@webstudio-is/sdk-components-react-radix 0.90.0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__generated__/accordion.props.js +6 -12
- package/lib/__generated__/checkbox.props.js +3 -6
- package/lib/__generated__/collapsible.props.js +4 -8
- package/lib/__generated__/dialog.props.js +8 -16
- package/lib/__generated__/label.props.js +2 -4
- package/lib/__generated__/navigation-menu.props.js +8 -16
- package/lib/__generated__/popover.props.js +4 -8
- package/lib/__generated__/radio-group.props.js +4 -8
- package/lib/__generated__/select.props.js +15 -19
- package/lib/__generated__/sheet.props.js +8 -16
- package/lib/__generated__/switch.props.js +3 -6
- package/lib/__generated__/tabs.props.js +5 -10
- package/lib/__generated__/tooltip.props.js +4 -8
- package/lib/accordion.js +7 -14
- package/{src/accordion.stories.tsx → lib/accordion.stories.js} +9 -12
- package/lib/accordion.ws.js +11 -22
- package/lib/checkbox.js +3 -6
- package/lib/checkbox.stories.js +19 -0
- package/lib/checkbox.ws.js +5 -10
- package/lib/collapsible.js +5 -10
- package/{src/collapsible.stories.tsx → lib/collapsible.stories.js} +9 -12
- package/lib/collapsible.ws.js +7 -14
- package/lib/components.js +13 -62
- package/lib/dialog.js +9 -18
- package/{src/dialog.stories.tsx → lib/dialog.stories.js} +9 -12
- package/lib/dialog.ws.js +17 -30
- package/lib/hooks.js +2 -4
- package/lib/label.js +2 -4
- package/lib/label.stories.js +19 -0
- package/lib/label.ws.js +3 -6
- package/lib/metas.js +55 -105
- package/lib/navigation-menu.js +9 -18
- package/{src/navigation-menu.stories.tsx → lib/navigation-menu.stories.js} +9 -12
- package/lib/navigation-menu.ws.js +16 -31
- package/lib/popover.js +5 -10
- package/{src/popover.stories.tsx → lib/popover.stories.js} +9 -12
- package/lib/popover.ws.js +7 -14
- package/lib/props-descriptions.js +2 -4
- package/lib/props.js +54 -103
- package/lib/radio-group.js +4 -8
- package/lib/radio-group.stories.js +19 -0
- package/lib/radio-group.ws.js +7 -14
- package/lib/select.js +10 -20
- package/{src/select.stories.tsx → lib/select.stories.js} +9 -12
- package/lib/select.ws.js +17 -34
- package/lib/sheet.js +9 -18
- package/{src/sheet.stories.tsx → lib/sheet.stories.js} +9 -12
- package/lib/sheet.ws.js +2 -4
- package/lib/switch.js +3 -6
- package/lib/switch.stories.js +19 -0
- package/lib/switch.ws.js +5 -10
- package/lib/tabs.js +6 -12
- package/{src/tabs.stories.tsx → lib/tabs.stories.js} +9 -12
- package/lib/tabs.ws.js +9 -18
- package/lib/theme/__generated__/tailwind-theme.js +517 -0
- package/lib/theme/styles.js +3 -6
- package/lib/theme/tailwind-classes.js +149 -301
- package/lib/theme/tailwind-colors.js +2 -4
- package/lib/tooltip.js +5 -10
- package/{src/tooltip.stories.tsx → lib/tooltip.stories.js} +9 -12
- package/lib/tooltip.ws.js +7 -14
- package/lib/types/__generated__/accordion.props.d.ts +1 -1
- package/lib/types/__generated__/checkbox.props.d.ts +1 -1
- package/lib/types/__generated__/collapsible.props.d.ts +1 -1
- package/lib/types/__generated__/dialog.props.d.ts +1 -1
- package/lib/types/__generated__/label.props.d.ts +1 -1
- package/lib/types/__generated__/navigation-menu.props.d.ts +1 -1
- package/lib/types/__generated__/popover.props.d.ts +1 -1
- package/lib/types/__generated__/radio-group.props.d.ts +1 -1
- package/lib/types/__generated__/select.props.d.ts +1 -1
- package/lib/types/__generated__/sheet.props.d.ts +1 -1
- package/lib/types/__generated__/switch.props.d.ts +1 -1
- package/lib/types/__generated__/tabs.props.d.ts +1 -1
- package/lib/types/__generated__/tooltip.props.d.ts +1 -1
- package/lib/types/accordion.d.ts +1 -1
- package/lib/types/sheet.d.ts +1 -1
- package/lib/types/theme/__generated__/tailwind-theme.d.ts +26 -0
- package/lib/types/theme/styles.d.ts +60 -60
- package/lib/types/theme/tailwind-classes.d.ts +33 -33
- package/package.json +20 -23
- package/lib/__generated__/button.props.js +0 -565
- package/lib/__generated__/input.props.js +0 -668
- package/lib/__generated__/textarea.props.js +0 -577
- package/lib/cjs/__generated__/accordion.props.js +0 -2645
- package/lib/cjs/__generated__/button.props.js +0 -585
- package/lib/cjs/__generated__/checkbox.props.js +0 -1103
- package/lib/cjs/__generated__/collapsible.props.js +0 -1050
- package/lib/cjs/__generated__/dialog.props.js +0 -2623
- package/lib/cjs/__generated__/input.props.js +0 -688
- package/lib/cjs/__generated__/label.props.js +0 -541
- package/lib/cjs/__generated__/navigation-menu.props.js +0 -2585
- package/lib/cjs/__generated__/popover.props.js +0 -582
- package/lib/cjs/__generated__/radio-group.props.js +0 -1647
- package/lib/cjs/__generated__/select.props.js +0 -3698
- package/lib/cjs/__generated__/sheet.props.js +0 -2642
- package/lib/cjs/__generated__/switch.props.js +0 -1103
- package/lib/cjs/__generated__/tabs.props.js +0 -2144
- package/lib/cjs/__generated__/textarea.props.js +0 -597
- package/lib/cjs/__generated__/tooltip.props.js +0 -593
- package/lib/cjs/accordion.js +0 -67
- package/lib/cjs/accordion.ws.js +0 -285
- package/lib/cjs/checkbox.js +0 -31
- package/lib/cjs/checkbox.ws.js +0 -174
- package/lib/cjs/collapsible.js +0 -53
- package/lib/cjs/collapsible.ws.js +0 -122
- package/lib/cjs/components.js +0 -82
- package/lib/cjs/dialog.js +0 -89
- package/lib/cjs/dialog.ws.js +0 -314
- package/lib/cjs/hooks.js +0 -43
- package/lib/cjs/label.js +0 -37
- package/lib/cjs/label.ws.js +0 -75
- package/lib/cjs/metas.js +0 -84
- package/lib/cjs/navigation-menu.js +0 -107
- package/lib/cjs/navigation-menu.ws.js +0 -514
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/popover.js +0 -90
- package/lib/cjs/popover.ws.js +0 -142
- package/lib/cjs/props-descriptions.js +0 -56
- package/lib/cjs/props.js +0 -82
- package/lib/cjs/radio-group.js +0 -30
- package/lib/cjs/radio-group.ws.js +0 -191
- package/lib/cjs/select.js +0 -83
- package/lib/cjs/select.ws.js +0 -350
- package/lib/cjs/sheet.js +0 -96
- package/lib/cjs/sheet.ws.js +0 -257
- package/lib/cjs/switch.js +0 -27
- package/lib/cjs/switch.ws.js +0 -173
- package/lib/cjs/tabs.js +0 -59
- package/lib/cjs/tabs.ws.js +0 -196
- package/lib/cjs/theme/radix-common-types.js +0 -16
- package/lib/cjs/theme/styles.js +0 -96
- package/lib/cjs/theme/tailwind-classes.js +0 -819
- package/lib/cjs/theme/tailwind-colors.js +0 -45
- package/lib/cjs/theme/tailwind-theme.js +0 -46
- package/lib/cjs/tooltip.js +0 -87
- package/lib/cjs/tooltip.ws.js +0 -143
- package/lib/theme/radix-common-types.js +0 -0
- package/lib/theme/tailwind-theme.js +0 -16
- package/lib/types/__generated__/button.props.d.ts +0 -2
- package/lib/types/__generated__/input.props.d.ts +0 -2
- package/lib/types/__generated__/textarea.props.d.ts +0 -2
- package/lib/types/theme/radix-common-types.d.ts +0 -85
- package/lib/types/theme/tailwind-theme.d.ts +0 -72
- package/src/__generated__/accordion.props.ts +0 -2949
- package/src/__generated__/button.props.ts +0 -635
- package/src/__generated__/checkbox.props.ts +0 -1217
- package/src/__generated__/collapsible.props.ts +0 -1156
- package/src/__generated__/dialog.props.ts +0 -2923
- package/src/__generated__/input.props.ts +0 -748
- package/src/__generated__/label.props.ts +0 -585
- package/src/__generated__/navigation-menu.props.ts +0 -2882
- package/src/__generated__/popover.props.ts +0 -626
- package/src/__generated__/radio-group.props.ts +0 -1828
- package/src/__generated__/select.props.ts +0 -4130
- package/src/__generated__/sheet.props.ts +0 -2942
- package/src/__generated__/switch.props.ts +0 -1217
- package/src/__generated__/tabs.props.ts +0 -2386
- package/src/__generated__/textarea.props.ts +0 -645
- package/src/__generated__/tooltip.props.ts +0 -639
- package/src/accordion.tsx +0 -88
- package/src/accordion.ws.ts +0 -296
- package/src/checkbox.stories.ts +0 -22
- package/src/checkbox.tsx +0 -22
- package/src/checkbox.ws.ts +0 -154
- package/src/collapsible.tsx +0 -62
- package/src/collapsible.ws.ts +0 -115
- package/src/components.ts +0 -50
- package/src/dialog.tsx +0 -92
- package/src/dialog.ws.tsx +0 -318
- package/src/hooks.ts +0 -22
- package/src/label.stories.ts +0 -22
- package/src/label.tsx +0 -15
- package/src/label.ws.ts +0 -50
- package/src/metas.ts +0 -74
- package/src/navigation-menu.tsx +0 -130
- package/src/navigation-menu.ws.ts +0 -524
- package/src/popover.tsx +0 -96
- package/src/popover.ws.tsx +0 -128
- package/src/props-descriptions.ts +0 -43
- package/src/props.ts +0 -73
- package/src/radio-group.stories.ts +0 -22
- package/src/radio-group.tsx +0 -17
- package/src/radio-group.ws.ts +0 -178
- package/src/select.tsx +0 -112
- package/src/select.ws.ts +0 -349
- package/src/sheet.tsx +0 -79
- package/src/sheet.ws.tsx +0 -236
- package/src/switch.stories.ts +0 -22
- package/src/switch.tsx +0 -10
- package/src/switch.ws.ts +0 -146
- package/src/tabs.tsx +0 -64
- package/src/tabs.ws.ts +0 -198
- package/src/theme/radix-common-types.ts +0 -496
- package/src/theme/styles.ts +0 -76
- package/src/theme/tailwind-classes.ts +0 -1026
- package/src/theme/tailwind-colors.ts +0 -39
- package/src/theme/tailwind-theme.ts +0 -24
- package/src/tooltip.tsx +0 -95
- package/src/tooltip.ws.tsx +0 -130
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
parseBoxShadow,
|
|
5
|
-
StyleValue
|
|
6
|
-
} from "@webstudio-is/css-data";
|
|
7
|
-
const property = (property2, value) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
import * as theme from "./__generated__/tailwind-theme";
|
|
3
|
+
export const property = (property2, value) => {
|
|
8
4
|
if (value.startsWith("--")) {
|
|
9
5
|
return {
|
|
10
6
|
property: property2,
|
|
@@ -17,7 +13,7 @@ const property = (property2, value) => {
|
|
|
17
13
|
};
|
|
18
14
|
};
|
|
19
15
|
const preflight = () => {
|
|
20
|
-
const borderColorValue =
|
|
16
|
+
const borderColorValue = theme.colors.border;
|
|
21
17
|
return [
|
|
22
18
|
{
|
|
23
19
|
property: "borderTopStyle",
|
|
@@ -53,89 +49,55 @@ const preflight = () => {
|
|
|
53
49
|
}
|
|
54
50
|
];
|
|
55
51
|
};
|
|
56
|
-
const z = (
|
|
57
|
-
const valueString = theme("zIndex")[zIndex ?? "auto"];
|
|
58
|
-
const value = parseCssValue("zIndex", valueString);
|
|
52
|
+
export const z = (value) => {
|
|
59
53
|
return [
|
|
60
54
|
{
|
|
61
55
|
property: "zIndex",
|
|
62
|
-
value
|
|
56
|
+
value: theme.zIndex[value]
|
|
63
57
|
}
|
|
64
58
|
];
|
|
65
59
|
};
|
|
66
|
-
const overflow = (value) => [
|
|
60
|
+
export const overflow = (value) => [
|
|
67
61
|
{
|
|
68
62
|
property: "overflow",
|
|
69
63
|
value: { type: "keyword", value }
|
|
70
64
|
}
|
|
71
65
|
];
|
|
72
|
-
const rounded = (
|
|
73
|
-
const
|
|
74
|
-
const value = parseCssValue("borderTopWidth", valueString);
|
|
66
|
+
export const rounded = (value = "DEFAULT") => {
|
|
67
|
+
const styleValue = theme.borderRadius[value];
|
|
75
68
|
return [
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
{
|
|
81
|
-
property: "borderTopRightRadius",
|
|
82
|
-
value
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
property: "borderBottomRightRadius",
|
|
86
|
-
value
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
property: "borderBottomLeftRadius",
|
|
90
|
-
value
|
|
91
|
-
}
|
|
69
|
+
{ property: "borderTopLeftRadius", value: styleValue },
|
|
70
|
+
{ property: "borderTopRightRadius", value: styleValue },
|
|
71
|
+
{ property: "borderBottomRightRadius", value: styleValue },
|
|
72
|
+
{ property: "borderBottomLeftRadius", value: styleValue }
|
|
92
73
|
];
|
|
93
74
|
};
|
|
94
|
-
const border = (borderWidthOrColor) => {
|
|
75
|
+
export const border = (borderWidthOrColor) => {
|
|
95
76
|
if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
|
|
96
|
-
const
|
|
97
|
-
const valueString = theme("borderWidth")?.[key] ?? "1px";
|
|
98
|
-
const value2 = parseCssValue("borderTopWidth", valueString);
|
|
77
|
+
const styleValue2 = theme.borderWidth[borderWidthOrColor ?? "DEFAULT"];
|
|
99
78
|
return [
|
|
100
79
|
...preflight(),
|
|
101
|
-
{ property: "borderTopWidth", value:
|
|
102
|
-
{ property: "borderRightWidth", value:
|
|
103
|
-
{ property: "borderBottomWidth", value:
|
|
104
|
-
{ property: "borderLeftWidth", value:
|
|
80
|
+
{ property: "borderTopWidth", value: styleValue2 },
|
|
81
|
+
{ property: "borderRightWidth", value: styleValue2 },
|
|
82
|
+
{ property: "borderBottomWidth", value: styleValue2 },
|
|
83
|
+
{ property: "borderLeftWidth", value: styleValue2 }
|
|
105
84
|
];
|
|
106
85
|
}
|
|
107
|
-
const
|
|
86
|
+
const styleValue = theme.colors[borderWidthOrColor];
|
|
108
87
|
return [
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
{
|
|
114
|
-
property: "borderRightColor",
|
|
115
|
-
value
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
property: "borderBottomColor",
|
|
119
|
-
value
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
property: "borderLeftColor",
|
|
123
|
-
value
|
|
124
|
-
}
|
|
88
|
+
{ property: "borderTopColor", value: styleValue },
|
|
89
|
+
{ property: "borderRightColor", value: styleValue },
|
|
90
|
+
{ property: "borderBottomColor", value: styleValue },
|
|
91
|
+
{ property: "borderLeftColor", value: styleValue }
|
|
125
92
|
];
|
|
126
93
|
};
|
|
127
|
-
const borderB = (borderWidthOrColor) => {
|
|
94
|
+
export const borderB = (borderWidthOrColor) => {
|
|
128
95
|
let widthValue = { type: "unit", value: 1, unit: "number" };
|
|
129
|
-
let colorValue =
|
|
130
|
-
"color",
|
|
131
|
-
theme("colors")["border"]
|
|
132
|
-
);
|
|
96
|
+
let colorValue = theme.colors.border;
|
|
133
97
|
if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
|
|
134
|
-
|
|
135
|
-
const valueString = theme("borderWidth")[key] ?? "1px";
|
|
136
|
-
widthValue = parseCssValue("borderTopWidth", valueString);
|
|
98
|
+
widthValue = theme.borderWidth[borderWidthOrColor ?? "DEFAULT"];
|
|
137
99
|
} else {
|
|
138
|
-
colorValue =
|
|
100
|
+
colorValue = theme.colors[borderWidthOrColor];
|
|
139
101
|
}
|
|
140
102
|
return [
|
|
141
103
|
{
|
|
@@ -153,121 +115,95 @@ const borderB = (borderWidthOrColor) => {
|
|
|
153
115
|
];
|
|
154
116
|
};
|
|
155
117
|
const paddingProperty = (property2) => (padding) => {
|
|
156
|
-
|
|
157
|
-
const valueString = theme("padding")?.[key] ?? "0";
|
|
158
|
-
const value = parseCssValue(property2, valueString);
|
|
159
|
-
return [{ property: property2, value }];
|
|
118
|
+
return [{ property: property2, value: theme.padding[padding] }];
|
|
160
119
|
};
|
|
161
|
-
const pt = (padding) => {
|
|
120
|
+
export const pt = (padding) => {
|
|
162
121
|
return paddingProperty("paddingTop")(padding);
|
|
163
122
|
};
|
|
164
|
-
const pb = (padding) => {
|
|
123
|
+
export const pb = (padding) => {
|
|
165
124
|
return paddingProperty("paddingBottom")(padding);
|
|
166
125
|
};
|
|
167
|
-
const pl = (padding) => {
|
|
126
|
+
export const pl = (padding) => {
|
|
168
127
|
return paddingProperty("paddingLeft")(padding);
|
|
169
128
|
};
|
|
170
|
-
const pr = (padding) => {
|
|
129
|
+
export const pr = (padding) => {
|
|
171
130
|
return paddingProperty("paddingRight")(padding);
|
|
172
131
|
};
|
|
173
|
-
const px = (padding) => {
|
|
132
|
+
export const px = (padding) => {
|
|
174
133
|
return [pl(padding), pr(padding)].flat();
|
|
175
134
|
};
|
|
176
|
-
const py = (padding) => {
|
|
135
|
+
export const py = (padding) => {
|
|
177
136
|
return [pt(padding), pb(padding)].flat();
|
|
178
137
|
};
|
|
179
|
-
const p = (padding) => {
|
|
138
|
+
export const p = (padding) => {
|
|
180
139
|
return [px(padding), py(padding)].flat();
|
|
181
140
|
};
|
|
182
141
|
const marginProperty = (property2) => (margin) => {
|
|
183
|
-
|
|
184
|
-
const valueString = theme("margin")?.[key] ?? "0";
|
|
185
|
-
const value = parseCssValue(property2, valueString);
|
|
186
|
-
return [{ property: property2, value }];
|
|
142
|
+
return [{ property: property2, value: theme.margin[margin] }];
|
|
187
143
|
};
|
|
188
|
-
const ml = (margin) => {
|
|
144
|
+
export const ml = (margin) => {
|
|
189
145
|
return marginProperty("marginLeft")(margin);
|
|
190
146
|
};
|
|
191
|
-
const mr = (margin) => {
|
|
147
|
+
export const mr = (margin) => {
|
|
192
148
|
return marginProperty("marginRight")(margin);
|
|
193
149
|
};
|
|
194
|
-
const mt = (margin) => {
|
|
150
|
+
export const mt = (margin) => {
|
|
195
151
|
return marginProperty("marginTop")(margin);
|
|
196
152
|
};
|
|
197
|
-
const mb = (margin) => {
|
|
153
|
+
export const mb = (margin) => {
|
|
198
154
|
return marginProperty("marginBottom")(margin);
|
|
199
155
|
};
|
|
200
|
-
const mx = (margin) => {
|
|
156
|
+
export const mx = (margin) => {
|
|
201
157
|
return [ml(margin), mr(margin)].flat();
|
|
202
158
|
};
|
|
203
|
-
const my = (margin) => {
|
|
159
|
+
export const my = (margin) => {
|
|
204
160
|
return [mt(margin), mb(margin)].flat();
|
|
205
161
|
};
|
|
206
|
-
const m = (margin) => {
|
|
162
|
+
export const m = (margin) => {
|
|
207
163
|
return [mx(margin), my(margin)].flat();
|
|
208
164
|
};
|
|
209
|
-
const w = (spacing) => {
|
|
210
|
-
|
|
211
|
-
const valueString = theme("width")?.[key] ?? "0";
|
|
212
|
-
const value = parseCssValue("width", valueString);
|
|
213
|
-
return [{ property: "width", value }];
|
|
165
|
+
export const w = (spacing) => {
|
|
166
|
+
return [{ property: "width", value: theme.width[spacing] }];
|
|
214
167
|
};
|
|
215
|
-
const h = (spacing) => {
|
|
216
|
-
|
|
217
|
-
const valueString = theme("height")?.[key] ?? "0";
|
|
218
|
-
const value = parseCssValue("height", valueString);
|
|
219
|
-
return [{ property: "height", value }];
|
|
168
|
+
export const h = (spacing) => {
|
|
169
|
+
return [{ property: "height", value: theme.height[spacing] }];
|
|
220
170
|
};
|
|
221
|
-
const minH = (spacing) => {
|
|
222
|
-
|
|
223
|
-
const valueString = theme("height")?.[key] ?? "0";
|
|
224
|
-
const value = parseCssValue("minHeight", valueString);
|
|
225
|
-
return [{ property: "minHeight", value }];
|
|
171
|
+
export const minH = (spacing) => {
|
|
172
|
+
return [{ property: "minHeight", value: theme.minHeight[spacing] }];
|
|
226
173
|
};
|
|
227
|
-
const opacity = (opacity2) => {
|
|
228
|
-
const key = `${opacity2}`;
|
|
229
|
-
const valueString = theme("opacity")?.[key] ?? "0";
|
|
230
|
-
const value = parseCssValue("opacity", valueString);
|
|
174
|
+
export const opacity = (opacity2) => {
|
|
231
175
|
return [
|
|
232
176
|
{
|
|
233
177
|
property: "opacity",
|
|
234
|
-
value
|
|
178
|
+
value: theme.opacity[opacity2]
|
|
235
179
|
}
|
|
236
180
|
];
|
|
237
181
|
};
|
|
238
|
-
const cursor = (cursor2) => {
|
|
239
|
-
const valueString = theme("cursor")?.[cursor2] ?? "auto";
|
|
240
|
-
const value = parseCssValue("cursor", valueString);
|
|
182
|
+
export const cursor = (cursor2) => {
|
|
241
183
|
return [
|
|
242
184
|
{
|
|
243
185
|
property: "cursor",
|
|
244
|
-
value
|
|
186
|
+
value: theme.cursor[cursor2]
|
|
245
187
|
}
|
|
246
188
|
];
|
|
247
189
|
};
|
|
248
|
-
const maxW = (spacing) => {
|
|
249
|
-
|
|
250
|
-
const valueString = theme("maxWidth")?.[key] ?? "0";
|
|
251
|
-
const value = parseCssValue("width", valueString);
|
|
252
|
-
return [{ property: "maxWidth", value }];
|
|
190
|
+
export const maxW = (spacing) => {
|
|
191
|
+
return [{ property: "maxWidth", value: theme.maxWidth[spacing] }];
|
|
253
192
|
};
|
|
254
193
|
const positionStyle = (property2, spacing) => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
const bottom = (spacing) => [positionStyle("bottom", spacing)];
|
|
263
|
-
const left = (spacing) => [positionStyle("left", spacing)];
|
|
264
|
-
const inset = (spacing) => [
|
|
194
|
+
return { property: property2, value: theme.inset[spacing] };
|
|
195
|
+
};
|
|
196
|
+
export const top = (spacing) => [positionStyle("top", spacing)];
|
|
197
|
+
export const right = (spacing) => [positionStyle("right", spacing)];
|
|
198
|
+
export const bottom = (spacing) => [positionStyle("bottom", spacing)];
|
|
199
|
+
export const left = (spacing) => [positionStyle("left", spacing)];
|
|
200
|
+
export const inset = (spacing) => [
|
|
265
201
|
positionStyle("left", spacing),
|
|
266
202
|
positionStyle("right", spacing),
|
|
267
203
|
positionStyle("top", spacing),
|
|
268
204
|
positionStyle("bottom", spacing)
|
|
269
205
|
];
|
|
270
|
-
const aspect = (value) => {
|
|
206
|
+
export const aspect = (value) => {
|
|
271
207
|
let unparsed = value;
|
|
272
208
|
if (value === "square") {
|
|
273
209
|
unparsed = "1 / 1";
|
|
@@ -282,20 +218,13 @@ const aspect = (value) => {
|
|
|
282
218
|
}
|
|
283
219
|
];
|
|
284
220
|
};
|
|
285
|
-
const backdropBlur = (blur) => {
|
|
286
|
-
|
|
287
|
-
const value = {
|
|
288
|
-
type: "unparsed",
|
|
289
|
-
value: `blur(${valueString})`
|
|
290
|
-
};
|
|
291
|
-
return [{ property: "backdropFilter", value }];
|
|
221
|
+
export const backdropBlur = (blur) => {
|
|
222
|
+
return [{ property: "backdropFilter", value: theme.blur[blur] }];
|
|
292
223
|
};
|
|
293
|
-
const list = (listStyle) => {
|
|
294
|
-
|
|
295
|
-
const value = parseCssValue("listStyleType", valueString);
|
|
296
|
-
return [{ property: "listStyleType", value }];
|
|
224
|
+
export const list = (listStyle) => {
|
|
225
|
+
return [{ property: "listStyleType", value: theme.listStyleType[listStyle] }];
|
|
297
226
|
};
|
|
298
|
-
const select = (
|
|
227
|
+
export const select = (_selectValue) => {
|
|
299
228
|
return [
|
|
300
229
|
{
|
|
301
230
|
property: "userSelect",
|
|
@@ -306,8 +235,8 @@ const select = (selectValue) => {
|
|
|
306
235
|
}
|
|
307
236
|
];
|
|
308
237
|
};
|
|
309
|
-
const bg = (color, alpha) => {
|
|
310
|
-
const value =
|
|
238
|
+
export const bg = (color, alpha) => {
|
|
239
|
+
const value = theme.colors[color];
|
|
311
240
|
if (alpha !== void 0 && value.type === "rgb") {
|
|
312
241
|
value.alpha = alpha / 100;
|
|
313
242
|
}
|
|
@@ -318,20 +247,20 @@ const bg = (color, alpha) => {
|
|
|
318
247
|
}
|
|
319
248
|
];
|
|
320
249
|
};
|
|
321
|
-
const fixed = () => {
|
|
250
|
+
export const fixed = () => {
|
|
322
251
|
return [{ property: "position", value: { type: "keyword", value: "fixed" } }];
|
|
323
252
|
};
|
|
324
|
-
const relative = () => {
|
|
253
|
+
export const relative = () => {
|
|
325
254
|
return [
|
|
326
255
|
{ property: "position", value: { type: "keyword", value: "relative" } }
|
|
327
256
|
];
|
|
328
257
|
};
|
|
329
|
-
const absolute = () => {
|
|
258
|
+
export const absolute = () => {
|
|
330
259
|
return [
|
|
331
260
|
{ property: "position", value: { type: "keyword", value: "absolute" } }
|
|
332
261
|
];
|
|
333
262
|
};
|
|
334
|
-
const grid = () => {
|
|
263
|
+
export const grid = () => {
|
|
335
264
|
return [{ property: "display", value: { type: "keyword", value: "grid" } }];
|
|
336
265
|
};
|
|
337
266
|
const alignItems = {
|
|
@@ -341,7 +270,7 @@ const alignItems = {
|
|
|
341
270
|
baseline: "baseline",
|
|
342
271
|
stretch: "stretch"
|
|
343
272
|
};
|
|
344
|
-
const items = (alignItemsParam) => {
|
|
273
|
+
export const items = (alignItemsParam) => {
|
|
345
274
|
return [
|
|
346
275
|
{
|
|
347
276
|
property: "alignItems",
|
|
@@ -361,7 +290,7 @@ const justifyContent = {
|
|
|
361
290
|
evenly: "space-evenly",
|
|
362
291
|
stretch: "stretch"
|
|
363
292
|
};
|
|
364
|
-
const justify = (justifyContentParam) => {
|
|
293
|
+
export const justify = (justifyContentParam) => {
|
|
365
294
|
return [
|
|
366
295
|
{
|
|
367
296
|
property: "justifyContent",
|
|
@@ -372,16 +301,16 @@ const justify = (justifyContentParam) => {
|
|
|
372
301
|
}
|
|
373
302
|
];
|
|
374
303
|
};
|
|
375
|
-
const inlineFlex = () => {
|
|
304
|
+
export const inlineFlex = () => {
|
|
376
305
|
return [
|
|
377
306
|
{ property: "display", value: { type: "keyword", value: "inline-flex" } }
|
|
378
307
|
];
|
|
379
308
|
};
|
|
380
|
-
const block = () => {
|
|
309
|
+
export const block = () => {
|
|
381
310
|
return [{ property: "display", value: { type: "keyword", value: "block" } }];
|
|
382
311
|
};
|
|
383
312
|
const flexDirection = { row: "row", col: "column" };
|
|
384
|
-
const flex = (flexParam) => {
|
|
313
|
+
export const flex = (flexParam) => {
|
|
385
314
|
if (flexParam === void 0) {
|
|
386
315
|
return [{ property: "display", value: { type: "keyword", value: "flex" } }];
|
|
387
316
|
}
|
|
@@ -459,7 +388,7 @@ const flex = (flexParam) => {
|
|
|
459
388
|
}
|
|
460
389
|
];
|
|
461
390
|
};
|
|
462
|
-
const grow = () => {
|
|
391
|
+
export const grow = () => {
|
|
463
392
|
return [
|
|
464
393
|
{
|
|
465
394
|
property: "flexGrow",
|
|
@@ -467,7 +396,7 @@ const grow = () => {
|
|
|
467
396
|
}
|
|
468
397
|
];
|
|
469
398
|
};
|
|
470
|
-
const shrink = (value) => {
|
|
399
|
+
export const shrink = (value) => {
|
|
471
400
|
return [
|
|
472
401
|
{
|
|
473
402
|
property: "flexGrow",
|
|
@@ -475,18 +404,14 @@ const shrink = (value) => {
|
|
|
475
404
|
}
|
|
476
405
|
];
|
|
477
406
|
};
|
|
478
|
-
const gap = (gapValue) => {
|
|
479
|
-
const
|
|
480
|
-
const valueString = theme("spacing")?.[key] ?? "0";
|
|
481
|
-
const value = parseCssValue("rowGap", valueString);
|
|
407
|
+
export const gap = (gapValue) => {
|
|
408
|
+
const value = theme.spacing[gapValue];
|
|
482
409
|
return [
|
|
483
410
|
{ property: "rowGap", value },
|
|
484
411
|
{ property: "columnGap", value }
|
|
485
412
|
];
|
|
486
413
|
};
|
|
487
|
-
const lineClamp = (lineClampValue) => {
|
|
488
|
-
const key = `${lineClampValue}`;
|
|
489
|
-
const valueString = theme("lineClamp")?.[key];
|
|
414
|
+
export const lineClamp = (lineClampValue) => {
|
|
490
415
|
return [
|
|
491
416
|
{
|
|
492
417
|
property: "overflow",
|
|
@@ -511,26 +436,19 @@ const lineClamp = (lineClampValue) => {
|
|
|
511
436
|
},
|
|
512
437
|
{
|
|
513
438
|
property: "-webkit-line-clamp",
|
|
514
|
-
value:
|
|
515
|
-
type: "keyword",
|
|
516
|
-
value: valueString
|
|
517
|
-
}
|
|
439
|
+
value: theme.lineClamp[lineClampValue]
|
|
518
440
|
}
|
|
519
441
|
];
|
|
520
442
|
};
|
|
521
|
-
const leading = (lineHeight) => {
|
|
522
|
-
|
|
523
|
-
const valueString = theme("lineHeight")[key];
|
|
524
|
-
const value = parseCssValue("lineHeight", valueString);
|
|
525
|
-
return [{ property: "lineHeight", value }];
|
|
443
|
+
export const leading = (lineHeight) => {
|
|
444
|
+
return [{ property: "lineHeight", value: theme.lineHeight[lineHeight] }];
|
|
526
445
|
};
|
|
527
|
-
const tracking = (letterSpacing) => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return [{ property: "letterSpacing", value }];
|
|
446
|
+
export const tracking = (letterSpacing) => {
|
|
447
|
+
return [
|
|
448
|
+
{ property: "letterSpacing", value: theme.letterSpacing[letterSpacing] }
|
|
449
|
+
];
|
|
532
450
|
};
|
|
533
|
-
const outline = (
|
|
451
|
+
export const outline = (_value) => {
|
|
534
452
|
return [
|
|
535
453
|
{
|
|
536
454
|
property: "outlineWidth",
|
|
@@ -550,42 +468,23 @@ const outline = (value) => {
|
|
|
550
468
|
}
|
|
551
469
|
];
|
|
552
470
|
};
|
|
553
|
-
const textSizes =
|
|
554
|
-
"sm",
|
|
555
|
-
"base",
|
|
556
|
-
"lg",
|
|
557
|
-
"xs",
|
|
558
|
-
"xl",
|
|
559
|
-
"2xl",
|
|
560
|
-
"3xl",
|
|
561
|
-
"4xl",
|
|
562
|
-
"5xl",
|
|
563
|
-
"6xl",
|
|
564
|
-
"7xl",
|
|
565
|
-
"8xl",
|
|
566
|
-
"9xl"
|
|
567
|
-
];
|
|
471
|
+
const textSizes = Object.keys(theme.fontSize);
|
|
568
472
|
const isTextSize = (value) => textSizes.includes(value);
|
|
569
|
-
const text = (sizeOrColor) => {
|
|
473
|
+
export const text = (sizeOrColor) => {
|
|
570
474
|
if (isTextSize(sizeOrColor)) {
|
|
571
|
-
const valueArr = theme("fontSize")[sizeOrColor];
|
|
572
|
-
const [fontSizeString, { lineHeight: lineHeightString }] = valueArr;
|
|
573
|
-
const fontSize = parseCssValue("fontSize", fontSizeString);
|
|
574
|
-
const lineHeight = parseCssValue("lineHeight", lineHeightString);
|
|
575
475
|
return [
|
|
576
|
-
{ property: "fontSize", value: fontSize },
|
|
577
|
-
{ property: "lineHeight", value:
|
|
476
|
+
{ property: "fontSize", value: theme.fontSize[sizeOrColor] },
|
|
477
|
+
{ property: "lineHeight", value: theme.fontSizeLineHeight[sizeOrColor] }
|
|
578
478
|
];
|
|
579
479
|
}
|
|
580
|
-
const value = parseCssValue("color", theme("colors")[sizeOrColor]);
|
|
581
480
|
return [
|
|
582
481
|
{
|
|
583
482
|
property: "color",
|
|
584
|
-
value
|
|
483
|
+
value: theme.colors[sizeOrColor]
|
|
585
484
|
}
|
|
586
485
|
];
|
|
587
486
|
};
|
|
588
|
-
const noUnderline = () => {
|
|
487
|
+
export const noUnderline = () => {
|
|
589
488
|
return [
|
|
590
489
|
{
|
|
591
490
|
property: "textDecorationLine",
|
|
@@ -593,7 +492,7 @@ const noUnderline = () => {
|
|
|
593
492
|
}
|
|
594
493
|
];
|
|
595
494
|
};
|
|
596
|
-
const underline = () => {
|
|
495
|
+
export const underline = () => {
|
|
597
496
|
return [
|
|
598
497
|
{
|
|
599
498
|
property: "textDecorationLine",
|
|
@@ -601,14 +500,11 @@ const underline = () => {
|
|
|
601
500
|
}
|
|
602
501
|
];
|
|
603
502
|
};
|
|
604
|
-
const underlineOffset = (offset) => {
|
|
605
|
-
const key = `${offset}`;
|
|
606
|
-
const valueString = theme("textUnderlineOffset")[key];
|
|
607
|
-
const value = parseCssValue("textUnderlineOffset", valueString);
|
|
503
|
+
export const underlineOffset = (offset) => {
|
|
608
504
|
return [
|
|
609
505
|
{
|
|
610
506
|
property: "textUnderlineOffset",
|
|
611
|
-
value
|
|
507
|
+
value: theme.textUnderlineOffset[offset]
|
|
612
508
|
}
|
|
613
509
|
];
|
|
614
510
|
};
|
|
@@ -623,7 +519,7 @@ const weights = {
|
|
|
623
519
|
extrabold: "800",
|
|
624
520
|
black: "900"
|
|
625
521
|
};
|
|
626
|
-
const font = (weight) => {
|
|
522
|
+
export const font = (weight) => {
|
|
627
523
|
return [
|
|
628
524
|
{
|
|
629
525
|
property: "fontWeight",
|
|
@@ -631,7 +527,7 @@ const font = (weight) => {
|
|
|
631
527
|
}
|
|
632
528
|
];
|
|
633
529
|
};
|
|
634
|
-
const whitespace = (value) => {
|
|
530
|
+
export const whitespace = (value) => {
|
|
635
531
|
return [
|
|
636
532
|
{
|
|
637
533
|
property: "whiteSpace",
|
|
@@ -639,37 +535,59 @@ const whitespace = (value) => {
|
|
|
639
535
|
}
|
|
640
536
|
];
|
|
641
537
|
};
|
|
642
|
-
const shadow = (shadowSize) => {
|
|
643
|
-
const valueString = theme("boxShadow")[shadowSize];
|
|
644
|
-
const value = parseBoxShadow(valueString);
|
|
538
|
+
export const shadow = (shadowSize) => {
|
|
645
539
|
return [
|
|
646
540
|
{
|
|
647
541
|
property: "boxShadow",
|
|
648
|
-
value
|
|
542
|
+
value: theme.boxShadow[shadowSize]
|
|
649
543
|
}
|
|
650
544
|
];
|
|
651
545
|
};
|
|
652
|
-
const ring = (ringColor, ringWidth, ringOffsetColor = "background", ringOffsetWidth = 0
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
const
|
|
656
|
-
const
|
|
657
|
-
const ringOffsetShadow =
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
546
|
+
export const ring = (ringColor, ringWidth, ringOffsetColor = "background", ringOffsetWidth = 0) => {
|
|
547
|
+
const ringWidthStyleValue = theme.ringWidth[ringWidth];
|
|
548
|
+
const ringOffsetWidthStyleValue = theme.ringOffsetWidth[ringOffsetWidth];
|
|
549
|
+
const ringColorStyleValue = theme.colors[ringColor];
|
|
550
|
+
const ringOffsetColorStyleValue = theme.colors[ringOffsetColor];
|
|
551
|
+
const ringOffsetShadow = {
|
|
552
|
+
type: "tuple",
|
|
553
|
+
value: [
|
|
554
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
555
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
556
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
557
|
+
ringOffsetWidthStyleValue,
|
|
558
|
+
ringOffsetColorStyleValue
|
|
559
|
+
]
|
|
560
|
+
};
|
|
561
|
+
const ringWidthValue = ringWidthStyleValue.type === "unit" ? ringWidthStyleValue.value : 0;
|
|
562
|
+
const ringOffsetWidthValue = ringOffsetWidthStyleValue.type === "unit" ? ringOffsetWidthStyleValue.value : 0;
|
|
563
|
+
const ringShadow = {
|
|
564
|
+
type: "tuple",
|
|
565
|
+
value: [
|
|
566
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
567
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
568
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
569
|
+
{
|
|
570
|
+
type: "unit",
|
|
571
|
+
value: ringWidthValue + ringOffsetWidthValue,
|
|
572
|
+
unit: ringWidthStyleValue.type === "unit" ? ringWidthStyleValue.unit : "number"
|
|
573
|
+
},
|
|
574
|
+
ringColorStyleValue
|
|
575
|
+
]
|
|
576
|
+
};
|
|
662
577
|
return [
|
|
663
578
|
{
|
|
664
579
|
property: "boxShadow",
|
|
665
|
-
value
|
|
580
|
+
value: {
|
|
581
|
+
type: "layers",
|
|
582
|
+
value: [ringOffsetShadow, ringShadow]
|
|
583
|
+
}
|
|
666
584
|
}
|
|
667
585
|
];
|
|
668
586
|
};
|
|
669
|
-
const pointerEvents = (value) => {
|
|
587
|
+
export const pointerEvents = (value) => {
|
|
670
588
|
return [{ property: "pointerEvents", value: { type: "keyword", value } }];
|
|
671
589
|
};
|
|
672
|
-
const transition = (value) => {
|
|
590
|
+
export const transition = (value) => {
|
|
673
591
|
if (value === "none") {
|
|
674
592
|
return [
|
|
675
593
|
{
|
|
@@ -693,7 +611,7 @@ const transition = (value) => {
|
|
|
693
611
|
}
|
|
694
612
|
];
|
|
695
613
|
};
|
|
696
|
-
const duration = (ms) => {
|
|
614
|
+
export const duration = (ms) => {
|
|
697
615
|
return [
|
|
698
616
|
{
|
|
699
617
|
property: "transitionDuration",
|
|
@@ -701,103 +619,33 @@ const duration = (ms) => {
|
|
|
701
619
|
}
|
|
702
620
|
];
|
|
703
621
|
};
|
|
704
|
-
const hover = (value) => {
|
|
622
|
+
export const hover = (value) => {
|
|
705
623
|
return value.map((decl) => ({
|
|
706
624
|
...decl,
|
|
707
625
|
state: ":hover"
|
|
708
626
|
}));
|
|
709
627
|
};
|
|
710
|
-
const focus = (value) => {
|
|
628
|
+
export const focus = (value) => {
|
|
711
629
|
return value.map((decl) => ({
|
|
712
630
|
...decl,
|
|
713
631
|
state: ":focus"
|
|
714
632
|
}));
|
|
715
633
|
};
|
|
716
|
-
const focusVisible = (value) => {
|
|
634
|
+
export const focusVisible = (value) => {
|
|
717
635
|
return value.map((decl) => ({
|
|
718
636
|
...decl,
|
|
719
637
|
state: ":focus-visible"
|
|
720
638
|
}));
|
|
721
639
|
};
|
|
722
|
-
const disabled = (value) => {
|
|
640
|
+
export const disabled = (value) => {
|
|
723
641
|
return value.map((decl) => ({
|
|
724
642
|
...decl,
|
|
725
643
|
state: ":disabled"
|
|
726
644
|
}));
|
|
727
645
|
};
|
|
728
|
-
const state = (value, state2) => {
|
|
646
|
+
export const state = (value, state2) => {
|
|
729
647
|
return value.map((decl) => ({
|
|
730
648
|
...decl,
|
|
731
649
|
state: state2
|
|
732
650
|
}));
|
|
733
651
|
};
|
|
734
|
-
export {
|
|
735
|
-
absolute,
|
|
736
|
-
aspect,
|
|
737
|
-
backdropBlur,
|
|
738
|
-
bg,
|
|
739
|
-
block,
|
|
740
|
-
border,
|
|
741
|
-
borderB,
|
|
742
|
-
bottom,
|
|
743
|
-
cursor,
|
|
744
|
-
disabled,
|
|
745
|
-
duration,
|
|
746
|
-
fixed,
|
|
747
|
-
flex,
|
|
748
|
-
focus,
|
|
749
|
-
focusVisible,
|
|
750
|
-
font,
|
|
751
|
-
gap,
|
|
752
|
-
grid,
|
|
753
|
-
grow,
|
|
754
|
-
h,
|
|
755
|
-
hover,
|
|
756
|
-
inlineFlex,
|
|
757
|
-
inset,
|
|
758
|
-
items,
|
|
759
|
-
justify,
|
|
760
|
-
leading,
|
|
761
|
-
left,
|
|
762
|
-
lineClamp,
|
|
763
|
-
list,
|
|
764
|
-
m,
|
|
765
|
-
maxW,
|
|
766
|
-
mb,
|
|
767
|
-
minH,
|
|
768
|
-
ml,
|
|
769
|
-
mr,
|
|
770
|
-
mt,
|
|
771
|
-
mx,
|
|
772
|
-
my,
|
|
773
|
-
noUnderline,
|
|
774
|
-
opacity,
|
|
775
|
-
outline,
|
|
776
|
-
overflow,
|
|
777
|
-
p,
|
|
778
|
-
pb,
|
|
779
|
-
pl,
|
|
780
|
-
pointerEvents,
|
|
781
|
-
pr,
|
|
782
|
-
property,
|
|
783
|
-
pt,
|
|
784
|
-
px,
|
|
785
|
-
py,
|
|
786
|
-
relative,
|
|
787
|
-
right,
|
|
788
|
-
ring,
|
|
789
|
-
rounded,
|
|
790
|
-
select,
|
|
791
|
-
shadow,
|
|
792
|
-
shrink,
|
|
793
|
-
state,
|
|
794
|
-
text,
|
|
795
|
-
top,
|
|
796
|
-
tracking,
|
|
797
|
-
transition,
|
|
798
|
-
underline,
|
|
799
|
-
underlineOffset,
|
|
800
|
-
w,
|
|
801
|
-
whitespace,
|
|
802
|
-
z
|
|
803
|
-
};
|