@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.
Files changed (178) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/charts/barChart/barChart.js +12 -29
  3. package/dist/cjs/charts/barChart/barChart.type.js +1 -2
  4. package/dist/cjs/charts/barChart/barChartStructure.js +25 -29
  5. package/dist/cjs/charts/barChart/context/barChartContext.js +2 -5
  6. package/dist/cjs/charts/barChart/context/buildBarContextValues.js +17 -21
  7. package/dist/cjs/charts/barChart/fragments/barChartPath.js +12 -16
  8. package/dist/cjs/charts/barChart/fragments/barChartSeparator.js +10 -14
  9. package/dist/cjs/charts/barChart/fragments/barChartXAxis.js +10 -14
  10. package/dist/cjs/charts/barChart/fragments/barChartYAxis.js +13 -17
  11. package/dist/cjs/charts/barChart/fragments/fixture/barContextData.js +3 -6
  12. package/dist/cjs/charts/barChart/fragments/fixture/index.js +1 -5
  13. package/dist/cjs/charts/barChart/index.js +1 -17
  14. package/dist/cjs/charts/barChart/utils/countBarChildren.js +5 -9
  15. package/dist/cjs/charts/barChart/utils/getAxisExtraSpacing.js +31 -35
  16. package/dist/cjs/charts/barChart/utils/getBarDataValue.js +1 -5
  17. package/dist/cjs/charts/barChart/utils/getRoundedBarMaxValue.js +1 -5
  18. package/dist/cjs/charts/index.js +3 -19
  19. package/dist/cjs/charts/lineChart/context/buildLineContextValue.js +17 -21
  20. package/dist/cjs/charts/lineChart/context/index.js +2 -7
  21. package/dist/cjs/charts/lineChart/context/lineChartContext.js +2 -5
  22. package/dist/cjs/charts/lineChart/fragments/fixture/contextData.js +1 -4
  23. package/dist/cjs/charts/lineChart/fragments/fixture/index.js +1 -5
  24. package/dist/cjs/charts/lineChart/fragments/index.js +4 -11
  25. package/dist/cjs/charts/lineChart/fragments/lineChartPath.js +31 -35
  26. package/dist/cjs/charts/lineChart/fragments/lineChartProjection.js +6 -10
  27. package/dist/cjs/charts/lineChart/fragments/lineChartSeparator.js +10 -14
  28. package/dist/cjs/charts/lineChart/fragments/lineChartXAxis.js +14 -18
  29. package/dist/cjs/charts/lineChart/fragments/lineChartYAxis.js +17 -21
  30. package/dist/cjs/charts/lineChart/hook/index.js +3 -9
  31. package/dist/cjs/charts/lineChart/hook/useAutoClick.js +6 -10
  32. package/dist/cjs/charts/lineChart/hook/useHover.js +5 -9
  33. package/dist/cjs/charts/lineChart/hook/useIndicator.js +5 -9
  34. package/dist/cjs/charts/lineChart/index.js +1 -17
  35. package/dist/cjs/charts/lineChart/lineChart.js +12 -29
  36. package/dist/cjs/charts/lineChart/lineChart.type.js +1 -2
  37. package/dist/cjs/charts/lineChart/lineChartStructure.js +34 -38
  38. package/dist/cjs/charts/lineChart/utils/accessibilityTemplateProcessor.js +6 -10
  39. package/dist/cjs/charts/lineChart/utils/findSurroundingNumber.js +2 -7
  40. package/dist/cjs/charts/lineChart/utils/getDataValues.js +1 -5
  41. package/dist/cjs/charts/lineChart/utils/getExtraSpacing.js +26 -30
  42. package/dist/cjs/charts/lineChart/utils/getPathData.js +1 -5
  43. package/dist/cjs/charts/lineChart/utils/getProjection.js +1 -5
  44. package/dist/cjs/charts/lineChart/utils/getRoundedMaxValue.js +2 -7
  45. package/dist/cjs/charts/lineChart/utils/handleNodesFocus.js +1 -5
  46. package/dist/cjs/charts/lineChart/utils/index.js +6 -17
  47. package/dist/cjs/charts/pieChart/context/buildPieContextValue.js +8 -12
  48. package/dist/cjs/charts/pieChart/context/index.js +2 -7
  49. package/dist/cjs/charts/pieChart/context/pieChartContext.js +2 -5
  50. package/dist/cjs/charts/pieChart/fragments/index.js +2 -7
  51. package/dist/cjs/charts/pieChart/fragments/pieChartForeign.js +7 -11
  52. package/dist/cjs/charts/pieChart/fragments/pieChartPath.js +12 -16
  53. package/dist/cjs/charts/pieChart/fragments/pieChartSegment.js +6 -10
  54. package/dist/cjs/charts/pieChart/index.js +1 -17
  55. package/dist/cjs/charts/pieChart/pieChart.js +8 -25
  56. package/dist/cjs/charts/pieChart/pieChart.type.js +1 -2
  57. package/dist/cjs/charts/pieChart/pieChartStructure.js +16 -20
  58. package/dist/cjs/charts/pieChart/utils/buildL.js +1 -5
  59. package/dist/cjs/charts/pieChart/utils/calculatePoint.js +1 -5
  60. package/dist/cjs/charts/pieChart/utils/calculateSegmentPath.js +10 -14
  61. package/dist/cjs/charts/pieChart/utils/drawSegmentPath.js +6 -10
  62. package/dist/cjs/charts/pieChart/utils/index.js +2 -7
  63. package/dist/cjs/charts/pieChart/utils/rotationDirection.js +3 -7
  64. package/dist/cjs/components/axisChart/index.js +2 -18
  65. package/dist/cjs/components/axisChart/utils/filterLineProps/filterLineProps.js +1 -5
  66. package/dist/cjs/components/axisChart/utils/index.js +1 -17
  67. package/dist/cjs/components/axisChart/xAxis/index.js +2 -18
  68. package/dist/cjs/components/axisChart/xAxis/xAxis.js +14 -18
  69. package/dist/cjs/components/axisChart/xAxis/xAxis.types.js +1 -2
  70. package/dist/cjs/components/axisChart/yAxis/index.js +2 -18
  71. package/dist/cjs/components/axisChart/yAxis/yAxis.js +13 -17
  72. package/dist/cjs/components/axisChart/yAxis/yAxis.types.js +1 -2
  73. package/dist/cjs/components/bar/bar.js +9 -13
  74. package/dist/cjs/components/bar/bar.type.js +1 -4
  75. package/dist/cjs/components/bar/fragments/barChartSegment.js +3 -7
  76. package/dist/cjs/components/bar/index.js +2 -18
  77. package/dist/cjs/components/bar/utils/buildD.js +5 -9
  78. package/dist/cjs/components/bar/utils/getSegments.js +3 -7
  79. package/dist/cjs/components/chartText/chartText.js +3 -7
  80. package/dist/cjs/components/chartText/chartText.types.js +1 -2
  81. package/dist/cjs/components/chartText/index.js +2 -18
  82. package/dist/cjs/components/foreignObject/foreignObject.js +3 -7
  83. package/dist/cjs/components/foreignObject/foreignObject.types.js +1 -2
  84. package/dist/cjs/components/foreignObject/index.js +2 -18
  85. package/dist/cjs/components/index.js +10 -26
  86. package/dist/cjs/components/line/index.js +2 -18
  87. package/dist/cjs/components/line/line.js +3 -7
  88. package/dist/cjs/components/line/line.types.js +1 -2
  89. package/dist/cjs/components/node/components/circle/circle.js +4 -7
  90. package/dist/cjs/components/node/components/hexagon/hexagon.js +6 -9
  91. package/dist/cjs/components/node/components/pentagon/pentagon.js +6 -9
  92. package/dist/cjs/components/node/components/square/square.js +4 -7
  93. package/dist/cjs/components/node/components/star/star.js +6 -9
  94. package/dist/cjs/components/node/components/straight/straight.js +4 -7
  95. package/dist/cjs/components/node/components/triangle/triangle.js +4 -7
  96. package/dist/cjs/components/node/index.js +2 -18
  97. package/dist/cjs/components/node/node.js +22 -25
  98. package/dist/cjs/components/node/node.types.js +1 -4
  99. package/dist/cjs/components/node/utils/calculateShapePoints/calculateShapePoints.js +1 -5
  100. package/dist/cjs/components/path/components/nodePath/nodePath.js +9 -12
  101. package/dist/cjs/components/path/index.js +2 -18
  102. package/dist/cjs/components/path/path.js +20 -23
  103. package/dist/cjs/components/path/path.types.js +1 -2
  104. package/dist/cjs/components/plot/components/circle/circle.js +4 -7
  105. package/dist/cjs/components/plot/components/index.js +3 -19
  106. package/dist/cjs/components/plot/components/square/square.js +4 -7
  107. package/dist/cjs/components/plot/components/triangle/triangle.js +4 -7
  108. package/dist/cjs/components/plot/index.js +2 -18
  109. package/dist/cjs/components/plot/plot.js +21 -24
  110. package/dist/cjs/components/plot/plot.types.js +8 -11
  111. package/dist/cjs/components/svgContainer/index.js +1 -17
  112. package/dist/cjs/components/svgContainer/svgContainer.js +5 -8
  113. package/dist/cjs/components/svgContainer/svgContainer.types.js +1 -2
  114. package/dist/cjs/components/svgContainer/utils/buildViewBox/buildViewBox.js +1 -5
  115. package/dist/cjs/components/svgContainer/utils/index.js +1 -17
  116. package/dist/cjs/components/tick/index.js +2 -18
  117. package/dist/cjs/components/tick/tick.js +4 -8
  118. package/dist/cjs/components/tick/tick.types.js +1 -4
  119. package/dist/cjs/components/zoomArea/components/HandlerIcon.js +3 -7
  120. package/dist/cjs/components/zoomArea/components/LineRenderer.js +3 -7
  121. package/dist/cjs/components/zoomArea/components/SelectionArea.js +9 -14
  122. package/dist/cjs/components/zoomArea/components/ZoomHandler.js +6 -10
  123. package/dist/cjs/components/zoomArea/components/index.js +4 -12
  124. package/dist/cjs/components/zoomArea/hooks/index.js +5 -13
  125. package/dist/cjs/components/zoomArea/hooks/useDragInteraction.js +19 -23
  126. package/dist/cjs/components/zoomArea/hooks/useKeyboardNavigation.js +18 -22
  127. package/dist/cjs/components/zoomArea/hooks/useResponsiveCanvas.js +12 -16
  128. package/dist/cjs/components/zoomArea/hooks/useZoomAreaFocus.js +6 -10
  129. package/dist/cjs/components/zoomArea/hooks/useZoomData.js +8 -12
  130. package/dist/cjs/components/zoomArea/index.js +5 -21
  131. package/dist/cjs/components/zoomArea/utils/accessibilityLabels.js +6 -11
  132. package/dist/cjs/components/zoomArea/utils/index.js +3 -14
  133. package/dist/cjs/components/zoomArea/utils/indexRounding.js +5 -11
  134. package/dist/cjs/components/zoomArea/utils/interactionConfig.js +1 -5
  135. package/dist/cjs/components/zoomArea/utils/pathGeneration.js +4 -9
  136. package/dist/cjs/components/zoomArea/utils/rangeAndPositions.js +5 -13
  137. package/dist/cjs/components/zoomArea/utils/selectionConfig.js +1 -5
  138. package/dist/cjs/components/zoomArea/zoomArea.js +35 -39
  139. package/dist/cjs/components/zoomArea/zoomArea.type.js +1 -4
  140. package/dist/cjs/hooks/index.js +2 -18
  141. package/dist/cjs/hooks/useFocus/useFocus.js +5 -9
  142. package/dist/cjs/hooks/useFocus/useFocus.types.js +1 -2
  143. package/dist/cjs/hooks/useHover/useHover.js +5 -9
  144. package/dist/cjs/hooks/useHover/useHover.types.js +1 -2
  145. package/dist/cjs/index.js +3 -19
  146. package/dist/cjs/types/canvas.type.js +1 -4
  147. package/dist/cjs/types/errors.type.js +1 -4
  148. package/dist/cjs/types/focusConfig.type.js +1 -4
  149. package/dist/cjs/types/index.js +4 -20
  150. package/dist/cjs/types/position.enum.js +1 -4
  151. package/dist/cjs/types/unit.enum.js +1 -4
  152. package/dist/cjs/types/valueFormatter.type.js +1 -2
  153. package/dist/cjs/utils/ajustedTextSpace/ajustedTextSpace.js +1 -5
  154. package/dist/cjs/utils/buildErrors/buildErrors.js +3 -7
  155. package/dist/cjs/utils/buildTickValues/buildTickValues.js +2 -7
  156. package/dist/cjs/utils/calculateFocusOutline/calculateFocusOutline.js +8 -13
  157. package/dist/cjs/utils/classNames/classNames.js +1 -5
  158. package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.js +4 -8
  159. package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.types.js +1 -2
  160. package/dist/cjs/utils/cursorNear/isNear.js +1 -5
  161. package/dist/cjs/utils/getAxisData/getAxisData.js +1 -5
  162. package/dist/cjs/utils/getCanvasDimensions/getCanvasDimensions.js +8 -12
  163. package/dist/cjs/utils/getChildrenAttr/getChildrenAttr.js +4 -8
  164. package/dist/cjs/utils/getCoordinates/getCoordinates.js +9 -14
  165. package/dist/cjs/utils/getDataFingerprint/getDataFingerprint.js +1 -5
  166. package/dist/cjs/utils/getPoints/getPoints.js +1 -5
  167. package/dist/cjs/utils/getTickTextCoordinate/getTickTextCoordinates.js +5 -10
  168. package/dist/cjs/utils/getTicks/getTicks.js +2 -7
  169. package/dist/cjs/utils/index.js +8 -24
  170. package/dist/cjs/utils/parseStringToNumberPx.ts/parseStringToNumberPx.js +3 -7
  171. package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.js +1 -5
  172. package/dist/cjs/utils/shadowSvg/shadowSvg.js +3 -7
  173. package/dist/cjs/utils/shadowSvg/shadowSvg.types.js +1 -2
  174. package/dist/cjs/utils/textBound/textBound.js +1 -5
  175. package/dist/kubit-ui-web-react-charts.cjs.js +1 -10
  176. package/dist/kubit-ui-web-react-charts.es.js +1 -10
  177. package/dist/kubit-ui-web-react-charts.umd.js +1 -10
  178. package/package.json +31 -33
@@ -1,17 +1 @@
1
- "use strict";
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("./lineChart"), exports);
1
+ export * from './lineChart';
@@ -1,30 +1,13 @@
1
- "use strict";
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
- exports.LineChart = void 0;
18
- const lineChartPath_1 = require("./fragments/lineChartPath");
19
- const lineChartSeparator_1 = require("./fragments/lineChartSeparator");
20
- const lineChartXAxis_1 = require("./fragments/lineChartXAxis");
21
- const lineChartYAxis_1 = require("./fragments/lineChartYAxis");
22
- const lineChartStructure_1 = require("./lineChartStructure");
23
- const LineChart = Object.assign(lineChartStructure_1.LineChartStructure, {
24
- Path: lineChartPath_1.LineChartPath,
25
- Separator: lineChartSeparator_1.LineChartSeparator,
26
- XAxis: lineChartXAxis_1.LineChartXAxis,
27
- YAxis: lineChartYAxis_1.LineChartYAxis,
1
+ import { LineChartPath } from './fragments/lineChartPath';
2
+ import { LineChartSeparator } from './fragments/lineChartSeparator';
3
+ import { LineChartXAxis } from './fragments/lineChartXAxis';
4
+ import { LineChartYAxis } from './fragments/lineChartYAxis';
5
+ import { LineChartStructure } from './lineChartStructure';
6
+ const LineChart = Object.assign(LineChartStructure, {
7
+ Path: LineChartPath,
8
+ Separator: LineChartSeparator,
9
+ XAxis: LineChartXAxis,
10
+ YAxis: LineChartYAxis,
28
11
  });
29
- exports.LineChart = LineChart;
30
- __exportStar(require("./lineChart.type"), exports);
12
+ export { LineChart };
13
+ export * from './lineChart.type';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartStructure = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const svgContainer_1 = require("../../components/svgContainer/svgContainer");
7
- const buildViewBox_1 = require("../../components/svgContainer/utils/buildViewBox/buildViewBox");
8
- const canvas_type_1 = require("../../types/canvas.type");
9
- const errors_type_1 = require("../../types/errors.type");
10
- const getCanvasDimensions_1 = require("../../utils/getCanvasDimensions/getCanvasDimensions");
11
- const getChildrenAttr_1 = require("../../utils/getChildrenAttr/getChildrenAttr");
12
- const getDataFingerprint_1 = require("../../utils/getDataFingerprint/getDataFingerprint");
13
- const parseStringToNumberPx_1 = require("../../utils/parseStringToNumberPx.ts/parseStringToNumberPx");
14
- const buildLineContextValue_1 = require("./context/buildLineContextValue");
15
- const lineChartContext_1 = require("./context/lineChartContext");
16
- const lineChartXAxis_1 = require("./fragments/lineChartXAxis");
17
- const lineChartYAxis_1 = require("./fragments/lineChartYAxis");
18
- const useHover_1 = require("./hook/useHover");
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Children, useEffect, useMemo, useState } from 'react';
3
+ import { SvgContainer } from '../../components/svgContainer/svgContainer';
4
+ import { buildViewBox } from '../../components/svgContainer/utils/buildViewBox/buildViewBox';
5
+ import { DefaultCanvasConfig } from '../../types/canvas.type';
6
+ import { ErrorType } from '../../types/errors.type';
7
+ import { getCanvasDimensions } from '../../utils/getCanvasDimensions/getCanvasDimensions';
8
+ import { getChildrenAttr } from '../../utils/getChildrenAttr/getChildrenAttr';
9
+ import { getDataFingerprint } from '../../utils/getDataFingerprint/getDataFingerprint';
10
+ import { parseStringToNumberPx } from '../../utils/parseStringToNumberPx.ts/parseStringToNumberPx';
11
+ import { buildLineContextValue } from './context/buildLineContextValue';
12
+ import { LineChartContext } from './context/lineChartContext';
13
+ import { LineChartXAxis } from './fragments/lineChartXAxis';
14
+ import { LineChartYAxis } from './fragments/lineChartYAxis';
15
+ import { useHover } from './hook/useHover';
19
16
  /**
20
17
  * Renders a line chart component.
21
18
  *
@@ -45,39 +42,39 @@ const useHover_1 = require("./hook/useHover");
45
42
  *
46
43
  * @returns The rendered LineChart component.
47
44
  */
48
- const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_1.DefaultCanvasConfig, caption, children, classNames, data, dataTestId = 'line-chart', getPathArea, height = '100%', onErrors, role, tabIndex, width = '100%', xKey, ...props }) => {
45
+ export const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = DefaultCanvasConfig, caption, children, classNames, data, dataTestId = 'line-chart', getPathArea, height = '100%', onErrors, role, tabIndex, width = '100%', xKey, ...props }) => {
49
46
  const { extraSpace: canvasExtraSpace, height: canvasHeight, width: canvasWidth } = canvasConfig;
50
- const [childrenYKeys, setChildrenYKey] = (0, react_1.useState)('');
51
- const [parsedCanvas, setParsedCanvas] = (0, react_1.useState)({
47
+ const [childrenYKeys, setChildrenYKey] = useState('');
48
+ const [parsedCanvas, setParsedCanvas] = useState({
52
49
  height: 0,
53
50
  width: 0,
54
51
  });
55
52
  const parsedCanvasExtraSpace = canvasExtraSpace
56
- ? (0, parseStringToNumberPx_1.parseStringToNumberPx)(canvasExtraSpace)
53
+ ? parseStringToNumberPx(canvasExtraSpace)
57
54
  : undefined;
58
- const viewBox = (0, buildViewBox_1.buildViewBox)(parsedCanvas.width, parsedCanvas.height, parsedCanvasExtraSpace);
55
+ const viewBox = buildViewBox(parsedCanvas.width, parsedCanvas.height, parsedCanvasExtraSpace);
59
56
  // Set the default axis for the chart
60
57
  const defaultAxis = [
61
- (0, jsx_runtime_1.jsx)(lineChartXAxis_1.LineChartXAxis, {}, "default-x-axis"),
62
- (0, jsx_runtime_1.jsx)(lineChartYAxis_1.LineChartYAxis, {}, "default-y-axis"),
58
+ _jsx(LineChartXAxis, {}, "default-x-axis"),
59
+ _jsx(LineChartYAxis, {}, "default-y-axis"),
63
60
  ];
64
- const arrayChildren = (react_1.Children.toArray(children) || []);
61
+ const arrayChildren = (Children.toArray(children) || []);
65
62
  const chidrenWithDefaultAxis = defaultAxis.concat(arrayChildren);
66
63
  const maxValue = Math.max(parsedCanvas.width, parsedCanvas.height, parsedCanvasExtraSpace ?? 0);
67
64
  const ajustedX = isNaN(parsedCanvas.width / maxValue) ? 0 : parsedCanvas.width / maxValue;
68
65
  const ajustedY = isNaN(parsedCanvas.height / maxValue) ? 0 : parsedCanvas.height / maxValue;
69
66
  // watch the Y childs keys
70
- (0, getChildrenAttr_1.getChildrenAttr)({
67
+ getChildrenAttr({
71
68
  attrName: 'dataKey',
72
69
  children: chidrenWithDefaultAxis,
73
70
  originalValue: childrenYKeys,
74
71
  updateValue: setChildrenYKey,
75
72
  });
76
73
  // Create a fingerprint of the data to avoid unnecessary contextValue updates
77
- const dataFingerprint = (0, getDataFingerprint_1.getDataFingerprint)(data);
74
+ const dataFingerprint = getDataFingerprint(data);
78
75
  // Build the context value
79
- const contextValue = (0, react_1.useMemo)(() => {
80
- return (0, buildLineContextValue_1.buildLineContextValue)({
76
+ const contextValue = useMemo(() => {
77
+ return buildLineContextValue({
81
78
  ajustedX,
82
79
  ajustedY,
83
80
  canvasHeight: parsedCanvas.height,
@@ -88,23 +85,23 @@ const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_
88
85
  xKey,
89
86
  });
90
87
  }, [parsedCanvas.width, parsedCanvas.height, dataFingerprint, xKey, childrenYKeys]);
91
- (0, react_1.useEffect)(() => {
88
+ useEffect(() => {
92
89
  if (contextValue.error && onErrors) {
93
90
  onErrors({
94
- [errors_type_1.ErrorType.GENERIC]: contextValue.error,
91
+ [ErrorType.GENERIC]: contextValue.error,
95
92
  });
96
93
  }
97
94
  }, [contextValue.error, onErrors]);
98
- const { svgRef, xCursor, yCursor } = (0, useHover_1.useHover)({
95
+ const { svgRef, xCursor, yCursor } = useHover({
99
96
  canvasHeight: parsedCanvas.height,
100
97
  canvasWidth: parsedCanvas.width,
101
98
  });
102
- (0, react_1.useEffect)(() => {
99
+ useEffect(() => {
103
100
  const svgElement = document.querySelector('[data-kbt-svg]');
104
101
  if (!svgElement) {
105
102
  return;
106
103
  }
107
- const { parsedCanvasHeight, parsedCanvasWidth } = (0, getCanvasDimensions_1.getCanvasDimensions)({
104
+ const { parsedCanvasHeight, parsedCanvasWidth } = getCanvasDimensions({
108
105
  canvasHeight,
109
106
  canvasWidth,
110
107
  svgElement,
@@ -114,7 +111,7 @@ const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_
114
111
  width: parsedCanvasWidth,
115
112
  });
116
113
  }, [canvasWidth, canvasHeight]);
117
- (0, react_1.useEffect)(() => {
114
+ useEffect(() => {
118
115
  getPathArea?.({
119
116
  x1: contextValue.extraSpaceLeftX,
120
117
  x2: parsedCanvas.width - contextValue.extraSpaceRightX,
@@ -122,7 +119,7 @@ const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_
122
119
  y2: parsedCanvas.height - contextValue.extraSpaceBottomY,
123
120
  });
124
121
  }, [parsedCanvas.width, parsedCanvas.height]);
125
- return ((0, jsx_runtime_1.jsx)(svgContainer_1.SvgContainer, { ref: svgRef, ariaHidden: ariaHidden, ariaLabel: ariaLabel, caption: caption, className: classNames, "data-kbt-svg": true, dataTestId: dataTestId, height: height, role: role, tabIndex: tabIndex, viewBox: viewBox, width: width, ...props, children: (0, jsx_runtime_1.jsx)(lineChartContext_1.LineChartContext.Provider, { value: {
122
+ return (_jsx(SvgContainer, { ref: svgRef, ariaHidden: ariaHidden, ariaLabel: ariaLabel, caption: caption, className: classNames, "data-kbt-svg": true, dataTestId: dataTestId, height: height, role: role, tabIndex: tabIndex, viewBox: viewBox, width: width, ...props, children: _jsx(LineChartContext.Provider, { value: {
126
123
  ...contextValue,
127
124
  canvasExtraSpace: parsedCanvasExtraSpace,
128
125
  canvasHeight: parsedCanvas.height,
@@ -134,4 +131,3 @@ const LineChartStructure = ({ ariaHidden, ariaLabel, canvasConfig = canvas_type_
134
131
  yCursor,
135
132
  }, children: children }) }));
136
133
  };
137
- exports.LineChartStructure = LineChartStructure;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processAccessibilityTemplate = exports.TEMPLATE_KEYS = void 0;
4
1
  // Template keys for accessibility labels
5
- exports.TEMPLATE_KEYS = {
2
+ export const TEMPLATE_KEYS = {
6
3
  DATA_KEY: '{{dataKey}}',
7
4
  INDEX: '{{index}}',
8
5
  X_VALUE: '{{xValue}}',
@@ -34,17 +31,17 @@ const extractValuesFromDataPoint = (dataPoint, nodeData) => {
34
31
  const replaceTemplatePlaceholders = (template, nodeData, xValue, yValue) => {
35
32
  let result = template;
36
33
  if (nodeData.dataKey !== undefined) {
37
- result = result.replace(new RegExp(exports.TEMPLATE_KEYS.DATA_KEY, 'g'), nodeData.dataKey);
34
+ result = result.replace(new RegExp(TEMPLATE_KEYS.DATA_KEY, 'g'), nodeData.dataKey);
38
35
  }
39
36
  // Always replace xValue and yValue placeholders, even with empty strings
40
- result = result.replace(new RegExp(exports.TEMPLATE_KEYS.X_VALUE, 'g'), xValue);
41
- result = result.replace(new RegExp(exports.TEMPLATE_KEYS.Y_VALUE, 'g'), yValue);
37
+ result = result.replace(new RegExp(TEMPLATE_KEYS.X_VALUE, 'g'), xValue);
38
+ result = result.replace(new RegExp(TEMPLATE_KEYS.Y_VALUE, 'g'), yValue);
42
39
  if (nodeData.index !== undefined) {
43
- result = result.replace(new RegExp(exports.TEMPLATE_KEYS.INDEX, 'g'), (nodeData.index + 1).toString());
40
+ result = result.replace(new RegExp(TEMPLATE_KEYS.INDEX, 'g'), (nodeData.index + 1).toString());
44
41
  }
45
42
  return result;
46
43
  };
47
- const processAccessibilityTemplate = (template, nodeData, dataValue) => {
44
+ export const processAccessibilityTemplate = (template, nodeData, dataValue) => {
48
45
  if (!template) {
49
46
  return undefined;
50
47
  }
@@ -57,4 +54,3 @@ const processAccessibilityTemplate = (template, nodeData, dataValue) => {
57
54
  // Replace template placeholders
58
55
  return replaceTemplatePlaceholders(template, nodeData, xValue, yValue);
59
56
  };
60
- exports.processAccessibilityTemplate = processAccessibilityTemplate;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findClosestNumber = exports.findSurroundingNumber = void 0;
4
- const findSurroundingNumber = (points, xPosition) => {
1
+ export const findSurroundingNumber = (points, xPosition) => {
5
2
  let idx = 0;
6
3
  let match = false;
7
4
  // TODO: performance the init and last point
@@ -14,8 +11,7 @@ const findSurroundingNumber = (points, xPosition) => {
14
11
  }
15
12
  return { idx, match };
16
13
  };
17
- exports.findSurroundingNumber = findSurroundingNumber;
18
- const findClosestNumber = (points, xPosition) => {
14
+ export const findClosestNumber = (points, xPosition) => {
19
15
  let closest = 0;
20
16
  let minDiff = Math.abs(points[0] - xPosition);
21
17
  for (let i = 1; i < points.length; i++) {
@@ -27,4 +23,3 @@ const findClosestNumber = (points, xPosition) => {
27
23
  }
28
24
  return closest;
29
25
  };
30
- exports.findClosestNumber = findClosestNumber;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDataValues = void 0;
4
1
  /**
5
2
  * Retrieves the data values from the given TickValuesAxisProps object.
6
3
  * @param data - The TickValuesAxisProps object containing the data values.
7
4
  * @returns An array of string values representing the data, or undefined if the data is invalid.
8
5
  */
9
- const getDataValues = (data) => {
6
+ export const getDataValues = (data) => {
10
7
  if (data.custom) {
11
8
  return data.custom?.values;
12
9
  }
@@ -25,4 +22,3 @@ const getDataValues = (data) => {
25
22
  }
26
23
  return undefined;
27
24
  };
28
- exports.getDataValues = getDataValues;
@@ -1,22 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getExtraSpacing = void 0;
4
- const react_1 = require("react");
5
- const position_enum_1 = require("../../../types/position.enum");
6
- const buildTickValues_1 = require("../../../utils/buildTickValues/buildTickValues");
7
- const textBound_1 = require("../../../utils/textBound/textBound");
8
- const lineChartXAxis_1 = require("../fragments/lineChartXAxis");
9
- const lineChartYAxis_1 = require("../fragments/lineChartYAxis");
10
- const getDataValues_1 = require("./getDataValues");
11
- const getRoundedMaxValue_1 = require("./getRoundedMaxValue");
1
+ import { Children, isValidElement } from 'react';
2
+ import { Positions } from '../../../types/position.enum';
3
+ import { buildTickValues } from '../../../utils/buildTickValues/buildTickValues';
4
+ import { textBound } from '../../../utils/textBound/textBound';
5
+ import { LineChartXAxis } from '../fragments/lineChartXAxis';
6
+ import { LineChartYAxis } from '../fragments/lineChartYAxis';
7
+ import { getDataValues } from './getDataValues';
8
+ import { getYKeyRoundMaxValue } from './getRoundedMaxValue';
12
9
  const handleLineChartXAxis = (child, data, xKey, ajustedX, viewBox, canvasHeight, canvasWidth) => {
13
10
  const { position, tickText, tickValues, valueFormatter } = child.props;
14
11
  const fontSize = tickText?.fontSize ?? 0;
15
12
  const spaceFontSize = fontSize * ajustedX;
16
- const xData = tickValues ? (0, getDataValues_1.getDataValues)(tickValues) : data.map(d => d[xKey]);
13
+ const xData = tickValues ? getDataValues(tickValues) : data.map(d => d[xKey]);
17
14
  // Apply the valueFormatter if provided to get the actual rendered text width
18
15
  const formattedXData = valueFormatter ? xData.map(valueFormatter) : xData;
19
- const securityXSpace = (0, textBound_1.textBound)({
16
+ const securityXSpace = textBound({
20
17
  bound: 'width',
21
18
  data: formattedXData,
22
19
  fontSize,
@@ -24,11 +21,11 @@ const handleLineChartXAxis = (child, data, xKey, ajustedX, viewBox, canvasHeight
24
21
  svgWidth: `${canvasWidth}`,
25
22
  viewBox,
26
23
  });
27
- const isBottomPosition = position === position_enum_1.Positions.BOTTOM;
28
- const isTopPosition = position === position_enum_1.Positions.TOP;
24
+ const isBottomPosition = position === Positions.BOTTOM;
25
+ const isTopPosition = position === Positions.TOP;
29
26
  const extraSpaceBottomY = isBottomPosition ? spaceFontSize + (tickText?.top ?? 0) : 0;
30
27
  const extraSpaceTopY = isTopPosition ? spaceFontSize + (tickText?.bottom ?? 0) : 0;
31
- const lineChartXPosition = (() => position || position_enum_1.Positions.BOTTOM)();
28
+ const lineChartXPosition = (() => position || Positions.BOTTOM)();
32
29
  const getBreakAxis = () => {
33
30
  if (tickValues?.numeric) {
34
31
  return tickValues.numeric.breakAxis ?? 0;
@@ -50,11 +47,11 @@ const handleLineChartYAxis = (child, data, xKey, ajustedY, viewBox, canvasHeight
50
47
  const fontSize = tickText?.fontSize ?? '0';
51
48
  const spaceFontSize = fontSize * ajustedY;
52
49
  const dataValues = tickValues ||
53
- (0, buildTickValues_1.buildTickValues)([...new Set((0, getRoundedMaxValue_1.getYKeyRoundMaxValue)(data, xKey))]);
54
- const yData = (0, getDataValues_1.getDataValues)(dataValues);
50
+ buildTickValues([...new Set(getYKeyRoundMaxValue(data, xKey))]);
51
+ const yData = getDataValues(dataValues);
55
52
  // Apply the valueFormatter if provided to get the actual rendered text width
56
53
  const formattedYData = valueFormatter ? yData.map(valueFormatter) : yData;
57
- const yAxisText = (0, textBound_1.textBound)({
54
+ const yAxisText = textBound({
58
55
  bound: 'width',
59
56
  data: formattedYData,
60
57
  fontSize: fontSize,
@@ -63,11 +60,11 @@ const handleLineChartYAxis = (child, data, xKey, ajustedY, viewBox, canvasHeight
63
60
  viewBox,
64
61
  });
65
62
  const securityYSpace = spaceFontSize;
66
- const isLeftPosition = position === position_enum_1.Positions.LEFT;
67
- const isRightPosition = position === position_enum_1.Positions.RIGHT;
63
+ const isLeftPosition = position === Positions.LEFT;
64
+ const isRightPosition = position === Positions.RIGHT;
68
65
  const extraSpaceLeftX = isLeftPosition ? yAxisText + (tickText?.right ?? 0) : 0;
69
66
  const extraSpaceRightX = isRightPosition ? yAxisText + (tickText?.left ?? 0) : 0;
70
- const lineChartYPosition = position || position_enum_1.Positions.LEFT;
67
+ const lineChartYPosition = position || Positions.LEFT;
71
68
  const getBreakAxis = () => {
72
69
  if (tickValues?.numeric) {
73
70
  return tickValues.numeric.breakAxis ?? 0;
@@ -90,14 +87,14 @@ const handleLineChartYAxis = (child, data, xKey, ajustedY, viewBox, canvasHeight
90
87
  * @param {GetExtraSpacing} options - The options for calculating extra spacing.
91
88
  * @returns {LineChartExtraSpacings} - The calculated extra spacings for the line chart.
92
89
  */
93
- const getExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, viewBox, xKey, }) => {
90
+ export const getExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, viewBox, xKey, }) => {
94
91
  let result = {
95
92
  extraSpaceBottomY: 0,
96
93
  extraSpaceLeftX: 0,
97
94
  extraSpaceRightX: 0,
98
95
  extraSpaceTopY: 0,
99
- lineChartXPosition: position_enum_1.Positions.BOTTOM,
100
- lineChartYPosition: position_enum_1.Positions.LEFT,
96
+ lineChartXPosition: Positions.BOTTOM,
97
+ lineChartYPosition: Positions.LEFT,
101
98
  securityXSpace: 0,
102
99
  securityYSpace: 0,
103
100
  xAxisText: 0,
@@ -107,15 +104,15 @@ const getExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, childr
107
104
  yBreakAxis: 0,
108
105
  yData: [],
109
106
  };
110
- react_1.Children.forEach(children, (child) => {
111
- if ((0, react_1.isValidElement)(child)) {
112
- if (child.type === lineChartXAxis_1.LineChartXAxis) {
107
+ Children.forEach(children, (child) => {
108
+ if (isValidElement(child)) {
109
+ if (child.type === LineChartXAxis) {
113
110
  result = {
114
111
  ...result,
115
112
  ...handleLineChartXAxis(child, data, xKey, ajustedX, viewBox, canvasHeight, canvasWidth),
116
113
  };
117
114
  }
118
- else if (child.type === lineChartYAxis_1.LineChartYAxis) {
115
+ else if (child.type === LineChartYAxis) {
119
116
  result = {
120
117
  ...result,
121
118
  ...handleLineChartYAxis(child, data, xKey, ajustedY, viewBox, canvasHeight, canvasWidth),
@@ -125,4 +122,3 @@ const getExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, childr
125
122
  });
126
123
  return result;
127
124
  };
128
- exports.getExtraSpacing = getExtraSpacing;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPathData = void 0;
4
1
  /**
5
2
  * Generates SVG path data from an array of points.
6
3
  * @param points - An array of points, where each point is an array of two numbers representing the x and y coordinates.
@@ -10,7 +7,7 @@ exports.getPathData = void 0;
10
7
  * @param extendToBottom - A boolean indicating whether the path should extend to the bottom of the SVG container. Defaults to false.
11
8
  * @returns The SVG path data as a string.
12
9
  */
13
- const getPathData = ({ curved = false, extendToBottom = false, points, svgHeight, }) => {
10
+ export const getPathData = ({ curved = false, extendToBottom = false, points, svgHeight, }) => {
14
11
  if (points.length === 0) {
15
12
  return '';
16
13
  }
@@ -34,4 +31,3 @@ const getPathData = ({ curved = false, extendToBottom = false, points, svgHeight
34
31
  }
35
32
  return pathData;
36
33
  };
37
- exports.getPathData = getPathData;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProjection = void 0;
4
1
  const addXProjection = (point, projection) => {
5
2
  if (!projection) {
6
3
  return point;
@@ -31,7 +28,7 @@ const addYProjection = (point, svgHeight, projection) => {
31
28
  * @param {ProjectionType} [params.lowerProjection] - The lower projection data.
32
29
  * @returns {GetProjectionReturnType} The generated SVG path data.
33
30
  */
34
- const getProjection = ({ curved, lowerProjection, points, svgHeight, upperProjection, }) => {
31
+ export const getProjection = ({ curved, lowerProjection, points, svgHeight, upperProjection, }) => {
35
32
  const hasProjections = upperProjection || lowerProjection;
36
33
  if (points.length === 0 && !hasProjections) {
37
34
  return { shapePath: '' };
@@ -106,4 +103,3 @@ const getProjection = ({ curved, lowerProjection, points, svgHeight, upperProjec
106
103
  }
107
104
  return { downPath, shapePath, upPath };
108
105
  };
109
- exports.getProjection = getProjection;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getYKeyRoundMaxValue = exports.getRoundedMaxValue = void 0;
4
1
  /**
5
2
  * Extracts the maximum value from the data points that do not correspond to the provided key.
6
3
  * The maximum value is rounded up to the nearest multiple of 10.
@@ -8,23 +5,21 @@ exports.getYKeyRoundMaxValue = exports.getRoundedMaxValue = void 0;
8
5
  * @param key - The key to exclude in the data.
9
6
  * @returns The rounded maximum value.
10
7
  */
11
- const getRoundedMaxValue = (data, key) => {
8
+ export const getRoundedMaxValue = (data, key) => {
12
9
  const values = data.flatMap(point => Object.keys(point)
13
10
  .filter(k => k !== key && typeof point[k] === 'number')
14
11
  .map(k => point[k]));
15
12
  const maxNumber = Math.max(...values);
16
13
  return Math.ceil(maxNumber / 10) * 10;
17
14
  };
18
- exports.getRoundedMaxValue = getRoundedMaxValue;
19
15
  /**
20
16
  * Returns an array of rounded maximum values for each yKey in the given data.
21
17
  * @param data - The array of data points.
22
18
  * @param xKey - The xKey used for filtering the data.
23
19
  * @returns An array of rounded maximum values.
24
20
  */
25
- const getYKeyRoundMaxValue = (data, xKey) => {
21
+ export const getYKeyRoundMaxValue = (data, xKey) => {
26
22
  return data.flatMap(point => Object.keys(point)
27
23
  .filter(k => k !== xKey && typeof point[k] === 'number')
28
24
  .map(k => point[k]));
29
25
  };
30
- exports.getYKeyRoundMaxValue = getYKeyRoundMaxValue;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleNodesFocus = void 0;
4
- const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
1
+ export const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
5
2
  let refFocused = false;
6
3
  let currentNode = undefined;
7
4
  const g = ref.querySelector('[data-draw]');
@@ -46,4 +43,3 @@ const handleNodesFocus = ({ data, getNodeFocusInfo, nodes, ref, }) => {
46
43
  };
47
44
  return { mount, unmount };
48
45
  };
49
- exports.handleNodesFocus = handleNodesFocus;
@@ -1,17 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getYKeyRoundMaxValue = exports.getRoundedMaxValue = exports.getProjection = exports.getPathData = exports.getExtraSpacing = exports.getDataValues = exports.findClosestNumber = exports.findSurroundingNumber = void 0;
4
- var findSurroundingNumber_1 = require("./findSurroundingNumber");
5
- Object.defineProperty(exports, "findSurroundingNumber", { enumerable: true, get: function () { return findSurroundingNumber_1.findSurroundingNumber; } });
6
- Object.defineProperty(exports, "findClosestNumber", { enumerable: true, get: function () { return findSurroundingNumber_1.findClosestNumber; } });
7
- var getDataValues_1 = require("./getDataValues");
8
- Object.defineProperty(exports, "getDataValues", { enumerable: true, get: function () { return getDataValues_1.getDataValues; } });
9
- var getExtraSpacing_1 = require("./getExtraSpacing");
10
- Object.defineProperty(exports, "getExtraSpacing", { enumerable: true, get: function () { return getExtraSpacing_1.getExtraSpacing; } });
11
- var getPathData_1 = require("./getPathData");
12
- Object.defineProperty(exports, "getPathData", { enumerable: true, get: function () { return getPathData_1.getPathData; } });
13
- var getProjection_1 = require("./getProjection");
14
- Object.defineProperty(exports, "getProjection", { enumerable: true, get: function () { return getProjection_1.getProjection; } });
15
- var getRoundedMaxValue_1 = require("./getRoundedMaxValue");
16
- Object.defineProperty(exports, "getRoundedMaxValue", { enumerable: true, get: function () { return getRoundedMaxValue_1.getRoundedMaxValue; } });
17
- Object.defineProperty(exports, "getYKeyRoundMaxValue", { enumerable: true, get: function () { return getRoundedMaxValue_1.getYKeyRoundMaxValue; } });
1
+ export { findSurroundingNumber, findClosestNumber } from './findSurroundingNumber';
2
+ export { getDataValues } from './getDataValues';
3
+ export { getExtraSpacing } from './getExtraSpacing';
4
+ export { getPathData } from './getPathData';
5
+ export { getProjection } from './getProjection';
6
+ export { getRoundedMaxValue, getYKeyRoundMaxValue } from './getRoundedMaxValue';
@@ -1,29 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildPieContextValue = void 0;
4
- const react_1 = require("react");
5
- const parseStringToNumberPx_1 = require("../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx");
6
- const pieChartPath_1 = require("../fragments/pieChartPath");
1
+ import { Children, isValidElement } from 'react';
2
+ import { parseStringToNumberPx } from '../../../utils/parseStringToNumberPx.ts/parseStringToNumberPx';
3
+ import { PieChartPath } from '../fragments/pieChartPath';
7
4
  /**
8
5
  * Builds the context value for the PieChart component.
9
6
  *
10
7
  * @param {BuildPieContextValueProps} props - The props for building the context value.
11
8
  * @returns {Omit<PieChartContextType, 'canvasHeight' | 'canvasWidth' | 'data'>} The context value.
12
9
  */
13
- const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart, }) => {
10
+ export const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart, }) => {
14
11
  // Use the min inner radious of the paths to calculate the size
15
12
  let minRadius = undefined;
16
13
  let foreignObjectSize = undefined;
17
- react_1.Children.forEach(children, (child) => {
18
- if (!(0, react_1.isValidElement)(child)) {
14
+ Children.forEach(children, (child) => {
15
+ if (!isValidElement(child)) {
19
16
  return;
20
17
  }
21
- if (child.type === pieChartPath_1.PieChartPath) {
18
+ if (child.type === PieChartPath) {
22
19
  const { innerRadius } = child.props;
23
20
  if (!innerRadius) {
24
21
  return;
25
22
  }
26
- const parsedInnerRadius = (0, parseStringToNumberPx_1.parseStringToNumberPx)(innerRadius);
23
+ const parsedInnerRadius = parseStringToNumberPx(innerRadius);
27
24
  if (!minRadius || parsedInnerRadius < minRadius) {
28
25
  minRadius = parsedInnerRadius;
29
26
  }
@@ -46,4 +43,3 @@ const buildPieContextValue = ({ canvasHeight, canvasWidth, children, halfChart,
46
43
  },
47
44
  };
48
45
  };
49
- exports.buildPieContextValue = buildPieContextValue;
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PieChartContext = exports.buildPieContextValue = void 0;
4
- var buildPieContextValue_1 = require("./buildPieContextValue");
5
- Object.defineProperty(exports, "buildPieContextValue", { enumerable: true, get: function () { return buildPieContextValue_1.buildPieContextValue; } });
6
- var pieChartContext_1 = require("./pieChartContext");
7
- Object.defineProperty(exports, "PieChartContext", { enumerable: true, get: function () { return pieChartContext_1.PieChartContext; } });
1
+ export { buildPieContextValue } from './buildPieContextValue';
2
+ export { PieChartContext } from './pieChartContext';
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PieChartContext = void 0;
4
- const react_1 = require("react");
5
- exports.PieChartContext = (0, react_1.createContext)({});
1
+ import { createContext } from 'react';
2
+ export const PieChartContext = createContext({});
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PieChartPath = exports.PieChartForeign = void 0;
4
- var pieChartForeign_1 = require("./pieChartForeign");
5
- Object.defineProperty(exports, "PieChartForeign", { enumerable: true, get: function () { return pieChartForeign_1.PieChartForeign; } });
6
- var pieChartPath_1 = require("./pieChartPath");
7
- Object.defineProperty(exports, "PieChartPath", { enumerable: true, get: function () { return pieChartPath_1.PieChartPath; } });
1
+ export { PieChartForeign } from './pieChartForeign';
2
+ export { PieChartPath } from './pieChartPath';
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PieChartForeign = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const foreignObject_1 = require("../../../components/foreignObject/foreignObject");
7
- const pieChartContext_1 = require("../context/pieChartContext");
8
- const PieChartForeign = ({ children, dataTestId: childDataTestId, height: childHeight, width: childWidth, x: childX, y: childY, ...props }) => {
9
- const { dataTestId: canvasDataTestId, foreignObject } = (0, react_1.useContext)(pieChartContext_1.PieChartContext);
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { ForeignObject } from '../../../components/foreignObject/foreignObject';
4
+ import { PieChartContext } from '../context/pieChartContext';
5
+ export const PieChartForeign = ({ children, dataTestId: childDataTestId, height: childHeight, width: childWidth, x: childX, y: childY, ...props }) => {
6
+ const { dataTestId: canvasDataTestId, foreignObject } = useContext(PieChartContext);
10
7
  const width = !childWidth && foreignObject?.width ? foreignObject.width : childWidth;
11
8
  const height = !childHeight && foreignObject?.height ? foreignObject.height : childHeight;
12
9
  const x = !childX && foreignObject?.x ? foreignObject.x : childX;
13
10
  const y = !childY && foreignObject?.y ? foreignObject.y : childY;
14
11
  const dataTestId = !childDataTestId && canvasDataTestId ? `${canvasDataTestId}-foreign-object` : childDataTestId;
15
- return ((0, jsx_runtime_1.jsx)(foreignObject_1.ForeignObject, { ...props, dataTestId: dataTestId, height: height, width: width, x: x, y: y, children: children }));
12
+ return (_jsx(ForeignObject, { ...props, dataTestId: dataTestId, height: height, width: width, x: x, y: y, children: children }));
16
13
  };
17
- exports.PieChartForeign = PieChartForeign;