@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.
Files changed (230) hide show
  1. package/README.md +31 -36
  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/dist/types/charts/barChart/barChart.d.ts +5 -5
  179. package/dist/types/charts/barChart/barChart.type.d.ts +1 -1
  180. package/dist/types/charts/barChart/context/barChartContext.d.ts +1 -1
  181. package/dist/types/charts/barChart/fragments/barChartSeparator.d.ts +1 -1
  182. package/dist/types/charts/barChart/fragments/barChartXAxis.d.ts +1 -1
  183. package/dist/types/charts/barChart/fragments/barChartYAxis.d.ts +1 -1
  184. package/dist/types/charts/lineChart/context/lineChartContext.d.ts +1 -1
  185. package/dist/types/charts/lineChart/fragments/lineChartPath.d.ts +1 -1
  186. package/dist/types/charts/lineChart/fragments/lineChartProjection.d.ts +1 -1
  187. package/dist/types/charts/lineChart/fragments/lineChartSeparator.d.ts +1 -1
  188. package/dist/types/charts/lineChart/fragments/lineChartXAxis.d.ts +1 -1
  189. package/dist/types/charts/lineChart/lineChart.d.ts +5 -5
  190. package/dist/types/charts/lineChart/lineChart.type.d.ts +1 -1
  191. package/dist/types/charts/lineChart/lineChartStructure.d.ts +1 -1
  192. package/dist/types/charts/pieChart/context/pieChartContext.d.ts +1 -1
  193. package/dist/types/charts/pieChart/fragments/pieChartForeign.d.ts +1 -1
  194. package/dist/types/charts/pieChart/fragments/pieChartPath.d.ts +1 -1
  195. package/dist/types/charts/pieChart/pieChart.d.ts +3 -3
  196. package/dist/types/charts/pieChart/pieChart.type.d.ts +1 -1
  197. package/dist/types/charts/pieChart/pieChartStructure.d.ts +1 -1
  198. package/dist/types/components/axisChart/xAxis/xAxis.d.ts +1 -1
  199. package/dist/types/components/axisChart/yAxis/yAxis.d.ts +1 -1
  200. package/dist/types/components/bar/bar.d.ts +1 -1
  201. package/dist/types/components/bar/fragments/barChartSegment.d.ts +1 -1
  202. package/dist/types/components/chartText/chartText.d.ts +1 -1
  203. package/dist/types/components/foreignObject/foreignObject.d.ts +1 -1
  204. package/dist/types/components/foreignObject/foreignObject.types.d.ts +1 -1
  205. package/dist/types/components/line/line.d.ts +1 -1
  206. package/dist/types/components/node/components/circle/circle.d.ts +1 -1
  207. package/dist/types/components/node/components/hexagon/hexagon.d.ts +1 -1
  208. package/dist/types/components/node/components/pentagon/pentagon.d.ts +1 -1
  209. package/dist/types/components/node/components/square/square.d.ts +1 -1
  210. package/dist/types/components/node/components/star/star.d.ts +1 -1
  211. package/dist/types/components/node/components/straight/straight.d.ts +1 -1
  212. package/dist/types/components/node/components/triangle/triangle.d.ts +1 -1
  213. package/dist/types/components/node/node.d.ts +1 -1
  214. package/dist/types/components/path/components/nodePath/nodePath.d.ts +2 -2
  215. package/dist/types/components/path/path.d.ts +1 -1
  216. package/dist/types/components/path/path.types.d.ts +1 -1
  217. package/dist/types/components/plot/components/circle/circle.d.ts +1 -1
  218. package/dist/types/components/plot/components/square/square.d.ts +1 -1
  219. package/dist/types/components/plot/components/triangle/triangle.d.ts +1 -1
  220. package/dist/types/components/plot/plot.d.ts +1 -1
  221. package/dist/types/components/svgContainer/svgContainer.d.ts +1 -1
  222. package/dist/types/components/tick/tick.d.ts +1 -1
  223. package/dist/types/components/zoomArea/components/HandlerIcon.d.ts +1 -1
  224. package/dist/types/components/zoomArea/components/LineRenderer.d.ts +1 -1
  225. package/dist/types/components/zoomArea/components/SelectionArea.d.ts +1 -1
  226. package/dist/types/components/zoomArea/components/ZoomHandler.d.ts +1 -1
  227. package/dist/types/hooks/useFocus/useFocus.types.d.ts +1 -1
  228. package/dist/types/hooks/useHover/useHover.types.d.ts +1 -1
  229. package/dist/types/utils/getChildrenAttr/getChildrenAttr.d.ts +1 -1
  230. package/package.json +44 -47
@@ -1,34 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartYAxis = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const yAxis_1 = require("../../../components/axisChart/yAxis/yAxis");
7
- const tick_types_1 = require("../../../components/tick/tick.types");
8
- const position_enum_1 = require("../../../types/position.enum");
9
- const ajustedTextSpace_1 = require("../../../utils/ajustedTextSpace/ajustedTextSpace");
10
- const getTickTextCoordinates_1 = require("../../../utils/getTickTextCoordinate/getTickTextCoordinates");
11
- const pickCustomAttributes_1 = require("../../../utils/pickCustomAttributes/pickCustomAttributes");
12
- const lineChartContext_1 = require("../context/lineChartContext");
13
- const LineChartYAxis = ({ ariaLabel, position = position_enum_1.Positions.LEFT, tickLine, tickText, valueFormatter = (value) => value,
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { YAxis } from '../../../components/axisChart/yAxis/yAxis';
4
+ import { TickDataUtils } from '../../../components/tick/tick.types';
5
+ import { Positions } from '../../../types/position.enum';
6
+ import { ajustedTextSpace } from '../../../utils/ajustedTextSpace/ajustedTextSpace';
7
+ import { getTickTextXCoordinate } from '../../../utils/getTickTextCoordinate/getTickTextCoordinates';
8
+ import { pickCustomAttributes } from '../../../utils/pickCustomAttributes/pickCustomAttributes';
9
+ import { LineChartContext } from '../context/lineChartContext';
10
+ export const LineChartYAxis = ({ ariaLabel, position = Positions.LEFT, tickLine, tickText, valueFormatter = (value) => value,
14
11
  // NOTE: tickValues prop is destructured but NOT USED - see TODO in lineChart.type.ts
15
12
  ...props }) => {
16
- const { yAxisCoordinates: { coordinates, tickValues: contextTickValues }, yCursor, ...context } = (0, react_1.useContext)(lineChartContext_1.LineChartContext);
13
+ const { yAxisCoordinates: { coordinates, tickValues: contextTickValues }, yCursor, ...context } = useContext(LineChartContext);
17
14
  // TODO: Currently ignoring props.tickValues and using contextTickValues instead
18
15
  // This means custom tickValues prop has no effect. Implementation needed to:
19
16
  // 1. Check if props.tickValues exists
20
17
  // 2. Use custom tick values instead of context values when provided
21
18
  // 3. Update buildLineContextValue to handle custom Y-axis tick values
22
19
  const textAnchor = tickText?.textAnchor || 'middle';
23
- const addSpace = position === position_enum_1.Positions.RIGHT ? tickText?.right : tickText?.left;
20
+ const addSpace = position === Positions.RIGHT ? tickText?.right : tickText?.left;
24
21
  const ajustedSpace = addSpace ?? 0;
25
- const ajustedText = (0, ajustedTextSpace_1.ajustedTextSpace)(textAnchor, context.yAxisText, ajustedSpace);
26
- const xTickText = (0, getTickTextCoordinates_1.getTickTextXCoordinate)(position, coordinates.x1, ajustedText);
22
+ const ajustedText = ajustedTextSpace(textAnchor, context.yAxisText, ajustedSpace);
23
+ const xTickText = getTickTextXCoordinate(position, coordinates.x1, ajustedText);
27
24
  const tickValues = tickText
28
- ? tick_types_1.TickDataUtils.formatTicksValues(contextTickValues, valueFormatter)
25
+ ? TickDataUtils.formatTicksValues(contextTickValues, valueFormatter)
29
26
  : undefined;
30
27
  // Extract custom attributes (aria-*, data-*) and handle deprecated ariaLabel
31
- const customAttributes = (0, pickCustomAttributes_1.pickCustomAttributes)(props);
28
+ const customAttributes = pickCustomAttributes(props);
32
29
  const finalAriaLabel = ariaLabel || props['aria-label'];
33
30
  // Merge all props including custom attributes and ariaLabel precedence
34
31
  const mergedProps = {
@@ -36,10 +33,9 @@ const LineChartYAxis = ({ ariaLabel, position = position_enum_1.Positions.LEFT,
36
33
  ...customAttributes,
37
34
  ...(finalAriaLabel && { 'aria-label': finalAriaLabel }),
38
35
  };
39
- return ((0, jsx_runtime_1.jsx)(yAxis_1.YAxis, { ...coordinates, ...mergedProps, canvasHeight: Number(context.canvasHeight), canvasWidth: Number(context.canvasWidth), cursor: yCursor, dataTestId: `${context.dataTestId}yAxis`, tickLine: {
36
+ return (_jsx(YAxis, { ...coordinates, ...mergedProps, canvasHeight: Number(context.canvasHeight), canvasWidth: Number(context.canvasWidth), cursor: yCursor, dataTestId: `${context.dataTestId}yAxis`, tickLine: {
40
37
  ...tickLine,
41
38
  x1: context.extraSpaceLeftX,
42
39
  x2: Number(context.canvasWidth) - context.extraSpaceRightX,
43
40
  }, tickText: { ...tickText, x: xTickText }, tickValues: tickValues }));
44
41
  };
45
- exports.LineChartYAxis = LineChartYAxis;
@@ -1,9 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIndicator = exports.useHover = exports.useAutoClick = void 0;
4
- var useAutoClick_1 = require("./useAutoClick");
5
- Object.defineProperty(exports, "useAutoClick", { enumerable: true, get: function () { return useAutoClick_1.useAutoClick; } });
6
- var useHover_1 = require("./useHover");
7
- Object.defineProperty(exports, "useHover", { enumerable: true, get: function () { return useHover_1.useHover; } });
8
- var useIndicator_1 = require("./useIndicator");
9
- Object.defineProperty(exports, "useIndicator", { enumerable: true, get: function () { return useIndicator_1.useIndicator; } });
1
+ export { useAutoClick } from './useAutoClick';
2
+ export { useHover } from './useHover';
3
+ export { useIndicator } from './useIndicator';
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAutoClick = void 0;
4
- const react_1 = require("react");
5
- const useAutoClick = (ref) => {
6
- const autoClick = (0, react_1.useRef)(false);
7
- const innerRef = (0, react_1.useRef)(null);
8
- (0, react_1.useImperativeHandle)(ref, () => innerRef.current, []);
1
+ import { useEffect, useImperativeHandle, useRef } from 'react';
2
+ export const useAutoClick = (ref) => {
3
+ const autoClick = useRef(false);
4
+ const innerRef = useRef(null);
5
+ useImperativeHandle(ref, () => innerRef.current, []);
9
6
  const handleClick = (e) => {
10
7
  autoClick.current = !!e.autoClick;
11
8
  };
12
- (0, react_1.useEffect)(() => {
9
+ useEffect(() => {
13
10
  if (!innerRef.current) {
14
11
  return;
15
12
  }
@@ -20,4 +17,3 @@ const useAutoClick = (ref) => {
20
17
  }, []);
21
18
  return [innerRef, autoClick];
22
19
  };
23
- exports.useAutoClick = useAutoClick;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useHover = void 0;
4
- const react_1 = require("react");
1
+ import { useCallback, useState } from 'react';
5
2
  const outRange = -Infinity;
6
- const useHover = ({ canvasHeight, canvasWidth }) => {
7
- const [[xCursor, yCursor], setCursor] = (0, react_1.useState)([outRange, outRange]);
8
- const getCursor = (0, react_1.useCallback)((e, node) => {
3
+ export const useHover = ({ canvasHeight, canvasWidth }) => {
4
+ const [[xCursor, yCursor], setCursor] = useState([outRange, outRange]);
5
+ const getCursor = useCallback((e, node) => {
9
6
  const { height, left, top, width } = node.getBoundingClientRect();
10
7
  // get the x and y position of the mouse
11
8
  const x = e.clientX - left;
@@ -19,7 +16,7 @@ const useHover = ({ canvasHeight, canvasWidth }) => {
19
16
  const startTouch = (e) => {
20
17
  e.preventDefault();
21
18
  };
22
- const svgRef = (0, react_1.useCallback)((node) => {
19
+ const svgRef = useCallback((node) => {
23
20
  if (node) {
24
21
  node.addEventListener('touchstart', startTouch);
25
22
  node.addEventListener('touchmove', e => getCursor(e.touches[0], node));
@@ -31,4 +28,3 @@ const useHover = ({ canvasHeight, canvasWidth }) => {
31
28
  }, [canvasHeight, canvasWidth]);
32
29
  return { svgRef, xCursor, yCursor };
33
30
  };
34
- exports.useHover = useHover;
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useIndicator = void 0;
4
- const react_1 = require("react");
5
- const useIndicator = (xPosition, implement) => {
6
- const pathRef = (0, react_1.useRef)(null);
7
- const indicatorRef = (0, react_1.useRef)(null);
8
- (0, react_1.useEffect)(() => {
1
+ import { useEffect, useRef } from 'react';
2
+ export const useIndicator = (xPosition, implement) => {
3
+ const pathRef = useRef(null);
4
+ const indicatorRef = useRef(null);
5
+ useEffect(() => {
9
6
  if (!implement || !pathRef.current || !indicatorRef.current) {
10
7
  return;
11
8
  }
@@ -32,4 +29,3 @@ const useIndicator = (xPosition, implement) => {
32
29
  }, [xPosition]);
33
30
  return { indicatorRef, pathRef };
34
31
  };
35
- exports.useIndicator = useIndicator;
@@ -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;