@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,11 +1,11 @@
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, extent as o, linearScale as s, niceTicks as c } from "./scales.js";
6
- import l from "./Chart.module.js";
7
- import { useMemo as u, useRef as d, useState as f } from "react";
8
- import p from "clsx";
1
+ import { useMemo as e, useRef as t, useState as n } from "react";
2
+ import r from "clsx";
3
+ import { ChartContainer as i } from "./ChartContainer.js";
4
+ import { ChartLegend as a } from "./ChartLegend.js";
5
+ import { ChartTooltip as o } from "./ChartTooltip.js";
6
+ import { XAxis as s, YAxis as c } from "./Axis.js";
7
+ import { bandScale as l, extent as u, linearScale as d, niceTicks as f } from "./scales.js";
8
+ import p from "./Chart.module.scss.js";
9
9
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
10
10
  // src/components/Chart/LineChart.tsx
11
11
  var _ = {
@@ -35,164 +35,164 @@ function y(e, t = 8) {
35
35
  let n = Math.ceil(e.length / t);
36
36
  return e.filter((e, t) => t % n === 0);
37
37
  }
38
- function b({ data: b, xKey: S, config: C, aspectRatio: w = 16 / 9, height: T, curve: E = "monotone", showPoints: ee = !0, dotColorKey: D, renderDot: O, showValues: k = !1, valuePosition: A = "top", renderLabel: j, activeIndex: M, onPointClick: N, showGrid: P = !0, showLegend: F = !0, showTooltip: I = !0, yTickCount: L = 5, yFormat: R, xFormat: z, valueFormat: B, renderTooltip: V, margin: H, emptyMessage: U = "No data", className: W, style: G, classes: K }) {
39
- let q = {
38
+ function b({ data: b, xKey: S, config: C, aspectRatio: w = 16 / 9, height: T, curve: E = "monotone", showPoints: D = !0, dotColorKey: O, renderDot: k, showValues: A = !1, valuePosition: j = "top", renderLabel: M, activeIndex: N, onPointClick: P, showGrid: F = !0, showLegend: I = !0, showTooltip: L = !0, yTickCount: R = 5, yFormat: z, xFormat: B, valueFormat: V, renderTooltip: H, margin: U, emptyMessage: W = "No data", className: G, style: K, classes: q }) {
39
+ let J = {
40
40
  ..._,
41
- ...H
42
- }, J = u(() => Object.keys(C), [C]), [Y, X] = f(null), Z = d(null), Q = M ?? Y, $ = (e, t) => {
43
- if (D) {
44
- let e = b[t]?.[D];
41
+ ...U
42
+ }, Y = e(() => Object.keys(C), [C]), [ee, X] = n(null), Z = t(null), Q = N ?? ee, $ = (e, t) => {
43
+ if (O) {
44
+ let e = b[t]?.[O];
45
45
  if (typeof e == "string") return e;
46
46
  }
47
47
  return C[e]?.color ?? "var(--crk-chart-1)";
48
48
  };
49
49
  if (b.length === 0) return /* @__PURE__ */ h("div", {
50
50
  ref: Z,
51
- className: p(l.root, K?.root, W),
52
- style: G,
51
+ className: r(p.root, q?.root, G),
52
+ style: K,
53
53
  children: /* @__PURE__ */ h("div", {
54
- className: l.canvas,
54
+ className: p.canvas,
55
55
  style: { height: T ?? 240 },
56
56
  children: /* @__PURE__ */ h("div", {
57
- className: l.empty,
58
- children: U
57
+ className: p.empty,
58
+ children: W
59
59
  })
60
60
  })
61
61
  });
62
- let te = I && Q !== null ? /* @__PURE__ */ h(n, {
62
+ let te = L && Q !== null ? /* @__PURE__ */ h(o, {
63
63
  row: b[Q],
64
- x: x(b, S, q, Q, Z),
64
+ x: x(b, S, J, Q, Z),
65
65
  y: 16,
66
66
  containerWidth: Z.current?.getBoundingClientRect().width ?? 0,
67
67
  config: C,
68
- render: V ? () => V(b[Q]) : void 0,
69
- valueFormat: B,
68
+ render: H ? () => H(b[Q]) : void 0,
69
+ valueFormat: V,
70
70
  titleKey: S,
71
- resolveColor: D ? (e) => $(e, Q) : void 0,
72
- classes: K
71
+ resolveColor: O ? (e) => $(e, Q) : void 0,
72
+ classes: q
73
73
  }) : null;
74
- return /* @__PURE__ */ h(e, {
74
+ return /* @__PURE__ */ h(i, {
75
75
  ref: Z,
76
76
  aspectRatio: w,
77
77
  height: T,
78
- className: W,
79
- style: G,
80
- classes: K,
81
- legend: F ? /* @__PURE__ */ h(t, {
78
+ className: G,
79
+ style: K,
80
+ classes: q,
81
+ legend: I ? /* @__PURE__ */ h(a, {
82
82
  config: C,
83
- classes: K
83
+ classes: q
84
84
  }) : void 0,
85
85
  overlay: te,
86
86
  children: ({ width: e, height: t }) => {
87
- let n = q.left, u = e - q.right, d = q.top, f = t - q.bottom, _ = Math.max(0, u - n), x = Math.max(0, f - d), w = b.map((e) => String(e[S])), T = a(w, [n, u], 0), D = [];
88
- for (let e of J) for (let t of b) {
87
+ let n = J.left, i = e - J.right, a = J.top, o = t - J.bottom, _ = Math.max(0, i - n), x = Math.max(0, o - a), w = b.map((e) => String(e[S])), T = l(w, [n, i], 0), O = [];
88
+ for (let e of Y) for (let t of b) {
89
89
  let n = t[e];
90
- typeof n == "number" && D.push(n);
90
+ typeof n == "number" && O.push(n);
91
91
  }
92
- let [F, I] = o(D), V = c(Math.min(0, F), I, L), H = s([V[0], V[V.length - 1]], [f, d]), U = V.map((e) => ({
92
+ let [I, L] = u(O), H = f(Math.min(0, I), L, R), U = d([H[0], H[H.length - 1]], [o, a]), W = H.map((e) => ({
93
93
  value: e,
94
- y: H(e)
95
- })), W = y(w).map((e) => ({
94
+ y: U(e)
95
+ })), G = y(w).map((e) => ({
96
96
  label: e,
97
97
  x: T(e)
98
98
  }));
99
99
  return /* @__PURE__ */ g(m, { children: [
100
- /* @__PURE__ */ h(i, {
101
- ticks: U,
100
+ /* @__PURE__ */ h(c, {
101
+ ticks: W,
102
102
  x: n,
103
103
  plotWidth: _,
104
- format: R,
105
- showGrid: P,
106
- classes: K
107
- }),
108
- /* @__PURE__ */ h(r, {
109
- ticks: W,
110
- y: f,
111
104
  format: z,
112
- classes: K
105
+ showGrid: F,
106
+ classes: q
107
+ }),
108
+ /* @__PURE__ */ h(s, {
109
+ ticks: G,
110
+ y: o,
111
+ format: B,
112
+ classes: q
113
113
  }),
114
- J.map((e) => {
114
+ Y.map((e) => {
115
115
  let t = C[e], n = b.map((t, n) => {
116
116
  let r = t[e], i = typeof r == "number" ? r : 0;
117
117
  return {
118
118
  x: T(w[n]),
119
- y: H(i),
119
+ y: U(i),
120
120
  value: i,
121
121
  row: t
122
122
  };
123
123
  });
124
124
  return /* @__PURE__ */ g("g", {
125
- className: p(l.series, K?.series),
125
+ className: r(p.series, q?.series),
126
126
  children: [
127
127
  /* @__PURE__ */ h("path", {
128
- className: p(l.linePath),
128
+ className: r(p.linePath),
129
129
  d: v(n, E),
130
130
  stroke: t.color
131
131
  }),
132
- ee && n.map((t, n) => {
133
- let r = $(e, n), i = Q === n, a = M !== void 0 && !i, o = N ? () => N({
132
+ D && n.map((t, n) => {
133
+ let i = $(e, n), a = Q === n, o = N !== void 0 && !a, s = P ? () => P({
134
134
  row: t.row,
135
135
  value: t.value,
136
136
  seriesKey: e,
137
137
  index: n
138
138
  }) : void 0;
139
- return O ? /* @__PURE__ */ h("g", {
140
- onClick: o,
141
- style: o ? { cursor: "pointer" } : void 0,
142
- opacity: a ? .45 : 1,
143
- children: O({
139
+ return k ? /* @__PURE__ */ h("g", {
140
+ onClick: s,
141
+ style: s ? { cursor: "pointer" } : void 0,
142
+ opacity: o ? .45 : 1,
143
+ children: k({
144
144
  row: t.row,
145
145
  value: t.value,
146
146
  seriesKey: e,
147
147
  index: n,
148
148
  x: t.x,
149
149
  y: t.y,
150
- color: r,
151
- active: i
150
+ color: i,
151
+ active: a
152
152
  })
153
153
  }, `${e}-${n}`) : /* @__PURE__ */ h("circle", {
154
- className: p(l.point, K?.point),
154
+ className: r(p.point, q?.point),
155
155
  cx: t.x,
156
156
  cy: t.y,
157
- r: i ? 5 : 3.5,
158
- fill: r,
159
- onClick: o,
160
- style: o ? { cursor: "pointer" } : void 0,
161
- opacity: a ? .45 : 1
157
+ r: a ? 5 : 3.5,
158
+ fill: i,
159
+ onClick: s,
160
+ style: s ? { cursor: "pointer" } : void 0,
161
+ opacity: o ? .45 : 1
162
162
  }, `${e}-${n}`);
163
163
  }),
164
- (k || j) && n.map((t, n) => {
165
- let r = j ? j({
164
+ (A || M) && n.map((t, n) => {
165
+ let i = M ? M({
166
166
  row: t.row,
167
167
  value: t.value,
168
168
  seriesKey: e,
169
169
  index: n
170
- }) : k ? B ? B(t.value) : String(t.value) : null;
171
- if (r == null) return null;
172
- let i = A === "top" ? t.y - 10 : t.y + 10 + 4;
170
+ }) : A ? V ? V(t.value) : String(t.value) : null;
171
+ if (i == null) return null;
172
+ let a = j === "top" ? t.y - 10 : t.y + 10 + 4;
173
173
  return /* @__PURE__ */ h("text", {
174
- className: p(l.axisLabel),
174
+ className: r(p.axisLabel),
175
175
  x: t.x,
176
- y: i,
176
+ y: a,
177
177
  textAnchor: "middle",
178
- dominantBaseline: A === "top" ? "auto" : "middle",
179
- children: r
178
+ dominantBaseline: j === "top" ? "auto" : "middle",
179
+ children: i
180
180
  }, `label-${e}-${n}`);
181
181
  })
182
182
  ]
183
183
  }, e);
184
184
  }),
185
185
  Q !== null && /* @__PURE__ */ h("line", {
186
- className: l.cursorLine,
186
+ className: p.cursorLine,
187
187
  x1: T(w[Q]),
188
188
  x2: T(w[Q]),
189
- y1: d,
190
- y2: f
189
+ y1: a,
190
+ y2: o
191
191
  }),
192
192
  /* @__PURE__ */ h("rect", {
193
- className: l.interactionLayer,
193
+ className: p.interactionLayer,
194
194
  x: n,
195
- y: d,
195
+ y: a,
196
196
  width: _,
197
197
  height: x,
198
198
  onMouseMove: (e) => {
@@ -200,25 +200,25 @@ function b({ data: b, xKey: S, config: C, aspectRatio: w = 16 / 9, height: T, cu
200
200
  X(a);
201
201
  },
202
202
  onMouseLeave: () => X(null),
203
- onClick: N ? (e) => {
204
- let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = T.step(), a = Math.max(0, Math.min(b.length - 1, Math.round((r - n - i / 2) / i))), o = J[0], s = b[a][o], c = typeof s == "number" ? s : 0;
205
- N({
203
+ onClick: P ? (e) => {
204
+ let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = T.step(), a = Math.max(0, Math.min(b.length - 1, Math.round((r - n - i / 2) / i))), o = Y[0], s = b[a][o], c = typeof s == "number" ? s : 0;
205
+ P({
206
206
  row: b[a],
207
207
  value: c,
208
208
  seriesKey: o,
209
209
  index: a
210
210
  });
211
211
  } : void 0,
212
- style: N ? { cursor: "pointer" } : void 0
212
+ style: P ? { cursor: "pointer" } : void 0
213
213
  })
214
214
  ] });
215
215
  }
216
216
  });
217
217
  }
218
218
  function x(e, t, n, r, i) {
219
- let o = i.current;
220
- if (!o) return 0;
221
- let s = o.getBoundingClientRect().width, c = e.map((e) => String(e[t]));
222
- return a(c, [n.left, s - n.right], 0)(c[r]);
219
+ let a = i.current;
220
+ if (!a) return 0;
221
+ let o = a.getBoundingClientRect().width, s = e.map((e) => String(e[t]));
222
+ return l(s, [n.left, o - n.right], 0)(s[r]);
223
223
  }
224
224
  export { b as LineChart };
@@ -1,8 +1,8 @@
1
- import { ChartContainer as e } from "./ChartContainer.js";
2
- import { ChartTooltip as t } from "./ChartTooltip.js";
3
- import n from "./Chart.module.js";
4
- import { useMemo as r, useRef as i, useState as a } from "react";
5
- import o from "clsx";
1
+ import { useMemo as e, useRef as t, useState as n } from "react";
2
+ import r from "clsx";
3
+ import { ChartContainer as i } from "./ChartContainer.js";
4
+ import { ChartTooltip as a } from "./ChartTooltip.js";
5
+ import o from "./Chart.module.scss.js";
6
6
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  // src/components/Chart/PieChart.tsx
8
8
  var u = [
@@ -58,20 +58,20 @@ function p(e, t, n, r, i) {
58
58
  };
59
59
  }
60
60
  function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspectRatio: y = 1, height: b, innerRadius: x = 0, outerRadius: S = "90%", strokeWidth: C = 2, strokeColor: w = "var(--crk-color-bg)", padAngle: T = 0, showLabels: E = !1, valuePosition: D = "outside", showLabelLines: O = !0, renderLabel: k, centerLabel: A, activeIndex: j, onSliceClick: M, showLegend: N = !0, showTooltip: P = !0, valueFormat: F, renderTooltip: I, emptyMessage: L = "No data", className: R, style: z, classes: B }) {
61
- let [V, H] = a(null), U = i(null), W = j ?? V, G = (e) => {
61
+ let [V, H] = n(null), U = t(null), W = j ?? V, G = (e) => {
62
62
  if (_) {
63
63
  let t = m[e]?.[_];
64
64
  if (typeof t == "string") return t;
65
65
  }
66
66
  return v[e % v.length];
67
- }, K = r(() => {
67
+ }, K = e(() => {
68
68
  let e = 0;
69
69
  for (let t of m) {
70
70
  let n = t[h];
71
71
  typeof n == "number" && n > 0 && (e += n);
72
72
  }
73
73
  return e;
74
- }, [m, h]), q = r(() => {
74
+ }, [m, h]), q = e(() => {
75
75
  let e = [], t = 0;
76
76
  for (let n = 0; n < m.length; n++) {
77
77
  let r = m[n], i = r[h], a = typeof i == "number" && i > 0 ? i : 0;
@@ -92,21 +92,21 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
92
92
  h,
93
93
  K
94
94
  ]), J = N ? /* @__PURE__ */ c("div", {
95
- className: o(n.legend, B?.legend),
95
+ className: r(o.legend, B?.legend),
96
96
  role: "list",
97
97
  children: q.map((e) => /* @__PURE__ */ l("div", {
98
- className: o(n.legendItem, B?.legendItem),
98
+ className: r(o.legendItem, B?.legendItem),
99
99
  role: "listitem",
100
100
  children: [/* @__PURE__ */ c("span", {
101
- className: n.legendSwatch,
101
+ className: o.legendSwatch,
102
102
  style: { background: G(e.index) },
103
103
  "aria-hidden": "true"
104
104
  }), /* @__PURE__ */ c("span", {
105
- className: n.legendLabel,
105
+ className: o.legendLabel,
106
106
  children: String(e.row[g])
107
107
  })]
108
108
  }, e.index))
109
- }) : void 0, Y = r(() => {
109
+ }) : void 0, Y = e(() => {
110
110
  let e = {};
111
111
  for (let t of q) e[t.index.toString()] = {
112
112
  label: String(t.row[g]),
@@ -116,17 +116,17 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
116
116
  }, [q]);
117
117
  return m.length === 0 || K === 0 ? /* @__PURE__ */ c("div", {
118
118
  ref: U,
119
- className: o(n.root, B?.root, R),
119
+ className: r(o.root, B?.root, R),
120
120
  style: z,
121
121
  children: /* @__PURE__ */ c("div", {
122
- className: n.canvas,
122
+ className: o.canvas,
123
123
  style: { height: b ?? 240 },
124
124
  children: /* @__PURE__ */ c("div", {
125
- className: n.empty,
125
+ className: o.empty,
126
126
  children: L
127
127
  })
128
128
  })
129
- }) : /* @__PURE__ */ c(e, {
129
+ }) : /* @__PURE__ */ c(i, {
130
130
  ref: U,
131
131
  aspectRatio: y,
132
132
  height: b,
@@ -134,7 +134,7 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
134
134
  style: z,
135
135
  classes: B,
136
136
  legend: J,
137
- overlay: P && W !== null && m[W] ? /* @__PURE__ */ c(t, {
137
+ overlay: P && W !== null && m[W] ? /* @__PURE__ */ c(a, {
138
138
  row: { [W.toString()]: m[W][h] },
139
139
  x: U.current ? U.current.getBoundingClientRect().width / 2 : 0,
140
140
  y: 16,
@@ -146,10 +146,10 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
146
146
  classes: B
147
147
  }) : null,
148
148
  children: ({ width: e, height: t }) => {
149
- let r = e / 2, i = t / 2, a = Math.min(e, t) / 2 - 4, u = d(S, a), m = Math.min(u - 1, d(x, a)), h = Math.max(4, u * .06);
149
+ let n = e / 2, i = t / 2, a = Math.min(e, t) / 2 - 4, u = d(S, a), m = Math.min(u - 1, d(x, a)), h = Math.max(4, u * .06);
150
150
  return /* @__PURE__ */ l(s, { children: [
151
151
  /* @__PURE__ */ c("g", { children: q.map((e) => {
152
- let t = T / 2, n = Math.min(e.end, e.start + t), a = Math.max(e.start, e.end - t), o = G(e.index), s = W === e.index, l = j !== void 0 && !s, d = s && j !== void 0 ? u + h : u, p = f(r, i, d, m, n, a), g = M ? () => M({
152
+ let t = T / 2, r = Math.min(e.end, e.start + t), a = Math.max(e.start, e.end - t), o = G(e.index), s = W === e.index, l = j !== void 0 && !s, d = s && j !== void 0 ? u + h : u, p = f(n, i, d, m, r, a), g = M ? () => M({
153
153
  row: e.row,
154
154
  value: e.value,
155
155
  index: e.index
@@ -174,13 +174,13 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
174
174
  index: e.index
175
175
  }) : E ? `${String(e.row[g])} ${F ? F(e.value) : Math.round(e.fraction * 100) + "%"}` : null;
176
176
  if (t == null) return null;
177
- let a = D === "inside", s = Math.max(16, u * .12), d = a ? (u + m) / 2 : u + s, f = p(r, i, d, e.start, e.end), h = a ? "middle" : f.x < r - 1 ? "end" : f.x > r + 1 ? "start" : "middle", _ = null;
177
+ let a = D === "inside", s = Math.max(16, u * .12), d = a ? (u + m) / 2 : u + s, f = p(n, i, d, e.start, e.end), h = a ? "middle" : f.x < n - 1 ? "end" : f.x > n + 1 ? "start" : "middle", _ = null;
178
178
  if (!a && O) {
179
- let t = p(r, i, u, e.start, e.end), n = h === "end" ? 4 : h === "start" ? -4 : 0;
179
+ let t = p(n, i, u, e.start, e.end), r = h === "end" ? 4 : h === "start" ? -4 : 0;
180
180
  _ = {
181
181
  x1: t.x,
182
182
  y1: t.y,
183
- x2: f.x + n,
183
+ x2: f.x + r,
184
184
  y2: f.y
185
185
  };
186
186
  }
@@ -195,14 +195,14 @@ function m({ data: m, valueKey: h, nameKey: g, colorKey: _, colors: v = u, aspec
195
195
  }), /* @__PURE__ */ c("text", {
196
196
  x: f.x,
197
197
  y: f.y,
198
- className: o(n.axisLabel, a && n.barLabelInside),
198
+ className: r(o.axisLabel, a && o.barLabelInside),
199
199
  textAnchor: h,
200
200
  dominantBaseline: "middle",
201
201
  children: t
202
202
  })] }, `label-${e.index}`);
203
203
  }),
204
204
  A !== void 0 && /* @__PURE__ */ c("foreignObject", {
205
- x: r - m,
205
+ x: n - m,
206
206
  y: i - m,
207
207
  width: Math.max(0, m * 2),
208
208
  height: Math.max(0, m * 2),
@@ -1,10 +1,10 @@
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 { extent as r, niceTicks as i } from "./scales.js";
5
- import a from "./Chart.module.js";
6
- import { useMemo as o, useRef as s, useState as c } from "react";
7
- import l from "clsx";
1
+ import { useMemo as e, useRef as t, useState as n } from "react";
2
+ import r from "clsx";
3
+ import { ChartContainer as i } from "./ChartContainer.js";
4
+ import { ChartLegend as a } from "./ChartLegend.js";
5
+ import { ChartTooltip as o } from "./ChartTooltip.js";
6
+ import { extent as s, niceTicks as c } from "./scales.js";
7
+ import l from "./Chart.module.scss.js";
8
8
  import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
9
9
  // src/components/Chart/RadarChart.tsx
10
10
  function p(e, t, n, r) {
@@ -21,39 +21,39 @@ function m(e, t, n, r) {
21
21
  }).join(" ");
22
22
  }
23
23
  function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, gridType: b = "polygon", showGrid: x = !0, showRadialLines: S = !0, showAxisLabels: C = !0, showRadiusAxis: w = !1, levels: T = 5, showPoints: E = !0, fillOpacity: D = .4, strokeWidth: O = 2, renderAxisLabel: k, axisFormat: A, valueFormat: j, renderTooltip: M, showLegend: N = !0, showTooltip: P = !0, emptyMessage: F = "No data", className: I, style: L, classes: R }) {
24
- let [z, B] = c(null), V = s(null), H = o(() => Object.keys(_), [_]), U = o(() => h.map((e, t) => t / h.length * 360), [h]), W = o(() => {
24
+ let [z, B] = n(null), V = t(null), H = e(() => Object.keys(_), [_]), U = e(() => h.map((e, t) => t / h.length * 360), [h]), W = e(() => {
25
25
  let e = [];
26
26
  for (let t of H) for (let n of h) {
27
27
  let r = n[t];
28
28
  typeof r == "number" && e.push(r);
29
29
  }
30
- let [, t] = r(e);
30
+ let [, t] = s(e);
31
31
  return Math.max(1, t);
32
- }, [h, H]), G = o(() => i(0, W, T).filter((e) => e > 0), [W, T]), K = G[G.length - 1] ?? W;
32
+ }, [h, H]), G = e(() => c(0, W, T).filter((e) => e > 0), [W, T]), K = G[G.length - 1] ?? W;
33
33
  return h.length === 0 ? /* @__PURE__ */ d("div", {
34
34
  ref: V,
35
- className: l(a.root, R?.root, I),
35
+ className: r(l.root, R?.root, I),
36
36
  style: L,
37
37
  children: /* @__PURE__ */ d("div", {
38
- className: a.canvas,
38
+ className: l.canvas,
39
39
  style: { height: y ?? 240 },
40
40
  children: /* @__PURE__ */ d("div", {
41
- className: a.empty,
41
+ className: l.empty,
42
42
  children: F
43
43
  })
44
44
  })
45
- }) : /* @__PURE__ */ d(e, {
45
+ }) : /* @__PURE__ */ d(i, {
46
46
  ref: V,
47
47
  aspectRatio: v,
48
48
  height: y,
49
49
  className: I,
50
50
  style: L,
51
51
  classes: R,
52
- legend: N ? /* @__PURE__ */ d(t, {
52
+ legend: N ? /* @__PURE__ */ d(a, {
53
53
  config: _,
54
54
  classes: R
55
55
  }) : void 0,
56
- overlay: P && z !== null ? /* @__PURE__ */ d(n, {
56
+ overlay: P && z !== null ? /* @__PURE__ */ d(o, {
57
57
  row: h[z],
58
58
  x: (V.current?.getBoundingClientRect().width ?? 0) / 2,
59
59
  y: 16,
@@ -65,28 +65,28 @@ function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, grid
65
65
  classes: R
66
66
  }) : null,
67
67
  children: ({ width: e, height: t }) => {
68
- let n = C ? 32 : 8, r = e / 2, i = t / 2, o = Math.max(0, Math.min(e, t) / 2 - n), s = (e) => Math.max(0, e) / K * o;
68
+ let n = C ? 32 : 8, i = e / 2, a = t / 2, o = Math.max(0, Math.min(e, t) / 2 - n), s = (e) => Math.max(0, e) / K * o;
69
69
  return /* @__PURE__ */ f(u, { children: [
70
70
  x && G.map((e) => {
71
71
  let t = s(e);
72
72
  return b === "circle" ? /* @__PURE__ */ d("circle", {
73
- className: l(a.gridLine, R?.grid),
74
- cx: r,
75
- cy: i,
73
+ className: r(l.gridLine, R?.grid),
74
+ cx: i,
75
+ cy: a,
76
76
  r: t,
77
77
  fill: "none"
78
78
  }, `ring-${e}`) : /* @__PURE__ */ d("polygon", {
79
- className: l(a.gridLine, R?.grid),
80
- points: m(r, i, t, U),
79
+ className: r(l.gridLine, R?.grid),
80
+ points: m(i, a, t, U),
81
81
  fill: "none"
82
82
  }, `ring-${e}`);
83
83
  }),
84
84
  S && U.map((e, t) => {
85
- let n = p(r, i, o, e);
85
+ let n = p(i, a, o, e);
86
86
  return /* @__PURE__ */ d("line", {
87
- className: l(a.gridLine, R?.grid),
88
- x1: r,
89
- y1: i,
87
+ className: r(l.gridLine, R?.grid),
88
+ x1: i,
89
+ y1: a,
90
90
  x2: n.x,
91
91
  y2: n.y
92
92
  }, `spoke-${t}`);
@@ -94,16 +94,16 @@ function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, grid
94
94
  w && G.map((e) => {
95
95
  let t = s(e);
96
96
  return /* @__PURE__ */ d("text", {
97
- className: l(a.axisLabel, R?.axisLabel),
98
- x: r + 4,
99
- y: i - t,
97
+ className: r(l.axisLabel, R?.axisLabel),
98
+ x: i + 4,
99
+ y: a - t,
100
100
  textAnchor: "start",
101
101
  dominantBaseline: "middle",
102
102
  children: j ? j(e) : e
103
103
  }, `raxis-${e}`);
104
104
  }),
105
105
  C && h.map((e, t) => {
106
- let n = U[t], s = p(r, i, o + 14, n), c = s.x < r - 1 ? "end" : s.x > r + 1 ? "start" : "middle";
106
+ let n = U[t], s = p(i, a, o + 14, n), c = s.x < i - 1 ? "end" : s.x > i + 1 ? "start" : "middle";
107
107
  if (k) return /* @__PURE__ */ d("g", { children: k({
108
108
  row: e,
109
109
  index: t,
@@ -114,7 +114,7 @@ function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, grid
114
114
  }) }, `label-${t}`);
115
115
  let u = String(e[g]), f = A ? A(u) : u;
116
116
  return /* @__PURE__ */ d("text", {
117
- className: l(a.axisLabel, R?.axisLabel),
117
+ className: r(l.axisLabel, R?.axisLabel),
118
118
  x: s.x,
119
119
  y: s.y,
120
120
  textAnchor: c,
@@ -124,11 +124,11 @@ function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, grid
124
124
  }),
125
125
  H.map((e) => {
126
126
  let t = _[e], n = h.map((t, n) => {
127
- let a = t[e], o = s(typeof a == "number" ? a : 0);
128
- return p(r, i, o, U[n]);
127
+ let r = t[e], o = s(typeof r == "number" ? r : 0);
128
+ return p(i, a, o, U[n]);
129
129
  }), o = n.map((e) => `${e.x},${e.y}`).join(" ");
130
130
  return /* @__PURE__ */ f("g", {
131
- className: l(a.series, R?.series),
131
+ className: r(l.series, R?.series),
132
132
  children: [/* @__PURE__ */ d("polygon", {
133
133
  points: o,
134
134
  fill: t.color,
@@ -137,25 +137,25 @@ function h({ data: h, axisKey: g, config: _, aspectRatio: v = 1, height: y, grid
137
137
  strokeWidth: O,
138
138
  strokeLinejoin: "round",
139
139
  strokeLinecap: "round"
140
- }), E && n.map((n, r) => /* @__PURE__ */ d("circle", {
141
- className: l(a.point, R?.point),
140
+ }), E && n.map((n, i) => /* @__PURE__ */ d("circle", {
141
+ className: r(l.point, R?.point),
142
142
  cx: n.x,
143
143
  cy: n.y,
144
- r: z === r ? 5 : 3.5,
144
+ r: z === i ? 5 : 3.5,
145
145
  fill: t.color
146
- }, `${e}-${r}`))]
146
+ }, `${e}-${i}`))]
147
147
  }, e);
148
148
  }),
149
149
  /* @__PURE__ */ d("rect", {
150
- className: a.interactionLayer,
150
+ className: l.interactionLayer,
151
151
  x: 0,
152
152
  y: 0,
153
153
  width: e,
154
154
  height: t,
155
155
  onMouseMove: (e) => {
156
- let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left - r, a = e.clientY - t.top - i;
157
- if (n === 0 && a === 0) return;
158
- let o = Math.atan2(a, n) * 180 / Math.PI + 90;
156
+ let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left - i, r = e.clientY - t.top - a;
157
+ if (n === 0 && r === 0) return;
158
+ let o = Math.atan2(r, n) * 180 / Math.PI + 90;
159
159
  o < 0 && (o += 360), o >= 360 && (o -= 360);
160
160
  let s = 360 / h.length, c = Math.round(o / s) % h.length;
161
161
  B(c);