@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,24 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAxisExtraSpacing = void 0;
4
- const react_1 = require("react");
5
- const bar_type_1 = require("../../../components/bar/bar.type");
6
- const position_enum_1 = require("../../../types/position.enum");
7
- const buildTickValues_1 = require("../../../utils/buildTickValues/buildTickValues");
8
- const textBound_1 = require("../../../utils/textBound/textBound");
9
- const barChartPath_1 = require("../fragments/barChartPath");
10
- const barChartXAxis_1 = require("../fragments/barChartXAxis");
11
- const barChartYAxis_1 = require("../fragments/barChartYAxis");
12
- const getBarDataValue_1 = require("./getBarDataValue");
13
- const getRoundedBarMaxValue_1 = require("./getRoundedBarMaxValue");
1
+ import { Children, isValidElement } from 'react';
2
+ import { BarOrientation } from '../../../components/bar/bar.type';
3
+ import { Positions } from '../../../types/position.enum';
4
+ import { buildTickValues } from '../../../utils/buildTickValues/buildTickValues';
5
+ import { textBound } from '../../../utils/textBound/textBound';
6
+ import { BarChartPath } from '../fragments/barChartPath';
7
+ import { BarChartXAxis } from '../fragments/barChartXAxis';
8
+ import { BarChartYAxis } from '../fragments/barChartYAxis';
9
+ import { getBarDataValues } from './getBarDataValue';
10
+ import { getBarKeyRoundMaxValue } from './getRoundedBarMaxValue';
14
11
  const handleBarChartXAxis = (child, data, pKey, ajustedX, barsSpacing, viewBox, canvasHeight, canvasWidth) => {
15
12
  const { position, tickText, tickValues } = child.props;
16
13
  const fontSize = tickText?.fontSize ?? 0;
17
14
  const spaceFontSize = fontSize * ajustedX;
18
15
  const xData = tickValues
19
- ? (0, getBarDataValue_1.getBarDataValues)(tickValues)
16
+ ? getBarDataValues(tickValues)
20
17
  : data.map(d => d[pKey]);
21
- const fontSpacing = (0, textBound_1.textBound)({
18
+ const fontSpacing = textBound({
22
19
  bound: 'width',
23
20
  data: xData,
24
21
  fontSize,
@@ -27,9 +24,9 @@ const handleBarChartXAxis = (child, data, pKey, ajustedX, barsSpacing, viewBox,
27
24
  viewBox,
28
25
  });
29
26
  const securityXSpace = (() => (barsSpacing > fontSpacing ? barsSpacing : fontSpacing))();
30
- const extraSpaceBottomY = position === position_enum_1.Positions.BOTTOM ? spaceFontSize + (tickText?.top ?? 0) : 0;
31
- const extraSpaceTopY = position === position_enum_1.Positions.TOP ? spaceFontSize + (tickText?.bottom ?? 0) : 0;
32
- const barChartXPosition = (() => position || position_enum_1.Positions.BOTTOM)();
27
+ const extraSpaceBottomY = position === Positions.BOTTOM ? spaceFontSize + (tickText?.top ?? 0) : 0;
28
+ const extraSpaceTopY = position === Positions.TOP ? spaceFontSize + (tickText?.bottom ?? 0) : 0;
29
+ const barChartXPosition = (() => position || Positions.BOTTOM)();
33
30
  const xBreakAxis = tickValues?.numeric
34
31
  ? (tickValues.numeric.breakAxis ?? 0)
35
32
  : (tickText?.custom?.breakAxis ?? 0);
@@ -47,10 +44,10 @@ const handleBarChartYAxis = (child, data, pKey, ajustedY, barSpacing, viewBox, c
47
44
  const fontSize = tickText?.fontSize ?? 0;
48
45
  const spaceFontSize = fontSize * ajustedY; //! review
49
46
  const dataValues = tickValues ||
50
- (0, buildTickValues_1.buildTickValues)([...new Set((0, getRoundedBarMaxValue_1.getBarKeyRoundMaxValue)(data, pKey))]);
51
- const yData = (0, getBarDataValue_1.getBarDataValues)(dataValues);
47
+ buildTickValues([...new Set(getBarKeyRoundMaxValue(data, pKey))]);
48
+ const yData = getBarDataValues(dataValues);
52
49
  const securityYSpace = (() => (barSpacing > spaceFontSize ? barSpacing : spaceFontSize))();
53
- const textWidth = (0, textBound_1.textBound)({
50
+ const textWidth = textBound({
54
51
  bound: 'width',
55
52
  data: yData,
56
53
  fontSize,
@@ -58,9 +55,9 @@ const handleBarChartYAxis = (child, data, pKey, ajustedY, barSpacing, viewBox, c
58
55
  svgWidth: `${canvasWidth}`,
59
56
  viewBox,
60
57
  });
61
- const extraSpaceLeftX = position === position_enum_1.Positions.LEFT ? textWidth + (tickText?.right ?? 0) : 0;
62
- const extraSpaceRightX = position === position_enum_1.Positions.RIGHT ? textWidth + (tickText?.left ?? 0) : 0;
63
- const barChartYPosition = (() => position || position_enum_1.Positions.LEFT)();
58
+ const extraSpaceLeftX = position === Positions.LEFT ? textWidth + (tickText?.right ?? 0) : 0;
59
+ const extraSpaceRightX = position === Positions.RIGHT ? textWidth + (tickText?.left ?? 0) : 0;
60
+ const barChartYPosition = (() => position || Positions.LEFT)();
64
61
  const yBreakAxis = tickValues?.numeric
65
62
  ? (tickValues.numeric.breakAxis ?? 0)
66
63
  : (tickText?.custom?.breakAxis ?? 0);
@@ -74,10 +71,10 @@ const handleBarChartYAxis = (child, data, pKey, ajustedY, barSpacing, viewBox, c
74
71
  yData,
75
72
  };
76
73
  };
77
- const getAxisExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, gapBetweenBars, orientation, pKey, viewBox, }) => {
74
+ export const getAxisExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, gapBetweenBars, orientation, pKey, viewBox, }) => {
78
75
  let result = {
79
- barChartXPosition: position_enum_1.Positions.BOTTOM,
80
- barChartYPosition: position_enum_1.Positions.LEFT,
76
+ barChartXPosition: Positions.BOTTOM,
77
+ barChartYPosition: Positions.LEFT,
81
78
  extraSpaceBottomY: 0,
82
79
  extraSpaceLeftX: 0,
83
80
  extraSpaceRightX: 0,
@@ -93,21 +90,21 @@ const getAxisExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, ch
93
90
  };
94
91
  let barsSpacing = gapBetweenBars;
95
92
  const reviews = [];
96
- react_1.Children.forEach(children, (child) => {
97
- if ((0, react_1.isValidElement)(child)) {
98
- if (child.type === barChartPath_1.BarChartPath && !reviews.includes(child.props.order)) {
93
+ Children.forEach(children, (child) => {
94
+ if (isValidElement(child)) {
95
+ if (child.type === BarChartPath && !reviews.includes(child.props.order)) {
99
96
  reviews.push(child.props.order);
100
97
  barsSpacing += child.props.barConfig.barWidth ?? 0;
101
98
  }
102
- if (child.type === barChartXAxis_1.BarChartXAxis) {
103
- const securitySpace = orientation === bar_type_1.BarOrientation.VERTICAL ? barsSpacing : 0;
99
+ if (child.type === BarChartXAxis) {
100
+ const securitySpace = orientation === BarOrientation.VERTICAL ? barsSpacing : 0;
104
101
  result = {
105
102
  ...result,
106
103
  ...handleBarChartXAxis(child, data, pKey, ajustedX, securitySpace, viewBox, canvasHeight, canvasWidth),
107
104
  };
108
105
  }
109
- else if (child.type === barChartYAxis_1.BarChartYAxis) {
110
- const securitySpace = orientation === bar_type_1.BarOrientation.HORIZONTAL ? barsSpacing : 0;
106
+ else if (child.type === BarChartYAxis) {
107
+ const securitySpace = orientation === BarOrientation.HORIZONTAL ? barsSpacing : 0;
111
108
  result = {
112
109
  ...result,
113
110
  ...handleBarChartYAxis(child, data, pKey, ajustedY, securitySpace, viewBox, canvasHeight, canvasWidth),
@@ -117,4 +114,3 @@ const getAxisExtraSpacing = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, ch
117
114
  });
118
115
  return result;
119
116
  };
120
- exports.getAxisExtraSpacing = getAxisExtraSpacing;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBarDataValues = void 0;
4
1
  /**
5
2
  * Retrieves the data values from the given BarTickValuesAxisProps object.
6
3
  * @param data - The BarTickValuesAxisProps 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 getBarDataValues = (data) => {
6
+ export const getBarDataValues = (data) => {
10
7
  if (data.custom) {
11
8
  return data.custom?.values;
12
9
  }
@@ -20,4 +17,3 @@ const getBarDataValues = (data) => {
20
17
  }
21
18
  return undefined;
22
19
  };
23
- exports.getBarDataValues = getBarDataValues;
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBarKeyRoundMaxValue = void 0;
4
1
  /**
5
2
  * Returns an array of rounded maximum values for each yKey in the given data.
6
3
  * @param data - The array of data points.
7
4
  * @param xKey - The xKey used for filtering the data.
8
5
  * @returns An array of rounded maximum values.
9
6
  */
10
- const getBarKeyRoundMaxValue = (data, Key) => {
7
+ export const getBarKeyRoundMaxValue = (data, Key) => {
11
8
  return data.flatMap(point => Object.keys(point)
12
9
  .filter(k => k !== Key && typeof point[k] === 'number')
13
10
  .map(k => Number(point[k])));
14
11
  };
15
- exports.getBarKeyRoundMaxValue = getBarKeyRoundMaxValue;
@@ -1,19 +1,3 @@
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("./barChart"), exports);
18
- __exportStar(require("./lineChart"), exports);
19
- __exportStar(require("./pieChart/pieChart"), exports);
1
+ export * from './barChart';
2
+ export * from './lineChart';
3
+ export * from './pieChart/pieChart';
@@ -1,24 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildLineContextValue = void 0;
4
- const position_enum_1 = require("../../../types/position.enum");
5
- const buildErrors_1 = require("../../../utils/buildErrors/buildErrors");
6
- const getCoordinates_1 = require("../../../utils/getCoordinates/getCoordinates");
7
- const getPoints_1 = require("../../../utils/getPoints/getPoints");
8
- const getTicks_1 = require("../../../utils/getTicks/getTicks");
9
- const getExtraSpacing_1 = require("../utils/getExtraSpacing");
1
+ import { Positions } from '../../../types/position.enum';
2
+ import { BuildError, buildError } from '../../../utils/buildErrors/buildErrors';
3
+ import { getXCoordinates, getYCoordinates } from '../../../utils/getCoordinates/getCoordinates';
4
+ import { getPoints } from '../../../utils/getPoints/getPoints';
5
+ import { getXTicks, getYTicks } from '../../../utils/getTicks/getTicks';
6
+ import { getExtraSpacing } from '../utils/getExtraSpacing';
10
7
  /**
11
8
  * Builds the context value for the line chart.
12
9
  *
13
10
  * @param {BuildContextValue} options - The options for building the context value.
14
11
  * @returns {LineContextValue} - The built context value.
15
12
  */
16
- const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, viewBox, xKey, }) => {
13
+ export const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth, children, data, viewBox, xKey, }) => {
17
14
  let error = undefined;
18
15
  /**
19
16
  * Get the extra spacings for the line chart.
20
17
  */
21
- const { extraSpaceBottomY, extraSpaceLeftX, extraSpaceRightX, extraSpaceTopY, lineChartXPosition, lineChartYPosition, securityXSpace, securityYSpace, xAxisText, xBreakAxis, xData, yAxisText, yBreakAxis, yData, } = (0, getExtraSpacing_1.getExtraSpacing)({
18
+ const { extraSpaceBottomY, extraSpaceLeftX, extraSpaceRightX, extraSpaceTopY, lineChartXPosition, lineChartYPosition, securityXSpace, securityYSpace, xAxisText, xBreakAxis, xData, yAxisText, yBreakAxis, yData, } = getExtraSpacing({
22
19
  ajustedX,
23
20
  ajustedY,
24
21
  canvasHeight,
@@ -31,9 +28,9 @@ const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth,
31
28
  /**
32
29
  * Calculate the tick values for the X Axis.
33
30
  */
34
- const crossXAxis = lineChartXPosition !== position_enum_1.Positions.TOP && lineChartXPosition !== position_enum_1.Positions.BOTTOM;
31
+ const crossXAxis = lineChartXPosition !== Positions.TOP && lineChartXPosition !== Positions.BOTTOM;
35
32
  const yAxisSpace = extraSpaceLeftX + extraSpaceRightX;
36
- const xTickValues = (0, getTicks_1.getXTicks)({
33
+ const xTickValues = getXTicks({
37
34
  initPos: extraSpaceLeftX,
38
35
  maxSpaceAvailable: canvasWidth,
39
36
  otherAxisSpace: yAxisSpace,
@@ -42,15 +39,15 @@ const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth,
42
39
  });
43
40
  if ((xTickValues ?? []).some(({ position }) => isNaN(position))) {
44
41
  error = {
45
- error: (0, buildErrors_1.buildError)(buildErrors_1.BuildError.INVALID_X_TICK),
42
+ error: buildError(BuildError.INVALID_X_TICK),
46
43
  };
47
44
  }
48
45
  /**
49
46
  * Calculate the tick values for the Y Axis.
50
47
  */
51
- const crossYAxis = lineChartYPosition !== position_enum_1.Positions.LEFT && lineChartYPosition !== position_enum_1.Positions.RIGHT;
48
+ const crossYAxis = lineChartYPosition !== Positions.LEFT && lineChartYPosition !== Positions.RIGHT;
52
49
  const otherAxisSpace = extraSpaceTopY + extraSpaceBottomY;
53
- const yTickValues = (0, getTicks_1.getYTicks)({
50
+ const yTickValues = getYTicks({
54
51
  initPos: canvasHeight - extraSpaceBottomY,
55
52
  maxSpaceAvailable: canvasHeight,
56
53
  otherAxisSpace,
@@ -60,12 +57,12 @@ const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth,
60
57
  /**
61
58
  * Calculate the custom breakAxis for the X and Y Axis.
62
59
  */
63
- const customBreakXAxis = crossXAxis ? (0, getPoints_1.getPoints)(yTickValues || [], [String(xBreakAxis)])[0] : 0;
64
- const customBreakYAxis = crossYAxis ? (0, getPoints_1.getPoints)(xTickValues || [], [String(yBreakAxis)])[0] : 0;
60
+ const customBreakXAxis = crossXAxis ? getPoints(yTickValues || [], [String(xBreakAxis)])[0] : 0;
61
+ const customBreakYAxis = crossYAxis ? getPoints(xTickValues || [], [String(yBreakAxis)])[0] : 0;
65
62
  /**
66
63
  * Calculate the X coordinates for the line chart.
67
64
  */
68
- const xCoordinates = (0, getCoordinates_1.getXCoordinates)({
65
+ const xCoordinates = getXCoordinates({
69
66
  canvasHeight,
70
67
  canvasWidth,
71
68
  customBreakAxis: Number(customBreakXAxis),
@@ -79,7 +76,7 @@ const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth,
79
76
  /**
80
77
  * Calculate the Y coordinates for the line chart.
81
78
  */
82
- const yCoordinates = (0, getCoordinates_1.getYCoordinates)({
79
+ const yCoordinates = getYCoordinates({
83
80
  canvasHeight,
84
81
  canvasWidth,
85
82
  customBreakAxis: Number(customBreakYAxis),
@@ -135,4 +132,3 @@ const buildLineContextValue = ({ ajustedX, ajustedY, canvasHeight, canvasWidth,
135
132
  yAxisText,
136
133
  };
137
134
  };
138
- exports.buildLineContextValue = buildLineContextValue;
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartContext = exports.buildLineContextValue = void 0;
4
- var buildLineContextValue_1 = require("./buildLineContextValue");
5
- Object.defineProperty(exports, "buildLineContextValue", { enumerable: true, get: function () { return buildLineContextValue_1.buildLineContextValue; } });
6
- var lineChartContext_1 = require("./lineChartContext");
7
- Object.defineProperty(exports, "LineChartContext", { enumerable: true, get: function () { return lineChartContext_1.LineChartContext; } });
1
+ export { buildLineContextValue } from './buildLineContextValue';
2
+ export { LineChartContext } from './lineChartContext';
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartContext = void 0;
4
- const react_1 = require("react");
5
- exports.LineChartContext = (0, react_1.createContext)({});
1
+ import { createContext } from 'react';
2
+ export const LineChartContext = createContext({});
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTEXT = void 0;
4
- exports.CONTEXT = {
1
+ export const CONTEXT = {
5
2
  canvasExtraSpace: 0,
6
3
  canvasHeight: 500,
7
4
  canvasWidth: 500,
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTEXT = void 0;
4
- var contextData_1 = require("./contextData");
5
- Object.defineProperty(exports, "CONTEXT", { enumerable: true, get: function () { return contextData_1.CONTEXT; } });
1
+ export { CONTEXT } from './contextData';
@@ -1,11 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartYAxis = exports.LineChartXAxis = exports.LineChartSeparator = exports.LineChartPath = void 0;
4
- var lineChartPath_1 = require("./lineChartPath");
5
- Object.defineProperty(exports, "LineChartPath", { enumerable: true, get: function () { return lineChartPath_1.LineChartPath; } });
6
- var lineChartSeparator_1 = require("./lineChartSeparator");
7
- Object.defineProperty(exports, "LineChartSeparator", { enumerable: true, get: function () { return lineChartSeparator_1.LineChartSeparator; } });
8
- var lineChartXAxis_1 = require("./lineChartXAxis");
9
- Object.defineProperty(exports, "LineChartXAxis", { enumerable: true, get: function () { return lineChartXAxis_1.LineChartXAxis; } });
10
- var lineChartYAxis_1 = require("./lineChartYAxis");
11
- Object.defineProperty(exports, "LineChartYAxis", { enumerable: true, get: function () { return lineChartYAxis_1.LineChartYAxis; } });
1
+ export { LineChartPath } from './lineChartPath';
2
+ export { LineChartSeparator } from './lineChartSeparator';
3
+ export { LineChartXAxis } from './lineChartXAxis';
4
+ export { LineChartYAxis } from './lineChartYAxis';
@@ -1,31 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartPath = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const line_1 = require("../../../components/line/line");
7
- const node_1 = require("../../../components/node/node");
8
- const path_1 = require("../../../components/path/path");
9
- const getPoints_1 = require("../../../utils/getPoints/getPoints");
10
- const pickCustomAttributes_1 = require("../../../utils/pickCustomAttributes/pickCustomAttributes");
11
- const lineChartContext_1 = require("../context/lineChartContext");
12
- const useIndicator_1 = require("../hook/useIndicator");
13
- const findSurroundingNumber_1 = require("../utils/findSurroundingNumber");
14
- const getPathData_1 = require("../utils/getPathData");
15
- const handleNodesFocus_1 = require("../utils/handleNodesFocus");
16
- require("./lineChartPath.css");
17
- const lineChartProjection_1 = require("./lineChartProjection");
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext, useEffect, useRef } from 'react';
3
+ import { Line } from '../../../components/line/line';
4
+ import { Node } from '../../../components/node/node';
5
+ import { Path } from '../../../components/path/path';
6
+ import { getPoints } from '../../../utils/getPoints/getPoints';
7
+ import { pickCustomAttributes } from '../../../utils/pickCustomAttributes/pickCustomAttributes';
8
+ import { LineChartContext } from '../context/lineChartContext';
9
+ import { useIndicator } from '../hook/useIndicator';
10
+ import { findClosestNumber, findSurroundingNumber } from '../utils/findSurroundingNumber';
11
+ import { getPathData } from '../utils/getPathData';
12
+ import { handleNodesFocus } from '../utils/handleNodesFocus';
13
+ import './lineChartPath.css';
14
+ import { LineChartProjection } from './lineChartProjection';
18
15
  const getAxisData = (data, key) => {
19
16
  return data.map(dt => dt[key]);
20
17
  };
21
- const LineChartPath = ({ ariaLabel, closestClick, curved, getNodeFocusInfo, getNodesCoords, indicatorConfig, lineProjection, onClick, ...props }) => {
18
+ export const LineChartPath = ({ ariaLabel, closestClick, curved, getNodeFocusInfo, getNodesCoords, indicatorConfig, lineProjection, onClick, ...props }) => {
22
19
  // recovery the context values
23
- const { xAxisCoordinates, yAxisCoordinates, ...context } = (0, react_1.useContext)(lineChartContext_1.LineChartContext);
20
+ const { xAxisCoordinates, yAxisCoordinates, ...context } = useContext(LineChartContext);
24
21
  // the node indicator logic
25
- const { indicatorRef, pathRef } = (0, useIndicator_1.useIndicator)(context.xCursor, !!indicatorConfig);
22
+ const { indicatorRef, pathRef } = useIndicator(context.xCursor, !!indicatorConfig);
26
23
  const showIndicator = !!indicatorConfig && context.xCursor !== -Infinity;
27
- const innerRefs = (0, react_1.useRef)(null);
28
- const pressedRef = (0, react_1.useRef)(null);
24
+ const innerRefs = useRef(null);
25
+ const pressedRef = useRef(null);
29
26
  // the projection line logic
30
27
  const { autoClick, lineIndicator, ...nodeIndicatorConfig } = indicatorConfig || {};
31
28
  // line indicator <Y> coordinates
@@ -36,24 +33,24 @@ const LineChartPath = ({ ariaLabel, closestClick, curved, getNodeFocusInfo, getN
36
33
  const { tickValues: yTickValues } = yAxisCoordinates;
37
34
  const xData = getAxisData(context.data, context.xKey);
38
35
  const yData = getAxisData(context.data, props.dataKey);
39
- const xPoints = (0, getPoints_1.getPoints)(xTickValues, xData, true);
40
- const yPoints = (0, getPoints_1.getPoints)(yTickValues, yData);
36
+ const xPoints = getPoints(xTickValues, xData, true);
37
+ const yPoints = getPoints(yTickValues, yData);
41
38
  const points = xPoints.map((x, i) => [x, yPoints[i]]);
42
39
  // the path data
43
- const dataOnlyLine = (0, getPathData_1.getPathData)({
40
+ const dataOnlyLine = getPathData({
44
41
  curved,
45
42
  extendToBottom: false,
46
43
  points,
47
44
  svgHeight: Number(context.canvasHeight) - context.extraSpaceBottomY,
48
45
  });
49
- const dataFill = (0, getPathData_1.getPathData)({
46
+ const dataFill = getPathData({
50
47
  curved,
51
48
  extendToBottom: !!props.fill || !!props.gradient,
52
49
  points,
53
50
  svgHeight: Number(context.canvasHeight) - context.extraSpaceBottomY,
54
51
  });
55
52
  // the ref to the path and handler the nodes focus
56
- (0, react_1.useEffect)(() => {
53
+ useEffect(() => {
57
54
  if (!innerRefs.current?.path) {
58
55
  return;
59
56
  }
@@ -61,15 +58,15 @@ const LineChartPath = ({ ariaLabel, closestClick, curved, getNodeFocusInfo, getN
61
58
  const main = innerRefs.current.main;
62
59
  const nodes = innerRefs.current.node;
63
60
  const data = xData.map((d, i) => ({ x: d, y: yData[i] }));
64
- const { mount, unmount } = (0, handleNodesFocus_1.handleNodesFocus)({ data, getNodeFocusInfo, nodes, ref: main });
61
+ const { mount, unmount } = handleNodesFocus({ data, getNodeFocusInfo, nodes, ref: main });
65
62
  mount();
66
63
  // eslint-disable-next-line consistent-return
67
64
  return () => unmount();
68
65
  }, []);
69
66
  // the auto click logic
70
- (0, react_1.useEffect)(() => {
67
+ useEffect(() => {
71
68
  if (props.nodeConfig && showIndicator && autoClick) {
72
- const { idx, match } = (0, findSurroundingNumber_1.findSurroundingNumber)(xPoints, context.xCursor);
69
+ const { idx, match } = findSurroundingNumber(xPoints, context.xCursor);
73
70
  if (match && idx !== pressedRef.current) {
74
71
  pressedRef.current = idx;
75
72
  const evt = new MouseEvent('click', { bubbles: true });
@@ -83,27 +80,26 @@ const LineChartPath = ({ ariaLabel, closestClick, curved, getNodeFocusInfo, getN
83
80
  }
84
81
  }, [context.xCursor]);
85
82
  // Return the nodes coordinates
86
- (0, react_1.useEffect)(() => {
83
+ useEffect(() => {
87
84
  getNodesCoords?.(points);
88
85
  }, [points]);
89
86
  // the click handler
90
87
  const handleClick = (data) => {
91
88
  onClick?.(data);
92
89
  if (closestClick) {
93
- const closest = (0, findSurroundingNumber_1.findClosestNumber)(xPoints, context.xCursor);
90
+ const closest = findClosestNumber(xPoints, context.xCursor);
94
91
  const evt = new MouseEvent('click', { bubbles: true });
95
92
  evt.autoClick = false;
96
93
  innerRefs.current?.node?.[closest]?.dispatchEvent(evt);
97
94
  }
98
95
  };
99
96
  // Extract custom attributes (aria-*, data-*) and handle deprecated ariaLabel
100
- const customAttributes = (0, pickCustomAttributes_1.pickCustomAttributes)(props);
97
+ const customAttributes = pickCustomAttributes(props);
101
98
  const mergedProps = {
102
99
  ...props,
103
100
  ...customAttributes,
104
101
  // Handle deprecated ariaLabel - give precedence to ariaLabel for backward compatibility
105
102
  ...(ariaLabel && { 'aria-label': ariaLabel }),
106
103
  };
107
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(path_1.Path, { ref: innerRefs, d: dataOnlyLine, dFill: dataFill, dataTestId: `${context.dataTestId}path`, dataValue: context.data, points: points, xKey: context.xKey, onClick: handleClick, ...mergedProps }), lineProjection && ((0, jsx_runtime_1.jsx)(lineChartProjection_1.LineChartProjection, { curved: curved, dataKey: props.dataKey, lineProjection: lineProjection, points: points, svgHeight: Number(context.canvasHeight) - context.extraSpaceBottomY })), showIndicator && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!lineIndicator && ((0, jsx_runtime_1.jsx)(line_1.Line, { ...lineIndicator, className: "pointer-events-none", x1: context.xCursor, x2: context.xCursor, y1: y1, y2: y2 })), (0, jsx_runtime_1.jsx)("g", { ref: indicatorRef, className: "pointer-events-none", children: (0, jsx_runtime_1.jsx)(node_1.Node, { ...nodeIndicatorConfig }) })] }))] }));
104
+ return (_jsxs(_Fragment, { children: [_jsx(Path, { ref: innerRefs, d: dataOnlyLine, dFill: dataFill, dataTestId: `${context.dataTestId}path`, dataValue: context.data, points: points, xKey: context.xKey, onClick: handleClick, ...mergedProps }), lineProjection && (_jsx(LineChartProjection, { curved: curved, dataKey: props.dataKey, lineProjection: lineProjection, points: points, svgHeight: Number(context.canvasHeight) - context.extraSpaceBottomY })), showIndicator && (_jsxs(_Fragment, { children: [!!lineIndicator && (_jsx(Line, { ...lineIndicator, className: "pointer-events-none", x1: context.xCursor, x2: context.xCursor, y1: y1, y2: y2 })), _jsx("g", { ref: indicatorRef, className: "pointer-events-none", children: _jsx(Node, { ...nodeIndicatorConfig }) })] }))] }));
108
105
  };
109
- exports.LineChartPath = LineChartPath;
@@ -1,22 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartProjection = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const getProjection_1 = require("../utils/getProjection");
6
- require("./lineChartPath.css");
7
- const LineChartProjection = ({ curved, lineProjection, points, svgHeight, }) => {
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getProjection } from '../utils/getProjection';
3
+ import './lineChartPath.css';
4
+ export const LineChartProjection = ({ curved, lineProjection, points, svgHeight, }) => {
8
5
  const { lower, shapeColor, upper } = lineProjection;
9
6
  const { xProjection: xUp, yProjection: yUp, ...upperProps } = upper || {};
10
7
  const { xProjection: xDw, yProjection: yDw, ...lowerProps } = lower || {};
11
8
  const upperProjection = xUp || yUp ? { x: xUp, y: yUp } : undefined;
12
9
  const lowerProjection = xDw || yDw ? { x: xDw, y: yDw } : undefined;
13
- const { downPath, shapePath, upPath } = (0, getProjection_1.getProjection)({
10
+ const { downPath, shapePath, upPath } = getProjection({
14
11
  curved,
15
12
  lowerProjection,
16
13
  points,
17
14
  svgHeight,
18
15
  upperProjection,
19
16
  });
20
- return ((0, jsx_runtime_1.jsxs)("g", { className: "pointer-events-none", children: [(0, jsx_runtime_1.jsx)("path", { d: shapePath, fill: shapeColor, stroke: "transparent", strokeWidth: "0.1" }), ";", upPath && (0, jsx_runtime_1.jsx)("path", { d: upPath, ...upperProps }), downPath && (0, jsx_runtime_1.jsx)("path", { d: downPath, ...lowerProps })] }));
17
+ return (_jsxs("g", { className: "pointer-events-none", children: [_jsx("path", { d: shapePath, fill: shapeColor, stroke: "transparent", strokeWidth: "0.1" }), ";", upPath && _jsx("path", { d: upPath, ...upperProps }), downPath && _jsx("path", { d: downPath, ...lowerProps })] }));
21
18
  };
22
- exports.LineChartProjection = LineChartProjection;
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartSeparator = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const getPoints_1 = require("../../../utils/getPoints/getPoints");
7
- const lineChartContext_1 = require("../context/lineChartContext");
8
- const LineChartSeparator = ({ areaSeparator, dataTestId, rightSeparator, topSeparator, xBreakAxis, yBreakAxis, }) => {
9
- const { crossXAxis, crossYAxis, xAxisCoordinates, yAxisCoordinates } = (0, react_1.useContext)(lineChartContext_1.LineChartContext);
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { getPoints } from '../../../utils/getPoints/getPoints';
4
+ import { LineChartContext } from '../context/lineChartContext';
5
+ export const LineChartSeparator = ({ areaSeparator, dataTestId, rightSeparator, topSeparator, xBreakAxis, yBreakAxis, }) => {
6
+ const { crossXAxis, crossYAxis, xAxisCoordinates, yAxisCoordinates } = useContext(LineChartContext);
10
7
  if (!topSeparator && !rightSeparator && !areaSeparator) {
11
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
8
+ return _jsx(_Fragment, {});
12
9
  }
13
- const customXEnd = xBreakAxis && (0, getPoints_1.getPoints)(xAxisCoordinates.tickValues, [xBreakAxis], true)[0];
14
- const customYEnd = yBreakAxis && (0, getPoints_1.getPoints)(yAxisCoordinates.tickValues, [yBreakAxis])[0];
10
+ const customXEnd = xBreakAxis && getPoints(xAxisCoordinates.tickValues, [xBreakAxis], true)[0];
11
+ const customYEnd = yBreakAxis && getPoints(yAxisCoordinates.tickValues, [yBreakAxis])[0];
15
12
  const autoXEnd = crossYAxis ? yAxisCoordinates.coordinates.x1 : xAxisCoordinates.coordinates.x2;
16
13
  const autoYEnd = crossXAxis ? xAxisCoordinates.coordinates.y1 : yAxisCoordinates.coordinates.y1;
17
14
  const xStart = xAxisCoordinates.coordinates.x1;
@@ -21,6 +18,5 @@ const LineChartSeparator = ({ areaSeparator, dataTestId, rightSeparator, topSepa
21
18
  const squarePath = `M${xStart} ${yStart} H ${xEnd} V ${yEnd} H ${xStart} Z`;
22
19
  const lineTop = `M${xStart} ${yEnd} H ${xEnd}`;
23
20
  const lineRight = `M${xEnd} ${yStart} V ${yEnd}`;
24
- return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { d: squarePath, "data-testid": `${dataTestId}Area`, ...areaSeparator }), (0, jsx_runtime_1.jsx)("path", { d: lineTop, "data-testid": `${dataTestId}Top`, ...topSeparator }), (0, jsx_runtime_1.jsx)("path", { d: lineRight, "data-testid": `${dataTestId}Right`, ...rightSeparator })] }));
21
+ return (_jsxs("g", { children: [_jsx("path", { d: squarePath, "data-testid": `${dataTestId}Area`, ...areaSeparator }), _jsx("path", { d: lineTop, "data-testid": `${dataTestId}Top`, ...topSeparator }), _jsx("path", { d: lineRight, "data-testid": `${dataTestId}Right`, ...rightSeparator })] }));
25
22
  };
26
- exports.LineChartSeparator = LineChartSeparator;
@@ -1,24 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LineChartXAxis = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const xAxis_1 = require("../../../components/axisChart/xAxis/xAxis");
7
- const tick_types_1 = require("../../../components/tick/tick.types");
8
- const position_enum_1 = require("../../../types/position.enum");
9
- const getTickTextCoordinates_1 = require("../../../utils/getTickTextCoordinate/getTickTextCoordinates");
10
- const pickCustomAttributes_1 = require("../../../utils/pickCustomAttributes/pickCustomAttributes");
11
- const lineChartContext_1 = require("../context/lineChartContext");
12
- const LineChartXAxis = ({ ariaLabel, position = position_enum_1.Positions.BOTTOM, tickLine, tickText, valueFormatter = (value) => value, ...props }) => {
13
- const { xAxisCoordinates: { coordinates, tickValues: contextTickValues }, xCursor, ...context } = (0, react_1.useContext)(lineChartContext_1.LineChartContext);
14
- const tickTextY = (0, getTickTextCoordinates_1.getTickTextYCoordinate)(position, coordinates.y1, Number(tickText?.fontSize), tickText?.top ?? 0);
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { XAxis } from '../../../components/axisChart/xAxis/xAxis';
4
+ import { TickDataUtils } from '../../../components/tick/tick.types';
5
+ import { Positions } from '../../../types/position.enum';
6
+ import { getTickTextYCoordinate } from '../../../utils/getTickTextCoordinate/getTickTextCoordinates';
7
+ import { pickCustomAttributes } from '../../../utils/pickCustomAttributes/pickCustomAttributes';
8
+ import { LineChartContext } from '../context/lineChartContext';
9
+ export const LineChartXAxis = ({ ariaLabel, position = Positions.BOTTOM, tickLine, tickText, valueFormatter = (value) => value, ...props }) => {
10
+ const { xAxisCoordinates: { coordinates, tickValues: contextTickValues }, xCursor, ...context } = useContext(LineChartContext);
11
+ const tickTextY = getTickTextYCoordinate(position, coordinates.y1, Number(tickText?.fontSize), tickText?.top ?? 0);
15
12
  const y1 = context.extraSpaceTopY;
16
13
  const y2 = Number(context.canvasHeight) - context.extraSpaceBottomY;
17
14
  const tickValues = tickText
18
- ? tick_types_1.TickDataUtils.formatTicksValues(contextTickValues, valueFormatter)
15
+ ? TickDataUtils.formatTicksValues(contextTickValues, valueFormatter)
19
16
  : undefined;
20
17
  // Extract custom attributes (aria-*, data-*) and handle deprecated ariaLabel
21
- const customAttributes = (0, pickCustomAttributes_1.pickCustomAttributes)(props);
18
+ const customAttributes = pickCustomAttributes(props);
22
19
  const finalAriaLabel = ariaLabel || props['aria-label'];
23
20
  // Merge all props including custom attributes and ariaLabel precedence
24
21
  const mergedProps = {
@@ -26,7 +23,7 @@ const LineChartXAxis = ({ ariaLabel, position = position_enum_1.Positions.BOTTOM
26
23
  ...customAttributes,
27
24
  ...(finalAriaLabel && { 'aria-label': finalAriaLabel }),
28
25
  };
29
- return ((0, jsx_runtime_1.jsx)(xAxis_1.XAxis, { ...coordinates, ...mergedProps, canvasHeight: Number(context.canvasHeight), canvasWidth: Number(context.canvasWidth), cursor: xCursor, dataTestId: `${context.dataTestId}xAxis`, extraSpace: {
26
+ return (_jsx(XAxis, { ...coordinates, ...mergedProps, canvasHeight: Number(context.canvasHeight), canvasWidth: Number(context.canvasWidth), cursor: xCursor, dataTestId: `${context.dataTestId}xAxis`, extraSpace: {
30
27
  left: context.extraSpaceLeftX,
31
28
  right: context.extraSpaceRightX,
32
29
  }, tickLine: {
@@ -38,4 +35,3 @@ const LineChartXAxis = ({ ariaLabel, position = position_enum_1.Positions.BOTTOM
38
35
  y: tickTextY,
39
36
  }, tickValues: tickValues }));
40
37
  };
41
- exports.LineChartXAxis = LineChartXAxis;