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