uisv 0.0.14 → 0.0.16
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 +58 -52
- package/dist/components/button.svelte.d.ts +6 -2
- 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/checkbox-group.svelte +1 -1
- package/dist/components/collapsible.svelte +76 -0
- package/dist/components/collapsible.svelte.d.ts +15 -0
- package/dist/components/h2.svelte +3 -3
- package/dist/components/h4.svelte +2 -2
- package/dist/components/h5.svelte +2 -2
- package/dist/components/h6.svelte +2 -2
- package/dist/components/icon.svelte +58 -0
- package/dist/components/icon.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +14 -2
- package/dist/components/index.js +14 -2
- package/dist/components/input-number.svelte +175 -0
- package/dist/components/input-number.svelte.d.ts +38 -0
- package/dist/components/input-time.svelte +4 -5
- package/dist/components/input-time.svelte.d.ts +3 -4
- package/dist/components/input.svelte +22 -25
- package/dist/components/input.svelte.d.ts +7 -7
- package/dist/components/kbd.svelte +35 -35
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/pin-input.svelte +21 -21
- package/dist/components/pin-input.svelte.d.ts +2 -2
- package/dist/components/placeholder.svelte +1 -1
- package/dist/components/progress.svelte +17 -17
- package/dist/components/select.svelte +333 -58
- package/dist/components/select.svelte.d.ts +32 -2
- package/dist/components/seperator.svelte +212 -0
- package/dist/components/seperator.svelte.d.ts +22 -0
- package/dist/components/slider.svelte +25 -25
- package/dist/components/switch.svelte +12 -28
- package/dist/components/switch.svelte.d.ts +5 -6
- package/dist/components/tabs.svelte +2 -2
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/dist/utilities.svelte.d.ts +9 -2
- package/dist/utilities.svelte.js +24 -4
- package/dist/vite.d.ts +2 -3
- package/dist/vite.js +41 -21
- package/package.json +18 -23
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { type PropColor } from '../index.js';
|
|
2
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
6
|
-
import { Time } from '
|
|
6
|
+
import { Time } from '../date.js';
|
|
7
7
|
|
|
8
|
-
export { Time };
|
|
9
8
|
export { default as InputTime } from './input-time.svelte';
|
|
10
9
|
|
|
11
10
|
export type InputTimeProps = {
|
|
@@ -25,7 +24,7 @@
|
|
|
25
24
|
/**
|
|
26
25
|
* @default outline
|
|
27
26
|
*/
|
|
28
|
-
variant?:
|
|
27
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
29
28
|
/**
|
|
30
29
|
* @default md
|
|
31
30
|
*/
|
|
@@ -80,7 +79,7 @@
|
|
|
80
79
|
icon: '',
|
|
81
80
|
segment: [
|
|
82
81
|
'rounded text-center outline-hidden transition-all focus:bg-surface-accented shrink',
|
|
83
|
-
'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:
|
|
82
|
+
'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:text-muted data-[segment="literal"]:px-1 data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75',
|
|
84
83
|
],
|
|
85
84
|
},
|
|
86
85
|
variants: {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type PropColor } from '../index.js';
|
|
1
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
import { Time } from '
|
|
5
|
-
export { Time };
|
|
4
|
+
import { Time } from '../date.js';
|
|
6
5
|
export { default as InputTime } from './input-time.svelte';
|
|
7
6
|
export type InputTimeProps = {
|
|
8
7
|
id?: string;
|
|
@@ -21,7 +20,7 @@ export type InputTimeProps = {
|
|
|
21
20
|
/**
|
|
22
21
|
* @default outline
|
|
23
22
|
*/
|
|
24
|
-
variant?:
|
|
23
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
25
24
|
/**
|
|
26
25
|
* @default md
|
|
27
26
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { type PropColor, isComponent, isSnippet } from '../index.js';
|
|
2
|
+
import { type PropColor, type PropVariant, isComponent, isSnippet } from '../index.js';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
4
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
5
5
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
/**
|
|
21
21
|
* @default outline
|
|
22
22
|
*/
|
|
23
|
-
variant?:
|
|
23
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
24
24
|
/**
|
|
25
25
|
* @default md
|
|
26
26
|
*/
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
*/
|
|
40
40
|
highlight?: boolean;
|
|
41
41
|
value?: string;
|
|
42
|
-
icon?: string |
|
|
42
|
+
icon?: string | Component;
|
|
43
43
|
iconposition?: 'leading' | 'trailing';
|
|
44
|
-
leading?: string |
|
|
45
|
-
trailing?: string |
|
|
44
|
+
leading?: string | Component;
|
|
45
|
+
trailing?: string | Component;
|
|
46
46
|
loading?: boolean;
|
|
47
|
-
loadingicon?: string |
|
|
47
|
+
loadingicon?: string | Component;
|
|
48
48
|
mask?: string | MaskInputOptions;
|
|
49
49
|
ui?: {
|
|
50
50
|
root?: ClassNameValue;
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
59
|
<script lang="ts">
|
|
60
|
+
import Icon from './icon.svelte';
|
|
61
|
+
|
|
60
62
|
let {
|
|
61
63
|
type,
|
|
62
64
|
value = $bindable(),
|
|
@@ -83,8 +85,8 @@
|
|
|
83
85
|
slots: {
|
|
84
86
|
root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
|
|
85
87
|
base: 'appearance-none outline-none placeholder:text-muted',
|
|
86
|
-
leading: 'text-muted',
|
|
87
|
-
trailing: 'text-muted',
|
|
88
|
+
leading: 'text-muted flex items-center',
|
|
89
|
+
trailing: 'text-muted flex items-center',
|
|
88
90
|
icon: '',
|
|
89
91
|
},
|
|
90
92
|
variants: {
|
|
@@ -135,7 +137,7 @@
|
|
|
135
137
|
soft: {
|
|
136
138
|
root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated',
|
|
137
139
|
},
|
|
138
|
-
subtle: { root: 'ring ring-dimmed' },
|
|
140
|
+
subtle: { root: 'bg-surface-muted ring ring-dimmed' },
|
|
139
141
|
ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
|
|
140
142
|
none: { root: '' },
|
|
141
143
|
},
|
|
@@ -168,42 +170,42 @@
|
|
|
168
170
|
color: 'primary',
|
|
169
171
|
variant: ['outline', 'subtle'],
|
|
170
172
|
class: {
|
|
171
|
-
root: 'focus-within:
|
|
173
|
+
root: 'focus-within:ring-primary-500 focus-within:ring-2',
|
|
172
174
|
},
|
|
173
175
|
},
|
|
174
176
|
{
|
|
175
177
|
color: 'surface',
|
|
176
178
|
variant: ['outline', 'subtle'],
|
|
177
179
|
class: {
|
|
178
|
-
root: 'focus-within:
|
|
180
|
+
root: 'focus-within:ring-surface-800 focus-within:ring-2',
|
|
179
181
|
},
|
|
180
182
|
},
|
|
181
183
|
{
|
|
182
184
|
color: 'info',
|
|
183
185
|
variant: ['outline', 'subtle'],
|
|
184
186
|
class: {
|
|
185
|
-
root: 'focus-within:
|
|
187
|
+
root: 'focus-within:ring-info-500 focus-within:ring-2',
|
|
186
188
|
},
|
|
187
189
|
},
|
|
188
190
|
{
|
|
189
191
|
color: 'success',
|
|
190
192
|
variant: ['outline', 'subtle'],
|
|
191
193
|
class: {
|
|
192
|
-
root: 'focus-within:
|
|
194
|
+
root: 'focus-within:ring-success-500 focus-within:ring-2',
|
|
193
195
|
},
|
|
194
196
|
},
|
|
195
197
|
{
|
|
196
198
|
color: 'warning',
|
|
197
199
|
variant: ['outline', 'subtle'],
|
|
198
200
|
class: {
|
|
199
|
-
root: 'focus-within:
|
|
201
|
+
root: 'focus-within:ring-warning-500 focus-within:ring-2',
|
|
200
202
|
},
|
|
201
203
|
},
|
|
202
204
|
{
|
|
203
205
|
color: 'error',
|
|
204
206
|
variant: ['outline', 'subtle'],
|
|
205
207
|
class: {
|
|
206
|
-
root: 'focus-within:
|
|
208
|
+
root: 'focus-within:ring-error-500 focus-within:ring-2',
|
|
207
209
|
},
|
|
208
210
|
},
|
|
209
211
|
],
|
|
@@ -234,16 +236,11 @@
|
|
|
234
236
|
{@const Leading = leading}
|
|
235
237
|
<Leading />
|
|
236
238
|
{/if}
|
|
237
|
-
{:else
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
></div>
|
|
243
|
-
{:else if isSnippet(TrailingIcon)}
|
|
244
|
-
{@render TrailingIcon()}
|
|
245
|
-
{:else if isComponent(TrailingIcon)}
|
|
246
|
-
<TrailingIcon class={variants.icon({ class: [ui.icon] })} />
|
|
239
|
+
{:else}
|
|
240
|
+
<Icon
|
|
241
|
+
name={TrailingIcon}
|
|
242
|
+
class={variants.icon({ class: [loading ? 'animate-spin' : ''] })}
|
|
243
|
+
/>
|
|
247
244
|
{/if}
|
|
248
245
|
</span>
|
|
249
246
|
{/if}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PropColor } from '../index.js';
|
|
2
|
-
import type { Component
|
|
1
|
+
import { type PropColor, type PropVariant } from '../index.js';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { type MaskInputOptions } from 'maska';
|
|
@@ -16,7 +16,7 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
|
16
16
|
/**
|
|
17
17
|
* @default outline
|
|
18
18
|
*/
|
|
19
|
-
variant?:
|
|
19
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
20
20
|
/**
|
|
21
21
|
* @default md
|
|
22
22
|
*/
|
|
@@ -35,12 +35,12 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
|
|
|
35
35
|
*/
|
|
36
36
|
highlight?: boolean;
|
|
37
37
|
value?: string;
|
|
38
|
-
icon?: string |
|
|
38
|
+
icon?: string | Component;
|
|
39
39
|
iconposition?: 'leading' | 'trailing';
|
|
40
|
-
leading?: string |
|
|
41
|
-
trailing?: string |
|
|
40
|
+
leading?: string | Component;
|
|
41
|
+
trailing?: string | Component;
|
|
42
42
|
loading?: boolean;
|
|
43
|
-
loadingicon?: string |
|
|
43
|
+
loadingicon?: string | Component;
|
|
44
44
|
mask?: string | MaskInputOptions;
|
|
45
45
|
ui?: {
|
|
46
46
|
root?: ClassNameValue;
|
|
@@ -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?: Exclude<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:
|
|
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
|
-
subtle: { cell: 'border border-surface-300 bg-surface-100 focus:
|
|
89
|
-
ghost: { cell: 'hover:
|
|
90
|
-
none: { cell: '' }
|
|
91
|
-
}
|
|
88
|
+
subtle: { cell: 'border border-surface-300 bg-surface-100 focus:border-2' },
|
|
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?: Exclude<PropVariant, 'solid'>;
|
|
7
7
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
8
8
|
length?: number;
|
|
9
9
|
autofocus?: boolean | number;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
value,
|
|
31
31
|
orientation = 'horizontal',
|
|
32
32
|
color = 'primary',
|
|
33
|
-
height =
|
|
34
|
-
ui = {}
|
|
33
|
+
height = 8,
|
|
34
|
+
ui = {},
|
|
35
35
|
}: ProgressProps = $props();
|
|
36
36
|
|
|
37
37
|
const percentage = $derived.by(() => {
|
|
@@ -53,46 +53,46 @@
|
|
|
53
53
|
root: 'relative w-full rounded-full overflow-hidden bg-surface-300',
|
|
54
54
|
status: '',
|
|
55
55
|
indicator: 'absolute transition-all rounded-full',
|
|
56
|
-
steps: ''
|
|
56
|
+
steps: '',
|
|
57
57
|
},
|
|
58
58
|
variants: {
|
|
59
59
|
color: {
|
|
60
60
|
primary: {
|
|
61
|
-
indicator: 'bg-primary-500'
|
|
61
|
+
indicator: 'bg-primary-500',
|
|
62
62
|
},
|
|
63
63
|
surface: {
|
|
64
|
-
indicator: 'bg-surface-500'
|
|
64
|
+
indicator: 'bg-surface-500',
|
|
65
65
|
},
|
|
66
66
|
info: {
|
|
67
|
-
indicator: 'bg-info-500'
|
|
67
|
+
indicator: 'bg-info-500',
|
|
68
68
|
},
|
|
69
69
|
success: {
|
|
70
|
-
indicator: 'bg-success-500'
|
|
70
|
+
indicator: 'bg-success-500',
|
|
71
71
|
},
|
|
72
72
|
warning: {
|
|
73
|
-
indicator: 'bg-warning-500'
|
|
73
|
+
indicator: 'bg-warning-500',
|
|
74
74
|
},
|
|
75
75
|
error: {
|
|
76
|
-
indicator: 'bg-error-500'
|
|
77
|
-
}
|
|
76
|
+
indicator: 'bg-error-500',
|
|
77
|
+
},
|
|
78
78
|
},
|
|
79
79
|
animation: {
|
|
80
80
|
swing: [indeterminate ? 'animate-[swing_2s_ease-in-out_infinite' : ''],
|
|
81
81
|
carousel: [indeterminate ? '' : ''],
|
|
82
82
|
'carousel-inverse': [indeterminate ? '' : ''],
|
|
83
|
-
elastic: [indeterminate ? '' : '']
|
|
84
|
-
}
|
|
83
|
+
elastic: [indeterminate ? '' : ''],
|
|
84
|
+
},
|
|
85
85
|
},
|
|
86
|
-
compoundVariants: []
|
|
86
|
+
compoundVariants: [],
|
|
87
87
|
})({
|
|
88
88
|
color,
|
|
89
|
-
animation: animation ?? 'swing'
|
|
90
|
-
})
|
|
89
|
+
animation: animation ?? 'swing',
|
|
90
|
+
}),
|
|
91
91
|
);
|
|
92
92
|
</script>
|
|
93
93
|
|
|
94
94
|
<div data-state-indeterminate={indeterminate}>
|
|
95
|
-
<div class={classes.root({ class: [ui.base] })} style:height={`${height
|
|
95
|
+
<div class={classes.root({ class: [ui.base] })} style:height={`${height}px`}>
|
|
96
96
|
<span class={classes.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
|
|
97
97
|
</span>
|
|
98
98
|
</div>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<p
|
|
102
102
|
class={[
|
|
103
103
|
'text-right transition',
|
|
104
|
-
value && value > 0 && max[value] ? 'text-primary-500' : 'text-surface-500'
|
|
104
|
+
value && value > 0 && max[value] ? 'text-primary-500' : 'text-surface-500',
|
|
105
105
|
]}
|
|
106
106
|
>
|
|
107
107
|
{(value && max[value]) || max[0]}
|