@rockfic.com/vue3-select-component 0.0.0-stage → 1.0.1

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.
Files changed (47) hide show
  1. package/dist/assembled/Select.d.ts +33 -0
  2. package/dist/composables/useSelectCollection.d.ts +18 -0
  3. package/dist/composables/useSelectDismiss.d.ts +14 -0
  4. package/dist/composables/useSelectKeyboard.d.ts +8 -0
  5. package/dist/composables/useSelectState.d.ts +36 -0
  6. package/dist/eslint.config.d.ts +1 -0
  7. package/dist/index.d.ts +11 -0
  8. package/dist/index.es.js +246 -0
  9. package/dist/lib/context.d.ts +51 -0
  10. package/dist/lib/create-item.d.ts +5 -0
  11. package/dist/lib/dom.d.ts +2 -0
  12. package/dist/lib/filter.d.ts +5 -0
  13. package/dist/lib/group-context.d.ts +15 -0
  14. package/dist/lib/ids.d.ts +5 -0
  15. package/dist/lib/normalize-options.d.ts +12 -0
  16. package/dist/primitives/SelectClear.d.ts +11 -0
  17. package/dist/primitives/SelectCreateItem.d.ts +11 -0
  18. package/dist/primitives/SelectGroup.d.ts +19 -0
  19. package/dist/primitives/SelectGroupLabel.d.ts +11 -0
  20. package/dist/primitives/SelectIcon.d.ts +11 -0
  21. package/dist/primitives/SelectInput.d.ts +4 -0
  22. package/dist/primitives/SelectListbox.d.ts +11 -0
  23. package/dist/primitives/SelectNoOptions.d.ts +11 -0
  24. package/dist/primitives/SelectOption.d.ts +20 -0
  25. package/dist/primitives/SelectPopover.d.ts +32 -0
  26. package/dist/primitives/SelectPopoverTriggerSync.d.ts +3 -0
  27. package/dist/primitives/SelectRoot.d.ts +31 -0
  28. package/dist/primitives/SelectSeparator.d.ts +3 -0
  29. package/dist/primitives/SelectTag.d.ts +22 -0
  30. package/dist/primitives/SelectTrailingIcon.d.ts +11 -0
  31. package/dist/primitives/SelectTrigger.d.ts +11 -0
  32. package/dist/primitives/SelectValue.d.ts +20 -0
  33. package/dist/primitives/index.d.ts +18 -0
  34. package/dist/primitives-B7jyuJ7a.js +3704 -0
  35. package/dist/primitives.js +1 -0
  36. package/dist/styles.css +1 -0
  37. package/dist/types/assembled.d.ts +31 -0
  38. package/dist/types/model.d.ts +1 -0
  39. package/dist/types/option.d.ts +6 -0
  40. package/dist/types/primitives.d.ts +37 -0
  41. package/dist/types/root.d.ts +27 -0
  42. package/dist/types/slots.d.ts +62 -0
  43. package/dist/vite.config.d.ts +2 -0
  44. package/dist/vite.styles.config.d.ts +2 -0
  45. package/dist/vitest.config.d.ts +2 -0
  46. package/package.json +94 -6
  47. package/README.md +0 -3
@@ -0,0 +1,33 @@
1
+ import { SelectModelValue } from '../types/model.js';
2
+ import { SelectOption as SelectOptionData } from '../types/option.js';
3
+ import { AssembledSelectSlots } from '../types/slots.js';
4
+ declare const __VLS_export: <OptionValue extends string | number = string, GenericOption = SelectOptionData<OptionValue>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<(import('../types/assembled.js').AssembledSelectBehaviorProps<GenericOption, OptionValue> & import('../index.js').SelectPopoverContentProps & import('../index.js').SelectPopoverRootProps & import('../index.js').SelectPopoverPortalProps & {
6
+ teleport?: import('../types/primitives.js').SelectPopoverTeleportTarget;
7
+ } & {
8
+ modelValue?: SelectModelValue<OptionValue>;
9
+ }) & {
10
+ onSearch?: ((value: string) => any) | undefined;
11
+ "onUpdate:modelValue"?: ((value: SelectModelValue<OptionValue>) => any) | undefined;
12
+ onMenuOpened?: (() => any) | undefined;
13
+ onMenuClosed?: (() => any) | undefined;
14
+ onCreate?: ((value: string) => any) | undefined;
15
+ onOptionSelected?: ((option: GenericOption) => any) | undefined;
16
+ onOptionDeselected?: ((option: GenericOption | null) => any) | undefined;
17
+ }> & (typeof globalThis extends {
18
+ __VLS_PROPS_FALLBACK: infer P;
19
+ } ? P : {});
20
+ expose: (exposed: {}) => void;
21
+ attrs: any;
22
+ slots: AssembledSelectSlots;
23
+ emit: (((evt: "search", value: string) => void) & ((evt: "menuOpened") => void) & ((evt: "menuClosed") => void) & ((evt: "create", value: string) => void) & ((evt: "optionSelected", option: GenericOption) => void) & ((evt: "optionDeselected", option: GenericOption | null) => void)) & ((event: "update:modelValue", value: SelectModelValue<OptionValue>) => void);
24
+ }>) => import('vue').VNode & {
25
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
26
+ };
27
+ declare const _default: typeof __VLS_export;
28
+ export default _default;
29
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
30
+ [K in keyof T]: T[K];
31
+ } : {
32
+ [K in keyof T as K]: T[K];
33
+ }) & {};
@@ -0,0 +1,18 @@
1
+ import { SelectOption } from '../types/option.js';
2
+ export type RegisteredOption<Value> = {
3
+ id: string;
4
+ value: Value;
5
+ label: string;
6
+ disabled: boolean;
7
+ };
8
+ type UseSelectCollectionParams<Value> = {
9
+ propOptions: () => readonly SelectOption<Value>[];
10
+ };
11
+ export declare function useSelectCollection<Value extends string | number>(params: UseSelectCollectionParams<Value>): {
12
+ register: (option: RegisteredOption<Value>) => void;
13
+ unregister: (id: string) => void;
14
+ allOptions: import('vue').ComputedRef<RegisteredOption<Value>[]>;
15
+ };
16
+ export declare function getEnabledOptions<Value>(options: readonly RegisteredOption<Value>[]): RegisteredOption<Value>[];
17
+ export declare function findNextEnabledOption<Value>(options: readonly RegisteredOption<Value>[], currentValue: Value | null, direction: 1 | -1): RegisteredOption<Value> | null;
18
+ export {};
@@ -0,0 +1,14 @@
1
+ import { Ref } from 'vue';
2
+ type UseSelectDismissParams = {
3
+ isOpen: Ref<boolean>;
4
+ close: () => void;
5
+ };
6
+ export declare function useSelectDismiss(params: UseSelectDismissParams): {
7
+ registerRootElement: (element: HTMLElement | null) => void;
8
+ registerTriggerElement: (element: HTMLElement | null) => void;
9
+ registerPopoverElement: (element: HTMLElement | null) => void;
10
+ rootElement: import('vue').ShallowRef<HTMLElement | null, HTMLElement | null>;
11
+ triggerElement: import('vue').ShallowRef<HTMLElement | null, HTMLElement | null>;
12
+ popoverElement: import('vue').ShallowRef<HTMLElement | null, HTMLElement | null>;
13
+ };
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import { SelectContext } from '../lib/context.js';
2
+ type UseSelectKeyboardParams<OptionValue extends string | number> = {
3
+ context: SelectContext<OptionValue>;
4
+ };
5
+ export declare function useSelectKeyboard<OptionValue extends string | number>(params: UseSelectKeyboardParams<OptionValue>): {
6
+ handleKeydown: (event: KeyboardEvent) => void;
7
+ };
8
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Ref } from 'vue';
2
+ import { SelectContext } from '../lib/context.js';
3
+ import { CreateItemMode } from '../lib/create-item.js';
4
+ import { FilterByFn } from '../lib/filter.js';
5
+ import { SelectModelValue } from '../types/model.js';
6
+ import { SelectOption } from '../types/option.js';
7
+ import { useSelectCollection } from './useSelectCollection.js';
8
+ type SelectStateEvents<OptionValue> = {
9
+ onMenuOpened?: () => void;
10
+ onMenuClosed?: () => void;
11
+ onSearch?: (value: string) => void;
12
+ onCreate?: (value: string) => void;
13
+ onOptionSelected?: (value: OptionValue) => void;
14
+ onOptionDeselected?: (value: OptionValue | null) => void;
15
+ };
16
+ type UseSelectStateParams<OptionValue extends string | number> = {
17
+ modelValue: Ref<SelectModelValue<OptionValue>>;
18
+ multiple: Ref<boolean>;
19
+ disabled: Ref<boolean>;
20
+ searchable: Ref<boolean>;
21
+ clearable: Ref<boolean>;
22
+ loading: Ref<boolean>;
23
+ closeOnSelect?: Ref<boolean | null | undefined>;
24
+ resetSearchOnBlur?: Ref<boolean>;
25
+ resetSearchOnSelect?: Ref<boolean>;
26
+ hideSelected?: Ref<boolean>;
27
+ createItem?: Ref<CreateItemMode | undefined>;
28
+ propOptions: Ref<readonly SelectOption<OptionValue>[]>;
29
+ filterBy: Ref<FilterByFn<OptionValue>>;
30
+ collection: ReturnType<typeof useSelectCollection<OptionValue>>;
31
+ events?: SelectStateEvents<OptionValue>;
32
+ };
33
+ export declare function useSelectState<OptionValue extends string | number>(params: UseSelectStateParams<OptionValue>): {
34
+ context: SelectContext<OptionValue>;
35
+ };
36
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from '@vue3-select-component/eslint-config';
@@ -0,0 +1,11 @@
1
+ export { default as Select } from './assembled/Select.js';
2
+ export { injectSelectContext, provideSelectContext } from './lib/context.js';
3
+ export type { SelectContext } from './lib/context.js';
4
+ export type { CreateItemMode } from './lib/create-item.js';
5
+ export { SelectClear, SelectCreateItem, SelectGroup, SelectGroupLabel, SelectIcon, SelectInput, SelectListbox, SelectNoOptions, SelectOption, SelectPopover, SelectRoot, SelectSeparator, SelectTag, SelectTrailingIcon, SelectTrigger, SelectValue, } from './primitives/index.js';
6
+ export type { AssembledSelectEmits, AssembledSelectProps } from './types/assembled.js';
7
+ export type { SelectModelValue } from './types/model.js';
8
+ export type { SelectOption as SelectOptionData } from './types/option.js';
9
+ export type { SelectPopoverContentProps, SelectPopoverPortalProps, SelectPopoverProps, SelectPopoverRootProps, } from './types/primitives.js';
10
+ export type { SelectRootEmits, SelectRootProps } from './types/root.js';
11
+ export type { AssembledSelectSlots, SelectClearSlots, SelectCreateItemSlots, SelectDefaultSlots, SelectGroupLabelSlots, SelectGroupSlots, SelectIconSlots, SelectNoOptionsSlots, SelectOptionSlots, SelectSearchValueSlotProps, SelectSeparatorSlots, SelectTagRemoveSlotProps, SelectTagSlots, SelectTrailingIconSlotProps, SelectTrailingIconSlots, SelectValueDefaultSlotProps, SelectValueSlots, } from './types/slots.js';
@@ -0,0 +1,246 @@
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./primitives-B7jyuJ7a.js";
2
+ import { Fragment as y, computed as b, createBlock as x, createCommentVNode as S, createElementBlock as C, createSlots as w, createVNode as T, defineComponent as E, guardReactiveProps as D, mergeModels as O, mergeProps as k, normalizeProps as A, openBlock as j, renderList as M, renderSlot as N, toRef as P, useAttrs as F, useModel as I, withCtx as L } from "vue";
3
+ // lib/normalize-options.ts
4
+ function R(e) {
5
+ if (e && typeof e == "object" && "disabled" in e) return !!e.disabled;
6
+ }
7
+ function z(e) {
8
+ return {
9
+ getOptionValue: e?.getOptionValue ?? ((e) => e.value),
10
+ getOptionLabel: e?.getOptionLabel ?? ((e) => e.label),
11
+ getOptionKey: e?.getOptionKey ?? ((e) => typeof e == "object" ? e.value : e)
12
+ };
13
+ }
14
+ function B(e, t) {
15
+ return e.map((e) => ({
16
+ key: t.getOptionKey(t.getOptionValue(e)),
17
+ value: t.getOptionValue(e),
18
+ label: t.getOptionLabel(e),
19
+ disabled: R(e)
20
+ }));
21
+ }
22
+ function V(e, t, n) {
23
+ let r = new Map(e.map((e) => [t.getOptionValue(e), {
24
+ source: e,
25
+ label: t.getOptionLabel(e)
26
+ }]));
27
+ return (e, t) => {
28
+ let i = r.get(e.value);
29
+ return i && n ? n(i.source, i.label, t) : v(e, t);
30
+ };
31
+ }
32
+ function H(e, t, n) {
33
+ return e.find((e) => t.getOptionValue(e) === n);
34
+ }
35
+ // assembled/Select.vue
36
+ var U = /* @__PURE__ */ E({
37
+ inheritAttrs: !1,
38
+ __name: "Select",
39
+ props: /*@__PURE__*/ O({
40
+ multiple: {
41
+ type: Boolean,
42
+ default: !1
43
+ },
44
+ searchable: {
45
+ type: Boolean,
46
+ default: !0
47
+ },
48
+ clearable: {
49
+ type: Boolean,
50
+ default: !1
51
+ },
52
+ disabled: {
53
+ type: Boolean,
54
+ default: !1
55
+ },
56
+ loading: {
57
+ type: Boolean,
58
+ default: !1
59
+ },
60
+ options: {},
61
+ placeholder: {},
62
+ closeOnSelect: {
63
+ type: [Boolean, null],
64
+ default: null
65
+ },
66
+ resetSearchOnBlur: {
67
+ type: Boolean,
68
+ default: !0
69
+ },
70
+ resetSearchOnSelect: {
71
+ type: Boolean,
72
+ default: !0
73
+ },
74
+ hideSelected: {
75
+ type: Boolean,
76
+ default: !1
77
+ },
78
+ createItem: { type: [Boolean, String] },
79
+ filterBy: {},
80
+ getOptionValue: {},
81
+ getOptionLabel: {},
82
+ getOptionKey: {},
83
+ memoDependencies: {},
84
+ side: {},
85
+ sideOffset: {},
86
+ sideFlip: { type: Boolean },
87
+ align: {},
88
+ alignOffset: {},
89
+ alignFlip: { type: Boolean },
90
+ avoidCollisions: { type: Boolean },
91
+ collisionBoundary: {},
92
+ collisionPadding: {},
93
+ arrowPadding: {},
94
+ hideShiftedArrow: { type: Boolean },
95
+ sticky: {},
96
+ hideWhenDetached: { type: Boolean },
97
+ positionStrategy: {},
98
+ updatePositionStrategy: {},
99
+ disableUpdateOnLayoutShift: { type: Boolean },
100
+ prioritizePosition: { type: Boolean },
101
+ dir: {},
102
+ disableOutsidePointerEvents: { type: Boolean },
103
+ modal: { type: Boolean },
104
+ defer: { type: Boolean },
105
+ teleport: {
106
+ type: [Boolean, String],
107
+ default: !0
108
+ }
109
+ }, {
110
+ modelValue: { default: null },
111
+ modelModifiers: {}
112
+ }),
113
+ emits: /*@__PURE__*/ O([
114
+ "optionSelected",
115
+ "optionDeselected",
116
+ "menuOpened",
117
+ "menuClosed",
118
+ "search",
119
+ "create"
120
+ ], ["update:modelValue"]),
121
+ setup(e, { emit: t }) {
122
+ let u = e, p = t, h = I(e, "modelValue"), _ = F(), v = P(() => u.options), E = /* @__PURE__ */ new Set([
123
+ "id",
124
+ "name",
125
+ "form",
126
+ "required",
127
+ "aria-label",
128
+ "aria-labelledby",
129
+ "aria-describedby",
130
+ "aria-invalid",
131
+ "aria-required"
132
+ ]), O = b(() => Object.fromEntries(Object.entries(_).filter(([e]) => !E.has(e)))), R = b(() => Object.fromEntries(Object.entries(_).filter(([e]) => E.has(e)))), U = b(() => u.searchable ? {} : R.value), W = b(() => u.searchable ? R.value : {}), G = b(() => z({
133
+ getOptionValue: u.getOptionValue,
134
+ getOptionLabel: u.getOptionLabel,
135
+ getOptionKey: u.getOptionKey
136
+ })), K = b(() => B(v.value, G.value)), q = b(() => V(v.value, G.value, u.filterBy)), J = b(() => {
137
+ let { multiple: e, searchable: t, clearable: n, disabled: r, loading: i, options: a, placeholder: o, closeOnSelect: s, resetSearchOnBlur: c, resetSearchOnSelect: l, hideSelected: d, createItem: f, filterBy: p, getOptionValue: m, getOptionLabel: h, ...g } = u;
138
+ return g;
139
+ });
140
+ function Y(e) {
141
+ let t = H(v.value, G.value, e);
142
+ t != null && p("optionSelected", t);
143
+ }
144
+ function X(e) {
145
+ if (e == null) {
146
+ p("optionDeselected", null);
147
+ return;
148
+ }
149
+ let t = H(v.value, G.value, e);
150
+ t != null && p("optionDeselected", t);
151
+ }
152
+ return (t, u) => (j(), x(n, k({
153
+ modelValue: h.value,
154
+ "onUpdate:modelValue": u[0] ||= (e) => h.value = e,
155
+ options: K.value,
156
+ multiple: e.multiple,
157
+ searchable: e.searchable,
158
+ clearable: e.clearable,
159
+ disabled: e.disabled,
160
+ loading: e.loading,
161
+ "close-on-select": e.closeOnSelect,
162
+ "reset-search-on-blur": e.resetSearchOnBlur,
163
+ "reset-search-on-select": e.resetSearchOnSelect,
164
+ "hide-selected": e.hideSelected,
165
+ "create-item": e.createItem,
166
+ "filter-by": q.value,
167
+ "data-assembled-select": ""
168
+ }, O.value, {
169
+ onMenuOpened: u[1] ||= (e) => p("menuOpened"),
170
+ onMenuClosed: u[2] ||= (e) => p("menuClosed"),
171
+ onSearch: u[3] ||= (e) => p("search", e),
172
+ onCreate: u[4] ||= (e) => p("create", e),
173
+ onOptionSelected: Y,
174
+ onOptionDeselected: X
175
+ }), {
176
+ default: L(() => [T(d, A(D(U.value)), {
177
+ default: L(() => [
178
+ t.$slots.icon ? (j(), x(l, { key: 0 }, {
179
+ default: L(() => [N(t.$slots, "icon")]),
180
+ _: 3
181
+ })) : S("", !0),
182
+ T(s, { placeholder: e.placeholder }, w({ _: 2 }, [t.$slots["tag-remove"] ? {
183
+ name: "tag-remove",
184
+ fn: L((e) => [N(t.$slots, "tag-remove", A(D(e)))]),
185
+ key: "0"
186
+ } : void 0]), 1032, ["placeholder"]),
187
+ T(f, A(D(W.value)), null, 16),
188
+ T(m, null, w({ _: 2 }, [t.$slots["trailing-icon"] ? {
189
+ name: "default",
190
+ fn: L((e) => [N(t.$slots, "trailing-icon", A(D(e)))]),
191
+ key: "0"
192
+ } : void 0]), 1024),
193
+ e.clearable ? (j(), x(a, { key: 1 }, w({ _: 2 }, [t.$slots.clear ? {
194
+ name: "default",
195
+ fn: L(() => [N(t.$slots, "clear")]),
196
+ key: "0"
197
+ } : void 0]), 1024)) : S("", !0)
198
+ ]),
199
+ _: 3
200
+ }, 16), T(c, A(D(J.value)), {
201
+ default: L(() => [T(i, null, {
202
+ default: L(() => [
203
+ T(r, null, w({ _: 2 }, [t.$slots["no-options"] ? {
204
+ name: "default",
205
+ fn: L((e) => [N(t.$slots, "no-options", A(D(e)))]),
206
+ key: "0"
207
+ } : void 0]), 1024),
208
+ (j(!0), C(y, null, M(K.value, (e) => (j(), x(g, {
209
+ key: e.key ?? e.value,
210
+ value: e.value,
211
+ label: e.label,
212
+ disabled: e.disabled
213
+ }, null, 8, [
214
+ "value",
215
+ "label",
216
+ "disabled"
217
+ ]))), 128)),
218
+ e.createItem ? (j(), x(o, { key: 0 }, w({ _: 2 }, [t.$slots["create-item"] ? {
219
+ name: "default",
220
+ fn: L((e) => [N(t.$slots, "create-item", A(D(e)))]),
221
+ key: "0"
222
+ } : void 0]), 1024)) : S("", !0)
223
+ ]),
224
+ _: 3
225
+ })]),
226
+ _: 3
227
+ }, 16)]),
228
+ _: 3
229
+ }, 16, [
230
+ "modelValue",
231
+ "options",
232
+ "multiple",
233
+ "searchable",
234
+ "clearable",
235
+ "disabled",
236
+ "loading",
237
+ "close-on-select",
238
+ "reset-search-on-blur",
239
+ "reset-search-on-select",
240
+ "hide-selected",
241
+ "create-item",
242
+ "filter-by"
243
+ ]));
244
+ }
245
+ });
246
+ export { U as Select, a as SelectClear, o as SelectCreateItem, p as SelectGroup, u as SelectGroupLabel, l as SelectIcon, f as SelectInput, i as SelectListbox, r as SelectNoOptions, g as SelectOption, c as SelectPopover, n as SelectRoot, h as SelectSeparator, t as SelectTag, m as SelectTrailingIcon, d as SelectTrigger, s as SelectValue, e as injectSelectContext, _ as provideSelectContext };
@@ -0,0 +1,51 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { RegisteredOption } from '../composables/useSelectCollection.js';
3
+ import { SelectModelValue } from '../types/model.js';
4
+ export type SelectContext<OptionValue = string> = {
5
+ modelValue: Ref<SelectModelValue<OptionValue>>;
6
+ isOpen: Ref<boolean>;
7
+ searchValue: Ref<string>;
8
+ multiple: Ref<boolean>;
9
+ disabled: Ref<boolean>;
10
+ searchable: Ref<boolean>;
11
+ clearable: Ref<boolean>;
12
+ loading: Ref<boolean>;
13
+ activeOptionValue: Ref<OptionValue | null>;
14
+ triggerId: string;
15
+ inputId: string;
16
+ listboxId: string;
17
+ activeOptionElementId: ComputedRef<string | undefined>;
18
+ allOptions: ComputedRef<readonly RegisteredOption<OptionValue>[]>;
19
+ filteredOptions: ComputedRef<readonly RegisteredOption<OptionValue>[]>;
20
+ selectedOptions: ComputedRef<readonly RegisteredOption<OptionValue>[]>;
21
+ showCreateItem: ComputedRef<boolean>;
22
+ createItemSearchValue: ComputedRef<string>;
23
+ isCreateItemActive: ComputedRef<boolean>;
24
+ createItemElementId: string;
25
+ open: () => void;
26
+ close: () => void;
27
+ toggle: () => void;
28
+ select: (value: OptionValue) => void;
29
+ selectCreateItem: () => void;
30
+ selectActiveOption: () => void;
31
+ deselect: (value: OptionValue) => void;
32
+ deselectLast: () => void;
33
+ clear: () => void;
34
+ registerOption: (option: RegisteredOption<OptionValue>) => void;
35
+ unregisterOption: (id: string) => void;
36
+ setActiveOptionValue: (value: OptionValue | null) => void;
37
+ moveActiveOption: (direction: 1 | -1) => void;
38
+ focusFirstOption: () => void;
39
+ isOptionVisible: (value: OptionValue) => boolean;
40
+ handleKeydown: (event: KeyboardEvent) => void;
41
+ registerRootElement: (element: HTMLElement | null) => void;
42
+ registerTriggerElement: (element: HTMLElement | null) => void;
43
+ registerInputElement: (element: HTMLInputElement | null) => void;
44
+ registerPopoverElement: (element: HTMLElement | null) => void;
45
+ rootElement: Ref<HTMLElement | null>;
46
+ triggerElement: Ref<HTMLElement | null>;
47
+ inputElement: Ref<HTMLInputElement | null>;
48
+ popoverElement: Ref<HTMLElement | null>;
49
+ };
50
+ export declare function provideSelectContext<OptionValue>(context: SelectContext<OptionValue>): void;
51
+ export declare function injectSelectContext<OptionValue = string>(): SelectContext<OptionValue>;
@@ -0,0 +1,5 @@
1
+ export type CreateItemMode = boolean | "always";
2
+ /**
3
+ * Whether the create-item action should be shown in the dropdown.
4
+ */
5
+ export declare function shouldShowCreateItem(createItem: CreateItemMode | undefined, searchable: boolean, searchValue: string, filteredOptionsCount: number): boolean;
@@ -0,0 +1,2 @@
1
+ import { ComponentPublicInstance } from 'vue';
2
+ export declare function resolveHTMLElement(node: Element | ComponentPublicInstance | null): HTMLElement | null;
@@ -0,0 +1,5 @@
1
+ import { RegisteredOption } from '../composables/useSelectCollection.js';
2
+ type FilterByFn<Value> = (option: RegisteredOption<Value>, search: string) => boolean;
3
+ export declare const defaultSelectFilterBy: <Value>(option: RegisteredOption<Value>, search: string) => boolean;
4
+ export declare function filterOptions<Value>(options: readonly RegisteredOption<Value>[], search: string, filterBy?: FilterByFn<Value>): RegisteredOption<Value>[];
5
+ export type { FilterByFn };
@@ -0,0 +1,15 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ export type SelectGroupContext<OptionValue = string> = {
3
+ groupId: string;
4
+ labelId: string;
5
+ labelledBy: ComputedRef<string | undefined>;
6
+ isVisible: ComputedRef<boolean>;
7
+ hasLabel: Ref<boolean>;
8
+ registerLabel: () => void;
9
+ unregisterLabel: () => void;
10
+ registerOptionValue: (value: OptionValue) => void;
11
+ unregisterOptionValue: (value: OptionValue) => void;
12
+ };
13
+ export declare function provideSelectGroupContext<OptionValue>(context: SelectGroupContext<OptionValue>): void;
14
+ export declare function injectSelectGroupContext<OptionValue = string>(): SelectGroupContext<OptionValue>;
15
+ export declare function injectOptionalSelectGroupContext<OptionValue = string>(): SelectGroupContext<OptionValue> | null;
@@ -0,0 +1,5 @@
1
+ export declare function createSelectInstanceId(): string;
2
+ export declare function createOptionId(): string;
3
+ export declare function createGroupId(): string;
4
+ export declare function createGroupLabelId(): string;
5
+ export declare function createPropOptionId(value: string | number): string;
@@ -0,0 +1,12 @@
1
+ import { SelectOption } from '../types/option.js';
2
+ import { FilterByFn } from './filter.js';
3
+ export type OptionMapper<GenericOption, OptionValue> = {
4
+ getOptionValue: (option: GenericOption) => OptionValue;
5
+ getOptionLabel: (option: GenericOption) => string;
6
+ getOptionKey: (option: OptionValue) => string | number;
7
+ };
8
+ export type GenericFilterByFn<GenericOption> = (option: GenericOption, label: string, search: string) => boolean;
9
+ export declare function createOptionMappers<GenericOption, OptionValue>(mappers?: Partial<OptionMapper<GenericOption, OptionValue>>): OptionMapper<GenericOption, OptionValue>;
10
+ export declare function normalizeSelectOptions<GenericOption, OptionValue>(options: readonly GenericOption[], mappers: OptionMapper<GenericOption, OptionValue>): SelectOption<OptionValue>[];
11
+ export declare function createGenericFilterByAdapter<GenericOption, OptionValue>(options: readonly GenericOption[], mappers: OptionMapper<GenericOption, OptionValue>, filterBy?: GenericFilterByFn<GenericOption>): FilterByFn<OptionValue>;
12
+ export declare function findSourceOptionByValue<GenericOption, OptionValue>(options: readonly GenericOption[], mappers: OptionMapper<GenericOption, OptionValue>, value: OptionValue): GenericOption | undefined;
@@ -0,0 +1,11 @@
1
+ import { SelectClearSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectClearSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,11 @@
1
+ import { SelectCreateItemSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectCreateItemSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,19 @@
1
+ import { SelectDefaultSlots } from '../types/slots.js';
2
+ declare const __VLS_export: <OptionValue extends string | number = string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import('vue').PublicProps & (typeof globalThis extends {
4
+ __VLS_PROPS_FALLBACK: infer P;
5
+ } ? P : {});
6
+ expose: (exposed: {}) => void;
7
+ attrs: any;
8
+ slots: SelectDefaultSlots;
9
+ emit: {};
10
+ }>) => import('vue').VNode & {
11
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
12
+ };
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
16
+ [K in keyof T]: T[K];
17
+ } : {
18
+ [K in keyof T as K]: T[K];
19
+ }) & {};
@@ -0,0 +1,11 @@
1
+ import { SelectDefaultSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectDefaultSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,11 @@
1
+ import { SelectIconSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectIconSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,4 @@
1
+ import { SelectInputProps } from '../types/primitives.js';
2
+ declare const __VLS_export: import('vue').DefineComponent<SelectInputProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SelectInputProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { SelectDefaultSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectDefaultSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,11 @@
1
+ import { SelectNoOptionsSlots } from '../types/slots.js';
2
+ type __VLS_Slots = SelectNoOptionsSlots;
3
+ declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
7
+ type __VLS_WithSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,20 @@
1
+ import { SelectOptionProps } from '../types/primitives.js';
2
+ import { SelectOptionSlots } from '../types/slots.js';
3
+ declare const __VLS_export: <OptionValue extends string | number = string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectOptionProps<OptionValue>> & (typeof globalThis extends {
5
+ __VLS_PROPS_FALLBACK: infer P;
6
+ } ? P : {});
7
+ expose: (exposed: {}) => void;
8
+ attrs: any;
9
+ slots: SelectOptionSlots;
10
+ emit: {};
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
13
+ };
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
17
+ [K in keyof T]: T[K];
18
+ } : {
19
+ [K in keyof T as K]: T[K];
20
+ }) & {};
@@ -0,0 +1,32 @@
1
+ import { SelectPopoverProps } from '../types/primitives.js';
2
+ import { SelectDefaultSlots } from '../types/slots.js';
3
+ type __VLS_Slots = SelectDefaultSlots;
4
+ declare const __VLS_base: import('vue').DefineComponent<SelectPopoverProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
5
+ escapeKeyDown: (event: KeyboardEvent) => any;
6
+ pointerDownOutside: (event: import('reka-ui').PointerDownOutsideEvent) => any;
7
+ focusOutside: (event: import('reka-ui').FocusOutsideEvent) => any;
8
+ interactOutside: (event: import('reka-ui').PointerDownOutsideEvent | import('reka-ui').FocusOutsideEvent) => any;
9
+ openAutoFocus: (event: Event) => any;
10
+ closeAutoFocus: (event: Event) => any;
11
+ }, string, import('vue').PublicProps, Readonly<SelectPopoverProps> & Readonly<{
12
+ onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
13
+ onPointerDownOutside?: ((event: import('reka-ui').PointerDownOutsideEvent) => any) | undefined;
14
+ onFocusOutside?: ((event: import('reka-ui').FocusOutsideEvent) => any) | undefined;
15
+ onInteractOutside?: ((event: import('reka-ui').PointerDownOutsideEvent | import('reka-ui').FocusOutsideEvent) => any) | undefined;
16
+ onOpenAutoFocus?: ((event: Event) => any) | undefined;
17
+ onCloseAutoFocus?: ((event: Event) => any) | undefined;
18
+ }>, {
19
+ side: "top" | "right" | "bottom" | "left";
20
+ sideOffset: number;
21
+ align: "center" | "end" | "start";
22
+ avoidCollisions: boolean;
23
+ teleport: import('../types/primitives.js').SelectPopoverTeleportTarget;
24
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;