@agile-plus/headless 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -17
- package/dist/index.cjs +4163 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +4258 -216
- package/dist/index.js.map +1 -1
- package/dist/types-BxsQI7P5.d.cts +93 -0
- package/dist/types-BxsQI7P5.d.ts +93 -0
- package/dist/types-zpeY0yvD.d.cts +73 -0
- package/dist/types-zpeY0yvD.d.ts +73 -0
- package/dist/useAccordion/index.cjs +149 -0
- package/dist/useAccordion/index.cjs.map +1 -0
- package/dist/useAccordion/index.d.cts +119 -0
- package/dist/useAccordion/index.d.ts +119 -0
- package/dist/useAccordion/index.js +128 -0
- package/dist/useAccordion/index.js.map +1 -0
- package/dist/useAvatar/index.cjs +135 -0
- package/dist/useAvatar/index.cjs.map +1 -0
- package/dist/useAvatar/index.d.cts +120 -0
- package/dist/useAvatar/index.d.ts +120 -0
- package/dist/useAvatar/index.js +106 -0
- package/dist/useAvatar/index.js.map +1 -0
- package/dist/useCheckbox/index.cjs +3 -1
- package/dist/useCheckbox/index.cjs.map +1 -1
- package/dist/useCheckbox/index.js +3 -1
- package/dist/useCheckbox/index.js.map +1 -1
- package/dist/useCollapsible/index.cjs +10 -0
- package/dist/useCollapsible/index.cjs.map +1 -1
- package/dist/useCollapsible/index.js +11 -1
- package/dist/useCollapsible/index.js.map +1 -1
- package/dist/useDatePicker/index.cjs +684 -0
- package/dist/useDatePicker/index.cjs.map +1 -0
- package/dist/useDatePicker/index.d.cts +191 -0
- package/dist/useDatePicker/index.d.ts +191 -0
- package/dist/useDatePicker/index.js +671 -0
- package/dist/useDatePicker/index.js.map +1 -0
- package/dist/useDateRangePicker/index.cjs +614 -0
- package/dist/useDateRangePicker/index.cjs.map +1 -0
- package/dist/useDateRangePicker/index.d.cts +159 -0
- package/dist/useDateRangePicker/index.d.ts +159 -0
- package/dist/useDateRangePicker/index.js +601 -0
- package/dist/useDateRangePicker/index.js.map +1 -0
- package/dist/useDialog/index.cjs.map +1 -1
- package/dist/useDialog/index.js.map +1 -1
- package/dist/useDropdownMenu/index.cjs +468 -0
- package/dist/useDropdownMenu/index.cjs.map +1 -0
- package/dist/useDropdownMenu/index.d.cts +73 -0
- package/dist/useDropdownMenu/index.d.ts +73 -0
- package/dist/useDropdownMenu/index.js +441 -0
- package/dist/useDropdownMenu/index.js.map +1 -0
- package/dist/useEllipsis/index.cjs +181 -0
- package/dist/useEllipsis/index.cjs.map +1 -0
- package/dist/useEllipsis/index.d.cts +67 -0
- package/dist/useEllipsis/index.d.ts +67 -0
- package/dist/useEllipsis/index.js +162 -0
- package/dist/useEllipsis/index.js.map +1 -0
- package/dist/useFloating/index.cjs +177 -0
- package/dist/useFloating/index.cjs.map +1 -0
- package/dist/useFloating/index.d.cts +21 -0
- package/dist/useFloating/index.d.ts +21 -0
- package/dist/useFloating/index.js +150 -0
- package/dist/useFloating/index.js.map +1 -0
- package/dist/useFormControl/index.cjs +5 -0
- package/dist/useFormControl/index.cjs.map +1 -1
- package/dist/useFormControl/index.js +5 -0
- package/dist/useFormControl/index.js.map +1 -1
- package/dist/useInput/index.cjs +192 -0
- package/dist/useInput/index.cjs.map +1 -0
- package/dist/useInput/index.d.cts +41 -0
- package/dist/useInput/index.d.ts +41 -0
- package/dist/useInput/index.js +165 -0
- package/dist/useInput/index.js.map +1 -0
- package/dist/useKeepMounted/index.cjs +44 -0
- package/dist/useKeepMounted/index.cjs.map +1 -0
- package/dist/useKeepMounted/index.d.cts +45 -0
- package/dist/useKeepMounted/index.d.ts +45 -0
- package/dist/useKeepMounted/index.js +17 -0
- package/dist/useKeepMounted/index.js.map +1 -0
- package/dist/useMenu/index.cjs +438 -0
- package/dist/useMenu/index.cjs.map +1 -0
- package/dist/useMenu/index.d.cts +134 -0
- package/dist/useMenu/index.d.ts +134 -0
- package/dist/useMenu/index.js +419 -0
- package/dist/useMenu/index.js.map +1 -0
- package/dist/usePagination/index.cjs +113 -0
- package/dist/usePagination/index.cjs.map +1 -0
- package/dist/usePagination/index.d.cts +139 -0
- package/dist/usePagination/index.d.ts +139 -0
- package/dist/usePagination/index.js +95 -0
- package/dist/usePagination/index.js.map +1 -0
- package/dist/usePopover/index.cjs +312 -0
- package/dist/usePopover/index.cjs.map +1 -0
- package/dist/usePopover/index.d.cts +71 -0
- package/dist/usePopover/index.d.ts +71 -0
- package/dist/usePopover/index.js +285 -0
- package/dist/usePopover/index.js.map +1 -0
- package/dist/useSelect/index.cjs +729 -0
- package/dist/useSelect/index.cjs.map +1 -0
- package/dist/useSelect/index.d.cts +193 -0
- package/dist/useSelect/index.d.ts +193 -0
- package/dist/useSelect/index.js +710 -0
- package/dist/useSelect/index.js.map +1 -0
- package/dist/useSplitter/index.cjs +558 -0
- package/dist/useSplitter/index.cjs.map +1 -0
- package/dist/useSplitter/index.d.cts +307 -0
- package/dist/useSplitter/index.d.ts +307 -0
- package/dist/useSplitter/index.js +541 -0
- package/dist/useSplitter/index.js.map +1 -0
- package/dist/useSwitch/index.cjs +4 -1
- package/dist/useSwitch/index.cjs.map +1 -1
- package/dist/useSwitch/index.js +4 -1
- package/dist/useSwitch/index.js.map +1 -1
- package/dist/useTable/index.cjs +308 -0
- package/dist/useTable/index.cjs.map +1 -0
- package/dist/useTable/index.d.cts +242 -0
- package/dist/useTable/index.d.ts +242 -0
- package/dist/useTable/index.js +301 -0
- package/dist/useTable/index.js.map +1 -0
- package/dist/useTabs/index.cjs +13 -4
- package/dist/useTabs/index.cjs.map +1 -1
- package/dist/useTabs/index.d.cts +5 -1
- package/dist/useTabs/index.d.ts +5 -1
- package/dist/useTabs/index.js +13 -4
- package/dist/useTabs/index.js.map +1 -1
- package/dist/useTextControl-Dcq0GFmg.d.cts +63 -0
- package/dist/useTextControl-Dcq0GFmg.d.ts +63 -0
- package/dist/useTextarea/index.cjs +186 -0
- package/dist/useTextarea/index.cjs.map +1 -0
- package/dist/useTextarea/index.d.cts +30 -0
- package/dist/useTextarea/index.d.ts +30 -0
- package/dist/useTextarea/index.js +159 -0
- package/dist/useTextarea/index.js.map +1 -0
- package/dist/useToast/index.cjs +27 -20
- package/dist/useToast/index.cjs.map +1 -1
- package/dist/useToast/index.js +27 -20
- package/dist/useToast/index.js.map +1 -1
- package/dist/useToastViewport/index.cjs +1 -3
- package/dist/useToastViewport/index.cjs.map +1 -1
- package/dist/useToastViewport/index.js +1 -3
- package/dist/useToastViewport/index.js.map +1 -1
- package/dist/useTooltip/index.cjs +357 -0
- package/dist/useTooltip/index.cjs.map +1 -0
- package/dist/useTooltip/index.d.cts +81 -0
- package/dist/useTooltip/index.d.ts +81 -0
- package/dist/useTooltip/index.js +338 -0
- package/dist/useTooltip/index.js.map +1 -0
- package/dist/useVirtualList/index.cjs +308 -0
- package/dist/useVirtualList/index.cjs.map +1 -0
- package/dist/useVirtualList/index.d.cts +31 -0
- package/dist/useVirtualList/index.d.ts +31 -0
- package/dist/useVirtualList/index.js +288 -0
- package/dist/useVirtualList/index.js.map +1 -0
- package/dist/useVirtualTree/index.cjs +520 -0
- package/dist/useVirtualTree/index.cjs.map +1 -0
- package/dist/useVirtualTree/index.d.cts +146 -0
- package/dist/useVirtualTree/index.d.ts +146 -0
- package/dist/useVirtualTree/index.js +511 -0
- package/dist/useVirtualTree/index.js.map +1 -0
- package/package.json +121 -2
- package/src/index.ts +38 -0
- package/src/useAccordion/index.ts +7 -0
- package/src/useAccordion/types.ts +118 -0
- package/src/useAccordion/useAccordion.ts +130 -0
- package/src/useAvatar/index.ts +14 -0
- package/src/useAvatar/types.ts +90 -0
- package/src/useAvatar/useAvatar.ts +39 -0
- package/src/useAvatar/useAvatarFallback.ts +62 -0
- package/src/useAvatar/useAvatarImage.ts +78 -0
- package/src/useCheckbox/useCheckbox.ts +4 -1
- package/src/useCollapsible/useCollapsible.ts +22 -1
- package/src/useDatePicker/index.ts +9 -0
- package/src/useDatePicker/types.ts +177 -0
- package/src/useDatePicker/useDatePicker.ts +688 -0
- package/src/useDateRangePicker/index.ts +8 -0
- package/src/useDateRangePicker/types.ts +146 -0
- package/src/useDateRangePicker/useDateRangePicker.ts +618 -0
- package/src/useDropdownMenu/index.ts +3 -0
- package/src/useDropdownMenu/types.ts +61 -0
- package/src/useDropdownMenu/useDropdownMenu.ts +322 -0
- package/src/useEllipsis/index.ts +3 -0
- package/src/useEllipsis/types.ts +51 -0
- package/src/useEllipsis/useEllipsis.ts +169 -0
- package/src/useFloating/index.ts +3 -0
- package/src/useFloating/types.ts +79 -0
- package/src/useFloating/useFloating.ts +199 -0
- package/src/useFormControl/useFormControl.ts +13 -0
- package/src/useInput/index.ts +3 -0
- package/src/useInput/types.ts +29 -0
- package/src/useInput/useInput.ts +40 -0
- package/src/useKeepMounted/index.ts +3 -0
- package/src/useKeepMounted/types.ts +29 -0
- package/src/useKeepMounted/useKeepMounted.ts +34 -0
- package/src/useMenu/index.ts +9 -0
- package/src/useMenu/types.ts +126 -0
- package/src/useMenu/useMenu.ts +504 -0
- package/src/usePagination/index.ts +3 -0
- package/src/usePagination/types.ts +137 -0
- package/src/usePagination/usePagination.ts +109 -0
- package/src/usePopover/index.ts +3 -0
- package/src/usePopover/types.ts +65 -0
- package/src/usePopover/usePopover.ts +157 -0
- package/src/useSelect/index.ts +9 -0
- package/src/useSelect/types.ts +184 -0
- package/src/useSelect/useSelect.ts +713 -0
- package/src/useSplitter/index.ts +10 -0
- package/src/useSplitter/types.ts +336 -0
- package/src/useSplitter/useSplitter.ts +648 -0
- package/src/useSplitter/useSplitterPanel.ts +106 -0
- package/src/useSwitch/useSwitch.ts +6 -1
- package/src/useTable/index.ts +3 -0
- package/src/useTable/types.ts +282 -0
- package/src/useTable/useTable.ts +407 -0
- package/src/useTabs/types.ts +5 -1
- package/src/useTabs/useTabs.ts +30 -6
- package/src/useTextarea/index.ts +3 -0
- package/src/useTextarea/types.ts +17 -0
- package/src/useTextarea/useTextarea.ts +34 -0
- package/src/useToast/useToast.ts +43 -26
- package/src/useToastViewport/useToastViewport.ts +10 -9
- package/src/useTooltip/index.ts +3 -0
- package/src/useTooltip/types.ts +72 -0
- package/src/useTooltip/useTooltip.ts +240 -0
- package/src/useVirtualList/index.ts +8 -0
- package/src/useVirtualList/types.ts +95 -0
- package/src/useVirtualList/useVirtualList.ts +478 -0
- package/src/useVirtualTree/index.ts +3 -0
- package/src/useVirtualTree/types.ts +179 -0
- package/src/useVirtualTree/useVirtualTree.ts +342 -0
- package/src/utils/useFocusTrap.ts +2 -0
- package/src/utils/useTextControl.ts +191 -0
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
// src/useSelect/useSelect.ts
|
|
2
|
+
import { computed as computed4, onScopeDispose as onScopeDispose4, ref as ref2, shallowRef as shallowRef3, toValue as toValue4, useId, watch as watch3 } from "vue";
|
|
3
|
+
import { getHiddenSelectStyle, writeNativeSelectValue } from "@agile-plus/primitives/form";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_TYPEAHEAD_TIMEOUT,
|
|
6
|
+
appendTypeaheadSearch,
|
|
7
|
+
findTypeaheadMatch,
|
|
8
|
+
resolveOpenHighlight,
|
|
9
|
+
resolveScrollTop,
|
|
10
|
+
resolveSelectHighlight,
|
|
11
|
+
resolveSelectKeyIntent
|
|
12
|
+
} from "@agile-plus/primitives/select";
|
|
13
|
+
|
|
14
|
+
// src/utils/useControllable.ts
|
|
15
|
+
import { computed, shallowRef, toValue } from "vue";
|
|
16
|
+
function useControllable(options) {
|
|
17
|
+
const controlled = computed(() => toValue(options.value));
|
|
18
|
+
const isControlled = computed(() => controlled.value !== void 0);
|
|
19
|
+
const internal = shallowRef(options.defaultValue);
|
|
20
|
+
const value = computed(() => {
|
|
21
|
+
const current = controlled.value;
|
|
22
|
+
return current === void 0 ? internal.value : current;
|
|
23
|
+
});
|
|
24
|
+
function set(next) {
|
|
25
|
+
if (!isControlled.value) internal.value = next;
|
|
26
|
+
options.onChange?.(next);
|
|
27
|
+
}
|
|
28
|
+
function replace(next) {
|
|
29
|
+
if (isControlled.value) return;
|
|
30
|
+
internal.value = next;
|
|
31
|
+
}
|
|
32
|
+
return { value, isControlled, set, replace };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/utils/useCollection.ts
|
|
36
|
+
import { computed as computed2, shallowRef as shallowRef2 } from "vue";
|
|
37
|
+
function useCollection(options) {
|
|
38
|
+
const entries = shallowRef2([]);
|
|
39
|
+
const items = computed2(() => entries.value);
|
|
40
|
+
function add(item) {
|
|
41
|
+
const key = options.key(item);
|
|
42
|
+
entries.value = [...entries.value.filter((existing) => options.key(existing) !== key), item];
|
|
43
|
+
return () => {
|
|
44
|
+
entries.value = entries.value.filter((existing) => existing !== item);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function remove(key) {
|
|
48
|
+
entries.value = entries.value.filter((existing) => options.key(existing) !== key);
|
|
49
|
+
}
|
|
50
|
+
function replace(item) {
|
|
51
|
+
const key = options.key(item);
|
|
52
|
+
entries.value = entries.value.map(
|
|
53
|
+
(existing) => options.key(existing) === key ? item : existing
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return { items, add, remove, replace };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/utils/useFormResetListener.ts
|
|
60
|
+
import { onScopeDispose, toValue as toValue2, watch } from "vue";
|
|
61
|
+
|
|
62
|
+
// src/utils/env.ts
|
|
63
|
+
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
64
|
+
function isObserverAvailable(constructor) {
|
|
65
|
+
return typeof constructor === "function";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/utils/useFormResetListener.ts
|
|
69
|
+
function resolveForm(element, formId) {
|
|
70
|
+
if (!isBrowser) return null;
|
|
71
|
+
if (formId) {
|
|
72
|
+
const node = document.getElementById(formId);
|
|
73
|
+
return node instanceof HTMLFormElement ? node : null;
|
|
74
|
+
}
|
|
75
|
+
const native = element && "form" in element ? element.form : null;
|
|
76
|
+
if (native instanceof HTMLFormElement) return native;
|
|
77
|
+
const closest = element?.closest("form");
|
|
78
|
+
return closest instanceof HTMLFormElement ? closest : null;
|
|
79
|
+
}
|
|
80
|
+
function useFormResetListener(control, onReset, formId) {
|
|
81
|
+
let target = null;
|
|
82
|
+
function detach() {
|
|
83
|
+
if (!target) return;
|
|
84
|
+
target.removeEventListener("reset", onReset);
|
|
85
|
+
target = null;
|
|
86
|
+
}
|
|
87
|
+
watch(
|
|
88
|
+
[control, () => toValue2(formId)],
|
|
89
|
+
([element, nextFormId]) => {
|
|
90
|
+
detach();
|
|
91
|
+
if (!isBrowser) return;
|
|
92
|
+
const form = resolveForm(element, nextFormId);
|
|
93
|
+
if (!form) return;
|
|
94
|
+
form.addEventListener("reset", onReset);
|
|
95
|
+
target = form;
|
|
96
|
+
},
|
|
97
|
+
{ flush: "post" }
|
|
98
|
+
);
|
|
99
|
+
onScopeDispose(detach);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/utils/useResizeObserver.ts
|
|
103
|
+
import { onScopeDispose as onScopeDispose2 } from "vue";
|
|
104
|
+
function useResizeObserver(onResize) {
|
|
105
|
+
let observer = null;
|
|
106
|
+
function observe(element) {
|
|
107
|
+
if (!element || !isBrowser || !isObserverAvailable(globalThis.ResizeObserver)) return;
|
|
108
|
+
observer ??= new ResizeObserver(() => onResize());
|
|
109
|
+
observer.observe(element);
|
|
110
|
+
}
|
|
111
|
+
function unobserve(element) {
|
|
112
|
+
observer?.unobserve(element);
|
|
113
|
+
}
|
|
114
|
+
function disconnect() {
|
|
115
|
+
observer?.disconnect();
|
|
116
|
+
observer = null;
|
|
117
|
+
}
|
|
118
|
+
onScopeDispose2(disconnect);
|
|
119
|
+
return { observe, unobserve, disconnect };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/useFloating/useFloating.ts
|
|
123
|
+
import { computed as computed3, nextTick, onScopeDispose as onScopeDispose3, ref, toValue as toValue3, watch as watch2 } from "vue";
|
|
124
|
+
import { computeAvailableSpace, computeFloatingPosition } from "@agile-plus/primitives/floating";
|
|
125
|
+
function useFloating(options = {}) {
|
|
126
|
+
const referenceRef = ref(null);
|
|
127
|
+
const floatingRef = ref(null);
|
|
128
|
+
const x = ref(0);
|
|
129
|
+
const y = ref(0);
|
|
130
|
+
const placement = ref(toValue3(options.placement) ?? "bottom");
|
|
131
|
+
const arrow = ref(null);
|
|
132
|
+
const availableSpace = ref(null);
|
|
133
|
+
const isOpen = computed3(() => toValue3(options.open) ?? true);
|
|
134
|
+
const strategy = computed3(() => options.strategy ?? "absolute");
|
|
135
|
+
let frame = null;
|
|
136
|
+
const resize = useResizeObserver(requestUpdate);
|
|
137
|
+
function requestUpdate() {
|
|
138
|
+
if (!isBrowser || frame !== null) return;
|
|
139
|
+
frame = window.requestAnimationFrame(() => {
|
|
140
|
+
frame = null;
|
|
141
|
+
measure();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function measure() {
|
|
145
|
+
const reference = referenceRef.value;
|
|
146
|
+
const floating = floatingRef.value;
|
|
147
|
+
if (!reference || !floating) return;
|
|
148
|
+
const referenceRect = reference.getBoundingClientRect();
|
|
149
|
+
const floatingRect = floating.getBoundingClientRect();
|
|
150
|
+
const boundaryRect = toValue3(options.boundary)?.getBoundingClientRect();
|
|
151
|
+
const viewport = { width: window.innerWidth, height: window.innerHeight };
|
|
152
|
+
const scrollX = window.scrollX;
|
|
153
|
+
const scrollY = window.scrollY;
|
|
154
|
+
const snapshot = {
|
|
155
|
+
reference: {
|
|
156
|
+
x: referenceRect.x,
|
|
157
|
+
y: referenceRect.y,
|
|
158
|
+
width: referenceRect.width,
|
|
159
|
+
height: referenceRect.height
|
|
160
|
+
},
|
|
161
|
+
// 浮层自己的 x/y 是上一轮结果,传 0 以免本轮输出依赖历史状态。
|
|
162
|
+
floating: { x: 0, y: 0, width: floatingRect.width, height: floatingRect.height },
|
|
163
|
+
viewport,
|
|
164
|
+
...boundaryRect ? {
|
|
165
|
+
boundary: {
|
|
166
|
+
x: boundaryRect.x,
|
|
167
|
+
y: boundaryRect.y,
|
|
168
|
+
width: boundaryRect.width,
|
|
169
|
+
height: boundaryRect.height
|
|
170
|
+
}
|
|
171
|
+
} : {}
|
|
172
|
+
};
|
|
173
|
+
const floatingOptions = {
|
|
174
|
+
placement: toValue3(options.placement),
|
|
175
|
+
offset: options.offset,
|
|
176
|
+
flip: options.flip,
|
|
177
|
+
shift: options.shift,
|
|
178
|
+
padding: options.padding,
|
|
179
|
+
arrow: options.arrow
|
|
180
|
+
};
|
|
181
|
+
const result = computeFloatingPosition(snapshot, floatingOptions);
|
|
182
|
+
x.value = strategy.value === "absolute" ? result.x + scrollX : result.x;
|
|
183
|
+
y.value = strategy.value === "absolute" ? result.y + scrollY : result.y;
|
|
184
|
+
placement.value = result.placement;
|
|
185
|
+
arrow.value = result.arrow;
|
|
186
|
+
availableSpace.value = computeAvailableSpace(snapshot, result.placement, floatingOptions);
|
|
187
|
+
}
|
|
188
|
+
const floatingStyle = computed3(() => ({
|
|
189
|
+
position: strategy.value,
|
|
190
|
+
left: 0,
|
|
191
|
+
top: 0,
|
|
192
|
+
transform: `translate(${x.value}px, ${y.value}px)`
|
|
193
|
+
}));
|
|
194
|
+
const arrowStyle = computed3(() => {
|
|
195
|
+
const offset = arrow.value;
|
|
196
|
+
if (!offset) return {};
|
|
197
|
+
return offset.x !== null ? { position: "absolute", left: `${offset.x}px` } : { position: "absolute", top: `${offset.y}px` };
|
|
198
|
+
});
|
|
199
|
+
function attach() {
|
|
200
|
+
window.addEventListener("scroll", requestUpdate, true);
|
|
201
|
+
window.addEventListener("resize", requestUpdate);
|
|
202
|
+
resize.observe(referenceRef.value);
|
|
203
|
+
resize.observe(floatingRef.value);
|
|
204
|
+
}
|
|
205
|
+
function detach() {
|
|
206
|
+
if (!isBrowser) return;
|
|
207
|
+
window.removeEventListener("scroll", requestUpdate, true);
|
|
208
|
+
window.removeEventListener("resize", requestUpdate);
|
|
209
|
+
resize.disconnect();
|
|
210
|
+
}
|
|
211
|
+
watch2(
|
|
212
|
+
[isOpen, referenceRef, floatingRef],
|
|
213
|
+
([open]) => {
|
|
214
|
+
detach();
|
|
215
|
+
if (!isBrowser || !open) return;
|
|
216
|
+
attach();
|
|
217
|
+
void nextTick(measure);
|
|
218
|
+
},
|
|
219
|
+
{ immediate: true }
|
|
220
|
+
);
|
|
221
|
+
onScopeDispose3(() => {
|
|
222
|
+
detach();
|
|
223
|
+
if (frame !== null && isBrowser) {
|
|
224
|
+
window.cancelAnimationFrame(frame);
|
|
225
|
+
frame = null;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
referenceRef,
|
|
230
|
+
floatingRef,
|
|
231
|
+
x: computed3(() => x.value),
|
|
232
|
+
y: computed3(() => y.value),
|
|
233
|
+
placement: computed3(() => placement.value),
|
|
234
|
+
availableSpace: computed3(() => availableSpace.value),
|
|
235
|
+
floatingStyle,
|
|
236
|
+
arrowStyle,
|
|
237
|
+
update: requestUpdate
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/useSelect/useSelect.ts
|
|
242
|
+
var DEFAULT_OFFSET = 4;
|
|
243
|
+
var DEFAULT_PADDING = 8;
|
|
244
|
+
function useSelect(options = {}) {
|
|
245
|
+
const uid = useId();
|
|
246
|
+
const triggerId = `select-trigger-${uid}`;
|
|
247
|
+
const contentId = `select-content-${uid}`;
|
|
248
|
+
const valueState = useControllable({
|
|
249
|
+
value: () => toValue4(options.modelValue),
|
|
250
|
+
defaultValue: options.defaultValue ?? "",
|
|
251
|
+
onChange: (next) => options.onValueChange?.(next)
|
|
252
|
+
});
|
|
253
|
+
const openState = useControllable({
|
|
254
|
+
value: () => toValue4(options.open),
|
|
255
|
+
defaultValue: options.defaultOpen ?? false,
|
|
256
|
+
onChange: (next) => options.onOpenChange?.(next)
|
|
257
|
+
});
|
|
258
|
+
const value = valueState.value;
|
|
259
|
+
const isOpen = openState.value;
|
|
260
|
+
const isDisabled = computed4(() => toValue4(options.disabled) === true);
|
|
261
|
+
const isRequired = computed4(() => toValue4(options.required) === true);
|
|
262
|
+
const loop = options.loop ?? true;
|
|
263
|
+
const highlightedValue = ref2(null);
|
|
264
|
+
const collection = useCollection({ key: (entry) => entry.id });
|
|
265
|
+
const floating = useFloating({
|
|
266
|
+
placement: options.placement ?? "bottom-start",
|
|
267
|
+
offset: options.offset ?? DEFAULT_OFFSET,
|
|
268
|
+
flip: options.flip,
|
|
269
|
+
shift: options.shift,
|
|
270
|
+
padding: options.padding ?? DEFAULT_PADDING,
|
|
271
|
+
strategy: options.strategy,
|
|
272
|
+
open: isOpen
|
|
273
|
+
});
|
|
274
|
+
const viewportElement = ref2(null);
|
|
275
|
+
const nativeSelectElement = ref2(null);
|
|
276
|
+
const triggerSize = shallowRef3(null);
|
|
277
|
+
const optionList = computed4(
|
|
278
|
+
() => collection.items.value.map((entry) => ({
|
|
279
|
+
value: entry.value.value,
|
|
280
|
+
textValue: entry.textValue.value,
|
|
281
|
+
disabled: isDisabled.value || entry.disabled.value
|
|
282
|
+
}))
|
|
283
|
+
);
|
|
284
|
+
const hasValue = computed4(() => value.value !== "");
|
|
285
|
+
const optionCache = shallowRef3(/* @__PURE__ */ new Map());
|
|
286
|
+
watch3(
|
|
287
|
+
() => toValue4(options.options) ?? [],
|
|
288
|
+
(list) => {
|
|
289
|
+
if (list.length === 0) return;
|
|
290
|
+
const next = new Map(optionCache.value);
|
|
291
|
+
for (const option of list) {
|
|
292
|
+
next.set(option.value, {
|
|
293
|
+
value: option.value,
|
|
294
|
+
textValue: option.textValue ?? option.label ?? option.value,
|
|
295
|
+
disabled: option.disabled === true
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
optionCache.value = next;
|
|
299
|
+
},
|
|
300
|
+
{ immediate: true }
|
|
301
|
+
);
|
|
302
|
+
watch3(
|
|
303
|
+
optionList,
|
|
304
|
+
(list) => {
|
|
305
|
+
if (list.length === 0) return;
|
|
306
|
+
const next = new Map(optionCache.value);
|
|
307
|
+
for (const option of list) next.set(option.value, option);
|
|
308
|
+
optionCache.value = next;
|
|
309
|
+
},
|
|
310
|
+
{ immediate: true }
|
|
311
|
+
);
|
|
312
|
+
const cachedOptions = computed4(() => [...optionCache.value.values()]);
|
|
313
|
+
const typeaheadOptions = computed4(
|
|
314
|
+
() => optionList.value.length > 0 ? optionList.value : cachedOptions.value
|
|
315
|
+
);
|
|
316
|
+
const selectedText = computed4(
|
|
317
|
+
() => optionList.value.find((option) => option.value === value.value)?.textValue ?? optionCache.value.get(value.value)?.textValue ?? ""
|
|
318
|
+
);
|
|
319
|
+
const activeDescendantId = computed4(() => {
|
|
320
|
+
if (!isOpen.value || highlightedValue.value === null) return void 0;
|
|
321
|
+
return collection.items.value.find((entry) => entry.value.value === highlightedValue.value)?.id;
|
|
322
|
+
});
|
|
323
|
+
const isFormControl = computed4(() => {
|
|
324
|
+
if (toValue4(options.name) || toValue4(options.form)) return true;
|
|
325
|
+
const trigger = floating.referenceRef.value;
|
|
326
|
+
if (!trigger) return true;
|
|
327
|
+
return trigger.closest("form") !== null;
|
|
328
|
+
});
|
|
329
|
+
const resize = useResizeObserver(measureTrigger);
|
|
330
|
+
let typeaheadSearch = "";
|
|
331
|
+
let typeaheadAt = null;
|
|
332
|
+
function getItemId(localId) {
|
|
333
|
+
return `${contentId}-item-${localId}`;
|
|
334
|
+
}
|
|
335
|
+
function findEntry(itemValue) {
|
|
336
|
+
return collection.items.value.find((entry) => entry.value.value === itemValue);
|
|
337
|
+
}
|
|
338
|
+
function setValue(next) {
|
|
339
|
+
valueState.set(next);
|
|
340
|
+
}
|
|
341
|
+
function open() {
|
|
342
|
+
if (isDisabled.value) return;
|
|
343
|
+
highlightedValue.value = resolveOpenHighlight({
|
|
344
|
+
options: optionList.value,
|
|
345
|
+
selectedValue: value.value,
|
|
346
|
+
edge: "first"
|
|
347
|
+
});
|
|
348
|
+
openState.set(true);
|
|
349
|
+
}
|
|
350
|
+
function close() {
|
|
351
|
+
highlightedValue.value = null;
|
|
352
|
+
typeaheadSearch = "";
|
|
353
|
+
typeaheadAt = null;
|
|
354
|
+
openState.set(false);
|
|
355
|
+
}
|
|
356
|
+
function toggle() {
|
|
357
|
+
if (isOpen.value) close();
|
|
358
|
+
else open();
|
|
359
|
+
}
|
|
360
|
+
function commitHighlighted() {
|
|
361
|
+
const current = highlightedValue.value;
|
|
362
|
+
if (current !== null) setValue(current);
|
|
363
|
+
close();
|
|
364
|
+
}
|
|
365
|
+
function moveHighlight(intent) {
|
|
366
|
+
const next = resolveSelectHighlight({
|
|
367
|
+
intent,
|
|
368
|
+
options: optionList.value,
|
|
369
|
+
currentValue: highlightedValue.value,
|
|
370
|
+
loop
|
|
371
|
+
});
|
|
372
|
+
if (next !== null) highlightedValue.value = next;
|
|
373
|
+
}
|
|
374
|
+
function runTypeahead(char) {
|
|
375
|
+
const now = Date.now();
|
|
376
|
+
const timeout = toValue4(options.typeaheadTimeout) ?? DEFAULT_TYPEAHEAD_TIMEOUT;
|
|
377
|
+
typeaheadSearch = appendTypeaheadSearch({
|
|
378
|
+
previous: typeaheadSearch,
|
|
379
|
+
char,
|
|
380
|
+
elapsed: typeaheadAt === null ? timeout : now - typeaheadAt,
|
|
381
|
+
timeout
|
|
382
|
+
});
|
|
383
|
+
typeaheadAt = now;
|
|
384
|
+
const match = findTypeaheadMatch({
|
|
385
|
+
options: typeaheadOptions.value,
|
|
386
|
+
search: typeaheadSearch,
|
|
387
|
+
currentValue: isOpen.value ? highlightedValue.value : value.value || null
|
|
388
|
+
});
|
|
389
|
+
if (match === null) return;
|
|
390
|
+
if (isOpen.value) highlightedValue.value = match;
|
|
391
|
+
else setValue(match);
|
|
392
|
+
}
|
|
393
|
+
function onTriggerClick() {
|
|
394
|
+
if (isDisabled.value) return;
|
|
395
|
+
toggle();
|
|
396
|
+
}
|
|
397
|
+
function onTriggerKeydown(event) {
|
|
398
|
+
if (isDisabled.value) return;
|
|
399
|
+
const intent = resolveSelectKeyIntent({
|
|
400
|
+
key: event.key,
|
|
401
|
+
open: isOpen.value,
|
|
402
|
+
hasModifierKey: event.ctrlKey || event.altKey || event.metaKey
|
|
403
|
+
});
|
|
404
|
+
if (intent.kind === "none") return;
|
|
405
|
+
if (intent.kind !== "tab-out") event.preventDefault();
|
|
406
|
+
switch (intent.kind) {
|
|
407
|
+
case "open":
|
|
408
|
+
highlightedValue.value = resolveOpenHighlight({
|
|
409
|
+
options: optionList.value,
|
|
410
|
+
selectedValue: value.value,
|
|
411
|
+
edge: intent.edge
|
|
412
|
+
});
|
|
413
|
+
openState.set(true);
|
|
414
|
+
break;
|
|
415
|
+
case "close":
|
|
416
|
+
close();
|
|
417
|
+
break;
|
|
418
|
+
case "tab-out":
|
|
419
|
+
close();
|
|
420
|
+
break;
|
|
421
|
+
case "commit":
|
|
422
|
+
commitHighlighted();
|
|
423
|
+
break;
|
|
424
|
+
case "highlight":
|
|
425
|
+
moveHighlight(intent.intent);
|
|
426
|
+
break;
|
|
427
|
+
case "typeahead":
|
|
428
|
+
runTypeahead(intent.char);
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function onTriggerBlur(event) {
|
|
433
|
+
const next = event.relatedTarget;
|
|
434
|
+
if (next instanceof Node) {
|
|
435
|
+
const trigger = floating.referenceRef.value;
|
|
436
|
+
const content = floating.floatingRef.value;
|
|
437
|
+
if (trigger?.contains(next) || content?.contains(next)) return;
|
|
438
|
+
}
|
|
439
|
+
close();
|
|
440
|
+
}
|
|
441
|
+
function onContentPointerDown(event) {
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
}
|
|
444
|
+
function onContentPointerLeave() {
|
|
445
|
+
highlightedValue.value = null;
|
|
446
|
+
}
|
|
447
|
+
function onItemPointerMove(itemValue) {
|
|
448
|
+
const option = optionList.value.find((entry) => entry.value === itemValue);
|
|
449
|
+
if (!option || option.disabled) return;
|
|
450
|
+
highlightedValue.value = itemValue;
|
|
451
|
+
}
|
|
452
|
+
function onItemClick(itemValue) {
|
|
453
|
+
const option = optionList.value.find((entry) => entry.value === itemValue);
|
|
454
|
+
if (!option || option.disabled) return;
|
|
455
|
+
setValue(itemValue);
|
|
456
|
+
close();
|
|
457
|
+
floating.referenceRef.value?.focus();
|
|
458
|
+
}
|
|
459
|
+
function getTriggerProps() {
|
|
460
|
+
const labelledby = toValue4(options.ariaLabelledby);
|
|
461
|
+
const describedby = toValue4(options.ariaDescribedby);
|
|
462
|
+
return {
|
|
463
|
+
id: triggerId,
|
|
464
|
+
role: "combobox",
|
|
465
|
+
"aria-expanded": isOpen.value,
|
|
466
|
+
"aria-controls": contentId,
|
|
467
|
+
"aria-haspopup": "listbox",
|
|
468
|
+
// 列表被 portal 到 body,不是触发元素的 DOM 后代。aria-activedescendant 要求
|
|
469
|
+
// 被指向的元素在自身子树内或经 aria-owns 建立归属,因此打开时显式声明所有权,
|
|
470
|
+
// 否则读屏会拒绝播报高亮项。关闭时不声明:那会把一个 hidden 的子树挂进来。
|
|
471
|
+
"aria-owns": isOpen.value ? contentId : void 0,
|
|
472
|
+
"aria-activedescendant": activeDescendantId.value,
|
|
473
|
+
"aria-required": isRequired.value || void 0,
|
|
474
|
+
"aria-disabled": isDisabled.value || void 0,
|
|
475
|
+
"aria-labelledby": labelledby || void 0,
|
|
476
|
+
"aria-describedby": describedby || void 0,
|
|
477
|
+
"data-state": isOpen.value ? "open" : "closed",
|
|
478
|
+
"data-disabled": isDisabled.value ? "" : void 0,
|
|
479
|
+
// 占位态交给样式层决定文字颜色,逻辑层不输出 class。
|
|
480
|
+
"data-placeholder": hasValue.value ? void 0 : "",
|
|
481
|
+
disabled: isDisabled.value || void 0
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function getContentProps() {
|
|
485
|
+
return {
|
|
486
|
+
id: contentId,
|
|
487
|
+
role: "listbox",
|
|
488
|
+
"aria-labelledby": toValue4(options.ariaLabelledby) || triggerId,
|
|
489
|
+
"aria-orientation": "vertical",
|
|
490
|
+
"data-state": isOpen.value ? "open" : "closed"
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function getViewportProps() {
|
|
494
|
+
return {
|
|
495
|
+
role: "presentation",
|
|
496
|
+
"data-part": "viewport",
|
|
497
|
+
// 视口是滚动容器,必须可聚焦才能让键盘用户用滚轮/方向键之外的方式滚动;
|
|
498
|
+
// 但焦点模型要求焦点留在触发元素,因此这里只给 -1,不进 Tab 序列。
|
|
499
|
+
tabindex: -1
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function getItemProps(itemValue) {
|
|
503
|
+
const option = optionList.value.find((entry) => entry.value === itemValue);
|
|
504
|
+
const disabled = option?.disabled === true;
|
|
505
|
+
const selected = value.value === itemValue;
|
|
506
|
+
return {
|
|
507
|
+
id: findEntry(itemValue)?.id,
|
|
508
|
+
role: "option",
|
|
509
|
+
"aria-selected": selected,
|
|
510
|
+
"aria-disabled": disabled || void 0,
|
|
511
|
+
"data-state": selected ? "checked" : "unchecked",
|
|
512
|
+
"data-highlighted": highlightedValue.value === itemValue ? "" : void 0,
|
|
513
|
+
"data-disabled": disabled ? "" : void 0,
|
|
514
|
+
"data-value": itemValue
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function getGroupProps(labelId) {
|
|
518
|
+
return { role: "group", "aria-labelledby": labelId };
|
|
519
|
+
}
|
|
520
|
+
function getLabelProps(id) {
|
|
521
|
+
return { id, "data-part": "label" };
|
|
522
|
+
}
|
|
523
|
+
function getSeparatorProps() {
|
|
524
|
+
return { role: "separator", "aria-orientation": "horizontal" };
|
|
525
|
+
}
|
|
526
|
+
function getValueProps() {
|
|
527
|
+
return { "data-part": "value", "data-placeholder": hasValue.value ? void 0 : "" };
|
|
528
|
+
}
|
|
529
|
+
function getIconProps() {
|
|
530
|
+
return { "aria-hidden": "true", "data-part": "icon" };
|
|
531
|
+
}
|
|
532
|
+
function getNativeSelectProps() {
|
|
533
|
+
if (!isFormControl.value) return null;
|
|
534
|
+
const name = toValue4(options.name);
|
|
535
|
+
const form = toValue4(options.form);
|
|
536
|
+
return {
|
|
537
|
+
name: name || void 0,
|
|
538
|
+
form: form || void 0,
|
|
539
|
+
required: isRequired.value,
|
|
540
|
+
disabled: isDisabled.value,
|
|
541
|
+
tabindex: -1,
|
|
542
|
+
"aria-hidden": "true",
|
|
543
|
+
style: getHiddenSelectStyle(triggerSize.value)
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function setTriggerElement(node) {
|
|
547
|
+
floating.referenceRef.value = node instanceof HTMLElement ? node : null;
|
|
548
|
+
}
|
|
549
|
+
function setContentElement(node) {
|
|
550
|
+
floating.floatingRef.value = node instanceof HTMLElement ? node : null;
|
|
551
|
+
}
|
|
552
|
+
function setViewportElement(node) {
|
|
553
|
+
viewportElement.value = node instanceof HTMLElement ? node : null;
|
|
554
|
+
}
|
|
555
|
+
function setNativeSelectElement(node) {
|
|
556
|
+
nativeSelectElement.value = node instanceof HTMLSelectElement ? node : null;
|
|
557
|
+
}
|
|
558
|
+
function measureTrigger() {
|
|
559
|
+
const trigger = floating.referenceRef.value;
|
|
560
|
+
if (!trigger || !isBrowser) {
|
|
561
|
+
triggerSize.value = null;
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const rect = trigger.getBoundingClientRect();
|
|
565
|
+
const current = triggerSize.value;
|
|
566
|
+
if (!current || current.width !== rect.width || current.height !== rect.height) {
|
|
567
|
+
triggerSize.value = { width: rect.width, height: rect.height };
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
const contentStyle = computed4(() => {
|
|
571
|
+
const available = floating.availableSpace.value;
|
|
572
|
+
return {
|
|
573
|
+
...floating.floatingStyle.value,
|
|
574
|
+
...triggerSize.value ? { "--y-select-trigger-width": `${triggerSize.value.width}px` } : null,
|
|
575
|
+
...available ? { "--y-select-content-available-height": `${available.height}px` } : null
|
|
576
|
+
};
|
|
577
|
+
});
|
|
578
|
+
function scrollHighlightedIntoView() {
|
|
579
|
+
const viewport = viewportElement.value;
|
|
580
|
+
const current = highlightedValue.value;
|
|
581
|
+
if (!viewport || current === null) return;
|
|
582
|
+
const item = findEntry(current)?.element.value;
|
|
583
|
+
if (!item) return;
|
|
584
|
+
const itemRect = item.getBoundingClientRect();
|
|
585
|
+
const viewportRect = viewport.getBoundingClientRect();
|
|
586
|
+
viewport.scrollTop = resolveScrollTop({
|
|
587
|
+
scrollTop: viewport.scrollTop,
|
|
588
|
+
itemOffset: itemRect.top - viewportRect.top,
|
|
589
|
+
itemSize: itemRect.height,
|
|
590
|
+
viewportSize: viewportRect.height
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
function handleDocumentPointerDown(event) {
|
|
594
|
+
const target = event.target;
|
|
595
|
+
if (!(target instanceof Node)) return;
|
|
596
|
+
const trigger = floating.referenceRef.value;
|
|
597
|
+
const content = floating.floatingRef.value;
|
|
598
|
+
if (trigger?.contains(target) || content?.contains(target)) return;
|
|
599
|
+
close();
|
|
600
|
+
}
|
|
601
|
+
function attachDismiss() {
|
|
602
|
+
document.addEventListener("pointerdown", handleDocumentPointerDown, true);
|
|
603
|
+
}
|
|
604
|
+
function detachDismiss() {
|
|
605
|
+
document.removeEventListener("pointerdown", handleDocumentPointerDown, true);
|
|
606
|
+
}
|
|
607
|
+
watch3(
|
|
608
|
+
isOpen,
|
|
609
|
+
(open2) => {
|
|
610
|
+
if (!isBrowser) return;
|
|
611
|
+
detachDismiss();
|
|
612
|
+
if (open2) attachDismiss();
|
|
613
|
+
},
|
|
614
|
+
{ immediate: true }
|
|
615
|
+
);
|
|
616
|
+
watch3(
|
|
617
|
+
() => floating.referenceRef.value,
|
|
618
|
+
(trigger) => {
|
|
619
|
+
resize.disconnect();
|
|
620
|
+
if (!isBrowser) return;
|
|
621
|
+
measureTrigger();
|
|
622
|
+
resize.observe(trigger);
|
|
623
|
+
},
|
|
624
|
+
{ flush: "post" }
|
|
625
|
+
);
|
|
626
|
+
watch3(highlightedValue, () => scrollHighlightedIntoView(), { flush: "post" });
|
|
627
|
+
watch3(optionList, (list) => {
|
|
628
|
+
const current = highlightedValue.value;
|
|
629
|
+
if (current === null) {
|
|
630
|
+
if (isOpen.value && list.length > 0) {
|
|
631
|
+
highlightedValue.value = resolveOpenHighlight({
|
|
632
|
+
options: list,
|
|
633
|
+
selectedValue: value.value,
|
|
634
|
+
edge: "first"
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
const option = list.find((entry) => entry.value === current);
|
|
640
|
+
if (!option || option.disabled) highlightedValue.value = null;
|
|
641
|
+
});
|
|
642
|
+
const initialValue = value.value;
|
|
643
|
+
useFormResetListener(
|
|
644
|
+
floating.referenceRef,
|
|
645
|
+
() => setValue(initialValue),
|
|
646
|
+
() => toValue4(options.form)
|
|
647
|
+
);
|
|
648
|
+
function syncNativeSelect(notify) {
|
|
649
|
+
const select = nativeSelectElement.value;
|
|
650
|
+
if (!select) return;
|
|
651
|
+
writeNativeSelectValue(select, value.value);
|
|
652
|
+
if (notify) select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
653
|
+
}
|
|
654
|
+
watch3(nativeSelectElement, (select) => {
|
|
655
|
+
if (!select) return;
|
|
656
|
+
syncNativeSelect(false);
|
|
657
|
+
});
|
|
658
|
+
watch3(value, () => syncNativeSelect(true));
|
|
659
|
+
watch3(optionList, () => syncNativeSelect(false));
|
|
660
|
+
onScopeDispose4(() => {
|
|
661
|
+
detachDismiss();
|
|
662
|
+
resize.disconnect();
|
|
663
|
+
});
|
|
664
|
+
return {
|
|
665
|
+
value,
|
|
666
|
+
isOpen,
|
|
667
|
+
isDisabled,
|
|
668
|
+
highlightedValue: computed4(() => highlightedValue.value),
|
|
669
|
+
selectedText,
|
|
670
|
+
hasValue,
|
|
671
|
+
options: optionList,
|
|
672
|
+
nativeOptions: cachedOptions,
|
|
673
|
+
triggerId,
|
|
674
|
+
contentId,
|
|
675
|
+
floating,
|
|
676
|
+
contentStyle,
|
|
677
|
+
setValue,
|
|
678
|
+
open,
|
|
679
|
+
close,
|
|
680
|
+
toggle,
|
|
681
|
+
getItemId,
|
|
682
|
+
registerItem: collection.add,
|
|
683
|
+
getTriggerProps,
|
|
684
|
+
getContentProps,
|
|
685
|
+
getViewportProps,
|
|
686
|
+
getItemProps,
|
|
687
|
+
getGroupProps,
|
|
688
|
+
getLabelProps,
|
|
689
|
+
getSeparatorProps,
|
|
690
|
+
getValueProps,
|
|
691
|
+
getIconProps,
|
|
692
|
+
isFormControl,
|
|
693
|
+
getNativeSelectProps,
|
|
694
|
+
setTriggerElement,
|
|
695
|
+
setContentElement,
|
|
696
|
+
setViewportElement,
|
|
697
|
+
setNativeSelectElement,
|
|
698
|
+
onTriggerClick,
|
|
699
|
+
onTriggerKeydown,
|
|
700
|
+
onTriggerBlur,
|
|
701
|
+
onContentPointerDown,
|
|
702
|
+
onContentPointerLeave,
|
|
703
|
+
onItemPointerMove,
|
|
704
|
+
onItemClick
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
export {
|
|
708
|
+
useSelect
|
|
709
|
+
};
|
|
710
|
+
//# sourceMappingURL=index.js.map
|