@rhammy/architect-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/LICENSE +21 -0
  3. package/README.md +355 -0
  4. package/dist/components/Accordion/Accordion.d.ts +34 -0
  5. package/dist/components/Accordion/Accordion.d.ts.map +1 -0
  6. package/dist/components/Accordion/index.d.ts +3 -0
  7. package/dist/components/Accordion/index.d.ts.map +1 -0
  8. package/dist/components/Button/Button.d.ts +21 -0
  9. package/dist/components/Button/Button.d.ts.map +1 -0
  10. package/dist/components/Button/index.d.ts +3 -0
  11. package/dist/components/Button/index.d.ts.map +1 -0
  12. package/dist/components/Checkbox/Checkbox.d.ts +25 -0
  13. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
  14. package/dist/components/Checkbox/index.d.ts +3 -0
  15. package/dist/components/Checkbox/index.d.ts.map +1 -0
  16. package/dist/components/Dialog/Dialog.d.ts +48 -0
  17. package/dist/components/Dialog/Dialog.d.ts.map +1 -0
  18. package/dist/components/Dialog/index.d.ts +3 -0
  19. package/dist/components/Dialog/index.d.ts.map +1 -0
  20. package/dist/components/Dropdown/Dropdown.d.ts +28 -0
  21. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -0
  22. package/dist/components/Dropdown/index.d.ts +3 -0
  23. package/dist/components/Dropdown/index.d.ts.map +1 -0
  24. package/dist/components/Input/ErrorMessage.d.ts +9 -0
  25. package/dist/components/Input/ErrorMessage.d.ts.map +1 -0
  26. package/dist/components/Input/FormField.d.ts +24 -0
  27. package/dist/components/Input/FormField.d.ts.map +1 -0
  28. package/dist/components/Input/Input.d.ts +27 -0
  29. package/dist/components/Input/Input.d.ts.map +1 -0
  30. package/dist/components/Input/Label.d.ts +13 -0
  31. package/dist/components/Input/Label.d.ts.map +1 -0
  32. package/dist/components/Input/index.d.ts +10 -0
  33. package/dist/components/Input/index.d.ts.map +1 -0
  34. package/dist/components/Radio/Radio.d.ts +36 -0
  35. package/dist/components/Radio/Radio.d.ts.map +1 -0
  36. package/dist/components/Radio/index.d.ts +3 -0
  37. package/dist/components/Radio/index.d.ts.map +1 -0
  38. package/dist/components/Select/Select.d.ts +38 -0
  39. package/dist/components/Select/Select.d.ts.map +1 -0
  40. package/dist/components/Select/index.d.ts +3 -0
  41. package/dist/components/Select/index.d.ts.map +1 -0
  42. package/dist/components/Switch/Switch.d.ts +19 -0
  43. package/dist/components/Switch/Switch.d.ts.map +1 -0
  44. package/dist/components/Switch/index.d.ts +3 -0
  45. package/dist/components/Switch/index.d.ts.map +1 -0
  46. package/dist/components/Tabs/Tabs.d.ts +35 -0
  47. package/dist/components/Tabs/Tabs.d.ts.map +1 -0
  48. package/dist/components/Tabs/index.d.ts +3 -0
  49. package/dist/components/Tabs/index.d.ts.map +1 -0
  50. package/dist/components/Textarea/Textarea.d.ts +25 -0
  51. package/dist/components/Textarea/Textarea.d.ts.map +1 -0
  52. package/dist/components/Textarea/index.d.ts +3 -0
  53. package/dist/components/Textarea/index.d.ts.map +1 -0
  54. package/dist/components/Toast/Toast.d.ts +46 -0
  55. package/dist/components/Toast/Toast.d.ts.map +1 -0
  56. package/dist/components/Toast/index.d.ts +3 -0
  57. package/dist/components/Toast/index.d.ts.map +1 -0
  58. package/dist/components/Tooltip/Tooltip.d.ts +31 -0
  59. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
  60. package/dist/components/Tooltip/index.d.ts +3 -0
  61. package/dist/components/Tooltip/index.d.ts.map +1 -0
  62. package/dist/hooks/useClickOutside.d.ts +4 -0
  63. package/dist/hooks/useClickOutside.d.ts.map +1 -0
  64. package/dist/hooks/useControllableState.d.ts +19 -0
  65. package/dist/hooks/useControllableState.d.ts.map +1 -0
  66. package/dist/hooks/useEscapeKey.d.ts +13 -0
  67. package/dist/hooks/useEscapeKey.d.ts.map +1 -0
  68. package/dist/hooks/useFocusTrap.d.ts +15 -0
  69. package/dist/hooks/useFocusTrap.d.ts.map +1 -0
  70. package/dist/hooks/useId.d.ts +10 -0
  71. package/dist/hooks/useId.d.ts.map +1 -0
  72. package/dist/index.cjs +23 -0
  73. package/dist/index.cjs.map +1 -0
  74. package/dist/index.d.ts +25 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +2342 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/style.css +1 -0
  79. package/dist/tests/setup.d.ts +2 -0
  80. package/dist/tests/setup.d.ts.map +1 -0
  81. package/dist/types/index.d.ts +59 -0
  82. package/dist/types/index.d.ts.map +1 -0
  83. package/dist/utils/dom.d.ts +31 -0
  84. package/dist/utils/dom.d.ts.map +1 -0
  85. package/dist/utils/focus.d.ts +26 -0
  86. package/dist/utils/focus.d.ts.map +1 -0
  87. package/package.json +107 -0
package/dist/index.js ADDED
@@ -0,0 +1,2342 @@
1
+ import { jsx as c, jsxs as $ } from "react/jsx-runtime";
2
+ import z, { useRef as C, useEffect as B, useState as H, useCallback as k, useId as Ee, forwardRef as D, createContext as Y, useContext as K } from "react";
3
+ import { createPortal as q } from "react-dom";
4
+ function ie(e) {
5
+ if (!e) return [];
6
+ const o = [
7
+ "a[href]",
8
+ "button:not([disabled])",
9
+ "textarea:not([disabled])",
10
+ "input:not([disabled])",
11
+ "select:not([disabled])",
12
+ '[tabindex]:not([tabindex="-1"])'
13
+ ].join(",");
14
+ return Array.from(
15
+ e.querySelectorAll(o)
16
+ ).filter((t) => t.offsetWidth > 0 && t.offsetHeight > 0 && getComputedStyle(t).visibility !== "hidden");
17
+ }
18
+ function Se(e) {
19
+ if (!e) return () => {
20
+ };
21
+ const o = ie(e), t = o[0], r = o[o.length - 1], i = (s) => {
22
+ s.key === "Tab" && (s.shiftKey ? document.activeElement === t && (s.preventDefault(), r == null || r.focus()) : document.activeElement === r && (s.preventDefault(), t == null || t.focus()));
23
+ };
24
+ return e.addEventListener("keydown", i), () => {
25
+ e.removeEventListener("keydown", i);
26
+ };
27
+ }
28
+ function Ae(e) {
29
+ var t;
30
+ (t = ie(e)[0]) == null || t.focus();
31
+ }
32
+ function xt() {
33
+ const e = document.activeElement;
34
+ return () => {
35
+ e == null || e.focus();
36
+ };
37
+ }
38
+ function vt(e) {
39
+ return e === document.activeElement;
40
+ }
41
+ function $e({
42
+ enabled: e,
43
+ autoFocus: o = !0,
44
+ restoreFocus: t = !0
45
+ }) {
46
+ const r = C(null), i = C(null);
47
+ return B(() => {
48
+ if (!e) return;
49
+ i.current = document.activeElement, o && r.current && Ae(r.current);
50
+ const s = Se(r.current);
51
+ return () => {
52
+ s(), t && i.current && i.current.focus();
53
+ };
54
+ }, [e, o, t]), r;
55
+ }
56
+ function Z({ enabled: e, onEscape: o }) {
57
+ B(() => {
58
+ if (!e) return;
59
+ const t = (r) => {
60
+ r.key === "Escape" && (r.preventDefault(), o());
61
+ };
62
+ return document.addEventListener("keydown", t), () => {
63
+ document.removeEventListener("keydown", t);
64
+ };
65
+ }, [e, o]);
66
+ }
67
+ function Le({
68
+ value: e,
69
+ defaultValue: o,
70
+ onChange: t
71
+ }) {
72
+ const [r, i] = H(o), s = e !== void 0, a = s ? e : r, n = C(t);
73
+ B(() => {
74
+ n.current = t;
75
+ });
76
+ const l = k(
77
+ (u) => {
78
+ var p;
79
+ s || i(u), (p = n.current) == null || p.call(n, u);
80
+ },
81
+ [s]
82
+ );
83
+ return [a, l];
84
+ }
85
+ function U(e = "architect") {
86
+ const o = Ee();
87
+ return `${e}-${o}`;
88
+ }
89
+ let ne = 0;
90
+ function gt(e = "architect") {
91
+ return ne += 1, `${e}-${ne}`;
92
+ }
93
+ function A(...e) {
94
+ return e.filter(Boolean).join(" ");
95
+ }
96
+ function se(e, o) {
97
+ return (t) => {
98
+ e == null || e(t), t.defaultPrevented || o == null || o(t);
99
+ };
100
+ }
101
+ function Re(...e) {
102
+ return (o) => {
103
+ e.forEach((t) => {
104
+ typeof t == "function" ? t(o) : t != null && (t.current = o);
105
+ });
106
+ };
107
+ }
108
+ const Q = typeof window < "u";
109
+ function Nt() {
110
+ return Q ? window : void 0;
111
+ }
112
+ function It() {
113
+ return Q ? document : void 0;
114
+ }
115
+ const ae = z.createContext(null);
116
+ function _() {
117
+ const e = z.useContext(ae);
118
+ if (!e)
119
+ throw new Error("Dialog components must be used within a Dialog");
120
+ return e;
121
+ }
122
+ const Be = ({
123
+ open: e,
124
+ defaultOpen: o = !1,
125
+ onOpenChange: t,
126
+ onDismiss: r,
127
+ closeOnOutsideClick: i = !0,
128
+ closeOnEscape: s = !0,
129
+ trapFocus: a = !0,
130
+ restoreFocus: n = !0,
131
+ role: l = "dialog",
132
+ children: u
133
+ }) => {
134
+ const [p, m] = Le({
135
+ value: e,
136
+ defaultValue: o,
137
+ onChange: t
138
+ }), b = U("dialog-title"), w = U("dialog-description"), d = (v) => {
139
+ m(v), !v && r && r();
140
+ };
141
+ B(() => {
142
+ if (!p || !Q) return;
143
+ const v = document.body.style.overflow;
144
+ return document.body.style.overflow = "hidden", () => {
145
+ document.body.style.overflow = v;
146
+ };
147
+ }, [p]);
148
+ const y = {
149
+ open: p ?? !1,
150
+ setOpen: d,
151
+ titleId: b,
152
+ descriptionId: w,
153
+ closeOnOutsideClick: i,
154
+ closeOnEscape: s,
155
+ role: l
156
+ };
157
+ return /* @__PURE__ */ c(ae.Provider, { value: y, children: u });
158
+ };
159
+ Be.displayName = "Dialog";
160
+ const ze = D(
161
+ ({ className: e, onClick: o, children: t, ...r }, i) => {
162
+ const { open: s, setOpen: a, closeOnOutsideClick: n } = _();
163
+ return !s || !Q ? null : q(
164
+ /* @__PURE__ */ c(
165
+ "div",
166
+ {
167
+ ref: i,
168
+ className: e,
169
+ onClick: se(o, (u) => {
170
+ n && u.target === u.currentTarget && a(!1);
171
+ }),
172
+ "data-state": s ? "open" : "closed",
173
+ ...r,
174
+ children: t
175
+ }
176
+ ),
177
+ document.body
178
+ );
179
+ }
180
+ );
181
+ ze.displayName = "DialogOverlay";
182
+ const Ce = D(
183
+ ({
184
+ className: e,
185
+ children: o,
186
+ "aria-labelledby": t,
187
+ "aria-describedby": r,
188
+ ...i
189
+ }, s) => {
190
+ const { open: a, setOpen: n, titleId: l, descriptionId: u, closeOnEscape: p, role: m } = _(), b = $e({
191
+ enabled: a,
192
+ autoFocus: !0,
193
+ restoreFocus: !0
194
+ });
195
+ return Z({
196
+ enabled: a && p,
197
+ onEscape: () => n(!1)
198
+ }), a ? /* @__PURE__ */ c(
199
+ "div",
200
+ {
201
+ ref: Re(s, b),
202
+ role: m,
203
+ "aria-modal": "true",
204
+ "aria-labelledby": t || l,
205
+ "aria-describedby": r || u,
206
+ className: e,
207
+ "data-state": a ? "open" : "closed",
208
+ ...i,
209
+ children: o
210
+ }
211
+ ) : null;
212
+ }
213
+ );
214
+ Ce.displayName = "DialogContent";
215
+ const Pe = D(
216
+ ({ className: e, level: o = 2, children: t, ...r }, i) => {
217
+ const { titleId: s } = _(), a = `h${o}`;
218
+ return /* @__PURE__ */ c(a, { ref: i, id: s, className: e, ...r, children: t });
219
+ }
220
+ );
221
+ Pe.displayName = "DialogTitle";
222
+ const He = D(({ className: e, children: o, ...t }, r) => {
223
+ const { descriptionId: i } = _();
224
+ return /* @__PURE__ */ c("p", { ref: r, id: i, className: e, ...t, children: o });
225
+ });
226
+ He.displayName = "DialogDescription";
227
+ const Oe = D(
228
+ ({ className: e, onClick: o, children: t, ...r }, i) => {
229
+ const { setOpen: s } = _();
230
+ return /* @__PURE__ */ c(
231
+ "button",
232
+ {
233
+ ref: i,
234
+ type: "button",
235
+ className: e,
236
+ onClick: se(o, () => {
237
+ s(!1);
238
+ }),
239
+ "aria-label": "Close dialog",
240
+ ...r,
241
+ children: t
242
+ }
243
+ );
244
+ }
245
+ );
246
+ Oe.displayName = "DialogClose";
247
+ const Fe = D(
248
+ ({
249
+ children: e,
250
+ className: o,
251
+ loading: t = !1,
252
+ disabled: r = !1,
253
+ iconLeft: i,
254
+ iconRight: s,
255
+ loadingText: a = "Loading",
256
+ as: n = "button",
257
+ type: l = "button",
258
+ "aria-label": u,
259
+ "aria-describedby": p,
260
+ onClick: m,
261
+ ...b
262
+ }, w) => {
263
+ const d = r || t, y = (x) => {
264
+ if (d) {
265
+ x.preventDefault();
266
+ return;
267
+ }
268
+ m == null || m(x);
269
+ }, v = {
270
+ "aria-label": u,
271
+ "aria-describedby": p,
272
+ "aria-disabled": d ? !0 : void 0,
273
+ "aria-busy": t ? !0 : void 0
274
+ }, g = {
275
+ className: A(o),
276
+ ...v,
277
+ ...b
278
+ };
279
+ return n === "button" ? /* @__PURE__ */ $(
280
+ "button",
281
+ {
282
+ ...g,
283
+ ref: w,
284
+ type: l,
285
+ disabled: d,
286
+ onClick: y,
287
+ "data-loading": t ? "true" : void 0,
288
+ "data-disabled": d ? "true" : void 0,
289
+ children: [
290
+ t && /* @__PURE__ */ c("span", { className: "button-loader", "aria-hidden": "true" }),
291
+ !t && i && /* @__PURE__ */ c("span", { className: "button-icon-left", "aria-hidden": "true", children: i }),
292
+ /* @__PURE__ */ c("span", { className: "button-content", children: t ? a : e }),
293
+ !t && s && /* @__PURE__ */ c("span", { className: "button-icon-right", "aria-hidden": "true", children: s }),
294
+ t && /* @__PURE__ */ c("span", { className: "sr-only", role: "status", "aria-live": "polite", children: a })
295
+ ]
296
+ }
297
+ ) : n === "a" ? /* @__PURE__ */ $(
298
+ "a",
299
+ {
300
+ ...g,
301
+ ref: w,
302
+ onClick: y,
303
+ role: "button",
304
+ tabIndex: d ? -1 : 0,
305
+ "data-loading": t ? "true" : void 0,
306
+ "data-disabled": d ? "true" : void 0,
307
+ children: [
308
+ t && /* @__PURE__ */ c("span", { className: "button-loader", "aria-hidden": "true" }),
309
+ !t && i && /* @__PURE__ */ c("span", { className: "button-icon-left", "aria-hidden": "true", children: i }),
310
+ /* @__PURE__ */ c("span", { className: "button-content", children: t ? a : e }),
311
+ !t && s && /* @__PURE__ */ c("span", { className: "button-icon-right", "aria-hidden": "true", children: s }),
312
+ t && /* @__PURE__ */ c("span", { className: "sr-only", role: "status", "aria-live": "polite", children: a })
313
+ ]
314
+ }
315
+ ) : /* @__PURE__ */ $(
316
+ "div",
317
+ {
318
+ ...g,
319
+ ref: w,
320
+ role: "button",
321
+ tabIndex: d ? -1 : 0,
322
+ onClick: y,
323
+ onKeyDown: (x) => {
324
+ (x.key === "Enter" || x.key === " ") && (x.preventDefault(), d || m == null || m(x));
325
+ },
326
+ "data-loading": t ? "true" : void 0,
327
+ "data-disabled": d ? "true" : void 0,
328
+ children: [
329
+ t && /* @__PURE__ */ c("span", { className: "button-loader", "aria-hidden": "true" }),
330
+ !t && i && /* @__PURE__ */ c("span", { className: "button-icon-left", "aria-hidden": "true", children: i }),
331
+ /* @__PURE__ */ c("span", { className: "button-content", children: t ? a : e }),
332
+ !t && s && /* @__PURE__ */ c("span", { className: "button-icon-right", "aria-hidden": "true", children: s }),
333
+ t && /* @__PURE__ */ c("span", { className: "sr-only", role: "status", "aria-live": "polite", children: a })
334
+ ]
335
+ }
336
+ );
337
+ }
338
+ );
339
+ Fe.displayName = "Button";
340
+ const ce = D(
341
+ ({
342
+ className: e,
343
+ invalid: o = !1,
344
+ errorId: t,
345
+ labelId: r,
346
+ disabled: i = !1,
347
+ required: s = !1,
348
+ prefix: a,
349
+ suffix: n,
350
+ hideNumberSpinners: l = !1,
351
+ hideDateIcon: u = !1,
352
+ showPasswordToggle: p = !1,
353
+ wrapperClassName: m,
354
+ wrapperStyle: b,
355
+ type: w = "text",
356
+ "aria-describedby": d,
357
+ "aria-labelledby": y,
358
+ onClick: v,
359
+ onFocus: g,
360
+ ...x
361
+ }, f) => {
362
+ const [h, N] = z.useState(!1), I = C(null), E = k(
363
+ (O) => {
364
+ I.current = O, typeof f == "function" ? f(O) : f && (f.current = O);
365
+ },
366
+ [f]
367
+ ), S = k(() => {
368
+ if (["date", "time", "datetime-local"].includes(w) && I.current && typeof I.current.showPicker == "function")
369
+ try {
370
+ I.current.showPicker();
371
+ } catch (J) {
372
+ console.warn("showPicker() not supported:", J);
373
+ }
374
+ }, [w]), T = k(
375
+ (O) => {
376
+ u && ["date", "time", "datetime-local"].includes(w) && S(), v == null || v(O);
377
+ },
378
+ [u, w, S, v]
379
+ ), P = k(
380
+ (O) => {
381
+ u && ["date", "time", "datetime-local"].includes(w) && S(), g == null || g(O);
382
+ },
383
+ [u, w, S, g]
384
+ ), W = [d, o && t].filter(Boolean).join(" ") || void 0, j = y || r, F = p && w === "password" && h ? "text" : w, X = A(
385
+ e,
386
+ l && w === "number" && "input-hide-spinners",
387
+ u && ["date", "time", "datetime-local"].includes(w) && "input-hide-date-icon"
388
+ );
389
+ return !a && !n && !(p && w === "password") ? /* @__PURE__ */ c(
390
+ "input",
391
+ {
392
+ ref: E,
393
+ type: F,
394
+ className: X,
395
+ disabled: i,
396
+ required: s,
397
+ "aria-invalid": o ? "true" : void 0,
398
+ "aria-describedby": W,
399
+ "aria-labelledby": j,
400
+ "aria-required": s ? "true" : void 0,
401
+ "data-invalid": o ? "true" : void 0,
402
+ "data-disabled": i ? "true" : void 0,
403
+ onClick: T,
404
+ onFocus: P,
405
+ ...x
406
+ }
407
+ ) : /* @__PURE__ */ $(
408
+ "div",
409
+ {
410
+ className: A("input-wrapper", m),
411
+ style: b,
412
+ children: [
413
+ a && /* @__PURE__ */ c("span", { className: "input-prefix", "aria-hidden": "true", children: a }),
414
+ /* @__PURE__ */ c(
415
+ "input",
416
+ {
417
+ ref: E,
418
+ type: F,
419
+ className: X,
420
+ disabled: i,
421
+ required: s,
422
+ "aria-invalid": o ? "true" : void 0,
423
+ "aria-describedby": W,
424
+ "aria-labelledby": j,
425
+ "aria-required": s ? "true" : void 0,
426
+ "data-invalid": o ? "true" : void 0,
427
+ "data-disabled": i ? "true" : void 0,
428
+ onClick: T,
429
+ onFocus: P,
430
+ ...x
431
+ }
432
+ ),
433
+ n && /* @__PURE__ */ c("span", { className: "input-suffix", "aria-hidden": "true", children: n }),
434
+ p && w === "password" && /* @__PURE__ */ c(
435
+ "button",
436
+ {
437
+ type: "button",
438
+ className: "input-password-toggle",
439
+ onClick: () => N((O) => !O),
440
+ "aria-label": h ? "Hide password" : "Show password",
441
+ tabIndex: -1,
442
+ children: h ? /* @__PURE__ */ $(
443
+ "svg",
444
+ {
445
+ width: "20",
446
+ height: "20",
447
+ viewBox: "0 0 20 20",
448
+ fill: "none",
449
+ xmlns: "http://www.w3.org/2000/svg",
450
+ "aria-hidden": "true",
451
+ children: [
452
+ /* @__PURE__ */ c(
453
+ "path",
454
+ {
455
+ d: "M2 10s3-6 8-6 8 6 8 6-3 6-8 6-8-6-8-6z",
456
+ stroke: "currentColor",
457
+ strokeWidth: "2",
458
+ strokeLinecap: "round",
459
+ strokeLinejoin: "round"
460
+ }
461
+ ),
462
+ /* @__PURE__ */ c(
463
+ "circle",
464
+ {
465
+ cx: "10",
466
+ cy: "10",
467
+ r: "3",
468
+ stroke: "currentColor",
469
+ strokeWidth: "2",
470
+ strokeLinecap: "round",
471
+ strokeLinejoin: "round"
472
+ }
473
+ )
474
+ ]
475
+ }
476
+ ) : /* @__PURE__ */ c(
477
+ "svg",
478
+ {
479
+ width: "20",
480
+ height: "20",
481
+ viewBox: "0 0 20 20",
482
+ fill: "none",
483
+ xmlns: "http://www.w3.org/2000/svg",
484
+ "aria-hidden": "true",
485
+ children: /* @__PURE__ */ c(
486
+ "path",
487
+ {
488
+ d: "M14.12 14.12A8 8 0 0 1 2 10s3-6 8-6a8 8 0 0 1 4.12 1.12m2.83 2.83A8 8 0 0 1 18 10s-3 6-8 6a8 8 0 0 1-2.95-.55M1 1l18 18",
489
+ stroke: "currentColor",
490
+ strokeWidth: "2",
491
+ strokeLinecap: "round",
492
+ strokeLinejoin: "round"
493
+ }
494
+ )
495
+ }
496
+ )
497
+ }
498
+ )
499
+ ]
500
+ }
501
+ );
502
+ }
503
+ );
504
+ ce.displayName = "Input";
505
+ const le = D(
506
+ ({
507
+ children: e,
508
+ className: o,
509
+ required: t = !1,
510
+ requiredIndicator: r = "*",
511
+ showRequiredIndicator: i = !0,
512
+ ...s
513
+ }, a) => /* @__PURE__ */ $("label", { ref: a, className: A(o), ...s, children: [
514
+ e,
515
+ t && i && /* @__PURE__ */ c(
516
+ "span",
517
+ {
518
+ className: "label-required",
519
+ "aria-label": "required",
520
+ role: "presentation",
521
+ children: r
522
+ }
523
+ )
524
+ ] })
525
+ );
526
+ le.displayName = "Label";
527
+ const de = D(
528
+ ({ children: e, className: o, show: t = !0, ...r }, i) => !t || !e ? null : /* @__PURE__ */ c(
529
+ "p",
530
+ {
531
+ ref: i,
532
+ className: A(o),
533
+ role: "alert",
534
+ "aria-live": "polite",
535
+ ...r,
536
+ children: e
537
+ }
538
+ )
539
+ );
540
+ de.displayName = "ErrorMessage";
541
+ const je = D(
542
+ ({
543
+ label: e,
544
+ error: o,
545
+ inputProps: t,
546
+ labelProps: r,
547
+ errorProps: i,
548
+ required: s = !1,
549
+ id: a,
550
+ className: n,
551
+ ...l
552
+ }, u) => {
553
+ const p = U("form-field"), m = a || p, b = `${m}-error`, w = `${m}-label`, d = !!o;
554
+ return /* @__PURE__ */ $("div", { className: n, ...l, children: [
555
+ /* @__PURE__ */ c(le, { id: w, htmlFor: m, required: s, ...r, children: e }),
556
+ /* @__PURE__ */ c(
557
+ ce,
558
+ {
559
+ ref: u,
560
+ id: m,
561
+ labelId: w,
562
+ errorId: b,
563
+ invalid: d,
564
+ required: s,
565
+ ...t
566
+ }
567
+ ),
568
+ /* @__PURE__ */ c(de, { id: b, show: d, ...i, children: o })
569
+ ] });
570
+ }
571
+ );
572
+ je.displayName = "FormField";
573
+ const ue = Y(null), V = () => {
574
+ const e = K(ue);
575
+ if (!e)
576
+ throw new Error("Dropdown components must be used within Dropdown");
577
+ return e;
578
+ }, Ue = ({
579
+ children: e,
580
+ open: o,
581
+ defaultOpen: t = !1,
582
+ onOpenChange: r,
583
+ className: i,
584
+ ...s
585
+ }) => {
586
+ const [a, n] = H(t), l = o !== void 0, u = l ? o : a, p = k(
587
+ (g) => {
588
+ l || n(g), r == null || r(g);
589
+ },
590
+ [l, r]
591
+ ), m = U("dropdown-trigger"), b = U("dropdown-menu"), [w, d] = H(-1), y = C([]), v = {
592
+ open: u,
593
+ setOpen: p,
594
+ triggerId: m,
595
+ menuId: b,
596
+ activeIndex: w,
597
+ setActiveIndex: d,
598
+ itemsRef: y
599
+ };
600
+ return /* @__PURE__ */ c(ue.Provider, { value: v, children: /* @__PURE__ */ c("div", { className: A("dropdown", i), ...s, children: e }) });
601
+ }, We = D(({ children: e, className: o, onClick: t, onKeyDown: r, ...i }, s) => {
602
+ const { open: a, setOpen: n, triggerId: l, menuId: u } = V(), p = (b) => {
603
+ n(!a), t == null || t(b);
604
+ }, m = (b) => {
605
+ (b.key === "ArrowDown" || b.key === "ArrowUp") && (b.preventDefault(), n(!0)), r == null || r(b);
606
+ };
607
+ return /* @__PURE__ */ c(
608
+ "button",
609
+ {
610
+ ref: s,
611
+ id: l,
612
+ type: "button",
613
+ "aria-haspopup": "true",
614
+ "aria-expanded": a,
615
+ "aria-controls": u,
616
+ className: A("dropdown-trigger", o),
617
+ onClick: p,
618
+ onKeyDown: m,
619
+ ...i,
620
+ children: e
621
+ }
622
+ );
623
+ });
624
+ We.displayName = "DropdownTrigger";
625
+ const Ye = D(
626
+ ({
627
+ children: e,
628
+ className: o,
629
+ portal: t = !0,
630
+ placement: r = "bottom",
631
+ style: i,
632
+ ...s
633
+ }, a) => {
634
+ const { open: n, setOpen: l, menuId: u, triggerId: p, setActiveIndex: m, itemsRef: b } = V(), w = C(null), [d, y] = z.useState({ top: 0, left: 0 });
635
+ B(() => {
636
+ if (!n || !t) return;
637
+ const f = () => {
638
+ const h = document.getElementById(p), N = w.current;
639
+ if (!h) return;
640
+ const I = h.getBoundingClientRect(), E = (N == null ? void 0 : N.offsetHeight) || 0;
641
+ let S;
642
+ r === "top" ? S = I.top + window.scrollY - E - 4 : S = I.bottom + window.scrollY + 4, y({
643
+ top: S,
644
+ left: I.left + window.scrollX
645
+ });
646
+ };
647
+ return f(), window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
648
+ window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
649
+ };
650
+ }, [n, t, p, r]), Z({
651
+ enabled: n,
652
+ onEscape: () => l(!1)
653
+ }), B(() => {
654
+ if (!n) return;
655
+ const f = (h) => {
656
+ const N = h.target, I = document.getElementById(p), E = w.current;
657
+ E && !E.contains(N) && I && !I.contains(N) && l(!1);
658
+ };
659
+ return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
660
+ }, [n, l, p]);
661
+ const v = (f) => {
662
+ var N, I, E;
663
+ const h = b.current.filter(
664
+ (S) => S && !S.hasAttribute("disabled")
665
+ );
666
+ switch (f.key) {
667
+ case "ArrowDown":
668
+ f.preventDefault(), m((S) => {
669
+ var P;
670
+ const T = S + 1 >= h.length ? 0 : S + 1;
671
+ return (P = h[T]) == null || P.focus(), T;
672
+ });
673
+ break;
674
+ case "ArrowUp":
675
+ f.preventDefault(), m((S) => {
676
+ var P;
677
+ const T = S - 1 < 0 ? h.length - 1 : S - 1;
678
+ return (P = h[T]) == null || P.focus(), T;
679
+ });
680
+ break;
681
+ case "Home":
682
+ f.preventDefault(), m(0), (N = h[0]) == null || N.focus();
683
+ break;
684
+ case "End":
685
+ f.preventDefault(), m(h.length - 1), (I = h[h.length - 1]) == null || I.focus();
686
+ break;
687
+ case "Escape":
688
+ f.preventDefault(), l(!1), (E = document.getElementById(p)) == null || E.focus();
689
+ break;
690
+ }
691
+ };
692
+ if (B(() => {
693
+ if (n) {
694
+ const f = b.current.filter(
695
+ (h) => h && !h.hasAttribute("disabled")
696
+ );
697
+ f.length > 0 && (m(0), setTimeout(() => {
698
+ var h;
699
+ return (h = f[0]) == null ? void 0 : h.focus();
700
+ }, 0));
701
+ } else
702
+ m(-1);
703
+ }, [n, m]), !n) return null;
704
+ const g = t ? {
705
+ ...i,
706
+ position: "absolute",
707
+ top: `${d.top}px`,
708
+ left: `${d.left}px`,
709
+ zIndex: 9999
710
+ } : i, x = /* @__PURE__ */ c(
711
+ "div",
712
+ {
713
+ ref: (f) => {
714
+ w.current = f, typeof a == "function" ? a(f) : a && (a.current = f);
715
+ },
716
+ id: u,
717
+ role: "menu",
718
+ "aria-labelledby": p,
719
+ className: A("dropdown-menu", o),
720
+ style: g,
721
+ onKeyDown: v,
722
+ ...s,
723
+ children: e
724
+ }
725
+ );
726
+ return t && Q ? q(x, document.body) : x;
727
+ }
728
+ );
729
+ Ye.displayName = "DropdownMenu";
730
+ const Ke = D(
731
+ ({ children: e, className: o, disabled: t = !1, onClick: r, ...i }, s) => {
732
+ const { setOpen: a, itemsRef: n, activeIndex: l } = V(), u = C(null), [p, m] = H(-1);
733
+ B(() => {
734
+ const d = u.current;
735
+ if (d) {
736
+ const y = n.current.length;
737
+ return n.current[y] = d, m(y), () => {
738
+ n.current[y] = null;
739
+ };
740
+ }
741
+ }, [n]);
742
+ const b = (d) => {
743
+ t || (r == null || r(d), a(!1));
744
+ }, w = (d) => {
745
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), t || b(d));
746
+ };
747
+ return /* @__PURE__ */ c(
748
+ "button",
749
+ {
750
+ ref: (d) => {
751
+ u.current = d, typeof s == "function" ? s(d) : s && (s.current = d);
752
+ },
753
+ type: "button",
754
+ role: "menuitem",
755
+ tabIndex: -1,
756
+ disabled: t,
757
+ "aria-disabled": t ? "true" : void 0,
758
+ className: A("dropdown-item", o),
759
+ onClick: b,
760
+ onKeyDown: w,
761
+ "data-active": p === l ? "true" : void 0,
762
+ ...i,
763
+ children: e
764
+ }
765
+ );
766
+ }
767
+ );
768
+ Ke.displayName = "DropdownItem";
769
+ Ue.displayName = "Dropdown";
770
+ const pe = Y(null), ee = () => {
771
+ const e = K(pe);
772
+ if (!e)
773
+ throw new Error("Tabs components must be used within Tabs");
774
+ return e;
775
+ }, Xe = ({
776
+ children: e,
777
+ value: o,
778
+ defaultValue: t,
779
+ onValueChange: r,
780
+ orientation: i = "horizontal",
781
+ activationMode: s = "automatic",
782
+ className: a,
783
+ ...n
784
+ }) => {
785
+ const [l, u] = H(
786
+ t || ""
787
+ ), p = o !== void 0, m = p ? o : l, b = k(
788
+ (x) => {
789
+ p || u(x), r == null || r(x);
790
+ },
791
+ [p, r]
792
+ ), w = U("tabs"), d = C(/* @__PURE__ */ new Map()), y = k((x, f) => {
793
+ d.current.set(x, f);
794
+ }, []), v = k((x) => {
795
+ d.current.delete(x);
796
+ }, []), g = {
797
+ selectedValue: m,
798
+ setSelectedValue: b,
799
+ orientation: i,
800
+ activationMode: s,
801
+ tabsId: w,
802
+ registerTab: y,
803
+ unregisterTab: v,
804
+ tabs: d.current
805
+ };
806
+ return /* @__PURE__ */ c(pe.Provider, { value: g, children: /* @__PURE__ */ c(
807
+ "div",
808
+ {
809
+ className: A("tabs", a),
810
+ "data-orientation": i,
811
+ ...n,
812
+ children: e
813
+ }
814
+ ) });
815
+ }, Ge = D(
816
+ ({ children: e, className: o, ...t }, r) => {
817
+ const { orientation: i } = ee();
818
+ return /* @__PURE__ */ c(
819
+ "div",
820
+ {
821
+ ref: r,
822
+ role: "tablist",
823
+ "aria-orientation": i,
824
+ className: A("tabs-list", o),
825
+ "data-orientation": i,
826
+ ...t,
827
+ children: e
828
+ }
829
+ );
830
+ }
831
+ );
832
+ Ge.displayName = "TabsList";
833
+ const Me = D(
834
+ ({ children: e, className: o, value: t, disabled: r = !1, onKeyDown: i, ...s }, a) => {
835
+ const {
836
+ selectedValue: n,
837
+ setSelectedValue: l,
838
+ orientation: u,
839
+ activationMode: p,
840
+ tabsId: m,
841
+ registerTab: b,
842
+ unregisterTab: w,
843
+ tabs: d
844
+ } = ee(), y = C(null), v = n === t;
845
+ B(() => {
846
+ const f = y.current;
847
+ if (f)
848
+ return b(t, f), () => w(t);
849
+ }, [t, b, w]), B(() => {
850
+ !n && d.size > 0 && Array.from(d.keys())[0] === t && l(t);
851
+ }, [n, t, d, l]);
852
+ const g = () => {
853
+ r || l(t);
854
+ }, x = (f) => {
855
+ if (r) return;
856
+ const N = Array.from(d.keys()).filter((S) => {
857
+ const T = d.get(S);
858
+ return T && !T.hasAttribute("disabled");
859
+ }), I = N.indexOf(t);
860
+ let E = I;
861
+ if (u === "horizontal" ? f.key === "ArrowLeft" ? (f.preventDefault(), E = I - 1 < 0 ? N.length - 1 : I - 1) : f.key === "ArrowRight" && (f.preventDefault(), E = I + 1 >= N.length ? 0 : I + 1) : f.key === "ArrowUp" ? (f.preventDefault(), E = I - 1 < 0 ? N.length - 1 : I - 1) : f.key === "ArrowDown" && (f.preventDefault(), E = I + 1 >= N.length ? 0 : I + 1), f.key === "Home" ? (f.preventDefault(), E = 0) : f.key === "End" && (f.preventDefault(), E = N.length - 1), E !== I) {
862
+ const S = N[E], T = d.get(S);
863
+ T && (T.focus(), p === "automatic" && l(S));
864
+ }
865
+ p === "manual" && (f.key === "Enter" || f.key === " ") && (f.preventDefault(), l(t)), i == null || i(f);
866
+ };
867
+ return /* @__PURE__ */ c(
868
+ "button",
869
+ {
870
+ ref: (f) => {
871
+ y.current = f, typeof a == "function" ? a(f) : a && (a.current = f);
872
+ },
873
+ type: "button",
874
+ role: "tab",
875
+ id: `${m}-tab-${t}`,
876
+ "aria-selected": v,
877
+ "aria-controls": `${m}-panel-${t}`,
878
+ tabIndex: v ? 0 : -1,
879
+ disabled: r,
880
+ className: A("tabs-trigger", o),
881
+ "data-state": v ? "active" : "inactive",
882
+ "data-orientation": u,
883
+ onClick: g,
884
+ onKeyDown: x,
885
+ ...s,
886
+ children: e
887
+ }
888
+ );
889
+ }
890
+ );
891
+ Me.displayName = "TabsTrigger";
892
+ const qe = D(
893
+ ({ children: e, className: o, value: t, ...r }, i) => {
894
+ const { selectedValue: s, tabsId: a } = ee(), n = s === t;
895
+ return n ? /* @__PURE__ */ c(
896
+ "div",
897
+ {
898
+ ref: i,
899
+ role: "tabpanel",
900
+ id: `${a}-panel-${t}`,
901
+ "aria-labelledby": `${a}-tab-${t}`,
902
+ tabIndex: 0,
903
+ className: A("tabs-content", o),
904
+ "data-state": n ? "active" : "inactive",
905
+ ...r,
906
+ children: e
907
+ }
908
+ ) : null;
909
+ }
910
+ );
911
+ qe.displayName = "TabsContent";
912
+ Xe.displayName = "Tabs";
913
+ const fe = Y(null), me = () => {
914
+ const e = K(fe);
915
+ if (!e)
916
+ throw new Error("Accordion components must be used within Accordion");
917
+ return e;
918
+ }, be = Y(
919
+ null
920
+ ), he = () => {
921
+ const e = K(be);
922
+ if (!e)
923
+ throw new Error(
924
+ "AccordionTrigger and AccordionContent must be used within AccordionItem"
925
+ );
926
+ return e;
927
+ }, Qe = ({
928
+ children: e,
929
+ type: o = "single",
930
+ value: t,
931
+ defaultValue: r,
932
+ onValueChange: i,
933
+ collapsible: s = !1,
934
+ disabled: a = !1,
935
+ className: n,
936
+ ...l
937
+ }) => {
938
+ const [u, p] = H(
939
+ r || (o === "single" ? "" : [])
940
+ ), m = t !== void 0, b = m ? t : u, w = k(
941
+ (v) => {
942
+ let g;
943
+ if (o === "single")
944
+ b === v && s ? g = "" : g = v;
945
+ else {
946
+ const x = b || [];
947
+ x.includes(v) ? g = x.filter((f) => f !== v) : g = [...x, v];
948
+ }
949
+ m || p(g), i == null || i(g);
950
+ },
951
+ [o, b, s, m, i]
952
+ ), d = U("accordion"), y = {
953
+ type: o,
954
+ value: b,
955
+ onValueChange: w,
956
+ collapsible: s,
957
+ disabled: a,
958
+ accordionId: d
959
+ };
960
+ return /* @__PURE__ */ c(fe.Provider, { value: y, children: /* @__PURE__ */ c("div", { className: A("accordion", n), ...l, children: e }) });
961
+ }, _e = D(
962
+ ({ children: e, className: o, value: t, disabled: r = !1, ...i }, s) => {
963
+ const {
964
+ type: a,
965
+ value: n,
966
+ disabled: l,
967
+ accordionId: u
968
+ } = me(), p = l || r, m = a === "single" ? n === t : Array.isArray(n) && n.includes(t), b = `${u}-trigger-${t}`, w = `${u}-content-${t}`, d = {
969
+ value: t,
970
+ disabled: p,
971
+ isOpen: m,
972
+ triggerId: b,
973
+ contentId: w
974
+ };
975
+ return /* @__PURE__ */ c(be.Provider, { value: d, children: /* @__PURE__ */ c(
976
+ "div",
977
+ {
978
+ ref: s,
979
+ className: A("accordion-item", o),
980
+ "data-state": m ? "open" : "closed",
981
+ "data-disabled": p ? "true" : void 0,
982
+ ...i,
983
+ children: e
984
+ }
985
+ ) });
986
+ }
987
+ );
988
+ _e.displayName = "AccordionItem";
989
+ const Je = D(({ children: e, className: o, ...t }, r) => {
990
+ const { onValueChange: i } = me(), { value: s, disabled: a, isOpen: n, triggerId: l, contentId: u } = he(), p = () => {
991
+ a || i(s);
992
+ };
993
+ return /* @__PURE__ */ c("h3", { className: "accordion-header", children: /* @__PURE__ */ c(
994
+ "button",
995
+ {
996
+ ref: r,
997
+ type: "button",
998
+ id: l,
999
+ "aria-expanded": n,
1000
+ "aria-controls": u,
1001
+ disabled: a,
1002
+ className: A("accordion-trigger", o),
1003
+ "data-state": n ? "open" : "closed",
1004
+ onClick: p,
1005
+ ...t,
1006
+ children: e
1007
+ }
1008
+ ) });
1009
+ });
1010
+ Je.displayName = "AccordionTrigger";
1011
+ const Ze = D(({ children: e, className: o, ...t }, r) => {
1012
+ const { isOpen: i, triggerId: s, contentId: a } = he(), n = C(null), [l, u] = H(
1013
+ i ? void 0 : 0
1014
+ );
1015
+ return B(() => {
1016
+ const p = n.current;
1017
+ if (p)
1018
+ if (i) {
1019
+ const m = p.scrollHeight;
1020
+ u(m);
1021
+ const b = setTimeout(() => {
1022
+ u(void 0);
1023
+ }, 300);
1024
+ return () => clearTimeout(b);
1025
+ } else {
1026
+ const m = p.scrollHeight;
1027
+ u(m), p.offsetHeight, requestAnimationFrame(() => {
1028
+ u(0);
1029
+ });
1030
+ }
1031
+ }, [i]), /* @__PURE__ */ c(
1032
+ "div",
1033
+ {
1034
+ ref: (p) => {
1035
+ n.current = p, typeof r == "function" ? r(p) : r && (r.current = p);
1036
+ },
1037
+ id: a,
1038
+ role: "region",
1039
+ "aria-labelledby": s,
1040
+ className: A("accordion-content", o),
1041
+ "data-state": i ? "open" : "closed",
1042
+ style: {
1043
+ height: l !== void 0 ? `${l}px` : "auto",
1044
+ overflow: "hidden",
1045
+ transition: "height 300ms cubic-bezier(0.4, 0, 0.2, 1)"
1046
+ },
1047
+ ...t,
1048
+ children: /* @__PURE__ */ c("div", { className: "accordion-content-inner", children: e })
1049
+ }
1050
+ );
1051
+ });
1052
+ Ze.displayName = "AccordionContent";
1053
+ Qe.displayName = "Accordion";
1054
+ const we = Y(null), ye = () => {
1055
+ const e = K(we);
1056
+ if (!e)
1057
+ throw new Error("Tooltip components must be used within Tooltip");
1058
+ return e;
1059
+ }, Ve = typeof window < "u", et = ({
1060
+ children: e,
1061
+ delayShow: o = 200,
1062
+ delayHide: t = 0,
1063
+ defaultOpen: r = !1,
1064
+ open: i,
1065
+ onOpenChange: s
1066
+ }) => {
1067
+ const [a, n] = H(r), l = i !== void 0, u = l ? i : a, p = k(
1068
+ (d) => {
1069
+ l || n(d), s == null || s(d);
1070
+ },
1071
+ [l, s]
1072
+ ), m = U("tooltip"), b = C(null), w = {
1073
+ open: u,
1074
+ setOpen: p,
1075
+ tooltipId: m,
1076
+ triggerRef: b,
1077
+ delayShow: o,
1078
+ delayHide: t
1079
+ };
1080
+ return /* @__PURE__ */ c(we.Provider, { value: w, children: e });
1081
+ }, tt = D(
1082
+ ({
1083
+ children: e,
1084
+ className: o,
1085
+ asChild: t = !1,
1086
+ onMouseEnter: r,
1087
+ onMouseLeave: i,
1088
+ onFocus: s,
1089
+ onBlur: a,
1090
+ ...n
1091
+ }, l) => {
1092
+ const { setOpen: u, tooltipId: p, triggerRef: m, delayShow: b, delayHide: w } = ye(), d = C(), y = C(), v = k(
1093
+ (h) => {
1094
+ clearTimeout(y.current), d.current = setTimeout(() => {
1095
+ u(!0);
1096
+ }, b), r == null || r(h);
1097
+ },
1098
+ [u, b, r]
1099
+ ), g = k(
1100
+ (h) => {
1101
+ clearTimeout(d.current), y.current = setTimeout(() => {
1102
+ u(!1);
1103
+ }, w), i == null || i(h);
1104
+ },
1105
+ [u, w, i]
1106
+ ), x = k(
1107
+ (h) => {
1108
+ clearTimeout(y.current), u(!0), s == null || s(h);
1109
+ },
1110
+ [u, s]
1111
+ ), f = k(
1112
+ (h) => {
1113
+ clearTimeout(d.current), u(!1), a == null || a(h);
1114
+ },
1115
+ [u, a]
1116
+ );
1117
+ return B(() => () => {
1118
+ clearTimeout(d.current), clearTimeout(y.current);
1119
+ }, []), t && z.isValidElement(e) ? z.cloneElement(e, {
1120
+ ref: (h) => {
1121
+ m.current = h, typeof l == "function" ? l(h) : l && (l.current = h);
1122
+ },
1123
+ "aria-describedby": p,
1124
+ onMouseEnter: v,
1125
+ onMouseLeave: g,
1126
+ onFocus: x,
1127
+ onBlur: f
1128
+ }) : /* @__PURE__ */ c(
1129
+ "span",
1130
+ {
1131
+ ref: (h) => {
1132
+ m.current = h, typeof l == "function" ? l(h) : l && (l.current = h);
1133
+ },
1134
+ className: A("tooltip-trigger", o),
1135
+ "aria-describedby": p,
1136
+ onMouseEnter: v,
1137
+ onMouseLeave: g,
1138
+ onFocus: x,
1139
+ onBlur: f,
1140
+ ...n,
1141
+ children: e
1142
+ }
1143
+ );
1144
+ }
1145
+ );
1146
+ tt.displayName = "TooltipTrigger";
1147
+ const rt = D(
1148
+ ({ children: e, className: o, placement: t = "top", portal: r = !0, style: i, ...s }, a) => {
1149
+ const { open: n, tooltipId: l, triggerRef: u } = ye(), p = C(null), [m, b] = H({ top: 0, left: 0 });
1150
+ if (B(() => {
1151
+ if (!n || !r) return;
1152
+ const y = () => {
1153
+ const v = u.current, g = p.current;
1154
+ if (!v || !g) return;
1155
+ const x = v.getBoundingClientRect(), f = g.getBoundingClientRect();
1156
+ let h = 0, N = 0;
1157
+ switch (t) {
1158
+ case "top":
1159
+ h = x.top + window.scrollY - f.height - 8, N = x.left + window.scrollX + x.width / 2 - f.width / 2;
1160
+ break;
1161
+ case "bottom":
1162
+ h = x.bottom + window.scrollY + 8, N = x.left + window.scrollX + x.width / 2 - f.width / 2;
1163
+ break;
1164
+ case "left":
1165
+ h = x.top + window.scrollY + x.height / 2 - f.height / 2, N = x.left + window.scrollX - f.width - 8;
1166
+ break;
1167
+ case "right":
1168
+ h = x.top + window.scrollY + x.height / 2 - f.height / 2, N = x.right + window.scrollX + 8;
1169
+ break;
1170
+ }
1171
+ b({ top: h, left: N });
1172
+ };
1173
+ return y(), window.addEventListener("scroll", y, !0), window.addEventListener("resize", y), () => {
1174
+ window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", y);
1175
+ };
1176
+ }, [n, r, t, u]), !n) return null;
1177
+ const w = r ? {
1178
+ ...i,
1179
+ position: "absolute",
1180
+ top: `${m.top}px`,
1181
+ left: `${m.left}px`,
1182
+ zIndex: 9999
1183
+ } : i, d = /* @__PURE__ */ c(
1184
+ "div",
1185
+ {
1186
+ ref: (y) => {
1187
+ p.current = y, typeof a == "function" ? a(y) : a && (a.current = y);
1188
+ },
1189
+ id: l,
1190
+ role: "tooltip",
1191
+ className: A("tooltip-content", o),
1192
+ "data-placement": t,
1193
+ style: w,
1194
+ ...s,
1195
+ children: e
1196
+ }
1197
+ );
1198
+ return r && Ve ? q(d, document.body) : d;
1199
+ }
1200
+ );
1201
+ rt.displayName = "TooltipContent";
1202
+ et.displayName = "Tooltip";
1203
+ const xe = Y(null), te = () => {
1204
+ const e = K(xe);
1205
+ if (!e)
1206
+ throw new Error("useToast must be used within ToastProvider");
1207
+ return e;
1208
+ }, ot = typeof window < "u";
1209
+ let nt = 0;
1210
+ const it = () => `toast-${++nt}`, kt = ({
1211
+ children: e,
1212
+ position: o = "bottom-right",
1213
+ maxToasts: t = 5
1214
+ }) => {
1215
+ const [r, i] = H([]), s = k(
1216
+ (l) => {
1217
+ const u = it(), p = {
1218
+ ...l,
1219
+ id: u,
1220
+ duration: l.duration ?? 5e3,
1221
+ variant: l.variant ?? "default"
1222
+ };
1223
+ return i((m) => [...m, p].slice(-t)), u;
1224
+ },
1225
+ [t]
1226
+ ), a = k((l) => {
1227
+ i((u) => u.filter((p) => p.id !== l));
1228
+ }, []), n = {
1229
+ toasts: r,
1230
+ addToast: s,
1231
+ removeToast: a,
1232
+ position: o
1233
+ };
1234
+ return /* @__PURE__ */ $(xe.Provider, { value: n, children: [
1235
+ e,
1236
+ /* @__PURE__ */ c(st, {})
1237
+ ] });
1238
+ }, st = () => {
1239
+ const { toasts: e, position: o } = te();
1240
+ return !ot || e.length === 0 ? null : q(
1241
+ /* @__PURE__ */ c(
1242
+ "div",
1243
+ {
1244
+ className: "toast-container",
1245
+ style: {
1246
+ position: "fixed",
1247
+ zIndex: 1e4,
1248
+ display: "flex",
1249
+ flexDirection: "column",
1250
+ gap: "8px",
1251
+ pointerEvents: "none",
1252
+ ...{
1253
+ "top-left": { top: 16, left: 16 },
1254
+ "top-center": { top: 16, left: "50%", transform: "translateX(-50%)" },
1255
+ "top-right": { top: 16, right: 16 },
1256
+ "bottom-left": { bottom: 16, left: 16 },
1257
+ "bottom-center": { bottom: 16, left: "50%", transform: "translateX(-50%)" },
1258
+ "bottom-right": { bottom: 16, right: 16 }
1259
+ }[o]
1260
+ },
1261
+ "aria-live": "polite",
1262
+ "aria-atomic": "false",
1263
+ children: e.map((r) => /* @__PURE__ */ c(ve, { toast: r }, r.id))
1264
+ }
1265
+ ),
1266
+ document.body
1267
+ );
1268
+ }, ve = D(
1269
+ ({ toast: e }, o) => {
1270
+ const { removeToast: t } = te(), [r, i] = H(!1);
1271
+ B(() => {
1272
+ if (e.duration && e.duration > 0) {
1273
+ const n = setTimeout(() => {
1274
+ s();
1275
+ }, e.duration);
1276
+ return () => clearTimeout(n);
1277
+ }
1278
+ }, [e.duration, e.id]);
1279
+ const s = () => {
1280
+ i(!0), setTimeout(() => {
1281
+ var n;
1282
+ t(e.id), (n = e.onDismiss) == null || n.call(e);
1283
+ }, 200);
1284
+ }, a = {
1285
+ default: {
1286
+ backgroundColor: "#1f2937",
1287
+ color: "white",
1288
+ border: "1px solid #374151"
1289
+ },
1290
+ success: {
1291
+ backgroundColor: "#10b981",
1292
+ color: "white",
1293
+ border: "1px solid #059669"
1294
+ },
1295
+ error: {
1296
+ backgroundColor: "#ef4444",
1297
+ color: "white",
1298
+ border: "1px solid #dc2626"
1299
+ },
1300
+ warning: {
1301
+ backgroundColor: "#f59e0b",
1302
+ color: "#1f2937",
1303
+ border: "1px solid #d97706"
1304
+ },
1305
+ info: {
1306
+ backgroundColor: "#3b82f6",
1307
+ color: "white",
1308
+ border: "1px solid #2563eb"
1309
+ }
1310
+ };
1311
+ return /* @__PURE__ */ $(
1312
+ "div",
1313
+ {
1314
+ ref: o,
1315
+ role: "status",
1316
+ "aria-live": "polite",
1317
+ className: A("toast-item", `toast-${e.variant}`),
1318
+ "data-variant": e.variant,
1319
+ "data-exiting": r,
1320
+ style: {
1321
+ pointerEvents: "auto",
1322
+ minWidth: "300px",
1323
+ maxWidth: "500px",
1324
+ padding: "16px",
1325
+ borderRadius: "8px",
1326
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
1327
+ display: "flex",
1328
+ alignItems: "flex-start",
1329
+ gap: "12px",
1330
+ animation: r ? "toast-exit 200ms ease-out" : "toast-enter 200ms ease-out",
1331
+ ...a[e.variant || "default"]
1332
+ },
1333
+ children: [
1334
+ /* @__PURE__ */ $("div", { style: { flex: 1 }, children: [
1335
+ e.title && /* @__PURE__ */ c(
1336
+ "div",
1337
+ {
1338
+ style: {
1339
+ fontWeight: "600",
1340
+ fontSize: "14px",
1341
+ marginBottom: e.description ? "4px" : 0
1342
+ },
1343
+ children: e.title
1344
+ }
1345
+ ),
1346
+ e.description && /* @__PURE__ */ c("div", { style: { fontSize: "13px", opacity: 0.9 }, children: e.description })
1347
+ ] }),
1348
+ /* @__PURE__ */ c(
1349
+ "button",
1350
+ {
1351
+ onClick: s,
1352
+ "aria-label": "Dismiss notification",
1353
+ style: {
1354
+ background: "transparent",
1355
+ border: "none",
1356
+ color: "inherit",
1357
+ cursor: "pointer",
1358
+ padding: "4px",
1359
+ display: "flex",
1360
+ alignItems: "center",
1361
+ justifyContent: "center",
1362
+ opacity: 0.7,
1363
+ transition: "opacity 0.2s"
1364
+ },
1365
+ onMouseEnter: (n) => n.currentTarget.style.opacity = "1",
1366
+ onMouseLeave: (n) => n.currentTarget.style.opacity = "0.7",
1367
+ children: /* @__PURE__ */ c("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ c("path", { d: "M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" }) })
1368
+ }
1369
+ ),
1370
+ /* @__PURE__ */ c("style", { children: `
1371
+ @keyframes toast-enter {
1372
+ from {
1373
+ opacity: 0;
1374
+ transform: translateY(20px);
1375
+ }
1376
+ to {
1377
+ opacity: 1;
1378
+ transform: translateY(0);
1379
+ }
1380
+ }
1381
+ @keyframes toast-exit {
1382
+ from {
1383
+ opacity: 1;
1384
+ transform: translateY(0);
1385
+ }
1386
+ to {
1387
+ opacity: 0;
1388
+ transform: translateY(20px);
1389
+ }
1390
+ }
1391
+ ` })
1392
+ ]
1393
+ }
1394
+ );
1395
+ }
1396
+ );
1397
+ ve.displayName = "ToastItem";
1398
+ const Tt = () => {
1399
+ const { addToast: e } = te(), o = k(
1400
+ (a) => e(a),
1401
+ [e]
1402
+ ), t = k(
1403
+ (a, n) => e({ title: a, description: n, variant: "success" }),
1404
+ [e]
1405
+ ), r = k(
1406
+ (a, n) => e({ title: a, description: n, variant: "error" }),
1407
+ [e]
1408
+ ), i = k(
1409
+ (a, n) => e({ title: a, description: n, variant: "warning" }),
1410
+ [e]
1411
+ ), s = k(
1412
+ (a, n) => e({ title: a, description: n, variant: "info" }),
1413
+ [e]
1414
+ );
1415
+ return {
1416
+ toast: o,
1417
+ success: t,
1418
+ error: r,
1419
+ warning: i,
1420
+ info: s
1421
+ };
1422
+ }, at = D(
1423
+ ({
1424
+ className: e,
1425
+ checked: o,
1426
+ defaultChecked: t,
1427
+ indeterminate: r = !1,
1428
+ disabled: i = !1,
1429
+ invalid: s = !1,
1430
+ label: a,
1431
+ helperText: n,
1432
+ errorMessage: l,
1433
+ onCheckedChange: u,
1434
+ onChange: p,
1435
+ id: m,
1436
+ ...b
1437
+ }, w) => {
1438
+ const d = k(
1439
+ (h) => {
1440
+ p == null || p(h), u == null || u(h.target.checked);
1441
+ },
1442
+ [p, u]
1443
+ ), y = z.useRef(null);
1444
+ z.useEffect(() => {
1445
+ y.current && (y.current.indeterminate = r);
1446
+ }, [r]), z.useImperativeHandle(w, () => y.current);
1447
+ const v = m || `checkbox-${z.useId()}`, g = n ? `${v}-helper` : void 0, x = l ? `${v}-error` : void 0, f = [g, x].filter(Boolean).join(" ") || void 0;
1448
+ return /* @__PURE__ */ $("div", { className: A("checkbox-wrapper", e), children: [
1449
+ /* @__PURE__ */ $("div", { style: { display: "flex", alignItems: "flex-start", gap: "8px" }, children: [
1450
+ /* @__PURE__ */ c(
1451
+ "input",
1452
+ {
1453
+ ref: y,
1454
+ type: "checkbox",
1455
+ id: v,
1456
+ checked: o,
1457
+ defaultChecked: t,
1458
+ disabled: i,
1459
+ "aria-invalid": s,
1460
+ "aria-describedby": f,
1461
+ onChange: d,
1462
+ className: "checkbox-input",
1463
+ "data-invalid": s ? "true" : void 0,
1464
+ "data-indeterminate": r ? "true" : void 0,
1465
+ ...b
1466
+ }
1467
+ ),
1468
+ a && /* @__PURE__ */ c(
1469
+ "label",
1470
+ {
1471
+ htmlFor: v,
1472
+ className: "checkbox-label",
1473
+ style: {
1474
+ cursor: i ? "not-allowed" : "pointer",
1475
+ opacity: i ? 0.6 : 1
1476
+ },
1477
+ children: a
1478
+ }
1479
+ )
1480
+ ] }),
1481
+ n && !l && /* @__PURE__ */ c(
1482
+ "div",
1483
+ {
1484
+ id: g,
1485
+ className: "checkbox-helper-text",
1486
+ style: {
1487
+ fontSize: "13px",
1488
+ color: "#6b7280",
1489
+ marginTop: "4px",
1490
+ marginLeft: "28px"
1491
+ },
1492
+ children: n
1493
+ }
1494
+ ),
1495
+ l && /* @__PURE__ */ c(
1496
+ "div",
1497
+ {
1498
+ id: x,
1499
+ className: "checkbox-error-message",
1500
+ role: "alert",
1501
+ style: {
1502
+ fontSize: "13px",
1503
+ color: "#ef4444",
1504
+ marginTop: "4px",
1505
+ marginLeft: "28px"
1506
+ },
1507
+ children: l
1508
+ }
1509
+ )
1510
+ ] });
1511
+ }
1512
+ );
1513
+ at.displayName = "Checkbox";
1514
+ const ge = Y(null), ct = () => {
1515
+ const e = K(ge);
1516
+ if (!e)
1517
+ throw new Error("Radio must be used within RadioGroup");
1518
+ return e;
1519
+ }, lt = D(
1520
+ ({
1521
+ className: e,
1522
+ name: o,
1523
+ value: t,
1524
+ defaultValue: r,
1525
+ disabled: i = !1,
1526
+ invalid: s = !1,
1527
+ label: a,
1528
+ helperText: n,
1529
+ errorMessage: l,
1530
+ onValueChange: u,
1531
+ children: p,
1532
+ ...m
1533
+ }, b) => {
1534
+ const [w, d] = z.useState(r), y = t !== void 0, v = y ? t : w, g = k(
1535
+ (E) => {
1536
+ y || d(E), u == null || u(E);
1537
+ },
1538
+ [y, u]
1539
+ ), x = z.useId(), f = n ? `${x}-helper` : void 0, h = l ? `${x}-error` : void 0, N = [f, h].filter(Boolean).join(" ") || void 0, I = {
1540
+ name: o,
1541
+ value: v,
1542
+ disabled: i,
1543
+ onChange: g
1544
+ };
1545
+ return /* @__PURE__ */ $("div", { ref: b, className: A("radio-group", e), ...m, children: [
1546
+ a && /* @__PURE__ */ c(
1547
+ "div",
1548
+ {
1549
+ className: "radio-group-label",
1550
+ style: {
1551
+ fontSize: "14px",
1552
+ fontWeight: "500",
1553
+ marginBottom: "12px",
1554
+ color: i ? "#9ca3af" : "#1f2937"
1555
+ },
1556
+ children: a
1557
+ }
1558
+ ),
1559
+ /* @__PURE__ */ c(ge.Provider, { value: I, children: /* @__PURE__ */ c(
1560
+ "div",
1561
+ {
1562
+ role: "radiogroup",
1563
+ "aria-invalid": s,
1564
+ "aria-describedby": N,
1565
+ style: { display: "flex", flexDirection: "column", gap: "8px" },
1566
+ children: p
1567
+ }
1568
+ ) }),
1569
+ n && !l && /* @__PURE__ */ c(
1570
+ "div",
1571
+ {
1572
+ id: f,
1573
+ className: "radio-group-helper-text",
1574
+ style: {
1575
+ fontSize: "13px",
1576
+ color: "#6b7280",
1577
+ marginTop: "8px"
1578
+ },
1579
+ children: n
1580
+ }
1581
+ ),
1582
+ l && /* @__PURE__ */ c(
1583
+ "div",
1584
+ {
1585
+ id: h,
1586
+ className: "radio-group-error-message",
1587
+ role: "alert",
1588
+ style: {
1589
+ fontSize: "13px",
1590
+ color: "#ef4444",
1591
+ marginTop: "8px"
1592
+ },
1593
+ children: l
1594
+ }
1595
+ )
1596
+ ] });
1597
+ }
1598
+ );
1599
+ lt.displayName = "RadioGroup";
1600
+ const dt = D(
1601
+ ({ className: e, value: o, label: t, disabled: r, onChange: i, ...s }, a) => {
1602
+ const n = ct(), l = r || n.disabled, u = n.value === o, p = k(
1603
+ (b) => {
1604
+ var w;
1605
+ i == null || i(b), (w = n.onChange) == null || w.call(n, o);
1606
+ },
1607
+ [i, n, o]
1608
+ ), m = `${n.name}-${o}`;
1609
+ return /* @__PURE__ */ c("div", { className: A("radio-wrapper", e), children: /* @__PURE__ */ $("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1610
+ /* @__PURE__ */ c(
1611
+ "input",
1612
+ {
1613
+ ref: a,
1614
+ type: "radio",
1615
+ id: m,
1616
+ name: n.name,
1617
+ value: o,
1618
+ checked: u,
1619
+ disabled: l,
1620
+ onChange: p,
1621
+ className: "radio-input",
1622
+ ...s
1623
+ }
1624
+ ),
1625
+ t && /* @__PURE__ */ c(
1626
+ "label",
1627
+ {
1628
+ htmlFor: m,
1629
+ className: "radio-label",
1630
+ style: {
1631
+ cursor: l ? "not-allowed" : "pointer",
1632
+ opacity: l ? 0.6 : 1,
1633
+ fontSize: "14px"
1634
+ },
1635
+ children: t
1636
+ }
1637
+ )
1638
+ ] }) });
1639
+ }
1640
+ );
1641
+ dt.displayName = "Radio";
1642
+ function ut(e, o) {
1643
+ B(() => {
1644
+ const t = Array.isArray(e) ? e : [e], r = (i) => {
1645
+ const s = i.target;
1646
+ t.every(
1647
+ (n) => !n.current || !n.current.contains(s)
1648
+ ) && o();
1649
+ };
1650
+ return document.addEventListener("mousedown", r), document.addEventListener("touchstart", r), () => {
1651
+ document.removeEventListener("mousedown", r), document.removeEventListener("touchstart", r);
1652
+ };
1653
+ }, [e, o]);
1654
+ }
1655
+ const pt = typeof window < "u", ft = D(
1656
+ ({
1657
+ className: e,
1658
+ options: o,
1659
+ value: t,
1660
+ defaultValue: r,
1661
+ placeholder: i = "Select an option",
1662
+ disabled: s = !1,
1663
+ invalid: a = !1,
1664
+ multiple: n = !1,
1665
+ searchable: l = !1,
1666
+ label: u,
1667
+ helperText: p,
1668
+ errorMessage: m,
1669
+ onValueChange: b,
1670
+ renderValue: w,
1671
+ ...d
1672
+ }, y) => {
1673
+ const [v, g] = H(r || (n ? [] : "")), x = t !== void 0, f = x ? t : v, [h, N] = H(!1), [I, E] = H(""), [S, T] = H(0), P = C(null), W = C(null), j = C(null);
1674
+ z.useImperativeHandle(y, () => P.current), ut([P, W], () => N(!1)), Z({ enabled: h, onEscape: () => N(!1) });
1675
+ const F = l ? o.filter(
1676
+ (L) => L.label.toLowerCase().includes(I.toLowerCase())
1677
+ ) : o;
1678
+ B(() => {
1679
+ h && l && j.current && j.current.focus();
1680
+ }, [h, l]), B(() => {
1681
+ h || (E(""), T(0));
1682
+ }, [h]);
1683
+ const X = k(
1684
+ (L) => {
1685
+ x || g(L), b == null || b(L);
1686
+ },
1687
+ [x, b]
1688
+ ), O = k(
1689
+ (L) => {
1690
+ if (n) {
1691
+ const R = f || [], M = R.includes(L) ? R.filter((De) => De !== L) : [...R, L];
1692
+ X(M);
1693
+ } else
1694
+ X(L), N(!1);
1695
+ },
1696
+ [n, f, X]
1697
+ ), J = k(
1698
+ (L) => {
1699
+ if (!s)
1700
+ switch (L.key) {
1701
+ case "Enter":
1702
+ case " ":
1703
+ if (!h)
1704
+ L.preventDefault(), N(!0);
1705
+ else if (!l) {
1706
+ L.preventDefault();
1707
+ const R = F[S];
1708
+ R && !R.disabled && O(R.value);
1709
+ }
1710
+ break;
1711
+ case "ArrowDown":
1712
+ L.preventDefault(), h ? T(
1713
+ (R) => R < F.length - 1 ? R + 1 : R
1714
+ ) : N(!0);
1715
+ break;
1716
+ case "ArrowUp":
1717
+ L.preventDefault(), h && T((R) => R > 0 ? R - 1 : R);
1718
+ break;
1719
+ case "Home":
1720
+ h && (L.preventDefault(), T(0));
1721
+ break;
1722
+ case "End":
1723
+ h && (L.preventDefault(), T(F.length - 1));
1724
+ break;
1725
+ case "Escape":
1726
+ h && (L.preventDefault(), N(!1));
1727
+ break;
1728
+ }
1729
+ },
1730
+ [
1731
+ s,
1732
+ h,
1733
+ l,
1734
+ S,
1735
+ F,
1736
+ O
1737
+ ]
1738
+ ), Ie = () => {
1739
+ if (w)
1740
+ return w(f);
1741
+ if (n) {
1742
+ const R = o.filter(
1743
+ (M) => f.includes(M.value)
1744
+ );
1745
+ return R.length > 0 ? R.map((M) => M.label).join(", ") : i;
1746
+ }
1747
+ const L = o.find((R) => R.value === f);
1748
+ return L ? L.label : i;
1749
+ }, ke = (L) => n ? f.includes(L) : f === L, G = z.useId(), re = p ? `${G}-helper` : void 0, oe = m ? `${G}-error` : void 0, Te = [re, oe].filter(Boolean).join(" ") || void 0;
1750
+ return /* @__PURE__ */ $("div", { className: A("select-wrapper", e), children: [
1751
+ u && /* @__PURE__ */ c(
1752
+ "label",
1753
+ {
1754
+ htmlFor: G,
1755
+ className: "select-label",
1756
+ style: {
1757
+ display: "block",
1758
+ fontSize: "14px",
1759
+ fontWeight: "500",
1760
+ marginBottom: "8px",
1761
+ color: s ? "#9ca3af" : "#1f2937"
1762
+ },
1763
+ children: u
1764
+ }
1765
+ ),
1766
+ /* @__PURE__ */ $(
1767
+ "button",
1768
+ {
1769
+ ref: P,
1770
+ id: G,
1771
+ type: "button",
1772
+ role: "combobox",
1773
+ "aria-expanded": h,
1774
+ "aria-haspopup": "listbox",
1775
+ "aria-controls": `${G}-listbox`,
1776
+ "aria-invalid": a,
1777
+ "aria-describedby": Te,
1778
+ disabled: s,
1779
+ onClick: () => !s && N(!h),
1780
+ onKeyDown: J,
1781
+ className: "select-trigger",
1782
+ "data-invalid": a ? "true" : void 0,
1783
+ style: {
1784
+ width: "100%",
1785
+ padding: "8px 12px",
1786
+ fontSize: "14px",
1787
+ textAlign: "left",
1788
+ backgroundColor: s ? "#f3f4f6" : "white",
1789
+ border: `1px solid ${a ? "#ef4444" : "#d1d5db"}`,
1790
+ borderRadius: "6px",
1791
+ cursor: s ? "not-allowed" : "pointer",
1792
+ display: "flex",
1793
+ alignItems: "center",
1794
+ justifyContent: "space-between",
1795
+ gap: "8px"
1796
+ },
1797
+ ...d,
1798
+ children: [
1799
+ /* @__PURE__ */ c(
1800
+ "span",
1801
+ {
1802
+ style: {
1803
+ flex: 1,
1804
+ overflow: "hidden",
1805
+ textOverflow: "ellipsis",
1806
+ whiteSpace: "nowrap"
1807
+ },
1808
+ children: Ie()
1809
+ }
1810
+ ),
1811
+ /* @__PURE__ */ c(
1812
+ "svg",
1813
+ {
1814
+ width: "16",
1815
+ height: "16",
1816
+ viewBox: "0 0 16 16",
1817
+ fill: "currentColor",
1818
+ style: {
1819
+ transition: "transform 0.2s",
1820
+ transform: h ? "rotate(180deg)" : "rotate(0deg)"
1821
+ },
1822
+ children: /* @__PURE__ */ c(
1823
+ "path",
1824
+ {
1825
+ d: "M4 6l4 4 4-4",
1826
+ stroke: "currentColor",
1827
+ strokeWidth: "2",
1828
+ fill: "none"
1829
+ }
1830
+ )
1831
+ }
1832
+ )
1833
+ ]
1834
+ }
1835
+ ),
1836
+ h && pt && q(
1837
+ /* @__PURE__ */ c(
1838
+ Ne,
1839
+ {
1840
+ ref: W,
1841
+ id: `${G}-listbox`,
1842
+ triggerRef: P,
1843
+ options: F,
1844
+ searchable: l,
1845
+ searchQuery: I,
1846
+ onSearchChange: E,
1847
+ searchInputRef: j,
1848
+ highlightedIndex: S,
1849
+ onSelect: O,
1850
+ isSelected: ke,
1851
+ multiple: n
1852
+ }
1853
+ ),
1854
+ document.body
1855
+ ),
1856
+ p && !m && /* @__PURE__ */ c(
1857
+ "div",
1858
+ {
1859
+ id: re,
1860
+ className: "select-helper-text",
1861
+ style: {
1862
+ fontSize: "13px",
1863
+ color: "#6b7280",
1864
+ marginTop: "4px"
1865
+ },
1866
+ children: p
1867
+ }
1868
+ ),
1869
+ m && /* @__PURE__ */ c(
1870
+ "div",
1871
+ {
1872
+ id: oe,
1873
+ className: "select-error-message",
1874
+ role: "alert",
1875
+ style: {
1876
+ fontSize: "13px",
1877
+ color: "#ef4444",
1878
+ marginTop: "4px"
1879
+ },
1880
+ children: m
1881
+ }
1882
+ )
1883
+ ] });
1884
+ }
1885
+ );
1886
+ ft.displayName = "Select";
1887
+ const Ne = D(
1888
+ ({
1889
+ id: e,
1890
+ triggerRef: o,
1891
+ options: t,
1892
+ searchable: r,
1893
+ searchQuery: i,
1894
+ onSearchChange: s,
1895
+ searchInputRef: a,
1896
+ highlightedIndex: n,
1897
+ onSelect: l,
1898
+ isSelected: u,
1899
+ multiple: p
1900
+ }, m) => {
1901
+ const [b, w] = H({ top: 0, left: 0, width: 0 });
1902
+ return B(() => {
1903
+ const d = () => {
1904
+ if (!o.current) return;
1905
+ const y = o.current.getBoundingClientRect();
1906
+ w({
1907
+ top: y.bottom + window.scrollY + 4,
1908
+ left: y.left + window.scrollX,
1909
+ width: y.width
1910
+ });
1911
+ };
1912
+ return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
1913
+ window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
1914
+ };
1915
+ }, [o]), /* @__PURE__ */ $(
1916
+ "div",
1917
+ {
1918
+ ref: m,
1919
+ id: e,
1920
+ role: "listbox",
1921
+ "aria-multiselectable": p,
1922
+ className: "select-dropdown",
1923
+ style: {
1924
+ position: "absolute",
1925
+ top: `${b.top}px`,
1926
+ left: `${b.left}px`,
1927
+ width: `${b.width}px`,
1928
+ maxHeight: "300px",
1929
+ backgroundColor: "white",
1930
+ border: "1px solid #d1d5db",
1931
+ borderRadius: "6px",
1932
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)",
1933
+ zIndex: 1e4,
1934
+ overflow: "auto"
1935
+ },
1936
+ children: [
1937
+ r && /* @__PURE__ */ c("div", { style: { padding: "8px", borderBottom: "1px solid #e5e7eb" }, children: /* @__PURE__ */ c(
1938
+ "input",
1939
+ {
1940
+ ref: a,
1941
+ type: "text",
1942
+ placeholder: "Search...",
1943
+ value: i,
1944
+ onChange: (d) => s(d.target.value),
1945
+ style: {
1946
+ width: "100%",
1947
+ padding: "6px 8px",
1948
+ fontSize: "14px",
1949
+ border: "1px solid #d1d5db",
1950
+ borderRadius: "4px"
1951
+ }
1952
+ }
1953
+ ) }),
1954
+ /* @__PURE__ */ c("div", { style: { padding: "4px" }, children: t.length === 0 ? /* @__PURE__ */ c(
1955
+ "div",
1956
+ {
1957
+ style: {
1958
+ padding: "8px 12px",
1959
+ fontSize: "14px",
1960
+ color: "#6b7280"
1961
+ },
1962
+ children: "No options found"
1963
+ }
1964
+ ) : t.map((d, y) => /* @__PURE__ */ $(
1965
+ "div",
1966
+ {
1967
+ role: "option",
1968
+ "aria-selected": u(d.value),
1969
+ "aria-disabled": d.disabled,
1970
+ onClick: () => !d.disabled && l(d.value),
1971
+ style: {
1972
+ padding: "8px 12px",
1973
+ fontSize: "14px",
1974
+ cursor: d.disabled ? "not-allowed" : "pointer",
1975
+ backgroundColor: y === n ? "#f3f4f6" : u(d.value) ? "#eff6ff" : "transparent",
1976
+ color: d.disabled ? "#9ca3af" : "#1f2937",
1977
+ borderRadius: "4px",
1978
+ display: "flex",
1979
+ alignItems: "center",
1980
+ justifyContent: "space-between"
1981
+ },
1982
+ children: [
1983
+ /* @__PURE__ */ c("span", { children: d.label }),
1984
+ u(d.value) && /* @__PURE__ */ c(
1985
+ "svg",
1986
+ {
1987
+ width: "16",
1988
+ height: "16",
1989
+ viewBox: "0 0 16 16",
1990
+ fill: "currentColor",
1991
+ children: /* @__PURE__ */ c("path", { d: "M13.5 3.5L6 11 2.5 7.5l1-1L6 9l6.5-6.5 1 1z" })
1992
+ }
1993
+ )
1994
+ ]
1995
+ },
1996
+ d.value
1997
+ )) })
1998
+ ]
1999
+ }
2000
+ );
2001
+ }
2002
+ );
2003
+ Ne.displayName = "SelectDropdown";
2004
+ const mt = D(
2005
+ ({
2006
+ className: e,
2007
+ label: o,
2008
+ helperText: t,
2009
+ errorMessage: r,
2010
+ invalid: i = !1,
2011
+ disabled: s = !1,
2012
+ maxLength: a,
2013
+ showCount: n = !1,
2014
+ autoResize: l = !1,
2015
+ minRows: u = 3,
2016
+ maxRows: p,
2017
+ value: m,
2018
+ onChange: b,
2019
+ id: w,
2020
+ ...d
2021
+ }, y) => {
2022
+ const v = C(null), [g, x] = z.useState(0);
2023
+ z.useImperativeHandle(y, () => v.current);
2024
+ const f = k(() => {
2025
+ const T = v.current;
2026
+ if (!T || !l) return;
2027
+ T.style.height = "auto";
2028
+ const P = parseInt(getComputedStyle(T).lineHeight), W = u * P, j = p ? p * P : 1 / 0, F = Math.min(
2029
+ Math.max(T.scrollHeight, W),
2030
+ j
2031
+ );
2032
+ T.style.height = `${F}px`;
2033
+ }, [l, u, p]);
2034
+ B(() => {
2035
+ l && f();
2036
+ }, [m, l, f]);
2037
+ const h = k(
2038
+ (T) => {
2039
+ x(T.target.value.length), b == null || b(T), l && f();
2040
+ },
2041
+ [b, l, f]
2042
+ );
2043
+ B(() => {
2044
+ m !== void 0 && x(String(m).length);
2045
+ }, [m]);
2046
+ const N = w || z.useId(), I = t ? `${N}-helper` : void 0, E = r ? `${N}-error` : void 0, S = [I, E].filter(Boolean).join(" ") || void 0;
2047
+ return /* @__PURE__ */ $("div", { className: A("textarea-wrapper", e), children: [
2048
+ o && /* @__PURE__ */ c(
2049
+ "label",
2050
+ {
2051
+ htmlFor: N,
2052
+ className: "textarea-label",
2053
+ style: {
2054
+ display: "block",
2055
+ fontSize: "14px",
2056
+ fontWeight: "500",
2057
+ marginBottom: "8px",
2058
+ color: s ? "#9ca3af" : "#1f2937"
2059
+ },
2060
+ children: o
2061
+ }
2062
+ ),
2063
+ /* @__PURE__ */ c(
2064
+ "textarea",
2065
+ {
2066
+ ref: v,
2067
+ id: N,
2068
+ disabled: s,
2069
+ "aria-invalid": i,
2070
+ "aria-describedby": S,
2071
+ maxLength: a,
2072
+ value: m,
2073
+ onChange: h,
2074
+ className: "textarea-input",
2075
+ "data-invalid": i ? "true" : void 0,
2076
+ style: {
2077
+ width: "100%",
2078
+ padding: "8px 12px",
2079
+ fontSize: "14px",
2080
+ lineHeight: "1.5",
2081
+ backgroundColor: s ? "#f3f4f6" : "white",
2082
+ border: `1px solid ${i ? "#ef4444" : "#d1d5db"}`,
2083
+ borderRadius: "6px",
2084
+ resize: l ? "none" : "vertical",
2085
+ fontFamily: "inherit"
2086
+ },
2087
+ ...d
2088
+ }
2089
+ ),
2090
+ /* @__PURE__ */ $(
2091
+ "div",
2092
+ {
2093
+ style: {
2094
+ display: "flex",
2095
+ justifyContent: "space-between",
2096
+ marginTop: "4px"
2097
+ },
2098
+ children: [
2099
+ /* @__PURE__ */ $("div", { style: { flex: 1 }, children: [
2100
+ t && !r && /* @__PURE__ */ c(
2101
+ "div",
2102
+ {
2103
+ id: I,
2104
+ className: "textarea-helper-text",
2105
+ style: {
2106
+ fontSize: "13px",
2107
+ color: "#6b7280"
2108
+ },
2109
+ children: t
2110
+ }
2111
+ ),
2112
+ r && /* @__PURE__ */ c(
2113
+ "div",
2114
+ {
2115
+ id: E,
2116
+ className: "textarea-error-message",
2117
+ role: "alert",
2118
+ style: {
2119
+ fontSize: "13px",
2120
+ color: "#ef4444"
2121
+ },
2122
+ children: r
2123
+ }
2124
+ )
2125
+ ] }),
2126
+ n && a && /* @__PURE__ */ $(
2127
+ "div",
2128
+ {
2129
+ className: "textarea-count",
2130
+ style: {
2131
+ fontSize: "13px",
2132
+ color: g > a ? "#ef4444" : "#6b7280",
2133
+ marginLeft: "8px"
2134
+ },
2135
+ children: [
2136
+ g,
2137
+ "/",
2138
+ a
2139
+ ]
2140
+ }
2141
+ )
2142
+ ]
2143
+ }
2144
+ )
2145
+ ] });
2146
+ }
2147
+ );
2148
+ mt.displayName = "Textarea";
2149
+ const bt = D(
2150
+ ({
2151
+ className: e,
2152
+ checked: o,
2153
+ defaultChecked: t,
2154
+ disabled: r = !1,
2155
+ label: i,
2156
+ helperText: s,
2157
+ onCheckedChange: a,
2158
+ onChange: n,
2159
+ id: l,
2160
+ ...u
2161
+ }, p) => {
2162
+ const m = k(
2163
+ (d) => {
2164
+ n == null || n(d), a == null || a(d.target.checked);
2165
+ },
2166
+ [n, a]
2167
+ ), b = l || z.useId(), w = s ? `${b}-helper` : void 0;
2168
+ return /* @__PURE__ */ $("div", { className: A("switch-wrapper", e), children: [
2169
+ /* @__PURE__ */ $("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
2170
+ /* @__PURE__ */ $(
2171
+ "label",
2172
+ {
2173
+ htmlFor: b,
2174
+ className: "switch-container",
2175
+ style: {
2176
+ position: "relative",
2177
+ display: "inline-block",
2178
+ width: "44px",
2179
+ height: "24px",
2180
+ cursor: r ? "not-allowed" : "pointer",
2181
+ opacity: r ? 0.6 : 1
2182
+ },
2183
+ children: [
2184
+ /* @__PURE__ */ c(
2185
+ "input",
2186
+ {
2187
+ ref: p,
2188
+ type: "checkbox",
2189
+ id: b,
2190
+ role: "switch",
2191
+ checked: o,
2192
+ defaultChecked: t,
2193
+ disabled: r,
2194
+ "aria-describedby": w,
2195
+ onChange: m,
2196
+ className: "switch-input",
2197
+ style: {
2198
+ opacity: 0,
2199
+ width: 0,
2200
+ height: 0,
2201
+ position: "absolute"
2202
+ },
2203
+ ...u
2204
+ }
2205
+ ),
2206
+ /* @__PURE__ */ c(
2207
+ "span",
2208
+ {
2209
+ className: "switch-slider",
2210
+ "data-checked": o,
2211
+ style: {
2212
+ position: "absolute",
2213
+ top: 0,
2214
+ left: 0,
2215
+ right: 0,
2216
+ bottom: 0,
2217
+ backgroundColor: o ? "#0066FF" : "#d1d5db",
2218
+ borderRadius: "24px",
2219
+ transition: "background-color 0.2s"
2220
+ },
2221
+ children: /* @__PURE__ */ c(
2222
+ "span",
2223
+ {
2224
+ className: "switch-thumb",
2225
+ style: {
2226
+ position: "absolute",
2227
+ top: "2px",
2228
+ left: o ? "22px" : "2px",
2229
+ width: "20px",
2230
+ height: "20px",
2231
+ backgroundColor: "white",
2232
+ borderRadius: "50%",
2233
+ transition: "left 0.2s",
2234
+ boxShadow: "0 2px 4px rgba(0, 0, 0, 0.2)"
2235
+ }
2236
+ }
2237
+ )
2238
+ }
2239
+ )
2240
+ ]
2241
+ }
2242
+ ),
2243
+ i && /* @__PURE__ */ c(
2244
+ "label",
2245
+ {
2246
+ htmlFor: b,
2247
+ className: "switch-label",
2248
+ style: {
2249
+ cursor: r ? "not-allowed" : "pointer",
2250
+ opacity: r ? 0.6 : 1,
2251
+ fontSize: "14px",
2252
+ userSelect: "none"
2253
+ },
2254
+ children: i
2255
+ }
2256
+ )
2257
+ ] }),
2258
+ s && /* @__PURE__ */ c(
2259
+ "div",
2260
+ {
2261
+ id: w,
2262
+ className: "switch-helper-text",
2263
+ style: {
2264
+ fontSize: "13px",
2265
+ color: "#6b7280",
2266
+ marginTop: "4px",
2267
+ marginLeft: "56px"
2268
+ },
2269
+ children: s
2270
+ }
2271
+ )
2272
+ ] });
2273
+ }
2274
+ );
2275
+ bt.displayName = "Switch";
2276
+ const Dt = {
2277
+ Enter: "Enter",
2278
+ Space: " ",
2279
+ Escape: "Escape",
2280
+ ArrowUp: "ArrowUp",
2281
+ ArrowDown: "ArrowDown",
2282
+ ArrowLeft: "ArrowLeft",
2283
+ ArrowRight: "ArrowRight",
2284
+ Tab: "Tab",
2285
+ Home: "Home",
2286
+ End: "End"
2287
+ };
2288
+ export {
2289
+ Qe as Accordion,
2290
+ Ze as AccordionContent,
2291
+ _e as AccordionItem,
2292
+ Je as AccordionTrigger,
2293
+ Fe as Button,
2294
+ at as Checkbox,
2295
+ Be as Dialog,
2296
+ Oe as DialogClose,
2297
+ Ce as DialogContent,
2298
+ He as DialogDescription,
2299
+ ze as DialogOverlay,
2300
+ Pe as DialogTitle,
2301
+ Ue as Dropdown,
2302
+ Ke as DropdownItem,
2303
+ Ye as DropdownMenu,
2304
+ We as DropdownTrigger,
2305
+ de as ErrorMessage,
2306
+ je as FormField,
2307
+ ce as Input,
2308
+ Dt as Keys,
2309
+ le as Label,
2310
+ dt as Radio,
2311
+ lt as RadioGroup,
2312
+ ft as Select,
2313
+ bt as Switch,
2314
+ Xe as Tabs,
2315
+ qe as TabsContent,
2316
+ Ge as TabsList,
2317
+ Me as TabsTrigger,
2318
+ mt as Textarea,
2319
+ kt as ToastProvider,
2320
+ et as Tooltip,
2321
+ rt as TooltipContent,
2322
+ tt as TooltipTrigger,
2323
+ A as cn,
2324
+ se as composeEventHandlers,
2325
+ Re as composeRefs,
2326
+ xt as createFocusRestorer,
2327
+ Se as createFocusTrap,
2328
+ Ae as focusFirstElement,
2329
+ gt as generateId,
2330
+ It as getDocument,
2331
+ ie as getFocusableElements,
2332
+ Nt as getWindow,
2333
+ Q as isBrowser,
2334
+ vt as isFocused,
2335
+ Le as useControllableState,
2336
+ Z as useEscapeKey,
2337
+ $e as useFocusTrap,
2338
+ U as useId,
2339
+ te as useToast,
2340
+ Tt as useToastNotification
2341
+ };
2342
+ //# sourceMappingURL=index.js.map