sv5ui 1.2.0 → 1.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/README.md +16 -11
- package/dist/CheckboxGroup/CheckboxGroup.svelte +215 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +5 -0
- package/dist/CheckboxGroup/checkbox-group.types.d.ts +130 -0
- package/dist/CheckboxGroup/checkbox-group.types.js +1 -0
- package/dist/CheckboxGroup/checkbox-group.variants.d.ts +553 -0
- package/dist/CheckboxGroup/checkbox-group.variants.js +231 -0
- package/dist/CheckboxGroup/index.d.ts +2 -0
- package/dist/CheckboxGroup/index.js +1 -0
- package/dist/Collapsible/Collapsible.svelte +69 -0
- package/dist/Collapsible/Collapsible.svelte.d.ts +6 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +17 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +4 -0
- package/dist/Collapsible/collapsible.types.d.ts +75 -0
- package/dist/Collapsible/collapsible.types.js +1 -0
- package/dist/Collapsible/collapsible.variants.d.ts +53 -0
- package/dist/Collapsible/collapsible.variants.js +21 -0
- package/dist/Collapsible/index.d.ts +2 -0
- package/dist/Collapsible/index.js +1 -0
- package/dist/Command/Command.svelte +183 -0
- package/dist/Command/Command.svelte.d.ts +6 -0
- package/dist/Command/CommandTestWrapper.svelte +13 -0
- package/dist/Command/CommandTestWrapper.svelte.d.ts +4 -0
- package/dist/Command/command.types.d.ts +98 -0
- package/dist/Command/command.types.js +1 -0
- package/dist/Command/command.variants.d.ts +226 -0
- package/dist/Command/command.variants.js +86 -0
- package/dist/Command/index.d.ts +2 -0
- package/dist/Command/index.js +1 -0
- package/dist/FileUpload/FileUpload.svelte +561 -0
- package/dist/FileUpload/FileUpload.svelte.d.ts +8 -0
- package/dist/FileUpload/file-upload.types.d.ts +164 -0
- package/dist/FileUpload/file-upload.types.js +1 -0
- package/dist/FileUpload/file-upload.variants.d.ts +397 -0
- package/dist/FileUpload/file-upload.variants.js +224 -0
- package/dist/FileUpload/index.d.ts +2 -0
- package/dist/FileUpload/index.js +1 -0
- package/dist/PinInput/PinInput.svelte +150 -0
- package/dist/PinInput/PinInput.svelte.d.ts +6 -0
- package/dist/PinInput/index.d.ts +2 -0
- package/dist/PinInput/index.js +1 -0
- package/dist/PinInput/pin-input.types.d.ts +99 -0
- package/dist/PinInput/pin-input.types.js +1 -0
- package/dist/PinInput/pin-input.variants.d.ts +303 -0
- package/dist/PinInput/pin-input.variants.js +196 -0
- package/dist/Select/select.variants.js +1 -1
- package/dist/SelectMenu/select-menu.variants.js +1 -1
- package/dist/Slider/Slider.svelte +135 -0
- package/dist/Slider/Slider.svelte.d.ts +6 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +1 -0
- package/dist/Slider/slider.types.d.ts +55 -0
- package/dist/Slider/slider.types.js +1 -0
- package/dist/Slider/slider.variants.d.ts +383 -0
- package/dist/Slider/slider.variants.js +102 -0
- package/dist/Toast/Toaster.svelte +618 -0
- package/dist/Toast/Toaster.svelte.d.ts +5 -0
- package/dist/Toast/index.d.ts +4 -0
- package/dist/Toast/index.js +2 -0
- package/dist/Toast/toast.d.ts +38 -0
- package/dist/Toast/toast.js +73 -0
- package/dist/Toast/toast.types.d.ts +19 -0
- package/dist/Toast/toast.types.js +1 -0
- package/dist/Toast/toast.variants.d.ts +7 -0
- package/dist/Toast/toast.variants.js +5 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +6 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/theme.css +36 -0
- package/package.json +2 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const pinInputVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
variant: {
|
|
4
|
+
outline: {
|
|
5
|
+
base: string;
|
|
6
|
+
};
|
|
7
|
+
soft: {
|
|
8
|
+
base: string;
|
|
9
|
+
};
|
|
10
|
+
subtle: {
|
|
11
|
+
base: string;
|
|
12
|
+
};
|
|
13
|
+
ghost: {
|
|
14
|
+
base: string;
|
|
15
|
+
};
|
|
16
|
+
none: {
|
|
17
|
+
base: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
color: {
|
|
21
|
+
primary: {};
|
|
22
|
+
secondary: {};
|
|
23
|
+
tertiary: {};
|
|
24
|
+
success: {};
|
|
25
|
+
warning: {};
|
|
26
|
+
error: {};
|
|
27
|
+
info: {};
|
|
28
|
+
surface: {};
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
xs: {
|
|
32
|
+
base: string;
|
|
33
|
+
};
|
|
34
|
+
sm: {
|
|
35
|
+
base: string;
|
|
36
|
+
};
|
|
37
|
+
md: {
|
|
38
|
+
base: string;
|
|
39
|
+
};
|
|
40
|
+
lg: {
|
|
41
|
+
base: string;
|
|
42
|
+
};
|
|
43
|
+
xl: {
|
|
44
|
+
base: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
highlight: {
|
|
48
|
+
true: {};
|
|
49
|
+
};
|
|
50
|
+
fixed: {
|
|
51
|
+
false: {};
|
|
52
|
+
};
|
|
53
|
+
disabled: {
|
|
54
|
+
true: {
|
|
55
|
+
root: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
root: string;
|
|
60
|
+
base: string[];
|
|
61
|
+
}, undefined, {
|
|
62
|
+
variant: {
|
|
63
|
+
outline: {
|
|
64
|
+
base: string;
|
|
65
|
+
};
|
|
66
|
+
soft: {
|
|
67
|
+
base: string;
|
|
68
|
+
};
|
|
69
|
+
subtle: {
|
|
70
|
+
base: string;
|
|
71
|
+
};
|
|
72
|
+
ghost: {
|
|
73
|
+
base: string;
|
|
74
|
+
};
|
|
75
|
+
none: {
|
|
76
|
+
base: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
color: {
|
|
80
|
+
primary: {};
|
|
81
|
+
secondary: {};
|
|
82
|
+
tertiary: {};
|
|
83
|
+
success: {};
|
|
84
|
+
warning: {};
|
|
85
|
+
error: {};
|
|
86
|
+
info: {};
|
|
87
|
+
surface: {};
|
|
88
|
+
};
|
|
89
|
+
size: {
|
|
90
|
+
xs: {
|
|
91
|
+
base: string;
|
|
92
|
+
};
|
|
93
|
+
sm: {
|
|
94
|
+
base: string;
|
|
95
|
+
};
|
|
96
|
+
md: {
|
|
97
|
+
base: string;
|
|
98
|
+
};
|
|
99
|
+
lg: {
|
|
100
|
+
base: string;
|
|
101
|
+
};
|
|
102
|
+
xl: {
|
|
103
|
+
base: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
highlight: {
|
|
107
|
+
true: {};
|
|
108
|
+
};
|
|
109
|
+
fixed: {
|
|
110
|
+
false: {};
|
|
111
|
+
};
|
|
112
|
+
disabled: {
|
|
113
|
+
true: {
|
|
114
|
+
root: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}, {
|
|
118
|
+
root: string;
|
|
119
|
+
base: string[];
|
|
120
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
121
|
+
variant: {
|
|
122
|
+
outline: {
|
|
123
|
+
base: string;
|
|
124
|
+
};
|
|
125
|
+
soft: {
|
|
126
|
+
base: string;
|
|
127
|
+
};
|
|
128
|
+
subtle: {
|
|
129
|
+
base: string;
|
|
130
|
+
};
|
|
131
|
+
ghost: {
|
|
132
|
+
base: string;
|
|
133
|
+
};
|
|
134
|
+
none: {
|
|
135
|
+
base: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
color: {
|
|
139
|
+
primary: {};
|
|
140
|
+
secondary: {};
|
|
141
|
+
tertiary: {};
|
|
142
|
+
success: {};
|
|
143
|
+
warning: {};
|
|
144
|
+
error: {};
|
|
145
|
+
info: {};
|
|
146
|
+
surface: {};
|
|
147
|
+
};
|
|
148
|
+
size: {
|
|
149
|
+
xs: {
|
|
150
|
+
base: string;
|
|
151
|
+
};
|
|
152
|
+
sm: {
|
|
153
|
+
base: string;
|
|
154
|
+
};
|
|
155
|
+
md: {
|
|
156
|
+
base: string;
|
|
157
|
+
};
|
|
158
|
+
lg: {
|
|
159
|
+
base: string;
|
|
160
|
+
};
|
|
161
|
+
xl: {
|
|
162
|
+
base: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
highlight: {
|
|
166
|
+
true: {};
|
|
167
|
+
};
|
|
168
|
+
fixed: {
|
|
169
|
+
false: {};
|
|
170
|
+
};
|
|
171
|
+
disabled: {
|
|
172
|
+
true: {
|
|
173
|
+
root: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
}, {
|
|
177
|
+
root: string;
|
|
178
|
+
base: string[];
|
|
179
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
180
|
+
export type PinInputVariantProps = VariantProps<typeof pinInputVariants>;
|
|
181
|
+
export type PinInputSlots = keyof ReturnType<typeof pinInputVariants>;
|
|
182
|
+
export declare const pinInputDefaults: {
|
|
183
|
+
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
184
|
+
variant: {
|
|
185
|
+
outline: {
|
|
186
|
+
base: string;
|
|
187
|
+
};
|
|
188
|
+
soft: {
|
|
189
|
+
base: string;
|
|
190
|
+
};
|
|
191
|
+
subtle: {
|
|
192
|
+
base: string;
|
|
193
|
+
};
|
|
194
|
+
ghost: {
|
|
195
|
+
base: string;
|
|
196
|
+
};
|
|
197
|
+
none: {
|
|
198
|
+
base: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
color: {
|
|
202
|
+
primary: {};
|
|
203
|
+
secondary: {};
|
|
204
|
+
tertiary: {};
|
|
205
|
+
success: {};
|
|
206
|
+
warning: {};
|
|
207
|
+
error: {};
|
|
208
|
+
info: {};
|
|
209
|
+
surface: {};
|
|
210
|
+
};
|
|
211
|
+
size: {
|
|
212
|
+
xs: {
|
|
213
|
+
base: string;
|
|
214
|
+
};
|
|
215
|
+
sm: {
|
|
216
|
+
base: string;
|
|
217
|
+
};
|
|
218
|
+
md: {
|
|
219
|
+
base: string;
|
|
220
|
+
};
|
|
221
|
+
lg: {
|
|
222
|
+
base: string;
|
|
223
|
+
};
|
|
224
|
+
xl: {
|
|
225
|
+
base: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
highlight: {
|
|
229
|
+
true: {};
|
|
230
|
+
};
|
|
231
|
+
fixed: {
|
|
232
|
+
false: {};
|
|
233
|
+
};
|
|
234
|
+
disabled: {
|
|
235
|
+
true: {
|
|
236
|
+
root: string;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
}, {
|
|
240
|
+
root: string;
|
|
241
|
+
base: string[];
|
|
242
|
+
}, {
|
|
243
|
+
variant: {
|
|
244
|
+
outline: {
|
|
245
|
+
base: string;
|
|
246
|
+
};
|
|
247
|
+
soft: {
|
|
248
|
+
base: string;
|
|
249
|
+
};
|
|
250
|
+
subtle: {
|
|
251
|
+
base: string;
|
|
252
|
+
};
|
|
253
|
+
ghost: {
|
|
254
|
+
base: string;
|
|
255
|
+
};
|
|
256
|
+
none: {
|
|
257
|
+
base: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
color: {
|
|
261
|
+
primary: {};
|
|
262
|
+
secondary: {};
|
|
263
|
+
tertiary: {};
|
|
264
|
+
success: {};
|
|
265
|
+
warning: {};
|
|
266
|
+
error: {};
|
|
267
|
+
info: {};
|
|
268
|
+
surface: {};
|
|
269
|
+
};
|
|
270
|
+
size: {
|
|
271
|
+
xs: {
|
|
272
|
+
base: string;
|
|
273
|
+
};
|
|
274
|
+
sm: {
|
|
275
|
+
base: string;
|
|
276
|
+
};
|
|
277
|
+
md: {
|
|
278
|
+
base: string;
|
|
279
|
+
};
|
|
280
|
+
lg: {
|
|
281
|
+
base: string;
|
|
282
|
+
};
|
|
283
|
+
xl: {
|
|
284
|
+
base: string;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
highlight: {
|
|
288
|
+
true: {};
|
|
289
|
+
};
|
|
290
|
+
fixed: {
|
|
291
|
+
false: {};
|
|
292
|
+
};
|
|
293
|
+
disabled: {
|
|
294
|
+
true: {
|
|
295
|
+
root: string;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
}, {
|
|
299
|
+
root: string;
|
|
300
|
+
base: string[];
|
|
301
|
+
}>;
|
|
302
|
+
slots: Partial<Record<PinInputSlots, string>>;
|
|
303
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const pinInputVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative inline-flex items-center gap-1.5 align-top',
|
|
5
|
+
base: [
|
|
6
|
+
'relative flex items-center justify-center rounded-md',
|
|
7
|
+
'select-none cursor-text transition-colors'
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
outline: {
|
|
13
|
+
base: 'text-on-surface bg-surface ring-2 ring-inset ring-outline-variant'
|
|
14
|
+
},
|
|
15
|
+
soft: {
|
|
16
|
+
base: 'text-on-surface bg-surface-container/50 data-[active]:bg-surface-container disabled:bg-surface-container/50'
|
|
17
|
+
},
|
|
18
|
+
subtle: {
|
|
19
|
+
base: 'text-on-surface bg-surface-container ring-2 ring-inset ring-outline-variant'
|
|
20
|
+
},
|
|
21
|
+
ghost: {
|
|
22
|
+
base: 'text-on-surface bg-transparent data-[active]:bg-surface-container'
|
|
23
|
+
},
|
|
24
|
+
none: {
|
|
25
|
+
base: 'text-on-surface bg-transparent'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
color: {
|
|
29
|
+
primary: {},
|
|
30
|
+
secondary: {},
|
|
31
|
+
tertiary: {},
|
|
32
|
+
success: {},
|
|
33
|
+
warning: {},
|
|
34
|
+
error: {},
|
|
35
|
+
info: {},
|
|
36
|
+
surface: {}
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
xs: { base: 'size-6 text-sm/4' },
|
|
40
|
+
sm: { base: 'size-7 text-sm/4' },
|
|
41
|
+
md: { base: 'size-8 text-base/5' },
|
|
42
|
+
lg: { base: 'size-9 text-base/5' },
|
|
43
|
+
xl: { base: 'size-10 text-base' }
|
|
44
|
+
},
|
|
45
|
+
highlight: {
|
|
46
|
+
true: {}
|
|
47
|
+
},
|
|
48
|
+
fixed: {
|
|
49
|
+
false: {}
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
true: {
|
|
53
|
+
root: 'opacity-75 cursor-not-allowed'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
compoundVariants: [
|
|
58
|
+
// outline + color → active cell ring
|
|
59
|
+
{
|
|
60
|
+
variant: 'outline',
|
|
61
|
+
color: 'primary',
|
|
62
|
+
class: {
|
|
63
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-primary'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
variant: 'outline',
|
|
68
|
+
color: 'secondary',
|
|
69
|
+
class: {
|
|
70
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-secondary'
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
variant: 'outline',
|
|
75
|
+
color: 'tertiary',
|
|
76
|
+
class: {
|
|
77
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-tertiary'
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
variant: 'outline',
|
|
82
|
+
color: 'success',
|
|
83
|
+
class: {
|
|
84
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-success'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
variant: 'outline',
|
|
89
|
+
color: 'warning',
|
|
90
|
+
class: {
|
|
91
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-warning'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
variant: 'outline',
|
|
96
|
+
color: 'error',
|
|
97
|
+
class: {
|
|
98
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-error'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
variant: 'outline',
|
|
103
|
+
color: 'info',
|
|
104
|
+
class: { base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-info' }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
variant: 'outline',
|
|
108
|
+
color: 'surface',
|
|
109
|
+
class: {
|
|
110
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-on-surface'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
// subtle + color → active cell ring
|
|
114
|
+
{
|
|
115
|
+
variant: 'subtle',
|
|
116
|
+
color: 'primary',
|
|
117
|
+
class: {
|
|
118
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-primary'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
variant: 'subtle',
|
|
123
|
+
color: 'secondary',
|
|
124
|
+
class: {
|
|
125
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-secondary'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
variant: 'subtle',
|
|
130
|
+
color: 'tertiary',
|
|
131
|
+
class: {
|
|
132
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-tertiary'
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
variant: 'subtle',
|
|
137
|
+
color: 'success',
|
|
138
|
+
class: {
|
|
139
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-success'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
variant: 'subtle',
|
|
144
|
+
color: 'warning',
|
|
145
|
+
class: {
|
|
146
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-warning'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
variant: 'subtle',
|
|
151
|
+
color: 'error',
|
|
152
|
+
class: {
|
|
153
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-error'
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
variant: 'subtle',
|
|
158
|
+
color: 'info',
|
|
159
|
+
class: { base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-info' }
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
variant: 'subtle',
|
|
163
|
+
color: 'surface',
|
|
164
|
+
class: {
|
|
165
|
+
base: 'data-[active]:ring-2 data-[active]:ring-inset data-[active]:ring-on-surface'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
// highlight + color → all cells always show color ring
|
|
169
|
+
{ highlight: true, color: 'primary', class: { base: 'ring-2 ring-inset ring-primary' } },
|
|
170
|
+
{
|
|
171
|
+
highlight: true,
|
|
172
|
+
color: 'secondary',
|
|
173
|
+
class: { base: 'ring-2 ring-inset ring-secondary' }
|
|
174
|
+
},
|
|
175
|
+
{ highlight: true, color: 'tertiary', class: { base: 'ring-2 ring-inset ring-tertiary' } },
|
|
176
|
+
{ highlight: true, color: 'success', class: { base: 'ring-2 ring-inset ring-success' } },
|
|
177
|
+
{ highlight: true, color: 'warning', class: { base: 'ring-2 ring-inset ring-warning' } },
|
|
178
|
+
{ highlight: true, color: 'error', class: { base: 'ring-2 ring-inset ring-error' } },
|
|
179
|
+
{ highlight: true, color: 'info', class: { base: 'ring-2 ring-inset ring-info' } },
|
|
180
|
+
{ highlight: true, color: 'surface', class: { base: 'ring-2 ring-inset ring-on-surface' } },
|
|
181
|
+
// fixed=false → responsive text (smaller on mobile)
|
|
182
|
+
{ fixed: false, size: 'xs', class: { base: 'md:text-xs' } },
|
|
183
|
+
{ fixed: false, size: 'sm', class: { base: 'md:text-xs' } },
|
|
184
|
+
{ fixed: false, size: 'md', class: { base: 'md:text-sm' } },
|
|
185
|
+
{ fixed: false, size: 'lg', class: { base: 'md:text-sm' } }
|
|
186
|
+
],
|
|
187
|
+
defaultVariants: {
|
|
188
|
+
variant: 'outline',
|
|
189
|
+
color: 'primary',
|
|
190
|
+
size: 'md'
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
export const pinInputDefaults = {
|
|
194
|
+
defaultVariants: pinInputVariants.defaultVariants,
|
|
195
|
+
slots: {}
|
|
196
|
+
};
|
|
@@ -26,7 +26,7 @@ export const selectVariants = tv({
|
|
|
26
26
|
'focus:outline-none',
|
|
27
27
|
'overflow-hidden'
|
|
28
28
|
],
|
|
29
|
-
viewport: 'p-1',
|
|
29
|
+
viewport: 'p-1 max-h-60 overflow-y-auto scrollbar-thin',
|
|
30
30
|
group: '',
|
|
31
31
|
groupLabel: 'px-2 py-1.5 text-xs font-semibold text-on-surface-variant',
|
|
32
32
|
item: [
|
|
@@ -14,7 +14,7 @@ export const selectMenuVariants = tv({
|
|
|
14
14
|
'flex flex-col'
|
|
15
15
|
],
|
|
16
16
|
input: 'border-b border-outline-variant',
|
|
17
|
-
viewport: 'p-1 flex-1 overflow-y-auto',
|
|
17
|
+
viewport: 'p-1 flex-1 overflow-y-auto scrollbar-thin',
|
|
18
18
|
empty: 'text-center text-on-surface-variant'
|
|
19
19
|
},
|
|
20
20
|
variants: {
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { SliderProps } from './slider.types.js'
|
|
3
|
+
|
|
4
|
+
export type Props = SliderProps
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { Slider, useId } from 'bits-ui'
|
|
9
|
+
import { getContext } from 'svelte'
|
|
10
|
+
import { sliderVariants, sliderDefaults } from './slider.variants.js'
|
|
11
|
+
import { getComponentConfig } from '../config.js'
|
|
12
|
+
import type { FormFieldProps } from '../FormField/form-field.types.js'
|
|
13
|
+
|
|
14
|
+
const config = getComponentConfig('slider', sliderDefaults)
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
ref = $bindable(null),
|
|
18
|
+
id,
|
|
19
|
+
value = $bindable(0),
|
|
20
|
+
onValueChange,
|
|
21
|
+
onValueCommit,
|
|
22
|
+
min = 0,
|
|
23
|
+
max = 100,
|
|
24
|
+
step = 1,
|
|
25
|
+
orientation = config.defaultVariants.orientation,
|
|
26
|
+
disabled = false,
|
|
27
|
+
autoSort = true,
|
|
28
|
+
dir,
|
|
29
|
+
thumbPositioning,
|
|
30
|
+
trackPadding,
|
|
31
|
+
color = config.defaultVariants.color,
|
|
32
|
+
size,
|
|
33
|
+
tooltip = false,
|
|
34
|
+
name,
|
|
35
|
+
class: className,
|
|
36
|
+
ui,
|
|
37
|
+
...restProps
|
|
38
|
+
}: Props = $props()
|
|
39
|
+
|
|
40
|
+
const formFieldContext = getContext<
|
|
41
|
+
| {
|
|
42
|
+
name?: string
|
|
43
|
+
size: NonNullable<FormFieldProps['size']>
|
|
44
|
+
error?: string | boolean
|
|
45
|
+
ariaId: string
|
|
46
|
+
}
|
|
47
|
+
| undefined
|
|
48
|
+
>('formField')
|
|
49
|
+
|
|
50
|
+
const autoId = useId()
|
|
51
|
+
const hasError = $derived(
|
|
52
|
+
formFieldContext?.error !== undefined && formFieldContext?.error !== false
|
|
53
|
+
)
|
|
54
|
+
const resolvedId = $derived(id ?? formFieldContext?.ariaId ?? autoId)
|
|
55
|
+
const resolvedName = $derived(name ?? formFieldContext?.name)
|
|
56
|
+
const resolvedSize = $derived(size ?? formFieldContext?.size ?? config.defaultVariants.size)
|
|
57
|
+
const resolvedColor = $derived(hasError ? 'error' : color)
|
|
58
|
+
const ariaDescribedBy = $derived(
|
|
59
|
+
!formFieldContext
|
|
60
|
+
? undefined
|
|
61
|
+
: hasError
|
|
62
|
+
? `${formFieldContext.ariaId}-error`
|
|
63
|
+
: `${formFieldContext.ariaId}-description ${formFieldContext.ariaId}-help`
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const asArray = $derived(Array.isArray(value) ? value : [value ?? min])
|
|
67
|
+
const isMultiple = $derived(Array.isArray(value))
|
|
68
|
+
|
|
69
|
+
function handleValueChange(v: number[]) {
|
|
70
|
+
value = isMultiple ? v : (v[0] ?? min)
|
|
71
|
+
onValueChange?.(value)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function handleValueCommit(v: number[]) {
|
|
75
|
+
onValueCommit?.(isMultiple ? v : (v[0] ?? min))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const slots = $derived(
|
|
79
|
+
sliderVariants({ color: resolvedColor, size: resolvedSize, orientation, disabled })
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const classes = $derived.by(() => {
|
|
83
|
+
const u = ui ?? {}
|
|
84
|
+
return {
|
|
85
|
+
root: slots.root({ class: [config.slots.root, className, u.root] }),
|
|
86
|
+
base: slots.base({ class: [config.slots.base, u.base] }),
|
|
87
|
+
track: slots.track({ class: [config.slots.track, u.track] }),
|
|
88
|
+
range: slots.range({ class: [config.slots.range, u.range] }),
|
|
89
|
+
thumb: slots.thumb({ class: [config.slots.thumb, u.thumb] }),
|
|
90
|
+
tooltip: slots.tooltip({ class: [config.slots.tooltip, u.tooltip] })
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<div bind:this={ref} class={classes.root} {...restProps}>
|
|
96
|
+
{#if resolvedName}
|
|
97
|
+
{#each asArray as v, i (i)}
|
|
98
|
+
<input type="hidden" name={resolvedName} value={v} />
|
|
99
|
+
{/each}
|
|
100
|
+
{/if}
|
|
101
|
+
|
|
102
|
+
<Slider.Root
|
|
103
|
+
type="multiple"
|
|
104
|
+
id={resolvedId}
|
|
105
|
+
value={asArray}
|
|
106
|
+
{min}
|
|
107
|
+
{max}
|
|
108
|
+
{step}
|
|
109
|
+
{disabled}
|
|
110
|
+
{orientation}
|
|
111
|
+
{autoSort}
|
|
112
|
+
{dir}
|
|
113
|
+
{thumbPositioning}
|
|
114
|
+
{trackPadding}
|
|
115
|
+
aria-describedby={ariaDescribedBy}
|
|
116
|
+
onValueChange={handleValueChange}
|
|
117
|
+
onValueCommit={handleValueCommit}
|
|
118
|
+
class={classes.base}
|
|
119
|
+
>
|
|
120
|
+
{#snippet children({ thumbItems })}
|
|
121
|
+
<span data-slider-track class={classes.track}>
|
|
122
|
+
<Slider.Range class={classes.range} />
|
|
123
|
+
</span>
|
|
124
|
+
|
|
125
|
+
{#each thumbItems as item (item.index)}
|
|
126
|
+
<Slider.Thumb index={item.index} class={classes.thumb} />
|
|
127
|
+
{#if tooltip}
|
|
128
|
+
<Slider.ThumbLabel index={item.index} class={classes.tooltip}>
|
|
129
|
+
{item.value}
|
|
130
|
+
</Slider.ThumbLabel>
|
|
131
|
+
{/if}
|
|
132
|
+
{/each}
|
|
133
|
+
{/snippet}
|
|
134
|
+
</Slider.Root>
|
|
135
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SliderProps } from './slider.types.js';
|
|
2
|
+
export type Props = SliderProps;
|
|
3
|
+
import { Slider } from 'bits-ui';
|
|
4
|
+
declare const Slider: import("svelte").Component<SliderProps, {}, "ref" | "value">;
|
|
5
|
+
type Slider = ReturnType<typeof Slider>;
|
|
6
|
+
export default Slider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Slider } from './Slider.svelte';
|