@ravileal/ui 0.0.0-stage → 0.1.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 (56) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +241 -2
  3. package/dist/components/Alert.d.ts +14 -0
  4. package/dist/components/Avatar.d.ts +11 -0
  5. package/dist/components/Badge.d.ts +23 -0
  6. package/dist/components/Button.d.ts +20 -0
  7. package/dist/components/Card.d.ts +36 -0
  8. package/dist/components/Checkbox.d.ts +7 -0
  9. package/dist/components/ColorPicker.d.ts +33 -0
  10. package/dist/components/Combobox.d.ts +23 -0
  11. package/dist/components/ConfirmModal.d.ts +14 -0
  12. package/dist/components/CopyValue.d.ts +31 -0
  13. package/dist/components/DataTable.d.ts +27 -0
  14. package/dist/components/DatePicker.d.ts +33 -0
  15. package/dist/components/Drawer.d.ts +16 -0
  16. package/dist/components/Dropdown.d.ts +51 -0
  17. package/dist/components/DropdownMenu.d.ts +26 -0
  18. package/dist/components/EmptyState.d.ts +10 -0
  19. package/dist/components/FileUpload.d.ts +14 -0
  20. package/dist/components/FormField.d.ts +24 -0
  21. package/dist/components/InlineEditorCard.d.ts +19 -0
  22. package/dist/components/ListScreen.d.ts +48 -0
  23. package/dist/components/Modal.d.ts +22 -0
  24. package/dist/components/MonthSelector.d.ts +24 -0
  25. package/dist/components/NumberStepper.d.ts +16 -0
  26. package/dist/components/PageHeader.d.ts +11 -0
  27. package/dist/components/Portal.d.ts +11 -0
  28. package/dist/components/ProgressBar.d.ts +13 -0
  29. package/dist/components/Radio.d.ts +5 -0
  30. package/dist/components/RowActions.d.ts +17 -0
  31. package/dist/components/ScreenSkeleton.d.ts +26 -0
  32. package/dist/components/SearchInput.d.ts +13 -0
  33. package/dist/components/SegmentedControl.d.ts +16 -0
  34. package/dist/components/Skeleton.d.ts +14 -0
  35. package/dist/components/Slider.d.ts +17 -0
  36. package/dist/components/Spinner.d.ts +8 -0
  37. package/dist/components/Switch.d.ts +15 -0
  38. package/dist/components/Tabs.d.ts +15 -0
  39. package/dist/components/TextInput.d.ts +13 -0
  40. package/dist/components/Textarea.d.ts +6 -0
  41. package/dist/components/Toast.d.ts +21 -0
  42. package/dist/components/Tooltip.d.ts +22 -0
  43. package/dist/components/VisuallyHidden.d.ts +6 -0
  44. package/dist/index.d.ts +82 -0
  45. package/dist/index.js +3253 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/internal/ScreenCaptureOverlay.d.ts +16 -0
  48. package/dist/internal/clipboard.d.ts +11 -0
  49. package/dist/internal/color.utils.d.ts +21 -0
  50. package/dist/internal/screen-color-picker.d.ts +12 -0
  51. package/dist/internal/tone.d.ts +1 -0
  52. package/dist/internal/useFocusTrap.d.ts +7 -0
  53. package/dist/internal/useIsomorphicLayoutEffect.d.ts +6 -0
  54. package/dist/internal/usePopover.d.ts +30 -0
  55. package/dist/styles.css +1702 -0
  56. package/package.json +105 -4
package/dist/index.js ADDED
@@ -0,0 +1,3253 @@
1
+ "use client";
2
+ import { jsx as n, jsxs as g, Fragment as ce } from "react/jsx-runtime";
3
+ import { useRef as B, useEffect as j, useLayoutEffect as Se, useState as L, useCallback as O, useId as J, useMemo as ue, forwardRef as ae, isValidElement as Me, cloneElement as Ee, useContext as Ie, createContext as Be } from "react";
4
+ import { createPortal as re } from "react-dom";
5
+ function it({
6
+ name: t,
7
+ color: r,
8
+ size: i = 32,
9
+ className: o,
10
+ style: e,
11
+ ariaLabel: s
12
+ }) {
13
+ const d = t.trim().charAt(0).toUpperCase() || "?", u = s ?? t;
14
+ return /* @__PURE__ */ n(
15
+ "div",
16
+ {
17
+ className: o,
18
+ role: u ? "img" : void 0,
19
+ "aria-label": u || void 0,
20
+ "aria-hidden": u ? void 0 : !0,
21
+ style: {
22
+ width: i,
23
+ height: i,
24
+ borderRadius: "50%",
25
+ background: r,
26
+ display: "flex",
27
+ alignItems: "center",
28
+ justifyContent: "center",
29
+ fontSize: i * 0.38,
30
+ fontWeight: 700,
31
+ color: "var(--ui-on-accent)",
32
+ flexShrink: 0,
33
+ ...e
34
+ },
35
+ children: d
36
+ }
37
+ );
38
+ }
39
+ function ot({
40
+ size: t = "md",
41
+ className: r,
42
+ indeterminate: i = !1,
43
+ ...o
44
+ }) {
45
+ const e = B(null);
46
+ return j(() => {
47
+ e.current && (e.current.indeterminate = i);
48
+ }, [i]), /* @__PURE__ */ n(
49
+ "input",
50
+ {
51
+ ref: e,
52
+ type: "checkbox",
53
+ className: `ui-checkbox${t === "sm" ? " is-sm" : ""}${r ? ` ${r}` : ""}`,
54
+ ...o
55
+ }
56
+ );
57
+ }
58
+ const ye = typeof window < "u" ? Se : j;
59
+ function se({
60
+ maxHeight: t,
61
+ minWidth: r = 160,
62
+ fitContent: i = !1,
63
+ onEscape: o,
64
+ onDismiss: e
65
+ }) {
66
+ const [s, d] = L(!1), [u, a] = L({
67
+ left: 0,
68
+ top: 0,
69
+ width: i ? void 0 : r,
70
+ maxHeight: t
71
+ }), l = B(null), f = B(null), h = B(e);
72
+ h.current = e;
73
+ const p = O(() => {
74
+ var F;
75
+ const m = l.current;
76
+ if (!m) return;
77
+ const b = m.getBoundingClientRect(), D = window.innerHeight || 0, k = window.innerWidth || 0, N = D - b.bottom, S = N < t + 8 && b.top > N, I = Math.max(i ? ((F = f.current) == null ? void 0 : F.offsetWidth) ?? r : b.width, r);
78
+ let R = i && b.width > I ? b.right - I : b.left;
79
+ R = Math.min(Math.max(R, 8), Math.max(k - I - 8, 8)), a({
80
+ left: R,
81
+ top: S ? void 0 : b.bottom + 4,
82
+ bottom: S ? Math.max(D - b.top + 4, 4) : void 0,
83
+ width: i ? void 0 : I,
84
+ maxHeight: t
85
+ });
86
+ }, [i, t, r]), y = O(() => d(!0), []), c = O((m = !1) => {
87
+ var b;
88
+ d(!1), m && ((b = l.current) == null || b.focus());
89
+ }, []);
90
+ return ye(() => {
91
+ s && p();
92
+ }, [s, p]), j(() => {
93
+ if (!s) return;
94
+ const m = (D) => {
95
+ var N, S, I;
96
+ const k = D.target;
97
+ (N = l.current) != null && N.contains(k) || (S = f.current) != null && S.contains(k) || ((I = h.current) == null || I.call(h), c());
98
+ }, b = (D) => {
99
+ var k;
100
+ D.key === "Escape" && (o != null && o() || ((k = h.current) == null || k.call(h), c(!0)));
101
+ };
102
+ return document.addEventListener("mousedown", m), document.addEventListener("keydown", b), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
103
+ document.removeEventListener("mousedown", m), document.removeEventListener("keydown", b), window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
104
+ };
105
+ }, [s, c, p, o]), { open: s, pos: u, triggerRef: l, menuRef: f, openMenu: y, closeMenu: c };
106
+ }
107
+ const Te = /^#?([0-9a-f]{6})$/i;
108
+ function ne(t) {
109
+ const r = Te.exec((t ?? "").trim());
110
+ return r ? `#${r[1].toLowerCase()}` : null;
111
+ }
112
+ function $e(t) {
113
+ const r = ne(t);
114
+ return r ? {
115
+ r: parseInt(r.slice(1, 3), 16),
116
+ g: parseInt(r.slice(3, 5), 16),
117
+ b: parseInt(r.slice(5, 7), 16)
118
+ } : null;
119
+ }
120
+ function de(t) {
121
+ return Math.max(0, Math.min(255, Math.round(t))).toString(16).padStart(2, "0");
122
+ }
123
+ function be(t) {
124
+ return `#${de(t.r)}${de(t.g)}${de(t.b)}`;
125
+ }
126
+ function we(t) {
127
+ const r = t.r / 255, i = t.g / 255, o = t.b / 255, e = Math.max(r, i, o), s = Math.min(r, i, o), d = e - s;
128
+ let u = 0;
129
+ return d !== 0 && (e === r ? u = (i - o) / d % 6 : e === i ? u = (o - r) / d + 2 : u = (r - i) / d + 4, u *= 60, u < 0 && (u += 360)), { h: u, s: e === 0 ? 0 : d / e, v: e };
130
+ }
131
+ function xe(t) {
132
+ const r = (t.h % 360 + 360) % 360, i = Math.max(0, Math.min(1, t.s)), o = Math.max(0, Math.min(1, t.v)), e = o * i, s = e * (1 - Math.abs(r / 60 % 2 - 1)), d = o - e;
133
+ let u = 0, a = 0, l = 0;
134
+ return r < 60 ? [u, a, l] = [e, s, 0] : r < 120 ? [u, a, l] = [s, e, 0] : r < 180 ? [u, a, l] = [0, e, s] : r < 240 ? [u, a, l] = [0, s, e] : r < 300 ? [u, a, l] = [s, 0, e] : [u, a, l] = [e, 0, s], {
135
+ r: Math.round((u + d) * 255),
136
+ g: Math.round((a + d) * 255),
137
+ b: Math.round((l + d) * 255)
138
+ };
139
+ }
140
+ function ie(t) {
141
+ return be(xe(t));
142
+ }
143
+ function Q(t) {
144
+ const r = $e(t);
145
+ return r ? we(r) : null;
146
+ }
147
+ function te(t, r, i) {
148
+ return Math.max(r, Math.min(i, t));
149
+ }
150
+ const fe = {
151
+ display: "flex",
152
+ alignItems: "center",
153
+ justifyContent: "center",
154
+ width: 22,
155
+ flex: 1,
156
+ border: "none",
157
+ background: "none",
158
+ color: "var(--ui-text-3)",
159
+ cursor: "pointer",
160
+ fontSize: 8,
161
+ lineHeight: 1,
162
+ padding: 0
163
+ };
164
+ function Re({
165
+ value: t,
166
+ onChange: r,
167
+ ariaLabel: i,
168
+ min: o = 0,
169
+ max: e = 255,
170
+ step: s = 1,
171
+ className: d,
172
+ style: u
173
+ }) {
174
+ const [a, l] = L(String(t)), f = B(null);
175
+ j(() => {
176
+ l(String(t));
177
+ }, [t]);
178
+ const h = (c) => Math.min(e, Math.max(o, Math.round(c))), p = (c) => {
179
+ const m = h(c);
180
+ l(String(m)), r(m);
181
+ }, y = (c) => {
182
+ p((Number(a) || 0) + c * s);
183
+ };
184
+ return j(() => {
185
+ const c = f.current;
186
+ if (!c) return;
187
+ const m = (b) => {
188
+ b.preventDefault(), p((Number(a) || 0) + (b.deltaY < 0 ? s : -s));
189
+ };
190
+ return c.addEventListener("wheel", m, { passive: !1 }), () => c.removeEventListener("wheel", m);
191
+ }, [a, s, o, e]), /* @__PURE__ */ g(
192
+ "div",
193
+ {
194
+ className: d,
195
+ style: {
196
+ display: "flex",
197
+ height: 30,
198
+ borderRadius: 8,
199
+ border: "1px solid var(--ui-border)",
200
+ background: "var(--ui-surface)",
201
+ overflow: "hidden",
202
+ ...u
203
+ },
204
+ children: [
205
+ /* @__PURE__ */ n(
206
+ "input",
207
+ {
208
+ ref: f,
209
+ "aria-label": i,
210
+ inputMode: "numeric",
211
+ value: a,
212
+ onChange: (c) => {
213
+ const m = c.target.value.replace(/[^\d]/g, "");
214
+ l(m), m !== "" && r(h(Number(m)));
215
+ },
216
+ onBlur: () => {
217
+ const c = Number(a);
218
+ p(Number.isFinite(c) && a !== "" ? c : t);
219
+ },
220
+ onKeyDown: (c) => {
221
+ var m;
222
+ c.key === "ArrowUp" ? (c.preventDefault(), y(1)) : c.key === "ArrowDown" ? (c.preventDefault(), y(-1)) : c.key === "Enter" && (c.preventDefault(), (m = f.current) == null || m.blur());
223
+ },
224
+ style: {
225
+ width: "100%",
226
+ minWidth: 0,
227
+ border: "none",
228
+ outline: "none",
229
+ background: "transparent",
230
+ color: "var(--ui-text)",
231
+ textAlign: "center",
232
+ fontSize: 12
233
+ }
234
+ }
235
+ ),
236
+ /* @__PURE__ */ g(
237
+ "div",
238
+ {
239
+ style: {
240
+ display: "flex",
241
+ flexDirection: "column",
242
+ borderLeft: "1px solid var(--ui-border)",
243
+ flexShrink: 0
244
+ },
245
+ children: [
246
+ /* @__PURE__ */ n(
247
+ "button",
248
+ {
249
+ type: "button",
250
+ "aria-label": `Increase ${i}`,
251
+ onClick: () => y(1),
252
+ style: fe,
253
+ onMouseEnter: (c) => c.currentTarget.style.background = "var(--ui-surface-2)",
254
+ onMouseLeave: (c) => c.currentTarget.style.background = "none",
255
+ children: "▲"
256
+ }
257
+ ),
258
+ /* @__PURE__ */ n(
259
+ "button",
260
+ {
261
+ type: "button",
262
+ "aria-label": `Decrease ${i}`,
263
+ onClick: () => y(-1),
264
+ style: { ...fe, borderTop: "1px solid var(--ui-border)" },
265
+ onMouseEnter: (c) => c.currentTarget.style.background = "var(--ui-surface-2)",
266
+ onMouseLeave: (c) => c.currentTarget.style.background = "none",
267
+ children: "▼"
268
+ }
269
+ )
270
+ ]
271
+ }
272
+ )
273
+ ]
274
+ }
275
+ );
276
+ }
277
+ function Le(t, r, i, o, e, s) {
278
+ const d = Math.max(1, i), u = Math.max(1, o);
279
+ return {
280
+ x: Math.min(e - 1, Math.max(0, Math.floor(t / d * e))),
281
+ y: Math.min(s - 1, Math.max(0, Math.floor(r / u * s)))
282
+ };
283
+ }
284
+ function he() {
285
+ return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function";
286
+ }
287
+ function Ae({
288
+ capture: t,
289
+ labels: r,
290
+ onPick: i,
291
+ onCancel: o
292
+ }) {
293
+ const [e, s] = L(null);
294
+ return j(() => {
295
+ const d = (u) => {
296
+ u.key === "Escape" && o();
297
+ };
298
+ return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
299
+ }, [o]), typeof document > "u" ? null : re(
300
+ /* @__PURE__ */ g(
301
+ "div",
302
+ {
303
+ role: "dialog",
304
+ "aria-label": (r == null ? void 0 : r.pickFromScreen) ?? "Pick colour from screen",
305
+ style: {
306
+ position: "fixed",
307
+ inset: 0,
308
+ zIndex: 5e3,
309
+ cursor: "crosshair",
310
+ background: "#000"
311
+ },
312
+ onPointerMove: (d) => {
313
+ const u = Le(
314
+ d.clientX,
315
+ d.clientY,
316
+ window.innerWidth,
317
+ window.innerHeight,
318
+ t.width,
319
+ t.height
320
+ ), a = t.context.getImageData(u.x, u.y, 1, 1).data;
321
+ s({
322
+ hex: be({ r: a[0], g: a[1], b: a[2] }),
323
+ x: d.clientX,
324
+ y: d.clientY
325
+ });
326
+ },
327
+ onPointerLeave: () => s(null),
328
+ onClick: () => {
329
+ e ? i(e.hex) : o();
330
+ },
331
+ children: [
332
+ /* @__PURE__ */ n(
333
+ "img",
334
+ {
335
+ src: t.dataUrl,
336
+ alt: "",
337
+ draggable: !1,
338
+ style: {
339
+ width: "100vw",
340
+ height: "100vh",
341
+ objectFit: "fill",
342
+ display: "block",
343
+ userSelect: "none"
344
+ }
345
+ }
346
+ ),
347
+ /* @__PURE__ */ n(
348
+ "div",
349
+ {
350
+ style: {
351
+ position: "fixed",
352
+ top: 16,
353
+ left: "50%",
354
+ transform: "translateX(-50%)",
355
+ background: "var(--ui-surface)",
356
+ border: "1px solid var(--ui-border)",
357
+ borderRadius: 8,
358
+ padding: "6px 12px",
359
+ color: "var(--ui-text-2)",
360
+ fontSize: 12
361
+ },
362
+ children: (r == null ? void 0 : r.clickToPick) ?? "Click to pick · Esc to cancel"
363
+ }
364
+ ),
365
+ e && /* @__PURE__ */ g(
366
+ "div",
367
+ {
368
+ style: {
369
+ position: "fixed",
370
+ left: e.x + 16,
371
+ top: e.y + 16,
372
+ display: "flex",
373
+ alignItems: "center",
374
+ gap: 6,
375
+ background: "var(--ui-surface)",
376
+ border: "1px solid var(--ui-border)",
377
+ borderRadius: 8,
378
+ padding: "6px 8px",
379
+ boxShadow: "var(--ui-shadow)",
380
+ pointerEvents: "none"
381
+ },
382
+ children: [
383
+ /* @__PURE__ */ n(
384
+ "span",
385
+ {
386
+ style: {
387
+ width: 18,
388
+ height: 18,
389
+ borderRadius: 4,
390
+ background: e.hex,
391
+ border: "1px solid var(--ui-border)"
392
+ }
393
+ }
394
+ ),
395
+ /* @__PURE__ */ n("span", { style: { fontFamily: "monospace", fontSize: 12, color: "var(--ui-text)" }, children: e.hex.toUpperCase() })
396
+ ]
397
+ }
398
+ )
399
+ ]
400
+ }
401
+ ),
402
+ document.body
403
+ );
404
+ }
405
+ const je = {
406
+ padding: "7px 10px",
407
+ borderRadius: 8,
408
+ border: "1px solid var(--ui-border)",
409
+ background: "var(--ui-surface)",
410
+ color: "var(--ui-text)",
411
+ fontSize: 12,
412
+ fontFamily: "monospace",
413
+ outline: "none",
414
+ width: "100%"
415
+ }, Pe = {
416
+ display: "inline-flex",
417
+ alignItems: "center",
418
+ justifyContent: "center",
419
+ width: 32,
420
+ height: 32,
421
+ flexShrink: 0,
422
+ borderRadius: 8,
423
+ border: "1px solid var(--ui-border)",
424
+ background: "none",
425
+ color: "var(--ui-text-2)",
426
+ cursor: "pointer"
427
+ }, pe = {
428
+ position: "absolute",
429
+ width: 14,
430
+ height: 14,
431
+ borderRadius: "50%",
432
+ border: "2px solid var(--ui-on-accent)",
433
+ boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.45)",
434
+ transform: "translate(-50%, -50%)",
435
+ pointerEvents: "none"
436
+ }, We = "#8098b5";
437
+ function at({
438
+ value: t,
439
+ onChange: r,
440
+ presets: i,
441
+ ariaLabel: o = "Color",
442
+ labels: e,
443
+ className: s,
444
+ style: d
445
+ }) {
446
+ var P;
447
+ const u = ne(t) ?? We, [a, l] = L(() => Q(u) ?? { h: 0, s: 0, v: 1 }), [f, h] = L(u.toUpperCase()), p = B(u), y = B(u), c = B(null), m = B(null), b = B(!1), D = B(!1), k = () => {
448
+ const v = y.current;
449
+ p.current !== v && (p.current = v, l(Q(v) ?? { h: 0, s: 0, v: 1 }), h(v.toUpperCase()), r(v));
450
+ }, { open: N, pos: S, triggerRef: I, menuRef: R, openMenu: F, closeMenu: w } = se({
451
+ maxHeight: 520,
452
+ minWidth: 272,
453
+ onDismiss: k
454
+ });
455
+ j(() => {
456
+ const v = ne(t);
457
+ v && v !== p.current && (p.current = v, l(Q(v) ?? { h: 0, s: 0, v: 1 }), h(v.toUpperCase()));
458
+ }, [t]);
459
+ const C = (v) => {
460
+ const M = ie(v);
461
+ p.current = M, l(v), h(M.toUpperCase()), r(M);
462
+ }, T = () => {
463
+ if (N) {
464
+ w();
465
+ return;
466
+ }
467
+ y.current = u, p.current = u, l(Q(u) ?? { h: 0, s: 0, v: 1 }), h(u.toUpperCase()), F();
468
+ }, Y = () => {
469
+ k(), w(!0);
470
+ }, H = xe(a), G = ie({ h: a.h, s: 1, v: 1 }), z = (v, M) => {
471
+ const A = c.current;
472
+ if (!A) return;
473
+ const V = A.getBoundingClientRect();
474
+ !V.width || !V.height || C({
475
+ ...a,
476
+ s: te((v - V.left) / V.width, 0, 1),
477
+ v: 1 - te((M - V.top) / V.height, 0, 1)
478
+ });
479
+ }, W = (v) => {
480
+ const M = m.current;
481
+ if (!M) return;
482
+ const A = M.getBoundingClientRect();
483
+ A.width && C({ ...a, h: te((v - A.left) / A.width, 0, 1) * 360 });
484
+ }, [U, X] = L(null), [_, Z] = L(!1), [x, $] = L(null);
485
+ j(() => {
486
+ const v = window.EyeDropper ?? null;
487
+ X(() => v), Z(he());
488
+ }, []);
489
+ const q = async () => {
490
+ if (U)
491
+ try {
492
+ const v = await new U().open(), M = ne(v.sRGBHex);
493
+ M && C(Q(M) ?? a);
494
+ } catch {
495
+ }
496
+ }, E = async () => {
497
+ if (U) {
498
+ await q();
499
+ return;
500
+ }
501
+ if (!he()) return;
502
+ let v = null;
503
+ try {
504
+ v = await navigator.mediaDevices.getDisplayMedia({ video: !0 });
505
+ const M = document.createElement("video");
506
+ M.srcObject = v, M.muted = !0, await M.play(), M.videoWidth || await new Promise((De) => {
507
+ M.addEventListener("loadedmetadata", () => De(), { once: !0 });
508
+ });
509
+ const A = document.createElement("canvas");
510
+ A.width = M.videoWidth, A.height = M.videoHeight;
511
+ const V = A.getContext("2d", { willReadFrequently: !0 });
512
+ if (!V) throw new Error("canvas unavailable");
513
+ V.drawImage(M, 0, 0), $({
514
+ dataUrl: A.toDataURL("image/png"),
515
+ width: A.width,
516
+ height: A.height,
517
+ context: V
518
+ });
519
+ } catch {
520
+ } finally {
521
+ v == null || v.getTracks().forEach((M) => M.stop());
522
+ }
523
+ };
524
+ return /* @__PURE__ */ g(
525
+ "div",
526
+ {
527
+ className: s,
528
+ style: { display: "inline-flex", flexShrink: 0, width: 148, ...d },
529
+ children: [
530
+ /* @__PURE__ */ g(
531
+ "button",
532
+ {
533
+ ref: I,
534
+ type: "button",
535
+ className: "ui-dropdown-trigger is-md",
536
+ "aria-label": o,
537
+ "aria-haspopup": "dialog",
538
+ "aria-expanded": N,
539
+ onClick: T,
540
+ children: [
541
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-dot", style: { background: u } }),
542
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-value", style: { fontSize: 12, fontFamily: "monospace" }, children: u.toUpperCase() }),
543
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-caret", "aria-hidden": "true", children: "▾" })
544
+ ]
545
+ }
546
+ ),
547
+ N && typeof document < "u" && re(
548
+ /* @__PURE__ */ n(
549
+ "div",
550
+ {
551
+ ref: R,
552
+ className: "ui-dropdown-menu",
553
+ role: "dialog",
554
+ "aria-label": (e == null ? void 0 : e.picker) ?? `${o} picker`,
555
+ style: {
556
+ left: S.left,
557
+ top: S.top,
558
+ bottom: S.bottom,
559
+ width: S.width,
560
+ maxHeight: S.maxHeight
561
+ },
562
+ children: /* @__PURE__ */ g(
563
+ "div",
564
+ {
565
+ style: {
566
+ padding: 10,
567
+ width: "100%",
568
+ display: "flex",
569
+ flexDirection: "column",
570
+ gap: 10
571
+ },
572
+ children: [
573
+ /* @__PURE__ */ n(
574
+ "div",
575
+ {
576
+ ref: c,
577
+ role: "slider",
578
+ "aria-label": (e == null ? void 0 : e.saturationAndBrightness) ?? "Saturation and brightness",
579
+ "aria-valuetext": ((P = e == null ? void 0 : e.saturationValueText) == null ? void 0 : P.call(e, Math.round(a.s * 100), Math.round(a.v * 100))) ?? `Saturation ${Math.round(a.s * 100)}%, brightness ${Math.round(a.v * 100)}%`,
580
+ tabIndex: 0,
581
+ onKeyDown: (v) => {
582
+ v.key === "ArrowLeft" ? (v.preventDefault(), C({ ...a, s: te(a.s - 0.02, 0, 1) })) : v.key === "ArrowRight" ? (v.preventDefault(), C({ ...a, s: te(a.s + 0.02, 0, 1) })) : v.key === "ArrowUp" ? (v.preventDefault(), C({ ...a, v: te(a.v + 0.02, 0, 1) })) : v.key === "ArrowDown" && (v.preventDefault(), C({ ...a, v: te(a.v - 0.02, 0, 1) }));
583
+ },
584
+ onPointerDown: (v) => {
585
+ b.current = !0, z(v.clientX, v.clientY);
586
+ },
587
+ onPointerMove: (v) => {
588
+ b.current && z(v.clientX, v.clientY);
589
+ },
590
+ onPointerUp: () => {
591
+ b.current = !1;
592
+ },
593
+ onPointerLeave: () => {
594
+ b.current = !1;
595
+ },
596
+ style: {
597
+ position: "relative",
598
+ height: 150,
599
+ borderRadius: 8,
600
+ cursor: "crosshair",
601
+ touchAction: "none",
602
+ background: `linear-gradient(to top, #000, rgba(0,0,0,0)), linear-gradient(to right, #fff, ${G})`
603
+ },
604
+ children: /* @__PURE__ */ n(
605
+ "span",
606
+ {
607
+ style: {
608
+ ...pe,
609
+ left: `${a.s * 100}%`,
610
+ top: `${(1 - a.v) * 100}%`,
611
+ background: ie(a)
612
+ }
613
+ }
614
+ )
615
+ }
616
+ ),
617
+ /* @__PURE__ */ n(
618
+ "div",
619
+ {
620
+ ref: m,
621
+ role: "slider",
622
+ "aria-label": (e == null ? void 0 : e.hue) ?? "Hue",
623
+ "aria-valuemin": 0,
624
+ "aria-valuemax": 360,
625
+ "aria-valuenow": Math.round(a.h),
626
+ tabIndex: 0,
627
+ onKeyDown: (v) => {
628
+ v.key === "ArrowLeft" ? (v.preventDefault(), C({ ...a, h: (a.h - 2 + 360) % 360 })) : v.key === "ArrowRight" ? (v.preventDefault(), C({ ...a, h: (a.h + 2) % 360 })) : v.key === "Home" ? (v.preventDefault(), C({ ...a, h: 0 })) : v.key === "End" && (v.preventDefault(), C({ ...a, h: 359 }));
629
+ },
630
+ onPointerDown: (v) => {
631
+ D.current = !0, W(v.clientX);
632
+ },
633
+ onPointerMove: (v) => {
634
+ D.current && W(v.clientX);
635
+ },
636
+ onPointerUp: () => {
637
+ D.current = !1;
638
+ },
639
+ onPointerLeave: () => {
640
+ D.current = !1;
641
+ },
642
+ style: {
643
+ position: "relative",
644
+ height: 12,
645
+ borderRadius: 6,
646
+ cursor: "pointer",
647
+ touchAction: "none",
648
+ background: "linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)"
649
+ },
650
+ children: /* @__PURE__ */ n(
651
+ "span",
652
+ {
653
+ style: {
654
+ ...pe,
655
+ left: `${a.h / 360 * 100}%`,
656
+ top: "50%",
657
+ width: 16,
658
+ height: 16,
659
+ background: G
660
+ }
661
+ }
662
+ )
663
+ }
664
+ ),
665
+ /* @__PURE__ */ g("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
666
+ /* @__PURE__ */ n(
667
+ "span",
668
+ {
669
+ "aria-hidden": "true",
670
+ style: {
671
+ width: 32,
672
+ height: 32,
673
+ flexShrink: 0,
674
+ borderRadius: 8,
675
+ background: ie(a),
676
+ border: "1px solid var(--ui-border)"
677
+ }
678
+ }
679
+ ),
680
+ /* @__PURE__ */ n(
681
+ "input",
682
+ {
683
+ "aria-label": (e == null ? void 0 : e.hexColor) ?? "Hex colour",
684
+ value: f,
685
+ onChange: (v) => {
686
+ const M = v.target.value;
687
+ h(M);
688
+ const A = ne(M);
689
+ A && (p.current = A, l(Q(A) ?? a), r(A));
690
+ },
691
+ onBlur: () => {
692
+ ne(f) || h(ie(a).toUpperCase());
693
+ },
694
+ onKeyDown: (v) => {
695
+ if (v.key !== "Enter") return;
696
+ const M = ne(f);
697
+ M && (v.preventDefault(), C(Q(M) ?? a), w(!0));
698
+ },
699
+ style: je
700
+ }
701
+ ),
702
+ (_ || U) && /* @__PURE__ */ n(
703
+ "button",
704
+ {
705
+ type: "button",
706
+ "aria-label": (e == null ? void 0 : e.pickFromScreen) ?? "Pick colour from screen",
707
+ title: (e == null ? void 0 : e.pickFromScreen) ?? "Pick colour from screen",
708
+ onClick: () => void E(),
709
+ style: Pe,
710
+ children: /* @__PURE__ */ g(
711
+ "svg",
712
+ {
713
+ width: "15",
714
+ height: "15",
715
+ viewBox: "0 0 24 24",
716
+ fill: "none",
717
+ stroke: "currentColor",
718
+ strokeWidth: "1.7",
719
+ strokeLinecap: "round",
720
+ strokeLinejoin: "round",
721
+ "aria-hidden": "true",
722
+ children: [
723
+ /* @__PURE__ */ n("path", { d: "m19 3-4 4" }),
724
+ /* @__PURE__ */ n("path", { d: "M14.5 4.5 19.5 9.5" }),
725
+ /* @__PURE__ */ n("path", { d: "M12.5 6.5 17.5 11.5 8 21H3v-5z" })
726
+ ]
727
+ }
728
+ )
729
+ }
730
+ )
731
+ ] }),
732
+ /* @__PURE__ */ n("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 8 }, children: ["r", "g", "b"].map((v, M) => /* @__PURE__ */ g(
733
+ "label",
734
+ {
735
+ style: {
736
+ display: "flex",
737
+ flexDirection: "column",
738
+ gap: 4,
739
+ fontSize: 11,
740
+ color: "var(--ui-text-2)"
741
+ },
742
+ children: [
743
+ ["R", "G", "B"][M],
744
+ /* @__PURE__ */ n(
745
+ Re,
746
+ {
747
+ ariaLabel: [(e == null ? void 0 : e.red) ?? "Red", (e == null ? void 0 : e.green) ?? "Green", (e == null ? void 0 : e.blue) ?? "Blue"][M],
748
+ value: H[v],
749
+ min: 0,
750
+ max: 255,
751
+ onChange: (A) => C(we({ ...H, [v]: A }))
752
+ }
753
+ )
754
+ ]
755
+ },
756
+ v
757
+ )) }),
758
+ /* @__PURE__ */ n(
759
+ "div",
760
+ {
761
+ role: "group",
762
+ "aria-label": (e == null ? void 0 : e.presetColors) ?? "Preset colours",
763
+ style: {
764
+ display: "grid",
765
+ gridTemplateColumns: "repeat(6, 24px)",
766
+ justifyContent: "space-between",
767
+ gap: 8,
768
+ width: "100%"
769
+ },
770
+ children: i.map((v) => {
771
+ var M;
772
+ return /* @__PURE__ */ n(
773
+ "button",
774
+ {
775
+ type: "button",
776
+ "aria-label": ((M = e == null ? void 0 : e.presetColor) == null ? void 0 : M.call(e, v)) ?? `Colour ${v}`,
777
+ title: v,
778
+ onClick: () => C(Q(v) ?? a),
779
+ style: {
780
+ width: 24,
781
+ height: 24,
782
+ borderRadius: "50%",
783
+ background: v,
784
+ border: u.toLowerCase() === v.toLowerCase() ? "2px solid var(--ui-text)" : "2px solid transparent",
785
+ cursor: "pointer"
786
+ }
787
+ },
788
+ v
789
+ );
790
+ })
791
+ }
792
+ ),
793
+ /* @__PURE__ */ g("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8 }, children: [
794
+ /* @__PURE__ */ n(
795
+ "button",
796
+ {
797
+ type: "button",
798
+ "aria-label": (e == null ? void 0 : e.cancel) ?? "Cancel",
799
+ onClick: Y,
800
+ style: {
801
+ padding: "7px 14px",
802
+ borderRadius: 8,
803
+ background: "none",
804
+ color: "var(--ui-text-2)",
805
+ fontWeight: 600,
806
+ fontSize: 12,
807
+ border: "1px solid var(--ui-border)",
808
+ cursor: "pointer"
809
+ },
810
+ children: (e == null ? void 0 : e.cancel) ?? "Cancel"
811
+ }
812
+ ),
813
+ /* @__PURE__ */ n(
814
+ "button",
815
+ {
816
+ type: "button",
817
+ "aria-label": (e == null ? void 0 : e.done) ?? "Done",
818
+ onClick: () => w(!0),
819
+ style: {
820
+ padding: "7px 14px",
821
+ borderRadius: 8,
822
+ background: "var(--ui-accent)",
823
+ color: "var(--ui-on-accent)",
824
+ fontWeight: 600,
825
+ fontSize: 12,
826
+ border: "none",
827
+ cursor: "pointer"
828
+ },
829
+ children: (e == null ? void 0 : e.done) ?? "Done"
830
+ }
831
+ )
832
+ ] })
833
+ ]
834
+ }
835
+ )
836
+ }
837
+ ),
838
+ document.body
839
+ ),
840
+ x && /* @__PURE__ */ n(
841
+ Ae,
842
+ {
843
+ capture: x,
844
+ labels: e,
845
+ onPick: (v) => {
846
+ C(Q(v) ?? a), w(!0), $(null);
847
+ },
848
+ onCancel: () => $(null)
849
+ }
850
+ )
851
+ ]
852
+ }
853
+ );
854
+ }
855
+ const me = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
856
+ function ke({
857
+ active: t,
858
+ containerRef: r,
859
+ initialFocusRef: i,
860
+ onEscape: o
861
+ }) {
862
+ const e = B(o);
863
+ e.current = o, j(() => {
864
+ if (!t || typeof document > "u") return;
865
+ const s = document.activeElement, d = r.current, u = (i == null ? void 0 : i.current) ?? (d == null ? void 0 : d.querySelector(me)) ?? d ?? null;
866
+ u == null || u.focus();
867
+ const a = (l) => {
868
+ if (l.key === "Escape") {
869
+ e.current();
870
+ return;
871
+ }
872
+ if (l.key !== "Tab" || !d) return;
873
+ const f = Array.from(d.querySelectorAll(me)).filter(
874
+ (y) => y.getAttribute("aria-hidden") !== "true"
875
+ );
876
+ if (f.length === 0) {
877
+ l.preventDefault(), d.focus();
878
+ return;
879
+ }
880
+ const h = f[0], p = f[f.length - 1];
881
+ l.shiftKey && document.activeElement === h ? (l.preventDefault(), p.focus()) : !l.shiftKey && document.activeElement === p && (l.preventDefault(), h.focus());
882
+ };
883
+ return document.addEventListener("keydown", a), () => {
884
+ var l;
885
+ document.removeEventListener("keydown", a), (l = s == null ? void 0 : s.focus) == null || l.call(s);
886
+ };
887
+ }, [t, r, i]);
888
+ }
889
+ const He = {
890
+ position: "fixed",
891
+ inset: 0,
892
+ background: "var(--ui-overlay)",
893
+ zIndex: 1500,
894
+ display: "flex",
895
+ alignItems: "center",
896
+ justifyContent: "center"
897
+ }, ze = {
898
+ display: "flex",
899
+ alignItems: "center",
900
+ justifyContent: "space-between",
901
+ gap: 12,
902
+ marginBottom: 16
903
+ };
904
+ function Ue({
905
+ open: t,
906
+ title: r,
907
+ onClose: i,
908
+ children: o,
909
+ maxWidth: e = 440,
910
+ panelStyle: s,
911
+ panelClassName: d,
912
+ closeLabel: u = "Close",
913
+ initialFocusRef: a,
914
+ closeOnBackdrop: l = !0,
915
+ closeOnEscape: f = !0
916
+ }) {
917
+ const h = J(), p = B(null);
918
+ return ke({
919
+ active: t,
920
+ containerRef: p,
921
+ initialFocusRef: a,
922
+ onEscape: f ? i : () => {
923
+ }
924
+ }), t ? /* @__PURE__ */ n("div", { style: He, onClick: l ? i : void 0, children: /* @__PURE__ */ g(
925
+ "div",
926
+ {
927
+ ref: p,
928
+ role: "dialog",
929
+ "aria-modal": "true",
930
+ "aria-labelledby": h,
931
+ tabIndex: -1,
932
+ onClick: (y) => y.stopPropagation(),
933
+ style: {
934
+ background: "var(--ui-surface)",
935
+ border: "1px solid var(--ui-border)",
936
+ borderRadius: 14,
937
+ padding: 24,
938
+ maxWidth: e,
939
+ width: "92%",
940
+ maxHeight: "85vh",
941
+ overflowY: "auto",
942
+ boxShadow: "var(--ui-shadow-lg)",
943
+ outline: "none",
944
+ ...s
945
+ },
946
+ className: `ui-scroll-y${d ? ` ${d}` : ""}`,
947
+ children: [
948
+ /* @__PURE__ */ g("div", { style: ze, children: [
949
+ /* @__PURE__ */ n("div", { id: h, style: { fontSize: 16, fontWeight: 700, color: "var(--ui-text)" }, children: r }),
950
+ /* @__PURE__ */ n(
951
+ "button",
952
+ {
953
+ type: "button",
954
+ "aria-label": u,
955
+ onClick: i,
956
+ style: {
957
+ display: "inline-flex",
958
+ alignItems: "center",
959
+ justifyContent: "center",
960
+ border: "1px solid var(--ui-border)",
961
+ background: "var(--ui-surface-2)",
962
+ color: "var(--ui-text-2)",
963
+ borderRadius: 7,
964
+ fontSize: 13,
965
+ lineHeight: 1,
966
+ padding: "5px 8px",
967
+ cursor: "pointer"
968
+ },
969
+ children: "✕"
970
+ }
971
+ )
972
+ ] }),
973
+ o
974
+ ]
975
+ }
976
+ ) }) : null;
977
+ }
978
+ function dt({
979
+ open: t,
980
+ title: r,
981
+ message: i,
982
+ onConfirm: o,
983
+ onCancel: e,
984
+ danger: s = !1,
985
+ confirmLabel: d,
986
+ cancelLabel: u = "Cancel",
987
+ panelStyle: a,
988
+ panelClassName: l
989
+ }) {
990
+ return /* @__PURE__ */ g(
991
+ Ue,
992
+ {
993
+ open: t,
994
+ title: r,
995
+ onClose: e,
996
+ maxWidth: 380,
997
+ panelStyle: a,
998
+ panelClassName: l,
999
+ children: [
1000
+ /* @__PURE__ */ n(
1001
+ "div",
1002
+ {
1003
+ style: {
1004
+ fontSize: 13,
1005
+ color: "var(--ui-text-2)",
1006
+ lineHeight: 1.6,
1007
+ marginBottom: 22
1008
+ },
1009
+ children: i
1010
+ }
1011
+ ),
1012
+ /* @__PURE__ */ g("div", { style: { display: "flex", gap: 10, justifyContent: "flex-end" }, children: [
1013
+ /* @__PURE__ */ n(
1014
+ "button",
1015
+ {
1016
+ type: "button",
1017
+ onClick: e,
1018
+ style: {
1019
+ padding: "9px 18px",
1020
+ borderRadius: 8,
1021
+ border: "1px solid var(--ui-border)",
1022
+ background: "none",
1023
+ color: "var(--ui-text-2)",
1024
+ fontSize: 13,
1025
+ cursor: "pointer",
1026
+ fontWeight: 500
1027
+ },
1028
+ children: u
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ n(
1032
+ "button",
1033
+ {
1034
+ type: "button",
1035
+ onClick: o,
1036
+ style: {
1037
+ padding: "9px 22px",
1038
+ borderRadius: 8,
1039
+ border: "none",
1040
+ background: s ? "var(--ui-red)" : "var(--ui-accent)",
1041
+ color: "var(--ui-on-accent)",
1042
+ fontSize: 13,
1043
+ fontWeight: 700,
1044
+ cursor: "pointer"
1045
+ },
1046
+ children: d ?? (s ? "Delete" : "Confirm")
1047
+ }
1048
+ )
1049
+ ] })
1050
+ ]
1051
+ }
1052
+ );
1053
+ }
1054
+ async function Ke(t) {
1055
+ var r, i;
1056
+ try {
1057
+ if ((r = navigator.clipboard) != null && r.writeText)
1058
+ return await navigator.clipboard.writeText(t), !0;
1059
+ } catch {
1060
+ }
1061
+ try {
1062
+ const o = document.activeElement, e = document.createElement("textarea");
1063
+ e.value = t, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.top = "-1000px", e.style.opacity = "0", document.body.appendChild(e), e.select(), e.setSelectionRange(0, t.length);
1064
+ const s = document.execCommand("copy");
1065
+ return document.body.removeChild(e), o && o !== document.body && ((i = o.focus) == null || i.call(o)), s;
1066
+ } catch {
1067
+ return !1;
1068
+ }
1069
+ }
1070
+ const ee = 8;
1071
+ function Ne({
1072
+ content: t,
1073
+ children: r,
1074
+ maxWidth: i = 260,
1075
+ delay: o = 120,
1076
+ style: e,
1077
+ className: s,
1078
+ disabled: d = !1,
1079
+ as: u = "span"
1080
+ }) {
1081
+ const [a, l] = L(!1), [f, h] = L(null), [p, y] = L({
1082
+ left: 0,
1083
+ top: 0,
1084
+ below: !1
1085
+ }), c = B(null), m = B(null), b = B(null), D = B(!1), k = J();
1086
+ j(() => {
1087
+ const T = () => h(window.innerWidth);
1088
+ return T(), window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
1089
+ }, []);
1090
+ const N = Math.min(
1091
+ i,
1092
+ Math.max(0, (f ?? i + ee * 2) - ee * 2)
1093
+ ), S = O(() => {
1094
+ const T = c.current, Y = m.current;
1095
+ if (!T || !Y) return;
1096
+ const H = T.getBoundingClientRect(), G = Y.offsetWidth, z = Y.offsetHeight, W = G / 2, U = Math.min(
1097
+ Math.max(H.left + H.width / 2, W + ee),
1098
+ window.innerWidth - W - ee
1099
+ ), X = H.top - ee, _ = window.innerHeight - H.bottom - ee, Z = X >= z, x = _ >= z, $ = !Z && (x || _ >= X);
1100
+ y({ left: U, top: $ ? H.bottom + ee : H.top - ee, below: $ });
1101
+ }, []), I = O(() => {
1102
+ if (!d) {
1103
+ if (b.current && clearTimeout(b.current), o <= 0) {
1104
+ l(!0);
1105
+ return;
1106
+ }
1107
+ b.current = setTimeout(() => l(!0), o);
1108
+ }
1109
+ }, [o, d]), R = O(() => {
1110
+ b.current && clearTimeout(b.current), l(!1);
1111
+ }, []);
1112
+ j(() => {
1113
+ d && R();
1114
+ }, [d, R]), j(
1115
+ () => () => {
1116
+ b.current && clearTimeout(b.current);
1117
+ },
1118
+ []
1119
+ ), j(() => {
1120
+ if (!a) return;
1121
+ const T = (Y) => {
1122
+ Y.key === "Escape" && R();
1123
+ };
1124
+ return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
1125
+ }, [a, R]), ye(() => {
1126
+ a && S();
1127
+ }, [a, S]), j(() => {
1128
+ if (!a) return;
1129
+ const T = () => S();
1130
+ return window.addEventListener("resize", T), window.addEventListener("scroll", T, !0), () => {
1131
+ window.removeEventListener("resize", T), window.removeEventListener("scroll", T, !0);
1132
+ };
1133
+ }, [a, S]);
1134
+ const F = {
1135
+ display: u === "div" ? "block" : "inline-flex",
1136
+ minWidth: 0,
1137
+ maxWidth: "100%",
1138
+ ...e
1139
+ }, w = {
1140
+ onMouseEnter: () => {
1141
+ D.current = !0, I();
1142
+ },
1143
+ onMouseLeave: () => {
1144
+ D.current = !1, R();
1145
+ },
1146
+ onFocus: I,
1147
+ onBlur: () => {
1148
+ D.current || R();
1149
+ }
1150
+ }, C = a && typeof document < "u" ? re(
1151
+ /* @__PURE__ */ n(
1152
+ "div",
1153
+ {
1154
+ ref: m,
1155
+ id: k,
1156
+ role: "tooltip",
1157
+ className: "ui-tooltip",
1158
+ style: {
1159
+ left: p.left,
1160
+ top: p.top,
1161
+ width: "max-content",
1162
+ maxWidth: N,
1163
+ overflowWrap: "break-word",
1164
+ transform: p.below ? "translate(-50%, 0)" : "translate(-50%, -100%)"
1165
+ },
1166
+ children: t
1167
+ }
1168
+ ),
1169
+ document.body
1170
+ ) : null;
1171
+ return u === "div" ? /* @__PURE__ */ g(
1172
+ "div",
1173
+ {
1174
+ ref: c,
1175
+ className: s,
1176
+ style: F,
1177
+ "aria-describedby": a ? k : void 0,
1178
+ ...w,
1179
+ children: [
1180
+ r,
1181
+ C
1182
+ ]
1183
+ }
1184
+ ) : /* @__PURE__ */ g(
1185
+ "span",
1186
+ {
1187
+ ref: c,
1188
+ className: s,
1189
+ style: F,
1190
+ "aria-describedby": a ? k : void 0,
1191
+ ...w,
1192
+ children: [
1193
+ r,
1194
+ C
1195
+ ]
1196
+ }
1197
+ );
1198
+ }
1199
+ function lt({
1200
+ value: t,
1201
+ children: r,
1202
+ ariaLabel: i,
1203
+ formatValue: o = (f) => String(f),
1204
+ copyValue: e = (f) => String(f),
1205
+ tooltipLabel: s,
1206
+ labels: d,
1207
+ className: u,
1208
+ style: a,
1209
+ wrapperStyle: l
1210
+ }) {
1211
+ const [f, h] = L(!1), p = B(null);
1212
+ j(
1213
+ () => () => {
1214
+ p.current && clearTimeout(p.current);
1215
+ },
1216
+ []
1217
+ );
1218
+ const y = () => {
1219
+ Ke(e(t)).then((c) => {
1220
+ c && (h(!0), p.current && clearTimeout(p.current), p.current = setTimeout(() => h(!1), 2e3));
1221
+ });
1222
+ };
1223
+ return /* @__PURE__ */ n(
1224
+ Ne,
1225
+ {
1226
+ content: f ? /* @__PURE__ */ n("span", { style: { color: "var(--ui-green)", fontWeight: 600 }, children: (d == null ? void 0 : d.copied) ?? "✓ Copied" }) : /* @__PURE__ */ g(ce, { children: [
1227
+ /* @__PURE__ */ n("span", { className: "ui-tooltip-label", children: s ?? (d == null ? void 0 : d.tooltip) ?? "Amount" }),
1228
+ (d == null ? void 0 : d.clickToCopy) ?? "Click to copy"
1229
+ ] }),
1230
+ delay: 0,
1231
+ style: l,
1232
+ children: /* @__PURE__ */ n(
1233
+ "span",
1234
+ {
1235
+ role: "button",
1236
+ tabIndex: 0,
1237
+ "aria-label": i,
1238
+ className: "ui-copy-value" + (u ? " " + u : ""),
1239
+ onClick: y,
1240
+ onKeyDown: (c) => {
1241
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), y());
1242
+ },
1243
+ style: {
1244
+ ...a,
1245
+ cursor: f ? "default" : "pointer",
1246
+ color: f ? "var(--ui-green)" : a == null ? void 0 : a.color
1247
+ },
1248
+ children: r ?? o(t)
1249
+ }
1250
+ )
1251
+ }
1252
+ );
1253
+ }
1254
+ function ve(t) {
1255
+ const r = /^(\d{4})-(\d{2})-(\d{2})/.exec(t ?? "");
1256
+ if (!r) return null;
1257
+ const i = new Date(Number(r[1]), Number(r[2]) - 1, Number(r[3]));
1258
+ return Number.isNaN(i.getTime()) ? null : i;
1259
+ }
1260
+ function le(t) {
1261
+ const r = t.getFullYear(), i = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0");
1262
+ return `${r}-${i}-${o}`;
1263
+ }
1264
+ function ct({
1265
+ value: t,
1266
+ onChange: r,
1267
+ ariaLabel: i = "Date",
1268
+ placeholder: o = "Select date",
1269
+ disabled: e = !1,
1270
+ invalid: s = !1,
1271
+ format: d = "friendly",
1272
+ size: u = "sm",
1273
+ fontSize: a = 13,
1274
+ triggerStyle: l,
1275
+ locale: f = "en-US",
1276
+ weekdayLabels: h,
1277
+ previousMonthLabel: p = "Previous month",
1278
+ nextMonthLabel: y = "Next month",
1279
+ clearLabel: c = "Clear",
1280
+ todayLabel: m = "Today",
1281
+ className: b,
1282
+ style: D
1283
+ }) {
1284
+ const k = ve(t), [N, S] = L(() => {
1285
+ const E = k ?? /* @__PURE__ */ new Date();
1286
+ return { year: E.getFullYear(), month: E.getMonth() };
1287
+ }), { open: I, pos: R, triggerRef: F, menuRef: w, openMenu: C, closeMenu: T } = se({
1288
+ maxHeight: 360,
1289
+ minWidth: 264,
1290
+ fitContent: !0
1291
+ }), Y = ue(() => {
1292
+ const E = new Intl.DateTimeFormat(f, { weekday: "narrow" });
1293
+ return Array.from({ length: 7 }, (P, v) => E.format(new Date(2024, 0, 7 + v)));
1294
+ }, [f]), H = h ?? Y, G = ue(
1295
+ () => new Intl.DateTimeFormat(f, { month: "long", year: "numeric" }).format(
1296
+ new Date(N.year, N.month, 1)
1297
+ ),
1298
+ [f, N.month, N.year]
1299
+ ), z = () => {
1300
+ if (e) return;
1301
+ const E = ve(t) ?? /* @__PURE__ */ new Date();
1302
+ S({ year: E.getFullYear(), month: E.getMonth() }), C();
1303
+ }, W = (E) => S((P) => {
1304
+ const v = new Date(P.year, P.month + E, 1);
1305
+ return { year: v.getFullYear(), month: v.getMonth() };
1306
+ }), U = new Date(N.year, N.month, 1), X = new Date(N.year, N.month, 1 - U.getDay()), _ = Array.from(
1307
+ { length: 42 },
1308
+ (E, P) => new Date(X.getFullYear(), X.getMonth(), X.getDate() + P)
1309
+ ), Z = le(/* @__PURE__ */ new Date()), x = k ? d === "short" ? k.toLocaleDateString(f, {
1310
+ month: "2-digit",
1311
+ day: "2-digit",
1312
+ year: "numeric"
1313
+ }) : k.toLocaleDateString(f, {
1314
+ month: "short",
1315
+ day: "numeric",
1316
+ year: "numeric"
1317
+ }) : "", $ = (E) => {
1318
+ e || (E.key === "ArrowDown" || E.key === "Enter" || E.key === " ") && (E.preventDefault(), I ? T(!0) : z());
1319
+ }, q = (E) => {
1320
+ r(E), T(!0);
1321
+ };
1322
+ return /* @__PURE__ */ g("div", { className: `ui-dropdown${b ? ` ${b}` : ""}`, style: D, children: [
1323
+ /* @__PURE__ */ g(
1324
+ "button",
1325
+ {
1326
+ ref: F,
1327
+ type: "button",
1328
+ className: "ui-dropdown-trigger" + (u === "md" ? " is-md" : "") + (s ? " is-invalid" : ""),
1329
+ style: l,
1330
+ "aria-label": i,
1331
+ "aria-haspopup": "dialog",
1332
+ "aria-expanded": I,
1333
+ disabled: e,
1334
+ onClick: () => I ? T() : z(),
1335
+ onKeyDown: $,
1336
+ children: [
1337
+ /* @__PURE__ */ n(
1338
+ "span",
1339
+ {
1340
+ className: "ui-dropdown-value",
1341
+ style: { fontSize: a, color: x ? "var(--ui-text)" : "var(--ui-text-3)" },
1342
+ children: x || o
1343
+ }
1344
+ ),
1345
+ /* @__PURE__ */ g(
1346
+ "svg",
1347
+ {
1348
+ className: "ui-datepicker-icon",
1349
+ width: "13",
1350
+ height: "13",
1351
+ viewBox: "0 0 13 13",
1352
+ fill: "none",
1353
+ stroke: "currentColor",
1354
+ strokeWidth: "1.3",
1355
+ "aria-hidden": "true",
1356
+ children: [
1357
+ /* @__PURE__ */ n("rect", { x: "1.5", y: "2.5", width: "10", height: "9", rx: "1.5" }),
1358
+ /* @__PURE__ */ n("line", { x1: "1.5", y1: "5.5", x2: "11.5", y2: "5.5" }),
1359
+ /* @__PURE__ */ n("line", { x1: "4.5", y1: "1", x2: "4.5", y2: "3.5" }),
1360
+ /* @__PURE__ */ n("line", { x1: "8.5", y1: "1", x2: "8.5", y2: "3.5" })
1361
+ ]
1362
+ }
1363
+ )
1364
+ ]
1365
+ }
1366
+ ),
1367
+ I && typeof document < "u" && re(
1368
+ /* @__PURE__ */ g(
1369
+ "div",
1370
+ {
1371
+ ref: w,
1372
+ className: "ui-datepicker-menu",
1373
+ role: "dialog",
1374
+ "aria-label": i,
1375
+ style: { left: R.left, top: R.top, bottom: R.bottom, width: R.width },
1376
+ children: [
1377
+ /* @__PURE__ */ g("div", { className: "ui-datepicker-head", children: [
1378
+ /* @__PURE__ */ n("span", { className: "ui-datepicker-title", children: G }),
1379
+ /* @__PURE__ */ g("span", { className: "ui-datepicker-nav", children: [
1380
+ /* @__PURE__ */ n(
1381
+ "button",
1382
+ {
1383
+ type: "button",
1384
+ "aria-label": p,
1385
+ onClick: () => W(-1),
1386
+ children: "‹"
1387
+ }
1388
+ ),
1389
+ /* @__PURE__ */ n("button", { type: "button", "aria-label": y, onClick: () => W(1), children: "›" })
1390
+ ] })
1391
+ ] }),
1392
+ /* @__PURE__ */ g("div", { className: "ui-datepicker-grid", children: [
1393
+ H.map((E, P) => /* @__PURE__ */ n("span", { className: "ui-datepicker-wd", children: E }, `${E}-${P}`)),
1394
+ _.map((E) => {
1395
+ const P = le(E), v = E.getMonth() !== N.month, M = !!k && le(k) === P, A = Z === P;
1396
+ return /* @__PURE__ */ n(
1397
+ "button",
1398
+ {
1399
+ type: "button",
1400
+ className: "ui-datepicker-day" + (v ? " is-out" : "") + (A ? " is-today" : "") + (M ? " is-selected" : ""),
1401
+ "aria-current": A ? "date" : void 0,
1402
+ onClick: () => q(P),
1403
+ children: E.getDate()
1404
+ },
1405
+ P
1406
+ );
1407
+ })
1408
+ ] }),
1409
+ /* @__PURE__ */ g("div", { className: "ui-datepicker-foot", children: [
1410
+ /* @__PURE__ */ n("button", { type: "button", onClick: () => q(""), children: c }),
1411
+ /* @__PURE__ */ n("button", { type: "button", onClick: () => q(Z), children: m })
1412
+ ] })
1413
+ ]
1414
+ }
1415
+ ),
1416
+ document.body
1417
+ )
1418
+ ] });
1419
+ }
1420
+ function Fe({
1421
+ value: t,
1422
+ onChange: r,
1423
+ options: i,
1424
+ ariaLabel: o,
1425
+ placeholder: e = "—",
1426
+ title: s,
1427
+ color: d,
1428
+ dot: u = !1,
1429
+ fontSize: a = 13,
1430
+ fontWeight: l,
1431
+ size: f = "sm",
1432
+ fullWidth: h = !0,
1433
+ disabled: p = !1,
1434
+ maxHeight: y = 260,
1435
+ onOpenChange: c,
1436
+ className: m,
1437
+ style: b
1438
+ }) {
1439
+ const [D, k] = L(0), [N, S] = L(null), I = J(), R = O(() => {
1440
+ if (!N) return;
1441
+ const x = i.findIndex(
1442
+ ($) => $.value === N.value && $.label === N.label
1443
+ );
1444
+ S(null), k(x >= 0 ? x : 0);
1445
+ }, [N, i]), F = O(() => N ? (R(), !0) : !1, [N, R]), { open: w, pos: C, triggerRef: T, menuRef: Y, openMenu: H, closeMenu: G } = se({
1446
+ maxHeight: y,
1447
+ onEscape: F
1448
+ }), z = i.findIndex((x) => x.value === t), W = z >= 0 ? i[z] : void 0, U = (N == null ? void 0 : N.children) ?? i, X = O(() => {
1449
+ p || i.length === 0 || (S(null), k(z >= 0 ? z : 0), H());
1450
+ }, [p, H, i.length, z]);
1451
+ j(() => {
1452
+ w || S(null);
1453
+ }, [w]), j(() => {
1454
+ c == null || c(w);
1455
+ }, [w, c]);
1456
+ const _ = O(
1457
+ (x) => {
1458
+ var q;
1459
+ const $ = U[x];
1460
+ if ($) {
1461
+ if ((q = $.children) != null && q.length) {
1462
+ const E = $.children.findIndex((P) => P.value === t);
1463
+ S($), k(E >= 0 ? E : 0);
1464
+ return;
1465
+ }
1466
+ r($.value), G(!0);
1467
+ }
1468
+ },
1469
+ [G, U, r, t]
1470
+ ), Z = (x) => {
1471
+ if (!p) {
1472
+ if (!w) {
1473
+ (x.key === "ArrowDown" || x.key === "Enter" || x.key === " ") && (x.preventDefault(), X());
1474
+ return;
1475
+ }
1476
+ x.key === "ArrowLeft" && N ? (x.preventDefault(), R()) : x.key === "ArrowDown" ? (x.preventDefault(), k(($) => Math.min($ + 1, U.length - 1))) : x.key === "ArrowUp" ? (x.preventDefault(), k(($) => Math.max($ - 1, 0))) : x.key === "Home" ? (x.preventDefault(), k(0)) : x.key === "End" ? (x.preventDefault(), k(U.length - 1)) : (x.key === "Enter" || x.key === " ") && (x.preventDefault(), _(D));
1477
+ }
1478
+ };
1479
+ return /* @__PURE__ */ g(
1480
+ "div",
1481
+ {
1482
+ className: "ui-dropdown" + (h ? "" : " is-inline") + (m ? " " + m : ""),
1483
+ style: b,
1484
+ children: [
1485
+ /* @__PURE__ */ g(
1486
+ "button",
1487
+ {
1488
+ ref: T,
1489
+ type: "button",
1490
+ className: "ui-dropdown-trigger" + (f === "md" ? " is-md" : ""),
1491
+ "aria-label": o,
1492
+ "aria-haspopup": "listbox",
1493
+ "aria-expanded": w,
1494
+ "aria-controls": w ? I : void 0,
1495
+ title: s,
1496
+ disabled: p,
1497
+ onClick: () => w ? G() : X(),
1498
+ onKeyDown: Z,
1499
+ children: [
1500
+ (W == null ? void 0 : W.icon) && /* @__PURE__ */ n("span", { className: "ui-dropdown-icon", children: W.icon }),
1501
+ u && d && /* @__PURE__ */ n("span", { className: "ui-dropdown-dot", style: { background: d } }),
1502
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-value", style: { fontSize: a, fontWeight: l, color: d }, children: (W == null ? void 0 : W.label) ?? (t || e) }),
1503
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-caret", "aria-hidden": "true", children: "▾" })
1504
+ ]
1505
+ }
1506
+ ),
1507
+ w && typeof document < "u" && re(
1508
+ /* @__PURE__ */ g(
1509
+ "div",
1510
+ {
1511
+ ref: Y,
1512
+ className: "ui-dropdown-menu",
1513
+ style: {
1514
+ left: C.left,
1515
+ top: C.top,
1516
+ bottom: C.bottom,
1517
+ width: C.width,
1518
+ maxHeight: C.maxHeight
1519
+ },
1520
+ children: [
1521
+ N && /* @__PURE__ */ g(
1522
+ "button",
1523
+ {
1524
+ type: "button",
1525
+ "aria-label": `Back to ${o}`,
1526
+ onClick: R,
1527
+ style: {
1528
+ display: "flex",
1529
+ alignItems: "center",
1530
+ gap: 6,
1531
+ width: "100%",
1532
+ padding: "6px 10px",
1533
+ marginBottom: 4,
1534
+ border: "none",
1535
+ borderRadius: 7,
1536
+ background: "var(--ui-surface-2)",
1537
+ color: "var(--ui-text-2)",
1538
+ fontSize: 11,
1539
+ fontWeight: 600,
1540
+ cursor: "pointer",
1541
+ textAlign: "left"
1542
+ },
1543
+ children: [
1544
+ /* @__PURE__ */ n("span", { "aria-hidden": "true", children: "‹" }),
1545
+ /* @__PURE__ */ n(
1546
+ "span",
1547
+ {
1548
+ style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
1549
+ children: N.label
1550
+ }
1551
+ )
1552
+ ]
1553
+ }
1554
+ ),
1555
+ /* @__PURE__ */ n("div", { id: I, role: "listbox", "aria-label": o, children: U.map((x, $) => {
1556
+ var P;
1557
+ const q = `${x.value}-${$}`, E = /* @__PURE__ */ g(
1558
+ "div",
1559
+ {
1560
+ role: "option",
1561
+ "aria-selected": x.value === t,
1562
+ className: "ui-dropdown-option" + ($ === D ? " is-active" : "") + (x.value === t ? " is-selected" : ""),
1563
+ onMouseEnter: () => k($),
1564
+ onClick: () => _($),
1565
+ children: [
1566
+ x.icon && /* @__PURE__ */ n("span", { className: "ui-dropdown-icon", children: x.icon }),
1567
+ x.color && /* @__PURE__ */ n("span", { className: "ui-dropdown-dot", style: { background: x.color } }),
1568
+ /* @__PURE__ */ n("span", { className: "ui-dropdown-option-label", children: x.label }),
1569
+ (P = x.children) != null && P.length ? /* @__PURE__ */ n("span", { className: "ui-dropdown-caret", "aria-hidden": "true", children: "›" }) : x.value === t && /* @__PURE__ */ n("span", { className: "ui-dropdown-check", "aria-hidden": "true", children: "✓" })
1570
+ ]
1571
+ },
1572
+ q
1573
+ );
1574
+ return x.hint ? /* @__PURE__ */ n(
1575
+ Ne,
1576
+ {
1577
+ as: "div",
1578
+ delay: 0,
1579
+ content: /* @__PURE__ */ g(ce, { children: [
1580
+ x.hintLabel && /* @__PURE__ */ n("span", { className: "ui-tooltip-label", children: x.hintLabel }),
1581
+ x.hint
1582
+ ] }),
1583
+ children: E
1584
+ },
1585
+ q
1586
+ ) : E;
1587
+ }) })
1588
+ ]
1589
+ }
1590
+ ),
1591
+ document.body
1592
+ )
1593
+ ]
1594
+ }
1595
+ );
1596
+ }
1597
+ function st({
1598
+ title: t,
1599
+ onSave: r,
1600
+ onCancel: i,
1601
+ saveDisabled: o,
1602
+ saveLabel: e = "Save",
1603
+ cancelLabel: s = "Cancel",
1604
+ embedded: d = !1,
1605
+ className: u,
1606
+ style: a,
1607
+ children: l
1608
+ }) {
1609
+ return /* @__PURE__ */ g(
1610
+ "div",
1611
+ {
1612
+ className: u,
1613
+ style: {
1614
+ ...d ? {
1615
+ background: "var(--ui-surface-2)",
1616
+ borderTop: "1px solid var(--ui-border)",
1617
+ padding: "16px 20px"
1618
+ } : {
1619
+ background: "var(--ui-surface)",
1620
+ border: "1px solid var(--ui-border)",
1621
+ borderRadius: 12,
1622
+ padding: 20
1623
+ },
1624
+ ...a
1625
+ },
1626
+ children: [
1627
+ /* @__PURE__ */ n("div", { style: { fontSize: 13, fontWeight: 600, color: "var(--ui-text)", marginBottom: 14 }, children: t }),
1628
+ l,
1629
+ /* @__PURE__ */ g("div", { style: { display: "flex", gap: 8, justifyContent: "flex-end", marginTop: 14 }, children: [
1630
+ /* @__PURE__ */ n(
1631
+ "button",
1632
+ {
1633
+ type: "button",
1634
+ onClick: i,
1635
+ style: {
1636
+ padding: "8px 16px",
1637
+ borderRadius: 8,
1638
+ border: "1px solid var(--ui-border)",
1639
+ background: "none",
1640
+ color: "var(--ui-text-2)",
1641
+ fontSize: 13,
1642
+ cursor: "pointer"
1643
+ },
1644
+ children: s
1645
+ }
1646
+ ),
1647
+ /* @__PURE__ */ n(
1648
+ "button",
1649
+ {
1650
+ type: "button",
1651
+ onClick: r,
1652
+ disabled: o,
1653
+ style: {
1654
+ padding: "8px 20px",
1655
+ borderRadius: 8,
1656
+ background: "var(--ui-accent)",
1657
+ color: "var(--ui-on-accent)",
1658
+ fontWeight: 600,
1659
+ fontSize: 13,
1660
+ cursor: o ? "not-allowed" : "pointer",
1661
+ border: "none",
1662
+ opacity: o ? 0.6 : 1
1663
+ },
1664
+ children: e
1665
+ }
1666
+ )
1667
+ ] })
1668
+ ]
1669
+ }
1670
+ );
1671
+ }
1672
+ function ut({
1673
+ title: t,
1674
+ subtitle: r,
1675
+ action: i,
1676
+ children: o,
1677
+ testId: e,
1678
+ maxWidth: s = 700,
1679
+ className: d,
1680
+ style: u
1681
+ }) {
1682
+ return /* @__PURE__ */ n(
1683
+ "div",
1684
+ {
1685
+ style: { height: "100%", overflowY: "auto", padding: "28px 32px", ...u },
1686
+ className: `ui-scroll-y${d ? ` ${d}` : ""}`,
1687
+ children: /* @__PURE__ */ g("div", { style: { maxWidth: s, margin: "0 auto" }, "data-testid": e, children: [
1688
+ /* @__PURE__ */ g(
1689
+ "div",
1690
+ {
1691
+ style: {
1692
+ display: "flex",
1693
+ justifyContent: "space-between",
1694
+ alignItems: "flex-start",
1695
+ marginBottom: 24
1696
+ },
1697
+ children: [
1698
+ /* @__PURE__ */ g("div", { children: [
1699
+ /* @__PURE__ */ n(
1700
+ "h1",
1701
+ {
1702
+ style: {
1703
+ fontSize: 22,
1704
+ fontWeight: 700,
1705
+ color: "var(--ui-text)",
1706
+ letterSpacing: "-0.5px"
1707
+ },
1708
+ children: t
1709
+ }
1710
+ ),
1711
+ /* @__PURE__ */ n("p", { style: { color: "var(--ui-text-2)", fontSize: 13, marginTop: 2 }, children: r })
1712
+ ] }),
1713
+ i && /* @__PURE__ */ n(
1714
+ "button",
1715
+ {
1716
+ type: "button",
1717
+ onClick: i.onClick,
1718
+ style: {
1719
+ padding: "9px 16px",
1720
+ borderRadius: 8,
1721
+ background: "var(--ui-accent)",
1722
+ color: "var(--ui-on-accent)",
1723
+ fontWeight: 600,
1724
+ fontSize: 13,
1725
+ cursor: "pointer",
1726
+ border: "none",
1727
+ flexShrink: 0
1728
+ },
1729
+ children: i.label
1730
+ }
1731
+ )
1732
+ ]
1733
+ }
1734
+ ),
1735
+ o
1736
+ ] })
1737
+ }
1738
+ );
1739
+ }
1740
+ function ft({
1741
+ children: t,
1742
+ testId: r,
1743
+ className: i,
1744
+ style: o
1745
+ }) {
1746
+ return /* @__PURE__ */ n(
1747
+ "div",
1748
+ {
1749
+ "data-testid": r,
1750
+ className: i,
1751
+ style: {
1752
+ background: "var(--ui-surface)",
1753
+ border: "1px solid var(--ui-border)",
1754
+ borderRadius: 12,
1755
+ overflow: "hidden",
1756
+ ...o
1757
+ },
1758
+ children: t
1759
+ }
1760
+ );
1761
+ }
1762
+ function ht({
1763
+ children: t,
1764
+ style: r,
1765
+ className: i,
1766
+ borderBottom: o = !0
1767
+ }) {
1768
+ return /* @__PURE__ */ n(
1769
+ "div",
1770
+ {
1771
+ className: i,
1772
+ style: {
1773
+ display: "flex",
1774
+ alignItems: "center",
1775
+ padding: "13px 20px",
1776
+ gap: 12,
1777
+ borderBottom: o ? "1px solid var(--ui-border)" : "none",
1778
+ ...r
1779
+ },
1780
+ onMouseEnter: (e) => e.currentTarget.style.background = "var(--ui-surface-2)",
1781
+ onMouseLeave: (e) => e.currentTarget.style.background = "transparent",
1782
+ children: t
1783
+ }
1784
+ );
1785
+ }
1786
+ function pt({
1787
+ ariaLabel: t,
1788
+ placeholder: r,
1789
+ value: i,
1790
+ onChange: o,
1791
+ className: e,
1792
+ style: s
1793
+ }) {
1794
+ return /* @__PURE__ */ n(
1795
+ "input",
1796
+ {
1797
+ "aria-label": t,
1798
+ placeholder: r,
1799
+ value: i,
1800
+ onChange: (d) => o(d.target.value),
1801
+ className: e,
1802
+ style: {
1803
+ padding: "9px 12px",
1804
+ borderRadius: 8,
1805
+ border: "1px solid var(--ui-border)",
1806
+ background: "var(--ui-surface)",
1807
+ color: "var(--ui-text)",
1808
+ fontSize: 13,
1809
+ outline: "none",
1810
+ width: "100%",
1811
+ marginBottom: 16,
1812
+ ...s
1813
+ }
1814
+ }
1815
+ );
1816
+ }
1817
+ function mt({
1818
+ children: t,
1819
+ className: r,
1820
+ style: i
1821
+ }) {
1822
+ return /* @__PURE__ */ n(
1823
+ "div",
1824
+ {
1825
+ className: r,
1826
+ style: {
1827
+ padding: 32,
1828
+ textAlign: "center",
1829
+ color: "var(--ui-text-3)",
1830
+ fontSize: 13,
1831
+ ...i
1832
+ },
1833
+ children: t
1834
+ }
1835
+ );
1836
+ }
1837
+ function vt({
1838
+ selectedMonth: t,
1839
+ setSelectedMonth: r,
1840
+ options: i,
1841
+ allOption: o,
1842
+ ariaLabel: e = "Select month",
1843
+ previousLabel: s = "Previous month",
1844
+ nextLabel: d = "Next month",
1845
+ className: u,
1846
+ style: a
1847
+ }) {
1848
+ const l = i, f = l.findIndex((y) => y.value === t), h = f >= 0 && f < l.length - 1, p = f > 0;
1849
+ return /* @__PURE__ */ g("div", { className: `ui-month-selector${u ? ` ${u}` : ""}`, style: a, children: [
1850
+ /* @__PURE__ */ n(
1851
+ "button",
1852
+ {
1853
+ type: "button",
1854
+ className: "ui-month-selector-arrow",
1855
+ "aria-label": s,
1856
+ disabled: !h,
1857
+ onClick: () => {
1858
+ h && r(l[f + 1].value);
1859
+ },
1860
+ children: "‹"
1861
+ }
1862
+ ),
1863
+ /* @__PURE__ */ n("div", { className: "ui-month-selector-middle", children: /* @__PURE__ */ n(
1864
+ Fe,
1865
+ {
1866
+ ariaLabel: e,
1867
+ value: t,
1868
+ onChange: r,
1869
+ options: o ? [o, ...l] : l,
1870
+ fullWidth: !1
1871
+ }
1872
+ ) }),
1873
+ /* @__PURE__ */ n(
1874
+ "button",
1875
+ {
1876
+ type: "button",
1877
+ className: "ui-month-selector-arrow",
1878
+ "aria-label": d,
1879
+ disabled: !p,
1880
+ onClick: () => {
1881
+ p && r(l[f - 1].value);
1882
+ },
1883
+ children: "›"
1884
+ }
1885
+ )
1886
+ ] });
1887
+ }
1888
+ function gt({ size: t = "md", className: r, ...i }) {
1889
+ return /* @__PURE__ */ n(
1890
+ "input",
1891
+ {
1892
+ type: "radio",
1893
+ className: `ui-radio${t === "sm" ? " is-sm" : ""}${r ? ` ${r}` : ""}`,
1894
+ ...i
1895
+ }
1896
+ );
1897
+ }
1898
+ const oe = {
1899
+ padding: "5px 10px",
1900
+ borderRadius: 6,
1901
+ fontSize: 11,
1902
+ cursor: "pointer"
1903
+ };
1904
+ function yt({
1905
+ onEdit: t,
1906
+ onDelete: r,
1907
+ confirmDelete: i = !0,
1908
+ editLabel: o = "Edit",
1909
+ deleteLabel: e = "Delete",
1910
+ cancelLabel: s = "Cancel",
1911
+ className: d,
1912
+ style: u
1913
+ }) {
1914
+ const [a, l] = L(!1), f = { display: "flex", gap: 6, ...u };
1915
+ return a ? /* @__PURE__ */ g("div", { className: d, style: f, children: [
1916
+ /* @__PURE__ */ n(
1917
+ "button",
1918
+ {
1919
+ type: "button",
1920
+ onClick: () => {
1921
+ r(), l(!1);
1922
+ },
1923
+ style: {
1924
+ ...oe,
1925
+ background: "var(--ui-red)",
1926
+ color: "var(--ui-on-accent)",
1927
+ fontWeight: 600,
1928
+ border: "none"
1929
+ },
1930
+ children: e
1931
+ }
1932
+ ),
1933
+ /* @__PURE__ */ n(
1934
+ "button",
1935
+ {
1936
+ type: "button",
1937
+ onClick: () => l(!1),
1938
+ style: {
1939
+ ...oe,
1940
+ background: "var(--ui-surface-2)",
1941
+ color: "var(--ui-text-2)",
1942
+ border: "1px solid var(--ui-border)"
1943
+ },
1944
+ children: s
1945
+ }
1946
+ )
1947
+ ] }) : /* @__PURE__ */ g("div", { className: d, style: f, children: [
1948
+ /* @__PURE__ */ n(
1949
+ "button",
1950
+ {
1951
+ type: "button",
1952
+ onClick: t,
1953
+ style: {
1954
+ ...oe,
1955
+ background: "none",
1956
+ border: "1px solid var(--ui-border)",
1957
+ color: "var(--ui-text-2)"
1958
+ },
1959
+ children: o
1960
+ }
1961
+ ),
1962
+ /* @__PURE__ */ n(
1963
+ "button",
1964
+ {
1965
+ type: "button",
1966
+ onClick: () => i ? l(!0) : r(),
1967
+ style: {
1968
+ ...oe,
1969
+ background: "none",
1970
+ border: "1px solid var(--ui-border)",
1971
+ color: "var(--ui-red)"
1972
+ },
1973
+ children: e
1974
+ }
1975
+ )
1976
+ ] });
1977
+ }
1978
+ function K({
1979
+ width: t = "100%",
1980
+ height: r = 12,
1981
+ radius: i = 6,
1982
+ circle: o = !1,
1983
+ className: e,
1984
+ style: s
1985
+ }) {
1986
+ return /* @__PURE__ */ n(
1987
+ "span",
1988
+ {
1989
+ "aria-hidden": "true",
1990
+ className: e ? `ui-skeleton ${e}` : "ui-skeleton",
1991
+ style: {
1992
+ display: "inline-block",
1993
+ width: t,
1994
+ height: r,
1995
+ borderRadius: o ? "50%" : i,
1996
+ ...s
1997
+ }
1998
+ }
1999
+ );
2000
+ }
2001
+ function Oe({
2002
+ label: t,
2003
+ children: r,
2004
+ className: i
2005
+ }) {
2006
+ return /* @__PURE__ */ n("div", { role: "status", "aria-live": "polite", "aria-busy": "true", "aria-label": t, className: i, children: r });
2007
+ }
2008
+ function bt({
2009
+ label: t,
2010
+ children: r,
2011
+ maxWidth: i = 700,
2012
+ padding: o = "28px 32px",
2013
+ className: e
2014
+ }) {
2015
+ return /* @__PURE__ */ n(Oe, { label: t, children: /* @__PURE__ */ n(
2016
+ "div",
2017
+ {
2018
+ style: { height: "100%", overflowY: "auto", padding: o },
2019
+ className: `ui-scroll-y${e ? ` ${e}` : ""}`,
2020
+ children: /* @__PURE__ */ n("div", { style: { maxWidth: i, margin: "0 auto" }, children: r })
2021
+ }
2022
+ ) });
2023
+ }
2024
+ function wt({
2025
+ actionWidth: t = 120,
2026
+ marginBottom: r = 24
2027
+ }) {
2028
+ return /* @__PURE__ */ g(
2029
+ "div",
2030
+ {
2031
+ style: {
2032
+ display: "flex",
2033
+ alignItems: "flex-start",
2034
+ justifyContent: "space-between",
2035
+ gap: 16,
2036
+ marginBottom: r
2037
+ },
2038
+ children: [
2039
+ /* @__PURE__ */ g("div", { children: [
2040
+ /* @__PURE__ */ n(K, { width: 190, height: 22, radius: 7 }),
2041
+ /* @__PURE__ */ n("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ n(K, { width: 300, height: 12 }) })
2042
+ ] }),
2043
+ t !== null && /* @__PURE__ */ n(K, { width: t, height: 36, radius: 8 })
2044
+ ]
2045
+ }
2046
+ );
2047
+ }
2048
+ function xt() {
2049
+ return /* @__PURE__ */ n("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ n(K, { height: 38, radius: 8 }) });
2050
+ }
2051
+ function kt({
2052
+ rows: t = 5,
2053
+ leading: r = "dot",
2054
+ trailing: i = "actions"
2055
+ }) {
2056
+ return /* @__PURE__ */ n(
2057
+ "div",
2058
+ {
2059
+ "aria-hidden": "true",
2060
+ style: {
2061
+ background: "var(--ui-surface)",
2062
+ border: "1px solid var(--ui-border)",
2063
+ borderRadius: 12,
2064
+ overflow: "hidden"
2065
+ },
2066
+ children: Array.from({ length: t }, (o, e) => /* @__PURE__ */ g(
2067
+ "div",
2068
+ {
2069
+ style: {
2070
+ display: "flex",
2071
+ alignItems: "center",
2072
+ gap: 12,
2073
+ padding: "13px 20px",
2074
+ borderTop: e === 0 ? "none" : "1px solid var(--ui-border)"
2075
+ },
2076
+ children: [
2077
+ r === "dot" && /* @__PURE__ */ n(K, { width: 12, height: 12, circle: !0 }),
2078
+ r === "avatar" && /* @__PURE__ */ n(K, { width: 44, height: 28, radius: 5 }),
2079
+ /* @__PURE__ */ g("div", { style: { flex: 1, minWidth: 0 }, children: [
2080
+ /* @__PURE__ */ n(K, { width: `${55 - e % 3 * 8}%`, height: 14 }),
2081
+ /* @__PURE__ */ n("div", { style: { marginTop: 6 }, children: /* @__PURE__ */ n(K, { width: `${34 - e % 2 * 6}%`, height: 11 }) })
2082
+ ] }),
2083
+ i === "amount" && /* @__PURE__ */ n(K, { width: 78, height: 14 }),
2084
+ i === "actions" && /* @__PURE__ */ g("div", { style: { display: "flex", gap: 6 }, children: [
2085
+ /* @__PURE__ */ n(K, { width: 24, height: 24, radius: 6 }),
2086
+ /* @__PURE__ */ n(K, { width: 24, height: 24, radius: 6 })
2087
+ ] })
2088
+ ]
2089
+ },
2090
+ e
2091
+ ))
2092
+ }
2093
+ );
2094
+ }
2095
+ function Nt({ rows: t = 3 }) {
2096
+ return /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { display: "flex", flexDirection: "column", gap: 10 }, children: Array.from({ length: t }, (r, i) => /* @__PURE__ */ g(
2097
+ "div",
2098
+ {
2099
+ style: {
2100
+ display: "grid",
2101
+ gridTemplateColumns: "76px 1fr 84px",
2102
+ gap: 10,
2103
+ alignItems: "center"
2104
+ },
2105
+ children: [
2106
+ /* @__PURE__ */ n(K, { width: 60, height: 11 }),
2107
+ /* @__PURE__ */ n(K, { width: `${72 - i * 9}%`, height: 12 }),
2108
+ /* @__PURE__ */ n("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ n(K, { width: 58, height: 12 }) })
2109
+ ]
2110
+ },
2111
+ i
2112
+ )) });
2113
+ }
2114
+ function Ct({
2115
+ children: t,
2116
+ tone: r = "info",
2117
+ title: i,
2118
+ action: o,
2119
+ onDismiss: e,
2120
+ dismissLabel: s = "Dismiss",
2121
+ role: d,
2122
+ className: u,
2123
+ style: a
2124
+ }) {
2125
+ const l = d ?? (r === "danger" || r === "warning" ? "alert" : "status");
2126
+ return /* @__PURE__ */ g(
2127
+ "div",
2128
+ {
2129
+ role: l,
2130
+ "aria-live": l === "alert" ? "assertive" : "polite",
2131
+ className: ["ui-alert", `ui-alert--${r}`, u ?? ""].filter(Boolean).join(" "),
2132
+ style: a,
2133
+ children: [
2134
+ /* @__PURE__ */ g("div", { className: "ui-alert-content", children: [
2135
+ i && /* @__PURE__ */ n("div", { className: "ui-alert-title", children: i }),
2136
+ /* @__PURE__ */ n("div", { className: "ui-alert-body", children: t })
2137
+ ] }),
2138
+ (o || e) && /* @__PURE__ */ g("div", { className: "ui-alert-actions", children: [
2139
+ o,
2140
+ e && /* @__PURE__ */ n(
2141
+ "button",
2142
+ {
2143
+ type: "button",
2144
+ className: "ui-alert-dismiss",
2145
+ "aria-label": s,
2146
+ onClick: e,
2147
+ children: "×"
2148
+ }
2149
+ )
2150
+ ] })
2151
+ ]
2152
+ }
2153
+ );
2154
+ }
2155
+ function Dt({
2156
+ children: t,
2157
+ tone: r = "neutral",
2158
+ variant: i = "soft",
2159
+ dot: o = !1,
2160
+ className: e,
2161
+ style: s
2162
+ }) {
2163
+ return /* @__PURE__ */ g(
2164
+ "span",
2165
+ {
2166
+ className: ["ui-badge", `ui-badge--${i}`, `ui-badge--${r}`, e ?? ""].filter(Boolean).join(" "),
2167
+ style: s,
2168
+ children: [
2169
+ o && /* @__PURE__ */ n("span", { className: "ui-badge-dot", "aria-hidden": "true" }),
2170
+ t
2171
+ ]
2172
+ }
2173
+ );
2174
+ }
2175
+ function St({
2176
+ children: t,
2177
+ tone: r = "neutral",
2178
+ variant: i = "soft",
2179
+ leadingIcon: o,
2180
+ onRemove: e,
2181
+ removeLabel: s = "Remove",
2182
+ className: d,
2183
+ style: u
2184
+ }) {
2185
+ return /* @__PURE__ */ g(
2186
+ "span",
2187
+ {
2188
+ className: [
2189
+ "ui-badge",
2190
+ "ui-chip",
2191
+ `ui-badge--${i}`,
2192
+ `ui-badge--${r}`,
2193
+ d ?? ""
2194
+ ].filter(Boolean).join(" "),
2195
+ style: u,
2196
+ children: [
2197
+ o && /* @__PURE__ */ n("span", { className: "ui-chip-icon", "aria-hidden": "true", children: o }),
2198
+ /* @__PURE__ */ n("span", { className: "ui-chip-label", children: t }),
2199
+ e && /* @__PURE__ */ n(
2200
+ "button",
2201
+ {
2202
+ type: "button",
2203
+ className: "ui-chip-remove",
2204
+ "aria-label": s,
2205
+ onClick: e,
2206
+ children: "×"
2207
+ }
2208
+ )
2209
+ ]
2210
+ }
2211
+ );
2212
+ }
2213
+ function Ye({ size: t = 16, label: r = "Loading", className: i, style: o }) {
2214
+ return /* @__PURE__ */ n(
2215
+ "span",
2216
+ {
2217
+ role: "status",
2218
+ "aria-label": r,
2219
+ className: i,
2220
+ style: { display: "inline-flex", flexShrink: 0, ...o },
2221
+ children: /* @__PURE__ */ n(
2222
+ "span",
2223
+ {
2224
+ className: "ui-spinner",
2225
+ "aria-hidden": "true",
2226
+ style: { width: t, height: t, borderWidth: Math.max(1.5, t / 8) }
2227
+ }
2228
+ )
2229
+ }
2230
+ );
2231
+ }
2232
+ const Xe = ae(function({
2233
+ variant: r = "primary",
2234
+ size: i = "md",
2235
+ loading: o = !1,
2236
+ loadingLabel: e = "Loading",
2237
+ leadingIcon: s,
2238
+ trailingIcon: d,
2239
+ fullWidth: u = !1,
2240
+ className: a,
2241
+ children: l,
2242
+ disabled: f,
2243
+ type: h = "button",
2244
+ ...p
2245
+ }, y) {
2246
+ return /* @__PURE__ */ g(
2247
+ "button",
2248
+ {
2249
+ ref: y,
2250
+ type: h,
2251
+ disabled: f || o,
2252
+ "aria-busy": o || void 0,
2253
+ className: [
2254
+ "ui-button",
2255
+ `ui-button--${r}`,
2256
+ `ui-button--${i}`,
2257
+ u ? "is-full" : "",
2258
+ o ? "is-loading" : "",
2259
+ a ?? ""
2260
+ ].filter(Boolean).join(" "),
2261
+ ...p,
2262
+ children: [
2263
+ o ? /* @__PURE__ */ n(Ye, { size: i === "sm" ? 12 : 14, label: e }) : s,
2264
+ l != null && /* @__PURE__ */ n("span", { className: "ui-button-label", children: l }),
2265
+ d
2266
+ ]
2267
+ }
2268
+ );
2269
+ }), Mt = ae(function({ className: r, children: i, ...o }, e) {
2270
+ return /* @__PURE__ */ n(
2271
+ Xe,
2272
+ {
2273
+ ref: e,
2274
+ ...o,
2275
+ className: ["ui-button--icon", r ?? ""].filter(Boolean).join(" "),
2276
+ children: i
2277
+ }
2278
+ );
2279
+ });
2280
+ function qe({ children: t, padding: r = "md", className: i, style: o }) {
2281
+ return /* @__PURE__ */ n(
2282
+ "div",
2283
+ {
2284
+ className: ["ui-card", `ui-card--pad-${r}`, i ?? ""].filter(Boolean).join(" "),
2285
+ style: o,
2286
+ children: t
2287
+ }
2288
+ );
2289
+ }
2290
+ function Ge({ title: t, subtitle: r, actions: i, className: o }) {
2291
+ return /* @__PURE__ */ g("div", { className: ["ui-card-header", o ?? ""].filter(Boolean).join(" "), children: [
2292
+ /* @__PURE__ */ g("div", { children: [
2293
+ /* @__PURE__ */ n("div", { className: "ui-card-title", children: t }),
2294
+ r && /* @__PURE__ */ n("div", { className: "ui-card-subtitle", children: r })
2295
+ ] }),
2296
+ i && /* @__PURE__ */ n("div", { className: "ui-card-actions", children: i })
2297
+ ] });
2298
+ }
2299
+ function Ve({
2300
+ children: t,
2301
+ className: r,
2302
+ style: i
2303
+ }) {
2304
+ return /* @__PURE__ */ n("div", { className: ["ui-card-body", r ?? ""].filter(Boolean).join(" "), style: i, children: t });
2305
+ }
2306
+ function Et({
2307
+ children: t,
2308
+ className: r,
2309
+ style: i
2310
+ }) {
2311
+ return /* @__PURE__ */ n("div", { className: ["ui-card-footer", r ?? ""].filter(Boolean).join(" "), style: i, children: t });
2312
+ }
2313
+ function It({
2314
+ title: t,
2315
+ subtitle: r,
2316
+ actions: i,
2317
+ children: o,
2318
+ className: e,
2319
+ contentClassName: s,
2320
+ style: d
2321
+ }) {
2322
+ return /* @__PURE__ */ g(qe, { padding: "none", className: e, style: d, children: [
2323
+ /* @__PURE__ */ n(Ge, { title: t, subtitle: r, actions: i }),
2324
+ /* @__PURE__ */ n(Ve, { className: s, children: o })
2325
+ ] });
2326
+ }
2327
+ function Bt({
2328
+ value: t,
2329
+ onChange: r,
2330
+ options: i,
2331
+ ariaLabel: o,
2332
+ placeholder: e = "Select…",
2333
+ noResultsLabel: s = "No results",
2334
+ disabled: d = !1,
2335
+ className: u,
2336
+ style: a
2337
+ }) {
2338
+ const [l, f] = L(!1), [h, p] = L(""), [y, c] = L(0), m = B(null), b = B(null), D = J(), k = i.find((w) => w.value === t), N = h.trim().toLowerCase(), S = N ? i.filter((w) => w.label.toLowerCase().includes(N)) : i;
2339
+ j(() => {
2340
+ if (!l) return;
2341
+ const w = (C) => {
2342
+ var T;
2343
+ (T = m.current) != null && T.contains(C.target) || f(!1);
2344
+ };
2345
+ return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
2346
+ }, [l]);
2347
+ const I = () => {
2348
+ d || (f(!0), p(""), c(0));
2349
+ }, R = (w) => {
2350
+ var C;
2351
+ w.disabled || (r(w.value), f(!1), p(""), (C = b.current) == null || C.focus());
2352
+ }, F = (w) => {
2353
+ if (!d)
2354
+ if (w.key === "ArrowDown")
2355
+ w.preventDefault(), l ? c((C) => Math.min(S.length - 1, C + 1)) : I();
2356
+ else if (w.key === "ArrowUp")
2357
+ w.preventDefault(), c((C) => Math.max(0, C - 1));
2358
+ else if (w.key === "Enter") {
2359
+ w.preventDefault();
2360
+ const C = S[y];
2361
+ C && R(C);
2362
+ } else w.key === "Escape" && f(!1);
2363
+ };
2364
+ return /* @__PURE__ */ g(
2365
+ "div",
2366
+ {
2367
+ ref: m,
2368
+ className: ["ui-combobox", u ?? ""].filter(Boolean).join(" "),
2369
+ style: a,
2370
+ children: [
2371
+ /* @__PURE__ */ n(
2372
+ "input",
2373
+ {
2374
+ ref: b,
2375
+ role: "combobox",
2376
+ "aria-label": o,
2377
+ "aria-expanded": l,
2378
+ "aria-controls": D,
2379
+ "aria-autocomplete": "list",
2380
+ "aria-activedescendant": l && S[y] ? `${D}-${y}` : void 0,
2381
+ className: "ui-input ui-combobox-input",
2382
+ value: l ? h : (k == null ? void 0 : k.label) ?? "",
2383
+ placeholder: (k == null ? void 0 : k.label) ?? e,
2384
+ disabled: d,
2385
+ onFocus: I,
2386
+ onClick: I,
2387
+ onChange: (w) => {
2388
+ p(w.target.value), f(!0), c(0);
2389
+ },
2390
+ onKeyDown: F
2391
+ }
2392
+ ),
2393
+ l && /* @__PURE__ */ n("div", { id: D, role: "listbox", "aria-label": o, className: "ui-combobox-menu", children: S.length === 0 ? /* @__PURE__ */ n("div", { className: "ui-combobox-empty", children: s }) : S.map((w, C) => /* @__PURE__ */ g(
2394
+ "div",
2395
+ {
2396
+ id: `${D}-${C}`,
2397
+ role: "option",
2398
+ "aria-selected": w.value === t,
2399
+ "aria-disabled": w.disabled || void 0,
2400
+ className: [
2401
+ "ui-combobox-option",
2402
+ C === y ? "is-active" : "",
2403
+ w.value === t ? "is-selected" : "",
2404
+ w.disabled ? "is-disabled" : ""
2405
+ ].filter(Boolean).join(" "),
2406
+ onMouseDown: (T) => T.preventDefault(),
2407
+ onMouseEnter: () => c(C),
2408
+ onClick: () => R(w),
2409
+ children: [
2410
+ /* @__PURE__ */ n("span", { className: "ui-combobox-label", children: w.label }),
2411
+ w.description && /* @__PURE__ */ n("span", { className: "ui-combobox-description", children: w.description })
2412
+ ]
2413
+ },
2414
+ w.value
2415
+ )) })
2416
+ ]
2417
+ }
2418
+ );
2419
+ }
2420
+ function Tt({
2421
+ columns: t,
2422
+ rows: r,
2423
+ rowKey: i,
2424
+ ariaLabel: o,
2425
+ caption: e,
2426
+ sort: s,
2427
+ onSortChange: d,
2428
+ emptyState: u = "No data",
2429
+ onRowClick: a,
2430
+ className: l,
2431
+ style: f
2432
+ }) {
2433
+ return /* @__PURE__ */ n(
2434
+ "div",
2435
+ {
2436
+ className: ["ui-data-table-wrap", l ?? ""].filter(Boolean).join(" "),
2437
+ style: f,
2438
+ children: /* @__PURE__ */ g("table", { className: "ui-data-table", "aria-label": o, children: [
2439
+ e && /* @__PURE__ */ n("caption", { children: e }),
2440
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: t.map((h) => {
2441
+ const p = (s == null ? void 0 : s.key) === h.key ? s.direction : void 0;
2442
+ return /* @__PURE__ */ n(
2443
+ "th",
2444
+ {
2445
+ scope: "col",
2446
+ "aria-sort": p === "asc" ? "ascending" : p === "desc" ? "descending" : h.sortable ? "none" : void 0,
2447
+ style: { width: h.width, textAlign: h.align ?? "left" },
2448
+ children: h.sortable && d ? /* @__PURE__ */ g(
2449
+ "button",
2450
+ {
2451
+ type: "button",
2452
+ className: "ui-data-table-sort",
2453
+ onClick: () => d({
2454
+ key: h.key,
2455
+ direction: p === "asc" ? "desc" : "asc"
2456
+ }),
2457
+ children: [
2458
+ h.header,
2459
+ /* @__PURE__ */ n("span", { className: "ui-data-table-sort-icon", "aria-hidden": "true", children: p === "asc" ? "▲" : p === "desc" ? "▼" : "↕" })
2460
+ ]
2461
+ }
2462
+ ) : h.header
2463
+ },
2464
+ h.key
2465
+ );
2466
+ }) }) }),
2467
+ /* @__PURE__ */ n("tbody", { children: r.length === 0 ? /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { className: "ui-data-table-empty", colSpan: t.length, children: u }) }) : r.map((h, p) => /* @__PURE__ */ n(
2468
+ "tr",
2469
+ {
2470
+ className: a ? "is-clickable" : void 0,
2471
+ tabIndex: a ? 0 : void 0,
2472
+ onClick: () => a == null ? void 0 : a(h),
2473
+ onKeyDown: (y) => {
2474
+ a && (y.key === "Enter" || y.key === " ") && (y.preventDefault(), a(h));
2475
+ },
2476
+ children: t.map((y) => /* @__PURE__ */ n("td", { style: { textAlign: y.align ?? "left" }, children: y.render ? y.render(h, p) : String(h[y.key] ?? "") }, y.key))
2477
+ },
2478
+ i(h, p)
2479
+ )) })
2480
+ ] })
2481
+ }
2482
+ );
2483
+ }
2484
+ function $t({
2485
+ open: t,
2486
+ onClose: r,
2487
+ title: i,
2488
+ children: o,
2489
+ footer: e,
2490
+ side: s = "right",
2491
+ width: d = 420,
2492
+ closeLabel: u = "Close",
2493
+ className: a,
2494
+ style: l,
2495
+ bodyClassName: f
2496
+ }) {
2497
+ const [h, p] = L(!1), y = J(), c = B(null);
2498
+ return j(() => {
2499
+ p(!0);
2500
+ }, []), ke({
2501
+ active: t && h,
2502
+ containerRef: c,
2503
+ onEscape: r
2504
+ }), j(() => {
2505
+ if (!t) return;
2506
+ const m = document.body.style.overflow;
2507
+ return document.body.style.overflow = "hidden", () => {
2508
+ document.body.style.overflow = m;
2509
+ };
2510
+ }, [t]), !t || !h ? null : re(
2511
+ /* @__PURE__ */ n("div", { className: "ui-drawer-overlay", onClick: r, children: /* @__PURE__ */ g(
2512
+ "div",
2513
+ {
2514
+ ref: c,
2515
+ role: "dialog",
2516
+ "aria-modal": "true",
2517
+ "aria-labelledby": y,
2518
+ tabIndex: -1,
2519
+ className: ["ui-drawer", `ui-drawer--${s}`, a ?? ""].filter(Boolean).join(" "),
2520
+ style: { width: d, maxWidth: "100vw", ...l },
2521
+ onClick: (m) => m.stopPropagation(),
2522
+ children: [
2523
+ /* @__PURE__ */ g("div", { className: "ui-drawer-header", children: [
2524
+ /* @__PURE__ */ n("div", { id: y, className: "ui-drawer-title", children: i }),
2525
+ /* @__PURE__ */ n(
2526
+ "button",
2527
+ {
2528
+ type: "button",
2529
+ className: "ui-drawer-close",
2530
+ "aria-label": u,
2531
+ onClick: r,
2532
+ children: "×"
2533
+ }
2534
+ )
2535
+ ] }),
2536
+ /* @__PURE__ */ n("div", { className: ["ui-drawer-body", f ?? ""].filter(Boolean).join(" "), children: o }),
2537
+ e && /* @__PURE__ */ n("div", { className: "ui-drawer-footer", children: e })
2538
+ ]
2539
+ }
2540
+ ) }),
2541
+ document.body
2542
+ );
2543
+ }
2544
+ function _e(t) {
2545
+ return t.type !== "separator";
2546
+ }
2547
+ function Rt({
2548
+ trigger: t,
2549
+ items: r,
2550
+ ariaLabel: i,
2551
+ align: o = "start",
2552
+ className: e,
2553
+ style: s
2554
+ }) {
2555
+ const [d, u] = L(!1), a = B(null), l = B(null), f = J(), h = O((c = !0) => {
2556
+ var m;
2557
+ u(!1), c && ((m = a.current) == null || m.focus());
2558
+ }, []);
2559
+ j(() => {
2560
+ var D;
2561
+ if (!d) return;
2562
+ const c = (D = l.current) == null ? void 0 : D.querySelector('[role="menuitem"]:not(:disabled)');
2563
+ c == null || c.focus();
2564
+ const m = (k) => {
2565
+ var S, I;
2566
+ const N = k.target;
2567
+ (S = a.current) != null && S.contains(N) || (I = l.current) != null && I.contains(N) || h(!1);
2568
+ }, b = (k) => {
2569
+ k.key === "Escape" && h();
2570
+ };
2571
+ return document.addEventListener("mousedown", m), document.addEventListener("keydown", b), () => {
2572
+ document.removeEventListener("mousedown", m), document.removeEventListener("keydown", b);
2573
+ };
2574
+ }, [d, h]);
2575
+ const p = (c) => {
2576
+ d || (c.key === "ArrowDown" || c.key === "Enter" || c.key === " ") && (c.preventDefault(), u(!0));
2577
+ }, y = (c) => {
2578
+ var D, k, N, S, I;
2579
+ const m = Array.from(
2580
+ ((D = l.current) == null ? void 0 : D.querySelectorAll('[role="menuitem"]:not(:disabled)')) ?? []
2581
+ );
2582
+ if (!m.length) return;
2583
+ const b = m.indexOf(document.activeElement);
2584
+ c.key === "ArrowDown" ? (c.preventDefault(), (k = m[(b + 1) % m.length]) == null || k.focus()) : c.key === "ArrowUp" ? (c.preventDefault(), (N = m[(b - 1 + m.length) % m.length]) == null || N.focus()) : c.key === "Home" ? (c.preventDefault(), (S = m[0]) == null || S.focus()) : c.key === "End" ? (c.preventDefault(), (I = m[m.length - 1]) == null || I.focus()) : c.key === "Tab" && h(!1);
2585
+ };
2586
+ return /* @__PURE__ */ g("div", { className: ["ui-menu", e ?? ""].filter(Boolean).join(" "), style: s, children: [
2587
+ /* @__PURE__ */ g(
2588
+ "button",
2589
+ {
2590
+ ref: a,
2591
+ type: "button",
2592
+ className: "ui-menu-trigger",
2593
+ "aria-label": i,
2594
+ "aria-haspopup": "menu",
2595
+ "aria-expanded": d,
2596
+ "aria-controls": d ? f : void 0,
2597
+ onClick: () => d ? h() : u(!0),
2598
+ onKeyDown: p,
2599
+ children: [
2600
+ t,
2601
+ /* @__PURE__ */ n("span", { className: "ui-menu-caret", "aria-hidden": "true", children: "▾" })
2602
+ ]
2603
+ }
2604
+ ),
2605
+ d && /* @__PURE__ */ n(
2606
+ "div",
2607
+ {
2608
+ ref: l,
2609
+ id: f,
2610
+ role: "menu",
2611
+ "aria-label": i,
2612
+ className: `ui-menu-list${o === "end" ? " is-end" : ""}`,
2613
+ onKeyDown: y,
2614
+ children: r.map((c, m) => _e(c) ? /* @__PURE__ */ g(
2615
+ "button",
2616
+ {
2617
+ type: "button",
2618
+ role: "menuitem",
2619
+ disabled: c.disabled,
2620
+ className: ["ui-menu-item", c.danger ? "is-danger" : ""].filter(Boolean).join(" "),
2621
+ onClick: () => {
2622
+ var b;
2623
+ c.disabled || ((b = c.onSelect) == null || b.call(c), h());
2624
+ },
2625
+ children: [
2626
+ c.icon && /* @__PURE__ */ n("span", { className: "ui-menu-item-icon", "aria-hidden": "true", children: c.icon }),
2627
+ /* @__PURE__ */ n("span", { children: c.label })
2628
+ ]
2629
+ },
2630
+ c.id
2631
+ ) : /* @__PURE__ */ n(
2632
+ "div",
2633
+ {
2634
+ role: "separator",
2635
+ className: "ui-menu-separator"
2636
+ },
2637
+ c.id ?? `separator-${m}`
2638
+ ))
2639
+ }
2640
+ )
2641
+ ] });
2642
+ }
2643
+ function Lt({
2644
+ title: t,
2645
+ description: r,
2646
+ icon: i,
2647
+ action: o,
2648
+ className: e,
2649
+ style: s
2650
+ }) {
2651
+ return /* @__PURE__ */ g("div", { className: ["ui-empty-state", e ?? ""].filter(Boolean).join(" "), style: s, children: [
2652
+ i && /* @__PURE__ */ n("div", { className: "ui-empty-state-icon", "aria-hidden": "true", children: i }),
2653
+ /* @__PURE__ */ n("div", { className: "ui-empty-state-title", children: t }),
2654
+ r && /* @__PURE__ */ n("div", { className: "ui-empty-state-description", children: r }),
2655
+ o && /* @__PURE__ */ n("div", { className: "ui-empty-state-action", children: o })
2656
+ ] });
2657
+ }
2658
+ function At({
2659
+ onFiles: t,
2660
+ accept: r,
2661
+ multiple: i = !1,
2662
+ disabled: o = !1,
2663
+ label: e = "Drop files here or click to browse",
2664
+ hint: s,
2665
+ className: d,
2666
+ style: u,
2667
+ inputId: a
2668
+ }) {
2669
+ const l = B(null), [f, h] = L(!1), p = (m) => {
2670
+ m != null && m.length && t(Array.from(m));
2671
+ }, y = () => {
2672
+ var m;
2673
+ o || (m = l.current) == null || m.click();
2674
+ }, c = (m) => {
2675
+ m.preventDefault(), h(!1), !o && p(m.dataTransfer.files);
2676
+ };
2677
+ return /* @__PURE__ */ g(ce, { children: [
2678
+ /* @__PURE__ */ n(
2679
+ "input",
2680
+ {
2681
+ ref: l,
2682
+ id: a,
2683
+ type: "file",
2684
+ accept: r,
2685
+ multiple: i,
2686
+ disabled: o,
2687
+ "aria-label": typeof e == "string" ? e : "Upload files",
2688
+ className: "ui-file-upload-input",
2689
+ onChange: (m) => {
2690
+ p(m.target.files), m.target.value = "";
2691
+ }
2692
+ }
2693
+ ),
2694
+ /* @__PURE__ */ g(
2695
+ "div",
2696
+ {
2697
+ className: [
2698
+ "ui-file-upload",
2699
+ f ? "is-dragging" : "",
2700
+ o ? "is-disabled" : "",
2701
+ d ?? ""
2702
+ ].filter(Boolean).join(" "),
2703
+ style: u,
2704
+ role: "button",
2705
+ tabIndex: o ? -1 : 0,
2706
+ "aria-disabled": o || void 0,
2707
+ onClick: y,
2708
+ onKeyDown: (m) => {
2709
+ (m.key === "Enter" || m.key === " ") && (m.preventDefault(), y());
2710
+ },
2711
+ onDragOver: (m) => {
2712
+ m.preventDefault(), o || h(!0);
2713
+ },
2714
+ onDragLeave: () => h(!1),
2715
+ onDrop: c,
2716
+ children: [
2717
+ /* @__PURE__ */ n("div", { className: "ui-file-upload-icon", "aria-hidden": "true", children: "↑" }),
2718
+ /* @__PURE__ */ n("div", { className: "ui-file-upload-label", children: e }),
2719
+ s && /* @__PURE__ */ n("div", { className: "ui-file-upload-hint", children: s })
2720
+ ]
2721
+ }
2722
+ )
2723
+ ] });
2724
+ }
2725
+ function ge(t) {
2726
+ return typeof t == "function";
2727
+ }
2728
+ function jt({
2729
+ label: t,
2730
+ htmlFor: r,
2731
+ id: i,
2732
+ hint: o,
2733
+ error: e,
2734
+ required: s = !1,
2735
+ children: d,
2736
+ className: u,
2737
+ style: a
2738
+ }) {
2739
+ const l = J(), f = !ge(d) && Me(d) ? d : null, h = typeof (f == null ? void 0 : f.props.id) == "string" ? f.props.id : void 0, p = r ?? i ?? h ?? l, y = o ? `${p}-hint` : void 0, c = e ? `${p}-error` : void 0, m = [y, c].filter(Boolean).join(" ") || void 0, b = !!e;
2740
+ let D;
2741
+ if (ge(d))
2742
+ D = d({ id: p, describedBy: m, invalid: b });
2743
+ else if (f) {
2744
+ const k = [f.props["aria-describedby"], m].filter(Boolean).join(" ") || void 0;
2745
+ D = Ee(f, {
2746
+ id: h ?? p,
2747
+ "aria-describedby": k,
2748
+ "aria-invalid": b ? !0 : f.props["aria-invalid"],
2749
+ ...s ? { required: !0 } : {}
2750
+ });
2751
+ } else
2752
+ D = d;
2753
+ return /* @__PURE__ */ g("div", { className: ["ui-form-field", u ?? ""].filter(Boolean).join(" "), style: a, children: [
2754
+ t && /* @__PURE__ */ g("label", { className: "ui-form-label", htmlFor: p, children: [
2755
+ t,
2756
+ s && /* @__PURE__ */ g("span", { className: "ui-form-required", "aria-hidden": "true", children: [
2757
+ " ",
2758
+ "*"
2759
+ ] })
2760
+ ] }),
2761
+ o && /* @__PURE__ */ n("div", { id: y, className: "ui-form-hint", children: o }),
2762
+ D,
2763
+ e && /* @__PURE__ */ n("div", { id: c, className: "ui-form-error", role: "alert", children: e })
2764
+ ] });
2765
+ }
2766
+ function Pt({
2767
+ title: t,
2768
+ subtitle: r,
2769
+ actions: i,
2770
+ onBack: o,
2771
+ backLabel: e = "Back",
2772
+ className: s,
2773
+ style: d
2774
+ }) {
2775
+ return /* @__PURE__ */ g("div", { className: ["ui-page-header", s ?? ""].filter(Boolean).join(" "), style: d, children: [
2776
+ /* @__PURE__ */ g("div", { className: "ui-page-header-main", children: [
2777
+ o && /* @__PURE__ */ n(
2778
+ "button",
2779
+ {
2780
+ type: "button",
2781
+ className: "ui-page-header-back",
2782
+ "aria-label": e,
2783
+ onClick: o,
2784
+ children: "‹"
2785
+ }
2786
+ ),
2787
+ /* @__PURE__ */ g("div", { children: [
2788
+ /* @__PURE__ */ n("h1", { className: "ui-page-header-title", children: t }),
2789
+ r && /* @__PURE__ */ n("p", { className: "ui-page-header-subtitle", children: r })
2790
+ ] })
2791
+ ] }),
2792
+ i && /* @__PURE__ */ n("div", { className: "ui-page-header-actions", children: i })
2793
+ ] });
2794
+ }
2795
+ function Qe({ children: t, container: r }) {
2796
+ const [i, o] = L(!1);
2797
+ return j(() => {
2798
+ o(!0);
2799
+ }, []), !i || typeof document > "u" ? null : re(t, r ?? document.body);
2800
+ }
2801
+ function Wt({
2802
+ value: t,
2803
+ max: r = 100,
2804
+ label: i = "Progress",
2805
+ valueText: o,
2806
+ size: e = "md",
2807
+ className: s,
2808
+ style: d
2809
+ }) {
2810
+ const u = t == null, a = r > 0 ? r : 100, l = u ? 0 : Math.min(a, Math.max(0, t)), f = u ? 0 : l / a * 100;
2811
+ return /* @__PURE__ */ n(
2812
+ "div",
2813
+ {
2814
+ role: "progressbar",
2815
+ "aria-label": i,
2816
+ "aria-valuemin": u ? void 0 : 0,
2817
+ "aria-valuemax": u ? void 0 : a,
2818
+ "aria-valuenow": u ? void 0 : l,
2819
+ "aria-valuetext": o,
2820
+ className: [
2821
+ "ui-progress",
2822
+ `ui-progress--${e}`,
2823
+ u ? "is-indeterminate" : "",
2824
+ s ?? ""
2825
+ ].filter(Boolean).join(" "),
2826
+ style: d,
2827
+ children: /* @__PURE__ */ n(
2828
+ "span",
2829
+ {
2830
+ className: "ui-progress-bar",
2831
+ style: u ? void 0 : { width: `${f}%` }
2832
+ }
2833
+ )
2834
+ }
2835
+ );
2836
+ }
2837
+ const Je = ae(function({
2838
+ size: r = "md",
2839
+ invalid: i = !1,
2840
+ leadingIcon: o,
2841
+ trailingIcon: e,
2842
+ onClear: s,
2843
+ clearLabel: d = "Clear",
2844
+ className: u,
2845
+ wrapperClassName: a,
2846
+ style: l,
2847
+ wrapperStyle: f,
2848
+ disabled: h,
2849
+ value: p,
2850
+ ...y
2851
+ }, c) {
2852
+ const m = !!s && p != null && p !== "";
2853
+ return /* @__PURE__ */ g(
2854
+ "div",
2855
+ {
2856
+ className: [
2857
+ "ui-input-wrap",
2858
+ `ui-input-wrap--${r}`,
2859
+ i ? "is-invalid" : "",
2860
+ h ? "is-disabled" : "",
2861
+ a ?? ""
2862
+ ].filter(Boolean).join(" "),
2863
+ style: f,
2864
+ children: [
2865
+ o && /* @__PURE__ */ n("span", { className: "ui-input-icon", "aria-hidden": "true", children: o }),
2866
+ /* @__PURE__ */ n(
2867
+ "input",
2868
+ {
2869
+ ref: c,
2870
+ className: ["ui-input", u ?? ""].filter(Boolean).join(" "),
2871
+ style: l,
2872
+ value: p,
2873
+ disabled: h,
2874
+ "aria-invalid": i || void 0,
2875
+ ...y
2876
+ }
2877
+ ),
2878
+ e && /* @__PURE__ */ n("span", { className: "ui-input-icon", "aria-hidden": "true", children: e }),
2879
+ m && /* @__PURE__ */ n(
2880
+ "button",
2881
+ {
2882
+ type: "button",
2883
+ className: "ui-input-clear",
2884
+ "aria-label": d,
2885
+ onClick: s,
2886
+ disabled: h,
2887
+ children: "×"
2888
+ }
2889
+ )
2890
+ ]
2891
+ }
2892
+ );
2893
+ });
2894
+ function Ze() {
2895
+ return /* @__PURE__ */ g(
2896
+ "svg",
2897
+ {
2898
+ width: "14",
2899
+ height: "14",
2900
+ viewBox: "0 0 14 14",
2901
+ fill: "none",
2902
+ stroke: "currentColor",
2903
+ strokeWidth: "1.5",
2904
+ strokeLinecap: "round",
2905
+ "aria-hidden": "true",
2906
+ children: [
2907
+ /* @__PURE__ */ n("circle", { cx: "6", cy: "6", r: "4.25" }),
2908
+ /* @__PURE__ */ n("path", { d: "m9.2 9.2 3 3" })
2909
+ ]
2910
+ }
2911
+ );
2912
+ }
2913
+ function Ht({
2914
+ value: t,
2915
+ onChange: r,
2916
+ ariaLabel: i,
2917
+ placeholder: o = "Search",
2918
+ onClear: e,
2919
+ clearLabel: s = "Clear search",
2920
+ disabled: d = !1,
2921
+ className: u,
2922
+ style: a
2923
+ }) {
2924
+ return /* @__PURE__ */ n(
2925
+ Je,
2926
+ {
2927
+ type: "text",
2928
+ value: t,
2929
+ onChange: (l) => r(l.target.value),
2930
+ "aria-label": i,
2931
+ placeholder: o,
2932
+ leadingIcon: /* @__PURE__ */ n(Ze, {}),
2933
+ onClear: t ? e ?? (() => r("")) : void 0,
2934
+ clearLabel: s,
2935
+ disabled: d,
2936
+ className: u,
2937
+ style: a
2938
+ }
2939
+ );
2940
+ }
2941
+ function zt({
2942
+ items: t,
2943
+ value: r,
2944
+ onChange: i,
2945
+ ariaLabel: o,
2946
+ size: e = "md",
2947
+ className: s,
2948
+ style: d
2949
+ }) {
2950
+ const u = B([]), a = (l) => {
2951
+ var c;
2952
+ const f = t.map((m, b) => ({ item: m, index: b })).filter(({ item: m }) => !m.disabled);
2953
+ if (!f.length) return;
2954
+ const h = f.findIndex(({ item: m }) => m.value === r);
2955
+ let p = null;
2956
+ if ((l.key === "ArrowRight" || l.key === "ArrowDown") && (p = (h + 1) % f.length), (l.key === "ArrowLeft" || l.key === "ArrowUp") && (p = (h - 1 + f.length) % f.length), l.key === "Home" && (p = 0), l.key === "End" && (p = f.length - 1), p == null) return;
2957
+ l.preventDefault();
2958
+ const y = f[p];
2959
+ i(y.item.value), (c = u.current[y.index]) == null || c.focus();
2960
+ };
2961
+ return /* @__PURE__ */ n(
2962
+ "div",
2963
+ {
2964
+ role: "radiogroup",
2965
+ "aria-label": o,
2966
+ className: ["ui-segmented", `ui-segmented--${e}`, s ?? ""].filter(Boolean).join(" "),
2967
+ style: d,
2968
+ onKeyDown: a,
2969
+ children: t.map((l, f) => {
2970
+ const h = l.value === r;
2971
+ return /* @__PURE__ */ n(
2972
+ "button",
2973
+ {
2974
+ ref: (p) => {
2975
+ u.current[f] = p;
2976
+ },
2977
+ type: "button",
2978
+ role: "radio",
2979
+ "aria-checked": h,
2980
+ tabIndex: h ? 0 : -1,
2981
+ disabled: l.disabled,
2982
+ className: ["ui-segmented-item", h ? "is-active" : ""].filter(Boolean).join(" "),
2983
+ onClick: () => i(l.value),
2984
+ children: l.label
2985
+ },
2986
+ l.value
2987
+ );
2988
+ })
2989
+ }
2990
+ );
2991
+ }
2992
+ function Ut({
2993
+ value: t,
2994
+ onChange: r,
2995
+ min: i = 0,
2996
+ max: o = 100,
2997
+ step: e = 1,
2998
+ label: s,
2999
+ ariaLabel: d,
3000
+ showValue: u = !0,
3001
+ formatValue: a = (y) => String(y),
3002
+ disabled: l = !1,
3003
+ id: f,
3004
+ className: h,
3005
+ style: p
3006
+ }) {
3007
+ const y = J(), c = f ?? y;
3008
+ return /* @__PURE__ */ g("div", { className: ["ui-slider", h ?? ""].filter(Boolean).join(" "), style: p, children: [
3009
+ (s || u) && /* @__PURE__ */ g("div", { className: "ui-slider-head", children: [
3010
+ s && /* @__PURE__ */ n("label", { htmlFor: c, className: "ui-slider-label", children: s }),
3011
+ u && /* @__PURE__ */ n("span", { className: "ui-slider-value", children: a(t) })
3012
+ ] }),
3013
+ /* @__PURE__ */ n(
3014
+ "input",
3015
+ {
3016
+ id: c,
3017
+ type: "range",
3018
+ className: "ui-slider-input",
3019
+ min: i,
3020
+ max: o,
3021
+ step: e,
3022
+ value: t,
3023
+ disabled: l,
3024
+ "aria-label": d ?? (s ? void 0 : "Slider"),
3025
+ onChange: (m) => r(Number(m.target.value))
3026
+ }
3027
+ )
3028
+ ] });
3029
+ }
3030
+ function Kt({
3031
+ checked: t,
3032
+ onChange: r,
3033
+ label: i,
3034
+ description: o,
3035
+ ariaLabel: e,
3036
+ disabled: s = !1,
3037
+ size: d = "md",
3038
+ id: u,
3039
+ name: a,
3040
+ className: l,
3041
+ style: f
3042
+ }) {
3043
+ const h = J(), p = `${u ?? h}-label`, y = `${u ?? h}-description`, c = !e && i ? p : void 0, m = e ?? "Toggle";
3044
+ return /* @__PURE__ */ g(
3045
+ "div",
3046
+ {
3047
+ className: ["ui-switch-row", s ? "is-disabled" : "", l ?? ""].filter(Boolean).join(" "),
3048
+ style: f,
3049
+ children: [
3050
+ (i || o) && /* @__PURE__ */ g("div", { className: "ui-switch-copy", children: [
3051
+ i && /* @__PURE__ */ n("span", { id: p, className: "ui-switch-label", children: i }),
3052
+ o && /* @__PURE__ */ n("span", { id: y, className: "ui-switch-description", children: o })
3053
+ ] }),
3054
+ /* @__PURE__ */ n(
3055
+ "button",
3056
+ {
3057
+ type: "button",
3058
+ role: "switch",
3059
+ "aria-checked": t,
3060
+ "aria-label": c ? void 0 : m,
3061
+ "aria-labelledby": c,
3062
+ "aria-describedby": o ? y : void 0,
3063
+ disabled: s,
3064
+ name: a,
3065
+ className: ["ui-switch", `ui-switch--${d}`, t ? "is-checked" : ""].filter(Boolean).join(" "),
3066
+ onClick: () => r(!t),
3067
+ children: /* @__PURE__ */ n("span", { className: "ui-switch-thumb", "aria-hidden": "true" })
3068
+ }
3069
+ )
3070
+ ]
3071
+ }
3072
+ );
3073
+ }
3074
+ function Ft({ items: t, value: r, onChange: i, ariaLabel: o, className: e, style: s }) {
3075
+ const d = B([]), u = (a) => {
3076
+ var y;
3077
+ const l = t.map((c, m) => ({ item: c, index: m })).filter(({ item: c }) => !c.disabled);
3078
+ if (!l.length) return;
3079
+ const f = l.findIndex(({ item: c }) => c.id === r);
3080
+ let h = null;
3081
+ if (a.key === "ArrowRight" && (h = (f + 1) % l.length), a.key === "ArrowLeft" && (h = (f - 1 + l.length) % l.length), a.key === "Home" && (h = 0), a.key === "End" && (h = l.length - 1), h == null) return;
3082
+ a.preventDefault();
3083
+ const p = l[h];
3084
+ i(p.item.id), (y = d.current[p.index]) == null || y.focus();
3085
+ };
3086
+ return /* @__PURE__ */ n(
3087
+ "div",
3088
+ {
3089
+ role: "tablist",
3090
+ "aria-label": o,
3091
+ className: ["ui-tabs", e ?? ""].filter(Boolean).join(" "),
3092
+ style: s,
3093
+ onKeyDown: u,
3094
+ children: t.map((a, l) => {
3095
+ const f = a.id === r;
3096
+ return /* @__PURE__ */ n(
3097
+ "button",
3098
+ {
3099
+ ref: (h) => {
3100
+ d.current[l] = h;
3101
+ },
3102
+ type: "button",
3103
+ role: "tab",
3104
+ "aria-selected": f,
3105
+ tabIndex: f ? 0 : -1,
3106
+ disabled: a.disabled,
3107
+ className: ["ui-tab", f ? "is-active" : ""].filter(Boolean).join(" "),
3108
+ onClick: () => i(a.id),
3109
+ children: a.label
3110
+ },
3111
+ a.id
3112
+ );
3113
+ })
3114
+ }
3115
+ );
3116
+ }
3117
+ const Ot = ae(function({ invalid: r = !1, className: i, ...o }, e) {
3118
+ return /* @__PURE__ */ n(
3119
+ "textarea",
3120
+ {
3121
+ ref: e,
3122
+ className: ["ui-textarea", i ?? ""].filter(Boolean).join(" "),
3123
+ "aria-invalid": r || void 0,
3124
+ ...o
3125
+ }
3126
+ );
3127
+ }), Ce = Be(null);
3128
+ function Yt() {
3129
+ const t = Ie(Ce);
3130
+ if (!t) throw new Error("useToast must be used inside a ToastProvider");
3131
+ return t;
3132
+ }
3133
+ function et({ toast: t, onDismiss: r }) {
3134
+ const i = B(r);
3135
+ return i.current = r, j(() => {
3136
+ const o = t.duration ?? 4e3;
3137
+ if (o <= 0) return;
3138
+ const e = setTimeout(() => i.current(), o);
3139
+ return () => clearTimeout(e);
3140
+ }, [t.duration]), /* @__PURE__ */ g("div", { className: `ui-toast ui-toast--${t.tone ?? "info"}`, role: "status", children: [
3141
+ /* @__PURE__ */ g("div", { className: "ui-toast-content", children: [
3142
+ t.title && /* @__PURE__ */ n("div", { className: "ui-toast-title", children: t.title }),
3143
+ t.description && /* @__PURE__ */ n("div", { className: "ui-toast-description", children: t.description })
3144
+ ] }),
3145
+ /* @__PURE__ */ n("button", { type: "button", className: "ui-toast-close", "aria-label": "Dismiss", onClick: r, children: "×" })
3146
+ ] });
3147
+ }
3148
+ function Xt({
3149
+ children: t,
3150
+ position: r = "bottom-right",
3151
+ maxToasts: i = 4
3152
+ }) {
3153
+ const [o, e] = L([]), s = B(0), d = O((a) => {
3154
+ e((l) => l.filter((f) => f.id !== a));
3155
+ }, []), u = O(
3156
+ (a) => {
3157
+ const l = `toast-${++s.current}`, f = Math.max(1, i);
3158
+ return e((h) => [...h, { ...a, id: l }].slice(-f)), l;
3159
+ },
3160
+ [i]
3161
+ );
3162
+ return /* @__PURE__ */ g(Ce.Provider, { value: { showToast: u, dismissToast: d }, children: [
3163
+ t,
3164
+ /* @__PURE__ */ n(Qe, { children: /* @__PURE__ */ n(
3165
+ "div",
3166
+ {
3167
+ className: `ui-toast-viewport ui-toast-viewport--${r}`,
3168
+ "aria-live": "polite",
3169
+ "aria-label": "Notifications",
3170
+ children: o.map((a) => /* @__PURE__ */ n(et, { toast: a, onDismiss: () => d(a.id) }, a.id))
3171
+ }
3172
+ ) })
3173
+ ] });
3174
+ }
3175
+ function qt({
3176
+ children: t,
3177
+ className: r,
3178
+ style: i,
3179
+ ...o
3180
+ }) {
3181
+ return /* @__PURE__ */ n(
3182
+ "span",
3183
+ {
3184
+ className: ["ui-visually-hidden", r ?? ""].filter(Boolean).join(" "),
3185
+ style: i,
3186
+ ...o,
3187
+ children: t
3188
+ }
3189
+ );
3190
+ }
3191
+ export {
3192
+ Ct as Alert,
3193
+ it as Avatar,
3194
+ Dt as Badge,
3195
+ Xe as Button,
3196
+ qe as Card,
3197
+ Ve as CardBody,
3198
+ Et as CardFooter,
3199
+ Ge as CardHeader,
3200
+ ot as Checkbox,
3201
+ St as Chip,
3202
+ at as ColorPicker,
3203
+ Bt as Combobox,
3204
+ dt as ConfirmModal,
3205
+ lt as CopyValue,
3206
+ Tt as DataTable,
3207
+ ct as DatePicker,
3208
+ Nt as DetailRowsSkeleton,
3209
+ $t as Drawer,
3210
+ Fe as Dropdown,
3211
+ Rt as DropdownMenu,
3212
+ At as Dropzone,
3213
+ Lt as EmptyState,
3214
+ At as FileUpload,
3215
+ jt as FormField,
3216
+ Mt as IconButton,
3217
+ st as InlineEditorCard,
3218
+ ft as ListCard,
3219
+ kt as ListCardSkeleton,
3220
+ mt as ListEmptyState,
3221
+ ht as ListRow,
3222
+ ut as ListScreen,
3223
+ pt as ListSearch,
3224
+ Rt as Menu,
3225
+ Ue as Modal,
3226
+ vt as MonthSelector,
3227
+ Re as NumberStepper,
3228
+ Pt as PageHeader,
3229
+ wt as PageHeaderSkeleton,
3230
+ bt as PageSkeleton,
3231
+ Qe as Portal,
3232
+ Wt as ProgressBar,
3233
+ gt as Radio,
3234
+ yt as RowActions,
3235
+ Ht as SearchInput,
3236
+ xt as SearchSkeleton,
3237
+ It as Section,
3238
+ zt as SegmentedControl,
3239
+ $t as Sheet,
3240
+ K as Skeleton,
3241
+ Oe as SkeletonStatus,
3242
+ Ut as Slider,
3243
+ Ye as Spinner,
3244
+ Kt as Switch,
3245
+ Ft as Tabs,
3246
+ Je as TextInput,
3247
+ Ot as Textarea,
3248
+ Xt as ToastProvider,
3249
+ Ne as Tooltip,
3250
+ qt as VisuallyHidden,
3251
+ Yt as useToast
3252
+ };
3253
+ //# sourceMappingURL=index.js.map