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