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.
Files changed (37) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -2
  3. package/components/AppLayout/AppLayout.css +13 -3
  4. package/components/AppLayout/AppLayout.d.ts +5 -1
  5. package/components/AppLayout/AppLayout.js +4 -0
  6. package/components/AppSidebar/AppSidebar.css +237 -0
  7. package/components/AppSidebar/AppSidebar.d.ts +32 -3
  8. package/components/AppSidebar/AppSidebar.js +187 -16
  9. package/components/BottomNav/BottomNav.css +417 -0
  10. package/components/BottomNav/BottomNav.d.ts +73 -0
  11. package/components/BottomNav/BottomNav.js +100 -0
  12. package/components/Chart/AreaChart.js +67 -56
  13. package/components/Chart/BarChart.js +67 -56
  14. package/components/Chart/ComboChart.js +93 -82
  15. package/components/Chart/LineChart.js +59 -48
  16. package/components/Chart/PieChart.js +56 -45
  17. package/components/Chart/RadarChart.js +60 -49
  18. package/components/Chart/RadialChart.js +70 -59
  19. package/components/Chart/ScatterChart.js +61 -50
  20. package/components/Chart/StackedBarChart.js +64 -53
  21. package/components/Chart/Treemap.js +34 -23
  22. package/components/Nav/Nav.d.ts +11 -3
  23. package/components/Nav/Nav.js +3 -2
  24. package/components/SidebarPanel/SidebarPanel.css +291 -0
  25. package/components/SidebarPanel/SidebarPanel.d.ts +45 -0
  26. package/components/SidebarPanel/SidebarPanel.js +166 -0
  27. package/components/Stepper/Stepper.d.ts +3 -1
  28. package/components/Stepper/Stepper.js +1 -1
  29. package/components/TopAppBar/TopAppBar.css +464 -0
  30. package/components/TopAppBar/TopAppBar.d.ts +80 -0
  31. package/components/TopAppBar/TopAppBar.js +138 -0
  32. package/components/registry.json +25 -1
  33. package/components/registry.json.d.ts +25 -1
  34. package/components/registry.json.js +1 -1
  35. package/index.d.ts +3 -0
  36. package/index.js +6 -0
  37. 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("div", { className: classes, children: [
44
- (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
45
- /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
46
- title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
47
- subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
48
- ] }),
49
- summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
50
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
51
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
52
- ] }, i)) })
53
- ] }),
54
- /* @__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: [
55
- /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
56
- const color = s.color || seriesColors[i % seriesColors.length];
57
- return /* @__PURE__ */ jsxs("linearGradient", { id: `area-gradient-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
58
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.4 }),
59
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
60
- ] }, `grad-${s.dataKey}`);
61
- }) }),
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
- Area,
83
- {
84
- type: "monotone",
85
- dataKey: s.dataKey,
86
- name: s.label,
87
- stroke: s.color || seriesColors[i % seriesColors.length],
88
- strokeWidth: 2,
89
- fill: `url(#area-gradient-${s.dataKey})`,
90
- fillOpacity: s.fillOpacity ?? 1,
91
- stackId: stacked ? "stack" : void 0
92
- },
93
- s.dataKey
94
- )),
95
- showLegend && series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: 12 } })
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("div", { className: classes, children: [
50
- (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
51
- /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
52
- title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
53
- subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
54
- ] }),
55
- summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
56
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
57
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
58
- ] }, i)) })
59
- ] }),
60
- /* @__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: [
61
- /* @__PURE__ */ jsx(
62
- CartesianGrid,
63
- {
64
- vertical: false,
65
- stroke: gridColor,
66
- strokeDasharray: ""
67
- }
68
- ),
69
- /* @__PURE__ */ jsx(
70
- XAxis,
71
- {
72
- dataKey: xKey,
73
- tick: { fill: textSecondary, fontSize: 12 },
74
- tickLine: false,
75
- axisLine: { stroke: gridColor }
76
- }
77
- ),
78
- /* @__PURE__ */ jsx(
79
- YAxis,
80
- {
81
- tick: { fill: textSecondary, fontSize: 12 },
82
- tickLine: false,
83
- axisLine: false
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- Tooltip,
88
- {
89
- content: renderTooltip,
90
- cursor: { fill: cursorColor, opacity: 0.4 }
91
- }
92
- ),
93
- /* @__PURE__ */ jsx(
94
- Bar,
95
- {
96
- dataKey: yKey,
97
- fill: resolvedBarColor,
98
- radius: [3, 3, 0, 0],
99
- maxBarSize: 32
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("div", { className: classes, 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", { className: `${baseClass}__title`, children: title }),
62
- subtitle && /* @__PURE__ */ jsx("p", { 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(
70
- ComposedChart,
71
- {
72
- data,
73
- margin: { top: 8, right: secondaryAxis ? -12 : 4, bottom: 0, left: -12 },
74
- children: [
75
- /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
76
- /* @__PURE__ */ jsx(
77
- XAxis,
78
- {
79
- dataKey: xKey,
80
- tick: { fill: textSecondary, fontSize: 12 },
81
- tickLine: false,
82
- axisLine: { stroke: gridColor }
83
- }
84
- ),
85
- /* @__PURE__ */ jsx(
86
- YAxis,
87
- {
88
- yAxisId: "bar",
89
- tick: { fill: textSecondary, fontSize: 12 },
90
- tickLine: false,
91
- axisLine: false
92
- }
93
- ),
94
- secondaryAxis && /* @__PURE__ */ jsx(
95
- YAxis,
96
- {
97
- yAxisId: "line",
98
- orientation: "right",
99
- tick: { fill: textSecondary, fontSize: 12 },
100
- tickLine: false,
101
- axisLine: false
102
- }
103
- ),
104
- /* @__PURE__ */ jsx(
105
- Tooltip,
106
- {
107
- content: renderTooltip,
108
- cursor: { fill: cursorColor, opacity: 0.4 }
109
- }
110
- ),
111
- /* @__PURE__ */ jsx(
112
- Bar,
113
- {
114
- yAxisId: "bar",
115
- dataKey: barKey,
116
- name: resolvedBarLabel,
117
- fill: resolvedBarColor,
118
- radius: [3, 3, 0, 0],
119
- maxBarSize: 32
120
- }
121
- ),
122
- /* @__PURE__ */ jsx(
123
- Line,
124
- {
125
- yAxisId: secondaryAxis ? "line" : "bar",
126
- type: "monotone",
127
- dataKey: lineKey,
128
- name: resolvedLineLabel,
129
- stroke: resolvedLineColor,
130
- strokeWidth: 2,
131
- dot: false,
132
- activeDot: { r: 4, strokeWidth: 0 }
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("div", { className: classes, children: [
42
- (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
43
- /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
44
- title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
45
- subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
46
- ] }),
47
- summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
48
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
49
- /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
50
- ] }, i)) })
51
- ] }),
52
- /* @__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: [
53
- /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
54
- /* @__PURE__ */ jsx(
55
- XAxis,
56
- {
57
- dataKey: xKey,
58
- tick: { fill: textSecondary, fontSize: 12 },
59
- tickLine: false,
60
- axisLine: { stroke: gridColor }
61
- }
62
- ),
63
- /* @__PURE__ */ jsx(
64
- YAxis,
65
- {
66
- tick: { fill: textSecondary, fontSize: 12 },
67
- tickLine: false,
68
- axisLine: false
69
- }
70
- ),
71
- /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
72
- series.map((s, i) => /* @__PURE__ */ jsx(
73
- Line,
74
- {
75
- type: "monotone",
76
- dataKey: s.dataKey,
77
- name: s.label,
78
- stroke: s.color || seriesColors[i % seriesColors.length],
79
- strokeWidth: 2,
80
- strokeDasharray: s.strokeDasharray,
81
- dot: false,
82
- activeDot: { r: 4, strokeWidth: 0 }
83
- },
84
- s.dataKey
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