@mui/x-charts 7.0.0-alpha.0 → 7.0.0-alpha.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/BarChart/index.d.ts +2 -2
- package/BarChart/index.js +21 -13
- package/CHANGELOG.md +591 -5
- 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/LineChart/index.d.ts +5 -5
- package/LineChart/index.js +50 -41
- package/PieChart/index.d.ts +2 -2
- package/PieChart/index.js +20 -18
- package/ScatterChart/index.d.ts +3 -3
- package/ScatterChart/index.js +31 -19
- package/SparkLineChart/index.d.ts +1 -1
- package/SparkLineChart/index.js +11 -7
- package/esm/BarChart/index.js +2 -2
- 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/LineChart/index.js +5 -5
- package/esm/PieChart/index.js +2 -2
- package/esm/ScatterChart/index.js +3 -3
- package/esm/SparkLineChart/index.js +1 -1
- package/index.js +1 -1
- package/legacy/BarChart/index.js +2 -2
- package/legacy/ChartsReferenceLine/common.js +3 -4
- 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 +7 -8
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/legacy/ChartsTooltip/index.js +2 -1
- package/legacy/ChartsTooltip/utils.js +1 -1
- package/legacy/LineChart/index.js +5 -5
- package/legacy/PieChart/index.js +2 -2
- package/legacy/ScatterChart/index.js +3 -3
- package/legacy/SparkLineChart/index.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/components/AxisSharedComponents.js +5 -6
- package/modern/BarChart/index.js +2 -2
- 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/LineChart/index.js +5 -5
- package/modern/PieChart/index.js +2 -2
- package/modern/ScatterChart/index.js +3 -3
- package/modern/SparkLineChart/index.js +1 -1
- package/modern/index.js +1 -1
- package/package.json +4 -3
- 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/LineChart/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './LinePlot';
|
|
2
|
+
export * from './AreaPlot';
|
|
3
|
+
export * from './MarkPlot';
|
|
4
|
+
export * from './LineHighlightPlot';
|
|
5
|
+
export * from './LineChart';
|
|
6
6
|
export * from './AreaElement';
|
|
7
7
|
export * from './LineElement';
|
|
8
8
|
export * from './MarkElement';
|
package/esm/PieChart/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './ScatterPlot';
|
|
2
|
+
export * from './ScatterChart';
|
|
3
|
+
export * from './Scatter';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './SparkLineChart';
|
package/index.js
CHANGED
package/legacy/BarChart/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './BarPlot';
|
|
2
|
+
export * from './BarChart';
|
|
@@ -3,18 +3,17 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { referenceLineClasses } from './chartsReferenceLineClasses';
|
|
5
5
|
export var ReferenceLineRoot = styled('g')(function (_ref) {
|
|
6
|
-
var _ref2;
|
|
7
6
|
var theme = _ref.theme;
|
|
8
|
-
return
|
|
7
|
+
return _defineProperty(_defineProperty({}, "& .".concat(referenceLineClasses.line), {
|
|
9
8
|
fill: 'none',
|
|
10
9
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
11
10
|
shapeRendering: 'crispEdges',
|
|
12
11
|
strokeWidth: 1,
|
|
13
12
|
pointerEvents: 'none'
|
|
14
|
-
}),
|
|
13
|
+
}), "& .".concat(referenceLineClasses.label), _extends({
|
|
15
14
|
fill: (theme.vars || theme).palette.text.primary,
|
|
16
15
|
stroke: 'none',
|
|
17
16
|
pointerEvents: 'none',
|
|
18
17
|
fontSize: 12
|
|
19
|
-
}, theme.typography.body1))
|
|
18
|
+
}, theme.typography.body1));
|
|
20
19
|
});
|
|
@@ -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'
|
|
@@ -45,21 +45,20 @@ export var ChartsTooltipCell = styled('td', {
|
|
|
45
45
|
name: 'MuiChartsTooltip',
|
|
46
46
|
slot: 'Cell'
|
|
47
47
|
})(function (_ref4) {
|
|
48
|
-
var _ref5;
|
|
49
48
|
var theme = _ref4.theme;
|
|
50
|
-
return
|
|
49
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
51
50
|
verticalAlign: 'middle',
|
|
52
51
|
color: (theme.vars || theme).palette.text.secondary
|
|
53
|
-
},
|
|
52
|
+
}, "&.".concat(chartsTooltipClasses.labelCell), {
|
|
54
53
|
paddingLeft: theme.spacing(1)
|
|
55
|
-
}),
|
|
54
|
+
}), "&.".concat(chartsTooltipClasses.valueCell), {
|
|
56
55
|
paddingLeft: theme.spacing(4),
|
|
57
56
|
color: (theme.vars || theme).palette.text.primary
|
|
58
|
-
}),
|
|
57
|
+
}), 'td:first-of-type&', {
|
|
59
58
|
paddingLeft: theme.spacing(2)
|
|
60
|
-
}),
|
|
59
|
+
}), 'td:last-of-type&', {
|
|
61
60
|
paddingRight: theme.spacing(2)
|
|
62
|
-
})
|
|
61
|
+
});
|
|
63
62
|
});
|
|
64
63
|
export var ChartsTooltipMark = styled(Box, {
|
|
65
64
|
name: 'MuiChartsTooltip',
|
|
@@ -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
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './LinePlot';
|
|
2
|
+
export * from './AreaPlot';
|
|
3
|
+
export * from './MarkPlot';
|
|
4
|
+
export * from './LineHighlightPlot';
|
|
5
|
+
export * from './LineChart';
|
|
6
6
|
export * from './AreaElement';
|
|
7
7
|
export * from './LineElement';
|
|
8
8
|
export * from './MarkElement';
|
package/legacy/PieChart/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './ScatterPlot';
|
|
2
|
+
export * from './ScatterChart';
|
|
3
|
+
export * from './Scatter';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './SparkLineChart';
|
package/legacy/index.js
CHANGED
|
@@ -9,18 +9,17 @@ export var AxisRoot = styled('g', {
|
|
|
9
9
|
return styles.root;
|
|
10
10
|
}
|
|
11
11
|
})(function (_ref) {
|
|
12
|
-
var _ref2;
|
|
13
12
|
var theme = _ref.theme;
|
|
14
|
-
return
|
|
13
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "& .".concat(axisClasses.tickLabel), _extends({}, theme.typography.caption, {
|
|
15
14
|
fill: (theme.vars || theme).palette.text.primary
|
|
16
|
-
})),
|
|
15
|
+
})), "& .".concat(axisClasses.label), _extends({}, theme.typography.body1, {
|
|
17
16
|
fill: (theme.vars || theme).palette.text.primary
|
|
18
|
-
})),
|
|
17
|
+
})), "& .".concat(axisClasses.line), {
|
|
19
18
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
20
19
|
shapeRendering: 'crispEdges',
|
|
21
20
|
strokeWidth: 1
|
|
22
|
-
}),
|
|
21
|
+
}), "& .".concat(axisClasses.tick), {
|
|
23
22
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
24
23
|
shapeRendering: 'crispEdges'
|
|
25
|
-
})
|
|
24
|
+
});
|
|
26
25
|
});
|
package/modern/BarChart/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './BarPlot';
|
|
2
|
+
export * from './BarChart';
|
|
@@ -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
|
})
|
|
@@ -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']);
|