@mui/x-charts 9.11.1 → 9.13.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/BarChart/BarChart.js +8 -1
- package/BarChart/BarChart.mjs +8 -1
- package/CHANGELOG.md +278 -0
- package/ChartsContainer/ChartsContainer.js +8 -1
- package/ChartsContainer/ChartsContainer.mjs +8 -1
- package/ChartsContainer/useChartsContainerProps.js +3 -1
- package/ChartsContainer/useChartsContainerProps.mjs +3 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -9
- package/ChartsTooltip/ChartsAxisTooltipContent.mjs +2 -9
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.mjs +2 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +6 -2
- package/ChartsTooltip/ChartsTooltipContainer.mjs +6 -2
- package/ChartsXAxis/useAxisTicksProps.js +2 -1
- package/ChartsXAxis/useAxisTicksProps.mjs +2 -1
- package/ChartsYAxis/shortenLabels.js +16 -26
- package/ChartsYAxis/shortenLabels.mjs +17 -27
- package/ChartsYAxis/useAxisTicksProps.js +2 -1
- package/ChartsYAxis/useAxisTicksProps.mjs +2 -1
- package/LineChart/CircleMarkElement.js +0 -4
- package/LineChart/CircleMarkElement.mjs +0 -4
- package/LineChart/LineChart.js +8 -1
- package/LineChart/LineChart.mjs +8 -1
- package/LineChart/MarkElement.js +13 -6
- package/LineChart/MarkElement.mjs +13 -6
- package/PieChart/PieChart.js +7 -0
- package/PieChart/PieChart.mjs +7 -0
- package/RadarChart/RadarChart.js +8 -1
- package/RadarChart/RadarChart.mjs +8 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +6 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +6 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +2 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +2 -1
- package/RadarChart/useRadarChartProps.js +3 -1
- package/RadarChart/useRadarChartProps.mjs +3 -1
- package/ScatterChart/ScatterChart.js +8 -1
- package/ScatterChart/ScatterChart.mjs +8 -1
- package/SparkLineChart/SparkLineChart.js +8 -1
- package/SparkLineChart/SparkLineChart.mjs +8 -1
- package/constants/index.d.mts +3 -1
- package/constants/index.d.ts +3 -1
- package/constants/index.js +5 -2
- package/constants/index.mjs +4 -1
- package/hooks/animation/index.d.mts +1 -0
- package/hooks/animation/index.d.ts +1 -0
- package/hooks/animation/index.js +11 -0
- package/hooks/animation/index.mjs +1 -0
- package/hooks/animation/useAnimateMark.d.mts +25 -0
- package/hooks/animation/useAnimateMark.d.ts +25 -0
- package/hooks/animation/useAnimateMark.js +45 -0
- package/hooks/animation/useAnimateMark.mjs +39 -0
- package/hooks/useInteractionItemProps.js +4 -0
- package/hooks/useInteractionItemProps.mjs +4 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +13 -3
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +12 -3
- package/internals/components/ChartsAccessibilityProxy/focusAccessibilityProxy.d.mts +8 -0
- package/internals/components/ChartsAccessibilityProxy/focusAccessibilityProxy.d.ts +8 -0
- package/internals/components/ChartsAccessibilityProxy/focusAccessibilityProxy.js +25 -0
- package/internals/components/ChartsAccessibilityProxy/focusAccessibilityProxy.mjs +19 -0
- package/internals/components/ChartsAccessibilityProxy/index.d.mts +2 -1
- package/internals/components/ChartsAccessibilityProxy/index.d.ts +2 -1
- package/internals/components/ChartsAccessibilityProxy/index.js +11 -0
- package/internals/components/ChartsAccessibilityProxy/index.mjs +2 -1
- package/internals/domUtils.js +17 -16
- package/internals/domUtils.mjs +17 -15
- package/internals/ellipsize.d.mts +30 -0
- package/internals/ellipsize.d.ts +30 -0
- package/internals/ellipsize.js +60 -0
- package/internals/ellipsize.mjs +59 -0
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/internals/index.mjs +1 -0
- package/internals/plugins/corePlugins/useChartElementRef/useChartElementRef.js +3 -1
- package/internals/plugins/corePlugins/useChartElementRef/useChartElementRef.mjs +3 -1
- package/internals/plugins/corePlugins/useChartElementRef/useChartElementRef.types.d.mts +5 -0
- package/internals/plugins/corePlugins/useChartElementRef/useChartElementRef.types.d.ts +5 -0
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +10 -0
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.mjs +10 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.d.mts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.js +9 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisAutoSize.mjs +9 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.js +9 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.mjs +9 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +75 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +76 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.mts +6 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +6 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.mts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +22 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +22 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +27 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.mjs +27 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.mts +20 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +242 -35
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.mjs +244 -36
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.mts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +12 -5
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.mjs +11 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.mts +29 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +29 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtAxisPosition.d.mts +28 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtAxisPosition.d.ts +28 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtAxisPosition.js +81 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtAxisPosition.mjs +76 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtRotationIndex.d.mts +18 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtRotationIndex.d.ts +18 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtRotationIndex.js +65 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getItemAtRotationIndex.mjs +60 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +43 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +43 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +3 -2
- package/internals/useDefaultTickLabelStyle.d.mts +7 -0
- package/internals/useDefaultTickLabelStyle.d.ts +7 -0
- package/internals/useDefaultTickLabelStyle.js +34 -0
- package/internals/useDefaultTickLabelStyle.mjs +28 -0
- package/package.json +6 -6
package/constants/index.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ export declare const DEFAULT_MARGINS: {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const DEFAULT_AXIS_SIZE_WIDTH = 45;
|
|
12
12
|
export declare const DEFAULT_AXIS_SIZE_HEIGHT = 25;
|
|
13
|
-
export declare const AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
13
|
+
export declare const AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
14
|
+
/** Font size the axes render their tick labels with, unless `tickLabelStyle` overrides it. */
|
|
15
|
+
export declare const DEFAULT_TICK_LABEL_FONT_SIZE = 12;
|
package/constants/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DEFAULT_Y_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = exports.DEFAULT_ROTATION_AXIS_KEY = exports.DEFAULT_RADIUS_AXIS_KEY = exports.DEFAULT_MARGINS = exports.DEFAULT_AXIS_SIZE_WIDTH = exports.DEFAULT_AXIS_SIZE_HEIGHT = exports.AXIS_LABEL_DEFAULT_HEIGHT = void 0;
|
|
6
|
+
exports.DEFAULT_Y_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = exports.DEFAULT_TICK_LABEL_FONT_SIZE = exports.DEFAULT_ROTATION_AXIS_KEY = exports.DEFAULT_RADIUS_AXIS_KEY = exports.DEFAULT_MARGINS = exports.DEFAULT_AXIS_SIZE_WIDTH = exports.DEFAULT_AXIS_SIZE_HEIGHT = exports.AXIS_LABEL_DEFAULT_HEIGHT = void 0;
|
|
7
7
|
const DEFAULT_X_AXIS_KEY = exports.DEFAULT_X_AXIS_KEY = 'DEFAULT_X_AXIS_KEY';
|
|
8
8
|
const DEFAULT_Y_AXIS_KEY = exports.DEFAULT_Y_AXIS_KEY = 'DEFAULT_Y_AXIS_KEY';
|
|
9
9
|
const DEFAULT_ROTATION_AXIS_KEY = exports.DEFAULT_ROTATION_AXIS_KEY = 'DEFAULT_ROTATION_AXIS_KEY';
|
|
@@ -16,4 +16,7 @@ const DEFAULT_MARGINS = exports.DEFAULT_MARGINS = {
|
|
|
16
16
|
};
|
|
17
17
|
const DEFAULT_AXIS_SIZE_WIDTH = exports.DEFAULT_AXIS_SIZE_WIDTH = 45;
|
|
18
18
|
const DEFAULT_AXIS_SIZE_HEIGHT = exports.DEFAULT_AXIS_SIZE_HEIGHT = 25;
|
|
19
|
-
const AXIS_LABEL_DEFAULT_HEIGHT = exports.AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
19
|
+
const AXIS_LABEL_DEFAULT_HEIGHT = exports.AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
20
|
+
|
|
21
|
+
/** Font size the axes render their tick labels with, unless `tickLabelStyle` overrides it. */
|
|
22
|
+
const DEFAULT_TICK_LABEL_FONT_SIZE = exports.DEFAULT_TICK_LABEL_FONT_SIZE = 12;
|
package/constants/index.mjs
CHANGED
|
@@ -10,4 +10,7 @@ export const DEFAULT_MARGINS = {
|
|
|
10
10
|
};
|
|
11
11
|
export const DEFAULT_AXIS_SIZE_WIDTH = 45;
|
|
12
12
|
export const DEFAULT_AXIS_SIZE_HEIGHT = 25;
|
|
13
|
-
export const AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
13
|
+
export const AXIS_LABEL_DEFAULT_HEIGHT = 20;
|
|
14
|
+
|
|
15
|
+
/** Font size the axes render their tick labels with, unless `tickLabelStyle` overrides it. */
|
|
16
|
+
export const DEFAULT_TICK_LABEL_FONT_SIZE = 12;
|
|
@@ -3,5 +3,6 @@ export * from "./useAnimateArea.mjs";
|
|
|
3
3
|
export * from "./useAnimateBar.mjs";
|
|
4
4
|
export * from "./useAnimateBarLabel.mjs";
|
|
5
5
|
export * from "./useAnimateLine.mjs";
|
|
6
|
+
export * from "./useAnimateMark.mjs";
|
|
6
7
|
export * from "./useAnimatePieArc.mjs";
|
|
7
8
|
export * from "./useAnimatePieArcLabel.mjs";
|
|
@@ -3,5 +3,6 @@ export * from "./useAnimateArea.js";
|
|
|
3
3
|
export * from "./useAnimateBar.js";
|
|
4
4
|
export * from "./useAnimateBarLabel.js";
|
|
5
5
|
export * from "./useAnimateLine.js";
|
|
6
|
+
export * from "./useAnimateMark.js";
|
|
6
7
|
export * from "./useAnimatePieArc.js";
|
|
7
8
|
export * from "./useAnimatePieArcLabel.js";
|
package/hooks/animation/index.js
CHANGED
|
@@ -58,6 +58,17 @@ Object.keys(_useAnimateLine).forEach(function (key) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var _useAnimateMark = require("./useAnimateMark");
|
|
62
|
+
Object.keys(_useAnimateMark).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _useAnimateMark[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _useAnimateMark[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
61
72
|
var _useAnimatePieArc = require("./useAnimatePieArc");
|
|
62
73
|
Object.keys(_useAnimatePieArc).forEach(function (key) {
|
|
63
74
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -3,5 +3,6 @@ export * from "./useAnimateArea.mjs";
|
|
|
3
3
|
export * from "./useAnimateBar.mjs";
|
|
4
4
|
export * from "./useAnimateBarLabel.mjs";
|
|
5
5
|
export * from "./useAnimateLine.mjs";
|
|
6
|
+
export * from "./useAnimateMark.mjs";
|
|
6
7
|
export * from "./useAnimatePieArc.mjs";
|
|
7
8
|
export * from "./useAnimatePieArcLabel.mjs";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
type UseAnimateMarkParams = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
skipAnimation?: boolean;
|
|
6
|
+
ref?: React.Ref<SVGPathElement>;
|
|
7
|
+
};
|
|
8
|
+
type UseAnimateMarkReturn = {
|
|
9
|
+
ref: React.Ref<SVGPathElement>;
|
|
10
|
+
transform: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Animates the position of a line chart mark.
|
|
14
|
+
*
|
|
15
|
+
* The mark is placed with the SVG `transform` attribute, in `viewBox` units, because Safari resolves CSS pixel
|
|
16
|
+
* transforms of SVG children against the viewport instead of the scaled `viewBox`, which moves the mark away from the
|
|
17
|
+
* line under browser zoom. See https://github.com/mui/mui-x/issues/23377.
|
|
18
|
+
*
|
|
19
|
+
* Safari cannot transition the `transform` attribute with CSS, so the animation runs in JavaScript.
|
|
20
|
+
*
|
|
21
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
22
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAnimateMark(props: UseAnimateMarkParams): UseAnimateMarkReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
type UseAnimateMarkParams = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
skipAnimation?: boolean;
|
|
6
|
+
ref?: React.Ref<SVGPathElement>;
|
|
7
|
+
};
|
|
8
|
+
type UseAnimateMarkReturn = {
|
|
9
|
+
ref: React.Ref<SVGPathElement>;
|
|
10
|
+
transform: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Animates the position of a line chart mark.
|
|
14
|
+
*
|
|
15
|
+
* The mark is placed with the SVG `transform` attribute, in `viewBox` units, because Safari resolves CSS pixel
|
|
16
|
+
* transforms of SVG children against the viewport instead of the scaled `viewBox`, which moves the mark away from the
|
|
17
|
+
* line under browser zoom. See https://github.com/mui/mui-x/issues/23377.
|
|
18
|
+
*
|
|
19
|
+
* Safari cannot transition the `transform` attribute with CSS, so the animation runs in JavaScript.
|
|
20
|
+
*
|
|
21
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
22
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAnimateMark(props: UseAnimateMarkParams): UseAnimateMarkReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAnimateMark = useAnimateMark;
|
|
7
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
8
|
+
var _useAnimate = require("./useAnimate");
|
|
9
|
+
function markPropsInterpolator(from, to) {
|
|
10
|
+
const interpolateX = (0, _d3Interpolate.interpolateNumber)(from.x, to.x);
|
|
11
|
+
const interpolateY = (0, _d3Interpolate.interpolateNumber)(from.y, to.y);
|
|
12
|
+
return t => ({
|
|
13
|
+
x: interpolateX(t),
|
|
14
|
+
y: interpolateY(t)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Animates the position of a line chart mark.
|
|
20
|
+
*
|
|
21
|
+
* The mark is placed with the SVG `transform` attribute, in `viewBox` units, because Safari resolves CSS pixel
|
|
22
|
+
* transforms of SVG children against the viewport instead of the scaled `viewBox`, which moves the mark away from the
|
|
23
|
+
* line under browser zoom. See https://github.com/mui/mui-x/issues/23377.
|
|
24
|
+
*
|
|
25
|
+
* Safari cannot transition the `transform` attribute with CSS, so the animation runs in JavaScript.
|
|
26
|
+
*
|
|
27
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
28
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
29
|
+
*/
|
|
30
|
+
function useAnimateMark(props) {
|
|
31
|
+
return (0, _useAnimate.useAnimate)({
|
|
32
|
+
x: props.x,
|
|
33
|
+
y: props.y
|
|
34
|
+
}, {
|
|
35
|
+
createInterpolator: markPropsInterpolator,
|
|
36
|
+
transformProps: p => ({
|
|
37
|
+
transform: `translate(${p.x} ${p.y})`
|
|
38
|
+
}),
|
|
39
|
+
applyProps(element, animatedProps) {
|
|
40
|
+
element.setAttribute('transform', animatedProps.transform);
|
|
41
|
+
},
|
|
42
|
+
skip: props.skipAnimation,
|
|
43
|
+
ref: props.ref
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { interpolateNumber } from '@mui/x-charts-vendor/d3-interpolate';
|
|
2
|
+
import { useAnimate } from "./useAnimate.mjs";
|
|
3
|
+
function markPropsInterpolator(from, to) {
|
|
4
|
+
const interpolateX = interpolateNumber(from.x, to.x);
|
|
5
|
+
const interpolateY = interpolateNumber(from.y, to.y);
|
|
6
|
+
return t => ({
|
|
7
|
+
x: interpolateX(t),
|
|
8
|
+
y: interpolateY(t)
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Animates the position of a line chart mark.
|
|
14
|
+
*
|
|
15
|
+
* The mark is placed with the SVG `transform` attribute, in `viewBox` units, because Safari resolves CSS pixel
|
|
16
|
+
* transforms of SVG children against the viewport instead of the scaled `viewBox`, which moves the mark away from the
|
|
17
|
+
* line under browser zoom. See https://github.com/mui/mui-x/issues/23377.
|
|
18
|
+
*
|
|
19
|
+
* Safari cannot transition the `transform` attribute with CSS, so the animation runs in JavaScript.
|
|
20
|
+
*
|
|
21
|
+
* The props object also accepts a `ref` which will be merged with the ref returned from this hook. This means you can
|
|
22
|
+
* pass the ref returned by this hook to the `path` element and the `ref` provided as argument will also be called.
|
|
23
|
+
*/
|
|
24
|
+
export function useAnimateMark(props) {
|
|
25
|
+
return useAnimate({
|
|
26
|
+
x: props.x,
|
|
27
|
+
y: props.y
|
|
28
|
+
}, {
|
|
29
|
+
createInterpolator: markPropsInterpolator,
|
|
30
|
+
transformProps: p => ({
|
|
31
|
+
transform: `translate(${p.x} ${p.y})`
|
|
32
|
+
}),
|
|
33
|
+
applyProps(element, animatedProps) {
|
|
34
|
+
element.setAttribute('transform', animatedProps.transform);
|
|
35
|
+
},
|
|
36
|
+
skip: props.skipAnimation,
|
|
37
|
+
ref: props.ref
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -24,11 +24,13 @@ const useInteractionItemProps = data => {
|
|
|
24
24
|
const onPointerEnter = (0, _useEventCallback.default)(() => {
|
|
25
25
|
interactionActive.current = true;
|
|
26
26
|
instance.setLastUpdateSource('pointer');
|
|
27
|
+
instance.setHoveredItem(data);
|
|
27
28
|
instance.setTooltipItem(data);
|
|
28
29
|
instance.setHighlight(data);
|
|
29
30
|
});
|
|
30
31
|
const onPointerLeave = (0, _useEventCallback.default)(() => {
|
|
31
32
|
interactionActive.current = false;
|
|
33
|
+
instance.clearHoveredItem(data);
|
|
32
34
|
instance.removeTooltipItem(data);
|
|
33
35
|
instance.clearHighlight();
|
|
34
36
|
});
|
|
@@ -53,6 +55,7 @@ function getInteractionItemProps(instance, item) {
|
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
57
|
instance.setLastUpdateSource('pointer');
|
|
58
|
+
instance.setHoveredItem(item);
|
|
56
59
|
instance.setTooltipItem(item);
|
|
57
60
|
instance.setHighlight(item);
|
|
58
61
|
}
|
|
@@ -60,6 +63,7 @@ function getInteractionItemProps(instance, item) {
|
|
|
60
63
|
if (!item) {
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
66
|
+
instance.clearHoveredItem(item);
|
|
63
67
|
instance.removeTooltipItem(item);
|
|
64
68
|
instance.clearHighlight();
|
|
65
69
|
}
|
|
@@ -16,11 +16,13 @@ export const useInteractionItemProps = data => {
|
|
|
16
16
|
const onPointerEnter = useEventCallback(() => {
|
|
17
17
|
interactionActive.current = true;
|
|
18
18
|
instance.setLastUpdateSource('pointer');
|
|
19
|
+
instance.setHoveredItem(data);
|
|
19
20
|
instance.setTooltipItem(data);
|
|
20
21
|
instance.setHighlight(data);
|
|
21
22
|
});
|
|
22
23
|
const onPointerLeave = useEventCallback(() => {
|
|
23
24
|
interactionActive.current = false;
|
|
25
|
+
instance.clearHoveredItem(data);
|
|
24
26
|
instance.removeTooltipItem(data);
|
|
25
27
|
instance.clearHighlight();
|
|
26
28
|
});
|
|
@@ -44,6 +46,7 @@ export function getInteractionItemProps(instance, item) {
|
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
instance.setLastUpdateSource('pointer');
|
|
49
|
+
instance.setHoveredItem(item);
|
|
47
50
|
instance.setTooltipItem(item);
|
|
48
51
|
instance.setHighlight(item);
|
|
49
52
|
}
|
|
@@ -51,6 +54,7 @@ export function getInteractionItemProps(instance, item) {
|
|
|
51
54
|
if (!item) {
|
|
52
55
|
return;
|
|
53
56
|
}
|
|
57
|
+
instance.clearHoveredItem(item);
|
|
54
58
|
instance.removeTooltipItem(item);
|
|
55
59
|
instance.clearHighlight();
|
|
56
60
|
}
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.ChartsAccessibilityProxy = ChartsAccessibilityProxy;
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
10
12
|
var _useChartId = require("../../../hooks/useChartId");
|
|
13
|
+
var _ChartsProvider = require("../../../context/ChartsProvider");
|
|
11
14
|
var _useDescription = require("./useDescription");
|
|
12
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
16
|
/**
|
|
@@ -35,9 +38,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
35
38
|
function ChartsAccessibilityProxy() {
|
|
36
39
|
const message = (0, _useDescription.useDescription)();
|
|
37
40
|
const chartId = (0, _useChartId.useChartId)();
|
|
41
|
+
const {
|
|
42
|
+
instance
|
|
43
|
+
} = (0, _ChartsProvider.useChartsContext)();
|
|
38
44
|
const currentFormatRef = React.useRef(null);
|
|
39
45
|
const currentIndexRef = React.useRef(0);
|
|
40
46
|
const containerRef = React.useRef(null);
|
|
47
|
+
const handleRef = (0, _useForkRef.default)(containerRef, instance.chartsAccessibilityProxyRef);
|
|
41
48
|
React.useEffect(() => {
|
|
42
49
|
const container = containerRef.current;
|
|
43
50
|
if (!container) {
|
|
@@ -93,9 +100,12 @@ function ChartsAccessibilityProxy() {
|
|
|
93
100
|
}
|
|
94
101
|
}, [message, chartId]);
|
|
95
102
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
-
role: "none"
|
|
97
|
-
|
|
98
|
-
|
|
103
|
+
role: "none"
|
|
104
|
+
// Stays focusable once an announcer child owns the tab stop, otherwise the browser would
|
|
105
|
+
// blur the root mid hand-off and the chart would look like it lost the focus.
|
|
106
|
+
,
|
|
107
|
+
tabIndex: message ? -1 : 0,
|
|
108
|
+
ref: handleRef,
|
|
99
109
|
style: fullSizeLayerStyle
|
|
100
110
|
});
|
|
101
111
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
4
5
|
import { useChartId } from "../../../hooks/useChartId.mjs";
|
|
6
|
+
import { useChartsContext } from "../../../context/ChartsProvider/index.mjs";
|
|
5
7
|
import { useDescription } from "./useDescription.mjs";
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -31,9 +33,13 @@ const fullSizeLayerStyle = {
|
|
|
31
33
|
export function ChartsAccessibilityProxy() {
|
|
32
34
|
const message = useDescription();
|
|
33
35
|
const chartId = useChartId();
|
|
36
|
+
const {
|
|
37
|
+
instance
|
|
38
|
+
} = useChartsContext();
|
|
34
39
|
const currentFormatRef = React.useRef(null);
|
|
35
40
|
const currentIndexRef = React.useRef(0);
|
|
36
41
|
const containerRef = React.useRef(null);
|
|
42
|
+
const handleRef = useForkRef(containerRef, instance.chartsAccessibilityProxyRef);
|
|
37
43
|
React.useEffect(() => {
|
|
38
44
|
const container = containerRef.current;
|
|
39
45
|
if (!container) {
|
|
@@ -89,9 +95,12 @@ export function ChartsAccessibilityProxy() {
|
|
|
89
95
|
}
|
|
90
96
|
}, [message, chartId]);
|
|
91
97
|
return /*#__PURE__*/_jsx("div", {
|
|
92
|
-
role: "none"
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
role: "none"
|
|
99
|
+
// Stays focusable once an announcer child owns the tab stop, otherwise the browser would
|
|
100
|
+
// blur the root mid hand-off and the chart would look like it lost the focus.
|
|
101
|
+
,
|
|
102
|
+
tabIndex: message ? -1 : 0,
|
|
103
|
+
ref: handleRef,
|
|
95
104
|
style: fullSizeLayerStyle
|
|
96
105
|
});
|
|
97
106
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moves the DOM focus to the chart tab stop.
|
|
3
|
+
* The proxy root is only tabbable while there is no description, otherwise one of the announcer
|
|
4
|
+
* children holds the tab stop.
|
|
5
|
+
* @param {HTMLDivElement | null} root The accessibility proxy root.
|
|
6
|
+
* @returns {boolean} `true` when an element was focused.
|
|
7
|
+
*/
|
|
8
|
+
export declare function focusAccessibilityProxy(root: HTMLDivElement | null): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moves the DOM focus to the chart tab stop.
|
|
3
|
+
* The proxy root is only tabbable while there is no description, otherwise one of the announcer
|
|
4
|
+
* children holds the tab stop.
|
|
5
|
+
* @param {HTMLDivElement | null} root The accessibility proxy root.
|
|
6
|
+
* @returns {boolean} `true` when an element was focused.
|
|
7
|
+
*/
|
|
8
|
+
export declare function focusAccessibilityProxy(root: HTMLDivElement | null): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.focusAccessibilityProxy = focusAccessibilityProxy;
|
|
7
|
+
/**
|
|
8
|
+
* Moves the DOM focus to the chart tab stop.
|
|
9
|
+
* The proxy root is only tabbable while there is no description, otherwise one of the announcer
|
|
10
|
+
* children holds the tab stop.
|
|
11
|
+
* @param {HTMLDivElement | null} root The accessibility proxy root.
|
|
12
|
+
* @returns {boolean} `true` when an element was focused.
|
|
13
|
+
*/
|
|
14
|
+
function focusAccessibilityProxy(root) {
|
|
15
|
+
if (!root) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const target = root.querySelector('[tabindex="0"]') ?? (root.tabIndex >= 0 ? root : null);
|
|
19
|
+
|
|
20
|
+
// The proxy covers the whole chart, focusing it would scroll long pages.
|
|
21
|
+
target?.focus({
|
|
22
|
+
preventScroll: true
|
|
23
|
+
});
|
|
24
|
+
return target !== null;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Moves the DOM focus to the chart tab stop.
|
|
3
|
+
* The proxy root is only tabbable while there is no description, otherwise one of the announcer
|
|
4
|
+
* children holds the tab stop.
|
|
5
|
+
* @param {HTMLDivElement | null} root The accessibility proxy root.
|
|
6
|
+
* @returns {boolean} `true` when an element was focused.
|
|
7
|
+
*/
|
|
8
|
+
export function focusAccessibilityProxy(root) {
|
|
9
|
+
if (!root) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const target = root.querySelector('[tabindex="0"]') ?? (root.tabIndex >= 0 ? root : null);
|
|
13
|
+
|
|
14
|
+
// The proxy covers the whole chart, focusing it would scroll long pages.
|
|
15
|
+
target?.focus({
|
|
16
|
+
preventScroll: true
|
|
17
|
+
});
|
|
18
|
+
return target !== null;
|
|
19
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./ChartsAccessibilityProxy.mjs";
|
|
1
|
+
export * from "./ChartsAccessibilityProxy.mjs";
|
|
2
|
+
export * from "./focusAccessibilityProxy.mjs";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./ChartsAccessibilityProxy.js";
|
|
1
|
+
export * from "./ChartsAccessibilityProxy.js";
|
|
2
|
+
export * from "./focusAccessibilityProxy.js";
|
|
@@ -13,4 +13,15 @@ Object.keys(_ChartsAccessibilityProxy).forEach(function (key) {
|
|
|
13
13
|
return _ChartsAccessibilityProxy[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _focusAccessibilityProxy = require("./focusAccessibilityProxy");
|
|
18
|
+
Object.keys(_focusAccessibilityProxy).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _focusAccessibilityProxy[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _focusAccessibilityProxy[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./ChartsAccessibilityProxy.mjs";
|
|
1
|
+
export * from "./ChartsAccessibilityProxy.mjs";
|
|
2
|
+
export * from "./focusAccessibilityProxy.mjs";
|
package/internals/domUtils.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,7 +7,6 @@ exports.batchMeasureStrings = batchMeasureStrings;
|
|
|
8
7
|
exports.clearStringMeasurementCache = clearStringMeasurementCache;
|
|
9
8
|
exports.getStringSize = void 0;
|
|
10
9
|
exports.getStyleString = getStyleString;
|
|
11
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
10
|
// DOM utils adapted from
|
|
13
11
|
// https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
|
|
14
12
|
|
|
@@ -64,6 +62,17 @@ function getStyleString(style) {
|
|
|
64
62
|
return result;
|
|
65
63
|
}
|
|
66
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Applies a style to a measurement element.
|
|
67
|
+
* Uses the CSS Object Model (CSSOM) to comply with Content Security Policy (CSP).
|
|
68
|
+
* https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
69
|
+
*/
|
|
70
|
+
function applyStyle(element, style) {
|
|
71
|
+
for (const styleKey of Object.keys(style)) {
|
|
72
|
+
element.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, style[styleKey]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
/**
|
|
68
77
|
*
|
|
69
78
|
* @param text The string to estimate
|
|
@@ -87,13 +96,7 @@ const getStringSize = (text, style = {}) => {
|
|
|
87
96
|
try {
|
|
88
97
|
const measurementSpanContainer = getMeasurementContainer();
|
|
89
98
|
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
90
|
-
|
|
91
|
-
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
|
|
92
|
-
// https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
93
|
-
Object.keys(style).map(styleKey => {
|
|
94
|
-
measurementElem.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, style[styleKey]);
|
|
95
|
-
return styleKey;
|
|
96
|
-
});
|
|
99
|
+
applyStyle(measurementElem, style);
|
|
97
100
|
measurementElem.textContent = str;
|
|
98
101
|
measurementSpanContainer.replaceChildren(measurementElem);
|
|
99
102
|
const result = measureSVGTextElement(measurementElem);
|
|
@@ -134,16 +137,14 @@ function batchMeasureStrings(texts, style = {}) {
|
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
const measurementContainer = getMeasurementContainer();
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
measurementContainer.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, measurementSpanStyle[styleKey]);
|
|
142
|
-
return styleKey;
|
|
143
|
-
});
|
|
140
|
+
|
|
141
|
+
// The style goes on each text element rather than on the shared container. Styling the container
|
|
142
|
+
// leaks into every later measurement, because a call that omits one of those properties keeps the
|
|
143
|
+
// previous call's value and measures the wrong font.
|
|
144
144
|
const measurementElements = [];
|
|
145
145
|
for (const string of textToMeasure) {
|
|
146
146
|
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
147
|
+
applyStyle(measurementElem, style);
|
|
147
148
|
measurementElem.textContent = `${string}`;
|
|
148
149
|
measurementElements.push(measurementElem);
|
|
149
150
|
}
|
package/internals/domUtils.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
// DOM utils adapted from
|
|
3
2
|
// https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
|
|
4
3
|
|
|
@@ -54,6 +53,17 @@ export function getStyleString(style) {
|
|
|
54
53
|
return result;
|
|
55
54
|
}
|
|
56
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Applies a style to a measurement element.
|
|
58
|
+
* Uses the CSS Object Model (CSSOM) to comply with Content Security Policy (CSP).
|
|
59
|
+
* https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
60
|
+
*/
|
|
61
|
+
function applyStyle(element, style) {
|
|
62
|
+
for (const styleKey of Object.keys(style)) {
|
|
63
|
+
element.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, style[styleKey]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
*
|
|
59
69
|
* @param text The string to estimate
|
|
@@ -77,13 +87,7 @@ export const getStringSize = (text, style = {}) => {
|
|
|
77
87
|
try {
|
|
78
88
|
const measurementSpanContainer = getMeasurementContainer();
|
|
79
89
|
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
80
|
-
|
|
81
|
-
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
|
|
82
|
-
// https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
83
|
-
Object.keys(style).map(styleKey => {
|
|
84
|
-
measurementElem.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, style[styleKey]);
|
|
85
|
-
return styleKey;
|
|
86
|
-
});
|
|
90
|
+
applyStyle(measurementElem, style);
|
|
87
91
|
measurementElem.textContent = str;
|
|
88
92
|
measurementSpanContainer.replaceChildren(measurementElem);
|
|
89
93
|
const result = measureSVGTextElement(measurementElem);
|
|
@@ -123,16 +127,14 @@ export function batchMeasureStrings(texts, style = {}) {
|
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
const measurementContainer = getMeasurementContainer();
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
measurementContainer.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, measurementSpanStyle[styleKey]);
|
|
131
|
-
return styleKey;
|
|
132
|
-
});
|
|
130
|
+
|
|
131
|
+
// The style goes on each text element rather than on the shared container. Styling the container
|
|
132
|
+
// leaks into every later measurement, because a call that omits one of those properties keeps the
|
|
133
|
+
// previous call's value and measures the wrong font.
|
|
133
134
|
const measurementElements = [];
|
|
134
135
|
for (const string of textToMeasure) {
|
|
135
136
|
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
137
|
+
applyStyle(measurementElem, style);
|
|
136
138
|
measurementElem.textContent = `${string}`;
|
|
137
139
|
measurementElements.push(measurementElem);
|
|
138
140
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChartsTextAnchor, ChartsTextBaseline } from "./getWordsByLines.mjs";
|
|
1
2
|
interface EllipsizeConfig {
|
|
2
3
|
width: number;
|
|
3
4
|
height: number;
|
|
@@ -9,6 +10,35 @@ interface EllipsizeConfig {
|
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
export declare function doesTextFitInRect(text: string, config: EllipsizeConfig): boolean;
|
|
13
|
+
export interface RotatedTextBoundsConfig {
|
|
14
|
+
/** Angle, in degrees, in which the text is displayed. */
|
|
15
|
+
angle: number;
|
|
16
|
+
textAnchor?: ChartsTextAnchor;
|
|
17
|
+
dominantBaseline?: ChartsTextBaseline;
|
|
18
|
+
isRtl?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface RotatedTextBounds {
|
|
21
|
+
/** Width of the text bounding box once rotated. */
|
|
22
|
+
width: number;
|
|
23
|
+
/** How far the text extends above its anchor point. */
|
|
24
|
+
above: number;
|
|
25
|
+
/** How far the text extends below its anchor point. */
|
|
26
|
+
below: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns the size of a rotated text, and how far it extends on each side of its anchor point.
|
|
30
|
+
*
|
|
31
|
+
* Which side of the anchor the text is drawn on depends on both the text anchoring and the rotation,
|
|
32
|
+
* so `above` and `below` are not necessarily equal. Either of them is negative when the whole text
|
|
33
|
+
* sits on the other side of the anchor point.
|
|
34
|
+
*
|
|
35
|
+
* @param textSize The size of the text before rotation.
|
|
36
|
+
* @param config How the text is anchored and rotated.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getRotatedTextBounds(textSize: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}, config: RotatedTextBoundsConfig): RotatedTextBounds;
|
|
12
42
|
/** This function finds the best place to clip the text to add an ellipsis.
|
|
13
43
|
* This function assumes that the {@link doesTextFit} never returns true for longer text after returning false for
|
|
14
44
|
* shorter text.
|