@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,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const isNear_1 = require("../../../utils/cursorNear/isNear");
|
|
10
|
-
const pickCustomAttributes_1 = require("../../../utils/pickCustomAttributes/pickCustomAttributes");
|
|
11
|
-
const filterLineProps_1 = require("../utils/filterLineProps/filterLineProps");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Line } from '../../../components/line/line';
|
|
3
|
+
import { Tick } from '../../../components/tick/tick';
|
|
4
|
+
import { DefaultCanvasConfig } from '../../../types/canvas.type';
|
|
5
|
+
import { Positions } from '../../../types/position.enum';
|
|
6
|
+
import { isNear } from '../../../utils/cursorNear/isNear';
|
|
7
|
+
import { pickCustomAttributes } from '../../../utils/pickCustomAttributes/pickCustomAttributes';
|
|
8
|
+
import { filterLineProps } from '../utils/filterLineProps/filterLineProps';
|
|
12
9
|
/**
|
|
13
10
|
* Renders the X-axis of a chart, including tick marks and labels.
|
|
14
11
|
*
|
|
@@ -16,23 +13,23 @@ const filterLineProps_1 = require("../utils/filterLineProps/filterLineProps");
|
|
|
16
13
|
*
|
|
17
14
|
* The component renders a `<g>` SVG element containing a `<Line>` component for the axis line and multiple `<Tick>` components for the tick marks and labels, adjusted for the canvas size and extra space.
|
|
18
15
|
*/
|
|
19
|
-
const XAxis = ({ canvasHeight =
|
|
16
|
+
export const XAxis = ({ canvasHeight = DefaultCanvasConfig.height, canvasWidth = DefaultCanvasConfig.width, cursor = 0, extraSpace = {
|
|
20
17
|
bottom: 0,
|
|
21
18
|
left: 0,
|
|
22
19
|
right: 0,
|
|
23
20
|
top: 0,
|
|
24
|
-
}, position =
|
|
21
|
+
}, position = Positions.BOTTOM, showTickLines = false, tickLine, tickLineHover, tickText, tickValues = [], ...props }) => {
|
|
25
22
|
// Extract custom attributes for the g element
|
|
26
|
-
const customAttributes =
|
|
27
|
-
return ((
|
|
23
|
+
const customAttributes = pickCustomAttributes(props);
|
|
24
|
+
return (_jsxs("g", { ...customAttributes, children: [_jsx(Line, { ...filterLineProps(props) }), tickValues &&
|
|
28
25
|
tickValues.length > 0 &&
|
|
29
26
|
tickValues.map((tick, index) => {
|
|
30
|
-
const overrideTickLine =
|
|
27
|
+
const overrideTickLine = isNear(cursor, tick.position) && tickLineHover;
|
|
31
28
|
const tickLineProps = overrideTickLine ? { ...tickLine, ...tickLineHover } : tickLine;
|
|
32
29
|
const rotate = tickText?.transform === 'rotate'
|
|
33
30
|
? `rotate(-30, ${tick.position}, ${tickText.y})`
|
|
34
31
|
: undefined;
|
|
35
|
-
return ((
|
|
32
|
+
return (_jsx(Tick, { showTickLines: showTickLines, tick: tick, tickLine: {
|
|
36
33
|
...tickLineProps,
|
|
37
34
|
x1: tick.position,
|
|
38
35
|
x2: tick.position,
|
|
@@ -43,4 +40,3 @@ const XAxis = ({ canvasHeight = canvas_type_1.DefaultCanvasConfig.height, canvas
|
|
|
43
40
|
} }, `${index.toString()}`));
|
|
44
41
|
})] }));
|
|
45
42
|
};
|
|
46
|
-
exports.XAxis = XAxis;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -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("./yAxis"), exports);
|
|
18
|
-
__exportStar(require("./yAxis.types"), exports);
|
|
1
|
+
export * from './yAxis';
|
|
2
|
+
export * from './yAxis.types';
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const isNear_1 = require("../../../utils/cursorNear/isNear");
|
|
9
|
-
const pickCustomAttributes_1 = require("../../../utils/pickCustomAttributes/pickCustomAttributes");
|
|
10
|
-
const filterLineProps_1 = require("../utils/filterLineProps/filterLineProps");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Line } from '../../../components/line/line';
|
|
3
|
+
import { Tick } from '../../../components/tick/tick';
|
|
4
|
+
import { Positions } from '../../../types/position.enum';
|
|
5
|
+
import { isNear } from '../../../utils/cursorNear/isNear';
|
|
6
|
+
import { pickCustomAttributes } from '../../../utils/pickCustomAttributes/pickCustomAttributes';
|
|
7
|
+
import { filterLineProps } from '../utils/filterLineProps/filterLineProps';
|
|
11
8
|
/**
|
|
12
9
|
* Renders a Y-axis for a chart, including tick marks and labels.
|
|
13
10
|
* This component renders a `<g>` SVG element containing a `<Line>` component for the axis line and multiple `<Tick>` components for the tick marks and labels.
|
|
14
11
|
*/
|
|
15
|
-
const YAxis = ({ canvasWidth, cursor = 0, extraSpace = {
|
|
12
|
+
export const YAxis = ({ canvasWidth, cursor = 0, extraSpace = {
|
|
16
13
|
bottom: 0,
|
|
17
14
|
left: 0,
|
|
18
15
|
right: 0,
|
|
19
16
|
top: 0,
|
|
20
|
-
}, position =
|
|
17
|
+
}, position = Positions.LEFT, showTickLines = true, tickLine, tickLineHover, tickText, tickValues = [], ...props }) => {
|
|
21
18
|
// Extract custom attributes for the g element
|
|
22
|
-
const customAttributes =
|
|
23
|
-
return ((
|
|
19
|
+
const customAttributes = pickCustomAttributes(props);
|
|
20
|
+
return (_jsxs("g", { ...customAttributes, children: [_jsx(Line, { ...filterLineProps(props) }), tickValues &&
|
|
24
21
|
tickValues.length > 0 &&
|
|
25
22
|
tickValues.map((tick, index) => {
|
|
26
|
-
const overrideTickLine =
|
|
23
|
+
const overrideTickLine = isNear(cursor, tick.position) && tickLineHover;
|
|
27
24
|
const tickLineProps = overrideTickLine ? { ...tickLine, ...tickLineHover } : tickLine;
|
|
28
25
|
const rotate = tickText?.transform === 'rotate'
|
|
29
26
|
? `rotate(-30, ${tickText.x}, ${tick.position})`
|
|
30
27
|
: undefined;
|
|
31
|
-
return ((
|
|
28
|
+
return (_jsx(Tick, { showTickLines: showTickLines, tick: tick, tickLine: {
|
|
32
29
|
...tickLineProps,
|
|
33
30
|
y1: tick.position,
|
|
34
31
|
y2: tick.position,
|
|
35
32
|
}, tickText: { ...tickText, transform: rotate, y: tick.position } }, `${index.toString()}`));
|
|
36
33
|
})] }));
|
|
37
34
|
};
|
|
38
|
-
exports.YAxis = YAxis;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const buildD_1 = require("./utils/buildD");
|
|
7
|
-
const getSegments_1 = require("./utils/getSegments");
|
|
8
|
-
const Bar = ({ barConfig, currentBars, endRounded, extraSpacing = 0, order = 1, orientation, startRounded, x1, x2, y1, y2, }) => {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Path } from '../path/path';
|
|
3
|
+
import { buildD } from './utils/buildD';
|
|
4
|
+
import { getSegments } from './utils/getSegments';
|
|
5
|
+
export const Bar = ({ barConfig, currentBars, endRounded, extraSpacing = 0, order = 1, orientation, startRounded, x1, x2, y1, y2, }) => {
|
|
9
6
|
const { barWidth, singleConfig } = barConfig;
|
|
10
|
-
const segments =
|
|
11
|
-
return ((
|
|
7
|
+
const segments = getSegments({ barConfig, orientation, x1, x2, y1, y2 });
|
|
8
|
+
return (_jsx("g", { children: singleConfig.map((single, index) => {
|
|
12
9
|
const [segmentX1, segmentX2] = orientation === 'HORIZONTAL' ? segments[index] : [x1, x2];
|
|
13
10
|
const [segmentY1, segmentY2] = orientation === 'VERTICAL' ? segments[index] : [y1, y2];
|
|
14
|
-
const d =
|
|
11
|
+
const d = buildD({
|
|
15
12
|
barWidth,
|
|
16
13
|
currentBars,
|
|
17
14
|
endRounded: index === singleConfig.length - 1 && endRounded ? endRounded : undefined,
|
|
@@ -24,10 +21,9 @@ const Bar = ({ barConfig, currentBars, endRounded, extraSpacing = 0, order = 1,
|
|
|
24
21
|
y1: segmentY1,
|
|
25
22
|
y2: segmentY2,
|
|
26
23
|
});
|
|
27
|
-
return ((
|
|
24
|
+
return (_jsx(Path, { d: d, fill: single.color, hoverConfig: {
|
|
28
25
|
stroke: 'transparent',
|
|
29
26
|
strokeWidth: '0',
|
|
30
27
|
}, stroke: "transparent", tabIndex: 0, title: single.title }, `${single.title}-${index.toString()}`));
|
|
31
28
|
}) }));
|
|
32
29
|
};
|
|
33
|
-
exports.Bar = Bar;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const BarChartSegment = () => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("path", { children: (0, jsx_runtime_1.jsx)("title", {}) }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const BarChartSegment = () => {
|
|
3
|
+
return (_jsx("path", { children: _jsx("title", {}) }));
|
|
7
4
|
};
|
|
8
|
-
exports.BarChartSegment = BarChartSegment;
|
|
@@ -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("./bar"), exports);
|
|
18
|
-
__exportStar(require("./bar.type"), exports);
|
|
1
|
+
export * from './bar';
|
|
2
|
+
export * from './bar.type';
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildD = void 0;
|
|
4
|
-
const bar_type_1 = require("../bar.type");
|
|
1
|
+
import { BarOrientation } from '../bar.type';
|
|
5
2
|
const locateFromPosition = ({ barWidth, currentBars, extraSpacing, order, orientation, }) => {
|
|
6
3
|
const halfWidth = barWidth / 2;
|
|
7
4
|
const gap = extraSpacing / 2;
|
|
@@ -18,7 +15,7 @@ const locateFromPosition = ({ barWidth, currentBars, extraSpacing, order, orient
|
|
|
18
15
|
startReference = isEven ? -gap : halfWidth;
|
|
19
16
|
}
|
|
20
17
|
else if (currentPosition < 0) {
|
|
21
|
-
if (orientation ===
|
|
18
|
+
if (orientation === BarOrientation.HORIZONTAL) {
|
|
22
19
|
startReference = currentPosition * -ajustedSpace + barWidth;
|
|
23
20
|
}
|
|
24
21
|
else {
|
|
@@ -26,7 +23,7 @@ const locateFromPosition = ({ barWidth, currentBars, extraSpacing, order, orient
|
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
else if (currentPosition > 0) {
|
|
29
|
-
if (orientation ===
|
|
26
|
+
if (orientation === BarOrientation.HORIZONTAL) {
|
|
30
27
|
startReference = currentPosition * -ajustedSpace;
|
|
31
28
|
}
|
|
32
29
|
else {
|
|
@@ -35,7 +32,7 @@ const locateFromPosition = ({ barWidth, currentBars, extraSpacing, order, orient
|
|
|
35
32
|
}
|
|
36
33
|
return startReference;
|
|
37
34
|
};
|
|
38
|
-
const buildD = ({ barWidth, currentBars, endRounded = 0, extraSpacing, order, orientation, startRounded = 0, x1, x2, y1, y2, }) => {
|
|
35
|
+
export const buildD = ({ barWidth, currentBars, endRounded = 0, extraSpacing, order, orientation, startRounded = 0, x1, x2, y1, y2, }) => {
|
|
39
36
|
// declare the variables for the path
|
|
40
37
|
let start, draw1, draw2, draw3;
|
|
41
38
|
let end = 'Z';
|
|
@@ -52,7 +49,7 @@ const buildD = ({ barWidth, currentBars, endRounded = 0, extraSpacing, order, or
|
|
|
52
49
|
* L = line to (x, y)
|
|
53
50
|
* Q = quadratic curve to (x curve deep, y curve deep), (end draw x, end draw y)
|
|
54
51
|
*/
|
|
55
|
-
if (orientation ===
|
|
52
|
+
if (orientation === BarOrientation.HORIZONTAL) {
|
|
56
53
|
// calculate the start and end of the quadratic curve in horizontal orientation
|
|
57
54
|
const modifyXStart = x1 + startRounded;
|
|
58
55
|
const modifyXEnd = x2 - endRounded;
|
|
@@ -116,4 +113,3 @@ const buildD = ({ barWidth, currentBars, endRounded = 0, extraSpacing, order, or
|
|
|
116
113
|
}
|
|
117
114
|
return `${start} ${draw1} ${draw2} ${draw3} ${end}`;
|
|
118
115
|
};
|
|
119
|
-
exports.buildD = buildD;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSegments = void 0;
|
|
4
|
-
const bar_type_1 = require("../bar.type");
|
|
1
|
+
import { BarOrientation } from '../bar.type';
|
|
5
2
|
const transformCoverage = (coveragePercent, maxValue) => {
|
|
6
3
|
return (coveragePercent / 100) * maxValue;
|
|
7
4
|
};
|
|
8
5
|
const ajustedGap = (positive, value, gap) => {
|
|
9
6
|
return positive ? value + gap / 2 : value - gap / 2;
|
|
10
7
|
};
|
|
11
|
-
const getSegments = ({ barConfig, orientation, x1, x2, y1, y2, }) => {
|
|
8
|
+
export const getSegments = ({ barConfig, orientation, x1, x2, y1, y2, }) => {
|
|
12
9
|
const { gap = 0, singleConfig } = barConfig;
|
|
13
|
-
const isHorizontal = orientation ===
|
|
10
|
+
const isHorizontal = orientation === BarOrientation.HORIZONTAL;
|
|
14
11
|
// the start of the bar based on the orientation
|
|
15
12
|
const barStart = isHorizontal ? x1 : y1;
|
|
16
13
|
// the end of the bar based on the orientation
|
|
@@ -32,4 +29,3 @@ const getSegments = ({ barConfig, orientation, x1, x2, y1, y2, }) => {
|
|
|
32
29
|
return acc;
|
|
33
30
|
}, []);
|
|
34
31
|
};
|
|
35
|
-
exports.getSegments = getSegments;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChartText = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
2
|
/**
|
|
6
3
|
* Functional component for rendering SVG text elements in React.
|
|
7
4
|
*
|
|
@@ -16,7 +13,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
13
|
* @param {React.ReactNode} props.children - The text content to be rendered within the `<text>` element.
|
|
17
14
|
* @returns {React.ReactElement} A React element representing the SVG text.
|
|
18
15
|
*/
|
|
19
|
-
const ChartText = ({ children, className = 'circle', tabIndex = -1, ...props }) => {
|
|
20
|
-
return ((
|
|
16
|
+
export const ChartText = ({ children, className = 'circle', tabIndex = -1, ...props }) => {
|
|
17
|
+
return (_jsx("text", { className: className, tabIndex: tabIndex, ...props, children: children }));
|
|
21
18
|
};
|
|
22
|
-
exports.ChartText = ChartText;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Defines the properties for rendering text within SVG elements in React components.
|
|
4
3
|
*
|
|
@@ -8,4 +7,4 @@
|
|
|
8
7
|
* writingMode. Additionally, it supports React-specific properties like style, className, and children, allowing for
|
|
9
8
|
* further customization and integration within React applications.
|
|
10
9
|
*/
|
|
11
|
-
|
|
10
|
+
export {};
|
|
@@ -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("./chartText"), exports);
|
|
18
|
-
__exportStar(require("./chartText.types"), exports);
|
|
1
|
+
export * from './chartText';
|
|
2
|
+
export * from './chartText.types';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const ForeignObject = ({ children, dataTestId, height, width, x, y, }) => {
|
|
6
|
-
return ((0, jsx_runtime_1.jsx)("foreignObject", { "data-testid": dataTestId, height: height, width: width, x: x, y: y, children: children }));
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const ForeignObject = ({ children, dataTestId, height, width, x, y, }) => {
|
|
3
|
+
return (_jsx("foreignObject", { "data-testid": dataTestId, height: height, width: width, x: x, y: y, children: children }));
|
|
7
4
|
};
|
|
8
|
-
exports.ForeignObject = ForeignObject;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -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("./foreignObject"), exports);
|
|
18
|
-
__exportStar(require("./foreignObject.types"), exports);
|
|
1
|
+
export * from './foreignObject';
|
|
2
|
+
export * from './foreignObject.types';
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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("./axisChart"), exports);
|
|
18
|
-
__exportStar(require("./bar"), exports);
|
|
19
|
-
__exportStar(require("./chartText"), exports);
|
|
20
|
-
__exportStar(require("./foreignObject"), exports);
|
|
21
|
-
__exportStar(require("./line"), exports);
|
|
22
|
-
__exportStar(require("./node"), exports);
|
|
23
|
-
__exportStar(require("./path"), exports);
|
|
24
|
-
__exportStar(require("./svgContainer"), exports);
|
|
25
|
-
__exportStar(require("./tick"), exports);
|
|
26
|
-
__exportStar(require("./zoomArea"), exports);
|
|
1
|
+
export * from './axisChart';
|
|
2
|
+
export * from './bar';
|
|
3
|
+
export * from './chartText';
|
|
4
|
+
export * from './foreignObject';
|
|
5
|
+
export * from './line';
|
|
6
|
+
export * from './node';
|
|
7
|
+
export * from './path';
|
|
8
|
+
export * from './svgContainer';
|
|
9
|
+
export * from './tick';
|
|
10
|
+
export * from './zoomArea';
|
|
@@ -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("./line"), exports);
|
|
18
|
-
__exportStar(require("./line.types"), exports);
|
|
1
|
+
export * from './line';
|
|
2
|
+
export * from './line.types';
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Line = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
2
|
/**
|
|
6
3
|
* `Line` component that renders an SVG line element with customizable properties.
|
|
7
4
|
*
|
|
8
5
|
* @returns A `line` SVG element with the specified properties and attributes.
|
|
9
6
|
*/
|
|
10
|
-
const Line = ({ ariaLabel = '', className = 'line', dataTestId, tabIndex = -1, ...props }) => {
|
|
11
|
-
return ((
|
|
7
|
+
export const Line = ({ ariaLabel = '', className = 'line', dataTestId, tabIndex = -1, ...props }) => {
|
|
8
|
+
return (_jsx("line", { ...props, "aria-label": ariaLabel, className: className, "data-testid": dataTestId, tabIndex: tabIndex }));
|
|
12
9
|
};
|
|
13
|
-
exports.Line = Line;
|
|
@@ -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 = 1, ...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,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const calculateShapePoints_1 = require("../../utils/calculateShapePoints/calculateShapePoints");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { calculateShapePoints } from '../../utils/calculateShapePoints/calculateShapePoints';
|
|
7
4
|
const HexagonComponent = ({ dataTestId, position = { x: 0, y: 0 }, size = 1, ...props }, ref) => {
|
|
8
|
-
const hexagonPoints =
|
|
9
|
-
return ((
|
|
5
|
+
const hexagonPoints = calculateShapePoints(position.x, position.y, 6, size / 2, size / 2);
|
|
6
|
+
return (_jsx("polygon", { ...props, ref: ref, "data-testid": `${dataTestId}-hexagon`, points: hexagonPoints }));
|
|
10
7
|
};
|
|
11
|
-
|
|
8
|
+
export const Hexagon = forwardRef(HexagonComponent);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const calculateShapePoints_1 = require("../../utils/calculateShapePoints/calculateShapePoints");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { calculateShapePoints } from '../../utils/calculateShapePoints/calculateShapePoints';
|
|
7
4
|
const PentagonComponent = ({ dataTestId, position = { x: 0, y: 0 }, size = 1, ...props }, ref) => {
|
|
8
|
-
const pentagonPoints =
|
|
9
|
-
return ((
|
|
5
|
+
const pentagonPoints = calculateShapePoints(position.x, position.y, 5, size / 2, size / 2);
|
|
6
|
+
return (_jsx("polygon", { ...props, ref: ref, "data-testid": `${dataTestId}-pentagon`, points: pentagonPoints }));
|
|
10
7
|
};
|
|
11
|
-
|
|
8
|
+
export const Pentagon = forwardRef(PentagonComponent);
|
|
@@ -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 = { x: 0, y: 0 }, size = 1, ...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,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const calculateShapePoints_1 = require("../../utils/calculateShapePoints/calculateShapePoints");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { calculateShapePoints } from '../../utils/calculateShapePoints/calculateShapePoints';
|
|
7
4
|
const StarComponent = ({ dataTestId, position = { x: 0, y: 0 }, size = 1, ...props }, ref) => {
|
|
8
5
|
const outerRadius = size / 2;
|
|
9
6
|
const innerRadius = outerRadius / 2;
|
|
10
|
-
const starPoints =
|
|
11
|
-
return (
|
|
7
|
+
const starPoints = calculateShapePoints(position.x, position.y, 5, outerRadius, innerRadius);
|
|
8
|
+
return _jsx("polygon", { ...props, ref: ref, "data-testid": `${dataTestId}-star`, points: starPoints });
|
|
12
9
|
};
|
|
13
|
-
|
|
10
|
+
export const Star = forwardRef(StarComponent);
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Straight = 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 StraightComponent = ({ dataTestId, position = { x: 0, y: 0 }, size = 1, ...props }, ref) => {
|
|
7
4
|
const d = `M ${position.x - size / 2} ${position.y} H ${position.x + size / 2} M ${position.x} ${position.y - size / 2} V ${position.y + size / 2}`;
|
|
8
|
-
return (
|
|
5
|
+
return _jsx("path", { ...props, ref: ref, d: d, "data-testid": `${dataTestId}-straight`, strokeWidth: 2 });
|
|
9
6
|
};
|
|
10
|
-
|
|
7
|
+
export const Straight = forwardRef(StraightComponent);
|
|
@@ -1,14 +1,11 @@
|
|
|
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 = { x: 0, y: 0 }, size = 1, ...props }, ref) => {
|
|
7
4
|
const points = [
|
|
8
5
|
`${position.x},${position.y - size / 2}`,
|
|
9
6
|
`${position.x - size / 2},${position.y + size / 2}`,
|
|
10
7
|
`${position.x + size / 2},${position.y + size / 2}`,
|
|
11
8
|
].join(' ');
|
|
12
|
-
return (
|
|
9
|
+
return _jsx("polygon", { ...props, ref: ref, "data-testid": `${dataTestId}-triangle`, points: points });
|
|
13
10
|
};
|
|
14
|
-
|
|
11
|
+
export const Triangle = forwardRef(TriangleComponent);
|