@trackunit/react-chart-components 2.17.39-alpha-b8d3d323d1a.0 → 2.17.40
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 +2 -3
- package/index.esm.js +4 -5
- package/package.json +7 -7
package/index.cjs.js
CHANGED
|
@@ -317,7 +317,6 @@ const LegendItem = ({ className, style, count, label, disabled = false, selected
|
|
|
317
317
|
return (jsxRuntime.jsxs("div", { "aria-checked": isSwitch ? selected : undefined, className: cvaLegendItem({ disabled, selected, isClickable: isSwitch, className }), "data-testid": dataTestId, onClick: handleOnClick, onKeyDown: handleOnKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: isSwitch ? "switch" : undefined, style: style, tabIndex: isSwitch ? 0 : undefined, children: [jsxRuntime.jsx(LegendItemSwatch, { color: color, dataTestId: dataTestId, indicator: indicator, symbol: symbol }), jsxRuntime.jsxs("p", { className: "truncate text-xs", children: [label, "\u00A0"] }), hideValue ? null : jsxRuntime.jsx("p", { className: "text-xs", children: `(${count ?? 0}${unit ?? ""})` })] }));
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
-
const chartCategoryColorList = sharedUtils.objectValues(uiDesignTokens.CHART_CATEGORY);
|
|
321
320
|
/**
|
|
322
321
|
* Re-ordered chart colors to ensure that adjacent colors are visually different.
|
|
323
322
|
*
|
|
@@ -325,7 +324,7 @@ const chartCategoryColorList = sharedUtils.objectValues(uiDesignTokens.CHART_CAT
|
|
|
325
324
|
*/
|
|
326
325
|
const useChartColor = () => {
|
|
327
326
|
const chartColor = react.useCallback((index) => {
|
|
328
|
-
return
|
|
327
|
+
return uiDesignTokens.DEFAULT_CHART_COLORS[index % uiDesignTokens.DEFAULT_CHART_COLORS.length] ?? "#000000";
|
|
329
328
|
}, []);
|
|
330
329
|
const chartColorArray = react.useCallback((total) => {
|
|
331
330
|
return Array.from({ length: total }, (_, index) => chartColor(index));
|
|
@@ -601,7 +600,7 @@ const useLimitDataSet = (data, limit, autoSortData = true, othersName) => {
|
|
|
601
600
|
name: othersName ?? "Others",
|
|
602
601
|
selected: false,
|
|
603
602
|
value: tail.reduce((acc, curr) => acc + (curr.value ?? 0), 0),
|
|
604
|
-
color: uiDesignTokens.
|
|
603
|
+
color: uiDesignTokens.DEFAULT_CHART_OTHER,
|
|
605
604
|
original: othersOriginal,
|
|
606
605
|
});
|
|
607
606
|
return result;
|
package/index.esm.js
CHANGED
|
@@ -2,10 +2,10 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { cva } from '@trackunit/css-class-variance-utilities';
|
|
3
3
|
import { toDateUtil } from '@trackunit/date-and-time-utils';
|
|
4
4
|
import { useLocale, useDateAndTime } from '@trackunit/react-date-and-time-hooks';
|
|
5
|
-
import {
|
|
5
|
+
import { DEFAULT_CHART_COLORS, CHART_STATUS_COLORS, fontFamily, DEFAULT_CHART_OTHER } from '@trackunit/ui-design-tokens';
|
|
6
6
|
import { useRef, useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { useMergeRefs, Spinner, Text } from '@trackunit/react-components';
|
|
8
|
-
import { objectKeys, exhaustiveCheck
|
|
8
|
+
import { objectKeys, exhaustiveCheck } from '@trackunit/shared-utils';
|
|
9
9
|
import * as echarts from 'echarts';
|
|
10
10
|
|
|
11
11
|
function isECElementEvent(value) {
|
|
@@ -296,7 +296,6 @@ const LegendItem = ({ className, style, count, label, disabled = false, selected
|
|
|
296
296
|
return (jsxs("div", { "aria-checked": isSwitch ? selected : undefined, className: cvaLegendItem({ disabled, selected, isClickable: isSwitch, className }), "data-testid": dataTestId, onClick: handleOnClick, onKeyDown: handleOnKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: ref, role: isSwitch ? "switch" : undefined, style: style, tabIndex: isSwitch ? 0 : undefined, children: [jsx(LegendItemSwatch, { color: color, dataTestId: dataTestId, indicator: indicator, symbol: symbol }), jsxs("p", { className: "truncate text-xs", children: [label, "\u00A0"] }), hideValue ? null : jsx("p", { className: "text-xs", children: `(${count ?? 0}${unit ?? ""})` })] }));
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
const chartCategoryColorList = objectValues(CHART_CATEGORY);
|
|
300
299
|
/**
|
|
301
300
|
* Re-ordered chart colors to ensure that adjacent colors are visually different.
|
|
302
301
|
*
|
|
@@ -304,7 +303,7 @@ const chartCategoryColorList = objectValues(CHART_CATEGORY);
|
|
|
304
303
|
*/
|
|
305
304
|
const useChartColor = () => {
|
|
306
305
|
const chartColor = useCallback((index) => {
|
|
307
|
-
return
|
|
306
|
+
return DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length] ?? "#000000";
|
|
308
307
|
}, []);
|
|
309
308
|
const chartColorArray = useCallback((total) => {
|
|
310
309
|
return Array.from({ length: total }, (_, index) => chartColor(index));
|
|
@@ -580,7 +579,7 @@ const useLimitDataSet = (data, limit, autoSortData = true, othersName) => {
|
|
|
580
579
|
name: othersName ?? "Others",
|
|
581
580
|
selected: false,
|
|
582
581
|
value: tail.reduce((acc, curr) => acc + (curr.value ?? 0), 0),
|
|
583
|
-
color:
|
|
582
|
+
color: DEFAULT_CHART_OTHER,
|
|
584
583
|
original: othersOriginal,
|
|
585
584
|
});
|
|
586
585
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-chart-components",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.40",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"migrations": "./migrations.json",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"echarts": "5.6.0",
|
|
12
|
-
"@trackunit/date-and-time-utils": "1.20.44
|
|
13
|
-
"@trackunit/react-date-and-time-hooks": "2.17.
|
|
14
|
-
"@trackunit/ui-design-tokens": "1.21.41
|
|
15
|
-
"@trackunit/shared-utils": "1.22.43
|
|
16
|
-
"@trackunit/css-class-variance-utilities": "2.6.43
|
|
17
|
-
"@trackunit/react-components": "6.0.
|
|
12
|
+
"@trackunit/date-and-time-utils": "1.20.44",
|
|
13
|
+
"@trackunit/react-date-and-time-hooks": "2.17.40",
|
|
14
|
+
"@trackunit/ui-design-tokens": "1.21.41",
|
|
15
|
+
"@trackunit/shared-utils": "1.22.43",
|
|
16
|
+
"@trackunit/css-class-variance-utilities": "2.6.43",
|
|
17
|
+
"@trackunit/react-components": "6.0.38"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@apollo/client": "^3.13.8",
|