@trackunit/react-chart-components 1.14.14 → 1.15.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/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/package.json +3 -3
package/index.cjs.js
CHANGED
|
@@ -278,7 +278,7 @@ const cvaLegendItemIndicator = cssClassVarianceUtilities.cvaMerge(["w-3", "mr-1"
|
|
|
278
278
|
*/
|
|
279
279
|
const LegendItem = ({ className, count, label, disabled, selected, onClick, color, "data-testid": dataTestId, onMouseEnter, onMouseLeave, unit, hideValue = false, }) => {
|
|
280
280
|
const handleOnClick = onClick && !disabled ? e => onClick(e) : undefined;
|
|
281
|
-
return (jsxRuntime.jsxs("div", { className: cvaLegendItem({ disabled, selected, isClickable: !disabled &&
|
|
281
|
+
return (jsxRuntime.jsxs("div", { className: cvaLegendItem({ disabled, selected, isClickable: !disabled && onClick !== undefined, className }), "data-testid": dataTestId, onClick: handleOnClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [jsxRuntime.jsx("div", { className: cvaLegendItemIndicator({ selected }), "data-testid": dataTestId ? `${dataTestId}-indicator` : null, style: { backgroundColor: color } }), jsxRuntime.jsxs("p", { className: "truncate text-xs", children: [label, "\u00A0"] }), hideValue ? null : (jsxRuntime.jsxs("p", { className: "text-xs", children: ["(", count ?? 0, ")", unit ?? ""] }))] }));
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
/**
|
|
@@ -395,7 +395,7 @@ const DonutChart = ({ data, size = "full", loading = false, onClick, className,
|
|
|
395
395
|
const handleChartClick = react.useCallback((evt) => {
|
|
396
396
|
if (onClick && data) {
|
|
397
397
|
const clickedEntry = data.find(x => {
|
|
398
|
-
if (
|
|
398
|
+
if (evt.data === null || evt.data === undefined || typeof evt.data !== "object" || !("id" in evt.data)) {
|
|
399
399
|
return false;
|
|
400
400
|
}
|
|
401
401
|
return x.id === evt.data.id;
|
|
@@ -633,7 +633,7 @@ const BarChart = ({ series, loading = false, onClick, className, "data-testid":
|
|
|
633
633
|
overflow: "truncate",
|
|
634
634
|
},
|
|
635
635
|
data: seriesData[0]?.data
|
|
636
|
-
.filter(({ value }) => value)
|
|
636
|
+
.filter(({ value }) => Boolean(value))
|
|
637
637
|
.map(data => (isDateData(data) ? data.date : data.key)),
|
|
638
638
|
},
|
|
639
639
|
],
|
|
@@ -644,7 +644,7 @@ const BarChart = ({ series, loading = false, onClick, className, "data-testid":
|
|
|
644
644
|
id: "insideX",
|
|
645
645
|
xAxisIndex: 0,
|
|
646
646
|
startValue: 0,
|
|
647
|
-
endValue: (seriesData[0]?.data.length
|
|
647
|
+
endValue: (seriesData[0]?.data.length ?? 0) > 10 ? 10 : (seriesData[0]?.data.length ?? 0),
|
|
648
648
|
showDetail: false,
|
|
649
649
|
},
|
|
650
650
|
]
|
package/index.esm.js
CHANGED
|
@@ -257,7 +257,7 @@ const cvaLegendItemIndicator = cvaMerge(["w-3", "mr-1", "h-3", "rounded-[50%]",
|
|
|
257
257
|
*/
|
|
258
258
|
const LegendItem = ({ className, count, label, disabled, selected, onClick, color, "data-testid": dataTestId, onMouseEnter, onMouseLeave, unit, hideValue = false, }) => {
|
|
259
259
|
const handleOnClick = onClick && !disabled ? e => onClick(e) : undefined;
|
|
260
|
-
return (jsxs("div", { className: cvaLegendItem({ disabled, selected, isClickable: !disabled &&
|
|
260
|
+
return (jsxs("div", { className: cvaLegendItem({ disabled, selected, isClickable: !disabled && onClick !== undefined, className }), "data-testid": dataTestId, onClick: handleOnClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [jsx("div", { className: cvaLegendItemIndicator({ selected }), "data-testid": dataTestId ? `${dataTestId}-indicator` : null, style: { backgroundColor: color } }), jsxs("p", { className: "truncate text-xs", children: [label, "\u00A0"] }), hideValue ? null : (jsxs("p", { className: "text-xs", children: ["(", count ?? 0, ")", unit ?? ""] }))] }));
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
/**
|
|
@@ -374,7 +374,7 @@ const DonutChart = ({ data, size = "full", loading = false, onClick, className,
|
|
|
374
374
|
const handleChartClick = useCallback((evt) => {
|
|
375
375
|
if (onClick && data) {
|
|
376
376
|
const clickedEntry = data.find(x => {
|
|
377
|
-
if (
|
|
377
|
+
if (evt.data === null || evt.data === undefined || typeof evt.data !== "object" || !("id" in evt.data)) {
|
|
378
378
|
return false;
|
|
379
379
|
}
|
|
380
380
|
return x.id === evt.data.id;
|
|
@@ -612,7 +612,7 @@ const BarChart = ({ series, loading = false, onClick, className, "data-testid":
|
|
|
612
612
|
overflow: "truncate",
|
|
613
613
|
},
|
|
614
614
|
data: seriesData[0]?.data
|
|
615
|
-
.filter(({ value }) => value)
|
|
615
|
+
.filter(({ value }) => Boolean(value))
|
|
616
616
|
.map(data => (isDateData(data) ? data.date : data.key)),
|
|
617
617
|
},
|
|
618
618
|
],
|
|
@@ -623,7 +623,7 @@ const BarChart = ({ series, loading = false, onClick, className, "data-testid":
|
|
|
623
623
|
id: "insideX",
|
|
624
624
|
xAxisIndex: 0,
|
|
625
625
|
startValue: 0,
|
|
626
|
-
endValue: (seriesData[0]?.data.length
|
|
626
|
+
endValue: (seriesData[0]?.data.length ?? 0) > 10 ? 10 : (seriesData[0]?.data.length ?? 0),
|
|
627
627
|
showDetail: false,
|
|
628
628
|
},
|
|
629
629
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-chart-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"echarts": "5.6.0",
|
|
11
11
|
"react": "19.0.0",
|
|
12
|
-
"@trackunit/date-and-time-utils": "1.11.
|
|
13
|
-
"@trackunit/react-date-and-time-hooks": "1.
|
|
12
|
+
"@trackunit/date-and-time-utils": "1.11.70",
|
|
13
|
+
"@trackunit/react-date-and-time-hooks": "1.15.0",
|
|
14
14
|
"@trackunit/ui-design-tokens": "1.11.67",
|
|
15
15
|
"@trackunit/shared-utils": "1.13.68",
|
|
16
16
|
"@trackunit/css-class-variance-utilities": "1.11.68",
|