uisv 0.0.7 → 0.0.9
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 +38 -37
- package/dist/components/accordion.svelte +0 -108
- package/dist/components/accordion.svelte.d.ts +0 -58
- package/dist/components/alert.svelte +0 -272
- 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 -255
- package/dist/components/banner.svelte.d.ts +0 -24
- package/dist/components/button.svelte +0 -384
- package/dist/components/button.svelte.d.ts +0 -49
- package/dist/components/card.svelte +0 -70
- package/dist/components/card.svelte.d.ts +0 -17
- package/dist/components/checkbox.svelte +0 -175
- package/dist/components/checkbox.svelte.d.ts +0 -27
- package/dist/components/checkboxgroup.svelte +0 -259
- package/dist/components/checkboxgroup.svelte.d.ts +0 -26
- package/dist/components/chip.svelte +0 -82
- package/dist/components/chip.svelte.d.ts +0 -17
- package/dist/components/h1.svelte +0 -28
- package/dist/components/h1.svelte.d.ts +0 -11
- package/dist/components/h2.svelte +0 -30
- package/dist/components/h2.svelte.d.ts +0 -11
- package/dist/components/index.d.ts +0 -34
- package/dist/components/index.js +0 -34
- package/dist/components/kbd.svelte +0 -239
- package/dist/components/kbd.svelte.d.ts +0 -40
- package/dist/components/p.svelte +0 -22
- package/dist/components/p.svelte.d.ts +0 -11
- package/dist/components/pin-input.svelte +0 -162
- package/dist/components/pin-input.svelte.d.ts +0 -25
- 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/slider.svelte +0 -172
- package/dist/components/slider.svelte.d.ts +0 -44
- package/dist/components/switch.svelte +0 -180
- package/dist/components/switch.svelte.d.ts +0 -27
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/utils/common.d.ts +0 -13
- package/dist/utils/common.js +0 -16
- package/dist/vite.d.ts +0 -38
- package/dist/vite.js +0 -57
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uisv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "ui library for the rest of us",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "ui-sv/uisv",
|
|
7
7
|
"homepage": "https://uisv.pages.dev",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite dev",
|
|
10
|
-
"build": "vite build &&
|
|
10
|
+
"build": "vite build && bun prepack",
|
|
11
11
|
"preview": "vite preview",
|
|
12
12
|
"prepare": "svelte-kit sync || echo ''",
|
|
13
13
|
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
@@ -43,45 +43,46 @@
|
|
|
43
43
|
"svelte": "^5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@eslint/compat": "^
|
|
47
|
-
"@eslint/js": "^9.
|
|
48
|
-
"@iconify-json/logos": "^1.2.
|
|
49
|
-
"@iconify-json/lucide": "^1.2.
|
|
50
|
-
"@iconify-json/solar": "^1.2.
|
|
51
|
-
"@
|
|
52
|
-
"@sveltejs/
|
|
53
|
-
"@sveltejs/
|
|
54
|
-
"@sveltejs/
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@unocss/
|
|
59
|
-
"@vitest/browser": "^
|
|
60
|
-
"bits-ui": "^2.
|
|
46
|
+
"@eslint/compat": "^2.0.1",
|
|
47
|
+
"@eslint/js": "^9.39.2",
|
|
48
|
+
"@iconify-json/logos": "^1.2.10",
|
|
49
|
+
"@iconify-json/lucide": "^1.2.84",
|
|
50
|
+
"@iconify-json/solar": "^1.2.5",
|
|
51
|
+
"@iconify/svelte": "^5.2.1",
|
|
52
|
+
"@sveltejs/adapter-auto": "^7.0.0",
|
|
53
|
+
"@sveltejs/kit": "^2.49.4",
|
|
54
|
+
"@sveltejs/package": "^2.5.7",
|
|
55
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
56
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
57
|
+
"@types/node": "^25.0.7",
|
|
58
|
+
"@unocss/preset-web-fonts": "^66.5.12",
|
|
59
|
+
"@vitest/browser": "^4.0.17",
|
|
60
|
+
"bits-ui": "^2.15.4",
|
|
61
61
|
"defu": "^6.1.4",
|
|
62
|
-
"eslint": "^9.
|
|
63
|
-
"eslint-config-prettier": "^10.
|
|
64
|
-
"eslint-plugin-svelte": "^3.
|
|
65
|
-
"globals": "^16.
|
|
66
|
-
"mdsvex": "^0.12.
|
|
62
|
+
"eslint": "^9.39.2",
|
|
63
|
+
"eslint-config-prettier": "^10.1.8",
|
|
64
|
+
"eslint-plugin-svelte": "^3.14.0",
|
|
65
|
+
"globals": "^16.5.0",
|
|
66
|
+
"mdsvex": "^0.12.6",
|
|
67
67
|
"mode-watcher": "^1.1.0",
|
|
68
|
-
"playwright": "^1.
|
|
69
|
-
"prettier": "^3.4
|
|
70
|
-
"prettier-plugin-svelte": "^3.
|
|
71
|
-
"publint": "^0.3.
|
|
68
|
+
"playwright": "^1.57.0",
|
|
69
|
+
"prettier": "^3.7.4",
|
|
70
|
+
"prettier-plugin-svelte": "^3.4.1",
|
|
71
|
+
"publint": "^0.3.16",
|
|
72
|
+
"runed": "^0.37.1",
|
|
72
73
|
"scule": "^1.3.0",
|
|
73
|
-
"svelte": "^5.
|
|
74
|
-
"svelte-check": "^4.
|
|
75
|
-
"tailwind-merge": "^3.
|
|
76
|
-
"tailwind-variants": "^3.
|
|
74
|
+
"svelte": "^5.46.3",
|
|
75
|
+
"svelte-check": "^4.3.5",
|
|
76
|
+
"tailwind-merge": "^3.4.0",
|
|
77
|
+
"tailwind-variants": "^3.2.2",
|
|
77
78
|
"theme-colors": "^0.1.0",
|
|
78
|
-
"typescript": "^5.
|
|
79
|
-
"typescript-eslint": "^8.
|
|
80
|
-
"unocss": "^66.5.
|
|
81
|
-
"unplugin-icons": "^22.
|
|
82
|
-
"vite": "^7.
|
|
83
|
-
"vitest": "^
|
|
84
|
-
"vitest-browser-svelte": "^0.1
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
|
+
"typescript-eslint": "^8.53.0",
|
|
81
|
+
"unocss": "^66.5.12",
|
|
82
|
+
"unplugin-icons": "^22.5.0",
|
|
83
|
+
"vite": "^7.3.1",
|
|
84
|
+
"vitest": "^4.0.17",
|
|
85
|
+
"vitest-browser-svelte": "^2.0.1"
|
|
85
86
|
},
|
|
86
87
|
"keywords": [
|
|
87
88
|
"svelte"
|
|
@@ -1,108 +0,0 @@
|
|
|
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>
|
|
@@ -1,58 +0,0 @@
|
|
|
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;
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { type PropColor, isSnippet } from '../index.js';
|
|
3
|
-
import type { Component, Snippet } from 'svelte';
|
|
4
|
-
import Button, { type ButtonProps } from './button.svelte';
|
|
5
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
6
|
-
import { tv } from 'tailwind-variants';
|
|
7
|
-
import { defu } from 'defu';
|
|
8
|
-
|
|
9
|
-
export type AlertProps = {
|
|
10
|
-
title?: string | Snippet;
|
|
11
|
-
description?: string | Snippet;
|
|
12
|
-
icon?: string | Snippet | Component;
|
|
13
|
-
color?: PropColor;
|
|
14
|
-
variant?: 'solid' | 'outline' | 'soft' | 'subtle';
|
|
15
|
-
position?: 'bottom' | 'right';
|
|
16
|
-
actions?: ButtonProps[];
|
|
17
|
-
close?: boolean | ButtonProps;
|
|
18
|
-
ui?: {
|
|
19
|
-
base?: ClassNameValue;
|
|
20
|
-
icon?: ClassNameValue;
|
|
21
|
-
description?: ClassNameValue;
|
|
22
|
-
title?: ClassNameValue;
|
|
23
|
-
};
|
|
24
|
-
onclose?: () => void | Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<script lang="ts">
|
|
29
|
-
let {
|
|
30
|
-
title,
|
|
31
|
-
description,
|
|
32
|
-
close,
|
|
33
|
-
icon,
|
|
34
|
-
actions = [],
|
|
35
|
-
color = 'primary',
|
|
36
|
-
variant = 'solid',
|
|
37
|
-
position = 'bottom',
|
|
38
|
-
ui = {},
|
|
39
|
-
onclose = () => {}
|
|
40
|
-
}: AlertProps = $props();
|
|
41
|
-
|
|
42
|
-
const close_props = $derived.by(() => {
|
|
43
|
-
return defu(typeof close === 'boolean' ? {} : close, {
|
|
44
|
-
icon: 'i-lucide-x',
|
|
45
|
-
variant: 'link',
|
|
46
|
-
color: variant === 'solid' ? 'secondary' : color,
|
|
47
|
-
ui: {
|
|
48
|
-
icon: variant === 'solid' ? 'text-white' : ''
|
|
49
|
-
}
|
|
50
|
-
} as ButtonProps);
|
|
51
|
-
});
|
|
52
|
-
const classes = $derived.by(() =>
|
|
53
|
-
tv({
|
|
54
|
-
slots: {
|
|
55
|
-
base: 'flex gap-2 font-sans p-4 rounded-lg',
|
|
56
|
-
icon: 'pi size-6',
|
|
57
|
-
actions: '',
|
|
58
|
-
description: 'text-opacity-50 text-sm',
|
|
59
|
-
title: 'font-medium'
|
|
60
|
-
},
|
|
61
|
-
variants: {
|
|
62
|
-
color: {
|
|
63
|
-
primary: '',
|
|
64
|
-
secondary: '',
|
|
65
|
-
info: '',
|
|
66
|
-
success: '',
|
|
67
|
-
warning: '',
|
|
68
|
-
error: ''
|
|
69
|
-
},
|
|
70
|
-
variant: {
|
|
71
|
-
solid: {
|
|
72
|
-
base: 'text-white',
|
|
73
|
-
description: 'text-white/90'
|
|
74
|
-
},
|
|
75
|
-
outline: 'border',
|
|
76
|
-
soft: '',
|
|
77
|
-
subtle: 'border'
|
|
78
|
-
},
|
|
79
|
-
position: {
|
|
80
|
-
right: {
|
|
81
|
-
base: ''
|
|
82
|
-
},
|
|
83
|
-
bottom: {
|
|
84
|
-
base: 'flex-col'
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
compoundVariants: [
|
|
89
|
-
{
|
|
90
|
-
variant: 'solid',
|
|
91
|
-
color: 'primary',
|
|
92
|
-
class: 'bg-primary-500'
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
variant: 'solid',
|
|
96
|
-
color: 'secondary',
|
|
97
|
-
class: 'bg-secondary-900'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
variant: 'solid',
|
|
101
|
-
color: 'info',
|
|
102
|
-
class: 'bg-info-500'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
variant: 'solid',
|
|
106
|
-
color: 'success',
|
|
107
|
-
class: 'bg-success-500'
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
variant: 'solid',
|
|
111
|
-
color: 'warning',
|
|
112
|
-
class: 'bg-warning-500'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
variant: 'solid',
|
|
116
|
-
color: 'error',
|
|
117
|
-
class: 'bg-error-500'
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
variant: 'outline',
|
|
122
|
-
color: 'primary',
|
|
123
|
-
class: 'border-primary-300 text-primary-500'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
variant: 'outline',
|
|
127
|
-
color: 'secondary',
|
|
128
|
-
class: 'border-secondary-300 text-secondary-900'
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
variant: 'outline',
|
|
132
|
-
color: 'info',
|
|
133
|
-
class: 'border-info-300 text-info-500'
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
variant: 'outline',
|
|
137
|
-
color: 'success',
|
|
138
|
-
class: 'border-success-300 text-success-500'
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
variant: 'outline',
|
|
142
|
-
color: 'warning',
|
|
143
|
-
class: 'border-warning-300 text-warning-500'
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
variant: 'outline',
|
|
147
|
-
color: 'error',
|
|
148
|
-
class: 'border-error-300 text-error-500'
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
variant: 'soft',
|
|
153
|
-
color: 'primary',
|
|
154
|
-
class: 'bg-primary-100 text-primary-500'
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
variant: 'soft',
|
|
158
|
-
color: 'secondary',
|
|
159
|
-
class: 'bg-secondary-50 text-secondary-900'
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
variant: 'soft',
|
|
163
|
-
color: 'info',
|
|
164
|
-
class: 'bg-info-50 text-info-500'
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
variant: 'soft',
|
|
168
|
-
color: 'success',
|
|
169
|
-
class: 'bg-success-50 text-success-500'
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
variant: 'soft',
|
|
173
|
-
color: 'warning',
|
|
174
|
-
class: 'bg-warning-50 text-warning-500'
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
variant: 'soft',
|
|
178
|
-
color: 'error',
|
|
179
|
-
class: 'bg-error-50 text-error-500'
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
variant: 'subtle',
|
|
184
|
-
color: 'primary',
|
|
185
|
-
class: 'bg-primary-100 text-primary-500 border-primary-300'
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
variant: 'subtle',
|
|
189
|
-
color: 'secondary',
|
|
190
|
-
class: 'bg-secondary-50 text-secondary-900 border-secondary-300'
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
variant: 'subtle',
|
|
194
|
-
color: 'info',
|
|
195
|
-
class: 'bg-info-50 text-info-500 border-info-300'
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
variant: 'subtle',
|
|
199
|
-
color: 'success',
|
|
200
|
-
class: 'bg-success-50 text-success-500 border-success-300'
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
variant: 'subtle',
|
|
204
|
-
color: 'warning',
|
|
205
|
-
class: 'bg-warning-50 text-warning-500 border-warning-300'
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
variant: 'subtle',
|
|
209
|
-
color: 'error',
|
|
210
|
-
class: 'bg-error-50 text-error-500 border-error-300'
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
})({ color, variant, position })
|
|
214
|
-
);
|
|
215
|
-
</script>
|
|
216
|
-
|
|
217
|
-
<div class={classes.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
|
|
218
|
-
<div class="flex gap-2 flex-grow">
|
|
219
|
-
{#if icon}
|
|
220
|
-
<div class="size-6">
|
|
221
|
-
{#if typeof icon === 'string'}
|
|
222
|
-
<div class={classes.icon({ class: [icon] })}></div>
|
|
223
|
-
{:else if isSnippet(icon)}
|
|
224
|
-
{@render icon()}
|
|
225
|
-
{:else}
|
|
226
|
-
{@const Icon = icon}
|
|
227
|
-
<Icon />
|
|
228
|
-
{/if}
|
|
229
|
-
</div>
|
|
230
|
-
{/if}
|
|
231
|
-
|
|
232
|
-
<div class="space-y-1 flex-grow">
|
|
233
|
-
{#if title}
|
|
234
|
-
<div class={classes.title({ class: [ui.title] })}>
|
|
235
|
-
{#if isSnippet(title)}
|
|
236
|
-
{@render title()}
|
|
237
|
-
{:else}
|
|
238
|
-
{title}
|
|
239
|
-
{/if}
|
|
240
|
-
</div>
|
|
241
|
-
{/if}
|
|
242
|
-
|
|
243
|
-
{#if description}
|
|
244
|
-
<div class={classes.description({ class: [ui.title] })}>
|
|
245
|
-
{#if isSnippet(description)}
|
|
246
|
-
{@render description()}
|
|
247
|
-
{:else}
|
|
248
|
-
{description}
|
|
249
|
-
{/if}
|
|
250
|
-
</div>
|
|
251
|
-
{/if}
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
{#if close}
|
|
255
|
-
<div>
|
|
256
|
-
<Button {...close_props} onclick={onclose} />
|
|
257
|
-
</div>
|
|
258
|
-
{/if}
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
{#if actions.length > 0}
|
|
262
|
-
<div class="flex gap-2 items-center pl-8">
|
|
263
|
-
{#each actions as action (action.label)}
|
|
264
|
-
<Button
|
|
265
|
-
{...defu(action, {
|
|
266
|
-
size: 'xs'
|
|
267
|
-
} as ButtonProps)}
|
|
268
|
-
/>
|
|
269
|
-
{/each}
|
|
270
|
-
</div>
|
|
271
|
-
{/if}
|
|
272
|
-
</div>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type PropColor } from '../index.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;
|