Skip to content

Commit b504327

Browse files
rivka-ungarclaude
andauthored
feat(style): remove deprecated semantic spacing tokens (#3320)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8885f48 commit b504327

File tree

94 files changed

+283
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+283
-253
lines changed

VIBE4_CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,12 +525,13 @@ Vibe 4 represents a major evolution of the design system, focusing on:
525525
- **Task**: [Monday.com Task](https://monday.monday.com/boards/10027056258/pulses/9713029006)
526526
- **PR**: TBD
527527

528-
#### Design Tokens
528+
#### Design Tokens — Spacing
529529

530-
- **Change**: TBD
531-
- **Reason**: TBD
532-
- **Migration**: TBD
533-
- **Codemod**: ❌ Manual
530+
- [x] **Status**: Complete
531+
- **Change**: Removed deprecated semantic spacing CSS custom properties (`--spacing-xs`, `--spacing-small`, `--spacing-medium`, `--spacing-large`, `--spacing-xl`, `--spacing-xxl`, `--spacing-xxxl`) from `@vibe/style`. All internal usages replaced with numeric spacing tokens (`--space-4`, `--space-8`, `--space-16`, `--space-24`, `--space-32`, `--space-48`, `--space-64`).
532+
- **Reason**: The numeric naming convention is more scalable, unambiguous, and consistent with modern design token practices. The semantic names (`small`, `medium`, `large`) don't scale beyond `xxxl` and create ambiguity about exact values.
533+
- **Migration**: Replace all usages of old spacing tokens with their numeric equivalents. Run `npx stylelint --fix "**/*.scss"` with `@vibe/style/use-new-spacing-tokens` rule enabled to auto-fix.
534+
- **Codemod**: ✅ Stylelint auto-fix via `@vibe/style/use-new-spacing-tokens` rule
534535
- **PR**: TBD
535536

536537
<!-- Add styling changes as they are identified -->

VIBE4_MIGRATION_GUIDE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,54 @@ const renderer: (item: VirtualizedGridItemType, index: number, style: CSSPropert
13141314

13151315
For component-specific migration details, see [VIBE4_CHANGELOG.md](./VIBE4_CHANGELOG.md).
13161316

1317+
---
1318+
1319+
## CSS Design Tokens
1320+
1321+
### Spacing Tokens
1322+
1323+
The deprecated semantic spacing CSS custom properties have been removed. Replace them with the numeric spacing tokens:
1324+
1325+
| Removed Token | Replacement |
1326+
|---|---|
1327+
| `--spacing-xs` | `--space-4` |
1328+
| `--spacing-small` | `--space-8` |
1329+
| `--spacing-medium` | `--space-16` |
1330+
| `--spacing-large` | `--space-24` |
1331+
| `--spacing-xl` | `--space-32` |
1332+
| `--spacing-xxl` | `--space-48` |
1333+
| `--spacing-xxxl` | `--space-64` |
1334+
1335+
**Before (v3)**
1336+
1337+
```scss
1338+
.my-component {
1339+
padding: var(--spacing-small) var(--spacing-medium);
1340+
margin-block-end: var(--spacing-large);
1341+
gap: var(--spacing-xs);
1342+
}
1343+
```
1344+
1345+
**After (v4)**
1346+
1347+
```scss
1348+
.my-component {
1349+
padding: var(--space-8) var(--space-16);
1350+
margin-block-end: var(--space-24);
1351+
gap: var(--space-4);
1352+
}
1353+
```
1354+
1355+
**Automated fix:** If you have the `@vibe/style` stylelint plugin configured, run:
1356+
1357+
```bash
1358+
npx stylelint --fix "**/*.scss"
1359+
```
1360+
1361+
The `@vibe/style/use-new-spacing-tokens` rule will automatically replace all legacy token references.
1362+
1363+
---
1364+
13171365
## Common Migration Patterns
13181366

13191367
### Prop Renames

packages/base/src/BaseInput/BaseInput.module.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
position: relative;
66
display: flex;
77
align-items: center;
8-
gap: var(--spacing-small);
9-
padding-block: var(--spacing-small);
10-
padding-inline: var(--space-12) var(--spacing-xs);
8+
gap: var(--space-8);
9+
padding-block: var(--space-8);
10+
padding-inline: var(--space-12) var(--space-4);
1111

1212
@include vibe-text(text1, normal);
1313
@include smoothing-text;
@@ -22,8 +22,8 @@
2222
&.small {
2323
min-height: 32px;
2424
height: 32px;
25-
padding-inline-start: var(--spacing-small);
26-
gap: var(--spacing-xs);
25+
padding-inline-start: var(--space-8);
26+
gap: var(--space-4);
2727
@include vibe-text(text2, normal);
2828
}
2929

@@ -35,11 +35,11 @@
3535
&.large {
3636
min-height: 48px;
3737
height: 48px;
38-
padding-block: var(--spacing-small);
38+
padding-block: var(--space-8);
3939
}
4040

4141
&.rightThinnerPadding {
42-
padding-inline-end: var(--spacing-medium);
42+
padding-inline-end: var(--space-16);
4343
}
4444

4545
&:hover {

packages/components/button/src/Button/Button.module.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ $disabled-on-primary-color-opacity: 0.5;
5656
}
5757

5858
.marginRight {
59-
margin-inline-end: var(--spacing-small);
59+
margin-inline-end: var(--space-8);
6060
}
6161

6262
.marginLeft {
63-
margin-inline-start: var(--spacing-small);
63+
margin-inline-start: var(--space-8);
6464
}
6565

6666
.rightFlat {
@@ -78,33 +78,33 @@ $disabled-on-primary-color-opacity: 0.5;
7878
}
7979

8080
.button .leftIcon {
81-
margin-inline-end: var(--spacing-small);
81+
margin-inline-end: var(--space-8);
8282
}
8383

8484
.button .rightIcon {
85-
margin-inline-start: var(--spacing-small);
85+
margin-inline-start: var(--space-8);
8686
}
8787

8888
.sizeXxs {
8989
@include smoothing-text;
9090
@include vibe-text(text2, normal);
91-
padding: 2px var(--spacing-xs);
91+
padding: 2px var(--space-4);
9292
height: 16px;
9393
line-height: 16px;
9494
}
9595

9696
.sizeXs {
9797
@include smoothing-text;
9898
@include vibe-text(text2, normal);
99-
padding: var(--spacing-xs) var(--spacing-small);
99+
padding: var(--space-4) var(--space-8);
100100
height: 24px;
101101
line-height: 21px;
102102
}
103103

104104
.sizeSmall {
105105
@include smoothing-text;
106106
@include vibe-text(text2, normal);
107-
padding: var(--spacing-xs) var(--spacing-small);
107+
padding: var(--space-4) var(--space-8);
108108
height: 32px;
109109
line-height: 24px;
110110
}
@@ -116,14 +116,14 @@ $disabled-on-primary-color-opacity: 0.5;
116116
.sizeMedium {
117117
@include smoothing-text;
118118
@include vibe-text(text1, normal);
119-
padding: var(--spacing-small) var(--spacing-medium);
119+
padding: var(--space-8) var(--space-16);
120120
height: 40px;
121121
}
122122

123123
.sizeLarge {
124124
@include smoothing-text;
125125
@include vibe-text(text1, normal);
126-
padding: 12px var(--spacing-large);
126+
padding: 12px var(--space-24);
127127
height: 48px;
128128
}
129129

packages/components/dialog/src/DialogContentContainer/DialogContentContainer.module.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
}
44

55
.sizeSmall {
6-
padding: var(--spacing-small);
6+
padding: var(--space-8);
77
}
88

99
.sizeMedium {
10-
padding: var(--spacing-medium);
10+
padding: var(--space-16);
1111
}
1212

1313
.sizeLarge {
14-
padding: var(--spacing-large);
14+
padding: var(--space-24);
1515
}
1616

1717
.typePopover {

packages/components/layout/src/Box/_utilities.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
/* stylelint-disable scss/at-if-no-null */
77
$utility-spacing-vars: (
88
0: 0,
9-
xs: var(--spacing-xs),
10-
small: var(--spacing-small),
11-
medium: var(--spacing-medium),
12-
large: var(--spacing-large),
13-
xl: var(--spacing-xl),
14-
xxl: var(--spacing-xxl),
15-
xxxl: var(--spacing-xxxl)
9+
xs: var(--space-4),
10+
small: var(--space-8),
11+
medium: var(--space-16),
12+
large: var(--space-24),
13+
xl: var(--space-32),
14+
xxl: var(--space-48),
15+
xxxl: var(--space-64)
1616
);
1717

1818
$utility-border-colors-vars: (

packages/components/layout/src/Flex/Flex.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ const Flex = forwardRef(
9898
if (typeof gap === "number") {
9999
return { gap: `${gap}px` };
100100
}
101-
return { gap: `var(--spacing-${gap})` };
101+
const gapTokenMap: Record<string, string> = {
102+
xs: "var(--space-4)",
103+
small: "var(--space-8)",
104+
medium: "var(--space-16)",
105+
large: "var(--space-24)"
106+
};
107+
return { gap: gapTokenMap[gap] };
102108
}, [gap]);
103109

104110
const flexStyle = useMemo(() => {

packages/components/layout/src/Flex/__tests__/__snapshots__/Flex.snapshot.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ exports[`Flex renders correctly > Horizontal display > with gap 1`] = `
121121
className="container directionRow justifyStart alignCenter"
122122
style={
123123
{
124-
"gap": "var(--spacing-large)",
124+
"gap": "var(--space-24)",
125125
}
126126
}
127127
>

packages/components/tooltip/src/Tooltip/Tooltip.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
.content {
3434
word-break: break-word;
3535
display: inline-block;
36-
padding: var(--tooltip-padding, #{var(--spacing-small) var(--spacing-medium)});
36+
padding: var(--tooltip-padding, #{var(--space-8) var(--space-16)});
3737
}
3838
}
3939

4040
.tooltip.paddingSizeMd {
4141
border-radius: var(--border-radius-medium);
42-
padding: var(--spacing-medium);
42+
padding: var(--space-16);
4343
@include vibe-text(text2, normal);
4444
}
4545

packages/components/typography/src/Text/Text.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ p:first-of-type.text {
77
}
88

99
p.text + p {
10-
margin-block-start: var(--spacing-large);
10+
margin-block-start: var(--space-24);
1111
margin-block-end: 0;
1212
}
1313

0 commit comments

Comments
 (0)