@overdoser/react-toolkit 0.21.0 → 0.22.1
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.
- package/AGENTS.md +1 -0
- package/CHANGELOG.md +35 -0
- package/components/Accordion/Accordion.js +48 -48
- package/components/ActionButton/ActionButton.js +23 -23
- package/components/ActionButton/CopyButton.js +5 -5
- package/components/Alert/Alert.js +13 -13
- package/components/Avatar/Avatar.js +12 -12
- package/components/Badge/Badge.js +6 -6
- package/components/Breadcrumbs/Breadcrumbs.js +15 -15
- package/components/Button/Button.js +14 -14
- package/components/Card/Card.js +26 -26
- package/components/Chart/AreaChart.js +103 -103
- package/components/Chart/Axis.js +7 -7
- package/components/Chart/BarChart.js +62 -62
- package/components/Chart/ChartContainer.js +11 -11
- package/components/Chart/ChartLegend.js +7 -7
- package/components/Chart/ChartTooltip.js +13 -13
- package/components/Chart/LineChart.js +88 -88
- package/components/Chart/PieChart.js +25 -25
- package/components/Chart/RadarChart.js +42 -42
- package/components/Chart/Sparkline.js +11 -11
- package/components/Chart/TradingChart.js +126 -126
- package/components/Chart/trading/period.js +3 -3
- package/components/Chip/Chip.js +24 -24
- package/components/CodeBlock/CodeBlock.js +31 -31
- package/components/CommandPalette/CommandPalette.js +166 -166
- package/components/ConfirmDialog/ConfirmDialog.js +60 -60
- package/components/Divider/Divider.js +10 -10
- package/components/Draggable/Draggable.js +29 -29
- package/components/Drawer/Drawer.js +53 -53
- package/components/Dropdown/Dropdown.js +66 -66
- package/components/Dropdown/DropdownItem.js +13 -13
- package/components/Dropdown/DropdownLabel.js +5 -5
- package/components/Dropdown/DropdownSeparator.js +5 -5
- package/components/Dropzone/Dropzone.js +15 -15
- package/components/EmptyState/EmptyState.js +11 -11
- package/components/Form/Form.js +17 -17
- package/components/Form/FormField.js +21 -21
- package/components/Form/FormRow.js +3 -3
- package/components/ImageViewer/ImageViewer.js +118 -118
- package/components/Kbd/Kbd.js +11 -11
- package/components/KeyValueList/KeyValueList.js +32 -32
- package/components/Link/Link.js +7 -7
- package/components/List/List.js +7 -7
- package/components/Loader/Loader.js +39 -39
- package/components/Modal/Modal.js +48 -48
- package/components/PageHeader/PageHeader.js +18 -18
- package/components/Pagination/Pagination.js +23 -23
- package/components/Popover/Popover.js +25 -25
- package/components/ProgressBar/ProgressBar.js +17 -17
- package/components/RelativeTime/RelativeTime.js +10 -10
- package/components/SegmentedControl/SegmentedControl.js +38 -38
- package/components/Skeleton/Skeleton.js +10 -10
- package/components/Spinner/Spinner.js +7 -7
- package/components/SplitButton/SplitButton.js +63 -63
- package/components/SplitPane/SplitPane.js +50 -50
- package/components/StatCard/StatCard.js +32 -32
- package/components/StatusDot/StatusDot.js +7 -7
- package/components/Table/Table.js +174 -174
- package/components/Tabs/Tabs.js +47 -47
- package/components/ThemeToggle/ThemeToggle.js +31 -31
- package/components/Timeline/GanttTimeline.js +213 -213
- package/components/Timeline/HistoryTimeline.js +306 -306
- package/components/Timeline/TimelineShared.js +103 -103
- package/components/Timeline/TraceEventDetails.js +103 -103
- package/components/Timeline/TraceTimeline.js +546 -546
- package/components/Timeline/historyLayout.js +2 -2
- package/components/Timer/Timer.js +39 -39
- package/components/Toast/Toast.js +59 -59
- package/components/ToggleIconButton/ToggleIconButton.js +9 -9
- package/components/Tooltip/Tooltip.js +16 -16
- package/components/Typography/Typography.js +5 -5
- package/components/inputs/Checkbox/Checkbox.js +11 -11
- package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
- package/components/inputs/DatePicker/CalendarPanel.js +113 -113
- package/components/inputs/DatePicker/DatePicker.js +39 -39
- package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
- package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
- package/components/inputs/DateTimePicker/TimeField.js +34 -34
- package/components/inputs/Input/Input.js +13 -13
- package/components/inputs/NumberInput/NumberInput.js +16 -16
- package/components/inputs/Radio/Radio.js +17 -17
- package/components/inputs/SearchInput/SearchInput.js +25 -25
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +485 -344
- package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
- package/components/inputs/Slider/Slider.js +21 -21
- package/components/inputs/Switch/Switch.js +4 -4
- package/components/inputs/Textarea/Textarea.js +8 -8
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +6 -3
- package/hooks/useResizable.js +1 -1
- package/hooks/useTheme.js +7 -7
- package/index.css +1 -1
- package/index.js +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +25 -4
- package/manifest.json +33 -4
- package/package.json +1 -1
- /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
- /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
- /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
- /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
- /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
- /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
- /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
- /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
- /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
- /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
- /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
- /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
- /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
- /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
- /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
- /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
- /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
- /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
- /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
- /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
- /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
- /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
- /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
- /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
- /package/components/List/{List.module.js → List.module.scss.js} +0 -0
- /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
- /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
- /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
- /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
- /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
- /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
- /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
- /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
- /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
- /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
- /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
- /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
- /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
- /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
- /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
- /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
- /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
- /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
- /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
- /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
- /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
- /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
- /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
- /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
- /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
- /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
- /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
- /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
- /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
- /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
- /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
- /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
- /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
- /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import d from "
|
|
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 { bandScale as s, extent as c, linearScale as l, niceTicks as u } from "./scales.js";
|
|
7
|
+
import d from "./Chart.module.scss.js";
|
|
8
8
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
9
|
// src/components/Chart/BarChart.tsx
|
|
10
10
|
var h = [
|
|
@@ -33,7 +33,7 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
33
33
|
let W = w === "horizontal", G = {
|
|
34
34
|
...W ? _ : g,
|
|
35
35
|
...se
|
|
36
|
-
}, K =
|
|
36
|
+
}, K = e(() => Object.keys(C), [C]), q = T && K.length > 1, [J, Y] = n(null), X = t(null), Z = y.map((e) => String(e[S])), Q = I ?? J, le = e(() => {
|
|
37
37
|
if (q) {
|
|
38
38
|
let e = 0, t = 0;
|
|
39
39
|
for (let n of y) {
|
|
@@ -51,7 +51,7 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
51
51
|
let r = t[n];
|
|
52
52
|
typeof r == "number" && e.push(r);
|
|
53
53
|
}
|
|
54
|
-
let [t, n] =
|
|
54
|
+
let [t, n] = c(e);
|
|
55
55
|
return [Math.min(0, t), Math.max(0, n)];
|
|
56
56
|
}, [
|
|
57
57
|
y,
|
|
@@ -60,18 +60,18 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
60
60
|
]);
|
|
61
61
|
if (y.length === 0) return /* @__PURE__ */ p("div", {
|
|
62
62
|
ref: X,
|
|
63
|
-
className: d
|
|
63
|
+
className: r(d.root, U?.root, V),
|
|
64
64
|
style: H,
|
|
65
65
|
children: /* @__PURE__ */ p("div", {
|
|
66
|
-
className:
|
|
66
|
+
className: d.canvas,
|
|
67
67
|
style: { height: D ?? 240 },
|
|
68
68
|
children: /* @__PURE__ */ p("div", {
|
|
69
|
-
className:
|
|
69
|
+
className: d.empty,
|
|
70
70
|
children: ce
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
});
|
|
74
|
-
let $ =
|
|
74
|
+
let $ = u(le[0], le[1], ae), ue = $[0], de = $[$.length - 1], fe = (e, t) => ie === "index" ? P[t % P.length] : C[e]?.color ?? P[0], pe = te && Q !== null && y[Q] ? /* @__PURE__ */ p(o, {
|
|
75
75
|
row: y[Q],
|
|
76
76
|
x: b(y, S, G, Q, X, W, O),
|
|
77
77
|
y: W ? x(y, S, G, Q, X, O) : 16,
|
|
@@ -86,34 +86,34 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
86
86
|
},
|
|
87
87
|
classes: U
|
|
88
88
|
}) : null;
|
|
89
|
-
return /* @__PURE__ */ p(
|
|
89
|
+
return /* @__PURE__ */ p(i, {
|
|
90
90
|
ref: X,
|
|
91
91
|
aspectRatio: E,
|
|
92
92
|
height: D,
|
|
93
93
|
className: V,
|
|
94
94
|
style: H,
|
|
95
95
|
classes: U,
|
|
96
|
-
legend: M ? /* @__PURE__ */ p(
|
|
96
|
+
legend: M ? /* @__PURE__ */ p(a, {
|
|
97
97
|
config: C,
|
|
98
98
|
classes: U
|
|
99
99
|
}) : void 0,
|
|
100
100
|
overlay: pe,
|
|
101
101
|
children: ({ width: e, height: t }) => {
|
|
102
|
-
let n = G.left, i = e - G.right,
|
|
102
|
+
let n = G.left, i = e - G.right, a = G.top, o = t - G.bottom, c = Math.max(0, i - n), u = Math.max(0, o - a), h = s(Z, W ? [a, o] : [n, i], O), g = h.bandWidth(), _ = l([ue, de], W ? [n, i] : [o, a]), b = _(0), x = g / (q ? 1 : Math.max(1, K.length)), S = x * (1 - k), C = $.map((e) => ({
|
|
103
103
|
value: e,
|
|
104
104
|
pos: _(e)
|
|
105
105
|
})), w = v(Z);
|
|
106
106
|
return /* @__PURE__ */ m(f, { children: [
|
|
107
107
|
j && /* @__PURE__ */ p("g", {
|
|
108
|
-
className: d
|
|
108
|
+
className: r(d.axis, U?.axis),
|
|
109
109
|
children: C.map(({ value: e, pos: t }) => W ? /* @__PURE__ */ p("line", {
|
|
110
|
-
className: d
|
|
110
|
+
className: r(d.gridLine, U?.grid),
|
|
111
111
|
x1: t,
|
|
112
112
|
x2: t,
|
|
113
|
-
y1:
|
|
114
|
-
y2:
|
|
113
|
+
y1: a,
|
|
114
|
+
y2: o
|
|
115
115
|
}, `g-${e}`) : /* @__PURE__ */ p("line", {
|
|
116
|
-
className: d
|
|
116
|
+
className: r(d.gridLine, U?.grid),
|
|
117
117
|
x1: n,
|
|
118
118
|
x2: i,
|
|
119
119
|
y1: t,
|
|
@@ -121,55 +121,55 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
121
121
|
}, `g-${e}`))
|
|
122
122
|
}),
|
|
123
123
|
/* @__PURE__ */ p("g", {
|
|
124
|
-
className: d
|
|
124
|
+
className: r(d.axis, U?.axis),
|
|
125
125
|
children: C.map(({ value: e, pos: t }) => {
|
|
126
|
-
let
|
|
126
|
+
let i = R ? R(e) : String(e);
|
|
127
127
|
return W ? /* @__PURE__ */ p("text", {
|
|
128
|
-
className: d
|
|
128
|
+
className: r(d.axisLabel, U?.axisLabel),
|
|
129
129
|
x: t,
|
|
130
|
-
y:
|
|
130
|
+
y: o + 16,
|
|
131
131
|
textAnchor: "middle",
|
|
132
|
-
children:
|
|
132
|
+
children: i
|
|
133
133
|
}, `vt-${e}`) : /* @__PURE__ */ p("text", {
|
|
134
|
-
className: d
|
|
134
|
+
className: r(d.axisLabel, U?.axisLabel),
|
|
135
135
|
x: n - 8,
|
|
136
136
|
y: t,
|
|
137
137
|
textAnchor: "end",
|
|
138
138
|
dominantBaseline: "middle",
|
|
139
|
-
children:
|
|
139
|
+
children: i
|
|
140
140
|
}, `vt-${e}`);
|
|
141
141
|
})
|
|
142
142
|
}),
|
|
143
143
|
/* @__PURE__ */ p("g", {
|
|
144
|
-
className: d
|
|
144
|
+
className: r(d.axis, U?.axis),
|
|
145
145
|
children: w.map((e) => {
|
|
146
|
-
let t = h(e),
|
|
146
|
+
let t = h(e), i = oe ? oe(e) : e;
|
|
147
147
|
return W ? /* @__PURE__ */ p("text", {
|
|
148
|
-
className: d
|
|
148
|
+
className: r(d.axisLabel, U?.axisLabel),
|
|
149
149
|
x: n - 8,
|
|
150
150
|
y: t,
|
|
151
151
|
textAnchor: "end",
|
|
152
152
|
dominantBaseline: "middle",
|
|
153
|
-
children:
|
|
153
|
+
children: i
|
|
154
154
|
}, `c-${e}`) : /* @__PURE__ */ p("text", {
|
|
155
|
-
className: d
|
|
155
|
+
className: r(d.axisLabel, U?.axisLabel),
|
|
156
156
|
x: t,
|
|
157
|
-
y:
|
|
157
|
+
y: o + 16,
|
|
158
158
|
textAnchor: "middle",
|
|
159
|
-
children:
|
|
159
|
+
children: i
|
|
160
160
|
}, `c-${e}`);
|
|
161
161
|
})
|
|
162
162
|
}),
|
|
163
163
|
y.map((e, t) => {
|
|
164
|
-
let n = h(Z[t]) - g / 2,
|
|
164
|
+
let n = h(Z[t]) - g / 2, i = 0, a = 0;
|
|
165
165
|
return /* @__PURE__ */ p("g", {
|
|
166
|
-
className: d
|
|
167
|
-
children: K.map((
|
|
168
|
-
let c = e[
|
|
166
|
+
className: r(d.series, U?.series),
|
|
167
|
+
children: K.map((o, s) => {
|
|
168
|
+
let c = e[o];
|
|
169
169
|
if (typeof c != "number") return null;
|
|
170
|
-
let l = c, u = fe(
|
|
171
|
-
q ? l >= 0 ? (y =
|
|
172
|
-
let C = _(y), w = _(b), T = q ? (g - S) / 2 :
|
|
170
|
+
let l = c, u = fe(o, t), f = F !== void 0 && l < 0 ? F : u, h = I === void 0 ? J === t : I === t, v = I !== void 0 && !h, y, b;
|
|
171
|
+
q ? l >= 0 ? (y = i, b = i + l, i = b) : (y = a, b = a + l, a = b) : (y = 0, b = l);
|
|
172
|
+
let C = _(y), w = _(b), T = q ? (g - S) / 2 : s * x + (x - S) / 2, E = 0, D = 0, O = 0, k = 0;
|
|
173
173
|
if (W) {
|
|
174
174
|
let e = Math.min(C, w), t = Math.max(C, w);
|
|
175
175
|
E = e, O = t - e, D = n + T, k = S;
|
|
@@ -180,7 +180,7 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
180
180
|
let j = re ? re({
|
|
181
181
|
row: e,
|
|
182
182
|
value: l,
|
|
183
|
-
seriesKey:
|
|
183
|
+
seriesKey: o,
|
|
184
184
|
index: t
|
|
185
185
|
}) : ne ? z ? z(l) : String(l) : null, M = ee({
|
|
186
186
|
isHorizontal: W,
|
|
@@ -192,7 +192,7 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
192
192
|
value: l
|
|
193
193
|
});
|
|
194
194
|
return /* @__PURE__ */ m("g", { children: [/* @__PURE__ */ p("rect", {
|
|
195
|
-
className: d
|
|
195
|
+
className: r(d.bar, h && d.activeBar, U?.point),
|
|
196
196
|
x: E,
|
|
197
197
|
y: D,
|
|
198
198
|
width: Math.max(0, O),
|
|
@@ -204,12 +204,12 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
204
204
|
onClick: L ? () => L({
|
|
205
205
|
row: e,
|
|
206
206
|
value: l,
|
|
207
|
-
seriesKey:
|
|
207
|
+
seriesKey: o,
|
|
208
208
|
index: t
|
|
209
209
|
}) : void 0,
|
|
210
210
|
style: L ? { cursor: "pointer" } : void 0
|
|
211
211
|
}), j != null && /* @__PURE__ */ p("text", {
|
|
212
|
-
className: d
|
|
212
|
+
className: r(d.axisLabel, (N === "inside" || N === "inside-start") && d.barLabelInside),
|
|
213
213
|
x: M.x,
|
|
214
214
|
y: M.y,
|
|
215
215
|
textAnchor: M.textAnchor,
|
|
@@ -217,26 +217,26 @@ function y({ data: y, xKey: S, config: C, orientation: w = "vertical", stacked:
|
|
|
217
217
|
transform: M.rotate ? `rotate(${M.rotate} ${M.x} ${M.y})` : void 0,
|
|
218
218
|
opacity: v ? .5 : 1,
|
|
219
219
|
children: j
|
|
220
|
-
})] },
|
|
220
|
+
})] }, o);
|
|
221
221
|
})
|
|
222
222
|
}, `group-${t}`);
|
|
223
223
|
}),
|
|
224
224
|
ue < 0 && de > 0 && /* @__PURE__ */ p("line", {
|
|
225
|
-
className: d
|
|
225
|
+
className: r(d.gridLine),
|
|
226
226
|
x1: W ? b : n,
|
|
227
227
|
x2: W ? b : i,
|
|
228
|
-
y1: W ?
|
|
229
|
-
y2: W ?
|
|
228
|
+
y1: W ? a : b,
|
|
229
|
+
y2: W ? o : b,
|
|
230
230
|
opacity: .9
|
|
231
231
|
}),
|
|
232
232
|
/* @__PURE__ */ p("rect", {
|
|
233
|
-
className:
|
|
233
|
+
className: d.interactionLayer,
|
|
234
234
|
x: n,
|
|
235
|
-
y:
|
|
236
|
-
width:
|
|
235
|
+
y: a,
|
|
236
|
+
width: c,
|
|
237
237
|
height: u,
|
|
238
238
|
onMouseMove: (e) => {
|
|
239
|
-
let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = e.clientY - t.top +
|
|
239
|
+
let t = e.currentTarget.getBoundingClientRect(), r = e.clientX - t.left + n, i = e.clientY - t.top + a, o = h.step(), s = W ? i - a : r - n, c = Math.max(0, Math.min(y.length - 1, Math.round((s - o / 2) / o)));
|
|
240
240
|
Y(c);
|
|
241
241
|
},
|
|
242
242
|
onMouseLeave: () => Y(null)
|
|
@@ -297,16 +297,16 @@ function ee({ isHorizontal: e, valuePosition: t, x: n, y: r, rectW: i, rectH: a,
|
|
|
297
297
|
dominantBaseline: s ? "auto" : "middle"
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
function b(e, t, n, i, a, o
|
|
301
|
-
let c =
|
|
300
|
+
function b(e, t, n, r, i, a, o) {
|
|
301
|
+
let c = i.current;
|
|
302
302
|
if (!c) return 0;
|
|
303
303
|
let l = c.getBoundingClientRect(), u = e.map((e) => String(e[t]));
|
|
304
|
-
return
|
|
304
|
+
return a ? l.width / 2 : s(u, [n.left, l.width - n.right], o)(u[r]);
|
|
305
305
|
}
|
|
306
|
-
function x(e, t, n, i, a
|
|
307
|
-
let
|
|
308
|
-
if (!
|
|
309
|
-
let c =
|
|
310
|
-
return
|
|
306
|
+
function x(e, t, n, r, i, a) {
|
|
307
|
+
let o = i.current;
|
|
308
|
+
if (!o) return 16;
|
|
309
|
+
let c = o.getBoundingClientRect(), l = e.map((e) => String(e[t]));
|
|
310
|
+
return s(l, [n.top, c.height - n.bottom], a)(l[r]);
|
|
311
311
|
}
|
|
312
312
|
export { y as BarChart };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import a from "
|
|
1
|
+
import { forwardRef as e, useImperativeHandle as t, useRef as n } from "react";
|
|
2
|
+
import r from "clsx";
|
|
3
|
+
import { useChartDimensions as i } from "./useChartDimensions.js";
|
|
4
|
+
import a from "./Chart.module.scss.js";
|
|
5
5
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
// src/components/Chart/ChartContainer.tsx
|
|
7
|
-
var c =
|
|
8
|
-
let g =
|
|
9
|
-
|
|
10
|
-
let { width: _ } =
|
|
7
|
+
var c = e(({ aspectRatio: e = 16 / 9, height: c, className: l, style: u, classes: d, legend: f, overlay: p, children: m }, h) => {
|
|
8
|
+
let g = n(null);
|
|
9
|
+
t(h, () => g.current);
|
|
10
|
+
let { width: _ } = i(g), v = Math.max(0, _), y = c ?? Math.round(v / e);
|
|
11
11
|
return /* @__PURE__ */ s("div", {
|
|
12
12
|
ref: g,
|
|
13
|
-
className: a
|
|
13
|
+
className: r(a.root, d?.root, l),
|
|
14
14
|
style: u,
|
|
15
15
|
children: [/* @__PURE__ */ s("div", {
|
|
16
|
-
className:
|
|
16
|
+
className: a.canvas,
|
|
17
17
|
style: { height: y || void 0 },
|
|
18
18
|
children: [v > 0 && y > 0 && /* @__PURE__ */ o("svg", {
|
|
19
|
-
className: a
|
|
19
|
+
className: r(a.svg, d?.svg),
|
|
20
20
|
width: v,
|
|
21
21
|
height: y,
|
|
22
22
|
viewBox: `0 0 ${v} ${y}`,
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
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/ChartLegend.tsx
|
|
5
5
|
function i({ config: i, order: a, classes: o }) {
|
|
6
6
|
let s = a ?? Object.keys(i);
|
|
7
7
|
return /* @__PURE__ */ n("div", {
|
|
8
|
-
className: t
|
|
8
|
+
className: e(t.legend, o?.legend),
|
|
9
9
|
role: "list",
|
|
10
10
|
children: s.map((a) => {
|
|
11
11
|
let s = i[a];
|
|
12
12
|
return s ? /* @__PURE__ */ r("div", {
|
|
13
|
-
className: t
|
|
13
|
+
className: e(t.legendItem, o?.legendItem),
|
|
14
14
|
role: "listitem",
|
|
15
15
|
children: [s.icon ? /* @__PURE__ */ n("span", {
|
|
16
|
-
className:
|
|
16
|
+
className: t.legendIcon,
|
|
17
17
|
style: { color: s.color },
|
|
18
18
|
"aria-hidden": "true",
|
|
19
19
|
children: s.icon
|
|
20
20
|
}) : /* @__PURE__ */ n("span", {
|
|
21
|
-
className:
|
|
21
|
+
className: t.legendSwatch,
|
|
22
22
|
style: { background: s.color },
|
|
23
23
|
"aria-hidden": "true"
|
|
24
24
|
}), /* @__PURE__ */ n("span", {
|
|
25
|
-
className:
|
|
25
|
+
className: t.legendLabel,
|
|
26
26
|
children: s.label
|
|
27
27
|
})]
|
|
28
28
|
}, a) : null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
1
|
+
import e from "clsx";
|
|
2
|
+
import t from "./Chart.module.scss.js";
|
|
3
3
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
// src/components/Chart/ChartTooltip.tsx
|
|
5
5
|
function a({ row: a, x: o, y: s, containerWidth: c, config: l, render: u, valueFormat: d = String, titleKey: f, resolveColor: p, classes: m }) {
|
|
6
6
|
if (!a) return null;
|
|
7
7
|
let h = o + 180 + 16 > c ? o - 180 - 12 : o + 12, g = Math.max(8, s - 16);
|
|
8
8
|
return /* @__PURE__ */ r("div", {
|
|
9
|
-
className: t
|
|
9
|
+
className: e(t.tooltip, m?.tooltip),
|
|
10
10
|
style: {
|
|
11
11
|
left: h,
|
|
12
12
|
top: g,
|
|
@@ -14,32 +14,32 @@ function a({ row: a, x: o, y: s, containerWidth: c, config: l, render: u, valueF
|
|
|
14
14
|
},
|
|
15
15
|
role: "tooltip",
|
|
16
16
|
children: u ? u(a) : /* @__PURE__ */ i(n, { children: [f && a[f] !== void 0 && /* @__PURE__ */ r("div", {
|
|
17
|
-
className:
|
|
17
|
+
className: t.tooltipTitle,
|
|
18
18
|
children: String(a[f])
|
|
19
19
|
}), /* @__PURE__ */ r("div", {
|
|
20
|
-
className:
|
|
21
|
-
children: Object.entries(l).map(([
|
|
22
|
-
let o = a[
|
|
20
|
+
className: t.tooltipRows,
|
|
21
|
+
children: Object.entries(l).map(([e, n]) => {
|
|
22
|
+
let o = a[e];
|
|
23
23
|
if (o == null) return null;
|
|
24
|
-
let s = typeof o == "number" ? d(o) : String(o), c = p?.(
|
|
24
|
+
let s = typeof o == "number" ? d(o) : String(o), c = p?.(e) ?? n.color;
|
|
25
25
|
return /* @__PURE__ */ i("div", {
|
|
26
|
-
className:
|
|
26
|
+
className: t.tooltipRow,
|
|
27
27
|
children: [
|
|
28
28
|
/* @__PURE__ */ r("span", {
|
|
29
|
-
className:
|
|
29
|
+
className: t.legendSwatch,
|
|
30
30
|
style: { background: c },
|
|
31
31
|
"aria-hidden": "true"
|
|
32
32
|
}),
|
|
33
33
|
/* @__PURE__ */ r("span", {
|
|
34
|
-
className:
|
|
34
|
+
className: t.tooltipLabel,
|
|
35
35
|
children: n.label
|
|
36
36
|
}),
|
|
37
37
|
/* @__PURE__ */ r("span", {
|
|
38
|
-
className:
|
|
38
|
+
className: t.tooltipValue,
|
|
39
39
|
children: s
|
|
40
40
|
})
|
|
41
41
|
]
|
|
42
|
-
},
|
|
42
|
+
}, e);
|
|
43
43
|
})
|
|
44
44
|
})] })
|
|
45
45
|
});
|