@sprawlify/svelte 0.0.78 → 0.0.79
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/dist/components/alert-dialog/alert-dialog-anatomy.d.ts +2 -2
- package/dist/components/anatomy.d.ts +1 -1
- package/dist/components/anatomy.js +1 -1
- package/dist/components/carousel/carousel-anatomy.d.ts +1 -1
- package/dist/components/color-picker/color-picker-anatomy.d.ts +1 -1
- package/dist/components/combobox/combobox-anatomy.d.ts +1 -1
- package/dist/components/date-picker/date-picker-anatomy.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-anatomy.d.ts +1 -0
- package/dist/components/dropdown-menu/dropdown-menu-anatomy.js +1 -0
- package/dist/components/dropdown-menu/dropdown-menu-arrow-tip.svelte +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-arrow-tip.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-arrow.svelte +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-arrow.svelte.d.ts +8 -0
- package/dist/components/{menu/menu-checkbox-item.svelte → dropdown-menu/dropdown-menu-checkbox-item.svelte} +12 -12
- package/dist/components/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +10 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.svelte +27 -0
- package/dist/components/dropdown-menu/dropdown-menu-content.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-context.svelte +17 -0
- package/dist/components/dropdown-menu/dropdown-menu-context.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-indicator.svelte +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-indicator.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-context.svelte +14 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-context.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-group-label.svelte +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-group-label.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-group.svelte +27 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-group.svelte.d.ts +10 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-indicator.svelte +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-indicator.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-text.svelte +21 -0
- package/dist/components/dropdown-menu/dropdown-menu-item-text.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-item.svelte +42 -0
- package/dist/components/dropdown-menu/dropdown-menu-item.svelte.d.ts +12 -0
- package/dist/components/dropdown-menu/dropdown-menu-positioner.svelte +23 -0
- package/dist/components/dropdown-menu/dropdown-menu-positioner.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item-group.svelte +44 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item-group.svelte.d.ts +10 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item.svelte +43 -0
- package/dist/components/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +10 -0
- package/dist/components/{menu/menu-root-provider.svelte → dropdown-menu/dropdown-menu-root-provider.svelte} +13 -13
- package/dist/components/dropdown-menu/dropdown-menu-root-provider.svelte.d.ts +14 -0
- package/dist/components/{menu/menu-root.svelte → dropdown-menu/dropdown-menu-root.svelte} +22 -22
- package/dist/components/dropdown-menu/dropdown-menu-root.svelte.d.ts +11 -0
- package/dist/components/dropdown-menu/dropdown-menu-separator.svelte +19 -0
- package/dist/components/dropdown-menu/dropdown-menu-separator.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger-item.svelte +22 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger-item.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.svelte +22 -0
- package/dist/components/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +8 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +21 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +20 -0
- package/dist/components/dropdown-menu/index.d.ts +27 -0
- package/dist/components/dropdown-menu/index.js +25 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-context.d.ts +4 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-context.js +7 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-item-context.d.ts +5 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-item-context.js +6 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-item-group-context.d.ts +11 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-item-group-context.js +6 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-machine-context.d.ts +4 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-machine-context.js +7 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-option-item-props-context.d.ts +3 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-option-item-props-context.js +6 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-trigger-item-context.d.ts +4 -0
- package/dist/components/dropdown-menu/use-dropdown-menu-trigger-item-context.js +7 -0
- package/dist/components/dropdown-menu/use-dropdown-menu.svelte.d.ts +12 -0
- package/dist/components/{menu/use-menu.svelte.js → dropdown-menu/use-dropdown-menu.svelte.js} +4 -4
- package/dist/components/listbox/listbox-anatomy.d.ts +1 -1
- package/dist/components/tour/tour-anatomy.d.ts +1 -1
- package/dist/components/tree-view/tree-view-split-props.d.ts +1 -1
- package/package.json +7 -7
- package/dist/components/menu/index.d.ts +0 -28
- package/dist/components/menu/index.js +0 -26
- package/dist/components/menu/menu-anatomy.d.ts +0 -1
- package/dist/components/menu/menu-anatomy.js +0 -1
- package/dist/components/menu/menu-arrow-tip.svelte +0 -19
- package/dist/components/menu/menu-arrow-tip.svelte.d.ts +0 -8
- package/dist/components/menu/menu-arrow.svelte +0 -19
- package/dist/components/menu/menu-arrow.svelte.d.ts +0 -8
- package/dist/components/menu/menu-checkbox-item.svelte.d.ts +0 -10
- package/dist/components/menu/menu-content.svelte +0 -27
- package/dist/components/menu/menu-content.svelte.d.ts +0 -8
- package/dist/components/menu/menu-context-trigger.svelte +0 -19
- package/dist/components/menu/menu-context-trigger.svelte.d.ts +0 -8
- package/dist/components/menu/menu-context.svelte +0 -17
- package/dist/components/menu/menu-context.svelte.d.ts +0 -8
- package/dist/components/menu/menu-indicator.svelte +0 -19
- package/dist/components/menu/menu-indicator.svelte.d.ts +0 -8
- package/dist/components/menu/menu-item-context.svelte +0 -14
- package/dist/components/menu/menu-item-context.svelte.d.ts +0 -8
- package/dist/components/menu/menu-item-group-label.svelte +0 -21
- package/dist/components/menu/menu-item-group-label.svelte.d.ts +0 -8
- package/dist/components/menu/menu-item-group.svelte +0 -27
- package/dist/components/menu/menu-item-group.svelte.d.ts +0 -10
- package/dist/components/menu/menu-item-indicator.svelte +0 -21
- package/dist/components/menu/menu-item-indicator.svelte.d.ts +0 -8
- package/dist/components/menu/menu-item-text.svelte +0 -21
- package/dist/components/menu/menu-item-text.svelte.d.ts +0 -8
- package/dist/components/menu/menu-item.svelte +0 -42
- package/dist/components/menu/menu-item.svelte.d.ts +0 -12
- package/dist/components/menu/menu-positioner.svelte +0 -23
- package/dist/components/menu/menu-positioner.svelte.d.ts +0 -8
- package/dist/components/menu/menu-radio-item-group.svelte +0 -44
- package/dist/components/menu/menu-radio-item-group.svelte.d.ts +0 -10
- package/dist/components/menu/menu-radio-item.svelte +0 -43
- package/dist/components/menu/menu-radio-item.svelte.d.ts +0 -10
- package/dist/components/menu/menu-root-provider.svelte.d.ts +0 -14
- package/dist/components/menu/menu-root.svelte.d.ts +0 -11
- package/dist/components/menu/menu-separator.svelte +0 -19
- package/dist/components/menu/menu-separator.svelte.d.ts +0 -8
- package/dist/components/menu/menu-trigger-item.svelte +0 -22
- package/dist/components/menu/menu-trigger-item.svelte.d.ts +0 -8
- package/dist/components/menu/menu-trigger.svelte +0 -22
- package/dist/components/menu/menu-trigger.svelte.d.ts +0 -8
- package/dist/components/menu/menu.d.ts +0 -22
- package/dist/components/menu/menu.js +0 -21
- package/dist/components/menu/use-menu-context.d.ts +0 -4
- package/dist/components/menu/use-menu-context.js +0 -7
- package/dist/components/menu/use-menu-item-context.d.ts +0 -5
- package/dist/components/menu/use-menu-item-context.js +0 -6
- package/dist/components/menu/use-menu-item-group-context.d.ts +0 -11
- package/dist/components/menu/use-menu-item-group-context.js +0 -6
- package/dist/components/menu/use-menu-machine-context.d.ts +0 -4
- package/dist/components/menu/use-menu-machine-context.js +0 -7
- package/dist/components/menu/use-menu-option-item-props-context.d.ts +0 -3
- package/dist/components/menu/use-menu-option-item-props-context.js +0 -6
- package/dist/components/menu/use-menu-trigger-item-context.d.ts +0 -4
- package/dist/components/menu/use-menu-trigger-item-context.js +0 -7
- package/dist/components/menu/use-menu.svelte.d.ts +0 -12
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const alertDialogAnatomy: import("@sprawlify/primitives/anatomy").Anatomy<"description" | "title" | "
|
|
2
|
-
export declare const parts: Record<"description" | "title" | "
|
|
1
|
+
export declare const alertDialogAnatomy: import("@sprawlify/primitives/anatomy").Anatomy<"description" | "title" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop">;
|
|
2
|
+
export declare const parts: Record<"description" | "title" | "closeTrigger" | "trigger" | "content" | "positioner" | "backdrop", import("@sprawlify/primitives/anatomy").AnatomyPart>;
|
|
@@ -22,7 +22,7 @@ export { hoverCardAnatomy } from './hover-card/hover-card-anatomy';
|
|
|
22
22
|
export { imageCropperAnatomy } from './image-cropper/image-cropper-anatomy';
|
|
23
23
|
export { listboxAnatomy } from './listbox/listbox-anatomy';
|
|
24
24
|
export { marqueeAnatomy } from './marquee/marquee-anatomy';
|
|
25
|
-
export {
|
|
25
|
+
export { dropdownMenuAnatomy } from './dropdown-menu/dropdown-menu-anatomy';
|
|
26
26
|
export { navigationMenuAnatomy } from './navigation-menu/navigation-menu-anatomy';
|
|
27
27
|
export { numberInputAnatomy } from './number-input/number-input-anatomy';
|
|
28
28
|
export { paginationAnatomy } from './pagination/pagination-anatomy';
|
|
@@ -22,7 +22,7 @@ export { hoverCardAnatomy } from './hover-card/hover-card-anatomy';
|
|
|
22
22
|
export { imageCropperAnatomy } from './image-cropper/image-cropper-anatomy';
|
|
23
23
|
export { listboxAnatomy } from './listbox/listbox-anatomy';
|
|
24
24
|
export { marqueeAnatomy } from './marquee/marquee-anatomy';
|
|
25
|
-
export {
|
|
25
|
+
export { dropdownMenuAnatomy } from './dropdown-menu/dropdown-menu-anatomy';
|
|
26
26
|
export { navigationMenuAnatomy } from './navigation-menu/navigation-menu-anatomy';
|
|
27
27
|
export { numberInputAnatomy } from './number-input/number-input-anatomy';
|
|
28
28
|
export { paginationAnatomy } from './pagination/pagination-anatomy';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const carouselAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"root" | "
|
|
1
|
+
export declare const carouselAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"root" | "control" | "item" | "itemGroup" | "indicator" | "nextTrigger" | "prevTrigger" | "indicatorGroup" | "autoplayTrigger" | "progressText" | "autoplayIndicator">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const colorPickerAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "area" | "view" | "trigger" | "content" | "positioner" | "root" | "control" | "valueText" | "areaThumb" | "
|
|
1
|
+
export declare const colorPickerAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "area" | "view" | "trigger" | "content" | "positioner" | "root" | "control" | "valueText" | "formatSelect" | "areaThumb" | "channelInput" | "channelSliderTrack" | "channelSliderThumb" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderValueText" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const comboboxAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "input" | "trigger" | "content" | "positioner" | "root" | "
|
|
1
|
+
export declare const comboboxAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "input" | "trigger" | "content" | "positioner" | "root" | "control" | "item" | "itemGroup" | "clearTrigger" | "list" | "itemIndicator" | "itemText" | "itemGroupLabel" | "empty">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const datePickerAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "input" | "table" | "view" | "trigger" | "content" | "positioner" | "root" | "
|
|
1
|
+
export declare const datePickerAnatomy: import("@sprawlify/primitives/anatomy").AnatomyInstance<"label" | "input" | "table" | "view" | "trigger" | "content" | "positioner" | "root" | "control" | "nextTrigger" | "prevTrigger" | "valueText" | "clearTrigger" | "monthSelect" | "presetTrigger" | "rangeText" | "tableBody" | "tableCell" | "tableCellTrigger" | "tableHead" | "tableHeader" | "tableRow" | "viewControl" | "viewTrigger" | "yearSelect">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { anatomy as dropdownMenuAnatomy } from '@sprawlify/primitives/machines/dropdown-menu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { anatomy as dropdownMenuAnatomy } from '@sprawlify/primitives/machines/dropdown-menu';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuArrowTipBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuArrowTipProps extends Assign<HTMLProps<'div'>, DropdownMenuArrowTipBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
|
|
13
|
+
let { ref = $bindable(null), ...props }: DropdownMenuArrowTipProps = $props()
|
|
14
|
+
|
|
15
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
16
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getArrowTipProps(), props))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuArrowTipBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuArrowTipProps extends Assign<HTMLProps<'div'>, DropdownMenuArrowTipBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuArrowTip: import("svelte").Component<DropdownMenuArrowTipProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuArrowTip = ReturnType<typeof DropdownMenuArrowTip>;
|
|
8
|
+
export default DropdownMenuArrowTip;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuArrowBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuArrowProps extends Assign<HTMLProps<'div'>, DropdownMenuArrowBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
|
|
13
|
+
let { ref = $bindable(null), ...props }: DropdownMenuArrowProps = $props()
|
|
14
|
+
|
|
15
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
16
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getArrowProps(), props))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuArrowBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuArrowProps extends Assign<HTMLProps<'div'>, DropdownMenuArrowBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuArrow: import("svelte").Component<DropdownMenuArrowProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuArrow = ReturnType<typeof DropdownMenuArrow>;
|
|
8
|
+
export default DropdownMenuArrow;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
-
import type { OptionItemProps } from '@sprawlify/primitives/machines/menu'
|
|
3
|
+
import type { OptionItemProps } from '@sprawlify/primitives/machines/dropdown-menu'
|
|
4
4
|
|
|
5
5
|
type PartialOptionItemProps = Omit<OptionItemProps, 'type'>
|
|
6
6
|
|
|
7
|
-
export interface
|
|
8
|
-
export interface
|
|
7
|
+
export interface DropdownMenuCheckboxItemBaseProps extends PartialOptionItemProps, PolymorphicProps<'div'>, RefAttribute {}
|
|
8
|
+
export interface DropdownMenuCheckboxItemProps extends Assign<HTMLProps<'div'>, DropdownMenuCheckboxItemBaseProps> {}
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
12
|
import { createSplitProps } from '../../utils/create-split-props'
|
|
13
13
|
import { mergeProps } from '../../core'
|
|
14
14
|
import { Sprawlify } from '../factory'
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
16
|
+
import { DropdownMenuItemProvider } from './use-dropdown-menu-item-context'
|
|
17
|
+
import { DropdownMenuItemPropsProvider } from './use-dropdown-menu-option-item-props-context'
|
|
18
18
|
|
|
19
|
-
let { ref = $bindable(null), checked = $bindable<boolean>(), ...props }:
|
|
19
|
+
let { ref = $bindable(null), checked = $bindable<boolean>(), ...props }: DropdownMenuCheckboxItemProps = $props()
|
|
20
20
|
|
|
21
21
|
const [partialOptionItemProps, localProps] = $derived(
|
|
22
22
|
createSplitProps<PartialOptionItemProps>()({ checked, ...props }, [
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
const mergedProps = $derived(mergeProps(
|
|
44
|
-
const optionItemState = $derived(
|
|
42
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
43
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getOptionItemProps(optionItemProps), localProps))
|
|
44
|
+
const optionItemState = $derived(dropdownMenu().getOptionItemState(optionItemProps))
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
DropdownMenuItemPropsProvider(() => optionItemProps)
|
|
47
|
+
DropdownMenuItemProvider(() => optionItemState)
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
50
|
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { OptionItemProps } from '@sprawlify/primitives/machines/dropdown-menu';
|
|
3
|
+
type PartialOptionItemProps = Omit<OptionItemProps, 'type'>;
|
|
4
|
+
export interface DropdownMenuCheckboxItemBaseProps extends PartialOptionItemProps, PolymorphicProps<'div'>, RefAttribute {
|
|
5
|
+
}
|
|
6
|
+
export interface DropdownMenuCheckboxItemProps extends Assign<HTMLProps<'div'>, DropdownMenuCheckboxItemBaseProps> {
|
|
7
|
+
}
|
|
8
|
+
declare const DropdownMenuCheckboxItem: import("svelte").Component<DropdownMenuCheckboxItemProps, {}, "checked" | "ref">;
|
|
9
|
+
type DropdownMenuCheckboxItem = ReturnType<typeof DropdownMenuCheckboxItem>;
|
|
10
|
+
export default DropdownMenuCheckboxItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuContentBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuContentProps extends Assign<HTMLProps<'div'>, DropdownMenuContentBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { usePresenceContext } from '../presence'
|
|
12
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
13
|
+
|
|
14
|
+
let { ref = $bindable(null), ...props }: DropdownMenuContentProps = $props()
|
|
15
|
+
|
|
16
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
17
|
+
const presence = usePresenceContext()
|
|
18
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getContentProps(), presence().getPresenceProps(), props))
|
|
19
|
+
|
|
20
|
+
function setNode(node: HTMLElement | null) {
|
|
21
|
+
presence().setNode(node)
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if !presence().unmounted}
|
|
26
|
+
<Sprawlify as="div" bind:ref {@attach setNode} {...mergedProps} />
|
|
27
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuContentBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuContentProps extends Assign<HTMLProps<'div'>, DropdownMenuContentBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuContent: import("svelte").Component<DropdownMenuContentProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuContent = ReturnType<typeof DropdownMenuContent>;
|
|
8
|
+
export default DropdownMenuContent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { UseDropdownMenuContext } from './use-dropdown-menu-context'
|
|
4
|
+
|
|
5
|
+
export interface DropdownMenuContextProps {
|
|
6
|
+
render: Snippet<[UseDropdownMenuContext]>
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
|
|
13
|
+
const { render }: DropdownMenuContextProps = $props()
|
|
14
|
+
const context = useDropdownMenuContext()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{@render render(context)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { UseDropdownMenuContext } from './use-dropdown-menu-context';
|
|
3
|
+
export interface DropdownMenuContextProps {
|
|
4
|
+
render: Snippet<[UseDropdownMenuContext]>;
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuContext: import("svelte").Component<DropdownMenuContextProps, {}, "">;
|
|
7
|
+
type DropdownMenuContext = ReturnType<typeof DropdownMenuContext>;
|
|
8
|
+
export default DropdownMenuContext;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuIndicatorBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuIndicatorProps extends Assign<HTMLProps<'div'>, DropdownMenuIndicatorBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
|
|
13
|
+
let { ref = $bindable(null), ...props }: DropdownMenuIndicatorProps = $props()
|
|
14
|
+
|
|
15
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
16
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getIndicatorProps(), props))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuIndicatorBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuIndicatorProps extends Assign<HTMLProps<'div'>, DropdownMenuIndicatorBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuIndicator: import("svelte").Component<DropdownMenuIndicatorProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuIndicator = ReturnType<typeof DropdownMenuIndicator>;
|
|
8
|
+
export default DropdownMenuIndicator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import { useDropdownMenuItemContext, type UseDropdownMenuItemContext } from './use-dropdown-menu-item-context'
|
|
4
|
+
|
|
5
|
+
export interface DropdownMenuItemContextProps {
|
|
6
|
+
render: Snippet<[UseDropdownMenuItemContext]>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props: DropdownMenuItemContextProps = $props()
|
|
10
|
+
|
|
11
|
+
const context = useDropdownMenuItemContext()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{@render props.render(context)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type UseDropdownMenuItemContext } from './use-dropdown-menu-item-context';
|
|
3
|
+
export interface DropdownMenuItemContextProps {
|
|
4
|
+
render: Snippet<[UseDropdownMenuItemContext]>;
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuItemContext: import("svelte").Component<DropdownMenuItemContextProps, {}, "">;
|
|
7
|
+
type DropdownMenuItemContext = ReturnType<typeof DropdownMenuItemContext>;
|
|
8
|
+
export default DropdownMenuItemContext;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuItemGroupLabelBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuItemGroupLabelProps extends Assign<HTMLProps<'div'>, DropdownMenuItemGroupLabelBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
import { useDropdownMenuItemGroupContext } from './use-dropdown-menu-item-group-context'
|
|
13
|
+
|
|
14
|
+
let { ref = $bindable(null), ...props }: DropdownMenuItemGroupLabelProps = $props()
|
|
15
|
+
|
|
16
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
17
|
+
const itemGroup = useDropdownMenuItemGroupContext()
|
|
18
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemGroupLabelProps({ htmlFor: itemGroup().id }), props))
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuItemGroupLabelBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuItemGroupLabelProps extends Assign<HTMLProps<'div'>, DropdownMenuItemGroupLabelBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuItemGroupLabel: import("svelte").Component<DropdownMenuItemGroupLabelProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuItemGroupLabel = ReturnType<typeof DropdownMenuItemGroupLabel>;
|
|
8
|
+
export default DropdownMenuItemGroupLabel;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, Optional, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { ItemGroupProps } from '@sprawlify/primitives/machines/dropdown-menu'
|
|
4
|
+
|
|
5
|
+
type OptionalItemGroupProps = Optional<ItemGroupProps, 'id'>
|
|
6
|
+
|
|
7
|
+
export interface DropdownMenuItemGroupBaseProps extends OptionalItemGroupProps, PolymorphicProps<'div'>, RefAttribute {}
|
|
8
|
+
export interface DropdownMenuItemGroupProps extends Assign<HTMLProps<'div'>, DropdownMenuItemGroupBaseProps> {}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { mergeProps } from '../../core'
|
|
13
|
+
import { Sprawlify } from '../factory'
|
|
14
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
15
|
+
import { DropdownMenuItemGroupProvider } from './use-dropdown-menu-item-group-context'
|
|
16
|
+
|
|
17
|
+
let { ref = $bindable(null), ...props }: DropdownMenuItemGroupProps = $props()
|
|
18
|
+
|
|
19
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
20
|
+
const id = $props.id()
|
|
21
|
+
const itemGroupProps = $derived({ id, ...props })
|
|
22
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemGroupProps(itemGroupProps), props))
|
|
23
|
+
|
|
24
|
+
DropdownMenuItemGroupProvider(() => itemGroupProps)
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, Optional, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { ItemGroupProps } from '@sprawlify/primitives/machines/dropdown-menu';
|
|
3
|
+
type OptionalItemGroupProps = Optional<ItemGroupProps, 'id'>;
|
|
4
|
+
export interface DropdownMenuItemGroupBaseProps extends OptionalItemGroupProps, PolymorphicProps<'div'>, RefAttribute {
|
|
5
|
+
}
|
|
6
|
+
export interface DropdownMenuItemGroupProps extends Assign<HTMLProps<'div'>, DropdownMenuItemGroupBaseProps> {
|
|
7
|
+
}
|
|
8
|
+
declare const DropdownMenuItemGroup: import("svelte").Component<DropdownMenuItemGroupProps, {}, "ref">;
|
|
9
|
+
type DropdownMenuItemGroup = ReturnType<typeof DropdownMenuItemGroup>;
|
|
10
|
+
export default DropdownMenuItemGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuItemIndicatorBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuItemIndicatorProps extends Assign<HTMLProps<'div'>, DropdownMenuItemIndicatorBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
import { useDropdownMenuItemPropsContext } from './use-dropdown-menu-option-item-props-context'
|
|
13
|
+
|
|
14
|
+
let { ref = $bindable(null), ...props }: DropdownMenuItemIndicatorProps = $props()
|
|
15
|
+
|
|
16
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
17
|
+
const itemProps = useDropdownMenuItemPropsContext()
|
|
18
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemIndicatorProps(itemProps()), props))
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuItemIndicatorBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuItemIndicatorProps extends Assign<HTMLProps<'div'>, DropdownMenuItemIndicatorBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuItemIndicator: import("svelte").Component<DropdownMenuItemIndicatorProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuItemIndicator = ReturnType<typeof DropdownMenuItemIndicator>;
|
|
8
|
+
export default DropdownMenuItemIndicator;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuItemTextBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuItemTextProps extends Assign<HTMLProps<'div'>, DropdownMenuItemTextBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
12
|
+
import { useDropdownMenuItemPropsContext } from './use-dropdown-menu-option-item-props-context'
|
|
13
|
+
|
|
14
|
+
let { ref = $bindable(null), ...props }: DropdownMenuItemTextProps = $props()
|
|
15
|
+
|
|
16
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
17
|
+
const itemProps = useDropdownMenuItemPropsContext()
|
|
18
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemTextProps(itemProps()), props))
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuItemTextBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuItemTextProps extends Assign<HTMLProps<'div'>, DropdownMenuItemTextBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuItemText: import("svelte").Component<DropdownMenuItemTextProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuItemText = ReturnType<typeof DropdownMenuItemText>;
|
|
8
|
+
export default DropdownMenuItemText;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
interface ItemBaseProps extends ItemProps {
|
|
5
|
+
onSelect?: VoidFunction
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DropdownMenuItemBaseProps extends ItemBaseProps, PolymorphicProps<'div'>, RefAttribute {}
|
|
9
|
+
export interface DropdownMenuItemProps extends Assign<HTMLProps<'div'>, DropdownMenuItemBaseProps> {}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import type { ItemProps } from '@sprawlify/primitives/machines/dropdown-menu'
|
|
14
|
+
import { mergeProps } from '../../core'
|
|
15
|
+
import { Sprawlify } from '../factory'
|
|
16
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
17
|
+
import { DropdownMenuItemProvider } from './use-dropdown-menu-item-context'
|
|
18
|
+
import { DropdownMenuItemPropsProvider } from './use-dropdown-menu-option-item-props-context'
|
|
19
|
+
import { createSplitProps } from '../../utils/create-split-props'
|
|
20
|
+
|
|
21
|
+
let { ref = $bindable(null), ...props }: DropdownMenuItemProps = $props()
|
|
22
|
+
|
|
23
|
+
const [itemProps, localProps] = $derived(
|
|
24
|
+
createSplitProps<ItemBaseProps>()(props, ['closeOnSelect', 'disabled', 'value', 'valueText', 'onSelect']),
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
28
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemProps(itemProps), localProps))
|
|
29
|
+
const itemState = $derived(dropdownMenu().getItemState(itemProps))
|
|
30
|
+
|
|
31
|
+
$effect(() => {
|
|
32
|
+
return dropdownMenu().addItemListener({
|
|
33
|
+
id: itemState.id,
|
|
34
|
+
onSelect: itemProps.onSelect,
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
DropdownMenuItemPropsProvider(() => itemProps)
|
|
39
|
+
DropdownMenuItemProvider(() => itemState)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
interface ItemBaseProps extends ItemProps {
|
|
3
|
+
onSelect?: VoidFunction;
|
|
4
|
+
}
|
|
5
|
+
export interface DropdownMenuItemBaseProps extends ItemBaseProps, PolymorphicProps<'div'>, RefAttribute {
|
|
6
|
+
}
|
|
7
|
+
export interface DropdownMenuItemProps extends Assign<HTMLProps<'div'>, DropdownMenuItemBaseProps> {
|
|
8
|
+
}
|
|
9
|
+
import type { ItemProps } from '@sprawlify/primitives/machines/dropdown-menu';
|
|
10
|
+
declare const DropdownMenuItem: import("svelte").Component<DropdownMenuItemProps, {}, "ref">;
|
|
11
|
+
type DropdownMenuItem = ReturnType<typeof DropdownMenuItem>;
|
|
12
|
+
export default DropdownMenuItem;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
|
|
4
|
+
export interface DropdownMenuPositionerBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
|
|
5
|
+
export interface DropdownMenuPositionerProps extends Assign<HTMLProps<'div'>, DropdownMenuPositionerBaseProps> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '../../core'
|
|
10
|
+
import { Sprawlify } from '../factory'
|
|
11
|
+
import { usePresenceContext } from '../presence'
|
|
12
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
13
|
+
|
|
14
|
+
let { ref = $bindable(null), ...props }: DropdownMenuPositionerProps = $props()
|
|
15
|
+
|
|
16
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
17
|
+
const presence = usePresenceContext()
|
|
18
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getPositionerProps(), props))
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{#if !presence().unmounted}
|
|
22
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
23
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
export interface DropdownMenuPositionerBaseProps extends PolymorphicProps<'div'>, RefAttribute {
|
|
3
|
+
}
|
|
4
|
+
export interface DropdownMenuPositionerProps extends Assign<HTMLProps<'div'>, DropdownMenuPositionerBaseProps> {
|
|
5
|
+
}
|
|
6
|
+
declare const DropdownMenuPositioner: import("svelte").Component<DropdownMenuPositionerProps, {}, "ref">;
|
|
7
|
+
type DropdownMenuPositioner = ReturnType<typeof DropdownMenuPositioner>;
|
|
8
|
+
export default DropdownMenuPositioner;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Assign, HTMLProps, Optional, PolymorphicProps, RefAttribute } from '../../types'
|
|
3
|
+
import type { UseDropdownMenuItemGroupContext } from './use-dropdown-menu-item-group-context'
|
|
4
|
+
|
|
5
|
+
type OptionalUseDropdownMenuItemGroupContext = Optional<ReturnType<UseDropdownMenuItemGroupContext>, 'id'>
|
|
6
|
+
|
|
7
|
+
export interface DropdownMenuRadioItemGroupBaseProps
|
|
8
|
+
extends OptionalUseDropdownMenuItemGroupContext,
|
|
9
|
+
PolymorphicProps<'div'>,
|
|
10
|
+
RefAttribute {}
|
|
11
|
+
export interface DropdownMenuRadioItemGroupProps extends Assign<HTMLProps<'div'>, DropdownMenuRadioItemGroupBaseProps> {}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { mergeProps } from '../../core'
|
|
16
|
+
import { Sprawlify } from '../factory'
|
|
17
|
+
import { createSplitProps } from '../../utils/create-split-props'
|
|
18
|
+
import { useDropdownMenuContext } from './use-dropdown-menu-context'
|
|
19
|
+
import { DropdownMenuItemGroupProvider } from './use-dropdown-menu-item-group-context'
|
|
20
|
+
|
|
21
|
+
let { ref = $bindable(null), value = $bindable(), ...props }: DropdownMenuRadioItemGroupProps = $props()
|
|
22
|
+
const id = $props.id()
|
|
23
|
+
|
|
24
|
+
const [optionalItemGroupProps, localProps] = $derived(
|
|
25
|
+
createSplitProps<OptionalUseDropdownMenuItemGroupContext>()(props, ['id', 'onValueChange', 'value']),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const dropdownMenu = useDropdownMenuContext()
|
|
29
|
+
|
|
30
|
+
const itemGroupProps = $derived<ReturnType<UseDropdownMenuItemGroupContext>>({
|
|
31
|
+
id: optionalItemGroupProps.id ?? id,
|
|
32
|
+
value,
|
|
33
|
+
onValueChange(e) {
|
|
34
|
+
value = e.value
|
|
35
|
+
optionalItemGroupProps?.onValueChange?.(e)
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const mergedProps = $derived(mergeProps(dropdownMenu().getItemGroupProps({ id: itemGroupProps.id }), localProps))
|
|
40
|
+
|
|
41
|
+
DropdownMenuItemGroupProvider(() => itemGroupProps)
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<Sprawlify as="div" bind:ref {...mergedProps} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Assign, HTMLProps, Optional, PolymorphicProps, RefAttribute } from '../../types';
|
|
2
|
+
import type { UseDropdownMenuItemGroupContext } from './use-dropdown-menu-item-group-context';
|
|
3
|
+
type OptionalUseDropdownMenuItemGroupContext = Optional<ReturnType<UseDropdownMenuItemGroupContext>, 'id'>;
|
|
4
|
+
export interface DropdownMenuRadioItemGroupBaseProps extends OptionalUseDropdownMenuItemGroupContext, PolymorphicProps<'div'>, RefAttribute {
|
|
5
|
+
}
|
|
6
|
+
export interface DropdownMenuRadioItemGroupProps extends Assign<HTMLProps<'div'>, DropdownMenuRadioItemGroupBaseProps> {
|
|
7
|
+
}
|
|
8
|
+
declare const DropdownMenuRadioItemGroup: import("svelte").Component<DropdownMenuRadioItemGroupProps, {}, "value" | "ref">;
|
|
9
|
+
type DropdownMenuRadioItemGroup = ReturnType<typeof DropdownMenuRadioItemGroup>;
|
|
10
|
+
export default DropdownMenuRadioItemGroup;
|