uisv 0.0.21 → 0.0.22
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 +20 -21
- 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 +57 -0
- package/dist/components/app.svelte.d.ts +15 -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 +6 -6
- package/dist/components/breadcrumb.svelte.d.ts +4 -25
- 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 +39 -38
- 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 +4 -5
- 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 +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/input-number.svelte +5 -7
- 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 +11 -12
- 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 +22 -21
- package/dist/components/progress.svelte.d.ts +5 -5
- package/dist/components/select.svelte +48 -53
- package/dist/components/select.svelte.d.ts +22 -29
- package/dist/components/seperator.svelte +6 -7
- 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 +17 -22
- 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/tooltip.svelte +94 -0
- package/dist/components/tooltip.svelte.d.ts +24 -0
- package/dist/contexts.d.ts +47 -0
- package/dist/contexts.js +46 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mode.d.ts +89 -0
- package/dist/mode.js +1 -0
- package/dist/utilities.svelte.d.ts +1 -1
- package/dist/vite.js +30 -35
- package/package.json +31 -26
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { Accordion } from 'bits-ui';
|
|
3
3
|
import type { Component, 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 AccordionItem = {
|
|
8
7
|
label: string;
|
|
@@ -25,15 +24,15 @@
|
|
|
25
24
|
content?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
26
25
|
body?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
|
|
27
26
|
ui?: {
|
|
28
|
-
root?:
|
|
29
|
-
item?:
|
|
30
|
-
header?:
|
|
31
|
-
trigger?:
|
|
32
|
-
content?:
|
|
33
|
-
body?:
|
|
34
|
-
leadingicon?:
|
|
35
|
-
trailingicon?:
|
|
36
|
-
label?:
|
|
27
|
+
root?: ClassValue;
|
|
28
|
+
item?: ClassValue;
|
|
29
|
+
header?: ClassValue;
|
|
30
|
+
trigger?: ClassValue;
|
|
31
|
+
content?: ClassValue;
|
|
32
|
+
body?: ClassValue;
|
|
33
|
+
leadingicon?: ClassValue;
|
|
34
|
+
trailingicon?: ClassValue;
|
|
35
|
+
label?: ClassValue;
|
|
37
36
|
};
|
|
38
37
|
};
|
|
39
38
|
</script>
|
|
@@ -51,9 +50,9 @@
|
|
|
51
50
|
trailing,
|
|
52
51
|
content,
|
|
53
52
|
body,
|
|
54
|
-
ui = {}
|
|
53
|
+
ui = {},
|
|
55
54
|
}: AccordionProps = $props();
|
|
56
|
-
const
|
|
55
|
+
const variants = $derived(
|
|
57
56
|
tv({
|
|
58
57
|
slots: {
|
|
59
58
|
root: 'w-full',
|
|
@@ -67,23 +66,23 @@
|
|
|
67
66
|
leadingIcon: 'shrink-0 size-5',
|
|
68
67
|
trailingIcon:
|
|
69
68
|
'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
|
|
70
|
-
label: 'text-start break-words'
|
|
69
|
+
label: 'text-start break-words',
|
|
71
70
|
},
|
|
72
71
|
variants: {
|
|
73
72
|
disabled: {
|
|
74
73
|
true: {
|
|
75
|
-
trigger: 'cursor-not-allowed opacity-75'
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
74
|
+
trigger: 'cursor-not-allowed opacity-75',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
79
78
|
})({
|
|
80
|
-
disabled
|
|
81
|
-
})
|
|
79
|
+
disabled,
|
|
80
|
+
}),
|
|
82
81
|
);
|
|
83
82
|
</script>
|
|
84
83
|
|
|
85
84
|
<Accordion.Root
|
|
86
|
-
class={
|
|
85
|
+
class={variants.root({ class: ui.root })}
|
|
87
86
|
type="multiple"
|
|
88
87
|
bind:value={
|
|
89
88
|
() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Accordion } from 'bits-ui';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type AccordionItem = {
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: string | Snippet | Component;
|
|
@@ -42,15 +42,15 @@ export type AccordionProps = {
|
|
|
42
42
|
open: boolean;
|
|
43
43
|
}]>;
|
|
44
44
|
ui?: {
|
|
45
|
-
root?:
|
|
46
|
-
item?:
|
|
47
|
-
header?:
|
|
48
|
-
trigger?:
|
|
49
|
-
content?:
|
|
50
|
-
body?:
|
|
51
|
-
leadingicon?:
|
|
52
|
-
trailingicon?:
|
|
53
|
-
label?:
|
|
45
|
+
root?: ClassValue;
|
|
46
|
+
item?: ClassValue;
|
|
47
|
+
header?: ClassValue;
|
|
48
|
+
trigger?: ClassValue;
|
|
49
|
+
content?: ClassValue;
|
|
50
|
+
body?: ClassValue;
|
|
51
|
+
leadingicon?: ClassValue;
|
|
52
|
+
trailingicon?: ClassValue;
|
|
53
|
+
label?: ClassValue;
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
declare const Accordion: Component<AccordionProps, {}, "value">;
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
type ButtonProps,
|
|
6
6
|
Button,
|
|
7
7
|
type PropVariant,
|
|
8
|
+
Icon,
|
|
8
9
|
} from '../index.js';
|
|
9
10
|
import type { Component, Snippet } from 'svelte';
|
|
10
|
-
import type
|
|
11
|
-
import { tv } from 'tailwind-variants';
|
|
11
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
12
12
|
import { defu } from 'defu';
|
|
13
|
+
import { app_icons } from '../contexts.js';
|
|
13
14
|
|
|
14
15
|
export type AlertProps = {
|
|
15
16
|
title?: string | Snippet;
|
|
@@ -21,10 +22,10 @@
|
|
|
21
22
|
actions?: ButtonProps[];
|
|
22
23
|
close?: boolean | ButtonProps;
|
|
23
24
|
ui?: {
|
|
24
|
-
base?:
|
|
25
|
-
icon?:
|
|
26
|
-
description?:
|
|
27
|
-
title?:
|
|
25
|
+
base?: ClassValue;
|
|
26
|
+
icon?: ClassValue;
|
|
27
|
+
description?: ClassValue;
|
|
28
|
+
title?: ClassValue;
|
|
28
29
|
};
|
|
29
30
|
onclose?: () => void | Promise<void>;
|
|
30
31
|
};
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
|
|
47
48
|
const close_props = $derived.by(() => {
|
|
48
49
|
return defu(typeof close === 'boolean' ? {} : close, {
|
|
49
|
-
icon:
|
|
50
|
+
icon: app_icons.get().close,
|
|
50
51
|
variant: 'link',
|
|
51
52
|
color: variant === 'solid' ? 'surface' : color,
|
|
52
53
|
ui: {
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
},
|
|
55
56
|
} as ButtonProps);
|
|
56
57
|
});
|
|
57
|
-
const
|
|
58
|
+
const variants = $derived.by(() =>
|
|
58
59
|
tv({
|
|
59
60
|
slots: {
|
|
60
61
|
base: 'flex gap-2 font-sans p-4 rounded-lg',
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
{
|
|
100
101
|
variant: 'solid',
|
|
101
102
|
color: 'surface',
|
|
102
|
-
class: 'bg-surface-
|
|
103
|
+
class: 'bg-surface-inverted',
|
|
103
104
|
},
|
|
104
105
|
{
|
|
105
106
|
variant: 'solid',
|
|
@@ -130,7 +131,7 @@
|
|
|
130
131
|
{
|
|
131
132
|
variant: 'outline',
|
|
132
133
|
color: 'surface',
|
|
133
|
-
class: 'border-surface-
|
|
134
|
+
class: 'border-surface-accented text-surface-inverted',
|
|
134
135
|
},
|
|
135
136
|
{
|
|
136
137
|
variant: 'outline',
|
|
@@ -161,7 +162,7 @@
|
|
|
161
162
|
{
|
|
162
163
|
variant: 'soft',
|
|
163
164
|
color: 'surface',
|
|
164
|
-
class: 'bg-surface-
|
|
165
|
+
class: 'bg-surface-muted text-surface-inverted',
|
|
165
166
|
},
|
|
166
167
|
{
|
|
167
168
|
variant: 'soft',
|
|
@@ -192,7 +193,7 @@
|
|
|
192
193
|
{
|
|
193
194
|
variant: 'subtle',
|
|
194
195
|
color: 'surface',
|
|
195
|
-
class: 'bg-surface-
|
|
196
|
+
class: 'bg-surface-muted text-surface-inverted border-surface-accented',
|
|
196
197
|
},
|
|
197
198
|
{
|
|
198
199
|
variant: 'subtle',
|
|
@@ -219,24 +220,17 @@
|
|
|
219
220
|
);
|
|
220
221
|
</script>
|
|
221
222
|
|
|
222
|
-
<div class={
|
|
223
|
-
<div class="flex gap-2
|
|
224
|
-
{#if icon}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{:else if isSnippet(icon)}
|
|
229
|
-
{@render icon()}
|
|
230
|
-
{:else}
|
|
231
|
-
{@const Icon = icon}
|
|
232
|
-
<Icon />
|
|
233
|
-
{/if}
|
|
234
|
-
</div>
|
|
223
|
+
<div class={variants.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
|
|
224
|
+
<div class="flex gap-2 grow">
|
|
225
|
+
{#if isSnippet(icon)}
|
|
226
|
+
{@render icon()}
|
|
227
|
+
{:else}
|
|
228
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
235
229
|
{/if}
|
|
236
230
|
|
|
237
|
-
<div class="space-y-1
|
|
231
|
+
<div class="space-y-1 grow">
|
|
238
232
|
{#if title}
|
|
239
|
-
<div class={
|
|
233
|
+
<div class={variants.title({ class: [ui.title] })}>
|
|
240
234
|
{#if isSnippet(title)}
|
|
241
235
|
{@render title()}
|
|
242
236
|
{:else}
|
|
@@ -246,7 +240,7 @@
|
|
|
246
240
|
{/if}
|
|
247
241
|
|
|
248
242
|
{#if description}
|
|
249
|
-
<div class={
|
|
243
|
+
<div class={variants.description({ class: [ui.title] })}>
|
|
250
244
|
{#if isSnippet(description)}
|
|
251
245
|
{@render description()}
|
|
252
246
|
{:else}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropColor, type ButtonProps, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type AlertProps = {
|
|
5
5
|
title?: string | Snippet;
|
|
6
6
|
description?: string | Snippet;
|
|
@@ -11,10 +11,10 @@ export type AlertProps = {
|
|
|
11
11
|
actions?: ButtonProps[];
|
|
12
12
|
close?: boolean | ButtonProps;
|
|
13
13
|
ui?: {
|
|
14
|
-
base?:
|
|
15
|
-
icon?:
|
|
16
|
-
description?:
|
|
17
|
-
title?:
|
|
14
|
+
base?: ClassValue;
|
|
15
|
+
icon?: ClassValue;
|
|
16
|
+
description?: ClassValue;
|
|
17
|
+
title?: ClassValue;
|
|
18
18
|
};
|
|
19
19
|
onclose?: () => void | Promise<void>;
|
|
20
20
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { app_icons, DEFAULT_ICONS, type AppIcons } from '../contexts.js';
|
|
3
|
+
import { ModeWatcher, type ModeWatcherProps } from '../mode.js';
|
|
4
|
+
import { Tooltip } from 'bits-ui';
|
|
5
|
+
import defu from 'defu';
|
|
6
|
+
import { type Snippet } from 'svelte';
|
|
7
|
+
import { Toaster, type ToasterProps } from 'svelte-sonner';
|
|
8
|
+
import { boxWith } from 'svelte-toolbelt';
|
|
9
|
+
import { Icon } from './index.js';
|
|
10
|
+
|
|
11
|
+
export type AppProps = {
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
modewatcher?: ModeWatcherProps;
|
|
14
|
+
toaster?: ToasterProps;
|
|
15
|
+
tooltip?: Tooltip.ProviderProps;
|
|
16
|
+
icons?: Partial<Record<AppIcons, `i-${string}:${string}`>>;
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let { children, modewatcher, toaster, tooltip, icons = {} }: AppProps = $props();
|
|
22
|
+
|
|
23
|
+
const _icons = boxWith(() => defu(icons, DEFAULT_ICONS));
|
|
24
|
+
|
|
25
|
+
app_icons.set(_icons.current);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<ModeWatcher {...modewatcher} />
|
|
29
|
+
<Toaster {...toaster}>
|
|
30
|
+
{#snippet infoIcon()}
|
|
31
|
+
<Icon name={app_icons.get().info} />
|
|
32
|
+
{/snippet}
|
|
33
|
+
|
|
34
|
+
{#snippet closeIcon()}
|
|
35
|
+
<Icon name={app_icons.get().close} />
|
|
36
|
+
{/snippet}
|
|
37
|
+
|
|
38
|
+
{#snippet errorIcon()}
|
|
39
|
+
<Icon name={app_icons.get().error} />
|
|
40
|
+
{/snippet}
|
|
41
|
+
|
|
42
|
+
{#snippet loadingIcon()}
|
|
43
|
+
<Icon name={app_icons.get().loading} />
|
|
44
|
+
{/snippet}
|
|
45
|
+
|
|
46
|
+
{#snippet successIcon()}
|
|
47
|
+
<Icon name={app_icons.get().success} />
|
|
48
|
+
{/snippet}
|
|
49
|
+
|
|
50
|
+
{#snippet warningIcon()}
|
|
51
|
+
<Icon name={app_icons.get().warning} />
|
|
52
|
+
{/snippet}
|
|
53
|
+
</Toaster>
|
|
54
|
+
|
|
55
|
+
<Tooltip.Provider {...tooltip}>
|
|
56
|
+
{@render children?.()}
|
|
57
|
+
</Tooltip.Provider>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AppIcons } from '../contexts.js';
|
|
2
|
+
import { type ModeWatcherProps } from '../mode.js';
|
|
3
|
+
import { Tooltip } from 'bits-ui';
|
|
4
|
+
import { type Snippet } from 'svelte';
|
|
5
|
+
import { type ToasterProps } from 'svelte-sonner';
|
|
6
|
+
export type AppProps = {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
modewatcher?: ModeWatcherProps;
|
|
9
|
+
toaster?: ToasterProps;
|
|
10
|
+
tooltip?: Tooltip.ProviderProps;
|
|
11
|
+
icons?: Partial<Record<AppIcons, `i-${string}:${string}`>>;
|
|
12
|
+
};
|
|
13
|
+
declare const App: import("svelte").Component<AppProps, {}, "">;
|
|
14
|
+
type App = ReturnType<typeof App>;
|
|
15
|
+
export default App;
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
5
|
+
import Icon from './icon.svelte';
|
|
6
6
|
|
|
7
7
|
export type BadgeProps = {
|
|
8
8
|
label?: string;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
trailingicon?: boolean;
|
|
14
14
|
children?: Snippet;
|
|
15
15
|
ui?: {
|
|
16
|
-
base?:
|
|
17
|
-
icon?:
|
|
16
|
+
base?: ClassValue;
|
|
17
|
+
icon?: ClassValue;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
</script>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
children,
|
|
32
32
|
}: BadgeProps = $props();
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const variants = $derived.by(() => {
|
|
35
35
|
return tv({
|
|
36
36
|
slots: { icon: '', base: 'flex-inline items-center font-sans' },
|
|
37
37
|
variants: {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
{
|
|
72
72
|
color: 'surface',
|
|
73
73
|
variant: 'solid',
|
|
74
|
-
class: 'bg-surface-inverted text-inverted',
|
|
74
|
+
class: 'bg-surface-inverted text-label-inverted',
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
color: 'info',
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
{
|
|
103
103
|
color: 'surface',
|
|
104
104
|
variant: 'outline',
|
|
105
|
-
class: 'border-surface-accented text-highlighted',
|
|
105
|
+
class: 'border-surface-accented text-label-highlighted',
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
color: 'info',
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
{
|
|
134
134
|
color: 'surface',
|
|
135
135
|
variant: 'soft',
|
|
136
|
-
class: 'bg-surface/10 text-highlighted',
|
|
136
|
+
class: 'bg-surface/10 text-label-highlighted',
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
color: 'info',
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
{
|
|
165
165
|
color: 'surface',
|
|
166
166
|
variant: 'subtle',
|
|
167
|
-
class: 'bg-surface/10 text-highlighted border-surface/20 ',
|
|
167
|
+
class: 'bg-surface/10 text-label-highlighted border-surface/20 ',
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
color: 'info',
|
|
@@ -192,12 +192,16 @@
|
|
|
192
192
|
</script>
|
|
193
193
|
|
|
194
194
|
<span
|
|
195
|
-
class={
|
|
195
|
+
class={variants.base({
|
|
196
196
|
class: [icon && !(children || label) ? 'px-0 aspect-square justify-center' : '', ui.base],
|
|
197
197
|
})}
|
|
198
198
|
>
|
|
199
199
|
{#if !trailingicon}
|
|
200
|
-
{
|
|
200
|
+
{#if isSnippet(icon)}
|
|
201
|
+
{@render icon()}
|
|
202
|
+
{:else}
|
|
203
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
204
|
+
{/if}
|
|
201
205
|
{/if}
|
|
202
206
|
|
|
203
207
|
{#if label}
|
|
@@ -207,19 +211,10 @@
|
|
|
207
211
|
{/if}
|
|
208
212
|
|
|
209
213
|
{#if trailingicon}
|
|
210
|
-
{
|
|
211
|
-
{/if}
|
|
212
|
-
</span>
|
|
213
|
-
|
|
214
|
-
{#snippet Icon()}
|
|
215
|
-
{#if icon}
|
|
216
|
-
{#if typeof icon === 'string'}
|
|
217
|
-
<div class={['pi', icon, classes.icon(), ui.icon]}></div>
|
|
218
|
-
{:else if isSnippet(icon)}
|
|
214
|
+
{#if isSnippet(icon)}
|
|
219
215
|
{@render icon()}
|
|
220
216
|
{:else}
|
|
221
|
-
|
|
222
|
-
<Icon />
|
|
217
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
223
218
|
{/if}
|
|
224
219
|
{/if}
|
|
225
|
-
|
|
220
|
+
</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component, Snippet } 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
|
export type BadgeProps = {
|
|
5
5
|
label?: string;
|
|
6
6
|
color?: PropColor;
|
|
@@ -10,8 +10,8 @@ export type BadgeProps = {
|
|
|
10
10
|
trailingicon?: boolean;
|
|
11
11
|
children?: Snippet;
|
|
12
12
|
ui?: {
|
|
13
|
-
base?:
|
|
14
|
-
icon?:
|
|
13
|
+
base?: ClassValue;
|
|
14
|
+
icon?: ClassValue;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
declare const Badge: Component<BadgeProps, {}, "">;
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
type ButtonProps,
|
|
6
6
|
Button,
|
|
7
7
|
type PropVariant,
|
|
8
|
+
Icon,
|
|
8
9
|
} from '../index.js';
|
|
9
10
|
import type { Component, Snippet } from 'svelte';
|
|
10
|
-
import type
|
|
11
|
-
import { tv } from 'tailwind-variants';
|
|
11
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
12
12
|
import { defu } from 'defu';
|
|
13
|
+
import { app_icons } from '../contexts.js';
|
|
13
14
|
|
|
14
15
|
export type BannerProps = {
|
|
15
16
|
title: string | Snippet;
|
|
@@ -21,10 +22,10 @@
|
|
|
21
22
|
href?: string;
|
|
22
23
|
target?: string;
|
|
23
24
|
ui?: {
|
|
24
|
-
base?:
|
|
25
|
-
icon?:
|
|
26
|
-
description?:
|
|
27
|
-
title?:
|
|
25
|
+
base?: ClassValue;
|
|
26
|
+
icon?: ClassValue;
|
|
27
|
+
description?: ClassValue;
|
|
28
|
+
title?: ClassValue;
|
|
28
29
|
};
|
|
29
30
|
onclose?: () => void | Promise<void>;
|
|
30
31
|
};
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
onclose = () => {},
|
|
45
46
|
}: BannerProps = $props();
|
|
46
47
|
|
|
47
|
-
const
|
|
48
|
+
const variants = $derived.by(() =>
|
|
48
49
|
tv({
|
|
49
50
|
slots: {
|
|
50
51
|
base: 'flex items-center gap-2 font-sans p-4',
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
},
|
|
64
65
|
variant: {
|
|
65
66
|
solid: {
|
|
66
|
-
base: 'text-inverted',
|
|
67
|
-
description: 'text-inverted/90',
|
|
67
|
+
base: 'text-label-inverted',
|
|
68
|
+
description: 'text-label-inverted/90',
|
|
68
69
|
},
|
|
69
70
|
outline: 'border',
|
|
70
71
|
soft: '',
|
|
@@ -204,23 +205,16 @@
|
|
|
204
205
|
this={href ? 'a' : 'button'}
|
|
205
206
|
{href}
|
|
206
207
|
{target}
|
|
207
|
-
class={
|
|
208
|
+
class={variants.base({ class: [ui.base] })}
|
|
208
209
|
>
|
|
209
210
|
<div class="flex grow gap-2 text-sm items-center">
|
|
210
|
-
{#if icon}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{:else if isSnippet(icon)}
|
|
215
|
-
{@render icon()}
|
|
216
|
-
{:else}
|
|
217
|
-
{@const Icon = icon}
|
|
218
|
-
<Icon />
|
|
219
|
-
{/if}
|
|
220
|
-
</div>
|
|
211
|
+
{#if isSnippet(icon)}
|
|
212
|
+
{@render icon()}
|
|
213
|
+
{:else}
|
|
214
|
+
<Icon name={icon} class={variants.icon({ class: ui.icon })} />
|
|
221
215
|
{/if}
|
|
222
216
|
|
|
223
|
-
<div class={
|
|
217
|
+
<div class={variants.title({ class: [ui.title] })}>
|
|
224
218
|
{#if isSnippet(title)}
|
|
225
219
|
{@render title()}
|
|
226
220
|
{:else}
|
|
@@ -244,11 +238,11 @@
|
|
|
244
238
|
<div>
|
|
245
239
|
<Button
|
|
246
240
|
{...defu<ButtonProps, [ButtonProps]>(typeof close === 'boolean' ? {} : close, {
|
|
247
|
-
icon:
|
|
241
|
+
icon: app_icons.get().close,
|
|
248
242
|
variant: 'ghost',
|
|
249
243
|
color: 'surface',
|
|
250
244
|
ui: {
|
|
251
|
-
icon: variant === 'solid' ? 'text-inverted' : '',
|
|
245
|
+
icon: variant === 'solid' ? 'text-label-inverted' : '',
|
|
252
246
|
},
|
|
253
247
|
})}
|
|
254
248
|
onclick={onclose}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PropColor, type ButtonProps, type PropVariant } from '../index.js';
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
4
4
|
export type BannerProps = {
|
|
5
5
|
title: string | Snippet;
|
|
6
6
|
icon?: string | Snippet | Component;
|
|
@@ -11,10 +11,10 @@ export type BannerProps = {
|
|
|
11
11
|
href?: string;
|
|
12
12
|
target?: string;
|
|
13
13
|
ui?: {
|
|
14
|
-
base?:
|
|
15
|
-
icon?:
|
|
16
|
-
description?:
|
|
17
|
-
title?:
|
|
14
|
+
base?: ClassValue;
|
|
15
|
+
icon?: ClassValue;
|
|
16
|
+
description?: ClassValue;
|
|
17
|
+
title?: ClassValue;
|
|
18
18
|
};
|
|
19
19
|
onclose?: () => void | Promise<void>;
|
|
20
20
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
3
|
import { Button, Icon, type ButtonProps } from './index.js';
|
|
5
4
|
import { tv } from 'tailwind-variants';
|
|
6
5
|
import { isSnippet } from '../utilities.svelte.js';
|
|
6
|
+
import { app_icons } from '../contexts.js';
|
|
7
7
|
|
|
8
8
|
export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
|
|
9
9
|
label?: string;
|
|
10
10
|
icon?: string | Component;
|
|
11
11
|
snippet?: string;
|
|
12
|
-
[key: string]:
|
|
12
|
+
[key: string]: unknown;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export type BreadcrumbProps = {
|
|
16
16
|
items: BreadcrumbItem[];
|
|
17
17
|
seperator?: string | Component | Snippet;
|
|
18
18
|
labelkey?: string;
|
|
19
|
-
[key: string]:
|
|
19
|
+
[key: string]: unknown | Snippet<[BreadcrumbItem]>;
|
|
20
20
|
};
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
|
-
<script lang="ts"
|
|
23
|
+
<script lang="ts">
|
|
24
24
|
let {
|
|
25
25
|
items,
|
|
26
26
|
labelkey = 'label',
|
|
27
|
-
seperator =
|
|
27
|
+
seperator = app_icons.get().chevronright,
|
|
28
28
|
...rest
|
|
29
29
|
}: BreadcrumbProps = $props();
|
|
30
30
|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
{/if}
|
|
54
54
|
{:else}
|
|
55
55
|
<Button
|
|
56
|
-
label={item[labelkey]}
|
|
56
|
+
label={item[labelkey] as undefined}
|
|
57
57
|
icon={item.icon}
|
|
58
58
|
href={item.href}
|
|
59
59
|
variant="link"
|
|
@@ -4,35 +4,14 @@ export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
|
|
|
4
4
|
label?: string;
|
|
5
5
|
icon?: string | Component;
|
|
6
6
|
snippet?: string;
|
|
7
|
-
[key: string]:
|
|
7
|
+
[key: string]: unknown;
|
|
8
8
|
};
|
|
9
9
|
export type BreadcrumbProps = {
|
|
10
10
|
items: BreadcrumbItem[];
|
|
11
11
|
seperator?: string | Component | Snippet;
|
|
12
12
|
labelkey?: string;
|
|
13
|
-
[key: string]:
|
|
13
|
+
[key: string]: unknown | Snippet<[BreadcrumbItem]>;
|
|
14
14
|
};
|
|
15
|
-
declare
|
|
16
|
-
|
|
17
|
-
exports: {};
|
|
18
|
-
bindings: "";
|
|
19
|
-
slots: {};
|
|
20
|
-
events: {};
|
|
21
|
-
};
|
|
22
|
-
declare class __sveltets_Render<T extends BreadcrumbItem> {
|
|
23
|
-
props(): ReturnType<typeof $$render<T>>['props'];
|
|
24
|
-
events(): ReturnType<typeof $$render<T>>['events'];
|
|
25
|
-
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
26
|
-
bindings(): "";
|
|
27
|
-
exports(): {};
|
|
28
|
-
}
|
|
29
|
-
interface $$IsomorphicComponent {
|
|
30
|
-
new <T extends BreadcrumbItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
31
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
32
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
33
|
-
<T extends BreadcrumbItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
34
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
35
|
-
}
|
|
36
|
-
declare const Breadcrumb: $$IsomorphicComponent;
|
|
37
|
-
type Breadcrumb<T extends BreadcrumbItem> = InstanceType<typeof Breadcrumb<T>>;
|
|
15
|
+
declare const Breadcrumb: Component<BreadcrumbProps, {}, "">;
|
|
16
|
+
type Breadcrumb = ReturnType<typeof Breadcrumb>;
|
|
38
17
|
export default Breadcrumb;
|