Skip to content

Commit 3fc0d3a

Browse files
committed
refactor theme and sprinkles
1 parent 52cd4af commit 3fc0d3a

File tree

20 files changed

+398
-404
lines changed

20 files changed

+398
-404
lines changed

packages/bento-design-system/src/Chip/Chip.css.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export const chipRecipe = strictRecipe({
2020

2121
export const maxWidth = createVar();
2222

23-
export const ellipsedLabel = style({
24-
overflow: "hidden",
25-
textOverflow: "ellipsis",
26-
whiteSpace: "nowrap",
27-
maxWidth: maxWidth,
28-
});
23+
export const ellipsedLabel = style([
24+
{ maxWidth: maxWidth },
25+
bentoSprinkles({
26+
overflow: "hidden",
27+
textOverflow: "ellipsis",
28+
whiteSpace: "nowrap",
29+
}),
30+
]);

packages/bento-design-system/src/Field/Field.css.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { createVar } from "@vanilla-extract/css";
22
import { bentoSprinkles } from "../internal/sprinkles.css";
33
import { strictRecipe } from "../util/strictRecipe";
44
import { vars } from "../vars.css";
5+
import { statusProperties } from "../util/atoms";
56

67
export const readOnlyBackground = createVar();
78

@@ -46,7 +47,7 @@ export const inputRecipe = strictRecipe({
4647
{
4748
selectors: {
4849
[`&:focus-within${notDisabled}`]: {
49-
boxShadow: vars.boxShadow.outlineInputFocus,
50+
boxShadow: statusProperties.boxShadow.outlineInputFocus,
5051
},
5152
},
5253
},
@@ -61,7 +62,7 @@ export const inputRecipe = strictRecipe({
6162
{
6263
selectors: {
6364
[`&:focus-within${notDisabled}`]: {
64-
boxShadow: vars.boxShadow.outlineNegativeStrong,
65+
boxShadow: statusProperties.boxShadow.outlineNegativeStrong,
6566
},
6667
},
6768
},

packages/bento-design-system/src/Icons/Icon.css.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import { style } from "@vanilla-extract/css";
21
import { recipe } from "@vanilla-extract/recipes";
32
import { bentoSprinkles } from "../internal";
43

54
export const iconRecipe = recipe({
65
variants: {
76
width: {
87
8: bentoSprinkles({ width: 8 }),
9-
12: style({ width: "12px" }),
8+
12: bentoSprinkles({ width: 12 }),
109
16: bentoSprinkles({ width: 16 }),
1110
24: bentoSprinkles({ width: 24 }),
1211
40: bentoSprinkles({ width: 40 }),
1312
},
1413
height: {
1514
8: bentoSprinkles({ height: 8 }),
16-
12: style({ height: "12px" }),
15+
12: bentoSprinkles({ height: 12 }),
1716
16: bentoSprinkles({ height: 16 }),
1817
24: bentoSprinkles({ height: 24 }),
1918
40: bentoSprinkles({ height: 40 }),

packages/bento-design-system/src/Icons/IconProps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BentoSprinkles } from "../internal";
22

33
export type IconProps = {
4-
size: Extract<BentoSprinkles["width"], 8 | 16 | 24 | 40> | 12;
4+
size: Extract<BentoSprinkles["width"], 8 | 12 | 16 | 24 | 40>;
55
color?:
66
| "default"
77
| "primary"

packages/bento-design-system/src/Modal/Modal.css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ export const underlay = bentoSprinkles({
3535
background: "backgroundDarkScrim",
3636
});
3737

38-
export const modalBody = style({
38+
export const modalBody = bentoSprinkles({
3939
overflowY: "auto",
4040
});

packages/bento-design-system/src/RadioGroupField/Radio.css.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { bentoSprinkles } from "../internal";
33
import { strictRecipe } from "../util/strictRecipe";
44
import { vars } from "../vars.css";
55
import { radioOption } from "./RadioGroupField.css";
6+
import { statusProperties } from "../util/atoms";
67

78
export const outerRadioCircleRecipe = strictRecipe({
89
base: bentoSprinkles({
@@ -21,10 +22,10 @@ export const outerRadioCircleRecipe = strictRecipe({
2122
{
2223
selectors: {
2324
[`${radioOption}:hover:not([disabled]) &`]: {
24-
boxShadow: vars.boxShadow.outlineInputHover,
25+
boxShadow: statusProperties.boxShadow.outlineInputHover,
2526
},
2627
[`${radioOption}[disabled] &`]: {
27-
boxShadow: vars.boxShadow.outlineInputDisabled,
28+
boxShadow: statusProperties.boxShadow.outlineInputDisabled,
2829
},
2930
},
3031
},

packages/bento-design-system/src/SelectField/SelectField.css.ts

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { style } from "@vanilla-extract/css";
22
import { bentoSprinkles } from "../internal";
33
import { strictRecipe } from "../util/strictRecipe";
4-
import { vars } from "../vars.css";
54

65
export const control = strictRecipe({
76
base: [
@@ -60,25 +59,23 @@ export const control = strictRecipe({
6059
],
6160
});
6261

63-
export const singleValue = style({
64-
gridArea: "1/1/2/3",
65-
textOverflow: "ellipsis",
66-
overflow: "hidden",
67-
whiteSpace: "nowrap",
68-
});
69-
70-
export const placeholder = style({ gridArea: "1/1/2/3" });
71-
72-
export const menu = style([
73-
{
74-
marginTop: vars.space[4],
75-
overflow: "hidden",
76-
},
62+
export const singleValue = style([
7763
bentoSprinkles({
78-
background: "backgroundPrimary",
64+
textOverflow: "ellipsis",
65+
overflow: "hidden",
66+
whiteSpace: "nowrap",
7967
}),
68+
{ gridArea: "1/1/2/3" },
8069
]);
8170

71+
export const placeholder = style({ gridArea: "1/1/2/3" });
72+
73+
export const menu = bentoSprinkles({
74+
marginTop: 4,
75+
background: "backgroundPrimary",
76+
overflow: "hidden",
77+
});
78+
8279
export const optionRecipe = strictRecipe({
8380
base: bentoSprinkles({
8481
cursor: { default: "pointer", disabled: "notAllowed" },

packages/bento-design-system/src/Slider/Slider.css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const slider = style({
88
// so their labels don't contribute to the vertical space, causing them to overlap with elements
99
// below the Slider.
1010
// This takes into account the height the label + the space between the label and the thumb
11-
paddingBottom: `calc(${vars.lineHeight.bodyMedium} + ${vars.space[8]})`,
11+
paddingBottom: `calc(${vars.typography.body.sizes.medium.lineHeight} + 8)`,
1212
});
1313

1414
export const trackContainer = bentoSprinkles({

packages/bento-design-system/src/Switch/Switch.css.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { vars } from "../vars.css";
33
import { bentoSprinkles } from "../internal";
44
import { strictRecipe } from "../util/strictRecipe";
55
import { extendedHitAreaRecipe } from "../util/extendedHitArea.css";
6+
import { statusProperties } from "../util/atoms";
67

78
export const switchContainer = style([
89
{ position: "relative", zIndex: "1" },
@@ -34,7 +35,7 @@ export const switchOuterRecipe = strictRecipe({
3435
{
3536
selectors: {
3637
[`${switchContainer}:hover:not([disabled]) &`]: {
37-
boxShadow: vars.boxShadow.outlineInputHover,
38+
boxShadow: statusProperties.boxShadow.outlineInputHover,
3839
},
3940
},
4041
},

packages/bento-design-system/src/Table/Table.css.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import { bentoSprinkles } from "../internal";
33
import { strictRecipe } from "../util/strictRecipe";
44
import { vars } from "../vars.css";
55

6-
export const table = style({
7-
gridAutoRows: "max-content",
8-
// NOTE(gabro): this is to avoid the internal z-indexes to "leak" out of the Table
9-
isolation: "isolate",
10-
});
6+
export const table = style([
7+
{
8+
gridAutoRows: "max-content",
9+
},
10+
bentoSprinkles({
11+
// NOTE(gabro): this is to avoid the internal z-indexes to "leak" out of the Table
12+
isolation: "isolate",
13+
}),
14+
]);
1115

1216
export const lastLeftStickyColumn = strictRecipe({
1317
variants: {

packages/bento-design-system/src/Typography/Body/Body.css.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { bentoSprinkles } from "../../internal/sprinkles.css";
33
import { ellipsis } from "../typography.css";
44

55
export const bodyRecipe = strictRecipe({
6-
base: bentoSprinkles({ fontFamily: "default" }),
6+
base: bentoSprinkles({ fontFamily: "body" }),
77
variants: {
88
size: {
9-
small: bentoSprinkles({ fontSize: "bodySmall", lineHeight: "bodySmall", letterSpacing: 1 }),
9+
small: bentoSprinkles({ fontSize: "bodySmall", lineHeight: "bodySmall" }),
1010
medium: bentoSprinkles({ fontSize: "bodyMedium", lineHeight: "bodyMedium" }),
1111
large: bentoSprinkles({ fontSize: "bodyLarge", lineHeight: "bodyLarge" }),
1212
},

packages/bento-design-system/src/Typography/Body/Body.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ export function Body({
1717
as = "span",
1818
}: Props) {
1919
return (
20-
<Box
21-
as={as}
22-
className={bodyRecipe({ weight, size, color, ellipsis })}
23-
textAlign={align}
24-
fontFamily="default"
25-
>
20+
<Box as={as} className={bodyRecipe({ weight, size, color, ellipsis })} textAlign={align}>
2621
{children}
2722
</Box>
2823
);

packages/bento-design-system/src/Typography/Display/Display.css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bentoSprinkles } from "../../internal";
33
import { ellipsis } from "../typography.css";
44

55
export const displayRecipe = strictRecipe({
6-
base: bentoSprinkles({ fontFamily: "default", fontWeight: "display", color: "textPrimary" }),
6+
base: bentoSprinkles({ fontFamily: "display", fontWeight: "display", color: "textPrimary" }),
77
variants: {
88
size: {
99
small: bentoSprinkles({ fontSize: "displaySmall", lineHeight: "displaySmall" }),

packages/bento-design-system/src/Typography/Headline/Headline.css.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { bentoSprinkles } from "../../internal";
33
import { ellipsis } from "../typography.css";
44

55
export const headlineRecipe = strictRecipe({
6-
base: bentoSprinkles({ fontFamily: "default", fontWeight: "headline", color: "textPrimary" }),
6+
base: bentoSprinkles({ fontFamily: "headline", fontWeight: "headline", color: "textPrimary" }),
77
variants: {
88
size: {
99
small: bentoSprinkles({ fontSize: "headlineSmall", lineHeight: "headlineSmall" }),

packages/bento-design-system/src/Typography/Label/Label.css.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@ import { bentoSprinkles } from "../../internal/sprinkles.css";
33
import { ellipsis } from "../typography.css";
44

55
export const labelRecipe = strictRecipe({
6-
base: bentoSprinkles({ fontFamily: "default", fontWeight: "label" }),
6+
base: bentoSprinkles({ fontFamily: "label", fontWeight: "label" }),
77
variants: {
88
size: {
99
small: bentoSprinkles({
1010
fontSize: "labelSmall",
1111
lineHeight: "labelSmall",
12-
letterSpacing: 1,
1312
}),
1413
medium: bentoSprinkles({
1514
fontSize: "labelMedium",
1615
lineHeight: "labelMedium",
17-
letterSpacing: 1,
1816
}),
1917
large: bentoSprinkles({
2018
fontSize: "labelLarge",
2119
lineHeight: "labelLarge",
22-
letterSpacing: 2,
2320
}),
2421
},
2522
color: {

packages/bento-design-system/src/Typography/Title/Title.css.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { bentoSprinkles } from "../../internal/sprinkles.css";
33
import { ellipsis } from "../typography.css";
44

55
export const titleRecipe = strictRecipe({
6-
base: bentoSprinkles({ fontFamily: "default", fontWeight: "title" }),
6+
base: bentoSprinkles({ fontFamily: "title", fontWeight: "title" }),
77
variants: {
88
size: {
99
small: bentoSprinkles({
1010
fontSize: "titleSmall",
1111
lineHeight: "titleSmall",
12-
letterSpacing: 1,
1312
}),
1413
medium: bentoSprinkles({ fontSize: "titleMedium", lineHeight: "titleMedium" }),
1514
large: bentoSprinkles({ fontSize: "titleLarge", lineHeight: "titleLarge" }),

0 commit comments

Comments
 (0)