@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,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("./node"), exports);
|
|
18
|
-
__exportStar(require("./node.types"), exports);
|
|
1
|
+
export * from './node';
|
|
2
|
+
export * from './node.types';
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const straight_1 = require("./components/straight/straight");
|
|
13
|
-
const triangle_1 = require("./components/triangle/triangle");
|
|
14
|
-
const node_types_1 = require("./node.types");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, } from 'react';
|
|
3
|
+
import { useAutoClick } from '../../charts/lineChart/hook';
|
|
4
|
+
import { Circle } from './components/circle/circle';
|
|
5
|
+
import { Hexagon } from './components/hexagon/hexagon';
|
|
6
|
+
import { Pentagon } from './components/pentagon/pentagon';
|
|
7
|
+
import { Square } from './components/square/square';
|
|
8
|
+
import { Star } from './components/star/star';
|
|
9
|
+
import { Straight } from './components/straight/straight';
|
|
10
|
+
import { Triangle } from './components/triangle/triangle';
|
|
11
|
+
import { NodeType } from './node.types';
|
|
15
12
|
const Component = {
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
13
|
+
[NodeType.Circle]: Circle,
|
|
14
|
+
[NodeType.Hexagon]: Hexagon,
|
|
15
|
+
[NodeType.Pentagon]: Pentagon,
|
|
16
|
+
[NodeType.Square]: Square,
|
|
17
|
+
[NodeType.Star]: Star,
|
|
18
|
+
[NodeType.Straight]: Straight,
|
|
19
|
+
[NodeType.Triangle]: Triangle,
|
|
23
20
|
};
|
|
24
21
|
/**
|
|
25
22
|
* Node component that renders interactive geometric shapes for data visualization.
|
|
@@ -48,9 +45,9 @@ const Component = {
|
|
|
48
45
|
*
|
|
49
46
|
* @returns An SVG element corresponding to the specified node type (`circle`, `rect`, `polygon`), or `null` if the type is not recognized.
|
|
50
47
|
*/
|
|
51
|
-
const NodeComponent = ({ dataTestId = 'node', haloConfig, hasHalo = false, onBlur, onClick, onDoubleClick, onFocus, onKeyDown, onMouseEnter, onMouseLeave, position = { x: 0, y: 0 }, size = 1, type =
|
|
48
|
+
const NodeComponent = ({ dataTestId = 'node', haloConfig, hasHalo = false, onBlur, onClick, onDoubleClick, onFocus, onKeyDown, onMouseEnter, onMouseLeave, position = { x: 0, y: 0 }, size = 1, type = NodeType.Circle, ...props }, ref) => {
|
|
52
49
|
// It needed to recovery the autoClick info into js event, because the react event can't be modified or handle custom properties
|
|
53
|
-
const [clickRef, autoClick] =
|
|
50
|
+
const [clickRef, autoClick] = useAutoClick(ref);
|
|
54
51
|
// TODO - Enrich events with data, stop using extra parameters for callbacks
|
|
55
52
|
const handleClick = (event) => {
|
|
56
53
|
onClick?.(event, { ...props.data, nodePosition: position }, autoClick.current);
|
|
@@ -96,6 +93,6 @@ const NodeComponent = ({ dataTestId = 'node', haloConfig, hasHalo = false, onBlu
|
|
|
96
93
|
strokeWidth: haloConfig?.strokeWidth || props.strokeWidth,
|
|
97
94
|
};
|
|
98
95
|
const InnerNode = Component[type];
|
|
99
|
-
return ((
|
|
96
|
+
return (_jsxs(_Fragment, { children: [hasHalo && (_jsx(InnerNode, { ...haloProps, "aria-hidden": "true", dataTestId: `${dataTestId}-halo`, position: position, size: size + size / 2, tabIndex: -1 })), _jsx(InnerNode, { ...nodeProps, ref: clickRef, dataTestId: dataTestId, position: position, size: size })] }));
|
|
100
97
|
};
|
|
101
|
-
|
|
98
|
+
export const Node = forwardRef(NodeComponent);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeType = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Enum for node types.
|
|
6
3
|
*
|
|
@@ -10,7 +7,7 @@ exports.NodeType = void 0;
|
|
|
10
7
|
*
|
|
11
8
|
* @enum {string}
|
|
12
9
|
*/
|
|
13
|
-
|
|
10
|
+
export const NodeType = {
|
|
14
11
|
Circle: 'circle', // Represents a circle node.
|
|
15
12
|
Hexagon: 'hexagon', // Represents a hexagon node.
|
|
16
13
|
Pentagon: 'pentagon', // Represents a pentagon node.
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateShapePoints = void 0;
|
|
4
|
-
const calculateShapePoints = (centerX, centerY, points, outerRadius, innerRadius) => {
|
|
1
|
+
export const calculateShapePoints = (centerX, centerY, points, outerRadius, innerRadius) => {
|
|
5
2
|
let result = '';
|
|
6
3
|
// Determine whether drawing a regular shape or a star
|
|
7
4
|
const isRegularShape = outerRadius === innerRadius;
|
|
@@ -19,4 +16,3 @@ const calculateShapePoints = (centerX, centerY, points, outerRadius, innerRadius
|
|
|
19
16
|
}
|
|
20
17
|
return result.trim();
|
|
21
18
|
};
|
|
22
|
-
exports.calculateShapePoints = calculateShapePoints;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const accessibilityTemplateProcessor_1 = require("../../../../charts/lineChart/utils/accessibilityTemplateProcessor");
|
|
7
|
-
const pickCustomAttributes_1 = require("../../../../utils/pickCustomAttributes/pickCustomAttributes");
|
|
8
|
-
const node_1 = require("../../../node/node");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { processAccessibilityTemplate } from '../../../../charts/lineChart/utils/accessibilityTemplateProcessor';
|
|
4
|
+
import { pickCustomAttributes } from '../../../../utils/pickCustomAttributes/pickCustomAttributes';
|
|
5
|
+
import { Node } from '../../../node/node';
|
|
9
6
|
const NODE_PATH_FOCUS_BORDER = 'node-path-focus-border';
|
|
10
7
|
/**
|
|
11
8
|
* NodePathComponent renders a Node with custom attributes including processed aria-label templates.
|
|
@@ -15,14 +12,14 @@ const NODE_PATH_FOCUS_BORDER = 'node-path-focus-border';
|
|
|
15
12
|
*/
|
|
16
13
|
const NodePathComponent = ({ data, nodeConfig, tabIndex = 0, x, y }, ref) => {
|
|
17
14
|
// Extract custom aria-* and data-* attributes from nodeConfig
|
|
18
|
-
const customAttributes = nodeConfig ?
|
|
15
|
+
const customAttributes = nodeConfig ? pickCustomAttributes(nodeConfig) : {};
|
|
19
16
|
// Process aria-label template if it exists and contains placeholders
|
|
20
17
|
if (customAttributes['aria-label'] &&
|
|
21
18
|
data &&
|
|
22
19
|
typeof customAttributes['aria-label'] === 'string') {
|
|
23
20
|
const ariaLabelValue = customAttributes['aria-label'];
|
|
24
21
|
if (ariaLabelValue.includes('{{')) {
|
|
25
|
-
const processedAriaLabel =
|
|
22
|
+
const processedAriaLabel = processAccessibilityTemplate(ariaLabelValue, {
|
|
26
23
|
dataKey: data.dataKey,
|
|
27
24
|
dataValue: data.dataValue,
|
|
28
25
|
index: data.index ?? 0,
|
|
@@ -33,9 +30,9 @@ const NodePathComponent = ({ data, nodeConfig, tabIndex = 0, x, y }, ref) => {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
return ((
|
|
33
|
+
return (_jsx(_Fragment, { children: nodeConfig && (_jsx(Node, { ...nodeConfig, ref: ref, ...customAttributes, className: NODE_PATH_FOCUS_BORDER, data: data, hasHalo: nodeConfig.hasHalo, position: {
|
|
37
34
|
x: x,
|
|
38
35
|
y: y,
|
|
39
36
|
}, tabIndex: tabIndex })) }));
|
|
40
37
|
};
|
|
41
|
-
|
|
38
|
+
export const NodePath = forwardRef(NodePathComponent);
|
|
@@ -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("./path"), exports);
|
|
18
|
-
__exportStar(require("./path.types"), exports);
|
|
1
|
+
export * from './path';
|
|
2
|
+
export * from './path.types';
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const shadowSvg_1 = require("../../utils/shadowSvg/shadowSvg");
|
|
11
|
-
const nodePath_1 = require("./components/nodePath/nodePath");
|
|
12
|
-
require("./path.css");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef, } from 'react';
|
|
3
|
+
import { useFocus } from '../../hooks/useFocus/useFocus';
|
|
4
|
+
import { useHover } from '../../hooks/useHover/useHover';
|
|
5
|
+
import { cssGradientToSVG } from '../../utils/cssGradientToSvg/cssGradientToSvg';
|
|
6
|
+
import { pickCustomAttributes } from '../../utils/pickCustomAttributes/pickCustomAttributes';
|
|
7
|
+
import { ShadowSvg } from '../../utils/shadowSvg/shadowSvg';
|
|
8
|
+
import { NodePath } from './components/nodePath/nodePath';
|
|
9
|
+
import './path.css';
|
|
13
10
|
const ENTER = {
|
|
14
11
|
code: 'Enter',
|
|
15
12
|
key: 'Enter',
|
|
@@ -55,12 +52,12 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
|
|
|
55
52
|
stroke: '#0000FF',
|
|
56
53
|
strokeWidth: '0.5',
|
|
57
54
|
}, role = 'img', ...props }, ref) => {
|
|
58
|
-
const { handleBlur, handleFocus, isFocused } =
|
|
59
|
-
const { handleMouseEnter, handleMouseLeave, isHovered } =
|
|
60
|
-
const pathRef =
|
|
61
|
-
const nodeRef =
|
|
62
|
-
const mainRef =
|
|
63
|
-
|
|
55
|
+
const { handleBlur, handleFocus, isFocused } = useFocus(props.onFocus, props.onBlur);
|
|
56
|
+
const { handleMouseEnter, handleMouseLeave, isHovered } = useHover(props.onMouseEnter, props.onMouseLeave);
|
|
57
|
+
const pathRef = useRef(null);
|
|
58
|
+
const nodeRef = useRef([]);
|
|
59
|
+
const mainRef = useRef(null);
|
|
60
|
+
useImperativeHandle(ref, () => ({
|
|
64
61
|
get main() {
|
|
65
62
|
return mainRef.current;
|
|
66
63
|
},
|
|
@@ -85,9 +82,9 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
|
|
|
85
82
|
const handleMouseDown = (e) => {
|
|
86
83
|
e.preventDefault();
|
|
87
84
|
};
|
|
88
|
-
const gradientSvgElement = props.gradient &&
|
|
85
|
+
const gradientSvgElement = props.gradient && cssGradientToSVG(props.gradient);
|
|
89
86
|
// Extract custom data-* and aria-* attributes
|
|
90
|
-
const customAttributes =
|
|
87
|
+
const customAttributes = pickCustomAttributes(props);
|
|
91
88
|
// Merge props to include focus and hover styles
|
|
92
89
|
const defaultProps = {
|
|
93
90
|
...props,
|
|
@@ -103,7 +100,7 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
|
|
|
103
100
|
...(isFocused && focusConfig),
|
|
104
101
|
...(isHovered && hoverConfig),
|
|
105
102
|
};
|
|
106
|
-
return ((
|
|
103
|
+
return (_jsxs("g", { ref: mainRef, tabIndex: -1, children: [gradientSvgElement && gradientSvgElement, mergedProps.shadowSvgConfig && (_jsx(ShadowSvg, { id: SHADOW_FILTER_ID, shadowSvgConfig: mergedProps.shadowSvgConfig })), _jsxs("g", { "aria-label": mergedProps.ariaLabel, className: mergedProps.classNames, "data-draw": true, filter: mergedProps.shadowSvgConfig && mergedProps.filter, opacity: mergedProps.opacity, orientation: mergedProps.orientation, role: mergedProps.role, rotate: mergedProps.rotate, tabIndex: mergedProps.tabIndex, transform: mergedProps.transform, visibility: mergedProps.visibility, ...customAttributes, onBlur: handleBlur, onClick: handleClick, onDoubleClick: handleDoubleClick, onFocus: handleFocus, onKeyDown: handleKeyDown, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("path", { ref: pathRef, d: mergedProps.d, "data-testid": mergedProps.dataTestId, fill: mergedProps.dFill ? 'transparent' : mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule, stroke: mergedProps.stroke, strokeDasharray: mergedProps.strokeDasharray, strokeDashoffset: mergedProps.strokeDashoffset, strokeLinecap: mergedProps.strokeLinecap, strokeLinejoin: mergedProps.strokeLinejoin, strokeMiterlimit: mergedProps.strokeMiterlimit, strokeOpacity: mergedProps.strokeOpacity, strokeWidth: mergedProps.strokeWidth, children: mergedProps.title && _jsx("title", { children: mergedProps.title }) }), mergedProps.dFill && (_jsx("path", { d: mergedProps.dFill, fill: mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule }))] }), mergedProps.points &&
|
|
107
104
|
mergedProps.nodeConfig &&
|
|
108
105
|
mergedProps.points.map(([x, y], index) => {
|
|
109
106
|
const nodeData = {
|
|
@@ -112,7 +109,7 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
|
|
|
112
109
|
index,
|
|
113
110
|
xKey: mergedProps?.xKey,
|
|
114
111
|
};
|
|
115
|
-
return ((
|
|
112
|
+
return (_jsx(NodePath, { ref: rf => (nodeRef.current[index] = rf), data: nodeData, nodeConfig: mergedProps.nodeConfig, tabIndex: -1, x: x, y: y }, `${index.toString()}`));
|
|
116
113
|
})] }));
|
|
117
114
|
};
|
|
118
|
-
|
|
115
|
+
export const Path = forwardRef(PathComponent);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Circle = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
6
3
|
const CircleComponent = ({ dataTestId, position, size, ...props }, ref) => {
|
|
7
|
-
return ((
|
|
4
|
+
return (_jsx("circle", { ...props, ref: ref, cx: position.x, cy: position.y, "data-testid": `${dataTestId}-circle`, r: size / 2 }));
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
export const Circle = forwardRef(CircleComponent);
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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("./circle/circle"), exports);
|
|
18
|
-
__exportStar(require("./square/square"), exports);
|
|
19
|
-
__exportStar(require("./triangle/triangle"), exports);
|
|
1
|
+
export * from './circle/circle';
|
|
2
|
+
export * from './square/square';
|
|
3
|
+
export * from './triangle/triangle';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Square = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
6
3
|
const SquareComponent = ({ dataTestId, position, size, ...props }, ref) => {
|
|
7
|
-
return ((
|
|
4
|
+
return (_jsx("rect", { ...props, ref: ref, "data-testid": `${dataTestId}-square`, height: size, width: size, x: position.x - size / 2, y: position.y - size / 2 }));
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
export const Square = forwardRef(SquareComponent);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Triangle = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
6
3
|
const TriangleComponent = ({ dataTestId, position, size, ...props }, ref) => {
|
|
7
4
|
// Create an isosceles triangle where both width and height are size*2
|
|
8
5
|
// This maintains consistency with the circle and square Plots
|
|
@@ -12,6 +9,6 @@ const TriangleComponent = ({ dataTestId, position, size, ...props }, ref) => {
|
|
|
12
9
|
const bottomLeft = `${position.x - halfWidth},${position.y + height / 2}`;
|
|
13
10
|
const bottomRight = `${position.x + halfWidth},${position.y + height / 2}`;
|
|
14
11
|
const trianglePoints = `${topPoint} ${bottomLeft} ${bottomRight}`;
|
|
15
|
-
return ((
|
|
12
|
+
return (_jsx("polygon", { ...props, ref: ref, "data-testid": `${dataTestId}-triangle`, points: trianglePoints }));
|
|
16
13
|
};
|
|
17
|
-
|
|
14
|
+
export const Triangle = forwardRef(TriangleComponent);
|
|
@@ -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("./plot"), exports);
|
|
18
|
-
__exportStar(require("./plot.types"), exports);
|
|
1
|
+
export * from './plot';
|
|
2
|
+
export * from './plot.types';
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const triangle_1 = require("./components/triangle/triangle");
|
|
12
|
-
require("./plot.css");
|
|
13
|
-
const plot_types_1 = require("./plot.types");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useFocus } from '../../hooks/useFocus/useFocus';
|
|
4
|
+
import { useHover } from '../../hooks/useHover/useHover';
|
|
5
|
+
import { calculateFocusOutline, getFocusConfig, } from '../../utils/calculateFocusOutline/calculateFocusOutline';
|
|
6
|
+
import { Circle } from './components/circle/circle';
|
|
7
|
+
import { Square } from './components/square/square';
|
|
8
|
+
import { Triangle } from './components/triangle/triangle';
|
|
9
|
+
import './plot.css';
|
|
10
|
+
import { PLOT_SIZE_MAP, PlotSize, PlotType } from './plot.types';
|
|
14
11
|
// Map of components by type
|
|
15
12
|
const Component = {
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
13
|
+
[PlotType.CIRCLE]: Circle,
|
|
14
|
+
[PlotType.SQUARE]: Square,
|
|
15
|
+
[PlotType.TRIANGLE]: Triangle,
|
|
19
16
|
};
|
|
20
|
-
const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity, focusConfig, hasHoverEffect, hoverConfig, id, label, onBlur, onClick, onFocus, onKeyDown, onMouseEnter, onMouseLeave, opacity, position = { x: 0, y: 0 }, size =
|
|
21
|
-
const { handleBlur, handleFocus, isFocused } =
|
|
22
|
-
const { handleMouseEnter, handleMouseLeave, isHovered } =
|
|
17
|
+
const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity, focusConfig, hasHoverEffect, hoverConfig, id, label, onBlur, onClick, onFocus, onKeyDown, onMouseEnter, onMouseLeave, opacity, position = { x: 0, y: 0 }, size = PlotSize.MEDIUM, stroke, strokeWidth, tabIndex, type = PlotType.CIRCLE, ...props }, ref) => {
|
|
18
|
+
const { handleBlur, handleFocus, isFocused } = useFocus(onFocus, onBlur);
|
|
19
|
+
const { handleMouseEnter, handleMouseLeave, isHovered } = useHover(onMouseEnter, onMouseLeave);
|
|
23
20
|
// Extract properties from hoverConfig with default values
|
|
24
21
|
const { fill: hoverFill = fill, opacity: hoverOpacity = 0.3, scale: hoverScale = 1.3, stroke: hoverStroke = fill, strokeWidth: hoverStrokeWidth = 0, } = hoverConfig || {};
|
|
25
22
|
// Extract properties from focusConfig with default values
|
|
26
|
-
const resolvedFocusConfig =
|
|
23
|
+
const resolvedFocusConfig = getFocusConfig(focusConfig);
|
|
27
24
|
// Calculate focus outline dimensions using the utility
|
|
28
|
-
const sizeInPixels = typeof size === 'number' ? size :
|
|
29
|
-
const focusOutline =
|
|
25
|
+
const sizeInPixels = typeof size === 'number' ? size : PLOT_SIZE_MAP[size];
|
|
26
|
+
const focusOutline = calculateFocusOutline({
|
|
30
27
|
elementHeight: sizeInPixels,
|
|
31
28
|
elementPosition: position,
|
|
32
29
|
elementStrokeWidth: strokeWidth,
|
|
@@ -61,7 +58,7 @@ const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity
|
|
|
61
58
|
};
|
|
62
59
|
// Get the correct component based on type
|
|
63
60
|
const PlotShape = Component[type];
|
|
64
|
-
return ((
|
|
61
|
+
return (_jsxs(_Fragment, { children: [hasHoverEffect && isHovered && !isFocused && (_jsx(PlotShape, { dataTestId: `${dataTestId}-hover`, fill: hoverFill, opacity: hoverOpacity, position: position, size: sizeInPixels * hoverScale, stroke: hoverStroke, strokeWidth: hoverStrokeWidth })), isFocused && focusOutline.type === 'rectangle' && (_jsxs("g", { children: [_jsx("rect", { className: "plot-focus-outer", "data-testid": `${dataTestId}-focus-outer`, fill: "none", height: focusOutline.outer.height, stroke: resolvedFocusConfig.outlineColor, strokeWidth: resolvedFocusConfig.outlineStrokeWidth, width: focusOutline.outer.width, x: focusOutline.outer.x, y: focusOutline.outer.y }), _jsx("rect", { className: "plot-focus-inner", "data-testid": `${dataTestId}-focus-inner`, fill: "none", height: focusOutline.inner.height, stroke: resolvedFocusConfig.innerColor, strokeWidth: resolvedFocusConfig.innerStrokeWidth, width: focusOutline.inner.width, x: focusOutline.inner.x, y: focusOutline.inner.y })] })), _jsx(PlotShape, { ref: ref, ...plotShapeProps })] }));
|
|
65
62
|
};
|
|
66
63
|
/**
|
|
67
64
|
* `Plot` component which renders an interactive point in a chart with hover effects and accessibility features.
|
|
@@ -95,4 +92,4 @@ const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity
|
|
|
95
92
|
*
|
|
96
93
|
* @returns An SVG element representing the plot point with event handlers and accessibility features.
|
|
97
94
|
*/
|
|
98
|
-
|
|
95
|
+
export const Plot = forwardRef(PlotComponent);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PLOT_SIZE_MAP = exports.PlotSize = exports.PlotType = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Enum for plot types.
|
|
6
3
|
*
|
|
@@ -9,7 +6,7 @@ exports.PLOT_SIZE_MAP = exports.PlotSize = exports.PlotType = void 0;
|
|
|
9
6
|
*
|
|
10
7
|
* @enum {string}
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const PlotType = {
|
|
13
10
|
/** Represents a circle plot point */
|
|
14
11
|
CIRCLE: 'CIRCLE',
|
|
15
12
|
/** Represents a square plot point */
|
|
@@ -25,7 +22,7 @@ exports.PlotType = {
|
|
|
25
22
|
*
|
|
26
23
|
* @enum {string}
|
|
27
24
|
*/
|
|
28
|
-
|
|
25
|
+
export const PlotSize = {
|
|
29
26
|
/** Extra large plot point (40x40 pixels) */
|
|
30
27
|
EXTRA_LARGE: 'EXTRA_LARGE',
|
|
31
28
|
/** Extra small plot point (8x8 pixels) */
|
|
@@ -45,10 +42,10 @@ exports.PlotSize = {
|
|
|
45
42
|
*
|
|
46
43
|
* @type {Record<PlotSize, number>}
|
|
47
44
|
*/
|
|
48
|
-
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
45
|
+
export const PLOT_SIZE_MAP = {
|
|
46
|
+
[PlotSize.EXTRA_LARGE]: 40,
|
|
47
|
+
[PlotSize.EXTRA_SMALL]: 8,
|
|
48
|
+
[PlotSize.LARGE]: 32,
|
|
49
|
+
[PlotSize.MEDIUM]: 24,
|
|
50
|
+
[PlotSize.SMALL]: 16,
|
|
54
51
|
};
|
|
@@ -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("./svgContainer"), exports);
|
|
1
|
+
export * from './svgContainer';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SvgContainer = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
6
3
|
/**
|
|
7
4
|
* Renders an SVG container with customizable properties.
|
|
8
5
|
*
|
|
@@ -28,10 +25,10 @@ const react_1 = require("react");
|
|
|
28
25
|
* @returns {ReactElement} A React element representing the SVG container.
|
|
29
26
|
*/
|
|
30
27
|
const SvgContainerComponent = ({ ariaHidden, ariaLabel, backgroundColor, caption, children, className, dataTestId, height, imageSrc, overflow, radius = '0px', role, tabIndex, viewBox, width, ...callbacks }, ref) => {
|
|
31
|
-
return ((
|
|
28
|
+
return (_jsxs("svg", { ref: ref, "aria-hidden": ariaHidden, "aria-label": ariaLabel, className: className, "data-testid": dataTestId, height: height, role: role, style: {
|
|
32
29
|
backgroundColor: backgroundColor,
|
|
33
30
|
borderRadius: radius,
|
|
34
31
|
overflow: overflow,
|
|
35
|
-
}, tabIndex: tabIndex, viewBox: viewBox, width: width, onMouseDown: e => e.preventDefault(), ...callbacks, children: [caption && (
|
|
32
|
+
}, tabIndex: tabIndex, viewBox: viewBox, width: width, onMouseDown: e => e.preventDefault(), ...callbacks, children: [caption && _jsx("title", { children: caption }), imageSrc && _jsx("image", { height: height, href: imageSrc, width: width, x: "0", y: "0" }), children] }));
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
export const SvgContainer = forwardRef(SvgContainerComponent);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildViewBox = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Constructs a viewBox attribute value for an SVG element.
|
|
6
3
|
*
|
|
@@ -14,11 +11,10 @@ exports.buildViewBox = void 0;
|
|
|
14
11
|
*
|
|
15
12
|
* @returns {string} The `viewBox` attribute value, formatted as "minX minY width height".
|
|
16
13
|
*/
|
|
17
|
-
const buildViewBox = (width, height, extraSpace = 0) => {
|
|
14
|
+
export const buildViewBox = (width, height, extraSpace = 0) => {
|
|
18
15
|
const minX = -extraSpace;
|
|
19
16
|
const minY = -extraSpace;
|
|
20
17
|
const viewBoxWidth = width;
|
|
21
18
|
const viewBoxHeight = height;
|
|
22
19
|
return `${minX} ${minY} ${viewBoxWidth} ${viewBoxHeight}`;
|
|
23
20
|
};
|
|
24
|
-
exports.buildViewBox = buildViewBox;
|
|
@@ -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("./buildViewBox/buildViewBox"), exports);
|
|
1
|
+
export * from './buildViewBox/buildViewBox';
|
|
@@ -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("./tick"), exports);
|
|
18
|
-
__exportStar(require("./tick.types"), exports);
|
|
1
|
+
export * from './tick';
|
|
2
|
+
export * from './tick.types';
|