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
|
@@ -13,21 +13,27 @@
|
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
15
|
import { DropdownMenu } from 'bits-ui'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
dropdownMenuVariants,
|
|
18
|
+
dropdownMenuDefaults,
|
|
19
|
+
itemColorClasses
|
|
20
|
+
} from './dropdown-menu.variants.js'
|
|
17
21
|
import { getComponentConfig, iconsDefaults } from '../config.js'
|
|
18
22
|
import Icon from '../Icon/Icon.svelte'
|
|
19
23
|
import Kbd from '../Kbd/Kbd.svelte'
|
|
20
24
|
|
|
21
25
|
const config = getComponentConfig('dropdownMenu', dropdownMenuDefaults)
|
|
26
|
+
const icons = getComponentConfig('icons', iconsDefaults)
|
|
22
27
|
|
|
23
28
|
let {
|
|
29
|
+
ref = $bindable(null),
|
|
24
30
|
open = $bindable(false),
|
|
25
31
|
onOpenChange,
|
|
26
32
|
items = [],
|
|
27
33
|
radioGroups = [],
|
|
28
|
-
checkedIcon =
|
|
29
|
-
submenuIcon =
|
|
30
|
-
side =
|
|
34
|
+
checkedIcon = icons.check,
|
|
35
|
+
submenuIcon = icons.chevronRight,
|
|
36
|
+
side = 'bottom',
|
|
31
37
|
sideOffset = 4,
|
|
32
38
|
align = 'start',
|
|
33
39
|
alignOffset = 0,
|
|
@@ -57,36 +63,34 @@
|
|
|
57
63
|
content: contentSlot
|
|
58
64
|
}: Props = $props()
|
|
59
65
|
|
|
60
|
-
// Pre-compute booleans
|
|
61
|
-
const showArrow = $derived(!!arrow)
|
|
62
66
|
const hasRadioItems = $derived(items.some((i) => i.type === 'radio'))
|
|
63
67
|
const firstRadioGroup = $derived(radioGroups[0])
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
const variantSlots = $derived(dropdownMenuVariants({ side, transition, size }))
|
|
69
|
+
const variantSlots = $derived(dropdownMenuVariants({ transition, size }))
|
|
67
70
|
const classes = $derived({
|
|
68
71
|
content: variantSlots.content({ class: [config.slots.content, ui?.content] }),
|
|
72
|
+
arrow: variantSlots.arrow({ class: [config.slots.arrow, ui?.arrow] }),
|
|
69
73
|
group: variantSlots.group({ class: [config.slots.group, ui?.group] }),
|
|
70
74
|
separator: variantSlots.separator({ class: [config.slots.separator, ui?.separator] }),
|
|
71
75
|
label: variantSlots.label({ class: [config.slots.label, ui?.label] }),
|
|
72
76
|
item: variantSlots.item({ class: [config.slots.item, ui?.item] }),
|
|
73
|
-
|
|
77
|
+
itemLeadingIcon: variantSlots.itemLeadingIcon({
|
|
78
|
+
class: [config.slots.itemLeadingIcon, ui?.itemLeadingIcon]
|
|
79
|
+
}),
|
|
74
80
|
itemLabel: variantSlots.itemLabel({ class: [config.slots.itemLabel, ui?.itemLabel] }),
|
|
75
|
-
|
|
81
|
+
itemTrailingKbds: variantSlots.itemTrailingKbds({
|
|
82
|
+
class: [config.slots.itemTrailingKbds, ui?.itemTrailingKbds]
|
|
83
|
+
}),
|
|
84
|
+
itemIndicator: variantSlots.itemIndicator({
|
|
85
|
+
class: [config.slots.itemIndicator, ui?.itemIndicator]
|
|
86
|
+
}),
|
|
76
87
|
subTrigger: variantSlots.subTrigger({ class: [config.slots.subTrigger, ui?.subTrigger] }),
|
|
77
88
|
subTriggerIcon: variantSlots.subTriggerIcon({
|
|
78
89
|
class: [config.slots.subTriggerIcon, ui?.subTriggerIcon]
|
|
79
90
|
}),
|
|
80
|
-
subContent: variantSlots.subContent({ class: [config.slots.subContent, ui?.subContent] })
|
|
81
|
-
checkboxIndicator: variantSlots.checkboxIndicator({
|
|
82
|
-
class: [config.slots.checkboxIndicator, ui?.checkboxIndicator]
|
|
83
|
-
}),
|
|
84
|
-
radioIndicator: variantSlots.radioIndicator({
|
|
85
|
-
class: [config.slots.radioIndicator, ui?.radioIndicator]
|
|
86
|
-
})
|
|
91
|
+
subContent: variantSlots.subContent({ class: [config.slots.subContent, ui?.subContent] })
|
|
87
92
|
})
|
|
88
93
|
|
|
89
|
-
// Arrow props
|
|
90
94
|
const arrowProps = $derived.by(() => {
|
|
91
95
|
if (typeof arrow === 'object') return { width: 12, height: 6, ...arrow }
|
|
92
96
|
return { width: 12, height: 6 }
|
|
@@ -96,20 +100,6 @@
|
|
|
96
100
|
open = false
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
function handleOpenChange(value: boolean) {
|
|
100
|
-
open = value
|
|
101
|
-
onOpenChange?.(value)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Get classes for action items with color variants
|
|
105
|
-
function getItemClasses(item: DropdownMenuItemAction) {
|
|
106
|
-
const colorVariant = dropdownMenuVariants({ size, color: item.color ?? 'default' })
|
|
107
|
-
return {
|
|
108
|
-
item: colorVariant.item({ class: [config.slots.item, ui?.item, item.class] }),
|
|
109
|
-
itemIcon: colorVariant.itemIcon({ class: [config.slots.itemIcon, ui?.itemIcon] })
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
103
|
// Type guards
|
|
114
104
|
function isActionItem(item: DropdownMenuItem): item is DropdownMenuItemAction {
|
|
115
105
|
return !item.type || item.type === 'item'
|
|
@@ -138,7 +128,7 @@
|
|
|
138
128
|
|
|
139
129
|
{#snippet renderKbds(kbds: DropdownMenuItemAction['kbds'])}
|
|
140
130
|
{#if kbds?.length}
|
|
141
|
-
<span class={classes.
|
|
131
|
+
<span class={classes.itemTrailingKbds}>
|
|
142
132
|
{#each kbds as kbd, i (i)}
|
|
143
133
|
{#if typeof kbd === 'string'}
|
|
144
134
|
<Kbd value={kbd} size="sm" variant="subtle" />
|
|
@@ -156,17 +146,20 @@
|
|
|
156
146
|
{:else if isLabel(item)}
|
|
157
147
|
<DropdownMenu.GroupHeading class={classes.label}>{item.label}</DropdownMenu.GroupHeading>
|
|
158
148
|
{:else if isActionItem(item)}
|
|
159
|
-
{@const
|
|
149
|
+
{@const colorCls = itemColorClasses[item.color ?? 'default']}
|
|
160
150
|
<DropdownMenu.Item
|
|
161
151
|
disabled={item.disabled}
|
|
162
152
|
closeOnSelect={item.closeOnSelect}
|
|
163
153
|
onSelect={item.onSelect}
|
|
164
|
-
class={
|
|
154
|
+
class={[classes.item, colorCls.item, item.class]}
|
|
165
155
|
>
|
|
166
156
|
{#if itemLeading}
|
|
167
157
|
{@render itemLeading({ item, index })}
|
|
168
158
|
{:else if item.icon}
|
|
169
|
-
<Icon
|
|
159
|
+
<Icon
|
|
160
|
+
name={item.icon}
|
|
161
|
+
class={[classes.itemLeadingIcon, colorCls.itemLeadingIcon]}
|
|
162
|
+
/>
|
|
170
163
|
{/if}
|
|
171
164
|
|
|
172
165
|
{#if itemLabel}
|
|
@@ -192,9 +185,9 @@
|
|
|
192
185
|
{#if itemLeading}
|
|
193
186
|
{@render itemLeading({ item, index })}
|
|
194
187
|
{:else}
|
|
195
|
-
<span class={classes.
|
|
188
|
+
<span class={classes.itemIndicator}>
|
|
196
189
|
{#if item.checked}
|
|
197
|
-
<Icon name={checkedIcon}
|
|
190
|
+
<Icon name={checkedIcon} />
|
|
198
191
|
{/if}
|
|
199
192
|
</span>
|
|
200
193
|
{/if}
|
|
@@ -221,9 +214,9 @@
|
|
|
221
214
|
{#if itemLeading}
|
|
222
215
|
{@render itemLeading({ item, index })}
|
|
223
216
|
{:else}
|
|
224
|
-
<span class={classes.
|
|
217
|
+
<span class={classes.itemIndicator}>
|
|
225
218
|
{#if firstRadioGroup?.value === item.value}
|
|
226
|
-
<Icon name={checkedIcon}
|
|
219
|
+
<Icon name={checkedIcon} />
|
|
227
220
|
{/if}
|
|
228
221
|
</span>
|
|
229
222
|
{/if}
|
|
@@ -249,7 +242,7 @@
|
|
|
249
242
|
{#if itemLeading}
|
|
250
243
|
{@render itemLeading({ item, index })}
|
|
251
244
|
{:else if item.icon}
|
|
252
|
-
<Icon name={item.icon} class={classes.
|
|
245
|
+
<Icon name={item.icon} class={classes.itemLeadingIcon} />
|
|
253
246
|
{/if}
|
|
254
247
|
|
|
255
248
|
{#if itemLabel}
|
|
@@ -298,6 +291,7 @@
|
|
|
298
291
|
|
|
299
292
|
{#snippet dropdownContentEl()}
|
|
300
293
|
<DropdownMenu.Content
|
|
294
|
+
bind:ref
|
|
301
295
|
{side}
|
|
302
296
|
{sideOffset}
|
|
303
297
|
{align}
|
|
@@ -344,13 +338,13 @@
|
|
|
344
338
|
{/if}
|
|
345
339
|
{/if}
|
|
346
340
|
|
|
347
|
-
{#if
|
|
341
|
+
{#if !!arrow}
|
|
348
342
|
<DropdownMenu.Arrow width={arrowProps.width} height={arrowProps.height} />
|
|
349
343
|
{/if}
|
|
350
344
|
</DropdownMenu.Content>
|
|
351
345
|
{/snippet}
|
|
352
346
|
|
|
353
|
-
<DropdownMenu.Root bind:open onOpenChange
|
|
347
|
+
<DropdownMenu.Root bind:open {onOpenChange}>
|
|
354
348
|
{#if children}
|
|
355
349
|
<DropdownMenu.Trigger>
|
|
356
350
|
{#snippet child({ props })}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DropdownMenuProps } from './dropdown-menu.types.js';
|
|
2
2
|
export type Props = DropdownMenuProps;
|
|
3
3
|
import { DropdownMenu } from 'bits-ui';
|
|
4
|
-
declare const DropdownMenu: import("svelte").Component<DropdownMenuProps, {}, "open">;
|
|
4
|
+
declare const DropdownMenu: import("svelte").Component<DropdownMenuProps, {}, "ref" | "open">;
|
|
5
5
|
type DropdownMenu = ReturnType<typeof DropdownMenu>;
|
|
6
6
|
export default DropdownMenu;
|
|
@@ -3,6 +3,8 @@ import type { ClassNameValue } from 'tailwind-merge';
|
|
|
3
3
|
import type { DropdownMenuSlots, DropdownMenuVariantProps } from './dropdown-menu.variants.js';
|
|
4
4
|
import type { KbdProps } from '../Kbd/kbd.types.js';
|
|
5
5
|
import type { DropdownMenuRootPropsWithoutHTML, DropdownMenuContentPropsWithoutHTML, DropdownMenuArrowPropsWithoutHTML } from 'bits-ui';
|
|
6
|
+
import { itemColorClasses } from './dropdown-menu.variants.js';
|
|
7
|
+
export type DropdownMenuItemColor = Exclude<keyof typeof itemColorClasses, 'default'>;
|
|
6
8
|
/**
|
|
7
9
|
* Base item properties shared across all item types.
|
|
8
10
|
*/
|
|
@@ -49,7 +51,7 @@ export interface DropdownMenuItemAction extends DropdownMenuItemBase {
|
|
|
49
51
|
/**
|
|
50
52
|
* Color variant for the item (useful for destructive actions).
|
|
51
53
|
*/
|
|
52
|
-
color?:
|
|
54
|
+
color?: DropdownMenuItemColor;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Checkbox menu item for toggling boolean state.
|
|
@@ -166,6 +168,10 @@ type ContentProps = Pick<DropdownMenuContentPropsWithoutHTML, 'side' | 'sideOffs
|
|
|
166
168
|
* @see https://bits-ui.com/docs/components/dropdown-menu
|
|
167
169
|
*/
|
|
168
170
|
export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
171
|
+
/**
|
|
172
|
+
* Bindable reference to the content DOM element.
|
|
173
|
+
*/
|
|
174
|
+
ref?: HTMLElement | null;
|
|
169
175
|
/**
|
|
170
176
|
* Array of menu items to render.
|
|
171
177
|
* Each item can be an action, checkbox, radio, separator, label, or submenu.
|
|
@@ -196,7 +202,7 @@ export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
|
196
202
|
* Animate the dropdown on open and close.
|
|
197
203
|
* @default true
|
|
198
204
|
*/
|
|
199
|
-
transition?: DropdownMenuVariantProps['transition']
|
|
205
|
+
transition?: NonNullable<DropdownMenuVariantProps['transition']>;
|
|
200
206
|
/**
|
|
201
207
|
* Render the dropdown content in a portal.
|
|
202
208
|
* @default true
|
|
@@ -206,7 +212,7 @@ export interface DropdownMenuProps extends RootProps, ContentProps {
|
|
|
206
212
|
* Size variant for the dropdown menu.
|
|
207
213
|
* @default 'md'
|
|
208
214
|
*/
|
|
209
|
-
size?: DropdownMenuVariantProps['size']
|
|
215
|
+
size?: NonNullable<DropdownMenuVariantProps['size']>;
|
|
210
216
|
/**
|
|
211
217
|
* Additional CSS class for the trigger wrapper.
|
|
212
218
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { itemColorClasses } from './dropdown-menu.variants.js';
|