@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',
|
|
@@ -46,23 +50,27 @@ const ChartsTooltipRoot = styled(Popper, {
|
|
|
46
50
|
*/
|
|
47
51
|
function ChartsTooltip(props) {
|
|
48
52
|
var _slots$popper, _slots$itemContent, _slots$axisContent;
|
|
53
|
+
const themeProps = useThemeProps({
|
|
54
|
+
props,
|
|
55
|
+
name: 'MuiChartsTooltip'
|
|
56
|
+
});
|
|
49
57
|
const {
|
|
50
58
|
trigger = 'axis',
|
|
51
59
|
itemContent,
|
|
52
60
|
axisContent,
|
|
53
61
|
slots,
|
|
54
62
|
slotProps
|
|
55
|
-
} =
|
|
63
|
+
} = themeProps;
|
|
56
64
|
const mousePosition = useMouseTracker();
|
|
57
65
|
const {
|
|
58
66
|
item,
|
|
59
67
|
axis
|
|
60
68
|
} = React.useContext(InteractionContext);
|
|
61
69
|
const displayedData = trigger === 'item' ? item : axis;
|
|
62
|
-
const tooltipHasData =
|
|
70
|
+
const tooltipHasData = getTooltipHasData(trigger, displayedData);
|
|
63
71
|
const popperOpen = mousePosition !== null && tooltipHasData;
|
|
64
72
|
const classes = useUtilityClasses({
|
|
65
|
-
classes:
|
|
73
|
+
classes: themeProps.classes
|
|
66
74
|
});
|
|
67
75
|
const PopperComponent = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : ChartsTooltipRoot;
|
|
68
76
|
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
|
}
|
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -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/esm/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/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import Typography from '@mui/material/Typography';
|
|
4
5
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
6
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
@@ -25,6 +26,7 @@ export function DefaultChartsAxisContent(props) {
|
|
|
25
26
|
sx: sx,
|
|
26
27
|
className: classes.root,
|
|
27
28
|
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
29
|
+
className: classes.table,
|
|
28
30
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
29
31
|
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
30
32
|
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
@@ -46,21 +48,23 @@ export function DefaultChartsAxisContent(props) {
|
|
|
46
48
|
return null;
|
|
47
49
|
}
|
|
48
50
|
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
51
|
+
className: classes.row,
|
|
49
52
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
50
|
-
className: classes.markCell,
|
|
53
|
+
className: clsx(classes.markCell, classes.cell),
|
|
51
54
|
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
52
55
|
ownerState: {
|
|
53
56
|
color: color
|
|
54
57
|
},
|
|
55
|
-
boxShadow: 1
|
|
58
|
+
boxShadow: 1,
|
|
59
|
+
className: classes.mark
|
|
56
60
|
})
|
|
57
61
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
58
|
-
className: classes.labelCell,
|
|
62
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
59
63
|
children: label ? /*#__PURE__*/_jsx(Typography, {
|
|
60
64
|
children: label
|
|
61
65
|
}) : null
|
|
62
66
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
63
|
-
className: classes.valueCell,
|
|
67
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
64
68
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
65
69
|
children: formattedValue
|
|
66
70
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import { useSlotProps } from '@mui/base/utils';
|
|
4
5
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
5
6
|
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
@@ -30,20 +31,23 @@ export function DefaultChartsItemContent(props) {
|
|
|
30
31
|
sx: sx,
|
|
31
32
|
className: classes.root,
|
|
32
33
|
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
34
|
+
className: classes.table,
|
|
33
35
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
34
36
|
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
37
|
+
className: classes.row,
|
|
35
38
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
36
|
-
className: classes.markCell,
|
|
39
|
+
className: clsx(classes.markCell, classes.cell),
|
|
37
40
|
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
38
41
|
ownerState: {
|
|
39
42
|
color: color
|
|
40
|
-
}
|
|
43
|
+
},
|
|
44
|
+
className: classes.mark
|
|
41
45
|
})
|
|
42
46
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
43
|
-
className: classes.labelCell,
|
|
47
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
44
48
|
children: displayedLabel
|
|
45
49
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
46
|
-
className: classes.valueCell,
|
|
50
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
47
51
|
children: formattedValue
|
|
48
52
|
})]
|
|
49
53
|
})
|
|
@@ -2,25 +2,29 @@ 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
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
16
16
|
var classes = ownerState.classes;
|
|
17
17
|
var slots = {
|
|
18
18
|
root: ['root'],
|
|
19
|
+
table: ['table'],
|
|
20
|
+
row: ['row'],
|
|
21
|
+
cell: ['cell'],
|
|
22
|
+
mark: ['mark'],
|
|
19
23
|
markCell: ['markCell'],
|
|
20
24
|
labelCell: ['labelCell'],
|
|
21
25
|
valueCell: ['valueCell']
|
|
22
26
|
};
|
|
23
|
-
return composeClasses(slots,
|
|
27
|
+
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
24
28
|
};
|
|
25
29
|
var ChartsTooltipRoot = styled(Popper, {
|
|
26
30
|
name: 'MuiChartsTooltip',
|
|
@@ -47,21 +51,25 @@ var ChartsTooltipRoot = styled(Popper, {
|
|
|
47
51
|
*/
|
|
48
52
|
function ChartsTooltip(props) {
|
|
49
53
|
var _slots$popper, _slots$itemContent, _slots$axisContent;
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
var themeProps = useThemeProps({
|
|
55
|
+
props: props,
|
|
56
|
+
name: 'MuiChartsTooltip'
|
|
57
|
+
});
|
|
58
|
+
var _themeProps$trigger = themeProps.trigger,
|
|
59
|
+
trigger = _themeProps$trigger === void 0 ? 'axis' : _themeProps$trigger,
|
|
60
|
+
itemContent = themeProps.itemContent,
|
|
61
|
+
axisContent = themeProps.axisContent,
|
|
62
|
+
slots = themeProps.slots,
|
|
63
|
+
slotProps = themeProps.slotProps;
|
|
56
64
|
var mousePosition = useMouseTracker();
|
|
57
65
|
var _React$useContext = React.useContext(InteractionContext),
|
|
58
66
|
item = _React$useContext.item,
|
|
59
67
|
axis = _React$useContext.axis;
|
|
60
68
|
var displayedData = trigger === 'item' ? item : axis;
|
|
61
|
-
var tooltipHasData =
|
|
69
|
+
var tooltipHasData = getTooltipHasData(trigger, displayedData);
|
|
62
70
|
var popperOpen = mousePosition !== null && tooltipHasData;
|
|
63
71
|
var classes = useUtilityClasses({
|
|
64
|
-
classes:
|
|
72
|
+
classes: themeProps.classes
|
|
65
73
|
});
|
|
66
74
|
var PopperComponent = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : ChartsTooltipRoot;
|
|
67
75
|
var popperProps = useSlotProps({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import Box from '@mui/system/Box';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
import {
|
|
4
|
+
import { chartsTooltipClasses } from './chartsTooltipClasses';
|
|
5
5
|
export var ChartsTooltipPaper = styled('div', {
|
|
6
6
|
name: 'MuiChartsTooltip',
|
|
7
7
|
slot: 'Container'
|
|
@@ -50,9 +50,9 @@ export var ChartsTooltipCell = styled('td', {
|
|
|
50
50
|
return _ref5 = {
|
|
51
51
|
verticalAlign: 'middle',
|
|
52
52
|
color: (theme.vars || theme).palette.text.secondary
|
|
53
|
-
}, _defineProperty(_ref5, "&.".concat(
|
|
53
|
+
}, _defineProperty(_ref5, "&.".concat(chartsTooltipClasses.labelCell), {
|
|
54
54
|
paddingLeft: theme.spacing(1)
|
|
55
|
-
}), _defineProperty(_ref5, "&.".concat(
|
|
55
|
+
}), _defineProperty(_ref5, "&.".concat(chartsTooltipClasses.valueCell), {
|
|
56
56
|
paddingLeft: theme.spacing(4),
|
|
57
57
|
color: (theme.vars || theme).palette.text.primary
|
|
58
58
|
}), _defineProperty(_ref5, 'td:first-of-type&', {
|
|
@@ -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 var 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';
|
|
@@ -81,7 +81,7 @@ export function useMouseTracker() {
|
|
|
81
81
|
}, [svgRef]);
|
|
82
82
|
return mousePosition;
|
|
83
83
|
}
|
|
84
|
-
export function
|
|
84
|
+
export function getTooltipHasData(trigger, displayedData) {
|
|
85
85
|
if (trigger === 'item') {
|
|
86
86
|
return displayedData !== null;
|
|
87
87
|
}
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _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';
|
|
@@ -38,7 +39,7 @@ var PieArcRoot = styled(animated.path, {
|
|
|
38
39
|
strokeLinejoin: 'round'
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
+
function PieArc(props) {
|
|
42
43
|
var id = props.id,
|
|
43
44
|
dataIndex = props.dataIndex,
|
|
44
45
|
innerClasses = props.classes,
|
|
@@ -83,4 +84,19 @@ export default function PieArc(props) {
|
|
|
83
84
|
seriesId: id,
|
|
84
85
|
dataIndex: dataIndex
|
|
85
86
|
})));
|
|
86
|
-
}
|
|
87
|
+
}
|
|
88
|
+
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
89
|
+
// ----------------------------- Warning --------------------------------
|
|
90
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
91
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
92
|
+
// ----------------------------------------------------------------------
|
|
93
|
+
classes: PropTypes.object,
|
|
94
|
+
dataIndex: PropTypes.number.isRequired,
|
|
95
|
+
highlightScope: PropTypes.shape({
|
|
96
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
97
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
98
|
+
}),
|
|
99
|
+
isFaded: PropTypes.bool.isRequired,
|
|
100
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
101
|
+
} : void 0;
|
|
102
|
+
export { PieArc };
|
|
@@ -3,9 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { animated, to } from '@react-spring/web';
|
|
7
8
|
import { arc as d3Arc } from 'd3-shape';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
11
11
|
import { styled } from '@mui/material/styles';
|
|
@@ -64,7 +64,7 @@ var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
|
|
|
64
64
|
return y;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
function PieArcLabel(props) {
|
|
68
68
|
var id = props.id,
|
|
69
69
|
innerClasses = props.classes,
|
|
70
70
|
color = props.color,
|
|
@@ -103,12 +103,8 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
103
103
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
104
104
|
// ----------------------------------------------------------------------
|
|
105
105
|
classes: PropTypes.object,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
innerRadius: PropTypes.number,
|
|
113
|
-
outerRadius: PropTypes.number.isRequired
|
|
114
|
-
} : void 0;
|
|
106
|
+
formattedArcLabel: PropTypes.string,
|
|
107
|
+
isFaded: PropTypes.bool.isRequired,
|
|
108
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
109
|
+
} : void 0;
|
|
110
|
+
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
|
var RATIO = 180 / Math.PI;
|
|
12
12
|
function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
@@ -4,7 +4,7 @@ var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadi
|
|
|
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/legacy/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/legacy/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import Typography from '@mui/material/Typography';
|
|
4
5
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
6
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
@@ -24,6 +25,7 @@ export function DefaultChartsAxisContent(props) {
|
|
|
24
25
|
sx: sx,
|
|
25
26
|
className: classes.root,
|
|
26
27
|
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
28
|
+
className: classes.table,
|
|
27
29
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
28
30
|
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
29
31
|
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
@@ -46,21 +48,23 @@ export function DefaultChartsAxisContent(props) {
|
|
|
46
48
|
return null;
|
|
47
49
|
}
|
|
48
50
|
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
51
|
+
className: classes.row,
|
|
49
52
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
50
|
-
className: classes.markCell,
|
|
53
|
+
className: clsx(classes.markCell, classes.cell),
|
|
51
54
|
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
52
55
|
ownerState: {
|
|
53
56
|
color
|
|
54
57
|
},
|
|
55
|
-
boxShadow: 1
|
|
58
|
+
boxShadow: 1,
|
|
59
|
+
className: classes.mark
|
|
56
60
|
})
|
|
57
61
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
58
|
-
className: classes.labelCell,
|
|
62
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
59
63
|
children: label ? /*#__PURE__*/_jsx(Typography, {
|
|
60
64
|
children: label
|
|
61
65
|
}) : null
|
|
62
66
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
63
|
-
className: classes.valueCell,
|
|
67
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
64
68
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
65
69
|
children: formattedValue
|
|
66
70
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
import { useSlotProps } from '@mui/base/utils';
|
|
4
5
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
5
6
|
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
@@ -33,20 +34,23 @@ export function DefaultChartsItemContent(props) {
|
|
|
33
34
|
sx: sx,
|
|
34
35
|
className: classes.root,
|
|
35
36
|
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
37
|
+
className: classes.table,
|
|
36
38
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
37
39
|
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
40
|
+
className: classes.row,
|
|
38
41
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
39
|
-
className: classes.markCell,
|
|
42
|
+
className: clsx(classes.markCell, classes.cell),
|
|
40
43
|
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
41
44
|
ownerState: {
|
|
42
45
|
color
|
|
43
|
-
}
|
|
46
|
+
},
|
|
47
|
+
className: classes.mark
|
|
44
48
|
})
|
|
45
49
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
46
|
-
className: classes.labelCell,
|
|
50
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
47
51
|
children: displayedLabel
|
|
48
52
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
49
|
-
className: classes.valueCell,
|
|
53
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
50
54
|
children: formattedValue
|
|
51
55
|
})]
|
|
52
56
|
})
|