rift-ds 1.0.1 → 1.1.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.
- package/LICENSE +1 -1
- package/README.md +8 -2
- package/components/AppLayout/AppLayout.css +13 -3
- package/components/AppLayout/AppLayout.d.ts +5 -1
- package/components/AppLayout/AppLayout.js +4 -0
- package/components/AppSidebar/AppSidebar.css +237 -0
- package/components/AppSidebar/AppSidebar.d.ts +32 -3
- package/components/AppSidebar/AppSidebar.js +187 -16
- package/components/BottomNav/BottomNav.css +417 -0
- package/components/BottomNav/BottomNav.d.ts +73 -0
- package/components/BottomNav/BottomNav.js +100 -0
- package/components/Chart/AreaChart.js +67 -56
- package/components/Chart/BarChart.js +67 -56
- package/components/Chart/ComboChart.js +93 -82
- package/components/Chart/LineChart.js +59 -48
- package/components/Chart/PieChart.js +56 -45
- package/components/Chart/RadarChart.js +60 -49
- package/components/Chart/RadialChart.js +70 -59
- package/components/Chart/ScatterChart.js +61 -50
- package/components/Chart/StackedBarChart.js +64 -53
- package/components/Chart/Treemap.js +34 -23
- package/components/Nav/Nav.d.ts +11 -3
- package/components/Nav/Nav.js +3 -2
- package/components/SidebarPanel/SidebarPanel.css +291 -0
- package/components/SidebarPanel/SidebarPanel.d.ts +45 -0
- package/components/SidebarPanel/SidebarPanel.js +166 -0
- package/components/Stepper/Stepper.d.ts +3 -1
- package/components/Stepper/Stepper.js +1 -1
- package/components/TopAppBar/TopAppBar.css +464 -0
- package/components/TopAppBar/TopAppBar.d.ts +80 -0
- package/components/TopAppBar/TopAppBar.js +138 -0
- package/components/registry.json +25 -1
- package/components/registry.json.d.ts +25 -1
- package/components/registry.json.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/package.json +5 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useId, useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, AreaChart as AreaChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Area, Legend } from "recharts";
|
|
4
4
|
import { getChartSeriesColors } from "./palette.js";
|
|
5
5
|
import "./Chart.css";
|
|
@@ -30,6 +30,8 @@ const AreaChart = ({
|
|
|
30
30
|
bare = false,
|
|
31
31
|
className = ""
|
|
32
32
|
}) => {
|
|
33
|
+
const titleId = useId();
|
|
34
|
+
const subtitleId = useId();
|
|
33
35
|
const baseClass = "ds-chart";
|
|
34
36
|
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
35
37
|
const textSecondary = getCSSVar("--color-text-secondary", "#303030");
|
|
@@ -40,61 +42,70 @@ const AreaChart = ({
|
|
|
40
42
|
(props) => /* @__PURE__ */ jsx(AreaTooltip, { ...props }),
|
|
41
43
|
[]
|
|
42
44
|
);
|
|
43
|
-
return /* @__PURE__ */ jsxs(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
] },
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: classes,
|
|
49
|
+
role: "figure",
|
|
50
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
51
|
+
"aria-describedby": subtitle ? subtitleId : void 0,
|
|
52
|
+
children: [
|
|
53
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
55
|
+
title && /* @__PURE__ */ jsx("h3", { id: titleId, className: `${baseClass}__title`, children: title }),
|
|
56
|
+
subtitle && /* @__PURE__ */ jsx("p", { id: subtitleId, className: `${baseClass}__subtitle`, children: subtitle })
|
|
57
|
+
] }),
|
|
58
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
61
|
+
] }, i)) })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
64
|
+
/* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
|
|
65
|
+
const color = s.color || seriesColors[i % seriesColors.length];
|
|
66
|
+
return /* @__PURE__ */ jsxs("linearGradient", { id: `area-gradient-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
67
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.4 }),
|
|
68
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
|
|
69
|
+
] }, `grad-${s.dataKey}`);
|
|
70
|
+
}) }),
|
|
71
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
XAxis,
|
|
74
|
+
{
|
|
75
|
+
dataKey: xKey,
|
|
76
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
77
|
+
tickLine: false,
|
|
78
|
+
axisLine: { stroke: gridColor }
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
YAxis,
|
|
83
|
+
{
|
|
84
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
85
|
+
tickLine: false,
|
|
86
|
+
axisLine: false
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
90
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
91
|
+
Area,
|
|
92
|
+
{
|
|
93
|
+
type: "monotone",
|
|
94
|
+
dataKey: s.dataKey,
|
|
95
|
+
name: s.label,
|
|
96
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
97
|
+
strokeWidth: 2,
|
|
98
|
+
fill: `url(#area-gradient-${s.dataKey})`,
|
|
99
|
+
fillOpacity: s.fillOpacity ?? 1,
|
|
100
|
+
stackId: stacked ? "stack" : void 0
|
|
101
|
+
},
|
|
102
|
+
s.dataKey
|
|
103
|
+
)),
|
|
104
|
+
showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: 12 } })
|
|
105
|
+
] }) }) })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
);
|
|
98
109
|
};
|
|
99
110
|
export {
|
|
100
111
|
AreaChart
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useId, useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Bar } from "recharts";
|
|
4
4
|
import "./Chart.css";
|
|
5
5
|
function getCSSVar(name, fallback) {
|
|
@@ -35,6 +35,8 @@ const BarChart = ({
|
|
|
35
35
|
bare = false,
|
|
36
36
|
className = ""
|
|
37
37
|
}) => {
|
|
38
|
+
const titleId = useId();
|
|
39
|
+
const subtitleId = useId();
|
|
38
40
|
const baseClass = "ds-chart";
|
|
39
41
|
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
40
42
|
const resolvedBarColor = barColor || getCSSVar("--color-action-primary-bg", "#0E6E8F");
|
|
@@ -46,61 +48,70 @@ const BarChart = ({
|
|
|
46
48
|
(props) => /* @__PURE__ */ jsx(ChartTooltip, { ...props, barColor: resolvedBarColor, dataLabel }),
|
|
47
49
|
[resolvedBarColor, dataLabel]
|
|
48
50
|
);
|
|
49
|
-
return /* @__PURE__ */ jsxs(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: classes,
|
|
55
|
+
role: "figure",
|
|
56
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
57
|
+
"aria-describedby": subtitle ? subtitleId : void 0,
|
|
58
|
+
children: [
|
|
59
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
61
|
+
title && /* @__PURE__ */ jsx("h3", { id: titleId, className: `${baseClass}__title`, children: title }),
|
|
62
|
+
subtitle && /* @__PURE__ */ jsx("p", { id: subtitleId, className: `${baseClass}__subtitle`, children: subtitle })
|
|
63
|
+
] }),
|
|
64
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
66
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
67
|
+
] }, i)) })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
CartesianGrid,
|
|
72
|
+
{
|
|
73
|
+
vertical: false,
|
|
74
|
+
stroke: gridColor,
|
|
75
|
+
strokeDasharray: ""
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
XAxis,
|
|
80
|
+
{
|
|
81
|
+
dataKey: xKey,
|
|
82
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
83
|
+
tickLine: false,
|
|
84
|
+
axisLine: { stroke: gridColor }
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
YAxis,
|
|
89
|
+
{
|
|
90
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
91
|
+
tickLine: false,
|
|
92
|
+
axisLine: false
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
Tooltip,
|
|
97
|
+
{
|
|
98
|
+
content: renderTooltip,
|
|
99
|
+
cursor: { fill: cursorColor, opacity: 0.4 }
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
Bar,
|
|
104
|
+
{
|
|
105
|
+
dataKey: yKey,
|
|
106
|
+
fill: resolvedBarColor,
|
|
107
|
+
radius: [3, 3, 0, 0],
|
|
108
|
+
maxBarSize: 32
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }) }) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
104
115
|
};
|
|
105
116
|
export {
|
|
106
117
|
BarChart
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useId, useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, ComposedChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, Line } from "recharts";
|
|
4
4
|
import { getChartSeriesColors } from "./palette.js";
|
|
5
5
|
import "./Chart.css";
|
|
@@ -40,6 +40,8 @@ const ComboChart = ({
|
|
|
40
40
|
bare = false,
|
|
41
41
|
className = ""
|
|
42
42
|
}) => {
|
|
43
|
+
const titleId = useId();
|
|
44
|
+
const subtitleId = useId();
|
|
43
45
|
const baseClass = "ds-chart";
|
|
44
46
|
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
45
47
|
const seriesColors = getChartSeriesColors();
|
|
@@ -55,87 +57,96 @@ const ComboChart = ({
|
|
|
55
57
|
(props) => /* @__PURE__ */ jsx(ComboTooltip, { ...props }),
|
|
56
58
|
[]
|
|
57
59
|
);
|
|
58
|
-
return /* @__PURE__ */ jsxs(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
60
|
+
return /* @__PURE__ */ jsxs(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: classes,
|
|
64
|
+
role: "figure",
|
|
65
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
66
|
+
"aria-describedby": subtitle ? subtitleId : void 0,
|
|
67
|
+
children: [
|
|
68
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
70
|
+
title && /* @__PURE__ */ jsx("h3", { id: titleId, className: `${baseClass}__title`, children: title }),
|
|
71
|
+
subtitle && /* @__PURE__ */ jsx("p", { id: subtitleId, className: `${baseClass}__subtitle`, children: subtitle })
|
|
72
|
+
] }),
|
|
73
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
76
|
+
] }, i)) })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
|
|
79
|
+
ComposedChart,
|
|
80
|
+
{
|
|
81
|
+
data,
|
|
82
|
+
margin: { top: 8, right: secondaryAxis ? -12 : 4, bottom: 0, left: -12 },
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
XAxis,
|
|
87
|
+
{
|
|
88
|
+
dataKey: xKey,
|
|
89
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
90
|
+
tickLine: false,
|
|
91
|
+
axisLine: { stroke: gridColor }
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
YAxis,
|
|
96
|
+
{
|
|
97
|
+
yAxisId: "bar",
|
|
98
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
99
|
+
tickLine: false,
|
|
100
|
+
axisLine: false
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
secondaryAxis && /* @__PURE__ */ jsx(
|
|
104
|
+
YAxis,
|
|
105
|
+
{
|
|
106
|
+
yAxisId: "line",
|
|
107
|
+
orientation: "right",
|
|
108
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
109
|
+
tickLine: false,
|
|
110
|
+
axisLine: false
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
Tooltip,
|
|
115
|
+
{
|
|
116
|
+
content: renderTooltip,
|
|
117
|
+
cursor: { fill: cursorColor, opacity: 0.4 }
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
Bar,
|
|
122
|
+
{
|
|
123
|
+
yAxisId: "bar",
|
|
124
|
+
dataKey: barKey,
|
|
125
|
+
name: resolvedBarLabel,
|
|
126
|
+
fill: resolvedBarColor,
|
|
127
|
+
radius: [3, 3, 0, 0],
|
|
128
|
+
maxBarSize: 32
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
Line,
|
|
133
|
+
{
|
|
134
|
+
yAxisId: secondaryAxis ? "line" : "bar",
|
|
135
|
+
type: "monotone",
|
|
136
|
+
dataKey: lineKey,
|
|
137
|
+
name: resolvedLineLabel,
|
|
138
|
+
stroke: resolvedLineColor,
|
|
139
|
+
strokeWidth: 2,
|
|
140
|
+
dot: false,
|
|
141
|
+
activeDot: { r: 4, strokeWidth: 0 }
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
) }) })
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
);
|
|
139
150
|
};
|
|
140
151
|
export {
|
|
141
152
|
ComboChart
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useId, useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, LineChart as LineChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Line } from "recharts";
|
|
4
4
|
import { getChartSeriesColors } from "./palette.js";
|
|
5
5
|
import "./Chart.css";
|
|
@@ -28,6 +28,8 @@ const LineChart = ({
|
|
|
28
28
|
bare = false,
|
|
29
29
|
className = ""
|
|
30
30
|
}) => {
|
|
31
|
+
const titleId = useId();
|
|
32
|
+
const subtitleId = useId();
|
|
31
33
|
const baseClass = "ds-chart";
|
|
32
34
|
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
33
35
|
const textSecondary = getCSSVar("--color-text-secondary", "#303030");
|
|
@@ -38,53 +40,62 @@ const LineChart = ({
|
|
|
38
40
|
(props) => /* @__PURE__ */ jsx(LineChartTooltip, { ...props }),
|
|
39
41
|
[]
|
|
40
42
|
);
|
|
41
|
-
return /* @__PURE__ */ jsxs(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: classes,
|
|
47
|
+
role: "figure",
|
|
48
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
49
|
+
"aria-describedby": subtitle ? subtitleId : void 0,
|
|
50
|
+
children: [
|
|
51
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
52
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
53
|
+
title && /* @__PURE__ */ jsx("h3", { id: titleId, className: `${baseClass}__title`, children: title }),
|
|
54
|
+
subtitle && /* @__PURE__ */ jsx("p", { id: subtitleId, className: `${baseClass}__subtitle`, children: subtitle })
|
|
55
|
+
] }),
|
|
56
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
58
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
59
|
+
] }, i)) })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(LineChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
XAxis,
|
|
65
|
+
{
|
|
66
|
+
dataKey: xKey,
|
|
67
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
68
|
+
tickLine: false,
|
|
69
|
+
axisLine: { stroke: gridColor }
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
YAxis,
|
|
74
|
+
{
|
|
75
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
76
|
+
tickLine: false,
|
|
77
|
+
axisLine: false
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
81
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
82
|
+
Line,
|
|
83
|
+
{
|
|
84
|
+
type: "monotone",
|
|
85
|
+
dataKey: s.dataKey,
|
|
86
|
+
name: s.label,
|
|
87
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
88
|
+
strokeWidth: 2,
|
|
89
|
+
strokeDasharray: s.strokeDasharray,
|
|
90
|
+
dot: false,
|
|
91
|
+
activeDot: { r: 4, strokeWidth: 0 }
|
|
92
|
+
},
|
|
93
|
+
s.dataKey
|
|
94
|
+
))
|
|
95
|
+
] }) }) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
88
99
|
};
|
|
89
100
|
export {
|
|
90
101
|
LineChart
|