uisv 0.0.7 → 0.0.9
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/package.json +38 -37
- package/dist/components/accordion.svelte +0 -108
- package/dist/components/accordion.svelte.d.ts +0 -58
- package/dist/components/alert.svelte +0 -272
- package/dist/components/alert.svelte.d.ts +0 -24
- package/dist/components/badge.svelte +0 -227
- package/dist/components/badge.svelte.d.ts +0 -19
- package/dist/components/banner.svelte +0 -255
- package/dist/components/banner.svelte.d.ts +0 -24
- package/dist/components/button.svelte +0 -384
- package/dist/components/button.svelte.d.ts +0 -49
- package/dist/components/card.svelte +0 -70
- package/dist/components/card.svelte.d.ts +0 -17
- package/dist/components/checkbox.svelte +0 -175
- package/dist/components/checkbox.svelte.d.ts +0 -27
- package/dist/components/checkboxgroup.svelte +0 -259
- package/dist/components/checkboxgroup.svelte.d.ts +0 -26
- package/dist/components/chip.svelte +0 -82
- package/dist/components/chip.svelte.d.ts +0 -17
- package/dist/components/h1.svelte +0 -28
- package/dist/components/h1.svelte.d.ts +0 -11
- package/dist/components/h2.svelte +0 -30
- package/dist/components/h2.svelte.d.ts +0 -11
- package/dist/components/index.d.ts +0 -34
- package/dist/components/index.js +0 -34
- package/dist/components/kbd.svelte +0 -239
- package/dist/components/kbd.svelte.d.ts +0 -40
- package/dist/components/p.svelte +0 -22
- package/dist/components/p.svelte.d.ts +0 -11
- package/dist/components/pin-input.svelte +0 -162
- package/dist/components/pin-input.svelte.d.ts +0 -25
- package/dist/components/placeholder.svelte +0 -32
- package/dist/components/placeholder.svelte.d.ts +0 -7
- package/dist/components/progress.svelte +0 -124
- package/dist/components/progress.svelte.d.ts +0 -21
- package/dist/components/slider.svelte +0 -172
- package/dist/components/slider.svelte.d.ts +0 -44
- package/dist/components/switch.svelte +0 -180
- package/dist/components/switch.svelte.d.ts +0 -27
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/utils/common.d.ts +0 -13
- package/dist/utils/common.js +0 -16
- package/dist/vite.d.ts +0 -38
- package/dist/vite.js +0 -57
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
6
|
-
|
|
7
|
-
export type KbdProps = {
|
|
8
|
-
children?: Snippet;
|
|
9
|
-
value?: string;
|
|
10
|
-
color?: PropColor;
|
|
11
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
12
|
-
size?: 'sm' | 'md' | 'lg';
|
|
13
|
-
class?: ClassNameValue;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const KBD_KEYS = {
|
|
17
|
-
meta: '',
|
|
18
|
-
ctrl: '',
|
|
19
|
-
alt: '',
|
|
20
|
-
win: '⊞',
|
|
21
|
-
command: '⌘',
|
|
22
|
-
shift: '⇧',
|
|
23
|
-
control: '⌃',
|
|
24
|
-
option: '⌥',
|
|
25
|
-
enter: '↵',
|
|
26
|
-
delete: '⌦',
|
|
27
|
-
backspace: '⌫',
|
|
28
|
-
escape: 'Esc',
|
|
29
|
-
tab: '⇥',
|
|
30
|
-
capslock: '⇪',
|
|
31
|
-
arrowup: '↑',
|
|
32
|
-
arrowright: '→',
|
|
33
|
-
arrowdown: '↓',
|
|
34
|
-
arrowleft: '←',
|
|
35
|
-
pageup: '⇞',
|
|
36
|
-
pagedown: '⇟',
|
|
37
|
-
home: '↖',
|
|
38
|
-
end: '↘'
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type KbdKey = keyof typeof KBD_KEYS;
|
|
42
|
-
export type KbdSpecificKey = 'meta' | 'alt' | 'ctrl';
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<script lang="ts">
|
|
46
|
-
const {
|
|
47
|
-
children,
|
|
48
|
-
value,
|
|
49
|
-
color = 'primary',
|
|
50
|
-
variant = 'outline',
|
|
51
|
-
size = 'md',
|
|
52
|
-
class: klass
|
|
53
|
-
}: KbdProps = $props();
|
|
54
|
-
|
|
55
|
-
const macOS = $derived.by(() => {
|
|
56
|
-
if (typeof navigator === 'undefined') return null;
|
|
57
|
-
if (!navigator.userAgent) return null;
|
|
58
|
-
return navigator.userAgent.match(/Macintosh;/);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const kbdKeysSpecificMap = $derived({
|
|
62
|
-
meta: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
63
|
-
alt: macOS ? KBD_KEYS.command : 'Ctrl',
|
|
64
|
-
ctrl: macOS ? KBD_KEYS.option : 'Alt'
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
function getKey(value?: KbdKey | string) {
|
|
68
|
-
if (!value) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (['meta', 'alt', 'ctrl'].includes(value)) {
|
|
73
|
-
return kbdKeysSpecificMap[value as KbdSpecificKey];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return KBD_KEYS[value as KbdKey] || value.toUpperCase();
|
|
77
|
-
}
|
|
78
|
-
</script>
|
|
79
|
-
|
|
80
|
-
<kbd
|
|
81
|
-
class={tv({
|
|
82
|
-
base: 'inline-flex items-center justify-center px-1 rounded-sm font-medium font-sans text-xs',
|
|
83
|
-
variants: {
|
|
84
|
-
color: {
|
|
85
|
-
primary: '',
|
|
86
|
-
secondary: '',
|
|
87
|
-
info: '',
|
|
88
|
-
success: '',
|
|
89
|
-
warning: '',
|
|
90
|
-
error: ''
|
|
91
|
-
},
|
|
92
|
-
variant: {
|
|
93
|
-
solid: 'text-white border border-b-3 border-r-2',
|
|
94
|
-
outline: 'border border-b-3 border-r-2',
|
|
95
|
-
soft: '',
|
|
96
|
-
subtle: 'border border-b-3 border-r-2'
|
|
97
|
-
},
|
|
98
|
-
size: {
|
|
99
|
-
sm: 'h-4 min-w-4',
|
|
100
|
-
md: 'h-5 min-w-5',
|
|
101
|
-
lg: 'h-6 min-w-6'
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
compoundVariants: [
|
|
105
|
-
{
|
|
106
|
-
color: 'primary',
|
|
107
|
-
variant: 'outline',
|
|
108
|
-
class: 'border-primary text-primary'
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
color: 'secondary',
|
|
112
|
-
variant: 'outline',
|
|
113
|
-
class: 'border-secondary-600'
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
color: 'info',
|
|
117
|
-
variant: 'outline',
|
|
118
|
-
class: 'border-info text-info'
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
color: 'success',
|
|
122
|
-
variant: 'outline',
|
|
123
|
-
class: 'border-success text-success'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
color: 'warning',
|
|
127
|
-
variant: 'outline',
|
|
128
|
-
class: 'border-warning text-warning'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
color: 'error',
|
|
132
|
-
variant: 'outline',
|
|
133
|
-
class: 'border-error text-error'
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
// SOLID
|
|
137
|
-
{
|
|
138
|
-
color: 'primary',
|
|
139
|
-
variant: 'solid',
|
|
140
|
-
class: 'bg-primary border-primary-600'
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
color: 'secondary',
|
|
144
|
-
variant: 'solid',
|
|
145
|
-
class: 'bg-secondary-600 border-secondary-700'
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
color: 'info',
|
|
149
|
-
variant: 'solid',
|
|
150
|
-
class: 'bg-info border-info-600'
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
color: 'success',
|
|
154
|
-
variant: 'solid',
|
|
155
|
-
class: 'bg-success border-success-600'
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
color: 'warning',
|
|
159
|
-
variant: 'solid',
|
|
160
|
-
class: 'bg-warning border-warning-600'
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
color: 'error',
|
|
164
|
-
variant: 'solid',
|
|
165
|
-
class: 'bg-error border-error-600'
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
// SOFT
|
|
169
|
-
{
|
|
170
|
-
color: 'primary',
|
|
171
|
-
variant: 'soft',
|
|
172
|
-
class: 'bg-primary-100 text-primary'
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
color: 'secondary',
|
|
176
|
-
variant: 'soft',
|
|
177
|
-
class: 'bg-secondary-100 text-secondary-700'
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
color: 'info',
|
|
181
|
-
variant: 'soft',
|
|
182
|
-
class: 'bg-info-100 text-info'
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
color: 'success',
|
|
186
|
-
variant: 'soft',
|
|
187
|
-
class: 'bg-success-100 text-success'
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
color: 'warning',
|
|
191
|
-
variant: 'soft',
|
|
192
|
-
class: 'bg-warning-100 text-warning'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
color: 'error',
|
|
196
|
-
variant: 'soft',
|
|
197
|
-
class: 'bg-error-100 text-error'
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
// SUBTLE
|
|
201
|
-
{
|
|
202
|
-
color: 'primary',
|
|
203
|
-
variant: 'subtle',
|
|
204
|
-
class: 'bg-primary-100 border-primary-200 text-primary'
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
color: 'secondary',
|
|
208
|
-
variant: 'subtle',
|
|
209
|
-
class: 'bg-secondary-100 border-secondary-200 text-secondary-700'
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
color: 'info',
|
|
213
|
-
variant: 'subtle',
|
|
214
|
-
class: 'bg-info-100 border-info-200 text-info'
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
color: 'success',
|
|
218
|
-
variant: 'subtle',
|
|
219
|
-
class: 'bg-success-100 border-success-200 text-success'
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
color: 'warning',
|
|
223
|
-
variant: 'subtle',
|
|
224
|
-
class: 'bg-warning-100 border-warning-200 text-warning'
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
color: 'error',
|
|
228
|
-
variant: 'subtle',
|
|
229
|
-
class: 'bg-error-100 border-error-200 text-error'
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
})({ color, variant, size, class: [klass] })}
|
|
233
|
-
>
|
|
234
|
-
{#if value}
|
|
235
|
-
{getKey(value)}
|
|
236
|
-
{:else}
|
|
237
|
-
{@render children?.()}
|
|
238
|
-
{/if}
|
|
239
|
-
</kbd>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
export type KbdProps = {
|
|
5
|
-
children?: Snippet;
|
|
6
|
-
value?: string;
|
|
7
|
-
color?: PropColor;
|
|
8
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
9
|
-
size?: 'sm' | 'md' | 'lg';
|
|
10
|
-
class?: ClassNameValue;
|
|
11
|
-
};
|
|
12
|
-
export declare const KBD_KEYS: {
|
|
13
|
-
meta: string;
|
|
14
|
-
ctrl: string;
|
|
15
|
-
alt: string;
|
|
16
|
-
win: string;
|
|
17
|
-
command: string;
|
|
18
|
-
shift: string;
|
|
19
|
-
control: string;
|
|
20
|
-
option: string;
|
|
21
|
-
enter: string;
|
|
22
|
-
delete: string;
|
|
23
|
-
backspace: string;
|
|
24
|
-
escape: string;
|
|
25
|
-
tab: string;
|
|
26
|
-
capslock: string;
|
|
27
|
-
arrowup: string;
|
|
28
|
-
arrowright: string;
|
|
29
|
-
arrowdown: string;
|
|
30
|
-
arrowleft: string;
|
|
31
|
-
pageup: string;
|
|
32
|
-
pagedown: string;
|
|
33
|
-
home: string;
|
|
34
|
-
end: string;
|
|
35
|
-
};
|
|
36
|
-
export type KbdKey = keyof typeof KBD_KEYS;
|
|
37
|
-
export type KbdSpecificKey = 'meta' | 'alt' | 'ctrl';
|
|
38
|
-
declare const Kbd: import("svelte").Component<KbdProps, {}, "">;
|
|
39
|
-
type Kbd = ReturnType<typeof Kbd>;
|
|
40
|
-
export default Kbd;
|
package/dist/components/p.svelte
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
import { tv } from 'tailwind-variants';
|
|
5
|
-
|
|
6
|
-
export type ParagraphProps = {
|
|
7
|
-
children: Snippet;
|
|
8
|
-
ui?: { root?: ClassNameValue };
|
|
9
|
-
};
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
const { children, ui = {} }: ParagraphProps = $props();
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<p
|
|
17
|
-
class={tv({
|
|
18
|
-
base: 'my-5 leading-7 text-pretty'
|
|
19
|
-
})({ class: ui.root })}
|
|
20
|
-
>
|
|
21
|
-
{@render children()}
|
|
22
|
-
</p>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
export type ParagraphProps = {
|
|
4
|
-
children: Snippet;
|
|
5
|
-
ui?: {
|
|
6
|
-
root?: ClassNameValue;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
declare const P: import("svelte").Component<ParagraphProps, {}, "">;
|
|
10
|
-
type P = ReturnType<typeof P>;
|
|
11
|
-
export default P;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
3
|
-
import { onMount } from 'svelte';
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
6
|
-
|
|
7
|
-
export type PinInputProps = {
|
|
8
|
-
value?: number[] | string[];
|
|
9
|
-
color?: PropColor;
|
|
10
|
-
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
11
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
-
length?: number;
|
|
13
|
-
autofocus?: boolean | number;
|
|
14
|
-
id?: string;
|
|
15
|
-
mask?: boolean;
|
|
16
|
-
name?: string;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
otp?: boolean;
|
|
19
|
-
placeholder?: string;
|
|
20
|
-
required?: boolean;
|
|
21
|
-
type?: 'text' | 'number';
|
|
22
|
-
ui?: { root?: ClassNameValue; cell?: ClassNameValue };
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<script lang="ts">
|
|
27
|
-
const KEYS_TO_IGNORE = [
|
|
28
|
-
'ArrowLeft',
|
|
29
|
-
'ArrowRight',
|
|
30
|
-
'ArrowUp',
|
|
31
|
-
'ArrowDown',
|
|
32
|
-
'Home',
|
|
33
|
-
'End',
|
|
34
|
-
'Escape',
|
|
35
|
-
'Enter',
|
|
36
|
-
'Tab',
|
|
37
|
-
'Shift',
|
|
38
|
-
'Control',
|
|
39
|
-
'Meta'
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
let {
|
|
43
|
-
value = $bindable([]),
|
|
44
|
-
color = 'primary',
|
|
45
|
-
variant = 'outline',
|
|
46
|
-
size = 'md',
|
|
47
|
-
length = 5,
|
|
48
|
-
autofocus,
|
|
49
|
-
id,
|
|
50
|
-
mask,
|
|
51
|
-
name,
|
|
52
|
-
disabled,
|
|
53
|
-
otp,
|
|
54
|
-
placeholder,
|
|
55
|
-
required,
|
|
56
|
-
type = 'text',
|
|
57
|
-
ui = {}
|
|
58
|
-
}: PinInputProps = $props();
|
|
59
|
-
const internal_id = $props.id();
|
|
60
|
-
let input_els = $state<HTMLInputElement[]>([]);
|
|
61
|
-
|
|
62
|
-
const classes = $derived(
|
|
63
|
-
tv({
|
|
64
|
-
slots: { root: 'flex gap-2', cell: 'rounded text-center outline-none transition relative' },
|
|
65
|
-
variants: {
|
|
66
|
-
color: {
|
|
67
|
-
primary: '',
|
|
68
|
-
secondary: '',
|
|
69
|
-
info: '',
|
|
70
|
-
success: '',
|
|
71
|
-
warning: '',
|
|
72
|
-
error: ''
|
|
73
|
-
},
|
|
74
|
-
size: {
|
|
75
|
-
xs: { root: '', cell: 'size-6' },
|
|
76
|
-
sm: { root: '', cell: 'size-7' },
|
|
77
|
-
md: { root: '', cell: 'size-8' },
|
|
78
|
-
lg: { root: '', cell: 'size-9' },
|
|
79
|
-
xl: { root: '', cell: 'size-10' }
|
|
80
|
-
},
|
|
81
|
-
variant: {
|
|
82
|
-
outline: {
|
|
83
|
-
cell: 'border border-secondary-300 focus:(border-2)'
|
|
84
|
-
},
|
|
85
|
-
soft: {
|
|
86
|
-
cell: 'bg-secondary-50 hover:(bg-secondary-100) focus:(bg-secondary-100)'
|
|
87
|
-
},
|
|
88
|
-
subtle: { cell: 'border border-secondary-300 bg-secondary-100 focus:(border-2)' },
|
|
89
|
-
ghost: { cell: 'hover:(bg-secondary-100) focus:(bg-secondary-100)' },
|
|
90
|
-
none: { cell: '' }
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
compoundVariants: [
|
|
94
|
-
{
|
|
95
|
-
variant: ['outline', 'subtle'],
|
|
96
|
-
color: 'primary',
|
|
97
|
-
class: { cell: 'focus:(border-primary-500)' }
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
variant: ['outline', 'subtle'],
|
|
101
|
-
color: 'secondary',
|
|
102
|
-
class: { cell: 'focus:(border-secondary-900)' }
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
variant: ['outline', 'subtle'],
|
|
106
|
-
color: 'info',
|
|
107
|
-
class: { cell: 'focus:(border-info-500)' }
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
variant: ['outline', 'subtle'],
|
|
111
|
-
color: 'success',
|
|
112
|
-
class: { cell: 'focus:(border-success-500)' }
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
variant: ['outline', 'subtle'],
|
|
116
|
-
color: 'warning',
|
|
117
|
-
class: { cell: 'focus:(border-warning-500)' }
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
variant: ['outline', 'subtle'],
|
|
121
|
-
color: 'error',
|
|
122
|
-
class: { cell: 'focus:(border-error-500)' }
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
})({ size, color, variant, class: ui.root })
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
onMount(() => {
|
|
129
|
-
if (!autofocus || input_els.length === 0) return;
|
|
130
|
-
|
|
131
|
-
input_els[0].focus();
|
|
132
|
-
});
|
|
133
|
-
</script>
|
|
134
|
-
|
|
135
|
-
<div id={id || internal_id} class={classes.root({ class: ui.root })}>
|
|
136
|
-
{#each { length }, i (i)}
|
|
137
|
-
<input
|
|
138
|
-
bind:this={input_els[i]}
|
|
139
|
-
bind:value={
|
|
140
|
-
() => (mask ? '•' : value[i]?.toString()?.slice(-1)),
|
|
141
|
-
(v: string) => {
|
|
142
|
-
try {
|
|
143
|
-
value[i] = type === 'text' ? v.slice(-1) : parseInt(v.slice(-1));
|
|
144
|
-
|
|
145
|
-
if (value[i] && input_els[i + 1]) input_els[i + 1].focus();
|
|
146
|
-
} catch {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
class={classes.cell({ class: ui.cell })}
|
|
152
|
-
onkeydown={(e) => {
|
|
153
|
-
if (KEYS_TO_IGNORE.includes(e.key)) e.preventDefault();
|
|
154
|
-
if (type === 'number' && isNaN(parseInt(e.key))) e.preventDefault();
|
|
155
|
-
const DIR: Record<string, number> = { ArrowLeft: -1, ArrowRight: 1 };
|
|
156
|
-
if (!DIR[e.key] || !input_els[i + DIR[e.key]]) return;
|
|
157
|
-
input_els[i + DIR[e.key]].focus();
|
|
158
|
-
}}
|
|
159
|
-
{placeholder}
|
|
160
|
-
/>
|
|
161
|
-
{/each}
|
|
162
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
2
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
export type PinInputProps = {
|
|
4
|
-
value?: number[] | string[];
|
|
5
|
-
color?: PropColor;
|
|
6
|
-
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
7
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
|
-
length?: number;
|
|
9
|
-
autofocus?: boolean | number;
|
|
10
|
-
id?: string;
|
|
11
|
-
mask?: boolean;
|
|
12
|
-
name?: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
otp?: boolean;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
type?: 'text' | 'number';
|
|
18
|
-
ui?: {
|
|
19
|
-
root?: ClassNameValue;
|
|
20
|
-
cell?: ClassNameValue;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
declare const PinInput: import("svelte").Component<PinInputProps, {}, "value">;
|
|
24
|
-
type PinInput = ReturnType<typeof PinInput>;
|
|
25
|
-
export default PinInput;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
|
|
4
|
-
let { class: klass }: { class?: ClassNameValue } = $props();
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<svg
|
|
8
|
-
class={[
|
|
9
|
-
'inset-0 w-full stroke-secondary/10 border border-dashed border-secondary rounded-md',
|
|
10
|
-
klass
|
|
11
|
-
]}
|
|
12
|
-
fill="none"
|
|
13
|
-
>
|
|
14
|
-
<defs>
|
|
15
|
-
<pattern
|
|
16
|
-
id="pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e"
|
|
17
|
-
x="0"
|
|
18
|
-
y="0"
|
|
19
|
-
width="10"
|
|
20
|
-
height="10"
|
|
21
|
-
patternUnits="userSpaceOnUse"
|
|
22
|
-
>
|
|
23
|
-
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"> </path>
|
|
24
|
-
</pattern>
|
|
25
|
-
</defs>
|
|
26
|
-
<rect
|
|
27
|
-
stroke="none"
|
|
28
|
-
fill="url(#pattern-5c1e4f0e-62d5-498b-8ff0-cf77bb448c8e)"
|
|
29
|
-
width="100%"
|
|
30
|
-
height="100%"
|
|
31
|
-
></rect>
|
|
32
|
-
</svg>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
class?: ClassNameValue;
|
|
4
|
-
};
|
|
5
|
-
declare const Placeholder: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
-
type Placeholder = ReturnType<typeof Placeholder>;
|
|
7
|
-
export default Placeholder;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
import { tv } from 'tailwind-variants';
|
|
5
|
-
|
|
6
|
-
export type ProgressProps = {
|
|
7
|
-
value?: number;
|
|
8
|
-
max?: number | string[];
|
|
9
|
-
animation?: 'swing' | 'carousel' | 'carousel-inverse' | 'elastic';
|
|
10
|
-
orientation?: 'horizontal' | 'veritcal';
|
|
11
|
-
color?: PropColor;
|
|
12
|
-
height?: number;
|
|
13
|
-
inverted?: boolean;
|
|
14
|
-
status?: boolean;
|
|
15
|
-
ui?: {
|
|
16
|
-
base?: ClassNameValue;
|
|
17
|
-
header?: ClassNameValue;
|
|
18
|
-
content?: ClassNameValue;
|
|
19
|
-
footer?: ClassNameValue;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
let {
|
|
26
|
-
max,
|
|
27
|
-
animation,
|
|
28
|
-
inverted,
|
|
29
|
-
status,
|
|
30
|
-
value,
|
|
31
|
-
orientation = 'horizontal',
|
|
32
|
-
color = 'primary',
|
|
33
|
-
height = '',
|
|
34
|
-
ui = {}
|
|
35
|
-
}: ProgressProps = $props();
|
|
36
|
-
|
|
37
|
-
const percentage = $derived.by(() => {
|
|
38
|
-
if (value === undefined) return null;
|
|
39
|
-
if (Array.isArray(max)) return (value / (max.length - 1)) * 100;
|
|
40
|
-
|
|
41
|
-
return (value / (max || 100)) * 100;
|
|
42
|
-
});
|
|
43
|
-
const indeterminate = $derived.by(() => {
|
|
44
|
-
if (value === undefined || percentage === null) return true;
|
|
45
|
-
if (value < 0) return true;
|
|
46
|
-
if (percentage > 100) return true;
|
|
47
|
-
|
|
48
|
-
return false;
|
|
49
|
-
});
|
|
50
|
-
const classes = $derived.by(() =>
|
|
51
|
-
tv({
|
|
52
|
-
slots: {
|
|
53
|
-
root: 'relative w-full rounded-full overflow-hidden bg-secondary-300',
|
|
54
|
-
status: '',
|
|
55
|
-
indicator: 'absolute transition-all rounded-full',
|
|
56
|
-
steps: ''
|
|
57
|
-
},
|
|
58
|
-
variants: {
|
|
59
|
-
color: {
|
|
60
|
-
primary: {
|
|
61
|
-
indicator: 'bg-primary-500'
|
|
62
|
-
},
|
|
63
|
-
secondary: {
|
|
64
|
-
indicator: 'bg-secondary-500'
|
|
65
|
-
},
|
|
66
|
-
info: {
|
|
67
|
-
indicator: 'bg-info-500'
|
|
68
|
-
},
|
|
69
|
-
success: {
|
|
70
|
-
indicator: 'bg-success-500'
|
|
71
|
-
},
|
|
72
|
-
warning: {
|
|
73
|
-
indicator: 'bg-warning-500'
|
|
74
|
-
},
|
|
75
|
-
error: {
|
|
76
|
-
indicator: 'bg-error-500'
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
animation: {
|
|
80
|
-
swing: [indeterminate ? 'animate-[swing_2s_ease-in-out_infinite' : ''],
|
|
81
|
-
carousel: [indeterminate ? '' : ''],
|
|
82
|
-
'carousel-inverse': [indeterminate ? '' : ''],
|
|
83
|
-
elastic: [indeterminate ? '' : '']
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
compoundVariants: []
|
|
87
|
-
})({
|
|
88
|
-
color,
|
|
89
|
-
animation: animation ?? 'swing'
|
|
90
|
-
})
|
|
91
|
-
);
|
|
92
|
-
</script>
|
|
93
|
-
|
|
94
|
-
<div data-state-indeterminate={indeterminate}>
|
|
95
|
-
<div class={classes.root({ class: [ui.base] })} style:height={`${height || 8}px`}>
|
|
96
|
-
<span class={classes.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
|
|
97
|
-
</span>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
{#if Array.isArray(max)}
|
|
101
|
-
<p
|
|
102
|
-
class={[
|
|
103
|
-
'text-right transition',
|
|
104
|
-
value && value > 0 && max[value] ? 'text-primary-500' : 'text-secondary-500'
|
|
105
|
-
]}
|
|
106
|
-
>
|
|
107
|
-
{(value && max[value]) || max[0]}
|
|
108
|
-
</p>
|
|
109
|
-
{/if}
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<style>
|
|
113
|
-
@keyframe swing {
|
|
114
|
-
0% {
|
|
115
|
-
width: 0%;
|
|
116
|
-
}
|
|
117
|
-
50% {
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
100% {
|
|
121
|
-
width: 0%;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
2
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
-
export type ProgressProps = {
|
|
4
|
-
value?: number;
|
|
5
|
-
max?: number | string[];
|
|
6
|
-
animation?: 'swing' | 'carousel' | 'carousel-inverse' | 'elastic';
|
|
7
|
-
orientation?: 'horizontal' | 'veritcal';
|
|
8
|
-
color?: PropColor;
|
|
9
|
-
height?: number;
|
|
10
|
-
inverted?: boolean;
|
|
11
|
-
status?: boolean;
|
|
12
|
-
ui?: {
|
|
13
|
-
base?: ClassNameValue;
|
|
14
|
-
header?: ClassNameValue;
|
|
15
|
-
content?: ClassNameValue;
|
|
16
|
-
footer?: ClassNameValue;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
declare const Progress: import("svelte").Component<ProgressProps, {}, "">;
|
|
20
|
-
type Progress = ReturnType<typeof Progress>;
|
|
21
|
-
export default Progress;
|