uisv 0.0.23 → 0.0.24
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/accordion.svelte +4 -18
- package/dist/components/alert.svelte +57 -54
- package/dist/components/alert.svelte.d.ts +2 -2
- package/dist/components/badge.svelte +16 -16
- package/dist/components/badge.svelte.d.ts +4 -2
- package/dist/components/banner.svelte +9 -13
- package/dist/components/banner.svelte.d.ts +2 -2
- package/dist/components/button.svelte +8 -6
- package/dist/components/card.svelte +1 -1
- package/dist/components/checkbox-group.svelte +3 -5
- package/dist/components/checkbox-group.svelte.d.ts +3 -3
- package/dist/components/checkbox.svelte +9 -20
- package/dist/components/checkbox.svelte.d.ts +4 -5
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/input.svelte +1 -1
- package/dist/components/kbd.svelte +8 -8
- package/dist/components/navigation-menu.svelte +416 -0
- package/dist/components/navigation-menu.svelte.d.ts +20 -0
- package/dist/components/radio-group.svelte +102 -0
- package/dist/components/radio-group.svelte.d.ts +27 -0
- package/dist/components/select.svelte +17 -10
- package/dist/components/select.svelte.d.ts +5 -6
- package/dist/components/tabs.svelte +3 -13
- package/dist/components/tabs.svelte.d.ts +1 -1
- package/package.json +27 -24
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
content:
|
|
65
65
|
'data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none',
|
|
66
66
|
body: 'text-sm pb-3.5',
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
leadingicon: 'shrink-0 size-5',
|
|
68
|
+
trailingicon:
|
|
69
69
|
'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
|
|
70
70
|
label: 'text-start break-words',
|
|
71
71
|
},
|
|
@@ -82,23 +82,9 @@
|
|
|
82
82
|
);
|
|
83
83
|
</script>
|
|
84
84
|
|
|
85
|
-
<Accordion.Root
|
|
86
|
-
class={variants.root({ class: ui.root })}
|
|
87
|
-
type="multiple"
|
|
88
|
-
bind:value={
|
|
89
|
-
() => {
|
|
90
|
-
if (!value) return;
|
|
91
|
-
if (Array.isArray(value)) return value;
|
|
92
|
-
return [value];
|
|
93
|
-
},
|
|
94
|
-
(val) => {
|
|
95
|
-
if (!val) return (value = val);
|
|
96
|
-
value = type === 'single' ? val[0] : val;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
>
|
|
85
|
+
<Accordion.Root class={variants.root({ class: ui.root })} {type} bind:value>
|
|
100
86
|
{#each items as item, idx (idx)}
|
|
101
|
-
<Accordion.Item value="item-
|
|
87
|
+
<Accordion.Item value="item-{idx}">
|
|
102
88
|
<Accordion.Header>
|
|
103
89
|
<Accordion.Trigger>{item.label}</Accordion.Trigger>
|
|
104
90
|
</Accordion.Header>
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
icon?: string | Snippet | Component;
|
|
19
19
|
color?: PropColor;
|
|
20
20
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
21
|
-
position?: 'bottom' | 'right';
|
|
22
21
|
actions?: ButtonProps[];
|
|
23
22
|
close?: boolean | ButtonProps;
|
|
24
23
|
ui?: {
|
|
@@ -27,7 +26,8 @@
|
|
|
27
26
|
description?: ClassValue;
|
|
28
27
|
title?: ClassValue;
|
|
29
28
|
};
|
|
30
|
-
onclose?: () =>
|
|
29
|
+
onclose?: () => unknown | Promise<() => unknown>;
|
|
30
|
+
orientation?: 'horizontal' | 'vertical';
|
|
31
31
|
};
|
|
32
32
|
</script>
|
|
33
33
|
|
|
@@ -40,29 +40,19 @@
|
|
|
40
40
|
actions = [],
|
|
41
41
|
color = 'primary',
|
|
42
42
|
variant = 'solid',
|
|
43
|
-
position = 'bottom',
|
|
44
43
|
ui = {},
|
|
45
44
|
onclose = () => {},
|
|
45
|
+
orientation = 'vertical',
|
|
46
46
|
}: AlertProps = $props();
|
|
47
47
|
|
|
48
|
-
const close_props = $derived.by(() => {
|
|
49
|
-
return defu(typeof close === 'boolean' ? {} : close, {
|
|
50
|
-
icon: getAppContext().icons.close,
|
|
51
|
-
variant: 'link',
|
|
52
|
-
color: variant === 'solid' ? 'surface' : color,
|
|
53
|
-
ui: {
|
|
54
|
-
icon: variant === 'solid' ? 'text-white' : '',
|
|
55
|
-
},
|
|
56
|
-
} as ButtonProps);
|
|
57
|
-
});
|
|
58
48
|
const variants = $derived.by(() =>
|
|
59
49
|
tv({
|
|
60
50
|
slots: {
|
|
61
51
|
base: 'flex gap-2 font-sans p-4 rounded-lg',
|
|
62
|
-
icon: 'pi size-
|
|
63
|
-
actions: '',
|
|
64
|
-
description: '
|
|
65
|
-
title: 'font-medium',
|
|
52
|
+
icon: 'pi size-5',
|
|
53
|
+
actions: 'flex flex-wrap gap-1.5 shrink-0',
|
|
54
|
+
description: 'opacity-90 mt-1 text-sm',
|
|
55
|
+
title: 'font-medium font-sm',
|
|
66
56
|
},
|
|
67
57
|
variants: {
|
|
68
58
|
color: {
|
|
@@ -75,20 +65,16 @@
|
|
|
75
65
|
},
|
|
76
66
|
variant: {
|
|
77
67
|
solid: {
|
|
78
|
-
base: 'text-
|
|
79
|
-
description: 'text-
|
|
68
|
+
base: 'text-surface-base',
|
|
69
|
+
description: 'text-surface-base/90',
|
|
80
70
|
},
|
|
81
|
-
outline: '
|
|
71
|
+
outline: 'ring ring-inset',
|
|
82
72
|
soft: '',
|
|
83
|
-
subtle: '
|
|
73
|
+
subtle: 'ring ring-inset',
|
|
84
74
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
bottom: {
|
|
90
|
-
base: 'flex-col',
|
|
91
|
-
},
|
|
75
|
+
orientation: {
|
|
76
|
+
horizontal: '',
|
|
77
|
+
vertical: 'flex-col',
|
|
92
78
|
},
|
|
93
79
|
},
|
|
94
80
|
compoundVariants: [
|
|
@@ -126,38 +112,38 @@
|
|
|
126
112
|
{
|
|
127
113
|
variant: 'outline',
|
|
128
114
|
color: 'primary',
|
|
129
|
-
class: '
|
|
115
|
+
class: 'ring-primary/50 text-primary-500',
|
|
130
116
|
},
|
|
131
117
|
{
|
|
132
118
|
variant: 'outline',
|
|
133
119
|
color: 'surface',
|
|
134
|
-
class: '
|
|
120
|
+
class: 'ring-surface-accented text-surface-inverted',
|
|
135
121
|
},
|
|
136
122
|
{
|
|
137
123
|
variant: 'outline',
|
|
138
124
|
color: 'info',
|
|
139
|
-
class: '
|
|
125
|
+
class: 'ring-info/50 text-info-500',
|
|
140
126
|
},
|
|
141
127
|
{
|
|
142
128
|
variant: 'outline',
|
|
143
129
|
color: 'success',
|
|
144
|
-
class: '
|
|
130
|
+
class: 'ring-success/50 text-success-500',
|
|
145
131
|
},
|
|
146
132
|
{
|
|
147
133
|
variant: 'outline',
|
|
148
134
|
color: 'warning',
|
|
149
|
-
class: '
|
|
135
|
+
class: 'ring-warning/50 text-warning-500',
|
|
150
136
|
},
|
|
151
137
|
{
|
|
152
138
|
variant: 'outline',
|
|
153
139
|
color: 'error',
|
|
154
|
-
class: '
|
|
140
|
+
class: 'ring-error/50 text-error-500',
|
|
155
141
|
},
|
|
156
142
|
|
|
157
143
|
{
|
|
158
144
|
variant: 'soft',
|
|
159
145
|
color: 'primary',
|
|
160
|
-
class: 'bg-primary
|
|
146
|
+
class: 'bg-primary/10 text-primary-500',
|
|
161
147
|
},
|
|
162
148
|
{
|
|
163
149
|
variant: 'soft',
|
|
@@ -167,61 +153,61 @@
|
|
|
167
153
|
{
|
|
168
154
|
variant: 'soft',
|
|
169
155
|
color: 'info',
|
|
170
|
-
class: 'bg-info
|
|
156
|
+
class: 'bg-info/10 text-info-500',
|
|
171
157
|
},
|
|
172
158
|
{
|
|
173
159
|
variant: 'soft',
|
|
174
160
|
color: 'success',
|
|
175
|
-
class: 'bg-success
|
|
161
|
+
class: 'bg-success/10 text-success-500',
|
|
176
162
|
},
|
|
177
163
|
{
|
|
178
164
|
variant: 'soft',
|
|
179
165
|
color: 'warning',
|
|
180
|
-
class: 'bg-warning
|
|
166
|
+
class: 'bg-warning/10 text-warning-500',
|
|
181
167
|
},
|
|
182
168
|
{
|
|
183
169
|
variant: 'soft',
|
|
184
170
|
color: 'error',
|
|
185
|
-
class: 'bg-error
|
|
171
|
+
class: 'bg-error/10 text-error-500',
|
|
186
172
|
},
|
|
187
173
|
|
|
188
174
|
{
|
|
189
175
|
variant: 'subtle',
|
|
190
176
|
color: 'primary',
|
|
191
|
-
class: 'bg-primary
|
|
177
|
+
class: 'bg-primary/10 text-primary/50 ring-primary-300',
|
|
192
178
|
},
|
|
193
179
|
{
|
|
194
180
|
variant: 'subtle',
|
|
195
181
|
color: 'surface',
|
|
196
|
-
class: 'bg-surface-muted text-surface-inverted
|
|
182
|
+
class: 'bg-surface-muted text-surface-inverted ring-surface-accented',
|
|
197
183
|
},
|
|
198
184
|
{
|
|
199
185
|
variant: 'subtle',
|
|
200
186
|
color: 'info',
|
|
201
|
-
class: 'bg-info
|
|
187
|
+
class: 'bg-info/10 text-info-500 ring-info/50',
|
|
202
188
|
},
|
|
203
189
|
{
|
|
204
190
|
variant: 'subtle',
|
|
205
191
|
color: 'success',
|
|
206
|
-
class: 'bg-success
|
|
192
|
+
class: 'bg-success/10 text-success-500 ring-success/50',
|
|
207
193
|
},
|
|
208
194
|
{
|
|
209
195
|
variant: 'subtle',
|
|
210
196
|
color: 'warning',
|
|
211
|
-
class: 'bg-warning
|
|
197
|
+
class: 'bg-warning/10 text-warning-500 ring-warning/50',
|
|
212
198
|
},
|
|
213
199
|
{
|
|
214
200
|
variant: 'subtle',
|
|
215
201
|
color: 'error',
|
|
216
|
-
class: 'bg-error
|
|
202
|
+
class: 'bg-error/10 text-error-500 ring-error/50',
|
|
217
203
|
},
|
|
218
204
|
],
|
|
219
|
-
})({ color, variant,
|
|
205
|
+
})({ color, variant, orientation }),
|
|
220
206
|
);
|
|
221
207
|
</script>
|
|
222
208
|
|
|
223
|
-
<div class={variants.base({ class: [
|
|
224
|
-
<div class="flex gap-2
|
|
209
|
+
<div class={variants.base({ class: [ui.base] })}>
|
|
210
|
+
<div class="flex gap-2 flex-1">
|
|
225
211
|
{#if isSnippet(icon)}
|
|
226
212
|
{@render icon()}
|
|
227
213
|
{:else}
|
|
@@ -250,22 +236,39 @@
|
|
|
250
236
|
{/if}
|
|
251
237
|
</div>
|
|
252
238
|
|
|
239
|
+
{#if orientation === 'horizontal'}
|
|
240
|
+
{@render actions_snippet()}
|
|
241
|
+
{/if}
|
|
242
|
+
|
|
253
243
|
{#if close}
|
|
254
244
|
<div>
|
|
255
|
-
<Button
|
|
245
|
+
<Button
|
|
246
|
+
{...defu(typeof close === 'boolean' ? {} : close, {
|
|
247
|
+
icon: getAppContext().icons.close,
|
|
248
|
+
variant: 'link',
|
|
249
|
+
color: 'surface',
|
|
250
|
+
onclick: onclose,
|
|
251
|
+
} as ButtonProps)}
|
|
252
|
+
/>
|
|
256
253
|
</div>
|
|
257
254
|
{/if}
|
|
258
255
|
</div>
|
|
259
256
|
|
|
260
|
-
{#if
|
|
257
|
+
{#if orientation === 'vertical'}
|
|
258
|
+
{@render actions_snippet()}
|
|
259
|
+
{/if}
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
{#snippet actions_snippet()}
|
|
263
|
+
{#if actions.length}
|
|
261
264
|
<div class="flex gap-2 items-center pl-8">
|
|
262
|
-
{#each actions as action (
|
|
265
|
+
{#each actions as action, idx (idx)}
|
|
263
266
|
<Button
|
|
264
|
-
{...defu(action, {
|
|
267
|
+
{...defu(action, <ButtonProps>{
|
|
265
268
|
size: 'xs',
|
|
266
|
-
}
|
|
269
|
+
})}
|
|
267
270
|
/>
|
|
268
271
|
{/each}
|
|
269
272
|
</div>
|
|
270
273
|
{/if}
|
|
271
|
-
|
|
274
|
+
{/snippet}
|
|
@@ -7,7 +7,6 @@ export type AlertProps = {
|
|
|
7
7
|
icon?: string | Snippet | Component;
|
|
8
8
|
color?: PropColor;
|
|
9
9
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
10
|
-
position?: 'bottom' | 'right';
|
|
11
10
|
actions?: ButtonProps[];
|
|
12
11
|
close?: boolean | ButtonProps;
|
|
13
12
|
ui?: {
|
|
@@ -16,7 +15,8 @@ export type AlertProps = {
|
|
|
16
15
|
description?: ClassValue;
|
|
17
16
|
title?: ClassValue;
|
|
18
17
|
};
|
|
19
|
-
onclose?: () =>
|
|
18
|
+
onclose?: () => unknown | Promise<() => unknown>;
|
|
19
|
+
orientation?: 'horizontal' | 'vertical';
|
|
20
20
|
};
|
|
21
21
|
declare const Alert: Component<AlertProps, {}, "">;
|
|
22
22
|
type Alert = ReturnType<typeof Alert>;
|
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
color?: PropColor;
|
|
10
10
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
11
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
-
icon?: string |
|
|
13
|
-
|
|
12
|
+
icon?: string | Component;
|
|
13
|
+
iconposition?: 'leading' | 'trailing';
|
|
14
14
|
children?: Snippet;
|
|
15
|
+
leading?: Snippet;
|
|
16
|
+
trailing?: Snippet;
|
|
15
17
|
ui?: {
|
|
16
18
|
base?: ClassValue;
|
|
17
19
|
icon?: ClassValue;
|
|
@@ -23,12 +25,14 @@
|
|
|
23
25
|
let {
|
|
24
26
|
icon,
|
|
25
27
|
label,
|
|
26
|
-
|
|
28
|
+
iconposition = 'leading',
|
|
27
29
|
color = 'primary',
|
|
28
30
|
size = 'md',
|
|
29
31
|
variant = 'solid',
|
|
30
32
|
ui = {},
|
|
31
33
|
children,
|
|
34
|
+
leading,
|
|
35
|
+
trailing,
|
|
32
36
|
}: BadgeProps = $props();
|
|
33
37
|
|
|
34
38
|
const variants = $derived.by(() => {
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
},
|
|
46
50
|
variant: {
|
|
47
51
|
link: '',
|
|
48
|
-
solid: 'text-
|
|
52
|
+
solid: 'text-label-inverted',
|
|
49
53
|
outline: 'border',
|
|
50
54
|
soft: '',
|
|
51
55
|
subtle: 'border',
|
|
@@ -196,12 +200,10 @@
|
|
|
196
200
|
class: [icon && !(children || label) ? 'px-0 aspect-square justify-center' : '', ui.base],
|
|
197
201
|
})}
|
|
198
202
|
>
|
|
199
|
-
{#if
|
|
200
|
-
{
|
|
201
|
-
|
|
202
|
-
{:
|
|
203
|
-
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
204
|
-
{/if}
|
|
203
|
+
{#if leading}
|
|
204
|
+
{@render leading()}
|
|
205
|
+
{:else if iconposition === 'leading'}
|
|
206
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
205
207
|
{/if}
|
|
206
208
|
|
|
207
209
|
{#if label}
|
|
@@ -210,11 +212,9 @@
|
|
|
210
212
|
{@render children?.()}
|
|
211
213
|
{/if}
|
|
212
214
|
|
|
213
|
-
{#if
|
|
214
|
-
{
|
|
215
|
-
|
|
216
|
-
{:
|
|
217
|
-
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
218
|
-
{/if}
|
|
215
|
+
{#if trailing}
|
|
216
|
+
{@render trailing()}
|
|
217
|
+
{:else if iconposition === 'trailing'}
|
|
218
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
219
219
|
{/if}
|
|
220
220
|
</span>
|
|
@@ -6,9 +6,11 @@ export type BadgeProps = {
|
|
|
6
6
|
color?: PropColor;
|
|
7
7
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
-
icon?: string |
|
|
10
|
-
|
|
9
|
+
icon?: string | Component;
|
|
10
|
+
iconposition?: 'leading' | 'trailing';
|
|
11
11
|
children?: Snippet;
|
|
12
|
+
leading?: Snippet;
|
|
13
|
+
trailing?: Snippet;
|
|
12
14
|
ui?: {
|
|
13
15
|
base?: ClassValue;
|
|
14
16
|
icon?: ClassValue;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
export type BannerProps = {
|
|
16
16
|
title: string | Snippet;
|
|
17
|
-
icon?: string |
|
|
17
|
+
icon?: string | Component;
|
|
18
18
|
color?: PropColor;
|
|
19
19
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
20
20
|
actions?: ButtonProps[];
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
description?: ClassValue;
|
|
28
28
|
title?: ClassValue;
|
|
29
29
|
};
|
|
30
|
-
onclose?: () => void | Promise<void>;
|
|
30
|
+
onclose?: () => void | Promise<() => void>;
|
|
31
31
|
};
|
|
32
32
|
</script>
|
|
33
33
|
|
|
@@ -208,11 +208,7 @@
|
|
|
208
208
|
class={variants.base({ class: [ui.base] })}
|
|
209
209
|
>
|
|
210
210
|
<div class="flex grow gap-2 text-sm items-center">
|
|
211
|
-
{
|
|
212
|
-
{@render icon()}
|
|
213
|
-
{:else}
|
|
214
|
-
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
215
|
-
{/if}
|
|
211
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
216
212
|
|
|
217
213
|
<div class={variants.title({ class: [ui.title] })}>
|
|
218
214
|
{#if isSnippet(title)}
|
|
@@ -222,13 +218,13 @@
|
|
|
222
218
|
{/if}
|
|
223
219
|
</div>
|
|
224
220
|
|
|
225
|
-
{#if actions.length
|
|
226
|
-
{#each actions as action (
|
|
221
|
+
{#if actions.length}
|
|
222
|
+
{#each actions as action, idx (idx)}
|
|
227
223
|
<Button
|
|
228
|
-
{...defu(action, {
|
|
224
|
+
{...defu(action, <ButtonProps>{
|
|
229
225
|
size: 'xs',
|
|
230
226
|
color: 'surface',
|
|
231
|
-
}
|
|
227
|
+
})}
|
|
232
228
|
/>
|
|
233
229
|
{/each}
|
|
234
230
|
{/if}
|
|
@@ -237,15 +233,15 @@
|
|
|
237
233
|
{#if close}
|
|
238
234
|
<div>
|
|
239
235
|
<Button
|
|
240
|
-
{...defu
|
|
236
|
+
{...defu(typeof close === 'boolean' ? {} : close, <ButtonProps>{
|
|
241
237
|
icon: getAppContext().icons.close,
|
|
242
238
|
variant: 'ghost',
|
|
243
239
|
color: 'surface',
|
|
244
240
|
ui: {
|
|
245
241
|
icon: variant === 'solid' ? 'text-label-inverted' : '',
|
|
246
242
|
},
|
|
243
|
+
onclick: onclose,
|
|
247
244
|
})}
|
|
248
|
-
onclick={onclose}
|
|
249
245
|
/>
|
|
250
246
|
</div>
|
|
251
247
|
{/if}
|
|
@@ -3,7 +3,7 @@ import type { Component, Snippet } from 'svelte';
|
|
|
3
3
|
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type BannerProps = {
|
|
5
5
|
title: string | Snippet;
|
|
6
|
-
icon?: string |
|
|
6
|
+
icon?: string | Component;
|
|
7
7
|
color?: PropColor;
|
|
8
8
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
9
9
|
actions?: ButtonProps[];
|
|
@@ -16,7 +16,7 @@ export type BannerProps = {
|
|
|
16
16
|
description?: ClassValue;
|
|
17
17
|
title?: ClassValue;
|
|
18
18
|
};
|
|
19
|
-
onclose?: () => void | Promise<void>;
|
|
19
|
+
onclose?: () => void | Promise<() => void>;
|
|
20
20
|
};
|
|
21
21
|
declare const Banner: Component<BannerProps, {}, "">;
|
|
22
22
|
type Banner = ReturnType<typeof Banner>;
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
return false;
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const variants = $derived(
|
|
98
98
|
tv({
|
|
99
99
|
slots: {
|
|
100
100
|
icon: '',
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
},
|
|
125
125
|
sm: { base: 'font-medium text-xs px-2 h-7 rounded gap-1', icon: 'size-4' },
|
|
126
126
|
md: { base: 'font-medium text-sm rounded-md px-2 h-8 gap-2', icon: 'size-5' },
|
|
127
|
-
lg: { base: 'font-medium text-sm px-3 h-9 rounded-md gap-2', icon: 'size-
|
|
127
|
+
lg: { base: 'font-medium text-sm px-3 h-9 rounded-md gap-2', icon: 'size-5' },
|
|
128
128
|
xl: { base: 'font-medium px-3 h-10 rounded-md gap-2', icon: 'size-6' },
|
|
129
129
|
},
|
|
130
130
|
block: {
|
|
@@ -353,14 +353,14 @@
|
|
|
353
353
|
|
|
354
354
|
<svelte:element
|
|
355
355
|
this={href ? 'a' : 'button'}
|
|
356
|
+
bind:this={ref}
|
|
356
357
|
type={href ? undefined : type}
|
|
357
358
|
href={href && !disabled ? href : undefined}
|
|
358
359
|
disabled={disabled || is_loading}
|
|
359
360
|
aria-disabled={href ? disabled : undefined}
|
|
360
361
|
role={href && disabled ? 'link' : undefined}
|
|
361
362
|
tabindex={href && disabled ? -1 : 0}
|
|
362
|
-
|
|
363
|
-
class={classnames.base({
|
|
363
|
+
class={variants.base({
|
|
364
364
|
class: [only_icon && 'px-0 aspect-square justify-center', href && 'cursor-pointer', ui.base],
|
|
365
365
|
})}
|
|
366
366
|
onclick={onClickWrapper}
|
|
@@ -369,7 +369,9 @@
|
|
|
369
369
|
{#if iconposition === 'leading' || leadingicon || loading}
|
|
370
370
|
<Icon
|
|
371
371
|
name={is_loading ? loadingicon : leadingicon || icon}
|
|
372
|
-
class={
|
|
372
|
+
class={variants.icon({
|
|
373
|
+
class: [ui.leadingicon, loading && 'animate-spin', iconposition === 'leading' && ui.icon],
|
|
374
|
+
})}
|
|
373
375
|
/>
|
|
374
376
|
{/if}
|
|
375
377
|
|
|
@@ -382,7 +384,7 @@
|
|
|
382
384
|
{#if iconposition === 'trailing' || trailingicon}
|
|
383
385
|
<Icon
|
|
384
386
|
name={trailingicon || icon}
|
|
385
|
-
class={[ui.trailingicon, iconposition === 'trailing' && ui.icon]}
|
|
387
|
+
class={variants.icon({ class: [ui.trailingicon, iconposition === 'trailing' && ui.icon] })}
|
|
386
388
|
/>
|
|
387
389
|
{/if}
|
|
388
390
|
</svelte:element>
|
|
@@ -3,18 +3,16 @@
|
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
4
|
import { type PropColor, isComponent, isSnippet, Checkbox } from '../index.js';
|
|
5
5
|
|
|
6
|
-
/* eslint @typescript-eslint/no-explicit-any: 0 */
|
|
7
|
-
|
|
8
6
|
export type CheckboxGroupProps = {
|
|
9
7
|
color?: PropColor;
|
|
10
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
11
|
-
icon?: string |
|
|
9
|
+
icon?: string | Component;
|
|
12
10
|
required?: boolean;
|
|
13
11
|
indicator?: 'start' | 'end' | 'hidden';
|
|
14
|
-
value?:
|
|
12
|
+
value?: string[];
|
|
15
13
|
valuekey?: string;
|
|
16
14
|
variant?: 'list' | 'card' | 'table';
|
|
17
|
-
items: Array<
|
|
15
|
+
items: Array<string>;
|
|
18
16
|
labelkey?: string;
|
|
19
17
|
descriptionkey?: string;
|
|
20
18
|
legend?: string | Snippet | Component;
|
|
@@ -4,13 +4,13 @@ import { type PropColor } from '../index.js';
|
|
|
4
4
|
export type CheckboxGroupProps = {
|
|
5
5
|
color?: PropColor;
|
|
6
6
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
-
icon?: string |
|
|
7
|
+
icon?: string | Component;
|
|
8
8
|
required?: boolean;
|
|
9
9
|
indicator?: 'start' | 'end' | 'hidden';
|
|
10
|
-
value?:
|
|
10
|
+
value?: string[];
|
|
11
11
|
valuekey?: string;
|
|
12
12
|
variant?: 'list' | 'card' | 'table';
|
|
13
|
-
items: Array<
|
|
13
|
+
items: Array<string>;
|
|
14
14
|
labelkey?: string;
|
|
15
15
|
descriptionkey?: string;
|
|
16
16
|
legend?: string | Snippet | Component;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { getAppContext } from '../contexts.js';
|
|
3
|
-
import { type PropColor
|
|
4
|
-
import type { Snippet } from 'svelte';
|
|
3
|
+
import { type PropColor } from '../index.js';
|
|
4
|
+
import type { Snippet, Component } from 'svelte';
|
|
5
5
|
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
|
-
import
|
|
6
|
+
import Icon from './icon.svelte';
|
|
7
7
|
|
|
8
8
|
export type CheckboxProps = {
|
|
9
9
|
value?: boolean | 'intermediate';
|
|
10
10
|
color?: PropColor;
|
|
11
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
12
|
disabled?: boolean;
|
|
13
|
-
icon?: string |
|
|
14
|
-
intermediateicon?: string |
|
|
13
|
+
icon?: string | Component;
|
|
14
|
+
intermediateicon?: string | Component;
|
|
15
15
|
label?: string | Snippet;
|
|
16
16
|
description?: string | Snippet;
|
|
17
17
|
required?: boolean;
|
|
@@ -131,8 +131,10 @@
|
|
|
131
131
|
value = !value;
|
|
132
132
|
}}
|
|
133
133
|
>
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
<Icon
|
|
135
|
+
name={value === 'intermediate' ? intermediateicon : value !== true ? icon : undefined}
|
|
136
|
+
class={variants.icon({ class: [ui.icon] })}
|
|
137
|
+
/>
|
|
136
138
|
</button>
|
|
137
139
|
|
|
138
140
|
{#if label}
|
|
@@ -162,16 +164,3 @@
|
|
|
162
164
|
</div>
|
|
163
165
|
{/if}
|
|
164
166
|
</svelte:element>
|
|
165
|
-
|
|
166
|
-
{#snippet Icon(ico?: CheckboxProps['icon'], icon_class?: ClassValue)}
|
|
167
|
-
<div class={['absolute', icon_class]}>
|
|
168
|
-
{#if typeof ico === 'string'}
|
|
169
|
-
<div class={variants.icon({ class: [ico, ui.icon] })}></div>
|
|
170
|
-
{:else if isSnippet(ico)}
|
|
171
|
-
{@render ico()}
|
|
172
|
-
{:else if isComponent(ico)}
|
|
173
|
-
{@const Iconn = ico}
|
|
174
|
-
<Iconn />
|
|
175
|
-
{/if}
|
|
176
|
-
</div>
|
|
177
|
-
{/snippet}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { type PropColor } from '../index.js';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Snippet, Component } from 'svelte';
|
|
3
3
|
import { type ClassValue } from 'tailwind-variants';
|
|
4
|
-
import type { Component } from 'vitest-browser-svelte';
|
|
5
4
|
export type CheckboxProps = {
|
|
6
5
|
value?: boolean | 'intermediate';
|
|
7
6
|
color?: PropColor;
|
|
8
7
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
8
|
disabled?: boolean;
|
|
10
|
-
icon?: string |
|
|
11
|
-
intermediateicon?: string |
|
|
9
|
+
icon?: string | Component;
|
|
10
|
+
intermediateicon?: string | Component;
|
|
12
11
|
label?: string | Snippet;
|
|
13
12
|
description?: string | Snippet;
|
|
14
13
|
required?: boolean;
|
|
@@ -22,6 +21,6 @@ export type CheckboxProps = {
|
|
|
22
21
|
description?: ClassValue;
|
|
23
22
|
};
|
|
24
23
|
};
|
|
25
|
-
declare const Checkbox:
|
|
24
|
+
declare const Checkbox: Component<CheckboxProps, {}, "value">;
|
|
26
25
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
27
26
|
export default Checkbox;
|
|
@@ -62,3 +62,7 @@ export { default as Tooltip } from './tooltip.svelte';
|
|
|
62
62
|
export * from './app.svelte';
|
|
63
63
|
export { default as App } from './app.svelte';
|
|
64
64
|
export * from './toast.svelte.js';
|
|
65
|
+
export * from './popover.svelte';
|
|
66
|
+
export { default as Popover } from './popover.svelte';
|
|
67
|
+
export * from './radio-group.svelte';
|
|
68
|
+
export { default as RadioGroup } from './radio-group.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -62,3 +62,7 @@ export { default as Tooltip } from './tooltip.svelte';
|
|
|
62
62
|
export * from './app.svelte';
|
|
63
63
|
export { default as App } from './app.svelte';
|
|
64
64
|
export * from './toast.svelte.js';
|
|
65
|
+
export * from './popover.svelte';
|
|
66
|
+
export { default as Popover } from './popover.svelte';
|
|
67
|
+
export * from './radio-group.svelte';
|
|
68
|
+
export { default as RadioGroup } from './radio-group.svelte';
|