@overdoser/react-toolkit 0.21.0 → 0.22.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 (161) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +27 -0
  3. package/components/Accordion/Accordion.js +48 -48
  4. package/components/ActionButton/ActionButton.js +23 -23
  5. package/components/ActionButton/CopyButton.js +5 -5
  6. package/components/Alert/Alert.js +13 -13
  7. package/components/Avatar/Avatar.js +12 -12
  8. package/components/Badge/Badge.js +6 -6
  9. package/components/Breadcrumbs/Breadcrumbs.js +15 -15
  10. package/components/Button/Button.js +14 -14
  11. package/components/Card/Card.js +26 -26
  12. package/components/Chart/AreaChart.js +103 -103
  13. package/components/Chart/Axis.js +7 -7
  14. package/components/Chart/BarChart.js +62 -62
  15. package/components/Chart/ChartContainer.js +11 -11
  16. package/components/Chart/ChartLegend.js +7 -7
  17. package/components/Chart/ChartTooltip.js +13 -13
  18. package/components/Chart/LineChart.js +88 -88
  19. package/components/Chart/PieChart.js +25 -25
  20. package/components/Chart/RadarChart.js +42 -42
  21. package/components/Chart/Sparkline.js +11 -11
  22. package/components/Chart/TradingChart.js +126 -126
  23. package/components/Chart/trading/period.js +3 -3
  24. package/components/Chip/Chip.js +24 -24
  25. package/components/CodeBlock/CodeBlock.js +31 -31
  26. package/components/CommandPalette/CommandPalette.js +166 -166
  27. package/components/ConfirmDialog/ConfirmDialog.js +60 -60
  28. package/components/Divider/Divider.js +10 -10
  29. package/components/Draggable/Draggable.js +29 -29
  30. package/components/Drawer/Drawer.js +53 -53
  31. package/components/Dropdown/Dropdown.js +66 -66
  32. package/components/Dropdown/DropdownItem.js +13 -13
  33. package/components/Dropdown/DropdownLabel.js +5 -5
  34. package/components/Dropdown/DropdownSeparator.js +5 -5
  35. package/components/Dropzone/Dropzone.js +15 -15
  36. package/components/EmptyState/EmptyState.js +11 -11
  37. package/components/Form/Form.js +17 -17
  38. package/components/Form/FormField.js +21 -21
  39. package/components/Form/FormRow.js +3 -3
  40. package/components/ImageViewer/ImageViewer.js +118 -118
  41. package/components/Kbd/Kbd.js +11 -11
  42. package/components/KeyValueList/KeyValueList.js +32 -32
  43. package/components/Link/Link.js +7 -7
  44. package/components/List/List.js +7 -7
  45. package/components/Loader/Loader.js +39 -39
  46. package/components/Modal/Modal.js +48 -48
  47. package/components/PageHeader/PageHeader.js +18 -18
  48. package/components/Pagination/Pagination.js +23 -23
  49. package/components/Popover/Popover.js +25 -25
  50. package/components/ProgressBar/ProgressBar.js +17 -17
  51. package/components/RelativeTime/RelativeTime.js +10 -10
  52. package/components/SegmentedControl/SegmentedControl.js +38 -38
  53. package/components/Skeleton/Skeleton.js +10 -10
  54. package/components/Spinner/Spinner.js +7 -7
  55. package/components/SplitButton/SplitButton.js +63 -63
  56. package/components/SplitPane/SplitPane.js +50 -50
  57. package/components/StatCard/StatCard.js +32 -32
  58. package/components/StatusDot/StatusDot.js +7 -7
  59. package/components/Table/Table.js +174 -174
  60. package/components/Tabs/Tabs.js +47 -47
  61. package/components/ThemeToggle/ThemeToggle.js +31 -31
  62. package/components/Timeline/GanttTimeline.js +213 -213
  63. package/components/Timeline/HistoryTimeline.js +306 -306
  64. package/components/Timeline/TimelineShared.js +103 -103
  65. package/components/Timeline/TraceEventDetails.js +103 -103
  66. package/components/Timeline/TraceTimeline.js +546 -546
  67. package/components/Timeline/historyLayout.js +2 -2
  68. package/components/Timer/Timer.js +39 -39
  69. package/components/Toast/Toast.js +59 -59
  70. package/components/ToggleIconButton/ToggleIconButton.js +9 -9
  71. package/components/Tooltip/Tooltip.js +16 -16
  72. package/components/Typography/Typography.js +5 -5
  73. package/components/inputs/Checkbox/Checkbox.js +11 -11
  74. package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
  75. package/components/inputs/DatePicker/CalendarPanel.js +113 -113
  76. package/components/inputs/DatePicker/DatePicker.js +39 -39
  77. package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
  78. package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
  79. package/components/inputs/DateTimePicker/TimeField.js +34 -34
  80. package/components/inputs/Input/Input.js +13 -13
  81. package/components/inputs/NumberInput/NumberInput.js +16 -16
  82. package/components/inputs/Radio/Radio.js +17 -17
  83. package/components/inputs/SearchInput/SearchInput.js +25 -25
  84. package/components/inputs/Select/Select.d.ts +55 -3
  85. package/components/inputs/Select/Select.js +485 -344
  86. package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
  87. package/components/inputs/Slider/Slider.js +21 -21
  88. package/components/inputs/Switch/Switch.js +4 -4
  89. package/components/inputs/Textarea/Textarea.js +8 -8
  90. package/hooks/usePortalPosition.d.ts +2 -1
  91. package/hooks/usePortalPosition.js +6 -3
  92. package/hooks/useResizable.js +1 -1
  93. package/hooks/useTheme.js +7 -7
  94. package/index.css +1 -1
  95. package/index.js +1 -1
  96. package/index.layered.css +1 -1
  97. package/llms.txt +25 -4
  98. package/manifest.json +33 -4
  99. package/package.json +1 -1
  100. /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
  101. /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
  102. /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
  103. /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
  104. /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
  105. /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
  106. /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
  107. /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
  108. /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
  109. /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
  110. /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
  111. /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
  112. /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
  113. /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
  114. /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
  115. /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
  116. /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
  117. /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
  118. /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
  119. /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
  120. /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
  121. /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
  122. /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
  123. /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
  124. /package/components/List/{List.module.js → List.module.scss.js} +0 -0
  125. /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
  126. /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
  127. /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
  128. /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
  129. /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
  130. /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
  131. /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
  132. /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
  133. /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
  134. /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
  135. /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
  136. /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
  137. /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
  138. /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
  139. /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
  140. /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
  141. /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
  142. /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
  143. /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
  144. /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
  145. /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
  146. /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
  147. /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
  148. /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
  149. /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
  150. /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
  151. /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
  152. /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
  153. /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
  154. /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
  155. /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
  156. /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
  157. /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
  158. /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
  159. /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
  160. /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
  161. /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
@@ -1,65 +1,65 @@
1
- import e from "./Card.module.js";
2
- import { createContext as t, forwardRef as n, useContext as r } from "react";
3
- import i from "clsx";
1
+ import { createContext as e, forwardRef as t, useContext as n } from "react";
2
+ import r from "clsx";
3
+ import i from "./Card.module.scss.js";
4
4
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
5
  // src/components/Card/Card.tsx
6
- var s = t({ classes: {} }), c = n(({ as: t = "h3", className: n, children: o, ...c }, l) => {
7
- let { classes: u } = r(s);
8
- return /* @__PURE__ */ a(t, {
6
+ var s = e({ classes: {} }), c = t(({ as: e = "h3", className: t, children: o, ...c }, l) => {
7
+ let { classes: u } = n(s);
8
+ return /* @__PURE__ */ a(e, {
9
9
  ref: l,
10
- className: i(e.title, u.title, n),
10
+ className: r(i.title, u.title, t),
11
11
  ...c,
12
12
  children: o
13
13
  });
14
14
  });
15
15
  c.displayName = "Card.Title";
16
- var l = n(({ title: t, subtitle: n, actions: l, divider: u = !1, className: d, children: f, ...p }, m) => {
17
- let { classes: h } = r(s), g = t != null || n != null;
16
+ var l = t(({ title: e, subtitle: t, actions: l, divider: u = !1, className: d, children: f, ...p }, m) => {
17
+ let { classes: h } = n(s), g = e != null || t != null;
18
18
  return /* @__PURE__ */ o("div", {
19
19
  ref: m,
20
- className: i(e.header, u && e.headerDivider, h.header, d),
20
+ className: r(i.header, u && i.headerDivider, h.header, d),
21
21
  ...p,
22
22
  children: [/* @__PURE__ */ o("div", {
23
- className: e.headerMain,
23
+ className: i.headerMain,
24
24
  children: [g && /* @__PURE__ */ o("div", {
25
- className: e.titleBlock,
26
- children: [t != null && /* @__PURE__ */ a(c, { children: t }), n != null && /* @__PURE__ */ a("div", {
27
- className: i(e.subtitle, h.subtitle),
28
- children: n
25
+ className: i.titleBlock,
26
+ children: [e != null && /* @__PURE__ */ a(c, { children: e }), t != null && /* @__PURE__ */ a("div", {
27
+ className: r(i.subtitle, h.subtitle),
28
+ children: t
29
29
  })]
30
30
  }), f]
31
31
  }), l != null && /* @__PURE__ */ a("div", {
32
- className: i(e.actions, h.actions),
32
+ className: r(i.actions, h.actions),
33
33
  children: l
34
34
  })]
35
35
  });
36
36
  });
37
37
  l.displayName = "Card.Header";
38
- var u = n(({ className: t, children: n, ...o }, c) => {
39
- let { classes: l } = r(s);
38
+ var u = t(({ className: e, children: t, ...o }, c) => {
39
+ let { classes: l } = n(s);
40
40
  return /* @__PURE__ */ a("div", {
41
41
  ref: c,
42
- className: i(e.body, l.body, t),
42
+ className: r(i.body, l.body, e),
43
43
  ...o,
44
- children: n
44
+ children: t
45
45
  });
46
46
  });
47
47
  u.displayName = "Card.Body";
48
- var d = n(({ align: t = "end", divider: n = !1, className: o, children: c, ...l }, u) => {
49
- let { classes: d } = r(s);
48
+ var d = t(({ align: e = "end", divider: t = !1, className: o, children: c, ...l }, u) => {
49
+ let { classes: d } = n(s);
50
50
  return /* @__PURE__ */ a("div", {
51
51
  ref: u,
52
- className: i(e.footer, e[`footer-${t}`], n && e.footerDivider, d.footer, o),
52
+ className: r(i.footer, i[`footer-${e}`], t && i.footerDivider, d.footer, o),
53
53
  ...l,
54
54
  children: c
55
55
  });
56
56
  });
57
57
  d.displayName = "Card.Footer";
58
- var f = n(({ variant: t = "outlined", padding: n = "md", interactive: r = !1, selected: o = !1, accent: c, href: l, target: u, rel: d, classes: f, className: p, style: m, onClick: h, onKeyDown: g, children: _, ...v }, y) => {
59
- let b = l != null, x = r || b, S = x && !b && typeof h == "function", C = c == null ? m : {
58
+ var f = t(({ variant: e = "outlined", padding: t = "md", interactive: n = !1, selected: o = !1, accent: c, href: l, target: u, rel: d, classes: f, className: p, style: m, onClick: h, onKeyDown: g, children: _, ...v }, y) => {
59
+ let b = l != null, x = n || b, S = x && !b && typeof h == "function", C = c == null ? m : {
60
60
  ...m,
61
61
  "--crk-card-accent": c
62
- }, w = i(e.root, e[t], e[`padding-${n}`], x && e.interactive, o && e.selected, c != null && e.accented, f?.root, p), T = (e) => {
62
+ }, w = r(i.root, i[e], i[`padding-${t}`], x && i.interactive, o && i.selected, c != null && i.accented, f?.root, p), T = (e) => {
63
63
  g?.(e), S && !e.defaultPrevented && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), h?.(e));
64
64
  }, E = /* @__PURE__ */ a(s.Provider, {
65
65
  value: { classes: f ?? {} },
@@ -1,20 +1,20 @@
1
- import { ChartContainer as e } from "./ChartContainer.js";
2
- import { ChartLegend as t } from "./ChartLegend.js";
3
- import { ChartTooltip as n } from "./ChartTooltip.js";
4
- import { XAxis as r, YAxis as i } from "./Axis.js";
5
- import { bandScale as a, linearScale as o, niceTicks as s } from "./scales.js";
6
- import c from "./Chart.module.js";
7
- import { useId as l, useMemo as u, useRef as d, useState as f } from "react";
8
- import p from "clsx";
9
- import { Fragment as ee, jsx as m, jsxs as h } from "react/jsx-runtime";
1
+ import { useId as e, useMemo as t, useRef as n, useState as r } from "react";
2
+ import i from "clsx";
3
+ import { ChartContainer as a } from "./ChartContainer.js";
4
+ import { ChartLegend as o } from "./ChartLegend.js";
5
+ import { ChartTooltip as s } from "./ChartTooltip.js";
6
+ import { XAxis as c, YAxis as l } from "./Axis.js";
7
+ import { bandScale as u, linearScale as ee, niceTicks as te } from "./scales.js";
8
+ import d from "./Chart.module.scss.js";
9
+ import { Fragment as ne, jsx as f, jsxs as p } from "react/jsx-runtime";
10
10
  // src/components/Chart/AreaChart.tsx
11
- var g = {
11
+ var m = {
12
12
  top: 12,
13
13
  right: 16,
14
14
  bottom: 28,
15
15
  left: 48
16
16
  };
17
- function _(e, t) {
17
+ function h(e, t) {
18
18
  if (e.length === 0) return "";
19
19
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
20
20
  if (t === "linear") return e.map((e, t) => `${t === 0 ? "M" : "L"} ${e.x} ${e.y}`).join(" ");
@@ -30,42 +30,42 @@ function _(e, t) {
30
30
  }
31
31
  return n;
32
32
  }
33
- function v(e, t, n) {
33
+ function g(e, t, n) {
34
34
  if (e.length === 0) return "";
35
- let r = _(e, n);
35
+ let r = h(e, n);
36
36
  if (typeof t == "number") {
37
37
  let n = e[e.length - 1], i = e[0];
38
38
  return `${r} L ${n.x} ${t} L ${i.x} ${t} Z`;
39
39
  }
40
- return `${r} ${_(e.map((e, n) => ({
40
+ return `${r} ${h(e.map((e, n) => ({
41
41
  x: e.x,
42
42
  y: t[n]
43
43
  })).reverse(), n).replace(/^M /, "L ")} Z`;
44
44
  }
45
- function y(e, t = 8) {
45
+ function _(e, t = 8) {
46
46
  if (e.length <= t) return e;
47
47
  let n = Math.ceil(e.length / t);
48
48
  return e.filter((e, t) => t % n === 0);
49
49
  }
50
- function b({ data: b, xKey: C, config: w, aspectRatio: T = 16 / 9, height: E, curve: D = "monotone", stacked: O = !1, stackOffset: k = "none", fillGradient: A = !1, showGrid: j = !0, showXAxis: te = !0, showYAxis: M = !0, showLegend: N = !0, showTooltip: P = !0, yTickCount: ne = 5, yFormat: re, xFormat: F, valueFormat: I, renderTooltip: L, margin: R, emptyMessage: z = "No data", className: B, style: V, classes: H }) {
51
- let U = u(() => ({
52
- ...g,
53
- ...M ? {} : { left: 16 },
50
+ function v({ data: v, xKey: x, config: S, aspectRatio: C = 16 / 9, height: w, curve: T = "monotone", stacked: E = !1, stackOffset: D = "none", fillGradient: O = !1, showGrid: k = !0, showXAxis: re = !0, showYAxis: A = !0, showLegend: j = !0, showTooltip: M = !0, yTickCount: N = 5, yFormat: P, xFormat: F, valueFormat: I, renderTooltip: L, margin: R, emptyMessage: z = "No data", className: B, style: V, classes: H }) {
51
+ let U = t(() => ({
52
+ ...m,
53
+ ...A ? {} : { left: 16 },
54
54
  ...R
55
- }), [R, M]), W = u(() => Object.keys(w), [w]), G = O && W.length > 0, K = G && k === "expand", [q, J] = f(null), Y = d(null), X = l(), { tops: Z, bottoms: Q } = u(() => {
55
+ }), [R, A]), W = t(() => Object.keys(S), [S]), G = E && W.length > 0, K = G && D === "expand", [q, J] = r(null), Y = n(null), X = e(), { tops: Z, bottoms: Q } = t(() => {
56
56
  let e = W.map(() => []), t = W.map(() => []);
57
- for (let n = 0; n < b.length; n++) {
57
+ for (let n = 0; n < v.length; n++) {
58
58
  let r = 0;
59
59
  if (K) {
60
60
  for (let e of W) {
61
- let t = b[n][e];
61
+ let t = v[n][e];
62
62
  typeof t == "number" && t > 0 && (r += t);
63
63
  }
64
64
  r === 0 && (r = 1);
65
65
  }
66
66
  let i = 0;
67
67
  for (let a = 0; a < W.length; a++) {
68
- let o = W[a], s = b[n][o], c = typeof s == "number" ? s : 0;
68
+ let o = W[a], s = v[n][o], c = typeof s == "number" ? s : 0;
69
69
  if (G) {
70
70
  let o = K ? c / r : c;
71
71
  t[a][n] = i, i += o, e[a][n] = i;
@@ -77,11 +77,11 @@ function b({ data: b, xKey: C, config: w, aspectRatio: T = 16 / 9, height: E, cu
77
77
  bottoms: t
78
78
  };
79
79
  }, [
80
- b,
80
+ v,
81
81
  W,
82
82
  G,
83
83
  K
84
- ]), [ie, ae] = u(() => {
84
+ ]), [ie, ae] = t(() => {
85
85
  if (K) return [0, 1];
86
86
  let e = 0, t = 0;
87
87
  for (let n of Z) for (let r of n) r < e && (e = r), r > t && (t = r);
@@ -92,117 +92,117 @@ function b({ data: b, xKey: C, config: w, aspectRatio: T = 16 / 9, height: E, cu
92
92
  Q,
93
93
  K
94
94
  ]);
95
- if (b.length === 0) return /* @__PURE__ */ m("div", {
95
+ if (v.length === 0) return /* @__PURE__ */ f("div", {
96
96
  ref: Y,
97
- className: p(c.root, H?.root, B),
97
+ className: i(d.root, H?.root, B),
98
98
  style: V,
99
- children: /* @__PURE__ */ m("div", {
100
- className: c.canvas,
101
- style: { height: E ?? 240 },
102
- children: /* @__PURE__ */ m("div", {
103
- className: c.empty,
99
+ children: /* @__PURE__ */ f("div", {
100
+ className: d.canvas,
101
+ style: { height: w ?? 240 },
102
+ children: /* @__PURE__ */ f("div", {
103
+ className: d.empty,
104
104
  children: z
105
105
  })
106
106
  })
107
107
  });
108
- let $ = q === null ? void 0 : b[q];
109
- return /* @__PURE__ */ m(e, {
108
+ let $ = q === null ? void 0 : v[q];
109
+ return /* @__PURE__ */ f(a, {
110
110
  ref: Y,
111
- aspectRatio: T,
112
- height: E,
111
+ aspectRatio: C,
112
+ height: w,
113
113
  className: B,
114
114
  style: V,
115
115
  classes: H,
116
- legend: N ? /* @__PURE__ */ m(t, {
117
- config: w,
116
+ legend: j ? /* @__PURE__ */ f(o, {
117
+ config: S,
118
118
  classes: H
119
119
  }) : void 0,
120
- overlay: P && q !== null && $ ? /* @__PURE__ */ m(n, {
120
+ overlay: M && q !== null && $ ? /* @__PURE__ */ f(s, {
121
121
  row: $,
122
- x: S(b, C, U, q, Y),
122
+ x: b(v, x, U, q, Y),
123
123
  y: 16,
124
124
  containerWidth: Y.current?.getBoundingClientRect().width ?? 0,
125
- config: w,
125
+ config: S,
126
126
  render: L ? () => L($) : void 0,
127
- valueFormat: K ? x($, W, I) : I,
128
- titleKey: C,
127
+ valueFormat: K ? y($, W, I) : I,
128
+ titleKey: x,
129
129
  classes: H
130
130
  }) : null,
131
131
  children: ({ width: e, height: t }) => {
132
- let n = U.left, l = e - U.right, u = U.top, d = t - U.bottom, f = Math.max(0, l - n), g = Math.max(0, d - u), x = b.map((e) => String(e[C])), S = a(x, [n, l], 0), T = K ? [
132
+ let n = U.left, r = e - U.right, a = U.top, o = t - U.bottom, s = Math.max(0, r - n), m = Math.max(0, o - a), y = v.map((e) => String(e[x])), b = u(y, [n, r], 0), C = K ? [
133
133
  0,
134
134
  .25,
135
135
  .5,
136
136
  .75,
137
137
  1
138
- ] : s(ie, ae, ne), E = o([T[0], T[T.length - 1]], [d, u]), O = E(0), k = T.map((e) => ({
138
+ ] : te(ie, ae, N), w = ee([C[0], C[C.length - 1]], [o, a]), E = w(0), D = C.map((e) => ({
139
139
  value: e,
140
- y: E(e)
141
- })), N = y(x).map((e) => ({
140
+ y: w(e)
141
+ })), j = _(y).map((e) => ({
142
142
  label: e,
143
- x: S(e)
144
- })), P = K ? (e) => `${Math.round(e * 100)}%` : re;
145
- return /* @__PURE__ */ h(ee, { children: [
146
- A && /* @__PURE__ */ m("defs", { children: W.map((e) => /* @__PURE__ */ h("linearGradient", {
143
+ x: b(e)
144
+ })), M = K ? (e) => `${Math.round(e * 100)}%` : P;
145
+ return /* @__PURE__ */ p(ne, { children: [
146
+ O && /* @__PURE__ */ f("defs", { children: W.map((e) => /* @__PURE__ */ p("linearGradient", {
147
147
  id: `${X}-${e}`,
148
148
  x1: "0",
149
149
  y1: "0",
150
150
  x2: "0",
151
151
  y2: "1",
152
- children: [/* @__PURE__ */ m("stop", {
152
+ children: [/* @__PURE__ */ f("stop", {
153
153
  offset: "5%",
154
- stopColor: w[e].color,
154
+ stopColor: S[e].color,
155
155
  stopOpacity: .6
156
- }), /* @__PURE__ */ m("stop", {
156
+ }), /* @__PURE__ */ f("stop", {
157
157
  offset: "95%",
158
- stopColor: w[e].color,
158
+ stopColor: S[e].color,
159
159
  stopOpacity: .05
160
160
  })]
161
161
  }, e)) }),
162
- M ? /* @__PURE__ */ m(i, {
163
- ticks: k,
162
+ A ? /* @__PURE__ */ f(l, {
163
+ ticks: D,
164
164
  x: n,
165
- plotWidth: f,
166
- format: P,
167
- showGrid: j,
165
+ plotWidth: s,
166
+ format: M,
167
+ showGrid: k,
168
168
  classes: H
169
- }) : j && /* @__PURE__ */ m("g", {
170
- className: p(c.axis, H?.axis),
171
- children: k.map(({ value: e, y: t }) => /* @__PURE__ */ m("line", {
172
- className: p(c.gridLine, H?.grid),
169
+ }) : k && /* @__PURE__ */ f("g", {
170
+ className: i(d.axis, H?.axis),
171
+ children: D.map(({ value: e, y: t }) => /* @__PURE__ */ f("line", {
172
+ className: i(d.gridLine, H?.grid),
173
173
  x1: n,
174
- x2: l,
174
+ x2: r,
175
175
  y1: t,
176
176
  y2: t
177
177
  }, `grid-${e}`))
178
178
  }),
179
- te && /* @__PURE__ */ m(r, {
180
- ticks: N,
181
- y: d,
179
+ re && /* @__PURE__ */ f(c, {
180
+ ticks: j,
181
+ y: o,
182
182
  format: F,
183
183
  classes: H
184
184
  }),
185
185
  W.map((e, t) => {
186
- let n = w[e], r = b.map((e, n) => ({
187
- x: S(x[n]),
188
- y: E(Z[t][n])
189
- })), i = A ? `url(#${X}-${e})` : n.color, a = A ? 1 : .18, o = G ? v(r, Q[t].map((e) => E(e)), D) : v(r, O, D);
190
- return /* @__PURE__ */ h("g", {
191
- className: p(c.series, H?.series),
186
+ let n = S[e], r = v.map((e, n) => ({
187
+ x: b(y[n]),
188
+ y: w(Z[t][n])
189
+ })), a = O ? `url(#${X}-${e})` : n.color, o = O ? 1 : .18, s = G ? g(r, Q[t].map((e) => w(e)), T) : g(r, E, T);
190
+ return /* @__PURE__ */ p("g", {
191
+ className: i(d.series, H?.series),
192
192
  children: [
193
- /* @__PURE__ */ m("path", {
194
- className: c.areaPath,
195
- d: o,
196
- fill: i,
197
- fillOpacity: a
193
+ /* @__PURE__ */ f("path", {
194
+ className: d.areaPath,
195
+ d: s,
196
+ fill: a,
197
+ fillOpacity: o
198
198
  }),
199
- /* @__PURE__ */ m("path", {
200
- className: c.linePath,
201
- d: _(r, D),
199
+ /* @__PURE__ */ f("path", {
200
+ className: d.linePath,
201
+ d: h(r, T),
202
202
  stroke: n.color
203
203
  }),
204
- !G && r.map((t, r) => /* @__PURE__ */ m("circle", {
205
- className: p(c.point, H?.point),
204
+ !G && r.map((t, r) => /* @__PURE__ */ f("circle", {
205
+ className: i(d.point, H?.point),
206
206
  cx: t.x,
207
207
  cy: t.y,
208
208
  r: q === r ? 5 : 3,
@@ -211,21 +211,21 @@ function b({ data: b, xKey: C, config: w, aspectRatio: T = 16 / 9, height: E, cu
211
211
  ]
212
212
  }, e);
213
213
  }),
214
- q !== null && /* @__PURE__ */ m("line", {
215
- className: c.cursorLine,
216
- x1: S(x[q]),
217
- x2: S(x[q]),
218
- y1: u,
219
- y2: d
214
+ q !== null && /* @__PURE__ */ f("line", {
215
+ className: d.cursorLine,
216
+ x1: b(y[q]),
217
+ x2: b(y[q]),
218
+ y1: a,
219
+ y2: o
220
220
  }),
221
- /* @__PURE__ */ m("rect", {
222
- className: c.interactionLayer,
221
+ /* @__PURE__ */ f("rect", {
222
+ className: d.interactionLayer,
223
223
  x: n,
224
- y: u,
225
- width: f,
226
- height: g,
224
+ y: a,
225
+ width: s,
226
+ height: m,
227
227
  onMouseMove: (e) => {
228
- let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = S.step(), a = Math.max(0, Math.min(b.length - 1, Math.round((r - n - i / 2) / i)));
228
+ let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = b.step(), a = Math.max(0, Math.min(v.length - 1, Math.round((r - n - i / 2) / i)));
229
229
  J(a);
230
230
  },
231
231
  onMouseLeave: () => J(null)
@@ -234,7 +234,7 @@ function b({ data: b, xKey: C, config: w, aspectRatio: T = 16 / 9, height: E, cu
234
234
  }
235
235
  });
236
236
  }
237
- function x(e, t, n) {
237
+ function y(e, t, n) {
238
238
  let r = 0;
239
239
  for (let n of t) {
240
240
  let t = e[n];
@@ -245,10 +245,10 @@ function x(e, t, n) {
245
245
  return `${n ? n(e) : e} · ${t}%`;
246
246
  };
247
247
  }
248
- function S(e, t, n, r, i) {
249
- let o = i.current;
250
- if (!o) return 0;
251
- let s = o.getBoundingClientRect().width, c = e.map((e) => String(e[t]));
252
- return a(c, [n.left, s - n.right], 0)(c[r]);
248
+ function b(e, t, n, r, i) {
249
+ let a = i.current;
250
+ if (!a) return 0;
251
+ let o = a.getBoundingClientRect().width, s = e.map((e) => String(e[t]));
252
+ return u(s, [n.left, o - n.right], 0)(s[r]);
253
253
  }
254
- export { b as AreaChart };
254
+ export { v as AreaChart };
@@ -1,18 +1,18 @@
1
- import e from "./Chart.module.js";
2
- import t from "clsx";
1
+ import e from "clsx";
2
+ import t from "./Chart.module.scss.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  // src/components/Chart/Axis.tsx
5
5
  function i({ ticks: i, x: a, plotWidth: o, format: s, showGrid: c = !0, classes: l }) {
6
6
  return /* @__PURE__ */ n("g", {
7
- className: t(e.axis, l?.axis),
7
+ className: e(t.axis, l?.axis),
8
8
  children: i.map(({ value: i, y: u }) => /* @__PURE__ */ r("g", { children: [c && /* @__PURE__ */ n("line", {
9
- className: t(e.gridLine, l?.grid),
9
+ className: e(t.gridLine, l?.grid),
10
10
  x1: a,
11
11
  x2: a + o,
12
12
  y1: u,
13
13
  y2: u
14
14
  }), /* @__PURE__ */ n("text", {
15
- className: t(e.axisLabel, l?.axisLabel),
15
+ className: e(t.axisLabel, l?.axisLabel),
16
16
  x: a - 8,
17
17
  y: u,
18
18
  textAnchor: "end",
@@ -23,9 +23,9 @@ function i({ ticks: i, x: a, plotWidth: o, format: s, showGrid: c = !0, classes:
23
23
  }
24
24
  function a({ ticks: r, y: i, format: a, classes: o }) {
25
25
  return /* @__PURE__ */ n("g", {
26
- className: t(e.axis, o?.axis),
26
+ className: e(t.axis, o?.axis),
27
27
  children: r.map(({ label: r, x: s }) => /* @__PURE__ */ n("text", {
28
- className: t(e.axisLabel, o?.axisLabel),
28
+ className: e(t.axisLabel, o?.axisLabel),
29
29
  x: s,
30
30
  y: i + 16,
31
31
  textAnchor: "middle",