uisv 0.0.12 → 0.0.13

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.
Files changed (75) hide show
  1. package/dist/components/accordion.svelte +108 -0
  2. package/dist/components/accordion.svelte.d.ts +58 -0
  3. package/dist/components/alert.svelte +271 -0
  4. package/dist/components/alert.svelte.d.ts +23 -0
  5. package/dist/components/badge.svelte +225 -0
  6. package/dist/components/badge.svelte.d.ts +19 -0
  7. package/dist/components/banner.svelte +254 -0
  8. package/dist/components/banner.svelte.d.ts +23 -0
  9. package/dist/components/button/button.svelte +105 -0
  10. package/dist/components/button/button.svelte.d.ts +4 -0
  11. package/dist/components/button/index.d.ts +48 -0
  12. package/dist/components/button/index.js +4 -0
  13. package/dist/components/button/style.d.ts +148 -0
  14. package/dist/components/button/style.js +248 -0
  15. package/dist/components/card.svelte +70 -0
  16. package/dist/components/card.svelte.d.ts +17 -0
  17. package/dist/components/checkbox-group.svelte +258 -0
  18. package/dist/components/checkbox-group.svelte.d.ts +26 -0
  19. package/dist/components/checkbox.svelte +175 -0
  20. package/dist/components/checkbox.svelte.d.ts +27 -0
  21. package/dist/components/chip.svelte +82 -0
  22. package/dist/components/chip.svelte.d.ts +17 -0
  23. package/dist/components/color-picker.svelte +48 -0
  24. package/dist/components/color-picker.svelte.d.ts +10 -0
  25. package/dist/components/h1.svelte +15 -0
  26. package/dist/components/h1.svelte.d.ts +3 -0
  27. package/dist/components/h2.svelte +19 -0
  28. package/dist/components/h2.svelte.d.ts +3 -0
  29. package/dist/components/h3.svelte +16 -0
  30. package/dist/components/h3.svelte.d.ts +3 -0
  31. package/dist/components/h4.svelte +19 -0
  32. package/dist/components/h4.svelte.d.ts +3 -0
  33. package/dist/components/h5.svelte +19 -0
  34. package/dist/components/h5.svelte.d.ts +3 -0
  35. package/dist/components/h6.svelte +19 -0
  36. package/dist/components/h6.svelte.d.ts +3 -0
  37. package/dist/components/index.d.ts +42 -0
  38. package/dist/components/index.js +42 -0
  39. package/dist/components/input/index.d.ts +54 -0
  40. package/dist/components/input/index.js +2 -0
  41. package/dist/components/input/input.svelte +103 -0
  42. package/dist/components/input/input.svelte.d.ts +4 -0
  43. package/dist/components/input/style.d.ts +316 -0
  44. package/dist/components/input/style.js +128 -0
  45. package/dist/components/input-time/index.d.ts +375 -0
  46. package/dist/components/input-time/index.js +144 -0
  47. package/dist/components/input-time/input-time.svelte +39 -0
  48. package/dist/components/input-time/input-time.svelte.d.ts +4 -0
  49. package/dist/components/kbd.svelte +239 -0
  50. package/dist/components/kbd.svelte.d.ts +40 -0
  51. package/dist/components/p.svelte +9 -0
  52. package/dist/components/p.svelte.d.ts +3 -0
  53. package/dist/components/pin-input.svelte +162 -0
  54. package/dist/components/pin-input.svelte.d.ts +25 -0
  55. package/dist/components/placeholder.svelte +34 -0
  56. package/dist/components/placeholder.svelte.d.ts +3 -0
  57. package/dist/components/popover.svelte +151 -0
  58. package/dist/components/popover.svelte.d.ts +88 -0
  59. package/dist/components/progress.svelte +124 -0
  60. package/dist/components/progress.svelte.d.ts +21 -0
  61. package/dist/components/select.svelte +171 -0
  62. package/dist/components/select.svelte.d.ts +50 -0
  63. package/dist/components/slider.svelte +172 -0
  64. package/dist/components/slider.svelte.d.ts +44 -0
  65. package/dist/components/switch.svelte +180 -0
  66. package/dist/components/switch.svelte.d.ts +27 -0
  67. package/dist/components/tabs.svelte +246 -0
  68. package/dist/components/tabs.svelte.d.ts +34 -0
  69. package/dist/index.d.ts +4 -0
  70. package/dist/index.js +3 -0
  71. package/dist/utilities.svelte.d.ts +24 -0
  72. package/dist/utilities.svelte.js +47 -0
  73. package/dist/vite.d.ts +51 -0
  74. package/dist/vite.js +157 -0
  75. package/package.json +2 -2
@@ -0,0 +1,108 @@
1
+ <script module lang="ts">
2
+ import { Accordion } from 'bits-ui';
3
+ import type { Component, Snippet } from 'svelte';
4
+ import type { ClassNameValue } from 'tailwind-merge';
5
+ import { tv } from 'tailwind-variants';
6
+
7
+ export type AccordionItem = {
8
+ label: string;
9
+ icon?: string | Snippet | Component;
10
+ trailingicon?: string | Snippet | Component;
11
+ content: string;
12
+ value?: string;
13
+ disabled?: boolean;
14
+ };
15
+ export type AccordionProps = {
16
+ value?: string | string[];
17
+ items: AccordionItem[];
18
+ collapsible?: boolean;
19
+ disabled?: boolean;
20
+ type?: 'single' | 'multiple';
21
+ trailingicon?: string | Snippet | Component;
22
+ leading?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
23
+ default?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
24
+ trailing?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
25
+ content?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
26
+ body?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
27
+ ui?: {
28
+ root?: ClassNameValue;
29
+ item?: ClassNameValue;
30
+ header?: ClassNameValue;
31
+ trigger?: ClassNameValue;
32
+ content?: ClassNameValue;
33
+ body?: ClassNameValue;
34
+ leadingicon?: ClassNameValue;
35
+ trailingicon?: ClassNameValue;
36
+ label?: ClassNameValue;
37
+ };
38
+ };
39
+ </script>
40
+
41
+ <script lang="ts">
42
+ let {
43
+ value = $bindable(),
44
+ items,
45
+ collapsible = true,
46
+ disabled,
47
+ type = 'single',
48
+ trailingicon = 'i-lucide-baret-down',
49
+ leading,
50
+ default: defau,
51
+ trailing,
52
+ content,
53
+ body,
54
+ ui = {}
55
+ }: AccordionProps = $props();
56
+ const classes = $derived(
57
+ tv({
58
+ slots: {
59
+ root: 'w-full',
60
+ item: 'border-b border-default last:border-b-0',
61
+ header: 'flex',
62
+ trigger:
63
+ 'group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-primary min-w-0',
64
+ content:
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
+ body: 'text-sm pb-3.5',
67
+ leadingIcon: 'shrink-0 size-5',
68
+ trailingIcon:
69
+ 'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
70
+ label: 'text-start break-words'
71
+ },
72
+ variants: {
73
+ disabled: {
74
+ true: {
75
+ trigger: 'cursor-not-allowed opacity-75'
76
+ }
77
+ }
78
+ }
79
+ })({
80
+ disabled
81
+ })
82
+ );
83
+ </script>
84
+
85
+ <Accordion.Root
86
+ class={classes.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
+ >
100
+ {#each items as item, idx (idx)}
101
+ <Accordion.Item value="item-1">
102
+ <Accordion.Header>
103
+ <Accordion.Trigger>{item.label}</Accordion.Trigger>
104
+ </Accordion.Header>
105
+ <Accordion.Content>This is the collapsible content for this section.</Accordion.Content>
106
+ </Accordion.Item>
107
+ {/each}
108
+ </Accordion.Root>
@@ -0,0 +1,58 @@
1
+ import { Accordion } from 'bits-ui';
2
+ import type { Component, Snippet } from 'svelte';
3
+ import type { ClassNameValue } from 'tailwind-merge';
4
+ export type AccordionItem = {
5
+ label: string;
6
+ icon?: string | Snippet | Component;
7
+ trailingicon?: string | Snippet | Component;
8
+ content: string;
9
+ value?: string;
10
+ disabled?: boolean;
11
+ };
12
+ export type AccordionProps = {
13
+ value?: string | string[];
14
+ items: AccordionItem[];
15
+ collapsible?: boolean;
16
+ disabled?: boolean;
17
+ type?: 'single' | 'multiple';
18
+ trailingicon?: string | Snippet | Component;
19
+ leading?: Snippet<[{
20
+ item: AccordionItem;
21
+ index: number;
22
+ open: boolean;
23
+ }]>;
24
+ default?: Snippet<[{
25
+ item: AccordionItem;
26
+ index: number;
27
+ open: boolean;
28
+ }]>;
29
+ trailing?: Snippet<[{
30
+ item: AccordionItem;
31
+ index: number;
32
+ open: boolean;
33
+ }]>;
34
+ content?: Snippet<[{
35
+ item: AccordionItem;
36
+ index: number;
37
+ open: boolean;
38
+ }]>;
39
+ body?: Snippet<[{
40
+ item: AccordionItem;
41
+ index: number;
42
+ open: boolean;
43
+ }]>;
44
+ ui?: {
45
+ root?: ClassNameValue;
46
+ item?: ClassNameValue;
47
+ header?: ClassNameValue;
48
+ trigger?: ClassNameValue;
49
+ content?: ClassNameValue;
50
+ body?: ClassNameValue;
51
+ leadingicon?: ClassNameValue;
52
+ trailingicon?: ClassNameValue;
53
+ label?: ClassNameValue;
54
+ };
55
+ };
56
+ declare const Accordion: Component<AccordionProps, {}, "value">;
57
+ type Accordion = ReturnType<typeof Accordion>;
58
+ export default Accordion;
@@ -0,0 +1,271 @@
1
+ <script module lang="ts">
2
+ import { type PropColor, isSnippet, type ButtonProps, Button } from '../index.js';
3
+ import type { Component, Snippet } from 'svelte';
4
+ import type { ClassNameValue } from 'tailwind-merge';
5
+ import { tv } from 'tailwind-variants';
6
+ import { defu } from 'defu';
7
+
8
+ export type AlertProps = {
9
+ title?: string | Snippet;
10
+ description?: string | Snippet;
11
+ icon?: string | Snippet | Component;
12
+ color?: PropColor;
13
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
14
+ position?: 'bottom' | 'right';
15
+ actions?: ButtonProps[];
16
+ close?: boolean | ButtonProps;
17
+ ui?: {
18
+ base?: ClassNameValue;
19
+ icon?: ClassNameValue;
20
+ description?: ClassNameValue;
21
+ title?: ClassNameValue;
22
+ };
23
+ onclose?: () => void | Promise<void>;
24
+ };
25
+ </script>
26
+
27
+ <script lang="ts">
28
+ let {
29
+ title,
30
+ description,
31
+ close,
32
+ icon,
33
+ actions = [],
34
+ color = 'primary',
35
+ variant = 'solid',
36
+ position = 'bottom',
37
+ ui = {},
38
+ onclose = () => {},
39
+ }: AlertProps = $props();
40
+
41
+ const close_props = $derived.by(() => {
42
+ return defu(typeof close === 'boolean' ? {} : close, {
43
+ icon: 'i-lucide-x',
44
+ variant: 'link',
45
+ color: variant === 'solid' ? 'surface' : color,
46
+ ui: {
47
+ icon: variant === 'solid' ? 'text-white' : '',
48
+ },
49
+ } as ButtonProps);
50
+ });
51
+ const classes = $derived.by(() =>
52
+ tv({
53
+ slots: {
54
+ base: 'flex gap-2 font-sans p-4 rounded-lg',
55
+ icon: 'pi size-6',
56
+ actions: '',
57
+ description: 'text-opacity-50 text-sm',
58
+ title: 'font-medium',
59
+ },
60
+ variants: {
61
+ color: {
62
+ primary: '',
63
+ surface: '',
64
+ info: '',
65
+ success: '',
66
+ warning: '',
67
+ error: '',
68
+ },
69
+ variant: {
70
+ solid: {
71
+ base: 'text-white',
72
+ description: 'text-white/90',
73
+ },
74
+ outline: 'border',
75
+ soft: '',
76
+ subtle: 'border',
77
+ },
78
+ position: {
79
+ right: {
80
+ base: '',
81
+ },
82
+ bottom: {
83
+ base: 'flex-col',
84
+ },
85
+ },
86
+ },
87
+ compoundVariants: [
88
+ {
89
+ variant: 'solid',
90
+ color: 'primary',
91
+ class: 'bg-primary-500',
92
+ },
93
+ {
94
+ variant: 'solid',
95
+ color: 'surface',
96
+ class: 'bg-surface-900',
97
+ },
98
+ {
99
+ variant: 'solid',
100
+ color: 'info',
101
+ class: 'bg-info-500',
102
+ },
103
+ {
104
+ variant: 'solid',
105
+ color: 'success',
106
+ class: 'bg-success-500',
107
+ },
108
+ {
109
+ variant: 'solid',
110
+ color: 'warning',
111
+ class: 'bg-warning-500',
112
+ },
113
+ {
114
+ variant: 'solid',
115
+ color: 'error',
116
+ class: 'bg-error-500',
117
+ },
118
+
119
+ {
120
+ variant: 'outline',
121
+ color: 'primary',
122
+ class: 'border-primary-300 text-primary-500',
123
+ },
124
+ {
125
+ variant: 'outline',
126
+ color: 'surface',
127
+ class: 'border-surface-300 text-surface-900',
128
+ },
129
+ {
130
+ variant: 'outline',
131
+ color: 'info',
132
+ class: 'border-info-300 text-info-500',
133
+ },
134
+ {
135
+ variant: 'outline',
136
+ color: 'success',
137
+ class: 'border-success-300 text-success-500',
138
+ },
139
+ {
140
+ variant: 'outline',
141
+ color: 'warning',
142
+ class: 'border-warning-300 text-warning-500',
143
+ },
144
+ {
145
+ variant: 'outline',
146
+ color: 'error',
147
+ class: 'border-error-300 text-error-500',
148
+ },
149
+
150
+ {
151
+ variant: 'soft',
152
+ color: 'primary',
153
+ class: 'bg-primary-100 text-primary-500',
154
+ },
155
+ {
156
+ variant: 'soft',
157
+ color: 'surface',
158
+ class: 'bg-surface-50 text-surface-900',
159
+ },
160
+ {
161
+ variant: 'soft',
162
+ color: 'info',
163
+ class: 'bg-info-50 text-info-500',
164
+ },
165
+ {
166
+ variant: 'soft',
167
+ color: 'success',
168
+ class: 'bg-success-50 text-success-500',
169
+ },
170
+ {
171
+ variant: 'soft',
172
+ color: 'warning',
173
+ class: 'bg-warning-50 text-warning-500',
174
+ },
175
+ {
176
+ variant: 'soft',
177
+ color: 'error',
178
+ class: 'bg-error-50 text-error-500',
179
+ },
180
+
181
+ {
182
+ variant: 'subtle',
183
+ color: 'primary',
184
+ class: 'bg-primary-100 text-primary-500 border-primary-300',
185
+ },
186
+ {
187
+ variant: 'subtle',
188
+ color: 'surface',
189
+ class: 'bg-surface-50 text-surface-900 border-surface-300',
190
+ },
191
+ {
192
+ variant: 'subtle',
193
+ color: 'info',
194
+ class: 'bg-info-50 text-info-500 border-info-300',
195
+ },
196
+ {
197
+ variant: 'subtle',
198
+ color: 'success',
199
+ class: 'bg-success-50 text-success-500 border-success-300',
200
+ },
201
+ {
202
+ variant: 'subtle',
203
+ color: 'warning',
204
+ class: 'bg-warning-50 text-warning-500 border-warning-300',
205
+ },
206
+ {
207
+ variant: 'subtle',
208
+ color: 'error',
209
+ class: 'bg-error-50 text-error-500 border-error-300',
210
+ },
211
+ ],
212
+ })({ color, variant, position }),
213
+ );
214
+ </script>
215
+
216
+ <div class={classes.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
217
+ <div class="flex gap-2 flex-grow">
218
+ {#if icon}
219
+ <div class="size-6">
220
+ {#if typeof icon === 'string'}
221
+ <div class={classes.icon({ class: [icon] })}></div>
222
+ {:else if isSnippet(icon)}
223
+ {@render icon()}
224
+ {:else}
225
+ {@const Icon = icon}
226
+ <Icon />
227
+ {/if}
228
+ </div>
229
+ {/if}
230
+
231
+ <div class="space-y-1 flex-grow">
232
+ {#if title}
233
+ <div class={classes.title({ class: [ui.title] })}>
234
+ {#if isSnippet(title)}
235
+ {@render title()}
236
+ {:else}
237
+ {title}
238
+ {/if}
239
+ </div>
240
+ {/if}
241
+
242
+ {#if description}
243
+ <div class={classes.description({ class: [ui.title] })}>
244
+ {#if isSnippet(description)}
245
+ {@render description()}
246
+ {:else}
247
+ {description}
248
+ {/if}
249
+ </div>
250
+ {/if}
251
+ </div>
252
+
253
+ {#if close}
254
+ <div>
255
+ <Button {...close_props} onclick={onclose} />
256
+ </div>
257
+ {/if}
258
+ </div>
259
+
260
+ {#if actions.length > 0}
261
+ <div class="flex gap-2 items-center pl-8">
262
+ {#each actions as action (action.label)}
263
+ <Button
264
+ {...defu(action, {
265
+ size: 'xs',
266
+ } as ButtonProps)}
267
+ />
268
+ {/each}
269
+ </div>
270
+ {/if}
271
+ </div>
@@ -0,0 +1,23 @@
1
+ import { type PropColor, type ButtonProps } from '../index.js';
2
+ import type { Component, Snippet } from 'svelte';
3
+ import type { ClassNameValue } from 'tailwind-merge';
4
+ export type AlertProps = {
5
+ title?: string | Snippet;
6
+ description?: string | Snippet;
7
+ icon?: string | Snippet | Component;
8
+ color?: PropColor;
9
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
10
+ position?: 'bottom' | 'right';
11
+ actions?: ButtonProps[];
12
+ close?: boolean | ButtonProps;
13
+ ui?: {
14
+ base?: ClassNameValue;
15
+ icon?: ClassNameValue;
16
+ description?: ClassNameValue;
17
+ title?: ClassNameValue;
18
+ };
19
+ onclose?: () => void | Promise<void>;
20
+ };
21
+ declare const Alert: Component<AlertProps, {}, "">;
22
+ type Alert = ReturnType<typeof Alert>;
23
+ export default Alert;
@@ -0,0 +1,225 @@
1
+ <script lang="ts" module>
2
+ import type { Component, Snippet } from 'svelte';
3
+ import { tv } from 'tailwind-variants';
4
+ import { type PropColor, isSnippet } from '../index.js';
5
+ import type { ClassNameValue } from 'tailwind-merge';
6
+
7
+ export type BadgeProps = {
8
+ label?: string;
9
+ color?: PropColor;
10
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
11
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
+ icon?: string | Snippet | Component;
13
+ trailingicon?: boolean;
14
+ children?: Snippet;
15
+ ui?: {
16
+ base?: ClassNameValue;
17
+ icon?: ClassNameValue;
18
+ };
19
+ };
20
+ </script>
21
+
22
+ <script lang="ts">
23
+ let {
24
+ icon,
25
+ label,
26
+ trailingicon,
27
+ color = 'primary',
28
+ size = 'md',
29
+ variant = 'solid',
30
+ ui = {},
31
+ children,
32
+ }: BadgeProps = $props();
33
+
34
+ const classes = $derived.by(() => {
35
+ return tv({
36
+ slots: { icon: '', base: 'flex-inline items-center font-sans' },
37
+ variants: {
38
+ color: {
39
+ primary: '',
40
+ surface: '',
41
+ error: '',
42
+ success: '',
43
+ info: '',
44
+ warning: '',
45
+ },
46
+ variant: {
47
+ link: '',
48
+ solid: 'text-white',
49
+ outline: 'border',
50
+ soft: '',
51
+ subtle: 'border',
52
+ ghost: '',
53
+ },
54
+ size: {
55
+ xs: {
56
+ base: 'font-medium text-[0.5rem] px-1 h-4 rounded gap-1',
57
+ icon: 'size-3',
58
+ },
59
+ sm: { base: 'font-medium text-[0.625rem] px-1 h-5 rounded gap-1', icon: 'size-3' },
60
+ md: { base: 'font-medium text-xs rounded-md px-2 h-6 gap-2', icon: 'size-4' },
61
+ lg: { base: 'font-medium text-sm px-2 h-7 rounded-md gap-2', icon: 'size-5' },
62
+ xl: { base: 'font-medium px-3 h-8 rounded-md gap-2', icon: 'size-5' },
63
+ },
64
+ },
65
+ compoundVariants: [
66
+ {
67
+ color: 'primary',
68
+ variant: 'solid',
69
+ class: 'bg-primary-400',
70
+ },
71
+ {
72
+ color: 'surface',
73
+ variant: 'solid',
74
+ class: 'bg-surface-900',
75
+ },
76
+ {
77
+ color: 'info',
78
+ variant: 'solid',
79
+ class: 'bg-blue-500',
80
+ },
81
+ {
82
+ color: 'success',
83
+ variant: 'solid',
84
+ class: 'bg-green-500',
85
+ },
86
+ {
87
+ color: 'error',
88
+ variant: 'solid',
89
+ class: 'bg-red-500',
90
+ },
91
+ {
92
+ color: 'warning',
93
+ variant: 'solid',
94
+ class: 'bg-yellow-500',
95
+ },
96
+
97
+ {
98
+ color: 'primary',
99
+ variant: 'outline',
100
+ class: 'border-primary-300 text-primary-400',
101
+ },
102
+ {
103
+ color: 'surface',
104
+ variant: 'outline',
105
+ class: 'border-surface-300 text-surface-900',
106
+ },
107
+ {
108
+ color: 'info',
109
+ variant: 'outline',
110
+ class: 'border-blue-300 text-blue-500',
111
+ },
112
+ {
113
+ color: 'success',
114
+ variant: 'outline',
115
+ class: 'border-green-300 text-green-500',
116
+ },
117
+ {
118
+ color: 'error',
119
+ variant: 'outline',
120
+ class: 'border-red-300 text-red-500',
121
+ },
122
+ {
123
+ color: 'warning',
124
+ variant: 'outline',
125
+ class: 'border-yellow-300 text-yellow-500',
126
+ },
127
+
128
+ {
129
+ color: 'primary',
130
+ variant: 'soft',
131
+ class: ' bg-primary-50 text-primary-500',
132
+ },
133
+ {
134
+ color: 'surface',
135
+ variant: 'soft',
136
+ class: 'bg-surface-100 text-surface-800',
137
+ },
138
+ {
139
+ color: 'info',
140
+ variant: 'soft',
141
+ class: 'bg-blue-100 text-blue-500',
142
+ },
143
+ {
144
+ color: 'success',
145
+ variant: 'soft',
146
+ class: 'bg-green-100 text-green-500',
147
+ },
148
+ {
149
+ color: 'error',
150
+ variant: 'soft',
151
+ class: 'bg-red-100 text-red-500',
152
+ },
153
+ {
154
+ color: 'warning',
155
+ variant: 'soft',
156
+ class: 'bg-yellow-100 text-yellow-500 ',
157
+ },
158
+
159
+ {
160
+ color: 'primary',
161
+ variant: 'subtle',
162
+ class: 'bg-primary-50 text-primary-500 border-primary-200 ',
163
+ },
164
+ {
165
+ color: 'surface',
166
+ variant: 'subtle',
167
+ class: 'bg-surface-100 text-surface-800 border-surface-300 ',
168
+ },
169
+ {
170
+ color: 'info',
171
+ variant: 'subtle',
172
+ class: 'bg-blue-50 text-blue-600 border-blue-200',
173
+ },
174
+ {
175
+ color: 'success',
176
+ variant: 'subtle',
177
+ class: 'bg-green-100 text-green-600 border-green-300',
178
+ },
179
+ {
180
+ color: 'error',
181
+ variant: 'subtle',
182
+ class: 'bg-red-50 text-red-600 border-red-200',
183
+ },
184
+ {
185
+ color: 'warning',
186
+ variant: 'subtle',
187
+ class: 'bg-yellow-50 text-yellow-600 border-yellow-300',
188
+ },
189
+ ],
190
+ })({ variant, size, color });
191
+ });
192
+ </script>
193
+
194
+ <span
195
+ class={classes.base({
196
+ class: [icon && !(children || label) ? 'px-0 aspect-square justify-center' : '', ui.base],
197
+ })}
198
+ >
199
+ {#if !trailingicon}
200
+ {@render Icon()}
201
+ {/if}
202
+
203
+ {#if label}
204
+ {label}
205
+ {:else}
206
+ {@render children?.()}
207
+ {/if}
208
+
209
+ {#if trailingicon}
210
+ {@render Icon()}
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)}
219
+ {@render icon()}
220
+ {:else}
221
+ {@const Icon = icon}
222
+ <Icon />
223
+ {/if}
224
+ {/if}
225
+ {/snippet}
@@ -0,0 +1,19 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+ import { type PropColor } from '../index.js';
3
+ import type { ClassNameValue } from 'tailwind-merge';
4
+ export type BadgeProps = {
5
+ label?: string;
6
+ color?: PropColor;
7
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
8
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ icon?: string | Snippet | Component;
10
+ trailingicon?: boolean;
11
+ children?: Snippet;
12
+ ui?: {
13
+ base?: ClassNameValue;
14
+ icon?: ClassNameValue;
15
+ };
16
+ };
17
+ declare const Badge: Component<BadgeProps, {}, "">;
18
+ type Badge = ReturnType<typeof Badge>;
19
+ export default Badge;