@kubit-ui-web/react-charts 1.0.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 +2 -0
- 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/package.json +31 -33
|
@@ -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';
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const chartText_1 = require("../../components/chartText/chartText");
|
|
6
|
-
const line_1 = require("../../components/line/line");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChartText } from '../../components/chartText/chartText';
|
|
3
|
+
import { Line } from '../../components/line/line';
|
|
7
4
|
/**
|
|
8
5
|
* Functional component for rendering a tick mark in a chart or graph.
|
|
9
6
|
*
|
|
@@ -19,5 +16,4 @@ const line_1 = require("../../components/line/line");
|
|
|
19
16
|
* @param {number} [props.y] - Optional y-coordinate for the position of the tick mark. Used for vertical placement.
|
|
20
17
|
* @returns A React functional component that renders the tick mark and its associated elements.
|
|
21
18
|
*/
|
|
22
|
-
const Tick = ({ showTickLines, tick, tickLine, tickText }) => ((
|
|
23
|
-
exports.Tick = Tick;
|
|
19
|
+
export const Tick = ({ showTickLines, tick, tickLine, tickText }) => (_jsxs("g", { children: [showTickLines && _jsx(Line, { ...tickLine }), tickText && _jsx(ChartText, { ...tickText, children: tick.value })] }));
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TickDataUtils = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Utility functions for working with TickData.
|
|
6
3
|
*/
|
|
7
|
-
|
|
4
|
+
export const TickDataUtils = {
|
|
8
5
|
/**
|
|
9
6
|
* Formats the values of an array of TickData using the provided formatter function.
|
|
10
7
|
*
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HandlerIcon = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
2
|
/**
|
|
6
3
|
* Default color for handler icons
|
|
7
4
|
*/
|
|
@@ -20,7 +17,6 @@ const ICON_OFFSET = 5;
|
|
|
20
17
|
* The icon is centered on the handler by applying a translation of:
|
|
21
18
|
* x - ICON_OFFSET, y - ICON_OFFSET
|
|
22
19
|
*/
|
|
23
|
-
const HandlerIcon = ({ fill = DEFAULT_ICON_COLOR, x, y }) => {
|
|
24
|
-
return ((
|
|
20
|
+
export const HandlerIcon = ({ fill = DEFAULT_ICON_COLOR, x, y }) => {
|
|
21
|
+
return (_jsxs("g", { fill: fill, pointerEvents: "none", transform: `translate(${x - ICON_OFFSET}, ${y - ICON_OFFSET})`, children: [_jsx("path", { d: "M4.99948 9.99802C4.47168 9.99802 4.04419 9.64335 4.04419 9.20547V0.79255C4.04419 0.354666 4.47168 0 4.99948 0C5.52728 0 5.95477 0.354666 5.95477 0.79255V9.20745C5.95477 9.64533 5.52728 10 4.99948 10V9.99802Z" }), _jsx("path", { d: "M0.955289 8.78839C0.427492 8.78839 0 8.43372 0 7.99584V2.00416C0 1.56628 0.427492 1.21161 0.955289 1.21161C1.48309 1.21161 1.91058 1.56628 1.91058 2.00416V7.99584C1.91058 8.43372 1.48309 8.78839 0.955289 8.78839Z" }), _jsx("path", { d: "M8.08936 7.99584C8.08936 8.43372 8.51685 8.78839 9.04464 8.78839C9.57244 8.78839 9.99993 8.43372 9.99993 7.99584V2.00416C9.99993 1.56628 9.57244 1.21161 9.04464 1.21161C8.51685 1.21161 8.08936 1.56628 8.08936 2.00416V7.99584Z" })] }));
|
|
25
22
|
};
|
|
26
|
-
exports.HandlerIcon = HandlerIcon;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LineRenderer = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
2
|
/**
|
|
6
3
|
* Default color for lines when no stroke is provided
|
|
7
4
|
*/
|
|
@@ -9,7 +6,6 @@ const DEFAULT_LINE_COLOR = '#0078D4';
|
|
|
9
6
|
/**
|
|
10
7
|
* Renders all lines and fill areas for the zoom area chart
|
|
11
8
|
*/
|
|
12
|
-
const LineRenderer = ({ linesData }) => {
|
|
13
|
-
return ((
|
|
9
|
+
export const LineRenderer = ({ linesData }) => {
|
|
10
|
+
return (_jsx(_Fragment, { children: linesData.map((lineData, index) => (_jsxs("g", { children: [lineData.config.fill && lineData.fillPath && (_jsx("path", { d: lineData.fillPath, fill: lineData.config.fill, fillOpacity: lineData.config.fillOpacity || 0.2, stroke: "none" })), _jsx("path", { d: lineData.linePath, fill: "none", stroke: lineData.config.stroke || DEFAULT_LINE_COLOR, strokeWidth: lineData.config.strokeWidth || 1 })] }, lineData.config.dataKey || lineData.config.yKey || index))) }));
|
|
14
11
|
};
|
|
15
|
-
exports.LineRenderer = LineRenderer;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const calculateFocusOutline_1 = require("../../../utils/calculateFocusOutline/calculateFocusOutline");
|
|
6
|
-
const rangeAndPositions_1 = require("../utils/rangeAndPositions");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { calculateFocusOutline } from '../../../utils/calculateFocusOutline/calculateFocusOutline';
|
|
3
|
+
import { isFullRange } from '../utils/rangeAndPositions';
|
|
7
4
|
/**
|
|
8
5
|
* Focus ring for the selection area - rendered separately to control z-order
|
|
9
6
|
*/
|
|
10
|
-
const SelectionAreaFocusRing = ({ endX, focusConfig, height, isFocused, startX, }) => {
|
|
7
|
+
export const SelectionAreaFocusRing = ({ endX, focusConfig, height, isFocused, startX, }) => {
|
|
11
8
|
if (!isFocused) {
|
|
12
9
|
return null;
|
|
13
10
|
}
|
|
@@ -17,7 +14,7 @@ const SelectionAreaFocusRing = ({ endX, focusConfig, height, isFocused, startX,
|
|
|
17
14
|
const centerX = startX + selectionWidth / 2;
|
|
18
15
|
const centerY = height / 2;
|
|
19
16
|
// Calculate focus ring dimensions using the new util
|
|
20
|
-
const focusOutline =
|
|
17
|
+
const focusOutline = calculateFocusOutline({
|
|
21
18
|
elementHeight: selectionHeight,
|
|
22
19
|
elementPosition: { x: centerX, y: centerY },
|
|
23
20
|
elementStrokeWidth: 0, // Selection area typically has no border
|
|
@@ -35,19 +32,17 @@ const SelectionAreaFocusRing = ({ endX, focusConfig, height, isFocused, startX,
|
|
|
35
32
|
if (focusOutline.type !== 'rectangle') {
|
|
36
33
|
return null;
|
|
37
34
|
}
|
|
38
|
-
return ((
|
|
35
|
+
return (_jsxs("g", { pointerEvents: "none", children: [_jsx("rect", { fill: "none", height: focusOutline.outer.height, stroke: outlineColor, strokeWidth: outlineStrokeWidth, width: focusOutline.outer.width, x: focusOutline.outer.x, y: focusOutline.outer.y }), _jsx("rect", { fill: "none", height: focusOutline.inner.height, stroke: innerColor, strokeWidth: innerStrokeWidth, width: focusOutline.inner.width, x: focusOutline.inner.x, y: focusOutline.inner.y })] }));
|
|
39
36
|
};
|
|
40
|
-
exports.SelectionAreaFocusRing = SelectionAreaFocusRing;
|
|
41
37
|
/**
|
|
42
38
|
* Selection area overlay
|
|
43
39
|
*/
|
|
44
|
-
const SelectionArea = ({ currentRange, dataLength, dataTestId, endX, height, onBlur, onFocus, onKeyDown, onMouseDown, onTouchStart, screenReaderText, selectionConfig, startX, }) => {
|
|
40
|
+
export const SelectionArea = ({ currentRange, dataLength, dataTestId, endX, height, onBlur, onFocus, onKeyDown, onMouseDown, onTouchStart, screenReaderText, selectionConfig, startX, }) => {
|
|
45
41
|
// Check if overlay should be hidden based on design specs:
|
|
46
42
|
// "Only visible when a range is defined"
|
|
47
|
-
const shouldHideOverlay = selectionConfig.hideOverlayOnFullRange &&
|
|
48
|
-
return ((
|
|
43
|
+
const shouldHideOverlay = selectionConfig.hideOverlayOnFullRange && isFullRange(currentRange, dataLength);
|
|
44
|
+
return (_jsx(_Fragment, { children: _jsx("rect", { "aria-label": screenReaderText, "aria-valuemax": dataLength - 1, "aria-valuemin": 0, "aria-valuetext": screenReaderText, cursor: "grab", "data-testid": dataTestId, fill: selectionConfig.fill, fillOpacity: selectionConfig.fillOpacity, height: height, role: "slider", stroke: selectionConfig.stroke, strokeWidth: selectionConfig.strokeWidth, style: {
|
|
49
45
|
outline: 'none',
|
|
50
46
|
visibility: shouldHideOverlay ? 'hidden' : 'visible',
|
|
51
47
|
}, tabIndex: 0, width: endX - startX, x: startX, y: 0, onBlur: onBlur, onFocus: onFocus, onKeyDown: onKeyDown, onMouseDown: onMouseDown, onTouchStart: onTouchStart }) }));
|
|
52
48
|
};
|
|
53
|
-
exports.SelectionArea = SelectionArea;
|