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