uisv 0.0.20 → 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 +33 -38
- package/dist/components/badge.svelte.d.ts +3 -3
- package/dist/components/banner.svelte +47 -55
- 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 -48
- package/dist/components/button.svelte.d.ts +12 -12
- package/dist/components/calendar.svelte +6 -7
- package/dist/components/calendar.svelte.d.ts +3 -3
- package/dist/components/card.svelte +14 -15
- 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 +21 -22
- 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/icon.svelte +0 -2
- 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.d.ts +2 -1
- package/dist/vite.js +32 -37
- 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-
|
|
74
|
+
class: 'bg-surface-inverted text-label-inverted',
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
color: 'info',
|
|
@@ -97,94 +97,94 @@
|
|
|
97
97
|
{
|
|
98
98
|
color: 'primary',
|
|
99
99
|
variant: 'outline',
|
|
100
|
-
class: 'border-primary
|
|
100
|
+
class: 'border-primary/50 text-primary',
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
color: 'surface',
|
|
104
104
|
variant: 'outline',
|
|
105
|
-
class: 'border-surface-
|
|
105
|
+
class: 'border-surface-accented text-label-highlighted',
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
color: 'info',
|
|
109
109
|
variant: 'outline',
|
|
110
|
-
class: 'border-info
|
|
110
|
+
class: 'border-info/50 text-info',
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
color: 'success',
|
|
114
114
|
variant: 'outline',
|
|
115
|
-
class: 'border-green
|
|
115
|
+
class: 'border-green/50 text-success',
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
color: 'error',
|
|
119
119
|
variant: 'outline',
|
|
120
|
-
class: 'border-error
|
|
120
|
+
class: 'border-error/50 text-error',
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
color: 'warning',
|
|
124
124
|
variant: 'outline',
|
|
125
|
-
class: 'border-warning
|
|
125
|
+
class: 'border-warning/50 text-warning',
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
{
|
|
129
129
|
color: 'primary',
|
|
130
130
|
variant: 'soft',
|
|
131
|
-
class: ' bg-primary
|
|
131
|
+
class: ' bg-primary/10 text-primary-500',
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
color: 'surface',
|
|
135
135
|
variant: 'soft',
|
|
136
|
-
class: 'bg-surface
|
|
136
|
+
class: 'bg-surface/10 text-label-highlighted',
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
color: 'info',
|
|
140
140
|
variant: 'soft',
|
|
141
|
-
class: 'bg-info
|
|
141
|
+
class: 'bg-info/10 text-info-500',
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
color: 'success',
|
|
145
145
|
variant: 'soft',
|
|
146
|
-
class: 'bg-success
|
|
146
|
+
class: 'bg-success/10 text-success-500',
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
color: 'error',
|
|
150
150
|
variant: 'soft',
|
|
151
|
-
class: 'bg-error
|
|
151
|
+
class: 'bg-error/10 text-error-500',
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
color: 'warning',
|
|
155
155
|
variant: 'soft',
|
|
156
|
-
class: 'bg-warning
|
|
156
|
+
class: 'bg-warning/10 text-warning-500 ',
|
|
157
157
|
},
|
|
158
158
|
|
|
159
159
|
{
|
|
160
160
|
color: 'primary',
|
|
161
161
|
variant: 'subtle',
|
|
162
|
-
class: 'bg-primary
|
|
162
|
+
class: 'bg-primary/10 text-primary-500 border-primary/20',
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
color: 'surface',
|
|
166
166
|
variant: 'subtle',
|
|
167
|
-
class: 'bg-surface
|
|
167
|
+
class: 'bg-surface/10 text-label-highlighted border-surface/20 ',
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
color: 'info',
|
|
171
171
|
variant: 'subtle',
|
|
172
|
-
class: 'bg-info
|
|
172
|
+
class: 'bg-info/10 text-info-600 border-info/20',
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
color: 'success',
|
|
176
176
|
variant: 'subtle',
|
|
177
|
-
class: 'bg-success
|
|
177
|
+
class: 'bg-success/10 text-success-600 border-success/20',
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
color: 'error',
|
|
181
181
|
variant: 'subtle',
|
|
182
|
-
class: 'bg-error
|
|
182
|
+
class: 'bg-error/10 text-error-600 border-error/20',
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
color: 'warning',
|
|
186
186
|
variant: 'subtle',
|
|
187
|
-
class: 'bg-warning
|
|
187
|
+
class: 'bg-warning/10 text-warning-600 border-warning/20',
|
|
188
188
|
},
|
|
189
189
|
],
|
|
190
190
|
})({ variant, size, color });
|
|
@@ -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, {}, "">;
|