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