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