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