@mui/x-charts 6.18.1 → 6.18.2
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/CHANGELOG.md +53 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +13 -5
- package/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
- package/ChartsTooltip/chartsTooltipClasses.js +12 -0
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +11 -0
- package/ChartsTooltip/utils.d.ts +1 -1
- package/ChartsTooltip/utils.js +2 -2
- package/PieChart/PieArc.d.ts +5 -2
- package/PieChart/PieArc.js +17 -2
- package/PieChart/PieArcLabel.d.ts +1 -1
- package/PieChart/PieArcLabel.js +5 -10
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.js +2 -2
- package/PieChart/index.d.ts +4 -2
- package/PieChart/index.js +37 -27
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
- package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/esm/ChartsTooltip/index.js +2 -1
- package/esm/ChartsTooltip/utils.js +1 -1
- package/esm/PieChart/PieArc.js +18 -2
- package/esm/PieChart/PieArcLabel.js +7 -11
- package/esm/PieChart/PieArcLabelPlot.js +1 -1
- package/esm/PieChart/PieArcPlot.js +1 -1
- package/esm/PieChart/index.js +2 -2
- package/index.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/legacy/ChartsTooltip/index.js +2 -1
- package/legacy/ChartsTooltip/utils.js +1 -1
- package/legacy/PieChart/PieArc.js +18 -2
- package/legacy/PieChart/PieArcLabel.js +7 -11
- package/legacy/PieChart/PieArcLabelPlot.js +1 -1
- package/legacy/PieChart/PieArcPlot.js +1 -1
- package/legacy/PieChart/index.js +2 -2
- package/legacy/index.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
- package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
- package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/modern/ChartsTooltip/index.js +2 -1
- package/modern/ChartsTooltip/utils.js +1 -1
- package/modern/PieChart/PieArc.js +18 -2
- package/modern/PieChart/PieArcLabel.js +7 -11
- package/modern/PieChart/PieArcLabelPlot.js +1 -1
- package/modern/PieChart/PieArcPlot.js +1 -1
- package/modern/PieChart/index.js +2 -2
- package/modern/index.js +1 -1
- package/package.json +1 -1
- package/themeAugmentation/components.d.ts +1 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/ChartsTooltip/tooltipClasses.d.ts +0 -13
- package/ChartsTooltip/tooltipClasses.js +0 -12
- package/esm/ChartsTooltip/tooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
- package/modern/ChartsTooltip/tooltipClasses.js +0 -5
|
@@ -2,15 +2,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
-
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { styled, useThemeProps } from '@mui/material/styles';
|
|
6
6
|
import { Popper } from '@mui/base/Popper';
|
|
7
7
|
import { NoSsr } from '@mui/base/NoSsr';
|
|
8
8
|
import { useSlotProps } from '@mui/base/utils';
|
|
9
9
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
10
|
-
import { generateVirtualElement, useMouseTracker,
|
|
10
|
+
import { generateVirtualElement, useMouseTracker, getTooltipHasData } from './utils';
|
|
11
11
|
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
12
12
|
import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
|
|
13
|
-
import {
|
|
13
|
+
import { getChartsTooltipUtilityClass } from './chartsTooltipClasses';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const useUtilityClasses = ownerState => {
|
|
16
16
|
const {
|
|
@@ -18,11 +18,15 @@ const useUtilityClasses = ownerState => {
|
|
|
18
18
|
} = ownerState;
|
|
19
19
|
const slots = {
|
|
20
20
|
root: ['root'],
|
|
21
|
+
table: ['table'],
|
|
22
|
+
row: ['row'],
|
|
23
|
+
cell: ['cell'],
|
|
24
|
+
mark: ['mark'],
|
|
21
25
|
markCell: ['markCell'],
|
|
22
26
|
labelCell: ['labelCell'],
|
|
23
27
|
valueCell: ['valueCell']
|
|
24
28
|
};
|
|
25
|
-
return composeClasses(slots,
|
|
29
|
+
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
26
30
|
};
|
|
27
31
|
const ChartsTooltipRoot = styled(Popper, {
|
|
28
32
|
name: 'MuiChartsTooltip',
|
|
@@ -45,23 +49,27 @@ const ChartsTooltipRoot = styled(Popper, {
|
|
|
45
49
|
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
46
50
|
*/
|
|
47
51
|
function ChartsTooltip(props) {
|
|
52
|
+
const themeProps = useThemeProps({
|
|
53
|
+
props,
|
|
54
|
+
name: 'MuiChartsTooltip'
|
|
55
|
+
});
|
|
48
56
|
const {
|
|
49
57
|
trigger = 'axis',
|
|
50
58
|
itemContent,
|
|
51
59
|
axisContent,
|
|
52
60
|
slots,
|
|
53
61
|
slotProps
|
|
54
|
-
} =
|
|
62
|
+
} = themeProps;
|
|
55
63
|
const mousePosition = useMouseTracker();
|
|
56
64
|
const {
|
|
57
65
|
item,
|
|
58
66
|
axis
|
|
59
67
|
} = React.useContext(InteractionContext);
|
|
60
68
|
const displayedData = trigger === 'item' ? item : axis;
|
|
61
|
-
const tooltipHasData =
|
|
69
|
+
const tooltipHasData = getTooltipHasData(trigger, displayedData);
|
|
62
70
|
const popperOpen = mousePosition !== null && tooltipHasData;
|
|
63
71
|
const classes = useUtilityClasses({
|
|
64
|
-
classes:
|
|
72
|
+
classes: themeProps.classes
|
|
65
73
|
});
|
|
66
74
|
const PopperComponent = slots?.popper ?? ChartsTooltipRoot;
|
|
67
75
|
const popperProps = useSlotProps({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Box from '@mui/system/Box';
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
|
-
import {
|
|
3
|
+
import { chartsTooltipClasses } from './chartsTooltipClasses';
|
|
4
4
|
export const ChartsTooltipPaper = styled('div', {
|
|
5
5
|
name: 'MuiChartsTooltip',
|
|
6
6
|
slot: 'Container'
|
|
@@ -45,10 +45,10 @@ export const ChartsTooltipCell = styled('td', {
|
|
|
45
45
|
}) => ({
|
|
46
46
|
verticalAlign: 'middle',
|
|
47
47
|
color: (theme.vars || theme).palette.text.secondary,
|
|
48
|
-
[`&.${
|
|
48
|
+
[`&.${chartsTooltipClasses.labelCell}`]: {
|
|
49
49
|
paddingLeft: theme.spacing(1)
|
|
50
50
|
},
|
|
51
|
-
[`&.${
|
|
51
|
+
[`&.${chartsTooltipClasses.valueCell}`]: {
|
|
52
52
|
paddingLeft: theme.spacing(4),
|
|
53
53
|
color: (theme.vars || theme).palette.text.primary
|
|
54
54
|
},
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
export function getChartsTooltipUtilityClass(slot) {
|
|
3
|
+
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
+
}
|
|
5
|
+
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './ChartsTooltip';
|
|
1
|
+
export * from './ChartsTooltip';
|
|
2
|
+
export * from './chartsTooltipClasses';
|
|
@@ -71,7 +71,7 @@ export function useMouseTracker() {
|
|
|
71
71
|
}, [svgRef]);
|
|
72
72
|
return mousePosition;
|
|
73
73
|
}
|
|
74
|
-
export function
|
|
74
|
+
export function getTooltipHasData(trigger, displayedData) {
|
|
75
75
|
if (trigger === 'item') {
|
|
76
76
|
return displayedData !== null;
|
|
77
77
|
}
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "onClick", "isFaded", "isHighlighted", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import { arc as d3Arc } from 'd3-shape';
|
|
6
7
|
import { animated, to } from '@react-spring/web';
|
|
7
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -37,7 +38,7 @@ const PieArcRoot = styled(animated.path, {
|
|
|
37
38
|
strokeWidth: 1,
|
|
38
39
|
strokeLinejoin: 'round'
|
|
39
40
|
}));
|
|
40
|
-
|
|
41
|
+
function PieArc(props) {
|
|
41
42
|
const {
|
|
42
43
|
id,
|
|
43
44
|
dataIndex,
|
|
@@ -82,4 +83,19 @@ export default function PieArc(props) {
|
|
|
82
83
|
seriesId: id,
|
|
83
84
|
dataIndex
|
|
84
85
|
})));
|
|
85
|
-
}
|
|
86
|
+
}
|
|
87
|
+
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
88
|
+
// ----------------------------- Warning --------------------------------
|
|
89
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
classes: PropTypes.object,
|
|
93
|
+
dataIndex: PropTypes.number.isRequired,
|
|
94
|
+
highlightScope: PropTypes.shape({
|
|
95
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
96
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
97
|
+
}),
|
|
98
|
+
isFaded: PropTypes.bool.isRequired,
|
|
99
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
100
|
+
} : void 0;
|
|
101
|
+
export { PieArc };
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import { animated, to } from '@react-spring/web';
|
|
6
7
|
import { arc as d3Arc } from 'd3-shape';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
10
10
|
import { styled } from '@mui/material/styles';
|
|
@@ -57,7 +57,7 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
|
|
|
57
57
|
}
|
|
58
58
|
return y;
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
function PieArcLabel(props) {
|
|
61
61
|
const {
|
|
62
62
|
id,
|
|
63
63
|
classes: innerClasses,
|
|
@@ -98,12 +98,8 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
98
98
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
99
99
|
// ----------------------------------------------------------------------
|
|
100
100
|
classes: PropTypes.object,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
innerRadius: PropTypes.number,
|
|
108
|
-
outerRadius: PropTypes.number.isRequired
|
|
109
|
-
} : void 0;
|
|
101
|
+
formattedArcLabel: PropTypes.string,
|
|
102
|
+
isFaded: PropTypes.bool.isRequired,
|
|
103
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
104
|
+
} : void 0;
|
|
105
|
+
export { PieArcLabel };
|
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
7
|
import { defaultLabelTransitionConfig } from './dataTransform/transition';
|
|
8
8
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
9
|
-
import PieArcLabel from './PieArcLabel';
|
|
9
|
+
import { PieArcLabel } from './PieArcLabel';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const RATIO = 180 / Math.PI;
|
|
12
12
|
function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
@@ -4,7 +4,7 @@ const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRa
|
|
|
4
4
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import PieArc from './PieArc';
|
|
7
|
+
import { PieArc } from './PieArc';
|
|
8
8
|
import { defaultTransitionConfig } from './dataTransform/transition';
|
|
9
9
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
package/modern/PieChart/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PiePlot } from './PiePlot';
|
|
2
2
|
export { PieChart } from './PieChart';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export { PieArcLabel, getPieArcLabelUtilityClass, pieArcLabelClasses } from './PieArcLabel';
|
|
4
|
+
export { PieArc, getPieArcUtilityClass, pieArcClasses } from './PieArc';
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ export interface ChartsComponents {
|
|
|
24
24
|
};
|
|
25
25
|
MuiChartsTooltip?: {
|
|
26
26
|
defaultProps?: ComponentsProps['MuiChartsTooltip'];
|
|
27
|
+
styleOverrides?: ComponentsOverrides['MuiChartsTooltip'];
|
|
27
28
|
};
|
|
28
29
|
MuiChartsSurface?: {
|
|
29
30
|
defaultProps?: ComponentsProps['MuiChartsSurface'];
|
|
@@ -2,6 +2,7 @@ import { BarElementClassKey } from '../BarChart/BarElement';
|
|
|
2
2
|
import { ChartsAxisClassKey } from '../ChartsAxis';
|
|
3
3
|
import { ChartsAxisHighlightClassKey } from '../ChartsAxisHighlight';
|
|
4
4
|
import { ChartsLegendClassKey } from '../ChartsLegend';
|
|
5
|
+
import { ChartsTooltipClassKey } from '../ChartsTooltip';
|
|
5
6
|
import { AreaElementClassKey, LineElementClassKey, MarkElementClassKey } from '../LineChart';
|
|
6
7
|
|
|
7
8
|
// prettier-ignore
|
|
@@ -9,6 +10,7 @@ export interface PickersComponentNameToClassKey {
|
|
|
9
10
|
MuiChartsAxis: ChartsAxisClassKey;
|
|
10
11
|
MuiChartsAxisHighlight: ChartsAxisHighlightClassKey;
|
|
11
12
|
MuiChartsLegend: ChartsLegendClassKey;
|
|
13
|
+
MuiChartsTooltip: ChartsTooltipClassKey;
|
|
12
14
|
|
|
13
15
|
// BarChart components
|
|
14
16
|
MuiBarElement: BarElementClassKey;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ChartsTooltipClasses {
|
|
2
|
-
/** Styles applied to the root element. */
|
|
3
|
-
root: string;
|
|
4
|
-
/** Styles applied to the markCell element. */
|
|
5
|
-
markCell: string;
|
|
6
|
-
/** Styles applied to the labelCell element. */
|
|
7
|
-
labelCell: string;
|
|
8
|
-
/** Styles applied to the valueCell element. */
|
|
9
|
-
valueCell: string;
|
|
10
|
-
}
|
|
11
|
-
export type ChartsTooltipClassKey = keyof ChartsTooltipClasses;
|
|
12
|
-
export declare function getTooltipUtilityClass(slot: string): string;
|
|
13
|
-
export declare const tooltipClasses: ChartsTooltipClasses;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getTooltipUtilityClass = getTooltipUtilityClass;
|
|
7
|
-
exports.tooltipClasses = void 0;
|
|
8
|
-
var _utils = require("@mui/utils");
|
|
9
|
-
function getTooltipUtilityClass(slot) {
|
|
10
|
-
return (0, _utils.unstable_generateUtilityClass)('MuiChartsTooltip', slot);
|
|
11
|
-
}
|
|
12
|
-
const tooltipClasses = exports.tooltipClasses = (0, _utils.unstable_generateUtilityClasses)('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export const tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export var tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export const tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|