@craftzbay/ui 0.11.3 → 0.11.4

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 (163) hide show
  1. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist-lib/components/ui/Accordion.js +42 -67
  3. package/dist-lib/components/ui/Accordion.js.map +1 -1
  4. package/dist-lib/components/ui/Alert.js +71 -77
  5. package/dist-lib/components/ui/Alert.js.map +1 -1
  6. package/dist-lib/components/ui/Avatar.js +67 -92
  7. package/dist-lib/components/ui/Avatar.js.map +1 -1
  8. package/dist-lib/components/ui/Badge.js +119 -74
  9. package/dist-lib/components/ui/Badge.js.map +1 -1
  10. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  11. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  12. package/dist-lib/components/ui/Button.js +129 -131
  13. package/dist-lib/components/ui/Button.js.map +1 -1
  14. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  15. package/dist-lib/components/ui/Calendar.js +99 -136
  16. package/dist-lib/components/ui/Calendar.js.map +1 -1
  17. package/dist-lib/components/ui/Card.js +88 -94
  18. package/dist-lib/components/ui/Card.js.map +1 -1
  19. package/dist-lib/components/ui/Carousel.js +125 -170
  20. package/dist-lib/components/ui/Carousel.js.map +1 -1
  21. package/dist-lib/components/ui/Chart.d.ts +3 -3
  22. package/dist-lib/components/ui/Chart.js +435 -464
  23. package/dist-lib/components/ui/Chart.js.map +1 -1
  24. package/dist-lib/components/ui/Checkbox.js +60 -69
  25. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  26. package/dist-lib/components/ui/Combobox.js +179 -192
  27. package/dist-lib/components/ui/Combobox.js.map +1 -1
  28. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  29. package/dist-lib/components/ui/CommandPalette.js +106 -167
  30. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  31. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  32. package/dist-lib/components/ui/ContextMenu.js +89 -154
  33. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  34. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  35. package/dist-lib/components/ui/DataGrid.js +99 -96
  36. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  37. package/dist-lib/components/ui/DatePicker.js +151 -188
  38. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  39. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  41. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  42. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  43. package/dist-lib/components/ui/Dialog.js +108 -156
  44. package/dist-lib/components/ui/Dialog.js.map +1 -1
  45. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  46. package/dist-lib/components/ui/Drawer.js +90 -124
  47. package/dist-lib/components/ui/Drawer.js.map +1 -1
  48. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  50. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  51. package/dist-lib/components/ui/EmptyState.js +31 -44
  52. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  53. package/dist-lib/components/ui/ErrorState.js +57 -67
  54. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  55. package/dist-lib/components/ui/FileUpload.js +113 -107
  56. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  57. package/dist-lib/components/ui/Form.d.ts +6 -4
  58. package/dist-lib/components/ui/Form.js +117 -122
  59. package/dist-lib/components/ui/Form.js.map +1 -1
  60. package/dist-lib/components/ui/Icon.d.ts +1 -1
  61. package/dist-lib/components/ui/Icon.js +30 -29
  62. package/dist-lib/components/ui/Icon.js.map +1 -1
  63. package/dist-lib/components/ui/IconButton.js +61 -63
  64. package/dist-lib/components/ui/IconButton.js.map +1 -1
  65. package/dist-lib/components/ui/Input.js +133 -156
  66. package/dist-lib/components/ui/Input.js.map +1 -1
  67. package/dist-lib/components/ui/Kbd.js +14 -21
  68. package/dist-lib/components/ui/Kbd.js.map +1 -1
  69. package/dist-lib/components/ui/MultiSelect.js +176 -208
  70. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  71. package/dist-lib/components/ui/Pagination.js +152 -149
  72. package/dist-lib/components/ui/Pagination.js.map +1 -1
  73. package/dist-lib/components/ui/Popover.js +18 -33
  74. package/dist-lib/components/ui/Popover.js.map +1 -1
  75. package/dist-lib/components/ui/Progress.js +77 -99
  76. package/dist-lib/components/ui/Progress.js.map +1 -1
  77. package/dist-lib/components/ui/RadioGroup.js +51 -80
  78. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  79. package/dist-lib/components/ui/RelativeTime.js +22 -29
  80. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  81. package/dist-lib/components/ui/ScrollArea.js +39 -58
  82. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  83. package/dist-lib/components/ui/Select.js +108 -131
  84. package/dist-lib/components/ui/Select.js.map +1 -1
  85. package/dist-lib/components/ui/Separator.js +18 -24
  86. package/dist-lib/components/ui/Separator.js.map +1 -1
  87. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  88. package/dist-lib/components/ui/Sheet.js +77 -129
  89. package/dist-lib/components/ui/Sheet.js.map +1 -1
  90. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  91. package/dist-lib/components/ui/Sidebar.js +168 -207
  92. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  93. package/dist-lib/components/ui/Skeleton.js +17 -27
  94. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  95. package/dist-lib/components/ui/Slider.js +45 -62
  96. package/dist-lib/components/ui/Slider.js.map +1 -1
  97. package/dist-lib/components/ui/Snackbar.js +75 -55
  98. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  99. package/dist-lib/components/ui/Spinner.js +45 -52
  100. package/dist-lib/components/ui/Spinner.js.map +1 -1
  101. package/dist-lib/components/ui/Stepper.js +56 -108
  102. package/dist-lib/components/ui/Stepper.js.map +1 -1
  103. package/dist-lib/components/ui/Switch.js +46 -79
  104. package/dist-lib/components/ui/Switch.js.map +1 -1
  105. package/dist-lib/components/ui/Table.js +108 -169
  106. package/dist-lib/components/ui/Table.js.map +1 -1
  107. package/dist-lib/components/ui/Tabs.js +57 -88
  108. package/dist-lib/components/ui/Tabs.js.map +1 -1
  109. package/dist-lib/components/ui/TagInput.js +76 -109
  110. package/dist-lib/components/ui/TagInput.js.map +1 -1
  111. package/dist-lib/components/ui/Textarea.js +74 -86
  112. package/dist-lib/components/ui/Textarea.js.map +1 -1
  113. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  114. package/dist-lib/components/ui/Timeline.js +61 -49
  115. package/dist-lib/components/ui/Timeline.js.map +1 -1
  116. package/dist-lib/components/ui/Toast.d.ts +1 -1
  117. package/dist-lib/components/ui/Toast.js +136 -150
  118. package/dist-lib/components/ui/Toast.js.map +1 -1
  119. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  120. package/dist-lib/components/ui/Tooltip.js +35 -56
  121. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  122. package/dist-lib/components/ui/TopNav.js +46 -66
  123. package/dist-lib/components/ui/TopNav.js.map +1 -1
  124. package/dist-lib/components/ui/Tree.js +134 -168
  125. package/dist-lib/components/ui/Tree.js.map +1 -1
  126. package/dist-lib/hooks/use-debounce.js +27 -33
  127. package/dist-lib/hooks/use-debounce.js.map +1 -1
  128. package/dist-lib/hooks/use-delayed-loading.js +19 -18
  129. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  130. package/dist-lib/hooks/use-field-ids.js +14 -16
  131. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  132. package/dist-lib/hooks/use-media-query.js +15 -19
  133. package/dist-lib/hooks/use-media-query.js.map +1 -1
  134. package/dist-lib/hooks/use-modifier-key.js +20 -15
  135. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  136. package/dist-lib/hooks/use-strings.js +10 -10
  137. package/dist-lib/hooks/use-strings.js.map +1 -1
  138. package/dist-lib/hooks/use-toast.js +73 -62
  139. package/dist-lib/hooks/use-toast.js.map +1 -1
  140. package/dist-lib/icon.js +2 -6
  141. package/dist-lib/icons/index.js +166 -163
  142. package/dist-lib/icons/index.js.map +1 -1
  143. package/dist-lib/illustrations/index.d.ts +7 -7
  144. package/dist-lib/illustrations/index.js +255 -106
  145. package/dist-lib/illustrations/index.js.map +1 -1
  146. package/dist-lib/index.js +69 -291
  147. package/dist-lib/lib/cva.js +2 -0
  148. package/dist-lib/lib/format.js +71 -87
  149. package/dist-lib/lib/format.js.map +1 -1
  150. package/dist-lib/lib/return-focus.js +11 -11
  151. package/dist-lib/lib/return-focus.js.map +1 -1
  152. package/dist-lib/lib/strings.js +167 -135
  153. package/dist-lib/lib/strings.js.map +1 -1
  154. package/dist-lib/lib/strings.mn.js +150 -113
  155. package/dist-lib/lib/strings.mn.js.map +1 -1
  156. package/dist-lib/lib/utils.js +9 -9
  157. package/dist-lib/lib/utils.js.map +1 -1
  158. package/dist-lib/styles.css +3 -1
  159. package/package.json +50 -50
  160. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  161. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  162. package/dist-lib/icon.js.map +0 -1
  163. package/dist-lib/index.js.map +0 -1
@@ -1,487 +1,458 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as $, Fragment as U } from "react/jsx-runtime";
3
- import { useId as oe, useState as K, useRef as ae, useCallback as se, useEffect as ie, useLayoutEffect as ce } from "react";
4
- import { cn as w } from "../../lib/utils.js";
5
- import { useStrings as X } from "../../hooks/use-strings.js";
6
- import { formatString as z } from "../../lib/strings.js";
7
- import { Skeleton as le } from "./Skeleton.js";
8
- const Ie = {
9
- summary: ({ name: e, count: n, min: r, max: t, lastX: o, lastY: a }) => `${e}: ${n} points, min ${r}, max ${t}, last ${o}: ${a}`,
10
- point: (e, n, r) => `${e ? `${e} — ` : ""}${n}: ${r}`,
11
- series: (e, n) => `${e}, ${n} points. Use arrow keys to move between points.`
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { formatString as t } from "../../lib/strings.js";
4
+ import { useStrings as n } from "../../hooks/use-strings.js";
5
+ import { Skeleton as r } from "./Skeleton.js";
6
+ import { useCallback as i, useEffect as a, useId as o, useLayoutEffect as s, useRef as c, useState as l } from "react";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ //#region src/components/ui/Chart.tsx
9
+ var p = {
10
+ summary: ({ name: e, count: t, min: n, max: r, lastX: i, lastY: a }) => `${e}: ${t} points, min ${n}, max ${r}, last ${i}: ${a}`,
11
+ point: (e, t, n) => `${e ? `${e} — ` : ""}${t}: ${n}`,
12
+ series: (e, t) => `${e}, ${t} points. Use arrow keys to move between points.`
12
13
  };
13
- function V(e) {
14
- return {
15
- summary: ({ name: n, count: r, min: t, max: o, lastX: a, lastY: i }) => z(e.summary, { name: n, count: r, min: t, max: o, x: a, y: i }),
16
- point: (n, r, t) => (n ? `${n} — ` : "") + z(e.point, { x: r, y: t }),
17
- series: (n, r) => z(e.seriesNav, { name: n, count: r })
18
- };
14
+ function m(e) {
15
+ return {
16
+ summary: ({ name: n, count: r, min: i, max: a, lastX: o, lastY: s }) => t(e.summary, {
17
+ name: n,
18
+ count: r,
19
+ min: i,
20
+ max: a,
21
+ x: o,
22
+ y: s
23
+ }),
24
+ point: (n, r, i) => (n ? `${n} — ` : "") + t(e.point, {
25
+ x: r,
26
+ y: i
27
+ }),
28
+ series: (n, r) => t(e.seriesNav, {
29
+ name: n,
30
+ count: r
31
+ })
32
+ };
19
33
  }
20
- const q = [
21
- "var(--chart-1)",
22
- "var(--chart-2)",
23
- "var(--chart-3)",
24
- "var(--chart-4)",
25
- "var(--chart-5)",
26
- "var(--chart-6)"
27
- ], de = 600, S = 6;
28
- function ue() {
29
- const e = ae(null), [n, r] = K(0);
30
- return (typeof window > "u" ? ie : ce)(() => {
31
- const o = e.current;
32
- if (!o) return;
33
- const a = () => r(o.clientWidth);
34
- if (a(), typeof ResizeObserver > "u") return;
35
- const i = new ResizeObserver(a);
36
- return i.observe(o), () => i.disconnect();
37
- }, []), { ref: e, width: n || de };
34
+ var h = [
35
+ "var(--chart-1)",
36
+ "var(--chart-2)",
37
+ "var(--chart-3)",
38
+ "var(--chart-4)",
39
+ "var(--chart-5)",
40
+ "var(--chart-6)"
41
+ ], g = 600, _ = 6;
42
+ function v() {
43
+ let e = c(null), [t, n] = l(0);
44
+ return (typeof window > "u" ? a : s)(() => {
45
+ let t = e.current;
46
+ if (!t) return;
47
+ let r = () => n(t.clientWidth);
48
+ if (r(), typeof ResizeObserver > "u") return;
49
+ let i = new ResizeObserver(r);
50
+ return i.observe(t), () => i.disconnect();
51
+ }, []), {
52
+ ref: e,
53
+ width: t || g
54
+ };
38
55
  }
39
- const he = 5;
40
- function fe(e) {
41
- const n = Math.abs(e), r = (t, o) => `${(Math.round(t * 10) / 10).toString()}${o}`;
42
- return n >= 1e9 ? r(e / 1e9, "B") : n >= 1e6 ? r(e / 1e6, "M") : n >= 1e3 ? r(e / 1e3, "K") : Number.isInteger(e) ? String(e) : (Math.round(e * 100) / 100).toString();
56
+ var y = 5;
57
+ function b(e) {
58
+ let t = Math.abs(e), n = (e, t) => `${(Math.round(e * 10) / 10).toString()}${t}`;
59
+ return t >= 1e9 ? n(e / 1e9, "B") : t >= 1e6 ? n(e / 1e6, "M") : t >= 1e3 ? n(e / 1e3, "K") : Number.isInteger(e) ? String(e) : (Math.round(e * 100) / 100).toString();
43
60
  }
44
- function me(e) {
45
- if (e <= 0) return 1;
46
- const r = 10 ** Math.floor(Math.log10(e)), t = e / r;
47
- return (t <= 1 ? 1 : t <= 2 ? 2 : t <= 2.5 ? 2.5 : t <= 5 ? 5 : 10) * r;
61
+ function x(e) {
62
+ if (e <= 0) return 1;
63
+ let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
64
+ return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 2.5 ? 2.5 : n <= 5 ? 5 : 10) * t;
48
65
  }
49
- function xe(e, n, r = he) {
50
- n === e && (n = e + 1);
51
- const t = me((n - e) / Math.max(1, r - 1)), o = Math.floor(e / t) * t, a = Math.ceil(n / t) * t, i = [];
52
- for (let c = a; c >= o - t / 2; c -= t) i.push(Number(c.toFixed(10)));
53
- return { min: o, max: a, ticks: i };
66
+ function S(e, t, n = y) {
67
+ t === e && (t = e + 1);
68
+ let r = x((t - e) / Math.max(1, n - 1)), i = Math.floor(e / r) * r, a = Math.ceil(t / r) * r, o = [];
69
+ for (let e = a; e >= i - r / 2; e -= r) o.push(Number(e.toFixed(10)));
70
+ return {
71
+ min: i,
72
+ max: a,
73
+ ticks: o
74
+ };
54
75
  }
55
- function J(e, n) {
56
- return n && n.length ? n : [{ data: e ?? [] }];
76
+ function C(e, t) {
77
+ return t && t.length ? t : [{ data: e ?? [] }];
57
78
  }
58
- const k = (e) => typeof e == "number";
59
- function Q(e, n = !0) {
60
- const r = e.flatMap((f) => f.data.map((u) => u.y).filter(k)), t = n ? Math.min(0, ...r) : Math.min(...r), o = Math.max(...r, n ? 1 : -1 / 0), { min: a, max: i, ticks: c } = xe(
61
- Number.isFinite(t) ? t : 0,
62
- o === -1 / 0 ? 1 : o
63
- );
64
- return { min: a, max: i, range: i - a || 1, ticks: c };
79
+ var w = (e) => typeof e == "number";
80
+ function T(e, t = !0) {
81
+ let n = e.flatMap((e) => e.data.map((e) => e.y).filter(w)), r = t ? Math.min(0, ...n) : Math.min(...n), i = Math.max(...n, t ? 1 : -Infinity), { min: a, max: o, ticks: s } = S(Number.isFinite(r) ? r : 0, i === -Infinity ? 1 : i);
82
+ return {
83
+ min: a,
84
+ max: o,
85
+ range: o - a || 1,
86
+ ticks: s
87
+ };
65
88
  }
66
- function Z(e, n, r, t, o) {
67
- const a = n - S * 2, i = r - S * 2;
68
- return { sx: (u) => e <= 1 ? S + a / 2 : S + u / (e - 1) * a, sy: (u) => S + i - (u - t) / o * i };
89
+ function E(e, t, n, r, i) {
90
+ let a = t - 12, o = n - 12;
91
+ return {
92
+ sx: (t) => e <= 1 ? _ + a / 2 : _ + t / (e - 1) * a,
93
+ sy: (e) => _ + o - (e - r) / i * o
94
+ };
69
95
  }
70
- function G(e) {
71
- if (e.length === 0) return "";
72
- if (e.length < 3) return e.map((r, t) => `${t ? "L" : "M"}${r[0]},${r[1]}`).join(" ");
73
- let n = `M${e[0][0]},${e[0][1]}`;
74
- for (let r = 0; r < e.length - 1; r++) {
75
- const t = e[r - 1] ?? e[r], o = e[r], a = e[r + 1], i = e[r + 2] ?? a, c = o[0] + (a[0] - t[0]) / 6, f = o[1] + (a[1] - t[1]) / 6, u = a[0] - (i[0] - o[0]) / 6, l = a[1] - (i[1] - o[1]) / 6;
76
- n += ` C${c.toFixed(1)},${f.toFixed(1)} ${u.toFixed(1)},${l.toFixed(1)} ${a[0].toFixed(1)},${a[1].toFixed(1)}`;
77
- }
78
- return n;
96
+ function D(e) {
97
+ if (e.length === 0) return "";
98
+ if (e.length < 3) return e.map((e, t) => `${t ? "L" : "M"}${e[0]},${e[1]}`).join(" ");
99
+ let t = `M${e[0][0]},${e[0][1]}`;
100
+ for (let n = 0; n < e.length - 1; n++) {
101
+ let r = e[n - 1] ?? e[n], i = e[n], a = e[n + 1], o = e[n + 2] ?? a, s = i[0] + (a[0] - r[0]) / 6, c = i[1] + (a[1] - r[1]) / 6, l = a[0] - (o[0] - i[0]) / 6, u = a[1] - (o[1] - i[1]) / 6;
102
+ t += ` C${s.toFixed(1)},${c.toFixed(1)} ${l.toFixed(1)},${u.toFixed(1)} ${a[0].toFixed(1)},${a[1].toFixed(1)}`;
103
+ }
104
+ return t;
79
105
  }
80
- function pe(e, n, r) {
81
- const t = [];
82
- let o = [];
83
- return e.forEach((a, i) => {
84
- k(a.y) ? o.push([n(i), r(a.y)]) : o.length && (t.push(o), o = []);
85
- }), o.length && t.push(o), t;
106
+ function O(e, t, n) {
107
+ let r = [], i = [];
108
+ return e.forEach((e, a) => {
109
+ w(e.y) ? i.push([t(a), n(e.y)]) : i.length && (r.push(i), i = []);
110
+ }), i.length && r.push(i), r;
86
111
  }
87
- const Y = (e, n, r) => e.name ?? z(r.series, { n: n + 1 });
88
- function ye(e, n, r) {
89
- return e.map((t, o) => {
90
- const a = t.data.map((f) => f.y).filter(k), i = Y(t, o, n);
91
- if (!a.length) return `${i}: ${n.noData}`;
92
- const c = [...t.data].reverse().find((f) => k(f.y));
93
- return r.summary({
94
- name: i,
95
- count: a.length,
96
- min: Math.min(...a),
97
- max: Math.max(...a),
98
- lastX: c == null ? void 0 : c.x,
99
- lastY: (c == null ? void 0 : c.y) ?? void 0
100
- });
101
- }).join(". ");
112
+ var k = (e, n, r) => e.name ?? t(r.series, { n: n + 1 });
113
+ function A(e, t, n) {
114
+ return e.map((e, r) => {
115
+ let i = e.data.map((e) => e.y).filter(w), a = k(e, r, t);
116
+ if (!i.length) return `${a}: ${t.noData}`;
117
+ let o = [...e.data].reverse().find((e) => w(e.y));
118
+ return n.summary({
119
+ name: a,
120
+ count: i.length,
121
+ min: Math.min(...i),
122
+ max: Math.max(...i),
123
+ lastX: o?.x,
124
+ lastY: o?.y ?? void 0
125
+ });
126
+ }).join(". ");
102
127
  }
103
- function ee({ width: e, height: n, lines: r }) {
104
- const t = n - S * 2, o = Math.max(1, r);
105
- return /* @__PURE__ */ s("g", { "aria-hidden": !0, children: Array.from({ length: o + 1 }, (a, i) => {
106
- const c = S + i / o * t;
107
- return /* @__PURE__ */ s(
108
- "line",
109
- {
110
- x1: 0,
111
- x2: e,
112
- y1: c,
113
- y2: c,
114
- stroke: "var(--color-border)",
115
- strokeWidth: 1,
116
- opacity: 0.6
117
- },
118
- i
119
- );
120
- }) });
128
+ function j({ width: e, height: t, lines: n }) {
129
+ let r = t - 12, i = Math.max(1, n);
130
+ return /* @__PURE__ */ d("g", {
131
+ "aria-hidden": !0,
132
+ children: Array.from({ length: i + 1 }, (t, n) => {
133
+ let a = _ + n / i * r;
134
+ return /* @__PURE__ */ d("line", {
135
+ x1: 0,
136
+ x2: e,
137
+ y1: a,
138
+ y2: a,
139
+ stroke: "var(--color-border)",
140
+ strokeWidth: 1,
141
+ opacity: .6
142
+ }, n);
143
+ })
144
+ });
121
145
  }
122
- function ge({ ticks: e }) {
123
- return /* @__PURE__ */ s(
124
- "div",
125
- {
126
- "aria-hidden": !0,
127
- className: "tabular text-foreground-subtle pointer-events-none flex shrink-0 flex-col justify-between py-1.5 pr-1.5 text-right text-xs",
128
- children: e.map((n, r) => /* @__PURE__ */ s("span", { className: "leading-none", children: fe(n) }, r))
129
- }
130
- );
146
+ function M({ ticks: e }) {
147
+ return /* @__PURE__ */ d("div", {
148
+ "aria-hidden": !0,
149
+ className: "tabular text-foreground-subtle pointer-events-none flex shrink-0 flex-col justify-between py-1.5 pr-1.5 text-right text-xs",
150
+ children: e.map((e, t) => /* @__PURE__ */ d("span", {
151
+ className: "leading-none",
152
+ children: b(e)
153
+ }, t))
154
+ });
131
155
  }
132
- function be({ first: e, last: n }) {
133
- return e ? /* @__PURE__ */ $("div", { "aria-hidden": !0, className: "text-foreground-subtle flex justify-between text-xs", children: [
134
- /* @__PURE__ */ s("span", { children: String(e.x) }),
135
- n && n !== e && /* @__PURE__ */ s("span", { children: String(n.x) })
136
- ] }) : null;
156
+ function N({ first: e, last: t }) {
157
+ return e ? /* @__PURE__ */ f("div", {
158
+ "aria-hidden": !0,
159
+ className: "text-foreground-subtle flex justify-between text-xs",
160
+ children: [/* @__PURE__ */ d("span", { children: String(e.x) }), t && t !== e && /* @__PURE__ */ d("span", { children: String(t.x) })]
161
+ }) : null;
137
162
  }
138
- function ve({
139
- id: e,
140
- all: n,
141
- name: r,
142
- visible: t,
143
- t: o
144
- }) {
145
- var f;
146
- const a = Math.max(...n.map((u) => u.data.length)), i = ((f = n.find((u) => u.data.length === a)) == null ? void 0 : f.data) ?? [], c = /* @__PURE__ */ $(
147
- "table",
148
- {
149
- id: e,
150
- "data-chart-table": !0,
151
- className: w(t && "tabular text-foreground-muted mt-2 w-full text-left text-xs"),
152
- children: [
153
- /* @__PURE__ */ s("caption", { className: w(t && "text-foreground-subtle pb-1 text-left"), children: z(o.tableCaption, { name: r ?? "" }).trim() }),
154
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ $("tr", { children: [
155
- /* @__PURE__ */ s("th", { scope: "col", className: w(t && "border-border border-b py-1 pr-3 font-medium"), children: "x" }),
156
- n.map((u, l) => /* @__PURE__ */ s(
157
- "th",
158
- {
159
- scope: "col",
160
- className: w(t && "border-border border-b py-1 pr-3 font-medium"),
161
- children: Y(u, l, o)
162
- },
163
- l
164
- ))
165
- ] }) }),
166
- /* @__PURE__ */ s("tbody", { children: i.map((u, l) => /* @__PURE__ */ $("tr", { children: [
167
- /* @__PURE__ */ s("th", { scope: "row", className: w(t && "py-0.5 pr-3 font-normal"), children: String(u.x) }),
168
- n.map((d, m) => {
169
- var h, y;
170
- return /* @__PURE__ */ s("td", { className: w(t && "py-0.5 pr-3"), children: k((h = d.data[l]) == null ? void 0 : h.y) ? String((y = d.data[l]) == null ? void 0 : y.y) : "—" }, m);
171
- })
172
- ] }, l)) })
173
- ]
174
- }
175
- );
176
- return t ? c : /* @__PURE__ */ s("div", { className: "sr-only", children: c });
163
+ function P({ id: n, all: r, name: i, visible: a, t: o }) {
164
+ let s = Math.max(...r.map((e) => e.data.length)), c = r.find((e) => e.data.length === s)?.data ?? [], l = /* @__PURE__ */ f("table", {
165
+ id: n,
166
+ "data-chart-table": !0,
167
+ className: e(a && "tabular text-foreground-muted mt-2 w-full text-left text-xs"),
168
+ children: [
169
+ /* @__PURE__ */ d("caption", {
170
+ className: e(a && "text-foreground-subtle pb-1 text-left"),
171
+ children: t(o.tableCaption, { name: i ?? "" }).trim()
172
+ }),
173
+ /* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
174
+ scope: "col",
175
+ className: e(a && "border-border border-b py-1 pr-3 font-medium"),
176
+ children: "x"
177
+ }), r.map((t, n) => /* @__PURE__ */ d("th", {
178
+ scope: "col",
179
+ className: e(a && "border-border border-b py-1 pr-3 font-medium"),
180
+ children: k(t, n, o)
181
+ }, n))] }) }),
182
+ /* @__PURE__ */ d("tbody", { children: c.map((t, n) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
183
+ scope: "row",
184
+ className: e(a && "py-0.5 pr-3 font-normal"),
185
+ children: String(t.x)
186
+ }), r.map((t, r) => /* @__PURE__ */ d("td", {
187
+ className: e(a && "py-0.5 pr-3"),
188
+ children: w(t.data[n]?.y) ? String(t.data[n]?.y) : "—"
189
+ }, r))] }, n)) })
190
+ ]
191
+ });
192
+ return a ? l : /* @__PURE__ */ d("div", {
193
+ className: "sr-only",
194
+ children: l
195
+ });
177
196
  }
178
- function te({
179
- caption: e,
180
- ariaLabel: n,
181
- title: r,
182
- all: t,
183
- height: o,
184
- width: a,
185
- className: i,
186
- showAxis: c,
187
- ticks: f,
188
- xFirst: u,
189
- xLast: l,
190
- tableFallback: d,
191
- showTableToggle: m,
192
- state: h,
193
- labels: y,
194
- children: E
195
- }) {
196
- const g = X().chart, x = oe().replace(/:/g, ""), I = `chart-cap-${x}`, F = `chart-title-${x}`, C = `chart-desc-${x}`, O = `chart-table-${x}`, v = n ?? r, [p, M] = K(!1), { ref: P, width: A } = ue(), N = $e(t, g, y);
197
- process.env.NODE_ENV !== "production" && !v && !e && console.warn(
198
- "[craftzbay/ui] Chart: provide `caption`, `aria-label`, or `title` so the chart has an accessible name."
199
- );
200
- const L = (d || p) && !h, R = h === "loading" ? /* @__PURE__ */ $("div", { role: "status", "aria-label": g.loading, style: { height: o }, className: "w-full", children: [
201
- /* @__PURE__ */ s(le, { style: { height: o }, className: "w-full" }),
202
- /* @__PURE__ */ s("span", { className: "sr-only", children: g.loading })
203
- ] }) : h ? /* @__PURE__ */ s(
204
- "div",
205
- {
206
- role: h === "error" ? "alert" : "status",
207
- style: { height: o },
208
- className: "text-foreground-subtle flex w-full items-center justify-center text-sm",
209
- children: h === "error" ? g.error : g.empty
210
- }
211
- ) : null;
212
- return /* @__PURE__ */ $("figure", { className: w("flex flex-col gap-1.5", i), style: { width: a }, children: [
213
- e && /* @__PURE__ */ s("figcaption", { id: I, className: "text-foreground-muted text-xs", children: e }),
214
- R ?? /* @__PURE__ */ $(U, { children: [
215
- /* @__PURE__ */ $("div", { className: "flex", children: [
216
- c && /* @__PURE__ */ s(ge, { ticks: f }),
217
- /* @__PURE__ */ s("div", { ref: P, className: "min-w-0 flex-1", children: /* @__PURE__ */ $(
218
- "svg",
219
- {
220
- viewBox: `0 0 ${A} ${o}`,
221
- width: A,
222
- height: o,
223
- role: "group",
224
- "aria-labelledby": e ? I : v ? F : void 0,
225
- "aria-describedby": C,
226
- className: "block max-w-full overflow-visible",
227
- children: [
228
- v && /* @__PURE__ */ s("title", { id: F, children: v }),
229
- /* @__PURE__ */ s("desc", { id: C, children: ye(t, g, y) }),
230
- E({ width: A, ...N })
231
- ]
232
- }
233
- ) })
234
- ] }),
235
- c && /* @__PURE__ */ s(be, { first: u, last: l }),
236
- /* @__PURE__ */ s("span", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: N.announcement })
237
- ] }),
238
- m && !h && /* @__PURE__ */ s(
239
- "button",
240
- {
241
- type: "button",
242
- onClick: () => M((W) => !W),
243
- "aria-expanded": p,
244
- "aria-controls": L ? O : void 0,
245
- className: w(
246
- "text-foreground-subtle hover:text-foreground self-start rounded-sm text-xs underline-offset-2 outline-none hover:underline",
247
- "focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2"
248
- ),
249
- children: p ? g.hideTable : g.viewAsTable
250
- }
251
- ),
252
- L && /* @__PURE__ */ s(
253
- ve,
254
- {
255
- id: O,
256
- all: t,
257
- name: v ?? (typeof e == "string" ? e : void 0),
258
- visible: p,
259
- t: g
260
- }
261
- )
262
- ] });
197
+ function F({ caption: t, ariaLabel: i, title: a, all: s, height: c, width: p, className: m, showAxis: h, ticks: g, xFirst: _, xLast: y, tableFallback: b, showTableToggle: x, state: S, labels: C, children: w }) {
198
+ let T = n().chart, E = o().replace(/:/g, ""), D = `chart-cap-${E}`, O = `chart-title-${E}`, k = `chart-desc-${E}`, j = `chart-table-${E}`, F = i ?? a, [L, R] = l(!1), { ref: z, width: B } = v(), V = I(s, T, C);
199
+ process.env.NODE_ENV !== "production" && !F && !t && console.warn("[craftzbay/ui] Chart: provide `caption`, `aria-label`, or `title` so the chart has an accessible name.");
200
+ let H = (b || L) && !S, U = S === "loading" ? /* @__PURE__ */ f("div", {
201
+ role: "status",
202
+ "aria-label": T.loading,
203
+ style: { height: c },
204
+ className: "w-full",
205
+ children: [/* @__PURE__ */ d(r, {
206
+ style: { height: c },
207
+ className: "w-full"
208
+ }), /* @__PURE__ */ d("span", {
209
+ className: "sr-only",
210
+ children: T.loading
211
+ })]
212
+ }) : S ? /* @__PURE__ */ d("div", {
213
+ role: S === "error" ? "alert" : "status",
214
+ style: { height: c },
215
+ className: "text-foreground-subtle flex w-full items-center justify-center text-sm",
216
+ children: S === "error" ? T.error : T.empty
217
+ }) : null;
218
+ return /* @__PURE__ */ f("figure", {
219
+ className: e("flex flex-col gap-1.5", m),
220
+ style: { width: p },
221
+ children: [
222
+ t && /* @__PURE__ */ d("figcaption", {
223
+ id: D,
224
+ className: "text-foreground-muted text-xs",
225
+ children: t
226
+ }),
227
+ U ?? /* @__PURE__ */ f(u, { children: [
228
+ /* @__PURE__ */ f("div", {
229
+ className: "flex",
230
+ children: [h && /* @__PURE__ */ d(M, { ticks: g }), /* @__PURE__ */ d("div", {
231
+ ref: z,
232
+ className: "min-w-0 flex-1",
233
+ children: /* @__PURE__ */ f("svg", {
234
+ viewBox: `0 0 ${B} ${c}`,
235
+ width: B,
236
+ height: c,
237
+ role: "group",
238
+ "aria-labelledby": t ? D : F ? O : void 0,
239
+ "aria-describedby": k,
240
+ className: "block max-w-full overflow-visible",
241
+ children: [
242
+ F && /* @__PURE__ */ d("title", {
243
+ id: O,
244
+ children: F
245
+ }),
246
+ /* @__PURE__ */ d("desc", {
247
+ id: k,
248
+ children: A(s, T, C)
249
+ }),
250
+ w({
251
+ width: B,
252
+ ...V
253
+ })
254
+ ]
255
+ })
256
+ })]
257
+ }),
258
+ h && /* @__PURE__ */ d(N, {
259
+ first: _,
260
+ last: y
261
+ }),
262
+ /* @__PURE__ */ d("span", {
263
+ className: "sr-only",
264
+ "aria-live": "polite",
265
+ "aria-atomic": "true",
266
+ children: V.announcement
267
+ })
268
+ ] }),
269
+ x && !S && /* @__PURE__ */ d("button", {
270
+ type: "button",
271
+ onClick: () => R((e) => !e),
272
+ "aria-expanded": L,
273
+ "aria-controls": H ? j : void 0,
274
+ className: e("text-foreground-subtle hover:text-foreground self-start rounded-sm text-xs underline-offset-2 outline-none hover:underline", "focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2"),
275
+ children: L ? T.hideTable : T.viewAsTable
276
+ }),
277
+ H && /* @__PURE__ */ d(P, {
278
+ id: j,
279
+ all: s,
280
+ name: F ?? (typeof t == "string" ? t : void 0),
281
+ visible: L,
282
+ t: T
283
+ })
284
+ ]
285
+ });
263
286
  }
264
- function $e(e, n, r) {
265
- const [t, o] = K(null), [a, i] = K(""), c = se(
266
- (l, d) => {
267
- const m = e[l], h = m == null ? void 0 : m.data[d];
268
- !h || !k(h.y) || (o({ series: l, index: d }), i(r.point(m.name, h.x, h.y)));
269
- },
270
- [e, r]
271
- ), f = (l) => e[l].data.map((d, m) => k(d.y) ? m : -1).filter((d) => d >= 0);
272
- return { active: t, announcement: a, seriesProps: (l) => ({
273
- tabIndex: 0,
274
- role: "group",
275
- "aria-label": r.series(Y(e[l], l, n), f(l).length),
276
- // Focus ring comes from theme.css `[data-chart-series]:focus-visible`
277
- // (CSS outline — Tailwind's box-shadow ring does not paint on SVG <g>).
278
- "data-chart-series": !0,
279
- className: w(
280
- "[&:focus-visible_[data-active]]:stroke-[var(--ring)] [&:focus-visible_[data-active]]:stroke-[3px]"
281
- ),
282
- onFocus: () => {
283
- const d = f(l);
284
- d.length && c(l, (t == null ? void 0 : t.series) === l ? t.index : d[d.length - 1]);
285
- },
286
- onBlur: () => {
287
- o(null), i("");
288
- },
289
- onKeyDown: (d) => {
290
- const m = f(l);
291
- if (!m.length) return;
292
- const h = (t == null ? void 0 : t.series) === l ? m.indexOf(t.index) : m.length - 1;
293
- let y = h;
294
- if (d.key === "ArrowRight" || d.key === "ArrowUp") y = Math.min(m.length - 1, h + 1);
295
- else if (d.key === "ArrowLeft" || d.key === "ArrowDown") y = Math.max(0, h - 1);
296
- else if (d.key === "Home") y = 0;
297
- else if (d.key === "End") y = m.length - 1;
298
- else return;
299
- d.preventDefault(), c(l, m[y]);
300
- }
301
- }) };
287
+ function I(t, n, r) {
288
+ let [a, o] = l(null), [s, c] = l(""), u = i((e, n) => {
289
+ let i = t[e], a = i?.data[n];
290
+ a && w(a.y) && (o({
291
+ series: e,
292
+ index: n
293
+ }), c(r.point(i.name, a.x, a.y)));
294
+ }, [t, r]), d = (e) => t[e].data.map((e, t) => w(e.y) ? t : -1).filter((e) => e >= 0);
295
+ return {
296
+ active: a,
297
+ announcement: s,
298
+ seriesProps: (i) => ({
299
+ tabIndex: 0,
300
+ role: "group",
301
+ "aria-label": r.series(k(t[i], i, n), d(i).length),
302
+ "data-chart-series": !0,
303
+ className: e("[&:focus-visible_[data-active]]:stroke-[var(--ring)] [&:focus-visible_[data-active]]:stroke-[3px]"),
304
+ onFocus: () => {
305
+ let e = d(i);
306
+ e.length && u(i, a?.series === i ? a.index : e[e.length - 1]);
307
+ },
308
+ onBlur: () => {
309
+ o(null), c("");
310
+ },
311
+ onKeyDown: (e) => {
312
+ let t = d(i);
313
+ if (!t.length) return;
314
+ let n = a?.series === i ? t.indexOf(a.index) : t.length - 1, r = n;
315
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") r = Math.min(t.length - 1, n + 1);
316
+ else if (e.key === "ArrowLeft" || e.key === "ArrowDown") r = Math.max(0, n - 1);
317
+ else if (e.key === "Home") r = 0;
318
+ else if (e.key === "End") r = t.length - 1;
319
+ else return;
320
+ e.preventDefault(), u(i, t[r]);
321
+ }
322
+ })
323
+ };
302
324
  }
303
- function Me({
304
- x: e,
305
- y: n,
306
- color: r,
307
- label: t,
308
- always: o,
309
- active: a
310
- }) {
311
- return /* @__PURE__ */ s(
312
- "circle",
313
- {
314
- cx: e,
315
- cy: n,
316
- r: 3.5,
317
- fill: r,
318
- "data-active": a || void 0,
319
- className: w(!o && !a && "opacity-0 hover:opacity-100"),
320
- children: /* @__PURE__ */ s("title", { children: t })
321
- }
322
- );
325
+ function L({ x: t, y: n, color: r, label: i, always: a, active: o }) {
326
+ return /* @__PURE__ */ d("circle", {
327
+ cx: t,
328
+ cy: n,
329
+ r: 3.5,
330
+ fill: r,
331
+ "data-active": o || void 0,
332
+ className: e(!a && !o && "opacity-0 hover:opacity-100"),
333
+ children: /* @__PURE__ */ d("title", { children: i })
334
+ });
323
335
  }
324
- function Ne({
325
- data: e,
326
- series: n,
327
- colors: r = q,
328
- height: t = 160,
329
- width: o = "100%",
330
- caption: a,
331
- "aria-label": i,
332
- title: c,
333
- grid: f = !0,
334
- showAxis: u = !0,
335
- tableFallback: l = !0,
336
- showTableToggle: d,
337
- state: m,
338
- labels: h,
339
- className: y
340
- }) {
341
- const E = X().chart, g = { ...V(E), ...h }, x = J(e, n), { min: I, range: F, ticks: C } = Q(x), O = Math.max(...x.map((p) => p.data.length)), v = x[0].data;
342
- return /* @__PURE__ */ s(
343
- te,
344
- {
345
- caption: a,
346
- ariaLabel: i,
347
- title: c,
348
- all: x,
349
- height: t,
350
- width: o,
351
- className: y,
352
- showAxis: u,
353
- ticks: C,
354
- xFirst: v[0],
355
- xLast: v[v.length - 1],
356
- tableFallback: l,
357
- showTableToggle: d,
358
- state: m,
359
- labels: g,
360
- children: ({ width: p, active: M, seriesProps: P }) => /* @__PURE__ */ $(U, { children: [
361
- f && /* @__PURE__ */ s(ee, { width: p, height: t, lines: C.length - 1 }),
362
- x.map((A, N) => {
363
- const L = r[N % r.length], { sx: R, sy: W } = Z(O, p, t, I, F), D = pe(A.data, R, W), H = D.map(G).join(" "), j = W(Math.max(I, 0)), T = D.map(
364
- (b) => `${G(b)} L${b[b.length - 1][0].toFixed(1)},${j.toFixed(1)} L${b[0][0].toFixed(1)},${j.toFixed(1)} Z`
365
- ).join(" "), B = A.data.map((b) => k(b.y)).lastIndexOf(!0);
366
- return /* @__PURE__ */ $("g", { ...P(N), children: [
367
- T && /* @__PURE__ */ s("path", { d: T, fill: L, fillOpacity: 0.08 }),
368
- /* @__PURE__ */ s(
369
- "path",
370
- {
371
- d: H,
372
- fill: "none",
373
- stroke: L,
374
- strokeWidth: 2,
375
- strokeLinecap: "round",
376
- strokeLinejoin: "round"
377
- }
378
- ),
379
- A.data.map(
380
- (b, _) => k(b.y) ? /* @__PURE__ */ s(
381
- Me,
382
- {
383
- x: R(_),
384
- y: W(b.y),
385
- color: L,
386
- always: _ === B,
387
- active: (M == null ? void 0 : M.series) === N && M.index === _,
388
- label: g.point(A.name, b.x, b.y)
389
- },
390
- _
391
- ) : null
392
- )
393
- ] }, N);
394
- })
395
- ] })
396
- }
397
- );
336
+ function R({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100%", caption: o, "aria-label": s, title: c, grid: l = !0, showAxis: p = !0, tableFallback: g = !0, showTableToggle: _, state: v, labels: y, className: b }) {
337
+ let x = n().chart, S = {
338
+ ...m(x),
339
+ ...y
340
+ }, k = C(e, t), { min: A, range: M, ticks: N } = T(k), P = Math.max(...k.map((e) => e.data.length)), I = k[0].data;
341
+ return /* @__PURE__ */ d(F, {
342
+ caption: o,
343
+ ariaLabel: s,
344
+ title: c,
345
+ all: k,
346
+ height: i,
347
+ width: a,
348
+ className: b,
349
+ showAxis: p,
350
+ ticks: N,
351
+ xFirst: I[0],
352
+ xLast: I[I.length - 1],
353
+ tableFallback: g,
354
+ showTableToggle: _,
355
+ state: v,
356
+ labels: S,
357
+ children: ({ width: e, active: t, seriesProps: n }) => /* @__PURE__ */ f(u, { children: [l && /* @__PURE__ */ d(j, {
358
+ width: e,
359
+ height: i,
360
+ lines: N.length - 1
361
+ }), k.map((a, o) => {
362
+ let s = r[o % r.length], { sx: c, sy: l } = E(P, e, i, A, M), u = O(a.data, c, l), p = u.map(D).join(" "), m = l(Math.max(A, 0)), h = u.map((e) => `${D(e)} L${e[e.length - 1][0].toFixed(1)},${m.toFixed(1)} L${e[0][0].toFixed(1)},${m.toFixed(1)} Z`).join(" "), g = a.data.map((e) => w(e.y)).lastIndexOf(!0);
363
+ return /* @__PURE__ */ f("g", {
364
+ ...n(o),
365
+ children: [
366
+ h && /* @__PURE__ */ d("path", {
367
+ d: h,
368
+ fill: s,
369
+ fillOpacity: .08
370
+ }),
371
+ /* @__PURE__ */ d("path", {
372
+ d: p,
373
+ fill: "none",
374
+ stroke: s,
375
+ strokeWidth: 2,
376
+ strokeLinecap: "round",
377
+ strokeLinejoin: "round"
378
+ }),
379
+ a.data.map((e, n) => w(e.y) ? /* @__PURE__ */ d(L, {
380
+ x: c(n),
381
+ y: l(e.y),
382
+ color: s,
383
+ always: n === g,
384
+ active: t?.series === o && t.index === n,
385
+ label: S.point(a.name, e.x, e.y)
386
+ }, n) : null)
387
+ ]
388
+ }, o);
389
+ })] })
390
+ });
398
391
  }
399
- function Ce(e) {
400
- return /* @__PURE__ */ s(Ne, { ...e });
392
+ function z(e) {
393
+ return /* @__PURE__ */ d(R, { ...e });
401
394
  }
402
- function We({
403
- data: e,
404
- series: n,
405
- colors: r = q,
406
- height: t = 160,
407
- width: o = "100%",
408
- caption: a,
409
- "aria-label": i,
410
- title: c,
411
- grid: f = !0,
412
- showAxis: u = !0,
413
- tableFallback: l = !0,
414
- showTableToggle: d,
415
- state: m,
416
- labels: h,
417
- className: y
418
- }) {
419
- const E = X().chart, g = { ...V(E), ...h }, x = J(e, n), I = Math.max(...x.map((p) => p.data.length)), { min: F, range: C, ticks: O } = Q(x), v = x[0].data;
420
- return /* @__PURE__ */ s(
421
- te,
422
- {
423
- caption: a,
424
- ariaLabel: i,
425
- title: c,
426
- all: x,
427
- height: t,
428
- width: o,
429
- className: y,
430
- showAxis: u,
431
- ticks: O,
432
- xFirst: v[0],
433
- xLast: v[v.length - 1],
434
- tableFallback: l,
435
- showTableToggle: d,
436
- state: m,
437
- labels: g,
438
- children: ({ width: p, active: M, seriesProps: P }) => {
439
- const N = (p - S * 2) / Math.max(1, I), L = N * 0.62, R = Math.max(2, L / x.length), { sy: W } = Z(I, p, t, F, C), D = W(Math.min(Math.max(0, F), F + C));
440
- return /* @__PURE__ */ $(U, { children: [
441
- f && /* @__PURE__ */ s(ee, { width: p, height: t, lines: O.length - 1 }),
442
- F < 0 && /* @__PURE__ */ s(
443
- "line",
444
- {
445
- "aria-hidden": !0,
446
- x1: 0,
447
- x2: p,
448
- y1: D,
449
- y2: D,
450
- stroke: "var(--color-border-strong)",
451
- strokeWidth: 1
452
- }
453
- ),
454
- x.map((H, j) => /* @__PURE__ */ s("g", { ...P(j), children: H.data.map((T, B) => {
455
- if (!k(T.y)) return null;
456
- const b = W(T.y), _ = S + B * N + (N - L) / 2 + j * R, ne = g.point(H.name, T.x, T.y), re = (M == null ? void 0 : M.series) === j && M.index === B;
457
- return /* @__PURE__ */ s(
458
- "rect",
459
- {
460
- x: _,
461
- y: Math.min(D, b),
462
- width: R,
463
- height: Math.abs(D - b),
464
- fill: r[j % r.length],
465
- rx: 2,
466
- "data-active": re || void 0,
467
- className: "transition-opacity hover:opacity-80",
468
- children: /* @__PURE__ */ s("title", { children: ne })
469
- },
470
- B
471
- );
472
- }) }, j))
473
- ] });
474
- }
475
- }
476
- );
395
+ function B({ data: e, series: t, colors: r = h, height: i = 160, width: a = "100%", caption: o, "aria-label": s, title: c, grid: l = !0, showAxis: p = !0, tableFallback: g = !0, showTableToggle: v, state: y, labels: b, className: x }) {
396
+ let S = n().chart, D = {
397
+ ...m(S),
398
+ ...b
399
+ }, O = C(e, t), k = Math.max(...O.map((e) => e.data.length)), { min: A, range: M, ticks: N } = T(O), P = O[0].data;
400
+ return /* @__PURE__ */ d(F, {
401
+ caption: o,
402
+ ariaLabel: s,
403
+ title: c,
404
+ all: O,
405
+ height: i,
406
+ width: a,
407
+ className: x,
408
+ showAxis: p,
409
+ ticks: N,
410
+ xFirst: P[0],
411
+ xLast: P[P.length - 1],
412
+ tableFallback: g,
413
+ showTableToggle: v,
414
+ state: y,
415
+ labels: D,
416
+ children: ({ width: e, active: t, seriesProps: n }) => {
417
+ let a = (e - 12) / Math.max(1, k), o = a * .62, s = Math.max(2, o / O.length), { sy: c } = E(k, e, i, A, M), p = c(Math.min(Math.max(0, A), A + M));
418
+ return /* @__PURE__ */ f(u, { children: [
419
+ l && /* @__PURE__ */ d(j, {
420
+ width: e,
421
+ height: i,
422
+ lines: N.length - 1
423
+ }),
424
+ A < 0 && /* @__PURE__ */ d("line", {
425
+ "aria-hidden": !0,
426
+ x1: 0,
427
+ x2: e,
428
+ y1: p,
429
+ y2: p,
430
+ stroke: "var(--color-border-strong)",
431
+ strokeWidth: 1
432
+ }),
433
+ O.map((e, i) => /* @__PURE__ */ d("g", {
434
+ ...n(i),
435
+ children: e.data.map((n, l) => {
436
+ if (!w(n.y)) return null;
437
+ let u = c(n.y), f = _ + l * a + (a - o) / 2 + i * s, m = D.point(e.name, n.x, n.y), h = t?.series === i && t.index === l;
438
+ return /* @__PURE__ */ d("rect", {
439
+ x: f,
440
+ y: Math.min(p, u),
441
+ width: s,
442
+ height: Math.abs(p - u),
443
+ fill: r[i % r.length],
444
+ rx: 2,
445
+ "data-active": h || void 0,
446
+ className: "transition-opacity hover:opacity-80",
447
+ children: /* @__PURE__ */ d("title", { children: m })
448
+ }, l);
449
+ })
450
+ }, i))
451
+ ] });
452
+ }
453
+ });
477
454
  }
478
- export {
479
- Ce as AreaChart,
480
- We as BarChart,
481
- q as DEFAULT_CHART_COLORS,
482
- Ne as LineChart,
483
- fe as abbreviateNumber,
484
- Ie as defaultChartLabels,
485
- xe as niceTicks
486
- };
487
- //# sourceMappingURL=Chart.js.map
455
+ //#endregion
456
+ export { z as AreaChart, B as BarChart, h as DEFAULT_CHART_COLORS, R as LineChart, b as abbreviateNumber, p as defaultChartLabels, S as niceTicks };
457
+
458
+ //# sourceMappingURL=Chart.js.map