@kubit-ui-web/react-charts 1.9.0 → 1.11.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 (155) hide show
  1. package/dist/cjs/charts/barChart/barChart.type.d.ts +8 -0
  2. package/dist/cjs/charts/barChart/barChart.type.d.ts.map +1 -1
  3. package/dist/cjs/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
  4. package/dist/cjs/charts/barChart/fragments/barChartPath.js +2 -2
  5. package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
  6. package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
  7. package/dist/cjs/charts/customBackgroundChart/context/customBackgroundChartContext.js +3 -0
  8. package/dist/cjs/charts/customBackgroundChart/context/index.d.ts +2 -0
  9. package/dist/cjs/charts/customBackgroundChart/context/index.d.ts.map +1 -0
  10. package/dist/cjs/charts/customBackgroundChart/context/index.js +1 -0
  11. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
  12. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
  13. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.js +7 -0
  14. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
  15. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
  16. package/dist/cjs/charts/customBackgroundChart/customBackgroundChart.type.js +1 -0
  17. package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
  18. package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
  19. package/dist/cjs/charts/customBackgroundChart/customBackgroundChartStructure.js +41 -0
  20. package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
  21. package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
  22. package/dist/cjs/charts/customBackgroundChart/fragments/customBackgroundChartPlot.js +49 -0
  23. package/dist/cjs/charts/customBackgroundChart/fragments/index.d.ts +2 -0
  24. package/dist/cjs/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
  25. package/dist/cjs/charts/customBackgroundChart/fragments/index.js +1 -0
  26. package/dist/cjs/charts/customBackgroundChart/index.d.ts +2 -0
  27. package/dist/cjs/charts/customBackgroundChart/index.d.ts.map +1 -0
  28. package/dist/cjs/charts/customBackgroundChart/index.js +1 -0
  29. package/dist/cjs/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
  30. package/dist/cjs/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
  31. package/dist/cjs/charts/customBackgroundChart/utils/accessibility.js +32 -0
  32. package/dist/cjs/charts/index.d.ts +1 -0
  33. package/dist/cjs/charts/index.d.ts.map +1 -1
  34. package/dist/cjs/charts/index.js +1 -0
  35. package/dist/cjs/components/bar/bar.d.ts.map +1 -1
  36. package/dist/cjs/components/bar/bar.js +6 -3
  37. package/dist/cjs/components/bar/bar.type.d.ts +9 -0
  38. package/dist/cjs/components/bar/bar.type.d.ts.map +1 -1
  39. package/dist/cjs/components/path/path.d.ts.map +1 -1
  40. package/dist/cjs/components/path/path.js +24 -11
  41. package/dist/cjs/components/path/path.types.d.ts +9 -0
  42. package/dist/cjs/components/path/path.types.d.ts.map +1 -1
  43. package/dist/cjs/components/plot/plot.d.ts.map +1 -1
  44. package/dist/cjs/components/plot/plot.js +21 -3
  45. package/dist/cjs/types/errors.type.d.ts +2 -0
  46. package/dist/cjs/types/errors.type.d.ts.map +1 -1
  47. package/dist/cjs/types/errors.type.js +3 -0
  48. package/dist/cjs/types/focusConfig.type.d.ts +13 -7
  49. package/dist/cjs/types/focusConfig.type.d.ts.map +1 -1
  50. package/dist/cjs/types/focusConfig.type.js +3 -3
  51. package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
  52. package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
  53. package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.js +27 -0
  54. package/dist/cjs/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
  55. package/dist/cjs/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
  56. package/dist/cjs/utils/adaptLegacyFocusConfig/index.js +1 -0
  57. package/dist/esm/charts/barChart/barChart.type.d.ts +8 -0
  58. package/dist/esm/charts/barChart/barChart.type.d.ts.map +1 -1
  59. package/dist/esm/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
  60. package/dist/esm/charts/barChart/fragments/barChartPath.js +2 -2
  61. package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
  62. package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
  63. package/dist/esm/charts/customBackgroundChart/context/customBackgroundChartContext.js +3 -0
  64. package/dist/esm/charts/customBackgroundChart/context/index.d.ts +2 -0
  65. package/dist/esm/charts/customBackgroundChart/context/index.d.ts.map +1 -0
  66. package/dist/esm/charts/customBackgroundChart/context/index.js +1 -0
  67. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
  68. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
  69. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.js +7 -0
  70. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
  71. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
  72. package/dist/esm/charts/customBackgroundChart/customBackgroundChart.type.js +1 -0
  73. package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
  74. package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
  75. package/dist/esm/charts/customBackgroundChart/customBackgroundChartStructure.js +41 -0
  76. package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
  77. package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
  78. package/dist/esm/charts/customBackgroundChart/fragments/customBackgroundChartPlot.js +49 -0
  79. package/dist/esm/charts/customBackgroundChart/fragments/index.d.ts +2 -0
  80. package/dist/esm/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
  81. package/dist/esm/charts/customBackgroundChart/fragments/index.js +1 -0
  82. package/dist/esm/charts/customBackgroundChart/index.d.ts +2 -0
  83. package/dist/esm/charts/customBackgroundChart/index.d.ts.map +1 -0
  84. package/dist/esm/charts/customBackgroundChart/index.js +1 -0
  85. package/dist/esm/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
  86. package/dist/esm/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
  87. package/dist/esm/charts/customBackgroundChart/utils/accessibility.js +32 -0
  88. package/dist/esm/charts/index.d.ts +1 -0
  89. package/dist/esm/charts/index.d.ts.map +1 -1
  90. package/dist/esm/charts/index.js +1 -0
  91. package/dist/esm/components/bar/bar.d.ts.map +1 -1
  92. package/dist/esm/components/bar/bar.js +6 -3
  93. package/dist/esm/components/bar/bar.type.d.ts +9 -0
  94. package/dist/esm/components/bar/bar.type.d.ts.map +1 -1
  95. package/dist/esm/components/path/path.d.ts.map +1 -1
  96. package/dist/esm/components/path/path.js +24 -11
  97. package/dist/esm/components/path/path.types.d.ts +9 -0
  98. package/dist/esm/components/path/path.types.d.ts.map +1 -1
  99. package/dist/esm/components/plot/plot.d.ts.map +1 -1
  100. package/dist/esm/components/plot/plot.js +21 -3
  101. package/dist/esm/types/errors.type.d.ts +2 -0
  102. package/dist/esm/types/errors.type.d.ts.map +1 -1
  103. package/dist/esm/types/errors.type.js +3 -0
  104. package/dist/esm/types/focusConfig.type.d.ts +13 -7
  105. package/dist/esm/types/focusConfig.type.d.ts.map +1 -1
  106. package/dist/esm/types/focusConfig.type.js +3 -3
  107. package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
  108. package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
  109. package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.js +27 -0
  110. package/dist/esm/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
  111. package/dist/esm/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
  112. package/dist/esm/utils/adaptLegacyFocusConfig/index.js +1 -0
  113. package/dist/kubit-ui-web-react-charts.cjs.js +1 -1
  114. package/dist/kubit-ui-web-react-charts.es.js +1 -1
  115. package/dist/kubit-ui-web-react-charts.umd.js +1 -1
  116. package/dist/react-charts.css +1 -1
  117. package/dist/types/charts/barChart/barChart.type.d.ts +8 -0
  118. package/dist/types/charts/barChart/barChart.type.d.ts.map +1 -1
  119. package/dist/types/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
  120. package/dist/types/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts +3 -0
  121. package/dist/types/charts/customBackgroundChart/context/customBackgroundChartContext.d.ts.map +1 -0
  122. package/dist/types/charts/customBackgroundChart/context/index.d.ts +2 -0
  123. package/dist/types/charts/customBackgroundChart/context/index.d.ts.map +1 -0
  124. package/dist/types/charts/customBackgroundChart/customBackgroundChart.d.ts +6 -0
  125. package/dist/types/charts/customBackgroundChart/customBackgroundChart.d.ts.map +1 -0
  126. package/dist/types/charts/customBackgroundChart/customBackgroundChart.type.d.ts +50 -0
  127. package/dist/types/charts/customBackgroundChart/customBackgroundChart.type.d.ts.map +1 -0
  128. package/dist/types/charts/customBackgroundChart/customBackgroundChartStructure.d.ts +4 -0
  129. package/dist/types/charts/customBackgroundChart/customBackgroundChartStructure.d.ts.map +1 -0
  130. package/dist/types/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts +4 -0
  131. package/dist/types/charts/customBackgroundChart/fragments/customBackgroundChartPlot.d.ts.map +1 -0
  132. package/dist/types/charts/customBackgroundChart/fragments/index.d.ts +2 -0
  133. package/dist/types/charts/customBackgroundChart/fragments/index.d.ts.map +1 -0
  134. package/dist/types/charts/customBackgroundChart/index.d.ts +2 -0
  135. package/dist/types/charts/customBackgroundChart/index.d.ts.map +1 -0
  136. package/dist/types/charts/customBackgroundChart/utils/accessibility.d.ts +19 -0
  137. package/dist/types/charts/customBackgroundChart/utils/accessibility.d.ts.map +1 -0
  138. package/dist/types/charts/index.d.ts +1 -0
  139. package/dist/types/charts/index.d.ts.map +1 -1
  140. package/dist/types/components/bar/bar.d.ts.map +1 -1
  141. package/dist/types/components/bar/bar.type.d.ts +9 -0
  142. package/dist/types/components/bar/bar.type.d.ts.map +1 -1
  143. package/dist/types/components/path/path.d.ts.map +1 -1
  144. package/dist/types/components/path/path.types.d.ts +9 -0
  145. package/dist/types/components/path/path.types.d.ts.map +1 -1
  146. package/dist/types/components/plot/plot.d.ts.map +1 -1
  147. package/dist/types/types/errors.type.d.ts +2 -0
  148. package/dist/types/types/errors.type.d.ts.map +1 -1
  149. package/dist/types/types/focusConfig.type.d.ts +13 -7
  150. package/dist/types/types/focusConfig.type.d.ts.map +1 -1
  151. package/dist/types/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
  152. package/dist/types/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
  153. package/dist/types/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
  154. package/dist/types/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
  155. package/package.json +1 -1
@@ -3,7 +3,10 @@ import { Path } from '../path/path';
3
3
  import { buildAriaLabel } from './utils/accessibility';
4
4
  import { buildD } from './utils/buildD';
5
5
  import { getSegments } from './utils/getSegments';
6
- export const Bar = ({ barConfig, currentBars, endRounded, extraSpacing = 0, order = 1, orientation, startRounded, x1, x2, y1, y2,
6
+ export const Bar = ({ barConfig, currentBars, endRounded, extraSpacing = 0, focusConfig = {
7
+ stroke: '#0078D4',
8
+ strokeWidth: 0.2,
9
+ }, onBlur, onFocus, order = 1, orientation, startRounded, tabIndex = 0, x1, x2, y1, y2,
7
10
  // Allow to build a11y aria-labels with templates
8
11
  dataKey, xKey, yKey, xData, yData, }) => {
9
12
  const { barWidth, singleConfig } = barConfig;
@@ -33,9 +36,9 @@ dataKey, xKey, yKey, xData, yData, }) => {
33
36
  yData,
34
37
  coverage: singleProps.coverage,
35
38
  index,
36
- }), d: d, fill: color, hoverConfig: {
39
+ }), d: d, fill: color, focusConfig: focusConfig, hoverConfig: {
37
40
  stroke: 'transparent',
38
41
  strokeWidth: '0',
39
- }, stroke: "transparent", ...singleProps }, `${index.toString()}`));
42
+ }, stroke: "transparent", tabIndex: tabIndex, onBlur: onBlur, onFocus: onFocus, ...singleProps }, `${index.toString()}`));
40
43
  }) }));
41
44
  };
@@ -1,4 +1,5 @@
1
1
  import type { AriaAttributes, HTMLAttributes } from 'react';
2
+ import type { StyleProps } from '../../components/path/path.types';
2
3
  export declare const BarOrientation: {
3
4
  readonly HORIZONTAL: "HORIZONTAL";
4
5
  readonly VERTICAL: "VERTICAL";
@@ -31,6 +32,14 @@ export interface BarProps {
31
32
  y2: number;
32
33
  startRounded?: number;
33
34
  endRounded?: number;
35
+ /**
36
+ * @deprecated In the next major version, this prop will use a more restrictive interface
37
+ * based on FocusConfig type. Other StyleProps fields are currently ignored.
38
+ */
39
+ focusConfig?: StyleProps;
40
+ tabIndex?: number;
41
+ onFocus?: (event: React.FocusEvent<SVGPathElement>) => void;
42
+ onBlur?: (event: React.FocusEvent<SVGPathElement>) => void;
34
43
  dataKey?: string;
35
44
  xKey?: string;
36
45
  yKey?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"bar.type.d.ts","sourceRoot":"","sources":["../../../../src/components/bar/bar.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,UAAU,cAAc;IACtB,CAAC,GA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AE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC5D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAE3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC;IAC1E,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/components/path/path.tsx"],"names":[],"mappings":"AAiBA,OAAO,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA4M9C,eAAO,MAAM,IAAI,+FAA4B,CAAC"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/components/path/path.tsx"],"names":[],"mappings":"AAoBA,OAAO,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkO9C,eAAO,MAAM,IAAI,+FAA4B,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useImperativeHandle, useRef, } from 'react';
3
+ import { FocusRing } from '../../components/focusRing/focusRing';
3
4
  import { useFocus } from '../../hooks/useFocus/useFocus';
4
5
  import { useHover } from '../../hooks/useHover/useHover';
6
+ import { adaptLegacyFocusConfig } from '../../utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig';
5
7
  import { cssGradientToSVG } from '../../utils/cssGradientToSvg/cssGradientToSvg';
6
8
  import { pickCustomAttributes } from '../../utils/pickCustomAttributes/pickCustomAttributes';
7
9
  import { ShadowSvg } from '../../utils/shadowSvg/shadowSvg';
@@ -15,7 +17,7 @@ const ENTER = {
15
17
  };
16
18
  const SHADOW_FILTER_ID = 'shadow';
17
19
  /**
18
- * Represents a customizable SVG path component in
20
+ * Represents a customizable SVG path component with FocusRing integration
19
21
  *
20
22
  * This component renders an SVG path with various customizable properties such as fill color, stroke color, and stroke width.
21
23
  * It supports dynamic SVG gradients through a utility function, interactive event handlers, and accessibility features.
@@ -26,7 +28,8 @@ const SHADOW_FILTER_ID = 'shadow';
26
28
  * @param {string} [props.gradient] - A CSS gradient string that will be converted to an SVG gradient.
27
29
  * @param {string | number} [props.dataValue] - The value of the represented data.
28
30
  * @param {string} [props.d] - The SVG path data string.
29
- * @param {number} [props.tabIndex] - The tab index for keyboard navigation.
31
+ * @param {number} [props.tabIndex=0] - The tab index for keyboard navigation. Defaults to 0 (focusable). Set to -1 to exclude from tab order.
32
+ * @param {FocusConfig} [props.focusConfig] - Configuration for the focus ring appearance and behavior. Defaults to adaptive variant.
30
33
  * @param {Function} [props.onClick] - Click event handler.
31
34
  * @param {Function} [props.onMouseEnter] - Mouse enter event handler.
32
35
  * @param {Function} [props.onMouseLeave] - Mouse leave event handler.
@@ -43,16 +46,26 @@ const SHADOW_FILTER_ID = 'shadow';
43
46
  * @param {Array} [props.points] - An array of points for rendering nodes along the path.
44
47
  * @param {Object} [props.nodeConfig] - Configuration for the nodes.
45
48
  *
46
- * @returns {ReactElement} A React element representing the SVG path.
49
+ * @returns {ReactElement} A React element representing the SVG path with FocusRing.
47
50
  */
48
- const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000FF', strokeWidth = '1', focusConfig = {
51
+ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000FF',
52
+ // NOTE: Default strokeWidth='1' affects FocusRing calculations in adaptive variant.
53
+ // FocusRing adds originalStrokeWidth to focus ring widths. If using fill-only paths
54
+ // (like Bar), pass strokeWidth="0" explicitly to avoid inflated focus rings.
55
+ strokeWidth = '1', focusConfig, hoverConfig = {
49
56
  stroke: '#0000FF',
50
57
  strokeWidth: '0.5',
51
- }, hoverConfig = {
52
- stroke: '#0000FF',
53
- strokeWidth: '0.5',
54
- }, role = 'img', ...props }, ref) => {
58
+ }, role = 'img', tabIndex = 0, // Default to 0 for keyboard accessibility
59
+ ...props }, ref) => {
55
60
  const { handleBlur, handleFocus, isFocused } = useFocus(props.onFocus, props.onBlur);
61
+ /**
62
+ * Translate StyleProps focusConfig to FocusConfig for FocusRing component.
63
+ * Maps: stroke → outlineColor, strokeWidth → outlineStrokeWidth
64
+ *
65
+ * @deprecated This adapter will be removed in the next major version when
66
+ * focusConfig prop uses FocusConfig type directly.
67
+ */
68
+ const resolvedFocusConfig = adaptLegacyFocusConfig(focusConfig);
56
69
  const { handleMouseEnter, handleMouseLeave, isHovered } = useHover(props.onMouseEnter, props.onMouseLeave);
57
70
  const pathRef = useRef(null);
58
71
  const nodeRef = useRef([]);
@@ -85,7 +98,7 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
85
98
  const gradientSvgElement = props.gradient && cssGradientToSVG(props.gradient);
86
99
  // Extract custom data-* and aria-* attributes
87
100
  const customAttributes = pickCustomAttributes(props);
88
- // Merge props to include focus and hover styles
101
+ // Merge props to include hover styles (focus is now handled by FocusRing)
89
102
  const defaultProps = {
90
103
  ...props,
91
104
  classNames: `path ${classNames}`,
@@ -94,13 +107,13 @@ const PathComponent = ({ classNames = '', fill = 'transparent', stroke = '#0000F
94
107
  role,
95
108
  stroke,
96
109
  strokeWidth,
110
+ tabIndex,
97
111
  };
98
112
  const mergedProps = {
99
113
  ...defaultProps,
100
- ...(isFocused && focusConfig),
101
114
  ...(isHovered && hoverConfig),
102
115
  };
103
- return (_jsxs("g", { ref: mainRef, children: [gradientSvgElement && gradientSvgElement, mergedProps.shadowSvgConfig && (_jsx(ShadowSvg, { id: SHADOW_FILTER_ID, shadowSvgConfig: mergedProps.shadowSvgConfig })), _jsxs("g", { "aria-label": mergedProps.ariaLabel, className: mergedProps.classNames, "data-draw": true, filter: mergedProps.shadowSvgConfig && mergedProps.filter, opacity: mergedProps.opacity, orientation: mergedProps.orientation, role: mergedProps.role, rotate: mergedProps.rotate, tabIndex: mergedProps.tabIndex, transform: mergedProps.transform, visibility: mergedProps.visibility, ...customAttributes, onBlur: handleBlur, onClick: handleClick, onDoubleClick: handleDoubleClick, onFocus: handleFocus, onKeyDown: handleKeyDown, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("path", { ref: pathRef, d: mergedProps.d, "data-testid": mergedProps.dataTestId, fill: mergedProps.dFill ? 'transparent' : mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule, stroke: mergedProps.stroke, strokeDasharray: mergedProps.strokeDasharray, strokeDashoffset: mergedProps.strokeDashoffset, strokeLinecap: mergedProps.strokeLinecap, strokeLinejoin: mergedProps.strokeLinejoin, strokeMiterlimit: mergedProps.strokeMiterlimit, strokeOpacity: mergedProps.strokeOpacity, strokeWidth: mergedProps.strokeWidth, children: mergedProps.title && _jsx("title", { children: mergedProps.title }) }), mergedProps.dFill && (_jsx("path", { d: mergedProps.dFill, fill: mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule }))] }), mergedProps.points &&
116
+ return (_jsxs("g", { ref: mainRef, children: [gradientSvgElement && gradientSvgElement, mergedProps.shadowSvgConfig && (_jsx(ShadowSvg, { id: SHADOW_FILTER_ID, shadowSvgConfig: mergedProps.shadowSvgConfig })), _jsx(FocusRing, { dataTestId: `${mergedProps.dataTestId}-focus-ring`, focusConfig: resolvedFocusConfig, isFocused: isFocused, targetRef: pathRef }), _jsxs("g", { "aria-label": mergedProps.ariaLabel, className: mergedProps.classNames, "data-draw": true, filter: mergedProps.shadowSvgConfig && mergedProps.filter, opacity: mergedProps.opacity, orientation: mergedProps.orientation, role: mergedProps.role, rotate: mergedProps.rotate, tabIndex: mergedProps.tabIndex, transform: mergedProps.transform, visibility: mergedProps.visibility, ...customAttributes, onBlur: handleBlur, onClick: handleClick, onDoubleClick: handleDoubleClick, onFocus: handleFocus, onKeyDown: handleKeyDown, onMouseDown: handleMouseDown, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("path", { ref: pathRef, d: mergedProps.d, "data-testid": mergedProps.dataTestId, fill: mergedProps.dFill ? 'transparent' : mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule, stroke: mergedProps.stroke, strokeDasharray: mergedProps.strokeDasharray, strokeDashoffset: mergedProps.strokeDashoffset, strokeLinecap: mergedProps.strokeLinecap, strokeLinejoin: mergedProps.strokeLinejoin, strokeMiterlimit: mergedProps.strokeMiterlimit, strokeOpacity: mergedProps.strokeOpacity, strokeWidth: mergedProps.strokeWidth, children: mergedProps.title && _jsx("title", { children: mergedProps.title }) }), mergedProps.dFill && (_jsx("path", { d: mergedProps.dFill, fill: mergedProps.fill, fillOpacity: mergedProps.fillOpacity, fillRule: mergedProps.fillRule }))] }), mergedProps.points &&
104
117
  mergedProps.nodeConfig &&
105
118
  mergedProps.points.map(([x, y], index) => {
106
119
  const nodeData = {
@@ -45,6 +45,15 @@ export interface PathProps extends StyleProps, AriaAttributes, DataAttributes {
45
45
  classNames?: string;
46
46
  gradient?: string;
47
47
  shadowSvgConfig?: ShadowSvgConfig;
48
+ /**
49
+ * Focus styling configuration.
50
+ * Uses StyleProps interface - internally translated to FocusRing configuration.
51
+ * Only `stroke` and `strokeWidth` are mapped to the FocusRing component
52
+ * (stroke → outlineColor, strokeWidth → outlineStrokeWidth).
53
+ *
54
+ * @deprecated In the next major version, this prop will use a more restrictive interface
55
+ * based on FocusConfig type. Other StyleProps fields are currently ignored.
56
+ */
48
57
  focusConfig?: StyleProps;
49
58
  hoverConfig?: StyleProps;
50
59
  dataValue?: string | number | IDataPoint[];
@@ -1 +1 @@
1
- {"version":3,"file":"path.types.d.ts","sourceRoot":"","sources":["../../../../src/components/path/path.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,UAAU,UAAU;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,GAAG,M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UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC5D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3D,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CACjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../../../src/components/plot/plot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,OAAO,CAAC;AAStD,OAAO,YAAY,CAAC;AACpB,OAAO,EAAiB,KAAK,SAAS,EAAsB,MAAM,cAAc,CAAC;AA2GjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,IAAI,EAAgC,CAAC,CAAC,GAAG,MAAM,EAC1D,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG;IACpB,GAAG,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;CAChC,KACE,GAAG,CAAC,OAAO,CAAC"}
1
+ {"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../../../src/components/plot/plot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,OAAO,CAAC;AAStD,OAAO,YAAY,CAAC;AACpB,OAAO,EAAiB,KAAK,SAAS,EAAsB,MAAM,cAAc,CAAC;AAiIjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,IAAI,EAAgC,CAAC,CAAC,GAAG,MAAM,EAC1D,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG;IACpB,GAAG,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;CAChC,KACE,GAAG,CAAC,OAAO,CAAC"}
@@ -8,6 +8,9 @@ import { Square } from './components/square/square';
8
8
  import { Triangle } from './components/triangle/triangle';
9
9
  import './plot.css';
10
10
  import { PLOT_SIZE_MAP, PlotSize, PlotType } from './plot.types';
11
+ // The centroid of a triangle is at 1/3 of the height from the base.
12
+ // When scaling, we need to compensate by (scaledSize - originalSize) / 6 to align centroids.
13
+ const TRIANGLE_CENTROID_OFFSET_DIVISOR = 6;
11
14
  // Map of components by type
12
15
  const Component = {
13
16
  [PlotType.CIRCLE]: Circle,
@@ -17,6 +20,13 @@ const Component = {
17
20
  const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity, focusConfig, hasHoverEffect, hoverConfig, id, label, onBlur, onClick, onFocus, onKeyDown, onMouseEnter, onMouseLeave, opacity, position = { x: 0, y: 0 }, size = PlotSize.MEDIUM, stroke, strokeWidth, tabIndex, type = PlotType.CIRCLE, ...props }, ref) => {
18
21
  const { handleMouseEnter, handleMouseLeave, isHovered } = useHover(onMouseEnter, onMouseLeave);
19
22
  const { handleBlur, handleFocus, isFocused } = useFocus(onFocus, onBlur);
23
+ const handleKeyDown = event => {
24
+ if (onClick && (event.key === 'Enter' || event.key === ' ')) {
25
+ event.preventDefault();
26
+ onClick(event);
27
+ }
28
+ onKeyDown?.(event);
29
+ };
20
30
  // Extract properties from hoverConfig with default values
21
31
  const { fill: hoverFill = fill, opacity: hoverOpacity = 0.3, scale: hoverScale = 1.3, stroke: hoverStroke = fill, strokeWidth: hoverStrokeWidth = 0, } = hoverConfig || {};
22
32
  // Calculate size in pixels
@@ -33,7 +43,7 @@ const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity
33
43
  onBlur: handleBlur,
34
44
  onClick,
35
45
  onFocus: handleFocus,
36
- onKeyDown,
46
+ onKeyDown: handleKeyDown,
37
47
  onMouseEnter: handleMouseEnter,
38
48
  onMouseLeave: handleMouseLeave,
39
49
  opacity, // Maintains original overall opacity
@@ -41,12 +51,20 @@ const PlotComponent = ({ className, data, dataTestId = 'plot', fill, fillOpacity
41
51
  role: 'button',
42
52
  size: sizeInPixels,
43
53
  stroke, // Maintains original stroke color
44
- strokeWidth: hasHoverEffect && isHovered ? 0 : strokeWidth, // Removed isFocused dependency
54
+ strokeWidth: hasHoverEffect && isHovered && !isFocused ? 0 : strokeWidth,
45
55
  tabIndex,
46
56
  };
47
57
  // Get the correct component based on type
48
58
  const PlotShape = Component[type];
49
- return (_jsxs(_Fragment, { children: [hasHoverEffect && isHovered && !isFocused && (_jsx(PlotShape, { dataTestId: `${dataTestId}-hover`, fill: hoverFill, opacity: hoverOpacity, position: position, size: sizeInPixels * hoverScale, stroke: hoverStroke, strokeWidth: hoverStrokeWidth })), _jsx(FocusRing, { dataTestId: dataTestId, focusConfig: { ...focusConfig, variant: focusConfig?.variant ?? 'bounding-box' }, isFocused: isFocused, children: _jsx(PlotShape, { ref: ref, ...plotShapeProps }) })] }));
59
+ // Calculate hover position with vertical offset for triangles
60
+ // Triangles need compensation because their centroid is not at the geometric center
61
+ const hoverPosition = type === PlotType.TRIANGLE
62
+ ? {
63
+ x: position.x,
64
+ y: position.y - (sizeInPixels * (hoverScale - 1)) / TRIANGLE_CENTROID_OFFSET_DIVISOR,
65
+ }
66
+ : position;
67
+ return (_jsxs(_Fragment, { children: [hasHoverEffect && isHovered && !isFocused && (_jsx(PlotShape, { dataTestId: `${dataTestId}-hover`, fill: hoverFill, opacity: hoverOpacity, position: hoverPosition, size: sizeInPixels * hoverScale, stroke: hoverStroke, strokeWidth: hoverStrokeWidth })), _jsx(FocusRing, { dataTestId: dataTestId, focusConfig: { ...focusConfig, variant: focusConfig?.variant ?? 'bounding-box' }, isFocused: isFocused, children: _jsx(PlotShape, { ref: ref, ...plotShapeProps }) })] }));
50
68
  };
51
69
  /**
52
70
  * `Plot` component which renders an interactive point in a chart with hover effects and accessibility features.
@@ -4,6 +4,8 @@ export declare const ErrorType: {
4
4
  readonly BAR_CHART_SEPARATOR_ERROR: "BAR_CHART_SEPARATOR_ERROR";
5
5
  readonly BAR_CHART_X_AXIS_ERROR: "BAR_CHART_X_AXIS_ERROR";
6
6
  readonly BAR_CHART_Y_AXIS_ERROR: "BAR_CHART_Y_AXIS_ERROR";
7
+ readonly CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR: "CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR";
8
+ readonly CUSTOM_BACKGROUND_CHART_PLOT_ERROR: "CUSTOM_BACKGROUND_CHART_PLOT_ERROR";
7
9
  readonly GENERIC: "GENERIC";
8
10
  readonly LINE_CHART_CONTEXT_ERROR: "LINE_CHART_CONTEXT_ERROR";
9
11
  readonly LINE_CHART_PATH_ERROR: "LINE_CHART_PATH_ERROR";
@@ -1 +1 @@
1
- {"version":3,"file":"errors.type.d.ts","sourceRoot":"","sources":["../../../src/types/errors.type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;CAoBZ,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,OAAO,SAAS,CAAC;CAC9B;AACD,MAAM,MAAM,oBAAoB,GAAG;KAChC,IAAI,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE;CACjF,CAAC;AAGF,eAAO,MAAM,gBAAgB,GAAI,OAAO,UAAU,GAAG,UAAU,EAAE,KAAG,UAAU,EAE7E,CAAC"}
1
+ {"version":3,"file":"errors.type.d.ts","sourceRoot":"","sources":["../../../src/types/errors.type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAuBZ,CAAC;AAEX,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,OAAO,SAAS,CAAC;CAC9B;AACD,MAAM,MAAM,oBAAoB,GAAG;KAChC,IAAI,IAAI,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE;CACjF,CAAC;AAGF,eAAO,MAAM,gBAAgB,GAAI,OAAO,UAAU,GAAG,UAAU,EAAE,KAAG,UAAU,EAE7E,CAAC"}
@@ -5,6 +5,9 @@ export const ErrorType = {
5
5
  BAR_CHART_SEPARATOR_ERROR: 'BAR_CHART_SEPARATOR_ERROR',
6
6
  BAR_CHART_X_AXIS_ERROR: 'BAR_CHART_X_AXIS_ERROR',
7
7
  BAR_CHART_Y_AXIS_ERROR: 'BAR_CHART_Y_AXIS_ERROR',
8
+ // Custom Background Chart Error categories
9
+ CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR: 'CUSTOM_BACKGROUND_CHART_CONTEXT_ERROR',
10
+ CUSTOM_BACKGROUND_CHART_PLOT_ERROR: 'CUSTOM_BACKGROUND_CHART_PLOT_ERROR',
8
11
  // Generic Error for backward compatibility
9
12
  GENERIC: 'GENERIC',
10
13
  // Line Chart Errors categories
@@ -1,11 +1,15 @@
1
1
  /**
2
2
  * Configuration for the focus effect.
3
3
  *
4
+ * **Important**: All numeric values (stroke widths and gap) are relative to the SVG viewBox coordinate system,
5
+ * not pixel values. This means the same values may appear different in size depending on the chart's viewBox dimensions.
6
+ * For example, a value of 2 in a chart with viewBox 200x200 will appear larger than the same value in a chart with viewBox 100x80.
7
+ *
4
8
  * - `outlineColor` - Color of the outer outline when focused. Defaults to #0078D7.
5
- * - `outlineStrokeWidth` - Stroke width of the outer outline. Defaults to 2.
9
+ * - `outlineStrokeWidth` - Stroke width of the outer outline (viewBox-relative). Defaults to 2.
6
10
  * - `innerColor` - Color of the inner outline when focused. Defaults to #FFFFFF.
7
- * - `innerStrokeWidth` - Stroke width of the inner outline. Defaults to 2.
8
- * - `gap` - Gap between the element and the focus rings. Defaults to 0.
11
+ * - `innerStrokeWidth` - Stroke width of the inner outline (viewBox-relative). Defaults to 2.
12
+ * - `gap` - Gap between the element and the focus rings (viewBox-relative). Defaults to 0.
9
13
  * Note: Only applies when variant is 'bounding-box'. Ignored in 'adaptive' mode.
10
14
  * - `variant` - Focus ring rendering mode. Defaults to 'adaptive'.
11
15
  * - 'adaptive': Ring follows the exact shape of the element (circle → circular ring, path → path ring)
@@ -13,10 +17,12 @@
13
17
  */
14
18
  export interface FocusConfig {
15
19
  outlineColor?: string;
20
+ /** Stroke width in viewBox coordinate units (not pixels) */
16
21
  outlineStrokeWidth?: number;
17
22
  innerColor?: string;
23
+ /** Stroke width in viewBox coordinate units (not pixels) */
18
24
  innerStrokeWidth?: number;
19
- /** Only applicable when variant is 'bounding-box' */
25
+ /** Gap in viewBox coordinate units (not pixels). Only applicable when variant is 'bounding-box' */
20
26
  gap?: number;
21
27
  variant?: 'adaptive' | 'bounding-box';
22
28
  }
@@ -25,11 +31,11 @@ export declare const FOCUS_DEFAULT: {
25
31
  readonly FOCUS_COLOR: "#0078D4";
26
32
  /** Focus ring inner border */
27
33
  readonly FOCUS_INNER: "#ffffff";
28
- /** Focus ring inner stroke width */
34
+ /** Focus ring inner stroke width (viewBox-relative units) */
29
35
  readonly INNER_FOCUS_STROKE_WIDTH: 2;
30
- /** Focus ring outer stroke width */
36
+ /** Focus ring outer stroke width (viewBox-relative units) */
31
37
  readonly OUTER_FOCUS_STROKE_WIDTH: 2;
32
- /** Gap between element and outlines (only applies in bounding-box variant) */
38
+ /** Gap between element and outlines in viewBox-relative units (only applies in bounding-box variant) */
33
39
  readonly OUTLINES_GAP: 0;
34
40
  /** Focus ring rendering variant */
35
41
  readonly VARIANT: "adaptive";
@@ -1 +1 @@
1
- {"version":3,"file":"focusConfig.type.d.ts","sourceRoot":"","sources":["../../../src/types/focusConfig.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;CACvC;AAED,eAAO,MAAM,aAAa;IACxB,uBAAuB;;IAEvB,8BAA8B;;IAE9B,oCAAoC;;IAEpC,oCAAoC;;IAEpC,8EAA8E;;IAE9E,mCAAmC;;CAE3B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,KAAG,QAAQ,CAAC,WAAW,CAO7E,CAAC"}
1
+ {"version":3,"file":"focusConfig.type.d.ts","sourceRoot":"","sources":["../../../src/types/focusConfig.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;CACvC;AAED,eAAO,MAAM,aAAa;IACxB,uBAAuB;;IAEvB,8BAA8B;;IAE9B,6DAA6D;;IAE7D,6DAA6D;;IAE7D,wGAAwG;;IAExG,mCAAmC;;CAE3B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,KAAG,QAAQ,CAAC,WAAW,CAO7E,CAAC"}
@@ -3,11 +3,11 @@ export const FOCUS_DEFAULT = {
3
3
  FOCUS_COLOR: '#0078D4',
4
4
  /** Focus ring inner border */
5
5
  FOCUS_INNER: '#ffffff',
6
- /** Focus ring inner stroke width */
6
+ /** Focus ring inner stroke width (viewBox-relative units) */
7
7
  INNER_FOCUS_STROKE_WIDTH: 2,
8
- /** Focus ring outer stroke width */
8
+ /** Focus ring outer stroke width (viewBox-relative units) */
9
9
  OUTER_FOCUS_STROKE_WIDTH: 2,
10
- /** Gap between element and outlines (only applies in bounding-box variant) */
10
+ /** Gap between element and outlines in viewBox-relative units (only applies in bounding-box variant) */
11
11
  OUTLINES_GAP: 0,
12
12
  /** Focus ring rendering variant */
13
13
  VARIANT: 'adaptive',
@@ -0,0 +1,20 @@
1
+ import type { StyleProps } from '../../components/path/path.types';
2
+ import type { FocusConfig } from '../../types/focusConfig.type';
3
+ /**
4
+ * Adapts legacy StyleProps focusConfig to the new FocusConfig format.
5
+ *
6
+ * Only maps properties that have semantic equivalence:
7
+ * - `stroke` → `outlineColor` (color of the focus ring outline)
8
+ * - `strokeWidth` → `outlineStrokeWidth` and `innerStrokeWidth` (width of both focus rings)
9
+ *
10
+ * Other StyleProps properties (fill, fillOpacity, strokeDasharray, etc.) are ignored
11
+ * as they don't have meaningful equivalents in the new FocusRing component.
12
+ *
13
+ * @deprecated This adapter exists for backward compatibility only.
14
+ * It will be removed in the next major version along with the legacy focusConfig prop.
15
+ *
16
+ * @param legacy - Legacy focusConfig using StyleProps interface
17
+ * @returns FocusConfig compatible object, or undefined if no legacy config provided
18
+ */
19
+ export declare const adaptLegacyFocusConfig: (legacy?: StyleProps) => FocusConfig | undefined;
20
+ //# sourceMappingURL=adaptLegacyFocusConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptLegacyFocusConfig.d.ts","sourceRoot":"","sources":["../../../../src/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,UAAU,KAAG,WAAW,GAAG,SAU1E,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Adapts legacy StyleProps focusConfig to the new FocusConfig format.
3
+ *
4
+ * Only maps properties that have semantic equivalence:
5
+ * - `stroke` → `outlineColor` (color of the focus ring outline)
6
+ * - `strokeWidth` → `outlineStrokeWidth` and `innerStrokeWidth` (width of both focus rings)
7
+ *
8
+ * Other StyleProps properties (fill, fillOpacity, strokeDasharray, etc.) are ignored
9
+ * as they don't have meaningful equivalents in the new FocusRing component.
10
+ *
11
+ * @deprecated This adapter exists for backward compatibility only.
12
+ * It will be removed in the next major version along with the legacy focusConfig prop.
13
+ *
14
+ * @param legacy - Legacy focusConfig using StyleProps interface
15
+ * @returns FocusConfig compatible object, or undefined if no legacy config provided
16
+ */
17
+ export const adaptLegacyFocusConfig = (legacy) => {
18
+ if (!legacy) {
19
+ return undefined;
20
+ }
21
+ const strokeWidth = legacy.strokeWidth ? Number(legacy.strokeWidth) : undefined;
22
+ return {
23
+ innerStrokeWidth: strokeWidth,
24
+ outlineColor: legacy.stroke,
25
+ outlineStrokeWidth: strokeWidth,
26
+ };
27
+ };
@@ -0,0 +1,2 @@
1
+ export { adaptLegacyFocusConfig } from './adaptLegacyFocusConfig';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/adaptLegacyFocusConfig/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1 @@
1
+ export { adaptLegacyFocusConfig } from './adaptLegacyFocusConfig';