uisv 0.0.12 → 0.0.13

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.
Files changed (75) hide show
  1. package/dist/components/accordion.svelte +108 -0
  2. package/dist/components/accordion.svelte.d.ts +58 -0
  3. package/dist/components/alert.svelte +271 -0
  4. package/dist/components/alert.svelte.d.ts +23 -0
  5. package/dist/components/badge.svelte +225 -0
  6. package/dist/components/badge.svelte.d.ts +19 -0
  7. package/dist/components/banner.svelte +254 -0
  8. package/dist/components/banner.svelte.d.ts +23 -0
  9. package/dist/components/button/button.svelte +105 -0
  10. package/dist/components/button/button.svelte.d.ts +4 -0
  11. package/dist/components/button/index.d.ts +48 -0
  12. package/dist/components/button/index.js +4 -0
  13. package/dist/components/button/style.d.ts +148 -0
  14. package/dist/components/button/style.js +248 -0
  15. package/dist/components/card.svelte +70 -0
  16. package/dist/components/card.svelte.d.ts +17 -0
  17. package/dist/components/checkbox-group.svelte +258 -0
  18. package/dist/components/checkbox-group.svelte.d.ts +26 -0
  19. package/dist/components/checkbox.svelte +175 -0
  20. package/dist/components/checkbox.svelte.d.ts +27 -0
  21. package/dist/components/chip.svelte +82 -0
  22. package/dist/components/chip.svelte.d.ts +17 -0
  23. package/dist/components/color-picker.svelte +48 -0
  24. package/dist/components/color-picker.svelte.d.ts +10 -0
  25. package/dist/components/h1.svelte +15 -0
  26. package/dist/components/h1.svelte.d.ts +3 -0
  27. package/dist/components/h2.svelte +19 -0
  28. package/dist/components/h2.svelte.d.ts +3 -0
  29. package/dist/components/h3.svelte +16 -0
  30. package/dist/components/h3.svelte.d.ts +3 -0
  31. package/dist/components/h4.svelte +19 -0
  32. package/dist/components/h4.svelte.d.ts +3 -0
  33. package/dist/components/h5.svelte +19 -0
  34. package/dist/components/h5.svelte.d.ts +3 -0
  35. package/dist/components/h6.svelte +19 -0
  36. package/dist/components/h6.svelte.d.ts +3 -0
  37. package/dist/components/index.d.ts +42 -0
  38. package/dist/components/index.js +42 -0
  39. package/dist/components/input/index.d.ts +54 -0
  40. package/dist/components/input/index.js +2 -0
  41. package/dist/components/input/input.svelte +103 -0
  42. package/dist/components/input/input.svelte.d.ts +4 -0
  43. package/dist/components/input/style.d.ts +316 -0
  44. package/dist/components/input/style.js +128 -0
  45. package/dist/components/input-time/index.d.ts +375 -0
  46. package/dist/components/input-time/index.js +144 -0
  47. package/dist/components/input-time/input-time.svelte +39 -0
  48. package/dist/components/input-time/input-time.svelte.d.ts +4 -0
  49. package/dist/components/kbd.svelte +239 -0
  50. package/dist/components/kbd.svelte.d.ts +40 -0
  51. package/dist/components/p.svelte +9 -0
  52. package/dist/components/p.svelte.d.ts +3 -0
  53. package/dist/components/pin-input.svelte +162 -0
  54. package/dist/components/pin-input.svelte.d.ts +25 -0
  55. package/dist/components/placeholder.svelte +34 -0
  56. package/dist/components/placeholder.svelte.d.ts +3 -0
  57. package/dist/components/popover.svelte +151 -0
  58. package/dist/components/popover.svelte.d.ts +88 -0
  59. package/dist/components/progress.svelte +124 -0
  60. package/dist/components/progress.svelte.d.ts +21 -0
  61. package/dist/components/select.svelte +171 -0
  62. package/dist/components/select.svelte.d.ts +50 -0
  63. package/dist/components/slider.svelte +172 -0
  64. package/dist/components/slider.svelte.d.ts +44 -0
  65. package/dist/components/switch.svelte +180 -0
  66. package/dist/components/switch.svelte.d.ts +27 -0
  67. package/dist/components/tabs.svelte +246 -0
  68. package/dist/components/tabs.svelte.d.ts +34 -0
  69. package/dist/index.d.ts +4 -0
  70. package/dist/index.js +3 -0
  71. package/dist/utilities.svelte.d.ts +24 -0
  72. package/dist/utilities.svelte.js +47 -0
  73. package/dist/vite.d.ts +51 -0
  74. package/dist/vite.js +157 -0
  75. package/package.json +2 -2
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ import { isComponent, isSnippet } from '../../utilities.svelte.js';
3
+ import { type InputProps, INPUT_VARIANTS } from './index.js';
4
+ import { maska } from 'maska/svelte';
5
+
6
+ let {
7
+ type,
8
+ value = $bindable(),
9
+ color = 'primary',
10
+ variant = 'outline',
11
+ size = 'md',
12
+ icon,
13
+ iconposition,
14
+ disabled,
15
+ highlight,
16
+ leading,
17
+ loading,
18
+ loadingicon = 'i-lucide-loader-circle',
19
+ required,
20
+ trailing,
21
+ mask,
22
+ ui = {},
23
+ ...rest
24
+ }: InputProps = $props();
25
+ const id = $props.id();
26
+
27
+ const variants = $derived(
28
+ INPUT_VARIANTS({
29
+ size,
30
+ color,
31
+ variant,
32
+ highlight,
33
+ loading,
34
+ leading: !!leading || (!!icon && iconposition === 'leading') || loading,
35
+ trailing: !!trailing || (!!icon && iconposition === 'trailing'),
36
+ type: type === 'file' ? 'file' : undefined,
37
+ }),
38
+ );
39
+ </script>
40
+
41
+ <div class={variants.root({ class: ui.root })}>
42
+ {#if leading || (icon && iconposition === 'leading') || loading}
43
+ {@const TrailingIcon = loading ? loadingicon : icon}
44
+
45
+ <span class={variants.leading({ class: ui.leading })}>
46
+ {#if !!leading && !loading}
47
+ {#if typeof leading === 'string'}
48
+ {leading}
49
+ {:else if isSnippet(leading)}
50
+ {@render leading()}
51
+ {:else if isComponent(leading)}
52
+ {@const Leading = leading}
53
+ <Leading />
54
+ {/if}
55
+ {:else if typeof TrailingIcon === 'string'}
56
+ <div
57
+ class={variants.icon({
58
+ class: [loading && 'animate-spin', TrailingIcon, ui.icon],
59
+ })}
60
+ ></div>
61
+ {:else if isSnippet(TrailingIcon)}
62
+ {@render TrailingIcon()}
63
+ {:else if isComponent(TrailingIcon)}
64
+ <TrailingIcon class={variants.icon({ class: [ui.icon] })} />
65
+ {/if}
66
+ </span>
67
+ {/if}
68
+
69
+ <input
70
+ {id}
71
+ {type}
72
+ {...rest}
73
+ class={variants.base({ class: [ui.base] })}
74
+ {...rest}
75
+ use:maska={mask}
76
+ />
77
+
78
+ {#if trailing || (icon && iconposition === 'trailing')}
79
+ <span class={variants.trailing({ class: ui.trailing })}>
80
+ {#if !!trailing}
81
+ {#if typeof trailing === 'string'}
82
+ {trailing}
83
+ {:else if isSnippet(trailing)}
84
+ {@render trailing()}
85
+ {:else if isComponent(trailing)}
86
+ {@const Trailing = trailing}
87
+ <Trailing />
88
+ {/if}
89
+ {:else if typeof icon === 'string'}
90
+ <div
91
+ class={variants.icon({
92
+ class: [icon, ui.icon],
93
+ })}
94
+ ></div>
95
+ {:else if isSnippet(icon)}
96
+ {@render icon()}
97
+ {:else if isComponent(icon)}
98
+ {@const Icon = icon}
99
+ <Icon class={variants.icon({ class: [ui.icon] })} />
100
+ {/if}
101
+ </span>
102
+ {/if}
103
+ </div>
@@ -0,0 +1,4 @@
1
+ import { type InputProps } from './index.js';
2
+ declare const Input: import("svelte").Component<InputProps, {}, "value">;
3
+ type Input = ReturnType<typeof Input>;
4
+ export default Input;
@@ -0,0 +1,316 @@
1
+ export declare const INPUT_VARIANTS: import("tailwind-variants").TVReturnType<{
2
+ fieldGroup: {
3
+ horizontal: {
4
+ root: string;
5
+ base: string;
6
+ };
7
+ vertical: {
8
+ root: string;
9
+ base: string;
10
+ };
11
+ };
12
+ size: {
13
+ xs: {
14
+ base: string;
15
+ leading: string;
16
+ trailing: string;
17
+ icon: string;
18
+ };
19
+ sm: {
20
+ base: string;
21
+ leading: string;
22
+ trailing: string;
23
+ icon: string;
24
+ };
25
+ md: {
26
+ base: string;
27
+ leading: string;
28
+ trailing: string;
29
+ icon: string;
30
+ };
31
+ lg: {
32
+ base: string;
33
+ leading: string;
34
+ trailing: string;
35
+ icon: string;
36
+ };
37
+ xl: {
38
+ base: string;
39
+ leading: string;
40
+ trailing: string;
41
+ icon: string;
42
+ };
43
+ };
44
+ variant: {
45
+ outline: {
46
+ root: string;
47
+ };
48
+ soft: {
49
+ root: string;
50
+ };
51
+ subtle: {
52
+ root: string;
53
+ };
54
+ ghost: {
55
+ root: string;
56
+ };
57
+ none: {
58
+ root: string;
59
+ };
60
+ };
61
+ color: {
62
+ primary: {
63
+ root: string;
64
+ };
65
+ surface: {
66
+ root: string;
67
+ };
68
+ info: {
69
+ root: string;
70
+ };
71
+ success: {
72
+ root: string;
73
+ };
74
+ warning: {
75
+ root: string;
76
+ };
77
+ error: {
78
+ root: string;
79
+ };
80
+ };
81
+ leading: {
82
+ false: {
83
+ leading: string;
84
+ };
85
+ };
86
+ trailing: {
87
+ false: {
88
+ trailing: string;
89
+ };
90
+ };
91
+ loading: {
92
+ true: string;
93
+ };
94
+ highlight: {
95
+ true: string;
96
+ };
97
+ type: {
98
+ file: string;
99
+ };
100
+ }, {
101
+ root: string;
102
+ base: string;
103
+ leading: string;
104
+ trailing: string;
105
+ icon: string;
106
+ }, undefined, {
107
+ fieldGroup: {
108
+ horizontal: {
109
+ root: string;
110
+ base: string;
111
+ };
112
+ vertical: {
113
+ root: string;
114
+ base: string;
115
+ };
116
+ };
117
+ size: {
118
+ xs: {
119
+ base: string;
120
+ leading: string;
121
+ trailing: string;
122
+ icon: string;
123
+ };
124
+ sm: {
125
+ base: string;
126
+ leading: string;
127
+ trailing: string;
128
+ icon: string;
129
+ };
130
+ md: {
131
+ base: string;
132
+ leading: string;
133
+ trailing: string;
134
+ icon: string;
135
+ };
136
+ lg: {
137
+ base: string;
138
+ leading: string;
139
+ trailing: string;
140
+ icon: string;
141
+ };
142
+ xl: {
143
+ base: string;
144
+ leading: string;
145
+ trailing: string;
146
+ icon: string;
147
+ };
148
+ };
149
+ variant: {
150
+ outline: {
151
+ root: string;
152
+ };
153
+ soft: {
154
+ root: string;
155
+ };
156
+ subtle: {
157
+ root: string;
158
+ };
159
+ ghost: {
160
+ root: string;
161
+ };
162
+ none: {
163
+ root: string;
164
+ };
165
+ };
166
+ color: {
167
+ primary: {
168
+ root: string;
169
+ };
170
+ surface: {
171
+ root: string;
172
+ };
173
+ info: {
174
+ root: string;
175
+ };
176
+ success: {
177
+ root: string;
178
+ };
179
+ warning: {
180
+ root: string;
181
+ };
182
+ error: {
183
+ root: string;
184
+ };
185
+ };
186
+ leading: {
187
+ false: {
188
+ leading: string;
189
+ };
190
+ };
191
+ trailing: {
192
+ false: {
193
+ trailing: string;
194
+ };
195
+ };
196
+ loading: {
197
+ true: string;
198
+ };
199
+ highlight: {
200
+ true: string;
201
+ };
202
+ type: {
203
+ file: string;
204
+ };
205
+ }, {
206
+ root: string;
207
+ base: string;
208
+ leading: string;
209
+ trailing: string;
210
+ icon: string;
211
+ }, import("tailwind-variants").TVReturnType<{
212
+ fieldGroup: {
213
+ horizontal: {
214
+ root: string;
215
+ base: string;
216
+ };
217
+ vertical: {
218
+ root: string;
219
+ base: string;
220
+ };
221
+ };
222
+ size: {
223
+ xs: {
224
+ base: string;
225
+ leading: string;
226
+ trailing: string;
227
+ icon: string;
228
+ };
229
+ sm: {
230
+ base: string;
231
+ leading: string;
232
+ trailing: string;
233
+ icon: string;
234
+ };
235
+ md: {
236
+ base: string;
237
+ leading: string;
238
+ trailing: string;
239
+ icon: string;
240
+ };
241
+ lg: {
242
+ base: string;
243
+ leading: string;
244
+ trailing: string;
245
+ icon: string;
246
+ };
247
+ xl: {
248
+ base: string;
249
+ leading: string;
250
+ trailing: string;
251
+ icon: string;
252
+ };
253
+ };
254
+ variant: {
255
+ outline: {
256
+ root: string;
257
+ };
258
+ soft: {
259
+ root: string;
260
+ };
261
+ subtle: {
262
+ root: string;
263
+ };
264
+ ghost: {
265
+ root: string;
266
+ };
267
+ none: {
268
+ root: string;
269
+ };
270
+ };
271
+ color: {
272
+ primary: {
273
+ root: string;
274
+ };
275
+ surface: {
276
+ root: string;
277
+ };
278
+ info: {
279
+ root: string;
280
+ };
281
+ success: {
282
+ root: string;
283
+ };
284
+ warning: {
285
+ root: string;
286
+ };
287
+ error: {
288
+ root: string;
289
+ };
290
+ };
291
+ leading: {
292
+ false: {
293
+ leading: string;
294
+ };
295
+ };
296
+ trailing: {
297
+ false: {
298
+ trailing: string;
299
+ };
300
+ };
301
+ loading: {
302
+ true: string;
303
+ };
304
+ highlight: {
305
+ true: string;
306
+ };
307
+ type: {
308
+ file: string;
309
+ };
310
+ }, {
311
+ root: string;
312
+ base: string;
313
+ leading: string;
314
+ trailing: string;
315
+ icon: string;
316
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,128 @@
1
+ import { tv } from 'tailwind-variants';
2
+ export const INPUT_VARIANTS = tv({
3
+ slots: {
4
+ root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
5
+ base: 'appearance-none outline-none placeholder:text-muted',
6
+ leading: 'text-muted',
7
+ trailing: 'text-muted',
8
+ icon: '',
9
+ },
10
+ variants: {
11
+ fieldGroup: {
12
+ horizontal: {
13
+ root: '',
14
+ base: '',
15
+ },
16
+ vertical: {
17
+ root: '',
18
+ base: '',
19
+ },
20
+ },
21
+ size: {
22
+ xs: {
23
+ base: 'px-2 py-1 text-xs gap-1',
24
+ leading: 'ps-2',
25
+ trailing: 'pe-2',
26
+ icon: 'size-4',
27
+ },
28
+ sm: {
29
+ base: 'px-2.5 py-1.5 text-xs gap-1.5',
30
+ leading: 'ps-2.5',
31
+ trailing: 'pe-2.5',
32
+ icon: 'size-4',
33
+ },
34
+ md: {
35
+ base: 'px-2.5 py-1.5 text-sm gap-1.5',
36
+ leading: 'ps-2.5',
37
+ trailing: 'pe-2.5',
38
+ icon: 'size-5',
39
+ },
40
+ lg: {
41
+ base: 'px-3 py-2 text-sm gap-2',
42
+ leading: 'ps-3',
43
+ trailing: 'pe-3',
44
+ icon: 'size-5',
45
+ },
46
+ xl: {
47
+ base: 'px-3 py-2 text-base gap-2',
48
+ leading: 'ps-3',
49
+ trailing: 'pe-3',
50
+ icon: 'size-6',
51
+ },
52
+ },
53
+ variant: {
54
+ outline: { root: 'ring ring-dimmed' },
55
+ soft: { root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated' },
56
+ subtle: { root: 'ring ring-dimmed' },
57
+ ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
58
+ none: { root: '' },
59
+ },
60
+ color: {
61
+ primary: { root: '' },
62
+ surface: { root: '' },
63
+ info: { root: '' },
64
+ success: { root: '' },
65
+ warning: { root: '' },
66
+ error: { root: '' },
67
+ },
68
+ leading: {
69
+ false: { leading: 'hidden' },
70
+ },
71
+ trailing: {
72
+ false: { trailing: 'hidden' },
73
+ },
74
+ loading: {
75
+ true: '',
76
+ },
77
+ highlight: {
78
+ true: '',
79
+ },
80
+ type: {
81
+ file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
82
+ },
83
+ },
84
+ compoundVariants: [
85
+ {
86
+ color: 'primary',
87
+ variant: ['outline', 'subtle'],
88
+ class: {
89
+ root: 'focus-within:(ring-primary-500 ring-2)',
90
+ },
91
+ },
92
+ {
93
+ color: 'surface',
94
+ variant: ['outline', 'subtle'],
95
+ class: {
96
+ root: 'focus-within:(ring-surface-800 ring-2)',
97
+ },
98
+ },
99
+ {
100
+ color: 'info',
101
+ variant: ['outline', 'subtle'],
102
+ class: {
103
+ root: 'focus-within:(ring-info-500 ring-2)',
104
+ },
105
+ },
106
+ {
107
+ color: 'success',
108
+ variant: ['outline', 'subtle'],
109
+ class: {
110
+ root: 'focus-within:(ring-success-500 ring-2)',
111
+ },
112
+ },
113
+ {
114
+ color: 'warning',
115
+ variant: ['outline', 'subtle'],
116
+ class: {
117
+ root: 'focus-within:(ring-warning-500 ring-2)',
118
+ },
119
+ },
120
+ {
121
+ color: 'error',
122
+ variant: ['outline', 'subtle'],
123
+ class: {
124
+ root: 'focus-within:(ring-error-500 ring-2)',
125
+ },
126
+ },
127
+ ],
128
+ });