@vygruppen/spor-react 13.3.2 → 13.4.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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +12 -0
- package/__tests__/radio.test.tsx +69 -0
- package/dist/index.cjs +233 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -4
- package/dist/index.d.ts +56 -4
- package/dist/index.mjs +234 -116
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -2
- package/setupTests.ts +84 -0
- package/src/input/Combobox.tsx +1 -0
- package/src/input/CountryCodeSelect.tsx +1 -0
- package/src/input/Field.tsx +8 -6
- package/src/input/FloatingLabel.tsx +2 -13
- package/src/input/Input.tsx +32 -15
- package/src/input/Label.tsx +2 -3
- package/src/input/PasswordInput.tsx +3 -1
- package/src/input/PhoneNumberInput.tsx +3 -1
- package/src/input/SearchInput.tsx +14 -3
- package/src/input/Select.tsx +23 -33
- package/src/theme/recipes/input.ts +15 -4
- package/src/theme/slot-recipes/anatomy.ts +1 -3
- package/src/theme/slot-recipes/breadcrumb.ts +0 -1
- package/src/theme/slot-recipes/field.ts +38 -4
- package/src/theme/slot-recipes/native-select.ts +15 -0
- package/src/theme/slot-recipes/select.ts +88 -35
- package/vitest.config.ts +12 -0
|
@@ -14,17 +14,15 @@ export const fieldSlotRecipe = defineSlotRecipe({
|
|
|
14
14
|
},
|
|
15
15
|
requiredIndicator: {
|
|
16
16
|
marginStart: 1,
|
|
17
|
-
|
|
18
|
-
color: "brightRed",
|
|
17
|
+
color: "outline.error",
|
|
19
18
|
},
|
|
20
19
|
label: {
|
|
21
20
|
display: "flex",
|
|
22
21
|
},
|
|
23
22
|
helperText: {
|
|
24
|
-
marginTop: 2,
|
|
25
23
|
color: "text.subtle",
|
|
26
24
|
lineHeight: "normal",
|
|
27
|
-
fontSize: "sm",
|
|
25
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
|
28
26
|
},
|
|
29
27
|
errorText: {
|
|
30
28
|
borderRadius: "xs",
|
|
@@ -52,4 +50,40 @@ export const fieldSlotRecipe = defineSlotRecipe({
|
|
|
52
50
|
},
|
|
53
51
|
},
|
|
54
52
|
},
|
|
53
|
+
variants: {
|
|
54
|
+
size: {
|
|
55
|
+
sm: {
|
|
56
|
+
label: {
|
|
57
|
+
fontSize: ["mobile.xs", "desktop.xs"],
|
|
58
|
+
paddingX: 2,
|
|
59
|
+
|
|
60
|
+
"&[data-float]": {
|
|
61
|
+
fontSize: ["mobile.2xs", "desktop.2xs"],
|
|
62
|
+
top: 0,
|
|
63
|
+
},
|
|
64
|
+
top: "0.5rem",
|
|
65
|
+
},
|
|
66
|
+
helperText: {
|
|
67
|
+
color: "text.subtle",
|
|
68
|
+
lineHeight: "normal",
|
|
69
|
+
fontSize: ["mobile.xs", "desktop.xs"],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
md: {
|
|
73
|
+
label: {
|
|
74
|
+
paddingX: 3,
|
|
75
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
|
76
|
+
"&[data-float]": {
|
|
77
|
+
fontSize: ["mobile.2xs", "desktop.2xs"],
|
|
78
|
+
color: "text.subtle",
|
|
79
|
+
top: "0.3rem",
|
|
80
|
+
},
|
|
81
|
+
top: "0.9rem",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
defaultVariants: {
|
|
87
|
+
size: "md",
|
|
88
|
+
},
|
|
55
89
|
});
|
|
@@ -55,5 +55,20 @@ export const nativeSelectSlotRecipe = defineSlotRecipe({
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
|
+
size: {
|
|
59
|
+
sm: {
|
|
60
|
+
field: {
|
|
61
|
+
...inputRecipe.variants?.size?.sm,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
md: {
|
|
65
|
+
field: {
|
|
66
|
+
...inputRecipe.variants?.size?.md,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
defaultVariants: {
|
|
72
|
+
size: "md",
|
|
58
73
|
},
|
|
59
74
|
});
|
|
@@ -16,15 +16,9 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
16
16
|
label: {
|
|
17
17
|
fontSize: ["mobile.sm", "desktop.sm"],
|
|
18
18
|
top: 0,
|
|
19
|
-
left: 3,
|
|
20
19
|
zIndex: 0,
|
|
21
20
|
position: "absolute",
|
|
22
21
|
color: "text",
|
|
23
|
-
marginY: 2,
|
|
24
|
-
|
|
25
|
-
_selected: {
|
|
26
|
-
transform: ["scale(0.825) translateY(-10px)"],
|
|
27
|
-
},
|
|
28
22
|
|
|
29
23
|
transitionProperty: "transform",
|
|
30
24
|
transitionDuration: "fast",
|
|
@@ -36,14 +30,10 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
36
30
|
display: "flex",
|
|
37
31
|
appearance: "none",
|
|
38
32
|
width: "100%",
|
|
39
|
-
height: 8,
|
|
40
33
|
color: "text",
|
|
41
|
-
paddingY: 1.5,
|
|
42
|
-
paddingX: 3,
|
|
43
34
|
|
|
44
35
|
justifyContent: "space-between",
|
|
45
36
|
alignItems: "center",
|
|
46
|
-
fontSize: "mobile.md",
|
|
47
37
|
borderRadius: "sm",
|
|
48
38
|
cursor: "pointer",
|
|
49
39
|
|
|
@@ -52,11 +42,14 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
52
42
|
transform: "rotate(180deg)",
|
|
53
43
|
},
|
|
54
44
|
},
|
|
45
|
+
_active: {
|
|
46
|
+
backgroundColor: "surface",
|
|
47
|
+
},
|
|
55
48
|
},
|
|
56
49
|
indicatorGroup: {
|
|
57
50
|
display: "flex",
|
|
58
51
|
alignItems: "center",
|
|
59
|
-
gap: "
|
|
52
|
+
gap: "0.5",
|
|
60
53
|
position: "absolute",
|
|
61
54
|
right: "0",
|
|
62
55
|
top: "0",
|
|
@@ -64,22 +57,22 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
64
57
|
paddingX: 2,
|
|
65
58
|
|
|
66
59
|
pointerEvents: "none",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
"& [data-part='indicator']": {
|
|
61
|
+
display: "flex",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
color: {
|
|
65
|
+
base: "text",
|
|
66
|
+
_disabled: "text.disabled",
|
|
67
|
+
_invalid: "text.highlight",
|
|
68
|
+
},
|
|
69
|
+
_icon: {
|
|
70
|
+
width: 3,
|
|
71
|
+
height: 3,
|
|
72
|
+
},
|
|
80
73
|
},
|
|
81
74
|
},
|
|
82
|
-
|
|
75
|
+
content: {
|
|
83
76
|
backgroundColor: "surface",
|
|
84
77
|
boxShadow: "sm",
|
|
85
78
|
overflowY: "auto",
|
|
@@ -134,8 +127,6 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
134
127
|
},
|
|
135
128
|
_hover: {
|
|
136
129
|
backgroundColor: "surface.accent.hover",
|
|
137
|
-
outline: "2px solid core.outline",
|
|
138
|
-
outlineOffset: "2px",
|
|
139
130
|
},
|
|
140
131
|
_selected: {
|
|
141
132
|
backgroundColor: "surface.accent",
|
|
@@ -144,6 +135,10 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
144
135
|
width: 3,
|
|
145
136
|
height: 3,
|
|
146
137
|
},
|
|
138
|
+
"& [data-part='item-description']": {
|
|
139
|
+
fontSize: ["mobile.xs", "desktop.xs"],
|
|
140
|
+
color: "text.ghost",
|
|
141
|
+
},
|
|
147
142
|
},
|
|
148
143
|
control: {
|
|
149
144
|
position: "relative",
|
|
@@ -162,6 +157,7 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
162
157
|
},
|
|
163
158
|
itemText: {
|
|
164
159
|
flex: "1",
|
|
160
|
+
alignItems: "center",
|
|
165
161
|
},
|
|
166
162
|
itemGroup: {
|
|
167
163
|
_first: { mt: "0" },
|
|
@@ -170,14 +166,6 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
170
166
|
py: "1",
|
|
171
167
|
fontWeight: "medium",
|
|
172
168
|
},
|
|
173
|
-
valueText: {},
|
|
174
|
-
itemDescription: {
|
|
175
|
-
fontSize: ["mobile.xs", "desktop.xs"],
|
|
176
|
-
color: "text.ghost",
|
|
177
|
-
"[aria-selected='true'] &": {
|
|
178
|
-
color: "text.ghost",
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
169
|
},
|
|
182
170
|
variants: {
|
|
183
171
|
variant: {
|
|
@@ -198,6 +186,10 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
198
186
|
backgroundColor: "surface.disabled",
|
|
199
187
|
},
|
|
200
188
|
},
|
|
189
|
+
content: {
|
|
190
|
+
outline: "2px solid",
|
|
191
|
+
outlineColor: "outline.core",
|
|
192
|
+
},
|
|
201
193
|
},
|
|
202
194
|
floating: {
|
|
203
195
|
control: {
|
|
@@ -242,5 +234,66 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
|
242
234
|
},
|
|
243
235
|
},
|
|
244
236
|
},
|
|
237
|
+
size: {
|
|
238
|
+
sm: {
|
|
239
|
+
trigger: {
|
|
240
|
+
height: 7,
|
|
241
|
+
paddingY: 1.5,
|
|
242
|
+
fontSize: "xs",
|
|
243
|
+
paddingX: 2,
|
|
244
|
+
},
|
|
245
|
+
label: {
|
|
246
|
+
fontSize: ["mobile.xs", "desktop.xs"],
|
|
247
|
+
left: 2,
|
|
248
|
+
marginY: 1.5,
|
|
249
|
+
_selected: {
|
|
250
|
+
transform: ["scale(0.85) translateY(-9px)"],
|
|
251
|
+
fontSize: "desktop.2xs",
|
|
252
|
+
color: "text.subtle",
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
item: {
|
|
256
|
+
paddingX: 2,
|
|
257
|
+
paddingY: 1,
|
|
258
|
+
fontSize: "xs",
|
|
259
|
+
"& [data-part='item-description']": {
|
|
260
|
+
fontSize: ["mobile.2xs", "desktop.2xs"],
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
itemGroupLabel: {
|
|
264
|
+
py: 0.5,
|
|
265
|
+
fontSize: "xs",
|
|
266
|
+
},
|
|
267
|
+
valueText: {
|
|
268
|
+
paddingTop: 0,
|
|
269
|
+
"&[data-with-placeholder]": {
|
|
270
|
+
paddingTop: "1.5",
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
md: {
|
|
275
|
+
trigger: {
|
|
276
|
+
height: 8,
|
|
277
|
+
paddingY: 1.5,
|
|
278
|
+
paddingX: 3,
|
|
279
|
+
fontSize: "sm",
|
|
280
|
+
},
|
|
281
|
+
label: {
|
|
282
|
+
left: 3,
|
|
283
|
+
marginY: 2,
|
|
284
|
+
_selected: {
|
|
285
|
+
transform: ["scale(0.825) translateY(-10px)"],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
valueText: {
|
|
289
|
+
"&[data-with-placeholder]": {
|
|
290
|
+
paddingTop: "4",
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
defaultVariants: {
|
|
297
|
+
size: "md",
|
|
245
298
|
},
|
|
246
299
|
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true, // Allows using 'describe', 'test', and 'expect' without importing them
|
|
6
|
+
environment: "jsdom",
|
|
7
|
+
setupFiles: "./setupTests.ts", // Global test helpers or mocks
|
|
8
|
+
typecheck: {
|
|
9
|
+
enabled: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|