@strapi/ui-primitives 1.7.4 → 1.7.5
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/index.cjs +1 -1
- package/dist/index.js +530 -513
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as d, jsxs as Ne, Fragment as Ae } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { composeEventHandlers as
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { composeEventHandlers as T } from "@radix-ui/primitive";
|
|
4
4
|
import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
|
|
5
5
|
import { createContextScope as Qe, createContext as et } from "@radix-ui/react-context";
|
|
6
6
|
import { DismissableLayer as tt } from "@radix-ui/react-dismissable-layer";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
7
|
+
import { useFocusGuards as ot } from "@radix-ui/react-focus-guards";
|
|
8
|
+
import { FocusScope as nt } from "@radix-ui/react-focus-scope";
|
|
9
|
+
import { useId as ne } from "@radix-ui/react-id";
|
|
10
|
+
import * as le from "@radix-ui/react-popper";
|
|
11
|
+
import { createPopperScope as rt } from "@radix-ui/react-popper";
|
|
12
|
+
import { Portal as lt } from "@radix-ui/react-portal";
|
|
11
13
|
import { Primitive as N } from "@radix-ui/react-primitive";
|
|
12
14
|
import { useControllableState as ie } from "@radix-ui/react-use-controllable-state";
|
|
13
|
-
import { useLayoutEffect as
|
|
14
|
-
import { hideOthers as
|
|
15
|
+
import { useLayoutEffect as H } from "@radix-ui/react-use-layout-effect";
|
|
16
|
+
import { hideOthers as st } from "aria-hidden";
|
|
15
17
|
import * as _e from "react-dom";
|
|
16
|
-
import { RemoveScroll as
|
|
18
|
+
import { RemoveScroll as ct } from "react-remove-scroll";
|
|
17
19
|
import { Slot as Ie } from "@radix-ui/react-slot";
|
|
18
20
|
import { clamp as Ze } from "@radix-ui/number";
|
|
19
|
-
import { createCollection as
|
|
20
|
-
import { useDirection as
|
|
21
|
-
import { useFocusGuards as Rt } from "@radix-ui/react-focus-guards";
|
|
22
|
-
import { FocusScope as Nt } from "@radix-ui/react-focus-scope";
|
|
21
|
+
import { createCollection as Rt } from "@radix-ui/react-collection";
|
|
22
|
+
import { useDirection as Nt } from "@radix-ui/react-direction";
|
|
23
23
|
import { useCallbackRef as At } from "@radix-ui/react-use-callback-ref";
|
|
24
24
|
import { useCallbackRef as Rn } from "@radix-ui/react-use-callback-ref";
|
|
25
25
|
import { usePrevious as _t } from "@radix-ui/react-use-previous";
|
|
26
26
|
import { VisuallyHidden as Mt } from "@radix-ui/react-visually-hidden";
|
|
27
27
|
let ye = /* @__PURE__ */ new Map();
|
|
28
28
|
function Ot(n, s) {
|
|
29
|
-
let e = n + (s ? Object.entries(s).sort((o,
|
|
29
|
+
let e = n + (s ? Object.entries(s).sort((o, l) => o[0] < l[0] ? -1 : 1).join() : "");
|
|
30
30
|
if (ye.has(e))
|
|
31
31
|
return ye.get(e);
|
|
32
32
|
let t = new Intl.Collator(n, s);
|
|
@@ -48,9 +48,9 @@ function Me(n, s) {
|
|
|
48
48
|
if (o.length === 0)
|
|
49
49
|
return !0;
|
|
50
50
|
t = t.normalize("NFC"), o = o.normalize("NFC");
|
|
51
|
-
let
|
|
52
|
-
for (;
|
|
53
|
-
let c = t.slice(
|
|
51
|
+
let l = 0, i = o.length;
|
|
52
|
+
for (; l + i <= t.length; l++) {
|
|
53
|
+
let c = t.slice(l, l + i);
|
|
54
54
|
if (e.compare(o, c) === 0)
|
|
55
55
|
return !0;
|
|
56
56
|
}
|
|
@@ -59,101 +59,101 @@ function Me(n, s) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
const Dt = (n) => {
|
|
62
|
-
const s =
|
|
63
|
-
return
|
|
62
|
+
const s = r.useRef();
|
|
63
|
+
return r.useEffect(() => {
|
|
64
64
|
s.current = n;
|
|
65
65
|
}), s.current;
|
|
66
66
|
};
|
|
67
67
|
function kt(n) {
|
|
68
|
-
const s = `${n}CollectionProvider`, [e, t] = Qe(s), [o,
|
|
68
|
+
const s = `${n}CollectionProvider`, [e, t] = Qe(s), [o, l] = e(s, {
|
|
69
69
|
collectionRef: { current: null },
|
|
70
70
|
itemMap: /* @__PURE__ */ new Map(),
|
|
71
71
|
listeners: /* @__PURE__ */ new Set()
|
|
72
72
|
}), i = (u) => {
|
|
73
|
-
const { scope:
|
|
74
|
-
return /* @__PURE__ */ d(o, { scope:
|
|
73
|
+
const { scope: m, children: S } = u, x = r.useRef(null), C = r.useRef(/* @__PURE__ */ new Map()).current, h = r.useRef(/* @__PURE__ */ new Set()).current;
|
|
74
|
+
return /* @__PURE__ */ d(o, { scope: m, itemMap: C, collectionRef: x, listeners: h, children: S });
|
|
75
75
|
};
|
|
76
76
|
i.displayName = s;
|
|
77
|
-
const c = `${n}CollectionSlot`, a =
|
|
78
|
-
const { scope:
|
|
79
|
-
return /* @__PURE__ */ d(Ie, { ref:
|
|
77
|
+
const c = `${n}CollectionSlot`, a = r.forwardRef((u, m) => {
|
|
78
|
+
const { scope: S, children: x } = u, C = l(c, S), h = _(m, C.collectionRef);
|
|
79
|
+
return /* @__PURE__ */ d(Ie, { ref: h, children: x });
|
|
80
80
|
});
|
|
81
81
|
a.displayName = c;
|
|
82
|
-
const
|
|
83
|
-
const { scope:
|
|
84
|
-
return
|
|
85
|
-
const
|
|
86
|
-
return A.itemMap.set(
|
|
82
|
+
const g = `${n}CollectionItemSlot`, f = "data-radix-collection-item", v = r.forwardRef((u, m) => {
|
|
83
|
+
const { scope: S, children: x, ...C } = u, h = r.useRef(null), w = _(m, h), A = l(g, S);
|
|
84
|
+
return r.useEffect(() => {
|
|
85
|
+
const V = Array.from(A.itemMap.values());
|
|
86
|
+
return A.itemMap.set(h, { ref: h, ...C }), A.listeners.forEach((M) => M(Array.from(A.itemMap.values()), V)), () => {
|
|
87
87
|
const M = Array.from(A.itemMap.values());
|
|
88
|
-
A.itemMap.delete(
|
|
88
|
+
A.itemMap.delete(h), A.listeners.forEach((E) => E(Array.from(A.itemMap.values()), M));
|
|
89
89
|
};
|
|
90
|
-
}), /* @__PURE__ */ d(Ie, { [f]: "", ref: w, children:
|
|
90
|
+
}), /* @__PURE__ */ d(Ie, { [f]: "", ref: w, children: x });
|
|
91
91
|
});
|
|
92
|
-
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
92
|
+
v.displayName = g;
|
|
93
|
+
function p(u) {
|
|
94
|
+
const m = l(`${n}CollectionConsumer`, u), S = r.useCallback(() => {
|
|
95
|
+
const C = m.collectionRef.current;
|
|
96
|
+
if (!C)
|
|
97
97
|
return [];
|
|
98
|
-
const
|
|
99
|
-
return Array.from(
|
|
100
|
-
(
|
|
98
|
+
const h = Array.from(C.querySelectorAll(`[${f}]`));
|
|
99
|
+
return Array.from(m.itemMap.values()).sort(
|
|
100
|
+
(V, M) => h.indexOf(V.ref.current) - h.indexOf(M.ref.current)
|
|
101
101
|
);
|
|
102
|
-
}, [
|
|
103
|
-
(
|
|
104
|
-
[
|
|
102
|
+
}, [m.collectionRef, m.itemMap]), x = r.useCallback(
|
|
103
|
+
(C) => (m.listeners.add(C), () => m.listeners.delete(C)),
|
|
104
|
+
[m.listeners]
|
|
105
105
|
);
|
|
106
|
-
return { getItems:
|
|
106
|
+
return { getItems: S, subscribe: x };
|
|
107
107
|
}
|
|
108
108
|
return [
|
|
109
|
-
{ Provider: i, Slot: a, ItemSlot:
|
|
110
|
-
|
|
109
|
+
{ Provider: i, Slot: a, ItemSlot: v },
|
|
110
|
+
p,
|
|
111
111
|
t
|
|
112
112
|
];
|
|
113
113
|
}
|
|
114
|
-
const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !!(n.length === 1 && n.match(/\S| /)),
|
|
114
|
+
const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !!(n.length === 1 && n.match(/\S| /)), it = "Combobox", [pe, xe] = kt(it), [Bt, Y] = et(it), Ht = ({ children: n }) => /* @__PURE__ */ d(le.Root, { children: /* @__PURE__ */ d(pe.Provider, { scope: void 0, children: n }) }), $t = (n) => {
|
|
115
115
|
const {
|
|
116
116
|
allowCustomValue: s = !1,
|
|
117
117
|
autocomplete: e = "none",
|
|
118
118
|
children: t,
|
|
119
119
|
open: o,
|
|
120
|
-
defaultOpen:
|
|
120
|
+
defaultOpen: l,
|
|
121
121
|
onOpenChange: i,
|
|
122
122
|
value: c,
|
|
123
123
|
defaultValue: a,
|
|
124
|
-
onValueChange:
|
|
124
|
+
onValueChange: g,
|
|
125
125
|
disabled: f,
|
|
126
|
-
required:
|
|
127
|
-
locale:
|
|
126
|
+
required: v = !1,
|
|
127
|
+
locale: p = "en-EN",
|
|
128
128
|
onTextValueChange: u,
|
|
129
|
-
textValue:
|
|
130
|
-
defaultTextValue:
|
|
131
|
-
filterValue:
|
|
132
|
-
defaultFilterValue:
|
|
133
|
-
onFilterValueChange:
|
|
134
|
-
} = n, [w, A] =
|
|
129
|
+
textValue: m,
|
|
130
|
+
defaultTextValue: S,
|
|
131
|
+
filterValue: x,
|
|
132
|
+
defaultFilterValue: C,
|
|
133
|
+
onFilterValueChange: h
|
|
134
|
+
} = n, [w, A] = r.useState(null), [V, M] = r.useState(null), [E, k] = r.useState(null), [$, G] = r.useState(null), [F = !1, O] = ie({
|
|
135
135
|
prop: o,
|
|
136
|
-
defaultProp:
|
|
136
|
+
defaultProp: l,
|
|
137
137
|
onChange: i
|
|
138
|
-
}), [
|
|
138
|
+
}), [L, B] = ie({
|
|
139
139
|
prop: c,
|
|
140
140
|
defaultProp: a,
|
|
141
|
-
onChange:
|
|
141
|
+
onChange: g
|
|
142
142
|
}), [U, K] = ie({
|
|
143
|
-
prop:
|
|
144
|
-
defaultProp:
|
|
143
|
+
prop: m,
|
|
144
|
+
defaultProp: S,
|
|
145
145
|
onChange: u
|
|
146
|
-
}), [
|
|
147
|
-
prop:
|
|
148
|
-
defaultProp:
|
|
149
|
-
onChange:
|
|
150
|
-
}), W =
|
|
151
|
-
(
|
|
152
|
-
const de = se.map((y) => y.ref.current), [
|
|
153
|
-
for (const y of
|
|
146
|
+
}), [X, Z] = ie({
|
|
147
|
+
prop: x,
|
|
148
|
+
defaultProp: C,
|
|
149
|
+
onChange: h
|
|
150
|
+
}), W = ne(), ue = r.useCallback(
|
|
151
|
+
(z, se) => {
|
|
152
|
+
const de = se.map((y) => y.ref.current), [J, ...ce] = de, [ee] = ce.slice(-1), b = $;
|
|
153
|
+
for (const y of z) {
|
|
154
154
|
if (y === b)
|
|
155
155
|
return;
|
|
156
|
-
if (y?.scrollIntoView({ block: "nearest" }), y ===
|
|
156
|
+
if (y?.scrollIntoView({ block: "nearest" }), y === J && V && (V.scrollTop = 0), y === ee && V && (V.scrollTop = V.scrollHeight), G(y), e === "both") {
|
|
157
157
|
const D = se.find((I) => I.ref.current === y);
|
|
158
158
|
D && K(D.textValue);
|
|
159
159
|
}
|
|
@@ -161,58 +161,70 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
|
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
|
-
[e, K,
|
|
164
|
+
[e, K, V, $]
|
|
165
165
|
);
|
|
166
|
-
return
|
|
167
|
-
e !== "both" &&
|
|
168
|
-
}, [U, e]),
|
|
169
|
-
if (
|
|
170
|
-
return
|
|
171
|
-
}, [
|
|
166
|
+
return r.useEffect(() => {
|
|
167
|
+
e !== "both" && G(null);
|
|
168
|
+
}, [U, e]), r.useEffect(() => {
|
|
169
|
+
if (E && w)
|
|
170
|
+
return st([E, w]);
|
|
171
|
+
}, [E, w]), /* @__PURE__ */ d(Ht, { children: /* @__PURE__ */ d(
|
|
172
172
|
Bt,
|
|
173
173
|
{
|
|
174
174
|
allowCustomValue: s,
|
|
175
175
|
autocomplete: e,
|
|
176
|
-
required:
|
|
176
|
+
required: v,
|
|
177
177
|
trigger: w,
|
|
178
178
|
onTriggerChange: A,
|
|
179
179
|
contentId: W,
|
|
180
|
-
value:
|
|
181
|
-
onValueChange:
|
|
182
|
-
open:
|
|
180
|
+
value: L,
|
|
181
|
+
onValueChange: B,
|
|
182
|
+
open: F,
|
|
183
183
|
onOpenChange: O,
|
|
184
184
|
disabled: f,
|
|
185
|
-
locale:
|
|
185
|
+
locale: p,
|
|
186
186
|
focusFirst: ue,
|
|
187
187
|
textValue: U,
|
|
188
188
|
onTextValueChange: K,
|
|
189
189
|
onViewportChange: M,
|
|
190
190
|
onContentChange: k,
|
|
191
|
-
visuallyFocussedItem:
|
|
192
|
-
filterValue:
|
|
193
|
-
onFilterValueChange:
|
|
194
|
-
onVisuallyFocussedItemChange:
|
|
195
|
-
children:
|
|
191
|
+
visuallyFocussedItem: $,
|
|
192
|
+
filterValue: X,
|
|
193
|
+
onFilterValueChange: Z,
|
|
194
|
+
onVisuallyFocussedItemChange: G,
|
|
195
|
+
children: /* @__PURE__ */ d(
|
|
196
|
+
nt,
|
|
197
|
+
{
|
|
198
|
+
trapped: F,
|
|
199
|
+
onMountAutoFocus: (z) => {
|
|
200
|
+
z.preventDefault();
|
|
201
|
+
},
|
|
202
|
+
onUnmountAutoFocus: (z) => {
|
|
203
|
+
w?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), z.preventDefault();
|
|
204
|
+
},
|
|
205
|
+
children: t
|
|
206
|
+
}
|
|
207
|
+
)
|
|
196
208
|
}
|
|
197
209
|
) });
|
|
198
|
-
}, Ut = "ComboboxTrigger", Kt =
|
|
199
|
-
const { ...e } = n, t =
|
|
200
|
-
return /* @__PURE__ */ d(
|
|
201
|
-
}),
|
|
202
|
-
const e =
|
|
210
|
+
}, Ut = "ComboboxTrigger", Kt = r.forwardRef((n, s) => {
|
|
211
|
+
const { ...e } = n, t = Y(Ut);
|
|
212
|
+
return /* @__PURE__ */ d(le.Anchor, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: s, "data-disabled": t.disabled ? "" : void 0, ...e }) });
|
|
213
|
+
}), at = "ComboboxInput", Wt = r.forwardRef((n, s) => {
|
|
214
|
+
const e = Y(at), t = r.useRef(null), { getItems: o } = xe(void 0), { startsWith: l } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, c = _(t, s, e.onTriggerChange), a = () => {
|
|
203
215
|
i || e.onOpenChange(!0);
|
|
204
|
-
},
|
|
205
|
-
return
|
|
216
|
+
}, g = Dt(e.filterValue);
|
|
217
|
+
return H(() => {
|
|
206
218
|
const f = setTimeout(() => {
|
|
207
219
|
if (e.textValue === "" || e.textValue === void 0 || e.filterValue === "" || e.filterValue === void 0)
|
|
208
220
|
return;
|
|
209
|
-
const
|
|
210
|
-
(u) => u.type === "option" &&
|
|
211
|
-
),
|
|
212
|
-
|
|
221
|
+
const v = o().find(
|
|
222
|
+
(u) => u.type === "option" && l(u.textValue, e.textValue)
|
|
223
|
+
), p = vo(g ?? "", e.filterValue);
|
|
224
|
+
v && !e.visuallyFocussedItem && p === e.filterValue.length && t.current.setSelectionRange(e.filterValue.length, e.textValue.length);
|
|
213
225
|
});
|
|
214
226
|
return () => clearTimeout(f);
|
|
215
|
-
}, [e.textValue, e.filterValue,
|
|
227
|
+
}, [e.textValue, e.filterValue, l, e.visuallyFocussedItem, o, g]), /* @__PURE__ */ d(
|
|
216
228
|
"input",
|
|
217
229
|
{
|
|
218
230
|
type: "text",
|
|
@@ -230,135 +242,140 @@ const Ft = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = ["Enter"], Je = (n) => !
|
|
|
230
242
|
value: e.textValue ?? "",
|
|
231
243
|
...n,
|
|
232
244
|
ref: c,
|
|
233
|
-
onClick:
|
|
245
|
+
onClick: T(n.onClick, (f) => {
|
|
234
246
|
f.currentTarget.focus();
|
|
235
247
|
}),
|
|
236
|
-
onPointerDown:
|
|
248
|
+
onPointerDown: T(n.onPointerDown, (f) => {
|
|
237
249
|
f.button === 0 && f.ctrlKey === !1 && (a(), f.currentTarget.focus());
|
|
238
250
|
}),
|
|
239
|
-
onKeyDown:
|
|
251
|
+
onKeyDown: T(n.onKeyDown, (f) => {
|
|
240
252
|
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key))
|
|
241
253
|
setTimeout(() => {
|
|
242
|
-
let
|
|
243
|
-
if (["ArrowUp", "End"].includes(f.key) && (
|
|
254
|
+
let p = o().filter((u) => !u.disabled).map((u) => u.ref.current);
|
|
255
|
+
if (["ArrowUp", "End"].includes(f.key) && (p = p.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
|
|
244
256
|
const u = e.visuallyFocussedItem ?? f.target;
|
|
245
|
-
let
|
|
246
|
-
|
|
257
|
+
let m = p.indexOf(u);
|
|
258
|
+
m === p.length - 1 && (m = -1), p = p.slice(m + 1);
|
|
247
259
|
}
|
|
248
|
-
if (["ArrowDown"].includes(f.key) && e.autocomplete === "both" &&
|
|
249
|
-
const [u, ...
|
|
250
|
-
e.textValue ===
|
|
260
|
+
if (["ArrowDown"].includes(f.key) && e.autocomplete === "both" && p.length > 1) {
|
|
261
|
+
const [u, ...m] = p, S = o().find((x) => x.ref.current === u).textValue;
|
|
262
|
+
e.textValue === S && (p = m);
|
|
251
263
|
}
|
|
252
|
-
e.focusFirst(
|
|
264
|
+
e.focusFirst(p, o());
|
|
253
265
|
}), f.preventDefault();
|
|
254
266
|
else if (["Escape"].includes(f.key))
|
|
255
267
|
e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), f.preventDefault();
|
|
256
268
|
else if (Lt.includes(f.key)) {
|
|
257
269
|
if (e.visuallyFocussedItem) {
|
|
258
|
-
const
|
|
259
|
-
|
|
270
|
+
const v = o().find((p) => p.ref.current === e.visuallyFocussedItem);
|
|
271
|
+
v && (e.onValueChange(v.value), e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue), v.ref.current?.click());
|
|
260
272
|
} else {
|
|
261
|
-
const
|
|
262
|
-
(
|
|
273
|
+
const v = o().find(
|
|
274
|
+
(p) => p.type === "option" && !p.disabled && p.textValue === e.textValue
|
|
263
275
|
);
|
|
264
|
-
|
|
276
|
+
v && (e.onValueChange(v.value), e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue), v.ref.current?.click());
|
|
265
277
|
}
|
|
266
278
|
e.onOpenChange(!1), f.preventDefault();
|
|
267
279
|
} else
|
|
268
280
|
e.onVisuallyFocussedItemChange(null);
|
|
269
281
|
}),
|
|
270
|
-
onChange:
|
|
282
|
+
onChange: T(n.onChange, (f) => {
|
|
271
283
|
e.onTextValueChange(f.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(f.currentTarget.value);
|
|
272
284
|
}),
|
|
273
|
-
onKeyUp:
|
|
285
|
+
onKeyUp: T(n.onKeyUp, (f) => {
|
|
274
286
|
!e.open && (Je(f.key) || ["ArrowUp", "ArrowDown", "Home", "End", "Backspace"].includes(f.key)) && a(), setTimeout(() => {
|
|
275
287
|
if (e.autocomplete === "both" && Je(f.key) && e.filterValue !== void 0) {
|
|
276
|
-
const
|
|
277
|
-
|
|
288
|
+
const v = e.filterValue, p = o().find((u) => l(u.textValue, v));
|
|
289
|
+
p && e.onTextValueChange(p.textValue);
|
|
278
290
|
}
|
|
279
291
|
});
|
|
292
|
+
}),
|
|
293
|
+
onBlur: T(n.onBlur, () => {
|
|
294
|
+
e.onVisuallyFocussedItemChange(null);
|
|
295
|
+
const [f] = o().filter(
|
|
296
|
+
(p) => p.textValue === e.textValue && p.type === "option"
|
|
297
|
+
);
|
|
298
|
+
if (e.allowCustomValue) {
|
|
299
|
+
f && (e.onValueChange(f.value), e.autocomplete === "both" && e.onFilterValueChange(f.textValue));
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const [v] = o().filter((p) => p.value === e.value && p.type === "option");
|
|
303
|
+
f ? e.onValueChange(f.value) : v && e.textValue !== "" ? (e.onTextValueChange(v.textValue), e.autocomplete === "both" && e.onFilterValueChange(v.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
|
|
280
304
|
})
|
|
281
305
|
}
|
|
282
306
|
);
|
|
283
|
-
}), zt =
|
|
284
|
-
const { children: e, ...t } = n, o =
|
|
285
|
-
|
|
307
|
+
}), zt = r.forwardRef((n, s) => {
|
|
308
|
+
const { children: e, ...t } = n, o = Y(at), l = o.disabled, i = () => {
|
|
309
|
+
l || (o.onOpenChange(!0), o.trigger?.focus());
|
|
286
310
|
};
|
|
287
311
|
return /* @__PURE__ */ d(
|
|
288
312
|
N.button,
|
|
289
313
|
{
|
|
290
314
|
"aria-hidden": !0,
|
|
291
315
|
type: "button",
|
|
292
|
-
"aria-disabled":
|
|
316
|
+
"aria-disabled": l,
|
|
293
317
|
"aria-controls": o.contentId,
|
|
294
318
|
"aria-expanded": o.open,
|
|
295
|
-
disabled:
|
|
296
|
-
"data-disabled":
|
|
319
|
+
disabled: l,
|
|
320
|
+
"data-disabled": l ? "" : void 0,
|
|
297
321
|
...t,
|
|
298
322
|
tabIndex: -1,
|
|
299
323
|
ref: s,
|
|
300
|
-
onClick:
|
|
324
|
+
onClick: T(t.onClick, () => {
|
|
301
325
|
o.trigger?.focus();
|
|
302
326
|
}),
|
|
303
|
-
onPointerDown:
|
|
327
|
+
onPointerDown: T(t.onPointerDown, (c) => {
|
|
304
328
|
c.button === 0 && c.ctrlKey === !1 && (i(), c.preventDefault());
|
|
305
329
|
}),
|
|
306
|
-
onKeyDown:
|
|
330
|
+
onKeyDown: T(t.onKeyDown, (c) => {
|
|
307
331
|
Ft.includes(c.key) && (i(), c.preventDefault());
|
|
308
332
|
}),
|
|
309
333
|
children: e || "▼"
|
|
310
334
|
}
|
|
311
335
|
);
|
|
312
|
-
}), Gt = "ComboboxPortal",
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
const e =
|
|
316
|
-
if (
|
|
336
|
+
}), Gt = "ComboboxPortal", ut = (n) => /* @__PURE__ */ d(lt, { asChild: !0, ...n });
|
|
337
|
+
ut.displayName = Gt;
|
|
338
|
+
const dt = "ComboboxContent", jt = r.forwardRef((n, s) => {
|
|
339
|
+
const e = Y(dt), [t, o] = r.useState();
|
|
340
|
+
if (H(() => {
|
|
317
341
|
o(new DocumentFragment());
|
|
318
342
|
}, []), !e.open) {
|
|
319
|
-
const
|
|
320
|
-
return
|
|
343
|
+
const l = t;
|
|
344
|
+
return l ? _e.createPortal(
|
|
321
345
|
/* @__PURE__ */ d(pe.Slot, { scope: void 0, children: /* @__PURE__ */ d("div", { children: n.children }) }),
|
|
322
|
-
|
|
346
|
+
l
|
|
323
347
|
) : null;
|
|
324
348
|
}
|
|
325
349
|
return /* @__PURE__ */ d(qt, { ...n, ref: s });
|
|
326
|
-
}), Yt = 10, qt =
|
|
350
|
+
}), Yt = 10, qt = r.forwardRef(
|
|
327
351
|
(n, s) => {
|
|
328
|
-
const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = n,
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
g && (a(g.value), r.autocomplete === "both" && m(g.textValue));
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
const [C] = u().filter((v) => v.value === h && v.type === "option");
|
|
336
|
-
g ? a(g.value) : C && S !== "" ? (f(C.textValue), r.autocomplete === "both" && m(C.textValue)) : (a(void 0), f(""));
|
|
337
|
-
}, [r, u, m, f, a, S, h]);
|
|
338
|
-
return l.useEffect(() => {
|
|
339
|
-
const g = () => {
|
|
340
|
-
p(), c(!1);
|
|
352
|
+
const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = n, l = Y(dt), i = _(s, (a) => l.onContentChange(a)), { onOpenChange: c } = l;
|
|
353
|
+
return ot(), r.useEffect(() => {
|
|
354
|
+
const a = () => {
|
|
355
|
+
c(!1);
|
|
341
356
|
};
|
|
342
|
-
return window.addEventListener("blur",
|
|
343
|
-
window.removeEventListener("blur",
|
|
357
|
+
return window.addEventListener("blur", a), window.addEventListener("resize", a), () => {
|
|
358
|
+
window.removeEventListener("blur", a), window.removeEventListener("resize", a);
|
|
344
359
|
};
|
|
345
|
-
}, [
|
|
360
|
+
}, [c]), /* @__PURE__ */ d(ct, { allowPinchZoom: !0, children: /* @__PURE__ */ d(
|
|
346
361
|
tt,
|
|
347
362
|
{
|
|
348
363
|
asChild: !0,
|
|
349
364
|
onEscapeKeyDown: e,
|
|
350
365
|
onPointerDownOutside: t,
|
|
351
|
-
onFocusOutside: (
|
|
366
|
+
onFocusOutside: (a) => {
|
|
367
|
+
a.preventDefault();
|
|
368
|
+
},
|
|
352
369
|
onDismiss: () => {
|
|
353
|
-
|
|
370
|
+
l.onOpenChange(!1), l.trigger?.focus({ preventScroll: !0 });
|
|
354
371
|
},
|
|
355
372
|
children: /* @__PURE__ */ d(
|
|
356
373
|
Xt,
|
|
357
374
|
{
|
|
358
375
|
role: "listbox",
|
|
359
|
-
id:
|
|
360
|
-
"data-state":
|
|
361
|
-
onContextMenu: (
|
|
376
|
+
id: l.contentId,
|
|
377
|
+
"data-state": l.open ? "open" : "closed",
|
|
378
|
+
onContextMenu: (a) => a.preventDefault(),
|
|
362
379
|
...o,
|
|
363
380
|
ref: i,
|
|
364
381
|
style: {
|
|
@@ -374,11 +391,11 @@ const at = "ComboboxContent", jt = l.forwardRef((n, s) => {
|
|
|
374
391
|
}
|
|
375
392
|
) });
|
|
376
393
|
}
|
|
377
|
-
), Xt =
|
|
394
|
+
), Xt = r.forwardRef(
|
|
378
395
|
(n, s) => {
|
|
379
396
|
const { align: e = "start", collisionPadding: t = Yt, ...o } = n;
|
|
380
397
|
return /* @__PURE__ */ d(
|
|
381
|
-
|
|
398
|
+
le.Content,
|
|
382
399
|
{
|
|
383
400
|
...o,
|
|
384
401
|
ref: s,
|
|
@@ -397,8 +414,8 @@ const at = "ComboboxContent", jt = l.forwardRef((n, s) => {
|
|
|
397
414
|
}
|
|
398
415
|
);
|
|
399
416
|
}
|
|
400
|
-
), Zt = "ComboboxViewport", Jt =
|
|
401
|
-
const e =
|
|
417
|
+
), Zt = "ComboboxViewport", Jt = r.forwardRef((n, s) => {
|
|
418
|
+
const e = Y(Zt), t = _(s, e.onViewportChange);
|
|
402
419
|
return /* @__PURE__ */ Ne(Ae, { children: [
|
|
403
420
|
/* @__PURE__ */ d(
|
|
404
421
|
"style",
|
|
@@ -427,71 +444,71 @@ const at = "ComboboxContent", jt = l.forwardRef((n, s) => {
|
|
|
427
444
|
}
|
|
428
445
|
) })
|
|
429
446
|
] });
|
|
430
|
-
}),
|
|
431
|
-
const { value: e, disabled: t = !1, textValue: o, ...
|
|
432
|
-
onTextValueChange:
|
|
447
|
+
}), ft = "ComboboxItem", [Qt, pt] = et(ft), mt = r.forwardRef((n, s) => {
|
|
448
|
+
const { value: e, disabled: t = !1, textValue: o, ...l } = n, i = r.useRef(null), c = _(s, i), { getItems: a } = xe(void 0), {
|
|
449
|
+
onTextValueChange: g,
|
|
433
450
|
textValue: f,
|
|
434
|
-
visuallyFocussedItem:
|
|
435
|
-
...
|
|
436
|
-
} =
|
|
437
|
-
t || (
|
|
438
|
-
}, { startsWith: w } = Me(
|
|
439
|
-
|
|
451
|
+
visuallyFocussedItem: v,
|
|
452
|
+
...p
|
|
453
|
+
} = Y(ft), u = ne(), [m, S] = r.useState(o ?? ""), x = r.useMemo(() => v === a().find((M) => M.ref.current === i.current)?.ref.current, [a, v]), C = p.value === e, h = () => {
|
|
454
|
+
t || (p.onValueChange(e), g(m), p.onOpenChange(!1), p.autocomplete === "both" && p.onFilterValueChange(m), p.trigger?.focus({ preventScroll: !0 }));
|
|
455
|
+
}, { startsWith: w } = Me(p.locale, { sensitivity: "base" }), A = r.useCallback((M) => {
|
|
456
|
+
S((E) => E || (M?.textContent ?? "").trim());
|
|
440
457
|
}, []);
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}, [
|
|
444
|
-
const
|
|
445
|
-
return
|
|
458
|
+
r.useEffect(() => {
|
|
459
|
+
C && f === void 0 && m !== "" && g(m);
|
|
460
|
+
}, [m, C, f, g]);
|
|
461
|
+
const V = ne();
|
|
462
|
+
return p.autocomplete === "list" && m && f && !w(m, f) || p.autocomplete === "both" && m && p.filterValue && !w(m, p.filterValue) ? null : /* @__PURE__ */ d(Qt, { textId: u, onTextValueChange: A, isSelected: C, children: /* @__PURE__ */ d(pe.ItemSlot, { scope: void 0, value: e, textValue: m, disabled: t, type: "option", children: /* @__PURE__ */ d(
|
|
446
463
|
N.div,
|
|
447
464
|
{
|
|
448
465
|
role: "option",
|
|
449
466
|
"aria-labelledby": u,
|
|
450
|
-
"data-highlighted":
|
|
451
|
-
"aria-selected":
|
|
452
|
-
"data-state":
|
|
467
|
+
"data-highlighted": x ? "" : void 0,
|
|
468
|
+
"aria-selected": C && x,
|
|
469
|
+
"data-state": C ? "checked" : "unchecked",
|
|
453
470
|
"aria-disabled": t || void 0,
|
|
454
471
|
"data-disabled": t ? "" : void 0,
|
|
455
472
|
tabIndex: t ? void 0 : -1,
|
|
456
|
-
...
|
|
457
|
-
id:
|
|
473
|
+
...l,
|
|
474
|
+
id: V,
|
|
458
475
|
ref: c,
|
|
459
|
-
onPointerUp:
|
|
476
|
+
onPointerUp: T(l.onPointerUp, h)
|
|
460
477
|
}
|
|
461
478
|
) }) });
|
|
462
|
-
}), eo = "ComboboxItemText", to =
|
|
463
|
-
const { className: e, style: t, ...o } = n,
|
|
464
|
-
return /* @__PURE__ */ d(N.span, { id:
|
|
465
|
-
}), oo = "ComboboxItemIndicator", no =
|
|
466
|
-
const { isSelected: e } =
|
|
479
|
+
}), eo = "ComboboxItemText", to = r.forwardRef((n, s) => {
|
|
480
|
+
const { className: e, style: t, ...o } = n, l = pt(eo), i = _(s, l.onTextValueChange);
|
|
481
|
+
return /* @__PURE__ */ d(N.span, { id: l.textId, ...o, ref: i });
|
|
482
|
+
}), oo = "ComboboxItemIndicator", no = r.forwardRef((n, s) => {
|
|
483
|
+
const { isSelected: e } = pt(oo);
|
|
467
484
|
return e ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...n, ref: s }) : null;
|
|
468
|
-
}),
|
|
469
|
-
const { textValue: e = "", locale: t } =
|
|
470
|
-
return
|
|
471
|
-
const a = i((
|
|
472
|
-
|
|
485
|
+
}), ht = "ComboboxNoValueFound", ro = r.forwardRef((n, s) => {
|
|
486
|
+
const { textValue: e = "", locale: t } = Y(ht), [o, l] = r.useState([]), { subscribe: i } = xe(void 0), { startsWith: c } = Me(t, { sensitivity: "base" });
|
|
487
|
+
return r.useEffect(() => {
|
|
488
|
+
const a = i((g) => {
|
|
489
|
+
l(g);
|
|
473
490
|
});
|
|
474
491
|
return () => {
|
|
475
492
|
a();
|
|
476
493
|
};
|
|
477
494
|
}, [i]), o.some((a) => c(a.textValue, e)) ? null : /* @__PURE__ */ d(N.div, { ...n, ref: s });
|
|
478
|
-
}), lo =
|
|
479
|
-
const { disabled: e = !1, ...t } = n, o =
|
|
480
|
-
!e &&
|
|
495
|
+
}), lo = r.forwardRef((n, s) => {
|
|
496
|
+
const { disabled: e = !1, ...t } = n, o = Y(ht), { textValue: l, visuallyFocussedItem: i } = o, { getItems: c, subscribe: a } = xe(void 0), g = r.useRef(null), [f, v] = r.useState(!1), p = _(s, g), u = r.useMemo(() => i === c().find((x) => x.ref.current === g.current)?.ref.current, [c, i]), m = ne(), S = () => {
|
|
497
|
+
!e && l && (o.onValueChange(l), o.onTextValueChange(l), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(l), o.trigger?.focus({ preventScroll: !0 }));
|
|
481
498
|
};
|
|
482
|
-
return
|
|
483
|
-
const
|
|
484
|
-
|
|
499
|
+
return H(() => {
|
|
500
|
+
const x = a((C) => {
|
|
501
|
+
v(!C.some((h) => h.textValue === l && h.type !== "create"));
|
|
485
502
|
});
|
|
486
|
-
return () => {
|
|
487
|
-
|
|
503
|
+
return c().length === 0 && v(!0), () => {
|
|
504
|
+
x();
|
|
488
505
|
};
|
|
489
|
-
}, [
|
|
506
|
+
}, [l, a, c]), !l || !f ? null : /* @__PURE__ */ d(
|
|
490
507
|
pe.ItemSlot,
|
|
491
508
|
{
|
|
492
509
|
scope: void 0,
|
|
493
|
-
value:
|
|
494
|
-
textValue:
|
|
510
|
+
value: l ?? "",
|
|
511
|
+
textValue: l ?? "",
|
|
495
512
|
disabled: e,
|
|
496
513
|
type: "create",
|
|
497
514
|
children: /* @__PURE__ */ d(
|
|
@@ -503,14 +520,14 @@ const at = "ComboboxContent", jt = l.forwardRef((n, s) => {
|
|
|
503
520
|
"data-disabled": e ? "" : void 0,
|
|
504
521
|
"data-highlighted": u ? "" : void 0,
|
|
505
522
|
...t,
|
|
506
|
-
id:
|
|
507
|
-
ref:
|
|
508
|
-
onPointerUp:
|
|
523
|
+
id: m,
|
|
524
|
+
ref: p,
|
|
525
|
+
onPointerUp: T(t.onPointerUp, S)
|
|
509
526
|
}
|
|
510
527
|
)
|
|
511
528
|
}
|
|
512
529
|
);
|
|
513
|
-
}), so = $t, co = Kt, io = Wt, ao = zt, uo =
|
|
530
|
+
}), so = $t, co = Kt, io = Wt, ao = zt, uo = ut, fo = jt, po = Jt, mo = mt, ho = to, go = no, xo = ro, Co = lo;
|
|
514
531
|
function vo(n, s) {
|
|
515
532
|
const e = Math.min(n.length, s.length);
|
|
516
533
|
for (let t = 0; t < e; t++)
|
|
@@ -520,7 +537,7 @@ function vo(n, s) {
|
|
|
520
537
|
}
|
|
521
538
|
const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
522
539
|
__proto__: null,
|
|
523
|
-
ComboboxItem:
|
|
540
|
+
ComboboxItem: mt,
|
|
524
541
|
Content: fo,
|
|
525
542
|
CreateItem: Co,
|
|
526
543
|
Icon: ao,
|
|
@@ -533,67 +550,67 @@ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
533
550
|
TextInput: io,
|
|
534
551
|
Trigger: co,
|
|
535
552
|
Viewport: po
|
|
536
|
-
}, Symbol.toStringTag, { value: "Module" })), So = [" ", "Enter", "ArrowUp", "ArrowDown"], bo = [" ", "Enter"],
|
|
553
|
+
}, Symbol.toStringTag, { value: "Module" })), So = [" ", "Enter", "ArrowUp", "ArrowDown"], bo = [" ", "Enter"], me = "Select", [Ce, he, wo] = Rt(me), [ae, yo] = Qe(me, [
|
|
537
554
|
wo,
|
|
538
|
-
|
|
539
|
-
]), ve =
|
|
555
|
+
rt
|
|
556
|
+
]), ve = rt(), [Io, q] = ae(me), [To, Vo] = ae(me), Oe = (n) => {
|
|
540
557
|
const {
|
|
541
558
|
__scopeSelect: s,
|
|
542
559
|
children: e,
|
|
543
560
|
open: t,
|
|
544
561
|
defaultOpen: o,
|
|
545
|
-
onOpenChange:
|
|
562
|
+
onOpenChange: l,
|
|
546
563
|
value: i,
|
|
547
564
|
defaultValue: c,
|
|
548
565
|
onValueChange: a,
|
|
549
|
-
dir:
|
|
566
|
+
dir: g,
|
|
550
567
|
// name,
|
|
551
568
|
// autoComplete,
|
|
552
569
|
disabled: f,
|
|
553
|
-
required:
|
|
554
|
-
multi:
|
|
555
|
-
} = n, u = ve(s), [
|
|
570
|
+
required: v,
|
|
571
|
+
multi: p = !1
|
|
572
|
+
} = n, u = ve(s), [m, S] = r.useState(null), [x, C] = r.useState(null), [h, w] = r.useState(!1), A = Nt(g), [V = !1, M] = ie({
|
|
556
573
|
prop: t,
|
|
557
574
|
defaultProp: o,
|
|
558
|
-
onChange:
|
|
559
|
-
}), [
|
|
575
|
+
onChange: l
|
|
576
|
+
}), [E, k] = ie({
|
|
560
577
|
prop: i,
|
|
561
578
|
defaultProp: c,
|
|
562
579
|
onChange(O) {
|
|
563
580
|
a && (Array.isArray(O), a(O));
|
|
564
581
|
}
|
|
565
|
-
}),
|
|
566
|
-
return /* @__PURE__ */ d(
|
|
582
|
+
}), $ = r.useRef(null), [G, F] = r.useState(/* @__PURE__ */ new Set());
|
|
583
|
+
return /* @__PURE__ */ d(le.Root, { ...u, children: /* @__PURE__ */ d(
|
|
567
584
|
Io,
|
|
568
585
|
{
|
|
569
|
-
required:
|
|
586
|
+
required: v,
|
|
570
587
|
scope: s,
|
|
571
|
-
trigger:
|
|
572
|
-
onTriggerChange:
|
|
573
|
-
valueNode:
|
|
574
|
-
onValueNodeChange:
|
|
575
|
-
valueNodeHasChildren:
|
|
588
|
+
trigger: m,
|
|
589
|
+
onTriggerChange: S,
|
|
590
|
+
valueNode: x,
|
|
591
|
+
onValueNodeChange: C,
|
|
592
|
+
valueNodeHasChildren: h,
|
|
576
593
|
onValueNodeHasChildrenChange: w,
|
|
577
|
-
contentId:
|
|
578
|
-
value:
|
|
594
|
+
contentId: ne(),
|
|
595
|
+
value: E,
|
|
579
596
|
onValueChange: k,
|
|
580
|
-
open:
|
|
597
|
+
open: V,
|
|
581
598
|
onOpenChange: M,
|
|
582
599
|
dir: A,
|
|
583
|
-
triggerPointerDownPosRef:
|
|
600
|
+
triggerPointerDownPosRef: $,
|
|
584
601
|
disabled: f,
|
|
585
|
-
multi:
|
|
602
|
+
multi: p,
|
|
586
603
|
children: /* @__PURE__ */ d(Ce.Provider, { scope: s, children: /* @__PURE__ */ d(
|
|
587
604
|
To,
|
|
588
605
|
{
|
|
589
606
|
scope: n.__scopeSelect,
|
|
590
|
-
onNativeOptionAdd:
|
|
591
|
-
|
|
607
|
+
onNativeOptionAdd: r.useCallback((O) => {
|
|
608
|
+
F((L) => new Set(L).add(O));
|
|
592
609
|
}, []),
|
|
593
|
-
onNativeOptionRemove:
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
return
|
|
610
|
+
onNativeOptionRemove: r.useCallback((O) => {
|
|
611
|
+
F((L) => {
|
|
612
|
+
const B = new Set(L);
|
|
613
|
+
return B.delete(O), B;
|
|
597
614
|
});
|
|
598
615
|
}, []),
|
|
599
616
|
children: e
|
|
@@ -602,157 +619,157 @@ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
602
619
|
}
|
|
603
620
|
) });
|
|
604
621
|
};
|
|
605
|
-
Oe.displayName =
|
|
606
|
-
const
|
|
622
|
+
Oe.displayName = me;
|
|
623
|
+
const gt = "SelectTrigger", De = r.forwardRef(
|
|
607
624
|
(n, s) => {
|
|
608
|
-
const { __scopeSelect: e, ...t } = n, o = ve(e),
|
|
609
|
-
const
|
|
610
|
-
if (
|
|
611
|
-
const
|
|
612
|
-
|
|
625
|
+
const { __scopeSelect: e, ...t } = n, o = ve(e), l = q(gt, e), i = l.disabled, c = _(s, l.onTriggerChange), a = he(e), [g, f, v] = Vt((u) => {
|
|
626
|
+
const m = a().filter((C) => !C.disabled), S = m.find((C) => C.value === l.value), x = Et(m, u, S);
|
|
627
|
+
if (x !== void 0 && !Array.isArray(x.value)) {
|
|
628
|
+
const C = l.multi ? [x.value] : x.value;
|
|
629
|
+
l.onValueChange(C);
|
|
613
630
|
}
|
|
614
|
-
}),
|
|
615
|
-
i || (
|
|
631
|
+
}), p = () => {
|
|
632
|
+
i || (l.onOpenChange(!0), v());
|
|
616
633
|
};
|
|
617
|
-
return /* @__PURE__ */ d(
|
|
634
|
+
return /* @__PURE__ */ d(le.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ d(
|
|
618
635
|
N.div,
|
|
619
636
|
{
|
|
620
637
|
role: "combobox",
|
|
621
|
-
"aria-controls":
|
|
622
|
-
"aria-expanded":
|
|
623
|
-
"aria-required":
|
|
638
|
+
"aria-controls": l.contentId,
|
|
639
|
+
"aria-expanded": l.open,
|
|
640
|
+
"aria-required": l.required,
|
|
624
641
|
"aria-autocomplete": "none",
|
|
625
|
-
dir:
|
|
626
|
-
"data-state":
|
|
642
|
+
dir: l.dir,
|
|
643
|
+
"data-state": l.open ? "open" : "closed",
|
|
627
644
|
"data-disabled": i ? "" : void 0,
|
|
628
|
-
"data-placeholder":
|
|
645
|
+
"data-placeholder": l.value === void 0 ? "" : void 0,
|
|
629
646
|
tabIndex: i ? void 0 : 0,
|
|
630
647
|
...t,
|
|
631
648
|
ref: c,
|
|
632
|
-
onClick:
|
|
649
|
+
onClick: T(t.onClick, (u) => {
|
|
633
650
|
u.currentTarget.focus();
|
|
634
651
|
}),
|
|
635
|
-
onPointerDown:
|
|
636
|
-
const
|
|
637
|
-
|
|
652
|
+
onPointerDown: T(t.onPointerDown, (u) => {
|
|
653
|
+
const m = u.target;
|
|
654
|
+
m.hasPointerCapture(u.pointerId) && m.releasePointerCapture(u.pointerId), (m.closest("button") ?? m.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (p(), l.triggerPointerDownPosRef.current = {
|
|
638
655
|
x: Math.round(u.pageX),
|
|
639
656
|
y: Math.round(u.pageY)
|
|
640
657
|
}, u.preventDefault());
|
|
641
658
|
}),
|
|
642
|
-
onKeyDown:
|
|
643
|
-
const
|
|
644
|
-
(
|
|
659
|
+
onKeyDown: T(t.onKeyDown, (u) => {
|
|
660
|
+
const m = g.current !== "", S = u.ctrlKey || u.altKey || u.metaKey, x = u.target;
|
|
661
|
+
(x.closest("button") ?? x.closest("div")) === u.currentTarget && (!S && u.key.length === 1 && f(u.key), !(m && u.key === " ") && So.includes(u.key) && (p(), u.preventDefault()));
|
|
645
662
|
})
|
|
646
663
|
}
|
|
647
664
|
) });
|
|
648
665
|
}
|
|
649
666
|
);
|
|
650
|
-
De.displayName =
|
|
651
|
-
const
|
|
667
|
+
De.displayName = gt;
|
|
668
|
+
const xt = "SelectValue", ke = r.forwardRef(
|
|
652
669
|
(n, s) => {
|
|
653
|
-
const { __scopeSelect: e, children: t, placeholder: o, ...
|
|
654
|
-
|
|
670
|
+
const { __scopeSelect: e, children: t, placeholder: o, ...l } = n, i = q(xt, e), { onValueNodeHasChildrenChange: c } = i, a = t !== void 0, g = _(s, i.onValueNodeChange), [f, v] = r.useState([]), p = he(e);
|
|
671
|
+
H(() => {
|
|
655
672
|
c(a);
|
|
656
|
-
}, [c, a]),
|
|
673
|
+
}, [c, a]), r.useLayoutEffect(() => {
|
|
657
674
|
if (Array.isArray(i.value) && f.length !== i.value.length) {
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
(
|
|
675
|
+
const m = setTimeout(() => {
|
|
676
|
+
const S = p().filter(
|
|
677
|
+
(x) => Array.isArray(x.value) ? !1 : i.value?.includes(x.value)
|
|
661
678
|
);
|
|
662
|
-
S
|
|
679
|
+
v(S);
|
|
663
680
|
});
|
|
664
681
|
return () => {
|
|
665
|
-
clearTimeout(
|
|
682
|
+
clearTimeout(m);
|
|
666
683
|
};
|
|
667
684
|
}
|
|
668
|
-
}, [i.value,
|
|
685
|
+
}, [i.value, p, f]);
|
|
669
686
|
let u;
|
|
670
687
|
if ((i.value === void 0 || i.value.length === 0) && o !== void 0)
|
|
671
688
|
u = /* @__PURE__ */ d("span", { children: o });
|
|
672
689
|
else if (typeof t == "function")
|
|
673
690
|
if (Array.isArray(i.value)) {
|
|
674
|
-
const
|
|
675
|
-
const
|
|
676
|
-
return
|
|
691
|
+
const m = i.value.map((S) => {
|
|
692
|
+
const x = f.find((C) => C.value === S);
|
|
693
|
+
return x ? t({ value: S, textValue: x?.textValue }) : null;
|
|
677
694
|
});
|
|
678
|
-
u =
|
|
695
|
+
u = m.every((S) => S === null) ? o : m;
|
|
679
696
|
} else
|
|
680
697
|
u = t(i.value);
|
|
681
698
|
else
|
|
682
699
|
u = t;
|
|
683
|
-
return /* @__PURE__ */ d(N.span, { ...
|
|
700
|
+
return /* @__PURE__ */ d(N.span, { ...l, ref: g, children: u || null });
|
|
684
701
|
}
|
|
685
702
|
);
|
|
686
|
-
ke.displayName =
|
|
687
|
-
const
|
|
703
|
+
ke.displayName = xt;
|
|
704
|
+
const Eo = "SelectIcon", Fe = r.forwardRef(
|
|
688
705
|
(n, s) => {
|
|
689
706
|
const { __scopeSelect: e, children: t, ...o } = n;
|
|
690
707
|
return /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t || "▼" });
|
|
691
708
|
}
|
|
692
709
|
);
|
|
693
|
-
Fe.displayName =
|
|
694
|
-
const
|
|
695
|
-
Le.displayName =
|
|
696
|
-
const
|
|
710
|
+
Fe.displayName = Eo;
|
|
711
|
+
const Po = "SelectPortal", Le = (n) => /* @__PURE__ */ d(lt, { asChild: !0, ...n });
|
|
712
|
+
Le.displayName = Po;
|
|
713
|
+
const re = "SelectContent", Be = r.forwardRef(
|
|
697
714
|
(n, s) => {
|
|
698
|
-
const e =
|
|
699
|
-
if (
|
|
715
|
+
const e = q(re, n.__scopeSelect), [t, o] = r.useState();
|
|
716
|
+
if (H(() => {
|
|
700
717
|
o(new DocumentFragment());
|
|
701
718
|
}, []), !e.open) {
|
|
702
|
-
const
|
|
703
|
-
return
|
|
704
|
-
/* @__PURE__ */ d(
|
|
705
|
-
|
|
719
|
+
const l = t;
|
|
720
|
+
return l ? _e.createPortal(
|
|
721
|
+
/* @__PURE__ */ d(Ct, { scope: n.__scopeSelect, children: /* @__PURE__ */ d(Ce.Slot, { scope: n.__scopeSelect, children: /* @__PURE__ */ d("div", { children: n.children }) }) }),
|
|
722
|
+
l
|
|
706
723
|
) : null;
|
|
707
724
|
}
|
|
708
|
-
return /* @__PURE__ */ d(
|
|
725
|
+
return /* @__PURE__ */ d(vt, { ...n, ref: s });
|
|
709
726
|
}
|
|
710
727
|
);
|
|
711
|
-
Be.displayName =
|
|
712
|
-
const
|
|
728
|
+
Be.displayName = re;
|
|
729
|
+
const j = 10, [Ct, Q] = ae(re), Ro = "SelectContentImpl", vt = r.forwardRef(
|
|
713
730
|
(n, s) => {
|
|
714
731
|
const {
|
|
715
732
|
__scopeSelect: e,
|
|
716
733
|
position: t = "item-aligned",
|
|
717
734
|
onCloseAutoFocus: o,
|
|
718
|
-
onEscapeKeyDown:
|
|
735
|
+
onEscapeKeyDown: l,
|
|
719
736
|
onPointerDownOutside: i,
|
|
720
737
|
//
|
|
721
738
|
// PopperContent props
|
|
722
739
|
side: c,
|
|
723
740
|
sideOffset: a,
|
|
724
|
-
align:
|
|
741
|
+
align: g,
|
|
725
742
|
alignOffset: f,
|
|
726
|
-
arrowPadding:
|
|
727
|
-
collisionBoundary:
|
|
743
|
+
arrowPadding: v,
|
|
744
|
+
collisionBoundary: p,
|
|
728
745
|
collisionPadding: u,
|
|
729
|
-
sticky:
|
|
730
|
-
hideWhenDetached:
|
|
731
|
-
avoidCollisions:
|
|
746
|
+
sticky: m,
|
|
747
|
+
hideWhenDetached: S,
|
|
748
|
+
avoidCollisions: x,
|
|
732
749
|
//
|
|
733
|
-
...
|
|
734
|
-
} = n,
|
|
735
|
-
|
|
750
|
+
...C
|
|
751
|
+
} = n, h = q(re, e), [w, A] = r.useState(null), [V, M] = r.useState(null), E = _(s, (b) => A(b)), [k, $] = r.useState(null), [G, F] = r.useState(null), O = he(e), [L, B] = r.useState(!1), U = r.useRef(!1);
|
|
752
|
+
r.useEffect(() => {
|
|
736
753
|
if (w)
|
|
737
|
-
return
|
|
738
|
-
}, [w]),
|
|
739
|
-
const K =
|
|
754
|
+
return st(w);
|
|
755
|
+
}, [w]), ot();
|
|
756
|
+
const K = r.useCallback(
|
|
740
757
|
(b) => {
|
|
741
|
-
const [y, ...D] = O().map((R) => R.ref.current), [I] = D.slice(-1),
|
|
758
|
+
const [y, ...D] = O().map((R) => R.ref.current), [I] = D.slice(-1), P = document.activeElement;
|
|
742
759
|
for (const R of b)
|
|
743
|
-
if (R ===
|
|
760
|
+
if (R === P || (R?.scrollIntoView({ block: "nearest" }), R === y && V && (V.scrollTop = 0), R === I && V && (V.scrollTop = V.scrollHeight), R?.focus(), document.activeElement !== P))
|
|
744
761
|
return;
|
|
745
762
|
},
|
|
746
|
-
[O,
|
|
747
|
-
),
|
|
763
|
+
[O, V]
|
|
764
|
+
), X = r.useCallback(
|
|
748
765
|
() => K([k, w]),
|
|
749
766
|
[K, k, w]
|
|
750
767
|
);
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}, [
|
|
754
|
-
const { onOpenChange:
|
|
755
|
-
|
|
768
|
+
r.useEffect(() => {
|
|
769
|
+
L && X();
|
|
770
|
+
}, [L, X]);
|
|
771
|
+
const { onOpenChange: Z, triggerPointerDownPosRef: W } = h;
|
|
772
|
+
r.useEffect(() => {
|
|
756
773
|
if (w) {
|
|
757
774
|
let b = { x: 0, y: 0 };
|
|
758
775
|
const y = (I) => {
|
|
@@ -761,108 +778,108 @@ const G = 10, [gt, J] = ae(ne), Ro = "SelectContentImpl", xt = l.forwardRef(
|
|
|
761
778
|
y: Math.abs(Math.round(I.pageY) - (W.current?.y ?? 0))
|
|
762
779
|
};
|
|
763
780
|
}, D = (I) => {
|
|
764
|
-
b.x <= 10 && b.y <= 10 ? I.preventDefault() : w.contains(I.target) ||
|
|
781
|
+
b.x <= 10 && b.y <= 10 ? I.preventDefault() : w.contains(I.target) || Z(!1), document.removeEventListener("pointermove", y), W.current = null;
|
|
765
782
|
};
|
|
766
783
|
return W.current !== null && (document.addEventListener("pointermove", y), document.addEventListener("pointerup", D, { capture: !0, once: !0 })), () => {
|
|
767
784
|
document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", D, { capture: !0 });
|
|
768
785
|
};
|
|
769
786
|
}
|
|
770
|
-
}, [w,
|
|
771
|
-
const b = () =>
|
|
787
|
+
}, [w, Z, W]), r.useEffect(() => {
|
|
788
|
+
const b = () => Z(!1);
|
|
772
789
|
return window.addEventListener("blur", b), window.addEventListener("resize", b), () => {
|
|
773
790
|
window.removeEventListener("blur", b), window.removeEventListener("resize", b);
|
|
774
791
|
};
|
|
775
|
-
}, [
|
|
776
|
-
const [ue,
|
|
777
|
-
const y = O().filter((
|
|
792
|
+
}, [Z]);
|
|
793
|
+
const [ue, z] = Vt((b) => {
|
|
794
|
+
const y = O().filter((P) => !P.disabled), D = y.find((P) => P.ref.current === document.activeElement), I = Et(y, b, D);
|
|
778
795
|
I && setTimeout(() => I.ref.current.focus());
|
|
779
|
-
}), se =
|
|
796
|
+
}), se = r.useCallback(
|
|
780
797
|
(b, y, D) => {
|
|
781
798
|
const I = !U.current && !D;
|
|
782
|
-
(
|
|
799
|
+
(h.value !== void 0 && h.value === y || I) && ($(b), I && (U.current = !0));
|
|
783
800
|
},
|
|
784
|
-
[
|
|
785
|
-
), de =
|
|
801
|
+
[h.value]
|
|
802
|
+
), de = r.useCallback(() => w?.focus(), [w]), J = r.useCallback(
|
|
786
803
|
(b, y, D) => {
|
|
787
804
|
const I = !U.current && !D;
|
|
788
|
-
(
|
|
805
|
+
(h.value !== void 0 && (Array.isArray(y) ? y.every((R) => h.value?.includes(R)) : h.value === y) || I) && F(b);
|
|
789
806
|
},
|
|
790
|
-
[
|
|
791
|
-
), ce = t === "popper" ? Te :
|
|
807
|
+
[h.value]
|
|
808
|
+
), ce = t === "popper" ? Te : St, ee = ce === Te ? {
|
|
792
809
|
side: c,
|
|
793
810
|
sideOffset: a,
|
|
794
|
-
align:
|
|
811
|
+
align: g,
|
|
795
812
|
alignOffset: f,
|
|
796
|
-
arrowPadding:
|
|
797
|
-
collisionBoundary:
|
|
813
|
+
arrowPadding: v,
|
|
814
|
+
collisionBoundary: p,
|
|
798
815
|
collisionPadding: u,
|
|
799
|
-
sticky:
|
|
800
|
-
hideWhenDetached:
|
|
801
|
-
avoidCollisions:
|
|
816
|
+
sticky: m,
|
|
817
|
+
hideWhenDetached: S,
|
|
818
|
+
avoidCollisions: x
|
|
802
819
|
} : {};
|
|
803
820
|
return /* @__PURE__ */ d(
|
|
804
|
-
|
|
821
|
+
Ct,
|
|
805
822
|
{
|
|
806
823
|
scope: e,
|
|
807
824
|
content: w,
|
|
808
|
-
viewport:
|
|
825
|
+
viewport: V,
|
|
809
826
|
onViewportChange: M,
|
|
810
827
|
itemRefCallback: se,
|
|
811
828
|
selectedItem: k,
|
|
812
829
|
onItemLeave: de,
|
|
813
|
-
itemTextRefCallback:
|
|
814
|
-
focusSelectedItem:
|
|
815
|
-
selectedItemText:
|
|
830
|
+
itemTextRefCallback: J,
|
|
831
|
+
focusSelectedItem: X,
|
|
832
|
+
selectedItemText: G,
|
|
816
833
|
position: t,
|
|
817
|
-
isPositioned:
|
|
834
|
+
isPositioned: L,
|
|
818
835
|
searchRef: ue,
|
|
819
|
-
children: /* @__PURE__ */ d(
|
|
820
|
-
|
|
836
|
+
children: /* @__PURE__ */ d(ct, { as: Ie, allowPinchZoom: !0, children: /* @__PURE__ */ d(
|
|
837
|
+
nt,
|
|
821
838
|
{
|
|
822
839
|
asChild: !0,
|
|
823
|
-
trapped:
|
|
840
|
+
trapped: h.open,
|
|
824
841
|
onMountAutoFocus: (b) => {
|
|
825
842
|
b.preventDefault();
|
|
826
843
|
},
|
|
827
|
-
onUnmountAutoFocus:
|
|
828
|
-
|
|
844
|
+
onUnmountAutoFocus: T(o, (b) => {
|
|
845
|
+
h.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), b.preventDefault();
|
|
829
846
|
}),
|
|
830
847
|
children: /* @__PURE__ */ d(
|
|
831
848
|
tt,
|
|
832
849
|
{
|
|
833
850
|
asChild: !0,
|
|
834
851
|
disableOutsidePointerEvents: !0,
|
|
835
|
-
onEscapeKeyDown:
|
|
852
|
+
onEscapeKeyDown: l,
|
|
836
853
|
onPointerDownOutside: i,
|
|
837
854
|
onFocusOutside: (b) => b.preventDefault(),
|
|
838
|
-
onDismiss: () =>
|
|
855
|
+
onDismiss: () => h.onOpenChange(!1),
|
|
839
856
|
children: /* @__PURE__ */ d(
|
|
840
857
|
ce,
|
|
841
858
|
{
|
|
842
859
|
role: "listbox",
|
|
843
|
-
id:
|
|
844
|
-
"data-state":
|
|
845
|
-
"aria-multiselectable":
|
|
846
|
-
dir:
|
|
860
|
+
id: h.contentId,
|
|
861
|
+
"data-state": h.open ? "open" : "closed",
|
|
862
|
+
"aria-multiselectable": h.multi ? "true" : void 0,
|
|
863
|
+
dir: h.dir,
|
|
847
864
|
onContextMenu: (b) => b.preventDefault(),
|
|
848
|
-
...
|
|
849
|
-
...
|
|
850
|
-
onPlaced: () =>
|
|
851
|
-
ref:
|
|
865
|
+
...C,
|
|
866
|
+
...ee,
|
|
867
|
+
onPlaced: () => B(!0),
|
|
868
|
+
ref: E,
|
|
852
869
|
style: {
|
|
853
870
|
// flex layout so we can place the scroll buttons properly
|
|
854
871
|
display: "flex",
|
|
855
872
|
flexDirection: "column",
|
|
856
873
|
// reset the outline by default as the content MAY get focused
|
|
857
874
|
outline: "none",
|
|
858
|
-
...
|
|
875
|
+
...C.style
|
|
859
876
|
},
|
|
860
|
-
onKeyDown:
|
|
877
|
+
onKeyDown: T(C.onKeyDown, (b) => {
|
|
861
878
|
const y = b.ctrlKey || b.altKey || b.metaKey;
|
|
862
|
-
if (b.key === "Tab" && b.preventDefault(), !y && b.key.length === 1 &&
|
|
863
|
-
let I = O().filter((
|
|
879
|
+
if (b.key === "Tab" && b.preventDefault(), !y && b.key.length === 1 && z(b.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(b.key)) {
|
|
880
|
+
let I = O().filter((P) => !P.disabled).map((P) => P.ref.current);
|
|
864
881
|
if (["ArrowUp", "End"].includes(b.key) && (I = I.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(b.key)) {
|
|
865
|
-
const
|
|
882
|
+
const P = b.target, R = I.indexOf(P);
|
|
866
883
|
I = I.slice(R + 1);
|
|
867
884
|
}
|
|
868
885
|
setTimeout(() => K(I)), b.preventDefault();
|
|
@@ -878,63 +895,63 @@ const G = 10, [gt, J] = ae(ne), Ro = "SelectContentImpl", xt = l.forwardRef(
|
|
|
878
895
|
);
|
|
879
896
|
}
|
|
880
897
|
);
|
|
881
|
-
|
|
882
|
-
const No = "SelectItemAlignedPosition",
|
|
898
|
+
vt.displayName = Ro;
|
|
899
|
+
const No = "SelectItemAlignedPosition", St = r.forwardRef(
|
|
883
900
|
(n, s) => {
|
|
884
|
-
const { __scopeSelect: e, onPlaced: t, ...o } = n,
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
const
|
|
889
|
-
c.style.minWidth = `${
|
|
901
|
+
const { __scopeSelect: e, onPlaced: t, ...o } = n, l = q(re, e), i = Q(re, e), [c, a] = r.useState(null), [g, f] = r.useState(null), v = _(s, (E) => f(E)), p = he(e), u = r.useRef(!1), m = r.useRef(!0), { viewport: S, selectedItem: x, selectedItemText: C, focusSelectedItem: h } = i, w = r.useCallback(() => {
|
|
902
|
+
if (l.trigger && l.valueNode && c && g && S && x && C) {
|
|
903
|
+
const E = l.trigger.getBoundingClientRect(), k = g.getBoundingClientRect(), $ = l.valueNode.getBoundingClientRect(), G = C.getBoundingClientRect();
|
|
904
|
+
if (l.dir !== "rtl") {
|
|
905
|
+
const P = G.left - k.left, R = $.left - P, te = E.left - R, oe = E.width + te, Se = Math.max(oe, k.width), be = window.innerWidth - j, we = Ze(R, [j, be - Se]);
|
|
906
|
+
c.style.minWidth = `${oe}px`, c.style.left = `${we}px`;
|
|
890
907
|
} else {
|
|
891
|
-
const
|
|
892
|
-
c.style.minWidth = `${
|
|
908
|
+
const P = k.right - G.right, R = window.innerWidth - $.right - P, te = window.innerWidth - E.right - R, oe = E.width + te, Se = Math.max(oe, k.width), be = window.innerWidth - j, we = Ze(R, [j, be - Se]);
|
|
909
|
+
c.style.minWidth = `${oe}px`, c.style.right = `${we}px`;
|
|
893
910
|
}
|
|
894
|
-
const
|
|
895
|
-
if (y <=
|
|
896
|
-
const
|
|
911
|
+
const F = p(), O = window.innerHeight - j * 2, L = S.scrollHeight, B = window.getComputedStyle(g), U = parseInt(B.borderTopWidth, 10), K = parseInt(B.paddingTop, 10), X = parseInt(B.borderBottomWidth, 10), Z = parseInt(B.paddingBottom, 10), W = U + K + L + Z + X, ue = Math.min(x.offsetHeight * 5, W), z = window.getComputedStyle(S), se = parseInt(z.paddingTop, 10), de = parseInt(z.paddingBottom, 10), J = E.top + E.height / 2 - j, ce = O - J, ee = x.offsetHeight / 2, b = x.offsetTop + ee, y = U + K + b, D = W - y;
|
|
912
|
+
if (y <= J) {
|
|
913
|
+
const P = x === F[F.length - 1].ref.current;
|
|
897
914
|
c.style.bottom = "0px";
|
|
898
|
-
const R =
|
|
915
|
+
const R = g.clientHeight - S.offsetTop - S.offsetHeight, te = Math.max(
|
|
899
916
|
ce,
|
|
900
|
-
|
|
901
|
-
(
|
|
902
|
-
),
|
|
903
|
-
c.style.height = `${
|
|
917
|
+
ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
918
|
+
(P ? de : 0) + R + X
|
|
919
|
+
), oe = y + te;
|
|
920
|
+
c.style.height = `${oe}px`;
|
|
904
921
|
} else {
|
|
905
|
-
const
|
|
922
|
+
const P = x === F[0].ref.current;
|
|
906
923
|
c.style.top = "0px";
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
U +
|
|
910
|
-
(
|
|
924
|
+
const te = Math.max(
|
|
925
|
+
J,
|
|
926
|
+
U + S.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
927
|
+
(P ? se : 0) + ee
|
|
911
928
|
) + D;
|
|
912
|
-
c.style.height = `${
|
|
929
|
+
c.style.height = `${te}px`, S.scrollTop = y - J + S.offsetTop;
|
|
913
930
|
}
|
|
914
|
-
c.style.margin = `${
|
|
931
|
+
c.style.margin = `${j}px 0`, c.style.minHeight = `${ue}px`, c.style.maxHeight = `${O}px`, t?.(), requestAnimationFrame(() => u.current = !0);
|
|
915
932
|
}
|
|
916
933
|
}, [
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
934
|
+
p,
|
|
935
|
+
l.trigger,
|
|
936
|
+
l.valueNode,
|
|
920
937
|
c,
|
|
921
|
-
m,
|
|
922
938
|
g,
|
|
939
|
+
S,
|
|
940
|
+
x,
|
|
923
941
|
C,
|
|
924
|
-
|
|
925
|
-
r.dir,
|
|
942
|
+
l.dir,
|
|
926
943
|
t
|
|
927
944
|
]);
|
|
928
|
-
|
|
929
|
-
const [A,
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
}, [
|
|
933
|
-
const M =
|
|
934
|
-
(
|
|
935
|
-
|
|
945
|
+
H(() => w(), [w]);
|
|
946
|
+
const [A, V] = r.useState();
|
|
947
|
+
H(() => {
|
|
948
|
+
g && V(window.getComputedStyle(g).zIndex);
|
|
949
|
+
}, [g]);
|
|
950
|
+
const M = r.useCallback(
|
|
951
|
+
(E) => {
|
|
952
|
+
E && m.current === !0 && (w(), h?.(), m.current = !1);
|
|
936
953
|
},
|
|
937
|
-
[w,
|
|
954
|
+
[w, h]
|
|
938
955
|
);
|
|
939
956
|
return /* @__PURE__ */ d(
|
|
940
957
|
_o,
|
|
@@ -957,7 +974,7 @@ const No = "SelectItemAlignedPosition", Ct = l.forwardRef(
|
|
|
957
974
|
N.div,
|
|
958
975
|
{
|
|
959
976
|
...o,
|
|
960
|
-
ref:
|
|
977
|
+
ref: v,
|
|
961
978
|
style: {
|
|
962
979
|
// When we get the height of the content, it includes borders. If we were to set
|
|
963
980
|
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
@@ -974,22 +991,22 @@ const No = "SelectItemAlignedPosition", Ct = l.forwardRef(
|
|
|
974
991
|
);
|
|
975
992
|
}
|
|
976
993
|
);
|
|
977
|
-
|
|
978
|
-
const Ao = "SelectPopperPosition", Te =
|
|
994
|
+
St.displayName = No;
|
|
995
|
+
const Ao = "SelectPopperPosition", Te = r.forwardRef(
|
|
979
996
|
(n, s) => {
|
|
980
|
-
const { __scopeSelect: e, align: t = "start", collisionPadding: o =
|
|
997
|
+
const { __scopeSelect: e, align: t = "start", collisionPadding: o = j, ...l } = n, i = ve(e);
|
|
981
998
|
return /* @__PURE__ */ d(
|
|
982
|
-
|
|
999
|
+
le.Content,
|
|
983
1000
|
{
|
|
984
1001
|
...i,
|
|
985
|
-
...
|
|
1002
|
+
...l,
|
|
986
1003
|
ref: s,
|
|
987
1004
|
align: t,
|
|
988
1005
|
collisionPadding: o,
|
|
989
1006
|
style: {
|
|
990
1007
|
// Ensure border-box for floating-ui calculations
|
|
991
1008
|
boxSizing: "border-box",
|
|
992
|
-
...
|
|
1009
|
+
...l.style,
|
|
993
1010
|
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
994
1011
|
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
995
1012
|
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
@@ -1002,11 +1019,11 @@ const Ao = "SelectPopperPosition", Te = l.forwardRef(
|
|
|
1002
1019
|
);
|
|
1003
1020
|
Te.displayName = Ao;
|
|
1004
1021
|
const [_o, He] = ae(
|
|
1005
|
-
|
|
1022
|
+
re,
|
|
1006
1023
|
{}
|
|
1007
|
-
),
|
|
1024
|
+
), Ve = "SelectViewport", $e = r.forwardRef(
|
|
1008
1025
|
(n, s) => {
|
|
1009
|
-
const { __scopeSelect: e, ...t } = n, o =
|
|
1026
|
+
const { __scopeSelect: e, ...t } = n, o = Q(Ve, e), l = He(Ve, e), i = _(s, o.onViewportChange), c = r.useRef(0);
|
|
1010
1027
|
return /* @__PURE__ */ Ne(Ae, { children: [
|
|
1011
1028
|
/* @__PURE__ */ d(
|
|
1012
1029
|
"style",
|
|
@@ -1032,49 +1049,49 @@ const [_o, He] = ae(
|
|
|
1032
1049
|
overflow: "auto",
|
|
1033
1050
|
...t.style
|
|
1034
1051
|
},
|
|
1035
|
-
onScroll:
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
const
|
|
1039
|
-
if (
|
|
1040
|
-
const u = window.innerHeight -
|
|
1041
|
-
if (
|
|
1042
|
-
const
|
|
1043
|
-
f.style.height = `${
|
|
1052
|
+
onScroll: T(t.onScroll, (a) => {
|
|
1053
|
+
const g = a.currentTarget, { contentWrapper: f, shouldExpandOnScrollRef: v } = l;
|
|
1054
|
+
if (v?.current && f) {
|
|
1055
|
+
const p = Math.abs(c.current - g.scrollTop);
|
|
1056
|
+
if (p > 0) {
|
|
1057
|
+
const u = window.innerHeight - j * 2, m = parseFloat(f.style.minHeight), S = parseFloat(f.style.height), x = Math.max(m, S);
|
|
1058
|
+
if (x < u) {
|
|
1059
|
+
const C = x + p, h = Math.min(u, C), w = C - h;
|
|
1060
|
+
f.style.height = `${h}px`, f.style.bottom === "0px" && (g.scrollTop = w > 0 ? w : 0, f.style.justifyContent = "flex-end");
|
|
1044
1061
|
}
|
|
1045
1062
|
}
|
|
1046
1063
|
}
|
|
1047
|
-
c.current =
|
|
1064
|
+
c.current = g.scrollTop;
|
|
1048
1065
|
})
|
|
1049
1066
|
}
|
|
1050
1067
|
) })
|
|
1051
1068
|
] });
|
|
1052
1069
|
}
|
|
1053
1070
|
);
|
|
1054
|
-
$e.displayName =
|
|
1055
|
-
const
|
|
1071
|
+
$e.displayName = Ve;
|
|
1072
|
+
const bt = "SelectGroup", [Mo, Oo] = ae(bt), Ue = r.forwardRef(
|
|
1056
1073
|
(n, s) => {
|
|
1057
|
-
const { __scopeSelect: e, ...t } = n, o =
|
|
1074
|
+
const { __scopeSelect: e, ...t } = n, o = ne();
|
|
1058
1075
|
return /* @__PURE__ */ d(Mo, { scope: e, id: o, children: /* @__PURE__ */ d(N.div, { role: "group", "aria-labelledby": o, ...t, ref: s }) });
|
|
1059
1076
|
}
|
|
1060
1077
|
);
|
|
1061
|
-
Ue.displayName =
|
|
1062
|
-
const
|
|
1078
|
+
Ue.displayName = bt;
|
|
1079
|
+
const wt = "SelectLabel", Ke = r.forwardRef(
|
|
1063
1080
|
(n, s) => {
|
|
1064
|
-
const { __scopeSelect: e, ...t } = n, o = Oo(
|
|
1081
|
+
const { __scopeSelect: e, ...t } = n, o = Oo(wt, e);
|
|
1065
1082
|
return /* @__PURE__ */ d(N.div, { id: o.id, ...t, ref: s });
|
|
1066
1083
|
}
|
|
1067
1084
|
);
|
|
1068
|
-
Ke.displayName =
|
|
1069
|
-
const
|
|
1085
|
+
Ke.displayName = wt;
|
|
1086
|
+
const ge = "SelectItem", [Do, yt] = ae(ge), We = r.forwardRef(
|
|
1070
1087
|
(n, s) => {
|
|
1071
|
-
const { __scopeSelect: e, value: t, disabled: o = !1, textValue:
|
|
1088
|
+
const { __scopeSelect: e, value: t, disabled: o = !1, textValue: l, ...i } = n, c = q(ge, e), a = Q(ge, e), g = typeof t == "string" ? Array.isArray(c.value) ? c.value.includes(t) : c.value === t : t.every((h) => c.value?.includes(h)), f = Array.isArray(c.value) && Array.isArray(t) && t.some((h) => c.value?.includes(h)), [v, p] = r.useState(l ?? ""), [u, m] = r.useState(!1), S = _(
|
|
1072
1089
|
s,
|
|
1073
|
-
(
|
|
1074
|
-
),
|
|
1090
|
+
(h) => a.itemRefCallback?.(h, t, o)
|
|
1091
|
+
), x = ne(), C = () => {
|
|
1075
1092
|
if (!o) {
|
|
1076
|
-
let
|
|
1077
|
-
f && !
|
|
1093
|
+
let h = c.multi && typeof t == "string" ? [t] : t;
|
|
1094
|
+
f && !g ? c.onValueChange(h) : Array.isArray(c.value) && (h = Pt(t, c.value)), c.onValueChange(h), c.multi || c.onOpenChange(!1);
|
|
1078
1095
|
}
|
|
1079
1096
|
};
|
|
1080
1097
|
if (!c.multi && Array.isArray(t))
|
|
@@ -1085,37 +1102,37 @@ const xe = "SelectItem", [Do, bt] = ae(xe), We = l.forwardRef(
|
|
|
1085
1102
|
scope: e,
|
|
1086
1103
|
value: t,
|
|
1087
1104
|
disabled: o,
|
|
1088
|
-
textId:
|
|
1089
|
-
isSelected:
|
|
1105
|
+
textId: x,
|
|
1106
|
+
isSelected: g,
|
|
1090
1107
|
isIntermediate: f,
|
|
1091
|
-
onItemTextChange:
|
|
1092
|
-
|
|
1108
|
+
onItemTextChange: r.useCallback((h) => {
|
|
1109
|
+
p((w) => w || (h?.textContent ?? "").trim());
|
|
1093
1110
|
}, []),
|
|
1094
|
-
children: /* @__PURE__ */ d(Ce.ItemSlot, { scope: e, value: t, disabled: o, textValue:
|
|
1111
|
+
children: /* @__PURE__ */ d(Ce.ItemSlot, { scope: e, value: t, disabled: o, textValue: v, children: /* @__PURE__ */ d(
|
|
1095
1112
|
N.div,
|
|
1096
1113
|
{
|
|
1097
1114
|
role: "option",
|
|
1098
|
-
"aria-labelledby":
|
|
1115
|
+
"aria-labelledby": x,
|
|
1099
1116
|
"data-highlighted": u ? "" : void 0,
|
|
1100
|
-
"aria-selected": c.multi ? void 0 :
|
|
1101
|
-
"aria-checked": c.multi ?
|
|
1102
|
-
"data-state":
|
|
1117
|
+
"aria-selected": c.multi ? void 0 : g && u,
|
|
1118
|
+
"aria-checked": c.multi ? g : void 0,
|
|
1119
|
+
"data-state": g ? "checked" : "unchecked",
|
|
1103
1120
|
"aria-disabled": o || void 0,
|
|
1104
1121
|
"data-disabled": o ? "" : void 0,
|
|
1105
1122
|
tabIndex: o ? void 0 : -1,
|
|
1106
1123
|
...i,
|
|
1107
|
-
ref:
|
|
1108
|
-
onFocus:
|
|
1109
|
-
onBlur:
|
|
1110
|
-
onPointerUp:
|
|
1111
|
-
onPointerMove:
|
|
1112
|
-
o ? a.onItemLeave?.() :
|
|
1124
|
+
ref: S,
|
|
1125
|
+
onFocus: T(i.onFocus, () => m(!0)),
|
|
1126
|
+
onBlur: T(i.onBlur, () => m(!1)),
|
|
1127
|
+
onPointerUp: T(i.onPointerUp, C),
|
|
1128
|
+
onPointerMove: T(i.onPointerMove, (h) => {
|
|
1129
|
+
o ? a.onItemLeave?.() : h.currentTarget.focus({ preventScroll: !0 });
|
|
1113
1130
|
}),
|
|
1114
|
-
onPointerLeave:
|
|
1115
|
-
|
|
1131
|
+
onPointerLeave: T(i.onPointerLeave, (h) => {
|
|
1132
|
+
h.currentTarget === document.activeElement && a.onItemLeave?.();
|
|
1116
1133
|
}),
|
|
1117
|
-
onKeyDown:
|
|
1118
|
-
a.searchRef?.current !== "" &&
|
|
1134
|
+
onKeyDown: T(i.onKeyDown, (h) => {
|
|
1135
|
+
a.searchRef?.current !== "" && h.key === " " || (bo.includes(h.key) && C(), h.key === " " && h.preventDefault());
|
|
1119
1136
|
})
|
|
1120
1137
|
}
|
|
1121
1138
|
) })
|
|
@@ -1123,15 +1140,15 @@ const xe = "SelectItem", [Do, bt] = ae(xe), We = l.forwardRef(
|
|
|
1123
1140
|
);
|
|
1124
1141
|
}
|
|
1125
1142
|
);
|
|
1126
|
-
We.displayName =
|
|
1127
|
-
const fe = "SelectItemText", ze =
|
|
1143
|
+
We.displayName = ge;
|
|
1144
|
+
const fe = "SelectItemText", ze = r.forwardRef(
|
|
1128
1145
|
(n, s) => {
|
|
1129
|
-
const { __scopeSelect: e, className: t, style: o, ...
|
|
1146
|
+
const { __scopeSelect: e, className: t, style: o, ...l } = n, i = q(fe, e), c = Q(fe, e), a = yt(fe, e), g = Vo(fe, e), [f, v] = r.useState(null), p = _(
|
|
1130
1147
|
s,
|
|
1131
|
-
(
|
|
1148
|
+
(C) => v(C),
|
|
1132
1149
|
a.onItemTextChange,
|
|
1133
|
-
(
|
|
1134
|
-
), u = f?.textContent,
|
|
1150
|
+
(C) => c.itemTextRefCallback?.(C, a.value, a.disabled)
|
|
1151
|
+
), u = f?.textContent, m = r.useMemo(
|
|
1135
1152
|
() => /* @__PURE__ */ d(
|
|
1136
1153
|
"option",
|
|
1137
1154
|
{
|
|
@@ -1142,37 +1159,37 @@ const fe = "SelectItemText", ze = l.forwardRef(
|
|
|
1142
1159
|
Array.isArray(a.value) ? a.value.join(";") : a.value
|
|
1143
1160
|
),
|
|
1144
1161
|
[a.disabled, a.value, u]
|
|
1145
|
-
), { onNativeOptionAdd:
|
|
1146
|
-
return
|
|
1147
|
-
/* @__PURE__ */ d(N.span, { id: a.textId, ...
|
|
1148
|
-
a.isSelected && i.valueNode && !i.valueNodeHasChildren ? _e.createPortal(
|
|
1162
|
+
), { onNativeOptionAdd: S, onNativeOptionRemove: x } = g;
|
|
1163
|
+
return H(() => (S(m), () => x(m)), [S, x, m]), /* @__PURE__ */ Ne(Ae, { children: [
|
|
1164
|
+
/* @__PURE__ */ d(N.span, { id: a.textId, ...l, ref: p }),
|
|
1165
|
+
a.isSelected && i.valueNode && !i.valueNodeHasChildren ? _e.createPortal(l.children, i.valueNode) : null
|
|
1149
1166
|
] });
|
|
1150
1167
|
}
|
|
1151
1168
|
);
|
|
1152
1169
|
ze.displayName = fe;
|
|
1153
|
-
const
|
|
1170
|
+
const It = "SelectItemIndicator", Ge = r.forwardRef(
|
|
1154
1171
|
(n, s) => {
|
|
1155
|
-
const { __scopeSelect: e, children: t, ...o } = n,
|
|
1172
|
+
const { __scopeSelect: e, children: t, ...o } = n, l = yt(It, e);
|
|
1156
1173
|
return typeof t == "function" ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t({
|
|
1157
|
-
isSelected:
|
|
1158
|
-
isIntermediate:
|
|
1159
|
-
}) }) :
|
|
1174
|
+
isSelected: l.isSelected,
|
|
1175
|
+
isIntermediate: l.isIntermediate
|
|
1176
|
+
}) }) : l.isSelected ? /* @__PURE__ */ d(N.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
|
|
1160
1177
|
}
|
|
1161
1178
|
);
|
|
1162
|
-
Ge.displayName =
|
|
1163
|
-
const
|
|
1179
|
+
Ge.displayName = It;
|
|
1180
|
+
const Ee = "SelectScrollUpButton", je = r.forwardRef(
|
|
1164
1181
|
(n, s) => {
|
|
1165
|
-
const e =
|
|
1166
|
-
return
|
|
1182
|
+
const e = Q(Ee, n.__scopeSelect), t = He(Ee, n.__scopeSelect), [o, l] = r.useState(!1), i = _(s, t.onScrollButtonChange);
|
|
1183
|
+
return H(() => {
|
|
1167
1184
|
if (e.viewport && e.isPositioned) {
|
|
1168
1185
|
const c = e.viewport, a = () => {
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1186
|
+
const g = c.scrollTop > 0;
|
|
1187
|
+
l(g);
|
|
1171
1188
|
};
|
|
1172
1189
|
return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
|
|
1173
1190
|
}
|
|
1174
1191
|
}, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ d(
|
|
1175
|
-
|
|
1192
|
+
Tt,
|
|
1176
1193
|
{
|
|
1177
1194
|
...n,
|
|
1178
1195
|
ref: i,
|
|
@@ -1184,20 +1201,20 @@ const Pe = "SelectScrollUpButton", je = l.forwardRef(
|
|
|
1184
1201
|
) : null;
|
|
1185
1202
|
}
|
|
1186
1203
|
);
|
|
1187
|
-
je.displayName =
|
|
1188
|
-
const
|
|
1204
|
+
je.displayName = Ee;
|
|
1205
|
+
const Pe = "SelectScrollDownButton", Ye = r.forwardRef(
|
|
1189
1206
|
(n, s) => {
|
|
1190
|
-
const e =
|
|
1191
|
-
return
|
|
1207
|
+
const e = Q(Pe, n.__scopeSelect), t = He(Pe, n.__scopeSelect), [o, l] = r.useState(!1), i = _(s, t.onScrollButtonChange);
|
|
1208
|
+
return H(() => {
|
|
1192
1209
|
if (e.viewport && e.isPositioned) {
|
|
1193
1210
|
const c = e.viewport, a = () => {
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1211
|
+
const g = c.scrollHeight - c.clientHeight, f = Math.ceil(c.scrollTop) < g;
|
|
1212
|
+
l(f);
|
|
1196
1213
|
};
|
|
1197
1214
|
return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
|
|
1198
1215
|
}
|
|
1199
1216
|
}, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ d(
|
|
1200
|
-
|
|
1217
|
+
Tt,
|
|
1201
1218
|
{
|
|
1202
1219
|
...n,
|
|
1203
1220
|
ref: i,
|
|
@@ -1209,13 +1226,13 @@ const Ve = "SelectScrollDownButton", Ye = l.forwardRef(
|
|
|
1209
1226
|
) : null;
|
|
1210
1227
|
}
|
|
1211
1228
|
);
|
|
1212
|
-
Ye.displayName =
|
|
1213
|
-
const
|
|
1229
|
+
Ye.displayName = Pe;
|
|
1230
|
+
const Tt = r.forwardRef(
|
|
1214
1231
|
(n, s) => {
|
|
1215
|
-
const { __scopeSelect: e, onAutoScroll: t, ...o } = n,
|
|
1232
|
+
const { __scopeSelect: e, onAutoScroll: t, ...o } = n, l = Q("SelectScrollButton", e), i = r.useRef(null), c = he(e), a = r.useCallback(() => {
|
|
1216
1233
|
i.current !== null && (window.clearInterval(i.current), i.current = null);
|
|
1217
1234
|
}, []);
|
|
1218
|
-
return
|
|
1235
|
+
return r.useEffect(() => () => a(), [a]), H(() => {
|
|
1219
1236
|
c().find((f) => f.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
1220
1237
|
}, [c]), /* @__PURE__ */ d(
|
|
1221
1238
|
N.div,
|
|
@@ -1224,37 +1241,37 @@ const yt = l.forwardRef(
|
|
|
1224
1241
|
...o,
|
|
1225
1242
|
ref: s,
|
|
1226
1243
|
style: { flexShrink: 0, ...o.style },
|
|
1227
|
-
onPointerMove:
|
|
1228
|
-
|
|
1244
|
+
onPointerMove: T(o.onPointerMove, () => {
|
|
1245
|
+
l.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
|
|
1229
1246
|
}),
|
|
1230
|
-
onPointerLeave:
|
|
1247
|
+
onPointerLeave: T(o.onPointerLeave, () => {
|
|
1231
1248
|
a();
|
|
1232
1249
|
})
|
|
1233
1250
|
}
|
|
1234
1251
|
);
|
|
1235
1252
|
}
|
|
1236
|
-
), ko = "SelectSeparator", qe =
|
|
1253
|
+
), ko = "SelectSeparator", qe = r.forwardRef(
|
|
1237
1254
|
(n, s) => {
|
|
1238
1255
|
const { __scopeSelect: e, ...t } = n;
|
|
1239
1256
|
return /* @__PURE__ */ d(N.div, { "aria-hidden": !0, ...t, ref: s });
|
|
1240
1257
|
}
|
|
1241
1258
|
);
|
|
1242
1259
|
qe.displayName = ko;
|
|
1243
|
-
const Re = "SelectArrow", Xe =
|
|
1260
|
+
const Re = "SelectArrow", Xe = r.forwardRef(
|
|
1244
1261
|
(n, s) => {
|
|
1245
|
-
const { __scopeSelect: e, ...t } = n, o = ve(e),
|
|
1246
|
-
return
|
|
1262
|
+
const { __scopeSelect: e, ...t } = n, o = ve(e), l = q(Re, e), i = Q(Re, e);
|
|
1263
|
+
return l.open && i.position === "popper" ? /* @__PURE__ */ d(le.Arrow, { ...o, ...t, ref: s }) : null;
|
|
1247
1264
|
}
|
|
1248
1265
|
);
|
|
1249
1266
|
Xe.displayName = Re;
|
|
1250
|
-
const Fo = "BubbleSelect", Lo =
|
|
1267
|
+
const Fo = "BubbleSelect", Lo = r.forwardRef(
|
|
1251
1268
|
(n, s) => {
|
|
1252
|
-
const { value: e, ...t } = n, o =
|
|
1253
|
-
|
|
1254
|
-
const
|
|
1255
|
-
if (i !== e &&
|
|
1269
|
+
const { value: e, ...t } = n, o = r.useRef(null), l = _(s, o), i = _t(e), c = q(Fo, void 0);
|
|
1270
|
+
r.useEffect(() => {
|
|
1271
|
+
const g = o.current, f = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(f, "value").set;
|
|
1272
|
+
if (i !== e && p) {
|
|
1256
1273
|
const u = new Event("change", { bubbles: !0 });
|
|
1257
|
-
|
|
1274
|
+
p.call(g, e), g.dispatchEvent(u);
|
|
1258
1275
|
}
|
|
1259
1276
|
}, [i, e]);
|
|
1260
1277
|
let a = e;
|
|
@@ -1263,43 +1280,43 @@ const Fo = "BubbleSelect", Lo = l.forwardRef(
|
|
|
1263
1280
|
{
|
|
1264
1281
|
...t,
|
|
1265
1282
|
multiple: c.multi ? !0 : void 0,
|
|
1266
|
-
ref:
|
|
1283
|
+
ref: l,
|
|
1267
1284
|
defaultValue: a
|
|
1268
1285
|
}
|
|
1269
1286
|
) });
|
|
1270
1287
|
}
|
|
1271
1288
|
);
|
|
1272
1289
|
Lo.displayName = "BubbleSelect";
|
|
1273
|
-
function
|
|
1274
|
-
const s = At(n), e =
|
|
1290
|
+
function Vt(n) {
|
|
1291
|
+
const s = At(n), e = r.useRef(""), t = r.useRef(0), o = r.useCallback(
|
|
1275
1292
|
(i) => {
|
|
1276
1293
|
const c = e.current + i;
|
|
1277
|
-
s(c), function a(
|
|
1278
|
-
e.current =
|
|
1294
|
+
s(c), function a(g) {
|
|
1295
|
+
e.current = g, window.clearTimeout(t.current), g !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
|
|
1279
1296
|
}(c);
|
|
1280
1297
|
},
|
|
1281
1298
|
[s]
|
|
1282
|
-
),
|
|
1299
|
+
), l = r.useCallback(() => {
|
|
1283
1300
|
e.current = "", window.clearTimeout(t.current);
|
|
1284
1301
|
}, []);
|
|
1285
|
-
return
|
|
1302
|
+
return r.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, l];
|
|
1286
1303
|
}
|
|
1287
|
-
function
|
|
1288
|
-
const o = s.length > 1 && Array.from(s).every((
|
|
1289
|
-
let i = Bo(n, Math.max(
|
|
1290
|
-
o.length === 1 && (i = i.filter((
|
|
1291
|
-
const a = i.find((
|
|
1304
|
+
function Et(n, s, e) {
|
|
1305
|
+
const o = s.length > 1 && Array.from(s).every((g) => g === s[0]) ? s[0] : s, l = e ? n.indexOf(e) : -1;
|
|
1306
|
+
let i = Bo(n, Math.max(l, 0));
|
|
1307
|
+
o.length === 1 && (i = i.filter((g) => g !== e));
|
|
1308
|
+
const a = i.find((g) => g.textValue.toLowerCase().startsWith(o.toLowerCase()));
|
|
1292
1309
|
return a !== e ? a : void 0;
|
|
1293
1310
|
}
|
|
1294
1311
|
function Bo(n, s) {
|
|
1295
1312
|
return n.map((e, t) => n[(s + t) % n.length]);
|
|
1296
1313
|
}
|
|
1297
|
-
const
|
|
1314
|
+
const Pt = (n, s = []) => {
|
|
1298
1315
|
if (Array.isArray(n))
|
|
1299
|
-
return n.reduce((t, o) =>
|
|
1316
|
+
return n.reduce((t, o) => Pt(o, t), s);
|
|
1300
1317
|
const e = s.indexOf(n);
|
|
1301
1318
|
return e === -1 ? [...s, n] : [...s.slice(0, e), ...s.slice(e + 1)];
|
|
1302
|
-
}, Ho = Oe, $o = De, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = $e, jo = Ue, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe,
|
|
1319
|
+
}, Ho = Oe, $o = De, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = $e, jo = Ue, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1303
1320
|
__proto__: null,
|
|
1304
1321
|
Arrow: tn,
|
|
1305
1322
|
Content: zo,
|
|
@@ -1337,6 +1354,6 @@ const Et = (n, s = []) => {
|
|
|
1337
1354
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1338
1355
|
export {
|
|
1339
1356
|
Tn as Combobox,
|
|
1340
|
-
|
|
1357
|
+
Vn as Select,
|
|
1341
1358
|
Rn as useCallbackRef
|
|
1342
1359
|
};
|