@kubit-ui-web/react-charts 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/charts/barChart/barChart.js +12 -29
  3. package/dist/cjs/charts/barChart/barChart.type.js +1 -2
  4. package/dist/cjs/charts/barChart/barChartStructure.js +25 -29
  5. package/dist/cjs/charts/barChart/context/barChartContext.js +2 -5
  6. package/dist/cjs/charts/barChart/context/buildBarContextValues.js +17 -21
  7. package/dist/cjs/charts/barChart/fragments/barChartPath.js +12 -16
  8. package/dist/cjs/charts/barChart/fragments/barChartSeparator.js +10 -14
  9. package/dist/cjs/charts/barChart/fragments/barChartXAxis.js +10 -14
  10. package/dist/cjs/charts/barChart/fragments/barChartYAxis.js +13 -17
  11. package/dist/cjs/charts/barChart/fragments/fixture/barContextData.js +3 -6
  12. package/dist/cjs/charts/barChart/fragments/fixture/index.js +1 -5
  13. package/dist/cjs/charts/barChart/index.js +1 -17
  14. package/dist/cjs/charts/barChart/utils/countBarChildren.js +5 -9
  15. package/dist/cjs/charts/barChart/utils/getAxisExtraSpacing.js +31 -35
  16. package/dist/cjs/charts/barChart/utils/getBarDataValue.js +1 -5
  17. package/dist/cjs/charts/barChart/utils/getRoundedBarMaxValue.js +1 -5
  18. package/dist/cjs/charts/index.js +3 -19
  19. package/dist/cjs/charts/lineChart/context/buildLineContextValue.js +17 -21
  20. package/dist/cjs/charts/lineChart/context/index.js +2 -7
  21. package/dist/cjs/charts/lineChart/context/lineChartContext.js +2 -5
  22. package/dist/cjs/charts/lineChart/fragments/fixture/contextData.js +1 -4
  23. package/dist/cjs/charts/lineChart/fragments/fixture/index.js +1 -5
  24. package/dist/cjs/charts/lineChart/fragments/index.js +4 -11
  25. package/dist/cjs/charts/lineChart/fragments/lineChartPath.js +31 -35
  26. package/dist/cjs/charts/lineChart/fragments/lineChartProjection.js +6 -10
  27. package/dist/cjs/charts/lineChart/fragments/lineChartSeparator.js +10 -14
  28. package/dist/cjs/charts/lineChart/fragments/lineChartXAxis.js +14 -18
  29. package/dist/cjs/charts/lineChart/fragments/lineChartYAxis.js +17 -21
  30. package/dist/cjs/charts/lineChart/hook/index.js +3 -9
  31. package/dist/cjs/charts/lineChart/hook/useAutoClick.js +6 -10
  32. package/dist/cjs/charts/lineChart/hook/useHover.js +5 -9
  33. package/dist/cjs/charts/lineChart/hook/useIndicator.js +5 -9
  34. package/dist/cjs/charts/lineChart/index.js +1 -17
  35. package/dist/cjs/charts/lineChart/lineChart.js +12 -29
  36. package/dist/cjs/charts/lineChart/lineChart.type.js +1 -2
  37. package/dist/cjs/charts/lineChart/lineChartStructure.js +34 -38
  38. package/dist/cjs/charts/lineChart/utils/accessibilityTemplateProcessor.js +6 -10
  39. package/dist/cjs/charts/lineChart/utils/findSurroundingNumber.js +2 -7
  40. package/dist/cjs/charts/lineChart/utils/getDataValues.js +1 -5
  41. package/dist/cjs/charts/lineChart/utils/getExtraSpacing.js +26 -30
  42. package/dist/cjs/charts/lineChart/utils/getPathData.js +1 -5
  43. package/dist/cjs/charts/lineChart/utils/getProjection.js +1 -5
  44. package/dist/cjs/charts/lineChart/utils/getRoundedMaxValue.js +2 -7
  45. package/dist/cjs/charts/lineChart/utils/handleNodesFocus.js +1 -5
  46. package/dist/cjs/charts/lineChart/utils/index.js +6 -17
  47. package/dist/cjs/charts/pieChart/context/buildPieContextValue.js +8 -12
  48. package/dist/cjs/charts/pieChart/context/index.js +2 -7
  49. package/dist/cjs/charts/pieChart/context/pieChartContext.js +2 -5
  50. package/dist/cjs/charts/pieChart/fragments/index.js +2 -7
  51. package/dist/cjs/charts/pieChart/fragments/pieChartForeign.js +7 -11
  52. package/dist/cjs/charts/pieChart/fragments/pieChartPath.js +12 -16
  53. package/dist/cjs/charts/pieChart/fragments/pieChartSegment.js +6 -10
  54. package/dist/cjs/charts/pieChart/index.js +1 -17
  55. package/dist/cjs/charts/pieChart/pieChart.js +8 -25
  56. package/dist/cjs/charts/pieChart/pieChart.type.js +1 -2
  57. package/dist/cjs/charts/pieChart/pieChartStructure.js +16 -20
  58. package/dist/cjs/charts/pieChart/utils/buildL.js +1 -5
  59. package/dist/cjs/charts/pieChart/utils/calculatePoint.js +1 -5
  60. package/dist/cjs/charts/pieChart/utils/calculateSegmentPath.js +10 -14
  61. package/dist/cjs/charts/pieChart/utils/drawSegmentPath.js +6 -10
  62. package/dist/cjs/charts/pieChart/utils/index.js +2 -7
  63. package/dist/cjs/charts/pieChart/utils/rotationDirection.js +3 -7
  64. package/dist/cjs/components/axisChart/index.js +2 -18
  65. package/dist/cjs/components/axisChart/utils/filterLineProps/filterLineProps.js +1 -5
  66. package/dist/cjs/components/axisChart/utils/index.js +1 -17
  67. package/dist/cjs/components/axisChart/xAxis/index.js +2 -18
  68. package/dist/cjs/components/axisChart/xAxis/xAxis.js +14 -18
  69. package/dist/cjs/components/axisChart/xAxis/xAxis.types.js +1 -2
  70. package/dist/cjs/components/axisChart/yAxis/index.js +2 -18
  71. package/dist/cjs/components/axisChart/yAxis/yAxis.js +13 -17
  72. package/dist/cjs/components/axisChart/yAxis/yAxis.types.js +1 -2
  73. package/dist/cjs/components/bar/bar.js +9 -13
  74. package/dist/cjs/components/bar/bar.type.js +1 -4
  75. package/dist/cjs/components/bar/fragments/barChartSegment.js +3 -7
  76. package/dist/cjs/components/bar/index.js +2 -18
  77. package/dist/cjs/components/bar/utils/buildD.js +5 -9
  78. package/dist/cjs/components/bar/utils/getSegments.js +3 -7
  79. package/dist/cjs/components/chartText/chartText.js +3 -7
  80. package/dist/cjs/components/chartText/chartText.types.js +1 -2
  81. package/dist/cjs/components/chartText/index.js +2 -18
  82. package/dist/cjs/components/foreignObject/foreignObject.js +3 -7
  83. package/dist/cjs/components/foreignObject/foreignObject.types.js +1 -2
  84. package/dist/cjs/components/foreignObject/index.js +2 -18
  85. package/dist/cjs/components/index.js +10 -26
  86. package/dist/cjs/components/line/index.js +2 -18
  87. package/dist/cjs/components/line/line.js +3 -7
  88. package/dist/cjs/components/line/line.types.js +1 -2
  89. package/dist/cjs/components/node/components/circle/circle.js +4 -7
  90. package/dist/cjs/components/node/components/hexagon/hexagon.js +6 -9
  91. package/dist/cjs/components/node/components/pentagon/pentagon.js +6 -9
  92. package/dist/cjs/components/node/components/square/square.js +4 -7
  93. package/dist/cjs/components/node/components/star/star.js +6 -9
  94. package/dist/cjs/components/node/components/straight/straight.js +4 -7
  95. package/dist/cjs/components/node/components/triangle/triangle.js +4 -7
  96. package/dist/cjs/components/node/index.js +2 -18
  97. package/dist/cjs/components/node/node.js +22 -25
  98. package/dist/cjs/components/node/node.types.js +1 -4
  99. package/dist/cjs/components/node/utils/calculateShapePoints/calculateShapePoints.js +1 -5
  100. package/dist/cjs/components/path/components/nodePath/nodePath.js +9 -12
  101. package/dist/cjs/components/path/index.js +2 -18
  102. package/dist/cjs/components/path/path.js +20 -23
  103. package/dist/cjs/components/path/path.types.js +1 -2
  104. package/dist/cjs/components/plot/components/circle/circle.js +4 -7
  105. package/dist/cjs/components/plot/components/index.js +3 -19
  106. package/dist/cjs/components/plot/components/square/square.js +4 -7
  107. package/dist/cjs/components/plot/components/triangle/triangle.js +4 -7
  108. package/dist/cjs/components/plot/index.js +2 -18
  109. package/dist/cjs/components/plot/plot.js +21 -24
  110. package/dist/cjs/components/plot/plot.types.js +8 -11
  111. package/dist/cjs/components/svgContainer/index.js +1 -17
  112. package/dist/cjs/components/svgContainer/svgContainer.js +5 -8
  113. package/dist/cjs/components/svgContainer/svgContainer.types.js +1 -2
  114. package/dist/cjs/components/svgContainer/utils/buildViewBox/buildViewBox.js +1 -5
  115. package/dist/cjs/components/svgContainer/utils/index.js +1 -17
  116. package/dist/cjs/components/tick/index.js +2 -18
  117. package/dist/cjs/components/tick/tick.js +4 -8
  118. package/dist/cjs/components/tick/tick.types.js +1 -4
  119. package/dist/cjs/components/zoomArea/components/HandlerIcon.js +3 -7
  120. package/dist/cjs/components/zoomArea/components/LineRenderer.js +3 -7
  121. package/dist/cjs/components/zoomArea/components/SelectionArea.js +9 -14
  122. package/dist/cjs/components/zoomArea/components/ZoomHandler.js +6 -10
  123. package/dist/cjs/components/zoomArea/components/index.js +4 -12
  124. package/dist/cjs/components/zoomArea/hooks/index.js +5 -13
  125. package/dist/cjs/components/zoomArea/hooks/useDragInteraction.js +19 -23
  126. package/dist/cjs/components/zoomArea/hooks/useKeyboardNavigation.js +18 -22
  127. package/dist/cjs/components/zoomArea/hooks/useResponsiveCanvas.js +12 -16
  128. package/dist/cjs/components/zoomArea/hooks/useZoomAreaFocus.js +6 -10
  129. package/dist/cjs/components/zoomArea/hooks/useZoomData.js +8 -12
  130. package/dist/cjs/components/zoomArea/index.js +5 -21
  131. package/dist/cjs/components/zoomArea/utils/accessibilityLabels.js +6 -11
  132. package/dist/cjs/components/zoomArea/utils/index.js +3 -14
  133. package/dist/cjs/components/zoomArea/utils/indexRounding.js +5 -11
  134. package/dist/cjs/components/zoomArea/utils/interactionConfig.js +1 -5
  135. package/dist/cjs/components/zoomArea/utils/pathGeneration.js +4 -9
  136. package/dist/cjs/components/zoomArea/utils/rangeAndPositions.js +5 -13
  137. package/dist/cjs/components/zoomArea/utils/selectionConfig.js +1 -5
  138. package/dist/cjs/components/zoomArea/zoomArea.js +35 -39
  139. package/dist/cjs/components/zoomArea/zoomArea.type.js +1 -4
  140. package/dist/cjs/hooks/index.js +2 -18
  141. package/dist/cjs/hooks/useFocus/useFocus.js +5 -9
  142. package/dist/cjs/hooks/useFocus/useFocus.types.js +1 -2
  143. package/dist/cjs/hooks/useHover/useHover.js +5 -9
  144. package/dist/cjs/hooks/useHover/useHover.types.js +1 -2
  145. package/dist/cjs/index.js +3 -19
  146. package/dist/cjs/types/canvas.type.js +1 -4
  147. package/dist/cjs/types/errors.type.js +1 -4
  148. package/dist/cjs/types/focusConfig.type.js +1 -4
  149. package/dist/cjs/types/index.js +4 -20
  150. package/dist/cjs/types/position.enum.js +1 -4
  151. package/dist/cjs/types/unit.enum.js +1 -4
  152. package/dist/cjs/types/valueFormatter.type.js +1 -2
  153. package/dist/cjs/utils/ajustedTextSpace/ajustedTextSpace.js +1 -5
  154. package/dist/cjs/utils/buildErrors/buildErrors.js +3 -7
  155. package/dist/cjs/utils/buildTickValues/buildTickValues.js +2 -7
  156. package/dist/cjs/utils/calculateFocusOutline/calculateFocusOutline.js +8 -13
  157. package/dist/cjs/utils/classNames/classNames.js +1 -5
  158. package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.js +4 -8
  159. package/dist/cjs/utils/cssGradientToSvg/cssGradientToSvg.types.js +1 -2
  160. package/dist/cjs/utils/cursorNear/isNear.js +1 -5
  161. package/dist/cjs/utils/getAxisData/getAxisData.js +1 -5
  162. package/dist/cjs/utils/getCanvasDimensions/getCanvasDimensions.js +8 -12
  163. package/dist/cjs/utils/getChildrenAttr/getChildrenAttr.js +4 -8
  164. package/dist/cjs/utils/getCoordinates/getCoordinates.js +9 -14
  165. package/dist/cjs/utils/getDataFingerprint/getDataFingerprint.js +1 -5
  166. package/dist/cjs/utils/getPoints/getPoints.js +1 -5
  167. package/dist/cjs/utils/getTickTextCoordinate/getTickTextCoordinates.js +5 -10
  168. package/dist/cjs/utils/getTicks/getTicks.js +2 -7
  169. package/dist/cjs/utils/index.js +8 -24
  170. package/dist/cjs/utils/parseStringToNumberPx.ts/parseStringToNumberPx.js +3 -7
  171. package/dist/cjs/utils/pickCustomAttributes/pickCustomAttributes.js +1 -5
  172. package/dist/cjs/utils/shadowSvg/shadowSvg.js +3 -7
  173. package/dist/cjs/utils/shadowSvg/shadowSvg.types.js +1 -2
  174. package/dist/cjs/utils/textBound/textBound.js +1 -5
  175. package/dist/kubit-ui-web-react-charts.cjs.js +1 -10
  176. package/dist/kubit-ui-web-react-charts.es.js +1 -10
  177. package/dist/kubit-ui-web-react-charts.umd.js +1 -10
  178. package/package.json +31 -33
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFullRange = exports.createDefaultRange = exports.clampRange = exports.mouseToDataIndex = exports.calculateHandlerPositions = void 0;
4
1
  /**
5
2
  * Range operations and position calculation utilities for ZoomArea
6
3
  */
@@ -12,12 +9,11 @@ exports.isFullRange = exports.createDefaultRange = exports.clampRange = exports.
12
9
  * @param width - Canvas width for scaling
13
10
  * @returns Object with startX and endX positions
14
11
  */
15
- const calculateHandlerPositions = (currentRange, dataLength, width) => {
12
+ export const calculateHandlerPositions = (currentRange, dataLength, width) => {
16
13
  const startX = (currentRange.start / Math.max(1, dataLength - 1)) * width;
17
14
  const endX = (currentRange.end / Math.max(1, dataLength - 1)) * width;
18
15
  return { endX, startX };
19
16
  };
20
- exports.calculateHandlerPositions = calculateHandlerPositions;
21
17
  /**
22
18
  * Converts mouse position to continuous data index
23
19
  *
@@ -26,12 +22,11 @@ exports.calculateHandlerPositions = calculateHandlerPositions;
26
22
  * @param dataLength - Total length of the dataset
27
23
  * @returns Data index
28
24
  */
29
- const mouseToDataIndex = (mouseX, width, dataLength) => {
25
+ export const mouseToDataIndex = (mouseX, width, dataLength) => {
30
26
  const relativeX = Math.max(0, Math.min(width, mouseX));
31
27
  const normalizedPosition = relativeX / width;
32
28
  return Math.round(normalizedPosition * (dataLength - 1));
33
29
  };
34
- exports.mouseToDataIndex = mouseToDataIndex;
35
30
  /**
36
31
  * Clamps a range to valid bounds
37
32
  *
@@ -40,7 +35,7 @@ exports.mouseToDataIndex = mouseToDataIndex;
40
35
  * @param minDistance - Minimum distance between start and end (default: 0.1)
41
36
  * @returns Clamped range within valid bounds
42
37
  */
43
- const clampRange = (range, dataLength, minDistance = 0.1) => {
38
+ export const clampRange = (range, dataLength, minDistance = 0.1) => {
44
39
  const clampedStart = Math.max(0, Math.min(range.start, dataLength - 1 - minDistance));
45
40
  const clampedEnd = Math.min(dataLength - 1, Math.max(range.end, clampedStart + minDistance));
46
41
  return {
@@ -48,18 +43,16 @@ const clampRange = (range, dataLength, minDistance = 0.1) => {
48
43
  start: clampedStart,
49
44
  };
50
45
  };
51
- exports.clampRange = clampRange;
52
46
  /**
53
47
  * Creates a default range for the given data length
54
48
  *
55
49
  * @param dataLength - Total length of the dataset
56
50
  * @returns Default range covering the full dataset
57
51
  */
58
- const createDefaultRange = (dataLength) => ({
52
+ export const createDefaultRange = (dataLength) => ({
59
53
  end: Math.max(0, dataLength - 1),
60
54
  start: 0,
61
55
  });
62
- exports.createDefaultRange = createDefaultRange;
63
56
  /**
64
57
  * Determines if the current range covers the full dataset.
65
58
  * According to design specs: overlay is "only visible when a range is defined".
@@ -77,7 +70,6 @@ exports.createDefaultRange = createDefaultRange;
77
70
  * isFullRange({ start: 0, end: 7 }, 10); // false - partial selection
78
71
  * ```
79
72
  */
80
- const isFullRange = (range, dataLength) => {
73
+ export const isFullRange = (range, dataLength) => {
81
74
  return range.start === 0 && range.end === dataLength - 1;
82
75
  };
83
- exports.isFullRange = isFullRange;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSelectionConfig = void 0;
4
1
  /**
5
2
  * Default configuration for ZoomArea selection area
6
3
  */
@@ -23,11 +20,10 @@ const DEFAULT_SELECTION_CONFIG = {
23
20
  * @param config - Optional user configuration
24
21
  * @returns Complete selection configuration with defaults applied
25
22
  */
26
- const getSelectionConfig = (config) => ({
23
+ export const getSelectionConfig = (config) => ({
27
24
  fill: config?.fill ?? DEFAULT_SELECTION_CONFIG.FILL,
28
25
  fillOpacity: config?.fillOpacity ?? DEFAULT_SELECTION_CONFIG.FILL_OPACITY,
29
26
  hideOverlayOnFullRange: config?.hideOverlayOnFullRange ?? DEFAULT_SELECTION_CONFIG.HIDE_OVERLAY_ON_FULL_RANGE,
30
27
  stroke: config?.stroke ?? DEFAULT_SELECTION_CONFIG.STROKE,
31
28
  strokeWidth: config?.strokeWidth ?? DEFAULT_SELECTION_CONFIG.STROKE_WIDTH,
32
29
  });
33
- exports.getSelectionConfig = getSelectionConfig;
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZoomArea = 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 calculateFocusOutline_1 = require("../../utils/calculateFocusOutline/calculateFocusOutline");
8
- const getDataFingerprint_1 = require("../../utils/getDataFingerprint/getDataFingerprint");
9
- const LineRenderer_1 = require("./components/LineRenderer");
10
- const SelectionArea_1 = require("./components/SelectionArea");
11
- const ZoomHandler_1 = require("./components/ZoomHandler");
12
- const useDragInteraction_1 = require("./hooks/useDragInteraction");
13
- const useKeyboardNavigation_1 = require("./hooks/useKeyboardNavigation");
14
- const useResponsiveCanvas_1 = require("./hooks/useResponsiveCanvas");
15
- const useZoomAreaFocus_1 = require("./hooks/useZoomAreaFocus");
16
- const useZoomData_1 = require("./hooks/useZoomData");
17
- const accessibilityLabels_1 = require("./utils/accessibilityLabels");
18
- const interactionConfig_1 = require("./utils/interactionConfig");
19
- const pathGeneration_1 = require("./utils/pathGeneration");
20
- const rangeAndPositions_1 = require("./utils/rangeAndPositions");
21
- const selectionConfig_1 = require("./utils/selectionConfig");
22
- const zoomArea_type_1 = require("./zoomArea.type");
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { SvgContainer } from '../../components/svgContainer/svgContainer';
4
+ import { getFocusConfig } from '../../utils/calculateFocusOutline/calculateFocusOutline';
5
+ import { getDataFingerprint } from '../../utils/getDataFingerprint/getDataFingerprint';
6
+ import { LineRenderer } from './components/LineRenderer';
7
+ import { SelectionArea, SelectionAreaFocusRing } from './components/SelectionArea';
8
+ import { ZoomHandler } from './components/ZoomHandler';
9
+ import { useDragInteraction } from './hooks/useDragInteraction';
10
+ import { useKeyboardNavigation } from './hooks/useKeyboardNavigation';
11
+ import { useResponsiveCanvas } from './hooks/useResponsiveCanvas';
12
+ import { useZoomAreaFocus } from './hooks/useZoomAreaFocus';
13
+ import { useZoomData } from './hooks/useZoomData';
14
+ import { generateAccessibilityLabels } from './utils/accessibilityLabels';
15
+ import { getInteractionConfig } from './utils/interactionConfig';
16
+ import { calculateLinesPathData } from './utils/pathGeneration';
17
+ import { calculateHandlerPositions } from './utils/rangeAndPositions';
18
+ import { getSelectionConfig } from './utils/selectionConfig';
19
+ import { ZoomAreaElements } from './zoomArea.type';
23
20
  /**
24
21
  * `ZoomArea` component that renders a scaled chart with draggable zoom handlers for interactive data filtering.
25
22
  *
@@ -29,56 +26,55 @@ const zoomArea_type_1 = require("./zoomArea.type");
29
26
  *
30
27
  * @returns A React functional component that renders an SVG-based zoom area with interactive handlers and accessibility features.
31
28
  */
32
- const ZoomArea = ({ ariaHidden, ariaLabel, backgroundColor, canvasConfig, // Optional - auto-calculated based on width/height if not provided
29
+ export const ZoomArea = ({ ariaHidden, ariaLabel, backgroundColor, canvasConfig, // Optional - auto-calculated based on width/height if not provided
33
30
  caption, classNames, data, focusConfig, handlerConfig, height = '40px', // 2.5rem, defined by size_400 token in Figma
34
31
  initialRange, interactionConfig, lines, onDataChange, role, screenReaderTextConfig, selectionConfig, width = '100%', xKey, ...eventHandlers }) => {
35
32
  const dataTestId = 'zoom-area';
36
33
  // Resolve interaction config with defaults
37
- const resolvedInteractionConfig = (0, interactionConfig_1.getInteractionConfig)(interactionConfig);
34
+ const resolvedInteractionConfig = getInteractionConfig(interactionConfig);
38
35
  // Resolve selection config with defaults
39
- const resolvedSelectionConfig = (0, selectionConfig_1.getSelectionConfig)(selectionConfig);
36
+ const resolvedSelectionConfig = getSelectionConfig(selectionConfig);
40
37
  // Resolve focus config with defaults
41
- const resolvedFocusConfig = (0, calculateFocusOutline_1.getFocusConfig)(focusConfig);
38
+ const resolvedFocusConfig = getFocusConfig(focusConfig);
42
39
  // Hook for core data filtering functionality
43
- const { currentRange, handleRangeChange } = (0, useZoomData_1.useZoomData)({
40
+ const { currentRange, handleRangeChange } = useZoomData({
44
41
  data,
45
42
  initialRange,
46
43
  onDataChange,
47
44
  });
48
45
  // Hook for responsive dimensions of the component when set as percentage
49
- const { parsedCanvas, viewBox } = (0, useResponsiveCanvas_1.useResponsiveCanvas)({
46
+ const { parsedCanvas, viewBox } = useResponsiveCanvas({
50
47
  canvasConfig,
51
48
  dataTestId,
52
49
  height,
53
50
  width,
54
51
  });
55
52
  // Create a fingerprint of the data/lines to avoid unnecessary updates
56
- const dataFingerprint = (0, getDataFingerprint_1.getDataFingerprint)(data);
53
+ const dataFingerprint = getDataFingerprint(data);
57
54
  const linesFingerprint = JSON.stringify(lines);
58
- const accessibilityLabels = (0, accessibilityLabels_1.generateAccessibilityLabels)(data, xKey, currentRange, screenReaderTextConfig);
55
+ const accessibilityLabels = generateAccessibilityLabels(data, xKey, currentRange, screenReaderTextConfig);
59
56
  // Memoize expensive line calculations
60
- const linesData = (0, react_1.useMemo)(() => {
61
- return (0, pathGeneration_1.calculateLinesPathData)(data, lines, parsedCanvas.width, parsedCanvas.height);
57
+ const linesData = useMemo(() => {
58
+ return calculateLinesPathData(data, lines, parsedCanvas.width, parsedCanvas.height);
62
59
  }, [dataFingerprint, linesFingerprint, parsedCanvas.width, parsedCanvas.height]);
63
60
  // Memoize handler positions calculation
64
- const { endX, startX } = (0, react_1.useMemo)(() => (0, rangeAndPositions_1.calculateHandlerPositions)(currentRange, data.length, parsedCanvas.width), [currentRange, dataFingerprint, parsedCanvas.width]);
61
+ const { endX, startX } = useMemo(() => calculateHandlerPositions(currentRange, data.length, parsedCanvas.width), [currentRange, dataFingerprint, parsedCanvas.width]);
65
62
  // Interaction hooks
66
- const { handleBlur, handleFocus, isFocused } = (0, useZoomAreaFocus_1.useZoomAreaFocus)();
67
- const { handleKeyDown } = (0, useKeyboardNavigation_1.useKeyboardNavigation)({
63
+ const { handleBlur, handleFocus, isFocused } = useZoomAreaFocus();
64
+ const { handleKeyDown } = useKeyboardNavigation({
68
65
  currentRange,
69
66
  dataLength: data.length,
70
67
  interactionConfig: resolvedInteractionConfig,
71
68
  onRangeChange: handleRangeChange,
72
69
  });
73
- const { groupRef, handleMouseDown, handleTouchStart } = (0, useDragInteraction_1.useDragInteraction)({
70
+ const { groupRef, handleMouseDown, handleTouchStart } = useDragInteraction({
74
71
  currentRange,
75
72
  dataLength: data.length,
76
73
  interactionConfig: resolvedInteractionConfig,
77
74
  onRangeChange: handleRangeChange,
78
75
  width: parsedCanvas.width,
79
76
  });
80
- return ((0, jsx_runtime_1.jsxs)(svgContainer_1.SvgContainer, { ref: groupRef, ariaHidden: ariaHidden, ariaLabel: ariaLabel, backgroundColor: backgroundColor, caption: caption, className: classNames, "data-testid": dataTestId, height: height,
77
+ return (_jsxs(SvgContainer, { ref: groupRef, ariaHidden: ariaHidden, ariaLabel: ariaLabel, backgroundColor: backgroundColor, caption: caption, className: classNames, "data-testid": dataTestId, height: height,
81
78
  // set overflow visible so handlers and focus rings are visible always
82
- overflow: "visible", role: role, viewBox: viewBox, width: width, ...eventHandlers, children: [(0, jsx_runtime_1.jsx)(LineRenderer_1.LineRenderer, { linesData: linesData }), (0, jsx_runtime_1.jsx)(SelectionArea_1.SelectionArea, { currentRange: currentRange, dataLength: data.length, dataTestId: `${dataTestId}-selection-area`, endX: endX, height: parsedCanvas.height, screenReaderText: accessibilityLabels.selectionArea, selectionConfig: resolvedSelectionConfig, startX: startX, onBlur: handleBlur, onFocus: handleFocus(zoomArea_type_1.ZoomAreaElements.SELECTION_AREA), onKeyDown: handleKeyDown(zoomArea_type_1.ZoomAreaElements.SELECTION_AREA), onMouseDown: handleMouseDown(zoomArea_type_1.ZoomAreaElements.SELECTION_AREA), onTouchStart: handleTouchStart(zoomArea_type_1.ZoomAreaElements.SELECTION_AREA) }), (0, jsx_runtime_1.jsx)(ZoomHandler_1.ZoomHandler, { dataTestId: `${dataTestId}-start-handler`, focusConfig: resolvedFocusConfig, handlerConfig: handlerConfig, height: parsedCanvas.height, isFocused: isFocused(zoomArea_type_1.ZoomAreaElements.START_HANDLER), max: currentRange.end - resolvedInteractionConfig.minHandlerDistance, min: 0, screenReaderText: accessibilityLabels.startHandler, type: zoomArea_type_1.ZoomAreaElements.START_HANDLER, value: currentRange.start, x: startX, onBlur: handleBlur, onFocus: handleFocus(zoomArea_type_1.ZoomAreaElements.START_HANDLER), onKeyDown: handleKeyDown(zoomArea_type_1.ZoomAreaElements.START_HANDLER), onMouseDown: handleMouseDown(zoomArea_type_1.ZoomAreaElements.START_HANDLER), onTouchStart: handleTouchStart(zoomArea_type_1.ZoomAreaElements.START_HANDLER) }), (0, jsx_runtime_1.jsx)(ZoomHandler_1.ZoomHandler, { dataTestId: `${dataTestId}-end-handler`, focusConfig: resolvedFocusConfig, handlerConfig: handlerConfig, height: parsedCanvas.height, isFocused: isFocused(zoomArea_type_1.ZoomAreaElements.END_HANDLER), max: data.length - 1, min: currentRange.start + resolvedInteractionConfig.minHandlerDistance, screenReaderText: accessibilityLabels.endHandler, type: zoomArea_type_1.ZoomAreaElements.END_HANDLER, value: currentRange.end, x: endX, onBlur: handleBlur, onFocus: handleFocus(zoomArea_type_1.ZoomAreaElements.END_HANDLER), onKeyDown: handleKeyDown(zoomArea_type_1.ZoomAreaElements.END_HANDLER), onMouseDown: handleMouseDown(zoomArea_type_1.ZoomAreaElements.END_HANDLER), onTouchStart: handleTouchStart(zoomArea_type_1.ZoomAreaElements.END_HANDLER) }), (0, jsx_runtime_1.jsx)(SelectionArea_1.SelectionAreaFocusRing, { endX: endX, focusConfig: resolvedFocusConfig, height: parsedCanvas.height, isFocused: isFocused(zoomArea_type_1.ZoomAreaElements.SELECTION_AREA), startX: startX })] }));
79
+ overflow: "visible", role: role, viewBox: viewBox, width: width, ...eventHandlers, children: [_jsx(LineRenderer, { linesData: linesData }), _jsx(SelectionArea, { currentRange: currentRange, dataLength: data.length, dataTestId: `${dataTestId}-selection-area`, endX: endX, height: parsedCanvas.height, screenReaderText: accessibilityLabels.selectionArea, selectionConfig: resolvedSelectionConfig, startX: startX, onBlur: handleBlur, onFocus: handleFocus(ZoomAreaElements.SELECTION_AREA), onKeyDown: handleKeyDown(ZoomAreaElements.SELECTION_AREA), onMouseDown: handleMouseDown(ZoomAreaElements.SELECTION_AREA), onTouchStart: handleTouchStart(ZoomAreaElements.SELECTION_AREA) }), _jsx(ZoomHandler, { dataTestId: `${dataTestId}-start-handler`, focusConfig: resolvedFocusConfig, handlerConfig: handlerConfig, height: parsedCanvas.height, isFocused: isFocused(ZoomAreaElements.START_HANDLER), max: currentRange.end - resolvedInteractionConfig.minHandlerDistance, min: 0, screenReaderText: accessibilityLabels.startHandler, type: ZoomAreaElements.START_HANDLER, value: currentRange.start, x: startX, onBlur: handleBlur, onFocus: handleFocus(ZoomAreaElements.START_HANDLER), onKeyDown: handleKeyDown(ZoomAreaElements.START_HANDLER), onMouseDown: handleMouseDown(ZoomAreaElements.START_HANDLER), onTouchStart: handleTouchStart(ZoomAreaElements.START_HANDLER) }), _jsx(ZoomHandler, { dataTestId: `${dataTestId}-end-handler`, focusConfig: resolvedFocusConfig, handlerConfig: handlerConfig, height: parsedCanvas.height, isFocused: isFocused(ZoomAreaElements.END_HANDLER), max: data.length - 1, min: currentRange.start + resolvedInteractionConfig.minHandlerDistance, screenReaderText: accessibilityLabels.endHandler, type: ZoomAreaElements.END_HANDLER, value: currentRange.end, x: endX, onBlur: handleBlur, onFocus: handleFocus(ZoomAreaElements.END_HANDLER), onKeyDown: handleKeyDown(ZoomAreaElements.END_HANDLER), onMouseDown: handleMouseDown(ZoomAreaElements.END_HANDLER), onTouchStart: handleTouchStart(ZoomAreaElements.END_HANDLER) }), _jsx(SelectionAreaFocusRing, { endX: endX, focusConfig: resolvedFocusConfig, height: parsedCanvas.height, isFocused: isFocused(ZoomAreaElements.SELECTION_AREA), startX: startX })] }));
83
80
  };
84
- exports.ZoomArea = ZoomArea;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZoomAreaElements = void 0;
4
1
  /**
5
2
  * Target enumeration for zoom area elements
6
3
  */
7
- exports.ZoomAreaElements = {
4
+ export const ZoomAreaElements = {
8
5
  END_HANDLER: 'END_HANDLER',
9
6
  SELECTION_AREA: 'SELECTION_AREA',
10
7
  START_HANDLER: 'START_HANDLER',
@@ -1,18 +1,2 @@
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("./useFocus/useFocus"), exports);
18
- __exportStar(require("./useHover/useHover"), exports);
1
+ export * from './useFocus/useFocus';
2
+ export * from './useHover/useHover';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFocus = void 0;
4
- const react_1 = require("react");
1
+ import { useCallback, useState } from 'react';
5
2
  /**
6
3
  * Custom React hook to manage focus state and handle focus/blur events for an element.
7
4
  *
@@ -14,16 +11,15 @@ const react_1 = require("react");
14
11
  * @param onBlur - An optional custom blur event handler of type `FocusHandler<T>`. It is called when the element loses focus.
15
12
  * @returns An object of type `UseFocusReturn<T>` containing the focus state (`isFocused`), and functions to handle focus (`handleFocus`) and blur (`handleBlur`) events.
16
13
  */
17
- const useFocus = (onFocus, onBlur) => {
18
- const [isFocused, setIsFocused] = (0, react_1.useState)(false);
19
- const handleFocus = (0, react_1.useCallback)((event) => {
14
+ export const useFocus = (onFocus, onBlur) => {
15
+ const [isFocused, setIsFocused] = useState(false);
16
+ const handleFocus = useCallback((event) => {
20
17
  setIsFocused(true);
21
18
  onFocus?.(event);
22
19
  }, [onFocus]);
23
- const handleBlur = (0, react_1.useCallback)((event) => {
20
+ const handleBlur = useCallback((event) => {
24
21
  setIsFocused(false);
25
22
  onBlur?.(event);
26
23
  }, [onBlur]);
27
24
  return { handleBlur, handleFocus, isFocused };
28
25
  };
29
- exports.useFocus = useFocus;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,4 @@
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
  /**
6
3
  * A custom hook that manages hover state and provides event handlers for mouse enter and leave events,
7
4
  * with optional custom handlers. It returns the hover state and functions to handle mouse enter and leave events,
@@ -12,13 +9,13 @@ const react_1 = require("react");
12
9
  * @param onMouseLeave - An optional custom mouse leave event handler of type `MouseHandler<T>`. It is called when the element is no longer hovered.
13
10
  * @returns An object of type `UseHoverReturn<T>` containing the hover state (`isHovered`), and functions to handle mouse enter (`handleMouseEnter`) and leave (`handleMouseLeave`) events.
14
11
  */
15
- const useHover = (onMouseEnter, onMouseLeave) => {
16
- const [isHovered, setIsHovered] = (0, react_1.useState)(false);
17
- const handleMouseEnter = (0, react_1.useCallback)((event) => {
12
+ export const useHover = (onMouseEnter, onMouseLeave) => {
13
+ const [isHovered, setIsHovered] = useState(false);
14
+ const handleMouseEnter = useCallback((event) => {
18
15
  setIsHovered(true);
19
16
  onMouseEnter?.(event);
20
17
  }, [onMouseEnter]);
21
- const handleMouseLeave = (0, react_1.useCallback)((event) => {
18
+ const handleMouseLeave = useCallback((event) => {
22
19
  setIsHovered(false);
23
20
  onMouseLeave?.(event);
24
21
  }, [onMouseLeave]);
@@ -28,4 +25,3 @@ const useHover = (onMouseEnter, onMouseLeave) => {
28
25
  isHovered,
29
26
  };
30
27
  };
31
- exports.useHover = useHover;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/dist/cjs/index.js CHANGED
@@ -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("./charts"), exports);
18
- __exportStar(require("./components"), exports);
19
- __exportStar(require("./types"), exports);
1
+ export * from './charts';
2
+ export * from './components';
3
+ export * from './types';
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultCanvasConfig = void 0;
4
1
  /**
5
2
  * Provides default configuration for a canvas element.
6
3
  *
7
4
  * This configuration sets the canvas width to 100 pixels, height to 80 pixels,
8
5
  * and includes no additional extra space around the canvas by default.
9
6
  */
10
- exports.DefaultCanvasConfig = {
7
+ export const DefaultCanvasConfig = {
11
8
  extraSpace: 0,
12
9
  height: 80,
13
10
  width: 100,
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorType = void 0;
4
- exports.ErrorType = {
1
+ export const ErrorType = {
5
2
  GENERIC: 'GENERIC',
6
3
  };
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FOCUS_DEFAULT = void 0;
4
- exports.FOCUS_DEFAULT = {
1
+ export const FOCUS_DEFAULT = {
5
2
  /** Focus ring color */
6
3
  FOCUS_COLOR: '#0078D4',
7
4
  /** Focus ring inner border */
@@ -1,20 +1,4 @@
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("./canvas.type"), exports);
18
- __exportStar(require("./errors.type"), exports);
19
- __exportStar(require("./focusConfig.type"), exports);
20
- __exportStar(require("./position.enum"), exports);
1
+ export * from './canvas.type';
2
+ export * from './errors.type';
3
+ export * from './focusConfig.type';
4
+ export * from './position.enum';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Enum for specifying the position of elements or components.
4
3
  *
@@ -8,9 +7,7 @@
8
7
  *
9
8
  * @enum {string}
10
9
  */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Positions = void 0;
13
- exports.Positions = {
10
+ export const Positions = {
14
11
  BOTTOM: 'BOTTOM',
15
12
  CENTER: 'CENTER',
16
13
  CUSTOM: 'CUSTOM',
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Unit = void 0;
4
1
  /**
5
2
  * Enumeration representing units of measurement that need some transformation to pixels (px).
6
3
  *
@@ -8,7 +5,7 @@ exports.Unit = void 0;
8
5
  * @property {string} PERCENTAGE - Represents a percentage unit ('%').
9
6
  * @property {string} REM - Represents a rem unit ('rem')
10
7
  */
11
- exports.Unit = {
8
+ export const Unit = {
12
9
  PERCENTAGE: '%',
13
10
  REM: 'rem',
14
11
  };
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ajustedTextSpace = void 0;
4
- const ajustedTextSpace = (textAnchor, value, extra) => {
1
+ export const ajustedTextSpace = (textAnchor, value, extra) => {
5
2
  let ajusted = 0;
6
3
  switch (textAnchor) {
7
4
  case 'middle':
@@ -16,4 +13,3 @@ const ajustedTextSpace = (textAnchor, value, extra) => {
16
13
  }
17
14
  return ajusted;
18
15
  };
19
- exports.ajustedTextSpace = ajustedTextSpace;
@@ -1,12 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildError = exports.ErrorsRecord = exports.BuildError = void 0;
4
- exports.BuildError = {
1
+ export const BuildError = {
5
2
  INVALID_X_TICK: 'INVALID_X_TICK',
6
3
  };
7
4
  const INVALID_X_TICK_ERROR = '[getXTicks] Invalid X tick values calculated';
8
- exports.ErrorsRecord = {
5
+ export const ErrorsRecord = {
9
6
  INVALID_X_TICK: new Error(INVALID_X_TICK_ERROR),
10
7
  };
11
- const buildError = (error) => exports.ErrorsRecord[error];
12
- exports.buildError = buildError;
8
+ export const buildError = (error) => ErrorsRecord[error];
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildTickValues = exports.getDivisor = void 0;
4
1
  /**
5
2
  * Returns the divisor for a given number.
6
3
  * The divisor is determined based on the number's divisibility by 2, 3, 4, or 5.
@@ -9,7 +6,7 @@ exports.buildTickValues = exports.getDivisor = void 0;
9
6
  * @param number - The number for which to determine the divisor.
10
7
  * @returns The divisor for the given number.
11
8
  */
12
- const getDivisor = (number) => {
9
+ export const getDivisor = (number) => {
13
10
  if (number % 3 === 0) {
14
11
  return 3;
15
12
  }
@@ -24,7 +21,6 @@ const getDivisor = (number) => {
24
21
  }
25
22
  return 1;
26
23
  };
27
- exports.getDivisor = getDivisor;
28
24
  /**
29
25
  * Builds the tick values for YAxis of a chart based on the provided data.
30
26
  * This is a fallback function that is used just in case no tickValues are provided as prop
@@ -33,7 +29,7 @@ exports.getDivisor = getDivisor;
33
29
  * @param data - An array of string values representing the data points.
34
30
  * @returns An object containing the numeric fallback tickValues for the YAxis of the chart.
35
31
  */
36
- const buildTickValues = (data) => {
32
+ export const buildTickValues = (data) => {
37
33
  if (data.length === 0) {
38
34
  return { numeric: { max: 2, min: 0, step: 1 } };
39
35
  }
@@ -49,4 +45,3 @@ const buildTickValues = (data) => {
49
45
  },
50
46
  };
51
47
  };
52
- exports.buildTickValues = buildTickValues;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFocusConfig = exports.calculateFocusOutline = void 0;
4
- const focusConfig_type_1 = require("../../types/focusConfig.type");
1
+ import { FOCUS_DEFAULT } from '../../types/focusConfig.type';
5
2
  /**
6
3
  * Calculates the dimensions of the focus outlines (outer and inner) for an SVG element.
7
4
  * Supports elements with different width and height dimensions.
@@ -9,7 +6,7 @@ const focusConfig_type_1 = require("../../types/focusConfig.type");
9
6
  * @param config - Configuration for the calculation.
10
7
  * @returns Object with the dimensions and positions of the outer and inner rectangles.
11
8
  */
12
- const calculateFocusOutline = ({ elementHeight, elementPosition, elementStrokeWidth = 0, elementType, elementWidth, gap = 0, innerStrokeWidth = 2, outlineStrokeWidth = 2, }) => {
9
+ export const calculateFocusOutline = ({ elementHeight, elementPosition, elementStrokeWidth = 0, elementType, elementWidth, gap = 0, innerStrokeWidth = 2, outlineStrokeWidth = 2, }) => {
13
10
  if (elementType === 'circle') {
14
11
  // For circles, work with radius
15
12
  const elementRadius = elementWidth / 2;
@@ -71,15 +68,13 @@ const calculateFocusOutline = ({ elementHeight, elementPosition, elementStrokeWi
71
68
  type: 'rectangle',
72
69
  };
73
70
  };
74
- exports.calculateFocusOutline = calculateFocusOutline;
75
71
  /**
76
72
  * Helper function to get focus complete config
77
73
  */
78
- const getFocusConfig = (focusConfig) => ({
79
- gap: focusConfig?.gap ?? focusConfig_type_1.FOCUS_DEFAULT.OUTLINES_GAP,
80
- innerColor: focusConfig?.innerColor ?? focusConfig_type_1.FOCUS_DEFAULT.FOCUS_INNER,
81
- innerStrokeWidth: focusConfig?.innerStrokeWidth ?? focusConfig_type_1.FOCUS_DEFAULT.INNER_FOCUS_STROKE_WIDTH,
82
- outlineColor: focusConfig?.outlineColor ?? focusConfig_type_1.FOCUS_DEFAULT.FOCUS_COLOR,
83
- outlineStrokeWidth: focusConfig?.outlineStrokeWidth ?? focusConfig_type_1.FOCUS_DEFAULT.OUTER_FOCUS_STROKE_WIDTH,
74
+ export const getFocusConfig = (focusConfig) => ({
75
+ gap: focusConfig?.gap ?? FOCUS_DEFAULT.OUTLINES_GAP,
76
+ innerColor: focusConfig?.innerColor ?? FOCUS_DEFAULT.FOCUS_INNER,
77
+ innerStrokeWidth: focusConfig?.innerStrokeWidth ?? FOCUS_DEFAULT.INNER_FOCUS_STROKE_WIDTH,
78
+ outlineColor: focusConfig?.outlineColor ?? FOCUS_DEFAULT.FOCUS_COLOR,
79
+ outlineStrokeWidth: focusConfig?.outlineStrokeWidth ?? FOCUS_DEFAULT.OUTER_FOCUS_STROKE_WIDTH,
84
80
  });
85
- exports.getFocusConfig = getFocusConfig;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.classNames = void 0;
4
1
  /**
5
2
  * Generates a string of class names based on the provided arguments.
6
3
  * Each argument can be:
@@ -11,7 +8,7 @@ exports.classNames = void 0;
11
8
  * @param args - A rest parameter that accepts an array of strings, arrays of strings, or objects with string keys and boolean values.
12
9
  * @returns A string of class names, separated by spaces.
13
10
  */
14
- const classNames = (...args) => {
11
+ export const classNames = (...args) => {
15
12
  return args
16
13
  .flatMap(arg => {
17
14
  if (typeof arg === 'string') {
@@ -26,4 +23,3 @@ const classNames = (...args) => {
26
23
  })
27
24
  .join(' ');
28
25
  };
29
- exports.classNames = classNames;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cssGradientToSVG = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
5
2
  /**
6
3
  * Converts a CSS linear gradient string into an SVG linear gradient.
7
4
  *
@@ -21,7 +18,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
21
18
  * CSS gradient string. If the angle is not supported, it returns an empty
22
19
  * React fragment.
23
20
  */
24
- const cssGradientToSVG = (cssGradient, id = 'gradientePath') => {
21
+ export const cssGradientToSVG = (cssGradient, id = 'gradientePath') => {
25
22
  const parts = cssGradient.split(',').map(part => part.trim());
26
23
  const angle = parseInt(parts[0], 10); // Extract the angle
27
24
  const stops = parts.slice(1).map(part => {
@@ -43,8 +40,7 @@ const cssGradientToSVG = (cssGradient, id = 'gradientePath') => {
43
40
  default:
44
41
  // eslint-disable-next-line no-console
45
42
  console.error('Unsupported angle');
46
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}); // Return an empty fragment for unsupported angles
43
+ return _jsx(_Fragment, {}); // Return an empty fragment for unsupported angles
47
44
  }
48
- return ((0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("linearGradient", { id: id, x1: x1, x2: x2, y1: y1, y2: y2, children: stops.map((stop, index) => ((0, jsx_runtime_1.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, `${index}-${stop.offset}`.toString()))) }) }));
45
+ return (_jsx("defs", { children: _jsx("linearGradient", { id: id, x1: x1, x2: x2, y1: y1, y2: y2, children: stops.map((stop, index) => (_jsx("stop", { offset: stop.offset, stopColor: stop.color }, `${index}-${stop.offset}`.toString()))) }) }));
49
46
  };
50
- exports.cssGradientToSVG = cssGradientToSVG;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNear = void 0;
4
- const isNear = (cursor, position, extraArea = 1) => {
1
+ export const isNear = (cursor, position, extraArea = 1) => {
5
2
  return cursor >= position - extraArea && cursor <= position + extraArea;
6
3
  };
7
- exports.isNear = isNear;