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