@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
package/components/Card/Card.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import i from "
|
|
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 =
|
|
7
|
-
let { classes: u } =
|
|
8
|
-
return /* @__PURE__ */ a(
|
|
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
|
|
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 =
|
|
17
|
-
let { classes: h } =
|
|
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
|
|
20
|
+
className: r(i.header, u && i.headerDivider, h.header, d),
|
|
21
21
|
...p,
|
|
22
22
|
children: [/* @__PURE__ */ o("div", {
|
|
23
|
-
className:
|
|
23
|
+
className: i.headerMain,
|
|
24
24
|
children: [g && /* @__PURE__ */ o("div", {
|
|
25
|
-
className:
|
|
26
|
-
children: [
|
|
27
|
-
className: i
|
|
28
|
-
children:
|
|
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
|
|
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 =
|
|
39
|
-
let { classes: l } =
|
|
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
|
|
42
|
+
className: r(i.body, l.body, e),
|
|
43
43
|
...o,
|
|
44
|
-
children:
|
|
44
|
+
children: t
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
u.displayName = "Card.Body";
|
|
48
|
-
var d =
|
|
49
|
-
let { classes: d } =
|
|
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
|
|
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 =
|
|
59
|
-
let b = l != null, x =
|
|
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
|
|
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 {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import c from "./
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { Fragment as
|
|
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
|
|
11
|
+
var m = {
|
|
12
12
|
top: 12,
|
|
13
13
|
right: 16,
|
|
14
14
|
bottom: 28,
|
|
15
15
|
left: 48
|
|
16
16
|
};
|
|
17
|
-
function
|
|
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
|
|
33
|
+
function g(e, t, n) {
|
|
34
34
|
if (e.length === 0) return "";
|
|
35
|
-
let r =
|
|
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} ${
|
|
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
|
|
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
|
|
51
|
-
let U =
|
|
52
|
-
...
|
|
53
|
-
...
|
|
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,
|
|
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 <
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
80
|
+
v,
|
|
81
81
|
W,
|
|
82
82
|
G,
|
|
83
83
|
K
|
|
84
|
-
]), [ie, ae] =
|
|
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 (
|
|
95
|
+
if (v.length === 0) return /* @__PURE__ */ f("div", {
|
|
96
96
|
ref: Y,
|
|
97
|
-
className:
|
|
97
|
+
className: i(d.root, H?.root, B),
|
|
98
98
|
style: V,
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
-
className:
|
|
101
|
-
style: { height:
|
|
102
|
-
children: /* @__PURE__ */
|
|
103
|
-
className:
|
|
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 :
|
|
109
|
-
return /* @__PURE__ */
|
|
108
|
+
let $ = q === null ? void 0 : v[q];
|
|
109
|
+
return /* @__PURE__ */ f(a, {
|
|
110
110
|
ref: Y,
|
|
111
|
-
aspectRatio:
|
|
112
|
-
height:
|
|
111
|
+
aspectRatio: C,
|
|
112
|
+
height: w,
|
|
113
113
|
className: B,
|
|
114
114
|
style: V,
|
|
115
115
|
classes: H,
|
|
116
|
-
legend:
|
|
117
|
-
config:
|
|
116
|
+
legend: j ? /* @__PURE__ */ f(o, {
|
|
117
|
+
config: S,
|
|
118
118
|
classes: H
|
|
119
119
|
}) : void 0,
|
|
120
|
-
overlay:
|
|
120
|
+
overlay: M && q !== null && $ ? /* @__PURE__ */ f(s, {
|
|
121
121
|
row: $,
|
|
122
|
-
x:
|
|
122
|
+
x: b(v, x, U, q, Y),
|
|
123
123
|
y: 16,
|
|
124
124
|
containerWidth: Y.current?.getBoundingClientRect().width ?? 0,
|
|
125
|
-
config:
|
|
125
|
+
config: S,
|
|
126
126
|
render: L ? () => L($) : void 0,
|
|
127
|
-
valueFormat: K ?
|
|
128
|
-
titleKey:
|
|
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,
|
|
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
|
-
] :
|
|
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:
|
|
141
|
-
})),
|
|
140
|
+
y: w(e)
|
|
141
|
+
})), j = _(y).map((e) => ({
|
|
142
142
|
label: e,
|
|
143
|
-
x:
|
|
144
|
-
})),
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
|
|
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__ */
|
|
152
|
+
children: [/* @__PURE__ */ f("stop", {
|
|
153
153
|
offset: "5%",
|
|
154
|
-
stopColor:
|
|
154
|
+
stopColor: S[e].color,
|
|
155
155
|
stopOpacity: .6
|
|
156
|
-
}), /* @__PURE__ */
|
|
156
|
+
}), /* @__PURE__ */ f("stop", {
|
|
157
157
|
offset: "95%",
|
|
158
|
-
stopColor:
|
|
158
|
+
stopColor: S[e].color,
|
|
159
159
|
stopOpacity: .05
|
|
160
160
|
})]
|
|
161
161
|
}, e)) }),
|
|
162
|
-
|
|
163
|
-
ticks:
|
|
162
|
+
A ? /* @__PURE__ */ f(l, {
|
|
163
|
+
ticks: D,
|
|
164
164
|
x: n,
|
|
165
|
-
plotWidth:
|
|
166
|
-
format:
|
|
167
|
-
showGrid:
|
|
165
|
+
plotWidth: s,
|
|
166
|
+
format: M,
|
|
167
|
+
showGrid: k,
|
|
168
168
|
classes: H
|
|
169
|
-
}) :
|
|
170
|
-
className:
|
|
171
|
-
children:
|
|
172
|
-
className:
|
|
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:
|
|
174
|
+
x2: r,
|
|
175
175
|
y1: t,
|
|
176
176
|
y2: t
|
|
177
177
|
}, `grid-${e}`))
|
|
178
178
|
}),
|
|
179
|
-
|
|
180
|
-
ticks:
|
|
181
|
-
y:
|
|
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 =
|
|
187
|
-
x:
|
|
188
|
-
y:
|
|
189
|
-
})),
|
|
190
|
-
return /* @__PURE__ */
|
|
191
|
-
className:
|
|
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__ */
|
|
194
|
-
className:
|
|
195
|
-
d:
|
|
196
|
-
fill:
|
|
197
|
-
fillOpacity:
|
|
193
|
+
/* @__PURE__ */ f("path", {
|
|
194
|
+
className: d.areaPath,
|
|
195
|
+
d: s,
|
|
196
|
+
fill: a,
|
|
197
|
+
fillOpacity: o
|
|
198
198
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
className:
|
|
201
|
-
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__ */
|
|
205
|
-
className:
|
|
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__ */
|
|
215
|
-
className:
|
|
216
|
-
x1:
|
|
217
|
-
x2:
|
|
218
|
-
y1:
|
|
219
|
-
y2:
|
|
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__ */
|
|
222
|
-
className:
|
|
221
|
+
/* @__PURE__ */ f("rect", {
|
|
222
|
+
className: d.interactionLayer,
|
|
223
223
|
x: n,
|
|
224
|
-
y:
|
|
225
|
-
width:
|
|
226
|
-
height:
|
|
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 =
|
|
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
|
|
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
|
|
249
|
-
let
|
|
250
|
-
if (!
|
|
251
|
-
let
|
|
252
|
-
return
|
|
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 {
|
|
254
|
+
export { v as AreaChart };
|
package/components/Chart/Axis.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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/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
|
|
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
|
|
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
|
|
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
|
|
26
|
+
className: e(t.axis, o?.axis),
|
|
27
27
|
children: r.map(({ label: r, x: s }) => /* @__PURE__ */ n("text", {
|
|
28
|
-
className: t
|
|
28
|
+
className: e(t.axisLabel, o?.axisLabel),
|
|
29
29
|
x: s,
|
|
30
30
|
y: i + 16,
|
|
31
31
|
textAnchor: "middle",
|