@kubit-ui-web/react-charts 0.1.0 → 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/README.md +31 -36
- package/dist/cjs/charts/barChart/barChart.js +12 -29
- package/dist/cjs/charts/barChart/barChart.type.js +1 -2
- package/dist/cjs/charts/barChart/barChartStructure.js +25 -29
- package/dist/cjs/charts/barChart/context/barChartContext.js +2 -5
- package/dist/cjs/charts/barChart/context/buildBarContextValues.js +17 -21
- package/dist/cjs/charts/barChart/fragments/barChartPath.js +12 -16
- package/dist/cjs/charts/barChart/fragments/barChartSeparator.js +10 -14
- package/dist/cjs/charts/barChart/fragments/barChartXAxis.js +10 -14
- package/dist/cjs/charts/barChart/fragments/barChartYAxis.js +13 -17
- package/dist/cjs/charts/barChart/fragments/fixture/barContextData.js +3 -6
- package/dist/cjs/charts/barChart/fragments/fixture/index.js +1 -5
- package/dist/cjs/charts/barChart/index.js +1 -17
- package/dist/cjs/charts/barChart/utils/countBarChildren.js +5 -9
- package/dist/cjs/charts/barChart/utils/getAxisExtraSpacing.js +31 -35
- package/dist/cjs/charts/barChart/utils/getBarDataValue.js +1 -5
- package/dist/cjs/charts/barChart/utils/getRoundedBarMaxValue.js +1 -5
- package/dist/cjs/charts/index.js +3 -19
- package/dist/cjs/charts/lineChart/context/buildLineContextValue.js +17 -21
- package/dist/cjs/charts/lineChart/context/index.js +2 -7
- package/dist/cjs/charts/lineChart/context/lineChartContext.js +2 -5
- package/dist/cjs/charts/lineChart/fragments/fixture/contextData.js +1 -4
- package/dist/cjs/charts/lineChart/fragments/fixture/index.js +1 -5
- package/dist/cjs/charts/lineChart/fragments/index.js +4 -11
- package/dist/cjs/charts/lineChart/fragments/lineChartPath.js +31 -35
- package/dist/cjs/charts/lineChart/fragments/lineChartProjection.js +6 -10
- package/dist/cjs/charts/lineChart/fragments/lineChartSeparator.js +10 -14
- package/dist/cjs/charts/lineChart/fragments/lineChartXAxis.js +14 -18
- package/dist/cjs/charts/lineChart/fragments/lineChartYAxis.js +17 -21
- package/dist/cjs/charts/lineChart/hook/index.js +3 -9
- package/dist/cjs/charts/lineChart/hook/useAutoClick.js +6 -10
- package/dist/cjs/charts/lineChart/hook/useHover.js +5 -9
- package/dist/cjs/charts/lineChart/hook/useIndicator.js +5 -9
- package/dist/cjs/charts/lineChart/index.js +1 -17
- package/dist/cjs/charts/lineChart/lineChart.js +12 -29
- package/dist/cjs/charts/lineChart/lineChart.type.js +1 -2
- package/dist/cjs/charts/lineChart/lineChartStructure.js +34 -38
- package/dist/cjs/charts/lineChart/utils/accessibilityTemplateProcessor.js +6 -10
- package/dist/cjs/charts/lineChart/utils/findSurroundingNumber.js +2 -7
- package/dist/cjs/charts/lineChart/utils/getDataValues.js +1 -5
- package/dist/cjs/charts/lineChart/utils/getExtraSpacing.js +26 -30
- package/dist/cjs/charts/lineChart/utils/getPathData.js +1 -5
- package/dist/cjs/charts/lineChart/utils/getProjection.js +1 -5
- package/dist/cjs/charts/lineChart/utils/getRoundedMaxValue.js +2 -7
- package/dist/cjs/charts/lineChart/utils/handleNodesFocus.js +1 -5
- package/dist/cjs/charts/lineChart/utils/index.js +6 -17
- package/dist/cjs/charts/pieChart/context/buildPieContextValue.js +8 -12
- package/dist/cjs/charts/pieChart/context/index.js +2 -7
- package/dist/cjs/charts/pieChart/context/pieChartContext.js +2 -5
- package/dist/cjs/charts/pieChart/fragments/index.js +2 -7
- package/dist/cjs/charts/pieChart/fragments/pieChartForeign.js +7 -11
- package/dist/cjs/charts/pieChart/fragments/pieChartPath.js +12 -16
- package/dist/cjs/charts/pieChart/fragments/pieChartSegment.js +6 -10
- package/dist/cjs/charts/pieChart/index.js +1 -17
- package/dist/cjs/charts/pieChart/pieChart.js +8 -25
- package/dist/cjs/charts/pieChart/pieChart.type.js +1 -2
- package/dist/cjs/charts/pieChart/pieChartStructure.js +16 -20
- package/dist/cjs/charts/pieChart/utils/buildL.js +1 -5
- package/dist/cjs/charts/pieChart/utils/calculatePoint.js +1 -5
- package/dist/cjs/charts/pieChart/utils/calculateSegmentPath.js +10 -14
- package/dist/cjs/charts/pieChart/utils/drawSegmentPath.js +6 -10
- package/dist/cjs/charts/pieChart/utils/index.js +2 -7
- package/dist/cjs/charts/pieChart/utils/rotationDirection.js +3 -7
- package/dist/cjs/components/axisChart/index.js +2 -18
- package/dist/cjs/components/axisChart/utils/filterLineProps/filterLineProps.js +1 -5
- package/dist/cjs/components/axisChart/utils/index.js +1 -17
- package/dist/cjs/components/axisChart/xAxis/index.js +2 -18
- package/dist/cjs/components/axisChart/xAxis/xAxis.js +14 -18
- package/dist/cjs/components/axisChart/xAxis/xAxis.types.js +1 -2
- package/dist/cjs/components/axisChart/yAxis/index.js +2 -18
- package/dist/cjs/components/axisChart/yAxis/yAxis.js +13 -17
- package/dist/cjs/components/axisChart/yAxis/yAxis.types.js +1 -2
- package/dist/cjs/components/bar/bar.js +9 -13
- package/dist/cjs/components/bar/bar.type.js +1 -4
- package/dist/cjs/components/bar/fragments/barChartSegment.js +3 -7
- package/dist/cjs/components/bar/index.js +2 -18
- package/dist/cjs/components/bar/utils/buildD.js +5 -9
- package/dist/cjs/components/bar/utils/getSegments.js +3 -7
- package/dist/cjs/components/chartText/chartText.js +3 -7
- package/dist/cjs/components/chartText/chartText.types.js +1 -2
- package/dist/cjs/components/chartText/index.js +2 -18
- package/dist/cjs/components/foreignObject/foreignObject.js +3 -7
- package/dist/cjs/components/foreignObject/foreignObject.types.js +1 -2
- package/dist/cjs/components/foreignObject/index.js +2 -18
- package/dist/cjs/components/index.js +10 -26
- package/dist/cjs/components/line/index.js +2 -18
- package/dist/cjs/components/line/line.js +3 -7
- package/dist/cjs/components/line/line.types.js +1 -2
- package/dist/cjs/components/node/components/circle/circle.js +4 -7
- package/dist/cjs/components/node/components/hexagon/hexagon.js +6 -9
- package/dist/cjs/components/node/components/pentagon/pentagon.js +6 -9
- package/dist/cjs/components/node/components/square/square.js +4 -7
- package/dist/cjs/components/node/components/star/star.js +6 -9
- package/dist/cjs/components/node/components/straight/straight.js +4 -7
- package/dist/cjs/components/node/components/triangle/triangle.js +4 -7
- package/dist/cjs/components/node/index.js +2 -18
- package/dist/cjs/components/node/node.js +22 -25
- package/dist/cjs/components/node/node.types.js +1 -4
- package/dist/cjs/components/node/utils/calculateShapePoints/calculateShapePoints.js +1 -5
- package/dist/cjs/components/path/components/nodePath/nodePath.js +9 -12
- package/dist/cjs/components/path/index.js +2 -18
- package/dist/cjs/components/path/path.js +20 -23
- package/dist/cjs/components/path/path.types.js +1 -2
- package/dist/cjs/components/plot/components/circle/circle.js +4 -7
- package/dist/cjs/components/plot/components/index.js +3 -19
- package/dist/cjs/components/plot/components/square/square.js +4 -7
- package/dist/cjs/components/plot/components/triangle/triangle.js +4 -7
- package/dist/cjs/components/plot/index.js +2 -18
- package/dist/cjs/components/plot/plot.js +21 -24
- package/dist/cjs/components/plot/plot.types.js +8 -11
- package/dist/cjs/components/svgContainer/index.js +1 -17
- package/dist/cjs/components/svgContainer/svgContainer.js +5 -8
- package/dist/cjs/components/svgContainer/svgContainer.types.js +1 -2
- package/dist/cjs/components/svgContainer/utils/buildViewBox/buildViewBox.js +1 -5
- package/dist/cjs/components/svgContainer/utils/index.js +1 -17
- package/dist/cjs/components/tick/index.js +2 -18
- package/dist/cjs/components/tick/tick.js +4 -8
- package/dist/cjs/components/tick/tick.types.js +1 -4
- package/dist/cjs/components/zoomArea/components/HandlerIcon.js +3 -7
- package/dist/cjs/components/zoomArea/components/LineRenderer.js +3 -7
- package/dist/cjs/components/zoomArea/components/SelectionArea.js +9 -14
- package/dist/cjs/components/zoomArea/components/ZoomHandler.js +6 -10
- package/dist/cjs/components/zoomArea/components/index.js +4 -12
- package/dist/cjs/components/zoomArea/hooks/index.js +5 -13
- package/dist/cjs/components/zoomArea/hooks/useDragInteraction.js +19 -23
- package/dist/cjs/components/zoomArea/hooks/useKeyboardNavigation.js +18 -22
- package/dist/cjs/components/zoomArea/hooks/useResponsiveCanvas.js +12 -16
- package/dist/cjs/components/zoomArea/hooks/useZoomAreaFocus.js +6 -10
- package/dist/cjs/components/zoomArea/hooks/useZoomData.js +8 -12
- package/dist/cjs/components/zoomArea/index.js +5 -21
- package/dist/cjs/components/zoomArea/utils/accessibilityLabels.js +6 -11
- package/dist/cjs/components/zoomArea/utils/index.js +3 -14
- package/dist/cjs/components/zoomArea/utils/indexRounding.js +5 -11
- package/dist/cjs/components/zoomArea/utils/interactionConfig.js +1 -5
- package/dist/cjs/components/zoomArea/utils/pathGeneration.js +4 -9
- package/dist/cjs/components/zoomArea/utils/rangeAndPositions.js +5 -13
- package/dist/cjs/components/zoomArea/utils/selectionConfig.js +1 -5
- package/dist/cjs/components/zoomArea/zoomArea.js +35 -39
- package/dist/cjs/components/zoomArea/zoomArea.type.js +1 -4
- package/dist/cjs/hooks/index.js +2 -18
- package/dist/cjs/hooks/useFocus/useFocus.js +5 -9
- package/dist/cjs/hooks/useFocus/useFocus.types.js +1 -2
- package/dist/cjs/hooks/useHover/useHover.js +5 -9
- package/dist/cjs/hooks/useHover/useHover.types.js +1 -2
- package/dist/cjs/index.js +3 -19
- package/dist/cjs/types/canvas.type.js +1 -4
- package/dist/cjs/types/errors.type.js +1 -4
- package/dist/cjs/types/focusConfig.type.js +1 -4
- package/dist/cjs/types/index.js +4 -20
- package/dist/cjs/types/position.enum.js +1 -4
- package/dist/cjs/types/unit.enum.js +1 -4
- package/dist/cjs/types/valueFormatter.type.js +1 -2
- package/dist/cjs/utils/ajustedTextSpace/ajustedTextSpace.js +1 -5
- package/dist/cjs/utils/buildErrors/buildErrors.js +3 -7
- package/dist/cjs/utils/buildTickValues/buildTickValues.js +2 -7
- package/dist/cjs/utils/calculateFocusOutline/calculateFocusOutline.js +8 -13
- package/dist/cjs/utils/classNames/classNames.js +1 -5
- package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.js +4 -8
- package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.types.js +1 -2
- package/dist/cjs/utils/cursorNear/isNear.js +1 -5
- package/dist/cjs/utils/getAxisData/getAxisData.js +1 -5
- package/dist/cjs/utils/getCanvasDimensions/getCanvasDimensions.js +8 -12
- package/dist/cjs/utils/getChildrenAttr/getChildrenAttr.js +4 -8
- package/dist/cjs/utils/getCoordinates/getCoordinates.js +9 -14
- package/dist/cjs/utils/getDataFingerprint/getDataFingerprint.js +1 -5
- package/dist/cjs/utils/getPoints/getPoints.js +1 -5
- package/dist/cjs/utils/getTickTextCoordinate/getTickTextCoordinates.js +5 -10
- package/dist/cjs/utils/getTicks/getTicks.js +2 -7
- package/dist/cjs/utils/index.js +8 -24
- package/dist/cjs/utils/parseStringToNumberPx.ts/parseStringToNumberPx.js +3 -7
- package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.js +1 -5
- package/dist/cjs/utils/shadowSvg/shadowSvg.js +3 -7
- package/dist/cjs/utils/shadowSvg/shadowSvg.types.js +1 -2
- package/dist/cjs/utils/textBound/textBound.js +1 -5
- package/dist/kubit-ui-web-react-charts.cjs.js +1 -10
- package/dist/kubit-ui-web-react-charts.es.js +1 -10
- package/dist/kubit-ui-web-react-charts.umd.js +1 -10
- package/dist/types/charts/barChart/barChart.d.ts +5 -5
- package/dist/types/charts/barChart/barChart.type.d.ts +1 -1
- package/dist/types/charts/barChart/context/barChartContext.d.ts +1 -1
- package/dist/types/charts/barChart/fragments/barChartSeparator.d.ts +1 -1
- package/dist/types/charts/barChart/fragments/barChartXAxis.d.ts +1 -1
- package/dist/types/charts/barChart/fragments/barChartYAxis.d.ts +1 -1
- package/dist/types/charts/lineChart/context/lineChartContext.d.ts +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartPath.d.ts +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartProjection.d.ts +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartSeparator.d.ts +1 -1
- package/dist/types/charts/lineChart/fragments/lineChartXAxis.d.ts +1 -1
- package/dist/types/charts/lineChart/lineChart.d.ts +5 -5
- package/dist/types/charts/lineChart/lineChart.type.d.ts +1 -1
- package/dist/types/charts/lineChart/lineChartStructure.d.ts +1 -1
- package/dist/types/charts/pieChart/context/pieChartContext.d.ts +1 -1
- package/dist/types/charts/pieChart/fragments/pieChartForeign.d.ts +1 -1
- package/dist/types/charts/pieChart/fragments/pieChartPath.d.ts +1 -1
- package/dist/types/charts/pieChart/pieChart.d.ts +3 -3
- package/dist/types/charts/pieChart/pieChart.type.d.ts +1 -1
- package/dist/types/charts/pieChart/pieChartStructure.d.ts +1 -1
- package/dist/types/components/axisChart/xAxis/xAxis.d.ts +1 -1
- package/dist/types/components/axisChart/yAxis/yAxis.d.ts +1 -1
- package/dist/types/components/bar/bar.d.ts +1 -1
- package/dist/types/components/bar/fragments/barChartSegment.d.ts +1 -1
- package/dist/types/components/chartText/chartText.d.ts +1 -1
- package/dist/types/components/foreignObject/foreignObject.d.ts +1 -1
- package/dist/types/components/foreignObject/foreignObject.types.d.ts +1 -1
- package/dist/types/components/line/line.d.ts +1 -1
- package/dist/types/components/node/components/circle/circle.d.ts +1 -1
- package/dist/types/components/node/components/hexagon/hexagon.d.ts +1 -1
- package/dist/types/components/node/components/pentagon/pentagon.d.ts +1 -1
- package/dist/types/components/node/components/square/square.d.ts +1 -1
- package/dist/types/components/node/components/star/star.d.ts +1 -1
- package/dist/types/components/node/components/straight/straight.d.ts +1 -1
- package/dist/types/components/node/components/triangle/triangle.d.ts +1 -1
- package/dist/types/components/node/node.d.ts +1 -1
- package/dist/types/components/path/components/nodePath/nodePath.d.ts +2 -2
- package/dist/types/components/path/path.d.ts +1 -1
- package/dist/types/components/path/path.types.d.ts +1 -1
- package/dist/types/components/plot/components/circle/circle.d.ts +1 -1
- package/dist/types/components/plot/components/square/square.d.ts +1 -1
- package/dist/types/components/plot/components/triangle/triangle.d.ts +1 -1
- package/dist/types/components/plot/plot.d.ts +1 -1
- package/dist/types/components/svgContainer/svgContainer.d.ts +1 -1
- package/dist/types/components/tick/tick.d.ts +1 -1
- package/dist/types/components/zoomArea/components/HandlerIcon.d.ts +1 -1
- package/dist/types/components/zoomArea/components/LineRenderer.d.ts +1 -1
- package/dist/types/components/zoomArea/components/SelectionArea.d.ts +1 -1
- package/dist/types/components/zoomArea/components/ZoomHandler.d.ts +1 -1
- package/dist/types/hooks/useFocus/useFocus.types.d.ts +1 -1
- package/dist/types/hooks/useHover/useHover.types.d.ts +1 -1
- package/dist/types/utils/getChildrenAttr/getChildrenAttr.d.ts +1 -1
- package/package.json +44 -47
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getYKeyRoundMaxValue = exports.getRoundedMaxValue = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Extracts the maximum value from the data points that do not correspond to the provided key.
|
|
6
3
|
* The maximum value is rounded up to the nearest multiple of 10.
|
|
@@ -8,23 +5,21 @@ exports.getYKeyRoundMaxValue = exports.getRoundedMaxValue = void 0;
|
|
|
8
5
|
* @param key - The key to exclude in the data.
|
|
9
6
|
* @returns The rounded maximum value.
|
|
10
7
|
*/
|
|
11
|
-
const getRoundedMaxValue = (data, key) => {
|
|
8
|
+
export const getRoundedMaxValue = (data, key) => {
|
|
12
9
|
const values = data.flatMap(point => Object.keys(point)
|
|
13
10
|
.filter(k => k !== key && typeof point[k] === 'number')
|
|
14
11
|
.map(k => point[k]));
|
|
15
12
|
const maxNumber = Math.max(...values);
|
|
16
13
|
return Math.ceil(maxNumber / 10) * 10;
|
|
17
14
|
};
|
|
18
|
-
exports.getRoundedMaxValue = getRoundedMaxValue;
|
|
19
15
|
/**
|
|
20
16
|
* Returns an array of rounded maximum values for each yKey in the given data.
|
|
21
17
|
* @param data - The array of data points.
|
|
22
18
|
* @param xKey - The xKey used for filtering the data.
|
|
23
19
|
* @returns An array of rounded maximum values.
|
|
24
20
|
*/
|
|
25
|
-
const getYKeyRoundMaxValue = (data, xKey) => {
|
|
21
|
+
export const getYKeyRoundMaxValue = (data, xKey) => {
|
|
26
22
|
return data.flatMap(point => Object.keys(point)
|
|
27
23
|
.filter(k => k !== xKey && typeof point[k] === 'number')
|
|
28
24
|
.map(k => point[k]));
|
|
29
25
|
};
|
|
30
|
-
exports.getYKeyRoundMaxValue = getYKeyRoundMaxValue;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleNodesFocus = void 0;
|
|
4
|
-
const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
|
|
1
|
+
export const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
|
|
5
2
|
let refFocused = false;
|
|
6
3
|
let currentNode = undefined;
|
|
7
4
|
const g = ref.querySelector('[data-draw]');
|
|
@@ -46,4 +43,3 @@ const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
|
|
|
46
43
|
};
|
|
47
44
|
return { mount, unmount };
|
|
48
45
|
};
|
|
49
|
-
exports.handleNodesFocus = handleNodesFocus;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var getDataValues_1 = require("./getDataValues");
|
|
8
|
-
Object.defineProperty(exports, "getDataValues", { enumerable: true, get: function () { return getDataValues_1.getDataValues; } });
|
|
9
|
-
var getExtraSpacing_1 = require("./getExtraSpacing");
|
|
10
|
-
Object.defineProperty(exports, "getExtraSpacing", { enumerable: true, get: function () { return getExtraSpacing_1.getExtraSpacing; } });
|
|
11
|
-
var getPathData_1 = require("./getPathData");
|
|
12
|
-
Object.defineProperty(exports, "getPathData", { enumerable: true, get: function () { return getPathData_1.getPathData; } });
|
|
13
|
-
var getProjection_1 = require("./getProjection");
|
|
14
|
-
Object.defineProperty(exports, "getProjection", { enumerable: true, get: function () { return getProjection_1.getProjection; } });
|
|
15
|
-
var getRoundedMaxValue_1 = require("./getRoundedMaxValue");
|
|
16
|
-
Object.defineProperty(exports, "getRoundedMaxValue", { enumerable: true, get: function () { return getRoundedMaxValue_1.getRoundedMaxValue; } });
|
|
17
|
-
Object.defineProperty(exports, "getYKeyRoundMaxValue", { enumerable: true, get: function () { return getRoundedMaxValue_1.getYKeyRoundMaxValue; } });
|
|
1
|
+
export { findSurroundingNumber, findClosestNumber } from './findSurroundingNumber';
|
|
2
|
+
export { getDataValues } from './getDataValues';
|
|
3
|
+
export { getExtraSpacing } from './getExtraSpacing';
|
|
4
|
+
export { getPathData } from './getPathData';
|
|
5
|
+
export { getProjection } from './getProjection';
|
|
6
|
+
export { getRoundedMaxValue, getYKeyRoundMaxValue } from './getRoundedMaxValue';
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const parseStringToNumberPx_1 = require("../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx");
|
|
6
|
-
const pieChartPath_1 = require("../fragments/pieChartPath");
|
|
1
|
+
import { Children, isValidElement } from 'react';
|
|
2
|
+
import { parseStringToNumberPx } from '../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx';
|
|
3
|
+
import { PieChartPath } from '../fragments/pieChartPath';
|
|
7
4
|
/**
|
|
8
5
|
* Builds the context value for the PieChart component.
|
|
9
6
|
*
|
|
10
7
|
* @param {BuildPieContextValueProps} props - The props for building the context value.
|
|
11
8
|
* @returns {Omit<PieChartContextType, 'canvasHeight' | 'canvasWidth' | 'data'>} The context value.
|
|
12
9
|
*/
|
|
13
|
-
const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart, }) => {
|
|
10
|
+
export const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart, }) => {
|
|
14
11
|
// Use the min inner radious of the paths to calculate the size
|
|
15
12
|
let minRadius = undefined;
|
|
16
13
|
let foreignObjectSize = undefined;
|
|
17
|
-
|
|
18
|
-
if (!
|
|
14
|
+
Children.forEach(children, (child) => {
|
|
15
|
+
if (!isValidElement(child)) {
|
|
19
16
|
return;
|
|
20
17
|
}
|
|
21
|
-
if (child.type ===
|
|
18
|
+
if (child.type === PieChartPath) {
|
|
22
19
|
const { innerRadius } = child.props;
|
|
23
20
|
if (!innerRadius) {
|
|
24
21
|
return;
|
|
25
22
|
}
|
|
26
|
-
const parsedInnerRadius =
|
|
23
|
+
const parsedInnerRadius = parseStringToNumberPx(innerRadius);
|
|
27
24
|
if (!minRadius || parsedInnerRadius < minRadius) {
|
|
28
25
|
minRadius = parsedInnerRadius;
|
|
29
26
|
}
|
|
@@ -46,4 +43,3 @@ const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart,
|
|
|
46
43
|
},
|
|
47
44
|
};
|
|
48
45
|
};
|
|
49
|
-
exports.buildPieContextValue = buildPieContextValue;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PieChartContext = exports.buildPieContextValue = void 0;
|
|
4
|
-
var buildPieContextValue_1 = require("./buildPieContextValue");
|
|
5
|
-
Object.defineProperty(exports, "buildPieContextValue", { enumerable: true, get: function () { return buildPieContextValue_1.buildPieContextValue; } });
|
|
6
|
-
var pieChartContext_1 = require("./pieChartContext");
|
|
7
|
-
Object.defineProperty(exports, "PieChartContext", { enumerable: true, get: function () { return pieChartContext_1.PieChartContext; } });
|
|
1
|
+
export { buildPieContextValue } from './buildPieContextValue';
|
|
2
|
+
export { PieChartContext } from './pieChartContext';
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PieChartContext = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
exports.PieChartContext = (0, react_1.createContext)({});
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const PieChartContext = createContext({});
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.PieChartPath = exports.PieChartForeign = void 0;
|
|
4
|
-
var pieChartForeign_1 = require("./pieChartForeign");
|
|
5
|
-
Object.defineProperty(exports, "PieChartForeign", { enumerable: true, get: function () { return pieChartForeign_1.PieChartForeign; } });
|
|
6
|
-
var pieChartPath_1 = require("./pieChartPath");
|
|
7
|
-
Object.defineProperty(exports, "PieChartPath", { enumerable: true, get: function () { return pieChartPath_1.PieChartPath; } });
|
|
1
|
+
export { PieChartForeign } from './pieChartForeign';
|
|
2
|
+
export { PieChartPath } from './pieChartPath';
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const pieChartContext_1 = require("../context/pieChartContext");
|
|
8
|
-
const PieChartForeign = ({ children, dataTestId: childDataTestId, height: childHeight, width: childWidth, x: childX, y: childY, ...props }) => {
|
|
9
|
-
const { dataTestId: canvasDataTestId, foreignObject } = (0, react_1.useContext)(pieChartContext_1.PieChartContext);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { ForeignObject } from '../../../components/foreignObject/foreignObject';
|
|
4
|
+
import { PieChartContext } from '../context/pieChartContext';
|
|
5
|
+
export const PieChartForeign = ({ children, dataTestId: childDataTestId, height: childHeight, width: childWidth, x: childX, y: childY, ...props }) => {
|
|
6
|
+
const { dataTestId: canvasDataTestId, foreignObject } = useContext(PieChartContext);
|
|
10
7
|
const width = !childWidth && foreignObject?.width ? foreignObject.width : childWidth;
|
|
11
8
|
const height = !childHeight && foreignObject?.height ? foreignObject.height : childHeight;
|
|
12
9
|
const x = !childX && foreignObject?.x ? foreignObject.x : childX;
|
|
13
10
|
const y = !childY && foreignObject?.y ? foreignObject.y : childY;
|
|
14
11
|
const dataTestId = !childDataTestId && canvasDataTestId ? `${canvasDataTestId}-foreign-object` : childDataTestId;
|
|
15
|
-
return ((
|
|
12
|
+
return (_jsx(ForeignObject, { ...props, dataTestId: dataTestId, height: height, width: width, x: x, y: y, children: children }));
|
|
16
13
|
};
|
|
17
|
-
exports.PieChartForeign = PieChartForeign;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const parseStringToNumberPx_1 = require("../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx");
|
|
8
|
-
const pieChartContext_1 = require("../context/pieChartContext");
|
|
9
|
-
const pieChartSegment_1 = require("./pieChartSegment");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { useContext, useRef } from 'react';
|
|
4
|
+
import { parseStringToNumberPx } from '../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx';
|
|
5
|
+
import { PieChartContext } from '../context/pieChartContext';
|
|
6
|
+
import { PieChartSegment } from './pieChartSegment';
|
|
10
7
|
/**
|
|
11
8
|
* Renders the path for a pie chart.
|
|
12
9
|
*
|
|
@@ -18,15 +15,14 @@ const pieChartSegment_1 = require("./pieChartSegment");
|
|
|
18
15
|
* @param {number} props.radius - The radius of the pie chart.
|
|
19
16
|
* @returns {ReactElement} The rendered PieChartPath component.
|
|
20
17
|
*/
|
|
21
|
-
const PieChartPath = ({ dataKey, fill, gap, innerRadius, radius, ...props }) => {
|
|
18
|
+
export const PieChartPath = ({ dataKey, fill, gap, innerRadius, radius, ...props }) => {
|
|
22
19
|
const key = String(dataKey);
|
|
23
|
-
const { canvasHeight, canvasWidth, data, dataTestId, halfChart } =
|
|
20
|
+
const { canvasHeight, canvasWidth, data, dataTestId, halfChart } = useContext(PieChartContext);
|
|
24
21
|
const chartInitAngle = halfChart ? 0 : -Math.PI / 2; // ? 0deg : -90deg
|
|
25
|
-
const startAngle =
|
|
22
|
+
const startAngle = useRef(chartInitAngle);
|
|
26
23
|
const total = data[key]?.reduce((acc, group) => acc + group.value, 0);
|
|
27
24
|
const singleStroke = data[key]?.length === 1;
|
|
28
|
-
const parsedInnerRadius = innerRadius ?
|
|
29
|
-
const parsedRadius = radius ?
|
|
30
|
-
return data[key]?.length ? ((
|
|
25
|
+
const parsedInnerRadius = innerRadius ? parseStringToNumberPx(innerRadius) : undefined;
|
|
26
|
+
const parsedRadius = radius ? parseStringToNumberPx(radius) : undefined;
|
|
27
|
+
return data[key]?.length ? (_jsx("g", { children: data[key].map((group, index) => (_createElement(PieChartSegment, { ...props, ...group, key: `${index.toString()}`, canvasHeight: canvasHeight, canvasWidth: canvasWidth, color: group.color || fill, dataTestId: `${dataTestId}path-${index}`, gap: gap, halfChart: halfChart, innerRadius: parsedInnerRadius, radius: parsedRadius, singleStroke: singleStroke, startAngle: startAngle, total: total }))) })) : (_jsx(_Fragment, {}));
|
|
31
28
|
};
|
|
32
|
-
exports.PieChartPath = PieChartPath;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const path_1 = require("../../../components/path/path");
|
|
6
|
-
const calculateSegmentPath_1 = require("../utils/calculateSegmentPath");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Path } from '../../../components/path/path';
|
|
3
|
+
import { calculateSegmentPath } from '../utils/calculateSegmentPath';
|
|
7
4
|
/**
|
|
8
5
|
* Renders a segment of a pie chart.
|
|
9
6
|
*
|
|
@@ -19,8 +16,8 @@ const calculateSegmentPath_1 = require("../utils/calculateSegmentPath");
|
|
|
19
16
|
* @param props - Additional props to pass to the Path component.
|
|
20
17
|
* @returns A React element representing the pie chart segment.
|
|
21
18
|
*/
|
|
22
|
-
const PieChartSegment = ({ canvasHeight, canvasWidth, color = 'blue', gap, halfChart, innerRadius, radius, singleStroke, startAngle, total, value, ...props }) => {
|
|
23
|
-
const pathData =
|
|
19
|
+
export const PieChartSegment = ({ canvasHeight, canvasWidth, color = 'blue', gap, halfChart, innerRadius, radius, singleStroke, startAngle, total, value, ...props }) => {
|
|
20
|
+
const pathData = calculateSegmentPath({
|
|
24
21
|
canvasHeight,
|
|
25
22
|
canvasWidth,
|
|
26
23
|
customRadius: radius,
|
|
@@ -32,6 +29,5 @@ const PieChartSegment = ({ canvasHeight, canvasWidth, color = 'blue', gap, halfC
|
|
|
32
29
|
total,
|
|
33
30
|
value,
|
|
34
31
|
});
|
|
35
|
-
return ((
|
|
32
|
+
return (_jsx(Path, { ...props, d: pathData, dataValue: value, fill: color }));
|
|
36
33
|
};
|
|
37
|
-
exports.PieChartSegment = PieChartSegment;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./pieChart"), exports);
|
|
1
|
+
export * from './pieChart';
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PieChart = void 0;
|
|
18
|
-
const pieChartForeign_1 = require("./fragments/pieChartForeign");
|
|
19
|
-
const pieChartPath_1 = require("./fragments/pieChartPath");
|
|
20
|
-
const pieChartStructure_1 = require("./pieChartStructure");
|
|
21
|
-
const PieChart = Object.assign(pieChartStructure_1.PieChartStructure, {
|
|
22
|
-
Foreign: pieChartForeign_1.PieChartForeign,
|
|
23
|
-
Path: pieChartPath_1.PieChartPath,
|
|
1
|
+
import { PieChartForeign } from './fragments/pieChartForeign';
|
|
2
|
+
import { PieChartPath } from './fragments/pieChartPath';
|
|
3
|
+
import { PieChartStructure } from './pieChartStructure';
|
|
4
|
+
const PieChart = Object.assign(PieChartStructure, {
|
|
5
|
+
Foreign: PieChartForeign,
|
|
6
|
+
Path: PieChartPath,
|
|
24
7
|
});
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
export { PieChart };
|
|
9
|
+
export * from './pieChart.type';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const parseStringToNumberPx_1 = require("../../utils/parseStringToNumberPx.ts/parseStringToNumberPx");
|
|
10
|
-
const buildPieContextValue_1 = require("./context/buildPieContextValue");
|
|
11
|
-
const pieChartContext_1 = require("./context/pieChartContext");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { SvgContainer } from '../../components/svgContainer/svgContainer';
|
|
4
|
+
import { buildViewBox } from '../../components/svgContainer/utils/buildViewBox/buildViewBox';
|
|
5
|
+
import { DefaultCanvasConfig } from '../../types/canvas.type';
|
|
6
|
+
import { parseStringToNumberPx } from '../../utils/parseStringToNumberPx.ts/parseStringToNumberPx';
|
|
7
|
+
import { buildPieContextValue } from './context/buildPieContextValue';
|
|
8
|
+
import { PieChartContext } from './context/pieChartContext';
|
|
12
9
|
/**
|
|
13
10
|
* Renders a pie chart component.
|
|
14
11
|
*
|
|
@@ -39,25 +36,25 @@ const pieChartContext_1 = require("./context/pieChartContext");
|
|
|
39
36
|
* @param {ChartData[]} props.data - The data for the pie chart.
|
|
40
37
|
* @returns {ReactElement} The rendered pie chart component.
|
|
41
38
|
*/
|
|
42
|
-
const PieChartStructure = ({ ariaHidden, ariaLabel, canvasConfig =
|
|
39
|
+
export const PieChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = DefaultCanvasConfig, caption, children, classNames, data, dataTestId = 'pie-chart', halfChart, height = '100%', radius = '50%', role, tabIndex, width = '100%', ...props }) => {
|
|
43
40
|
// Destructure the canvas configuration to obtain width, height, and extra space.
|
|
44
41
|
const { extraSpace: canvasExtraSpace, height: canvasHeight, width: canvasWidth } = canvasConfig;
|
|
45
|
-
const parsedCanvasWidth =
|
|
46
|
-
const parsedCanvasHeight =
|
|
42
|
+
const parsedCanvasWidth = parseStringToNumberPx(canvasWidth);
|
|
43
|
+
const parsedCanvasHeight = parseStringToNumberPx(canvasHeight);
|
|
47
44
|
const parsedCanvasExtraSpace = canvasExtraSpace
|
|
48
|
-
?
|
|
45
|
+
? parseStringToNumberPx(canvasExtraSpace)
|
|
49
46
|
: undefined;
|
|
50
47
|
// Build the viewBox string based on canvas dimensions and extra space.
|
|
51
|
-
const viewBox =
|
|
52
|
-
const contextValue =
|
|
53
|
-
return
|
|
48
|
+
const viewBox = buildViewBox(parsedCanvasWidth, parsedCanvasHeight, parsedCanvasExtraSpace);
|
|
49
|
+
const contextValue = useMemo(() => {
|
|
50
|
+
return buildPieContextValue({
|
|
54
51
|
canvasHeight: parsedCanvasHeight,
|
|
55
52
|
canvasWidth: parsedCanvasWidth,
|
|
56
53
|
children,
|
|
57
54
|
halfChart,
|
|
58
55
|
});
|
|
59
56
|
}, [canvasHeight, canvasWidth, halfChart]);
|
|
60
|
-
return ((
|
|
57
|
+
return (_jsx(SvgContainer, { ariaHidden: ariaHidden, ariaLabel: ariaLabel, caption: caption, className: classNames, dataTestId: dataTestId, height: height, radius: radius, role: role, tabIndex: tabIndex, viewBox: viewBox, width: width, ...props, children: _jsx(PieChartContext.Provider, { value: {
|
|
61
58
|
...contextValue,
|
|
62
59
|
canvasHeight: parsedCanvasHeight,
|
|
63
60
|
canvasWidth: parsedCanvasWidth,
|
|
@@ -66,4 +63,3 @@ const PieChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_1
|
|
|
66
63
|
halfChart,
|
|
67
64
|
}, children: children }) }));
|
|
68
65
|
};
|
|
69
|
-
exports.PieChartStructure = PieChartStructure;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildL = void 0;
|
|
4
|
-
const buildL = ({ center, innerEnd, innerRadius, singleStroke, }) => {
|
|
1
|
+
export const buildL = ({ center, innerEnd, innerRadius, singleStroke, }) => {
|
|
5
2
|
if (singleStroke) {
|
|
6
3
|
return undefined;
|
|
7
4
|
}
|
|
@@ -10,4 +7,3 @@ const buildL = ({ center, innerEnd, innerRadius, singleStroke, }) => {
|
|
|
10
7
|
}
|
|
11
8
|
return `L ${center.x},${center.y}`;
|
|
12
9
|
};
|
|
13
|
-
exports.buildL = buildL;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculatePoint = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Calculates the coordinates of a point on a circle given the center, radius, and angle.
|
|
6
3
|
* @param center - The coordinates of the center of the circle.
|
|
@@ -8,10 +5,9 @@ exports.calculatePoint = void 0;
|
|
|
8
5
|
* @param angle - The angle in radians.
|
|
9
6
|
* @returns The coordinates of the calculated point.
|
|
10
7
|
*/
|
|
11
|
-
const calculatePoint = (center, radius, angle) => {
|
|
8
|
+
export const calculatePoint = (center, radius, angle) => {
|
|
12
9
|
return {
|
|
13
10
|
x: center.x + radius * Math.cos(angle),
|
|
14
11
|
y: center.y + radius * Math.sin(angle),
|
|
15
12
|
};
|
|
16
13
|
};
|
|
17
|
-
exports.calculatePoint = calculatePoint;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const calculatePoint_1 = require("./calculatePoint");
|
|
5
|
-
const drawSegmentPath_1 = require("./drawSegmentPath");
|
|
6
|
-
const rotationDirection_1 = require("./rotationDirection");
|
|
1
|
+
import { calculatePoint } from './calculatePoint';
|
|
2
|
+
import { drawSegmentPath } from './drawSegmentPath';
|
|
3
|
+
import { rotationDirection } from './rotationDirection';
|
|
7
4
|
/**
|
|
8
5
|
* Calculates the SVG path for a segment of a pie chart.
|
|
9
6
|
*
|
|
@@ -21,7 +18,7 @@ const rotationDirection_1 = require("./rotationDirection");
|
|
|
21
18
|
* @param {string} params.rotateDirection - The direction of rotation for the segment.
|
|
22
19
|
* @returns {string} The SVG path for the segment.
|
|
23
20
|
*/
|
|
24
|
-
const calculateSegmentPath = ({ canvasHeight, canvasWidth, customRadius, gap, halfChart, innerRadius, rotateDirection, singleStroke, startAngle, total, value, }) => {
|
|
21
|
+
export const calculateSegmentPath = ({ canvasHeight, canvasWidth, customRadius, gap, halfChart, innerRadius, rotateDirection, singleStroke, startAngle, total, value, }) => {
|
|
25
22
|
const segmentCanvasHeight = halfChart ? canvasHeight * 2 : canvasHeight;
|
|
26
23
|
const maxRadius = Math.min(canvasWidth, segmentCanvasHeight) / 2;
|
|
27
24
|
const radius = customRadius && customRadius < maxRadius ? customRadius : maxRadius;
|
|
@@ -32,7 +29,7 @@ const calculateSegmentPath = ({ canvasHeight, canvasWidth, customRadius, gap, ha
|
|
|
32
29
|
const piePortion = (value * 100) / segmentTotal;
|
|
33
30
|
const angleEquivalent = (piePortion * maxAngle) / 100;
|
|
34
31
|
const gapAngle = gap / radius;
|
|
35
|
-
const { carryAngle, finalAngle, initialAngle } =
|
|
32
|
+
const { carryAngle, finalAngle, initialAngle } = rotationDirection({
|
|
36
33
|
angleEquivalent,
|
|
37
34
|
direction: rotateDirection,
|
|
38
35
|
gapAngle,
|
|
@@ -41,11 +38,11 @@ const calculateSegmentPath = ({ canvasHeight, canvasWidth, customRadius, gap, ha
|
|
|
41
38
|
startAngle.current = carryAngle;
|
|
42
39
|
const segmentAngle = (maxAngle * value) / segmentTotal;
|
|
43
40
|
const largeArcFlag = segmentAngle - gapAngle <= Math.PI ? '0' : '1';
|
|
44
|
-
const innerStart =
|
|
45
|
-
const innerEnd =
|
|
46
|
-
const outerStart =
|
|
47
|
-
const outerEnd =
|
|
48
|
-
return
|
|
41
|
+
const innerStart = calculatePoint(center, innerRadius, initialAngle);
|
|
42
|
+
const innerEnd = calculatePoint(center, innerRadius, finalAngle);
|
|
43
|
+
const outerStart = calculatePoint(center, radius, initialAngle);
|
|
44
|
+
const outerEnd = calculatePoint(center, radius, finalAngle);
|
|
45
|
+
return drawSegmentPath({
|
|
49
46
|
center,
|
|
50
47
|
innerEnd,
|
|
51
48
|
innerRadius,
|
|
@@ -58,4 +55,3 @@ const calculateSegmentPath = ({ canvasHeight, canvasWidth, customRadius, gap, ha
|
|
|
58
55
|
singleStroke,
|
|
59
56
|
});
|
|
60
57
|
};
|
|
61
|
-
exports.calculateSegmentPath = calculateSegmentPath;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const buildL_1 = require("./buildL");
|
|
5
|
-
const rotationDirection_1 = require("./rotationDirection");
|
|
6
|
-
const drawSegmentPath = ({ center, innerEnd, innerRadius, innerStart, largeArcFlag, outerEnd, outerStart, radius, rotateDirection, singleStroke, }) => {
|
|
1
|
+
import { buildL } from './buildL';
|
|
2
|
+
import { RotateDirection } from './rotationDirection';
|
|
3
|
+
export const drawSegmentPath = ({ center, innerEnd, innerRadius, innerStart, largeArcFlag, outerEnd, outerStart, radius, rotateDirection, singleStroke, }) => {
|
|
7
4
|
let M, A, L, m, AA, MR, AR, mR, AAR, Z;
|
|
8
|
-
if (rotateDirection ===
|
|
5
|
+
if (rotateDirection === RotateDirection.CLOCKWISE) {
|
|
9
6
|
M = `M ${outerStart.x},${outerStart.y}`;
|
|
10
7
|
A = `A ${radius},${radius} 0 ${largeArcFlag} 1 ${outerEnd.x}, ${outerEnd.y}`;
|
|
11
|
-
L =
|
|
8
|
+
L = buildL({ center, innerEnd: innerEnd, innerRadius, singleStroke });
|
|
12
9
|
m = singleStroke ? `M ${innerEnd.x},${innerEnd.y}` : undefined;
|
|
13
10
|
AA =
|
|
14
11
|
innerRadius > 0
|
|
@@ -24,7 +21,7 @@ const drawSegmentPath = ({ center, innerEnd, innerRadius, innerStart, largeArcFl
|
|
|
24
21
|
else {
|
|
25
22
|
M = `M ${outerStart.x} ${outerStart.y}`;
|
|
26
23
|
A = `A ${radius},${radius} 0 ${largeArcFlag},0 ${outerEnd.x}, ${outerEnd.y}`;
|
|
27
|
-
L =
|
|
24
|
+
L = buildL({ center, innerEnd, innerRadius, singleStroke });
|
|
28
25
|
m = singleStroke ? `M ${innerEnd.x},${innerEnd.y}` : undefined;
|
|
29
26
|
AA =
|
|
30
27
|
innerRadius > 0
|
|
@@ -42,4 +39,3 @@ const drawSegmentPath = ({ center, innerEnd, innerRadius, innerStart, largeArcFl
|
|
|
42
39
|
const mirror = singleStroke ? [MR, AR, mR, AAR] : [];
|
|
43
40
|
return base.concat(mirror).filter(Boolean).join(' ');
|
|
44
41
|
};
|
|
45
|
-
exports.drawSegmentPath = drawSegmentPath;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.calculateSegmentPath = exports.calculatePoint = void 0;
|
|
4
|
-
var calculatePoint_1 = require("./calculatePoint");
|
|
5
|
-
Object.defineProperty(exports, "calculatePoint", { enumerable: true, get: function () { return calculatePoint_1.calculatePoint; } });
|
|
6
|
-
var calculateSegmentPath_1 = require("./calculateSegmentPath");
|
|
7
|
-
Object.defineProperty(exports, "calculateSegmentPath", { enumerable: true, get: function () { return calculateSegmentPath_1.calculateSegmentPath; } });
|
|
1
|
+
export { calculatePoint } from './calculatePoint';
|
|
2
|
+
export { calculateSegmentPath } from './calculateSegmentPath';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rotationDirection = exports.RotateDirection = void 0;
|
|
4
|
-
exports.RotateDirection = {
|
|
1
|
+
export const RotateDirection = {
|
|
5
2
|
CLOCKWISE: 'CLOCKWISE',
|
|
6
3
|
COUNTER_CLOCKWISE: 'COUNTER_CLOCKWISE',
|
|
7
4
|
};
|
|
8
|
-
const rotationDirection = ({ angleEquivalent, direction, gapAngle, startAngle, }) => {
|
|
9
|
-
const clockDir = direction ===
|
|
5
|
+
export const rotationDirection = ({ angleEquivalent, direction, gapAngle, startAngle, }) => {
|
|
6
|
+
const clockDir = direction === RotateDirection.CLOCKWISE;
|
|
10
7
|
const initialAngle = clockDir ? startAngle + gapAngle / 2 : startAngle - gapAngle / 2;
|
|
11
8
|
const finalAngle = clockDir
|
|
12
9
|
? startAngle + angleEquivalent - gapAngle / 2
|
|
@@ -14,4 +11,3 @@ const rotationDirection = ({ angleEquivalent, direction, gapAngle, startAngle, }
|
|
|
14
11
|
const carryAngle = clockDir ? startAngle + angleEquivalent : startAngle - angleEquivalent;
|
|
15
12
|
return { carryAngle, finalAngle, initialAngle };
|
|
16
13
|
};
|
|
17
|
-
exports.rotationDirection = rotationDirection;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./xAxis"), exports);
|
|
18
|
-
__exportStar(require("./yAxis"), exports);
|
|
1
|
+
export * from './xAxis';
|
|
2
|
+
export * from './yAxis';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterLineProps = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Filters and extracts line-related properties from a given object.
|
|
6
3
|
*
|
|
@@ -16,7 +13,7 @@ exports.filterLineProps = void 0;
|
|
|
16
13
|
* flexible input types. However, this means the function assumes the caller has ensured that
|
|
17
14
|
* the input object contains properties compatible with `LineProps`.
|
|
18
15
|
*/
|
|
19
|
-
const filterLineProps = (props) => {
|
|
16
|
+
export const filterLineProps = (props) => {
|
|
20
17
|
const { ariaLabel, className, dataTestId, opacity, stroke, strokeDasharray, strokeDashoffset, strokeLinecap, strokeLinejoin, strokeOpacity, strokeWidth, style, tabIndex, transform, x1, x2, y1, y2, } = props;
|
|
21
18
|
return {
|
|
22
19
|
ariaLabel,
|
|
@@ -39,4 +36,3 @@ const filterLineProps = (props) => {
|
|
|
39
36
|
y2,
|
|
40
37
|
};
|
|
41
38
|
};
|
|
42
|
-
exports.filterLineProps = filterLineProps;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./filterLineProps/filterLineProps"), exports);
|
|
1
|
+
export * from './filterLineProps/filterLineProps';
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./xAxis"), exports);
|
|
18
|
-
__exportStar(require("./xAxis.types"), exports);
|
|
1
|
+
export * from './xAxis';
|
|
2
|
+
export * from './xAxis.types';
|