@spear-ai/spectral 1.3.56 → 1.3.58
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/Drawer.js +41 -39
- package/dist/Popover.js +14 -12
- package/dist/RadioGroup.d.ts +34 -9
- package/dist/RadioGroup.js +504 -33
- package/dist/Select.js +588 -635
- package/dist/Tooltip.js +12 -10
- package/dist/components/RadioGroup/RadioGroup.d.ts +34 -9
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/index-CA7haECj.js +248 -0
- package/dist/index-CBwRmAsQ.js +69 -0
- package/dist/index-Cb7rjMhE.js +27 -0
- package/dist/index-CbXx14YO.js +59 -0
- package/dist/{index-CFeaEsew.js → index-Cfyte2YO.js} +1 -1
- package/dist/{index-BDYruyoU.js → index-DUK1rxhf.js} +1 -1
- package/dist/{index-C18a1qz_.js → index-FeGk8zep.js} +316 -338
- package/dist/index-VXXKXen4.js +15 -0
- package/dist/index-cCg4yNa8.js +132 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/styles/main.css +1 -1
- package/package.json +2 -1
- package/dist/RadioGroup/RadioGroupBase.d.ts +0 -52
- package/dist/RadioGroup/RadioGroupBase.js +0 -249
- package/dist/components/RadioGroup/RadioGroupBase.d.ts +0 -52
- package/dist/components/RadioGroup/RadioGroupBase.d.ts.map +0 -1
- package/dist/index-Ddc_4vXe.js +0 -80
- package/dist/index-DfFzqLW6.js +0 -373
package/dist/Select.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
3
|
+
import { jsx as n, jsxs as B, Fragment as ae } from "react/jsx-runtime";
|
|
4
4
|
import "./Icons/AnnotationsIcon.js";
|
|
5
5
|
import "./Icons/CalendarIcon.js";
|
|
6
6
|
import "./Icons/CheckCircleIcon.js";
|
|
7
7
|
import "./Icons/CheckSquareIcon.js";
|
|
8
|
-
import { CheckmarkIcon as
|
|
8
|
+
import { CheckmarkIcon as at } from "./Icons/CheckmarkIcon.js";
|
|
9
9
|
import { ChevronDownIcon as xe } from "./Icons/ChevronDownIcon.js";
|
|
10
10
|
import "./Icons/ChevronUpIcon.js";
|
|
11
11
|
import "./Icons/ClockIcon.js";
|
|
@@ -28,7 +28,7 @@ import "./Icons/LabelIcon.js";
|
|
|
28
28
|
import "./Icons/LassoIcon.js";
|
|
29
29
|
import "./Icons/LineToolIcon.js";
|
|
30
30
|
import "./Icons/LiveViewIcon.js";
|
|
31
|
-
import { LoaderIcon as
|
|
31
|
+
import { LoaderIcon as lt } from "./Icons/LoaderIcon.js";
|
|
32
32
|
import "./Icons/LocationIcon.js";
|
|
33
33
|
import "./Icons/LogoutIcon.js";
|
|
34
34
|
import "./Icons/MetadataIcon.js";
|
|
@@ -47,398 +47,351 @@ import "./Icons/WarningIcon.js";
|
|
|
47
47
|
import "./Icons/ZoomAllIcon.js";
|
|
48
48
|
import "./Icons/ZoomXIcon.js";
|
|
49
49
|
import "./Icons/ZoomYIcon.js";
|
|
50
|
-
import { Label as
|
|
51
|
-
import * as
|
|
52
|
-
import
|
|
53
|
-
import * as
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
import { Label as ct } from "./Label.js";
|
|
51
|
+
import * as t from "react";
|
|
52
|
+
import { forwardRef as dt } from "react";
|
|
53
|
+
import * as Me from "react-dom";
|
|
54
|
+
import { d as Re, c as pt, b as Ne, a as Y, P as L, e as _, u as q, h as ut, g as mt } from "./index-CA7haECj.js";
|
|
55
|
+
import { u as ft, c as ht, a as gt } from "./index-CbXx14YO.js";
|
|
56
|
+
import { D as vt } from "./index-cCg4yNa8.js";
|
|
57
|
+
import { h as St, u as wt, R as xt, F as Ct } from "./index-DUK1rxhf.js";
|
|
58
|
+
import { c as Oe, R as yt, a as It, C as bt, A as Tt } from "./index-FeGk8zep.js";
|
|
59
|
+
import { V as Nt } from "./index-Cfyte2YO.js";
|
|
60
|
+
import { useFormFieldId as Pt, useFormFieldState as Rt, getAriaProps as Et, getErrorMessageId as _t, groupOptions as Mt, getFormFieldCSSProperties as Ot, getStateClasses as At, getTriggerClasses as Dt, ErrorMessage as Lt, LoadingState as kt, EmptyState as Vt, getOptionClasses as Bt } from "./utils/formFieldUtils.js";
|
|
61
|
+
import { c as de } from "./twUtils-CRiPKpXj.js";
|
|
62
|
+
function Ee(r, [a, e]) {
|
|
63
|
+
return Math.min(e, Math.max(a, r));
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
), r = (a) => {
|
|
68
|
-
const { scope: f, children: v } = a, u = ee.useRef(null), g = ee.useRef(/* @__PURE__ */ new Map()).current;
|
|
69
|
-
return /* @__PURE__ */ s(c, { scope: f, itemMap: g, collectionRef: u, children: v });
|
|
70
|
-
};
|
|
71
|
-
r.displayName = n;
|
|
72
|
-
const i = t + "CollectionSlot", l = ye(i), m = ee.forwardRef(
|
|
73
|
-
(a, f) => {
|
|
74
|
-
const { scope: v, children: u } = a, g = p(i, v), P = U(f, g.collectionRef);
|
|
75
|
-
return /* @__PURE__ */ s(l, { ref: P, children: u });
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
m.displayName = i;
|
|
79
|
-
const S = t + "CollectionItemSlot", C = "data-radix-collection-item", b = ye(S), x = ee.forwardRef(
|
|
80
|
-
(a, f) => {
|
|
81
|
-
const { scope: v, children: u, ...g } = a, P = ee.useRef(null), E = U(f, P), V = p(S, v);
|
|
82
|
-
return ee.useEffect(() => (V.itemMap.set(P, { ref: P, ...g }), () => void V.itemMap.delete(P))), /* @__PURE__ */ s(b, { [C]: "", ref: E, children: u });
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
x.displayName = S;
|
|
86
|
-
function w(a) {
|
|
87
|
-
const f = p(t + "CollectionConsumer", a);
|
|
88
|
-
return ee.useCallback(() => {
|
|
89
|
-
const u = f.collectionRef.current;
|
|
90
|
-
if (!u) return [];
|
|
91
|
-
const g = Array.from(u.querySelectorAll(`[${C}]`));
|
|
92
|
-
return Array.from(f.itemMap.values()).sort(
|
|
93
|
-
(V, T) => g.indexOf(V.ref.current) - g.indexOf(T.ref.current)
|
|
94
|
-
);
|
|
95
|
-
}, [f.collectionRef, f.itemMap]);
|
|
96
|
-
}
|
|
97
|
-
return [
|
|
98
|
-
{ Provider: r, Slot: m, ItemSlot: x },
|
|
99
|
-
w,
|
|
100
|
-
d
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
var Bt = o.createContext(void 0);
|
|
104
|
-
function Ht(t) {
|
|
105
|
-
const n = o.useContext(Bt);
|
|
106
|
-
return t || n || "ltr";
|
|
107
|
-
}
|
|
108
|
-
function Ft(t) {
|
|
109
|
-
const n = o.useRef({ value: t, previous: t });
|
|
110
|
-
return o.useMemo(() => (n.current.value !== t && (n.current.previous = n.current.value, n.current.value = t), n.current.previous), [t]);
|
|
111
|
-
}
|
|
112
|
-
var Ut = [" ", "Enter", "ArrowUp", "ArrowDown"], Wt = [" ", "Enter"], te = "Select", [me, fe, Kt] = Vt(te), [re] = De(te, [
|
|
113
|
-
Kt,
|
|
114
|
-
Le
|
|
115
|
-
]), he = Le(), [zt, X] = re(te), [Gt, jt] = re(te), ke = (t) => {
|
|
65
|
+
var Ht = [" ", "Enter", "ArrowUp", "ArrowDown"], Ft = [" ", "Enter"], ee = "Select", [ue, me, Ut] = ht(ee), [ne] = pt(ee, [
|
|
66
|
+
Ut,
|
|
67
|
+
Oe
|
|
68
|
+
]), fe = Oe(), [Wt, $] = ne(ee), [Kt, zt] = ne(ee), Ae = (r) => {
|
|
116
69
|
const {
|
|
117
|
-
__scopeSelect:
|
|
70
|
+
__scopeSelect: a,
|
|
118
71
|
children: e,
|
|
119
|
-
open:
|
|
120
|
-
defaultOpen:
|
|
72
|
+
open: c,
|
|
73
|
+
defaultOpen: l,
|
|
121
74
|
onOpenChange: p,
|
|
122
|
-
value:
|
|
123
|
-
defaultValue:
|
|
124
|
-
onValueChange:
|
|
75
|
+
value: o,
|
|
76
|
+
defaultValue: s,
|
|
77
|
+
onValueChange: i,
|
|
125
78
|
dir: m,
|
|
126
|
-
name:
|
|
127
|
-
autoComplete:
|
|
128
|
-
disabled:
|
|
129
|
-
required:
|
|
130
|
-
form:
|
|
131
|
-
} =
|
|
132
|
-
prop:
|
|
133
|
-
defaultProp:
|
|
79
|
+
name: v,
|
|
80
|
+
autoComplete: w,
|
|
81
|
+
disabled: T,
|
|
82
|
+
required: I,
|
|
83
|
+
form: C
|
|
84
|
+
} = r, d = fe(a), [h, S] = t.useState(null), [u, g] = t.useState(null), [z, M] = t.useState(!1), Z = ft(m), [P, O] = Re({
|
|
85
|
+
prop: c,
|
|
86
|
+
defaultProp: l ?? !1,
|
|
134
87
|
onChange: p,
|
|
135
|
-
caller:
|
|
136
|
-
}), [
|
|
137
|
-
prop:
|
|
138
|
-
defaultProp:
|
|
139
|
-
onChange:
|
|
140
|
-
caller:
|
|
141
|
-
}),
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
|
|
88
|
+
caller: ee
|
|
89
|
+
}), [H, G] = Re({
|
|
90
|
+
prop: o,
|
|
91
|
+
defaultProp: s,
|
|
92
|
+
onChange: i,
|
|
93
|
+
caller: ee
|
|
94
|
+
}), k = t.useRef(null), F = h ? C || !!h.closest("form") : !0, [U, V] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(U).map((E) => E.props.value).join(";");
|
|
95
|
+
return /* @__PURE__ */ n(yt, { ...d, children: /* @__PURE__ */ B(
|
|
96
|
+
Wt,
|
|
144
97
|
{
|
|
145
|
-
required:
|
|
146
|
-
scope:
|
|
147
|
-
trigger:
|
|
148
|
-
onTriggerChange:
|
|
98
|
+
required: I,
|
|
99
|
+
scope: a,
|
|
100
|
+
trigger: h,
|
|
101
|
+
onTriggerChange: S,
|
|
149
102
|
valueNode: u,
|
|
150
103
|
onValueNodeChange: g,
|
|
151
|
-
valueNodeHasChildren:
|
|
152
|
-
onValueNodeHasChildrenChange:
|
|
153
|
-
contentId:
|
|
154
|
-
value:
|
|
155
|
-
onValueChange:
|
|
156
|
-
open:
|
|
157
|
-
onOpenChange:
|
|
158
|
-
dir:
|
|
159
|
-
triggerPointerDownPosRef:
|
|
160
|
-
disabled:
|
|
104
|
+
valueNodeHasChildren: z,
|
|
105
|
+
onValueNodeHasChildrenChange: M,
|
|
106
|
+
contentId: Ne(),
|
|
107
|
+
value: H,
|
|
108
|
+
onValueChange: G,
|
|
109
|
+
open: P,
|
|
110
|
+
onOpenChange: O,
|
|
111
|
+
dir: Z,
|
|
112
|
+
triggerPointerDownPosRef: k,
|
|
113
|
+
disabled: T,
|
|
161
114
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
115
|
+
/* @__PURE__ */ n(ue.Provider, { scope: a, children: /* @__PURE__ */ n(
|
|
116
|
+
Kt,
|
|
164
117
|
{
|
|
165
|
-
scope:
|
|
166
|
-
onNativeOptionAdd:
|
|
167
|
-
|
|
118
|
+
scope: r.__scopeSelect,
|
|
119
|
+
onNativeOptionAdd: t.useCallback((E) => {
|
|
120
|
+
V((b) => new Set(b).add(E));
|
|
168
121
|
}, []),
|
|
169
|
-
onNativeOptionRemove:
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
return
|
|
122
|
+
onNativeOptionRemove: t.useCallback((E) => {
|
|
123
|
+
V((b) => {
|
|
124
|
+
const A = new Set(b);
|
|
125
|
+
return A.delete(E), A;
|
|
173
126
|
});
|
|
174
127
|
}, []),
|
|
175
128
|
children: e
|
|
176
129
|
}
|
|
177
130
|
) }),
|
|
178
|
-
|
|
179
|
-
|
|
131
|
+
F ? /* @__PURE__ */ B(
|
|
132
|
+
nt,
|
|
180
133
|
{
|
|
181
134
|
"aria-hidden": !0,
|
|
182
|
-
required:
|
|
135
|
+
required: I,
|
|
183
136
|
tabIndex: -1,
|
|
184
|
-
name:
|
|
185
|
-
autoComplete:
|
|
186
|
-
value:
|
|
187
|
-
onChange: (
|
|
188
|
-
disabled:
|
|
189
|
-
form:
|
|
137
|
+
name: v,
|
|
138
|
+
autoComplete: w,
|
|
139
|
+
value: H,
|
|
140
|
+
onChange: (E) => G(E.target.value),
|
|
141
|
+
disabled: T,
|
|
142
|
+
form: C,
|
|
190
143
|
children: [
|
|
191
|
-
|
|
192
|
-
Array.from(
|
|
144
|
+
H === void 0 ? /* @__PURE__ */ n("option", { value: "" }) : null,
|
|
145
|
+
Array.from(U)
|
|
193
146
|
]
|
|
194
147
|
},
|
|
195
|
-
|
|
148
|
+
W
|
|
196
149
|
) : null
|
|
197
150
|
]
|
|
198
151
|
}
|
|
199
152
|
) });
|
|
200
153
|
};
|
|
201
|
-
|
|
202
|
-
var
|
|
203
|
-
(
|
|
204
|
-
const { __scopeSelect: e, disabled:
|
|
205
|
-
const
|
|
206
|
-
u !== void 0 &&
|
|
207
|
-
}),
|
|
208
|
-
|
|
209
|
-
x: Math.round(
|
|
210
|
-
y: Math.round(
|
|
154
|
+
Ae.displayName = ee;
|
|
155
|
+
var De = "SelectTrigger", Le = t.forwardRef(
|
|
156
|
+
(r, a) => {
|
|
157
|
+
const { __scopeSelect: e, disabled: c = !1, ...l } = r, p = fe(e), o = $(De, e), s = o.disabled || c, i = Y(a, o.onTriggerChange), m = me(e), v = t.useRef("touch"), [w, T, I] = st((d) => {
|
|
158
|
+
const h = m().filter((g) => !g.disabled), S = h.find((g) => g.value === o.value), u = it(h, d, S);
|
|
159
|
+
u !== void 0 && o.onValueChange(u.value);
|
|
160
|
+
}), C = (d) => {
|
|
161
|
+
s || (o.onOpenChange(!0), I()), d && (o.triggerPointerDownPosRef.current = {
|
|
162
|
+
x: Math.round(d.pageX),
|
|
163
|
+
y: Math.round(d.pageY)
|
|
211
164
|
});
|
|
212
165
|
};
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
|
|
166
|
+
return /* @__PURE__ */ n(It, { asChild: !0, ...p, children: /* @__PURE__ */ n(
|
|
167
|
+
L.button,
|
|
215
168
|
{
|
|
216
169
|
type: "button",
|
|
217
170
|
role: "combobox",
|
|
218
|
-
"aria-controls":
|
|
219
|
-
"aria-expanded":
|
|
220
|
-
"aria-required":
|
|
171
|
+
"aria-controls": o.contentId,
|
|
172
|
+
"aria-expanded": o.open,
|
|
173
|
+
"aria-required": o.required,
|
|
221
174
|
"aria-autocomplete": "none",
|
|
222
|
-
dir:
|
|
223
|
-
"data-state":
|
|
224
|
-
disabled:
|
|
225
|
-
"data-disabled":
|
|
226
|
-
"data-placeholder":
|
|
227
|
-
...
|
|
228
|
-
ref:
|
|
229
|
-
onClick:
|
|
230
|
-
|
|
175
|
+
dir: o.dir,
|
|
176
|
+
"data-state": o.open ? "open" : "closed",
|
|
177
|
+
disabled: s,
|
|
178
|
+
"data-disabled": s ? "" : void 0,
|
|
179
|
+
"data-placeholder": rt(o.value) ? "" : void 0,
|
|
180
|
+
...l,
|
|
181
|
+
ref: i,
|
|
182
|
+
onClick: _(l.onClick, (d) => {
|
|
183
|
+
d.currentTarget.focus(), v.current !== "mouse" && C(d);
|
|
231
184
|
}),
|
|
232
|
-
onPointerDown:
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
185
|
+
onPointerDown: _(l.onPointerDown, (d) => {
|
|
186
|
+
v.current = d.pointerType;
|
|
187
|
+
const h = d.target;
|
|
188
|
+
h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), d.button === 0 && d.ctrlKey === !1 && d.pointerType === "mouse" && (C(d), d.preventDefault());
|
|
236
189
|
}),
|
|
237
|
-
onKeyDown:
|
|
238
|
-
const
|
|
239
|
-
!(
|
|
190
|
+
onKeyDown: _(l.onKeyDown, (d) => {
|
|
191
|
+
const h = w.current !== "";
|
|
192
|
+
!(d.ctrlKey || d.altKey || d.metaKey) && d.key.length === 1 && T(d.key), !(h && d.key === " ") && Ht.includes(d.key) && (C(), d.preventDefault());
|
|
240
193
|
})
|
|
241
194
|
}
|
|
242
195
|
) });
|
|
243
196
|
}
|
|
244
197
|
);
|
|
245
|
-
|
|
246
|
-
var
|
|
247
|
-
(
|
|
248
|
-
const { __scopeSelect: e, className:
|
|
249
|
-
return
|
|
250
|
-
m(
|
|
251
|
-
}, [m,
|
|
252
|
-
|
|
198
|
+
Le.displayName = De;
|
|
199
|
+
var ke = "SelectValue", Ve = t.forwardRef(
|
|
200
|
+
(r, a) => {
|
|
201
|
+
const { __scopeSelect: e, className: c, style: l, children: p, placeholder: o = "", ...s } = r, i = $(ke, e), { onValueNodeHasChildrenChange: m } = i, v = p !== void 0, w = Y(a, i.onValueNodeChange);
|
|
202
|
+
return q(() => {
|
|
203
|
+
m(v);
|
|
204
|
+
}, [m, v]), /* @__PURE__ */ n(
|
|
205
|
+
L.span,
|
|
253
206
|
{
|
|
254
|
-
...
|
|
255
|
-
ref:
|
|
207
|
+
...s,
|
|
208
|
+
ref: w,
|
|
256
209
|
style: { pointerEvents: "none" },
|
|
257
|
-
children:
|
|
210
|
+
children: rt(i.value) ? /* @__PURE__ */ n(ae, { children: o }) : p
|
|
258
211
|
}
|
|
259
212
|
);
|
|
260
213
|
}
|
|
261
214
|
);
|
|
262
|
-
|
|
263
|
-
var
|
|
264
|
-
(
|
|
265
|
-
const { __scopeSelect: e, children:
|
|
266
|
-
return /* @__PURE__ */
|
|
215
|
+
Ve.displayName = ke;
|
|
216
|
+
var Gt = "SelectIcon", Be = t.forwardRef(
|
|
217
|
+
(r, a) => {
|
|
218
|
+
const { __scopeSelect: e, children: c, ...l } = r;
|
|
219
|
+
return /* @__PURE__ */ n(L.span, { "aria-hidden": !0, ...l, ref: a, children: c || "▼" });
|
|
267
220
|
}
|
|
268
221
|
);
|
|
269
|
-
|
|
270
|
-
var
|
|
271
|
-
(
|
|
272
|
-
const e =
|
|
273
|
-
if (
|
|
274
|
-
|
|
222
|
+
Be.displayName = Gt;
|
|
223
|
+
var te = "SelectContent", He = t.forwardRef(
|
|
224
|
+
(r, a) => {
|
|
225
|
+
const e = $(te, r.__scopeSelect), [c, l] = t.useState();
|
|
226
|
+
if (q(() => {
|
|
227
|
+
l(new DocumentFragment());
|
|
275
228
|
}, []), !e.open) {
|
|
276
|
-
const p =
|
|
277
|
-
return p ?
|
|
278
|
-
/* @__PURE__ */
|
|
229
|
+
const p = c;
|
|
230
|
+
return p ? Me.createPortal(
|
|
231
|
+
/* @__PURE__ */ n(Fe, { scope: r.__scopeSelect, children: /* @__PURE__ */ n(ue.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ n("div", { children: r.children }) }) }),
|
|
279
232
|
p
|
|
280
233
|
) : null;
|
|
281
234
|
}
|
|
282
|
-
return /* @__PURE__ */
|
|
235
|
+
return /* @__PURE__ */ n(Ue, { ...r, ref: a });
|
|
283
236
|
}
|
|
284
237
|
);
|
|
285
|
-
|
|
286
|
-
var
|
|
287
|
-
(
|
|
238
|
+
He.displayName = te;
|
|
239
|
+
var K = 10, [Fe, X] = ne(te), jt = "SelectContentImpl", Yt = mt("SelectContent.RemoveScroll"), Ue = t.forwardRef(
|
|
240
|
+
(r, a) => {
|
|
288
241
|
const {
|
|
289
242
|
__scopeSelect: e,
|
|
290
|
-
position:
|
|
291
|
-
onCloseAutoFocus:
|
|
243
|
+
position: c = "item-aligned",
|
|
244
|
+
onCloseAutoFocus: l,
|
|
292
245
|
onEscapeKeyDown: p,
|
|
293
|
-
onPointerDownOutside:
|
|
246
|
+
onPointerDownOutside: o,
|
|
294
247
|
//
|
|
295
248
|
// PopperContent props
|
|
296
|
-
side:
|
|
297
|
-
sideOffset:
|
|
249
|
+
side: s,
|
|
250
|
+
sideOffset: i,
|
|
298
251
|
align: m,
|
|
299
|
-
alignOffset:
|
|
300
|
-
arrowPadding:
|
|
301
|
-
collisionBoundary:
|
|
302
|
-
collisionPadding:
|
|
303
|
-
sticky:
|
|
304
|
-
hideWhenDetached:
|
|
305
|
-
avoidCollisions:
|
|
252
|
+
alignOffset: v,
|
|
253
|
+
arrowPadding: w,
|
|
254
|
+
collisionBoundary: T,
|
|
255
|
+
collisionPadding: I,
|
|
256
|
+
sticky: C,
|
|
257
|
+
hideWhenDetached: d,
|
|
258
|
+
avoidCollisions: h,
|
|
306
259
|
//
|
|
307
|
-
...
|
|
308
|
-
} =
|
|
260
|
+
...S
|
|
261
|
+
} = r, u = $(te, e), [g, z] = t.useState(null), [M, Z] = t.useState(null), P = Y(a, (f) => z(f)), [O, H] = t.useState(null), [G, k] = t.useState(
|
|
309
262
|
null
|
|
310
|
-
),
|
|
311
|
-
|
|
312
|
-
if (g) return
|
|
313
|
-
}, [g]),
|
|
314
|
-
const
|
|
315
|
-
(
|
|
316
|
-
const [N, ...
|
|
317
|
-
for (const
|
|
318
|
-
if (
|
|
263
|
+
), F = me(e), [U, V] = t.useState(!1), W = t.useRef(!1);
|
|
264
|
+
t.useEffect(() => {
|
|
265
|
+
if (g) return St(g);
|
|
266
|
+
}, [g]), wt();
|
|
267
|
+
const E = t.useCallback(
|
|
268
|
+
(f) => {
|
|
269
|
+
const [N, ...D] = F().map((R) => R.ref.current), [x] = D.slice(-1), y = document.activeElement;
|
|
270
|
+
for (const R of f)
|
|
271
|
+
if (R === y || (R?.scrollIntoView({ block: "nearest" }), R === N && M && (M.scrollTop = 0), R === x && M && (M.scrollTop = M.scrollHeight), R?.focus(), document.activeElement !== y)) return;
|
|
319
272
|
},
|
|
320
|
-
[
|
|
321
|
-
),
|
|
322
|
-
() =>
|
|
323
|
-
[
|
|
273
|
+
[F, M]
|
|
274
|
+
), b = t.useCallback(
|
|
275
|
+
() => E([O, g]),
|
|
276
|
+
[E, O, g]
|
|
324
277
|
);
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}, [
|
|
328
|
-
const { onOpenChange:
|
|
329
|
-
|
|
278
|
+
t.useEffect(() => {
|
|
279
|
+
U && b();
|
|
280
|
+
}, [U, b]);
|
|
281
|
+
const { onOpenChange: A, triggerPointerDownPosRef: j } = u;
|
|
282
|
+
t.useEffect(() => {
|
|
330
283
|
if (g) {
|
|
331
|
-
let
|
|
332
|
-
const N = (
|
|
333
|
-
|
|
334
|
-
x: Math.abs(Math.round(
|
|
335
|
-
y: Math.abs(Math.round(
|
|
284
|
+
let f = { x: 0, y: 0 };
|
|
285
|
+
const N = (x) => {
|
|
286
|
+
f = {
|
|
287
|
+
x: Math.abs(Math.round(x.pageX) - (j.current?.x ?? 0)),
|
|
288
|
+
y: Math.abs(Math.round(x.pageY) - (j.current?.y ?? 0))
|
|
336
289
|
};
|
|
337
|
-
},
|
|
338
|
-
|
|
290
|
+
}, D = (x) => {
|
|
291
|
+
f.x <= 10 && f.y <= 10 ? x.preventDefault() : g.contains(x.target) || A(!1), document.removeEventListener("pointermove", N), j.current = null;
|
|
339
292
|
};
|
|
340
|
-
return
|
|
341
|
-
document.removeEventListener("pointermove", N), document.removeEventListener("pointerup",
|
|
293
|
+
return j.current !== null && (document.addEventListener("pointermove", N), document.addEventListener("pointerup", D, { capture: !0, once: !0 })), () => {
|
|
294
|
+
document.removeEventListener("pointermove", N), document.removeEventListener("pointerup", D, { capture: !0 });
|
|
342
295
|
};
|
|
343
296
|
}
|
|
344
|
-
}, [g,
|
|
345
|
-
const
|
|
346
|
-
return window.addEventListener("blur",
|
|
347
|
-
window.removeEventListener("blur",
|
|
297
|
+
}, [g, A, j]), t.useEffect(() => {
|
|
298
|
+
const f = () => A(!1);
|
|
299
|
+
return window.addEventListener("blur", f), window.addEventListener("resize", f), () => {
|
|
300
|
+
window.removeEventListener("blur", f), window.removeEventListener("resize", f);
|
|
348
301
|
};
|
|
349
|
-
}, [
|
|
350
|
-
const [
|
|
351
|
-
const N =
|
|
352
|
-
|
|
353
|
-
}),
|
|
354
|
-
(
|
|
355
|
-
const
|
|
356
|
-
(u.value !== void 0 && u.value === N ||
|
|
302
|
+
}, [A]);
|
|
303
|
+
const [re, le] = st((f) => {
|
|
304
|
+
const N = F().filter((y) => !y.disabled), D = N.find((y) => y.ref.current === document.activeElement), x = it(N, f, D);
|
|
305
|
+
x && setTimeout(() => x.ref.current.focus());
|
|
306
|
+
}), he = t.useCallback(
|
|
307
|
+
(f, N, D) => {
|
|
308
|
+
const x = !W.current && !D;
|
|
309
|
+
(u.value !== void 0 && u.value === N || x) && (H(f), x && (W.current = !0));
|
|
357
310
|
},
|
|
358
311
|
[u.value]
|
|
359
|
-
),
|
|
360
|
-
(
|
|
361
|
-
const
|
|
362
|
-
(u.value !== void 0 && u.value === N ||
|
|
312
|
+
), ge = t.useCallback(() => g?.focus(), [g]), oe = t.useCallback(
|
|
313
|
+
(f, N, D) => {
|
|
314
|
+
const x = !W.current && !D;
|
|
315
|
+
(u.value !== void 0 && u.value === N || x) && k(f);
|
|
363
316
|
},
|
|
364
317
|
[u.value]
|
|
365
|
-
),
|
|
366
|
-
side:
|
|
367
|
-
sideOffset:
|
|
318
|
+
), ce = c === "popper" ? Ce : We, se = ce === Ce ? {
|
|
319
|
+
side: s,
|
|
320
|
+
sideOffset: i,
|
|
368
321
|
align: m,
|
|
369
|
-
alignOffset:
|
|
370
|
-
arrowPadding:
|
|
371
|
-
collisionBoundary:
|
|
372
|
-
collisionPadding:
|
|
373
|
-
sticky:
|
|
374
|
-
hideWhenDetached:
|
|
375
|
-
avoidCollisions:
|
|
322
|
+
alignOffset: v,
|
|
323
|
+
arrowPadding: w,
|
|
324
|
+
collisionBoundary: T,
|
|
325
|
+
collisionPadding: I,
|
|
326
|
+
sticky: C,
|
|
327
|
+
hideWhenDetached: d,
|
|
328
|
+
avoidCollisions: h
|
|
376
329
|
} : {};
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
|
|
330
|
+
return /* @__PURE__ */ n(
|
|
331
|
+
Fe,
|
|
379
332
|
{
|
|
380
333
|
scope: e,
|
|
381
334
|
content: g,
|
|
382
|
-
viewport:
|
|
383
|
-
onViewportChange:
|
|
384
|
-
itemRefCallback:
|
|
385
|
-
selectedItem:
|
|
386
|
-
onItemLeave:
|
|
387
|
-
itemTextRefCallback:
|
|
388
|
-
focusSelectedItem:
|
|
389
|
-
selectedItemText:
|
|
390
|
-
position:
|
|
391
|
-
isPositioned:
|
|
392
|
-
searchRef:
|
|
393
|
-
children: /* @__PURE__ */
|
|
335
|
+
viewport: M,
|
|
336
|
+
onViewportChange: Z,
|
|
337
|
+
itemRefCallback: he,
|
|
338
|
+
selectedItem: O,
|
|
339
|
+
onItemLeave: ge,
|
|
340
|
+
itemTextRefCallback: oe,
|
|
341
|
+
focusSelectedItem: b,
|
|
342
|
+
selectedItemText: G,
|
|
343
|
+
position: c,
|
|
344
|
+
isPositioned: U,
|
|
345
|
+
searchRef: re,
|
|
346
|
+
children: /* @__PURE__ */ n(xt, { as: Yt, allowPinchZoom: !0, children: /* @__PURE__ */ n(
|
|
394
347
|
Ct,
|
|
395
348
|
{
|
|
396
349
|
asChild: !0,
|
|
397
350
|
trapped: u.open,
|
|
398
|
-
onMountAutoFocus: (
|
|
399
|
-
|
|
351
|
+
onMountAutoFocus: (f) => {
|
|
352
|
+
f.preventDefault();
|
|
400
353
|
},
|
|
401
|
-
onUnmountAutoFocus:
|
|
402
|
-
u.trigger?.focus({ preventScroll: !0 }),
|
|
354
|
+
onUnmountAutoFocus: _(l, (f) => {
|
|
355
|
+
u.trigger?.focus({ preventScroll: !0 }), f.preventDefault();
|
|
403
356
|
}),
|
|
404
|
-
children: /* @__PURE__ */
|
|
405
|
-
|
|
357
|
+
children: /* @__PURE__ */ n(
|
|
358
|
+
vt,
|
|
406
359
|
{
|
|
407
360
|
asChild: !0,
|
|
408
361
|
disableOutsidePointerEvents: !0,
|
|
409
362
|
onEscapeKeyDown: p,
|
|
410
|
-
onPointerDownOutside:
|
|
411
|
-
onFocusOutside: (
|
|
363
|
+
onPointerDownOutside: o,
|
|
364
|
+
onFocusOutside: (f) => f.preventDefault(),
|
|
412
365
|
onDismiss: () => u.onOpenChange(!1),
|
|
413
|
-
children: /* @__PURE__ */
|
|
414
|
-
|
|
366
|
+
children: /* @__PURE__ */ n(
|
|
367
|
+
ce,
|
|
415
368
|
{
|
|
416
369
|
role: "listbox",
|
|
417
370
|
id: u.contentId,
|
|
418
371
|
"data-state": u.open ? "open" : "closed",
|
|
419
372
|
dir: u.dir,
|
|
420
|
-
onContextMenu: (
|
|
421
|
-
...
|
|
422
|
-
...
|
|
423
|
-
onPlaced: () =>
|
|
424
|
-
ref:
|
|
373
|
+
onContextMenu: (f) => f.preventDefault(),
|
|
374
|
+
...S,
|
|
375
|
+
...se,
|
|
376
|
+
onPlaced: () => V(!0),
|
|
377
|
+
ref: P,
|
|
425
378
|
style: {
|
|
426
379
|
// flex layout so we can place the scroll buttons properly
|
|
427
380
|
display: "flex",
|
|
428
381
|
flexDirection: "column",
|
|
429
382
|
// reset the outline by default as the content MAY get focused
|
|
430
383
|
outline: "none",
|
|
431
|
-
...
|
|
384
|
+
...S.style
|
|
432
385
|
},
|
|
433
|
-
onKeyDown:
|
|
434
|
-
const N =
|
|
435
|
-
if (
|
|
436
|
-
let
|
|
437
|
-
if (["ArrowUp", "End"].includes(
|
|
438
|
-
const
|
|
439
|
-
|
|
386
|
+
onKeyDown: _(S.onKeyDown, (f) => {
|
|
387
|
+
const N = f.ctrlKey || f.altKey || f.metaKey;
|
|
388
|
+
if (f.key === "Tab" && f.preventDefault(), !N && f.key.length === 1 && le(f.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key)) {
|
|
389
|
+
let x = F().filter((y) => !y.disabled).map((y) => y.ref.current);
|
|
390
|
+
if (["ArrowUp", "End"].includes(f.key) && (x = x.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
|
|
391
|
+
const y = f.target, R = x.indexOf(y);
|
|
392
|
+
x = x.slice(R + 1);
|
|
440
393
|
}
|
|
441
|
-
setTimeout(() =>
|
|
394
|
+
setTimeout(() => E(x)), f.preventDefault();
|
|
442
395
|
}
|
|
443
396
|
})
|
|
444
397
|
}
|
|
@@ -451,103 +404,103 @@ var j = 10, [Ke, Z] = re(oe), Yt = "SelectContentImpl", $t = ye("SelectContent.R
|
|
|
451
404
|
);
|
|
452
405
|
}
|
|
453
406
|
);
|
|
454
|
-
|
|
455
|
-
var
|
|
456
|
-
const { __scopeSelect: e, onPlaced:
|
|
457
|
-
if (p.trigger && p.valueNode &&
|
|
458
|
-
const
|
|
407
|
+
Ue.displayName = jt;
|
|
408
|
+
var qt = "SelectItemAlignedPosition", We = t.forwardRef((r, a) => {
|
|
409
|
+
const { __scopeSelect: e, onPlaced: c, ...l } = r, p = $(te, e), o = X(te, e), [s, i] = t.useState(null), [m, v] = t.useState(null), w = Y(a, (P) => v(P)), T = me(e), I = t.useRef(!1), C = t.useRef(!0), { viewport: d, selectedItem: h, selectedItemText: S, focusSelectedItem: u } = o, g = t.useCallback(() => {
|
|
410
|
+
if (p.trigger && p.valueNode && s && m && d && h && S) {
|
|
411
|
+
const P = p.trigger.getBoundingClientRect(), O = m.getBoundingClientRect(), H = p.valueNode.getBoundingClientRect(), G = S.getBoundingClientRect();
|
|
459
412
|
if (p.dir !== "rtl") {
|
|
460
|
-
const
|
|
461
|
-
|
|
413
|
+
const y = G.left - O.left, R = H.left - y, J = P.left - R, Q = P.width + J, ve = Math.max(Q, O.width), Se = window.innerWidth - K, we = Ee(R, [
|
|
414
|
+
K,
|
|
462
415
|
// Prevents the content from going off the starting edge of the
|
|
463
416
|
// viewport. It may still go off the ending edge, but this can be
|
|
464
417
|
// controlled by the user since they may want to manage overflow in a
|
|
465
418
|
// specific way.
|
|
466
419
|
// https://github.com/radix-ui/primitives/issues/2049
|
|
467
|
-
Math.max(
|
|
420
|
+
Math.max(K, Se - ve)
|
|
468
421
|
]);
|
|
469
|
-
|
|
422
|
+
s.style.minWidth = Q + "px", s.style.left = we + "px";
|
|
470
423
|
} else {
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
Math.max(
|
|
424
|
+
const y = O.right - G.right, R = window.innerWidth - H.right - y, J = window.innerWidth - P.right - R, Q = P.width + J, ve = Math.max(Q, O.width), Se = window.innerWidth - K, we = Ee(R, [
|
|
425
|
+
K,
|
|
426
|
+
Math.max(K, Se - ve)
|
|
474
427
|
]);
|
|
475
|
-
|
|
428
|
+
s.style.minWidth = Q + "px", s.style.right = we + "px";
|
|
476
429
|
}
|
|
477
|
-
const
|
|
478
|
-
if (N <=
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
(
|
|
430
|
+
const k = T(), F = window.innerHeight - K * 2, U = d.scrollHeight, V = window.getComputedStyle(m), W = parseInt(V.borderTopWidth, 10), E = parseInt(V.paddingTop, 10), b = parseInt(V.borderBottomWidth, 10), A = parseInt(V.paddingBottom, 10), j = W + E + U + A + b, re = Math.min(h.offsetHeight * 5, j), le = window.getComputedStyle(d), he = parseInt(le.paddingTop, 10), ge = parseInt(le.paddingBottom, 10), oe = P.top + P.height / 2 - K, ce = F - oe, se = h.offsetHeight / 2, f = h.offsetTop + se, N = W + E + f, D = j - N;
|
|
431
|
+
if (N <= oe) {
|
|
432
|
+
const y = k.length > 0 && h === k[k.length - 1].ref.current;
|
|
433
|
+
s.style.bottom = "0px";
|
|
434
|
+
const R = m.clientHeight - d.offsetTop - d.offsetHeight, J = Math.max(
|
|
435
|
+
ce,
|
|
436
|
+
se + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
437
|
+
(y ? ge : 0) + R + b
|
|
485
438
|
), Q = N + J;
|
|
486
|
-
|
|
439
|
+
s.style.height = Q + "px";
|
|
487
440
|
} else {
|
|
488
|
-
const
|
|
489
|
-
|
|
441
|
+
const y = k.length > 0 && h === k[0].ref.current;
|
|
442
|
+
s.style.top = "0px";
|
|
490
443
|
const J = Math.max(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
(
|
|
494
|
-
) +
|
|
495
|
-
|
|
444
|
+
oe,
|
|
445
|
+
W + d.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
446
|
+
(y ? he : 0) + se
|
|
447
|
+
) + D;
|
|
448
|
+
s.style.height = J + "px", d.scrollTop = N - oe + d.offsetTop;
|
|
496
449
|
}
|
|
497
|
-
|
|
450
|
+
s.style.margin = `${K}px 0`, s.style.minHeight = re + "px", s.style.maxHeight = F + "px", c?.(), requestAnimationFrame(() => I.current = !0);
|
|
498
451
|
}
|
|
499
452
|
}, [
|
|
500
|
-
|
|
453
|
+
T,
|
|
501
454
|
p.trigger,
|
|
502
455
|
p.valueNode,
|
|
503
|
-
|
|
456
|
+
s,
|
|
504
457
|
m,
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
458
|
+
d,
|
|
459
|
+
h,
|
|
460
|
+
S,
|
|
508
461
|
p.dir,
|
|
509
|
-
|
|
462
|
+
c
|
|
510
463
|
]);
|
|
511
|
-
|
|
512
|
-
const [
|
|
513
|
-
|
|
514
|
-
m &&
|
|
464
|
+
q(() => g(), [g]);
|
|
465
|
+
const [z, M] = t.useState();
|
|
466
|
+
q(() => {
|
|
467
|
+
m && M(window.getComputedStyle(m).zIndex);
|
|
515
468
|
}, [m]);
|
|
516
|
-
const
|
|
517
|
-
(
|
|
518
|
-
|
|
469
|
+
const Z = t.useCallback(
|
|
470
|
+
(P) => {
|
|
471
|
+
P && C.current === !0 && (g(), u?.(), C.current = !1);
|
|
519
472
|
},
|
|
520
473
|
[g, u]
|
|
521
474
|
);
|
|
522
|
-
return /* @__PURE__ */
|
|
523
|
-
|
|
475
|
+
return /* @__PURE__ */ n(
|
|
476
|
+
Xt,
|
|
524
477
|
{
|
|
525
478
|
scope: e,
|
|
526
|
-
contentWrapper:
|
|
527
|
-
shouldExpandOnScrollRef:
|
|
528
|
-
onScrollButtonChange:
|
|
529
|
-
children: /* @__PURE__ */
|
|
479
|
+
contentWrapper: s,
|
|
480
|
+
shouldExpandOnScrollRef: I,
|
|
481
|
+
onScrollButtonChange: Z,
|
|
482
|
+
children: /* @__PURE__ */ n(
|
|
530
483
|
"div",
|
|
531
484
|
{
|
|
532
|
-
ref:
|
|
485
|
+
ref: i,
|
|
533
486
|
style: {
|
|
534
487
|
display: "flex",
|
|
535
488
|
flexDirection: "column",
|
|
536
489
|
position: "fixed",
|
|
537
|
-
zIndex:
|
|
490
|
+
zIndex: z
|
|
538
491
|
},
|
|
539
|
-
children: /* @__PURE__ */
|
|
540
|
-
|
|
492
|
+
children: /* @__PURE__ */ n(
|
|
493
|
+
L.div,
|
|
541
494
|
{
|
|
542
|
-
...
|
|
543
|
-
ref:
|
|
495
|
+
...l,
|
|
496
|
+
ref: w,
|
|
544
497
|
style: {
|
|
545
498
|
// When we get the height of the content, it includes borders. If we were to set
|
|
546
499
|
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
547
500
|
boxSizing: "border-box",
|
|
548
501
|
// We need to ensure the content doesn't get taller than the wrapper
|
|
549
502
|
maxHeight: "100%",
|
|
550
|
-
...
|
|
503
|
+
...l.style
|
|
551
504
|
}
|
|
552
505
|
}
|
|
553
506
|
)
|
|
@@ -556,22 +509,22 @@ var Xt = "SelectItemAlignedPosition", Ge = o.forwardRef((t, n) => {
|
|
|
556
509
|
}
|
|
557
510
|
);
|
|
558
511
|
});
|
|
559
|
-
|
|
560
|
-
var
|
|
512
|
+
We.displayName = qt;
|
|
513
|
+
var $t = "SelectPopperPosition", Ce = t.forwardRef((r, a) => {
|
|
561
514
|
const {
|
|
562
515
|
__scopeSelect: e,
|
|
563
|
-
align:
|
|
564
|
-
collisionPadding:
|
|
516
|
+
align: c = "start",
|
|
517
|
+
collisionPadding: l = K,
|
|
565
518
|
...p
|
|
566
|
-
} =
|
|
567
|
-
return /* @__PURE__ */
|
|
568
|
-
|
|
519
|
+
} = r, o = fe(e);
|
|
520
|
+
return /* @__PURE__ */ n(
|
|
521
|
+
bt,
|
|
569
522
|
{
|
|
570
|
-
...
|
|
523
|
+
...o,
|
|
571
524
|
...p,
|
|
572
|
-
ref:
|
|
573
|
-
align:
|
|
574
|
-
collisionPadding:
|
|
525
|
+
ref: a,
|
|
526
|
+
align: c,
|
|
527
|
+
collisionPadding: l,
|
|
575
528
|
style: {
|
|
576
529
|
// Ensure border-box for floating-ui calculations
|
|
577
530
|
boxSizing: "border-box",
|
|
@@ -585,27 +538,27 @@ var Zt = "SelectPopperPosition", Ie = o.forwardRef((t, n) => {
|
|
|
585
538
|
}
|
|
586
539
|
);
|
|
587
540
|
});
|
|
588
|
-
|
|
589
|
-
var [
|
|
590
|
-
(
|
|
591
|
-
const { __scopeSelect: e, nonce:
|
|
592
|
-
return /* @__PURE__ */
|
|
593
|
-
/* @__PURE__ */
|
|
541
|
+
Ce.displayName = $t;
|
|
542
|
+
var [Xt, Pe] = ne(te, {}), ye = "SelectViewport", Ke = t.forwardRef(
|
|
543
|
+
(r, a) => {
|
|
544
|
+
const { __scopeSelect: e, nonce: c, ...l } = r, p = X(ye, e), o = Pe(ye, e), s = Y(a, p.onViewportChange), i = t.useRef(0);
|
|
545
|
+
return /* @__PURE__ */ B(ae, { children: [
|
|
546
|
+
/* @__PURE__ */ n(
|
|
594
547
|
"style",
|
|
595
548
|
{
|
|
596
549
|
dangerouslySetInnerHTML: {
|
|
597
550
|
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
598
551
|
},
|
|
599
|
-
nonce:
|
|
552
|
+
nonce: c
|
|
600
553
|
}
|
|
601
554
|
),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
|
|
555
|
+
/* @__PURE__ */ n(ue.Slot, { scope: e, children: /* @__PURE__ */ n(
|
|
556
|
+
L.div,
|
|
604
557
|
{
|
|
605
558
|
"data-radix-select-viewport": "",
|
|
606
559
|
role: "presentation",
|
|
607
|
-
...
|
|
608
|
-
ref:
|
|
560
|
+
...l,
|
|
561
|
+
ref: s,
|
|
609
562
|
style: {
|
|
610
563
|
// we use position: 'relative' here on the `viewport` so that when we call
|
|
611
564
|
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
@@ -617,110 +570,110 @@ var [Jt, Ee] = re(oe, {}), be = "SelectViewport", je = o.forwardRef(
|
|
|
617
570
|
// revisit this if/when that is supported
|
|
618
571
|
// https://developer.chrome.com/blog/vertical-form-controls
|
|
619
572
|
overflow: "hidden auto",
|
|
620
|
-
...
|
|
573
|
+
...l.style
|
|
621
574
|
},
|
|
622
|
-
onScroll:
|
|
623
|
-
const
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
626
|
-
if (
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
629
|
-
const u =
|
|
630
|
-
|
|
575
|
+
onScroll: _(l.onScroll, (m) => {
|
|
576
|
+
const v = m.currentTarget, { contentWrapper: w, shouldExpandOnScrollRef: T } = o;
|
|
577
|
+
if (T?.current && w) {
|
|
578
|
+
const I = Math.abs(i.current - v.scrollTop);
|
|
579
|
+
if (I > 0) {
|
|
580
|
+
const C = window.innerHeight - K * 2, d = parseFloat(w.style.minHeight), h = parseFloat(w.style.height), S = Math.max(d, h);
|
|
581
|
+
if (S < C) {
|
|
582
|
+
const u = S + I, g = Math.min(C, u), z = u - g;
|
|
583
|
+
w.style.height = g + "px", w.style.bottom === "0px" && (v.scrollTop = z > 0 ? z : 0, w.style.justifyContent = "flex-end");
|
|
631
584
|
}
|
|
632
585
|
}
|
|
633
586
|
}
|
|
634
|
-
|
|
587
|
+
i.current = v.scrollTop;
|
|
635
588
|
})
|
|
636
589
|
}
|
|
637
590
|
) })
|
|
638
591
|
] });
|
|
639
592
|
}
|
|
640
593
|
);
|
|
641
|
-
|
|
642
|
-
var
|
|
643
|
-
(
|
|
644
|
-
const { __scopeSelect: e, ...
|
|
645
|
-
return /* @__PURE__ */
|
|
594
|
+
Ke.displayName = ye;
|
|
595
|
+
var ze = "SelectGroup", [Zt, Jt] = ne(ze), Ge = t.forwardRef(
|
|
596
|
+
(r, a) => {
|
|
597
|
+
const { __scopeSelect: e, ...c } = r, l = Ne();
|
|
598
|
+
return /* @__PURE__ */ n(Zt, { scope: e, id: l, children: /* @__PURE__ */ n(L.div, { role: "group", "aria-labelledby": l, ...c, ref: a }) });
|
|
646
599
|
}
|
|
647
600
|
);
|
|
648
|
-
|
|
649
|
-
var
|
|
650
|
-
(
|
|
651
|
-
const { __scopeSelect: e, ...
|
|
652
|
-
return /* @__PURE__ */
|
|
601
|
+
Ge.displayName = ze;
|
|
602
|
+
var je = "SelectLabel", Ye = t.forwardRef(
|
|
603
|
+
(r, a) => {
|
|
604
|
+
const { __scopeSelect: e, ...c } = r, l = Jt(je, e);
|
|
605
|
+
return /* @__PURE__ */ n(L.div, { id: l.id, ...c, ref: a });
|
|
653
606
|
}
|
|
654
607
|
);
|
|
655
|
-
|
|
656
|
-
var pe = "SelectItem", [
|
|
657
|
-
(
|
|
608
|
+
Ye.displayName = je;
|
|
609
|
+
var pe = "SelectItem", [Qt, qe] = ne(pe), $e = t.forwardRef(
|
|
610
|
+
(r, a) => {
|
|
658
611
|
const {
|
|
659
612
|
__scopeSelect: e,
|
|
660
|
-
value:
|
|
661
|
-
disabled:
|
|
613
|
+
value: c,
|
|
614
|
+
disabled: l = !1,
|
|
662
615
|
textValue: p,
|
|
663
|
-
...
|
|
664
|
-
} =
|
|
665
|
-
|
|
666
|
-
(u) =>
|
|
667
|
-
),
|
|
668
|
-
|
|
616
|
+
...o
|
|
617
|
+
} = r, s = $(pe, e), i = X(pe, e), m = s.value === c, [v, w] = t.useState(p ?? ""), [T, I] = t.useState(!1), C = Y(
|
|
618
|
+
a,
|
|
619
|
+
(u) => i.itemRefCallback?.(u, c, l)
|
|
620
|
+
), d = Ne(), h = t.useRef("touch"), S = () => {
|
|
621
|
+
l || (s.onValueChange(c), s.onOpenChange(!1));
|
|
669
622
|
};
|
|
670
|
-
if (
|
|
623
|
+
if (c === "")
|
|
671
624
|
throw new Error(
|
|
672
625
|
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
673
626
|
);
|
|
674
|
-
return /* @__PURE__ */
|
|
675
|
-
|
|
627
|
+
return /* @__PURE__ */ n(
|
|
628
|
+
Qt,
|
|
676
629
|
{
|
|
677
630
|
scope: e,
|
|
678
|
-
value:
|
|
679
|
-
disabled:
|
|
680
|
-
textId:
|
|
631
|
+
value: c,
|
|
632
|
+
disabled: l,
|
|
633
|
+
textId: d,
|
|
681
634
|
isSelected: m,
|
|
682
|
-
onItemTextChange:
|
|
683
|
-
|
|
635
|
+
onItemTextChange: t.useCallback((u) => {
|
|
636
|
+
w((g) => g || (u?.textContent ?? "").trim());
|
|
684
637
|
}, []),
|
|
685
|
-
children: /* @__PURE__ */
|
|
686
|
-
|
|
638
|
+
children: /* @__PURE__ */ n(
|
|
639
|
+
ue.ItemSlot,
|
|
687
640
|
{
|
|
688
641
|
scope: e,
|
|
689
|
-
value:
|
|
690
|
-
disabled:
|
|
691
|
-
textValue:
|
|
692
|
-
children: /* @__PURE__ */
|
|
693
|
-
|
|
642
|
+
value: c,
|
|
643
|
+
disabled: l,
|
|
644
|
+
textValue: v,
|
|
645
|
+
children: /* @__PURE__ */ n(
|
|
646
|
+
L.div,
|
|
694
647
|
{
|
|
695
648
|
role: "option",
|
|
696
|
-
"aria-labelledby":
|
|
697
|
-
"data-highlighted":
|
|
698
|
-
"aria-selected": m &&
|
|
649
|
+
"aria-labelledby": d,
|
|
650
|
+
"data-highlighted": T ? "" : void 0,
|
|
651
|
+
"aria-selected": m && T,
|
|
699
652
|
"data-state": m ? "checked" : "unchecked",
|
|
700
|
-
"aria-disabled":
|
|
701
|
-
"data-disabled":
|
|
702
|
-
tabIndex:
|
|
703
|
-
...
|
|
704
|
-
ref:
|
|
705
|
-
onFocus:
|
|
706
|
-
onBlur:
|
|
707
|
-
onClick:
|
|
708
|
-
|
|
653
|
+
"aria-disabled": l || void 0,
|
|
654
|
+
"data-disabled": l ? "" : void 0,
|
|
655
|
+
tabIndex: l ? void 0 : -1,
|
|
656
|
+
...o,
|
|
657
|
+
ref: C,
|
|
658
|
+
onFocus: _(o.onFocus, () => I(!0)),
|
|
659
|
+
onBlur: _(o.onBlur, () => I(!1)),
|
|
660
|
+
onClick: _(o.onClick, () => {
|
|
661
|
+
h.current !== "mouse" && S();
|
|
709
662
|
}),
|
|
710
|
-
onPointerUp:
|
|
711
|
-
|
|
663
|
+
onPointerUp: _(o.onPointerUp, () => {
|
|
664
|
+
h.current === "mouse" && S();
|
|
712
665
|
}),
|
|
713
|
-
onPointerDown:
|
|
714
|
-
|
|
666
|
+
onPointerDown: _(o.onPointerDown, (u) => {
|
|
667
|
+
h.current = u.pointerType;
|
|
715
668
|
}),
|
|
716
|
-
onPointerMove:
|
|
717
|
-
|
|
669
|
+
onPointerMove: _(o.onPointerMove, (u) => {
|
|
670
|
+
h.current = u.pointerType, l ? i.onItemLeave?.() : h.current === "mouse" && u.currentTarget.focus({ preventScroll: !0 });
|
|
718
671
|
}),
|
|
719
|
-
onPointerLeave:
|
|
720
|
-
u.currentTarget === document.activeElement &&
|
|
672
|
+
onPointerLeave: _(o.onPointerLeave, (u) => {
|
|
673
|
+
u.currentTarget === document.activeElement && i.onItemLeave?.();
|
|
721
674
|
}),
|
|
722
|
-
onKeyDown:
|
|
723
|
-
|
|
675
|
+
onKeyDown: _(o.onKeyDown, (u) => {
|
|
676
|
+
i.searchRef?.current !== "" && u.key === " " || (Ft.includes(u.key) && S(), u.key === " " && u.preventDefault());
|
|
724
677
|
})
|
|
725
678
|
}
|
|
726
679
|
)
|
|
@@ -730,262 +683,262 @@ var pe = "SelectItem", [to, Ze] = re(pe), Je = o.forwardRef(
|
|
|
730
683
|
);
|
|
731
684
|
}
|
|
732
685
|
);
|
|
733
|
-
|
|
734
|
-
var
|
|
735
|
-
(
|
|
736
|
-
const { __scopeSelect: e, className:
|
|
737
|
-
|
|
738
|
-
(
|
|
739
|
-
|
|
740
|
-
(
|
|
741
|
-
),
|
|
742
|
-
() => /* @__PURE__ */
|
|
743
|
-
[
|
|
744
|
-
), { onNativeOptionAdd:
|
|
745
|
-
return
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
|
|
686
|
+
$e.displayName = pe;
|
|
687
|
+
var ie = "SelectItemText", Xe = t.forwardRef(
|
|
688
|
+
(r, a) => {
|
|
689
|
+
const { __scopeSelect: e, className: c, style: l, ...p } = r, o = $(ie, e), s = X(ie, e), i = qe(ie, e), m = zt(ie, e), [v, w] = t.useState(null), T = Y(
|
|
690
|
+
a,
|
|
691
|
+
(S) => w(S),
|
|
692
|
+
i.onItemTextChange,
|
|
693
|
+
(S) => s.itemTextRefCallback?.(S, i.value, i.disabled)
|
|
694
|
+
), I = v?.textContent, C = t.useMemo(
|
|
695
|
+
() => /* @__PURE__ */ n("option", { value: i.value, disabled: i.disabled, children: I }, i.value),
|
|
696
|
+
[i.disabled, i.value, I]
|
|
697
|
+
), { onNativeOptionAdd: d, onNativeOptionRemove: h } = m;
|
|
698
|
+
return q(() => (d(C), () => h(C)), [d, h, C]), /* @__PURE__ */ B(ae, { children: [
|
|
699
|
+
/* @__PURE__ */ n(L.span, { id: i.textId, ...p, ref: T }),
|
|
700
|
+
i.isSelected && o.valueNode && !o.valueNodeHasChildren ? Me.createPortal(p.children, o.valueNode) : null
|
|
748
701
|
] });
|
|
749
702
|
}
|
|
750
703
|
);
|
|
751
|
-
|
|
752
|
-
var
|
|
753
|
-
(
|
|
754
|
-
const { __scopeSelect: e, ...
|
|
755
|
-
return Ze
|
|
704
|
+
Xe.displayName = ie;
|
|
705
|
+
var Ze = "SelectItemIndicator", Je = t.forwardRef(
|
|
706
|
+
(r, a) => {
|
|
707
|
+
const { __scopeSelect: e, ...c } = r;
|
|
708
|
+
return qe(Ze, e).isSelected ? /* @__PURE__ */ n(L.span, { "aria-hidden": !0, ...c, ref: a }) : null;
|
|
756
709
|
}
|
|
757
710
|
);
|
|
758
|
-
|
|
759
|
-
var
|
|
760
|
-
const e =
|
|
761
|
-
return
|
|
711
|
+
Je.displayName = Ze;
|
|
712
|
+
var Ie = "SelectScrollUpButton", Qe = t.forwardRef((r, a) => {
|
|
713
|
+
const e = X(Ie, r.__scopeSelect), c = Pe(Ie, r.__scopeSelect), [l, p] = t.useState(!1), o = Y(a, c.onScrollButtonChange);
|
|
714
|
+
return q(() => {
|
|
762
715
|
if (e.viewport && e.isPositioned) {
|
|
763
|
-
let
|
|
764
|
-
const m =
|
|
716
|
+
let s = function() {
|
|
717
|
+
const m = i.scrollTop > 0;
|
|
765
718
|
p(m);
|
|
766
719
|
};
|
|
767
|
-
const
|
|
768
|
-
return
|
|
720
|
+
const i = e.viewport;
|
|
721
|
+
return s(), i.addEventListener("scroll", s), () => i.removeEventListener("scroll", s);
|
|
769
722
|
}
|
|
770
|
-
}, [e.viewport, e.isPositioned]),
|
|
771
|
-
|
|
723
|
+
}, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ n(
|
|
724
|
+
tt,
|
|
772
725
|
{
|
|
773
|
-
...
|
|
774
|
-
ref:
|
|
726
|
+
...r,
|
|
727
|
+
ref: o,
|
|
775
728
|
onAutoScroll: () => {
|
|
776
|
-
const { viewport:
|
|
777
|
-
|
|
729
|
+
const { viewport: s, selectedItem: i } = e;
|
|
730
|
+
s && i && (s.scrollTop = s.scrollTop - i.offsetHeight);
|
|
778
731
|
}
|
|
779
732
|
}
|
|
780
733
|
) : null;
|
|
781
734
|
});
|
|
782
|
-
|
|
783
|
-
var
|
|
784
|
-
const e =
|
|
785
|
-
return
|
|
735
|
+
Qe.displayName = Ie;
|
|
736
|
+
var be = "SelectScrollDownButton", et = t.forwardRef((r, a) => {
|
|
737
|
+
const e = X(be, r.__scopeSelect), c = Pe(be, r.__scopeSelect), [l, p] = t.useState(!1), o = Y(a, c.onScrollButtonChange);
|
|
738
|
+
return q(() => {
|
|
786
739
|
if (e.viewport && e.isPositioned) {
|
|
787
|
-
let
|
|
788
|
-
const m =
|
|
789
|
-
p(
|
|
740
|
+
let s = function() {
|
|
741
|
+
const m = i.scrollHeight - i.clientHeight, v = Math.ceil(i.scrollTop) < m;
|
|
742
|
+
p(v);
|
|
790
743
|
};
|
|
791
|
-
const
|
|
792
|
-
return
|
|
744
|
+
const i = e.viewport;
|
|
745
|
+
return s(), i.addEventListener("scroll", s), () => i.removeEventListener("scroll", s);
|
|
793
746
|
}
|
|
794
|
-
}, [e.viewport, e.isPositioned]),
|
|
795
|
-
|
|
747
|
+
}, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ n(
|
|
748
|
+
tt,
|
|
796
749
|
{
|
|
797
|
-
...
|
|
798
|
-
ref:
|
|
750
|
+
...r,
|
|
751
|
+
ref: o,
|
|
799
752
|
onAutoScroll: () => {
|
|
800
|
-
const { viewport:
|
|
801
|
-
|
|
753
|
+
const { viewport: s, selectedItem: i } = e;
|
|
754
|
+
s && i && (s.scrollTop = s.scrollTop + i.offsetHeight);
|
|
802
755
|
}
|
|
803
756
|
}
|
|
804
757
|
) : null;
|
|
805
758
|
});
|
|
806
|
-
|
|
807
|
-
var
|
|
808
|
-
const { __scopeSelect: e, onAutoScroll:
|
|
809
|
-
|
|
759
|
+
et.displayName = be;
|
|
760
|
+
var tt = t.forwardRef((r, a) => {
|
|
761
|
+
const { __scopeSelect: e, onAutoScroll: c, ...l } = r, p = X("SelectScrollButton", e), o = t.useRef(null), s = me(e), i = t.useCallback(() => {
|
|
762
|
+
o.current !== null && (window.clearInterval(o.current), o.current = null);
|
|
810
763
|
}, []);
|
|
811
|
-
return
|
|
812
|
-
|
|
813
|
-
}, [
|
|
814
|
-
|
|
764
|
+
return t.useEffect(() => () => i(), [i]), q(() => {
|
|
765
|
+
s().find((v) => v.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
766
|
+
}, [s]), /* @__PURE__ */ n(
|
|
767
|
+
L.div,
|
|
815
768
|
{
|
|
816
769
|
"aria-hidden": !0,
|
|
817
|
-
...
|
|
818
|
-
ref:
|
|
819
|
-
style: { flexShrink: 0, ...
|
|
820
|
-
onPointerDown:
|
|
821
|
-
|
|
770
|
+
...l,
|
|
771
|
+
ref: a,
|
|
772
|
+
style: { flexShrink: 0, ...l.style },
|
|
773
|
+
onPointerDown: _(l.onPointerDown, () => {
|
|
774
|
+
o.current === null && (o.current = window.setInterval(c, 50));
|
|
822
775
|
}),
|
|
823
|
-
onPointerMove:
|
|
824
|
-
p.onItemLeave?.(),
|
|
776
|
+
onPointerMove: _(l.onPointerMove, () => {
|
|
777
|
+
p.onItemLeave?.(), o.current === null && (o.current = window.setInterval(c, 50));
|
|
825
778
|
}),
|
|
826
|
-
onPointerLeave:
|
|
827
|
-
|
|
779
|
+
onPointerLeave: _(l.onPointerLeave, () => {
|
|
780
|
+
i();
|
|
828
781
|
})
|
|
829
782
|
}
|
|
830
783
|
);
|
|
831
|
-
}),
|
|
832
|
-
(
|
|
833
|
-
const { __scopeSelect: e, ...
|
|
834
|
-
return /* @__PURE__ */
|
|
784
|
+
}), eo = "SelectSeparator", ot = t.forwardRef(
|
|
785
|
+
(r, a) => {
|
|
786
|
+
const { __scopeSelect: e, ...c } = r;
|
|
787
|
+
return /* @__PURE__ */ n(L.div, { "aria-hidden": !0, ...c, ref: a });
|
|
835
788
|
}
|
|
836
789
|
);
|
|
837
|
-
|
|
838
|
-
var
|
|
839
|
-
(
|
|
840
|
-
const { __scopeSelect: e, ...
|
|
841
|
-
return p.open &&
|
|
790
|
+
ot.displayName = eo;
|
|
791
|
+
var Te = "SelectArrow", to = t.forwardRef(
|
|
792
|
+
(r, a) => {
|
|
793
|
+
const { __scopeSelect: e, ...c } = r, l = fe(e), p = $(Te, e), o = X(Te, e);
|
|
794
|
+
return p.open && o.position === "popper" ? /* @__PURE__ */ n(Tt, { ...l, ...c, ref: a }) : null;
|
|
842
795
|
}
|
|
843
796
|
);
|
|
844
|
-
|
|
845
|
-
var
|
|
846
|
-
({ __scopeSelect:
|
|
847
|
-
const
|
|
848
|
-
return
|
|
849
|
-
const
|
|
850
|
-
if (!
|
|
851
|
-
const
|
|
852
|
-
|
|
797
|
+
to.displayName = Te;
|
|
798
|
+
var oo = "SelectBubbleInput", nt = t.forwardRef(
|
|
799
|
+
({ __scopeSelect: r, value: a, ...e }, c) => {
|
|
800
|
+
const l = t.useRef(null), p = Y(c, l), o = gt(a);
|
|
801
|
+
return t.useEffect(() => {
|
|
802
|
+
const s = l.current;
|
|
803
|
+
if (!s) return;
|
|
804
|
+
const i = window.HTMLSelectElement.prototype, v = Object.getOwnPropertyDescriptor(
|
|
805
|
+
i,
|
|
853
806
|
"value"
|
|
854
807
|
).set;
|
|
855
|
-
if (
|
|
856
|
-
const
|
|
857
|
-
|
|
808
|
+
if (o !== a && v) {
|
|
809
|
+
const w = new Event("change", { bubbles: !0 });
|
|
810
|
+
v.call(s, a), s.dispatchEvent(w);
|
|
858
811
|
}
|
|
859
|
-
}, [
|
|
860
|
-
|
|
812
|
+
}, [o, a]), /* @__PURE__ */ n(
|
|
813
|
+
L.select,
|
|
861
814
|
{
|
|
862
815
|
...e,
|
|
863
|
-
style: { ...
|
|
816
|
+
style: { ...Nt, ...e.style },
|
|
864
817
|
ref: p,
|
|
865
|
-
defaultValue:
|
|
818
|
+
defaultValue: a
|
|
866
819
|
}
|
|
867
820
|
);
|
|
868
821
|
}
|
|
869
822
|
);
|
|
870
|
-
|
|
871
|
-
function
|
|
872
|
-
return
|
|
823
|
+
nt.displayName = oo;
|
|
824
|
+
function rt(r) {
|
|
825
|
+
return r === "" || r === void 0;
|
|
873
826
|
}
|
|
874
|
-
function
|
|
875
|
-
const
|
|
876
|
-
(
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
e.current = m, window.clearTimeout(
|
|
880
|
-
})(
|
|
827
|
+
function st(r) {
|
|
828
|
+
const a = ut(r), e = t.useRef(""), c = t.useRef(0), l = t.useCallback(
|
|
829
|
+
(o) => {
|
|
830
|
+
const s = e.current + o;
|
|
831
|
+
a(s), (function i(m) {
|
|
832
|
+
e.current = m, window.clearTimeout(c.current), m !== "" && (c.current = window.setTimeout(() => i(""), 1e3));
|
|
833
|
+
})(s);
|
|
881
834
|
},
|
|
882
|
-
[
|
|
883
|
-
), p =
|
|
884
|
-
e.current = "", window.clearTimeout(
|
|
835
|
+
[a]
|
|
836
|
+
), p = t.useCallback(() => {
|
|
837
|
+
e.current = "", window.clearTimeout(c.current);
|
|
885
838
|
}, []);
|
|
886
|
-
return
|
|
839
|
+
return t.useEffect(() => () => window.clearTimeout(c.current), []), [e, l, p];
|
|
887
840
|
}
|
|
888
|
-
function
|
|
889
|
-
const
|
|
890
|
-
let
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
(m) => m.textValue.toLowerCase().startsWith(
|
|
841
|
+
function it(r, a, e) {
|
|
842
|
+
const l = a.length > 1 && Array.from(a).every((m) => m === a[0]) ? a[0] : a, p = e ? r.indexOf(e) : -1;
|
|
843
|
+
let o = no(r, Math.max(p, 0));
|
|
844
|
+
l.length === 1 && (o = o.filter((m) => m !== e));
|
|
845
|
+
const i = o.find(
|
|
846
|
+
(m) => m.textValue.toLowerCase().startsWith(l.toLowerCase())
|
|
894
847
|
);
|
|
895
|
-
return
|
|
848
|
+
return i !== e ? i : void 0;
|
|
896
849
|
}
|
|
897
|
-
function
|
|
898
|
-
return
|
|
850
|
+
function no(r, a) {
|
|
851
|
+
return r.map((e, c) => r[(a + c) % r.length]);
|
|
899
852
|
}
|
|
900
|
-
var
|
|
901
|
-
const
|
|
853
|
+
var ro = Ae, so = Le, io = Ve, ao = Be, lo = He, co = Ke, po = Ge, uo = Ye, mo = $e, fo = Xe, ho = Je, go = Qe, vo = et, _e = ot;
|
|
854
|
+
const So = dt(
|
|
902
855
|
({
|
|
903
|
-
align:
|
|
904
|
-
alignOffset:
|
|
856
|
+
align: r = "start",
|
|
857
|
+
alignOffset: a = 0,
|
|
905
858
|
className: e,
|
|
906
|
-
collisionPadding:
|
|
907
|
-
defaultValue:
|
|
859
|
+
collisionPadding: c = 10,
|
|
860
|
+
defaultValue: l,
|
|
908
861
|
emptyMessage: p = "No options found",
|
|
909
|
-
errorMessage:
|
|
910
|
-
id:
|
|
911
|
-
label:
|
|
862
|
+
errorMessage: o,
|
|
863
|
+
id: s,
|
|
864
|
+
label: i,
|
|
912
865
|
loadingMessage: m = "Loading…",
|
|
913
|
-
name:
|
|
914
|
-
onChange:
|
|
915
|
-
options:
|
|
916
|
-
placeholder:
|
|
917
|
-
position:
|
|
918
|
-
side:
|
|
919
|
-
sideOffset:
|
|
920
|
-
state:
|
|
866
|
+
name: v,
|
|
867
|
+
onChange: w,
|
|
868
|
+
options: T = [],
|
|
869
|
+
placeholder: I = "Select an option",
|
|
870
|
+
position: C = "popper",
|
|
871
|
+
side: d = "bottom",
|
|
872
|
+
sideOffset: h = 4,
|
|
873
|
+
state: S = "default",
|
|
921
874
|
value: u,
|
|
922
875
|
"aria-label": g,
|
|
923
|
-
"aria-describedby":
|
|
924
|
-
...
|
|
925
|
-
},
|
|
926
|
-
const
|
|
927
|
-
if (
|
|
928
|
-
return /* @__PURE__ */
|
|
929
|
-
if (
|
|
930
|
-
return /* @__PURE__ */
|
|
931
|
-
const
|
|
932
|
-
const
|
|
933
|
-
return /* @__PURE__ */
|
|
934
|
-
|
|
876
|
+
"aria-describedby": z,
|
|
877
|
+
...M
|
|
878
|
+
}, Z) => {
|
|
879
|
+
const P = Pt(s, v), O = _t(P), { isDisabled: H, isLoading: G, isInvalid: k } = Rt(M.disabled, S), F = Et(S, k, O, z), { groups: U, ungrouped: V } = Mt(T), W = () => {
|
|
880
|
+
if (G)
|
|
881
|
+
return /* @__PURE__ */ n(kt, { message: m });
|
|
882
|
+
if (T.length === 0)
|
|
883
|
+
return /* @__PURE__ */ n(Vt, { message: p });
|
|
884
|
+
const E = (b) => {
|
|
885
|
+
const A = u === b.value;
|
|
886
|
+
return /* @__PURE__ */ B(
|
|
887
|
+
mo,
|
|
935
888
|
{
|
|
936
|
-
value:
|
|
937
|
-
disabled:
|
|
938
|
-
className:
|
|
939
|
-
|
|
889
|
+
value: b.value,
|
|
890
|
+
disabled: b.disabled,
|
|
891
|
+
className: de(
|
|
892
|
+
Bt(A, !1, b.disabled),
|
|
940
893
|
"relative flex w-full cursor-pointer items-center"
|
|
941
894
|
),
|
|
942
895
|
children: [
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ n(fo, { className: "block truncate", children: b.label }),
|
|
897
|
+
/* @__PURE__ */ n(ho, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "absolute right-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ n(at, { size: 16 }) }) })
|
|
945
898
|
]
|
|
946
899
|
},
|
|
947
|
-
|
|
900
|
+
b.value
|
|
948
901
|
);
|
|
949
902
|
};
|
|
950
|
-
return /* @__PURE__ */
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
Object.keys(
|
|
903
|
+
return /* @__PURE__ */ B(ae, { children: [
|
|
904
|
+
V.length > 0 && /* @__PURE__ */ B(ae, { children: [
|
|
905
|
+
V.map(E),
|
|
906
|
+
Object.keys(U).length > 0 && /* @__PURE__ */ n(_e, { className: "bg-border-secondary -mx-1 my-1 h-px" })
|
|
954
907
|
] }),
|
|
955
|
-
Object.entries(
|
|
956
|
-
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
|
|
959
|
-
] },
|
|
908
|
+
Object.entries(U).map(([b, A], j) => /* @__PURE__ */ B(po, { children: [
|
|
909
|
+
j > 0 && /* @__PURE__ */ n(_e, { className: "bg-border-secondary -mx-1 my-1 h-px" }),
|
|
910
|
+
/* @__PURE__ */ n(uo, { className: "text-text-primary px-2 py-1.5 text-base font-semibold", children: b }),
|
|
911
|
+
A.map((re) => E(re))
|
|
912
|
+
] }, b))
|
|
960
913
|
] });
|
|
961
914
|
};
|
|
962
|
-
return /* @__PURE__ */
|
|
963
|
-
|
|
964
|
-
/* @__PURE__ */
|
|
965
|
-
|
|
915
|
+
return /* @__PURE__ */ B("div", { className: "w-full", "data-testid": "select-root", children: [
|
|
916
|
+
i && /* @__PURE__ */ n(ct, { htmlFor: P, className: de("text-text-primary mb-4 block", H && "text-text-secondary"), children: i }),
|
|
917
|
+
/* @__PURE__ */ B(
|
|
918
|
+
ro,
|
|
966
919
|
{
|
|
967
920
|
value: u,
|
|
968
|
-
defaultValue:
|
|
969
|
-
onValueChange:
|
|
970
|
-
disabled:
|
|
971
|
-
name:
|
|
972
|
-
required:
|
|
921
|
+
defaultValue: l,
|
|
922
|
+
onValueChange: w,
|
|
923
|
+
disabled: H,
|
|
924
|
+
name: v,
|
|
925
|
+
required: M.required,
|
|
973
926
|
children: [
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
|
|
927
|
+
/* @__PURE__ */ n(
|
|
928
|
+
so,
|
|
976
929
|
{
|
|
977
|
-
ref:
|
|
978
|
-
id:
|
|
979
|
-
className:
|
|
980
|
-
"aria-label": g ||
|
|
981
|
-
"data-state":
|
|
982
|
-
style:
|
|
983
|
-
...
|
|
984
|
-
...
|
|
930
|
+
ref: Z,
|
|
931
|
+
id: P,
|
|
932
|
+
className: de(Dt(S, !1), At(S), e),
|
|
933
|
+
"aria-label": g || i,
|
|
934
|
+
"data-state": S,
|
|
935
|
+
style: Ot(),
|
|
936
|
+
...F,
|
|
937
|
+
...M,
|
|
985
938
|
asChild: !0,
|
|
986
|
-
children: /* @__PURE__ */
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ B("button", { type: "button", children: [
|
|
940
|
+
/* @__PURE__ */ n(io, { placeholder: I, className: "block truncate" }),
|
|
941
|
+
/* @__PURE__ */ n(ao, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex items-center", children: G ? /* @__PURE__ */ n(lt, { size: 20 }) : /* @__PURE__ */ n(
|
|
989
942
|
xe,
|
|
990
943
|
{
|
|
991
944
|
className: "transition-transform duration-200 data-[state=open]:rotate-180",
|
|
@@ -995,20 +948,20 @@ const wo = mt(
|
|
|
995
948
|
] })
|
|
996
949
|
}
|
|
997
950
|
),
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
|
|
951
|
+
/* @__PURE__ */ n(
|
|
952
|
+
lo,
|
|
1000
953
|
{
|
|
1001
|
-
position:
|
|
1002
|
-
side:
|
|
1003
|
-
align:
|
|
1004
|
-
sideOffset:
|
|
1005
|
-
alignOffset:
|
|
1006
|
-
collisionPadding:
|
|
954
|
+
position: C,
|
|
955
|
+
side: d,
|
|
956
|
+
align: r,
|
|
957
|
+
sideOffset: h,
|
|
958
|
+
alignOffset: a,
|
|
959
|
+
collisionPadding: c,
|
|
1007
960
|
asChild: !0,
|
|
1008
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ B(
|
|
1009
962
|
"div",
|
|
1010
963
|
{
|
|
1011
|
-
className:
|
|
964
|
+
className: de(
|
|
1012
965
|
"border-input-border bg-input-bg z-50 rounded-lg border shadow-md",
|
|
1013
966
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1014
967
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
@@ -1025,9 +978,9 @@ const wo = mt(
|
|
|
1025
978
|
maxHeight: "var(--radix-select-content-available-height)"
|
|
1026
979
|
},
|
|
1027
980
|
children: [
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ n(go, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ n(xe, { className: "rotate-180", size: 18 }) }),
|
|
982
|
+
/* @__PURE__ */ n(co, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "max-h-96 p-1", style: { position: "relative", overflow: "hidden auto" }, children: W() }) }),
|
|
983
|
+
/* @__PURE__ */ n(vo, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ n(xe, { size: 18 }) })
|
|
1031
984
|
]
|
|
1032
985
|
}
|
|
1033
986
|
)
|
|
@@ -1036,11 +989,11 @@ const wo = mt(
|
|
|
1036
989
|
]
|
|
1037
990
|
}
|
|
1038
991
|
),
|
|
1039
|
-
|
|
992
|
+
k && o && /* @__PURE__ */ n(Lt, { id: O, message: o })
|
|
1040
993
|
] });
|
|
1041
994
|
}
|
|
1042
995
|
);
|
|
1043
|
-
|
|
996
|
+
So.displayName = "Select";
|
|
1044
997
|
export {
|
|
1045
|
-
|
|
998
|
+
So as Select
|
|
1046
999
|
};
|