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,4 +1,44 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
|
+
// Per-item color classes — static map, O(1) lookup, no TV re-instantiation per item
|
|
3
|
+
// Default highlight is here (not in base item slot) to avoid class conflicts
|
|
4
|
+
export const itemColorClasses = {
|
|
5
|
+
default: {
|
|
6
|
+
item: 'data-[highlighted]:bg-surface-container-highest',
|
|
7
|
+
itemLeadingIcon: ''
|
|
8
|
+
},
|
|
9
|
+
primary: {
|
|
10
|
+
item: 'text-primary data-[highlighted]:bg-primary-container data-[highlighted]:text-on-primary-container',
|
|
11
|
+
itemLeadingIcon: 'text-primary group-data-[highlighted]:text-on-primary-container'
|
|
12
|
+
},
|
|
13
|
+
secondary: {
|
|
14
|
+
item: 'text-secondary data-[highlighted]:bg-secondary-container data-[highlighted]:text-on-secondary-container',
|
|
15
|
+
itemLeadingIcon: 'text-secondary group-data-[highlighted]:text-on-secondary-container'
|
|
16
|
+
},
|
|
17
|
+
tertiary: {
|
|
18
|
+
item: 'text-tertiary data-[highlighted]:bg-tertiary-container data-[highlighted]:text-on-tertiary-container',
|
|
19
|
+
itemLeadingIcon: 'text-tertiary group-data-[highlighted]:text-on-tertiary-container'
|
|
20
|
+
},
|
|
21
|
+
success: {
|
|
22
|
+
item: 'text-success data-[highlighted]:bg-success-container data-[highlighted]:text-on-success-container',
|
|
23
|
+
itemLeadingIcon: 'text-success group-data-[highlighted]:text-on-success-container'
|
|
24
|
+
},
|
|
25
|
+
warning: {
|
|
26
|
+
item: 'text-warning data-[highlighted]:bg-warning-container data-[highlighted]:text-on-warning-container',
|
|
27
|
+
itemLeadingIcon: 'text-warning group-data-[highlighted]:text-on-warning-container'
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
item: 'text-error data-[highlighted]:bg-error-container data-[highlighted]:text-on-error-container',
|
|
31
|
+
itemLeadingIcon: 'text-error group-data-[highlighted]:text-on-error-container'
|
|
32
|
+
},
|
|
33
|
+
info: {
|
|
34
|
+
item: 'text-info data-[highlighted]:bg-info-container data-[highlighted]:text-on-info-container',
|
|
35
|
+
itemLeadingIcon: 'text-info group-data-[highlighted]:text-on-info-container'
|
|
36
|
+
},
|
|
37
|
+
surface: {
|
|
38
|
+
item: 'text-on-surface-variant data-[highlighted]:bg-surface-container-highest data-[highlighted]:text-on-surface',
|
|
39
|
+
itemLeadingIcon: 'text-on-surface-variant group-data-[highlighted]:text-on-surface'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
2
42
|
export const dropdownMenuVariants = tv({
|
|
3
43
|
slots: {
|
|
4
44
|
content: [
|
|
@@ -10,18 +50,18 @@ export const dropdownMenuVariants = tv({
|
|
|
10
50
|
'focus:outline-none',
|
|
11
51
|
'overflow-hidden'
|
|
12
52
|
],
|
|
53
|
+
arrow: 'fill-surface-container-low text-surface-container-low',
|
|
13
54
|
group: 'p-1',
|
|
14
55
|
separator: '-mx-1 my-1 h-px bg-outline-variant',
|
|
15
56
|
label: 'px-2 py-1.5 text-xs font-semibold text-on-surface-variant',
|
|
16
57
|
item: [
|
|
17
58
|
'group relative flex items-center gap-2 w-full rounded-sm px-2 cursor-pointer select-none',
|
|
18
59
|
'focus:outline-none',
|
|
19
|
-
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
|
|
20
|
-
'data-[highlighted]:bg-surface-container-highest'
|
|
60
|
+
'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
|
|
21
61
|
],
|
|
22
|
-
|
|
62
|
+
itemLeadingIcon: 'shrink-0',
|
|
23
63
|
itemLabel: 'flex-1 truncate',
|
|
24
|
-
|
|
64
|
+
itemTrailingKbds: 'ml-auto flex items-center gap-0.5',
|
|
25
65
|
itemIndicator: 'shrink-0',
|
|
26
66
|
subTrigger: [
|
|
27
67
|
'relative flex items-center gap-2 w-full rounded-sm px-2 cursor-pointer select-none',
|
|
@@ -39,151 +79,68 @@ export const dropdownMenuVariants = tv({
|
|
|
39
79
|
'shadow-lg',
|
|
40
80
|
'focus:outline-none',
|
|
41
81
|
'overflow-hidden'
|
|
42
|
-
]
|
|
43
|
-
checkboxIndicator: 'shrink-0',
|
|
44
|
-
radioIndicator: 'shrink-0'
|
|
82
|
+
]
|
|
45
83
|
},
|
|
46
84
|
variants: {
|
|
47
|
-
side: {
|
|
48
|
-
top: {
|
|
49
|
-
content: 'data-[state=open]:animate-[slide-in-from-bottom_150ms_ease-out] data-[state=closed]:animate-[slide-in-from-top_100ms_ease-in_reverse]'
|
|
50
|
-
},
|
|
51
|
-
right: {
|
|
52
|
-
content: 'data-[state=open]:animate-[slide-in-from-left_150ms_ease-out] data-[state=closed]:animate-[slide-in-from-right_100ms_ease-in_reverse]'
|
|
53
|
-
},
|
|
54
|
-
bottom: {
|
|
55
|
-
content: 'data-[state=open]:animate-[slide-in-from-top_150ms_ease-out] data-[state=closed]:animate-[slide-in-from-bottom_100ms_ease-in_reverse]'
|
|
56
|
-
},
|
|
57
|
-
left: {
|
|
58
|
-
content: 'data-[state=open]:animate-[slide-in-from-right_150ms_ease-out] data-[state=closed]:animate-[slide-in-from-left_100ms_ease-in_reverse]'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
85
|
transition: {
|
|
62
86
|
true: {
|
|
63
|
-
content:
|
|
64
|
-
|
|
87
|
+
content: [
|
|
88
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
89
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
90
|
+
'data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2',
|
|
91
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2'
|
|
92
|
+
],
|
|
93
|
+
subContent: [
|
|
94
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
95
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
96
|
+
'data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2',
|
|
97
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2'
|
|
98
|
+
]
|
|
65
99
|
}
|
|
66
100
|
},
|
|
67
101
|
size: {
|
|
68
102
|
xs: {
|
|
69
103
|
item: 'py-1 text-xs',
|
|
70
104
|
subTrigger: 'py-1 text-xs',
|
|
71
|
-
|
|
105
|
+
itemLeadingIcon: 'size-3',
|
|
72
106
|
subTriggerIcon: 'size-3',
|
|
73
|
-
|
|
74
|
-
radioIndicator: 'size-3',
|
|
107
|
+
itemIndicator: 'size-3',
|
|
75
108
|
label: 'text-[10px]'
|
|
76
109
|
},
|
|
77
110
|
sm: {
|
|
78
111
|
item: 'py-1.5 text-xs',
|
|
79
112
|
subTrigger: 'py-1.5 text-xs',
|
|
80
|
-
|
|
113
|
+
itemLeadingIcon: 'size-3.5',
|
|
81
114
|
subTriggerIcon: 'size-3.5',
|
|
82
|
-
|
|
83
|
-
radioIndicator: 'size-3.5',
|
|
115
|
+
itemIndicator: 'size-3.5',
|
|
84
116
|
label: 'text-[11px]'
|
|
85
117
|
},
|
|
86
118
|
md: {
|
|
87
119
|
item: 'py-1.5 text-sm',
|
|
88
120
|
subTrigger: 'py-1.5 text-sm',
|
|
89
|
-
|
|
121
|
+
itemLeadingIcon: 'size-4',
|
|
90
122
|
subTriggerIcon: 'size-4',
|
|
91
|
-
|
|
92
|
-
radioIndicator: 'size-4'
|
|
123
|
+
itemIndicator: 'size-4'
|
|
93
124
|
},
|
|
94
125
|
lg: {
|
|
95
126
|
item: 'py-2 text-sm',
|
|
96
127
|
subTrigger: 'py-2 text-sm',
|
|
97
|
-
|
|
128
|
+
itemLeadingIcon: 'size-5',
|
|
98
129
|
subTriggerIcon: 'size-5',
|
|
99
|
-
|
|
100
|
-
radioIndicator: 'size-5'
|
|
130
|
+
itemIndicator: 'size-5'
|
|
101
131
|
},
|
|
102
132
|
xl: {
|
|
103
133
|
item: 'py-2.5 text-base',
|
|
104
134
|
subTrigger: 'py-2.5 text-base',
|
|
105
|
-
|
|
135
|
+
itemLeadingIcon: 'size-5',
|
|
106
136
|
subTriggerIcon: 'size-5',
|
|
107
|
-
|
|
108
|
-
radioIndicator: 'size-5'
|
|
137
|
+
itemIndicator: 'size-5'
|
|
109
138
|
}
|
|
110
|
-
},
|
|
111
|
-
color: {
|
|
112
|
-
default: {},
|
|
113
|
-
primary: {},
|
|
114
|
-
secondary: {},
|
|
115
|
-
tertiary: {},
|
|
116
|
-
success: {},
|
|
117
|
-
warning: {},
|
|
118
|
-
error: {},
|
|
119
|
-
info: {},
|
|
120
|
-
surface: {}
|
|
121
139
|
}
|
|
122
140
|
},
|
|
123
|
-
compoundVariants: [
|
|
124
|
-
// Color variants for items (primarily for destructive/error actions)
|
|
125
|
-
{
|
|
126
|
-
color: 'error',
|
|
127
|
-
class: {
|
|
128
|
-
item: 'text-error data-[highlighted]:bg-error-container data-[highlighted]:text-on-error-container',
|
|
129
|
-
itemIcon: 'text-error group-data-[highlighted]:text-on-error-container'
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
color: 'success',
|
|
134
|
-
class: {
|
|
135
|
-
item: 'text-success data-[highlighted]:bg-success-container data-[highlighted]:text-on-success-container',
|
|
136
|
-
itemIcon: 'text-success group-data-[highlighted]:text-on-success-container'
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
color: 'warning',
|
|
141
|
-
class: {
|
|
142
|
-
item: 'text-warning data-[highlighted]:bg-warning-container data-[highlighted]:text-on-warning-container',
|
|
143
|
-
itemIcon: 'text-warning group-data-[highlighted]:text-on-warning-container'
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
color: 'info',
|
|
148
|
-
class: {
|
|
149
|
-
item: 'text-info data-[highlighted]:bg-info-container data-[highlighted]:text-on-info-container',
|
|
150
|
-
itemIcon: 'text-info group-data-[highlighted]:text-on-info-container'
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
color: 'primary',
|
|
155
|
-
class: {
|
|
156
|
-
item: 'text-primary data-[highlighted]:bg-primary-container data-[highlighted]:text-on-primary-container',
|
|
157
|
-
itemIcon: 'text-primary group-data-[highlighted]:text-on-primary-container'
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
color: 'secondary',
|
|
162
|
-
class: {
|
|
163
|
-
item: 'text-secondary data-[highlighted]:bg-secondary-container data-[highlighted]:text-on-secondary-container',
|
|
164
|
-
itemIcon: 'text-secondary group-data-[highlighted]:text-on-secondary-container'
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
color: 'tertiary',
|
|
169
|
-
class: {
|
|
170
|
-
item: 'text-tertiary data-[highlighted]:bg-tertiary-container data-[highlighted]:text-on-tertiary-container',
|
|
171
|
-
itemIcon: 'text-tertiary group-data-[highlighted]:text-on-tertiary-container'
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
color: 'surface',
|
|
176
|
-
class: {
|
|
177
|
-
item: 'text-on-surface-variant data-[highlighted]:bg-surface-container-highest data-[highlighted]:text-on-surface',
|
|
178
|
-
itemIcon: 'text-on-surface-variant group-data-[highlighted]:text-on-surface'
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
141
|
defaultVariants: {
|
|
183
|
-
side: 'bottom',
|
|
184
142
|
transition: true,
|
|
185
|
-
size: 'md'
|
|
186
|
-
color: 'default'
|
|
143
|
+
size: 'md'
|
|
187
144
|
}
|
|
188
145
|
});
|
|
189
146
|
export const dropdownMenuDefaults = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as DropdownMenu } from './DropdownMenu.svelte';
|
|
2
|
-
export type { DropdownMenuProps, DropdownMenuItem, DropdownMenuRadioGroup } from './dropdown-menu.types.js';
|
|
2
|
+
export type { DropdownMenuProps, DropdownMenuItem, DropdownMenuItemColor, DropdownMenuRadioGroup } from './dropdown-menu.types.js';
|
package/dist/Empty/Empty.svelte
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
const config = getComponentConfig('empty', emptyDefaults)
|
|
15
15
|
|
|
16
16
|
let {
|
|
17
|
+
ref = $bindable(null),
|
|
17
18
|
as = 'div',
|
|
18
19
|
ui,
|
|
19
20
|
icon,
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
title,
|
|
22
23
|
description,
|
|
23
24
|
actions,
|
|
24
|
-
color = config.defaultVariants.color,
|
|
25
25
|
variant = config.defaultVariants.variant,
|
|
26
26
|
size = config.defaultVariants.size,
|
|
27
27
|
class: className,
|
|
@@ -29,55 +29,90 @@
|
|
|
29
29
|
titleSlot,
|
|
30
30
|
descriptionSlot,
|
|
31
31
|
actionsSlot,
|
|
32
|
+
header,
|
|
33
|
+
body,
|
|
34
|
+
footer,
|
|
32
35
|
children,
|
|
33
36
|
...restProps
|
|
34
37
|
}: Props = $props()
|
|
35
38
|
|
|
36
39
|
const classes = $derived.by(() => {
|
|
37
|
-
const slots = emptyVariants({ variant,
|
|
40
|
+
const slots = emptyVariants({ variant, size })
|
|
41
|
+
const c = config.slots
|
|
38
42
|
return {
|
|
39
|
-
root: slots.root({ class: [
|
|
40
|
-
|
|
41
|
-
avatar: slots.avatar({ class: [
|
|
42
|
-
title: slots.title({ class: [
|
|
43
|
-
description: slots.description({ class: [
|
|
44
|
-
|
|
43
|
+
root: slots.root({ class: [c.root, className, ui?.root] }),
|
|
44
|
+
header: slots.header({ class: [c.header, ui?.header] }),
|
|
45
|
+
avatar: slots.avatar({ class: [c.avatar, ui?.avatar] }),
|
|
46
|
+
title: slots.title({ class: [c.title, ui?.title] }),
|
|
47
|
+
description: slots.description({ class: [c.description, ui?.description] }),
|
|
48
|
+
body: slots.body({ class: [c.body, ui?.body] }),
|
|
49
|
+
actions: slots.actions({ class: [c.actions, ui?.actions] }),
|
|
50
|
+
footer: slots.footer({ class: [c.footer, ui?.footer] })
|
|
45
51
|
}
|
|
46
52
|
})
|
|
47
53
|
|
|
54
|
+
const hasHeader = $derived(
|
|
55
|
+
!!icon ||
|
|
56
|
+
!!avatar ||
|
|
57
|
+
!!title ||
|
|
58
|
+
!!description ||
|
|
59
|
+
!!leading ||
|
|
60
|
+
!!titleSlot ||
|
|
61
|
+
!!descriptionSlot ||
|
|
62
|
+
!!header
|
|
63
|
+
)
|
|
48
64
|
const hasActions = $derived(actions && actions.length > 0)
|
|
65
|
+
const hasBody = $derived(!!hasActions || !!actionsSlot || !!body || !!children)
|
|
49
66
|
</script>
|
|
50
67
|
|
|
51
|
-
<svelte:element this={as} class={classes.root} {...restProps}>
|
|
52
|
-
{#if
|
|
53
|
-
{@render
|
|
54
|
-
{:else if
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
<svelte:element this={as} bind:this={ref} class={classes.root} {...restProps}>
|
|
69
|
+
{#if header}
|
|
70
|
+
{@render header()}
|
|
71
|
+
{:else if hasHeader}
|
|
72
|
+
<div class={classes.header}>
|
|
73
|
+
{#if leading}
|
|
74
|
+
{@render leading()}
|
|
75
|
+
{:else if icon}
|
|
76
|
+
<Icon name={icon} class={classes.avatar} />
|
|
77
|
+
{:else if avatar}
|
|
78
|
+
<Avatar {...avatar} class={classes.avatar} />
|
|
79
|
+
{/if}
|
|
59
80
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
81
|
+
{#if titleSlot}
|
|
82
|
+
{@render titleSlot()}
|
|
83
|
+
{:else if title}
|
|
84
|
+
<p class={classes.title}>{title}</p>
|
|
85
|
+
{/if}
|
|
65
86
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
{#if descriptionSlot}
|
|
88
|
+
{@render descriptionSlot()}
|
|
89
|
+
{:else if description}
|
|
90
|
+
<p class={classes.description}>{description}</p>
|
|
91
|
+
{/if}
|
|
92
|
+
</div>
|
|
70
93
|
{/if}
|
|
71
94
|
|
|
72
|
-
{
|
|
95
|
+
{#if body}
|
|
96
|
+
{@render body()}
|
|
97
|
+
{:else if hasBody}
|
|
98
|
+
<div class={classes.body}>
|
|
99
|
+
{@render children?.()}
|
|
100
|
+
|
|
101
|
+
{#if actionsSlot}
|
|
102
|
+
{@render actionsSlot()}
|
|
103
|
+
{:else if hasActions}
|
|
104
|
+
<div class={classes.actions}>
|
|
105
|
+
{#each actions as action, index (index)}
|
|
106
|
+
<Button size="sm" {...action} />
|
|
107
|
+
{/each}
|
|
108
|
+
</div>
|
|
109
|
+
{/if}
|
|
110
|
+
</div>
|
|
111
|
+
{/if}
|
|
73
112
|
|
|
74
|
-
{#if
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
<div class={classes.actions}>
|
|
78
|
-
{#each actions as action, index (index)}
|
|
79
|
-
<Button size="sm" {...action} />
|
|
80
|
-
{/each}
|
|
113
|
+
{#if footer}
|
|
114
|
+
<div class={classes.footer}>
|
|
115
|
+
{@render footer()}
|
|
81
116
|
</div>
|
|
82
117
|
{/if}
|
|
83
118
|
</svelte:element>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EmptyProps } from './empty.types.js';
|
|
2
2
|
export type Props = EmptyProps;
|
|
3
|
-
declare const Empty: import("svelte").Component<EmptyProps, {}, "">;
|
|
3
|
+
declare const Empty: import("svelte").Component<EmptyProps, {}, "ref">;
|
|
4
4
|
type Empty = ReturnType<typeof Empty>;
|
|
5
5
|
export default Empty;
|
|
@@ -5,22 +5,26 @@ import type { EmptyVariantProps, EmptySlots } from './empty.variants.js';
|
|
|
5
5
|
import type { AvatarProps } from '../Avatar/avatar.types.js';
|
|
6
6
|
import type { ButtonProps } from '../Button/button.types.js';
|
|
7
7
|
export type EmptyProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'title'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Bindable reference to the root DOM element.
|
|
10
|
+
*/
|
|
11
|
+
ref?: HTMLElement | null;
|
|
8
12
|
/**
|
|
9
13
|
* Renders the empty state as a different HTML element.
|
|
10
14
|
* @default 'div'
|
|
11
15
|
*/
|
|
12
16
|
as?: keyof HTMLElementTagNameMap;
|
|
13
17
|
/**
|
|
14
|
-
* Override styles for specific empty slots
|
|
18
|
+
* Override styles for specific empty slots.
|
|
15
19
|
*/
|
|
16
20
|
ui?: Partial<Record<EmptySlots, ClassNameValue>>;
|
|
17
21
|
/**
|
|
18
|
-
* Icon to display in the
|
|
22
|
+
* Icon to display in the header area.
|
|
19
23
|
* Takes precedence over avatar when both are provided.
|
|
20
24
|
*/
|
|
21
25
|
icon?: string;
|
|
22
26
|
/**
|
|
23
|
-
* Avatar configuration to display
|
|
27
|
+
* Avatar configuration to display in the header area.
|
|
24
28
|
* Only visible when icon is not specified.
|
|
25
29
|
*/
|
|
26
30
|
avatar?: AvatarProps;
|
|
@@ -36,18 +40,13 @@ export type EmptyProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'title'>
|
|
|
36
40
|
* Array of button configurations to render as action buttons.
|
|
37
41
|
*/
|
|
38
42
|
actions?: ButtonProps[];
|
|
39
|
-
/**
|
|
40
|
-
* Controls the color scheme applied to the empty state.
|
|
41
|
-
* @default 'surface'
|
|
42
|
-
*/
|
|
43
|
-
color?: NonNullable<EmptyVariantProps['color']>;
|
|
44
43
|
/**
|
|
45
44
|
* Controls the visual style and background treatment.
|
|
46
45
|
* @default 'outline'
|
|
47
46
|
*/
|
|
48
47
|
variant?: NonNullable<EmptyVariantProps['variant']>;
|
|
49
48
|
/**
|
|
50
|
-
* Controls the overall dimensions
|
|
49
|
+
* Controls the overall dimensions and typography scale.
|
|
51
50
|
* @default 'md'
|
|
52
51
|
*/
|
|
53
52
|
size?: NonNullable<EmptyVariantProps['size']>;
|
|
@@ -71,4 +70,22 @@ export type EmptyProps = Omit<HTMLAttributes<HTMLDivElement>, 'class' | 'title'>
|
|
|
71
70
|
* Custom content to replace the default action buttons.
|
|
72
71
|
*/
|
|
73
72
|
actionsSlot?: Snippet;
|
|
73
|
+
/**
|
|
74
|
+
* Custom header slot content.
|
|
75
|
+
* Replaces the entire header area (leading/icon/avatar + title + description).
|
|
76
|
+
*/
|
|
77
|
+
header?: Snippet;
|
|
78
|
+
/**
|
|
79
|
+
* Custom body slot content.
|
|
80
|
+
* Replaces the entire body area (actions).
|
|
81
|
+
*/
|
|
82
|
+
body?: Snippet;
|
|
83
|
+
/**
|
|
84
|
+
* Custom footer slot content.
|
|
85
|
+
*/
|
|
86
|
+
footer?: Snippet;
|
|
87
|
+
/**
|
|
88
|
+
* Default slot content rendered in the body area.
|
|
89
|
+
*/
|
|
90
|
+
children?: Snippet;
|
|
74
91
|
};
|