uisv 0.0.21 → 0.0.23
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 +22 -22
- package/dist/components/accordion.svelte.d.ts +10 -10
- package/dist/components/alert.svelte +22 -28
- package/dist/components/alert.svelte.d.ts +5 -5
- package/dist/components/app.svelte +63 -0
- package/dist/components/app.svelte.d.ts +8 -0
- package/dist/components/badge.svelte +18 -23
- package/dist/components/badge.svelte.d.ts +3 -3
- package/dist/components/banner.svelte +18 -24
- package/dist/components/banner.svelte.d.ts +5 -5
- package/dist/components/breadcrumb.svelte +7 -8
- package/dist/components/breadcrumb.svelte.d.ts +5 -26
- package/dist/components/button.svelte +36 -44
- package/dist/components/button.svelte.d.ts +12 -11
- package/dist/components/calendar.svelte +6 -7
- package/dist/components/calendar.svelte.d.ts +3 -3
- package/dist/components/card.svelte +11 -12
- package/dist/components/card.svelte.d.ts +5 -5
- package/dist/components/checkbox-group.svelte +12 -13
- package/dist/components/checkbox-group.svelte.d.ts +4 -4
- package/dist/components/checkbox.svelte +42 -40
- package/dist/components/checkbox.svelte.d.ts +6 -6
- package/dist/components/chip.svelte +7 -8
- package/dist/components/chip.svelte.d.ts +3 -3
- package/dist/components/collapsible.svelte +7 -6
- package/dist/components/collapsible.svelte.d.ts +4 -4
- package/dist/components/color-picker.svelte +1 -1
- package/dist/components/h1.svelte +8 -7
- package/dist/components/h2.svelte +12 -11
- package/dist/components/h3.svelte +9 -8
- package/dist/components/h4.svelte +12 -11
- package/dist/components/h5.svelte +12 -11
- package/dist/components/h6.svelte +12 -11
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +7 -0
- package/dist/components/input-number.svelte +8 -9
- package/dist/components/input-number.svelte.d.ts +5 -5
- package/dist/components/input-time.svelte +11 -12
- package/dist/components/input-time.svelte.d.ts +6 -6
- package/dist/components/input.svelte +19 -29
- package/dist/components/input.svelte.d.ts +6 -6
- package/dist/components/kbd.svelte +6 -7
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/modal.svelte +189 -0
- package/dist/components/modal.svelte.d.ts +33 -0
- package/dist/components/p.svelte +3 -1
- package/dist/components/pin-input.svelte +10 -11
- package/dist/components/pin-input.svelte.d.ts +3 -3
- package/dist/components/placeholder.svelte +4 -4
- package/dist/components/popover.svelte +33 -61
- package/dist/components/popover.svelte.d.ts +8 -30
- package/dist/components/progress.svelte +62 -26
- package/dist/components/progress.svelte.d.ts +8 -7
- package/dist/components/select.svelte +49 -53
- package/dist/components/select.svelte.d.ts +22 -29
- package/dist/components/seperator.svelte +7 -8
- package/dist/components/seperator.svelte.d.ts +6 -6
- package/dist/components/slider.svelte +13 -14
- package/dist/components/slider.svelte.d.ts +4 -4
- package/dist/components/switch.svelte +19 -23
- package/dist/components/switch.svelte.d.ts +6 -6
- package/dist/components/tabs.svelte +19 -20
- package/dist/components/tabs.svelte.d.ts +7 -7
- package/dist/components/toast.svelte +173 -0
- package/dist/components/toast.svelte.d.ts +8 -0
- package/dist/components/toast.svelte.js +11 -0
- package/dist/components/tooltip.svelte +94 -0
- package/dist/components/tooltip.svelte.d.ts +24 -0
- package/dist/contexts.d.ts +54 -0
- package/dist/contexts.js +46 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mode.d.ts +89 -0
- package/dist/mode.js +1 -0
- package/dist/utilities/index.d.ts +5 -0
- package/dist/utilities/index.js +5 -0
- package/dist/utilities/isComponent.d.ts +7 -0
- package/dist/utilities/isComponent.js +10 -0
- package/dist/utilities/isSnippet.d.ts +7 -0
- package/dist/utilities/isSnippet.js +8 -0
- package/dist/utilities/useElementRects.svelte.d.ts +11 -0
- package/dist/{utilities.svelte.js → utilities/useElementRects.svelte.js} +0 -38
- package/dist/utilities/useRafFn.svelte.d.ts +43 -0
- package/dist/utilities/useRafFn.svelte.js +56 -0
- package/dist/utilities/useStyle.svelte.d.ts +8 -0
- package/dist/utilities/useStyle.svelte.js +21 -0
- package/dist/vite.js +30 -35
- package/package.json +39 -27
- package/dist/utilities.svelte.d.ts +0 -31
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { type Component, type Snippet } from 'svelte';
|
|
3
|
-
import {
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
3
|
+
import { type PropColor, type PropVariant, Icon } from '../index.js';
|
|
5
4
|
// import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
|
|
6
|
-
import { isSnippet } from '../index.js';
|
|
7
|
-
import { tv } from 'tailwind-variants';
|
|
8
5
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
6
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
7
|
+
import { getAppContext } from '../contexts.js';
|
|
9
8
|
|
|
10
|
-
export type
|
|
9
|
+
export type ButtonBaseProps = {
|
|
11
10
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
12
11
|
ref?: HTMLButtonElement | HTMLAnchorElement;
|
|
13
12
|
/** Where to display the linked URL, as the name for a browsing context. */
|
|
@@ -18,15 +17,15 @@
|
|
|
18
17
|
/** The type of the button when not a link. */
|
|
19
18
|
type?: 'submit' | 'reset' | 'button' | null | undefined;
|
|
20
19
|
/** When true, the icon will be displayed on the right side. */
|
|
21
|
-
loadingicon?: string |
|
|
20
|
+
loadingicon?: string | Component;
|
|
22
21
|
/** When true, the loading icon will be displayed. */
|
|
23
22
|
loading?: boolean;
|
|
24
23
|
/** The position of the icon, including the loading icon */
|
|
25
|
-
iconposition?: '
|
|
24
|
+
iconposition?: 'leading' | 'trailing';
|
|
26
25
|
/** Icon when `loading` is `false` */
|
|
27
|
-
icon?: string |
|
|
28
|
-
leadingicon?: string |
|
|
29
|
-
trailingicon?: string |
|
|
26
|
+
icon?: string | Component;
|
|
27
|
+
leadingicon?: string | Component;
|
|
28
|
+
trailingicon?: string | Component;
|
|
30
29
|
/** Route Location the link should navigate to when clicked on. */
|
|
31
30
|
href?: string;
|
|
32
31
|
label?: string;
|
|
@@ -49,13 +48,15 @@
|
|
|
49
48
|
/** Set loading state automatically based on the `@click` promise state */
|
|
50
49
|
loadingauto?: boolean;
|
|
51
50
|
ui?: {
|
|
52
|
-
base?:
|
|
53
|
-
icon?:
|
|
54
|
-
leadingicon?:
|
|
55
|
-
trailingicon?:
|
|
51
|
+
base?: ClassValue;
|
|
52
|
+
icon?: ClassValue;
|
|
53
|
+
leadingicon?: ClassValue;
|
|
54
|
+
trailingicon?: ClassValue;
|
|
56
55
|
};
|
|
57
56
|
children?: Snippet;
|
|
58
57
|
};
|
|
58
|
+
|
|
59
|
+
export type ButtonProps = SvelteHTMLElements['button'] & ButtonBaseProps;
|
|
59
60
|
</script>
|
|
60
61
|
|
|
61
62
|
<script lang="ts">
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
size = 'md',
|
|
66
67
|
variant = 'solid',
|
|
67
68
|
color = 'primary',
|
|
68
|
-
iconposition = '
|
|
69
|
+
iconposition = 'leading',
|
|
69
70
|
children,
|
|
70
71
|
// active,
|
|
71
72
|
// activecolor,
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
href,
|
|
80
81
|
icon,
|
|
81
82
|
loading,
|
|
82
|
-
loadingicon =
|
|
83
|
+
loadingicon = getAppContext().icons.loading,
|
|
83
84
|
type,
|
|
84
85
|
trailingicon,
|
|
85
86
|
leadingicon,
|
|
@@ -93,7 +94,7 @@
|
|
|
93
94
|
return false;
|
|
94
95
|
});
|
|
95
96
|
|
|
96
|
-
const
|
|
97
|
+
const classnames = $derived(
|
|
97
98
|
tv({
|
|
98
99
|
slots: {
|
|
99
100
|
icon: '',
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
},
|
|
111
112
|
variant: {
|
|
112
113
|
link: '',
|
|
113
|
-
solid: 'text-inverted',
|
|
114
|
+
solid: 'text-label-inverted',
|
|
114
115
|
outline: 'border',
|
|
115
116
|
soft: '',
|
|
116
117
|
subtle: 'border',
|
|
@@ -143,7 +144,7 @@
|
|
|
143
144
|
{
|
|
144
145
|
color: 'surface',
|
|
145
146
|
variant: 'solid',
|
|
146
|
-
class: 'bg-surface-inverted text-inverted hover:bg-toned',
|
|
147
|
+
class: 'bg-surface-inverted text-label-inverted hover:bg-label-toned',
|
|
147
148
|
},
|
|
148
149
|
{
|
|
149
150
|
color: 'info',
|
|
@@ -177,7 +178,7 @@
|
|
|
177
178
|
color: 'surface',
|
|
178
179
|
variant: 'outline',
|
|
179
180
|
class: {
|
|
180
|
-
base: 'border-surface-accented text-
|
|
181
|
+
base: 'border-surface-accented text-label hover:bg-surface-elevated',
|
|
181
182
|
},
|
|
182
183
|
},
|
|
183
184
|
{
|
|
@@ -217,7 +218,7 @@
|
|
|
217
218
|
{
|
|
218
219
|
color: 'surface',
|
|
219
220
|
variant: 'soft',
|
|
220
|
-
class: 'bg-surface/10 text-
|
|
221
|
+
class: 'bg-surface/10 text-label-highlighted hover:bg-surface/15',
|
|
221
222
|
},
|
|
222
223
|
{
|
|
223
224
|
color: 'info',
|
|
@@ -248,7 +249,7 @@
|
|
|
248
249
|
{
|
|
249
250
|
color: 'surface',
|
|
250
251
|
variant: 'subtle',
|
|
251
|
-
class: 'bg-surface/10 text-
|
|
252
|
+
class: 'bg-surface/10 text-label-highlighted border-surface/25 hover:bg-surface/15',
|
|
252
253
|
},
|
|
253
254
|
{
|
|
254
255
|
color: 'info',
|
|
@@ -279,7 +280,7 @@
|
|
|
279
280
|
{
|
|
280
281
|
color: 'surface',
|
|
281
282
|
variant: 'ghost',
|
|
282
|
-
class: 'text-highlighted hover:bg-surface/15',
|
|
283
|
+
class: 'text-label-label-highlighted hover:bg-surface/15',
|
|
283
284
|
},
|
|
284
285
|
{
|
|
285
286
|
color: 'info',
|
|
@@ -310,7 +311,7 @@
|
|
|
310
311
|
{
|
|
311
312
|
color: 'surface',
|
|
312
313
|
variant: 'link',
|
|
313
|
-
class: 'text-muted hover:text-surface-inverted',
|
|
314
|
+
class: 'text-label-muted hover:text-surface-inverted',
|
|
314
315
|
},
|
|
315
316
|
{
|
|
316
317
|
color: 'info',
|
|
@@ -352,7 +353,6 @@
|
|
|
352
353
|
|
|
353
354
|
<svelte:element
|
|
354
355
|
this={href ? 'a' : 'button'}
|
|
355
|
-
data-button-root
|
|
356
356
|
type={href ? undefined : type}
|
|
357
357
|
href={href && !disabled ? href : undefined}
|
|
358
358
|
disabled={disabled || is_loading}
|
|
@@ -360,14 +360,17 @@
|
|
|
360
360
|
role={href && disabled ? 'link' : undefined}
|
|
361
361
|
tabindex={href && disabled ? -1 : 0}
|
|
362
362
|
bind:this={ref}
|
|
363
|
-
class={
|
|
363
|
+
class={classnames.base({
|
|
364
364
|
class: [only_icon && 'px-0 aspect-square justify-center', href && 'cursor-pointer', ui.base],
|
|
365
365
|
})}
|
|
366
366
|
onclick={onClickWrapper}
|
|
367
367
|
{...rest}
|
|
368
368
|
>
|
|
369
|
-
{#if iconposition === '
|
|
370
|
-
|
|
369
|
+
{#if iconposition === 'leading' || leadingicon || loading}
|
|
370
|
+
<Icon
|
|
371
|
+
name={is_loading ? loadingicon : leadingicon || icon}
|
|
372
|
+
class={[ui.leadingicon, loading && 'animate-spin', iconposition === 'leading' && ui.icon]}
|
|
373
|
+
/>
|
|
371
374
|
{/if}
|
|
372
375
|
|
|
373
376
|
{#if label}
|
|
@@ -376,21 +379,10 @@
|
|
|
376
379
|
{@render children?.()}
|
|
377
380
|
{/if}
|
|
378
381
|
|
|
379
|
-
{#if iconposition
|
|
380
|
-
|
|
382
|
+
{#if iconposition === 'trailing' || trailingicon}
|
|
383
|
+
<Icon
|
|
384
|
+
name={trailingicon || icon}
|
|
385
|
+
class={[ui.trailingicon, iconposition === 'trailing' && ui.icon]}
|
|
386
|
+
/>
|
|
381
387
|
{/if}
|
|
382
388
|
</svelte:element>
|
|
383
|
-
|
|
384
|
-
{#snippet Icon(IconProp?: string | Snippet | Component, classvalue?: ClassNameValue)}
|
|
385
|
-
{#if typeof IconProp === 'string'}
|
|
386
|
-
<div
|
|
387
|
-
class={variants.icon({
|
|
388
|
-
class: [is_loading && 'animate-spin', IconProp, ui.icon, classvalue],
|
|
389
|
-
})}
|
|
390
|
-
></div>
|
|
391
|
-
{:else if isSnippet(IconProp)}
|
|
392
|
-
{@render IconProp()}
|
|
393
|
-
{:else if isComponent(IconProp)}
|
|
394
|
-
<IconProp />
|
|
395
|
-
{/if}
|
|
396
|
-
{/snippet}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Component, type Snippet } from 'svelte';
|
|
2
2
|
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
5
|
-
|
|
4
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
5
|
+
export type ButtonBaseProps = {
|
|
6
6
|
/** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
|
|
7
7
|
ref?: HTMLButtonElement | HTMLAnchorElement;
|
|
8
8
|
/** Where to display the linked URL, as the name for a browsing context. */
|
|
@@ -12,15 +12,15 @@ export type ButtonProps = SvelteHTMLElements['button'] & {
|
|
|
12
12
|
/** The type of the button when not a link. */
|
|
13
13
|
type?: 'submit' | 'reset' | 'button' | null | undefined;
|
|
14
14
|
/** When true, the icon will be displayed on the right side. */
|
|
15
|
-
loadingicon?: string |
|
|
15
|
+
loadingicon?: string | Component;
|
|
16
16
|
/** When true, the loading icon will be displayed. */
|
|
17
17
|
loading?: boolean;
|
|
18
18
|
/** The position of the icon, including the loading icon */
|
|
19
|
-
iconposition?: '
|
|
19
|
+
iconposition?: 'leading' | 'trailing';
|
|
20
20
|
/** Icon when `loading` is `false` */
|
|
21
|
-
icon?: string |
|
|
22
|
-
leadingicon?: string |
|
|
23
|
-
trailingicon?: string |
|
|
21
|
+
icon?: string | Component;
|
|
22
|
+
leadingicon?: string | Component;
|
|
23
|
+
trailingicon?: string | Component;
|
|
24
24
|
/** Route Location the link should navigate to when clicked on. */
|
|
25
25
|
href?: string;
|
|
26
26
|
label?: string;
|
|
@@ -41,13 +41,14 @@ export type ButtonProps = SvelteHTMLElements['button'] & {
|
|
|
41
41
|
/** Set loading state automatically based on the `@click` promise state */
|
|
42
42
|
loadingauto?: boolean;
|
|
43
43
|
ui?: {
|
|
44
|
-
base?:
|
|
45
|
-
icon?:
|
|
46
|
-
leadingicon?:
|
|
47
|
-
trailingicon?:
|
|
44
|
+
base?: ClassValue;
|
|
45
|
+
icon?: ClassValue;
|
|
46
|
+
leadingicon?: ClassValue;
|
|
47
|
+
trailingicon?: ClassValue;
|
|
48
48
|
};
|
|
49
49
|
children?: Snippet;
|
|
50
50
|
};
|
|
51
|
+
export type ButtonProps = SvelteHTMLElements['button'] & ButtonBaseProps;
|
|
51
52
|
declare const Button: Component<ButtonProps, {}, "ref">;
|
|
52
53
|
type Button = ReturnType<typeof Button>;
|
|
53
54
|
export default Button;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import { tv } from 'tailwind-variants';
|
|
3
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
4
4
|
import { type PropColor, type PropVariant, isSnippet } from '../index.js';
|
|
5
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
5
|
import { type DateValue, today } from '../date.js';
|
|
7
6
|
import { Calendar, type CalendarRootProps } from 'bits-ui';
|
|
8
7
|
|
|
@@ -11,8 +10,8 @@
|
|
|
11
10
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
12
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
12
|
ui?: {
|
|
14
|
-
base?:
|
|
15
|
-
icon?:
|
|
13
|
+
base?: ClassValue;
|
|
14
|
+
icon?: ClassValue;
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
</script>
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
children,
|
|
31
30
|
}: CalendarProps = $props();
|
|
32
31
|
|
|
33
|
-
const
|
|
32
|
+
const variants = $derived.by(() => {
|
|
34
33
|
return tv({
|
|
35
34
|
slots: { icon: '', base: '' },
|
|
36
35
|
variants: {
|
|
@@ -63,7 +62,7 @@
|
|
|
63
62
|
});
|
|
64
63
|
</script>
|
|
65
64
|
|
|
66
|
-
<Calendar.Root type={type as
|
|
65
|
+
<Calendar.Root type={type as 'single'} bind:value={() => value as DateValue, (v) => (value = v)}>
|
|
67
66
|
{#snippet children({ months, weekdays })}
|
|
68
67
|
<Calendar.Header>
|
|
69
68
|
<Calendar.PrevButton />
|
|
@@ -71,7 +70,7 @@
|
|
|
71
70
|
<Calendar.NextButton />
|
|
72
71
|
</Calendar.Header>
|
|
73
72
|
|
|
74
|
-
{#each months as month}
|
|
73
|
+
{#each months as month (month)}
|
|
75
74
|
<Calendar.Grid>
|
|
76
75
|
<Calendar.GridHead>
|
|
77
76
|
<Calendar.GridRow>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
2
3
|
import { type PropColor, type PropVariant } from '../index.js';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
4
|
import { Calendar, type CalendarRootProps } from 'bits-ui';
|
|
5
5
|
export type CalendarProps = CalendarRootProps & {
|
|
6
6
|
color?: PropColor;
|
|
7
7
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
8
8
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
9
|
ui?: {
|
|
10
|
-
base?:
|
|
11
|
-
icon?:
|
|
10
|
+
base?: ClassValue;
|
|
11
|
+
icon?: ClassValue;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
declare const Calendar: Component<CalendarProps, {}, "value">;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { PropVariant } from '../index.js';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import type
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
5
|
|
|
7
6
|
export type CardProps = {
|
|
8
7
|
children: Snippet;
|
|
@@ -10,10 +9,10 @@
|
|
|
10
9
|
footer?: Snippet;
|
|
11
10
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
12
11
|
ui?: {
|
|
13
|
-
base?:
|
|
14
|
-
header?:
|
|
15
|
-
content?:
|
|
16
|
-
footer?:
|
|
12
|
+
base?: ClassValue;
|
|
13
|
+
header?: ClassValue;
|
|
14
|
+
content?: ClassValue;
|
|
15
|
+
footer?: ClassValue;
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
</script>
|
|
@@ -21,7 +20,7 @@
|
|
|
21
20
|
<script lang="ts">
|
|
22
21
|
let { header, children, footer, variant = 'solid', ui = {} }: CardProps = $props();
|
|
23
22
|
|
|
24
|
-
const
|
|
23
|
+
const variants = $derived.by(() =>
|
|
25
24
|
tv({
|
|
26
25
|
slots: {
|
|
27
26
|
base: 'rounded overflow-hidden',
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
variants: {
|
|
33
32
|
variant: {
|
|
34
33
|
solid: {
|
|
35
|
-
base: 'bg-surface-inverted text-inverted',
|
|
34
|
+
base: 'bg-surface-inverted text-label-inverted',
|
|
36
35
|
header: 'border-transparent',
|
|
37
36
|
footer: 'border-transparent',
|
|
38
37
|
},
|
|
@@ -52,19 +51,19 @@
|
|
|
52
51
|
);
|
|
53
52
|
</script>
|
|
54
53
|
|
|
55
|
-
<div class={
|
|
54
|
+
<div class={variants.base({ class: [ui.base] })}>
|
|
56
55
|
{#if header}
|
|
57
|
-
<div class={
|
|
56
|
+
<div class={variants.header({ class: [ui.header] })}>
|
|
58
57
|
{@render header()}
|
|
59
58
|
</div>
|
|
60
59
|
{/if}
|
|
61
60
|
|
|
62
|
-
<div class={
|
|
61
|
+
<div class={variants.content({ class: ui.content })}>
|
|
63
62
|
{@render children()}
|
|
64
63
|
</div>
|
|
65
64
|
|
|
66
65
|
{#if footer}
|
|
67
|
-
<div class={
|
|
66
|
+
<div class={variants.header({ class: [ui.header] })}>
|
|
68
67
|
{@render footer()}
|
|
69
68
|
</div>
|
|
70
69
|
{/if}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { PropVariant } from '../index.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type CardProps = {
|
|
5
5
|
children: Snippet;
|
|
6
6
|
header?: Snippet;
|
|
7
7
|
footer?: Snippet;
|
|
8
8
|
variant?: Exclude<PropVariant, 'none' | 'ghost'>;
|
|
9
9
|
ui?: {
|
|
10
|
-
base?:
|
|
11
|
-
header?:
|
|
12
|
-
content?:
|
|
13
|
-
footer?:
|
|
10
|
+
base?: ClassValue;
|
|
11
|
+
header?: ClassValue;
|
|
12
|
+
content?: ClassValue;
|
|
13
|
+
footer?: ClassValue;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
declare const Card: import("svelte").Component<CardProps, {}, "">;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { tv } from 'tailwind-variants';
|
|
2
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
4
3
|
import type { Component, Snippet } from 'svelte';
|
|
5
4
|
import { type PropColor, isComponent, isSnippet, Checkbox } from '../index.js';
|
|
6
5
|
|
|
@@ -21,9 +20,9 @@
|
|
|
21
20
|
legend?: string | Snippet | Component;
|
|
22
21
|
orientation?: 'horizontal' | 'vertical';
|
|
23
22
|
ui?: {
|
|
24
|
-
root?:
|
|
25
|
-
container?:
|
|
26
|
-
checkbox?:
|
|
23
|
+
root?: ClassValue;
|
|
24
|
+
container?: ClassValue;
|
|
25
|
+
checkbox?: ClassValue;
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
</script>
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
...props
|
|
45
44
|
}: CheckboxGroupProps = $props();
|
|
46
45
|
|
|
47
|
-
const
|
|
46
|
+
const variants = $derived.by(() =>
|
|
48
47
|
tv({
|
|
49
48
|
slots: {
|
|
50
49
|
root: '',
|
|
@@ -96,10 +95,10 @@
|
|
|
96
95
|
},
|
|
97
96
|
variant: {
|
|
98
97
|
list: { container: 'gap-2' },
|
|
99
|
-
card: { container: 'gap-2', checkbox: 'p-4 rounded-lg border border-
|
|
98
|
+
card: { container: 'gap-2', checkbox: 'p-4 rounded-lg border border-surface-accented' },
|
|
100
99
|
table: {
|
|
101
100
|
container: 'gap-0 ',
|
|
102
|
-
checkbox: 'border border-
|
|
101
|
+
checkbox: 'border border-surface-accented p-4 data-[state=checked]:z-1',
|
|
103
102
|
},
|
|
104
103
|
},
|
|
105
104
|
orientation: {
|
|
@@ -128,7 +127,7 @@
|
|
|
128
127
|
selected: true,
|
|
129
128
|
variant: ['table', 'card'],
|
|
130
129
|
class: {
|
|
131
|
-
checkbox: 'border-
|
|
130
|
+
checkbox: 'border-label-muted',
|
|
132
131
|
},
|
|
133
132
|
},
|
|
134
133
|
{
|
|
@@ -177,7 +176,7 @@
|
|
|
177
176
|
selected: true,
|
|
178
177
|
variant: ['table'],
|
|
179
178
|
class: {
|
|
180
|
-
checkbox: 'bg-surface-
|
|
179
|
+
checkbox: 'bg-surface-elevated',
|
|
181
180
|
},
|
|
182
181
|
},
|
|
183
182
|
{
|
|
@@ -217,7 +216,7 @@
|
|
|
217
216
|
);
|
|
218
217
|
</script>
|
|
219
218
|
|
|
220
|
-
<div class={
|
|
219
|
+
<div class={variants.root({ class: [ui.root] })}>
|
|
221
220
|
{#if typeof legend === 'string'}
|
|
222
221
|
<legend>{legend}</legend>
|
|
223
222
|
{:else if isSnippet(legend)}
|
|
@@ -227,7 +226,7 @@
|
|
|
227
226
|
<Legend />
|
|
228
227
|
{/if}
|
|
229
228
|
|
|
230
|
-
<fieldset class={
|
|
229
|
+
<fieldset class={variants.container({ class: [ui.container] })}>
|
|
231
230
|
{#each items as item, index (index)}
|
|
232
231
|
{@const key = typeof item === 'object' ? item[valuekey] : item}
|
|
233
232
|
|
|
@@ -236,7 +235,7 @@
|
|
|
236
235
|
{color}
|
|
237
236
|
as={variant === 'list' ? 'div' : 'label'}
|
|
238
237
|
ui={{
|
|
239
|
-
root:
|
|
238
|
+
root: variants.checkbox({
|
|
240
239
|
class: [ui.checkbox],
|
|
241
240
|
selected: value.includes(key),
|
|
242
241
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
3
|
import { type PropColor } from '../index.js';
|
|
4
4
|
export type CheckboxGroupProps = {
|
|
@@ -16,9 +16,9 @@ export type CheckboxGroupProps = {
|
|
|
16
16
|
legend?: string | Snippet | Component;
|
|
17
17
|
orientation?: 'horizontal' | 'vertical';
|
|
18
18
|
ui?: {
|
|
19
|
-
root?:
|
|
20
|
-
container?:
|
|
21
|
-
checkbox?:
|
|
19
|
+
root?: ClassValue;
|
|
20
|
+
container?: ClassValue;
|
|
21
|
+
checkbox?: ClassValue;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
declare const CheckboxGroup: Component<CheckboxGroupProps, {}, "value">;
|