@still-forest/canopy 0.38.1 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/Textarea-BQ42uliX.js +3155 -0
- package/dist/forms.d.ts +27 -1
- package/dist/forms.js +12 -10
- package/dist/index.d.ts +26 -1
- package/dist/index.js +28 -26
- package/package.json +7 -5
- package/dist/chunks/Textarea-DslZ0KXP.js +0 -2478
|
@@ -0,0 +1,3155 @@
|
|
|
1
|
+
import { j as a } from "./jsx-runtime-B0GD0xBr.js";
|
|
2
|
+
import { c as ee, u as V, B as Te, h as nn, i as on, j as Ie, g as an } from "./calendar-C-nHBQQ8.js";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import { useState as Me, useEffect as St, useRef as sn, useMemo as ln } from "react";
|
|
5
|
+
import { F as ne, G as cn } from "./Layout-CvVv48kM.js";
|
|
6
|
+
import { T as Ae } from "./Heading-DjVutKs1.js";
|
|
7
|
+
import { L as dn } from "./Loader-B_h7e46-.js";
|
|
8
|
+
import { d as ve, j as dt, e as te, f as N, h as _, u as De, c as pe, w as yt, g as Ct, x as Oe, l as Rt, m as It, n as kt, o as Et, p as un, A as pn, i as oe, q as fn, V as mn, y as hn, z as vn, B as xn, F as gn, s as bn, t as wn, r as Sn, k as jt, R as yn, P as Cn, O as Rn, C as In } from "./index-CA-6Q-v_.js";
|
|
9
|
+
import { c as A } from "./index-CRiPKpXj.js";
|
|
10
|
+
import * as Nt from "react-dom";
|
|
11
|
+
/**
|
|
12
|
+
* @license lucide-react v0.544.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
const kn = [
|
|
18
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
19
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
20
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
21
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
22
|
+
], En = ee("calendar", kn);
|
|
23
|
+
/**
|
|
24
|
+
* @license lucide-react v0.544.0 - ISC
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the ISC license.
|
|
27
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
const jn = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ut = ee("check", jn);
|
|
30
|
+
/**
|
|
31
|
+
* @license lucide-react v0.544.0 - ISC
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the ISC license.
|
|
34
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
const Nn = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], _n = ee("chevron-up", Nn);
|
|
37
|
+
/**
|
|
38
|
+
* @license lucide-react v0.544.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/
|
|
43
|
+
const Pn = [
|
|
44
|
+
["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
|
|
45
|
+
["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
|
|
46
|
+
], Tn = ee("chevrons-up-down", Pn);
|
|
47
|
+
/**
|
|
48
|
+
* @license lucide-react v0.544.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/
|
|
53
|
+
const Mn = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], An = ee("circle", Mn);
|
|
54
|
+
/**
|
|
55
|
+
* @license lucide-react v0.544.0 - ISC
|
|
56
|
+
*
|
|
57
|
+
* This source code is licensed under the ISC license.
|
|
58
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
+
*/
|
|
60
|
+
const Dn = [
|
|
61
|
+
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
|
|
62
|
+
[
|
|
63
|
+
"path",
|
|
64
|
+
{
|
|
65
|
+
d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
|
|
66
|
+
key: "116196"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
["path", { d: "m9 14 2 2 4-4", key: "df797q" }]
|
|
70
|
+
], On = ee("clipboard-check", Dn);
|
|
71
|
+
/**
|
|
72
|
+
* @license lucide-react v0.544.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/
|
|
77
|
+
const Fn = [
|
|
78
|
+
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
|
|
79
|
+
[
|
|
80
|
+
"path",
|
|
81
|
+
{
|
|
82
|
+
d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
|
|
83
|
+
key: "116196"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
], Ln = ee("clipboard", Fn);
|
|
87
|
+
/**
|
|
88
|
+
* @license lucide-react v0.544.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/
|
|
93
|
+
const Bn = [
|
|
94
|
+
[
|
|
95
|
+
"path",
|
|
96
|
+
{
|
|
97
|
+
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
98
|
+
key: "1c8476"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
102
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
103
|
+
], $n = ee("save", Bn);
|
|
104
|
+
/**
|
|
105
|
+
* @license lucide-react v0.544.0 - ISC
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the ISC license.
|
|
108
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/
|
|
110
|
+
const Vn = [
|
|
111
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
112
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
113
|
+
], Kn = ee("search", Vn);
|
|
114
|
+
/**
|
|
115
|
+
* @license lucide-react v0.544.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/
|
|
120
|
+
const Hn = [
|
|
121
|
+
[
|
|
122
|
+
"path",
|
|
123
|
+
{
|
|
124
|
+
d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
|
|
125
|
+
key: "1ffxy3"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
|
|
129
|
+
], qe = ee("send", Hn);
|
|
130
|
+
/**
|
|
131
|
+
* @license lucide-react v0.544.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/
|
|
136
|
+
const Un = [
|
|
137
|
+
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
138
|
+
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
139
|
+
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
140
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
141
|
+
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
142
|
+
], Gn = ee("trash-2", Un);
|
|
143
|
+
var Ye = "rovingFocusGroup.onEntryFocus", zn = { bubbles: !1, cancelable: !0 }, ke = "RovingFocusGroup", [Qe, _t, Wn] = dt(ke), [qn, Pt] = ve(
|
|
144
|
+
ke,
|
|
145
|
+
[Wn]
|
|
146
|
+
), [Yn, Xn] = qn(ke), Tt = l.forwardRef(
|
|
147
|
+
(e, r) => /* @__PURE__ */ a.jsx(Qe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a.jsx(Qe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a.jsx(Zn, { ...e, ref: r }) }) })
|
|
148
|
+
);
|
|
149
|
+
Tt.displayName = ke;
|
|
150
|
+
var Zn = l.forwardRef((e, r) => {
|
|
151
|
+
const {
|
|
152
|
+
__scopeRovingFocusGroup: t,
|
|
153
|
+
orientation: o,
|
|
154
|
+
loop: n = !1,
|
|
155
|
+
dir: i,
|
|
156
|
+
currentTabStopId: s,
|
|
157
|
+
defaultCurrentTabStopId: c,
|
|
158
|
+
onCurrentTabStopIdChange: d,
|
|
159
|
+
onEntryFocus: u,
|
|
160
|
+
preventScrollOnEntryFocus: p = !1,
|
|
161
|
+
...f
|
|
162
|
+
} = e, x = l.useRef(null), g = V(r, x), w = De(i), [m, v] = pe({
|
|
163
|
+
prop: s,
|
|
164
|
+
defaultProp: c ?? null,
|
|
165
|
+
onChange: d,
|
|
166
|
+
caller: ke
|
|
167
|
+
}), [b, S] = l.useState(!1), y = yt(u), I = _t(t), D = l.useRef(!1), [P, j] = l.useState(0);
|
|
168
|
+
return l.useEffect(() => {
|
|
169
|
+
const L = x.current;
|
|
170
|
+
if (L)
|
|
171
|
+
return L.addEventListener(Ye, y), () => L.removeEventListener(Ye, y);
|
|
172
|
+
}, [y]), /* @__PURE__ */ a.jsx(
|
|
173
|
+
Yn,
|
|
174
|
+
{
|
|
175
|
+
scope: t,
|
|
176
|
+
orientation: o,
|
|
177
|
+
dir: w,
|
|
178
|
+
loop: n,
|
|
179
|
+
currentTabStopId: m,
|
|
180
|
+
onItemFocus: l.useCallback(
|
|
181
|
+
(L) => v(L),
|
|
182
|
+
[v]
|
|
183
|
+
),
|
|
184
|
+
onItemShiftTab: l.useCallback(() => S(!0), []),
|
|
185
|
+
onFocusableItemAdd: l.useCallback(
|
|
186
|
+
() => j((L) => L + 1),
|
|
187
|
+
[]
|
|
188
|
+
),
|
|
189
|
+
onFocusableItemRemove: l.useCallback(
|
|
190
|
+
() => j((L) => L - 1),
|
|
191
|
+
[]
|
|
192
|
+
),
|
|
193
|
+
children: /* @__PURE__ */ a.jsx(
|
|
194
|
+
N.div,
|
|
195
|
+
{
|
|
196
|
+
tabIndex: b || P === 0 ? -1 : 0,
|
|
197
|
+
"data-orientation": o,
|
|
198
|
+
...f,
|
|
199
|
+
ref: g,
|
|
200
|
+
style: { outline: "none", ...e.style },
|
|
201
|
+
onMouseDown: _(e.onMouseDown, () => {
|
|
202
|
+
D.current = !0;
|
|
203
|
+
}),
|
|
204
|
+
onFocus: _(e.onFocus, (L) => {
|
|
205
|
+
const Z = !D.current;
|
|
206
|
+
if (L.target === L.currentTarget && Z && !b) {
|
|
207
|
+
const z = new CustomEvent(Ye, zn);
|
|
208
|
+
if (L.currentTarget.dispatchEvent(z), !z.defaultPrevented) {
|
|
209
|
+
const O = I().filter((F) => F.focusable), K = O.find((F) => F.active), X = O.find((F) => F.id === m), U = [K, X, ...O].filter(
|
|
210
|
+
Boolean
|
|
211
|
+
).map((F) => F.ref.current);
|
|
212
|
+
Dt(U, p);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
D.current = !1;
|
|
216
|
+
}),
|
|
217
|
+
onBlur: _(e.onBlur, () => S(!1))
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
}), Mt = "RovingFocusGroupItem", At = l.forwardRef(
|
|
223
|
+
(e, r) => {
|
|
224
|
+
const {
|
|
225
|
+
__scopeRovingFocusGroup: t,
|
|
226
|
+
focusable: o = !0,
|
|
227
|
+
active: n = !1,
|
|
228
|
+
tabStopId: i,
|
|
229
|
+
children: s,
|
|
230
|
+
...c
|
|
231
|
+
} = e, d = te(), u = i || d, p = Xn(Mt, t), f = p.currentTabStopId === u, x = _t(t), { onFocusableItemAdd: g, onFocusableItemRemove: w, currentTabStopId: m } = p;
|
|
232
|
+
return l.useEffect(() => {
|
|
233
|
+
if (o)
|
|
234
|
+
return g(), () => w();
|
|
235
|
+
}, [o, g, w]), /* @__PURE__ */ a.jsx(
|
|
236
|
+
Qe.ItemSlot,
|
|
237
|
+
{
|
|
238
|
+
scope: t,
|
|
239
|
+
id: u,
|
|
240
|
+
focusable: o,
|
|
241
|
+
active: n,
|
|
242
|
+
children: /* @__PURE__ */ a.jsx(
|
|
243
|
+
N.span,
|
|
244
|
+
{
|
|
245
|
+
tabIndex: f ? 0 : -1,
|
|
246
|
+
"data-orientation": p.orientation,
|
|
247
|
+
...c,
|
|
248
|
+
ref: r,
|
|
249
|
+
onMouseDown: _(e.onMouseDown, (v) => {
|
|
250
|
+
o ? p.onItemFocus(u) : v.preventDefault();
|
|
251
|
+
}),
|
|
252
|
+
onFocus: _(e.onFocus, () => p.onItemFocus(u)),
|
|
253
|
+
onKeyDown: _(e.onKeyDown, (v) => {
|
|
254
|
+
if (v.key === "Tab" && v.shiftKey) {
|
|
255
|
+
p.onItemShiftTab();
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (v.target !== v.currentTarget) return;
|
|
259
|
+
const b = eo(v, p.orientation, p.dir);
|
|
260
|
+
if (b !== void 0) {
|
|
261
|
+
if (v.metaKey || v.ctrlKey || v.altKey || v.shiftKey) return;
|
|
262
|
+
v.preventDefault();
|
|
263
|
+
let y = x().filter((I) => I.focusable).map((I) => I.ref.current);
|
|
264
|
+
if (b === "last") y.reverse();
|
|
265
|
+
else if (b === "prev" || b === "next") {
|
|
266
|
+
b === "prev" && y.reverse();
|
|
267
|
+
const I = y.indexOf(v.currentTarget);
|
|
268
|
+
y = p.loop ? to(y, I + 1) : y.slice(I + 1);
|
|
269
|
+
}
|
|
270
|
+
setTimeout(() => Dt(y));
|
|
271
|
+
}
|
|
272
|
+
}),
|
|
273
|
+
children: typeof s == "function" ? s({ isCurrentTabStop: f, hasTabStop: m != null }) : s
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
At.displayName = Mt;
|
|
281
|
+
var Jn = {
|
|
282
|
+
ArrowLeft: "prev",
|
|
283
|
+
ArrowUp: "prev",
|
|
284
|
+
ArrowRight: "next",
|
|
285
|
+
ArrowDown: "next",
|
|
286
|
+
PageUp: "first",
|
|
287
|
+
Home: "first",
|
|
288
|
+
PageDown: "last",
|
|
289
|
+
End: "last"
|
|
290
|
+
};
|
|
291
|
+
function Qn(e, r) {
|
|
292
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
293
|
+
}
|
|
294
|
+
function eo(e, r, t) {
|
|
295
|
+
const o = Qn(e.key, t);
|
|
296
|
+
if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
297
|
+
return Jn[o];
|
|
298
|
+
}
|
|
299
|
+
function Dt(e, r = !1) {
|
|
300
|
+
const t = document.activeElement;
|
|
301
|
+
for (const o of e)
|
|
302
|
+
if (o === t || (o.focus({ preventScroll: r }), document.activeElement !== t)) return;
|
|
303
|
+
}
|
|
304
|
+
function to(e, r) {
|
|
305
|
+
return e.map((t, o) => e[(r + o) % e.length]);
|
|
306
|
+
}
|
|
307
|
+
var ro = Tt, no = At;
|
|
308
|
+
const Ns = ({ disabled: e = !1, handleDelete: r, ...t }) => /* @__PURE__ */ a.jsx(
|
|
309
|
+
Te,
|
|
310
|
+
{
|
|
311
|
+
disabled: e,
|
|
312
|
+
icon: /* @__PURE__ */ a.jsx(Gn, {}),
|
|
313
|
+
onClick: r,
|
|
314
|
+
variant: "outline",
|
|
315
|
+
...t,
|
|
316
|
+
className: "border-destructive text-destructive hover:bg-destructive hover:text-white",
|
|
317
|
+
children: "Delete"
|
|
318
|
+
}
|
|
319
|
+
), xt = {
|
|
320
|
+
default: { label: "Submit", submittingLabel: "Submitting", IconComponent: qe },
|
|
321
|
+
submit: { label: "Submit", submittingLabel: "Submitting", IconComponent: qe },
|
|
322
|
+
save: { label: "Save", submittingLabel: "Saving", IconComponent: $n },
|
|
323
|
+
send: { label: "Send", submittingLabel: "Sending", IconComponent: qe }
|
|
324
|
+
}, _s = ({
|
|
325
|
+
submitting: e = !1,
|
|
326
|
+
disabled: r = !1,
|
|
327
|
+
submittingIcon: t,
|
|
328
|
+
action: o = "default",
|
|
329
|
+
label: n,
|
|
330
|
+
submittingLabel: i,
|
|
331
|
+
icon: s,
|
|
332
|
+
noIcon: c = !1,
|
|
333
|
+
...d
|
|
334
|
+
}) => {
|
|
335
|
+
if (!xt[o])
|
|
336
|
+
throw new Error(`Invalid action: ${o}`);
|
|
337
|
+
const u = xt[o], p = n || u.label, f = i || u.submittingLabel, x = s || u.IconComponent, g = e ? /* @__PURE__ */ a.jsx(dn, { icon: t }) : /* @__PURE__ */ a.jsx(x, {});
|
|
338
|
+
return /* @__PURE__ */ a.jsx(
|
|
339
|
+
Te,
|
|
340
|
+
{
|
|
341
|
+
disabled: r || e,
|
|
342
|
+
icon: c ? void 0 : g,
|
|
343
|
+
type: "submit",
|
|
344
|
+
variant: "primary",
|
|
345
|
+
...d,
|
|
346
|
+
children: e ? f : p
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
};
|
|
350
|
+
function Ee(e) {
|
|
351
|
+
const r = l.useRef({ value: e, previous: e });
|
|
352
|
+
return l.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
|
|
353
|
+
}
|
|
354
|
+
var Fe = "Checkbox", [oo, Ps] = ve(Fe), [ao, pt] = oo(Fe);
|
|
355
|
+
function so(e) {
|
|
356
|
+
const {
|
|
357
|
+
__scopeCheckbox: r,
|
|
358
|
+
checked: t,
|
|
359
|
+
children: o,
|
|
360
|
+
defaultChecked: n,
|
|
361
|
+
disabled: i,
|
|
362
|
+
form: s,
|
|
363
|
+
name: c,
|
|
364
|
+
onCheckedChange: d,
|
|
365
|
+
required: u,
|
|
366
|
+
value: p = "on",
|
|
367
|
+
// @ts-expect-error
|
|
368
|
+
internal_do_not_use_render: f
|
|
369
|
+
} = e, [x, g] = pe({
|
|
370
|
+
prop: t,
|
|
371
|
+
defaultProp: n ?? !1,
|
|
372
|
+
onChange: d,
|
|
373
|
+
caller: Fe
|
|
374
|
+
}), [w, m] = l.useState(null), [v, b] = l.useState(null), S = l.useRef(!1), y = w ? !!s || !!w.closest("form") : (
|
|
375
|
+
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
376
|
+
!0
|
|
377
|
+
), I = {
|
|
378
|
+
checked: x,
|
|
379
|
+
disabled: i,
|
|
380
|
+
setChecked: g,
|
|
381
|
+
control: w,
|
|
382
|
+
setControl: m,
|
|
383
|
+
name: c,
|
|
384
|
+
form: s,
|
|
385
|
+
value: p,
|
|
386
|
+
hasConsumerStoppedPropagationRef: S,
|
|
387
|
+
required: u,
|
|
388
|
+
defaultChecked: re(n) ? !1 : n,
|
|
389
|
+
isFormControl: y,
|
|
390
|
+
bubbleInput: v,
|
|
391
|
+
setBubbleInput: b
|
|
392
|
+
};
|
|
393
|
+
return /* @__PURE__ */ a.jsx(
|
|
394
|
+
ao,
|
|
395
|
+
{
|
|
396
|
+
scope: r,
|
|
397
|
+
...I,
|
|
398
|
+
children: io(f) ? f(I) : o
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
var Ot = "CheckboxTrigger", Ft = l.forwardRef(
|
|
403
|
+
({ __scopeCheckbox: e, onKeyDown: r, onClick: t, ...o }, n) => {
|
|
404
|
+
const {
|
|
405
|
+
control: i,
|
|
406
|
+
value: s,
|
|
407
|
+
disabled: c,
|
|
408
|
+
checked: d,
|
|
409
|
+
required: u,
|
|
410
|
+
setControl: p,
|
|
411
|
+
setChecked: f,
|
|
412
|
+
hasConsumerStoppedPropagationRef: x,
|
|
413
|
+
isFormControl: g,
|
|
414
|
+
bubbleInput: w
|
|
415
|
+
} = pt(Ot, e), m = V(n, p), v = l.useRef(d);
|
|
416
|
+
return l.useEffect(() => {
|
|
417
|
+
const b = i?.form;
|
|
418
|
+
if (b) {
|
|
419
|
+
const S = () => f(v.current);
|
|
420
|
+
return b.addEventListener("reset", S), () => b.removeEventListener("reset", S);
|
|
421
|
+
}
|
|
422
|
+
}, [i, f]), /* @__PURE__ */ a.jsx(
|
|
423
|
+
N.button,
|
|
424
|
+
{
|
|
425
|
+
type: "button",
|
|
426
|
+
role: "checkbox",
|
|
427
|
+
"aria-checked": re(d) ? "mixed" : d,
|
|
428
|
+
"aria-required": u,
|
|
429
|
+
"data-state": Ht(d),
|
|
430
|
+
"data-disabled": c ? "" : void 0,
|
|
431
|
+
disabled: c,
|
|
432
|
+
value: s,
|
|
433
|
+
...o,
|
|
434
|
+
ref: m,
|
|
435
|
+
onKeyDown: _(r, (b) => {
|
|
436
|
+
b.key === "Enter" && b.preventDefault();
|
|
437
|
+
}),
|
|
438
|
+
onClick: _(t, (b) => {
|
|
439
|
+
f((S) => re(S) ? !0 : !S), w && g && (x.current = b.isPropagationStopped(), x.current || b.stopPropagation());
|
|
440
|
+
})
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
Ft.displayName = Ot;
|
|
446
|
+
var Lt = l.forwardRef(
|
|
447
|
+
(e, r) => {
|
|
448
|
+
const {
|
|
449
|
+
__scopeCheckbox: t,
|
|
450
|
+
name: o,
|
|
451
|
+
checked: n,
|
|
452
|
+
defaultChecked: i,
|
|
453
|
+
required: s,
|
|
454
|
+
disabled: c,
|
|
455
|
+
value: d,
|
|
456
|
+
onCheckedChange: u,
|
|
457
|
+
form: p,
|
|
458
|
+
...f
|
|
459
|
+
} = e;
|
|
460
|
+
return /* @__PURE__ */ a.jsx(
|
|
461
|
+
so,
|
|
462
|
+
{
|
|
463
|
+
__scopeCheckbox: t,
|
|
464
|
+
checked: n,
|
|
465
|
+
defaultChecked: i,
|
|
466
|
+
disabled: c,
|
|
467
|
+
required: s,
|
|
468
|
+
onCheckedChange: u,
|
|
469
|
+
name: o,
|
|
470
|
+
form: p,
|
|
471
|
+
value: d,
|
|
472
|
+
internal_do_not_use_render: ({ isFormControl: x }) => /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
473
|
+
/* @__PURE__ */ a.jsx(
|
|
474
|
+
Ft,
|
|
475
|
+
{
|
|
476
|
+
...f,
|
|
477
|
+
ref: r,
|
|
478
|
+
__scopeCheckbox: t
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
x && /* @__PURE__ */ a.jsx(
|
|
482
|
+
Kt,
|
|
483
|
+
{
|
|
484
|
+
__scopeCheckbox: t
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
] })
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
Lt.displayName = Fe;
|
|
493
|
+
var Bt = "CheckboxIndicator", $t = l.forwardRef(
|
|
494
|
+
(e, r) => {
|
|
495
|
+
const { __scopeCheckbox: t, forceMount: o, ...n } = e, i = pt(Bt, t);
|
|
496
|
+
return /* @__PURE__ */ a.jsx(
|
|
497
|
+
Ct,
|
|
498
|
+
{
|
|
499
|
+
present: o || re(i.checked) || i.checked === !0,
|
|
500
|
+
children: /* @__PURE__ */ a.jsx(
|
|
501
|
+
N.span,
|
|
502
|
+
{
|
|
503
|
+
"data-state": Ht(i.checked),
|
|
504
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
505
|
+
...n,
|
|
506
|
+
ref: r,
|
|
507
|
+
style: { pointerEvents: "none", ...e.style }
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
$t.displayName = Bt;
|
|
515
|
+
var Vt = "CheckboxBubbleInput", Kt = l.forwardRef(
|
|
516
|
+
({ __scopeCheckbox: e, ...r }, t) => {
|
|
517
|
+
const {
|
|
518
|
+
control: o,
|
|
519
|
+
hasConsumerStoppedPropagationRef: n,
|
|
520
|
+
checked: i,
|
|
521
|
+
defaultChecked: s,
|
|
522
|
+
required: c,
|
|
523
|
+
disabled: d,
|
|
524
|
+
name: u,
|
|
525
|
+
value: p,
|
|
526
|
+
form: f,
|
|
527
|
+
bubbleInput: x,
|
|
528
|
+
setBubbleInput: g
|
|
529
|
+
} = pt(Vt, e), w = V(t, g), m = Ee(i), v = Oe(o);
|
|
530
|
+
l.useEffect(() => {
|
|
531
|
+
const S = x;
|
|
532
|
+
if (!S) return;
|
|
533
|
+
const y = window.HTMLInputElement.prototype, D = Object.getOwnPropertyDescriptor(
|
|
534
|
+
y,
|
|
535
|
+
"checked"
|
|
536
|
+
).set, P = !n.current;
|
|
537
|
+
if (m !== i && D) {
|
|
538
|
+
const j = new Event("click", { bubbles: P });
|
|
539
|
+
S.indeterminate = re(i), D.call(S, re(i) ? !1 : i), S.dispatchEvent(j);
|
|
540
|
+
}
|
|
541
|
+
}, [x, m, i, n]);
|
|
542
|
+
const b = l.useRef(re(i) ? !1 : i);
|
|
543
|
+
return /* @__PURE__ */ a.jsx(
|
|
544
|
+
N.input,
|
|
545
|
+
{
|
|
546
|
+
type: "checkbox",
|
|
547
|
+
"aria-hidden": !0,
|
|
548
|
+
defaultChecked: s ?? b.current,
|
|
549
|
+
required: c,
|
|
550
|
+
disabled: d,
|
|
551
|
+
name: u,
|
|
552
|
+
value: p,
|
|
553
|
+
form: f,
|
|
554
|
+
...r,
|
|
555
|
+
tabIndex: -1,
|
|
556
|
+
ref: w,
|
|
557
|
+
style: {
|
|
558
|
+
...r.style,
|
|
559
|
+
...v,
|
|
560
|
+
position: "absolute",
|
|
561
|
+
pointerEvents: "none",
|
|
562
|
+
opacity: 0,
|
|
563
|
+
margin: 0,
|
|
564
|
+
// We transform because the input is absolutely positioned but we have
|
|
565
|
+
// rendered it **after** the button. This pulls it back to sit on top
|
|
566
|
+
// of the button.
|
|
567
|
+
transform: "translateX(-100%)"
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
Kt.displayName = Vt;
|
|
574
|
+
function io(e) {
|
|
575
|
+
return typeof e == "function";
|
|
576
|
+
}
|
|
577
|
+
function re(e) {
|
|
578
|
+
return e === "indeterminate";
|
|
579
|
+
}
|
|
580
|
+
function Ht(e) {
|
|
581
|
+
return re(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
582
|
+
}
|
|
583
|
+
function lo({ className: e, ...r }) {
|
|
584
|
+
return /* @__PURE__ */ a.jsx(
|
|
585
|
+
Lt,
|
|
586
|
+
{
|
|
587
|
+
className: A(
|
|
588
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
589
|
+
e
|
|
590
|
+
),
|
|
591
|
+
"data-slot": "checkbox",
|
|
592
|
+
...r,
|
|
593
|
+
children: /* @__PURE__ */ a.jsx(
|
|
594
|
+
$t,
|
|
595
|
+
{
|
|
596
|
+
className: "flex items-center justify-center text-current transition-none",
|
|
597
|
+
"data-slot": "checkbox-indicator",
|
|
598
|
+
children: /* @__PURE__ */ a.jsx(ut, { className: "size-3.5" })
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
const Ts = ({ label: e, name: r, value: t, checked: o, onCheckedChange: n }) => {
|
|
605
|
+
const [i, s] = Me(o);
|
|
606
|
+
St(() => {
|
|
607
|
+
s(o);
|
|
608
|
+
}, [o]);
|
|
609
|
+
let c = r;
|
|
610
|
+
const d = t || r;
|
|
611
|
+
t && (c += `[${t}]`);
|
|
612
|
+
const u = (p) => {
|
|
613
|
+
s(p), n?.(p);
|
|
614
|
+
};
|
|
615
|
+
return /* @__PURE__ */ a.jsxs(ne, { align: "center", gap: "2", children: [
|
|
616
|
+
/* @__PURE__ */ a.jsx(
|
|
617
|
+
lo,
|
|
618
|
+
{
|
|
619
|
+
checked: i,
|
|
620
|
+
id: c,
|
|
621
|
+
name: r,
|
|
622
|
+
onCheckedChange: u,
|
|
623
|
+
value: d
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
/* @__PURE__ */ a.jsx(ae, { className: "cursor-pointer", htmlFor: c, children: e })
|
|
627
|
+
] });
|
|
628
|
+
}, Ms = ({ content: e, className: r, size: t = "md", ...o }) => {
|
|
629
|
+
const [n, i] = Me(!1), s = sn(null);
|
|
630
|
+
St(() => () => {
|
|
631
|
+
s.current && clearTimeout(s.current);
|
|
632
|
+
}, []);
|
|
633
|
+
const c = () => {
|
|
634
|
+
const d = navigator.clipboard?.writeText;
|
|
635
|
+
d && (i(!0), d.call(navigator.clipboard, e).then(() => {
|
|
636
|
+
s.current && clearTimeout(s.current), s.current = setTimeout(() => {
|
|
637
|
+
i(!1), s.current = null;
|
|
638
|
+
}, 2e3);
|
|
639
|
+
}).catch(() => {
|
|
640
|
+
i(!1);
|
|
641
|
+
}));
|
|
642
|
+
};
|
|
643
|
+
return /* @__PURE__ */ a.jsx(
|
|
644
|
+
Te,
|
|
645
|
+
{
|
|
646
|
+
className: A(
|
|
647
|
+
{
|
|
648
|
+
"w-[88px]": t === "xs",
|
|
649
|
+
"w-[96px]": t === "sm",
|
|
650
|
+
"w-[100px]": t === "md",
|
|
651
|
+
"w-[125px]": t === "lg",
|
|
652
|
+
"w-[144px]": t === "xl"
|
|
653
|
+
},
|
|
654
|
+
"justify-start",
|
|
655
|
+
r
|
|
656
|
+
),
|
|
657
|
+
disabled: n,
|
|
658
|
+
icon: n ? /* @__PURE__ */ a.jsx(On, {}) : /* @__PURE__ */ a.jsx(Ln, {}),
|
|
659
|
+
label: n ? "Copied" : "Copy",
|
|
660
|
+
onClick: c,
|
|
661
|
+
size: t,
|
|
662
|
+
...o
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
}, As = ({ name: e, label: r, placeholder: t, note: o, className: n, size: i = "md", ...s }) => /* @__PURE__ */ a.jsx(
|
|
666
|
+
Gt,
|
|
667
|
+
{
|
|
668
|
+
className: A(
|
|
669
|
+
i === "xs" && "max-w-[140px] md:max-w-[135px]",
|
|
670
|
+
i === "sm" && "max-w-[150px] md:max-w-[140px]",
|
|
671
|
+
i === "md" && "max-w-[170px] md:max-w-[150px]",
|
|
672
|
+
i === "lg" && "max-w-[180px] md:max-w-[170px]",
|
|
673
|
+
i === "xl" && "max-w-[200px]",
|
|
674
|
+
n
|
|
675
|
+
),
|
|
676
|
+
label: r,
|
|
677
|
+
name: e,
|
|
678
|
+
note: o,
|
|
679
|
+
placeholder: t,
|
|
680
|
+
size: i,
|
|
681
|
+
type: "date",
|
|
682
|
+
...s
|
|
683
|
+
}
|
|
684
|
+
), Ds = ({ onDateSelection: e, initialValue: r, className: t, size: o = "default", error: n }) => {
|
|
685
|
+
const [i, s] = Me(r), c = (d) => {
|
|
686
|
+
s(d), d && e(d);
|
|
687
|
+
};
|
|
688
|
+
return /* @__PURE__ */ a.jsxs(ne, { direction: "col", gap: "2", children: [
|
|
689
|
+
/* @__PURE__ */ a.jsxs(Rt, { children: [
|
|
690
|
+
/* @__PURE__ */ a.jsx(It, { asChild: !0, children: /* @__PURE__ */ a.jsxs(
|
|
691
|
+
Te,
|
|
692
|
+
{
|
|
693
|
+
className: A("w-[280px] justify-start text-left font-normal", !i && "text-muted-foreground", t),
|
|
694
|
+
size: o,
|
|
695
|
+
variant: "outline",
|
|
696
|
+
children: [
|
|
697
|
+
/* @__PURE__ */ a.jsx(En, { className: "mr-2 h-4 w-4" }),
|
|
698
|
+
i ? i.toISOString().split("T")[0] : /* @__PURE__ */ a.jsx("span", { children: "Select a date" })
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
) }),
|
|
702
|
+
/* @__PURE__ */ a.jsx(kt, { className: "w-auto p-0", children: /* @__PURE__ */ a.jsx(nn, { autoFocus: !0, mode: "single", onSelect: c, selected: i }) })
|
|
703
|
+
] }),
|
|
704
|
+
n && /* @__PURE__ */ a.jsx(je, { message: n })
|
|
705
|
+
] });
|
|
706
|
+
}, je = ({ message: e }) => /* @__PURE__ */ a.jsx(Ae, { size: "xs", variant: "destructive", children: e }), co = ({ label: e, labelFor: r, className: t = "", labelClassName: o = "", children: n }) => /* @__PURE__ */ a.jsxs(ne, { direction: "col", gap: "2", children: [
|
|
707
|
+
e && /* @__PURE__ */ a.jsx(ae, { className: o, htmlFor: r, children: e }),
|
|
708
|
+
/* @__PURE__ */ a.jsx(ne, { className: `rounded-md border border-input bg-card p-2 shadow-xs ${t}`, gapY: "1", children: n })
|
|
709
|
+
] });
|
|
710
|
+
var uo = "Label", Ut = l.forwardRef((e, r) => /* @__PURE__ */ a.jsx(
|
|
711
|
+
N.label,
|
|
712
|
+
{
|
|
713
|
+
...e,
|
|
714
|
+
ref: r,
|
|
715
|
+
onMouseDown: (t) => {
|
|
716
|
+
t.target.closest("button, input, select, textarea") || (e.onMouseDown?.(t), !t.defaultPrevented && t.detail > 1 && t.preventDefault());
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
));
|
|
720
|
+
Ut.displayName = uo;
|
|
721
|
+
var po = Ut;
|
|
722
|
+
function fo({ className: e, ...r }) {
|
|
723
|
+
return /* @__PURE__ */ a.jsx(
|
|
724
|
+
po,
|
|
725
|
+
{
|
|
726
|
+
className: A(
|
|
727
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
728
|
+
e
|
|
729
|
+
),
|
|
730
|
+
"data-slot": "label",
|
|
731
|
+
...r
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
const ae = ({ htmlFor: e, value: r, children: t, size: o = "md", className: n = "", ...i }) => /* @__PURE__ */ a.jsx(
|
|
736
|
+
fo,
|
|
737
|
+
{
|
|
738
|
+
className: A(
|
|
739
|
+
"font-display font-normal text-foreground",
|
|
740
|
+
{
|
|
741
|
+
"text-xs": o === "xs",
|
|
742
|
+
"text-sm": o === "sm",
|
|
743
|
+
"text-base": o === "md",
|
|
744
|
+
"text-lg": o === "lg",
|
|
745
|
+
"text-xl": o === "xl"
|
|
746
|
+
},
|
|
747
|
+
n
|
|
748
|
+
),
|
|
749
|
+
htmlFor: e,
|
|
750
|
+
...i,
|
|
751
|
+
children: r || t
|
|
752
|
+
}
|
|
753
|
+
), Gt = ({
|
|
754
|
+
name: e,
|
|
755
|
+
type: r = "text",
|
|
756
|
+
placeholder: t,
|
|
757
|
+
label: o,
|
|
758
|
+
labelOrientation: n = "top",
|
|
759
|
+
note: i,
|
|
760
|
+
size: s = "md",
|
|
761
|
+
className: c,
|
|
762
|
+
error: d,
|
|
763
|
+
...u
|
|
764
|
+
}) => {
|
|
765
|
+
const p = A(
|
|
766
|
+
"flex w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 shadow-xs outline-none",
|
|
767
|
+
"transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex ",
|
|
768
|
+
"file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
|
|
769
|
+
"placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
770
|
+
"dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
771
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
772
|
+
s === "xs" && "h-7 text-xs md:text-xs",
|
|
773
|
+
s === "sm" && "h-8 text-sm md:text-xs",
|
|
774
|
+
s === "md" && "h-9 text-base md:text-sm",
|
|
775
|
+
s === "lg" && "h-10 text-lg md:text-base",
|
|
776
|
+
s === "xl" && "h-11 text-xl md:text-lg",
|
|
777
|
+
c
|
|
778
|
+
);
|
|
779
|
+
return /* @__PURE__ */ a.jsxs(ne, { className: "w-full", direction: n === "left" ? "row" : "col", gap: "2", children: [
|
|
780
|
+
o && /* @__PURE__ */ a.jsx(ae, { className: n === "left" ? "text-nowrap" : "", htmlFor: e, size: s, children: o }),
|
|
781
|
+
/* @__PURE__ */ a.jsx(
|
|
782
|
+
"input",
|
|
783
|
+
{
|
|
784
|
+
"aria-label": o || e,
|
|
785
|
+
className: p,
|
|
786
|
+
"data-slot": "input",
|
|
787
|
+
id: e,
|
|
788
|
+
name: e,
|
|
789
|
+
placeholder: t,
|
|
790
|
+
type: r,
|
|
791
|
+
...u
|
|
792
|
+
}
|
|
793
|
+
),
|
|
794
|
+
i && /* @__PURE__ */ a.jsx(Ae, { size: "sm", variant: "muted", children: i }),
|
|
795
|
+
d && /* @__PURE__ */ a.jsx(je, { message: d })
|
|
796
|
+
] });
|
|
797
|
+
}, Os = ({
|
|
798
|
+
name: e,
|
|
799
|
+
label: r,
|
|
800
|
+
placeholder: t,
|
|
801
|
+
note: o,
|
|
802
|
+
// Default to two decimal places for currency and general decimal values
|
|
803
|
+
step: n = ".01",
|
|
804
|
+
className: i,
|
|
805
|
+
...s
|
|
806
|
+
}) => /* @__PURE__ */ a.jsx(
|
|
807
|
+
Gt,
|
|
808
|
+
{
|
|
809
|
+
className: i,
|
|
810
|
+
label: r,
|
|
811
|
+
name: e,
|
|
812
|
+
note: o,
|
|
813
|
+
placeholder: t,
|
|
814
|
+
step: n,
|
|
815
|
+
type: "number",
|
|
816
|
+
...s
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
var ft = "Radio", [mo, zt] = ve(ft), [ho, vo] = mo(ft), Wt = l.forwardRef(
|
|
820
|
+
(e, r) => {
|
|
821
|
+
const {
|
|
822
|
+
__scopeRadio: t,
|
|
823
|
+
name: o,
|
|
824
|
+
checked: n = !1,
|
|
825
|
+
required: i,
|
|
826
|
+
disabled: s,
|
|
827
|
+
value: c = "on",
|
|
828
|
+
onCheck: d,
|
|
829
|
+
form: u,
|
|
830
|
+
...p
|
|
831
|
+
} = e, [f, x] = l.useState(null), g = V(r, (v) => x(v)), w = l.useRef(!1), m = f ? u || !!f.closest("form") : !0;
|
|
832
|
+
return /* @__PURE__ */ a.jsxs(ho, { scope: t, checked: n, disabled: s, children: [
|
|
833
|
+
/* @__PURE__ */ a.jsx(
|
|
834
|
+
N.button,
|
|
835
|
+
{
|
|
836
|
+
type: "button",
|
|
837
|
+
role: "radio",
|
|
838
|
+
"aria-checked": n,
|
|
839
|
+
"data-state": Zt(n),
|
|
840
|
+
"data-disabled": s ? "" : void 0,
|
|
841
|
+
disabled: s,
|
|
842
|
+
value: c,
|
|
843
|
+
...p,
|
|
844
|
+
ref: g,
|
|
845
|
+
onClick: _(e.onClick, (v) => {
|
|
846
|
+
n || d?.(), m && (w.current = v.isPropagationStopped(), w.current || v.stopPropagation());
|
|
847
|
+
})
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
m && /* @__PURE__ */ a.jsx(
|
|
851
|
+
Xt,
|
|
852
|
+
{
|
|
853
|
+
control: f,
|
|
854
|
+
bubbles: !w.current,
|
|
855
|
+
name: o,
|
|
856
|
+
value: c,
|
|
857
|
+
checked: n,
|
|
858
|
+
required: i,
|
|
859
|
+
disabled: s,
|
|
860
|
+
form: u,
|
|
861
|
+
style: { transform: "translateX(-100%)" }
|
|
862
|
+
}
|
|
863
|
+
)
|
|
864
|
+
] });
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
Wt.displayName = ft;
|
|
868
|
+
var qt = "RadioIndicator", Yt = l.forwardRef(
|
|
869
|
+
(e, r) => {
|
|
870
|
+
const { __scopeRadio: t, forceMount: o, ...n } = e, i = vo(qt, t);
|
|
871
|
+
return /* @__PURE__ */ a.jsx(Ct, { present: o || i.checked, children: /* @__PURE__ */ a.jsx(
|
|
872
|
+
N.span,
|
|
873
|
+
{
|
|
874
|
+
"data-state": Zt(i.checked),
|
|
875
|
+
"data-disabled": i.disabled ? "" : void 0,
|
|
876
|
+
...n,
|
|
877
|
+
ref: r
|
|
878
|
+
}
|
|
879
|
+
) });
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
Yt.displayName = qt;
|
|
883
|
+
var xo = "RadioBubbleInput", Xt = l.forwardRef(
|
|
884
|
+
({
|
|
885
|
+
__scopeRadio: e,
|
|
886
|
+
control: r,
|
|
887
|
+
checked: t,
|
|
888
|
+
bubbles: o = !0,
|
|
889
|
+
...n
|
|
890
|
+
}, i) => {
|
|
891
|
+
const s = l.useRef(null), c = V(s, i), d = Ee(t), u = Oe(r);
|
|
892
|
+
return l.useEffect(() => {
|
|
893
|
+
const p = s.current;
|
|
894
|
+
if (!p) return;
|
|
895
|
+
const f = window.HTMLInputElement.prototype, g = Object.getOwnPropertyDescriptor(
|
|
896
|
+
f,
|
|
897
|
+
"checked"
|
|
898
|
+
).set;
|
|
899
|
+
if (d !== t && g) {
|
|
900
|
+
const w = new Event("click", { bubbles: o });
|
|
901
|
+
g.call(p, t), p.dispatchEvent(w);
|
|
902
|
+
}
|
|
903
|
+
}, [d, t, o]), /* @__PURE__ */ a.jsx(
|
|
904
|
+
N.input,
|
|
905
|
+
{
|
|
906
|
+
type: "radio",
|
|
907
|
+
"aria-hidden": !0,
|
|
908
|
+
defaultChecked: t,
|
|
909
|
+
...n,
|
|
910
|
+
tabIndex: -1,
|
|
911
|
+
ref: c,
|
|
912
|
+
style: {
|
|
913
|
+
...n.style,
|
|
914
|
+
...u,
|
|
915
|
+
position: "absolute",
|
|
916
|
+
pointerEvents: "none",
|
|
917
|
+
opacity: 0,
|
|
918
|
+
margin: 0
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
Xt.displayName = xo;
|
|
925
|
+
function Zt(e) {
|
|
926
|
+
return e ? "checked" : "unchecked";
|
|
927
|
+
}
|
|
928
|
+
var go = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Le = "RadioGroup", [bo, Fs] = ve(Le, [
|
|
929
|
+
Pt,
|
|
930
|
+
zt
|
|
931
|
+
]), Jt = Pt(), Qt = zt(), [wo, So] = bo(Le), er = l.forwardRef(
|
|
932
|
+
(e, r) => {
|
|
933
|
+
const {
|
|
934
|
+
__scopeRadioGroup: t,
|
|
935
|
+
name: o,
|
|
936
|
+
defaultValue: n,
|
|
937
|
+
value: i,
|
|
938
|
+
required: s = !1,
|
|
939
|
+
disabled: c = !1,
|
|
940
|
+
orientation: d,
|
|
941
|
+
dir: u,
|
|
942
|
+
loop: p = !0,
|
|
943
|
+
onValueChange: f,
|
|
944
|
+
...x
|
|
945
|
+
} = e, g = Jt(t), w = De(u), [m, v] = pe({
|
|
946
|
+
prop: i,
|
|
947
|
+
defaultProp: n ?? null,
|
|
948
|
+
onChange: f,
|
|
949
|
+
caller: Le
|
|
950
|
+
});
|
|
951
|
+
return /* @__PURE__ */ a.jsx(
|
|
952
|
+
wo,
|
|
953
|
+
{
|
|
954
|
+
scope: t,
|
|
955
|
+
name: o,
|
|
956
|
+
required: s,
|
|
957
|
+
disabled: c,
|
|
958
|
+
value: m,
|
|
959
|
+
onValueChange: v,
|
|
960
|
+
children: /* @__PURE__ */ a.jsx(
|
|
961
|
+
ro,
|
|
962
|
+
{
|
|
963
|
+
asChild: !0,
|
|
964
|
+
...g,
|
|
965
|
+
orientation: d,
|
|
966
|
+
dir: w,
|
|
967
|
+
loop: p,
|
|
968
|
+
children: /* @__PURE__ */ a.jsx(
|
|
969
|
+
N.div,
|
|
970
|
+
{
|
|
971
|
+
role: "radiogroup",
|
|
972
|
+
"aria-required": s,
|
|
973
|
+
"aria-orientation": d,
|
|
974
|
+
"data-disabled": c ? "" : void 0,
|
|
975
|
+
dir: w,
|
|
976
|
+
...x,
|
|
977
|
+
ref: r
|
|
978
|
+
}
|
|
979
|
+
)
|
|
980
|
+
}
|
|
981
|
+
)
|
|
982
|
+
}
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
er.displayName = Le;
|
|
987
|
+
var tr = "RadioGroupItem", rr = l.forwardRef(
|
|
988
|
+
(e, r) => {
|
|
989
|
+
const { __scopeRadioGroup: t, disabled: o, ...n } = e, i = So(tr, t), s = i.disabled || o, c = Jt(t), d = Qt(t), u = l.useRef(null), p = V(r, u), f = i.value === n.value, x = l.useRef(!1);
|
|
990
|
+
return l.useEffect(() => {
|
|
991
|
+
const g = (m) => {
|
|
992
|
+
go.includes(m.key) && (x.current = !0);
|
|
993
|
+
}, w = () => x.current = !1;
|
|
994
|
+
return document.addEventListener("keydown", g), document.addEventListener("keyup", w), () => {
|
|
995
|
+
document.removeEventListener("keydown", g), document.removeEventListener("keyup", w);
|
|
996
|
+
};
|
|
997
|
+
}, []), /* @__PURE__ */ a.jsx(
|
|
998
|
+
no,
|
|
999
|
+
{
|
|
1000
|
+
asChild: !0,
|
|
1001
|
+
...c,
|
|
1002
|
+
focusable: !s,
|
|
1003
|
+
active: f,
|
|
1004
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1005
|
+
Wt,
|
|
1006
|
+
{
|
|
1007
|
+
disabled: s,
|
|
1008
|
+
required: i.required,
|
|
1009
|
+
checked: f,
|
|
1010
|
+
...d,
|
|
1011
|
+
...n,
|
|
1012
|
+
name: i.name,
|
|
1013
|
+
ref: p,
|
|
1014
|
+
onCheck: () => i.onValueChange(n.value),
|
|
1015
|
+
onKeyDown: _((g) => {
|
|
1016
|
+
g.key === "Enter" && g.preventDefault();
|
|
1017
|
+
}),
|
|
1018
|
+
onFocus: _(n.onFocus, () => {
|
|
1019
|
+
x.current && u.current?.click();
|
|
1020
|
+
})
|
|
1021
|
+
}
|
|
1022
|
+
)
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
);
|
|
1027
|
+
rr.displayName = tr;
|
|
1028
|
+
var yo = "RadioGroupIndicator", nr = l.forwardRef(
|
|
1029
|
+
(e, r) => {
|
|
1030
|
+
const { __scopeRadioGroup: t, ...o } = e, n = Qt(t);
|
|
1031
|
+
return /* @__PURE__ */ a.jsx(Yt, { ...n, ...o, ref: r });
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
nr.displayName = yo;
|
|
1035
|
+
var Co = er, Ro = rr, Io = nr;
|
|
1036
|
+
function ko({ className: e, ...r }) {
|
|
1037
|
+
return /* @__PURE__ */ a.jsx(Co, { className: A("grid gap-3", e), "data-slot": "radio-group", ...r });
|
|
1038
|
+
}
|
|
1039
|
+
function Eo({ className: e, ...r }) {
|
|
1040
|
+
return /* @__PURE__ */ a.jsx(
|
|
1041
|
+
Ro,
|
|
1042
|
+
{
|
|
1043
|
+
className: A(
|
|
1044
|
+
"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
1045
|
+
e
|
|
1046
|
+
),
|
|
1047
|
+
"data-slot": "radio-group-item",
|
|
1048
|
+
...r,
|
|
1049
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1050
|
+
Io,
|
|
1051
|
+
{
|
|
1052
|
+
className: "relative flex items-center justify-center",
|
|
1053
|
+
"data-slot": "radio-group-indicator",
|
|
1054
|
+
children: /* @__PURE__ */ a.jsx(An, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
const Ls = ({ label: e, name: r, options: t, value: o, onChange: n, error: i }) => /* @__PURE__ */ a.jsxs(co, { className: "flex flex-col gap-4 px-2 py-1", label: e, labelFor: r, children: [
|
|
1061
|
+
/* @__PURE__ */ a.jsx(ko, { className: "w-full", name: r, onValueChange: n, value: o, children: /* @__PURE__ */ a.jsx(cn, { cols: "2", children: t.map((s, c) => /* @__PURE__ */ a.jsxs(ne, { align: "center", gap: "2", justify: "start", children: [
|
|
1062
|
+
/* @__PURE__ */ a.jsx(Eo, { id: s.value, value: s.value }),
|
|
1063
|
+
/* @__PURE__ */ a.jsx(ae, { htmlFor: s.value, children: s.label })
|
|
1064
|
+
] }, c)) }) }),
|
|
1065
|
+
i && /* @__PURE__ */ a.jsx(je, { message: i })
|
|
1066
|
+
] });
|
|
1067
|
+
function _e(e, [r, t]) {
|
|
1068
|
+
return Math.min(t, Math.max(r, e));
|
|
1069
|
+
}
|
|
1070
|
+
var jo = [" ", "Enter", "ArrowUp", "ArrowDown"], No = [" ", "Enter"], fe = "Select", [Be, $e, _o] = dt(fe), [we, Bs] = ve(fe, [
|
|
1071
|
+
_o,
|
|
1072
|
+
Et
|
|
1073
|
+
]), Ve = Et(), [Po, ie] = we(fe), [To, Mo] = we(fe), or = (e) => {
|
|
1074
|
+
const {
|
|
1075
|
+
__scopeSelect: r,
|
|
1076
|
+
children: t,
|
|
1077
|
+
open: o,
|
|
1078
|
+
defaultOpen: n,
|
|
1079
|
+
onOpenChange: i,
|
|
1080
|
+
value: s,
|
|
1081
|
+
defaultValue: c,
|
|
1082
|
+
onValueChange: d,
|
|
1083
|
+
dir: u,
|
|
1084
|
+
name: p,
|
|
1085
|
+
autoComplete: f,
|
|
1086
|
+
disabled: x,
|
|
1087
|
+
required: g,
|
|
1088
|
+
form: w
|
|
1089
|
+
} = e, m = Ve(r), [v, b] = l.useState(null), [S, y] = l.useState(null), [I, D] = l.useState(!1), P = De(u), [j, L] = pe({
|
|
1090
|
+
prop: o,
|
|
1091
|
+
defaultProp: n ?? !1,
|
|
1092
|
+
onChange: i,
|
|
1093
|
+
caller: fe
|
|
1094
|
+
}), [Z, z] = pe({
|
|
1095
|
+
prop: s,
|
|
1096
|
+
defaultProp: c,
|
|
1097
|
+
onChange: d,
|
|
1098
|
+
caller: fe
|
|
1099
|
+
}), O = l.useRef(null), K = v ? w || !!v.closest("form") : !0, [X, W] = l.useState(/* @__PURE__ */ new Set()), U = Array.from(X).map((F) => F.props.value).join(";");
|
|
1100
|
+
return /* @__PURE__ */ a.jsx(un, { ...m, children: /* @__PURE__ */ a.jsxs(
|
|
1101
|
+
Po,
|
|
1102
|
+
{
|
|
1103
|
+
required: g,
|
|
1104
|
+
scope: r,
|
|
1105
|
+
trigger: v,
|
|
1106
|
+
onTriggerChange: b,
|
|
1107
|
+
valueNode: S,
|
|
1108
|
+
onValueNodeChange: y,
|
|
1109
|
+
valueNodeHasChildren: I,
|
|
1110
|
+
onValueNodeHasChildrenChange: D,
|
|
1111
|
+
contentId: te(),
|
|
1112
|
+
value: Z,
|
|
1113
|
+
onValueChange: z,
|
|
1114
|
+
open: j,
|
|
1115
|
+
onOpenChange: L,
|
|
1116
|
+
dir: P,
|
|
1117
|
+
triggerPointerDownPosRef: O,
|
|
1118
|
+
disabled: x,
|
|
1119
|
+
children: [
|
|
1120
|
+
/* @__PURE__ */ a.jsx(Be.Provider, { scope: r, children: /* @__PURE__ */ a.jsx(
|
|
1121
|
+
To,
|
|
1122
|
+
{
|
|
1123
|
+
scope: e.__scopeSelect,
|
|
1124
|
+
onNativeOptionAdd: l.useCallback((F) => {
|
|
1125
|
+
W((G) => new Set(G).add(F));
|
|
1126
|
+
}, []),
|
|
1127
|
+
onNativeOptionRemove: l.useCallback((F) => {
|
|
1128
|
+
W((G) => {
|
|
1129
|
+
const q = new Set(G);
|
|
1130
|
+
return q.delete(F), q;
|
|
1131
|
+
});
|
|
1132
|
+
}, []),
|
|
1133
|
+
children: t
|
|
1134
|
+
}
|
|
1135
|
+
) }),
|
|
1136
|
+
K ? /* @__PURE__ */ a.jsxs(
|
|
1137
|
+
kr,
|
|
1138
|
+
{
|
|
1139
|
+
"aria-hidden": !0,
|
|
1140
|
+
required: g,
|
|
1141
|
+
tabIndex: -1,
|
|
1142
|
+
name: p,
|
|
1143
|
+
autoComplete: f,
|
|
1144
|
+
value: Z,
|
|
1145
|
+
onChange: (F) => z(F.target.value),
|
|
1146
|
+
disabled: x,
|
|
1147
|
+
form: w,
|
|
1148
|
+
children: [
|
|
1149
|
+
Z === void 0 ? /* @__PURE__ */ a.jsx("option", { value: "" }) : null,
|
|
1150
|
+
Array.from(X)
|
|
1151
|
+
]
|
|
1152
|
+
},
|
|
1153
|
+
U
|
|
1154
|
+
) : null
|
|
1155
|
+
]
|
|
1156
|
+
}
|
|
1157
|
+
) });
|
|
1158
|
+
};
|
|
1159
|
+
or.displayName = fe;
|
|
1160
|
+
var ar = "SelectTrigger", sr = l.forwardRef(
|
|
1161
|
+
(e, r) => {
|
|
1162
|
+
const { __scopeSelect: t, disabled: o = !1, ...n } = e, i = Ve(t), s = ie(ar, t), c = s.disabled || o, d = V(r, s.onTriggerChange), u = $e(t), p = l.useRef("touch"), [f, x, g] = jr((m) => {
|
|
1163
|
+
const v = u().filter((y) => !y.disabled), b = v.find((y) => y.value === s.value), S = Nr(v, m, b);
|
|
1164
|
+
S !== void 0 && s.onValueChange(S.value);
|
|
1165
|
+
}), w = (m) => {
|
|
1166
|
+
c || (s.onOpenChange(!0), g()), m && (s.triggerPointerDownPosRef.current = {
|
|
1167
|
+
x: Math.round(m.pageX),
|
|
1168
|
+
y: Math.round(m.pageY)
|
|
1169
|
+
});
|
|
1170
|
+
};
|
|
1171
|
+
return /* @__PURE__ */ a.jsx(pn, { asChild: !0, ...i, children: /* @__PURE__ */ a.jsx(
|
|
1172
|
+
N.button,
|
|
1173
|
+
{
|
|
1174
|
+
type: "button",
|
|
1175
|
+
role: "combobox",
|
|
1176
|
+
"aria-controls": s.contentId,
|
|
1177
|
+
"aria-expanded": s.open,
|
|
1178
|
+
"aria-required": s.required,
|
|
1179
|
+
"aria-autocomplete": "none",
|
|
1180
|
+
dir: s.dir,
|
|
1181
|
+
"data-state": s.open ? "open" : "closed",
|
|
1182
|
+
disabled: c,
|
|
1183
|
+
"data-disabled": c ? "" : void 0,
|
|
1184
|
+
"data-placeholder": Er(s.value) ? "" : void 0,
|
|
1185
|
+
...n,
|
|
1186
|
+
ref: d,
|
|
1187
|
+
onClick: _(n.onClick, (m) => {
|
|
1188
|
+
m.currentTarget.focus(), p.current !== "mouse" && w(m);
|
|
1189
|
+
}),
|
|
1190
|
+
onPointerDown: _(n.onPointerDown, (m) => {
|
|
1191
|
+
p.current = m.pointerType;
|
|
1192
|
+
const v = m.target;
|
|
1193
|
+
v.hasPointerCapture(m.pointerId) && v.releasePointerCapture(m.pointerId), m.button === 0 && m.ctrlKey === !1 && m.pointerType === "mouse" && (w(m), m.preventDefault());
|
|
1194
|
+
}),
|
|
1195
|
+
onKeyDown: _(n.onKeyDown, (m) => {
|
|
1196
|
+
const v = f.current !== "";
|
|
1197
|
+
!(m.ctrlKey || m.altKey || m.metaKey) && m.key.length === 1 && x(m.key), !(v && m.key === " ") && jo.includes(m.key) && (w(), m.preventDefault());
|
|
1198
|
+
})
|
|
1199
|
+
}
|
|
1200
|
+
) });
|
|
1201
|
+
}
|
|
1202
|
+
);
|
|
1203
|
+
sr.displayName = ar;
|
|
1204
|
+
var ir = "SelectValue", lr = l.forwardRef(
|
|
1205
|
+
(e, r) => {
|
|
1206
|
+
const { __scopeSelect: t, className: o, style: n, children: i, placeholder: s = "", ...c } = e, d = ie(ir, t), { onValueNodeHasChildrenChange: u } = d, p = i !== void 0, f = V(r, d.onValueNodeChange);
|
|
1207
|
+
return oe(() => {
|
|
1208
|
+
u(p);
|
|
1209
|
+
}, [u, p]), /* @__PURE__ */ a.jsx(
|
|
1210
|
+
N.span,
|
|
1211
|
+
{
|
|
1212
|
+
...c,
|
|
1213
|
+
ref: f,
|
|
1214
|
+
style: { pointerEvents: "none" },
|
|
1215
|
+
children: Er(d.value) ? /* @__PURE__ */ a.jsx(a.Fragment, { children: s }) : i
|
|
1216
|
+
}
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
);
|
|
1220
|
+
lr.displayName = ir;
|
|
1221
|
+
var Ao = "SelectIcon", cr = l.forwardRef(
|
|
1222
|
+
(e, r) => {
|
|
1223
|
+
const { __scopeSelect: t, children: o, ...n } = e;
|
|
1224
|
+
return /* @__PURE__ */ a.jsx(N.span, { "aria-hidden": !0, ...n, ref: r, children: o || "▼" });
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
cr.displayName = Ao;
|
|
1228
|
+
var Do = "SelectPortal", dr = (e) => /* @__PURE__ */ a.jsx(fn, { asChild: !0, ...e });
|
|
1229
|
+
dr.displayName = Do;
|
|
1230
|
+
var me = "SelectContent", ur = l.forwardRef(
|
|
1231
|
+
(e, r) => {
|
|
1232
|
+
const t = ie(me, e.__scopeSelect), [o, n] = l.useState();
|
|
1233
|
+
if (oe(() => {
|
|
1234
|
+
n(new DocumentFragment());
|
|
1235
|
+
}, []), !t.open) {
|
|
1236
|
+
const i = o;
|
|
1237
|
+
return i ? Nt.createPortal(
|
|
1238
|
+
/* @__PURE__ */ a.jsx(pr, { scope: e.__scopeSelect, children: /* @__PURE__ */ a.jsx(Be.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ a.jsx("div", { children: e.children }) }) }),
|
|
1239
|
+
i
|
|
1240
|
+
) : null;
|
|
1241
|
+
}
|
|
1242
|
+
return /* @__PURE__ */ a.jsx(fr, { ...e, ref: r });
|
|
1243
|
+
}
|
|
1244
|
+
);
|
|
1245
|
+
ur.displayName = me;
|
|
1246
|
+
var Q = 10, [pr, le] = we(me), Oo = "SelectContentImpl", Fo = on("SelectContent.RemoveScroll"), fr = l.forwardRef(
|
|
1247
|
+
(e, r) => {
|
|
1248
|
+
const {
|
|
1249
|
+
__scopeSelect: t,
|
|
1250
|
+
position: o = "item-aligned",
|
|
1251
|
+
onCloseAutoFocus: n,
|
|
1252
|
+
onEscapeKeyDown: i,
|
|
1253
|
+
onPointerDownOutside: s,
|
|
1254
|
+
//
|
|
1255
|
+
// PopperContent props
|
|
1256
|
+
side: c,
|
|
1257
|
+
sideOffset: d,
|
|
1258
|
+
align: u,
|
|
1259
|
+
alignOffset: p,
|
|
1260
|
+
arrowPadding: f,
|
|
1261
|
+
collisionBoundary: x,
|
|
1262
|
+
collisionPadding: g,
|
|
1263
|
+
sticky: w,
|
|
1264
|
+
hideWhenDetached: m,
|
|
1265
|
+
avoidCollisions: v,
|
|
1266
|
+
//
|
|
1267
|
+
...b
|
|
1268
|
+
} = e, S = ie(me, t), [y, I] = l.useState(null), [D, P] = l.useState(null), j = V(r, (C) => I(C)), [L, Z] = l.useState(null), [z, O] = l.useState(
|
|
1269
|
+
null
|
|
1270
|
+
), K = $e(t), [X, W] = l.useState(!1), U = l.useRef(!1);
|
|
1271
|
+
l.useEffect(() => {
|
|
1272
|
+
if (y) return hn(y);
|
|
1273
|
+
}, [y]), vn();
|
|
1274
|
+
const F = l.useCallback(
|
|
1275
|
+
(C) => {
|
|
1276
|
+
const [M, ...B] = K().map((Y) => Y.ref.current), [$] = B.slice(-1), H = document.activeElement;
|
|
1277
|
+
for (const Y of C)
|
|
1278
|
+
if (Y === H || (Y?.scrollIntoView({ block: "nearest" }), Y === M && D && (D.scrollTop = 0), Y === $ && D && (D.scrollTop = D.scrollHeight), Y?.focus(), document.activeElement !== H)) return;
|
|
1279
|
+
},
|
|
1280
|
+
[K, D]
|
|
1281
|
+
), G = l.useCallback(
|
|
1282
|
+
() => F([L, y]),
|
|
1283
|
+
[F, L, y]
|
|
1284
|
+
);
|
|
1285
|
+
l.useEffect(() => {
|
|
1286
|
+
X && G();
|
|
1287
|
+
}, [X, G]);
|
|
1288
|
+
const { onOpenChange: q, triggerPointerDownPosRef: J } = S;
|
|
1289
|
+
l.useEffect(() => {
|
|
1290
|
+
if (y) {
|
|
1291
|
+
let C = { x: 0, y: 0 };
|
|
1292
|
+
const M = ($) => {
|
|
1293
|
+
C = {
|
|
1294
|
+
x: Math.abs(Math.round($.pageX) - (J.current?.x ?? 0)),
|
|
1295
|
+
y: Math.abs(Math.round($.pageY) - (J.current?.y ?? 0))
|
|
1296
|
+
};
|
|
1297
|
+
}, B = ($) => {
|
|
1298
|
+
C.x <= 10 && C.y <= 10 ? $.preventDefault() : y.contains($.target) || q(!1), document.removeEventListener("pointermove", M), J.current = null;
|
|
1299
|
+
};
|
|
1300
|
+
return J.current !== null && (document.addEventListener("pointermove", M), document.addEventListener("pointerup", B, { capture: !0, once: !0 })), () => {
|
|
1301
|
+
document.removeEventListener("pointermove", M), document.removeEventListener("pointerup", B, { capture: !0 });
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
}, [y, q, J]), l.useEffect(() => {
|
|
1305
|
+
const C = () => q(!1);
|
|
1306
|
+
return window.addEventListener("blur", C), window.addEventListener("resize", C), () => {
|
|
1307
|
+
window.removeEventListener("blur", C), window.removeEventListener("resize", C);
|
|
1308
|
+
};
|
|
1309
|
+
}, [q]);
|
|
1310
|
+
const [xe, ce] = jr((C) => {
|
|
1311
|
+
const M = K().filter((H) => !H.disabled), B = M.find((H) => H.ref.current === document.activeElement), $ = Nr(M, C, B);
|
|
1312
|
+
$ && setTimeout(() => $.ref.current.focus());
|
|
1313
|
+
}), h = l.useCallback(
|
|
1314
|
+
(C, M, B) => {
|
|
1315
|
+
const $ = !U.current && !B;
|
|
1316
|
+
(S.value !== void 0 && S.value === M || $) && (Z(C), $ && (U.current = !0));
|
|
1317
|
+
},
|
|
1318
|
+
[S.value]
|
|
1319
|
+
), k = l.useCallback(() => y?.focus(), [y]), E = l.useCallback(
|
|
1320
|
+
(C, M, B) => {
|
|
1321
|
+
const $ = !U.current && !B;
|
|
1322
|
+
(S.value !== void 0 && S.value === M || $) && O(C);
|
|
1323
|
+
},
|
|
1324
|
+
[S.value]
|
|
1325
|
+
), R = o === "popper" ? et : mr, T = R === et ? {
|
|
1326
|
+
side: c,
|
|
1327
|
+
sideOffset: d,
|
|
1328
|
+
align: u,
|
|
1329
|
+
alignOffset: p,
|
|
1330
|
+
arrowPadding: f,
|
|
1331
|
+
collisionBoundary: x,
|
|
1332
|
+
collisionPadding: g,
|
|
1333
|
+
sticky: w,
|
|
1334
|
+
hideWhenDetached: m,
|
|
1335
|
+
avoidCollisions: v
|
|
1336
|
+
} : {};
|
|
1337
|
+
return /* @__PURE__ */ a.jsx(
|
|
1338
|
+
pr,
|
|
1339
|
+
{
|
|
1340
|
+
scope: t,
|
|
1341
|
+
content: y,
|
|
1342
|
+
viewport: D,
|
|
1343
|
+
onViewportChange: P,
|
|
1344
|
+
itemRefCallback: h,
|
|
1345
|
+
selectedItem: L,
|
|
1346
|
+
onItemLeave: k,
|
|
1347
|
+
itemTextRefCallback: E,
|
|
1348
|
+
focusSelectedItem: G,
|
|
1349
|
+
selectedItemText: z,
|
|
1350
|
+
position: o,
|
|
1351
|
+
isPositioned: X,
|
|
1352
|
+
searchRef: xe,
|
|
1353
|
+
children: /* @__PURE__ */ a.jsx(xn, { as: Fo, allowPinchZoom: !0, children: /* @__PURE__ */ a.jsx(
|
|
1354
|
+
gn,
|
|
1355
|
+
{
|
|
1356
|
+
asChild: !0,
|
|
1357
|
+
trapped: S.open,
|
|
1358
|
+
onMountAutoFocus: (C) => {
|
|
1359
|
+
C.preventDefault();
|
|
1360
|
+
},
|
|
1361
|
+
onUnmountAutoFocus: _(n, (C) => {
|
|
1362
|
+
S.trigger?.focus({ preventScroll: !0 }), C.preventDefault();
|
|
1363
|
+
}),
|
|
1364
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1365
|
+
bn,
|
|
1366
|
+
{
|
|
1367
|
+
asChild: !0,
|
|
1368
|
+
disableOutsidePointerEvents: !0,
|
|
1369
|
+
onEscapeKeyDown: i,
|
|
1370
|
+
onPointerDownOutside: s,
|
|
1371
|
+
onFocusOutside: (C) => C.preventDefault(),
|
|
1372
|
+
onDismiss: () => S.onOpenChange(!1),
|
|
1373
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1374
|
+
R,
|
|
1375
|
+
{
|
|
1376
|
+
role: "listbox",
|
|
1377
|
+
id: S.contentId,
|
|
1378
|
+
"data-state": S.open ? "open" : "closed",
|
|
1379
|
+
dir: S.dir,
|
|
1380
|
+
onContextMenu: (C) => C.preventDefault(),
|
|
1381
|
+
...b,
|
|
1382
|
+
...T,
|
|
1383
|
+
onPlaced: () => W(!0),
|
|
1384
|
+
ref: j,
|
|
1385
|
+
style: {
|
|
1386
|
+
// flex layout so we can place the scroll buttons properly
|
|
1387
|
+
display: "flex",
|
|
1388
|
+
flexDirection: "column",
|
|
1389
|
+
// reset the outline by default as the content MAY get focused
|
|
1390
|
+
outline: "none",
|
|
1391
|
+
...b.style
|
|
1392
|
+
},
|
|
1393
|
+
onKeyDown: _(b.onKeyDown, (C) => {
|
|
1394
|
+
const M = C.ctrlKey || C.altKey || C.metaKey;
|
|
1395
|
+
if (C.key === "Tab" && C.preventDefault(), !M && C.key.length === 1 && ce(C.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(C.key)) {
|
|
1396
|
+
let $ = K().filter((H) => !H.disabled).map((H) => H.ref.current);
|
|
1397
|
+
if (["ArrowUp", "End"].includes(C.key) && ($ = $.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(C.key)) {
|
|
1398
|
+
const H = C.target, Y = $.indexOf(H);
|
|
1399
|
+
$ = $.slice(Y + 1);
|
|
1400
|
+
}
|
|
1401
|
+
setTimeout(() => F($)), C.preventDefault();
|
|
1402
|
+
}
|
|
1403
|
+
})
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
}
|
|
1409
|
+
) })
|
|
1410
|
+
}
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
);
|
|
1414
|
+
fr.displayName = Oo;
|
|
1415
|
+
var Lo = "SelectItemAlignedPosition", mr = l.forwardRef((e, r) => {
|
|
1416
|
+
const { __scopeSelect: t, onPlaced: o, ...n } = e, i = ie(me, t), s = le(me, t), [c, d] = l.useState(null), [u, p] = l.useState(null), f = V(r, (j) => p(j)), x = $e(t), g = l.useRef(!1), w = l.useRef(!0), { viewport: m, selectedItem: v, selectedItemText: b, focusSelectedItem: S } = s, y = l.useCallback(() => {
|
|
1417
|
+
if (i.trigger && i.valueNode && c && u && m && v && b) {
|
|
1418
|
+
const j = i.trigger.getBoundingClientRect(), L = u.getBoundingClientRect(), Z = i.valueNode.getBoundingClientRect(), z = b.getBoundingClientRect();
|
|
1419
|
+
if (i.dir !== "rtl") {
|
|
1420
|
+
const H = z.left - L.left, Y = Z.left - H, de = j.left - Y, ue = j.width + de, Ge = Math.max(ue, L.width), ze = window.innerWidth - Q, We = _e(Y, [
|
|
1421
|
+
Q,
|
|
1422
|
+
// Prevents the content from going off the starting edge of the
|
|
1423
|
+
// viewport. It may still go off the ending edge, but this can be
|
|
1424
|
+
// controlled by the user since they may want to manage overflow in a
|
|
1425
|
+
// specific way.
|
|
1426
|
+
// https://github.com/radix-ui/primitives/issues/2049
|
|
1427
|
+
Math.max(Q, ze - Ge)
|
|
1428
|
+
]);
|
|
1429
|
+
c.style.minWidth = ue + "px", c.style.left = We + "px";
|
|
1430
|
+
} else {
|
|
1431
|
+
const H = L.right - z.right, Y = window.innerWidth - Z.right - H, de = window.innerWidth - j.right - Y, ue = j.width + de, Ge = Math.max(ue, L.width), ze = window.innerWidth - Q, We = _e(Y, [
|
|
1432
|
+
Q,
|
|
1433
|
+
Math.max(Q, ze - Ge)
|
|
1434
|
+
]);
|
|
1435
|
+
c.style.minWidth = ue + "px", c.style.right = We + "px";
|
|
1436
|
+
}
|
|
1437
|
+
const O = x(), K = window.innerHeight - Q * 2, X = m.scrollHeight, W = window.getComputedStyle(u), U = parseInt(W.borderTopWidth, 10), F = parseInt(W.paddingTop, 10), G = parseInt(W.borderBottomWidth, 10), q = parseInt(W.paddingBottom, 10), J = U + F + X + q + G, xe = Math.min(v.offsetHeight * 5, J), ce = window.getComputedStyle(m), h = parseInt(ce.paddingTop, 10), k = parseInt(ce.paddingBottom, 10), E = j.top + j.height / 2 - Q, R = K - E, T = v.offsetHeight / 2, C = v.offsetTop + T, M = U + F + C, B = J - M;
|
|
1438
|
+
if (M <= E) {
|
|
1439
|
+
const H = O.length > 0 && v === O[O.length - 1].ref.current;
|
|
1440
|
+
c.style.bottom = "0px";
|
|
1441
|
+
const Y = u.clientHeight - m.offsetTop - m.offsetHeight, de = Math.max(
|
|
1442
|
+
R,
|
|
1443
|
+
T + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
1444
|
+
(H ? k : 0) + Y + G
|
|
1445
|
+
), ue = M + de;
|
|
1446
|
+
c.style.height = ue + "px";
|
|
1447
|
+
} else {
|
|
1448
|
+
const H = O.length > 0 && v === O[0].ref.current;
|
|
1449
|
+
c.style.top = "0px";
|
|
1450
|
+
const de = Math.max(
|
|
1451
|
+
E,
|
|
1452
|
+
U + m.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
1453
|
+
(H ? h : 0) + T
|
|
1454
|
+
) + B;
|
|
1455
|
+
c.style.height = de + "px", m.scrollTop = M - E + m.offsetTop;
|
|
1456
|
+
}
|
|
1457
|
+
c.style.margin = `${Q}px 0`, c.style.minHeight = xe + "px", c.style.maxHeight = K + "px", o?.(), requestAnimationFrame(() => g.current = !0);
|
|
1458
|
+
}
|
|
1459
|
+
}, [
|
|
1460
|
+
x,
|
|
1461
|
+
i.trigger,
|
|
1462
|
+
i.valueNode,
|
|
1463
|
+
c,
|
|
1464
|
+
u,
|
|
1465
|
+
m,
|
|
1466
|
+
v,
|
|
1467
|
+
b,
|
|
1468
|
+
i.dir,
|
|
1469
|
+
o
|
|
1470
|
+
]);
|
|
1471
|
+
oe(() => y(), [y]);
|
|
1472
|
+
const [I, D] = l.useState();
|
|
1473
|
+
oe(() => {
|
|
1474
|
+
u && D(window.getComputedStyle(u).zIndex);
|
|
1475
|
+
}, [u]);
|
|
1476
|
+
const P = l.useCallback(
|
|
1477
|
+
(j) => {
|
|
1478
|
+
j && w.current === !0 && (y(), S?.(), w.current = !1);
|
|
1479
|
+
},
|
|
1480
|
+
[y, S]
|
|
1481
|
+
);
|
|
1482
|
+
return /* @__PURE__ */ a.jsx(
|
|
1483
|
+
$o,
|
|
1484
|
+
{
|
|
1485
|
+
scope: t,
|
|
1486
|
+
contentWrapper: c,
|
|
1487
|
+
shouldExpandOnScrollRef: g,
|
|
1488
|
+
onScrollButtonChange: P,
|
|
1489
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1490
|
+
"div",
|
|
1491
|
+
{
|
|
1492
|
+
ref: d,
|
|
1493
|
+
style: {
|
|
1494
|
+
display: "flex",
|
|
1495
|
+
flexDirection: "column",
|
|
1496
|
+
position: "fixed",
|
|
1497
|
+
zIndex: I
|
|
1498
|
+
},
|
|
1499
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1500
|
+
N.div,
|
|
1501
|
+
{
|
|
1502
|
+
...n,
|
|
1503
|
+
ref: f,
|
|
1504
|
+
style: {
|
|
1505
|
+
// When we get the height of the content, it includes borders. If we were to set
|
|
1506
|
+
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
1507
|
+
boxSizing: "border-box",
|
|
1508
|
+
// We need to ensure the content doesn't get taller than the wrapper
|
|
1509
|
+
maxHeight: "100%",
|
|
1510
|
+
...n.style
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
)
|
|
1514
|
+
}
|
|
1515
|
+
)
|
|
1516
|
+
}
|
|
1517
|
+
);
|
|
1518
|
+
});
|
|
1519
|
+
mr.displayName = Lo;
|
|
1520
|
+
var Bo = "SelectPopperPosition", et = l.forwardRef((e, r) => {
|
|
1521
|
+
const {
|
|
1522
|
+
__scopeSelect: t,
|
|
1523
|
+
align: o = "start",
|
|
1524
|
+
collisionPadding: n = Q,
|
|
1525
|
+
...i
|
|
1526
|
+
} = e, s = Ve(t);
|
|
1527
|
+
return /* @__PURE__ */ a.jsx(
|
|
1528
|
+
wn,
|
|
1529
|
+
{
|
|
1530
|
+
...s,
|
|
1531
|
+
...i,
|
|
1532
|
+
ref: r,
|
|
1533
|
+
align: o,
|
|
1534
|
+
collisionPadding: n,
|
|
1535
|
+
style: {
|
|
1536
|
+
// Ensure border-box for floating-ui calculations
|
|
1537
|
+
boxSizing: "border-box",
|
|
1538
|
+
...i.style,
|
|
1539
|
+
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1540
|
+
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
1541
|
+
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
1542
|
+
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1543
|
+
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
);
|
|
1547
|
+
});
|
|
1548
|
+
et.displayName = Bo;
|
|
1549
|
+
var [$o, mt] = we(me, {}), tt = "SelectViewport", hr = l.forwardRef(
|
|
1550
|
+
(e, r) => {
|
|
1551
|
+
const { __scopeSelect: t, nonce: o, ...n } = e, i = le(tt, t), s = mt(tt, t), c = V(r, i.onViewportChange), d = l.useRef(0);
|
|
1552
|
+
return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
1553
|
+
/* @__PURE__ */ a.jsx(
|
|
1554
|
+
"style",
|
|
1555
|
+
{
|
|
1556
|
+
dangerouslySetInnerHTML: {
|
|
1557
|
+
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
1558
|
+
},
|
|
1559
|
+
nonce: o
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
/* @__PURE__ */ a.jsx(Be.Slot, { scope: t, children: /* @__PURE__ */ a.jsx(
|
|
1563
|
+
N.div,
|
|
1564
|
+
{
|
|
1565
|
+
"data-radix-select-viewport": "",
|
|
1566
|
+
role: "presentation",
|
|
1567
|
+
...n,
|
|
1568
|
+
ref: c,
|
|
1569
|
+
style: {
|
|
1570
|
+
// we use position: 'relative' here on the `viewport` so that when we call
|
|
1571
|
+
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
1572
|
+
// (independent of the scrollUpButton).
|
|
1573
|
+
position: "relative",
|
|
1574
|
+
flex: 1,
|
|
1575
|
+
// Viewport should only be scrollable in the vertical direction.
|
|
1576
|
+
// This won't work in vertical writing modes, so we'll need to
|
|
1577
|
+
// revisit this if/when that is supported
|
|
1578
|
+
// https://developer.chrome.com/blog/vertical-form-controls
|
|
1579
|
+
overflow: "hidden auto",
|
|
1580
|
+
...n.style
|
|
1581
|
+
},
|
|
1582
|
+
onScroll: _(n.onScroll, (u) => {
|
|
1583
|
+
const p = u.currentTarget, { contentWrapper: f, shouldExpandOnScrollRef: x } = s;
|
|
1584
|
+
if (x?.current && f) {
|
|
1585
|
+
const g = Math.abs(d.current - p.scrollTop);
|
|
1586
|
+
if (g > 0) {
|
|
1587
|
+
const w = window.innerHeight - Q * 2, m = parseFloat(f.style.minHeight), v = parseFloat(f.style.height), b = Math.max(m, v);
|
|
1588
|
+
if (b < w) {
|
|
1589
|
+
const S = b + g, y = Math.min(w, S), I = S - y;
|
|
1590
|
+
f.style.height = y + "px", f.style.bottom === "0px" && (p.scrollTop = I > 0 ? I : 0, f.style.justifyContent = "flex-end");
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
d.current = p.scrollTop;
|
|
1595
|
+
})
|
|
1596
|
+
}
|
|
1597
|
+
) })
|
|
1598
|
+
] });
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
hr.displayName = tt;
|
|
1602
|
+
var vr = "SelectGroup", [Vo, Ko] = we(vr), Ho = l.forwardRef(
|
|
1603
|
+
(e, r) => {
|
|
1604
|
+
const { __scopeSelect: t, ...o } = e, n = te();
|
|
1605
|
+
return /* @__PURE__ */ a.jsx(Vo, { scope: t, id: n, children: /* @__PURE__ */ a.jsx(N.div, { role: "group", "aria-labelledby": n, ...o, ref: r }) });
|
|
1606
|
+
}
|
|
1607
|
+
);
|
|
1608
|
+
Ho.displayName = vr;
|
|
1609
|
+
var xr = "SelectLabel", Uo = l.forwardRef(
|
|
1610
|
+
(e, r) => {
|
|
1611
|
+
const { __scopeSelect: t, ...o } = e, n = Ko(xr, t);
|
|
1612
|
+
return /* @__PURE__ */ a.jsx(N.div, { id: n.id, ...o, ref: r });
|
|
1613
|
+
}
|
|
1614
|
+
);
|
|
1615
|
+
Uo.displayName = xr;
|
|
1616
|
+
var Pe = "SelectItem", [Go, gr] = we(Pe), br = l.forwardRef(
|
|
1617
|
+
(e, r) => {
|
|
1618
|
+
const {
|
|
1619
|
+
__scopeSelect: t,
|
|
1620
|
+
value: o,
|
|
1621
|
+
disabled: n = !1,
|
|
1622
|
+
textValue: i,
|
|
1623
|
+
...s
|
|
1624
|
+
} = e, c = ie(Pe, t), d = le(Pe, t), u = c.value === o, [p, f] = l.useState(i ?? ""), [x, g] = l.useState(!1), w = V(
|
|
1625
|
+
r,
|
|
1626
|
+
(S) => d.itemRefCallback?.(S, o, n)
|
|
1627
|
+
), m = te(), v = l.useRef("touch"), b = () => {
|
|
1628
|
+
n || (c.onValueChange(o), c.onOpenChange(!1));
|
|
1629
|
+
};
|
|
1630
|
+
if (o === "")
|
|
1631
|
+
throw new Error(
|
|
1632
|
+
"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."
|
|
1633
|
+
);
|
|
1634
|
+
return /* @__PURE__ */ a.jsx(
|
|
1635
|
+
Go,
|
|
1636
|
+
{
|
|
1637
|
+
scope: t,
|
|
1638
|
+
value: o,
|
|
1639
|
+
disabled: n,
|
|
1640
|
+
textId: m,
|
|
1641
|
+
isSelected: u,
|
|
1642
|
+
onItemTextChange: l.useCallback((S) => {
|
|
1643
|
+
f((y) => y || (S?.textContent ?? "").trim());
|
|
1644
|
+
}, []),
|
|
1645
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1646
|
+
Be.ItemSlot,
|
|
1647
|
+
{
|
|
1648
|
+
scope: t,
|
|
1649
|
+
value: o,
|
|
1650
|
+
disabled: n,
|
|
1651
|
+
textValue: p,
|
|
1652
|
+
children: /* @__PURE__ */ a.jsx(
|
|
1653
|
+
N.div,
|
|
1654
|
+
{
|
|
1655
|
+
role: "option",
|
|
1656
|
+
"aria-labelledby": m,
|
|
1657
|
+
"data-highlighted": x ? "" : void 0,
|
|
1658
|
+
"aria-selected": u && x,
|
|
1659
|
+
"data-state": u ? "checked" : "unchecked",
|
|
1660
|
+
"aria-disabled": n || void 0,
|
|
1661
|
+
"data-disabled": n ? "" : void 0,
|
|
1662
|
+
tabIndex: n ? void 0 : -1,
|
|
1663
|
+
...s,
|
|
1664
|
+
ref: w,
|
|
1665
|
+
onFocus: _(s.onFocus, () => g(!0)),
|
|
1666
|
+
onBlur: _(s.onBlur, () => g(!1)),
|
|
1667
|
+
onClick: _(s.onClick, () => {
|
|
1668
|
+
v.current !== "mouse" && b();
|
|
1669
|
+
}),
|
|
1670
|
+
onPointerUp: _(s.onPointerUp, () => {
|
|
1671
|
+
v.current === "mouse" && b();
|
|
1672
|
+
}),
|
|
1673
|
+
onPointerDown: _(s.onPointerDown, (S) => {
|
|
1674
|
+
v.current = S.pointerType;
|
|
1675
|
+
}),
|
|
1676
|
+
onPointerMove: _(s.onPointerMove, (S) => {
|
|
1677
|
+
v.current = S.pointerType, n ? d.onItemLeave?.() : v.current === "mouse" && S.currentTarget.focus({ preventScroll: !0 });
|
|
1678
|
+
}),
|
|
1679
|
+
onPointerLeave: _(s.onPointerLeave, (S) => {
|
|
1680
|
+
S.currentTarget === document.activeElement && d.onItemLeave?.();
|
|
1681
|
+
}),
|
|
1682
|
+
onKeyDown: _(s.onKeyDown, (S) => {
|
|
1683
|
+
d.searchRef?.current !== "" && S.key === " " || (No.includes(S.key) && b(), S.key === " " && S.preventDefault());
|
|
1684
|
+
})
|
|
1685
|
+
}
|
|
1686
|
+
)
|
|
1687
|
+
}
|
|
1688
|
+
)
|
|
1689
|
+
}
|
|
1690
|
+
);
|
|
1691
|
+
}
|
|
1692
|
+
);
|
|
1693
|
+
br.displayName = Pe;
|
|
1694
|
+
var Re = "SelectItemText", wr = l.forwardRef(
|
|
1695
|
+
(e, r) => {
|
|
1696
|
+
const { __scopeSelect: t, className: o, style: n, ...i } = e, s = ie(Re, t), c = le(Re, t), d = gr(Re, t), u = Mo(Re, t), [p, f] = l.useState(null), x = V(
|
|
1697
|
+
r,
|
|
1698
|
+
(b) => f(b),
|
|
1699
|
+
d.onItemTextChange,
|
|
1700
|
+
(b) => c.itemTextRefCallback?.(b, d.value, d.disabled)
|
|
1701
|
+
), g = p?.textContent, w = l.useMemo(
|
|
1702
|
+
() => /* @__PURE__ */ a.jsx("option", { value: d.value, disabled: d.disabled, children: g }, d.value),
|
|
1703
|
+
[d.disabled, d.value, g]
|
|
1704
|
+
), { onNativeOptionAdd: m, onNativeOptionRemove: v } = u;
|
|
1705
|
+
return oe(() => (m(w), () => v(w)), [m, v, w]), /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
1706
|
+
/* @__PURE__ */ a.jsx(N.span, { id: d.textId, ...i, ref: x }),
|
|
1707
|
+
d.isSelected && s.valueNode && !s.valueNodeHasChildren ? Nt.createPortal(i.children, s.valueNode) : null
|
|
1708
|
+
] });
|
|
1709
|
+
}
|
|
1710
|
+
);
|
|
1711
|
+
wr.displayName = Re;
|
|
1712
|
+
var Sr = "SelectItemIndicator", yr = l.forwardRef(
|
|
1713
|
+
(e, r) => {
|
|
1714
|
+
const { __scopeSelect: t, ...o } = e;
|
|
1715
|
+
return gr(Sr, t).isSelected ? /* @__PURE__ */ a.jsx(N.span, { "aria-hidden": !0, ...o, ref: r }) : null;
|
|
1716
|
+
}
|
|
1717
|
+
);
|
|
1718
|
+
yr.displayName = Sr;
|
|
1719
|
+
var rt = "SelectScrollUpButton", Cr = l.forwardRef((e, r) => {
|
|
1720
|
+
const t = le(rt, e.__scopeSelect), o = mt(rt, e.__scopeSelect), [n, i] = l.useState(!1), s = V(r, o.onScrollButtonChange);
|
|
1721
|
+
return oe(() => {
|
|
1722
|
+
if (t.viewport && t.isPositioned) {
|
|
1723
|
+
let c = function() {
|
|
1724
|
+
const u = d.scrollTop > 0;
|
|
1725
|
+
i(u);
|
|
1726
|
+
};
|
|
1727
|
+
const d = t.viewport;
|
|
1728
|
+
return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
|
|
1729
|
+
}
|
|
1730
|
+
}, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ a.jsx(
|
|
1731
|
+
Ir,
|
|
1732
|
+
{
|
|
1733
|
+
...e,
|
|
1734
|
+
ref: s,
|
|
1735
|
+
onAutoScroll: () => {
|
|
1736
|
+
const { viewport: c, selectedItem: d } = t;
|
|
1737
|
+
c && d && (c.scrollTop = c.scrollTop - d.offsetHeight);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
) : null;
|
|
1741
|
+
});
|
|
1742
|
+
Cr.displayName = rt;
|
|
1743
|
+
var nt = "SelectScrollDownButton", Rr = l.forwardRef((e, r) => {
|
|
1744
|
+
const t = le(nt, e.__scopeSelect), o = mt(nt, e.__scopeSelect), [n, i] = l.useState(!1), s = V(r, o.onScrollButtonChange);
|
|
1745
|
+
return oe(() => {
|
|
1746
|
+
if (t.viewport && t.isPositioned) {
|
|
1747
|
+
let c = function() {
|
|
1748
|
+
const u = d.scrollHeight - d.clientHeight, p = Math.ceil(d.scrollTop) < u;
|
|
1749
|
+
i(p);
|
|
1750
|
+
};
|
|
1751
|
+
const d = t.viewport;
|
|
1752
|
+
return c(), d.addEventListener("scroll", c), () => d.removeEventListener("scroll", c);
|
|
1753
|
+
}
|
|
1754
|
+
}, [t.viewport, t.isPositioned]), n ? /* @__PURE__ */ a.jsx(
|
|
1755
|
+
Ir,
|
|
1756
|
+
{
|
|
1757
|
+
...e,
|
|
1758
|
+
ref: s,
|
|
1759
|
+
onAutoScroll: () => {
|
|
1760
|
+
const { viewport: c, selectedItem: d } = t;
|
|
1761
|
+
c && d && (c.scrollTop = c.scrollTop + d.offsetHeight);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
) : null;
|
|
1765
|
+
});
|
|
1766
|
+
Rr.displayName = nt;
|
|
1767
|
+
var Ir = l.forwardRef((e, r) => {
|
|
1768
|
+
const { __scopeSelect: t, onAutoScroll: o, ...n } = e, i = le("SelectScrollButton", t), s = l.useRef(null), c = $e(t), d = l.useCallback(() => {
|
|
1769
|
+
s.current !== null && (window.clearInterval(s.current), s.current = null);
|
|
1770
|
+
}, []);
|
|
1771
|
+
return l.useEffect(() => () => d(), [d]), oe(() => {
|
|
1772
|
+
c().find((p) => p.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
1773
|
+
}, [c]), /* @__PURE__ */ a.jsx(
|
|
1774
|
+
N.div,
|
|
1775
|
+
{
|
|
1776
|
+
"aria-hidden": !0,
|
|
1777
|
+
...n,
|
|
1778
|
+
ref: r,
|
|
1779
|
+
style: { flexShrink: 0, ...n.style },
|
|
1780
|
+
onPointerDown: _(n.onPointerDown, () => {
|
|
1781
|
+
s.current === null && (s.current = window.setInterval(o, 50));
|
|
1782
|
+
}),
|
|
1783
|
+
onPointerMove: _(n.onPointerMove, () => {
|
|
1784
|
+
i.onItemLeave?.(), s.current === null && (s.current = window.setInterval(o, 50));
|
|
1785
|
+
}),
|
|
1786
|
+
onPointerLeave: _(n.onPointerLeave, () => {
|
|
1787
|
+
d();
|
|
1788
|
+
})
|
|
1789
|
+
}
|
|
1790
|
+
);
|
|
1791
|
+
}), zo = "SelectSeparator", Wo = l.forwardRef(
|
|
1792
|
+
(e, r) => {
|
|
1793
|
+
const { __scopeSelect: t, ...o } = e;
|
|
1794
|
+
return /* @__PURE__ */ a.jsx(N.div, { "aria-hidden": !0, ...o, ref: r });
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
Wo.displayName = zo;
|
|
1798
|
+
var ot = "SelectArrow", qo = l.forwardRef(
|
|
1799
|
+
(e, r) => {
|
|
1800
|
+
const { __scopeSelect: t, ...o } = e, n = Ve(t), i = ie(ot, t), s = le(ot, t);
|
|
1801
|
+
return i.open && s.position === "popper" ? /* @__PURE__ */ a.jsx(Sn, { ...n, ...o, ref: r }) : null;
|
|
1802
|
+
}
|
|
1803
|
+
);
|
|
1804
|
+
qo.displayName = ot;
|
|
1805
|
+
var Yo = "SelectBubbleInput", kr = l.forwardRef(
|
|
1806
|
+
({ __scopeSelect: e, value: r, ...t }, o) => {
|
|
1807
|
+
const n = l.useRef(null), i = V(o, n), s = Ee(r);
|
|
1808
|
+
return l.useEffect(() => {
|
|
1809
|
+
const c = n.current;
|
|
1810
|
+
if (!c) return;
|
|
1811
|
+
const d = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(
|
|
1812
|
+
d,
|
|
1813
|
+
"value"
|
|
1814
|
+
).set;
|
|
1815
|
+
if (s !== r && p) {
|
|
1816
|
+
const f = new Event("change", { bubbles: !0 });
|
|
1817
|
+
p.call(c, r), c.dispatchEvent(f);
|
|
1818
|
+
}
|
|
1819
|
+
}, [s, r]), /* @__PURE__ */ a.jsx(
|
|
1820
|
+
N.select,
|
|
1821
|
+
{
|
|
1822
|
+
...t,
|
|
1823
|
+
style: { ...mn, ...t.style },
|
|
1824
|
+
ref: i,
|
|
1825
|
+
defaultValue: r
|
|
1826
|
+
}
|
|
1827
|
+
);
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
kr.displayName = Yo;
|
|
1831
|
+
function Er(e) {
|
|
1832
|
+
return e === "" || e === void 0;
|
|
1833
|
+
}
|
|
1834
|
+
function jr(e) {
|
|
1835
|
+
const r = yt(e), t = l.useRef(""), o = l.useRef(0), n = l.useCallback(
|
|
1836
|
+
(s) => {
|
|
1837
|
+
const c = t.current + s;
|
|
1838
|
+
r(c), function d(u) {
|
|
1839
|
+
t.current = u, window.clearTimeout(o.current), u !== "" && (o.current = window.setTimeout(() => d(""), 1e3));
|
|
1840
|
+
}(c);
|
|
1841
|
+
},
|
|
1842
|
+
[r]
|
|
1843
|
+
), i = l.useCallback(() => {
|
|
1844
|
+
t.current = "", window.clearTimeout(o.current);
|
|
1845
|
+
}, []);
|
|
1846
|
+
return l.useEffect(() => () => window.clearTimeout(o.current), []), [t, n, i];
|
|
1847
|
+
}
|
|
1848
|
+
function Nr(e, r, t) {
|
|
1849
|
+
const n = r.length > 1 && Array.from(r).every((u) => u === r[0]) ? r[0] : r, i = t ? e.indexOf(t) : -1;
|
|
1850
|
+
let s = Xo(e, Math.max(i, 0));
|
|
1851
|
+
n.length === 1 && (s = s.filter((u) => u !== t));
|
|
1852
|
+
const d = s.find(
|
|
1853
|
+
(u) => u.textValue.toLowerCase().startsWith(n.toLowerCase())
|
|
1854
|
+
);
|
|
1855
|
+
return d !== t ? d : void 0;
|
|
1856
|
+
}
|
|
1857
|
+
function Xo(e, r) {
|
|
1858
|
+
return e.map((t, o) => e[(r + o) % e.length]);
|
|
1859
|
+
}
|
|
1860
|
+
var Zo = or, Jo = sr, Qo = lr, ea = cr, ta = dr, ra = ur, na = hr, oa = br, aa = wr, sa = yr, ia = Cr, la = Rr;
|
|
1861
|
+
function ca({ ...e }) {
|
|
1862
|
+
return /* @__PURE__ */ a.jsx(Zo, { "data-slot": "select", ...e });
|
|
1863
|
+
}
|
|
1864
|
+
function da({ ...e }) {
|
|
1865
|
+
return /* @__PURE__ */ a.jsx(Qo, { "data-slot": "select-value", ...e });
|
|
1866
|
+
}
|
|
1867
|
+
function ua({
|
|
1868
|
+
className: e,
|
|
1869
|
+
size: r = "default",
|
|
1870
|
+
children: t,
|
|
1871
|
+
...o
|
|
1872
|
+
}) {
|
|
1873
|
+
return /* @__PURE__ */ a.jsxs(
|
|
1874
|
+
Jo,
|
|
1875
|
+
{
|
|
1876
|
+
className: A(
|
|
1877
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1878
|
+
e
|
|
1879
|
+
),
|
|
1880
|
+
"data-size": r,
|
|
1881
|
+
"data-slot": "select-trigger",
|
|
1882
|
+
...o,
|
|
1883
|
+
children: [
|
|
1884
|
+
t,
|
|
1885
|
+
/* @__PURE__ */ a.jsx(ea, { asChild: !0, children: /* @__PURE__ */ a.jsx(jt, { className: "size-4 opacity-50" }) })
|
|
1886
|
+
]
|
|
1887
|
+
}
|
|
1888
|
+
);
|
|
1889
|
+
}
|
|
1890
|
+
function pa({
|
|
1891
|
+
className: e,
|
|
1892
|
+
children: r,
|
|
1893
|
+
position: t = "popper",
|
|
1894
|
+
align: o = "center",
|
|
1895
|
+
...n
|
|
1896
|
+
}) {
|
|
1897
|
+
return /* @__PURE__ */ a.jsx(ta, { children: /* @__PURE__ */ a.jsxs(
|
|
1898
|
+
ra,
|
|
1899
|
+
{
|
|
1900
|
+
align: o,
|
|
1901
|
+
className: A(
|
|
1902
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out 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-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
1903
|
+
t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
1904
|
+
e
|
|
1905
|
+
),
|
|
1906
|
+
"data-slot": "select-content",
|
|
1907
|
+
position: t,
|
|
1908
|
+
...n,
|
|
1909
|
+
children: [
|
|
1910
|
+
/* @__PURE__ */ a.jsx(ma, {}),
|
|
1911
|
+
/* @__PURE__ */ a.jsx(
|
|
1912
|
+
na,
|
|
1913
|
+
{
|
|
1914
|
+
className: A(
|
|
1915
|
+
"p-1",
|
|
1916
|
+
t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
1917
|
+
),
|
|
1918
|
+
children: r
|
|
1919
|
+
}
|
|
1920
|
+
),
|
|
1921
|
+
/* @__PURE__ */ a.jsx(ha, {})
|
|
1922
|
+
]
|
|
1923
|
+
}
|
|
1924
|
+
) });
|
|
1925
|
+
}
|
|
1926
|
+
function fa({ className: e, children: r, ...t }) {
|
|
1927
|
+
return /* @__PURE__ */ a.jsxs(
|
|
1928
|
+
oa,
|
|
1929
|
+
{
|
|
1930
|
+
className: A(
|
|
1931
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
1932
|
+
e
|
|
1933
|
+
),
|
|
1934
|
+
"data-slot": "select-item",
|
|
1935
|
+
...t,
|
|
1936
|
+
children: [
|
|
1937
|
+
/* @__PURE__ */ a.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ a.jsx(sa, { children: /* @__PURE__ */ a.jsx(ut, { className: "size-4" }) }) }),
|
|
1938
|
+
/* @__PURE__ */ a.jsx(aa, { children: r })
|
|
1939
|
+
]
|
|
1940
|
+
}
|
|
1941
|
+
);
|
|
1942
|
+
}
|
|
1943
|
+
function ma({ className: e, ...r }) {
|
|
1944
|
+
return /* @__PURE__ */ a.jsx(
|
|
1945
|
+
ia,
|
|
1946
|
+
{
|
|
1947
|
+
className: A("flex cursor-default items-center justify-center py-1", e),
|
|
1948
|
+
"data-slot": "select-scroll-up-button",
|
|
1949
|
+
...r,
|
|
1950
|
+
children: /* @__PURE__ */ a.jsx(_n, { className: "size-4" })
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
function ha({
|
|
1955
|
+
className: e,
|
|
1956
|
+
...r
|
|
1957
|
+
}) {
|
|
1958
|
+
return /* @__PURE__ */ a.jsx(
|
|
1959
|
+
la,
|
|
1960
|
+
{
|
|
1961
|
+
className: A("flex cursor-default items-center justify-center py-1", e),
|
|
1962
|
+
"data-slot": "select-scroll-down-button",
|
|
1963
|
+
...r,
|
|
1964
|
+
children: /* @__PURE__ */ a.jsx(jt, { className: "size-4" })
|
|
1965
|
+
}
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
const $s = ({
|
|
1969
|
+
name: e,
|
|
1970
|
+
defaultValue: r,
|
|
1971
|
+
options: t,
|
|
1972
|
+
label: o,
|
|
1973
|
+
placeholder: n,
|
|
1974
|
+
note: i,
|
|
1975
|
+
className: s,
|
|
1976
|
+
value: c,
|
|
1977
|
+
onValueChange: d,
|
|
1978
|
+
error: u,
|
|
1979
|
+
size: p = "md",
|
|
1980
|
+
...f
|
|
1981
|
+
}) => {
|
|
1982
|
+
const x = A(
|
|
1983
|
+
"min-w-[180px]",
|
|
1984
|
+
p === "xs" && "h-7 text-xs md:text-xs",
|
|
1985
|
+
p === "sm" && "h-8 text-sm md:text-xs",
|
|
1986
|
+
p === "md" && "h-9 text-base md:text-sm",
|
|
1987
|
+
p === "lg" && "h-10 text-lg md:text-base",
|
|
1988
|
+
p === "xl" && "h-11 text-xl md:text-lg",
|
|
1989
|
+
s
|
|
1990
|
+
), g = p === "xs" || p === "sm" ? "sm" : "default";
|
|
1991
|
+
return /* @__PURE__ */ a.jsxs(ne, { className: "w-full", direction: "col", gap: "2", children: [
|
|
1992
|
+
o && /* @__PURE__ */ a.jsx(ae, { htmlFor: e, children: o }),
|
|
1993
|
+
/* @__PURE__ */ a.jsxs(
|
|
1994
|
+
ca,
|
|
1995
|
+
{
|
|
1996
|
+
defaultValue: r,
|
|
1997
|
+
name: e,
|
|
1998
|
+
onValueChange: d,
|
|
1999
|
+
value: c,
|
|
2000
|
+
...f,
|
|
2001
|
+
children: [
|
|
2002
|
+
/* @__PURE__ */ a.jsx(ua, { className: x, "data-testid": `select-input-${e}`, size: g, children: /* @__PURE__ */ a.jsx(da, { placeholder: n }) }),
|
|
2003
|
+
/* @__PURE__ */ a.jsx(pa, { children: t.map(({ value: w, label: m }) => /* @__PURE__ */ a.jsx(fa, { value: w, children: m }, `option-${w}`)) })
|
|
2004
|
+
]
|
|
2005
|
+
}
|
|
2006
|
+
),
|
|
2007
|
+
i && /* @__PURE__ */ a.jsx(Ae, { size: "sm", variant: "muted", children: i }),
|
|
2008
|
+
u && /* @__PURE__ */ a.jsx(je, { message: u })
|
|
2009
|
+
] });
|
|
2010
|
+
};
|
|
2011
|
+
var gt = 1, va = 0.9, xa = 0.8, ga = 0.17, Xe = 0.1, Ze = 0.999, ba = 0.9999, wa = 0.99, Sa = /[\\\/_+.#"@\[\(\{&]/, ya = /[\\\/_+.#"@\[\(\{&]/g, Ca = /[\s-]/, _r = /[\s-]/g;
|
|
2012
|
+
function at(e, r, t, o, n, i, s) {
|
|
2013
|
+
if (i === r.length) return n === e.length ? gt : wa;
|
|
2014
|
+
var c = `${n},${i}`;
|
|
2015
|
+
if (s[c] !== void 0) return s[c];
|
|
2016
|
+
for (var d = o.charAt(i), u = t.indexOf(d, n), p = 0, f, x, g, w; u >= 0; ) f = at(e, r, t, o, u + 1, i + 1, s), f > p && (u === n ? f *= gt : Sa.test(e.charAt(u - 1)) ? (f *= xa, g = e.slice(n, u - 1).match(ya), g && n > 0 && (f *= Math.pow(Ze, g.length))) : Ca.test(e.charAt(u - 1)) ? (f *= va, w = e.slice(n, u - 1).match(_r), w && n > 0 && (f *= Math.pow(Ze, w.length))) : (f *= ga, n > 0 && (f *= Math.pow(Ze, u - n))), e.charAt(u) !== r.charAt(i) && (f *= ba)), (f < Xe && t.charAt(u - 1) === o.charAt(i + 1) || o.charAt(i + 1) === o.charAt(i) && t.charAt(u - 1) !== o.charAt(i)) && (x = at(e, r, t, o, u + 1, i + 2, s), x * Xe > f && (f = x * Xe)), f > p && (p = f), u = t.indexOf(d, u + 1);
|
|
2017
|
+
return s[c] = p, p;
|
|
2018
|
+
}
|
|
2019
|
+
function bt(e) {
|
|
2020
|
+
return e.toLowerCase().replace(_r, " ");
|
|
2021
|
+
}
|
|
2022
|
+
function Ra(e, r, t) {
|
|
2023
|
+
return e = t && t.length > 0 ? `${e + " " + t.join(" ")}` : e, at(e, r, bt(e), bt(r), 0, 0, {});
|
|
2024
|
+
}
|
|
2025
|
+
var Ce = '[cmdk-group=""]', Je = '[cmdk-group-items=""]', Ia = '[cmdk-group-heading=""]', Pr = '[cmdk-item=""]', wt = `${Pr}:not([aria-disabled="true"])`, st = "cmdk-item-select", ge = "data-value", ka = (e, r, t) => Ra(e, r, t), Tr = l.createContext(void 0), Ne = () => l.useContext(Tr), Mr = l.createContext(void 0), ht = () => l.useContext(Mr), Ar = l.createContext(void 0), Dr = l.forwardRef((e, r) => {
|
|
2026
|
+
let t = be(() => {
|
|
2027
|
+
var h, k;
|
|
2028
|
+
return { search: "", value: (k = (h = e.value) != null ? h : e.defaultValue) != null ? k : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
2029
|
+
}), o = be(() => /* @__PURE__ */ new Set()), n = be(() => /* @__PURE__ */ new Map()), i = be(() => /* @__PURE__ */ new Map()), s = be(() => /* @__PURE__ */ new Set()), c = Or(e), { label: d, children: u, value: p, onValueChange: f, filter: x, shouldFilter: g, loop: w, disablePointerSelection: m = !1, vimBindings: v = !0, ...b } = e, S = te(), y = te(), I = te(), D = l.useRef(null), P = Fa();
|
|
2030
|
+
he(() => {
|
|
2031
|
+
if (p !== void 0) {
|
|
2032
|
+
let h = p.trim();
|
|
2033
|
+
t.current.value = h, j.emit();
|
|
2034
|
+
}
|
|
2035
|
+
}, [p]), he(() => {
|
|
2036
|
+
P(6, X);
|
|
2037
|
+
}, []);
|
|
2038
|
+
let j = l.useMemo(() => ({ subscribe: (h) => (s.current.add(h), () => s.current.delete(h)), snapshot: () => t.current, setState: (h, k, E) => {
|
|
2039
|
+
var R, T, C, M;
|
|
2040
|
+
if (!Object.is(t.current[h], k)) {
|
|
2041
|
+
if (t.current[h] = k, h === "search") K(), z(), P(1, O);
|
|
2042
|
+
else if (h === "value") {
|
|
2043
|
+
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
2044
|
+
let B = document.getElementById(I);
|
|
2045
|
+
B ? B.focus() : (R = document.getElementById(S)) == null || R.focus();
|
|
2046
|
+
}
|
|
2047
|
+
if (P(7, () => {
|
|
2048
|
+
var B;
|
|
2049
|
+
t.current.selectedItemId = (B = W()) == null ? void 0 : B.id, j.emit();
|
|
2050
|
+
}), E || P(5, X), ((T = c.current) == null ? void 0 : T.value) !== void 0) {
|
|
2051
|
+
let B = k ?? "";
|
|
2052
|
+
(M = (C = c.current).onValueChange) == null || M.call(C, B);
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
j.emit();
|
|
2057
|
+
}
|
|
2058
|
+
}, emit: () => {
|
|
2059
|
+
s.current.forEach((h) => h());
|
|
2060
|
+
} }), []), L = l.useMemo(() => ({ value: (h, k, E) => {
|
|
2061
|
+
var R;
|
|
2062
|
+
k !== ((R = i.current.get(h)) == null ? void 0 : R.value) && (i.current.set(h, { value: k, keywords: E }), t.current.filtered.items.set(h, Z(k, E)), P(2, () => {
|
|
2063
|
+
z(), j.emit();
|
|
2064
|
+
}));
|
|
2065
|
+
}, item: (h, k) => (o.current.add(h), k && (n.current.has(k) ? n.current.get(k).add(h) : n.current.set(k, /* @__PURE__ */ new Set([h]))), P(3, () => {
|
|
2066
|
+
K(), z(), t.current.value || O(), j.emit();
|
|
2067
|
+
}), () => {
|
|
2068
|
+
i.current.delete(h), o.current.delete(h), t.current.filtered.items.delete(h);
|
|
2069
|
+
let E = W();
|
|
2070
|
+
P(4, () => {
|
|
2071
|
+
K(), E?.getAttribute("id") === h && O(), j.emit();
|
|
2072
|
+
});
|
|
2073
|
+
}), group: (h) => (n.current.has(h) || n.current.set(h, /* @__PURE__ */ new Set()), () => {
|
|
2074
|
+
i.current.delete(h), n.current.delete(h);
|
|
2075
|
+
}), filter: () => c.current.shouldFilter, label: d || e["aria-label"], getDisablePointerSelection: () => c.current.disablePointerSelection, listId: S, inputId: I, labelId: y, listInnerRef: D }), []);
|
|
2076
|
+
function Z(h, k) {
|
|
2077
|
+
var E, R;
|
|
2078
|
+
let T = (R = (E = c.current) == null ? void 0 : E.filter) != null ? R : ka;
|
|
2079
|
+
return h ? T(h, t.current.search, k) : 0;
|
|
2080
|
+
}
|
|
2081
|
+
function z() {
|
|
2082
|
+
if (!t.current.search || c.current.shouldFilter === !1) return;
|
|
2083
|
+
let h = t.current.filtered.items, k = [];
|
|
2084
|
+
t.current.filtered.groups.forEach((R) => {
|
|
2085
|
+
let T = n.current.get(R), C = 0;
|
|
2086
|
+
T.forEach((M) => {
|
|
2087
|
+
let B = h.get(M);
|
|
2088
|
+
C = Math.max(B, C);
|
|
2089
|
+
}), k.push([R, C]);
|
|
2090
|
+
});
|
|
2091
|
+
let E = D.current;
|
|
2092
|
+
U().sort((R, T) => {
|
|
2093
|
+
var C, M;
|
|
2094
|
+
let B = R.getAttribute("id"), $ = T.getAttribute("id");
|
|
2095
|
+
return ((C = h.get($)) != null ? C : 0) - ((M = h.get(B)) != null ? M : 0);
|
|
2096
|
+
}).forEach((R) => {
|
|
2097
|
+
let T = R.closest(Je);
|
|
2098
|
+
T ? T.appendChild(R.parentElement === T ? R : R.closest(`${Je} > *`)) : E.appendChild(R.parentElement === E ? R : R.closest(`${Je} > *`));
|
|
2099
|
+
}), k.sort((R, T) => T[1] - R[1]).forEach((R) => {
|
|
2100
|
+
var T;
|
|
2101
|
+
let C = (T = D.current) == null ? void 0 : T.querySelector(`${Ce}[${ge}="${encodeURIComponent(R[0])}"]`);
|
|
2102
|
+
C?.parentElement.appendChild(C);
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
function O() {
|
|
2106
|
+
let h = U().find((E) => E.getAttribute("aria-disabled") !== "true"), k = h?.getAttribute(ge);
|
|
2107
|
+
j.setState("value", k || void 0);
|
|
2108
|
+
}
|
|
2109
|
+
function K() {
|
|
2110
|
+
var h, k, E, R;
|
|
2111
|
+
if (!t.current.search || c.current.shouldFilter === !1) {
|
|
2112
|
+
t.current.filtered.count = o.current.size;
|
|
2113
|
+
return;
|
|
2114
|
+
}
|
|
2115
|
+
t.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
2116
|
+
let T = 0;
|
|
2117
|
+
for (let C of o.current) {
|
|
2118
|
+
let M = (k = (h = i.current.get(C)) == null ? void 0 : h.value) != null ? k : "", B = (R = (E = i.current.get(C)) == null ? void 0 : E.keywords) != null ? R : [], $ = Z(M, B);
|
|
2119
|
+
t.current.filtered.items.set(C, $), $ > 0 && T++;
|
|
2120
|
+
}
|
|
2121
|
+
for (let [C, M] of n.current) for (let B of M) if (t.current.filtered.items.get(B) > 0) {
|
|
2122
|
+
t.current.filtered.groups.add(C);
|
|
2123
|
+
break;
|
|
2124
|
+
}
|
|
2125
|
+
t.current.filtered.count = T;
|
|
2126
|
+
}
|
|
2127
|
+
function X() {
|
|
2128
|
+
var h, k, E;
|
|
2129
|
+
let R = W();
|
|
2130
|
+
R && (((h = R.parentElement) == null ? void 0 : h.firstChild) === R && ((E = (k = R.closest(Ce)) == null ? void 0 : k.querySelector(Ia)) == null || E.scrollIntoView({ block: "nearest" })), R.scrollIntoView({ block: "nearest" }));
|
|
2131
|
+
}
|
|
2132
|
+
function W() {
|
|
2133
|
+
var h;
|
|
2134
|
+
return (h = D.current) == null ? void 0 : h.querySelector(`${Pr}[aria-selected="true"]`);
|
|
2135
|
+
}
|
|
2136
|
+
function U() {
|
|
2137
|
+
var h;
|
|
2138
|
+
return Array.from(((h = D.current) == null ? void 0 : h.querySelectorAll(wt)) || []);
|
|
2139
|
+
}
|
|
2140
|
+
function F(h) {
|
|
2141
|
+
let k = U()[h];
|
|
2142
|
+
k && j.setState("value", k.getAttribute(ge));
|
|
2143
|
+
}
|
|
2144
|
+
function G(h) {
|
|
2145
|
+
var k;
|
|
2146
|
+
let E = W(), R = U(), T = R.findIndex((M) => M === E), C = R[T + h];
|
|
2147
|
+
(k = c.current) != null && k.loop && (C = T + h < 0 ? R[R.length - 1] : T + h === R.length ? R[0] : R[T + h]), C && j.setState("value", C.getAttribute(ge));
|
|
2148
|
+
}
|
|
2149
|
+
function q(h) {
|
|
2150
|
+
let k = W(), E = k?.closest(Ce), R;
|
|
2151
|
+
for (; E && !R; ) E = h > 0 ? Da(E, Ce) : Oa(E, Ce), R = E?.querySelector(wt);
|
|
2152
|
+
R ? j.setState("value", R.getAttribute(ge)) : G(h);
|
|
2153
|
+
}
|
|
2154
|
+
let J = () => F(U().length - 1), xe = (h) => {
|
|
2155
|
+
h.preventDefault(), h.metaKey ? J() : h.altKey ? q(1) : G(1);
|
|
2156
|
+
}, ce = (h) => {
|
|
2157
|
+
h.preventDefault(), h.metaKey ? F(0) : h.altKey ? q(-1) : G(-1);
|
|
2158
|
+
};
|
|
2159
|
+
return l.createElement(N.div, { ref: r, tabIndex: -1, ...b, "cmdk-root": "", onKeyDown: (h) => {
|
|
2160
|
+
var k;
|
|
2161
|
+
(k = b.onKeyDown) == null || k.call(b, h);
|
|
2162
|
+
let E = h.nativeEvent.isComposing || h.keyCode === 229;
|
|
2163
|
+
if (!(h.defaultPrevented || E)) switch (h.key) {
|
|
2164
|
+
case "n":
|
|
2165
|
+
case "j": {
|
|
2166
|
+
v && h.ctrlKey && xe(h);
|
|
2167
|
+
break;
|
|
2168
|
+
}
|
|
2169
|
+
case "ArrowDown": {
|
|
2170
|
+
xe(h);
|
|
2171
|
+
break;
|
|
2172
|
+
}
|
|
2173
|
+
case "p":
|
|
2174
|
+
case "k": {
|
|
2175
|
+
v && h.ctrlKey && ce(h);
|
|
2176
|
+
break;
|
|
2177
|
+
}
|
|
2178
|
+
case "ArrowUp": {
|
|
2179
|
+
ce(h);
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2182
|
+
case "Home": {
|
|
2183
|
+
h.preventDefault(), F(0);
|
|
2184
|
+
break;
|
|
2185
|
+
}
|
|
2186
|
+
case "End": {
|
|
2187
|
+
h.preventDefault(), J();
|
|
2188
|
+
break;
|
|
2189
|
+
}
|
|
2190
|
+
case "Enter": {
|
|
2191
|
+
h.preventDefault();
|
|
2192
|
+
let R = W();
|
|
2193
|
+
if (R) {
|
|
2194
|
+
let T = new Event(st);
|
|
2195
|
+
R.dispatchEvent(T);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
} }, l.createElement("label", { "cmdk-label": "", htmlFor: L.inputId, id: L.labelId, style: Ba }, d), Ke(e, (h) => l.createElement(Mr.Provider, { value: j }, l.createElement(Tr.Provider, { value: L }, h))));
|
|
2200
|
+
}), Ea = l.forwardRef((e, r) => {
|
|
2201
|
+
var t, o;
|
|
2202
|
+
let n = te(), i = l.useRef(null), s = l.useContext(Ar), c = Ne(), d = Or(e), u = (o = (t = d.current) == null ? void 0 : t.forceMount) != null ? o : s?.forceMount;
|
|
2203
|
+
he(() => {
|
|
2204
|
+
if (!u) return c.item(n, s?.id);
|
|
2205
|
+
}, [u]);
|
|
2206
|
+
let p = Fr(n, i, [e.value, e.children, i], e.keywords), f = ht(), x = se((P) => P.value && P.value === p.current), g = se((P) => u || c.filter() === !1 ? !0 : P.search ? P.filtered.items.get(n) > 0 : !0);
|
|
2207
|
+
l.useEffect(() => {
|
|
2208
|
+
let P = i.current;
|
|
2209
|
+
if (!(!P || e.disabled)) return P.addEventListener(st, w), () => P.removeEventListener(st, w);
|
|
2210
|
+
}, [g, e.onSelect, e.disabled]);
|
|
2211
|
+
function w() {
|
|
2212
|
+
var P, j;
|
|
2213
|
+
m(), (j = (P = d.current).onSelect) == null || j.call(P, p.current);
|
|
2214
|
+
}
|
|
2215
|
+
function m() {
|
|
2216
|
+
f.setState("value", p.current, !0);
|
|
2217
|
+
}
|
|
2218
|
+
if (!g) return null;
|
|
2219
|
+
let { disabled: v, value: b, onSelect: S, forceMount: y, keywords: I, ...D } = e;
|
|
2220
|
+
return l.createElement(N.div, { ref: Ie(i, r), ...D, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!v, "aria-selected": !!x, "data-disabled": !!v, "data-selected": !!x, onPointerMove: v || c.getDisablePointerSelection() ? void 0 : m, onClick: v ? void 0 : w }, e.children);
|
|
2221
|
+
}), ja = l.forwardRef((e, r) => {
|
|
2222
|
+
let { heading: t, children: o, forceMount: n, ...i } = e, s = te(), c = l.useRef(null), d = l.useRef(null), u = te(), p = Ne(), f = se((g) => n || p.filter() === !1 ? !0 : g.search ? g.filtered.groups.has(s) : !0);
|
|
2223
|
+
he(() => p.group(s), []), Fr(s, c, [e.value, e.heading, d]);
|
|
2224
|
+
let x = l.useMemo(() => ({ id: s, forceMount: n }), [n]);
|
|
2225
|
+
return l.createElement(N.div, { ref: Ie(c, r), ...i, "cmdk-group": "", role: "presentation", hidden: f ? void 0 : !0 }, t && l.createElement("div", { ref: d, "cmdk-group-heading": "", "aria-hidden": !0, id: u }, t), Ke(e, (g) => l.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? u : void 0 }, l.createElement(Ar.Provider, { value: x }, g))));
|
|
2226
|
+
}), Na = l.forwardRef((e, r) => {
|
|
2227
|
+
let { alwaysRender: t, ...o } = e, n = l.useRef(null), i = se((s) => !s.search);
|
|
2228
|
+
return !t && !i ? null : l.createElement(N.div, { ref: Ie(n, r), ...o, "cmdk-separator": "", role: "separator" });
|
|
2229
|
+
}), _a = l.forwardRef((e, r) => {
|
|
2230
|
+
let { onValueChange: t, ...o } = e, n = e.value != null, i = ht(), s = se((u) => u.search), c = se((u) => u.selectedItemId), d = Ne();
|
|
2231
|
+
return l.useEffect(() => {
|
|
2232
|
+
e.value != null && i.setState("search", e.value);
|
|
2233
|
+
}, [e.value]), l.createElement(N.input, { ref: r, ...o, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": d.listId, "aria-labelledby": d.labelId, "aria-activedescendant": c, id: d.inputId, type: "text", value: n ? e.value : s, onChange: (u) => {
|
|
2234
|
+
n || i.setState("search", u.target.value), t?.(u.target.value);
|
|
2235
|
+
} });
|
|
2236
|
+
}), Pa = l.forwardRef((e, r) => {
|
|
2237
|
+
let { children: t, label: o = "Suggestions", ...n } = e, i = l.useRef(null), s = l.useRef(null), c = se((u) => u.selectedItemId), d = Ne();
|
|
2238
|
+
return l.useEffect(() => {
|
|
2239
|
+
if (s.current && i.current) {
|
|
2240
|
+
let u = s.current, p = i.current, f, x = new ResizeObserver(() => {
|
|
2241
|
+
f = requestAnimationFrame(() => {
|
|
2242
|
+
let g = u.offsetHeight;
|
|
2243
|
+
p.style.setProperty("--cmdk-list-height", g.toFixed(1) + "px");
|
|
2244
|
+
});
|
|
2245
|
+
});
|
|
2246
|
+
return x.observe(u), () => {
|
|
2247
|
+
cancelAnimationFrame(f), x.unobserve(u);
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
}, []), l.createElement(N.div, { ref: Ie(i, r), ...n, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": c, "aria-label": o, id: d.listId }, Ke(e, (u) => l.createElement("div", { ref: Ie(s, d.listInnerRef), "cmdk-list-sizer": "" }, u)));
|
|
2251
|
+
}), Ta = l.forwardRef((e, r) => {
|
|
2252
|
+
let { open: t, onOpenChange: o, overlayClassName: n, contentClassName: i, container: s, ...c } = e;
|
|
2253
|
+
return l.createElement(yn, { open: t, onOpenChange: o }, l.createElement(Cn, { container: s }, l.createElement(Rn, { "cmdk-overlay": "", className: n }), l.createElement(In, { "aria-label": e.label, "cmdk-dialog": "", className: i }, l.createElement(Dr, { ref: r, ...c }))));
|
|
2254
|
+
}), Ma = l.forwardRef((e, r) => se((t) => t.filtered.count === 0) ? l.createElement(N.div, { ref: r, ...e, "cmdk-empty": "", role: "presentation" }) : null), Aa = l.forwardRef((e, r) => {
|
|
2255
|
+
let { progress: t, children: o, label: n = "Loading...", ...i } = e;
|
|
2256
|
+
return l.createElement(N.div, { ref: r, ...i, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": n }, Ke(e, (s) => l.createElement("div", { "aria-hidden": !0 }, s)));
|
|
2257
|
+
}), Se = Object.assign(Dr, { List: Pa, Item: Ea, Input: _a, Group: ja, Separator: Na, Dialog: Ta, Empty: Ma, Loading: Aa });
|
|
2258
|
+
function Da(e, r) {
|
|
2259
|
+
let t = e.nextElementSibling;
|
|
2260
|
+
for (; t; ) {
|
|
2261
|
+
if (t.matches(r)) return t;
|
|
2262
|
+
t = t.nextElementSibling;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
function Oa(e, r) {
|
|
2266
|
+
let t = e.previousElementSibling;
|
|
2267
|
+
for (; t; ) {
|
|
2268
|
+
if (t.matches(r)) return t;
|
|
2269
|
+
t = t.previousElementSibling;
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
function Or(e) {
|
|
2273
|
+
let r = l.useRef(e);
|
|
2274
|
+
return he(() => {
|
|
2275
|
+
r.current = e;
|
|
2276
|
+
}), r;
|
|
2277
|
+
}
|
|
2278
|
+
var he = typeof window > "u" ? l.useEffect : l.useLayoutEffect;
|
|
2279
|
+
function be(e) {
|
|
2280
|
+
let r = l.useRef();
|
|
2281
|
+
return r.current === void 0 && (r.current = e()), r;
|
|
2282
|
+
}
|
|
2283
|
+
function se(e) {
|
|
2284
|
+
let r = ht(), t = () => e(r.snapshot());
|
|
2285
|
+
return l.useSyncExternalStore(r.subscribe, t, t);
|
|
2286
|
+
}
|
|
2287
|
+
function Fr(e, r, t, o = []) {
|
|
2288
|
+
let n = l.useRef(), i = Ne();
|
|
2289
|
+
return he(() => {
|
|
2290
|
+
var s;
|
|
2291
|
+
let c = (() => {
|
|
2292
|
+
var u;
|
|
2293
|
+
for (let p of t) {
|
|
2294
|
+
if (typeof p == "string") return p.trim();
|
|
2295
|
+
if (typeof p == "object" && "current" in p) return p.current ? (u = p.current.textContent) == null ? void 0 : u.trim() : n.current;
|
|
2296
|
+
}
|
|
2297
|
+
})(), d = o.map((u) => u.trim());
|
|
2298
|
+
i.value(e, c, d), (s = r.current) == null || s.setAttribute(ge, c), n.current = c;
|
|
2299
|
+
}), n;
|
|
2300
|
+
}
|
|
2301
|
+
var Fa = () => {
|
|
2302
|
+
let [e, r] = l.useState(), t = be(() => /* @__PURE__ */ new Map());
|
|
2303
|
+
return he(() => {
|
|
2304
|
+
t.current.forEach((o) => o()), t.current = /* @__PURE__ */ new Map();
|
|
2305
|
+
}, [e]), (o, n) => {
|
|
2306
|
+
t.current.set(o, n), r({});
|
|
2307
|
+
};
|
|
2308
|
+
};
|
|
2309
|
+
function La(e) {
|
|
2310
|
+
let r = e.type;
|
|
2311
|
+
return typeof r == "function" ? r(e.props) : "render" in r ? r.render(e.props) : e;
|
|
2312
|
+
}
|
|
2313
|
+
function Ke({ asChild: e, children: r }, t) {
|
|
2314
|
+
return e && l.isValidElement(r) ? l.cloneElement(La(r), { ref: r.ref }, t(r.props.children)) : t(r);
|
|
2315
|
+
}
|
|
2316
|
+
var Ba = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
|
|
2317
|
+
function $a({ className: e, ...r }) {
|
|
2318
|
+
return /* @__PURE__ */ a.jsx(
|
|
2319
|
+
Se,
|
|
2320
|
+
{
|
|
2321
|
+
className: A(
|
|
2322
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
2323
|
+
e
|
|
2324
|
+
),
|
|
2325
|
+
"data-slot": "command",
|
|
2326
|
+
...r
|
|
2327
|
+
}
|
|
2328
|
+
);
|
|
2329
|
+
}
|
|
2330
|
+
function Va({ className: e, ...r }) {
|
|
2331
|
+
return /* @__PURE__ */ a.jsxs("div", { className: "flex h-9 items-center gap-2 border-b px-3", "data-slot": "command-input-wrapper", children: [
|
|
2332
|
+
/* @__PURE__ */ a.jsx(Kn, { className: "size-4 shrink-0 opacity-50" }),
|
|
2333
|
+
/* @__PURE__ */ a.jsx(
|
|
2334
|
+
Se.Input,
|
|
2335
|
+
{
|
|
2336
|
+
className: A(
|
|
2337
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
2338
|
+
e
|
|
2339
|
+
),
|
|
2340
|
+
"data-slot": "command-input",
|
|
2341
|
+
...r
|
|
2342
|
+
}
|
|
2343
|
+
)
|
|
2344
|
+
] });
|
|
2345
|
+
}
|
|
2346
|
+
function Ka({ className: e, ...r }) {
|
|
2347
|
+
return /* @__PURE__ */ a.jsx(
|
|
2348
|
+
Se.List,
|
|
2349
|
+
{
|
|
2350
|
+
className: A("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", e),
|
|
2351
|
+
"data-slot": "command-list",
|
|
2352
|
+
...r
|
|
2353
|
+
}
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
function Ha({ ...e }) {
|
|
2357
|
+
return /* @__PURE__ */ a.jsx(Se.Empty, { className: "py-6 text-center text-sm", "data-slot": "command-empty", ...e });
|
|
2358
|
+
}
|
|
2359
|
+
function Ua({ className: e, ...r }) {
|
|
2360
|
+
return /* @__PURE__ */ a.jsx(
|
|
2361
|
+
Se.Group,
|
|
2362
|
+
{
|
|
2363
|
+
className: A(
|
|
2364
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs",
|
|
2365
|
+
e
|
|
2366
|
+
),
|
|
2367
|
+
"data-slot": "command-group",
|
|
2368
|
+
...r
|
|
2369
|
+
}
|
|
2370
|
+
);
|
|
2371
|
+
}
|
|
2372
|
+
function Ga({ className: e, ...r }) {
|
|
2373
|
+
return /* @__PURE__ */ a.jsx(
|
|
2374
|
+
Se.Item,
|
|
2375
|
+
{
|
|
2376
|
+
className: A(
|
|
2377
|
+
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2378
|
+
e
|
|
2379
|
+
),
|
|
2380
|
+
"data-slot": "command-item",
|
|
2381
|
+
...r
|
|
2382
|
+
}
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
const za = ({
|
|
2386
|
+
placeholder: e,
|
|
2387
|
+
selected: r,
|
|
2388
|
+
className: t,
|
|
2389
|
+
open: o,
|
|
2390
|
+
renderSelected: n = (i) => i.label
|
|
2391
|
+
}) => /* @__PURE__ */ a.jsx(It, { asChild: !0, children: /* @__PURE__ */ a.jsxs(an, { "aria-expanded": o, className: `justify-between ${t}`, role: "combobox", variant: "outline", children: [
|
|
2392
|
+
n(r || { label: e, value: "" }),
|
|
2393
|
+
/* @__PURE__ */ a.jsx(Tn, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
2394
|
+
] }) }), Vs = ({
|
|
2395
|
+
options: e,
|
|
2396
|
+
value: r = "",
|
|
2397
|
+
placeholder: t = "Select a value...",
|
|
2398
|
+
className: o = "",
|
|
2399
|
+
onSelect: n = () => {
|
|
2400
|
+
},
|
|
2401
|
+
renderSelected: i = (s) => s.label
|
|
2402
|
+
}) => {
|
|
2403
|
+
const [s, c] = Me(!1), d = ln(() => e.find((u) => u.value === r), [e, r]);
|
|
2404
|
+
return /* @__PURE__ */ a.jsxs(Rt, { onOpenChange: c, open: s, children: [
|
|
2405
|
+
/* @__PURE__ */ a.jsx(
|
|
2406
|
+
za,
|
|
2407
|
+
{
|
|
2408
|
+
className: `w-full ${o}`,
|
|
2409
|
+
open: s,
|
|
2410
|
+
placeholder: t,
|
|
2411
|
+
renderSelected: i,
|
|
2412
|
+
selected: d
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2415
|
+
/* @__PURE__ */ a.jsx(kt, { className: "w-full p-0", children: /* @__PURE__ */ a.jsxs($a, { value: r, children: [
|
|
2416
|
+
/* @__PURE__ */ a.jsx(Va, { "aria-label": "Search options", className: "h-9", placeholder: "Search" }),
|
|
2417
|
+
/* @__PURE__ */ a.jsxs(Ka, { children: [
|
|
2418
|
+
/* @__PURE__ */ a.jsx(Ha, { children: "No results found" }),
|
|
2419
|
+
/* @__PURE__ */ a.jsx(Ua, { children: e.map((u) => /* @__PURE__ */ a.jsxs(
|
|
2420
|
+
Ga,
|
|
2421
|
+
{
|
|
2422
|
+
onSelect: () => {
|
|
2423
|
+
c(!1), n(u.value);
|
|
2424
|
+
},
|
|
2425
|
+
value: u.value,
|
|
2426
|
+
children: [
|
|
2427
|
+
u.icon ? /* @__PURE__ */ a.jsx("span", { className: "mr-2", children: u.icon }) : "",
|
|
2428
|
+
u.label,
|
|
2429
|
+
/* @__PURE__ */ a.jsx(ut, { className: A("ml-auto", u.value === r ? "opacity-100" : "opacity-0") })
|
|
2430
|
+
]
|
|
2431
|
+
},
|
|
2432
|
+
u.value
|
|
2433
|
+
)) })
|
|
2434
|
+
] })
|
|
2435
|
+
] }) })
|
|
2436
|
+
] });
|
|
2437
|
+
};
|
|
2438
|
+
var Lr = ["PageUp", "PageDown"], Br = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], $r = {
|
|
2439
|
+
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
2440
|
+
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
2441
|
+
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
2442
|
+
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
2443
|
+
}, ye = "Slider", [it, Wa, qa] = dt(ye), [Vr, Ks] = ve(ye, [
|
|
2444
|
+
qa
|
|
2445
|
+
]), [Ya, He] = Vr(ye), Kr = l.forwardRef(
|
|
2446
|
+
(e, r) => {
|
|
2447
|
+
const {
|
|
2448
|
+
name: t,
|
|
2449
|
+
min: o = 0,
|
|
2450
|
+
max: n = 100,
|
|
2451
|
+
step: i = 1,
|
|
2452
|
+
orientation: s = "horizontal",
|
|
2453
|
+
disabled: c = !1,
|
|
2454
|
+
minStepsBetweenThumbs: d = 0,
|
|
2455
|
+
defaultValue: u = [o],
|
|
2456
|
+
value: p,
|
|
2457
|
+
onValueChange: f = () => {
|
|
2458
|
+
},
|
|
2459
|
+
onValueCommit: x = () => {
|
|
2460
|
+
},
|
|
2461
|
+
inverted: g = !1,
|
|
2462
|
+
form: w,
|
|
2463
|
+
...m
|
|
2464
|
+
} = e, v = l.useRef(/* @__PURE__ */ new Set()), b = l.useRef(0), y = s === "horizontal" ? Xa : Za, [I = [], D] = pe({
|
|
2465
|
+
prop: p,
|
|
2466
|
+
defaultProp: u,
|
|
2467
|
+
onChange: (O) => {
|
|
2468
|
+
[...v.current][b.current]?.focus(), f(O);
|
|
2469
|
+
}
|
|
2470
|
+
}), P = l.useRef(I);
|
|
2471
|
+
function j(O) {
|
|
2472
|
+
const K = rs(I, O);
|
|
2473
|
+
z(O, K);
|
|
2474
|
+
}
|
|
2475
|
+
function L(O) {
|
|
2476
|
+
z(O, b.current);
|
|
2477
|
+
}
|
|
2478
|
+
function Z() {
|
|
2479
|
+
const O = P.current[b.current];
|
|
2480
|
+
I[b.current] !== O && x(I);
|
|
2481
|
+
}
|
|
2482
|
+
function z(O, K, { commit: X } = { commit: !1 }) {
|
|
2483
|
+
const W = ss(i), U = is(Math.round((O - o) / i) * i + o, W), F = _e(U, [o, n]);
|
|
2484
|
+
D((G = []) => {
|
|
2485
|
+
const q = es(G, F, K);
|
|
2486
|
+
if (as(q, d * i)) {
|
|
2487
|
+
b.current = q.indexOf(F);
|
|
2488
|
+
const J = String(q) !== String(G);
|
|
2489
|
+
return J && X && x(q), J ? q : G;
|
|
2490
|
+
} else
|
|
2491
|
+
return G;
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
return /* @__PURE__ */ a.jsx(
|
|
2495
|
+
Ya,
|
|
2496
|
+
{
|
|
2497
|
+
scope: e.__scopeSlider,
|
|
2498
|
+
name: t,
|
|
2499
|
+
disabled: c,
|
|
2500
|
+
min: o,
|
|
2501
|
+
max: n,
|
|
2502
|
+
valueIndexToChangeRef: b,
|
|
2503
|
+
thumbs: v.current,
|
|
2504
|
+
values: I,
|
|
2505
|
+
orientation: s,
|
|
2506
|
+
form: w,
|
|
2507
|
+
children: /* @__PURE__ */ a.jsx(it.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ a.jsx(it.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ a.jsx(
|
|
2508
|
+
y,
|
|
2509
|
+
{
|
|
2510
|
+
"aria-disabled": c,
|
|
2511
|
+
"data-disabled": c ? "" : void 0,
|
|
2512
|
+
...m,
|
|
2513
|
+
ref: r,
|
|
2514
|
+
onPointerDown: _(m.onPointerDown, () => {
|
|
2515
|
+
c || (P.current = I);
|
|
2516
|
+
}),
|
|
2517
|
+
min: o,
|
|
2518
|
+
max: n,
|
|
2519
|
+
inverted: g,
|
|
2520
|
+
onSlideStart: c ? void 0 : j,
|
|
2521
|
+
onSlideMove: c ? void 0 : L,
|
|
2522
|
+
onSlideEnd: c ? void 0 : Z,
|
|
2523
|
+
onHomeKeyDown: () => !c && z(o, 0, { commit: !0 }),
|
|
2524
|
+
onEndKeyDown: () => !c && z(n, I.length - 1, { commit: !0 }),
|
|
2525
|
+
onStepKeyDown: ({ event: O, direction: K }) => {
|
|
2526
|
+
if (!c) {
|
|
2527
|
+
const U = Lr.includes(O.key) || O.shiftKey && Br.includes(O.key) ? 10 : 1, F = b.current, G = I[F], q = i * U * K;
|
|
2528
|
+
z(G + q, F, { commit: !0 });
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
) }) })
|
|
2533
|
+
}
|
|
2534
|
+
);
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
Kr.displayName = ye;
|
|
2538
|
+
var [Hr, Ur] = Vr(ye, {
|
|
2539
|
+
startEdge: "left",
|
|
2540
|
+
endEdge: "right",
|
|
2541
|
+
size: "width",
|
|
2542
|
+
direction: 1
|
|
2543
|
+
}), Xa = l.forwardRef(
|
|
2544
|
+
(e, r) => {
|
|
2545
|
+
const {
|
|
2546
|
+
min: t,
|
|
2547
|
+
max: o,
|
|
2548
|
+
dir: n,
|
|
2549
|
+
inverted: i,
|
|
2550
|
+
onSlideStart: s,
|
|
2551
|
+
onSlideMove: c,
|
|
2552
|
+
onSlideEnd: d,
|
|
2553
|
+
onStepKeyDown: u,
|
|
2554
|
+
...p
|
|
2555
|
+
} = e, [f, x] = l.useState(null), g = V(r, (y) => x(y)), w = l.useRef(void 0), m = De(n), v = m === "ltr", b = v && !i || !v && i;
|
|
2556
|
+
function S(y) {
|
|
2557
|
+
const I = w.current || f.getBoundingClientRect(), D = [0, I.width], j = vt(D, b ? [t, o] : [o, t]);
|
|
2558
|
+
return w.current = I, j(y - I.left);
|
|
2559
|
+
}
|
|
2560
|
+
return /* @__PURE__ */ a.jsx(
|
|
2561
|
+
Hr,
|
|
2562
|
+
{
|
|
2563
|
+
scope: e.__scopeSlider,
|
|
2564
|
+
startEdge: b ? "left" : "right",
|
|
2565
|
+
endEdge: b ? "right" : "left",
|
|
2566
|
+
direction: b ? 1 : -1,
|
|
2567
|
+
size: "width",
|
|
2568
|
+
children: /* @__PURE__ */ a.jsx(
|
|
2569
|
+
Gr,
|
|
2570
|
+
{
|
|
2571
|
+
dir: m,
|
|
2572
|
+
"data-orientation": "horizontal",
|
|
2573
|
+
...p,
|
|
2574
|
+
ref: g,
|
|
2575
|
+
style: {
|
|
2576
|
+
...p.style,
|
|
2577
|
+
"--radix-slider-thumb-transform": "translateX(-50%)"
|
|
2578
|
+
},
|
|
2579
|
+
onSlideStart: (y) => {
|
|
2580
|
+
const I = S(y.clientX);
|
|
2581
|
+
s?.(I);
|
|
2582
|
+
},
|
|
2583
|
+
onSlideMove: (y) => {
|
|
2584
|
+
const I = S(y.clientX);
|
|
2585
|
+
c?.(I);
|
|
2586
|
+
},
|
|
2587
|
+
onSlideEnd: () => {
|
|
2588
|
+
w.current = void 0, d?.();
|
|
2589
|
+
},
|
|
2590
|
+
onStepKeyDown: (y) => {
|
|
2591
|
+
const D = $r[b ? "from-left" : "from-right"].includes(y.key);
|
|
2592
|
+
u?.({ event: y, direction: D ? -1 : 1 });
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
)
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
), Za = l.forwardRef(
|
|
2600
|
+
(e, r) => {
|
|
2601
|
+
const {
|
|
2602
|
+
min: t,
|
|
2603
|
+
max: o,
|
|
2604
|
+
inverted: n,
|
|
2605
|
+
onSlideStart: i,
|
|
2606
|
+
onSlideMove: s,
|
|
2607
|
+
onSlideEnd: c,
|
|
2608
|
+
onStepKeyDown: d,
|
|
2609
|
+
...u
|
|
2610
|
+
} = e, p = l.useRef(null), f = V(r, p), x = l.useRef(void 0), g = !n;
|
|
2611
|
+
function w(m) {
|
|
2612
|
+
const v = x.current || p.current.getBoundingClientRect(), b = [0, v.height], y = vt(b, g ? [o, t] : [t, o]);
|
|
2613
|
+
return x.current = v, y(m - v.top);
|
|
2614
|
+
}
|
|
2615
|
+
return /* @__PURE__ */ a.jsx(
|
|
2616
|
+
Hr,
|
|
2617
|
+
{
|
|
2618
|
+
scope: e.__scopeSlider,
|
|
2619
|
+
startEdge: g ? "bottom" : "top",
|
|
2620
|
+
endEdge: g ? "top" : "bottom",
|
|
2621
|
+
size: "height",
|
|
2622
|
+
direction: g ? 1 : -1,
|
|
2623
|
+
children: /* @__PURE__ */ a.jsx(
|
|
2624
|
+
Gr,
|
|
2625
|
+
{
|
|
2626
|
+
"data-orientation": "vertical",
|
|
2627
|
+
...u,
|
|
2628
|
+
ref: f,
|
|
2629
|
+
style: {
|
|
2630
|
+
...u.style,
|
|
2631
|
+
"--radix-slider-thumb-transform": "translateY(50%)"
|
|
2632
|
+
},
|
|
2633
|
+
onSlideStart: (m) => {
|
|
2634
|
+
const v = w(m.clientY);
|
|
2635
|
+
i?.(v);
|
|
2636
|
+
},
|
|
2637
|
+
onSlideMove: (m) => {
|
|
2638
|
+
const v = w(m.clientY);
|
|
2639
|
+
s?.(v);
|
|
2640
|
+
},
|
|
2641
|
+
onSlideEnd: () => {
|
|
2642
|
+
x.current = void 0, c?.();
|
|
2643
|
+
},
|
|
2644
|
+
onStepKeyDown: (m) => {
|
|
2645
|
+
const b = $r[g ? "from-bottom" : "from-top"].includes(m.key);
|
|
2646
|
+
d?.({ event: m, direction: b ? -1 : 1 });
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
)
|
|
2650
|
+
}
|
|
2651
|
+
);
|
|
2652
|
+
}
|
|
2653
|
+
), Gr = l.forwardRef(
|
|
2654
|
+
(e, r) => {
|
|
2655
|
+
const {
|
|
2656
|
+
__scopeSlider: t,
|
|
2657
|
+
onSlideStart: o,
|
|
2658
|
+
onSlideMove: n,
|
|
2659
|
+
onSlideEnd: i,
|
|
2660
|
+
onHomeKeyDown: s,
|
|
2661
|
+
onEndKeyDown: c,
|
|
2662
|
+
onStepKeyDown: d,
|
|
2663
|
+
...u
|
|
2664
|
+
} = e, p = He(ye, t);
|
|
2665
|
+
return /* @__PURE__ */ a.jsx(
|
|
2666
|
+
N.span,
|
|
2667
|
+
{
|
|
2668
|
+
...u,
|
|
2669
|
+
ref: r,
|
|
2670
|
+
onKeyDown: _(e.onKeyDown, (f) => {
|
|
2671
|
+
f.key === "Home" ? (s(f), f.preventDefault()) : f.key === "End" ? (c(f), f.preventDefault()) : Lr.concat(Br).includes(f.key) && (d(f), f.preventDefault());
|
|
2672
|
+
}),
|
|
2673
|
+
onPointerDown: _(e.onPointerDown, (f) => {
|
|
2674
|
+
const x = f.target;
|
|
2675
|
+
x.setPointerCapture(f.pointerId), f.preventDefault(), p.thumbs.has(x) ? x.focus() : o(f);
|
|
2676
|
+
}),
|
|
2677
|
+
onPointerMove: _(e.onPointerMove, (f) => {
|
|
2678
|
+
f.target.hasPointerCapture(f.pointerId) && n(f);
|
|
2679
|
+
}),
|
|
2680
|
+
onPointerUp: _(e.onPointerUp, (f) => {
|
|
2681
|
+
const x = f.target;
|
|
2682
|
+
x.hasPointerCapture(f.pointerId) && (x.releasePointerCapture(f.pointerId), i(f));
|
|
2683
|
+
})
|
|
2684
|
+
}
|
|
2685
|
+
);
|
|
2686
|
+
}
|
|
2687
|
+
), zr = "SliderTrack", Wr = l.forwardRef(
|
|
2688
|
+
(e, r) => {
|
|
2689
|
+
const { __scopeSlider: t, ...o } = e, n = He(zr, t);
|
|
2690
|
+
return /* @__PURE__ */ a.jsx(
|
|
2691
|
+
N.span,
|
|
2692
|
+
{
|
|
2693
|
+
"data-disabled": n.disabled ? "" : void 0,
|
|
2694
|
+
"data-orientation": n.orientation,
|
|
2695
|
+
...o,
|
|
2696
|
+
ref: r
|
|
2697
|
+
}
|
|
2698
|
+
);
|
|
2699
|
+
}
|
|
2700
|
+
);
|
|
2701
|
+
Wr.displayName = zr;
|
|
2702
|
+
var lt = "SliderRange", qr = l.forwardRef(
|
|
2703
|
+
(e, r) => {
|
|
2704
|
+
const { __scopeSlider: t, ...o } = e, n = He(lt, t), i = Ur(lt, t), s = l.useRef(null), c = V(r, s), d = n.values.length, u = n.values.map(
|
|
2705
|
+
(x) => Zr(x, n.min, n.max)
|
|
2706
|
+
), p = d > 1 ? Math.min(...u) : 0, f = 100 - Math.max(...u);
|
|
2707
|
+
return /* @__PURE__ */ a.jsx(
|
|
2708
|
+
N.span,
|
|
2709
|
+
{
|
|
2710
|
+
"data-orientation": n.orientation,
|
|
2711
|
+
"data-disabled": n.disabled ? "" : void 0,
|
|
2712
|
+
...o,
|
|
2713
|
+
ref: c,
|
|
2714
|
+
style: {
|
|
2715
|
+
...e.style,
|
|
2716
|
+
[i.startEdge]: p + "%",
|
|
2717
|
+
[i.endEdge]: f + "%"
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
);
|
|
2721
|
+
}
|
|
2722
|
+
);
|
|
2723
|
+
qr.displayName = lt;
|
|
2724
|
+
var ct = "SliderThumb", Yr = l.forwardRef(
|
|
2725
|
+
(e, r) => {
|
|
2726
|
+
const t = Wa(e.__scopeSlider), [o, n] = l.useState(null), i = V(r, (c) => n(c)), s = l.useMemo(
|
|
2727
|
+
() => o ? t().findIndex((c) => c.ref.current === o) : -1,
|
|
2728
|
+
[t, o]
|
|
2729
|
+
);
|
|
2730
|
+
return /* @__PURE__ */ a.jsx(Ja, { ...e, ref: i, index: s });
|
|
2731
|
+
}
|
|
2732
|
+
), Ja = l.forwardRef(
|
|
2733
|
+
(e, r) => {
|
|
2734
|
+
const { __scopeSlider: t, index: o, name: n, ...i } = e, s = He(ct, t), c = Ur(ct, t), [d, u] = l.useState(null), p = V(r, (S) => u(S)), f = d ? s.form || !!d.closest("form") : !0, x = Oe(d), g = s.values[o], w = g === void 0 ? 0 : Zr(g, s.min, s.max), m = ts(o, s.values.length), v = x?.[c.size], b = v ? ns(v, w, c.direction) : 0;
|
|
2735
|
+
return l.useEffect(() => {
|
|
2736
|
+
if (d)
|
|
2737
|
+
return s.thumbs.add(d), () => {
|
|
2738
|
+
s.thumbs.delete(d);
|
|
2739
|
+
};
|
|
2740
|
+
}, [d, s.thumbs]), /* @__PURE__ */ a.jsxs(
|
|
2741
|
+
"span",
|
|
2742
|
+
{
|
|
2743
|
+
style: {
|
|
2744
|
+
transform: "var(--radix-slider-thumb-transform)",
|
|
2745
|
+
position: "absolute",
|
|
2746
|
+
[c.startEdge]: `calc(${w}% + ${b}px)`
|
|
2747
|
+
},
|
|
2748
|
+
children: [
|
|
2749
|
+
/* @__PURE__ */ a.jsx(it.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ a.jsx(
|
|
2750
|
+
N.span,
|
|
2751
|
+
{
|
|
2752
|
+
role: "slider",
|
|
2753
|
+
"aria-label": e["aria-label"] || m,
|
|
2754
|
+
"aria-valuemin": s.min,
|
|
2755
|
+
"aria-valuenow": g,
|
|
2756
|
+
"aria-valuemax": s.max,
|
|
2757
|
+
"aria-orientation": s.orientation,
|
|
2758
|
+
"data-orientation": s.orientation,
|
|
2759
|
+
"data-disabled": s.disabled ? "" : void 0,
|
|
2760
|
+
tabIndex: s.disabled ? void 0 : 0,
|
|
2761
|
+
...i,
|
|
2762
|
+
ref: p,
|
|
2763
|
+
style: g === void 0 ? { display: "none" } : e.style,
|
|
2764
|
+
onFocus: _(e.onFocus, () => {
|
|
2765
|
+
s.valueIndexToChangeRef.current = o;
|
|
2766
|
+
})
|
|
2767
|
+
}
|
|
2768
|
+
) }),
|
|
2769
|
+
f && /* @__PURE__ */ a.jsx(
|
|
2770
|
+
Xr,
|
|
2771
|
+
{
|
|
2772
|
+
name: n ?? (s.name ? s.name + (s.values.length > 1 ? "[]" : "") : void 0),
|
|
2773
|
+
form: s.form,
|
|
2774
|
+
value: g
|
|
2775
|
+
},
|
|
2776
|
+
o
|
|
2777
|
+
)
|
|
2778
|
+
]
|
|
2779
|
+
}
|
|
2780
|
+
);
|
|
2781
|
+
}
|
|
2782
|
+
);
|
|
2783
|
+
Yr.displayName = ct;
|
|
2784
|
+
var Qa = "RadioBubbleInput", Xr = l.forwardRef(
|
|
2785
|
+
({ __scopeSlider: e, value: r, ...t }, o) => {
|
|
2786
|
+
const n = l.useRef(null), i = V(n, o), s = Ee(r);
|
|
2787
|
+
return l.useEffect(() => {
|
|
2788
|
+
const c = n.current;
|
|
2789
|
+
if (!c) return;
|
|
2790
|
+
const d = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(d, "value").set;
|
|
2791
|
+
if (s !== r && p) {
|
|
2792
|
+
const f = new Event("input", { bubbles: !0 });
|
|
2793
|
+
p.call(c, r), c.dispatchEvent(f);
|
|
2794
|
+
}
|
|
2795
|
+
}, [s, r]), /* @__PURE__ */ a.jsx(
|
|
2796
|
+
N.input,
|
|
2797
|
+
{
|
|
2798
|
+
style: { display: "none" },
|
|
2799
|
+
...t,
|
|
2800
|
+
ref: i,
|
|
2801
|
+
defaultValue: r
|
|
2802
|
+
}
|
|
2803
|
+
);
|
|
2804
|
+
}
|
|
2805
|
+
);
|
|
2806
|
+
Xr.displayName = Qa;
|
|
2807
|
+
function es(e = [], r, t) {
|
|
2808
|
+
const o = [...e];
|
|
2809
|
+
return o[t] = r, o.sort((n, i) => n - i);
|
|
2810
|
+
}
|
|
2811
|
+
function Zr(e, r, t) {
|
|
2812
|
+
const i = 100 / (t - r) * (e - r);
|
|
2813
|
+
return _e(i, [0, 100]);
|
|
2814
|
+
}
|
|
2815
|
+
function ts(e, r) {
|
|
2816
|
+
return r > 2 ? `Value ${e + 1} of ${r}` : r === 2 ? ["Minimum", "Maximum"][e] : void 0;
|
|
2817
|
+
}
|
|
2818
|
+
function rs(e, r) {
|
|
2819
|
+
if (e.length === 1) return 0;
|
|
2820
|
+
const t = e.map((n) => Math.abs(n - r)), o = Math.min(...t);
|
|
2821
|
+
return t.indexOf(o);
|
|
2822
|
+
}
|
|
2823
|
+
function ns(e, r, t) {
|
|
2824
|
+
const o = e / 2, i = vt([0, 50], [0, o]);
|
|
2825
|
+
return (o - i(r) * t) * t;
|
|
2826
|
+
}
|
|
2827
|
+
function os(e) {
|
|
2828
|
+
return e.slice(0, -1).map((r, t) => e[t + 1] - r);
|
|
2829
|
+
}
|
|
2830
|
+
function as(e, r) {
|
|
2831
|
+
if (r > 0) {
|
|
2832
|
+
const t = os(e);
|
|
2833
|
+
return Math.min(...t) >= r;
|
|
2834
|
+
}
|
|
2835
|
+
return !0;
|
|
2836
|
+
}
|
|
2837
|
+
function vt(e, r) {
|
|
2838
|
+
return (t) => {
|
|
2839
|
+
if (e[0] === e[1] || r[0] === r[1]) return r[0];
|
|
2840
|
+
const o = (r[1] - r[0]) / (e[1] - e[0]);
|
|
2841
|
+
return r[0] + o * (t - e[0]);
|
|
2842
|
+
};
|
|
2843
|
+
}
|
|
2844
|
+
function ss(e) {
|
|
2845
|
+
return (String(e).split(".")[1] || "").length;
|
|
2846
|
+
}
|
|
2847
|
+
function is(e, r) {
|
|
2848
|
+
const t = Math.pow(10, r);
|
|
2849
|
+
return Math.round(e * t) / t;
|
|
2850
|
+
}
|
|
2851
|
+
var ls = Kr, cs = Wr, ds = qr, us = Yr;
|
|
2852
|
+
function ps({
|
|
2853
|
+
className: e,
|
|
2854
|
+
trackClassName: r,
|
|
2855
|
+
thumbClassName: t,
|
|
2856
|
+
defaultValue: o,
|
|
2857
|
+
value: n,
|
|
2858
|
+
min: i = 0,
|
|
2859
|
+
max: s = 100,
|
|
2860
|
+
...c
|
|
2861
|
+
}) {
|
|
2862
|
+
const d = l.useMemo(
|
|
2863
|
+
() => Array.isArray(n) ? n : Array.isArray(o) ? o : [i, s],
|
|
2864
|
+
[n, o, i, s]
|
|
2865
|
+
);
|
|
2866
|
+
return /* @__PURE__ */ a.jsxs(
|
|
2867
|
+
ls,
|
|
2868
|
+
{
|
|
2869
|
+
className: A(
|
|
2870
|
+
"relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
2871
|
+
e
|
|
2872
|
+
),
|
|
2873
|
+
"data-slot": "slider",
|
|
2874
|
+
defaultValue: o,
|
|
2875
|
+
max: s,
|
|
2876
|
+
min: i,
|
|
2877
|
+
value: n,
|
|
2878
|
+
...c,
|
|
2879
|
+
children: [
|
|
2880
|
+
/* @__PURE__ */ a.jsx(
|
|
2881
|
+
cs,
|
|
2882
|
+
{
|
|
2883
|
+
className: A(
|
|
2884
|
+
"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
|
|
2885
|
+
r
|
|
2886
|
+
),
|
|
2887
|
+
"data-slot": "slider-track",
|
|
2888
|
+
children: /* @__PURE__ */ a.jsx(
|
|
2889
|
+
ds,
|
|
2890
|
+
{
|
|
2891
|
+
className: A("bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"),
|
|
2892
|
+
"data-slot": "slider-range"
|
|
2893
|
+
}
|
|
2894
|
+
)
|
|
2895
|
+
}
|
|
2896
|
+
),
|
|
2897
|
+
Array.from({ length: d.length }, (u, p) => /* @__PURE__ */ a.jsx(
|
|
2898
|
+
us,
|
|
2899
|
+
{
|
|
2900
|
+
className: A(
|
|
2901
|
+
"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50",
|
|
2902
|
+
t
|
|
2903
|
+
),
|
|
2904
|
+
"data-slot": "slider-thumb"
|
|
2905
|
+
},
|
|
2906
|
+
p
|
|
2907
|
+
))
|
|
2908
|
+
]
|
|
2909
|
+
}
|
|
2910
|
+
);
|
|
2911
|
+
}
|
|
2912
|
+
const Hs = ({ size: e = "md", ...r }) => /* @__PURE__ */ a.jsx(
|
|
2913
|
+
ps,
|
|
2914
|
+
{
|
|
2915
|
+
thumbClassName: A({
|
|
2916
|
+
"size-2": e === "xs",
|
|
2917
|
+
"size-3": e === "sm",
|
|
2918
|
+
"size-4": e === "md",
|
|
2919
|
+
"size-5": e === "lg",
|
|
2920
|
+
"size-6": e === "xl"
|
|
2921
|
+
}),
|
|
2922
|
+
trackClassName: A({
|
|
2923
|
+
"data-[orientation=horizontal]:h-1 data-[orientation=vertical]:w-1": e === "xs",
|
|
2924
|
+
"data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5": e === "sm",
|
|
2925
|
+
"data-[orientation=horizontal]:h-2 data-[orientation=vertical]:w-2": e === "md",
|
|
2926
|
+
"data-[orientation=horizontal]:h-3 data-[orientation=vertical]:w-3": e === "lg",
|
|
2927
|
+
"data-[orientation=horizontal]:h-4 data-[orientation=vertical]:w-4": e === "xl"
|
|
2928
|
+
}),
|
|
2929
|
+
...r
|
|
2930
|
+
}
|
|
2931
|
+
);
|
|
2932
|
+
var Ue = "Switch", [fs, Us] = ve(Ue), [ms, hs] = fs(Ue), Jr = l.forwardRef(
|
|
2933
|
+
(e, r) => {
|
|
2934
|
+
const {
|
|
2935
|
+
__scopeSwitch: t,
|
|
2936
|
+
name: o,
|
|
2937
|
+
checked: n,
|
|
2938
|
+
defaultChecked: i,
|
|
2939
|
+
required: s,
|
|
2940
|
+
disabled: c,
|
|
2941
|
+
value: d = "on",
|
|
2942
|
+
onCheckedChange: u,
|
|
2943
|
+
form: p,
|
|
2944
|
+
...f
|
|
2945
|
+
} = e, [x, g] = l.useState(null), w = V(r, (y) => g(y)), m = l.useRef(!1), v = x ? p || !!x.closest("form") : !0, [b, S] = pe({
|
|
2946
|
+
prop: n,
|
|
2947
|
+
defaultProp: i ?? !1,
|
|
2948
|
+
onChange: u,
|
|
2949
|
+
caller: Ue
|
|
2950
|
+
});
|
|
2951
|
+
return /* @__PURE__ */ a.jsxs(ms, { scope: t, checked: b, disabled: c, children: [
|
|
2952
|
+
/* @__PURE__ */ a.jsx(
|
|
2953
|
+
N.button,
|
|
2954
|
+
{
|
|
2955
|
+
type: "button",
|
|
2956
|
+
role: "switch",
|
|
2957
|
+
"aria-checked": b,
|
|
2958
|
+
"aria-required": s,
|
|
2959
|
+
"data-state": rn(b),
|
|
2960
|
+
"data-disabled": c ? "" : void 0,
|
|
2961
|
+
disabled: c,
|
|
2962
|
+
value: d,
|
|
2963
|
+
...f,
|
|
2964
|
+
ref: w,
|
|
2965
|
+
onClick: _(e.onClick, (y) => {
|
|
2966
|
+
S((I) => !I), v && (m.current = y.isPropagationStopped(), m.current || y.stopPropagation());
|
|
2967
|
+
})
|
|
2968
|
+
}
|
|
2969
|
+
),
|
|
2970
|
+
v && /* @__PURE__ */ a.jsx(
|
|
2971
|
+
tn,
|
|
2972
|
+
{
|
|
2973
|
+
control: x,
|
|
2974
|
+
bubbles: !m.current,
|
|
2975
|
+
name: o,
|
|
2976
|
+
value: d,
|
|
2977
|
+
checked: b,
|
|
2978
|
+
required: s,
|
|
2979
|
+
disabled: c,
|
|
2980
|
+
form: p,
|
|
2981
|
+
style: { transform: "translateX(-100%)" }
|
|
2982
|
+
}
|
|
2983
|
+
)
|
|
2984
|
+
] });
|
|
2985
|
+
}
|
|
2986
|
+
);
|
|
2987
|
+
Jr.displayName = Ue;
|
|
2988
|
+
var Qr = "SwitchThumb", en = l.forwardRef(
|
|
2989
|
+
(e, r) => {
|
|
2990
|
+
const { __scopeSwitch: t, ...o } = e, n = hs(Qr, t);
|
|
2991
|
+
return /* @__PURE__ */ a.jsx(
|
|
2992
|
+
N.span,
|
|
2993
|
+
{
|
|
2994
|
+
"data-state": rn(n.checked),
|
|
2995
|
+
"data-disabled": n.disabled ? "" : void 0,
|
|
2996
|
+
...o,
|
|
2997
|
+
ref: r
|
|
2998
|
+
}
|
|
2999
|
+
);
|
|
3000
|
+
}
|
|
3001
|
+
);
|
|
3002
|
+
en.displayName = Qr;
|
|
3003
|
+
var vs = "SwitchBubbleInput", tn = l.forwardRef(
|
|
3004
|
+
({
|
|
3005
|
+
__scopeSwitch: e,
|
|
3006
|
+
control: r,
|
|
3007
|
+
checked: t,
|
|
3008
|
+
bubbles: o = !0,
|
|
3009
|
+
...n
|
|
3010
|
+
}, i) => {
|
|
3011
|
+
const s = l.useRef(null), c = V(s, i), d = Ee(t), u = Oe(r);
|
|
3012
|
+
return l.useEffect(() => {
|
|
3013
|
+
const p = s.current;
|
|
3014
|
+
if (!p) return;
|
|
3015
|
+
const f = window.HTMLInputElement.prototype, g = Object.getOwnPropertyDescriptor(
|
|
3016
|
+
f,
|
|
3017
|
+
"checked"
|
|
3018
|
+
).set;
|
|
3019
|
+
if (d !== t && g) {
|
|
3020
|
+
const w = new Event("click", { bubbles: o });
|
|
3021
|
+
g.call(p, t), p.dispatchEvent(w);
|
|
3022
|
+
}
|
|
3023
|
+
}, [d, t, o]), /* @__PURE__ */ a.jsx(
|
|
3024
|
+
"input",
|
|
3025
|
+
{
|
|
3026
|
+
type: "checkbox",
|
|
3027
|
+
"aria-hidden": !0,
|
|
3028
|
+
defaultChecked: t,
|
|
3029
|
+
...n,
|
|
3030
|
+
tabIndex: -1,
|
|
3031
|
+
ref: c,
|
|
3032
|
+
style: {
|
|
3033
|
+
...n.style,
|
|
3034
|
+
...u,
|
|
3035
|
+
position: "absolute",
|
|
3036
|
+
pointerEvents: "none",
|
|
3037
|
+
opacity: 0,
|
|
3038
|
+
margin: 0
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
);
|
|
3042
|
+
}
|
|
3043
|
+
);
|
|
3044
|
+
tn.displayName = vs;
|
|
3045
|
+
function rn(e) {
|
|
3046
|
+
return e ? "checked" : "unchecked";
|
|
3047
|
+
}
|
|
3048
|
+
var xs = Jr, gs = en;
|
|
3049
|
+
function bs({
|
|
3050
|
+
className: e,
|
|
3051
|
+
thumbClassName: r,
|
|
3052
|
+
...t
|
|
3053
|
+
}) {
|
|
3054
|
+
return /* @__PURE__ */ a.jsx(
|
|
3055
|
+
xs,
|
|
3056
|
+
{
|
|
3057
|
+
className: A(
|
|
3058
|
+
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
3059
|
+
e
|
|
3060
|
+
),
|
|
3061
|
+
"data-slot": "switch",
|
|
3062
|
+
...t,
|
|
3063
|
+
children: /* @__PURE__ */ a.jsx(
|
|
3064
|
+
gs,
|
|
3065
|
+
{
|
|
3066
|
+
className: A(
|
|
3067
|
+
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
|
|
3068
|
+
r
|
|
3069
|
+
),
|
|
3070
|
+
"data-slot": "switch-thumb"
|
|
3071
|
+
}
|
|
3072
|
+
)
|
|
3073
|
+
}
|
|
3074
|
+
);
|
|
3075
|
+
}
|
|
3076
|
+
const Gs = ({ id: e, label: r, leftLabel: t, rightLabel: o, size: n = "md" }) => {
|
|
3077
|
+
const i = e || `switch-${Math.random().toString(36).substring(2, 15)}`;
|
|
3078
|
+
return /* @__PURE__ */ a.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3079
|
+
t && /* @__PURE__ */ a.jsx(ae, { className: "cursor-pointer", htmlFor: i, size: n, children: t }),
|
|
3080
|
+
/* @__PURE__ */ a.jsx(
|
|
3081
|
+
bs,
|
|
3082
|
+
{
|
|
3083
|
+
className: A({
|
|
3084
|
+
"h-[10px] w-4": n === "xs",
|
|
3085
|
+
"h-[14px] w-6": n === "sm",
|
|
3086
|
+
"h-[18px] w-8": n === "md",
|
|
3087
|
+
"h-[22px] w-10": n === "lg",
|
|
3088
|
+
"h-[26px] w-12": n === "xl"
|
|
3089
|
+
}),
|
|
3090
|
+
id: i,
|
|
3091
|
+
thumbClassName: A({
|
|
3092
|
+
"size-2": n === "xs",
|
|
3093
|
+
"size-3": n === "sm",
|
|
3094
|
+
"size-4": n === "sm",
|
|
3095
|
+
"size-5": n === "lg",
|
|
3096
|
+
"size-6": n === "xl"
|
|
3097
|
+
})
|
|
3098
|
+
}
|
|
3099
|
+
),
|
|
3100
|
+
/* @__PURE__ */ a.jsx(ae, { className: "cursor-pointer", htmlFor: i, size: n, children: o || r })
|
|
3101
|
+
] });
|
|
3102
|
+
};
|
|
3103
|
+
function ws({ className: e, ...r }) {
|
|
3104
|
+
return /* @__PURE__ */ a.jsx(
|
|
3105
|
+
"textarea",
|
|
3106
|
+
{
|
|
3107
|
+
className: A(
|
|
3108
|
+
"field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground 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 md:text-sm dark:aria-invalid:ring-destructive/40",
|
|
3109
|
+
e
|
|
3110
|
+
),
|
|
3111
|
+
"data-slot": "textarea",
|
|
3112
|
+
...r
|
|
3113
|
+
}
|
|
3114
|
+
);
|
|
3115
|
+
}
|
|
3116
|
+
function zs({ label: e, name: r, note: t, placeholder: o, className: n, error: i, ...s }) {
|
|
3117
|
+
return /* @__PURE__ */ a.jsxs(ne, { className: "w-full", direction: "col", gap: "2", children: [
|
|
3118
|
+
e && /* @__PURE__ */ a.jsx(ae, { htmlFor: r, children: e }),
|
|
3119
|
+
/* @__PURE__ */ a.jsx(
|
|
3120
|
+
ws,
|
|
3121
|
+
{
|
|
3122
|
+
"aria-label": e || r,
|
|
3123
|
+
className: n,
|
|
3124
|
+
id: r,
|
|
3125
|
+
name: r,
|
|
3126
|
+
placeholder: o,
|
|
3127
|
+
...s
|
|
3128
|
+
}
|
|
3129
|
+
),
|
|
3130
|
+
t && /* @__PURE__ */ a.jsx(Ae, { size: "sm", variant: "muted", children: t }),
|
|
3131
|
+
i && /* @__PURE__ */ a.jsx(je, { message: i })
|
|
3132
|
+
] });
|
|
3133
|
+
}
|
|
3134
|
+
export {
|
|
3135
|
+
Ts as C,
|
|
3136
|
+
Ns as D,
|
|
3137
|
+
je as I,
|
|
3138
|
+
ae as L,
|
|
3139
|
+
Os as N,
|
|
3140
|
+
Ls as R,
|
|
3141
|
+
_s as S,
|
|
3142
|
+
zs as T,
|
|
3143
|
+
Ms as a,
|
|
3144
|
+
As as b,
|
|
3145
|
+
Ds as c,
|
|
3146
|
+
co as d,
|
|
3147
|
+
$s as e,
|
|
3148
|
+
Vs as f,
|
|
3149
|
+
Hs as g,
|
|
3150
|
+
Gs as h,
|
|
3151
|
+
Gt as i,
|
|
3152
|
+
Pt as j,
|
|
3153
|
+
ro as k,
|
|
3154
|
+
no as l
|
|
3155
|
+
};
|