@kubit-ui-web/react-charts 1.9.0 → 1.10.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.
- package/dist/cjs/charts/barChart/barChart.type.d.ts +8 -0
- package/dist/cjs/charts/barChart/barChart.type.d.ts.map +1 -1
- package/dist/cjs/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
- package/dist/cjs/charts/barChart/fragments/barChartPath.js +2 -2
- package/dist/cjs/components/bar/bar.d.ts.map +1 -1
- package/dist/cjs/components/bar/bar.js +6 -3
- package/dist/cjs/components/bar/bar.type.d.ts +9 -0
- package/dist/cjs/components/bar/bar.type.d.ts.map +1 -1
- package/dist/cjs/components/path/path.d.ts.map +1 -1
- package/dist/cjs/components/path/path.js +24 -11
- package/dist/cjs/components/path/path.types.d.ts +9 -0
- package/dist/cjs/components/path/path.types.d.ts.map +1 -1
- package/dist/cjs/types/focusConfig.type.d.ts +13 -7
- package/dist/cjs/types/focusConfig.type.d.ts.map +1 -1
- package/dist/cjs/types/focusConfig.type.js +3 -3
- package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
- package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
- package/dist/cjs/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.js +27 -0
- package/dist/cjs/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
- package/dist/cjs/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
- package/dist/cjs/utils/adaptLegacyFocusConfig/index.js +1 -0
- package/dist/esm/charts/barChart/barChart.type.d.ts +8 -0
- package/dist/esm/charts/barChart/barChart.type.d.ts.map +1 -1
- package/dist/esm/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
- package/dist/esm/charts/barChart/fragments/barChartPath.js +2 -2
- package/dist/esm/components/bar/bar.d.ts.map +1 -1
- package/dist/esm/components/bar/bar.js +6 -3
- package/dist/esm/components/bar/bar.type.d.ts +9 -0
- package/dist/esm/components/bar/bar.type.d.ts.map +1 -1
- package/dist/esm/components/path/path.d.ts.map +1 -1
- package/dist/esm/components/path/path.js +24 -11
- package/dist/esm/components/path/path.types.d.ts +9 -0
- package/dist/esm/components/path/path.types.d.ts.map +1 -1
- package/dist/esm/types/focusConfig.type.d.ts +13 -7
- package/dist/esm/types/focusConfig.type.d.ts.map +1 -1
- package/dist/esm/types/focusConfig.type.js +3 -3
- package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
- package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
- package/dist/esm/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.js +27 -0
- package/dist/esm/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
- package/dist/esm/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
- package/dist/esm/utils/adaptLegacyFocusConfig/index.js +1 -0
- package/dist/kubit-ui-web-react-charts.cjs.js +1 -1
- package/dist/kubit-ui-web-react-charts.es.js +1 -1
- package/dist/kubit-ui-web-react-charts.umd.js +1 -1
- package/dist/react-charts.css +1 -1
- package/dist/types/charts/barChart/barChart.type.d.ts +8 -0
- package/dist/types/charts/barChart/barChart.type.d.ts.map +1 -1
- package/dist/types/charts/barChart/fragments/barChartPath.d.ts.map +1 -1
- package/dist/types/components/bar/bar.d.ts.map +1 -1
- package/dist/types/components/bar/bar.type.d.ts +9 -0
- package/dist/types/components/bar/bar.type.d.ts.map +1 -1
- package/dist/types/components/path/path.d.ts.map +1 -1
- package/dist/types/components/path/path.types.d.ts +9 -0
- package/dist/types/components/path/path.types.d.ts.map +1 -1
- package/dist/types/types/focusConfig.type.d.ts +13 -7
- package/dist/types/types/focusConfig.type.d.ts.map +1 -1
- package/dist/types/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts +20 -0
- package/dist/types/utils/adaptLegacyFocusConfig/adaptLegacyFocusConfig.d.ts.map +1 -0
- package/dist/types/utils/adaptLegacyFocusConfig/index.d.ts +2 -0
- package/dist/types/utils/adaptLegacyFocusConfig/index.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -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
|
|
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',
|
|
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
|
-
},
|
|
52
|
-
|
|
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
|
|
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,E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,CAAC;CACjD"}
|
|
@@ -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
|
|
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 @@
|
|
|
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';
|