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