sv5ui 1.1.3 → 1.3.0
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/README.md +6 -0
- package/dist/Alert/Alert.svelte +33 -22
- package/dist/Alert/Alert.svelte.d.ts +1 -1
- package/dist/Alert/alert.types.d.ts +4 -0
- package/dist/Avatar/Avatar.svelte +72 -46
- package/dist/Avatar/avatar.types.d.ts +36 -3
- package/dist/Avatar/avatar.variants.d.ts +138 -0
- package/dist/Avatar/avatar.variants.js +23 -12
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroup.svelte +11 -6
- package/dist/AvatarGroup/AvatarGroup.svelte.d.ts +1 -1
- package/dist/AvatarGroup/avatar-group.types.d.ts +18 -3
- package/dist/AvatarGroup/avatar-group.variants.d.ts +85 -0
- package/dist/AvatarGroup/avatar-group.variants.js +19 -29
- package/dist/Badge/Badge.svelte +4 -3
- package/dist/Badge/Badge.svelte.d.ts +1 -1
- package/dist/Badge/badge.types.d.ts +9 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +20 -7
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +1 -1
- package/dist/Breadcrumb/breadcrumb.types.d.ts +5 -1
- package/dist/Breadcrumb/breadcrumb.variants.d.ts +15 -5
- package/dist/Breadcrumb/breadcrumb.variants.js +7 -3
- package/dist/Button/Button.svelte +71 -16
- package/dist/Button/Button.svelte.d.ts +0 -1
- package/dist/Button/button.types.d.ts +61 -2
- package/dist/Calendar/Calendar.svelte +4 -0
- package/dist/Calendar/Calendar.svelte.d.ts +1 -1
- package/dist/Calendar/calendar.types.d.ts +4 -0
- package/dist/Card/Card.svelte +5 -4
- package/dist/Card/Card.svelte.d.ts +1 -1
- package/dist/Card/card.types.d.ts +5 -1
- package/dist/Checkbox/Checkbox.svelte +37 -11
- package/dist/Checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/Checkbox/checkbox.types.d.ts +16 -1
- package/dist/Checkbox/checkbox.variants.d.ts +90 -0
- package/dist/Checkbox/checkbox.variants.js +73 -4
- package/dist/CheckboxGroup/CheckboxGroup.svelte +215 -0
- package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +5 -0
- package/dist/CheckboxGroup/checkbox-group.types.d.ts +130 -0
- package/dist/CheckboxGroup/checkbox-group.types.js +1 -0
- package/dist/CheckboxGroup/checkbox-group.variants.d.ts +553 -0
- package/dist/CheckboxGroup/checkbox-group.variants.js +231 -0
- package/dist/CheckboxGroup/index.d.ts +2 -0
- package/dist/CheckboxGroup/index.js +1 -0
- package/dist/Chip/Chip.svelte +3 -2
- package/dist/Chip/Chip.svelte.d.ts +1 -1
- package/dist/Chip/chip.types.d.ts +5 -1
- package/dist/Chip/chip.variants.d.ts +135 -45
- package/dist/Chip/chip.variants.js +9 -9
- package/dist/ContextMenu/ContextMenu.svelte +87 -77
- package/dist/ContextMenu/ContextMenu.svelte.d.ts +1 -1
- package/dist/ContextMenu/context-menu.types.d.ts +9 -3
- package/dist/ContextMenu/context-menu.types.js +1 -1
- package/dist/ContextMenu/context-menu.variants.d.ts +74 -160
- package/dist/ContextMenu/context-menu.variants.js +63 -95
- package/dist/DropdownMenu/DropdownMenu.svelte +37 -43
- package/dist/DropdownMenu/DropdownMenu.svelte.d.ts +1 -1
- package/dist/DropdownMenu/dropdown-menu.types.d.ts +9 -3
- package/dist/DropdownMenu/dropdown-menu.types.js +1 -1
- package/dist/DropdownMenu/dropdown-menu.variants.d.ts +79 -230
- package/dist/DropdownMenu/dropdown-menu.variants.js +68 -111
- package/dist/DropdownMenu/index.d.ts +1 -1
- package/dist/Empty/Empty.svelte +68 -33
- package/dist/Empty/Empty.svelte.d.ts +1 -1
- package/dist/Empty/empty.types.d.ts +26 -9
- package/dist/Empty/empty.variants.d.ts +150 -130
- package/dist/Empty/empty.variants.js +33 -324
- package/dist/FieldGroup/FieldGroup.svelte +11 -6
- package/dist/FieldGroup/FieldGroup.svelte.d.ts +1 -1
- package/dist/FieldGroup/field-group.types.d.ts +4 -0
- package/dist/FileUpload/FileUpload.svelte +561 -0
- package/dist/FileUpload/FileUpload.svelte.d.ts +8 -0
- package/dist/FileUpload/file-upload.types.d.ts +164 -0
- package/dist/FileUpload/file-upload.types.js +1 -0
- package/dist/FileUpload/file-upload.variants.d.ts +397 -0
- package/dist/FileUpload/file-upload.variants.js +224 -0
- package/dist/FileUpload/index.d.ts +2 -0
- package/dist/FileUpload/index.js +1 -0
- package/dist/FormField/FormField.svelte +17 -18
- package/dist/FormField/FormField.svelte.d.ts +1 -1
- package/dist/FormField/form-field.types.d.ts +4 -0
- package/dist/Icon/Icon.svelte +13 -7
- package/dist/Icon/icon.types.d.ts +18 -9
- package/dist/Input/Input.svelte +30 -29
- package/dist/Kbd/Kbd.svelte +13 -3
- package/dist/Kbd/Kbd.svelte.d.ts +1 -1
- package/dist/Kbd/index.d.ts +1 -1
- package/dist/Kbd/kbd.types.d.ts +15 -1
- package/dist/Kbd/kbd.variants.d.ts +92 -30
- package/dist/Kbd/kbd.variants.js +55 -35
- package/dist/Kbd/useKbd.svelte.d.ts +2 -2
- package/dist/Kbd/useKbd.svelte.js +34 -41
- package/dist/Link/Link.svelte +69 -24
- package/dist/Link/Link.svelte.d.ts +1 -1
- package/dist/Link/link.types.d.ts +26 -8
- package/dist/Link/link.variants.d.ts +35 -60
- package/dist/Link/link.variants.js +8 -110
- package/dist/Modal/Modal.svelte +9 -1
- package/dist/Modal/modal.types.d.ts +5 -0
- package/dist/Modal/modal.variants.d.ts +5 -0
- package/dist/Modal/modal.variants.js +1 -0
- package/dist/Pagination/Pagination.svelte +143 -94
- package/dist/Pagination/Pagination.svelte.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/pagination.types.d.ts +21 -2
- package/dist/Pagination/pagination.variants.d.ts +21 -387
- package/dist/Pagination/pagination.variants.js +63 -59
- package/dist/PinInput/PinInput.svelte +150 -0
- package/dist/PinInput/PinInput.svelte.d.ts +6 -0
- package/dist/PinInput/index.d.ts +2 -0
- package/dist/PinInput/index.js +1 -0
- package/dist/PinInput/pin-input.types.d.ts +99 -0
- package/dist/PinInput/pin-input.types.js +1 -0
- package/dist/PinInput/pin-input.variants.d.ts +303 -0
- package/dist/PinInput/pin-input.variants.js +196 -0
- package/dist/Popover/Popover.svelte +9 -12
- package/dist/Popover/Popover.svelte.d.ts +1 -1
- package/dist/Popover/popover.types.d.ts +4 -0
- package/dist/Popover/popover.variants.d.ts +5 -75
- package/dist/Popover/popover.variants.js +6 -16
- package/dist/Progress/Progress.svelte +58 -30
- package/dist/Progress/progress.types.d.ts +9 -1
- package/dist/Progress/progress.variants.d.ts +55 -25
- package/dist/Progress/progress.variants.js +34 -28
- package/dist/RadioGroup/RadioGroup.svelte +105 -61
- package/dist/RadioGroup/RadioGroup.svelte.d.ts +1 -1
- package/dist/RadioGroup/radio-group.types.d.ts +16 -1
- package/dist/RadioGroup/radio-group.variants.d.ts +90 -0
- package/dist/RadioGroup/radio-group.variants.js +73 -4
- package/dist/Select/Select.svelte +9 -6
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/Select/select.types.d.ts +4 -0
- package/dist/SelectMenu/SelectMenu.svelte +436 -0
- package/dist/SelectMenu/SelectMenu.svelte.d.ts +5 -0
- package/dist/SelectMenu/index.d.ts +2 -0
- package/dist/SelectMenu/index.js +1 -0
- package/dist/SelectMenu/select-menu.types.d.ts +262 -0
- package/dist/SelectMenu/select-menu.types.js +1 -0
- package/dist/SelectMenu/select-menu.variants.d.ts +759 -0
- package/dist/SelectMenu/select-menu.variants.js +33 -0
- package/dist/Separator/Separator.svelte +1 -2
- package/dist/Separator/separator.variants.d.ts +1 -5
- package/dist/Separator/separator.variants.js +2 -2
- package/dist/Skeleton/Skeleton.svelte +18 -2
- package/dist/Skeleton/Skeleton.svelte.d.ts +1 -1
- package/dist/Skeleton/skeleton.types.d.ts +10 -1
- package/dist/Slideover/Slideover.svelte +9 -1
- package/dist/Slideover/slideover.types.d.ts +5 -0
- package/dist/Slideover/slideover.variants.d.ts +20 -5
- package/dist/Slideover/slideover.variants.js +4 -29
- package/dist/Slider/Slider.svelte +135 -0
- package/dist/Slider/Slider.svelte.d.ts +6 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +1 -0
- package/dist/Slider/slider.types.d.ts +55 -0
- package/dist/Slider/slider.types.js +1 -0
- package/dist/Slider/slider.variants.d.ts +383 -0
- package/dist/Slider/slider.variants.js +102 -0
- package/dist/Switch/Switch.svelte +32 -31
- package/dist/Switch/Switch.svelte.d.ts +1 -1
- package/dist/Switch/switch.types.d.ts +6 -1
- package/dist/Switch/switch.variants.js +6 -6
- package/dist/Tabs/Tabs.svelte +6 -9
- package/dist/Tabs/Tabs.svelte.d.ts +1 -1
- package/dist/Tabs/tabs.types.d.ts +4 -0
- package/dist/Tabs/tabs.variants.js +2 -0
- package/dist/Textarea/Textarea.svelte +26 -25
- package/dist/ThemeModeButton/theme-mode-button.types.d.ts +7 -2
- package/dist/Timeline/Timeline.svelte +62 -19
- package/dist/Timeline/Timeline.svelte.d.ts +1 -1
- package/dist/Timeline/index.d.ts +1 -1
- package/dist/Timeline/timeline.types.d.ts +8 -0
- package/dist/Tooltip/Tooltip.svelte +12 -10
- package/dist/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/Tooltip/tooltip.types.d.ts +8 -4
- package/dist/Tooltip/tooltip.variants.d.ts +10 -75
- package/dist/Tooltip/tooltip.variants.js +8 -17
- package/dist/User/User.svelte +13 -9
- package/dist/User/User.svelte.d.ts +1 -1
- package/dist/User/user.types.d.ts +4 -0
- package/dist/User/user.variants.d.ts +60 -0
- package/dist/User/user.variants.js +13 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.js +9 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/package.json +2 -2
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { LinkSlots } from './link.variants.js';
|
|
3
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
export type LinkProps = Omit<
|
|
5
|
+
export type LinkProps = Omit<HTMLAttributes<HTMLElement>, 'class'> & {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Bindable reference to the root DOM element.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
+
ref?: HTMLElement | null;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* The destination URL for the anchor element.
|
|
12
|
+
* When omitted, renders as a `<button>` element.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
href?: string;
|
|
14
15
|
/**
|
|
15
16
|
* Overrides the auto-detected active state.
|
|
16
17
|
* When omitted, the active state is inferred from the current route.
|
|
@@ -57,6 +58,19 @@ export type LinkProps = Omit<HTMLAnchorAttributes, 'class' | 'href'> & {
|
|
|
57
58
|
* Auto-detected from the `href` when omitted.
|
|
58
59
|
*/
|
|
59
60
|
external?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The button type attribute. Only applies when rendering as `<button>`.
|
|
63
|
+
* @default 'button'
|
|
64
|
+
*/
|
|
65
|
+
type?: 'button' | 'submit' | 'reset';
|
|
66
|
+
/**
|
|
67
|
+
* The link target attribute. Only applies when rendering as `<a>`.
|
|
68
|
+
*/
|
|
69
|
+
target?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The link rel attribute. Only applies when rendering as `<a>`.
|
|
72
|
+
*/
|
|
73
|
+
rel?: string;
|
|
60
74
|
/**
|
|
61
75
|
* Additional CSS classes for the root element.
|
|
62
76
|
*/
|
|
@@ -65,4 +79,8 @@ export type LinkProps = Omit<HTMLAnchorAttributes, 'class' | 'href'> & {
|
|
|
65
79
|
* Override styles for specific link slots.
|
|
66
80
|
*/
|
|
67
81
|
ui?: Partial<Record<LinkSlots, ClassNameValue>>;
|
|
82
|
+
/**
|
|
83
|
+
* Content rendered inside the link.
|
|
84
|
+
*/
|
|
85
|
+
children?: Snippet;
|
|
68
86
|
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { type VariantProps } from 'tailwind-variants';
|
|
2
2
|
export declare const linkVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
-
color: {
|
|
4
|
-
primary: string;
|
|
5
|
-
secondary: string;
|
|
6
|
-
tertiary: string;
|
|
7
|
-
success: string;
|
|
8
|
-
warning: string;
|
|
9
|
-
error: string;
|
|
10
|
-
info: string;
|
|
11
|
-
};
|
|
12
3
|
active: {
|
|
13
|
-
true:
|
|
14
|
-
|
|
4
|
+
true: {
|
|
5
|
+
base: string;
|
|
6
|
+
};
|
|
7
|
+
false: {
|
|
8
|
+
base: string;
|
|
9
|
+
};
|
|
15
10
|
};
|
|
16
11
|
disabled: {
|
|
17
12
|
true: {
|
|
@@ -24,20 +19,15 @@ export declare const linkVariants: import("tailwind-variants").TVReturnType<{
|
|
|
24
19
|
false: string;
|
|
25
20
|
};
|
|
26
21
|
}, {
|
|
27
|
-
base: string
|
|
22
|
+
base: string;
|
|
28
23
|
}, undefined, {
|
|
29
|
-
color: {
|
|
30
|
-
primary: string;
|
|
31
|
-
secondary: string;
|
|
32
|
-
tertiary: string;
|
|
33
|
-
success: string;
|
|
34
|
-
warning: string;
|
|
35
|
-
error: string;
|
|
36
|
-
info: string;
|
|
37
|
-
};
|
|
38
24
|
active: {
|
|
39
|
-
true:
|
|
40
|
-
|
|
25
|
+
true: {
|
|
26
|
+
base: string;
|
|
27
|
+
};
|
|
28
|
+
false: {
|
|
29
|
+
base: string;
|
|
30
|
+
};
|
|
41
31
|
};
|
|
42
32
|
disabled: {
|
|
43
33
|
true: {
|
|
@@ -50,20 +40,15 @@ export declare const linkVariants: import("tailwind-variants").TVReturnType<{
|
|
|
50
40
|
false: string;
|
|
51
41
|
};
|
|
52
42
|
}, {
|
|
53
|
-
base: string
|
|
43
|
+
base: string;
|
|
54
44
|
}, import("tailwind-variants").TVReturnType<{
|
|
55
|
-
color: {
|
|
56
|
-
primary: string;
|
|
57
|
-
secondary: string;
|
|
58
|
-
tertiary: string;
|
|
59
|
-
success: string;
|
|
60
|
-
warning: string;
|
|
61
|
-
error: string;
|
|
62
|
-
info: string;
|
|
63
|
-
};
|
|
64
45
|
active: {
|
|
65
|
-
true:
|
|
66
|
-
|
|
46
|
+
true: {
|
|
47
|
+
base: string;
|
|
48
|
+
};
|
|
49
|
+
false: {
|
|
50
|
+
base: string;
|
|
51
|
+
};
|
|
67
52
|
};
|
|
68
53
|
disabled: {
|
|
69
54
|
true: {
|
|
@@ -76,24 +61,19 @@ export declare const linkVariants: import("tailwind-variants").TVReturnType<{
|
|
|
76
61
|
false: string;
|
|
77
62
|
};
|
|
78
63
|
}, {
|
|
79
|
-
base: string
|
|
64
|
+
base: string;
|
|
80
65
|
}, undefined, unknown, unknown, undefined>>;
|
|
81
66
|
export type LinkVariantProps = VariantProps<typeof linkVariants>;
|
|
82
67
|
export type LinkSlots = keyof ReturnType<typeof linkVariants>;
|
|
83
68
|
export declare const linkDefaults: {
|
|
84
69
|
defaultVariants: import("tailwind-variants").TVDefaultVariants<{
|
|
85
|
-
color: {
|
|
86
|
-
primary: string;
|
|
87
|
-
secondary: string;
|
|
88
|
-
tertiary: string;
|
|
89
|
-
success: string;
|
|
90
|
-
warning: string;
|
|
91
|
-
error: string;
|
|
92
|
-
info: string;
|
|
93
|
-
};
|
|
94
70
|
active: {
|
|
95
|
-
true:
|
|
96
|
-
|
|
71
|
+
true: {
|
|
72
|
+
base: string;
|
|
73
|
+
};
|
|
74
|
+
false: {
|
|
75
|
+
base: string;
|
|
76
|
+
};
|
|
97
77
|
};
|
|
98
78
|
disabled: {
|
|
99
79
|
true: {
|
|
@@ -106,20 +86,15 @@ export declare const linkDefaults: {
|
|
|
106
86
|
false: string;
|
|
107
87
|
};
|
|
108
88
|
}, {
|
|
109
|
-
base: string
|
|
89
|
+
base: string;
|
|
110
90
|
}, {
|
|
111
|
-
color: {
|
|
112
|
-
primary: string;
|
|
113
|
-
secondary: string;
|
|
114
|
-
tertiary: string;
|
|
115
|
-
success: string;
|
|
116
|
-
warning: string;
|
|
117
|
-
error: string;
|
|
118
|
-
info: string;
|
|
119
|
-
};
|
|
120
91
|
active: {
|
|
121
|
-
true:
|
|
122
|
-
|
|
92
|
+
true: {
|
|
93
|
+
base: string;
|
|
94
|
+
};
|
|
95
|
+
false: {
|
|
96
|
+
base: string;
|
|
97
|
+
};
|
|
123
98
|
};
|
|
124
99
|
disabled: {
|
|
125
100
|
true: {
|
|
@@ -132,7 +107,7 @@ export declare const linkDefaults: {
|
|
|
132
107
|
false: string;
|
|
133
108
|
};
|
|
134
109
|
}, {
|
|
135
|
-
base: string
|
|
110
|
+
base: string;
|
|
136
111
|
}>;
|
|
137
112
|
slots: Partial<Record<LinkSlots, string>>;
|
|
138
113
|
};
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
2
|
export const linkVariants = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base:
|
|
5
|
-
'inline-flex items-center',
|
|
6
|
-
'transition-colors duration-200',
|
|
7
|
-
'focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary'
|
|
8
|
-
]
|
|
4
|
+
base: 'focus-visible:outline-primary'
|
|
9
5
|
},
|
|
10
6
|
variants: {
|
|
11
|
-
color: {
|
|
12
|
-
primary: '',
|
|
13
|
-
secondary: '',
|
|
14
|
-
tertiary: '',
|
|
15
|
-
success: '',
|
|
16
|
-
warning: '',
|
|
17
|
-
error: '',
|
|
18
|
-
info: ''
|
|
19
|
-
},
|
|
20
7
|
active: {
|
|
21
|
-
true:
|
|
22
|
-
|
|
8
|
+
true: {
|
|
9
|
+
base: 'text-primary'
|
|
10
|
+
},
|
|
11
|
+
false: {
|
|
12
|
+
base: 'text-on-surface-variant'
|
|
13
|
+
}
|
|
23
14
|
},
|
|
24
15
|
disabled: {
|
|
25
16
|
true: {
|
|
@@ -33,107 +24,14 @@ export const linkVariants = tv({
|
|
|
33
24
|
}
|
|
34
25
|
},
|
|
35
26
|
compoundVariants: [
|
|
36
|
-
// ========== PRIMARY ==========
|
|
37
|
-
{
|
|
38
|
-
color: 'primary',
|
|
39
|
-
active: true,
|
|
40
|
-
raw: false,
|
|
41
|
-
class: { base: 'text-primary' }
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
color: 'primary',
|
|
45
|
-
active: false,
|
|
46
|
-
disabled: false,
|
|
47
|
-
raw: false,
|
|
48
|
-
class: { base: 'text-primary/80 hover:text-primary' }
|
|
49
|
-
},
|
|
50
|
-
// ========== SECONDARY ==========
|
|
51
|
-
{
|
|
52
|
-
color: 'secondary',
|
|
53
|
-
active: true,
|
|
54
|
-
raw: false,
|
|
55
|
-
class: { base: 'text-secondary' }
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
color: 'secondary',
|
|
59
|
-
active: false,
|
|
60
|
-
disabled: false,
|
|
61
|
-
raw: false,
|
|
62
|
-
class: { base: 'text-secondary/80 hover:text-secondary' }
|
|
63
|
-
},
|
|
64
|
-
// ========== TERTIARY ==========
|
|
65
|
-
{
|
|
66
|
-
color: 'tertiary',
|
|
67
|
-
active: true,
|
|
68
|
-
raw: false,
|
|
69
|
-
class: { base: 'text-tertiary' }
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
color: 'tertiary',
|
|
73
|
-
active: false,
|
|
74
|
-
disabled: false,
|
|
75
|
-
raw: false,
|
|
76
|
-
class: { base: 'text-tertiary/80 hover:text-tertiary' }
|
|
77
|
-
},
|
|
78
|
-
// ========== SUCCESS ==========
|
|
79
|
-
{
|
|
80
|
-
color: 'success',
|
|
81
|
-
active: true,
|
|
82
|
-
raw: false,
|
|
83
|
-
class: { base: 'text-success' }
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
color: 'success',
|
|
87
|
-
active: false,
|
|
88
|
-
disabled: false,
|
|
89
|
-
raw: false,
|
|
90
|
-
class: { base: 'text-success/80 hover:text-success' }
|
|
91
|
-
},
|
|
92
|
-
// ========== WARNING ==========
|
|
93
|
-
{
|
|
94
|
-
color: 'warning',
|
|
95
|
-
active: true,
|
|
96
|
-
raw: false,
|
|
97
|
-
class: { base: 'text-warning' }
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
color: 'warning',
|
|
101
|
-
active: false,
|
|
102
|
-
disabled: false,
|
|
103
|
-
raw: false,
|
|
104
|
-
class: { base: 'text-warning/80 hover:text-warning' }
|
|
105
|
-
},
|
|
106
|
-
// ========== ERROR ==========
|
|
107
|
-
{
|
|
108
|
-
color: 'error',
|
|
109
|
-
active: true,
|
|
110
|
-
raw: false,
|
|
111
|
-
class: { base: 'text-error' }
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
color: 'error',
|
|
115
|
-
active: false,
|
|
116
|
-
disabled: false,
|
|
117
|
-
raw: false,
|
|
118
|
-
class: { base: 'text-error/80 hover:text-error' }
|
|
119
|
-
},
|
|
120
|
-
// ========== INFO ==========
|
|
121
|
-
{
|
|
122
|
-
color: 'info',
|
|
123
|
-
active: true,
|
|
124
|
-
raw: false,
|
|
125
|
-
class: { base: 'text-info' }
|
|
126
|
-
},
|
|
127
27
|
{
|
|
128
|
-
color: 'info',
|
|
129
28
|
active: false,
|
|
130
29
|
disabled: false,
|
|
131
30
|
raw: false,
|
|
132
|
-
class: { base: '
|
|
31
|
+
class: { base: 'hover:text-on-surface transition-colors' }
|
|
133
32
|
}
|
|
134
33
|
],
|
|
135
34
|
defaultVariants: {
|
|
136
|
-
color: 'primary',
|
|
137
35
|
active: false,
|
|
138
36
|
disabled: false,
|
|
139
37
|
raw: false
|
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
header: headerSlot,
|
|
41
41
|
titleSlot,
|
|
42
42
|
descriptionSlot,
|
|
43
|
+
actions: actionsSlot,
|
|
43
44
|
body: bodySlot,
|
|
44
45
|
footer: footerSlot,
|
|
45
46
|
closeSlot
|
|
@@ -51,7 +52,9 @@
|
|
|
51
52
|
const hasTitle = $derived(!!title || !!titleSlot)
|
|
52
53
|
const hasDescription = $derived(!!description || !!descriptionSlot)
|
|
53
54
|
const hasHeading = $derived(hasTitle || hasDescription)
|
|
54
|
-
const hasHeader = $derived(
|
|
55
|
+
const hasHeader = $derived(
|
|
56
|
+
!!headerSlot || hasHeading || !!actionsSlot || showClose || !!closeSlot
|
|
57
|
+
)
|
|
55
58
|
|
|
56
59
|
const variantSlots = $derived(
|
|
57
60
|
modalVariants({ transition, fullscreen, overlay: showOverlay, scrollable })
|
|
@@ -66,6 +69,7 @@
|
|
|
66
69
|
description: variantSlots.description({
|
|
67
70
|
class: [config.slots.description, ui?.description]
|
|
68
71
|
}),
|
|
72
|
+
actions: variantSlots.actions({ class: [config.slots.actions, ui?.actions] }),
|
|
69
73
|
body: variantSlots.body({ class: [config.slots.body, ui?.body] }),
|
|
70
74
|
footer: variantSlots.footer({ class: [config.slots.footer, ui?.footer] }),
|
|
71
75
|
close: variantSlots.close({ class: [config.slots.close, ui?.close] })
|
|
@@ -132,6 +136,10 @@
|
|
|
132
136
|
{/if}
|
|
133
137
|
</div>
|
|
134
138
|
|
|
139
|
+
{#if actionsSlot}
|
|
140
|
+
<div class={classes.actions}>{@render actionsSlot()}</div>
|
|
141
|
+
{/if}
|
|
142
|
+
|
|
135
143
|
{#if showClose || closeSlot}
|
|
136
144
|
<Dialog.Close>
|
|
137
145
|
{#snippet child({ props })}
|
|
@@ -113,6 +113,11 @@ export interface ModalProps extends RootProps, ContentProps {
|
|
|
113
113
|
* Custom description slot. Overrides the `description` prop when provided.
|
|
114
114
|
*/
|
|
115
115
|
descriptionSlot?: Snippet;
|
|
116
|
+
/**
|
|
117
|
+
* Actions slot rendered between the title/description wrapper
|
|
118
|
+
* and the close button inside the header.
|
|
119
|
+
*/
|
|
120
|
+
actions?: Snippet;
|
|
116
121
|
/**
|
|
117
122
|
* Body content rendered between the header and footer.
|
|
118
123
|
*/
|
|
@@ -38,6 +38,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
38
38
|
footer: string;
|
|
39
39
|
title: string;
|
|
40
40
|
description: string;
|
|
41
|
+
actions: string;
|
|
41
42
|
close: string;
|
|
42
43
|
}, undefined, {
|
|
43
44
|
transition: {
|
|
@@ -78,6 +79,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
78
79
|
footer: string;
|
|
79
80
|
title: string;
|
|
80
81
|
description: string;
|
|
82
|
+
actions: string;
|
|
81
83
|
close: string;
|
|
82
84
|
}, import("tailwind-variants").TVReturnType<{
|
|
83
85
|
transition: {
|
|
@@ -118,6 +120,7 @@ export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
|
118
120
|
footer: string;
|
|
119
121
|
title: string;
|
|
120
122
|
description: string;
|
|
123
|
+
actions: string;
|
|
121
124
|
close: string;
|
|
122
125
|
}, undefined, unknown, unknown, undefined>>;
|
|
123
126
|
export type ModalVariantProps = VariantProps<typeof modalVariants>;
|
|
@@ -162,6 +165,7 @@ export declare const modalDefaults: {
|
|
|
162
165
|
footer: string;
|
|
163
166
|
title: string;
|
|
164
167
|
description: string;
|
|
168
|
+
actions: string;
|
|
165
169
|
close: string;
|
|
166
170
|
}, {
|
|
167
171
|
transition: {
|
|
@@ -202,6 +206,7 @@ export declare const modalDefaults: {
|
|
|
202
206
|
footer: string;
|
|
203
207
|
title: string;
|
|
204
208
|
description: string;
|
|
209
|
+
actions: string;
|
|
205
210
|
close: string;
|
|
206
211
|
}>;
|
|
207
212
|
slots: Partial<Record<ModalSlots, string>>;
|
|
@@ -9,6 +9,7 @@ export const modalVariants = tv({
|
|
|
9
9
|
footer: 'flex items-center gap-1.5 p-4 sm:px-6',
|
|
10
10
|
title: 'text-on-surface font-semibold',
|
|
11
11
|
description: 'mt-1 text-on-surface-variant text-sm',
|
|
12
|
+
actions: 'flex items-center gap-1.5 shrink-0',
|
|
12
13
|
close: 'absolute top-4 end-4'
|
|
13
14
|
},
|
|
14
15
|
variants: {
|