bits-ui 0.17.0 → 0.18.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/dist/bits/accordion/_export.types.d.ts +1 -1
- package/dist/bits/accordion/components/accordion-content.svelte +3 -18
- package/dist/bits/accordion/ctx.js +3 -3
- package/dist/bits/accordion/types.d.ts +1 -1
- package/dist/bits/alert-dialog/_export.types.d.ts +1 -1
- package/dist/bits/alert-dialog/_types.d.ts +1 -1
- package/dist/bits/alert-dialog/components/alert-dialog-overlay.svelte +2 -12
- package/dist/bits/alert-dialog/components/alert-dialog-title.svelte +1 -6
- package/dist/bits/alert-dialog/ctx.js +4 -4
- package/dist/bits/alert-dialog/types.d.ts +1 -1
- package/dist/bits/aspect-ratio/components/aspect-ratio.svelte +1 -5
- package/dist/bits/avatar/_export.types.d.ts +1 -1
- package/dist/bits/avatar/ctx.js +2 -2
- package/dist/bits/button/_export.types.d.ts +1 -1
- package/dist/bits/button/types.d.ts +1 -1
- package/dist/bits/calendar/_export.types.d.ts +1 -1
- package/dist/bits/calendar/_types.d.ts +1 -1
- package/dist/bits/calendar/components/calendar-next-button.svelte +1 -7
- package/dist/bits/calendar/components/calendar-prev-button.svelte +1 -7
- package/dist/bits/calendar/components/calendar.svelte +2 -12
- package/dist/bits/calendar/ctx.js +2 -2
- package/dist/bits/calendar/types.d.ts +1 -1
- package/dist/bits/checkbox/_export.types.d.ts +1 -1
- package/dist/bits/checkbox/_types.d.ts +1 -1
- package/dist/bits/checkbox/components/checkbox-input.svelte +1 -6
- package/dist/bits/checkbox/ctx.js +2 -2
- package/dist/bits/checkbox/types.d.ts +1 -1
- package/dist/bits/collapsible/_export.types.d.ts +1 -1
- package/dist/bits/collapsible/components/collapsible-content.svelte +3 -18
- package/dist/bits/collapsible/components/collapsible-trigger.svelte +1 -7
- package/dist/bits/collapsible/ctx.js +2 -2
- package/dist/bits/collapsible/types.d.ts +1 -1
- package/dist/bits/combobox/_export.types.d.ts +1 -0
- package/dist/bits/combobox/_export.types.js +1 -0
- package/dist/bits/combobox/_types.d.ts +62 -0
- package/dist/bits/combobox/_types.js +1 -0
- package/dist/bits/combobox/components/combobox-arrow.svelte +21 -0
- package/dist/bits/combobox/components/combobox-arrow.svelte.d.ts +26 -0
- package/dist/bits/combobox/components/combobox-content.svelte +104 -0
- package/dist/bits/combobox/components/combobox-content.svelte.d.ts +27 -0
- package/dist/bits/combobox/components/combobox-group-label.svelte +25 -0
- package/dist/bits/combobox/components/combobox-group-label.svelte.d.ts +23 -0
- package/dist/bits/combobox/components/combobox-group.svelte +19 -0
- package/dist/bits/combobox/components/combobox-group.svelte.d.ts +26 -0
- package/dist/bits/combobox/components/combobox-hidden-input.svelte +25 -0
- package/dist/bits/combobox/components/combobox-hidden-input.svelte.d.ts +32 -0
- package/dist/bits/combobox/components/combobox-input.svelte +31 -0
- package/dist/bits/combobox/components/combobox-input.svelte.d.ts +33 -0
- package/dist/bits/combobox/components/combobox-item-indicator.svelte +16 -0
- package/dist/bits/combobox/components/combobox-item-indicator.svelte.d.ts +20 -0
- package/dist/bits/combobox/components/combobox-item.svelte +47 -0
- package/dist/bits/combobox/components/combobox-item.svelte.d.ts +31 -0
- package/dist/bits/combobox/components/combobox-label.svelte +22 -0
- package/dist/bits/combobox/components/combobox-label.svelte.d.ts +17 -0
- package/dist/bits/combobox/components/combobox.svelte +113 -0
- package/dist/bits/combobox/components/combobox.svelte.d.ts +41 -0
- package/dist/bits/combobox/ctx.d.ts +187 -0
- package/dist/bits/combobox/ctx.js +91 -0
- package/dist/bits/combobox/index.d.ts +12 -0
- package/dist/bits/combobox/index.js +12 -0
- package/dist/bits/combobox/types.d.ts +36 -0
- package/dist/bits/combobox/types.js +1 -0
- package/dist/bits/context-menu/_export.types.d.ts +1 -1
- package/dist/bits/context-menu/components/context-menu-content.svelte +1 -6
- package/dist/bits/context-menu/components/context-menu.svelte +4 -7
- package/dist/bits/context-menu/components/context-menu.svelte.d.ts +2 -2
- package/dist/bits/context-menu/ctx.d.ts +1 -1
- package/dist/bits/context-menu/ctx.js +5 -5
- package/dist/bits/context-menu/types.d.ts +1 -1
- package/dist/bits/date-field/_export.types.d.ts +1 -1
- package/dist/bits/date-field/components/date-field.svelte +1 -5
- package/dist/bits/date-field/ctx.d.ts +1 -1
- package/dist/bits/date-field/ctx.js +2 -2
- package/dist/bits/date-field/types.d.ts +1 -1
- package/dist/bits/date-picker/_export.types.d.ts +1 -1
- package/dist/bits/date-picker/components/date-picker-calendar.svelte +1 -6
- package/dist/bits/date-picker/components/date-picker-content.svelte +3 -18
- package/dist/bits/date-picker/components/date-picker-field.svelte +1 -5
- package/dist/bits/date-picker/components/date-picker-next-button.svelte +1 -7
- package/dist/bits/date-picker/components/date-picker-prev-button.svelte +1 -7
- package/dist/bits/date-picker/components/date-picker.svelte +1 -5
- package/dist/bits/date-picker/ctx.d.ts +2 -2
- package/dist/bits/date-picker/ctx.js +5 -5
- package/dist/bits/date-picker/types.d.ts +1 -1
- package/dist/bits/date-range-field/_export.types.d.ts +1 -1
- package/dist/bits/date-range-field/components/date-range-field.svelte +2 -11
- package/dist/bits/date-range-field/ctx.d.ts +1 -1
- package/dist/bits/date-range-field/ctx.js +1 -1
- package/dist/bits/date-range-picker/_export.types.d.ts +1 -1
- package/dist/bits/date-range-picker/components/date-range-picker-content.svelte +3 -18
- package/dist/bits/date-range-picker/components/date-range-picker-field.svelte +1 -5
- package/dist/bits/date-range-picker/ctx.d.ts +2 -2
- package/dist/bits/date-range-picker/ctx.js +5 -5
- package/dist/bits/date-range-picker/types.d.ts +1 -1
- package/dist/bits/dialog/_export.types.d.ts +1 -1
- package/dist/bits/dialog/_types.d.ts +1 -1
- package/dist/bits/dialog/components/dialog-title.svelte +1 -6
- package/dist/bits/dialog/ctx.js +4 -4
- package/dist/bits/dialog/types.d.ts +1 -1
- package/dist/bits/dropdown-menu/_export.types.d.ts +1 -1
- package/dist/bits/dropdown-menu/types.d.ts +1 -1
- package/dist/bits/floating/helpers.js +3 -3
- package/dist/bits/index.d.ts +1 -0
- package/dist/bits/index.js +1 -0
- package/dist/bits/label/_export.types.d.ts +1 -1
- package/dist/bits/label/components/label.svelte +1 -6
- package/dist/bits/label/ctx.js +1 -1
- package/dist/bits/label/types.d.ts +1 -1
- package/dist/bits/link-preview/_export.types.d.ts +1 -1
- package/dist/bits/link-preview/components/link-preview.svelte +4 -7
- package/dist/bits/link-preview/ctx.js +6 -6
- package/dist/bits/link-preview/types.d.ts +1 -1
- package/dist/bits/menu/components/menu-content.svelte +1 -6
- package/dist/bits/menu/components/menu-sub.svelte +4 -7
- package/dist/bits/menu/components/menu.svelte +4 -7
- package/dist/bits/menu/components/menu.svelte.d.ts +2 -2
- package/dist/bits/menu/ctx.d.ts +8 -8
- package/dist/bits/menu/ctx.js +20 -20
- package/dist/bits/menu/types.d.ts +1 -1
- package/dist/bits/menubar/_export.types.d.ts +1 -1
- package/dist/bits/menubar/components/menubar-menu.svelte +4 -7
- package/dist/bits/menubar/components/menubar-menu.svelte.d.ts +2 -2
- package/dist/bits/menubar/components/menubar-sub.svelte +4 -7
- package/dist/bits/menubar/ctx.d.ts +3 -3
- package/dist/bits/menubar/ctx.js +12 -12
- package/dist/bits/menubar/types.d.ts +1 -1
- package/dist/bits/pagination/_export.types.d.ts +1 -1
- package/dist/bits/pagination/components/pagination-next-button.svelte +1 -7
- package/dist/bits/pagination/components/pagination-page.svelte +1 -7
- package/dist/bits/pagination/components/pagination-prev-button.svelte +1 -7
- package/dist/bits/pagination/ctx.js +2 -2
- package/dist/bits/pagination/types.d.ts +1 -1
- package/dist/bits/pin-input/_export.types.d.ts +1 -1
- package/dist/bits/pin-input/ctx.d.ts +1 -1
- package/dist/bits/pin-input/ctx.js +2 -2
- package/dist/bits/pin-input/types.d.ts +1 -1
- package/dist/bits/popover/_export.types.d.ts +1 -1
- package/dist/bits/popover/components/popover-content.svelte +3 -18
- package/dist/bits/popover/components/popover.svelte +4 -7
- package/dist/bits/popover/ctx.js +7 -7
- package/dist/bits/popover/types.d.ts +1 -1
- package/dist/bits/progress/ctx.js +2 -2
- package/dist/bits/radio-group/_export.types.d.ts +1 -1
- package/dist/bits/radio-group/ctx.js +2 -2
- package/dist/bits/radio-group/types.d.ts +1 -1
- package/dist/bits/range-calendar/_export.types.d.ts +1 -1
- package/dist/bits/range-calendar/_types.d.ts +1 -1
- package/dist/bits/range-calendar/components/range-calendar-next-button.svelte +1 -7
- package/dist/bits/range-calendar/components/range-calendar-prev-button.svelte +1 -7
- package/dist/bits/range-calendar/components/range-calendar.svelte +1 -6
- package/dist/bits/range-calendar/ctx.js +2 -2
- package/dist/bits/range-calendar/types.d.ts +1 -1
- package/dist/bits/select/_export.types.d.ts +1 -1
- package/dist/bits/select/_types.d.ts +1 -1
- package/dist/bits/select/components/select-content.svelte +1 -7
- package/dist/bits/select/components/select-value.svelte +1 -6
- package/dist/bits/select/components/select.svelte.d.ts +1 -1
- package/dist/bits/select/ctx.d.ts +4 -4
- package/dist/bits/select/ctx.js +11 -11
- package/dist/bits/select/types.d.ts +1 -1
- package/dist/bits/separator/ctx.js +2 -2
- package/dist/bits/slider/_export.types.d.ts +1 -1
- package/dist/bits/slider/components/slider-thumb.svelte +1 -6
- package/dist/bits/slider/ctx.js +2 -2
- package/dist/bits/slider/types.d.ts +1 -1
- package/dist/bits/switch/_export.types.d.ts +1 -1
- package/dist/bits/switch/ctx.js +2 -2
- package/dist/bits/switch/types.d.ts +1 -1
- package/dist/bits/tabs/_export.types.d.ts +1 -1
- package/dist/bits/tabs/ctx.js +2 -2
- package/dist/bits/tabs/types.d.ts +1 -1
- package/dist/bits/toggle/_export.types.d.ts +1 -1
- package/dist/bits/toggle/_types.d.ts +1 -1
- package/dist/bits/toggle/ctx.js +2 -2
- package/dist/bits/toggle/types.d.ts +1 -1
- package/dist/bits/toggle-group/_export.types.d.ts +1 -1
- package/dist/bits/toggle-group/ctx.js +2 -2
- package/dist/bits/toggle-group/types.d.ts +1 -1
- package/dist/bits/toolbar/_export.types.d.ts +1 -1
- package/dist/bits/toolbar/components/toolbar-button.svelte +1 -7
- package/dist/bits/toolbar/ctx.js +5 -5
- package/dist/bits/toolbar/types.d.ts +1 -1
- package/dist/bits/tooltip/_export.types.d.ts +1 -1
- package/dist/bits/tooltip/components/tooltip.svelte +4 -7
- package/dist/bits/tooltip/ctx.js +7 -7
- package/dist/bits/tooltip/types.d.ts +1 -1
- package/dist/helpers/builders.js +1 -1
- package/dist/internal/attrs.js +1 -1
- package/dist/internal/focus.js +1 -1
- package/dist/internal/kbd.js +1 -1
- package/dist/internal/style.js +1 -1
- package/package.json +21 -22
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import { type CreateComboboxProps } from "@melt-ui/svelte";
|
|
3
|
+
import type { Writable } from "svelte/store";
|
|
4
|
+
import type { FloatingProps } from "../floating/_types.js";
|
|
5
|
+
type GetReturn = Omit<ReturnType<typeof setCtx>, "updateOption">;
|
|
6
|
+
export declare function getCtx(): GetReturn;
|
|
7
|
+
type Items<T> = {
|
|
8
|
+
value: T;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
type Props<T = unknown, M extends boolean = false> = CreateComboboxProps<T, M> & {
|
|
12
|
+
items?: Items<T>[];
|
|
13
|
+
};
|
|
14
|
+
export declare function setCtx<T = unknown, M extends boolean = false>(props: Props<T, M>): {
|
|
15
|
+
updateOption: <K extends string, V extends unknown>(key: K, value: V | undefined) => void;
|
|
16
|
+
getAttrs: (part: "content" | "label" | "hidden-input" | "arrow" | "menu" | "group" | "input" | "item" | "indicator" | "group-label") => Record<string, string>;
|
|
17
|
+
elements: {
|
|
18
|
+
input: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[{
|
|
19
|
+
update: (updater: import("svelte/store").Updater<boolean>, sideEffect?: ((newValue: boolean) => void) | undefined) => void;
|
|
20
|
+
set: (this: void, value: boolean) => void;
|
|
21
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean> | undefined): import("svelte/store").Unsubscriber;
|
|
22
|
+
get: () => boolean;
|
|
23
|
+
destroy?: (() => void) | undefined;
|
|
24
|
+
}, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<HTMLElement | null>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<boolean>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>], (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"input" | "keydown" | "click">, ([$open, $highlightedItem, $disabled, $menuId, $triggerId, $labelId]: [boolean, HTMLElement | null, boolean, string, string, string]) => {
|
|
25
|
+
readonly 'aria-activedescendant': string | undefined;
|
|
26
|
+
readonly 'aria-autocomplete': "list";
|
|
27
|
+
readonly 'aria-controls': string;
|
|
28
|
+
readonly 'aria-expanded': boolean;
|
|
29
|
+
readonly 'aria-labelledby': string;
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly role: "combobox";
|
|
32
|
+
readonly disabled: true | undefined;
|
|
33
|
+
readonly type: "button" | undefined;
|
|
34
|
+
}, string>, Writable<string>], (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"input" | "keydown" | "click">, ([$trigger, $inputValue]: [{
|
|
35
|
+
readonly 'aria-activedescendant': string | undefined;
|
|
36
|
+
readonly 'aria-autocomplete': "list";
|
|
37
|
+
readonly 'aria-controls': string;
|
|
38
|
+
readonly 'aria-expanded': boolean;
|
|
39
|
+
readonly 'aria-labelledby': string;
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly role: "combobox";
|
|
42
|
+
readonly disabled: true | undefined;
|
|
43
|
+
readonly type: "button" | undefined;
|
|
44
|
+
} & {
|
|
45
|
+
[x: `data-melt-${string}`]: "";
|
|
46
|
+
} & {
|
|
47
|
+
action: (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"input" | "keydown" | "click">;
|
|
48
|
+
}, string]) => {
|
|
49
|
+
readonly role: "combobox";
|
|
50
|
+
readonly value: string;
|
|
51
|
+
readonly disabled: true | undefined;
|
|
52
|
+
readonly type: "button" | undefined;
|
|
53
|
+
readonly 'aria-expanded': boolean;
|
|
54
|
+
readonly 'aria-controls': string;
|
|
55
|
+
readonly 'aria-activedescendant': string | undefined;
|
|
56
|
+
readonly 'aria-autocomplete': "list";
|
|
57
|
+
readonly 'aria-labelledby': string;
|
|
58
|
+
readonly id: string;
|
|
59
|
+
}, string>;
|
|
60
|
+
label: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>], (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"mousedown">, ([$labelId, $triggerId]: [string, string]) => {
|
|
61
|
+
id: string;
|
|
62
|
+
for: string;
|
|
63
|
+
}, string>;
|
|
64
|
+
menu: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[import("svelte/store").Readable<boolean>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string>>], (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"pointerleave">, ([$isVisible, $menuId]: [boolean, string]) => {
|
|
65
|
+
readonly hidden: true | undefined;
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly role: "listbox";
|
|
68
|
+
readonly style: string;
|
|
69
|
+
}, string>;
|
|
70
|
+
option: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[import("svelte/store").Readable<(value: unknown) => boolean>], (node: HTMLElement) => import("@melt-ui/svelte/internal/types").MeltActionReturn<"click" | "pointermove">, ([$isSelected]: [(value: unknown) => boolean]) => (props: import("@melt-ui/svelte/index.js").ComboboxOptionProps<unknown>) => {
|
|
71
|
+
readonly 'data-value': string;
|
|
72
|
+
readonly 'data-label': string | undefined;
|
|
73
|
+
readonly 'data-disabled': true | undefined;
|
|
74
|
+
readonly 'aria-disabled': true | undefined;
|
|
75
|
+
readonly 'aria-selected': boolean;
|
|
76
|
+
readonly 'data-selected': "" | undefined;
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly role: "option";
|
|
79
|
+
}, string>;
|
|
80
|
+
group: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => (groupId: string) => {
|
|
81
|
+
role: string;
|
|
82
|
+
'aria-labelledby': string;
|
|
83
|
+
}, string>;
|
|
84
|
+
arrow: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<import("@melt-ui/svelte/internal/helpers").WithGet<Writable<number | undefined>>, import("svelte/action").Action<any, any, Record<never, any>>, ($arrowSize: number | undefined) => {
|
|
85
|
+
'data-arrow': boolean;
|
|
86
|
+
style: string;
|
|
87
|
+
}, string>;
|
|
88
|
+
groupLabel: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => (groupId: string) => {
|
|
89
|
+
id: string;
|
|
90
|
+
}, string>;
|
|
91
|
+
hiddenInput: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[{
|
|
92
|
+
update: (updater: import("svelte/store").Updater<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined>, sideEffect?: ((newValue: import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined) => void) | undefined) => void;
|
|
93
|
+
set: (this: void, value: import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined) => void;
|
|
94
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined>, invalidate?: import("svelte/store").Invalidator<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined> | undefined): import("svelte/store").Unsubscriber;
|
|
95
|
+
get: () => import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined;
|
|
96
|
+
destroy?: (() => void) | undefined;
|
|
97
|
+
}, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<boolean>>, import("@melt-ui/svelte/internal/helpers").WithGet<Writable<string | undefined>>], import("svelte/action").Action<any, any, Record<never, any>>, ([$selected, $required, $name]: [import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined, boolean, string | undefined]) => {
|
|
98
|
+
required: boolean | undefined;
|
|
99
|
+
value: unknown;
|
|
100
|
+
name: string | undefined;
|
|
101
|
+
type: string;
|
|
102
|
+
'aria-hidden': boolean;
|
|
103
|
+
hidden: boolean;
|
|
104
|
+
tabIndex: number;
|
|
105
|
+
style: string;
|
|
106
|
+
}, string>;
|
|
107
|
+
};
|
|
108
|
+
states: {
|
|
109
|
+
touchedInput: Writable<boolean>;
|
|
110
|
+
inputValue: Writable<string>;
|
|
111
|
+
open: {
|
|
112
|
+
update: (updater: import("svelte/store").Updater<boolean>, sideEffect?: ((newValue: boolean) => void) | undefined) => void;
|
|
113
|
+
set: (this: void, value: boolean) => void;
|
|
114
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<boolean>, invalidate?: import("svelte/store").Invalidator<boolean> | undefined): import("svelte/store").Unsubscriber;
|
|
115
|
+
get: () => boolean;
|
|
116
|
+
destroy?: (() => void) | undefined;
|
|
117
|
+
};
|
|
118
|
+
selected: {
|
|
119
|
+
update: (updater: import("svelte/store").Updater<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined>, sideEffect?: ((newValue: import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined) => void) | undefined) => void;
|
|
120
|
+
set: (this: void, value: import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined) => void;
|
|
121
|
+
subscribe(this: void, run: import("svelte/store").Subscriber<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined>, invalidate?: import("svelte/store").Invalidator<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined> | undefined): import("svelte/store").Unsubscriber;
|
|
122
|
+
get: () => import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined;
|
|
123
|
+
destroy?: (() => void) | undefined;
|
|
124
|
+
};
|
|
125
|
+
highlighted: import("svelte/store").Readable<import("@melt-ui/svelte/index.js").ComboboxOption<unknown> | undefined>;
|
|
126
|
+
highlightedItem: import("@melt-ui/svelte/internal/helpers").WithGet<Writable<HTMLElement | null>>;
|
|
127
|
+
};
|
|
128
|
+
ids: import("@melt-ui/svelte/internal/helpers").ToWritableStores<{
|
|
129
|
+
label: string;
|
|
130
|
+
menu: string;
|
|
131
|
+
trigger: string;
|
|
132
|
+
}>;
|
|
133
|
+
helpers: {
|
|
134
|
+
isSelected: import("svelte/store").Readable<(value: unknown) => boolean>;
|
|
135
|
+
isHighlighted: import("svelte/store").Readable<(item: unknown) => boolean>;
|
|
136
|
+
closeMenu: () => void;
|
|
137
|
+
};
|
|
138
|
+
options: import("@melt-ui/svelte/internal/helpers").ToWritableStores<{
|
|
139
|
+
multiple: M;
|
|
140
|
+
disabled: boolean;
|
|
141
|
+
forceVisible: boolean;
|
|
142
|
+
name: string | undefined;
|
|
143
|
+
required: boolean;
|
|
144
|
+
onOpenChange?: import("@melt-ui/svelte/internal/helpers").ChangeFn<boolean> | undefined;
|
|
145
|
+
preventScroll: boolean;
|
|
146
|
+
portal: string | HTMLElement | null | undefined;
|
|
147
|
+
positioning: import("@melt-ui/svelte/internal/actions").FloatingConfig | {
|
|
148
|
+
placement: "bottom";
|
|
149
|
+
sameWidth: true;
|
|
150
|
+
};
|
|
151
|
+
arrowSize?: number | undefined;
|
|
152
|
+
scrollAlignment: "center" | "nearest";
|
|
153
|
+
loop: boolean;
|
|
154
|
+
defaultSelected?: import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined;
|
|
155
|
+
selected?: Writable<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>>> | undefined;
|
|
156
|
+
onSelectedChange?: import("@melt-ui/svelte/internal/helpers").ChangeFn<import("@melt-ui/svelte/internal/types").WhenTrue<M, import("@melt-ui/svelte/index.js").ComboboxOption<T>[], import("@melt-ui/svelte/index.js").ComboboxOption<T>, import("@melt-ui/svelte/index.js").ComboboxOption<T>[] | import("@melt-ui/svelte/index.js").ComboboxOption<T>> | undefined> | undefined;
|
|
157
|
+
closeOnOutsideClick: boolean;
|
|
158
|
+
closeOnEscape: boolean;
|
|
159
|
+
onOutsideClick: ((event: PointerEvent) => void) | undefined;
|
|
160
|
+
typeahead: boolean;
|
|
161
|
+
highlightOnHover: boolean;
|
|
162
|
+
}>;
|
|
163
|
+
};
|
|
164
|
+
export declare function setGroupCtx(): {
|
|
165
|
+
group: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => (groupId: string) => {
|
|
166
|
+
role: string;
|
|
167
|
+
'aria-labelledby': string;
|
|
168
|
+
}, string>;
|
|
169
|
+
id: string;
|
|
170
|
+
getAttrs: (part: "content" | "label" | "hidden-input" | "arrow" | "menu" | "group" | "input" | "item" | "indicator" | "group-label") => Record<string, string>;
|
|
171
|
+
};
|
|
172
|
+
export declare function setItemCtx(value: unknown): GetReturn;
|
|
173
|
+
export declare function getGroupLabel(): {
|
|
174
|
+
groupLabel: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<import("svelte/store").Stores | undefined, import("svelte/action").Action<any, any, Record<never, any>>, () => (groupId: string) => {
|
|
175
|
+
id: string;
|
|
176
|
+
}, string>;
|
|
177
|
+
id: string;
|
|
178
|
+
getAttrs: (part: "content" | "label" | "hidden-input" | "arrow" | "menu" | "group" | "input" | "item" | "indicator" | "group-label") => Record<string, string>;
|
|
179
|
+
};
|
|
180
|
+
export declare function getItemIndicator(): {
|
|
181
|
+
value: unknown;
|
|
182
|
+
isSelected: import("svelte/store").Readable<(value: unknown) => boolean>;
|
|
183
|
+
getAttrs: (part: "content" | "label" | "hidden-input" | "arrow" | "menu" | "group" | "input" | "item" | "indicator" | "group-label") => Record<string, string>;
|
|
184
|
+
};
|
|
185
|
+
export declare function setArrow(size?: number): GetReturn;
|
|
186
|
+
export declare function updatePositioning(props: FloatingProps): void;
|
|
187
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createCombobox } from "@melt-ui/svelte";
|
|
2
|
+
import { getContext, setContext } from "svelte";
|
|
3
|
+
import { createBitAttrs, generateId, getOptionUpdater, removeUndefined, } from "../../internal/index.js";
|
|
4
|
+
import { getPositioningUpdater } from "../floating/helpers.js";
|
|
5
|
+
function getSelectData() {
|
|
6
|
+
const NAME = "combobox";
|
|
7
|
+
const GROUP_NAME = "combobox-group";
|
|
8
|
+
const ITEM_NAME = "combobox-item";
|
|
9
|
+
const PARTS = [
|
|
10
|
+
"content",
|
|
11
|
+
"menu",
|
|
12
|
+
"input",
|
|
13
|
+
"item",
|
|
14
|
+
"label",
|
|
15
|
+
"group",
|
|
16
|
+
"group-label",
|
|
17
|
+
"arrow",
|
|
18
|
+
"hidden-input",
|
|
19
|
+
"indicator",
|
|
20
|
+
];
|
|
21
|
+
return {
|
|
22
|
+
NAME,
|
|
23
|
+
GROUP_NAME,
|
|
24
|
+
ITEM_NAME,
|
|
25
|
+
PARTS,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function getCtx() {
|
|
29
|
+
const { NAME } = getSelectData();
|
|
30
|
+
return getContext(NAME);
|
|
31
|
+
}
|
|
32
|
+
export function setCtx(
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
props) {
|
|
35
|
+
const { NAME, PARTS } = getSelectData();
|
|
36
|
+
const getAttrs = createBitAttrs(NAME, PARTS);
|
|
37
|
+
const combobox = {
|
|
38
|
+
...createCombobox({ ...removeUndefined(props), forceVisible: true }),
|
|
39
|
+
getAttrs,
|
|
40
|
+
};
|
|
41
|
+
setContext(NAME, combobox);
|
|
42
|
+
return {
|
|
43
|
+
...combobox,
|
|
44
|
+
updateOption: getOptionUpdater(combobox.options),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function setGroupCtx() {
|
|
48
|
+
const { GROUP_NAME } = getSelectData();
|
|
49
|
+
const id = generateId();
|
|
50
|
+
setContext(GROUP_NAME, id);
|
|
51
|
+
const { elements: { group }, getAttrs, } = getCtx();
|
|
52
|
+
return { group, id, getAttrs };
|
|
53
|
+
}
|
|
54
|
+
export function setItemCtx(value) {
|
|
55
|
+
const { ITEM_NAME } = getSelectData();
|
|
56
|
+
const combobox = getCtx();
|
|
57
|
+
setContext(ITEM_NAME, value);
|
|
58
|
+
return combobox;
|
|
59
|
+
}
|
|
60
|
+
export function getGroupLabel() {
|
|
61
|
+
const { GROUP_NAME } = getSelectData();
|
|
62
|
+
const id = getContext(GROUP_NAME);
|
|
63
|
+
const { elements: { groupLabel }, getAttrs, } = getCtx();
|
|
64
|
+
return { groupLabel, id, getAttrs };
|
|
65
|
+
}
|
|
66
|
+
export function getItemIndicator() {
|
|
67
|
+
const { ITEM_NAME } = getSelectData();
|
|
68
|
+
const { helpers: { isSelected }, getAttrs, } = getCtx();
|
|
69
|
+
const value = getContext(ITEM_NAME);
|
|
70
|
+
return {
|
|
71
|
+
value,
|
|
72
|
+
isSelected,
|
|
73
|
+
getAttrs,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function setArrow(size = 8) {
|
|
77
|
+
const combobox = getCtx();
|
|
78
|
+
combobox.options.arrowSize?.set(size);
|
|
79
|
+
return combobox;
|
|
80
|
+
}
|
|
81
|
+
export function updatePositioning(props) {
|
|
82
|
+
const defaultPlacement = {
|
|
83
|
+
side: "bottom",
|
|
84
|
+
align: "center",
|
|
85
|
+
sameWidth: true,
|
|
86
|
+
};
|
|
87
|
+
const withDefaults = { ...defaultPlacement, ...props };
|
|
88
|
+
const { options: { positioning }, } = getCtx();
|
|
89
|
+
const updater = getPositioningUpdater(positioning);
|
|
90
|
+
updater(withDefaults);
|
|
91
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Root } from "./components/combobox.svelte";
|
|
2
|
+
export { default as Content } from "./components/combobox-content.svelte";
|
|
3
|
+
export { default as Input } from "./components/combobox-input.svelte";
|
|
4
|
+
export { default as Item } from "./components/combobox-item.svelte";
|
|
5
|
+
export { default as Label } from "./components/combobox-label.svelte";
|
|
6
|
+
export { default as Group } from "./components/combobox-group.svelte";
|
|
7
|
+
export { default as GroupLabel } from "./components/combobox-group-label.svelte";
|
|
8
|
+
export { default as Arrow } from "./components/combobox-arrow.svelte";
|
|
9
|
+
export { default as HiddenInput } from "./components/combobox-hidden-input.svelte";
|
|
10
|
+
export { default as Separator } from "../separator/components/separator.svelte";
|
|
11
|
+
export { default as ItemIndicator } from "./components/combobox-item-indicator.svelte";
|
|
12
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Root } from "./components/combobox.svelte";
|
|
2
|
+
export { default as Content } from "./components/combobox-content.svelte";
|
|
3
|
+
export { default as Input } from "./components/combobox-input.svelte";
|
|
4
|
+
export { default as Item } from "./components/combobox-item.svelte";
|
|
5
|
+
export { default as Label } from "./components/combobox-label.svelte";
|
|
6
|
+
export { default as Group } from "./components/combobox-group.svelte";
|
|
7
|
+
export { default as GroupLabel } from "./components/combobox-group-label.svelte";
|
|
8
|
+
export { default as Arrow } from "./components/combobox-arrow.svelte";
|
|
9
|
+
export { default as HiddenInput } from "./components/combobox-hidden-input.svelte";
|
|
10
|
+
export { default as Separator } from "../separator/components/separator.svelte";
|
|
11
|
+
export { default as ItemIndicator } from "./components/combobox-item-indicator.svelte";
|
|
12
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HTMLDivAttributes, Transition } from "../../internal/index.js";
|
|
2
|
+
import type { EventHandler, HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
import type { CustomEventHandler } from "../../index.js";
|
|
4
|
+
import type * as I from "./_types.js";
|
|
5
|
+
type Props<T, Multiple extends boolean = false> = I.Props<T, Multiple>;
|
|
6
|
+
type ContentProps<T extends Transition = Transition, In extends Transition = Transition, Out extends Transition = Transition> = I.ContentProps<T, In, Out> & HTMLDivAttributes;
|
|
7
|
+
type InputProps = I.InputProps & HTMLInputAttributes;
|
|
8
|
+
type LabelProps = I.LabelProps & HTMLDivAttributes;
|
|
9
|
+
type GroupProps = I.GroupProps & HTMLDivAttributes;
|
|
10
|
+
type GroupLabelProps = I.GroupLabelProps & HTMLDivAttributes;
|
|
11
|
+
type ItemProps = I.ItemProps & HTMLDivAttributes;
|
|
12
|
+
type HiddenInputProps = I.HiddenInputProps & HTMLInputAttributes;
|
|
13
|
+
type SeparatorProps = I.SeparatorProps & HTMLDivAttributes;
|
|
14
|
+
type IndicatorProps = I.IndicatorProps & HTMLDivAttributes;
|
|
15
|
+
type ArrowProps = I.ArrowProps & HTMLDivAttributes;
|
|
16
|
+
type ItemEvents<T extends Element = HTMLDivElement> = {
|
|
17
|
+
click: CustomEventHandler<MouseEvent, T>;
|
|
18
|
+
pointermove: CustomEventHandler<PointerEvent, T>;
|
|
19
|
+
focusin: EventHandler<FocusEvent, T>;
|
|
20
|
+
keydown: EventHandler<KeyboardEvent, T>;
|
|
21
|
+
focusout: EventHandler<FocusEvent, T>;
|
|
22
|
+
pointerleave: EventHandler<PointerEvent, T>;
|
|
23
|
+
};
|
|
24
|
+
type ContentEvents<T extends Element = HTMLDivElement> = {
|
|
25
|
+
pointerleave: CustomEventHandler<PointerEvent, T>;
|
|
26
|
+
keydown: EventHandler<KeyboardEvent, T>;
|
|
27
|
+
};
|
|
28
|
+
type GroupLabelEvents<T extends Element = HTMLSpanElement> = {
|
|
29
|
+
click: CustomEventHandler<MouseEvent, T>;
|
|
30
|
+
};
|
|
31
|
+
type InputEvents = {
|
|
32
|
+
keydown: CustomEventHandler<KeyboardEvent, HTMLInputElement>;
|
|
33
|
+
input: CustomEventHandler<InputEvent, HTMLInputElement>;
|
|
34
|
+
click: CustomEventHandler<ClipboardEvent, HTMLInputElement>;
|
|
35
|
+
};
|
|
36
|
+
export type { Props, ContentProps, InputProps, ItemProps, LabelProps, GroupProps, GroupLabelProps, ArrowProps, HiddenInputProps, SeparatorProps, IndicatorProps, ContentEvents, InputEvents, ItemEvents, GroupLabelEvents, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Props as ContextMenuProps, SubProps as ContextMenuSubProps, ItemProps as ContextMenuItemProps, ArrowProps as ContextMenuArrowProps, GroupProps as ContextMenuGroupProps, LabelProps as ContextMenuLabelProps, ContentProps as ContextMenuContentProps, TriggerProps as ContextMenuTriggerProps, RadioItemProps as ContextMenuRadioItemProps, SeparatorProps as ContextMenuSeparatorProps, RadioGroupProps as ContextMenuRadioGroupProps, SubContentProps as ContextMenuSubContentProps, SubTriggerProps as ContextMenuSubTriggerProps, CheckboxItemProps as ContextMenuCheckboxItemProps, RadioIndicatorProps as ContextMenuRadioIndicatorProps, CheckboxIndicatorProps as ContextMenuCheckboxIndicatorProps, ItemEvents as ContextMenuItemEvents, TriggerEvents as ContextMenuTriggerEvents, ContentEvents as ContextMenuContentEvents, RadioItemEvents as ContextMenuRadioItemEvents, SubContentEvents as ContextMenuSubContentEvents, SubTriggerEvents as ContextMenuSubTriggerEvents, CheckboxItemEvents as ContextMenuCheckboxItemEvents } from "./types.js";
|
|
1
|
+
export type { Props as ContextMenuProps, SubProps as ContextMenuSubProps, ItemProps as ContextMenuItemProps, ArrowProps as ContextMenuArrowProps, GroupProps as ContextMenuGroupProps, LabelProps as ContextMenuLabelProps, ContentProps as ContextMenuContentProps, TriggerProps as ContextMenuTriggerProps, RadioItemProps as ContextMenuRadioItemProps, SeparatorProps as ContextMenuSeparatorProps, RadioGroupProps as ContextMenuRadioGroupProps, SubContentProps as ContextMenuSubContentProps, SubTriggerProps as ContextMenuSubTriggerProps, CheckboxItemProps as ContextMenuCheckboxItemProps, RadioIndicatorProps as ContextMenuRadioIndicatorProps, CheckboxIndicatorProps as ContextMenuCheckboxIndicatorProps, ItemEvents as ContextMenuItemEvents, TriggerEvents as ContextMenuTriggerEvents, ContentEvents as ContextMenuContentEvents, RadioItemEvents as ContextMenuRadioItemEvents, SubContentEvents as ContextMenuSubContentEvents, SubTriggerEvents as ContextMenuSubTriggerEvents, CheckboxItemEvents as ContextMenuCheckboxItemEvents, } from "./types.js";
|
|
@@ -89,12 +89,7 @@ $:
|
|
|
89
89
|
<slot {builder} />
|
|
90
90
|
</div>
|
|
91
91
|
{:else if $open}
|
|
92
|
-
<div
|
|
93
|
-
bind:this={el}
|
|
94
|
-
{...builder} use:builder.action
|
|
95
|
-
{...$$restProps}
|
|
96
|
-
on:m-keydown={dispatch}
|
|
97
|
-
>
|
|
92
|
+
<div bind:this={el} {...builder} use:builder.action {...$$restProps} on:m-keydown={dispatch}>
|
|
98
93
|
<slot {builder} />
|
|
99
94
|
</div>
|
|
100
95
|
{/if}
|
|
@@ -37,13 +37,10 @@ const {
|
|
|
37
37
|
return next;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
const idValues = derived(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
trigger: $triggerId
|
|
45
|
-
})
|
|
46
|
-
);
|
|
40
|
+
const idValues = derived([ids.menu, ids.trigger], ([$menuId, $triggerId]) => ({
|
|
41
|
+
menu: $menuId,
|
|
42
|
+
trigger: $triggerId
|
|
43
|
+
}));
|
|
47
44
|
$:
|
|
48
45
|
open !== void 0 && localOpen.set(open);
|
|
49
46
|
$:
|
|
@@ -7,10 +7,10 @@ declare const __propDef: {
|
|
|
7
7
|
onOutsideClick?: ((event: PointerEvent) => void) | undefined;
|
|
8
8
|
portal?: string | HTMLElement | null | undefined;
|
|
9
9
|
closeFocus?: import("@melt-ui/svelte/index.js").FocusProp | undefined;
|
|
10
|
+
typeahead?: boolean | undefined;
|
|
11
|
+
loop?: boolean | undefined;
|
|
10
12
|
dir?: import("@melt-ui/svelte/internal/types").TextDirection | undefined;
|
|
11
13
|
closeOnItemClick?: boolean | undefined;
|
|
12
|
-
loop?: boolean | undefined;
|
|
13
|
-
typeahead?: boolean | undefined;
|
|
14
14
|
disableFocusFirstItem?: boolean | undefined;
|
|
15
15
|
open?: boolean | undefined;
|
|
16
16
|
onOpenChange?: import("../../../internal/types.js").OnChangeFn<boolean> | undefined;
|
|
@@ -9,7 +9,7 @@ export declare function getContextMenuData(): {
|
|
|
9
9
|
type GetReturn = Omit<ReturnType<typeof setCtx>, "updateOption">;
|
|
10
10
|
export declare function setCtx(props: CreateContextMenuProps): {
|
|
11
11
|
updateOption: <K extends string, V extends unknown>(key: K, value: V | undefined) => void;
|
|
12
|
-
getAttrs: (part: "content" | "checkbox-indicator" | "
|
|
12
|
+
getAttrs: (part: "content" | "checkbox-indicator" | "label" | "arrow" | "group" | "radio-group" | "separator" | "item" | "trigger" | "checkbox-item" | "radio-item" | "sub-content" | "sub-trigger") => Record<string, string>;
|
|
13
13
|
ids: import("@melt-ui/svelte/internal/helpers").ToWritableStores<{
|
|
14
14
|
menu: string;
|
|
15
15
|
trigger: string;
|
|
@@ -17,11 +17,11 @@ export function getContextMenuData() {
|
|
|
17
17
|
"separator",
|
|
18
18
|
"sub-content",
|
|
19
19
|
"sub-trigger",
|
|
20
|
-
"trigger"
|
|
20
|
+
"trigger",
|
|
21
21
|
];
|
|
22
22
|
return {
|
|
23
23
|
NAME,
|
|
24
|
-
PARTS
|
|
24
|
+
PARTS,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
export function setCtx(props) {
|
|
@@ -31,7 +31,7 @@ export function setCtx(props) {
|
|
|
31
31
|
setContext(NAME, contextMenu);
|
|
32
32
|
return {
|
|
33
33
|
...contextMenu,
|
|
34
|
-
updateOption: getOptionUpdater(contextMenu.options)
|
|
34
|
+
updateOption: getOptionUpdater(contextMenu.options),
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
export function getCtx() {
|
|
@@ -41,10 +41,10 @@ export function getCtx() {
|
|
|
41
41
|
export function updatePositioning(props) {
|
|
42
42
|
const defaultPlacement = {
|
|
43
43
|
side: "bottom",
|
|
44
|
-
align: "start"
|
|
44
|
+
align: "start",
|
|
45
45
|
};
|
|
46
46
|
const withDefaults = { ...defaultPlacement, ...props };
|
|
47
|
-
const { options: { positioning } } = getCtx();
|
|
47
|
+
const { options: { positioning }, } = getCtx();
|
|
48
48
|
const updater = getPositioningUpdater(positioning);
|
|
49
49
|
updater(withDefaults);
|
|
50
50
|
}
|
|
@@ -2,4 +2,4 @@ import type { ArrowProps, CheckboxItemProps, RadioGroupProps, RadioItemProps, Gr
|
|
|
2
2
|
import type { HTMLDivAttributes, Transition } from "../../internal";
|
|
3
3
|
import type * as I from "./_types.js";
|
|
4
4
|
type ContentProps<T extends Transition = Transition, In extends Transition = Transition, Out extends Transition = Transition> = I.ContentProps<T, In, Out> & HTMLDivAttributes;
|
|
5
|
-
export type { Props, SubProps, ItemProps, ArrowProps, GroupProps, LabelProps, ContentProps, TriggerProps, RadioItemProps, SeparatorProps, RadioGroupProps, SubContentProps, SubTriggerProps, CheckboxItemProps, CheckboxIndicatorProps, RadioIndicatorProps, ItemEvents, TriggerEvents, ContentEvents, RadioItemEvents, SubContentEvents, SubTriggerEvents, CheckboxItemEvents };
|
|
5
|
+
export type { Props, SubProps, ItemProps, ArrowProps, GroupProps, LabelProps, ContentProps, TriggerProps, RadioItemProps, SeparatorProps, RadioGroupProps, SubContentProps, SubTriggerProps, CheckboxItemProps, CheckboxIndicatorProps, RadioIndicatorProps, ItemEvents, TriggerEvents, ContentEvents, RadioItemEvents, SubContentEvents, SubTriggerEvents, CheckboxItemEvents, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Props as DateFieldProps, LabelProps as DateFieldLabelProps, DescriptionProps as DateFieldDescriptionProps, InputProps as DateFieldInputProps, SegmentProps as DateFieldSegmentProps, SegmentEvents as DateFieldSegmentEvents } from "./types.js";
|
|
1
|
+
export type { Props as DateFieldProps, LabelProps as DateFieldLabelProps, DescriptionProps as DateFieldDescriptionProps, InputProps as DateFieldInputProps, SegmentProps as DateFieldSegmentProps, SegmentEvents as DateFieldSegmentEvents, } from "./types.js";
|
|
@@ -17,11 +17,7 @@ export let validationId = void 0;
|
|
|
17
17
|
export let descriptionId = void 0;
|
|
18
18
|
export let readonlySegments = void 0;
|
|
19
19
|
const {
|
|
20
|
-
states: {
|
|
21
|
-
value: localValue,
|
|
22
|
-
placeholder: localPlaceholder,
|
|
23
|
-
isInvalid: localIsInvalid
|
|
24
|
-
},
|
|
20
|
+
states: { value: localValue, placeholder: localPlaceholder, isInvalid: localIsInvalid },
|
|
25
21
|
updateOption,
|
|
26
22
|
ids
|
|
27
23
|
} = setCtx({
|
|
@@ -7,7 +7,7 @@ export declare function getDateFieldData(): {
|
|
|
7
7
|
type GetReturn = Omit<ReturnType<typeof setCtx>, "updateOption">;
|
|
8
8
|
export declare function setCtx(props: CreateDateFieldProps): {
|
|
9
9
|
updateOption: <K extends string, V extends unknown>(key: K, value: V | undefined) => void;
|
|
10
|
-
getAttrs: (part: "
|
|
10
|
+
getAttrs: (part: "label" | "segment" | "input") => Record<string, string>;
|
|
11
11
|
elements: {
|
|
12
12
|
field: import("@melt-ui/svelte/internal/helpers").ExplicitBuilderReturn<[{
|
|
13
13
|
update: (updater: import("svelte/store").Updater<import("@internationalized/date").DateValue | undefined>, sideEffect?: ((newValue: import("@internationalized/date").DateValue | undefined) => void) | undefined) => void;
|
|
@@ -6,7 +6,7 @@ export function getDateFieldData() {
|
|
|
6
6
|
const PARTS = ["label", "input", "segment"];
|
|
7
7
|
return {
|
|
8
8
|
NAME,
|
|
9
|
-
PARTS
|
|
9
|
+
PARTS,
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export function setCtx(props) {
|
|
@@ -16,7 +16,7 @@ export function setCtx(props) {
|
|
|
16
16
|
setContext(NAME, dateField);
|
|
17
17
|
return {
|
|
18
18
|
...dateField,
|
|
19
|
-
updateOption: getOptionUpdater(dateField.options)
|
|
19
|
+
updateOption: getOptionUpdater(dateField.options),
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
export function getCtx() {
|
|
@@ -11,4 +11,4 @@ type SegmentEvents = {
|
|
|
11
11
|
focusout: CustomEventHandler<FocusEvent, HTMLDivElement>;
|
|
12
12
|
keydown: CustomEventHandler<KeyboardEvent, HTMLDivElement>;
|
|
13
13
|
};
|
|
14
|
-
export type { Props, LabelProps, DescriptionProps, InputProps, SegmentProps, SegmentEvents };
|
|
14
|
+
export type { Props, LabelProps, DescriptionProps, InputProps, SegmentProps, SegmentEvents, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { Props as DatePickerProps, CalendarProps as DatePickerCalendarProps, LabelProps as DatePickerLabelProps, DescriptionProps as DatePickerDescriptionProps, InputProps as DatePickerInputProps, SegmentProps as DatePickerSegmentProps, CellProps as DatePickerCellProps, DayProps as DatePickerDayProps, GridBodyProps as DatePickerGridBodyProps, GridHeadProps as DatePickerGridHeadProps, GridRowProps as DatePickerGridRowProps, GridProps as DatePickerGridProps, HeadCellProps as DatePickerHeadCellProps, HeaderProps as DatePickerHeaderProps, HeadingProps as DatePickerHeadingProps, NextButtonProps as DatePickerNextButtonProps, PrevButtonProps as DatePickerPrevButtonProps, TriggerProps as DatePickerTriggerProps, ContentProps as DatePickerContentProps, ArrowProps as DatePickerArrowProps, CloseProps as DatePickerCloseProps, CloseEvents as DatePickerCloseEvents, TriggerEvents as DatePickerTriggerEvents, CalendarEvents as DatePickerCalendarEvents, DayEvents as DatePickerDayEvents, PrevButtonEvents as DatePickerPrevButtonEvents, NextButtonEvents as DatePickerNextButtonEvents, SegmentEvents as DatePickerSegmentEvents } from "./types.js";
|
|
1
|
+
export type { Props as DatePickerProps, CalendarProps as DatePickerCalendarProps, LabelProps as DatePickerLabelProps, DescriptionProps as DatePickerDescriptionProps, InputProps as DatePickerInputProps, SegmentProps as DatePickerSegmentProps, CellProps as DatePickerCellProps, DayProps as DatePickerDayProps, GridBodyProps as DatePickerGridBodyProps, GridHeadProps as DatePickerGridHeadProps, GridRowProps as DatePickerGridRowProps, GridProps as DatePickerGridProps, HeadCellProps as DatePickerHeadCellProps, HeaderProps as DatePickerHeaderProps, HeadingProps as DatePickerHeadingProps, NextButtonProps as DatePickerNextButtonProps, PrevButtonProps as DatePickerPrevButtonProps, TriggerProps as DatePickerTriggerProps, ContentProps as DatePickerContentProps, ArrowProps as DatePickerArrowProps, CloseProps as DatePickerCloseProps, CloseEvents as DatePickerCloseEvents, TriggerEvents as DatePickerTriggerEvents, CalendarEvents as DatePickerCalendarEvents, DayEvents as DatePickerDayEvents, PrevButtonEvents as DatePickerPrevButtonEvents, NextButtonEvents as DatePickerNextButtonEvents, SegmentEvents as DatePickerSegmentEvents, } from "./types.js";
|
|
@@ -28,12 +28,7 @@ $:
|
|
|
28
28
|
{#if asChild}
|
|
29
29
|
<slot {builder} {months} weekdays={$weekdays} />
|
|
30
30
|
{:else}
|
|
31
|
-
<div
|
|
32
|
-
bind:this={el}
|
|
33
|
-
{...builder} use:builder.action
|
|
34
|
-
{...$$restProps}
|
|
35
|
-
on:m-keydown={dispatch}
|
|
36
|
-
>
|
|
31
|
+
<div bind:this={el} {...builder} use:builder.action {...$$restProps} on:m-keydown={dispatch}>
|
|
37
32
|
<slot {builder} {months} weekdays={$weekdays} />
|
|
38
33
|
</div>
|
|
39
34
|
{/if}
|
|
@@ -54,12 +54,7 @@ $:
|
|
|
54
54
|
{#if asChild && $open}
|
|
55
55
|
<slot {builder} />
|
|
56
56
|
{:else if transition && $open}
|
|
57
|
-
<div
|
|
58
|
-
bind:this={el}
|
|
59
|
-
transition:transition={transitionConfig}
|
|
60
|
-
{...builder} use:builder.action
|
|
61
|
-
{...$$restProps}
|
|
62
|
-
>
|
|
57
|
+
<div bind:this={el} transition:transition={transitionConfig} {...builder} use:builder.action {...$$restProps}>
|
|
63
58
|
<slot {builder} />
|
|
64
59
|
</div>
|
|
65
60
|
{:else if inTransition && outTransition && $open}
|
|
@@ -73,21 +68,11 @@ $:
|
|
|
73
68
|
<slot {builder} />
|
|
74
69
|
</div>
|
|
75
70
|
{:else if inTransition && $open}
|
|
76
|
-
<div
|
|
77
|
-
bind:this={el}
|
|
78
|
-
in:inTransition={inTransitionConfig}
|
|
79
|
-
{...builder} use:builder.action
|
|
80
|
-
{...$$restProps}
|
|
81
|
-
>
|
|
71
|
+
<div bind:this={el} in:inTransition={inTransitionConfig} {...builder} use:builder.action {...$$restProps}>
|
|
82
72
|
<slot {builder} />
|
|
83
73
|
</div>
|
|
84
74
|
{:else if outTransition && $open}
|
|
85
|
-
<div
|
|
86
|
-
bind:this={el}
|
|
87
|
-
out:outTransition={outTransitionConfig}
|
|
88
|
-
{...builder} use:builder.action
|
|
89
|
-
{...$$restProps}
|
|
90
|
-
>
|
|
75
|
+
<div bind:this={el} out:outTransition={outTransitionConfig} {...builder} use:builder.action {...$$restProps}>
|
|
91
76
|
<slot {builder} />
|
|
92
77
|
</div>
|
|
93
78
|
{:else if $open}
|
|
@@ -16,11 +16,7 @@ export let readonly = void 0;
|
|
|
16
16
|
export let validationId = void 0;
|
|
17
17
|
export let descriptionId = void 0;
|
|
18
18
|
const {
|
|
19
|
-
states: {
|
|
20
|
-
value: localValue,
|
|
21
|
-
placeholder: localPlaceholder,
|
|
22
|
-
isInvalid: localIsInvalid
|
|
23
|
-
},
|
|
19
|
+
states: { value: localValue, placeholder: localPlaceholder, isInvalid: localIsInvalid },
|
|
24
20
|
updateOption,
|
|
25
21
|
ids
|
|
26
22
|
} = setCtx({
|
|
@@ -18,13 +18,7 @@ $:
|
|
|
18
18
|
{#if asChild}
|
|
19
19
|
<slot {builder} />
|
|
20
20
|
{:else}
|
|
21
|
-
<button
|
|
22
|
-
bind:this={el}
|
|
23
|
-
{...builder} use:builder.action
|
|
24
|
-
type="button"
|
|
25
|
-
{...$$restProps}
|
|
26
|
-
on:m-click={dispatch}
|
|
27
|
-
>
|
|
21
|
+
<button bind:this={el} {...builder} use:builder.action type="button" {...$$restProps} on:m-click={dispatch}>
|
|
28
22
|
<slot {builder} />
|
|
29
23
|
</button>
|
|
30
24
|
{/if}
|
|
@@ -18,13 +18,7 @@ $:
|
|
|
18
18
|
{#if asChild}
|
|
19
19
|
<slot {builder} />
|
|
20
20
|
{:else}
|
|
21
|
-
<button
|
|
22
|
-
bind:this={el}
|
|
23
|
-
{...builder} use:builder.action
|
|
24
|
-
type="button"
|
|
25
|
-
{...$$restProps}
|
|
26
|
-
on:m-click={dispatch}
|
|
27
|
-
>
|
|
21
|
+
<button bind:this={el} {...builder} use:builder.action type="button" {...$$restProps} on:m-click={dispatch}>
|
|
28
22
|
<slot {builder} />
|
|
29
23
|
</button>
|
|
30
24
|
{/if}
|