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