@still-forest/canopy 0.28.2 → 0.29.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.
@@ -1,1971 +0,0 @@
1
- import { j as n } from "./jsx-runtime.js";
2
- import { c as q, u as A, i as Pe, B as Be, j as no } from "./calendar.js";
3
- import * as i from "react";
4
- import oe, { useState as qe, useEffect as ro } from "react";
5
- import { F as ne, G as so } from "./Layout2.js";
6
- import { T as Ve } from "./Heading.js";
7
- import { c as D } from "./index2.js";
8
- import { c as ce, b as Ye, P as N, u as ue, d as I, s as Xe, a as xe, t as Ze, i as Je, j as ao, A as co, q as Z, k as io, V as lo, v as uo, w as po, x as fo, F as mo, D as ho, m as vo, l as xo, e as go, f as bo, g as So } from "./popover.js";
9
- import * as Qe from "react-dom";
10
- /**
11
- * @license lucide-react v0.525.0 - ISC
12
- *
13
- * This source code is licensed under the ISC license.
14
- * See the LICENSE file in the root directory of this source tree.
15
- */
16
- const Co = [
17
- ["path", { d: "M8 2v4", key: "1cmpym" }],
18
- ["path", { d: "M16 2v4", key: "4m81vk" }],
19
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
20
- ["path", { d: "M3 10h18", key: "8toen8" }]
21
- ], wo = q("calendar", Co);
22
- /**
23
- * @license lucide-react v0.525.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */
28
- const yo = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], et = q("check", yo);
29
- /**
30
- * @license lucide-react v0.525.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- */
35
- const Io = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], tt = q("chevron-down", Io);
36
- /**
37
- * @license lucide-react v0.525.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */
42
- const Ro = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], _o = q("chevron-up", Ro);
43
- /**
44
- * @license lucide-react v0.525.0 - ISC
45
- *
46
- * This source code is licensed under the ISC license.
47
- * See the LICENSE file in the root directory of this source tree.
48
- */
49
- const No = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], To = q("circle", No);
50
- /**
51
- * @license lucide-react v0.525.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */
56
- const Eo = [
57
- ["path", { d: "M12 2v4", key: "3427ic" }],
58
- ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
59
- ["path", { d: "M18 12h4", key: "wj9ykh" }],
60
- ["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
61
- ["path", { d: "M12 18v4", key: "jadmvz" }],
62
- ["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
63
- ["path", { d: "M2 12h4", key: "j09sii" }],
64
- ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
65
- ], jo = q("loader", Eo);
66
- /**
67
- * @license lucide-react v0.525.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */
72
- const ko = [
73
- [
74
- "path",
75
- {
76
- 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",
77
- key: "1c8476"
78
- }
79
- ],
80
- ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
81
- ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
82
- ], Po = q("save", ko);
83
- /**
84
- * @license lucide-react v0.525.0 - ISC
85
- *
86
- * This source code is licensed under the ISC license.
87
- * See the LICENSE file in the root directory of this source tree.
88
- */
89
- const Mo = [
90
- [
91
- "path",
92
- {
93
- 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",
94
- key: "1ffxy3"
95
- }
96
- ],
97
- ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
98
- ], je = q("send", Mo);
99
- /**
100
- * @license lucide-react v0.525.0 - ISC
101
- *
102
- * This source code is licensed under the ISC license.
103
- * See the LICENSE file in the root directory of this source tree.
104
- */
105
- const Ao = [
106
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
107
- ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
108
- ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
109
- ["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
110
- ["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
111
- ], Do = q("trash-2", Ao);
112
- function ot(e) {
113
- const o = e + "CollectionProvider", [t, r] = ce(o), [s, a] = t(
114
- o,
115
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
116
- ), c = (u) => {
117
- const { scope: f, children: x } = u, h = oe.useRef(null), g = oe.useRef(/* @__PURE__ */ new Map()).current;
118
- return /* @__PURE__ */ n.jsx(s, { scope: f, itemMap: g, collectionRef: h, children: x });
119
- };
120
- c.displayName = o;
121
- const l = e + "CollectionSlot", d = Pe(l), p = oe.forwardRef(
122
- (u, f) => {
123
- const { scope: x, children: h } = u, g = a(l, x), y = A(f, g.collectionRef);
124
- return /* @__PURE__ */ n.jsx(d, { ref: y, children: h });
125
- }
126
- );
127
- p.displayName = l;
128
- const m = e + "CollectionItemSlot", v = "data-radix-collection-item", C = Pe(m), S = oe.forwardRef(
129
- (u, f) => {
130
- const { scope: x, children: h, ...g } = u, y = oe.useRef(null), j = A(f, y), O = a(m, x);
131
- return oe.useEffect(() => (O.itemMap.set(y, { ref: y, ...g }), () => void O.itemMap.delete(y))), /* @__PURE__ */ n.jsx(C, { [v]: "", ref: j, children: h });
132
- }
133
- );
134
- S.displayName = m;
135
- function b(u) {
136
- const f = a(e + "CollectionConsumer", u);
137
- return oe.useCallback(() => {
138
- const h = f.collectionRef.current;
139
- if (!h) return [];
140
- const g = Array.from(h.querySelectorAll(`[${v}]`));
141
- return Array.from(f.itemMap.values()).sort(
142
- (O, k) => g.indexOf(O.ref.current) - g.indexOf(k.ref.current)
143
- );
144
- }, [f.collectionRef, f.itemMap]);
145
- }
146
- return [
147
- { Provider: c, Slot: p, ItemSlot: S },
148
- b,
149
- r
150
- ];
151
- }
152
- var Oo = i.createContext(void 0);
153
- function Ge(e) {
154
- const o = i.useContext(Oo);
155
- return e || o || "ltr";
156
- }
157
- function $e(e) {
158
- const o = i.useRef({ value: e, previous: e });
159
- return i.useMemo(() => (o.current.value !== e && (o.current.previous = o.current.value, o.current.value = e), o.current.previous), [e]);
160
- }
161
- var ge = "Checkbox", [Lo, hr] = ce(ge), [Fo, He] = Lo(ge);
162
- function Bo(e) {
163
- const {
164
- __scopeCheckbox: o,
165
- checked: t,
166
- children: r,
167
- defaultChecked: s,
168
- disabled: a,
169
- form: c,
170
- name: l,
171
- onCheckedChange: d,
172
- required: p,
173
- value: m = "on",
174
- // @ts-expect-error
175
- internal_do_not_use_render: v
176
- } = e, [C, S] = ue({
177
- prop: t,
178
- defaultProp: s ?? !1,
179
- onChange: d,
180
- caller: ge
181
- }), [b, u] = i.useState(null), [f, x] = i.useState(null), h = i.useRef(!1), g = b ? !!c || !!b.closest("form") : (
182
- // We set this to true by default so that events bubble to forms without JS (SSR)
183
- !0
184
- ), y = {
185
- checked: C,
186
- disabled: a,
187
- setChecked: S,
188
- control: b,
189
- setControl: u,
190
- name: l,
191
- form: c,
192
- value: m,
193
- hasConsumerStoppedPropagationRef: h,
194
- required: p,
195
- defaultChecked: X(s) ? !1 : s,
196
- isFormControl: g,
197
- bubbleInput: f,
198
- setBubbleInput: x
199
- };
200
- return /* @__PURE__ */ n.jsx(
201
- Fo,
202
- {
203
- scope: o,
204
- ...y,
205
- children: Vo(v) ? v(y) : r
206
- }
207
- );
208
- }
209
- var nt = "CheckboxTrigger", rt = i.forwardRef(
210
- ({ __scopeCheckbox: e, onKeyDown: o, onClick: t, ...r }, s) => {
211
- const {
212
- control: a,
213
- value: c,
214
- disabled: l,
215
- checked: d,
216
- required: p,
217
- setControl: m,
218
- setChecked: v,
219
- hasConsumerStoppedPropagationRef: C,
220
- isFormControl: S,
221
- bubbleInput: b
222
- } = He(nt, e), u = A(s, m), f = i.useRef(d);
223
- return i.useEffect(() => {
224
- const x = a?.form;
225
- if (x) {
226
- const h = () => v(f.current);
227
- return x.addEventListener("reset", h), () => x.removeEventListener("reset", h);
228
- }
229
- }, [a, v]), /* @__PURE__ */ n.jsx(
230
- N.button,
231
- {
232
- type: "button",
233
- role: "checkbox",
234
- "aria-checked": X(d) ? "mixed" : d,
235
- "aria-required": p,
236
- "data-state": dt(d),
237
- "data-disabled": l ? "" : void 0,
238
- disabled: l,
239
- value: c,
240
- ...r,
241
- ref: u,
242
- onKeyDown: I(o, (x) => {
243
- x.key === "Enter" && x.preventDefault();
244
- }),
245
- onClick: I(t, (x) => {
246
- v((h) => X(h) ? !0 : !h), b && S && (C.current = x.isPropagationStopped(), C.current || x.stopPropagation());
247
- })
248
- }
249
- );
250
- }
251
- );
252
- rt.displayName = nt;
253
- var st = i.forwardRef(
254
- (e, o) => {
255
- const {
256
- __scopeCheckbox: t,
257
- name: r,
258
- checked: s,
259
- defaultChecked: a,
260
- required: c,
261
- disabled: l,
262
- value: d,
263
- onCheckedChange: p,
264
- form: m,
265
- ...v
266
- } = e;
267
- return /* @__PURE__ */ n.jsx(
268
- Bo,
269
- {
270
- __scopeCheckbox: t,
271
- checked: s,
272
- defaultChecked: a,
273
- disabled: l,
274
- required: c,
275
- onCheckedChange: p,
276
- name: r,
277
- form: m,
278
- value: d,
279
- internal_do_not_use_render: ({ isFormControl: C }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
280
- /* @__PURE__ */ n.jsx(
281
- rt,
282
- {
283
- ...v,
284
- ref: o,
285
- __scopeCheckbox: t
286
- }
287
- ),
288
- C && /* @__PURE__ */ n.jsx(
289
- lt,
290
- {
291
- __scopeCheckbox: t
292
- }
293
- )
294
- ] })
295
- }
296
- );
297
- }
298
- );
299
- st.displayName = ge;
300
- var at = "CheckboxIndicator", ct = i.forwardRef(
301
- (e, o) => {
302
- const { __scopeCheckbox: t, forceMount: r, ...s } = e, a = He(at, t);
303
- return /* @__PURE__ */ n.jsx(
304
- Ye,
305
- {
306
- present: r || X(a.checked) || a.checked === !0,
307
- children: /* @__PURE__ */ n.jsx(
308
- N.span,
309
- {
310
- "data-state": dt(a.checked),
311
- "data-disabled": a.disabled ? "" : void 0,
312
- ...s,
313
- ref: o,
314
- style: { pointerEvents: "none", ...e.style }
315
- }
316
- )
317
- }
318
- );
319
- }
320
- );
321
- ct.displayName = at;
322
- var it = "CheckboxBubbleInput", lt = i.forwardRef(
323
- ({ __scopeCheckbox: e, ...o }, t) => {
324
- const {
325
- control: r,
326
- hasConsumerStoppedPropagationRef: s,
327
- checked: a,
328
- defaultChecked: c,
329
- required: l,
330
- disabled: d,
331
- name: p,
332
- value: m,
333
- form: v,
334
- bubbleInput: C,
335
- setBubbleInput: S
336
- } = He(it, e), b = A(t, S), u = $e(a), f = Xe(r);
337
- i.useEffect(() => {
338
- const h = C;
339
- if (!h) return;
340
- const g = window.HTMLInputElement.prototype, j = Object.getOwnPropertyDescriptor(
341
- g,
342
- "checked"
343
- ).set, O = !s.current;
344
- if (u !== a && j) {
345
- const k = new Event("click", { bubbles: O });
346
- h.indeterminate = X(a), j.call(h, X(a) ? !1 : a), h.dispatchEvent(k);
347
- }
348
- }, [C, u, a, s]);
349
- const x = i.useRef(X(a) ? !1 : a);
350
- return /* @__PURE__ */ n.jsx(
351
- N.input,
352
- {
353
- type: "checkbox",
354
- "aria-hidden": !0,
355
- defaultChecked: c ?? x.current,
356
- required: l,
357
- disabled: d,
358
- name: p,
359
- value: m,
360
- form: v,
361
- ...o,
362
- tabIndex: -1,
363
- ref: b,
364
- style: {
365
- ...o.style,
366
- ...f,
367
- position: "absolute",
368
- pointerEvents: "none",
369
- opacity: 0,
370
- margin: 0,
371
- // We transform because the input is absolutely positioned but we have
372
- // rendered it **after** the button. This pulls it back to sit on top
373
- // of the button.
374
- transform: "translateX(-100%)"
375
- }
376
- }
377
- );
378
- }
379
- );
380
- lt.displayName = it;
381
- function Vo(e) {
382
- return typeof e == "function";
383
- }
384
- function X(e) {
385
- return e === "indeterminate";
386
- }
387
- function dt(e) {
388
- return X(e) ? "indeterminate" : e ? "checked" : "unchecked";
389
- }
390
- var ke = "rovingFocusGroup.onEntryFocus", Go = { bubbles: !1, cancelable: !0 }, pe = "RovingFocusGroup", [Me, ut, $o] = ot(pe), [Ho, pt] = ce(
391
- pe,
392
- [$o]
393
- ), [Uo, zo] = Ho(pe), ft = i.forwardRef(
394
- (e, o) => /* @__PURE__ */ n.jsx(Me.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n.jsx(Me.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n.jsx(Ko, { ...e, ref: o }) }) })
395
- );
396
- ft.displayName = pe;
397
- var Ko = i.forwardRef((e, o) => {
398
- const {
399
- __scopeRovingFocusGroup: t,
400
- orientation: r,
401
- loop: s = !1,
402
- dir: a,
403
- currentTabStopId: c,
404
- defaultCurrentTabStopId: l,
405
- onCurrentTabStopIdChange: d,
406
- onEntryFocus: p,
407
- preventScrollOnEntryFocus: m = !1,
408
- ...v
409
- } = e, C = i.useRef(null), S = A(o, C), b = Ge(a), [u, f] = ue({
410
- prop: c,
411
- defaultProp: l ?? null,
412
- onChange: d,
413
- caller: pe
414
- }), [x, h] = i.useState(!1), g = Ze(p), y = ut(t), j = i.useRef(!1), [O, k] = i.useState(0);
415
- return i.useEffect(() => {
416
- const R = C.current;
417
- if (R)
418
- return R.addEventListener(ke, g), () => R.removeEventListener(ke, g);
419
- }, [g]), /* @__PURE__ */ n.jsx(
420
- Uo,
421
- {
422
- scope: t,
423
- orientation: r,
424
- dir: b,
425
- loop: s,
426
- currentTabStopId: u,
427
- onItemFocus: i.useCallback(
428
- (R) => f(R),
429
- [f]
430
- ),
431
- onItemShiftTab: i.useCallback(() => h(!0), []),
432
- onFocusableItemAdd: i.useCallback(
433
- () => k((R) => R + 1),
434
- []
435
- ),
436
- onFocusableItemRemove: i.useCallback(
437
- () => k((R) => R - 1),
438
- []
439
- ),
440
- children: /* @__PURE__ */ n.jsx(
441
- N.div,
442
- {
443
- tabIndex: x || O === 0 ? -1 : 0,
444
- "data-orientation": r,
445
- ...v,
446
- ref: S,
447
- style: { outline: "none", ...e.style },
448
- onMouseDown: I(e.onMouseDown, () => {
449
- j.current = !0;
450
- }),
451
- onFocus: I(e.onFocus, (R) => {
452
- const $ = !j.current;
453
- if (R.target === R.currentTarget && $ && !x) {
454
- const H = new CustomEvent(ke, Go);
455
- if (R.currentTarget.dispatchEvent(H), !H.defaultPrevented) {
456
- const L = y().filter((T) => T.focusable), B = L.find((T) => T.active), U = L.find((T) => T.id === u), V = [B, U, ...L].filter(
457
- Boolean
458
- ).map((T) => T.ref.current);
459
- vt(V, m);
460
- }
461
- }
462
- j.current = !1;
463
- }),
464
- onBlur: I(e.onBlur, () => h(!1))
465
- }
466
- )
467
- }
468
- );
469
- }), mt = "RovingFocusGroupItem", ht = i.forwardRef(
470
- (e, o) => {
471
- const {
472
- __scopeRovingFocusGroup: t,
473
- focusable: r = !0,
474
- active: s = !1,
475
- tabStopId: a,
476
- children: c,
477
- ...l
478
- } = e, d = xe(), p = a || d, m = zo(mt, t), v = m.currentTabStopId === p, C = ut(t), { onFocusableItemAdd: S, onFocusableItemRemove: b, currentTabStopId: u } = m;
479
- return i.useEffect(() => {
480
- if (r)
481
- return S(), () => b();
482
- }, [r, S, b]), /* @__PURE__ */ n.jsx(
483
- Me.ItemSlot,
484
- {
485
- scope: t,
486
- id: p,
487
- focusable: r,
488
- active: s,
489
- children: /* @__PURE__ */ n.jsx(
490
- N.span,
491
- {
492
- tabIndex: v ? 0 : -1,
493
- "data-orientation": m.orientation,
494
- ...l,
495
- ref: o,
496
- onMouseDown: I(e.onMouseDown, (f) => {
497
- r ? m.onItemFocus(p) : f.preventDefault();
498
- }),
499
- onFocus: I(e.onFocus, () => m.onItemFocus(p)),
500
- onKeyDown: I(e.onKeyDown, (f) => {
501
- if (f.key === "Tab" && f.shiftKey) {
502
- m.onItemShiftTab();
503
- return;
504
- }
505
- if (f.target !== f.currentTarget) return;
506
- const x = Yo(f, m.orientation, m.dir);
507
- if (x !== void 0) {
508
- if (f.metaKey || f.ctrlKey || f.altKey || f.shiftKey) return;
509
- f.preventDefault();
510
- let g = C().filter((y) => y.focusable).map((y) => y.ref.current);
511
- if (x === "last") g.reverse();
512
- else if (x === "prev" || x === "next") {
513
- x === "prev" && g.reverse();
514
- const y = g.indexOf(f.currentTarget);
515
- g = m.loop ? Xo(g, y + 1) : g.slice(y + 1);
516
- }
517
- setTimeout(() => vt(g));
518
- }
519
- }),
520
- children: typeof c == "function" ? c({ isCurrentTabStop: v, hasTabStop: u != null }) : c
521
- }
522
- )
523
- }
524
- );
525
- }
526
- );
527
- ht.displayName = mt;
528
- var Wo = {
529
- ArrowLeft: "prev",
530
- ArrowUp: "prev",
531
- ArrowRight: "next",
532
- ArrowDown: "next",
533
- PageUp: "first",
534
- Home: "first",
535
- PageDown: "last",
536
- End: "last"
537
- };
538
- function qo(e, o) {
539
- return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
540
- }
541
- function Yo(e, o, t) {
542
- const r = qo(e.key, t);
543
- if (!(o === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(o === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
544
- return Wo[r];
545
- }
546
- function vt(e, o = !1) {
547
- const t = document.activeElement;
548
- for (const r of e)
549
- if (r === t || (r.focus({ preventScroll: o }), document.activeElement !== t)) return;
550
- }
551
- function Xo(e, o) {
552
- return e.map((t, r) => e[(o + r) % e.length]);
553
- }
554
- var Zo = ft, Jo = ht, Qo = "Label", xt = i.forwardRef((e, o) => /* @__PURE__ */ n.jsx(
555
- N.label,
556
- {
557
- ...e,
558
- ref: o,
559
- onMouseDown: (t) => {
560
- t.target.closest("button, input, select, textarea") || (e.onMouseDown?.(t), !t.defaultPrevented && t.detail > 1 && t.preventDefault());
561
- }
562
- }
563
- ));
564
- xt.displayName = Qo;
565
- var en = xt;
566
- function Ke(e, [o, t]) {
567
- return Math.min(t, Math.max(o, e));
568
- }
569
- var Ue = "Radio", [tn, gt] = ce(Ue), [on, nn] = tn(Ue), bt = i.forwardRef(
570
- (e, o) => {
571
- const {
572
- __scopeRadio: t,
573
- name: r,
574
- checked: s = !1,
575
- required: a,
576
- disabled: c,
577
- value: l = "on",
578
- onCheck: d,
579
- form: p,
580
- ...m
581
- } = e, [v, C] = i.useState(null), S = A(o, (f) => C(f)), b = i.useRef(!1), u = v ? p || !!v.closest("form") : !0;
582
- return /* @__PURE__ */ n.jsxs(on, { scope: t, checked: s, disabled: c, children: [
583
- /* @__PURE__ */ n.jsx(
584
- N.button,
585
- {
586
- type: "button",
587
- role: "radio",
588
- "aria-checked": s,
589
- "data-state": yt(s),
590
- "data-disabled": c ? "" : void 0,
591
- disabled: c,
592
- value: l,
593
- ...m,
594
- ref: S,
595
- onClick: I(e.onClick, (f) => {
596
- s || d?.(), u && (b.current = f.isPropagationStopped(), b.current || f.stopPropagation());
597
- })
598
- }
599
- ),
600
- u && /* @__PURE__ */ n.jsx(
601
- wt,
602
- {
603
- control: v,
604
- bubbles: !b.current,
605
- name: r,
606
- value: l,
607
- checked: s,
608
- required: a,
609
- disabled: c,
610
- form: p,
611
- style: { transform: "translateX(-100%)" }
612
- }
613
- )
614
- ] });
615
- }
616
- );
617
- bt.displayName = Ue;
618
- var St = "RadioIndicator", Ct = i.forwardRef(
619
- (e, o) => {
620
- const { __scopeRadio: t, forceMount: r, ...s } = e, a = nn(St, t);
621
- return /* @__PURE__ */ n.jsx(Ye, { present: r || a.checked, children: /* @__PURE__ */ n.jsx(
622
- N.span,
623
- {
624
- "data-state": yt(a.checked),
625
- "data-disabled": a.disabled ? "" : void 0,
626
- ...s,
627
- ref: o
628
- }
629
- ) });
630
- }
631
- );
632
- Ct.displayName = St;
633
- var rn = "RadioBubbleInput", wt = i.forwardRef(
634
- ({
635
- __scopeRadio: e,
636
- control: o,
637
- checked: t,
638
- bubbles: r = !0,
639
- ...s
640
- }, a) => {
641
- const c = i.useRef(null), l = A(c, a), d = $e(t), p = Xe(o);
642
- return i.useEffect(() => {
643
- const m = c.current;
644
- if (!m) return;
645
- const v = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(
646
- v,
647
- "checked"
648
- ).set;
649
- if (d !== t && S) {
650
- const b = new Event("click", { bubbles: r });
651
- S.call(m, t), m.dispatchEvent(b);
652
- }
653
- }, [d, t, r]), /* @__PURE__ */ n.jsx(
654
- N.input,
655
- {
656
- type: "radio",
657
- "aria-hidden": !0,
658
- defaultChecked: t,
659
- ...s,
660
- tabIndex: -1,
661
- ref: l,
662
- style: {
663
- ...s.style,
664
- ...p,
665
- position: "absolute",
666
- pointerEvents: "none",
667
- opacity: 0,
668
- margin: 0
669
- }
670
- }
671
- );
672
- }
673
- );
674
- wt.displayName = rn;
675
- function yt(e) {
676
- return e ? "checked" : "unchecked";
677
- }
678
- var sn = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], be = "RadioGroup", [an, vr] = ce(be, [
679
- pt,
680
- gt
681
- ]), It = pt(), Rt = gt(), [cn, ln] = an(be), _t = i.forwardRef(
682
- (e, o) => {
683
- const {
684
- __scopeRadioGroup: t,
685
- name: r,
686
- defaultValue: s,
687
- value: a,
688
- required: c = !1,
689
- disabled: l = !1,
690
- orientation: d,
691
- dir: p,
692
- loop: m = !0,
693
- onValueChange: v,
694
- ...C
695
- } = e, S = It(t), b = Ge(p), [u, f] = ue({
696
- prop: a,
697
- defaultProp: s ?? null,
698
- onChange: v,
699
- caller: be
700
- });
701
- return /* @__PURE__ */ n.jsx(
702
- cn,
703
- {
704
- scope: t,
705
- name: r,
706
- required: c,
707
- disabled: l,
708
- value: u,
709
- onValueChange: f,
710
- children: /* @__PURE__ */ n.jsx(
711
- Zo,
712
- {
713
- asChild: !0,
714
- ...S,
715
- orientation: d,
716
- dir: b,
717
- loop: m,
718
- children: /* @__PURE__ */ n.jsx(
719
- N.div,
720
- {
721
- role: "radiogroup",
722
- "aria-required": c,
723
- "aria-orientation": d,
724
- "data-disabled": l ? "" : void 0,
725
- dir: b,
726
- ...C,
727
- ref: o
728
- }
729
- )
730
- }
731
- )
732
- }
733
- );
734
- }
735
- );
736
- _t.displayName = be;
737
- var Nt = "RadioGroupItem", Tt = i.forwardRef(
738
- (e, o) => {
739
- const { __scopeRadioGroup: t, disabled: r, ...s } = e, a = ln(Nt, t), c = a.disabled || r, l = It(t), d = Rt(t), p = i.useRef(null), m = A(o, p), v = a.value === s.value, C = i.useRef(!1);
740
- return i.useEffect(() => {
741
- const S = (u) => {
742
- sn.includes(u.key) && (C.current = !0);
743
- }, b = () => C.current = !1;
744
- return document.addEventListener("keydown", S), document.addEventListener("keyup", b), () => {
745
- document.removeEventListener("keydown", S), document.removeEventListener("keyup", b);
746
- };
747
- }, []), /* @__PURE__ */ n.jsx(
748
- Jo,
749
- {
750
- asChild: !0,
751
- ...l,
752
- focusable: !c,
753
- active: v,
754
- children: /* @__PURE__ */ n.jsx(
755
- bt,
756
- {
757
- disabled: c,
758
- required: a.required,
759
- checked: v,
760
- ...d,
761
- ...s,
762
- name: a.name,
763
- ref: m,
764
- onCheck: () => a.onValueChange(s.value),
765
- onKeyDown: I((S) => {
766
- S.key === "Enter" && S.preventDefault();
767
- }),
768
- onFocus: I(s.onFocus, () => {
769
- C.current && p.current?.click();
770
- })
771
- }
772
- )
773
- }
774
- );
775
- }
776
- );
777
- Tt.displayName = Nt;
778
- var dn = "RadioGroupIndicator", Et = i.forwardRef(
779
- (e, o) => {
780
- const { __scopeRadioGroup: t, ...r } = e, s = Rt(t);
781
- return /* @__PURE__ */ n.jsx(Ct, { ...s, ...r, ref: o });
782
- }
783
- );
784
- Et.displayName = dn;
785
- var un = _t, pn = Tt, fn = Et, mn = [" ", "Enter", "ArrowUp", "ArrowDown"], hn = [" ", "Enter"], re = "Select", [Se, Ce, vn] = ot(re), [ie, xr] = ce(re, [
786
- vn,
787
- Je
788
- ]), we = Je(), [xn, J] = ie(re), [gn, bn] = ie(re), jt = (e) => {
789
- const {
790
- __scopeSelect: o,
791
- children: t,
792
- open: r,
793
- defaultOpen: s,
794
- onOpenChange: a,
795
- value: c,
796
- defaultValue: l,
797
- onValueChange: d,
798
- dir: p,
799
- name: m,
800
- autoComplete: v,
801
- disabled: C,
802
- required: S,
803
- form: b
804
- } = e, u = we(o), [f, x] = i.useState(null), [h, g] = i.useState(null), [y, j] = i.useState(!1), O = Ge(p), [k, R] = ue({
805
- prop: r,
806
- defaultProp: s ?? !1,
807
- onChange: a,
808
- caller: re
809
- }), [$, H] = ue({
810
- prop: c,
811
- defaultProp: l,
812
- onChange: d,
813
- caller: re
814
- }), L = i.useRef(null), B = f ? b || !!f.closest("form") : !0, [U, z] = i.useState(/* @__PURE__ */ new Set()), V = Array.from(U).map((T) => T.props.value).join(";");
815
- return /* @__PURE__ */ n.jsx(ao, { ...u, children: /* @__PURE__ */ n.jsxs(
816
- xn,
817
- {
818
- required: S,
819
- scope: o,
820
- trigger: f,
821
- onTriggerChange: x,
822
- valueNode: h,
823
- onValueNodeChange: g,
824
- valueNodeHasChildren: y,
825
- onValueNodeHasChildrenChange: j,
826
- contentId: xe(),
827
- value: $,
828
- onValueChange: H,
829
- open: k,
830
- onOpenChange: R,
831
- dir: O,
832
- triggerPointerDownPosRef: L,
833
- disabled: C,
834
- children: [
835
- /* @__PURE__ */ n.jsx(Se.Provider, { scope: o, children: /* @__PURE__ */ n.jsx(
836
- gn,
837
- {
838
- scope: e.__scopeSelect,
839
- onNativeOptionAdd: i.useCallback((T) => {
840
- z((K) => new Set(K).add(T));
841
- }, []),
842
- onNativeOptionRemove: i.useCallback((T) => {
843
- z((K) => {
844
- const W = new Set(K);
845
- return W.delete(T), W;
846
- });
847
- }, []),
848
- children: t
849
- }
850
- ) }),
851
- B ? /* @__PURE__ */ n.jsxs(
852
- Jt,
853
- {
854
- "aria-hidden": !0,
855
- required: S,
856
- tabIndex: -1,
857
- name: m,
858
- autoComplete: v,
859
- value: $,
860
- onChange: (T) => H(T.target.value),
861
- disabled: C,
862
- form: b,
863
- children: [
864
- $ === void 0 ? /* @__PURE__ */ n.jsx("option", { value: "" }) : null,
865
- Array.from(U)
866
- ]
867
- },
868
- V
869
- ) : null
870
- ]
871
- }
872
- ) });
873
- };
874
- jt.displayName = re;
875
- var kt = "SelectTrigger", Pt = i.forwardRef(
876
- (e, o) => {
877
- const { __scopeSelect: t, disabled: r = !1, ...s } = e, a = we(t), c = J(kt, t), l = c.disabled || r, d = A(o, c.onTriggerChange), p = Ce(t), m = i.useRef("touch"), [v, C, S] = eo((u) => {
878
- const f = p().filter((g) => !g.disabled), x = f.find((g) => g.value === c.value), h = to(f, u, x);
879
- h !== void 0 && c.onValueChange(h.value);
880
- }), b = (u) => {
881
- l || (c.onOpenChange(!0), S()), u && (c.triggerPointerDownPosRef.current = {
882
- x: Math.round(u.pageX),
883
- y: Math.round(u.pageY)
884
- });
885
- };
886
- return /* @__PURE__ */ n.jsx(co, { asChild: !0, ...a, children: /* @__PURE__ */ n.jsx(
887
- N.button,
888
- {
889
- type: "button",
890
- role: "combobox",
891
- "aria-controls": c.contentId,
892
- "aria-expanded": c.open,
893
- "aria-required": c.required,
894
- "aria-autocomplete": "none",
895
- dir: c.dir,
896
- "data-state": c.open ? "open" : "closed",
897
- disabled: l,
898
- "data-disabled": l ? "" : void 0,
899
- "data-placeholder": Qt(c.value) ? "" : void 0,
900
- ...s,
901
- ref: d,
902
- onClick: I(s.onClick, (u) => {
903
- u.currentTarget.focus(), m.current !== "mouse" && b(u);
904
- }),
905
- onPointerDown: I(s.onPointerDown, (u) => {
906
- m.current = u.pointerType;
907
- const f = u.target;
908
- f.hasPointerCapture(u.pointerId) && f.releasePointerCapture(u.pointerId), u.button === 0 && u.ctrlKey === !1 && u.pointerType === "mouse" && (b(u), u.preventDefault());
909
- }),
910
- onKeyDown: I(s.onKeyDown, (u) => {
911
- const f = v.current !== "";
912
- !(u.ctrlKey || u.altKey || u.metaKey) && u.key.length === 1 && C(u.key), !(f && u.key === " ") && mn.includes(u.key) && (b(), u.preventDefault());
913
- })
914
- }
915
- ) });
916
- }
917
- );
918
- Pt.displayName = kt;
919
- var Mt = "SelectValue", At = i.forwardRef(
920
- (e, o) => {
921
- const { __scopeSelect: t, className: r, style: s, children: a, placeholder: c = "", ...l } = e, d = J(Mt, t), { onValueNodeHasChildrenChange: p } = d, m = a !== void 0, v = A(o, d.onValueNodeChange);
922
- return Z(() => {
923
- p(m);
924
- }, [p, m]), /* @__PURE__ */ n.jsx(
925
- N.span,
926
- {
927
- ...l,
928
- ref: v,
929
- style: { pointerEvents: "none" },
930
- children: Qt(d.value) ? /* @__PURE__ */ n.jsx(n.Fragment, { children: c }) : a
931
- }
932
- );
933
- }
934
- );
935
- At.displayName = Mt;
936
- var Sn = "SelectIcon", Dt = i.forwardRef(
937
- (e, o) => {
938
- const { __scopeSelect: t, children: r, ...s } = e;
939
- return /* @__PURE__ */ n.jsx(N.span, { "aria-hidden": !0, ...s, ref: o, children: r || "▼" });
940
- }
941
- );
942
- Dt.displayName = Sn;
943
- var Cn = "SelectPortal", Ot = (e) => /* @__PURE__ */ n.jsx(io, { asChild: !0, ...e });
944
- Ot.displayName = Cn;
945
- var se = "SelectContent", Lt = i.forwardRef(
946
- (e, o) => {
947
- const t = J(se, e.__scopeSelect), [r, s] = i.useState();
948
- if (Z(() => {
949
- s(new DocumentFragment());
950
- }, []), !t.open) {
951
- const a = r;
952
- return a ? Qe.createPortal(
953
- /* @__PURE__ */ n.jsx(Ft, { scope: e.__scopeSelect, children: /* @__PURE__ */ n.jsx(Se.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ n.jsx("div", { children: e.children }) }) }),
954
- a
955
- ) : null;
956
- }
957
- return /* @__PURE__ */ n.jsx(Bt, { ...e, ref: o });
958
- }
959
- );
960
- Lt.displayName = se;
961
- var G = 10, [Ft, Q] = ie(se), wn = "SelectContentImpl", yn = Pe("SelectContent.RemoveScroll"), Bt = i.forwardRef(
962
- (e, o) => {
963
- const {
964
- __scopeSelect: t,
965
- position: r = "item-aligned",
966
- onCloseAutoFocus: s,
967
- onEscapeKeyDown: a,
968
- onPointerDownOutside: c,
969
- //
970
- // PopperContent props
971
- side: l,
972
- sideOffset: d,
973
- align: p,
974
- alignOffset: m,
975
- arrowPadding: v,
976
- collisionBoundary: C,
977
- collisionPadding: S,
978
- sticky: b,
979
- hideWhenDetached: u,
980
- avoidCollisions: f,
981
- //
982
- ...x
983
- } = e, h = J(se, t), [g, y] = i.useState(null), [j, O] = i.useState(null), k = A(o, (w) => y(w)), [R, $] = i.useState(null), [H, L] = i.useState(
984
- null
985
- ), B = Ce(t), [U, z] = i.useState(!1), V = i.useRef(!1);
986
- i.useEffect(() => {
987
- if (g) return uo(g);
988
- }, [g]), po();
989
- const T = i.useCallback(
990
- (w) => {
991
- const [P, ...F] = B().map((M) => M.ref.current), [_] = F.slice(-1), E = document.activeElement;
992
- for (const M of w)
993
- if (M === E || (M?.scrollIntoView({ block: "nearest" }), M === P && j && (j.scrollTop = 0), M === _ && j && (j.scrollTop = j.scrollHeight), M?.focus(), document.activeElement !== E)) return;
994
- },
995
- [B, j]
996
- ), K = i.useCallback(
997
- () => T([R, g]),
998
- [T, R, g]
999
- );
1000
- i.useEffect(() => {
1001
- U && K();
1002
- }, [U, K]);
1003
- const { onOpenChange: W, triggerPointerDownPosRef: Y } = h;
1004
- i.useEffect(() => {
1005
- if (g) {
1006
- let w = { x: 0, y: 0 };
1007
- const P = (_) => {
1008
- w = {
1009
- x: Math.abs(Math.round(_.pageX) - (Y.current?.x ?? 0)),
1010
- y: Math.abs(Math.round(_.pageY) - (Y.current?.y ?? 0))
1011
- };
1012
- }, F = (_) => {
1013
- w.x <= 10 && w.y <= 10 ? _.preventDefault() : g.contains(_.target) || W(!1), document.removeEventListener("pointermove", P), Y.current = null;
1014
- };
1015
- return Y.current !== null && (document.addEventListener("pointermove", P), document.addEventListener("pointerup", F, { capture: !0, once: !0 })), () => {
1016
- document.removeEventListener("pointermove", P), document.removeEventListener("pointerup", F, { capture: !0 });
1017
- };
1018
- }
1019
- }, [g, W, Y]), i.useEffect(() => {
1020
- const w = () => W(!1);
1021
- return window.addEventListener("blur", w), window.addEventListener("resize", w), () => {
1022
- window.removeEventListener("blur", w), window.removeEventListener("resize", w);
1023
- };
1024
- }, [W]);
1025
- const [Ie, me] = eo((w) => {
1026
- const P = B().filter((E) => !E.disabled), F = P.find((E) => E.ref.current === document.activeElement), _ = to(P, w, F);
1027
- _ && setTimeout(() => _.ref.current.focus());
1028
- }), Re = i.useCallback(
1029
- (w, P, F) => {
1030
- const _ = !V.current && !F;
1031
- (h.value !== void 0 && h.value === P || _) && ($(w), _ && (V.current = !0));
1032
- },
1033
- [h.value]
1034
- ), _e = i.useCallback(() => g?.focus(), [g]), ae = i.useCallback(
1035
- (w, P, F) => {
1036
- const _ = !V.current && !F;
1037
- (h.value !== void 0 && h.value === P || _) && L(w);
1038
- },
1039
- [h.value]
1040
- ), he = r === "popper" ? Ae : Vt, le = he === Ae ? {
1041
- side: l,
1042
- sideOffset: d,
1043
- align: p,
1044
- alignOffset: m,
1045
- arrowPadding: v,
1046
- collisionBoundary: C,
1047
- collisionPadding: S,
1048
- sticky: b,
1049
- hideWhenDetached: u,
1050
- avoidCollisions: f
1051
- } : {};
1052
- return /* @__PURE__ */ n.jsx(
1053
- Ft,
1054
- {
1055
- scope: t,
1056
- content: g,
1057
- viewport: j,
1058
- onViewportChange: O,
1059
- itemRefCallback: Re,
1060
- selectedItem: R,
1061
- onItemLeave: _e,
1062
- itemTextRefCallback: ae,
1063
- focusSelectedItem: K,
1064
- selectedItemText: H,
1065
- position: r,
1066
- isPositioned: U,
1067
- searchRef: Ie,
1068
- children: /* @__PURE__ */ n.jsx(fo, { as: yn, allowPinchZoom: !0, children: /* @__PURE__ */ n.jsx(
1069
- mo,
1070
- {
1071
- asChild: !0,
1072
- trapped: h.open,
1073
- onMountAutoFocus: (w) => {
1074
- w.preventDefault();
1075
- },
1076
- onUnmountAutoFocus: I(s, (w) => {
1077
- h.trigger?.focus({ preventScroll: !0 }), w.preventDefault();
1078
- }),
1079
- children: /* @__PURE__ */ n.jsx(
1080
- ho,
1081
- {
1082
- asChild: !0,
1083
- disableOutsidePointerEvents: !0,
1084
- onEscapeKeyDown: a,
1085
- onPointerDownOutside: c,
1086
- onFocusOutside: (w) => w.preventDefault(),
1087
- onDismiss: () => h.onOpenChange(!1),
1088
- children: /* @__PURE__ */ n.jsx(
1089
- he,
1090
- {
1091
- role: "listbox",
1092
- id: h.contentId,
1093
- "data-state": h.open ? "open" : "closed",
1094
- dir: h.dir,
1095
- onContextMenu: (w) => w.preventDefault(),
1096
- ...x,
1097
- ...le,
1098
- onPlaced: () => z(!0),
1099
- ref: k,
1100
- style: {
1101
- // flex layout so we can place the scroll buttons properly
1102
- display: "flex",
1103
- flexDirection: "column",
1104
- // reset the outline by default as the content MAY get focused
1105
- outline: "none",
1106
- ...x.style
1107
- },
1108
- onKeyDown: I(x.onKeyDown, (w) => {
1109
- const P = w.ctrlKey || w.altKey || w.metaKey;
1110
- if (w.key === "Tab" && w.preventDefault(), !P && w.key.length === 1 && me(w.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(w.key)) {
1111
- let _ = B().filter((E) => !E.disabled).map((E) => E.ref.current);
1112
- if (["ArrowUp", "End"].includes(w.key) && (_ = _.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(w.key)) {
1113
- const E = w.target, M = _.indexOf(E);
1114
- _ = _.slice(M + 1);
1115
- }
1116
- setTimeout(() => T(_)), w.preventDefault();
1117
- }
1118
- })
1119
- }
1120
- )
1121
- }
1122
- )
1123
- }
1124
- ) })
1125
- }
1126
- );
1127
- }
1128
- );
1129
- Bt.displayName = wn;
1130
- var In = "SelectItemAlignedPosition", Vt = i.forwardRef((e, o) => {
1131
- const { __scopeSelect: t, onPlaced: r, ...s } = e, a = J(se, t), c = Q(se, t), [l, d] = i.useState(null), [p, m] = i.useState(null), v = A(o, (k) => m(k)), C = Ce(t), S = i.useRef(!1), b = i.useRef(!0), { viewport: u, selectedItem: f, selectedItemText: x, focusSelectedItem: h } = c, g = i.useCallback(() => {
1132
- if (a.trigger && a.valueNode && l && p && u && f && x) {
1133
- const k = a.trigger.getBoundingClientRect(), R = p.getBoundingClientRect(), $ = a.valueNode.getBoundingClientRect(), H = x.getBoundingClientRect();
1134
- if (a.dir !== "rtl") {
1135
- const E = H.left - R.left, M = $.left - E, ee = k.left - M, te = k.width + ee, Ne = Math.max(te, R.width), Te = window.innerWidth - G, Ee = Ke(M, [
1136
- G,
1137
- // Prevents the content from going off the starting edge of the
1138
- // viewport. It may still go off the ending edge, but this can be
1139
- // controlled by the user since they may want to manage overflow in a
1140
- // specific way.
1141
- // https://github.com/radix-ui/primitives/issues/2049
1142
- Math.max(G, Te - Ne)
1143
- ]);
1144
- l.style.minWidth = te + "px", l.style.left = Ee + "px";
1145
- } else {
1146
- const E = R.right - H.right, M = window.innerWidth - $.right - E, ee = window.innerWidth - k.right - M, te = k.width + ee, Ne = Math.max(te, R.width), Te = window.innerWidth - G, Ee = Ke(M, [
1147
- G,
1148
- Math.max(G, Te - Ne)
1149
- ]);
1150
- l.style.minWidth = te + "px", l.style.right = Ee + "px";
1151
- }
1152
- const L = C(), B = window.innerHeight - G * 2, U = u.scrollHeight, z = window.getComputedStyle(p), V = parseInt(z.borderTopWidth, 10), T = parseInt(z.paddingTop, 10), K = parseInt(z.borderBottomWidth, 10), W = parseInt(z.paddingBottom, 10), Y = V + T + U + W + K, Ie = Math.min(f.offsetHeight * 5, Y), me = window.getComputedStyle(u), Re = parseInt(me.paddingTop, 10), _e = parseInt(me.paddingBottom, 10), ae = k.top + k.height / 2 - G, he = B - ae, le = f.offsetHeight / 2, w = f.offsetTop + le, P = V + T + w, F = Y - P;
1153
- if (P <= ae) {
1154
- const E = L.length > 0 && f === L[L.length - 1].ref.current;
1155
- l.style.bottom = "0px";
1156
- const M = p.clientHeight - u.offsetTop - u.offsetHeight, ee = Math.max(
1157
- he,
1158
- le + // viewport might have padding bottom, include it to avoid a scrollable viewport
1159
- (E ? _e : 0) + M + K
1160
- ), te = P + ee;
1161
- l.style.height = te + "px";
1162
- } else {
1163
- const E = L.length > 0 && f === L[0].ref.current;
1164
- l.style.top = "0px";
1165
- const ee = Math.max(
1166
- ae,
1167
- V + u.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1168
- (E ? Re : 0) + le
1169
- ) + F;
1170
- l.style.height = ee + "px", u.scrollTop = P - ae + u.offsetTop;
1171
- }
1172
- l.style.margin = `${G}px 0`, l.style.minHeight = Ie + "px", l.style.maxHeight = B + "px", r?.(), requestAnimationFrame(() => S.current = !0);
1173
- }
1174
- }, [
1175
- C,
1176
- a.trigger,
1177
- a.valueNode,
1178
- l,
1179
- p,
1180
- u,
1181
- f,
1182
- x,
1183
- a.dir,
1184
- r
1185
- ]);
1186
- Z(() => g(), [g]);
1187
- const [y, j] = i.useState();
1188
- Z(() => {
1189
- p && j(window.getComputedStyle(p).zIndex);
1190
- }, [p]);
1191
- const O = i.useCallback(
1192
- (k) => {
1193
- k && b.current === !0 && (g(), h?.(), b.current = !1);
1194
- },
1195
- [g, h]
1196
- );
1197
- return /* @__PURE__ */ n.jsx(
1198
- _n,
1199
- {
1200
- scope: t,
1201
- contentWrapper: l,
1202
- shouldExpandOnScrollRef: S,
1203
- onScrollButtonChange: O,
1204
- children: /* @__PURE__ */ n.jsx(
1205
- "div",
1206
- {
1207
- ref: d,
1208
- style: {
1209
- display: "flex",
1210
- flexDirection: "column",
1211
- position: "fixed",
1212
- zIndex: y
1213
- },
1214
- children: /* @__PURE__ */ n.jsx(
1215
- N.div,
1216
- {
1217
- ...s,
1218
- ref: v,
1219
- style: {
1220
- // When we get the height of the content, it includes borders. If we were to set
1221
- // the height without having `boxSizing: 'border-box'` it would be too big.
1222
- boxSizing: "border-box",
1223
- // We need to ensure the content doesn't get taller than the wrapper
1224
- maxHeight: "100%",
1225
- ...s.style
1226
- }
1227
- }
1228
- )
1229
- }
1230
- )
1231
- }
1232
- );
1233
- });
1234
- Vt.displayName = In;
1235
- var Rn = "SelectPopperPosition", Ae = i.forwardRef((e, o) => {
1236
- const {
1237
- __scopeSelect: t,
1238
- align: r = "start",
1239
- collisionPadding: s = G,
1240
- ...a
1241
- } = e, c = we(t);
1242
- return /* @__PURE__ */ n.jsx(
1243
- vo,
1244
- {
1245
- ...c,
1246
- ...a,
1247
- ref: o,
1248
- align: r,
1249
- collisionPadding: s,
1250
- style: {
1251
- // Ensure border-box for floating-ui calculations
1252
- boxSizing: "border-box",
1253
- ...a.style,
1254
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1255
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1256
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
1257
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
1258
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
1259
- }
1260
- }
1261
- );
1262
- });
1263
- Ae.displayName = Rn;
1264
- var [_n, ze] = ie(se, {}), De = "SelectViewport", Gt = i.forwardRef(
1265
- (e, o) => {
1266
- const { __scopeSelect: t, nonce: r, ...s } = e, a = Q(De, t), c = ze(De, t), l = A(o, a.onViewportChange), d = i.useRef(0);
1267
- return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1268
- /* @__PURE__ */ n.jsx(
1269
- "style",
1270
- {
1271
- dangerouslySetInnerHTML: {
1272
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
1273
- },
1274
- nonce: r
1275
- }
1276
- ),
1277
- /* @__PURE__ */ n.jsx(Se.Slot, { scope: t, children: /* @__PURE__ */ n.jsx(
1278
- N.div,
1279
- {
1280
- "data-radix-select-viewport": "",
1281
- role: "presentation",
1282
- ...s,
1283
- ref: l,
1284
- style: {
1285
- // we use position: 'relative' here on the `viewport` so that when we call
1286
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1287
- // (independent of the scrollUpButton).
1288
- position: "relative",
1289
- flex: 1,
1290
- // Viewport should only be scrollable in the vertical direction.
1291
- // This won't work in vertical writing modes, so we'll need to
1292
- // revisit this if/when that is supported
1293
- // https://developer.chrome.com/blog/vertical-form-controls
1294
- overflow: "hidden auto",
1295
- ...s.style
1296
- },
1297
- onScroll: I(s.onScroll, (p) => {
1298
- const m = p.currentTarget, { contentWrapper: v, shouldExpandOnScrollRef: C } = c;
1299
- if (C?.current && v) {
1300
- const S = Math.abs(d.current - m.scrollTop);
1301
- if (S > 0) {
1302
- const b = window.innerHeight - G * 2, u = parseFloat(v.style.minHeight), f = parseFloat(v.style.height), x = Math.max(u, f);
1303
- if (x < b) {
1304
- const h = x + S, g = Math.min(b, h), y = h - g;
1305
- v.style.height = g + "px", v.style.bottom === "0px" && (m.scrollTop = y > 0 ? y : 0, v.style.justifyContent = "flex-end");
1306
- }
1307
- }
1308
- }
1309
- d.current = m.scrollTop;
1310
- })
1311
- }
1312
- ) })
1313
- ] });
1314
- }
1315
- );
1316
- Gt.displayName = De;
1317
- var $t = "SelectGroup", [Nn, Tn] = ie($t), En = i.forwardRef(
1318
- (e, o) => {
1319
- const { __scopeSelect: t, ...r } = e, s = xe();
1320
- return /* @__PURE__ */ n.jsx(Nn, { scope: t, id: s, children: /* @__PURE__ */ n.jsx(N.div, { role: "group", "aria-labelledby": s, ...r, ref: o }) });
1321
- }
1322
- );
1323
- En.displayName = $t;
1324
- var Ht = "SelectLabel", jn = i.forwardRef(
1325
- (e, o) => {
1326
- const { __scopeSelect: t, ...r } = e, s = Tn(Ht, t);
1327
- return /* @__PURE__ */ n.jsx(N.div, { id: s.id, ...r, ref: o });
1328
- }
1329
- );
1330
- jn.displayName = Ht;
1331
- var ve = "SelectItem", [kn, Ut] = ie(ve), zt = i.forwardRef(
1332
- (e, o) => {
1333
- const {
1334
- __scopeSelect: t,
1335
- value: r,
1336
- disabled: s = !1,
1337
- textValue: a,
1338
- ...c
1339
- } = e, l = J(ve, t), d = Q(ve, t), p = l.value === r, [m, v] = i.useState(a ?? ""), [C, S] = i.useState(!1), b = A(
1340
- o,
1341
- (h) => d.itemRefCallback?.(h, r, s)
1342
- ), u = xe(), f = i.useRef("touch"), x = () => {
1343
- s || (l.onValueChange(r), l.onOpenChange(!1));
1344
- };
1345
- if (r === "")
1346
- throw new Error(
1347
- "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."
1348
- );
1349
- return /* @__PURE__ */ n.jsx(
1350
- kn,
1351
- {
1352
- scope: t,
1353
- value: r,
1354
- disabled: s,
1355
- textId: u,
1356
- isSelected: p,
1357
- onItemTextChange: i.useCallback((h) => {
1358
- v((g) => g || (h?.textContent ?? "").trim());
1359
- }, []),
1360
- children: /* @__PURE__ */ n.jsx(
1361
- Se.ItemSlot,
1362
- {
1363
- scope: t,
1364
- value: r,
1365
- disabled: s,
1366
- textValue: m,
1367
- children: /* @__PURE__ */ n.jsx(
1368
- N.div,
1369
- {
1370
- role: "option",
1371
- "aria-labelledby": u,
1372
- "data-highlighted": C ? "" : void 0,
1373
- "aria-selected": p && C,
1374
- "data-state": p ? "checked" : "unchecked",
1375
- "aria-disabled": s || void 0,
1376
- "data-disabled": s ? "" : void 0,
1377
- tabIndex: s ? void 0 : -1,
1378
- ...c,
1379
- ref: b,
1380
- onFocus: I(c.onFocus, () => S(!0)),
1381
- onBlur: I(c.onBlur, () => S(!1)),
1382
- onClick: I(c.onClick, () => {
1383
- f.current !== "mouse" && x();
1384
- }),
1385
- onPointerUp: I(c.onPointerUp, () => {
1386
- f.current === "mouse" && x();
1387
- }),
1388
- onPointerDown: I(c.onPointerDown, (h) => {
1389
- f.current = h.pointerType;
1390
- }),
1391
- onPointerMove: I(c.onPointerMove, (h) => {
1392
- f.current = h.pointerType, s ? d.onItemLeave?.() : f.current === "mouse" && h.currentTarget.focus({ preventScroll: !0 });
1393
- }),
1394
- onPointerLeave: I(c.onPointerLeave, (h) => {
1395
- h.currentTarget === document.activeElement && d.onItemLeave?.();
1396
- }),
1397
- onKeyDown: I(c.onKeyDown, (h) => {
1398
- d.searchRef?.current !== "" && h.key === " " || (hn.includes(h.key) && x(), h.key === " " && h.preventDefault());
1399
- })
1400
- }
1401
- )
1402
- }
1403
- )
1404
- }
1405
- );
1406
- }
1407
- );
1408
- zt.displayName = ve;
1409
- var de = "SelectItemText", Kt = i.forwardRef(
1410
- (e, o) => {
1411
- const { __scopeSelect: t, className: r, style: s, ...a } = e, c = J(de, t), l = Q(de, t), d = Ut(de, t), p = bn(de, t), [m, v] = i.useState(null), C = A(
1412
- o,
1413
- (x) => v(x),
1414
- d.onItemTextChange,
1415
- (x) => l.itemTextRefCallback?.(x, d.value, d.disabled)
1416
- ), S = m?.textContent, b = i.useMemo(
1417
- () => /* @__PURE__ */ n.jsx("option", { value: d.value, disabled: d.disabled, children: S }, d.value),
1418
- [d.disabled, d.value, S]
1419
- ), { onNativeOptionAdd: u, onNativeOptionRemove: f } = p;
1420
- return Z(() => (u(b), () => f(b)), [u, f, b]), /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1421
- /* @__PURE__ */ n.jsx(N.span, { id: d.textId, ...a, ref: C }),
1422
- d.isSelected && c.valueNode && !c.valueNodeHasChildren ? Qe.createPortal(a.children, c.valueNode) : null
1423
- ] });
1424
- }
1425
- );
1426
- Kt.displayName = de;
1427
- var Wt = "SelectItemIndicator", qt = i.forwardRef(
1428
- (e, o) => {
1429
- const { __scopeSelect: t, ...r } = e;
1430
- return Ut(Wt, t).isSelected ? /* @__PURE__ */ n.jsx(N.span, { "aria-hidden": !0, ...r, ref: o }) : null;
1431
- }
1432
- );
1433
- qt.displayName = Wt;
1434
- var Oe = "SelectScrollUpButton", Yt = i.forwardRef((e, o) => {
1435
- const t = Q(Oe, e.__scopeSelect), r = ze(Oe, e.__scopeSelect), [s, a] = i.useState(!1), c = A(o, r.onScrollButtonChange);
1436
- return Z(() => {
1437
- if (t.viewport && t.isPositioned) {
1438
- let l = function() {
1439
- const p = d.scrollTop > 0;
1440
- a(p);
1441
- };
1442
- const d = t.viewport;
1443
- return l(), d.addEventListener("scroll", l), () => d.removeEventListener("scroll", l);
1444
- }
1445
- }, [t.viewport, t.isPositioned]), s ? /* @__PURE__ */ n.jsx(
1446
- Zt,
1447
- {
1448
- ...e,
1449
- ref: c,
1450
- onAutoScroll: () => {
1451
- const { viewport: l, selectedItem: d } = t;
1452
- l && d && (l.scrollTop = l.scrollTop - d.offsetHeight);
1453
- }
1454
- }
1455
- ) : null;
1456
- });
1457
- Yt.displayName = Oe;
1458
- var Le = "SelectScrollDownButton", Xt = i.forwardRef((e, o) => {
1459
- const t = Q(Le, e.__scopeSelect), r = ze(Le, e.__scopeSelect), [s, a] = i.useState(!1), c = A(o, r.onScrollButtonChange);
1460
- return Z(() => {
1461
- if (t.viewport && t.isPositioned) {
1462
- let l = function() {
1463
- const p = d.scrollHeight - d.clientHeight, m = Math.ceil(d.scrollTop) < p;
1464
- a(m);
1465
- };
1466
- const d = t.viewport;
1467
- return l(), d.addEventListener("scroll", l), () => d.removeEventListener("scroll", l);
1468
- }
1469
- }, [t.viewport, t.isPositioned]), s ? /* @__PURE__ */ n.jsx(
1470
- Zt,
1471
- {
1472
- ...e,
1473
- ref: c,
1474
- onAutoScroll: () => {
1475
- const { viewport: l, selectedItem: d } = t;
1476
- l && d && (l.scrollTop = l.scrollTop + d.offsetHeight);
1477
- }
1478
- }
1479
- ) : null;
1480
- });
1481
- Xt.displayName = Le;
1482
- var Zt = i.forwardRef((e, o) => {
1483
- const { __scopeSelect: t, onAutoScroll: r, ...s } = e, a = Q("SelectScrollButton", t), c = i.useRef(null), l = Ce(t), d = i.useCallback(() => {
1484
- c.current !== null && (window.clearInterval(c.current), c.current = null);
1485
- }, []);
1486
- return i.useEffect(() => () => d(), [d]), Z(() => {
1487
- l().find((m) => m.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1488
- }, [l]), /* @__PURE__ */ n.jsx(
1489
- N.div,
1490
- {
1491
- "aria-hidden": !0,
1492
- ...s,
1493
- ref: o,
1494
- style: { flexShrink: 0, ...s.style },
1495
- onPointerDown: I(s.onPointerDown, () => {
1496
- c.current === null && (c.current = window.setInterval(r, 50));
1497
- }),
1498
- onPointerMove: I(s.onPointerMove, () => {
1499
- a.onItemLeave?.(), c.current === null && (c.current = window.setInterval(r, 50));
1500
- }),
1501
- onPointerLeave: I(s.onPointerLeave, () => {
1502
- d();
1503
- })
1504
- }
1505
- );
1506
- }), Pn = "SelectSeparator", Mn = i.forwardRef(
1507
- (e, o) => {
1508
- const { __scopeSelect: t, ...r } = e;
1509
- return /* @__PURE__ */ n.jsx(N.div, { "aria-hidden": !0, ...r, ref: o });
1510
- }
1511
- );
1512
- Mn.displayName = Pn;
1513
- var Fe = "SelectArrow", An = i.forwardRef(
1514
- (e, o) => {
1515
- const { __scopeSelect: t, ...r } = e, s = we(t), a = J(Fe, t), c = Q(Fe, t);
1516
- return a.open && c.position === "popper" ? /* @__PURE__ */ n.jsx(xo, { ...s, ...r, ref: o }) : null;
1517
- }
1518
- );
1519
- An.displayName = Fe;
1520
- var Dn = "SelectBubbleInput", Jt = i.forwardRef(
1521
- ({ __scopeSelect: e, value: o, ...t }, r) => {
1522
- const s = i.useRef(null), a = A(r, s), c = $e(o);
1523
- return i.useEffect(() => {
1524
- const l = s.current;
1525
- if (!l) return;
1526
- const d = window.HTMLSelectElement.prototype, m = Object.getOwnPropertyDescriptor(
1527
- d,
1528
- "value"
1529
- ).set;
1530
- if (c !== o && m) {
1531
- const v = new Event("change", { bubbles: !0 });
1532
- m.call(l, o), l.dispatchEvent(v);
1533
- }
1534
- }, [c, o]), /* @__PURE__ */ n.jsx(
1535
- N.select,
1536
- {
1537
- ...t,
1538
- style: { ...lo, ...t.style },
1539
- ref: a,
1540
- defaultValue: o
1541
- }
1542
- );
1543
- }
1544
- );
1545
- Jt.displayName = Dn;
1546
- function Qt(e) {
1547
- return e === "" || e === void 0;
1548
- }
1549
- function eo(e) {
1550
- const o = Ze(e), t = i.useRef(""), r = i.useRef(0), s = i.useCallback(
1551
- (c) => {
1552
- const l = t.current + c;
1553
- o(l), function d(p) {
1554
- t.current = p, window.clearTimeout(r.current), p !== "" && (r.current = window.setTimeout(() => d(""), 1e3));
1555
- }(l);
1556
- },
1557
- [o]
1558
- ), a = i.useCallback(() => {
1559
- t.current = "", window.clearTimeout(r.current);
1560
- }, []);
1561
- return i.useEffect(() => () => window.clearTimeout(r.current), []), [t, s, a];
1562
- }
1563
- function to(e, o, t) {
1564
- const s = o.length > 1 && Array.from(o).every((p) => p === o[0]) ? o[0] : o, a = t ? e.indexOf(t) : -1;
1565
- let c = On(e, Math.max(a, 0));
1566
- s.length === 1 && (c = c.filter((p) => p !== t));
1567
- const d = c.find(
1568
- (p) => p.textValue.toLowerCase().startsWith(s.toLowerCase())
1569
- );
1570
- return d !== t ? d : void 0;
1571
- }
1572
- function On(e, o) {
1573
- return e.map((t, r) => e[(o + r) % e.length]);
1574
- }
1575
- var Ln = jt, Fn = Pt, Bn = At, Vn = Dt, Gn = Ot, $n = Lt, Hn = Gt, Un = zt, zn = Kt, Kn = qt, Wn = Yt, qn = Xt;
1576
- const gr = ({ disabled: e = !1, handleDelete: o, ...t }) => /* @__PURE__ */ n.jsx(
1577
- Be,
1578
- {
1579
- disabled: e,
1580
- icon: /* @__PURE__ */ n.jsx(Do, {}),
1581
- onClick: o,
1582
- variant: "outline",
1583
- ...t,
1584
- className: "border-destructive text-destructive hover:bg-destructive hover:text-white",
1585
- children: "Delete"
1586
- }
1587
- ), We = {
1588
- default: { label: "Submit", submittingLabel: "Submitting", IconComponent: je },
1589
- submit: { label: "Submit", submittingLabel: "Submitting", IconComponent: je },
1590
- save: { label: "Save", submittingLabel: "Saving", IconComponent: Po },
1591
- send: { label: "Send", submittingLabel: "Sending", IconComponent: je }
1592
- }, br = ({
1593
- submitting: e = !1,
1594
- disabled: o = !1,
1595
- submittingIcon: t,
1596
- action: r = "default",
1597
- noIcon: s = !1,
1598
- ...a
1599
- }) => {
1600
- const c = t || jo;
1601
- if (!We[r])
1602
- throw new Error(`Invalid action: ${r}`);
1603
- const { label: l, submittingLabel: d, IconComponent: p } = We[r], m = e ? /* @__PURE__ */ n.jsx(c, { className: "animate-spin" }) : /* @__PURE__ */ n.jsx(p, {});
1604
- return /* @__PURE__ */ n.jsx(
1605
- Be,
1606
- {
1607
- disabled: o || e,
1608
- icon: s ? void 0 : m,
1609
- type: "submit",
1610
- variant: "primary",
1611
- ...a,
1612
- children: e ? d : l
1613
- }
1614
- );
1615
- };
1616
- function Yn({ className: e, ...o }) {
1617
- return /* @__PURE__ */ n.jsx(
1618
- st,
1619
- {
1620
- className: D(
1621
- "peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40",
1622
- e
1623
- ),
1624
- "data-slot": "checkbox",
1625
- ...o,
1626
- children: /* @__PURE__ */ n.jsx(
1627
- ct,
1628
- {
1629
- className: "flex items-center justify-center text-current transition-none",
1630
- "data-slot": "checkbox-indicator",
1631
- children: /* @__PURE__ */ n.jsx(et, { className: "size-3.5" })
1632
- }
1633
- )
1634
- }
1635
- );
1636
- }
1637
- const Sr = ({ label: e, name: o, value: t, checked: r, onCheckedChange: s }) => {
1638
- const [a, c] = qe(r);
1639
- ro(() => {
1640
- c(r);
1641
- }, [r]);
1642
- let l = o;
1643
- const d = t || o;
1644
- t && (l += `[${t}]`);
1645
- const p = (m) => {
1646
- c(m), s?.(m);
1647
- };
1648
- return /* @__PURE__ */ n.jsxs(ne, { align: "center", gap: "2", children: [
1649
- /* @__PURE__ */ n.jsx(
1650
- Yn,
1651
- {
1652
- checked: a,
1653
- id: l,
1654
- name: o,
1655
- onCheckedChange: p,
1656
- value: d
1657
- }
1658
- ),
1659
- /* @__PURE__ */ n.jsx(fe, { className: "cursor-pointer", htmlFor: l, children: e })
1660
- ] });
1661
- }, Cr = ({ name: e, label: o, placeholder: t, note: r, className: s, ...a }) => /* @__PURE__ */ n.jsx(
1662
- oo,
1663
- {
1664
- className: D("max-w-[150px]", s),
1665
- label: o,
1666
- name: e,
1667
- note: r,
1668
- placeholder: t,
1669
- type: "date",
1670
- ...a
1671
- }
1672
- ), wr = ({ onDateSelection: e, initialValue: o, className: t, size: r = "default", error: s }) => {
1673
- const [a, c] = qe(o), l = (d) => {
1674
- c(d), d && e(d);
1675
- };
1676
- return /* @__PURE__ */ n.jsxs(ne, { direction: "col", gap: "2", children: [
1677
- /* @__PURE__ */ n.jsxs(go, { children: [
1678
- /* @__PURE__ */ n.jsx(bo, { asChild: !0, children: /* @__PURE__ */ n.jsxs(
1679
- Be,
1680
- {
1681
- className: D("w-[280px] justify-start text-left font-normal", !a && "text-muted-foreground", t),
1682
- size: r,
1683
- variant: "outline",
1684
- children: [
1685
- /* @__PURE__ */ n.jsx(wo, { className: "mr-2 h-4 w-4" }),
1686
- a ? a.toISOString().split("T")[0] : /* @__PURE__ */ n.jsx("span", { children: "Select a date" })
1687
- ]
1688
- }
1689
- ) }),
1690
- /* @__PURE__ */ n.jsx(So, { className: "w-auto p-0", children: /* @__PURE__ */ n.jsx(no, { autoFocus: !0, mode: "single", onSelect: l, selected: a }) })
1691
- ] }),
1692
- s && /* @__PURE__ */ n.jsx(ye, { message: s })
1693
- ] });
1694
- }, ye = ({ message: e }) => /* @__PURE__ */ n.jsx(Ve, { size: "xs", variant: "destructive", children: e }), Xn = ({ label: e, labelFor: o, className: t = "", labelClassName: r = "", children: s }) => /* @__PURE__ */ n.jsxs(ne, { direction: "col", gap: "2", children: [
1695
- e && /* @__PURE__ */ n.jsx(fe, { className: r, htmlFor: o, children: e }),
1696
- /* @__PURE__ */ n.jsx(ne, { className: `rounded-md border border-input bg-card p-2 shadow-xs ${t}`, gapY: "1", children: s })
1697
- ] });
1698
- function Zn({ className: e, ...o }) {
1699
- return /* @__PURE__ */ n.jsx(
1700
- en,
1701
- {
1702
- className: D(
1703
- "flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
1704
- e
1705
- ),
1706
- "data-slot": "label",
1707
- ...o
1708
- }
1709
- );
1710
- }
1711
- const fe = ({ htmlFor: e, value: o, children: t, className: r = "", ...s }) => /* @__PURE__ */ n.jsx(
1712
- Zn,
1713
- {
1714
- className: D("font-display font-normal text-base text-foreground", r),
1715
- htmlFor: e,
1716
- ...s,
1717
- children: o || t
1718
- }
1719
- );
1720
- function Jn({ className: e, type: o, ...t }) {
1721
- return /* @__PURE__ */ n.jsx(
1722
- "input",
1723
- {
1724
- className: D(
1725
- "flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
1726
- "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
1727
- "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
1728
- e
1729
- ),
1730
- "data-slot": "input",
1731
- type: o,
1732
- ...t
1733
- }
1734
- );
1735
- }
1736
- const oo = ({
1737
- name: e,
1738
- type: o = "text",
1739
- placeholder: t,
1740
- label: r,
1741
- labelOrientation: s = "top",
1742
- note: a,
1743
- className: c,
1744
- error: l,
1745
- ...d
1746
- }) => /* @__PURE__ */ n.jsxs(ne, { className: "w-full", direction: s === "left" ? "row" : "col", gap: "2", children: [
1747
- r && /* @__PURE__ */ n.jsx(fe, { className: s === "left" ? "text-nowrap" : "", htmlFor: e, children: r }),
1748
- /* @__PURE__ */ n.jsx(
1749
- Jn,
1750
- {
1751
- "aria-label": r || e,
1752
- className: c,
1753
- id: e,
1754
- name: e,
1755
- placeholder: t,
1756
- type: o,
1757
- ...d
1758
- }
1759
- ),
1760
- a && /* @__PURE__ */ n.jsx(Ve, { size: "sm", variant: "muted", children: a }),
1761
- l && /* @__PURE__ */ n.jsx(ye, { message: l })
1762
- ] }), yr = ({
1763
- name: e,
1764
- label: o,
1765
- placeholder: t,
1766
- note: r,
1767
- // Default to two decimal places for currency and general decimal values
1768
- step: s = ".01",
1769
- className: a,
1770
- ...c
1771
- }) => /* @__PURE__ */ n.jsx(
1772
- oo,
1773
- {
1774
- className: a,
1775
- label: o,
1776
- name: e,
1777
- note: r,
1778
- placeholder: t,
1779
- step: s,
1780
- type: "number",
1781
- ...c
1782
- }
1783
- );
1784
- function Qn({ className: e, ...o }) {
1785
- return /* @__PURE__ */ n.jsx(un, { className: D("grid gap-3", e), "data-slot": "radio-group", ...o });
1786
- }
1787
- function er({ className: e, ...o }) {
1788
- return /* @__PURE__ */ n.jsx(
1789
- pn,
1790
- {
1791
- className: D(
1792
- "aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
1793
- e
1794
- ),
1795
- "data-slot": "radio-group-item",
1796
- ...o,
1797
- children: /* @__PURE__ */ n.jsx(
1798
- fn,
1799
- {
1800
- className: "relative flex items-center justify-center",
1801
- "data-slot": "radio-group-indicator",
1802
- children: /* @__PURE__ */ n.jsx(To, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" })
1803
- }
1804
- )
1805
- }
1806
- );
1807
- }
1808
- const Ir = ({ label: e, name: o, options: t, value: r, onChange: s, error: a }) => /* @__PURE__ */ n.jsxs(Xn, { className: "flex flex-col gap-4 px-2 py-1", label: e, labelFor: o, children: [
1809
- /* @__PURE__ */ n.jsx(Qn, { className: "w-full", name: o, onValueChange: s, value: r, children: /* @__PURE__ */ n.jsx(so, { cols: "2", children: t.map((c, l) => /* @__PURE__ */ n.jsxs(ne, { align: "center", gap: "2", justify: "start", children: [
1810
- /* @__PURE__ */ n.jsx(er, { id: c.value, value: c.value }),
1811
- /* @__PURE__ */ n.jsx(fe, { htmlFor: c.value, children: c.label })
1812
- ] }, l)) }) }),
1813
- a && /* @__PURE__ */ n.jsx(ye, { message: a })
1814
- ] });
1815
- function tr({ ...e }) {
1816
- return /* @__PURE__ */ n.jsx(Ln, { "data-slot": "select", ...e });
1817
- }
1818
- function or({ ...e }) {
1819
- return /* @__PURE__ */ n.jsx(Bn, { "data-slot": "select-value", ...e });
1820
- }
1821
- function nr({
1822
- className: e,
1823
- size: o = "default",
1824
- children: t,
1825
- ...r
1826
- }) {
1827
- return /* @__PURE__ */ n.jsxs(
1828
- Fn,
1829
- {
1830
- className: D(
1831
- "flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
1832
- e
1833
- ),
1834
- "data-size": o,
1835
- "data-slot": "select-trigger",
1836
- ...r,
1837
- children: [
1838
- t,
1839
- /* @__PURE__ */ n.jsx(Vn, { asChild: !0, children: /* @__PURE__ */ n.jsx(tt, { className: "size-4 opacity-50" }) })
1840
- ]
1841
- }
1842
- );
1843
- }
1844
- function rr({
1845
- className: e,
1846
- children: o,
1847
- position: t = "popper",
1848
- ...r
1849
- }) {
1850
- return /* @__PURE__ */ n.jsx(Gn, { children: /* @__PURE__ */ n.jsxs(
1851
- $n,
1852
- {
1853
- className: D(
1854
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in",
1855
- t === "popper" && "data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1",
1856
- e
1857
- ),
1858
- "data-slot": "select-content",
1859
- position: t,
1860
- ...r,
1861
- children: [
1862
- /* @__PURE__ */ n.jsx(ar, {}),
1863
- /* @__PURE__ */ n.jsx(
1864
- Hn,
1865
- {
1866
- className: D(
1867
- "p-1",
1868
- t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
1869
- ),
1870
- children: o
1871
- }
1872
- ),
1873
- /* @__PURE__ */ n.jsx(cr, {})
1874
- ]
1875
- }
1876
- ) });
1877
- }
1878
- function sr({ className: e, children: o, ...t }) {
1879
- return /* @__PURE__ */ n.jsxs(
1880
- Un,
1881
- {
1882
- className: D(
1883
- "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
1884
- e
1885
- ),
1886
- "data-slot": "select-item",
1887
- ...t,
1888
- children: [
1889
- /* @__PURE__ */ n.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ n.jsx(Kn, { children: /* @__PURE__ */ n.jsx(et, { className: "size-4" }) }) }),
1890
- /* @__PURE__ */ n.jsx(zn, { children: o })
1891
- ]
1892
- }
1893
- );
1894
- }
1895
- function ar({ className: e, ...o }) {
1896
- return /* @__PURE__ */ n.jsx(
1897
- Wn,
1898
- {
1899
- className: D("flex cursor-default items-center justify-center py-1", e),
1900
- "data-slot": "select-scroll-up-button",
1901
- ...o,
1902
- children: /* @__PURE__ */ n.jsx(_o, { className: "size-4" })
1903
- }
1904
- );
1905
- }
1906
- function cr({
1907
- className: e,
1908
- ...o
1909
- }) {
1910
- return /* @__PURE__ */ n.jsx(
1911
- qn,
1912
- {
1913
- className: D("flex cursor-default items-center justify-center py-1", e),
1914
- "data-slot": "select-scroll-down-button",
1915
- ...o,
1916
- children: /* @__PURE__ */ n.jsx(tt, { className: "size-4" })
1917
- }
1918
- );
1919
- }
1920
- const Rr = ({
1921
- name: e,
1922
- defaultValue: o,
1923
- options: t,
1924
- label: r,
1925
- placeholder: s,
1926
- note: a,
1927
- className: c,
1928
- value: l,
1929
- onValueChange: d,
1930
- error: p,
1931
- ...m
1932
- }) => /* @__PURE__ */ n.jsxs(ne, { className: "w-full", direction: "col", gap: "2", children: [
1933
- r && /* @__PURE__ */ n.jsx(fe, { htmlFor: e, children: r }),
1934
- /* @__PURE__ */ n.jsxs(
1935
- tr,
1936
- {
1937
- defaultValue: o,
1938
- name: e,
1939
- onValueChange: d,
1940
- value: l,
1941
- ...m,
1942
- children: [
1943
- /* @__PURE__ */ n.jsx(nr, { className: D("min-w-[180px]", c), "data-testid": `select-input-${e}`, children: /* @__PURE__ */ n.jsx(or, { placeholder: s }) }),
1944
- /* @__PURE__ */ n.jsx(rr, { children: t.map(({ value: v, label: C }) => /* @__PURE__ */ n.jsx(sr, { value: v, children: C }, `option-${v}`)) })
1945
- ]
1946
- }
1947
- ),
1948
- a && /* @__PURE__ */ n.jsx(Ve, { size: "sm", variant: "muted", children: a }),
1949
- p && /* @__PURE__ */ n.jsx(ye, { message: p })
1950
- ] });
1951
- export {
1952
- Sr as C,
1953
- gr as D,
1954
- ye as I,
1955
- fe as L,
1956
- yr as N,
1957
- Ir as R,
1958
- br as S,
1959
- oo as T,
1960
- Cr as a,
1961
- wr as b,
1962
- Xn as c,
1963
- Rr as d,
1964
- pt as e,
1965
- Zo as f,
1966
- Jo as g,
1967
- et as h,
1968
- ot as i,
1969
- tt as j,
1970
- Ge as u
1971
- };