uisv 0.0.13 → 0.0.15
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/dist/components/alert.svelte +8 -2
- package/dist/components/alert.svelte.d.ts +2 -2
- package/dist/components/badge.svelte +18 -18
- package/dist/components/badge.svelte.d.ts +2 -2
- package/dist/components/banner.svelte +8 -2
- package/dist/components/banner.svelte.d.ts +2 -2
- package/dist/components/breadcrumb.svelte +75 -0
- package/dist/components/breadcrumb.svelte.d.ts +38 -0
- package/dist/components/button.svelte +415 -0
- package/dist/components/{button/index.d.ts → button.svelte.d.ts} +9 -4
- package/dist/components/calendar.svelte +99 -0
- package/dist/components/calendar.svelte.d.ts +16 -0
- package/dist/components/card.svelte +11 -10
- package/dist/components/card.svelte.d.ts +2 -1
- package/dist/components/collapsible.svelte +76 -0
- package/dist/components/collapsible.svelte.d.ts +15 -0
- package/dist/components/icon.svelte +58 -0
- package/dist/components/icon.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +18 -3
- package/dist/components/index.js +18 -3
- package/dist/components/input-number.svelte +175 -0
- package/dist/components/input-number.svelte.d.ts +38 -0
- package/dist/components/input-time.svelte +233 -0
- package/dist/components/input-time.svelte.d.ts +53 -0
- package/dist/components/input.svelte +285 -0
- package/dist/components/{input/index.d.ts → input.svelte.d.ts} +6 -5
- package/dist/components/kbd.svelte +35 -35
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/pin-input.svelte +20 -20
- package/dist/components/pin-input.svelte.d.ts +2 -2
- package/dist/components/placeholder.svelte +1 -1
- package/dist/components/select.svelte +2 -2
- package/dist/components/select.svelte.d.ts +2 -2
- package/dist/components/seperator.svelte +212 -0
- package/dist/components/seperator.svelte.d.ts +22 -0
- package/dist/components/tabs.svelte +1 -2
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/utilities.svelte.d.ts +7 -0
- package/dist/utilities.svelte.js +20 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +24 -39
- package/package.json +41 -49
- package/dist/components/button/button.svelte +0 -105
- package/dist/components/button/button.svelte.d.ts +0 -4
- package/dist/components/button/index.js +0 -4
- package/dist/components/button/style.d.ts +0 -148
- package/dist/components/button/style.js +0 -248
- package/dist/components/input/index.js +0 -2
- package/dist/components/input/input.svelte +0 -103
- package/dist/components/input/input.svelte.d.ts +0 -4
- package/dist/components/input/style.d.ts +0 -316
- package/dist/components/input/style.js +0 -128
- package/dist/components/input-time/index.d.ts +0 -375
- package/dist/components/input-time/index.js +0 -144
- package/dist/components/input-time/input-time.svelte +0 -39
- package/dist/components/input-time/input-time.svelte.d.ts +0 -4
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { type PropColor, type PropVariant, isComponent, isSnippet } from '../index.js';
|
|
3
|
+
import type { Component, Snippet } from 'svelte';
|
|
4
|
+
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
5
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
|
+
import { maska } from 'maska/svelte';
|
|
7
|
+
import { type MaskInputOptions } from 'maska';
|
|
8
|
+
import { tv } from 'tailwind-variants';
|
|
9
|
+
|
|
10
|
+
export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The placeholder text when the input is empty.
|
|
14
|
+
*/
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @default primary
|
|
18
|
+
*/
|
|
19
|
+
color?: PropColor;
|
|
20
|
+
/**
|
|
21
|
+
* @default outline
|
|
22
|
+
*/
|
|
23
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
24
|
+
/**
|
|
25
|
+
* @default md
|
|
26
|
+
*/
|
|
27
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
28
|
+
/**
|
|
29
|
+
* @default off
|
|
30
|
+
*/
|
|
31
|
+
autocomplete?: 'on' | 'off';
|
|
32
|
+
/**
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
autofocus?: boolean | number;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Highlight the ring color like a focus state.
|
|
39
|
+
*/
|
|
40
|
+
highlight?: boolean;
|
|
41
|
+
value?: string;
|
|
42
|
+
icon?: string | Snippet | Component;
|
|
43
|
+
iconposition?: 'leading' | 'trailing';
|
|
44
|
+
leading?: string | Snippet | Component;
|
|
45
|
+
trailing?: string | Snippet | Component;
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
loadingicon?: string | Snippet | Component;
|
|
48
|
+
mask?: string | MaskInputOptions;
|
|
49
|
+
ui?: {
|
|
50
|
+
root?: ClassNameValue;
|
|
51
|
+
base?: ClassNameValue;
|
|
52
|
+
leading?: ClassNameValue;
|
|
53
|
+
icon?: ClassNameValue;
|
|
54
|
+
trailing?: ClassNameValue;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
let {
|
|
61
|
+
type,
|
|
62
|
+
value = $bindable(),
|
|
63
|
+
color = 'primary',
|
|
64
|
+
variant = 'outline',
|
|
65
|
+
size = 'md',
|
|
66
|
+
icon,
|
|
67
|
+
iconposition,
|
|
68
|
+
disabled,
|
|
69
|
+
highlight,
|
|
70
|
+
leading,
|
|
71
|
+
loading,
|
|
72
|
+
loadingicon = 'i-lucide-loader-circle',
|
|
73
|
+
required,
|
|
74
|
+
trailing,
|
|
75
|
+
mask,
|
|
76
|
+
ui = {},
|
|
77
|
+
...rest
|
|
78
|
+
}: InputProps = $props();
|
|
79
|
+
const id = $props.id();
|
|
80
|
+
|
|
81
|
+
const variants = $derived(
|
|
82
|
+
tv({
|
|
83
|
+
slots: {
|
|
84
|
+
root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
|
|
85
|
+
base: 'appearance-none outline-none placeholder:text-muted',
|
|
86
|
+
leading: 'text-muted',
|
|
87
|
+
trailing: 'text-muted',
|
|
88
|
+
icon: '',
|
|
89
|
+
},
|
|
90
|
+
variants: {
|
|
91
|
+
fieldGroup: {
|
|
92
|
+
horizontal: {
|
|
93
|
+
root: '',
|
|
94
|
+
base: '',
|
|
95
|
+
},
|
|
96
|
+
vertical: {
|
|
97
|
+
root: '',
|
|
98
|
+
base: '',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
size: {
|
|
102
|
+
xs: {
|
|
103
|
+
base: 'px-2 py-1 text-xs gap-1',
|
|
104
|
+
leading: 'ps-2',
|
|
105
|
+
trailing: 'pe-2',
|
|
106
|
+
icon: 'size-4',
|
|
107
|
+
},
|
|
108
|
+
sm: {
|
|
109
|
+
base: 'px-2.5 py-1.5 text-xs gap-1.5',
|
|
110
|
+
leading: 'ps-2.5',
|
|
111
|
+
trailing: 'pe-2.5',
|
|
112
|
+
icon: 'size-4',
|
|
113
|
+
},
|
|
114
|
+
md: {
|
|
115
|
+
base: 'px-2.5 py-1.5 text-sm gap-1.5',
|
|
116
|
+
leading: 'ps-2.5',
|
|
117
|
+
trailing: 'pe-2.5',
|
|
118
|
+
icon: 'size-5',
|
|
119
|
+
},
|
|
120
|
+
lg: {
|
|
121
|
+
base: 'px-3 py-2 text-sm gap-2',
|
|
122
|
+
leading: 'ps-3',
|
|
123
|
+
trailing: 'pe-3',
|
|
124
|
+
icon: 'size-5',
|
|
125
|
+
},
|
|
126
|
+
xl: {
|
|
127
|
+
base: 'px-3 py-2 text-base gap-2',
|
|
128
|
+
leading: 'ps-3',
|
|
129
|
+
trailing: 'pe-3',
|
|
130
|
+
icon: 'size-6',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
variant: {
|
|
134
|
+
outline: { root: 'ring ring-dimmed' },
|
|
135
|
+
soft: {
|
|
136
|
+
root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated',
|
|
137
|
+
},
|
|
138
|
+
subtle: { root: 'ring ring-dimmed' },
|
|
139
|
+
ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
|
|
140
|
+
none: { root: '' },
|
|
141
|
+
},
|
|
142
|
+
color: {
|
|
143
|
+
primary: { root: '' },
|
|
144
|
+
surface: { root: '' },
|
|
145
|
+
info: { root: '' },
|
|
146
|
+
success: { root: '' },
|
|
147
|
+
warning: { root: '' },
|
|
148
|
+
error: { root: '' },
|
|
149
|
+
},
|
|
150
|
+
leading: {
|
|
151
|
+
false: { leading: 'hidden' },
|
|
152
|
+
},
|
|
153
|
+
trailing: {
|
|
154
|
+
false: { trailing: 'hidden' },
|
|
155
|
+
},
|
|
156
|
+
loading: {
|
|
157
|
+
true: '',
|
|
158
|
+
},
|
|
159
|
+
highlight: {
|
|
160
|
+
true: '',
|
|
161
|
+
},
|
|
162
|
+
type: {
|
|
163
|
+
file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
compoundVariants: [
|
|
167
|
+
{
|
|
168
|
+
color: 'primary',
|
|
169
|
+
variant: ['outline', 'subtle'],
|
|
170
|
+
class: {
|
|
171
|
+
root: 'focus-within:(ring-primary-500 ring-2)',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
color: 'surface',
|
|
176
|
+
variant: ['outline', 'subtle'],
|
|
177
|
+
class: {
|
|
178
|
+
root: 'focus-within:(ring-surface-800 ring-2)',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
color: 'info',
|
|
183
|
+
variant: ['outline', 'subtle'],
|
|
184
|
+
class: {
|
|
185
|
+
root: 'focus-within:(ring-info-500 ring-2)',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
color: 'success',
|
|
190
|
+
variant: ['outline', 'subtle'],
|
|
191
|
+
class: {
|
|
192
|
+
root: 'focus-within:(ring-success-500 ring-2)',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
color: 'warning',
|
|
197
|
+
variant: ['outline', 'subtle'],
|
|
198
|
+
class: {
|
|
199
|
+
root: 'focus-within:(ring-warning-500 ring-2)',
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
color: 'error',
|
|
204
|
+
variant: ['outline', 'subtle'],
|
|
205
|
+
class: {
|
|
206
|
+
root: 'focus-within:(ring-error-500 ring-2)',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
})({
|
|
211
|
+
size,
|
|
212
|
+
color,
|
|
213
|
+
variant,
|
|
214
|
+
highlight,
|
|
215
|
+
loading,
|
|
216
|
+
leading: !!leading || (!!icon && iconposition === 'leading') || loading,
|
|
217
|
+
trailing: !!trailing || (!!icon && iconposition === 'trailing'),
|
|
218
|
+
type: type === 'file' ? 'file' : undefined,
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
</script>
|
|
222
|
+
|
|
223
|
+
<div class={variants.root({ class: ui.root })}>
|
|
224
|
+
{#if leading || (icon && iconposition === 'leading') || loading}
|
|
225
|
+
{@const TrailingIcon = loading ? loadingicon : icon}
|
|
226
|
+
|
|
227
|
+
<span class={variants.leading({ class: ui.leading })}>
|
|
228
|
+
{#if !!leading && !loading}
|
|
229
|
+
{#if typeof leading === 'string'}
|
|
230
|
+
{leading}
|
|
231
|
+
{:else if isSnippet(leading)}
|
|
232
|
+
{@render leading()}
|
|
233
|
+
{:else if isComponent(leading)}
|
|
234
|
+
{@const Leading = leading}
|
|
235
|
+
<Leading />
|
|
236
|
+
{/if}
|
|
237
|
+
{:else if typeof TrailingIcon === 'string'}
|
|
238
|
+
<div
|
|
239
|
+
class={variants.icon({
|
|
240
|
+
class: [loading && 'animate-spin', TrailingIcon, ui.icon],
|
|
241
|
+
})}
|
|
242
|
+
></div>
|
|
243
|
+
{:else if isSnippet(TrailingIcon)}
|
|
244
|
+
{@render TrailingIcon()}
|
|
245
|
+
{:else if isComponent(TrailingIcon)}
|
|
246
|
+
<TrailingIcon class={variants.icon({ class: [ui.icon] })} />
|
|
247
|
+
{/if}
|
|
248
|
+
</span>
|
|
249
|
+
{/if}
|
|
250
|
+
|
|
251
|
+
<input
|
|
252
|
+
{id}
|
|
253
|
+
{type}
|
|
254
|
+
{...rest}
|
|
255
|
+
class={variants.base({ class: [ui.base] })}
|
|
256
|
+
{...rest}
|
|
257
|
+
use:maska={mask}
|
|
258
|
+
/>
|
|
259
|
+
|
|
260
|
+
{#if trailing || (icon && iconposition === 'trailing')}
|
|
261
|
+
<span class={variants.trailing({ class: ui.trailing })}>
|
|
262
|
+
{#if !!trailing}
|
|
263
|
+
{#if typeof trailing === 'string'}
|
|
264
|
+
{trailing}
|
|
265
|
+
{:else if isSnippet(trailing)}
|
|
266
|
+
{@render trailing()}
|
|
267
|
+
{:else if isComponent(trailing)}
|
|
268
|
+
{@const Trailing = trailing}
|
|
269
|
+
<Trailing />
|
|
270
|
+
{/if}
|
|
271
|
+
{:else if typeof icon === 'string'}
|
|
272
|
+
<div
|
|
273
|
+
class={variants.icon({
|
|
274
|
+
class: [icon, ui.icon],
|
|
275
|
+
})}
|
|
276
|
+
></div>
|
|
277
|
+
{:else if isSnippet(icon)}
|
|
278
|
+
{@render icon()}
|
|
279
|
+
{:else if isComponent(icon)}
|
|
280
|
+
{@const Icon = icon}
|
|
281
|
+
<Icon class={variants.icon({ class: [ui.icon] })} />
|
|
282
|
+
{/if}
|
|
283
|
+
</span>
|
|
284
|
+
{/if}
|
|
285
|
+
</div>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
import type
|
|
6
|
-
export { default as Input } from './input.svelte';
|
|
7
|
-
export * from './style.js';
|
|
5
|
+
import { type MaskInputOptions } from 'maska';
|
|
8
6
|
export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
9
7
|
name?: string;
|
|
10
8
|
/**
|
|
@@ -18,7 +16,7 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
|
18
16
|
/**
|
|
19
17
|
* @default outline
|
|
20
18
|
*/
|
|
21
|
-
variant?:
|
|
19
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
22
20
|
/**
|
|
23
21
|
* @default md
|
|
24
22
|
*/
|
|
@@ -52,3 +50,6 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
|
52
50
|
trailing?: ClassNameValue;
|
|
53
51
|
};
|
|
54
52
|
};
|
|
53
|
+
declare const Input: Component<InputProps, {}, "value">;
|
|
54
|
+
type Input = ReturnType<typeof Input>;
|
|
55
|
+
export default Input;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
2
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
children?: Snippet;
|
|
9
9
|
value?: string;
|
|
10
10
|
color?: PropColor;
|
|
11
|
-
variant?:
|
|
11
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
12
12
|
size?: 'sm' | 'md' | 'lg';
|
|
13
13
|
class?: ClassNameValue;
|
|
14
14
|
};
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
pageup: '⇞',
|
|
36
36
|
pagedown: '⇟',
|
|
37
37
|
home: '↖',
|
|
38
|
-
end: '↘'
|
|
38
|
+
end: '↘',
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
export type KbdKey = keyof typeof KBD_KEYS;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
color = 'primary',
|
|
50
50
|
variant = 'outline',
|
|
51
51
|
size = 'md',
|
|
52
|
-
class: klass
|
|
52
|
+
class: klass,
|
|
53
53
|
}: KbdProps = $props();
|
|
54
54
|
|
|
55
55
|
const macOS = $derived.by(() => {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
const kbdKeysSpecificMap = $derived({
|
|
62
62
|
meta: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
63
63
|
alt: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
64
|
-
ctrl: macOS ? KBD_KEYS.option : 'Alt'
|
|
64
|
+
ctrl: macOS ? KBD_KEYS.option : 'Alt',
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
function getKey(value?: KbdKey | string) {
|
|
@@ -87,148 +87,148 @@
|
|
|
87
87
|
info: '',
|
|
88
88
|
success: '',
|
|
89
89
|
warning: '',
|
|
90
|
-
error: ''
|
|
90
|
+
error: '',
|
|
91
91
|
},
|
|
92
92
|
variant: {
|
|
93
93
|
solid: 'text-white border border-b-3 border-r-2',
|
|
94
94
|
outline: 'border border-b-3 border-r-2',
|
|
95
95
|
soft: '',
|
|
96
|
-
subtle: 'border border-b-3 border-r-2'
|
|
96
|
+
subtle: 'border border-b-3 border-r-2',
|
|
97
97
|
},
|
|
98
98
|
size: {
|
|
99
99
|
sm: 'h-4 min-w-4',
|
|
100
100
|
md: 'h-5 min-w-5',
|
|
101
|
-
lg: 'h-6 min-w-6'
|
|
102
|
-
}
|
|
101
|
+
lg: 'h-6 min-w-6',
|
|
102
|
+
},
|
|
103
103
|
},
|
|
104
104
|
compoundVariants: [
|
|
105
105
|
{
|
|
106
106
|
color: 'primary',
|
|
107
107
|
variant: 'outline',
|
|
108
|
-
class: 'border-primary text-primary'
|
|
108
|
+
class: 'border-primary text-primary',
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
color: 'surface',
|
|
112
112
|
variant: 'outline',
|
|
113
|
-
class: 'border-surface-600'
|
|
113
|
+
class: 'border-surface-600',
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
color: 'info',
|
|
117
117
|
variant: 'outline',
|
|
118
|
-
class: 'border-info text-info'
|
|
118
|
+
class: 'border-info text-info',
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
color: 'success',
|
|
122
122
|
variant: 'outline',
|
|
123
|
-
class: 'border-success text-success'
|
|
123
|
+
class: 'border-success text-success',
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
color: 'warning',
|
|
127
127
|
variant: 'outline',
|
|
128
|
-
class: 'border-warning text-warning'
|
|
128
|
+
class: 'border-warning text-warning',
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
color: 'error',
|
|
132
132
|
variant: 'outline',
|
|
133
|
-
class: 'border-error text-error'
|
|
133
|
+
class: 'border-error text-error',
|
|
134
134
|
},
|
|
135
135
|
|
|
136
136
|
// SOLID
|
|
137
137
|
{
|
|
138
138
|
color: 'primary',
|
|
139
139
|
variant: 'solid',
|
|
140
|
-
class: 'bg-primary border-primary-600'
|
|
140
|
+
class: 'bg-primary border-primary-600',
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
color: 'surface',
|
|
144
144
|
variant: 'solid',
|
|
145
|
-
class: 'bg-surface-600 border-surface-700'
|
|
145
|
+
class: 'bg-surface-600 border-surface-700',
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
color: 'info',
|
|
149
149
|
variant: 'solid',
|
|
150
|
-
class: 'bg-info border-info-600'
|
|
150
|
+
class: 'bg-info border-info-600',
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
color: 'success',
|
|
154
154
|
variant: 'solid',
|
|
155
|
-
class: 'bg-success border-success-600'
|
|
155
|
+
class: 'bg-success border-success-600',
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
color: 'warning',
|
|
159
159
|
variant: 'solid',
|
|
160
|
-
class: 'bg-warning border-warning-600'
|
|
160
|
+
class: 'bg-warning border-warning-600',
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
color: 'error',
|
|
164
164
|
variant: 'solid',
|
|
165
|
-
class: 'bg-error border-error-600'
|
|
165
|
+
class: 'bg-error border-error-600',
|
|
166
166
|
},
|
|
167
167
|
|
|
168
168
|
// SOFT
|
|
169
169
|
{
|
|
170
170
|
color: 'primary',
|
|
171
171
|
variant: 'soft',
|
|
172
|
-
class: 'bg-primary-100 text-primary'
|
|
172
|
+
class: 'bg-primary-100 text-primary',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
color: 'surface',
|
|
176
176
|
variant: 'soft',
|
|
177
|
-
class: 'bg-surface-100 text-surface-700'
|
|
177
|
+
class: 'bg-surface-100 text-surface-700',
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
color: 'info',
|
|
181
181
|
variant: 'soft',
|
|
182
|
-
class: 'bg-info-100 text-info'
|
|
182
|
+
class: 'bg-info-100 text-info',
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
color: 'success',
|
|
186
186
|
variant: 'soft',
|
|
187
|
-
class: 'bg-success-100 text-success'
|
|
187
|
+
class: 'bg-success-100 text-success',
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
color: 'warning',
|
|
191
191
|
variant: 'soft',
|
|
192
|
-
class: 'bg-warning-100 text-warning'
|
|
192
|
+
class: 'bg-warning-100 text-warning',
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
195
|
color: 'error',
|
|
196
196
|
variant: 'soft',
|
|
197
|
-
class: 'bg-error-100 text-error'
|
|
197
|
+
class: 'bg-error-100 text-error',
|
|
198
198
|
},
|
|
199
199
|
|
|
200
200
|
// SUBTLE
|
|
201
201
|
{
|
|
202
202
|
color: 'primary',
|
|
203
203
|
variant: 'subtle',
|
|
204
|
-
class: 'bg-primary-100 border-primary-200 text-primary'
|
|
204
|
+
class: 'bg-primary-100 border-primary-200 text-primary',
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
207
|
color: 'surface',
|
|
208
208
|
variant: 'subtle',
|
|
209
|
-
class: 'bg-surface-100 border-surface-200 text-surface-700'
|
|
209
|
+
class: 'bg-surface-100 border-surface-200 text-surface-700',
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
color: 'info',
|
|
213
213
|
variant: 'subtle',
|
|
214
|
-
class: 'bg-info-100 border-info-200 text-info'
|
|
214
|
+
class: 'bg-info-100 border-info-200 text-info',
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
color: 'success',
|
|
218
218
|
variant: 'subtle',
|
|
219
|
-
class: 'bg-success-100 border-success-200 text-success'
|
|
219
|
+
class: 'bg-success-100 border-success-200 text-success',
|
|
220
220
|
},
|
|
221
221
|
{
|
|
222
222
|
color: 'warning',
|
|
223
223
|
variant: 'subtle',
|
|
224
|
-
class: 'bg-warning-100 border-warning-200 text-warning'
|
|
224
|
+
class: 'bg-warning-100 border-warning-200 text-warning',
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
color: 'error',
|
|
228
228
|
variant: 'subtle',
|
|
229
|
-
class: 'bg-error-100 border-error-200 text-error'
|
|
230
|
-
}
|
|
231
|
-
]
|
|
229
|
+
class: 'bg-error-100 border-error-200 text-error',
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
232
|
})({ color, variant, size, class: [klass] })}
|
|
233
233
|
>
|
|
234
234
|
{#if value}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
1
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
export type KbdProps = {
|
|
5
5
|
children?: Snippet;
|
|
6
6
|
value?: string;
|
|
7
7
|
color?: PropColor;
|
|
8
|
-
variant?:
|
|
8
|
+
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
9
9
|
size?: 'sm' | 'md' | 'lg';
|
|
10
10
|
class?: ClassNameValue;
|
|
11
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
2
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export type PinInputProps = {
|
|
8
8
|
value?: number[] | string[];
|
|
9
9
|
color?: PropColor;
|
|
10
|
-
variant?:
|
|
10
|
+
variant?: Omit<PropVariant, 'solid'>;
|
|
11
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
12
|
length?: number;
|
|
13
13
|
autofocus?: boolean | number;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
'Tab',
|
|
37
37
|
'Shift',
|
|
38
38
|
'Control',
|
|
39
|
-
'Meta'
|
|
39
|
+
'Meta',
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
let {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
placeholder,
|
|
55
55
|
required,
|
|
56
56
|
type = 'text',
|
|
57
|
-
ui = {}
|
|
57
|
+
ui = {},
|
|
58
58
|
}: PinInputProps = $props();
|
|
59
59
|
const internal_id = $props.id();
|
|
60
60
|
let input_els = $state<HTMLInputElement[]>([]);
|
|
@@ -69,60 +69,60 @@
|
|
|
69
69
|
info: '',
|
|
70
70
|
success: '',
|
|
71
71
|
warning: '',
|
|
72
|
-
error: ''
|
|
72
|
+
error: '',
|
|
73
73
|
},
|
|
74
74
|
size: {
|
|
75
75
|
xs: { root: '', cell: 'size-6' },
|
|
76
76
|
sm: { root: '', cell: 'size-7' },
|
|
77
77
|
md: { root: '', cell: 'size-8' },
|
|
78
78
|
lg: { root: '', cell: 'size-9' },
|
|
79
|
-
xl: { root: '', cell: 'size-10' }
|
|
79
|
+
xl: { root: '', cell: 'size-10' },
|
|
80
80
|
},
|
|
81
81
|
variant: {
|
|
82
82
|
outline: {
|
|
83
|
-
cell: 'border border-surface-300 focus:(border-2)'
|
|
83
|
+
cell: 'border border-surface-300 focus:(border-2)',
|
|
84
84
|
},
|
|
85
85
|
soft: {
|
|
86
|
-
cell: 'bg-surface-50 hover:
|
|
86
|
+
cell: 'bg-surface-50 hover:bg-surface-100 focus:bg-surface-100',
|
|
87
87
|
},
|
|
88
88
|
subtle: { cell: 'border border-surface-300 bg-surface-100 focus:(border-2)' },
|
|
89
|
-
ghost: { cell: 'hover:
|
|
90
|
-
none: { cell: '' }
|
|
91
|
-
}
|
|
89
|
+
ghost: { cell: 'hover:bg-surface-100 focus:bg-surface-100' },
|
|
90
|
+
none: { cell: '' },
|
|
91
|
+
},
|
|
92
92
|
},
|
|
93
93
|
compoundVariants: [
|
|
94
94
|
{
|
|
95
95
|
variant: ['outline', 'subtle'],
|
|
96
96
|
color: 'primary',
|
|
97
|
-
class: { cell: 'focus:
|
|
97
|
+
class: { cell: 'focus:border-primary-500' },
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
variant: ['outline', 'subtle'],
|
|
101
101
|
color: 'surface',
|
|
102
|
-
class: { cell: 'focus:
|
|
102
|
+
class: { cell: 'focus:border-surface-900' },
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
variant: ['outline', 'subtle'],
|
|
106
106
|
color: 'info',
|
|
107
|
-
class: { cell: 'focus:
|
|
107
|
+
class: { cell: 'focus:border-info-500' },
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
variant: ['outline', 'subtle'],
|
|
111
111
|
color: 'success',
|
|
112
|
-
class: { cell: 'focus:
|
|
112
|
+
class: { cell: 'focus:border-success-500' },
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
variant: ['outline', 'subtle'],
|
|
116
116
|
color: 'warning',
|
|
117
|
-
class: { cell: 'focus:
|
|
117
|
+
class: { cell: 'focus:border-warning-500' },
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
variant: ['outline', 'subtle'],
|
|
121
121
|
color: 'error',
|
|
122
|
-
class: { cell: 'focus:
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
})({ size, color, variant, class: ui.root })
|
|
122
|
+
class: { cell: 'focus:border-error-500' },
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
})({ size, color, variant, class: ui.root }),
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
onMount(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
1
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
2
2
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
3
|
export type PinInputProps = {
|
|
4
4
|
value?: number[] | string[];
|
|
5
5
|
color?: PropColor;
|
|
6
|
-
variant?:
|
|
6
|
+
variant?: Omit<PropVariant, 'solid'>;
|
|
7
7
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
8
|
length?: number;
|
|
9
9
|
autofocus?: boolean | number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
2
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
3
3
|
import { Select } from 'bits-ui';
|
|
4
4
|
import type { Component, Snippet } from 'svelte';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
item?: Snippet<[{ item: SelectItem<T> }]>;
|
|
19
19
|
color?: PropColor;
|
|
20
20
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
21
|
-
variant?:
|
|
21
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
22
22
|
highlight?: boolean;
|
|
23
23
|
placeholder?: string;
|
|
24
24
|
} & (
|