uisv 0.0.2 → 0.0.3
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/package.json +11 -3
- package/dist/components/alert.svelte +0 -274
- package/dist/components/alert.svelte.d.ts +0 -24
- package/dist/components/badge.svelte +0 -227
- package/dist/components/badge.svelte.d.ts +0 -19
- package/dist/components/banner.svelte +0 -257
- package/dist/components/banner.svelte.d.ts +0 -24
- package/dist/components/button.svelte +0 -380
- package/dist/components/button.svelte.d.ts +0 -50
- package/dist/components/card.svelte +0 -70
- package/dist/components/card.svelte.d.ts +0 -17
- package/dist/components/chip.svelte +0 -82
- package/dist/components/chip.svelte.d.ts +0 -17
- package/dist/components/index.d.ts +0 -16
- package/dist/components/index.js +0 -16
- package/dist/components/placeholder.svelte +0 -32
- package/dist/components/placeholder.svelte.d.ts +0 -7
- package/dist/components/progress.svelte +0 -124
- package/dist/components/progress.svelte.d.ts +0 -21
- package/dist/components/switch.svelte +0 -180
- package/dist/components/switch.svelte.d.ts +0 -27
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -1
- package/dist/utils/common.d.ts +0 -14
- package/dist/utils/common.js +0 -18
- package/dist/utils/keys.d.ts +0 -8
- package/dist/utils/keys.js +0 -8
- package/dist/utils/types.d.ts +0 -1
- package/dist/utils/types.js +0 -1
- package/dist/vite.d.ts +0 -38
- package/dist/vite.js +0 -85
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uisv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "ui library for the rest of us",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "ui-sv/uisv",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build": "vite build && npm run prepack",
|
|
11
11
|
"preview": "vite preview",
|
|
12
12
|
"prepare": "svelte-kit sync || echo ''",
|
|
13
|
-
"prepack": "
|
|
13
|
+
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
14
14
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
15
15
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
16
16
|
"format": "prettier --write .",
|
|
@@ -53,14 +53,17 @@
|
|
|
53
53
|
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
54
54
|
"@tailwindcss/vite": "^4.1.13",
|
|
55
55
|
"@types/node": "^22",
|
|
56
|
+
"@unocss/preset-web-fonts": "^66.5.2",
|
|
56
57
|
"@unocss/reset": "^66.5.1",
|
|
57
58
|
"@vitest/browser": "^3.2.3",
|
|
58
59
|
"bits-ui": "^2.11.0",
|
|
60
|
+
"carta-md": "^4.11.1",
|
|
59
61
|
"defu": "^6.1.4",
|
|
60
62
|
"eslint": "^9.22.0",
|
|
61
63
|
"eslint-config-prettier": "^10.0.1",
|
|
62
64
|
"eslint-plugin-svelte": "^3.0.0",
|
|
63
65
|
"globals": "^16.0.0",
|
|
66
|
+
"mdsvex": "^0.12.3",
|
|
64
67
|
"playwright": "^1.53.0",
|
|
65
68
|
"prettier": "^3.4.2",
|
|
66
69
|
"prettier-plugin-svelte": "^3.3.3",
|
|
@@ -82,5 +85,10 @@
|
|
|
82
85
|
},
|
|
83
86
|
"keywords": [
|
|
84
87
|
"svelte"
|
|
85
|
-
]
|
|
88
|
+
],
|
|
89
|
+
"pnpm": {
|
|
90
|
+
"onlyBuiltDependencies": [
|
|
91
|
+
"esbuild"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
86
94
|
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { PropColor } from '../types.js';
|
|
3
|
-
import type { Component, Snippet } from 'svelte';
|
|
4
|
-
import type { ButtonProps } from './button.svelte';
|
|
5
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
|
-
import { tv } from 'tailwind-variants';
|
|
7
|
-
import { isSnippet } from '../utils/common.js';
|
|
8
|
-
import { defu } from 'defu';
|
|
9
|
-
import Button from './button.svelte';
|
|
10
|
-
|
|
11
|
-
export type AlertProps = {
|
|
12
|
-
title?: string | Snippet;
|
|
13
|
-
description?: string | Snippet;
|
|
14
|
-
icon?: string | Snippet | Component;
|
|
15
|
-
color?: PropColor;
|
|
16
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
17
|
-
position?: 'bottom' | 'right';
|
|
18
|
-
actions?: ButtonProps[];
|
|
19
|
-
close?: boolean | ButtonProps;
|
|
20
|
-
ui?: {
|
|
21
|
-
base?: ClassNameValue;
|
|
22
|
-
icon?: ClassNameValue;
|
|
23
|
-
description?: ClassNameValue;
|
|
24
|
-
title?: ClassNameValue;
|
|
25
|
-
};
|
|
26
|
-
onclose?: () => void | Promise<void>;
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
let {
|
|
32
|
-
title,
|
|
33
|
-
description,
|
|
34
|
-
close,
|
|
35
|
-
icon,
|
|
36
|
-
actions = [],
|
|
37
|
-
color = 'primary',
|
|
38
|
-
variant = 'solid',
|
|
39
|
-
position = 'bottom',
|
|
40
|
-
ui = {},
|
|
41
|
-
onclose = () => {}
|
|
42
|
-
}: AlertProps = $props();
|
|
43
|
-
|
|
44
|
-
const close_props = $derived.by(() => {
|
|
45
|
-
return defu(typeof close === 'boolean' ? {} : close, {
|
|
46
|
-
icon: 'i-lucide-x',
|
|
47
|
-
variant: 'link',
|
|
48
|
-
color: variant === 'solid' ? 'secondary' : color,
|
|
49
|
-
ui: {
|
|
50
|
-
icon: variant === 'solid' ? 'text-white' : ''
|
|
51
|
-
}
|
|
52
|
-
} as ButtonProps);
|
|
53
|
-
});
|
|
54
|
-
const classes = $derived.by(() =>
|
|
55
|
-
tv({
|
|
56
|
-
slots: {
|
|
57
|
-
base: 'flex gap-2 font-sans p-4 rounded-lg',
|
|
58
|
-
icon: 'pi size-6',
|
|
59
|
-
actions: '',
|
|
60
|
-
description: 'text-opacity-50 text-sm',
|
|
61
|
-
title: 'font-medium'
|
|
62
|
-
},
|
|
63
|
-
variants: {
|
|
64
|
-
color: {
|
|
65
|
-
primary: '',
|
|
66
|
-
secondary: '',
|
|
67
|
-
info: '',
|
|
68
|
-
success: '',
|
|
69
|
-
warning: '',
|
|
70
|
-
error: ''
|
|
71
|
-
},
|
|
72
|
-
variant: {
|
|
73
|
-
solid: {
|
|
74
|
-
base: 'text-white',
|
|
75
|
-
description: 'text-white/90'
|
|
76
|
-
},
|
|
77
|
-
outline: 'border',
|
|
78
|
-
soft: '',
|
|
79
|
-
subtle: 'border'
|
|
80
|
-
},
|
|
81
|
-
position: {
|
|
82
|
-
right: {
|
|
83
|
-
base: ''
|
|
84
|
-
},
|
|
85
|
-
bottom: {
|
|
86
|
-
base: 'flex-col'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
compoundVariants: [
|
|
91
|
-
{
|
|
92
|
-
variant: 'solid',
|
|
93
|
-
color: 'primary',
|
|
94
|
-
class: 'bg-primary-500'
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
variant: 'solid',
|
|
98
|
-
color: 'secondary',
|
|
99
|
-
class: 'bg-secondary-900'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
variant: 'solid',
|
|
103
|
-
color: 'info',
|
|
104
|
-
class: 'bg-info-500'
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
variant: 'solid',
|
|
108
|
-
color: 'success',
|
|
109
|
-
class: 'bg-success-500'
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
variant: 'solid',
|
|
113
|
-
color: 'warning',
|
|
114
|
-
class: 'bg-warning-500'
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
variant: 'solid',
|
|
118
|
-
color: 'error',
|
|
119
|
-
class: 'bg-error-500'
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
variant: 'outline',
|
|
124
|
-
color: 'primary',
|
|
125
|
-
class: 'border-primary-300 text-primary-500'
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
variant: 'outline',
|
|
129
|
-
color: 'secondary',
|
|
130
|
-
class: 'border-secondary-300 text-secondary-900'
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
variant: 'outline',
|
|
134
|
-
color: 'info',
|
|
135
|
-
class: 'border-info-300 text-info-500'
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
variant: 'outline',
|
|
139
|
-
color: 'success',
|
|
140
|
-
class: 'border-success-300 text-success-500'
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
variant: 'outline',
|
|
144
|
-
color: 'warning',
|
|
145
|
-
class: 'border-warning-300 text-warning-500'
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
variant: 'outline',
|
|
149
|
-
color: 'error',
|
|
150
|
-
class: 'border-error-300 text-error-500'
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
variant: 'soft',
|
|
155
|
-
color: 'primary',
|
|
156
|
-
class: 'bg-primary-100 text-primary-500'
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
variant: 'soft',
|
|
160
|
-
color: 'secondary',
|
|
161
|
-
class: 'bg-secondary-50 text-secondary-900'
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
variant: 'soft',
|
|
165
|
-
color: 'info',
|
|
166
|
-
class: 'bg-info-50 text-info-500'
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
variant: 'soft',
|
|
170
|
-
color: 'success',
|
|
171
|
-
class: 'bg-success-50 text-success-500'
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
variant: 'soft',
|
|
175
|
-
color: 'warning',
|
|
176
|
-
class: 'bg-warning-50 text-warning-500'
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
variant: 'soft',
|
|
180
|
-
color: 'error',
|
|
181
|
-
class: 'bg-error-50 text-error-500'
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
{
|
|
185
|
-
variant: 'subtle',
|
|
186
|
-
color: 'primary',
|
|
187
|
-
class: 'bg-primary-100 text-primary-500 border-primary-300'
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
variant: 'subtle',
|
|
191
|
-
color: 'secondary',
|
|
192
|
-
class: 'bg-secondary-50 text-secondary-900 border-secondary-300'
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
variant: 'subtle',
|
|
196
|
-
color: 'info',
|
|
197
|
-
class: 'bg-info-50 text-info-500 border-info-300'
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
variant: 'subtle',
|
|
201
|
-
color: 'success',
|
|
202
|
-
class: 'bg-success-50 text-success-500 border-success-300'
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
variant: 'subtle',
|
|
206
|
-
color: 'warning',
|
|
207
|
-
class: 'bg-warning-50 text-warning-500 border-warning-300'
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
variant: 'subtle',
|
|
211
|
-
color: 'error',
|
|
212
|
-
class: 'bg-error-50 text-error-500 border-error-300'
|
|
213
|
-
}
|
|
214
|
-
]
|
|
215
|
-
})({ color, variant, position })
|
|
216
|
-
);
|
|
217
|
-
</script>
|
|
218
|
-
|
|
219
|
-
<div class={classes.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
|
|
220
|
-
<div class="flex gap-2 flex-grow">
|
|
221
|
-
{#if icon}
|
|
222
|
-
<div class="size-6">
|
|
223
|
-
{#if typeof icon === 'string'}
|
|
224
|
-
<div class={classes.icon({ class: [icon] })}></div>
|
|
225
|
-
{:else if isSnippet(icon)}
|
|
226
|
-
{@render icon()}
|
|
227
|
-
{:else}
|
|
228
|
-
{@const Icon = icon}
|
|
229
|
-
<Icon />
|
|
230
|
-
{/if}
|
|
231
|
-
</div>
|
|
232
|
-
{/if}
|
|
233
|
-
|
|
234
|
-
<div class="space-y-1 flex-grow">
|
|
235
|
-
{#if title}
|
|
236
|
-
<div class={classes.title({ class: [ui.title] })}>
|
|
237
|
-
{#if isSnippet(title)}
|
|
238
|
-
{@render title()}
|
|
239
|
-
{:else}
|
|
240
|
-
{title}
|
|
241
|
-
{/if}
|
|
242
|
-
</div>
|
|
243
|
-
{/if}
|
|
244
|
-
|
|
245
|
-
{#if description}
|
|
246
|
-
<div class={classes.description({ class: [ui.title] })}>
|
|
247
|
-
{#if isSnippet(description)}
|
|
248
|
-
{@render description()}
|
|
249
|
-
{:else}
|
|
250
|
-
{description}
|
|
251
|
-
{/if}
|
|
252
|
-
</div>
|
|
253
|
-
{/if}
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
{#if close}
|
|
257
|
-
<div>
|
|
258
|
-
<Button {...close_props} onclick={onclose} />
|
|
259
|
-
</div>
|
|
260
|
-
{/if}
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
{#if actions.length > 0}
|
|
264
|
-
<div class="flex gap-2 items-center pl-8">
|
|
265
|
-
{#each actions as action (action.label)}
|
|
266
|
-
<Button
|
|
267
|
-
{...defu(action, {
|
|
268
|
-
size: 'xs'
|
|
269
|
-
} as ButtonProps)}
|
|
270
|
-
/>
|
|
271
|
-
{/each}
|
|
272
|
-
</div>
|
|
273
|
-
{/if}
|
|
274
|
-
</div>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { PropColor } from '../types.js';
|
|
2
|
-
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
import type { ButtonProps } from './button.svelte';
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
export type AlertProps = {
|
|
6
|
-
title?: string | Snippet;
|
|
7
|
-
description?: string | Snippet;
|
|
8
|
-
icon?: string | Snippet | Component;
|
|
9
|
-
color?: PropColor;
|
|
10
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
11
|
-
position?: 'bottom' | 'right';
|
|
12
|
-
actions?: ButtonProps[];
|
|
13
|
-
close?: boolean | ButtonProps;
|
|
14
|
-
ui?: {
|
|
15
|
-
base?: ClassNameValue;
|
|
16
|
-
icon?: ClassNameValue;
|
|
17
|
-
description?: ClassNameValue;
|
|
18
|
-
title?: ClassNameValue;
|
|
19
|
-
};
|
|
20
|
-
onclose?: () => void | Promise<void>;
|
|
21
|
-
};
|
|
22
|
-
declare const Alert: Component<AlertProps, {}, "">;
|
|
23
|
-
type Alert = ReturnType<typeof Alert>;
|
|
24
|
-
export default Alert;
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Component, Snippet } from 'svelte';
|
|
3
|
-
|
|
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
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<script lang="ts">
|
|
20
|
-
import { tv } from 'tailwind-variants';
|
|
21
|
-
import { isSnippet } from '../utils/common.js';
|
|
22
|
-
import type { PropColor } from '../types.js';
|
|
23
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
24
|
-
|
|
25
|
-
let {
|
|
26
|
-
icon,
|
|
27
|
-
label,
|
|
28
|
-
trailingicon,
|
|
29
|
-
color = 'primary',
|
|
30
|
-
size = 'md',
|
|
31
|
-
variant = 'solid',
|
|
32
|
-
ui = {},
|
|
33
|
-
children
|
|
34
|
-
}: BadgeProps = $props();
|
|
35
|
-
|
|
36
|
-
const classes = $derived.by(() => {
|
|
37
|
-
return tv({
|
|
38
|
-
slots: { icon: '', base: 'flex-inline items-center font-sans' },
|
|
39
|
-
variants: {
|
|
40
|
-
color: {
|
|
41
|
-
primary: '',
|
|
42
|
-
secondary: '',
|
|
43
|
-
error: '',
|
|
44
|
-
success: '',
|
|
45
|
-
info: '',
|
|
46
|
-
warning: ''
|
|
47
|
-
},
|
|
48
|
-
variant: {
|
|
49
|
-
link: '',
|
|
50
|
-
solid: 'text-white',
|
|
51
|
-
outline: 'border',
|
|
52
|
-
soft: '',
|
|
53
|
-
subtle: 'border',
|
|
54
|
-
ghost: ''
|
|
55
|
-
},
|
|
56
|
-
size: {
|
|
57
|
-
xs: {
|
|
58
|
-
base: 'font-medium text-[0.5rem] px-1 h-4 rounded gap-1',
|
|
59
|
-
icon: 'size-3'
|
|
60
|
-
},
|
|
61
|
-
sm: { base: 'font-medium text-[0.625rem] px-1 h-5 rounded gap-1', icon: 'size-3' },
|
|
62
|
-
md: { base: 'font-medium text-xs rounded-md px-2 h-6 gap-2', icon: 'size-4' },
|
|
63
|
-
lg: { base: 'font-medium text-sm px-2 h-7 rounded-md gap-2', icon: 'size-5' },
|
|
64
|
-
xl: { base: 'font-medium px-3 h-8 rounded-md gap-2', icon: 'size-5' }
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
compoundVariants: [
|
|
68
|
-
{
|
|
69
|
-
color: 'primary',
|
|
70
|
-
variant: 'solid',
|
|
71
|
-
class: 'bg-primary-400'
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
color: 'secondary',
|
|
75
|
-
variant: 'solid',
|
|
76
|
-
class: 'bg-secondary-900'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
color: 'info',
|
|
80
|
-
variant: 'solid',
|
|
81
|
-
class: 'bg-blue-500'
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
color: 'success',
|
|
85
|
-
variant: 'solid',
|
|
86
|
-
class: 'bg-green-500'
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
color: 'error',
|
|
90
|
-
variant: 'solid',
|
|
91
|
-
class: 'bg-red-500'
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
color: 'warning',
|
|
95
|
-
variant: 'solid',
|
|
96
|
-
class: 'bg-yellow-500'
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
color: 'primary',
|
|
101
|
-
variant: 'outline',
|
|
102
|
-
class: 'border-primary-300 text-primary-400'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
color: 'secondary',
|
|
106
|
-
variant: 'outline',
|
|
107
|
-
class: 'border-secondary-300 text-secondary-900'
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
color: 'info',
|
|
111
|
-
variant: 'outline',
|
|
112
|
-
class: 'border-blue-300 text-blue-500'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
color: 'success',
|
|
116
|
-
variant: 'outline',
|
|
117
|
-
class: 'border-green-300 text-green-500'
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
color: 'error',
|
|
121
|
-
variant: 'outline',
|
|
122
|
-
class: 'border-red-300 text-red-500'
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
color: 'warning',
|
|
126
|
-
variant: 'outline',
|
|
127
|
-
class: 'border-yellow-300 text-yellow-500'
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
color: 'primary',
|
|
132
|
-
variant: 'soft',
|
|
133
|
-
class: ' bg-primary-50 text-primary-500'
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
color: 'secondary',
|
|
137
|
-
variant: 'soft',
|
|
138
|
-
class: 'bg-secondary-100 text-secondary-800'
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
color: 'info',
|
|
142
|
-
variant: 'soft',
|
|
143
|
-
class: 'bg-blue-100 text-blue-500'
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
color: 'success',
|
|
147
|
-
variant: 'soft',
|
|
148
|
-
class: 'bg-green-100 text-green-500'
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
color: 'error',
|
|
152
|
-
variant: 'soft',
|
|
153
|
-
class: 'bg-red-100 text-red-500'
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
color: 'warning',
|
|
157
|
-
variant: 'soft',
|
|
158
|
-
class: 'bg-yellow-100 text-yellow-500 '
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
color: 'primary',
|
|
163
|
-
variant: 'subtle',
|
|
164
|
-
class: 'bg-primary-50 text-primary-500 border-primary-200 '
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
color: 'secondary',
|
|
168
|
-
variant: 'subtle',
|
|
169
|
-
class: 'bg-secondary-100 text-secondary-800 border-secondary-300 '
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
color: 'info',
|
|
173
|
-
variant: 'subtle',
|
|
174
|
-
class: 'bg-blue-50 text-blue-600 border-blue-200'
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
color: 'success',
|
|
178
|
-
variant: 'subtle',
|
|
179
|
-
class: 'bg-green-100 text-green-600 border-green-300'
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
color: 'error',
|
|
183
|
-
variant: 'subtle',
|
|
184
|
-
class: 'bg-red-50 text-red-600 border-red-200'
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
color: 'warning',
|
|
188
|
-
variant: 'subtle',
|
|
189
|
-
class: 'bg-yellow-50 text-yellow-600 border-yellow-300'
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
})({ variant, size, color });
|
|
193
|
-
});
|
|
194
|
-
</script>
|
|
195
|
-
|
|
196
|
-
<span
|
|
197
|
-
class={classes.base({
|
|
198
|
-
class: [icon && !(children || label) ? 'px-0 aspect-square justify-center' : '', ui.base]
|
|
199
|
-
})}
|
|
200
|
-
>
|
|
201
|
-
{#if !trailingicon}
|
|
202
|
-
{@render Icon()}
|
|
203
|
-
{/if}
|
|
204
|
-
|
|
205
|
-
{#if label}
|
|
206
|
-
{label}
|
|
207
|
-
{:else}
|
|
208
|
-
{@render children?.()}
|
|
209
|
-
{/if}
|
|
210
|
-
|
|
211
|
-
{#if trailingicon}
|
|
212
|
-
{@render Icon()}
|
|
213
|
-
{/if}
|
|
214
|
-
</span>
|
|
215
|
-
|
|
216
|
-
{#snippet Icon()}
|
|
217
|
-
{#if icon}
|
|
218
|
-
{#if typeof icon === 'string'}
|
|
219
|
-
<div class={['pi', icon, classes.icon(), ui.icon]}></div>
|
|
220
|
-
{:else if isSnippet(icon)}
|
|
221
|
-
{@render icon()}
|
|
222
|
-
{:else}
|
|
223
|
-
{@const Icon = icon}
|
|
224
|
-
<Icon />
|
|
225
|
-
{/if}
|
|
226
|
-
{/if}
|
|
227
|
-
{/snippet}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Component, Snippet } from 'svelte';
|
|
2
|
-
export type BadgeProps = {
|
|
3
|
-
label?: string;
|
|
4
|
-
color?: PropColor;
|
|
5
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
6
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
-
icon?: string | Snippet | Component;
|
|
8
|
-
trailingicon?: boolean;
|
|
9
|
-
children?: Snippet;
|
|
10
|
-
ui?: {
|
|
11
|
-
base?: ClassNameValue;
|
|
12
|
-
icon?: ClassNameValue;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
import type { PropColor } from '../types.js';
|
|
16
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
17
|
-
declare const Badge: Component<BadgeProps, {}, "">;
|
|
18
|
-
type Badge = ReturnType<typeof Badge>;
|
|
19
|
-
export default Badge;
|