@strapi/ui-primitives 2.1.0 → 2.1.2
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.js +1 -1
- package/dist/index.mjs +354 -351
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as p, jsxs as ye, Fragment as Se } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import { useComposedRefs as A } from "@radix-ui/react-compose-refs";
|
|
4
4
|
import { createContextScope as st, createContext as it } from "@radix-ui/react-context";
|
|
5
5
|
import { Slot as Ee } from "@radix-ui/react-slot";
|
|
6
|
-
import { composeEventHandlers as
|
|
6
|
+
import { composeEventHandlers as E } from "@radix-ui/primitive";
|
|
7
7
|
import { DismissableLayer as ct } from "@radix-ui/react-dismissable-layer";
|
|
8
8
|
import { useFocusGuards as at } from "@radix-ui/react-focus-guards";
|
|
9
9
|
import { FocusScope as ut } from "@radix-ui/react-focus-scope";
|
|
@@ -29,43 +29,43 @@ function Jt(o) {
|
|
|
29
29
|
itemMap: /* @__PURE__ */ new Map(),
|
|
30
30
|
listeners: /* @__PURE__ */ new Set()
|
|
31
31
|
}), c = (u) => {
|
|
32
|
-
const { scope: f, children:
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
const { scope: f, children: m } = u, b = s.useRef(null), g = s.useRef(/* @__PURE__ */ new Map()).current, d = s.useRef(/* @__PURE__ */ new Set()).current;
|
|
33
|
+
return /* @__PURE__ */ p(n, { scope: f, itemMap: g, collectionRef: b, listeners: d, children: m });
|
|
34
34
|
};
|
|
35
35
|
c.displayName = i;
|
|
36
36
|
const l = `${o}CollectionSlot`, a = s.forwardRef((u, f) => {
|
|
37
|
-
const { scope:
|
|
38
|
-
return /* @__PURE__ */
|
|
37
|
+
const { scope: m, children: b } = u, g = r(l, m), d = A(f, g.collectionRef);
|
|
38
|
+
return /* @__PURE__ */ p(Ee, { ref: d, children: b });
|
|
39
39
|
});
|
|
40
40
|
a.displayName = l;
|
|
41
|
-
const
|
|
42
|
-
const { scope:
|
|
41
|
+
const h = `${o}CollectionItemSlot`, C = "data-radix-collection-item", v = s.forwardRef((u, f) => {
|
|
42
|
+
const { scope: m, children: b, ...g } = u, d = s.useRef(null), y = A(f, d), V = r(h, m);
|
|
43
43
|
return s.useEffect(() => {
|
|
44
|
-
const O = Array.from(
|
|
45
|
-
return
|
|
46
|
-
const F = Array.from(
|
|
47
|
-
|
|
44
|
+
const O = Array.from(V.itemMap.values());
|
|
45
|
+
return V.itemMap.set(d, { ref: d, ...g }), V.listeners.forEach((F) => F(Array.from(V.itemMap.values()), O)), () => {
|
|
46
|
+
const F = Array.from(V.itemMap.values());
|
|
47
|
+
V.itemMap.delete(d), V.listeners.forEach((_) => _(Array.from(V.itemMap.values()), F));
|
|
48
48
|
};
|
|
49
|
-
}), /* @__PURE__ */
|
|
49
|
+
}), /* @__PURE__ */ p(Ee, { [C]: "", ref: y, children: b });
|
|
50
50
|
});
|
|
51
|
-
v.displayName =
|
|
52
|
-
function
|
|
53
|
-
const f = r(`${o}CollectionConsumer`, u),
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
const
|
|
51
|
+
v.displayName = h;
|
|
52
|
+
function x(u) {
|
|
53
|
+
const f = r(`${o}CollectionConsumer`, u), m = s.useCallback(() => {
|
|
54
|
+
const g = f.collectionRef.current;
|
|
55
|
+
if (!g) return [];
|
|
56
|
+
const d = Array.from(g.querySelectorAll(`[${C}]`));
|
|
57
57
|
return Array.from(f.itemMap.values()).sort(
|
|
58
|
-
(O, F) =>
|
|
58
|
+
(O, F) => d.indexOf(O.ref.current) - d.indexOf(F.ref.current)
|
|
59
59
|
);
|
|
60
60
|
}, [f.collectionRef, f.itemMap]), b = s.useCallback(
|
|
61
|
-
(
|
|
61
|
+
(g) => (f.listeners.add(g), () => f.listeners.delete(g)),
|
|
62
62
|
[f.listeners]
|
|
63
63
|
);
|
|
64
|
-
return { getItems:
|
|
64
|
+
return { getItems: m, subscribe: b };
|
|
65
65
|
}
|
|
66
66
|
return [
|
|
67
67
|
{ Provider: c, Slot: a, ItemSlot: v },
|
|
68
|
-
|
|
68
|
+
x,
|
|
69
69
|
t
|
|
70
70
|
];
|
|
71
71
|
}
|
|
@@ -111,14 +111,14 @@ const eo = (o) => {
|
|
|
111
111
|
}), i.current;
|
|
112
112
|
}, ht = s.forwardRef(
|
|
113
113
|
({ children: o, estimatedItemSize: i = 40, overscan: e = 5, getItemCount: t, onViewportChange: n, ...r }, c) => {
|
|
114
|
-
const l = s.useRef(null), a = A(c, l, n),
|
|
114
|
+
const l = s.useRef(null), a = A(c, l, n), h = s.useMemo(() => s.Children.toArray(o), [o]), C = jt({
|
|
115
115
|
count: t(),
|
|
116
116
|
getScrollElement: () => l.current,
|
|
117
117
|
estimateSize: () => i,
|
|
118
118
|
overscan: e
|
|
119
119
|
}), v = C.getVirtualItems();
|
|
120
120
|
return /* @__PURE__ */ ye(Se, { children: [
|
|
121
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ p(
|
|
122
122
|
"style",
|
|
123
123
|
{
|
|
124
124
|
dangerouslySetInnerHTML: {
|
|
@@ -126,7 +126,7 @@ const eo = (o) => {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ p(
|
|
130
130
|
N.div,
|
|
131
131
|
{
|
|
132
132
|
"data-radix-combobox-viewport": "",
|
|
@@ -139,7 +139,7 @@ const eo = (o) => {
|
|
|
139
139
|
overflow: "auto",
|
|
140
140
|
...r.style
|
|
141
141
|
},
|
|
142
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ p(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
145
|
style: {
|
|
@@ -147,23 +147,23 @@ const eo = (o) => {
|
|
|
147
147
|
width: "100%",
|
|
148
148
|
position: "relative"
|
|
149
149
|
},
|
|
150
|
-
children: v.map((
|
|
151
|
-
const u =
|
|
152
|
-
return /* @__PURE__ */
|
|
150
|
+
children: v.map((x) => {
|
|
151
|
+
const u = h[x.index];
|
|
152
|
+
return /* @__PURE__ */ p(
|
|
153
153
|
"div",
|
|
154
154
|
{
|
|
155
|
-
"data-index":
|
|
155
|
+
"data-index": x.index,
|
|
156
156
|
ref: C.measureElement,
|
|
157
157
|
style: {
|
|
158
158
|
position: "absolute",
|
|
159
159
|
top: 0,
|
|
160
160
|
left: 0,
|
|
161
161
|
width: "100%",
|
|
162
|
-
transform: `translateY(${
|
|
162
|
+
transform: `translateY(${x.start}px)`
|
|
163
163
|
},
|
|
164
164
|
children: u
|
|
165
165
|
},
|
|
166
|
-
|
|
166
|
+
x.key
|
|
167
167
|
);
|
|
168
168
|
})
|
|
169
169
|
}
|
|
@@ -174,7 +174,7 @@ const eo = (o) => {
|
|
|
174
174
|
}
|
|
175
175
|
);
|
|
176
176
|
ht.displayName = "VirtualizedViewport";
|
|
177
|
-
const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !!(o.length === 1 && o.match(/\S| /)), gt = "Combobox", [re, xe] = Jt(gt), [ro, Y] = it(gt), lo = ({ children: o }) => /* @__PURE__ */
|
|
177
|
+
const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !!(o.length === 1 && o.match(/\S| /)), gt = "Combobox", [re, xe] = Jt(gt), [ro, Y] = it(gt), lo = ({ children: o }) => /* @__PURE__ */ p(ie.Root, { children: /* @__PURE__ */ p(re.Provider, { scope: void 0, children: o }) }), so = (o) => typeof o == "string" ? o === "none" ? {
|
|
178
178
|
type: o,
|
|
179
179
|
filter: void 0
|
|
180
180
|
} : {
|
|
@@ -190,44 +190,44 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
190
190
|
onOpenChange: c,
|
|
191
191
|
value: l,
|
|
192
192
|
defaultValue: a,
|
|
193
|
-
onValueChange:
|
|
193
|
+
onValueChange: h,
|
|
194
194
|
disabled: C,
|
|
195
195
|
required: v = !1,
|
|
196
|
-
locale:
|
|
196
|
+
locale: x = "en-EN",
|
|
197
197
|
onTextValueChange: u,
|
|
198
198
|
textValue: f,
|
|
199
|
-
defaultTextValue:
|
|
199
|
+
defaultTextValue: m,
|
|
200
200
|
filterValue: b,
|
|
201
|
-
defaultFilterValue:
|
|
202
|
-
onFilterValueChange:
|
|
201
|
+
defaultFilterValue: g,
|
|
202
|
+
onFilterValueChange: d,
|
|
203
203
|
isPrintableCharacter: y = no,
|
|
204
|
-
visible:
|
|
204
|
+
visible: V = !1,
|
|
205
205
|
virtualized: O = "auto",
|
|
206
206
|
estimatedItemSize: F = 40,
|
|
207
207
|
overscan: _ = 5
|
|
208
|
-
} = o, [k, Z] = s.useState(null), [U,
|
|
208
|
+
} = o, [k, Z] = s.useState(null), [U, W] = s.useState(null), [R, H] = s.useState(null), [L, z] = s.useState(null), [J = !1, Q] = de({
|
|
209
209
|
prop: n,
|
|
210
210
|
defaultProp: r,
|
|
211
211
|
onChange: c
|
|
212
212
|
}), [K, G] = de({
|
|
213
213
|
prop: l,
|
|
214
214
|
defaultProp: a,
|
|
215
|
-
onChange:
|
|
215
|
+
onChange: h
|
|
216
216
|
}), [ce, ee] = de({
|
|
217
217
|
prop: f,
|
|
218
|
-
defaultProp: i && !
|
|
218
|
+
defaultProp: i && !m ? l : m,
|
|
219
219
|
onChange: u
|
|
220
220
|
}), [fe, me] = de({
|
|
221
221
|
prop: b,
|
|
222
|
-
defaultProp:
|
|
223
|
-
onChange:
|
|
222
|
+
defaultProp: g,
|
|
223
|
+
onChange: d
|
|
224
224
|
}), te = se(), ae = s.useCallback(
|
|
225
225
|
(S, I) => {
|
|
226
226
|
var j;
|
|
227
|
-
const M = I.map((D) => D.ref.current), [
|
|
227
|
+
const M = I.map((D) => D.ref.current), [P, ...T] = M, [w] = T.slice(-1), B = L ?? ((j = I.find((D) => D.value === K)) == null ? void 0 : j.ref.current);
|
|
228
228
|
for (const D of S) {
|
|
229
229
|
if (D === B) return;
|
|
230
|
-
if (D == null || D.scrollIntoView({ block: "nearest" }), D ===
|
|
230
|
+
if (D == null || D.scrollIntoView({ block: "nearest" }), D === P && U && (U.scrollTop = 0), D === w && U && (U.scrollTop = U.scrollHeight), z(D), e === "both") {
|
|
231
231
|
const ue = I.find((he) => he.ref.current === D);
|
|
232
232
|
ue && ee(ue.textValue);
|
|
233
233
|
}
|
|
@@ -237,10 +237,10 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
237
237
|
[e, ee, U, L, K]
|
|
238
238
|
), ne = so(e);
|
|
239
239
|
return s.useEffect(() => {
|
|
240
|
-
e !== "both" &&
|
|
240
|
+
e !== "both" && z(null);
|
|
241
241
|
}, [ce, e]), s.useEffect(() => {
|
|
242
242
|
if (R && k) return ft([R, k]);
|
|
243
|
-
}, [R, k]), /* @__PURE__ */
|
|
243
|
+
}, [R, k]), /* @__PURE__ */ p(lo, { children: /* @__PURE__ */ p(
|
|
244
244
|
ro,
|
|
245
245
|
{
|
|
246
246
|
allowCustomValue: i,
|
|
@@ -254,18 +254,18 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
254
254
|
open: J,
|
|
255
255
|
onOpenChange: Q,
|
|
256
256
|
disabled: C,
|
|
257
|
-
locale:
|
|
257
|
+
locale: x,
|
|
258
258
|
focusFirst: ae,
|
|
259
259
|
textValue: ce,
|
|
260
260
|
onTextValueChange: ee,
|
|
261
|
-
onViewportChange:
|
|
261
|
+
onViewportChange: W,
|
|
262
262
|
onContentChange: H,
|
|
263
263
|
visuallyFocussedItem: L,
|
|
264
264
|
filterValue: fe,
|
|
265
265
|
onFilterValueChange: me,
|
|
266
|
-
onVisuallyFocussedItemChange:
|
|
266
|
+
onVisuallyFocussedItemChange: z,
|
|
267
267
|
isPrintableCharacter: y,
|
|
268
|
-
visible:
|
|
268
|
+
visible: V,
|
|
269
269
|
virtualized: O,
|
|
270
270
|
estimatedItemSize: F,
|
|
271
271
|
overscan: _,
|
|
@@ -276,7 +276,7 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
276
276
|
const { ...e } = o, t = Y(xt), n = () => {
|
|
277
277
|
t.disabled || t.onOpenChange(!0);
|
|
278
278
|
};
|
|
279
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ p(ie.Anchor, { asChild: !0, children: /* @__PURE__ */ p(
|
|
280
280
|
ut,
|
|
281
281
|
{
|
|
282
282
|
asChild: !0,
|
|
@@ -288,13 +288,13 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
288
288
|
var c, l;
|
|
289
289
|
(c = t.trigger) == null || c.focus({ preventScroll: !0 }), (l = document.getSelection()) == null || l.empty(), r.preventDefault();
|
|
290
290
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
291
|
+
children: /* @__PURE__ */ p(
|
|
292
292
|
"div",
|
|
293
293
|
{
|
|
294
294
|
ref: i,
|
|
295
295
|
"data-disabled": t.disabled ? "" : void 0,
|
|
296
296
|
...e,
|
|
297
|
-
onClick:
|
|
297
|
+
onClick: E(e.onClick, (r) => {
|
|
298
298
|
var c;
|
|
299
299
|
if (t.disabled) {
|
|
300
300
|
r.preventDefault();
|
|
@@ -302,7 +302,7 @@ const to = [" ", "Enter", "ArrowUp", "ArrowDown"], oo = ["Enter"], no = (o) => !
|
|
|
302
302
|
}
|
|
303
303
|
(c = t.trigger) == null || c.focus();
|
|
304
304
|
}),
|
|
305
|
-
onPointerDown:
|
|
305
|
+
onPointerDown: E(e.onPointerDown, (r) => {
|
|
306
306
|
var a;
|
|
307
307
|
if (t.disabled) {
|
|
308
308
|
r.preventDefault();
|
|
@@ -321,19 +321,19 @@ const vt = "ComboboxInput", bt = s.forwardRef((o, i) => {
|
|
|
321
321
|
var C;
|
|
322
322
|
const e = Y(vt), t = s.useRef(null), { getItems: n } = xe(void 0), { startsWith: r } = De(e.locale, { sensitivity: "base" }), c = e.disabled, l = A(t, i, e.onTriggerChange), a = () => {
|
|
323
323
|
c || e.onOpenChange(!0);
|
|
324
|
-
},
|
|
324
|
+
}, h = eo(e.filterValue);
|
|
325
325
|
return $(() => {
|
|
326
326
|
const v = setTimeout(() => {
|
|
327
327
|
var f;
|
|
328
328
|
if (e.textValue === "" || e.textValue === void 0 || e.filterValue === "" || e.filterValue === void 0)
|
|
329
329
|
return;
|
|
330
|
-
const
|
|
331
|
-
(
|
|
332
|
-
), u = wo(
|
|
333
|
-
|
|
330
|
+
const x = n().find(
|
|
331
|
+
(m) => m.type === "option" && r(m.textValue, e.textValue)
|
|
332
|
+
), u = wo(h ?? "", e.filterValue);
|
|
333
|
+
x && !e.visuallyFocussedItem && u === e.filterValue.length && ((f = t.current) == null || f.setSelectionRange(e.filterValue.length, e.textValue.length));
|
|
334
334
|
});
|
|
335
335
|
return () => clearTimeout(v);
|
|
336
|
-
}, [e.textValue, e.filterValue, r, e.visuallyFocussedItem, n,
|
|
336
|
+
}, [e.textValue, e.filterValue, r, e.visuallyFocussedItem, n, h]), /* @__PURE__ */ p(
|
|
337
337
|
"input",
|
|
338
338
|
{
|
|
339
339
|
type: "text",
|
|
@@ -351,24 +351,24 @@ const vt = "ComboboxInput", bt = s.forwardRef((o, i) => {
|
|
|
351
351
|
value: e.textValue ?? "",
|
|
352
352
|
...o,
|
|
353
353
|
ref: l,
|
|
354
|
-
onKeyDown:
|
|
355
|
-
var
|
|
354
|
+
onKeyDown: E(o.onKeyDown, (v) => {
|
|
355
|
+
var x, u;
|
|
356
356
|
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(v.key))
|
|
357
357
|
e.open || a(), setTimeout(() => {
|
|
358
358
|
var b;
|
|
359
|
-
let
|
|
360
|
-
if (["ArrowUp", "End"].includes(v.key) && (
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
let
|
|
364
|
-
|
|
359
|
+
let m = n().filter((g) => !g.disabled && g.isVisible).map((g) => g.ref.current);
|
|
360
|
+
if (["ArrowUp", "End"].includes(v.key) && (m = m.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(v.key)) {
|
|
361
|
+
const g = e.visuallyFocussedItem ?? ((b = n().find((d) => d.value === e.value)) == null ? void 0 : b.ref.current);
|
|
362
|
+
if (g) {
|
|
363
|
+
let d = m.indexOf(g);
|
|
364
|
+
d === m.length - 1 && (d = -1), m = m.slice(d + 1);
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
if (["ArrowDown"].includes(v.key) && e.autocomplete.type === "both" &&
|
|
368
|
-
const [
|
|
369
|
-
e.textValue === y && (
|
|
367
|
+
if (["ArrowDown"].includes(v.key) && e.autocomplete.type === "both" && m.length > 1) {
|
|
368
|
+
const [g, ...d] = m, y = n().find((V) => V.ref.current === g).textValue;
|
|
369
|
+
e.textValue === y && (m = d);
|
|
370
370
|
}
|
|
371
|
-
e.focusFirst(
|
|
371
|
+
e.focusFirst(m, n());
|
|
372
372
|
}), v.preventDefault();
|
|
373
373
|
else if (["Tab"].includes(v.key) && e.open)
|
|
374
374
|
v.preventDefault();
|
|
@@ -376,11 +376,11 @@ const vt = "ComboboxInput", bt = s.forwardRef((o, i) => {
|
|
|
376
376
|
e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), v.preventDefault();
|
|
377
377
|
else if (oo.includes(v.key)) {
|
|
378
378
|
if (e.visuallyFocussedItem) {
|
|
379
|
-
const f = n().find((
|
|
380
|
-
f && (e.onValueChange(f.value), e.onTextValueChange(f.textValue), e.autocomplete.type === "both" && e.onFilterValueChange(f.textValue), (
|
|
379
|
+
const f = n().find((m) => m.ref.current === e.visuallyFocussedItem);
|
|
380
|
+
f && (e.onValueChange(f.value), e.onTextValueChange(f.textValue), e.autocomplete.type === "both" && e.onFilterValueChange(f.textValue), (x = f.ref.current) == null || x.click());
|
|
381
381
|
} else {
|
|
382
382
|
const f = n().find(
|
|
383
|
-
(
|
|
383
|
+
(m) => m.type === "option" && !m.disabled && m.textValue === e.textValue
|
|
384
384
|
);
|
|
385
385
|
f && (e.onValueChange(f.value), e.onTextValueChange(f.textValue), e.autocomplete.type === "both" && e.onFilterValueChange(f.textValue), (u = f.ref.current) == null || u.click());
|
|
386
386
|
}
|
|
@@ -388,22 +388,22 @@ const vt = "ComboboxInput", bt = s.forwardRef((o, i) => {
|
|
|
388
388
|
} else
|
|
389
389
|
e.onVisuallyFocussedItemChange(null);
|
|
390
390
|
}),
|
|
391
|
-
onChange:
|
|
391
|
+
onChange: E(o.onChange, (v) => {
|
|
392
392
|
e.onTextValueChange(v.currentTarget.value), e.autocomplete.type === "both" && e.onFilterValueChange(v.currentTarget.value);
|
|
393
393
|
}),
|
|
394
|
-
onKeyUp:
|
|
395
|
-
var
|
|
394
|
+
onKeyUp: E(o.onKeyUp, (v) => {
|
|
395
|
+
var x;
|
|
396
396
|
if (!e.open && (e.isPrintableCharacter(v.key) || ["Backspace"].includes(v.key)) && a(), setTimeout(() => {
|
|
397
397
|
if (e.autocomplete.type === "both" && e.isPrintableCharacter(v.key) && e.filterValue !== void 0) {
|
|
398
|
-
const u = e.filterValue, f = n().find((
|
|
398
|
+
const u = e.filterValue, f = n().find((m) => r(m.textValue, u));
|
|
399
399
|
f && e.onTextValueChange(f.textValue);
|
|
400
400
|
}
|
|
401
401
|
}), e.autocomplete.type === "none" && e.isPrintableCharacter(v.key)) {
|
|
402
|
-
const u = e.textValue ?? "", f = n().find((
|
|
403
|
-
f && (e.onVisuallyFocussedItemChange(f.ref.current), (
|
|
402
|
+
const u = e.textValue ?? "", f = n().find((m) => r(m.textValue, u));
|
|
403
|
+
f && (e.onVisuallyFocussedItemChange(f.ref.current), (x = f.ref.current) == null || x.scrollIntoView());
|
|
404
404
|
}
|
|
405
405
|
}),
|
|
406
|
-
onBlur:
|
|
406
|
+
onBlur: E(o.onBlur, () => {
|
|
407
407
|
if (e.open)
|
|
408
408
|
return;
|
|
409
409
|
e.onVisuallyFocussedItemChange(null);
|
|
@@ -418,8 +418,8 @@ const vt = "ComboboxInput", bt = s.forwardRef((o, i) => {
|
|
|
418
418
|
e.onValueChange(e.textValue), e.autocomplete.type === "both" && e.onFilterValueChange(e.textValue);
|
|
419
419
|
return;
|
|
420
420
|
}
|
|
421
|
-
const [
|
|
422
|
-
|
|
421
|
+
const [x] = n().filter((u) => u.value === e.value && u.type === "option");
|
|
422
|
+
x && e.textValue !== "" ? (e.onTextValueChange(x.textValue), e.autocomplete.type === "both" && e.onFilterValueChange(x.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
|
|
423
423
|
})
|
|
424
424
|
}
|
|
425
425
|
);
|
|
@@ -430,7 +430,7 @@ const yt = s.forwardRef((o, i) => {
|
|
|
430
430
|
var l;
|
|
431
431
|
r || (n.onOpenChange(!0), (l = n.trigger) == null || l.focus());
|
|
432
432
|
};
|
|
433
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ p(
|
|
434
434
|
N.button,
|
|
435
435
|
{
|
|
436
436
|
"aria-hidden": !0,
|
|
@@ -443,14 +443,14 @@ const yt = s.forwardRef((o, i) => {
|
|
|
443
443
|
...t,
|
|
444
444
|
tabIndex: -1,
|
|
445
445
|
ref: i,
|
|
446
|
-
onClick:
|
|
446
|
+
onClick: E(t.onClick, () => {
|
|
447
447
|
var l;
|
|
448
448
|
(l = n.trigger) == null || l.focus();
|
|
449
449
|
}),
|
|
450
|
-
onPointerDown:
|
|
450
|
+
onPointerDown: E(t.onPointerDown, (l) => {
|
|
451
451
|
l.button === 0 && l.ctrlKey === !1 && (c(), l.preventDefault());
|
|
452
452
|
}),
|
|
453
|
-
onKeyDown:
|
|
453
|
+
onKeyDown: E(t.onKeyDown, (l) => {
|
|
454
454
|
to.includes(l.key) && (c(), l.preventDefault());
|
|
455
455
|
}),
|
|
456
456
|
children: e || "▼"
|
|
@@ -458,7 +458,7 @@ const yt = s.forwardRef((o, i) => {
|
|
|
458
458
|
);
|
|
459
459
|
});
|
|
460
460
|
yt.displayName = "ComboboxIcon";
|
|
461
|
-
const co = "ComboboxPortal", St = (o) => /* @__PURE__ */
|
|
461
|
+
const co = "ComboboxPortal", St = (o) => /* @__PURE__ */ p(pt, { asChild: !0, ...o });
|
|
462
462
|
St.displayName = co;
|
|
463
463
|
const ke = "ComboboxContent", wt = s.forwardRef((o, i) => {
|
|
464
464
|
const e = Y(ke), { getItems: t } = xe(void 0), [n, r] = s.useState();
|
|
@@ -473,11 +473,11 @@ const ke = "ComboboxContent", wt = s.forwardRef((o, i) => {
|
|
|
473
473
|
}, [t, e.autocomplete, e.value, e.open]), !e.open) {
|
|
474
474
|
const c = n;
|
|
475
475
|
return c ? we.createPortal(
|
|
476
|
-
/* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ p(re.Slot, { scope: void 0, children: /* @__PURE__ */ p("div", { children: o.children }) }),
|
|
477
477
|
c
|
|
478
478
|
) : null;
|
|
479
479
|
}
|
|
480
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ p(It, { ...o, ref: i });
|
|
481
481
|
});
|
|
482
482
|
wt.displayName = ke;
|
|
483
483
|
const ao = 10, It = s.forwardRef(
|
|
@@ -490,7 +490,7 @@ const ao = 10, It = s.forwardRef(
|
|
|
490
490
|
return window.addEventListener("blur", a), window.addEventListener("resize", a), () => {
|
|
491
491
|
window.removeEventListener("blur", a), window.removeEventListener("resize", a);
|
|
492
492
|
};
|
|
493
|
-
}, [l]), /* @__PURE__ */
|
|
493
|
+
}, [l]), /* @__PURE__ */ p(mt, { allowPinchZoom: !0, children: /* @__PURE__ */ p(
|
|
494
494
|
ct,
|
|
495
495
|
{
|
|
496
496
|
asChild: !0,
|
|
@@ -503,7 +503,7 @@ const ao = 10, It = s.forwardRef(
|
|
|
503
503
|
var a;
|
|
504
504
|
r.onOpenChange(!1), (a = r.trigger) == null || a.focus({ preventScroll: !0 });
|
|
505
505
|
},
|
|
506
|
-
children: /* @__PURE__ */
|
|
506
|
+
children: /* @__PURE__ */ p(
|
|
507
507
|
Tt,
|
|
508
508
|
{
|
|
509
509
|
role: "listbox",
|
|
@@ -530,7 +530,7 @@ It.displayName = "ComboboxContentImpl";
|
|
|
530
530
|
const Tt = s.forwardRef(
|
|
531
531
|
(o, i) => {
|
|
532
532
|
const { align: e = "start", collisionPadding: t = ao, ...n } = o;
|
|
533
|
-
return /* @__PURE__ */
|
|
533
|
+
return /* @__PURE__ */ p(
|
|
534
534
|
ie.Content,
|
|
535
535
|
{
|
|
536
536
|
...n,
|
|
@@ -554,7 +554,7 @@ const Tt = s.forwardRef(
|
|
|
554
554
|
Tt.displayName = "ComboboxPopperPosition";
|
|
555
555
|
const Vt = "ComboboxViewport", Pt = s.forwardRef((o, i) => {
|
|
556
556
|
const e = Y(Vt), t = A(i, e.onViewportChange), r = s.useMemo(() => s.Children.toArray(o.children), [o.children]).length;
|
|
557
|
-
return e.virtualized === !0 || e.virtualized === "auto" && r > 100 ? /* @__PURE__ */
|
|
557
|
+
return e.virtualized === !0 || e.virtualized === "auto" && r > 100 ? /* @__PURE__ */ p(re.Slot, { scope: void 0, children: /* @__PURE__ */ p(
|
|
558
558
|
ht,
|
|
559
559
|
{
|
|
560
560
|
...o,
|
|
@@ -565,7 +565,7 @@ const Vt = "ComboboxViewport", Pt = s.forwardRef((o, i) => {
|
|
|
565
565
|
onViewportChange: e.onViewportChange
|
|
566
566
|
}
|
|
567
567
|
) }) : /* @__PURE__ */ ye(Se, { children: [
|
|
568
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ p(
|
|
569
569
|
"style",
|
|
570
570
|
{
|
|
571
571
|
dangerouslySetInnerHTML: {
|
|
@@ -573,7 +573,7 @@ const Vt = "ComboboxViewport", Pt = s.forwardRef((o, i) => {
|
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
),
|
|
576
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ p(re.Slot, { scope: void 0, children: /* @__PURE__ */ p(
|
|
577
577
|
N.div,
|
|
578
578
|
{
|
|
579
579
|
"data-radix-combobox-viewport": "",
|
|
@@ -599,51 +599,51 @@ const Ie = "ComboboxItem", [lt, Fe] = it(Ie), Le = s.forwardRef((o, i) => {
|
|
|
599
599
|
$(() => {
|
|
600
600
|
l(new DocumentFragment());
|
|
601
601
|
}, []);
|
|
602
|
-
const { onTextValueChange: a, textValue:
|
|
603
|
-
u((y) => y || ((
|
|
602
|
+
const { onTextValueChange: a, textValue: h, ...C } = Y(Ie), v = se(), [x, u] = s.useState(n ?? ""), f = C.value === e, { startsWith: m, contains: b } = De(C.locale, { sensitivity: "base" }), g = s.useCallback((d) => {
|
|
603
|
+
u((y) => y || ((d == null ? void 0 : d.textContent) ?? "").trim());
|
|
604
604
|
}, []);
|
|
605
605
|
return s.useEffect(() => {
|
|
606
|
-
f &&
|
|
607
|
-
}, [
|
|
608
|
-
/* @__PURE__ */
|
|
606
|
+
f && h === void 0 && x !== "" && a(x);
|
|
607
|
+
}, [x, f, h, a]), C.autocomplete.type === "both" && x && C.filterValue && !m(x, C.filterValue) || C.autocomplete.type === "list" && C.autocomplete.filter === "startsWith" && x && h && !m(x, h) || C.autocomplete.type === "list" && C.autocomplete.filter === "contains" && x && h && !b(x, h) ? c ? we.createPortal(
|
|
608
|
+
/* @__PURE__ */ p(
|
|
609
609
|
lt,
|
|
610
610
|
{
|
|
611
611
|
textId: v,
|
|
612
|
-
onTextValueChange:
|
|
612
|
+
onTextValueChange: g,
|
|
613
613
|
isSelected: f,
|
|
614
|
-
textValue:
|
|
615
|
-
children: /* @__PURE__ */
|
|
614
|
+
textValue: x,
|
|
615
|
+
children: /* @__PURE__ */ p(
|
|
616
616
|
re.ItemSlot,
|
|
617
617
|
{
|
|
618
618
|
scope: void 0,
|
|
619
619
|
value: e,
|
|
620
|
-
textValue:
|
|
620
|
+
textValue: x,
|
|
621
621
|
disabled: t,
|
|
622
622
|
type: "option",
|
|
623
623
|
isVisible: !1,
|
|
624
|
-
children: /* @__PURE__ */
|
|
624
|
+
children: /* @__PURE__ */ p(Ne, { ref: i, value: e, disabled: t, ...r })
|
|
625
625
|
}
|
|
626
626
|
)
|
|
627
627
|
}
|
|
628
628
|
),
|
|
629
629
|
c
|
|
630
|
-
) : null : /* @__PURE__ */
|
|
630
|
+
) : null : /* @__PURE__ */ p(
|
|
631
631
|
lt,
|
|
632
632
|
{
|
|
633
633
|
textId: v,
|
|
634
|
-
onTextValueChange:
|
|
634
|
+
onTextValueChange: g,
|
|
635
635
|
isSelected: f,
|
|
636
|
-
textValue:
|
|
637
|
-
children: /* @__PURE__ */
|
|
636
|
+
textValue: x,
|
|
637
|
+
children: /* @__PURE__ */ p(
|
|
638
638
|
re.ItemSlot,
|
|
639
639
|
{
|
|
640
640
|
scope: void 0,
|
|
641
641
|
value: e,
|
|
642
|
-
textValue:
|
|
642
|
+
textValue: x,
|
|
643
643
|
disabled: t,
|
|
644
644
|
type: "option",
|
|
645
645
|
isVisible: !0,
|
|
646
|
-
children: /* @__PURE__ */
|
|
646
|
+
children: /* @__PURE__ */ p(Ne, { ref: i, value: e, disabled: t, ...r })
|
|
647
647
|
}
|
|
648
648
|
)
|
|
649
649
|
}
|
|
@@ -651,20 +651,20 @@ const Ie = "ComboboxItem", [lt, Fe] = it(Ie), Le = s.forwardRef((o, i) => {
|
|
|
651
651
|
});
|
|
652
652
|
Le.displayName = Ie;
|
|
653
653
|
const Et = "ComboboxItemImpl", Ne = s.forwardRef((o, i) => {
|
|
654
|
-
const { value: e, disabled: t = !1, ...n } = o, r = s.useRef(null), c = A(i, r), { getItems: l } = xe(void 0), { onTextValueChange: a, visuallyFocussedItem:
|
|
655
|
-
var
|
|
656
|
-
t || (C.onValueChange(e), a(
|
|
657
|
-
},
|
|
658
|
-
var
|
|
659
|
-
return
|
|
660
|
-
}, [l,
|
|
661
|
-
return /* @__PURE__ */
|
|
654
|
+
const { value: e, disabled: t = !1, ...n } = o, r = s.useRef(null), c = A(i, r), { getItems: l } = xe(void 0), { onTextValueChange: a, visuallyFocussedItem: h, ...C } = Y(Ie), { isSelected: v, textValue: x, textId: u } = Fe(Et), f = () => {
|
|
655
|
+
var g;
|
|
656
|
+
t || (C.onValueChange(e), a(x), C.onOpenChange(!1), C.autocomplete.type === "both" && C.onFilterValueChange(x), (g = C.trigger) == null || g.focus({ preventScroll: !0 }));
|
|
657
|
+
}, m = s.useMemo(() => {
|
|
658
|
+
var g;
|
|
659
|
+
return h === ((g = l().find((d) => d.ref.current === r.current)) == null ? void 0 : g.ref.current);
|
|
660
|
+
}, [l, h]), b = se();
|
|
661
|
+
return /* @__PURE__ */ p(
|
|
662
662
|
N.div,
|
|
663
663
|
{
|
|
664
664
|
role: "option",
|
|
665
665
|
"aria-labelledby": u,
|
|
666
|
-
"data-highlighted":
|
|
667
|
-
"aria-selected": v &&
|
|
666
|
+
"data-highlighted": m ? "" : void 0,
|
|
667
|
+
"aria-selected": v && m,
|
|
668
668
|
"data-state": v ? "checked" : "unchecked",
|
|
669
669
|
"aria-disabled": t || void 0,
|
|
670
670
|
"data-disabled": t ? "" : void 0,
|
|
@@ -672,19 +672,19 @@ const Et = "ComboboxItemImpl", Ne = s.forwardRef((o, i) => {
|
|
|
672
672
|
...n,
|
|
673
673
|
id: b,
|
|
674
674
|
ref: c,
|
|
675
|
-
onPointerUp:
|
|
675
|
+
onPointerUp: E(n.onPointerUp, f)
|
|
676
676
|
}
|
|
677
677
|
);
|
|
678
678
|
});
|
|
679
679
|
Ne.displayName = Et;
|
|
680
680
|
const Nt = "ComboboxItemText", Rt = s.forwardRef((o, i) => {
|
|
681
681
|
const { className: e, style: t, ...n } = o, r = Fe(Nt), c = A(i, r.onTextValueChange);
|
|
682
|
-
return /* @__PURE__ */
|
|
682
|
+
return /* @__PURE__ */ p(N.span, { id: r.textId, ...n, ref: c });
|
|
683
683
|
});
|
|
684
684
|
Rt.displayName = Nt;
|
|
685
685
|
const At = "ComboboxItemIndicator", _t = s.forwardRef((o, i) => {
|
|
686
686
|
const { isSelected: e } = Fe(At);
|
|
687
|
-
return e ? /* @__PURE__ */
|
|
687
|
+
return e ? /* @__PURE__ */ p(N.span, { "aria-hidden": !0, ...o, ref: i }) : null;
|
|
688
688
|
});
|
|
689
689
|
_t.displayName = At;
|
|
690
690
|
const Be = "ComboboxNoValueFound", Mt = s.forwardRef((o, i) => {
|
|
@@ -694,37 +694,37 @@ const Be = "ComboboxNoValueFound", Mt = s.forwardRef((o, i) => {
|
|
|
694
694
|
visible: n = !1,
|
|
695
695
|
locale: r,
|
|
696
696
|
autocomplete: c
|
|
697
|
-
} = Y(Be), [l, a] = s.useState([]), { subscribe:
|
|
697
|
+
} = Y(Be), [l, a] = s.useState([]), { subscribe: h } = xe(void 0), { startsWith: C, contains: v } = De(r, { sensitivity: "base" });
|
|
698
698
|
return s.useEffect(() => {
|
|
699
|
-
const
|
|
699
|
+
const x = h((u) => {
|
|
700
700
|
if (n) {
|
|
701
|
-
const f = u.filter((
|
|
701
|
+
const f = u.filter((m) => m.type !== "create");
|
|
702
702
|
a(f);
|
|
703
703
|
} else
|
|
704
704
|
a(u);
|
|
705
705
|
});
|
|
706
706
|
return () => {
|
|
707
|
-
|
|
707
|
+
x();
|
|
708
708
|
};
|
|
709
|
-
}, [n,
|
|
709
|
+
}, [n, h]), c.type === "none" && l.length > 0 || c.type === "list" && c.filter === "startsWith" && l.some((x) => C(x.textValue, e)) || c.type === "both" && l.some((x) => C(x.textValue, t)) || c.type === "list" && c.filter === "contains" && l.some((x) => v(x.textValue, e)) ? null : /* @__PURE__ */ p(N.div, { ...o, ref: i });
|
|
710
710
|
});
|
|
711
711
|
Mt.displayName = Be;
|
|
712
712
|
const Ot = s.forwardRef((o, i) => {
|
|
713
|
-
const { disabled: e = !1, ...t } = o, n = Y(Be), { textValue: r, visuallyFocussedItem: c } = n, { getItems: l, subscribe: a } = xe(void 0),
|
|
713
|
+
const { disabled: e = !1, ...t } = o, n = Y(Be), { textValue: r, visuallyFocussedItem: c } = n, { getItems: l, subscribe: a } = xe(void 0), h = s.useRef(null), [C, v] = s.useState(!1), x = A(i, h), u = s.useMemo(() => {
|
|
714
714
|
var b;
|
|
715
|
-
return c === ((b = l().find((
|
|
716
|
-
}, [l, c]), f = se(),
|
|
715
|
+
return c === ((b = l().find((g) => g.ref.current === h.current)) == null ? void 0 : b.ref.current);
|
|
716
|
+
}, [l, c]), f = se(), m = () => {
|
|
717
717
|
var b;
|
|
718
718
|
!e && r && (n.onValueChange(r), n.onTextValueChange(r), n.onOpenChange(!1), n.autocomplete.type === "both" && n.onFilterValueChange(r), (b = n.trigger) == null || b.focus({ preventScroll: !0 }));
|
|
719
719
|
};
|
|
720
720
|
return $(() => {
|
|
721
|
-
const b = a((
|
|
722
|
-
v(!
|
|
721
|
+
const b = a((g) => {
|
|
722
|
+
v(!g.some((d) => d.textValue === r && d.type !== "create"));
|
|
723
723
|
});
|
|
724
724
|
return l().length === 0 && v(!0), () => {
|
|
725
725
|
b();
|
|
726
726
|
};
|
|
727
|
-
}, [r, a, l]), (!r || !C) && !n.visible ? null : /* @__PURE__ */
|
|
727
|
+
}, [r, a, l]), (!r || !C) && !n.visible ? null : /* @__PURE__ */ p(
|
|
728
728
|
re.ItemSlot,
|
|
729
729
|
{
|
|
730
730
|
scope: void 0,
|
|
@@ -733,7 +733,7 @@ const Ot = s.forwardRef((o, i) => {
|
|
|
733
733
|
disabled: e,
|
|
734
734
|
isVisible: !0,
|
|
735
735
|
type: "create",
|
|
736
|
-
children: /* @__PURE__ */
|
|
736
|
+
children: /* @__PURE__ */ p(
|
|
737
737
|
N.div,
|
|
738
738
|
{
|
|
739
739
|
role: "option",
|
|
@@ -743,8 +743,8 @@ const Ot = s.forwardRef((o, i) => {
|
|
|
743
743
|
"data-highlighted": u ? "" : void 0,
|
|
744
744
|
...t,
|
|
745
745
|
id: f,
|
|
746
|
-
ref:
|
|
747
|
-
onPointerUp:
|
|
746
|
+
ref: x,
|
|
747
|
+
onPointerUp: E(t.onPointerUp, m)
|
|
748
748
|
}
|
|
749
749
|
)
|
|
750
750
|
}
|
|
@@ -797,13 +797,13 @@ const To = [" ", "Enter", "ArrowUp", "ArrowDown"], Vo = [" ", "Enter"], Ce = "Se
|
|
|
797
797
|
value: c,
|
|
798
798
|
defaultValue: l,
|
|
799
799
|
onValueChange: a,
|
|
800
|
-
dir:
|
|
800
|
+
dir: h,
|
|
801
801
|
// name,
|
|
802
802
|
// autoComplete,
|
|
803
803
|
disabled: C,
|
|
804
804
|
required: v,
|
|
805
|
-
multi:
|
|
806
|
-
} = o, u = Ve(i), [f,
|
|
805
|
+
multi: x = !1
|
|
806
|
+
} = o, u = Ve(i), [f, m] = s.useState(null), [b, g] = s.useState(null), [d, y] = s.useState(!1), V = qt(h), [O = !1, F] = de({
|
|
807
807
|
prop: t,
|
|
808
808
|
defaultProp: n,
|
|
809
809
|
onChange: r
|
|
@@ -813,36 +813,36 @@ const To = [" ", "Enter", "ArrowUp", "ArrowDown"], Vo = [" ", "Enter"], Ce = "Se
|
|
|
813
813
|
onChange(R) {
|
|
814
814
|
a && (Array.isArray(R), a(R));
|
|
815
815
|
}
|
|
816
|
-
}), Z = s.useRef(null), [U,
|
|
817
|
-
return /* @__PURE__ */
|
|
816
|
+
}), Z = s.useRef(null), [U, W] = s.useState(/* @__PURE__ */ new Set());
|
|
817
|
+
return /* @__PURE__ */ p(ie.Root, { ...u, children: /* @__PURE__ */ p(
|
|
818
818
|
No,
|
|
819
819
|
{
|
|
820
820
|
required: v,
|
|
821
821
|
scope: i,
|
|
822
822
|
trigger: f,
|
|
823
|
-
onTriggerChange:
|
|
823
|
+
onTriggerChange: m,
|
|
824
824
|
valueNode: b,
|
|
825
|
-
onValueNodeChange:
|
|
826
|
-
valueNodeHasChildren:
|
|
825
|
+
onValueNodeChange: g,
|
|
826
|
+
valueNodeHasChildren: d,
|
|
827
827
|
onValueNodeHasChildrenChange: y,
|
|
828
828
|
contentId: se(),
|
|
829
829
|
value: _,
|
|
830
830
|
onValueChange: k,
|
|
831
831
|
open: O,
|
|
832
832
|
onOpenChange: F,
|
|
833
|
-
dir:
|
|
833
|
+
dir: V,
|
|
834
834
|
triggerPointerDownPosRef: Z,
|
|
835
835
|
disabled: C,
|
|
836
|
-
multi:
|
|
837
|
-
children: /* @__PURE__ */
|
|
836
|
+
multi: x,
|
|
837
|
+
children: /* @__PURE__ */ p(Te.Provider, { scope: i, children: /* @__PURE__ */ p(
|
|
838
838
|
Ro,
|
|
839
839
|
{
|
|
840
840
|
scope: o.__scopeSelect,
|
|
841
841
|
onNativeOptionAdd: s.useCallback((R) => {
|
|
842
|
-
|
|
842
|
+
W((H) => new Set(H).add(R));
|
|
843
843
|
}, []),
|
|
844
844
|
onNativeOptionRemove: s.useCallback((R) => {
|
|
845
|
-
|
|
845
|
+
W((H) => {
|
|
846
846
|
const L = new Set(H);
|
|
847
847
|
return L.delete(R), L;
|
|
848
848
|
});
|
|
@@ -856,16 +856,16 @@ const To = [" ", "Enter", "ArrowUp", "ArrowDown"], Vo = [" ", "Enter"], Ce = "Se
|
|
|
856
856
|
$e.displayName = Ce;
|
|
857
857
|
const Dt = "SelectTrigger", Ue = s.forwardRef(
|
|
858
858
|
(o, i) => {
|
|
859
|
-
const { __scopeSelect: e, ...t } = o, n = Ve(e), r = X(Dt, e), c = r.disabled, l = A(i, r.onTriggerChange), a = ve(e), [
|
|
860
|
-
const f = a().filter((
|
|
859
|
+
const { __scopeSelect: e, ...t } = o, n = Ve(e), r = X(Dt, e), c = r.disabled, l = A(i, r.onTriggerChange), a = ve(e), [h, C, v] = Wt((u) => {
|
|
860
|
+
const f = a().filter((g) => !g.disabled), m = f.find((g) => g.value === r.value), b = Kt(f, u, m);
|
|
861
861
|
if (b !== void 0 && !Array.isArray(b.value)) {
|
|
862
|
-
const
|
|
863
|
-
r.onValueChange(
|
|
862
|
+
const g = r.multi ? [b.value] : b.value;
|
|
863
|
+
r.onValueChange(g);
|
|
864
864
|
}
|
|
865
|
-
}),
|
|
865
|
+
}), x = () => {
|
|
866
866
|
c || (r.onOpenChange(!0), v());
|
|
867
867
|
};
|
|
868
|
-
return /* @__PURE__ */
|
|
868
|
+
return /* @__PURE__ */ p(ie.Anchor, { asChild: !0, ...n, children: /* @__PURE__ */ p(
|
|
869
869
|
N.div,
|
|
870
870
|
{
|
|
871
871
|
role: "combobox",
|
|
@@ -880,19 +880,19 @@ const Dt = "SelectTrigger", Ue = s.forwardRef(
|
|
|
880
880
|
tabIndex: c ? void 0 : 0,
|
|
881
881
|
...t,
|
|
882
882
|
ref: l,
|
|
883
|
-
onClick:
|
|
883
|
+
onClick: E(t.onClick, (u) => {
|
|
884
884
|
u.currentTarget.focus();
|
|
885
885
|
}),
|
|
886
|
-
onPointerDown:
|
|
886
|
+
onPointerDown: E(t.onPointerDown, (u) => {
|
|
887
887
|
const f = u.target;
|
|
888
|
-
f.hasPointerCapture(u.pointerId) && f.releasePointerCapture(u.pointerId), (f.closest("button") ?? f.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (
|
|
888
|
+
f.hasPointerCapture(u.pointerId) && f.releasePointerCapture(u.pointerId), (f.closest("button") ?? f.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (x(), r.triggerPointerDownPosRef.current = {
|
|
889
889
|
x: Math.round(u.pageX),
|
|
890
890
|
y: Math.round(u.pageY)
|
|
891
891
|
}, u.preventDefault());
|
|
892
892
|
}),
|
|
893
|
-
onKeyDown:
|
|
894
|
-
const f =
|
|
895
|
-
(b.closest("button") ?? b.closest("div")) === u.currentTarget && (!
|
|
893
|
+
onKeyDown: E(t.onKeyDown, (u) => {
|
|
894
|
+
const f = h.current !== "", m = u.ctrlKey || u.altKey || u.metaKey, b = u.target;
|
|
895
|
+
(b.closest("button") ?? b.closest("div")) === u.currentTarget && (!m && u.key.length === 1 && C(u.key), !(f && u.key === " ") && To.includes(u.key) && (x(), u.preventDefault()));
|
|
896
896
|
})
|
|
897
897
|
}
|
|
898
898
|
) });
|
|
@@ -901,52 +901,55 @@ const Dt = "SelectTrigger", Ue = s.forwardRef(
|
|
|
901
901
|
Ue.displayName = Dt;
|
|
902
902
|
const kt = "SelectValue", He = s.forwardRef(
|
|
903
903
|
(o, i) => {
|
|
904
|
-
const { __scopeSelect: e, children: t, placeholder: n, ...r } = o, c = X(kt, e), { onValueNodeHasChildrenChange: l } = c, a = t !== void 0,
|
|
904
|
+
const { __scopeSelect: e, children: t, placeholder: n, ...r } = o, c = X(kt, e), { onValueNodeHasChildrenChange: l } = c, a = t !== void 0, h = A(i, c.onValueNodeChange), [C, v] = s.useState([]), x = ve(e);
|
|
905
905
|
$(() => {
|
|
906
906
|
l(a);
|
|
907
907
|
}, [l, a]), s.useLayoutEffect(() => {
|
|
908
|
-
if (Array.isArray(c.value)
|
|
909
|
-
const f =
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
908
|
+
if (Array.isArray(c.value)) {
|
|
909
|
+
const f = new Set(C.map((g) => g.value)), m = new Set(c.value);
|
|
910
|
+
if (!(f.size === m.size && Array.from(m).every((g) => f.has(g)))) {
|
|
911
|
+
const g = setTimeout(() => {
|
|
912
|
+
const d = x().filter(
|
|
913
|
+
(y) => {
|
|
914
|
+
var V;
|
|
915
|
+
return Array.isArray(y.value) ? !1 : (V = c.value) == null ? void 0 : V.includes(y.value);
|
|
916
|
+
}
|
|
917
|
+
);
|
|
918
|
+
v(d);
|
|
919
|
+
});
|
|
920
|
+
return () => {
|
|
921
|
+
clearTimeout(g);
|
|
922
|
+
};
|
|
923
|
+
}
|
|
921
924
|
}
|
|
922
|
-
}, [c.value,
|
|
925
|
+
}, [c.value, x, C]);
|
|
923
926
|
let u;
|
|
924
927
|
if ((c.value === void 0 || c.value.length === 0) && n !== void 0)
|
|
925
|
-
u = /* @__PURE__ */
|
|
928
|
+
u = /* @__PURE__ */ p("span", { children: n });
|
|
926
929
|
else if (typeof t == "function")
|
|
927
930
|
if (Array.isArray(c.value)) {
|
|
928
|
-
const f = c.value.map((
|
|
929
|
-
const b = C.find((
|
|
930
|
-
return b ? t({ value:
|
|
931
|
+
const f = c.value.map((m) => {
|
|
932
|
+
const b = C.find((g) => g.value === m);
|
|
933
|
+
return b ? t({ value: m, textValue: b == null ? void 0 : b.textValue }) : null;
|
|
931
934
|
});
|
|
932
|
-
u = f.every((
|
|
935
|
+
u = f.every((m) => m === null) ? n : f;
|
|
933
936
|
} else
|
|
934
937
|
u = t(c.value);
|
|
935
938
|
else
|
|
936
939
|
u = t;
|
|
937
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ p(N.span, { ...r, ref: h, children: u || null });
|
|
938
941
|
}
|
|
939
942
|
);
|
|
940
943
|
He.displayName = kt;
|
|
941
|
-
const _o = "SelectIcon",
|
|
944
|
+
const _o = "SelectIcon", ze = s.forwardRef(
|
|
942
945
|
(o, i) => {
|
|
943
946
|
const { __scopeSelect: e, children: t, ...n } = o;
|
|
944
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ p(N.span, { "aria-hidden": !0, ...n, ref: i, children: t || "▼" });
|
|
945
948
|
}
|
|
946
949
|
);
|
|
947
|
-
|
|
948
|
-
const Mo = "SelectPortal",
|
|
949
|
-
|
|
950
|
+
ze.displayName = _o;
|
|
951
|
+
const Mo = "SelectPortal", We = (o) => /* @__PURE__ */ p(pt, { asChild: !0, ...o });
|
|
952
|
+
We.displayName = Mo;
|
|
950
953
|
const le = "SelectContent", Ke = s.forwardRef(
|
|
951
954
|
(o, i) => {
|
|
952
955
|
const e = X(le, o.__scopeSelect), [t, n] = s.useState();
|
|
@@ -955,11 +958,11 @@ const le = "SelectContent", Ke = s.forwardRef(
|
|
|
955
958
|
}, []), !e.open) {
|
|
956
959
|
const r = t;
|
|
957
960
|
return r ? we.createPortal(
|
|
958
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ p(Ft, { scope: o.__scopeSelect, children: /* @__PURE__ */ p(Te.Slot, { scope: o.__scopeSelect, children: /* @__PURE__ */ p("div", { children: o.children }) }) }),
|
|
959
962
|
r
|
|
960
963
|
) : null;
|
|
961
964
|
}
|
|
962
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ p(Lt, { ...o, ref: i });
|
|
963
966
|
}
|
|
964
967
|
);
|
|
965
968
|
Ke.displayName = le;
|
|
@@ -975,25 +978,25 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
975
978
|
// PopperContent props
|
|
976
979
|
side: l,
|
|
977
980
|
sideOffset: a,
|
|
978
|
-
align:
|
|
981
|
+
align: h,
|
|
979
982
|
alignOffset: C,
|
|
980
983
|
arrowPadding: v,
|
|
981
|
-
collisionBoundary:
|
|
984
|
+
collisionBoundary: x,
|
|
982
985
|
collisionPadding: u,
|
|
983
986
|
sticky: f,
|
|
984
|
-
hideWhenDetached:
|
|
987
|
+
hideWhenDetached: m,
|
|
985
988
|
avoidCollisions: b,
|
|
986
989
|
//
|
|
987
|
-
...
|
|
988
|
-
} = o,
|
|
990
|
+
...g
|
|
991
|
+
} = o, d = X(le, e), [y, V] = s.useState(null), [O, F] = s.useState(null), _ = A(i, (S) => V(S)), [k, Z] = s.useState(null), [U, W] = s.useState(null), R = ve(e), [H, L] = s.useState(!1), z = s.useRef(!1);
|
|
989
992
|
s.useEffect(() => {
|
|
990
993
|
if (y) return ft(y);
|
|
991
994
|
}, [y]), at();
|
|
992
995
|
const J = s.useCallback(
|
|
993
996
|
(S) => {
|
|
994
|
-
const [I, ...M] = R().map((w) => w.ref.current), [
|
|
997
|
+
const [I, ...M] = R().map((w) => w.ref.current), [P] = M.slice(-1), T = document.activeElement;
|
|
995
998
|
for (const w of S)
|
|
996
|
-
if (w === T || (w == null || w.scrollIntoView({ block: "nearest" }), w === I && O && (O.scrollTop = 0), w ===
|
|
999
|
+
if (w === T || (w == null || w.scrollIntoView({ block: "nearest" }), w === I && O && (O.scrollTop = 0), w === P && O && (O.scrollTop = O.scrollHeight), w == null || w.focus(), document.activeElement !== T)) return;
|
|
997
1000
|
},
|
|
998
1001
|
[R, O]
|
|
999
1002
|
), Q = s.useCallback(
|
|
@@ -1003,18 +1006,18 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1003
1006
|
s.useEffect(() => {
|
|
1004
1007
|
H && Q();
|
|
1005
1008
|
}, [H, Q]);
|
|
1006
|
-
const { onOpenChange: K, triggerPointerDownPosRef: G } =
|
|
1009
|
+
const { onOpenChange: K, triggerPointerDownPosRef: G } = d;
|
|
1007
1010
|
s.useEffect(() => {
|
|
1008
1011
|
if (y) {
|
|
1009
1012
|
let S = { x: 0, y: 0 };
|
|
1010
|
-
const I = (
|
|
1013
|
+
const I = (P) => {
|
|
1011
1014
|
var T, w;
|
|
1012
1015
|
S = {
|
|
1013
|
-
x: Math.abs(Math.round(
|
|
1014
|
-
y: Math.abs(Math.round(
|
|
1016
|
+
x: Math.abs(Math.round(P.pageX) - (((T = G.current) == null ? void 0 : T.x) ?? 0)),
|
|
1017
|
+
y: Math.abs(Math.round(P.pageY) - (((w = G.current) == null ? void 0 : w.y) ?? 0))
|
|
1015
1018
|
};
|
|
1016
|
-
}, M = (
|
|
1017
|
-
S.x <= 10 && S.y <= 10 ?
|
|
1019
|
+
}, M = (P) => {
|
|
1020
|
+
S.x <= 10 && S.y <= 10 ? P.preventDefault() : y.contains(P.target) || K(!1), document.removeEventListener("pointermove", I), G.current = null;
|
|
1018
1021
|
};
|
|
1019
1022
|
return G.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", M, { capture: !0, once: !0 })), () => {
|
|
1020
1023
|
document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", M, { capture: !0 });
|
|
@@ -1026,37 +1029,37 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1026
1029
|
window.removeEventListener("blur", S), window.removeEventListener("resize", S);
|
|
1027
1030
|
};
|
|
1028
1031
|
}, [K]);
|
|
1029
|
-
const [ce, ee] =
|
|
1030
|
-
const I = R().filter((T) => !T.disabled), M = I.find((T) => T.ref.current === document.activeElement),
|
|
1031
|
-
|
|
1032
|
+
const [ce, ee] = Wt((S) => {
|
|
1033
|
+
const I = R().filter((T) => !T.disabled), M = I.find((T) => T.ref.current === document.activeElement), P = Kt(I, S, M);
|
|
1034
|
+
P && setTimeout(() => P.ref.current.focus());
|
|
1032
1035
|
}), fe = s.useCallback(
|
|
1033
1036
|
(S, I, M) => {
|
|
1034
|
-
const
|
|
1035
|
-
(
|
|
1037
|
+
const P = !z.current && !M;
|
|
1038
|
+
(d.value !== void 0 && d.value === I || P) && (Z(S), P && (z.current = !0));
|
|
1036
1039
|
},
|
|
1037
|
-
[
|
|
1040
|
+
[d.value]
|
|
1038
1041
|
), me = s.useCallback(() => y == null ? void 0 : y.focus(), [y]), te = s.useCallback(
|
|
1039
1042
|
(S, I, M) => {
|
|
1040
|
-
const
|
|
1041
|
-
(
|
|
1043
|
+
const P = !z.current && !M;
|
|
1044
|
+
(d.value !== void 0 && (Array.isArray(I) ? I.every((w) => {
|
|
1042
1045
|
var B;
|
|
1043
|
-
return (B =
|
|
1044
|
-
}) :
|
|
1046
|
+
return (B = d.value) == null ? void 0 : B.includes(w);
|
|
1047
|
+
}) : d.value === I) || P) && W(S);
|
|
1045
1048
|
},
|
|
1046
|
-
[
|
|
1049
|
+
[d.value]
|
|
1047
1050
|
), ae = t === "popper" ? Re : Bt, ne = ae === Re ? {
|
|
1048
1051
|
side: l,
|
|
1049
1052
|
sideOffset: a,
|
|
1050
|
-
align:
|
|
1053
|
+
align: h,
|
|
1051
1054
|
alignOffset: C,
|
|
1052
1055
|
arrowPadding: v,
|
|
1053
|
-
collisionBoundary:
|
|
1056
|
+
collisionBoundary: x,
|
|
1054
1057
|
collisionPadding: u,
|
|
1055
1058
|
sticky: f,
|
|
1056
|
-
hideWhenDetached:
|
|
1059
|
+
hideWhenDetached: m,
|
|
1057
1060
|
avoidCollisions: b
|
|
1058
1061
|
} : {};
|
|
1059
|
-
return /* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ p(
|
|
1060
1063
|
Ft,
|
|
1061
1064
|
{
|
|
1062
1065
|
scope: e,
|
|
@@ -1072,19 +1075,19 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1072
1075
|
position: t,
|
|
1073
1076
|
isPositioned: H,
|
|
1074
1077
|
searchRef: ce,
|
|
1075
|
-
children: /* @__PURE__ */
|
|
1078
|
+
children: /* @__PURE__ */ p(mt, { as: Ee, allowPinchZoom: !0, children: /* @__PURE__ */ p(
|
|
1076
1079
|
ut,
|
|
1077
1080
|
{
|
|
1078
1081
|
asChild: !0,
|
|
1079
|
-
trapped:
|
|
1082
|
+
trapped: d.open,
|
|
1080
1083
|
onMountAutoFocus: (S) => {
|
|
1081
1084
|
S.preventDefault();
|
|
1082
1085
|
},
|
|
1083
|
-
onUnmountAutoFocus:
|
|
1086
|
+
onUnmountAutoFocus: E(n, (S) => {
|
|
1084
1087
|
var I, M;
|
|
1085
|
-
(I =
|
|
1088
|
+
(I = d.trigger) == null || I.focus({ preventScroll: !0 }), (M = document.getSelection()) == null || M.empty(), S.preventDefault();
|
|
1086
1089
|
}),
|
|
1087
|
-
children: /* @__PURE__ */
|
|
1090
|
+
children: /* @__PURE__ */ p(
|
|
1088
1091
|
ct,
|
|
1089
1092
|
{
|
|
1090
1093
|
asChild: !0,
|
|
@@ -1092,17 +1095,17 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1092
1095
|
onEscapeKeyDown: r,
|
|
1093
1096
|
onPointerDownOutside: c,
|
|
1094
1097
|
onFocusOutside: (S) => S.preventDefault(),
|
|
1095
|
-
onDismiss: () =>
|
|
1096
|
-
children: /* @__PURE__ */
|
|
1098
|
+
onDismiss: () => d.onOpenChange(!1),
|
|
1099
|
+
children: /* @__PURE__ */ p(
|
|
1097
1100
|
ae,
|
|
1098
1101
|
{
|
|
1099
1102
|
role: "listbox",
|
|
1100
|
-
id:
|
|
1101
|
-
"data-state":
|
|
1102
|
-
"aria-multiselectable":
|
|
1103
|
-
dir:
|
|
1103
|
+
id: d.contentId,
|
|
1104
|
+
"data-state": d.open ? "open" : "closed",
|
|
1105
|
+
"aria-multiselectable": d.multi ? "true" : void 0,
|
|
1106
|
+
dir: d.dir,
|
|
1104
1107
|
onContextMenu: (S) => S.preventDefault(),
|
|
1105
|
-
...
|
|
1108
|
+
...g,
|
|
1106
1109
|
...ne,
|
|
1107
1110
|
onPlaced: () => L(!0),
|
|
1108
1111
|
ref: _,
|
|
@@ -1112,17 +1115,17 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1112
1115
|
flexDirection: "column",
|
|
1113
1116
|
// reset the outline by default as the content MAY get focused
|
|
1114
1117
|
outline: "none",
|
|
1115
|
-
...
|
|
1118
|
+
...g.style
|
|
1116
1119
|
},
|
|
1117
|
-
onKeyDown:
|
|
1120
|
+
onKeyDown: E(g.onKeyDown, (S) => {
|
|
1118
1121
|
const I = S.ctrlKey || S.altKey || S.metaKey;
|
|
1119
1122
|
if (S.key === "Tab" && S.preventDefault(), !I && S.key.length === 1 && ee(S.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(S.key)) {
|
|
1120
|
-
let
|
|
1121
|
-
if (["ArrowUp", "End"].includes(S.key) && (
|
|
1122
|
-
const T = S.target, w =
|
|
1123
|
-
|
|
1123
|
+
let P = R().filter((T) => !T.disabled).map((T) => T.ref.current);
|
|
1124
|
+
if (["ArrowUp", "End"].includes(S.key) && (P = P.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
|
|
1125
|
+
const T = S.target, w = P.indexOf(T);
|
|
1126
|
+
P = P.slice(w + 1);
|
|
1124
1127
|
}
|
|
1125
|
-
setTimeout(() => J(
|
|
1128
|
+
setTimeout(() => J(P)), S.preventDefault();
|
|
1126
1129
|
}
|
|
1127
1130
|
})
|
|
1128
1131
|
}
|
|
@@ -1138,9 +1141,9 @@ const q = 10, [Ft, oe] = pe(le), Oo = "SelectContentImpl", Lt = s.forwardRef(
|
|
|
1138
1141
|
Lt.displayName = Oo;
|
|
1139
1142
|
const Do = "SelectItemAlignedPosition", Bt = s.forwardRef(
|
|
1140
1143
|
(o, i) => {
|
|
1141
|
-
const { __scopeSelect: e, onPlaced: t, ...n } = o, r = X(le, e), c = oe(le, e), [l, a] = s.useState(null), [
|
|
1142
|
-
if (r.trigger && r.valueNode && l &&
|
|
1143
|
-
const _ = r.trigger.getBoundingClientRect(), k =
|
|
1144
|
+
const { __scopeSelect: e, onPlaced: t, ...n } = o, r = X(le, e), c = oe(le, e), [l, a] = s.useState(null), [h, C] = s.useState(null), v = A(i, (_) => C(_)), x = ve(e), u = s.useRef(!1), f = s.useRef(!0), { viewport: m, selectedItem: b, selectedItemText: g, focusSelectedItem: d } = c, y = s.useCallback(() => {
|
|
1145
|
+
if (r.trigger && r.valueNode && l && h && m && b && g) {
|
|
1146
|
+
const _ = r.trigger.getBoundingClientRect(), k = h.getBoundingClientRect(), Z = r.valueNode.getBoundingClientRect(), U = g.getBoundingClientRect();
|
|
1144
1147
|
if (r.dir !== "rtl") {
|
|
1145
1148
|
const T = U.left - k.left, w = Z.left - T, B = _.left - w, j = _.width + B, D = Math.max(j, k.width), ue = window.innerWidth - q, he = rt(w, [q, ue - D]);
|
|
1146
1149
|
l.style.minWidth = `${j}px`, l.style.left = `${he}px`;
|
|
@@ -1148,59 +1151,59 @@ const Do = "SelectItemAlignedPosition", Bt = s.forwardRef(
|
|
|
1148
1151
|
const T = k.right - U.right, w = window.innerWidth - Z.right - T, B = window.innerWidth - _.right - w, j = _.width + B, D = Math.max(j, k.width), ue = window.innerWidth - q, he = rt(w, [q, ue - D]);
|
|
1149
1152
|
l.style.minWidth = `${j}px`, l.style.right = `${he}px`;
|
|
1150
1153
|
}
|
|
1151
|
-
const
|
|
1154
|
+
const W = x(), R = window.innerHeight - q * 2, H = m.scrollHeight, L = window.getComputedStyle(h), z = parseInt(L.borderTopWidth, 10), J = parseInt(L.paddingTop, 10), Q = parseInt(L.borderBottomWidth, 10), K = parseInt(L.paddingBottom, 10), G = z + J + H + K + Q, ce = Math.min(b.offsetHeight * 5, G), ee = window.getComputedStyle(m), fe = parseInt(ee.paddingTop, 10), me = parseInt(ee.paddingBottom, 10), te = _.top + _.height / 2 - q, ae = R - te, ne = b.offsetHeight / 2, S = b.offsetTop + ne, I = z + J + S, M = G - I;
|
|
1152
1155
|
if (I <= te) {
|
|
1153
|
-
const T = b ===
|
|
1156
|
+
const T = b === W[W.length - 1].ref.current;
|
|
1154
1157
|
l.style.bottom = "0px";
|
|
1155
|
-
const w =
|
|
1158
|
+
const w = h.clientHeight - m.offsetTop - m.offsetHeight, B = Math.max(
|
|
1156
1159
|
ae,
|
|
1157
1160
|
ne + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
1158
1161
|
(T ? me : 0) + w + Q
|
|
1159
1162
|
), j = I + B;
|
|
1160
1163
|
l.style.height = `${j}px`;
|
|
1161
1164
|
} else {
|
|
1162
|
-
const T = b ===
|
|
1165
|
+
const T = b === W[0].ref.current;
|
|
1163
1166
|
l.style.top = "0px";
|
|
1164
1167
|
const B = Math.max(
|
|
1165
1168
|
te,
|
|
1166
|
-
|
|
1169
|
+
z + m.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
1167
1170
|
(T ? fe : 0) + ne
|
|
1168
1171
|
) + M;
|
|
1169
|
-
l.style.height = `${B}px`,
|
|
1172
|
+
l.style.height = `${B}px`, m.scrollTop = I - te + m.offsetTop;
|
|
1170
1173
|
}
|
|
1171
1174
|
l.style.margin = `${q}px 0`, l.style.minHeight = `${ce}px`, l.style.maxHeight = `${R}px`, t == null || t(), requestAnimationFrame(() => u.current = !0);
|
|
1172
1175
|
}
|
|
1173
1176
|
}, [
|
|
1174
|
-
|
|
1177
|
+
x,
|
|
1175
1178
|
r.trigger,
|
|
1176
1179
|
r.valueNode,
|
|
1177
1180
|
l,
|
|
1178
|
-
m,
|
|
1179
1181
|
h,
|
|
1182
|
+
m,
|
|
1180
1183
|
b,
|
|
1181
|
-
|
|
1184
|
+
g,
|
|
1182
1185
|
r.dir,
|
|
1183
1186
|
t
|
|
1184
1187
|
]);
|
|
1185
1188
|
$(() => y(), [y]);
|
|
1186
|
-
const [
|
|
1189
|
+
const [V, O] = s.useState();
|
|
1187
1190
|
$(() => {
|
|
1188
|
-
|
|
1189
|
-
}, [
|
|
1191
|
+
h && O(window.getComputedStyle(h).zIndex);
|
|
1192
|
+
}, [h]);
|
|
1190
1193
|
const F = s.useCallback(
|
|
1191
1194
|
(_) => {
|
|
1192
|
-
_ && f.current === !0 && (y(),
|
|
1195
|
+
_ && f.current === !0 && (y(), d == null || d(), f.current = !1);
|
|
1193
1196
|
},
|
|
1194
|
-
[y,
|
|
1197
|
+
[y, d]
|
|
1195
1198
|
);
|
|
1196
|
-
return /* @__PURE__ */
|
|
1199
|
+
return /* @__PURE__ */ p(
|
|
1197
1200
|
Fo,
|
|
1198
1201
|
{
|
|
1199
1202
|
scope: e,
|
|
1200
1203
|
contentWrapper: l,
|
|
1201
1204
|
shouldExpandOnScrollRef: u,
|
|
1202
1205
|
onScrollButtonChange: F,
|
|
1203
|
-
children: /* @__PURE__ */
|
|
1206
|
+
children: /* @__PURE__ */ p(
|
|
1204
1207
|
"div",
|
|
1205
1208
|
{
|
|
1206
1209
|
ref: a,
|
|
@@ -1208,9 +1211,9 @@ const Do = "SelectItemAlignedPosition", Bt = s.forwardRef(
|
|
|
1208
1211
|
display: "flex",
|
|
1209
1212
|
flexDirection: "column",
|
|
1210
1213
|
position: "fixed",
|
|
1211
|
-
zIndex:
|
|
1214
|
+
zIndex: V
|
|
1212
1215
|
},
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1216
|
+
children: /* @__PURE__ */ p(
|
|
1214
1217
|
N.div,
|
|
1215
1218
|
{
|
|
1216
1219
|
...n,
|
|
@@ -1235,7 +1238,7 @@ Bt.displayName = Do;
|
|
|
1235
1238
|
const ko = "SelectPopperPosition", Re = s.forwardRef(
|
|
1236
1239
|
(o, i) => {
|
|
1237
1240
|
const { __scopeSelect: e, align: t = "start", collisionPadding: n = q, ...r } = o, c = Ve(e);
|
|
1238
|
-
return /* @__PURE__ */
|
|
1241
|
+
return /* @__PURE__ */ p(
|
|
1239
1242
|
ie.Content,
|
|
1240
1243
|
{
|
|
1241
1244
|
...c,
|
|
@@ -1265,7 +1268,7 @@ const [Fo, Ge] = pe(
|
|
|
1265
1268
|
(o, i) => {
|
|
1266
1269
|
const { __scopeSelect: e, ...t } = o, n = oe(Ae, e), r = Ge(Ae, e), c = A(i, n.onViewportChange), l = s.useRef(0);
|
|
1267
1270
|
return /* @__PURE__ */ ye(Se, { children: [
|
|
1268
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ p(
|
|
1269
1272
|
"style",
|
|
1270
1273
|
{
|
|
1271
1274
|
dangerouslySetInnerHTML: {
|
|
@@ -1273,7 +1276,7 @@ const [Fo, Ge] = pe(
|
|
|
1273
1276
|
}
|
|
1274
1277
|
}
|
|
1275
1278
|
),
|
|
1276
|
-
/* @__PURE__ */
|
|
1279
|
+
/* @__PURE__ */ p(Te.Slot, { scope: e, children: /* @__PURE__ */ p(
|
|
1277
1280
|
N.div,
|
|
1278
1281
|
{
|
|
1279
1282
|
"data-radix-select-viewport": "",
|
|
@@ -1289,19 +1292,19 @@ const [Fo, Ge] = pe(
|
|
|
1289
1292
|
overflow: "auto",
|
|
1290
1293
|
...t.style
|
|
1291
1294
|
},
|
|
1292
|
-
onScroll:
|
|
1293
|
-
const
|
|
1295
|
+
onScroll: E(t.onScroll, (a) => {
|
|
1296
|
+
const h = a.currentTarget, { contentWrapper: C, shouldExpandOnScrollRef: v } = r;
|
|
1294
1297
|
if (v != null && v.current && C) {
|
|
1295
|
-
const
|
|
1296
|
-
if (
|
|
1297
|
-
const u = window.innerHeight - q * 2, f = parseFloat(C.style.minHeight),
|
|
1298
|
+
const x = Math.abs(l.current - h.scrollTop);
|
|
1299
|
+
if (x > 0) {
|
|
1300
|
+
const u = window.innerHeight - q * 2, f = parseFloat(C.style.minHeight), m = parseFloat(C.style.height), b = Math.max(f, m);
|
|
1298
1301
|
if (b < u) {
|
|
1299
|
-
const
|
|
1300
|
-
C.style.height = `${
|
|
1302
|
+
const g = b + x, d = Math.min(u, g), y = g - d;
|
|
1303
|
+
C.style.height = `${d}px`, C.style.bottom === "0px" && (h.scrollTop = y > 0 ? y : 0, C.style.justifyContent = "flex-end");
|
|
1301
1304
|
}
|
|
1302
1305
|
}
|
|
1303
1306
|
}
|
|
1304
|
-
l.current =
|
|
1307
|
+
l.current = h.scrollTop;
|
|
1305
1308
|
})
|
|
1306
1309
|
}
|
|
1307
1310
|
) })
|
|
@@ -1312,79 +1315,79 @@ je.displayName = Ae;
|
|
|
1312
1315
|
const $t = "SelectGroup", [Lo, Bo] = pe($t), Ye = s.forwardRef(
|
|
1313
1316
|
(o, i) => {
|
|
1314
1317
|
const { __scopeSelect: e, ...t } = o, n = se();
|
|
1315
|
-
return /* @__PURE__ */
|
|
1318
|
+
return /* @__PURE__ */ p(Lo, { scope: e, id: n, children: /* @__PURE__ */ p(N.div, { role: "group", "aria-labelledby": n, ...t, ref: i }) });
|
|
1316
1319
|
}
|
|
1317
1320
|
);
|
|
1318
1321
|
Ye.displayName = $t;
|
|
1319
1322
|
const Ut = "SelectLabel", qe = s.forwardRef(
|
|
1320
1323
|
(o, i) => {
|
|
1321
1324
|
const { __scopeSelect: e, ...t } = o, n = Bo(Ut, e);
|
|
1322
|
-
return /* @__PURE__ */
|
|
1325
|
+
return /* @__PURE__ */ p(N.div, { id: n.id, ...t, ref: i });
|
|
1323
1326
|
}
|
|
1324
1327
|
);
|
|
1325
1328
|
qe.displayName = Ut;
|
|
1326
1329
|
const be = "SelectItem", [$o, Ht] = pe(be), Xe = s.forwardRef(
|
|
1327
1330
|
(o, i) => {
|
|
1328
|
-
const { __scopeSelect: e, value: t, disabled: n = !1, textValue: r, ...c } = o, l = X(be, e), a = oe(be, e),
|
|
1331
|
+
const { __scopeSelect: e, value: t, disabled: n = !1, textValue: r, ...c } = o, l = X(be, e), a = oe(be, e), h = typeof t == "string" ? Array.isArray(l.value) ? l.value.includes(t) : l.value === t : t.every((d) => {
|
|
1329
1332
|
var y;
|
|
1330
|
-
return (y = l.value) == null ? void 0 : y.includes(
|
|
1331
|
-
}), C = Array.isArray(l.value) && Array.isArray(t) && t.some((
|
|
1333
|
+
return (y = l.value) == null ? void 0 : y.includes(d);
|
|
1334
|
+
}), C = Array.isArray(l.value) && Array.isArray(t) && t.some((d) => {
|
|
1332
1335
|
var y;
|
|
1333
|
-
return (y = l.value) == null ? void 0 : y.includes(
|
|
1334
|
-
}), [v,
|
|
1336
|
+
return (y = l.value) == null ? void 0 : y.includes(d);
|
|
1337
|
+
}), [v, x] = s.useState(r ?? ""), [u, f] = s.useState(!1), m = A(
|
|
1335
1338
|
i,
|
|
1336
|
-
(
|
|
1339
|
+
(d) => {
|
|
1337
1340
|
var y;
|
|
1338
|
-
return (y = a.itemRefCallback) == null ? void 0 : y.call(a,
|
|
1341
|
+
return (y = a.itemRefCallback) == null ? void 0 : y.call(a, d, t, n);
|
|
1339
1342
|
}
|
|
1340
|
-
), b = se(),
|
|
1343
|
+
), b = se(), g = () => {
|
|
1341
1344
|
if (!n) {
|
|
1342
|
-
let
|
|
1343
|
-
C && !
|
|
1345
|
+
let d = l.multi && typeof t == "string" ? [t] : t;
|
|
1346
|
+
C && !h ? l.onValueChange(d) : Array.isArray(l.value) && (d = Gt(t, l.value)), l.onValueChange(d), l.multi || l.onOpenChange(!1);
|
|
1344
1347
|
}
|
|
1345
1348
|
};
|
|
1346
1349
|
if (!l.multi && Array.isArray(t))
|
|
1347
1350
|
throw new Error("You can only pass an array of values in multi selects");
|
|
1348
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ p(
|
|
1349
1352
|
$o,
|
|
1350
1353
|
{
|
|
1351
1354
|
scope: e,
|
|
1352
1355
|
value: t,
|
|
1353
1356
|
disabled: n,
|
|
1354
1357
|
textId: b,
|
|
1355
|
-
isSelected:
|
|
1358
|
+
isSelected: h,
|
|
1356
1359
|
isIntermediate: C,
|
|
1357
|
-
onItemTextChange: s.useCallback((
|
|
1358
|
-
|
|
1360
|
+
onItemTextChange: s.useCallback((d) => {
|
|
1361
|
+
x((y) => y || ((d == null ? void 0 : d.textContent) ?? "").trim());
|
|
1359
1362
|
}, []),
|
|
1360
|
-
children: /* @__PURE__ */
|
|
1363
|
+
children: /* @__PURE__ */ p(Te.ItemSlot, { scope: e, value: t, disabled: n, textValue: v, children: /* @__PURE__ */ p(
|
|
1361
1364
|
N.div,
|
|
1362
1365
|
{
|
|
1363
1366
|
role: "option",
|
|
1364
1367
|
"aria-labelledby": b,
|
|
1365
1368
|
"data-highlighted": u ? "" : void 0,
|
|
1366
|
-
"aria-selected": l.multi ? void 0 :
|
|
1367
|
-
"aria-checked": l.multi ?
|
|
1368
|
-
"data-state":
|
|
1369
|
+
"aria-selected": l.multi ? void 0 : h && u,
|
|
1370
|
+
"aria-checked": l.multi ? h : void 0,
|
|
1371
|
+
"data-state": h ? "checked" : "unchecked",
|
|
1369
1372
|
"aria-disabled": n || void 0,
|
|
1370
1373
|
"data-disabled": n ? "" : void 0,
|
|
1371
1374
|
tabIndex: n ? void 0 : -1,
|
|
1372
1375
|
...c,
|
|
1373
|
-
ref:
|
|
1374
|
-
onFocus:
|
|
1375
|
-
onBlur:
|
|
1376
|
-
onPointerUp:
|
|
1377
|
-
onPointerMove:
|
|
1376
|
+
ref: m,
|
|
1377
|
+
onFocus: E(c.onFocus, () => f(!0)),
|
|
1378
|
+
onBlur: E(c.onBlur, () => f(!1)),
|
|
1379
|
+
onPointerUp: E(c.onPointerUp, g),
|
|
1380
|
+
onPointerMove: E(c.onPointerMove, (d) => {
|
|
1378
1381
|
var y;
|
|
1379
|
-
n ? (y = a.onItemLeave) == null || y.call(a) :
|
|
1382
|
+
n ? (y = a.onItemLeave) == null || y.call(a) : d.currentTarget.focus({ preventScroll: !0 });
|
|
1380
1383
|
}),
|
|
1381
|
-
onPointerLeave:
|
|
1384
|
+
onPointerLeave: E(c.onPointerLeave, (d) => {
|
|
1382
1385
|
var y;
|
|
1383
|
-
|
|
1386
|
+
d.currentTarget === document.activeElement && ((y = a.onItemLeave) == null || y.call(a));
|
|
1384
1387
|
}),
|
|
1385
|
-
onKeyDown:
|
|
1386
|
-
var
|
|
1387
|
-
((
|
|
1388
|
+
onKeyDown: E(c.onKeyDown, (d) => {
|
|
1389
|
+
var V;
|
|
1390
|
+
((V = a.searchRef) == null ? void 0 : V.current) !== "" && d.key === " " || (Vo.includes(d.key) && g(), d.key === " " && d.preventDefault());
|
|
1388
1391
|
})
|
|
1389
1392
|
}
|
|
1390
1393
|
) })
|
|
@@ -1395,16 +1398,16 @@ const be = "SelectItem", [$o, Ht] = pe(be), Xe = s.forwardRef(
|
|
|
1395
1398
|
Xe.displayName = be;
|
|
1396
1399
|
const ge = "SelectItemText", Ze = s.forwardRef(
|
|
1397
1400
|
(o, i) => {
|
|
1398
|
-
const { __scopeSelect: e, className: t, style: n, ...r } = o, c = X(ge, e), l = oe(ge, e), a = Ht(ge, e),
|
|
1401
|
+
const { __scopeSelect: e, className: t, style: n, ...r } = o, c = X(ge, e), l = oe(ge, e), a = Ht(ge, e), h = Ao(ge, e), [C, v] = s.useState(null), x = A(
|
|
1399
1402
|
i,
|
|
1400
|
-
(
|
|
1403
|
+
(g) => v(g),
|
|
1401
1404
|
a.onItemTextChange,
|
|
1402
|
-
(
|
|
1403
|
-
var
|
|
1404
|
-
return (
|
|
1405
|
+
(g) => {
|
|
1406
|
+
var d;
|
|
1407
|
+
return (d = l.itemTextRefCallback) == null ? void 0 : d.call(l, g, a.value, a.disabled);
|
|
1405
1408
|
}
|
|
1406
1409
|
), u = C == null ? void 0 : C.textContent, f = s.useMemo(
|
|
1407
|
-
() => /* @__PURE__ */
|
|
1410
|
+
() => /* @__PURE__ */ p(
|
|
1408
1411
|
"option",
|
|
1409
1412
|
{
|
|
1410
1413
|
value: a.value,
|
|
@@ -1414,36 +1417,36 @@ const ge = "SelectItemText", Ze = s.forwardRef(
|
|
|
1414
1417
|
Array.isArray(a.value) ? a.value.join(";") : a.value
|
|
1415
1418
|
),
|
|
1416
1419
|
[a.disabled, a.value, u]
|
|
1417
|
-
), { onNativeOptionAdd:
|
|
1418
|
-
return $(() => (
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
+
), { onNativeOptionAdd: m, onNativeOptionRemove: b } = h;
|
|
1421
|
+
return $(() => (m(f), () => b(f)), [m, b, f]), /* @__PURE__ */ ye(Se, { children: [
|
|
1422
|
+
/* @__PURE__ */ p(N.span, { id: a.textId, ...r, ref: x }),
|
|
1420
1423
|
a.isSelected && c.valueNode && !c.valueNodeHasChildren ? we.createPortal(r.children, c.valueNode) : null
|
|
1421
1424
|
] });
|
|
1422
1425
|
}
|
|
1423
1426
|
);
|
|
1424
1427
|
Ze.displayName = ge;
|
|
1425
|
-
const
|
|
1428
|
+
const zt = "SelectItemIndicator", Je = s.forwardRef(
|
|
1426
1429
|
(o, i) => {
|
|
1427
|
-
const { __scopeSelect: e, children: t, ...n } = o, r = Ht(
|
|
1428
|
-
return typeof t == "function" ? /* @__PURE__ */
|
|
1430
|
+
const { __scopeSelect: e, children: t, ...n } = o, r = Ht(zt, e);
|
|
1431
|
+
return typeof t == "function" ? /* @__PURE__ */ p(N.span, { "aria-hidden": !0, ...n, ref: i, children: t({
|
|
1429
1432
|
isSelected: r.isSelected,
|
|
1430
1433
|
isIntermediate: r.isIntermediate
|
|
1431
|
-
}) }) : r.isSelected ? /* @__PURE__ */
|
|
1434
|
+
}) }) : r.isSelected ? /* @__PURE__ */ p(N.span, { "aria-hidden": !0, ...n, ref: i, children: t }) : null;
|
|
1432
1435
|
}
|
|
1433
1436
|
);
|
|
1434
|
-
Je.displayName =
|
|
1437
|
+
Je.displayName = zt;
|
|
1435
1438
|
const _e = "SelectScrollUpButton", Qe = s.forwardRef(
|
|
1436
1439
|
(o, i) => {
|
|
1437
1440
|
const e = oe(_e, o.__scopeSelect), t = Ge(_e, o.__scopeSelect), [n, r] = s.useState(!1), c = A(i, t.onScrollButtonChange);
|
|
1438
1441
|
return $(() => {
|
|
1439
1442
|
if (e.viewport && e.isPositioned) {
|
|
1440
1443
|
const l = e.viewport, a = () => {
|
|
1441
|
-
const
|
|
1442
|
-
r(
|
|
1444
|
+
const h = l.scrollTop > 0;
|
|
1445
|
+
r(h);
|
|
1443
1446
|
};
|
|
1444
1447
|
return a(), l.addEventListener("scroll", a), () => l.removeEventListener("scroll", a);
|
|
1445
1448
|
}
|
|
1446
|
-
}, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */
|
|
1449
|
+
}, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */ p(
|
|
1447
1450
|
tt,
|
|
1448
1451
|
{
|
|
1449
1452
|
...o,
|
|
@@ -1463,12 +1466,12 @@ const Me = "SelectScrollDownButton", et = s.forwardRef(
|
|
|
1463
1466
|
return $(() => {
|
|
1464
1467
|
if (e.viewport && e.isPositioned) {
|
|
1465
1468
|
const l = e.viewport, a = () => {
|
|
1466
|
-
const
|
|
1469
|
+
const h = l.scrollHeight - l.clientHeight, C = Math.ceil(l.scrollTop) < h;
|
|
1467
1470
|
r(C);
|
|
1468
1471
|
};
|
|
1469
1472
|
return a(), l.addEventListener("scroll", a), () => l.removeEventListener("scroll", a);
|
|
1470
1473
|
}
|
|
1471
|
-
}, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */
|
|
1474
|
+
}, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */ p(
|
|
1472
1475
|
tt,
|
|
1473
1476
|
{
|
|
1474
1477
|
...o,
|
|
@@ -1489,20 +1492,20 @@ const tt = s.forwardRef(
|
|
|
1489
1492
|
}, []);
|
|
1490
1493
|
return s.useEffect(() => () => a(), [a]), $(() => {
|
|
1491
1494
|
var C;
|
|
1492
|
-
const
|
|
1493
|
-
(C =
|
|
1494
|
-
}, [l]), /* @__PURE__ */
|
|
1495
|
+
const h = l().find((v) => v.ref.current === document.activeElement);
|
|
1496
|
+
(C = h == null ? void 0 : h.ref.current) == null || C.scrollIntoView({ block: "nearest" });
|
|
1497
|
+
}, [l]), /* @__PURE__ */ p(
|
|
1495
1498
|
N.div,
|
|
1496
1499
|
{
|
|
1497
1500
|
"aria-hidden": !0,
|
|
1498
1501
|
...n,
|
|
1499
1502
|
ref: i,
|
|
1500
1503
|
style: { flexShrink: 0, ...n.style },
|
|
1501
|
-
onPointerMove:
|
|
1502
|
-
var
|
|
1503
|
-
(
|
|
1504
|
+
onPointerMove: E(n.onPointerMove, () => {
|
|
1505
|
+
var h;
|
|
1506
|
+
(h = r.onItemLeave) == null || h.call(r), c.current === null && (c.current = window.setInterval(t, 50));
|
|
1504
1507
|
}),
|
|
1505
|
-
onPointerLeave:
|
|
1508
|
+
onPointerLeave: E(n.onPointerLeave, () => {
|
|
1506
1509
|
a();
|
|
1507
1510
|
})
|
|
1508
1511
|
}
|
|
@@ -1513,29 +1516,29 @@ tt.displayName = "SelectScrollButtonImpl";
|
|
|
1513
1516
|
const Uo = "SelectSeparator", ot = s.forwardRef(
|
|
1514
1517
|
(o, i) => {
|
|
1515
1518
|
const { __scopeSelect: e, ...t } = o;
|
|
1516
|
-
return /* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ p(N.div, { "aria-hidden": !0, ...t, ref: i });
|
|
1517
1520
|
}
|
|
1518
1521
|
);
|
|
1519
1522
|
ot.displayName = Uo;
|
|
1520
1523
|
const Oe = "SelectArrow", nt = s.forwardRef(
|
|
1521
1524
|
(o, i) => {
|
|
1522
1525
|
const { __scopeSelect: e, ...t } = o, n = Ve(e), r = X(Oe, e), c = oe(Oe, e);
|
|
1523
|
-
return r.open && c.position === "popper" ? /* @__PURE__ */
|
|
1526
|
+
return r.open && c.position === "popper" ? /* @__PURE__ */ p(ie.Arrow, { ...n, ...t, ref: i }) : null;
|
|
1524
1527
|
}
|
|
1525
1528
|
);
|
|
1526
1529
|
nt.displayName = Oe;
|
|
1527
|
-
const Ho = "BubbleSelect",
|
|
1530
|
+
const Ho = "BubbleSelect", zo = s.forwardRef(
|
|
1528
1531
|
(o, i) => {
|
|
1529
1532
|
const { value: e, ...t } = o, n = s.useRef(null), r = A(i, n), c = Xt(e), l = X(Ho, void 0);
|
|
1530
1533
|
s.useEffect(() => {
|
|
1531
|
-
const
|
|
1532
|
-
if (c !== e &&
|
|
1534
|
+
const h = n.current, C = window.HTMLSelectElement.prototype, x = Object.getOwnPropertyDescriptor(C, "value").set;
|
|
1535
|
+
if (c !== e && x) {
|
|
1533
1536
|
const u = new Event("change", { bubbles: !0 });
|
|
1534
|
-
|
|
1537
|
+
x.call(h, e), h.dispatchEvent(u);
|
|
1535
1538
|
}
|
|
1536
1539
|
}, [c, e]);
|
|
1537
1540
|
let a = e;
|
|
1538
|
-
return l.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */
|
|
1541
|
+
return l.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ p(Zt, { asChild: !0, children: /* @__PURE__ */ p(
|
|
1539
1542
|
"select",
|
|
1540
1543
|
{
|
|
1541
1544
|
...t,
|
|
@@ -1546,13 +1549,13 @@ const Ho = "BubbleSelect", Wo = s.forwardRef(
|
|
|
1546
1549
|
) });
|
|
1547
1550
|
}
|
|
1548
1551
|
);
|
|
1549
|
-
|
|
1550
|
-
function
|
|
1552
|
+
zo.displayName = "BubbleSelect";
|
|
1553
|
+
function Wt(o) {
|
|
1551
1554
|
const i = Io(o), e = s.useRef(""), t = s.useRef(0), n = s.useCallback(
|
|
1552
1555
|
(c) => {
|
|
1553
1556
|
const l = e.current + c;
|
|
1554
|
-
i(l), function a(
|
|
1555
|
-
e.current =
|
|
1557
|
+
i(l), function a(h) {
|
|
1558
|
+
e.current = h, window.clearTimeout(t.current), h !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
|
|
1556
1559
|
}(l);
|
|
1557
1560
|
},
|
|
1558
1561
|
[i]
|
|
@@ -1562,13 +1565,13 @@ function zt(o) {
|
|
|
1562
1565
|
return s.useEffect(() => () => window.clearTimeout(t.current), []), [e, n, r];
|
|
1563
1566
|
}
|
|
1564
1567
|
function Kt(o, i, e) {
|
|
1565
|
-
const n = i.length > 1 && Array.from(i).every((
|
|
1566
|
-
let c =
|
|
1567
|
-
n.length === 1 && (c = c.filter((
|
|
1568
|
-
const a = c.find((
|
|
1568
|
+
const n = i.length > 1 && Array.from(i).every((h) => h === i[0]) ? i[0] : i, r = e ? o.indexOf(e) : -1;
|
|
1569
|
+
let c = Wo(o, Math.max(r, 0));
|
|
1570
|
+
n.length === 1 && (c = c.filter((h) => h !== e));
|
|
1571
|
+
const a = c.find((h) => h.textValue.toLowerCase().startsWith(n.toLowerCase()));
|
|
1569
1572
|
return a !== e ? a : void 0;
|
|
1570
1573
|
}
|
|
1571
|
-
function
|
|
1574
|
+
function Wo(o, i) {
|
|
1572
1575
|
return o.map((e, t) => o[(i + t) % o.length]);
|
|
1573
1576
|
}
|
|
1574
1577
|
const Gt = (o, i = []) => {
|
|
@@ -1576,7 +1579,7 @@ const Gt = (o, i = []) => {
|
|
|
1576
1579
|
return o.reduce((t, n) => Gt(n, t), i);
|
|
1577
1580
|
const e = i.indexOf(o);
|
|
1578
1581
|
return e === -1 ? [...i, o] : [...i.slice(0, e), ...i.slice(e + 1)];
|
|
1579
|
-
}, Ko = $e, Go = Ue, jo = He, Yo =
|
|
1582
|
+
}, Ko = $e, Go = Ue, jo = He, Yo = ze, qo = We, Xo = Ke, Zo = je, Jo = Ye, Qo = qe, en = Xe, tn = Ze, on = Je, nn = Qe, rn = et, ln = ot, sn = nt, An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1580
1583
|
__proto__: null,
|
|
1581
1584
|
Arrow: sn,
|
|
1582
1585
|
Content: Xo,
|
|
@@ -1594,12 +1597,12 @@ const Gt = (o, i = []) => {
|
|
|
1594
1597
|
SelectArrow: nt,
|
|
1595
1598
|
SelectContent: Ke,
|
|
1596
1599
|
SelectGroup: Ye,
|
|
1597
|
-
SelectIcon:
|
|
1600
|
+
SelectIcon: ze,
|
|
1598
1601
|
SelectItem: Xe,
|
|
1599
1602
|
SelectItemIndicator: Je,
|
|
1600
1603
|
SelectItemText: Ze,
|
|
1601
1604
|
SelectLabel: qe,
|
|
1602
|
-
SelectPortal:
|
|
1605
|
+
SelectPortal: We,
|
|
1603
1606
|
SelectScrollDownButton: et,
|
|
1604
1607
|
SelectScrollUpButton: Qe,
|
|
1605
1608
|
SelectSeparator: ot,
|