@mui/x-charts-pro 8.0.0-alpha.0 → 8.0.0-alpha.1
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/BarChartPro/BarChartPro.js +3 -31
- package/CHANGELOG.md +429 -5
- package/ChartContainerPro/ChartContainerPro.js +13 -23
- package/ChartContainerPro/useChartContainerProProps.d.ts +2 -39
- package/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/Heatmap/Heatmap.d.ts +11 -4
- package/Heatmap/Heatmap.js +4 -35
- package/Heatmap/HeatmapTooltip.d.ts +9 -0
- package/Heatmap/HeatmapTooltip.js +294 -0
- package/Heatmap/index.d.ts +1 -1
- package/Heatmap/index.js +1 -1
- package/LineChartPro/LineChartPro.js +3 -32
- package/README.md +2 -2
- package/ScatterChartPro/ScatterChartPro.js +3 -32
- package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +4 -1
- package/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -5
- package/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/index.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.js +3 -31
- package/modern/ChartContainerPro/ChartContainerPro.js +13 -23
- package/modern/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/modern/Heatmap/Heatmap.js +4 -35
- package/modern/Heatmap/HeatmapTooltip.js +294 -0
- package/modern/Heatmap/index.js +1 -1
- package/modern/LineChartPro/LineChartPro.js +3 -32
- package/modern/ScatterChartPro/ScatterChartPro.js +3 -32
- package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/BarChartPro/BarChartPro.js +3 -31
- package/node/ChartContainerPro/ChartContainerPro.js +13 -23
- package/node/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/node/Heatmap/Heatmap.js +4 -35
- package/node/Heatmap/HeatmapTooltip.js +300 -0
- package/node/Heatmap/index.js +4 -4
- package/node/LineChartPro/LineChartPro.js +3 -32
- package/node/ScatterChartPro/ScatterChartPro.js +3 -32
- package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +21 -20
- package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +7 -7
- package/Heatmap/DefaultHeatmapTooltip.d.ts +0 -7
- package/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/modern/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/node/Heatmap/DefaultHeatmapTooltip.js +0 -105
|
@@ -16,12 +16,14 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
16
16
|
};
|
|
17
17
|
const {
|
|
18
18
|
chartDataProviderProps,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
chartsSurfaceProps,
|
|
20
|
+
resizableContainerProps,
|
|
21
|
+
children
|
|
21
22
|
} = useChartContainerProps(baseProps, ref);
|
|
22
23
|
return {
|
|
23
24
|
chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
resizableContainerProps,
|
|
26
|
+
chartsSurfaceProps,
|
|
27
|
+
children
|
|
26
28
|
};
|
|
27
29
|
};
|
package/Heatmap/Heatmap.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
3
|
import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
|
|
4
|
-
import { ChartsTooltipProps
|
|
4
|
+
import { ChartsTooltipProps } from '@mui/x-charts/ChartsTooltip';
|
|
5
5
|
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps, AxisConfig } from '@mui/x-charts/internals';
|
|
6
6
|
import { ChartsOnAxisClickHandlerProps } from '@mui/x-charts/ChartsOnAxisClickHandler';
|
|
7
7
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
8
8
|
import { ChartContainerProProps } from '../ChartContainerPro';
|
|
9
9
|
import { HeatmapSeriesType } from '../models/seriesType/heatmap';
|
|
10
|
+
import { HeatmapTooltipProps } from './HeatmapTooltip';
|
|
10
11
|
import { HeatmapItemSlotProps, HeatmapItemSlots } from './HeatmapItem';
|
|
11
|
-
export interface HeatmapSlots extends ChartsAxisSlots,
|
|
12
|
+
export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
|
|
13
|
+
/**
|
|
14
|
+
* Custom component for the tooltip popper.
|
|
15
|
+
* @default ChartsTooltipRoot
|
|
16
|
+
*/
|
|
17
|
+
tooltip?: React.ElementType<HeatmapTooltipProps>;
|
|
12
18
|
}
|
|
13
|
-
export interface HeatmapSlotProps extends ChartsAxisSlotProps,
|
|
19
|
+
export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps {
|
|
20
|
+
tooltip?: Partial<HeatmapTooltipProps>;
|
|
14
21
|
}
|
|
15
22
|
export interface HeatmapProps extends Omit<ChartContainerProProps, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'zoom' | 'onZoomChange' | 'skipAnimation'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
16
23
|
/**
|
|
@@ -34,7 +41,7 @@ export interface HeatmapProps extends Omit<ChartContainerProProps, 'series' | 'p
|
|
|
34
41
|
* The configuration of the tooltip.
|
|
35
42
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
36
43
|
*/
|
|
37
|
-
tooltip?: ChartsTooltipProps
|
|
44
|
+
tooltip?: ChartsTooltipProps;
|
|
38
45
|
/**
|
|
39
46
|
* Overridable component slots.
|
|
40
47
|
* @default {}
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -7,14 +7,13 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
|
|
9
9
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
|
-
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
11
10
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
12
11
|
import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
|
|
13
12
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
14
13
|
import { ChartContainerPro } from "../ChartContainerPro/index.js";
|
|
15
14
|
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
16
15
|
import { plugin as heatmapPlugin } from "./plugin.js";
|
|
17
|
-
import {
|
|
16
|
+
import { HeatmapTooltip } from "./HeatmapTooltip.js";
|
|
18
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
18
|
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
20
19
|
const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
@@ -34,7 +33,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
34
33
|
colors,
|
|
35
34
|
dataset,
|
|
36
35
|
sx,
|
|
37
|
-
tooltip,
|
|
38
36
|
topAxis,
|
|
39
37
|
leftAxis,
|
|
40
38
|
rightAxis,
|
|
@@ -65,6 +63,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
65
63
|
color: defaultColorMap
|
|
66
64
|
}
|
|
67
65
|
}], [zAxis]);
|
|
66
|
+
const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
|
|
68
67
|
return /*#__PURE__*/_jsxs(ChartContainerPro, {
|
|
69
68
|
ref: ref,
|
|
70
69
|
plugins: [heatmapPlugin],
|
|
@@ -102,14 +101,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
102
101
|
bottomAxis: bottomAxis,
|
|
103
102
|
slots: slots,
|
|
104
103
|
slotProps: slotProps
|
|
105
|
-
}), !loading && /*#__PURE__*/_jsx(
|
|
106
|
-
trigger: "item"
|
|
107
|
-
}, tooltip, {
|
|
108
|
-
slots: _extends({
|
|
109
|
-
itemContent: DefaultHeatmapTooltip
|
|
110
|
-
}, slots),
|
|
111
|
-
slotProps: slotProps
|
|
112
|
-
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
104
|
+
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
113
105
|
id: clipPathId
|
|
114
106
|
}), children]
|
|
115
107
|
});
|
|
@@ -190,16 +182,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
190
182
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
191
183
|
*/
|
|
192
184
|
onHighlightChange: PropTypes.func,
|
|
193
|
-
/**
|
|
194
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
195
|
-
* before it renders for the first time.
|
|
196
|
-
*
|
|
197
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
198
|
-
* the first render, like when used inside a grid.
|
|
199
|
-
*
|
|
200
|
-
* @default false
|
|
201
|
-
*/
|
|
202
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
203
185
|
/**
|
|
204
186
|
* Indicate which axis to display the right of the charts.
|
|
205
187
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -227,26 +209,13 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
227
209
|
* The configuration of the tooltip.
|
|
228
210
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
229
211
|
*/
|
|
230
|
-
tooltip: PropTypes.
|
|
231
|
-
axisContent: PropTypes.elementType,
|
|
232
|
-
classes: PropTypes.object,
|
|
233
|
-
itemContent: PropTypes.elementType,
|
|
234
|
-
slotProps: PropTypes.object,
|
|
235
|
-
slots: PropTypes.object,
|
|
236
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
237
|
-
}),
|
|
212
|
+
tooltip: PropTypes.object,
|
|
238
213
|
/**
|
|
239
214
|
* Indicate which axis to display the top of the charts.
|
|
240
215
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
241
216
|
* @default null
|
|
242
217
|
*/
|
|
243
218
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
244
|
-
viewBox: PropTypes.shape({
|
|
245
|
-
height: PropTypes.number,
|
|
246
|
-
width: PropTypes.number,
|
|
247
|
-
x: PropTypes.number,
|
|
248
|
-
y: PropTypes.number
|
|
249
|
-
}),
|
|
250
219
|
/**
|
|
251
220
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
252
221
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
|
|
3
|
+
export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
|
|
4
|
+
}
|
|
5
|
+
declare function HeatmapTooltip(props: HeatmapTooltipProps): React.JSX.Element;
|
|
6
|
+
declare namespace HeatmapTooltip {
|
|
7
|
+
var propTypes: any;
|
|
8
|
+
}
|
|
9
|
+
export { HeatmapTooltip };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
|
|
9
|
+
import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
|
|
10
|
+
import { getLabel } from '@mui/x-charts/internals';
|
|
11
|
+
import { useHeatmapSeries } from "../hooks/useSeries.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const useUtilityClasses = ownerState => {
|
|
14
|
+
const {
|
|
15
|
+
classes
|
|
16
|
+
} = ownerState;
|
|
17
|
+
const slots = {
|
|
18
|
+
root: ['root'],
|
|
19
|
+
paper: ['paper'],
|
|
20
|
+
table: ['table'],
|
|
21
|
+
row: ['row'],
|
|
22
|
+
cell: ['cell'],
|
|
23
|
+
mark: ['mark'],
|
|
24
|
+
markCell: ['markCell'],
|
|
25
|
+
labelCell: ['labelCell'],
|
|
26
|
+
valueCell: ['valueCell']
|
|
27
|
+
};
|
|
28
|
+
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @ignore - internal component.
|
|
33
|
+
*/
|
|
34
|
+
function DefaultHeatmapTooltipContent(props) {
|
|
35
|
+
const {
|
|
36
|
+
classes
|
|
37
|
+
} = props;
|
|
38
|
+
const xAxis = useXAxis();
|
|
39
|
+
const yAxis = useYAxis();
|
|
40
|
+
const heatmapSeries = useHeatmapSeries();
|
|
41
|
+
const tooltipData = useItemTooltip();
|
|
42
|
+
if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const {
|
|
46
|
+
series,
|
|
47
|
+
seriesOrder
|
|
48
|
+
} = heatmapSeries;
|
|
49
|
+
const seriesId = seriesOrder[0];
|
|
50
|
+
const {
|
|
51
|
+
color,
|
|
52
|
+
value,
|
|
53
|
+
identifier
|
|
54
|
+
} = tooltipData;
|
|
55
|
+
const [xIndex, yIndex] = value;
|
|
56
|
+
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
57
|
+
location: 'tooltip'
|
|
58
|
+
}) ?? xAxis.data[xIndex].toLocaleString();
|
|
59
|
+
const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
|
|
60
|
+
location: 'tooltip'
|
|
61
|
+
}) ?? yAxis.data[yIndex].toLocaleString();
|
|
62
|
+
const formattedValue = series[seriesId].valueFormatter(value, {
|
|
63
|
+
dataIndex: identifier.dataIndex
|
|
64
|
+
});
|
|
65
|
+
const seriesLabel = getLabel(series[seriesId].label, 'tooltip');
|
|
66
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
67
|
+
className: classes?.paper,
|
|
68
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
69
|
+
className: classes?.table,
|
|
70
|
+
children: [/*#__PURE__*/_jsx("thead", {
|
|
71
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
72
|
+
className: classes?.row,
|
|
73
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
74
|
+
className: classes?.cell,
|
|
75
|
+
children: formattedX
|
|
76
|
+
}), formattedX && formattedY && /*#__PURE__*/_jsx(ChartsTooltipCell, {}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
77
|
+
className: classes?.cell,
|
|
78
|
+
children: formattedY
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
81
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
82
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
83
|
+
className: classes?.row,
|
|
84
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
85
|
+
className: clsx(classes?.markCell, classes?.cell),
|
|
86
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
87
|
+
color: color,
|
|
88
|
+
className: classes?.mark
|
|
89
|
+
})
|
|
90
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
91
|
+
className: clsx(classes?.labelCell, classes?.cell),
|
|
92
|
+
children: seriesLabel
|
|
93
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
94
|
+
className: clsx(classes?.valueCell, classes?.cell),
|
|
95
|
+
children: formattedValue
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
|
|
103
|
+
// ----------------------------- Warning --------------------------------
|
|
104
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
105
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
106
|
+
// ----------------------------------------------------------------------
|
|
107
|
+
/**
|
|
108
|
+
* Override or extend the styles applied to the component.
|
|
109
|
+
*/
|
|
110
|
+
classes: PropTypes.object
|
|
111
|
+
} : void 0;
|
|
112
|
+
function HeatmapTooltip(props) {
|
|
113
|
+
const classes = useUtilityClasses({
|
|
114
|
+
classes: props.classes
|
|
115
|
+
});
|
|
116
|
+
return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
|
|
117
|
+
classes: classes,
|
|
118
|
+
trigger: "item",
|
|
119
|
+
children: /*#__PURE__*/_jsx(DefaultHeatmapTooltipContent, {
|
|
120
|
+
classes: classes
|
|
121
|
+
})
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
|
|
125
|
+
// ----------------------------- Warning --------------------------------
|
|
126
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
127
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
128
|
+
// ----------------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
131
|
+
* or a function that returns either.
|
|
132
|
+
* It's used to set the position of the popper.
|
|
133
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
134
|
+
*/
|
|
135
|
+
anchorEl: PropTypes.oneOfType([(props, propName) => {
|
|
136
|
+
if (props[propName] == null) {
|
|
137
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
138
|
+
}
|
|
139
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
140
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}, PropTypes.func, PropTypes.shape({
|
|
144
|
+
contextElement: (props, propName) => {
|
|
145
|
+
if (props[propName] == null) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
149
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
},
|
|
153
|
+
getBoundingClientRect: PropTypes.func.isRequired
|
|
154
|
+
})]),
|
|
155
|
+
/**
|
|
156
|
+
* Override or extend the styles applied to the component.
|
|
157
|
+
*/
|
|
158
|
+
classes: PropTypes.object,
|
|
159
|
+
/**
|
|
160
|
+
* The component used for the root node.
|
|
161
|
+
* Either a string to use a HTML element or a component.
|
|
162
|
+
*/
|
|
163
|
+
component: PropTypes.elementType,
|
|
164
|
+
/**
|
|
165
|
+
* The components used for each slot inside the Popper.
|
|
166
|
+
* Either a string to use a HTML element or a component.
|
|
167
|
+
* @default {}
|
|
168
|
+
*/
|
|
169
|
+
components: PropTypes.shape({
|
|
170
|
+
Root: PropTypes.elementType
|
|
171
|
+
}),
|
|
172
|
+
/**
|
|
173
|
+
* The props used for each slot inside the Popper.
|
|
174
|
+
* @default {}
|
|
175
|
+
*/
|
|
176
|
+
componentsProps: PropTypes.shape({
|
|
177
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
178
|
+
}),
|
|
179
|
+
/**
|
|
180
|
+
* An HTML element or function that returns one.
|
|
181
|
+
* The `container` will have the portal children appended to it.
|
|
182
|
+
*
|
|
183
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
184
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
185
|
+
*
|
|
186
|
+
* By default, it uses the body of the top-level document object,
|
|
187
|
+
* so it's simply `document.body` most of the time.
|
|
188
|
+
*/
|
|
189
|
+
container: PropTypes.oneOfType([(props, propName) => {
|
|
190
|
+
if (props[propName] == null) {
|
|
191
|
+
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
192
|
+
}
|
|
193
|
+
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
194
|
+
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}, PropTypes.func]),
|
|
198
|
+
/**
|
|
199
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
200
|
+
* @default false
|
|
201
|
+
*/
|
|
202
|
+
disablePortal: PropTypes.bool,
|
|
203
|
+
/**
|
|
204
|
+
* Always keep the children in the DOM.
|
|
205
|
+
* This prop can be useful in SEO situation or
|
|
206
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
keepMounted: PropTypes.bool,
|
|
210
|
+
/**
|
|
211
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
212
|
+
* most of its features are fully encapsulated "modifiers".
|
|
213
|
+
*
|
|
214
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
215
|
+
* compute the position of the popper.
|
|
216
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
217
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
218
|
+
*/
|
|
219
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
220
|
+
data: PropTypes.object,
|
|
221
|
+
effect: PropTypes.func,
|
|
222
|
+
enabled: PropTypes.bool,
|
|
223
|
+
fn: PropTypes.func,
|
|
224
|
+
name: PropTypes.any,
|
|
225
|
+
options: PropTypes.object,
|
|
226
|
+
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
227
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
228
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
229
|
+
})),
|
|
230
|
+
/**
|
|
231
|
+
* If `true`, the component is shown.
|
|
232
|
+
*/
|
|
233
|
+
open: PropTypes.bool,
|
|
234
|
+
/**
|
|
235
|
+
* Popper placement.
|
|
236
|
+
* @default 'bottom'
|
|
237
|
+
*/
|
|
238
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
239
|
+
/**
|
|
240
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
241
|
+
* @default {}
|
|
242
|
+
*/
|
|
243
|
+
popperOptions: PropTypes.shape({
|
|
244
|
+
modifiers: PropTypes.array,
|
|
245
|
+
onFirstUpdate: PropTypes.func,
|
|
246
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
247
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
248
|
+
}),
|
|
249
|
+
/**
|
|
250
|
+
* A ref that points to the used popper instance.
|
|
251
|
+
*/
|
|
252
|
+
popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
253
|
+
current: PropTypes.shape({
|
|
254
|
+
destroy: PropTypes.func.isRequired,
|
|
255
|
+
forceUpdate: PropTypes.func.isRequired,
|
|
256
|
+
setOptions: PropTypes.func.isRequired,
|
|
257
|
+
state: PropTypes.shape({
|
|
258
|
+
attributes: PropTypes.object.isRequired,
|
|
259
|
+
elements: PropTypes.object.isRequired,
|
|
260
|
+
modifiersData: PropTypes.object.isRequired,
|
|
261
|
+
options: PropTypes.object.isRequired,
|
|
262
|
+
orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
263
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
|
|
264
|
+
rects: PropTypes.object.isRequired,
|
|
265
|
+
reset: PropTypes.bool.isRequired,
|
|
266
|
+
scrollParents: PropTypes.object.isRequired,
|
|
267
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
|
|
268
|
+
styles: PropTypes.object.isRequired
|
|
269
|
+
}).isRequired,
|
|
270
|
+
update: PropTypes.func.isRequired
|
|
271
|
+
})
|
|
272
|
+
})]),
|
|
273
|
+
/**
|
|
274
|
+
* The props used for each slot inside the Popper.
|
|
275
|
+
* @default {}
|
|
276
|
+
*/
|
|
277
|
+
slotProps: PropTypes.object,
|
|
278
|
+
/**
|
|
279
|
+
* The components used for each slot inside the Popper.
|
|
280
|
+
* Either a string to use a HTML element or a component.
|
|
281
|
+
* @default {}
|
|
282
|
+
*/
|
|
283
|
+
slots: PropTypes.object,
|
|
284
|
+
/**
|
|
285
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
286
|
+
*/
|
|
287
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
288
|
+
/**
|
|
289
|
+
* Help supporting a react-transition-group/Transition component.
|
|
290
|
+
* @default false
|
|
291
|
+
*/
|
|
292
|
+
transition: PropTypes.bool
|
|
293
|
+
} : void 0;
|
|
294
|
+
export { HeatmapTooltip };
|
package/Heatmap/index.d.ts
CHANGED
package/Heatmap/index.js
CHANGED
|
@@ -165,9 +165,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
165
165
|
axisHighlightProps,
|
|
166
166
|
lineHighlightPlotProps,
|
|
167
167
|
legendProps,
|
|
168
|
-
tooltipProps,
|
|
169
168
|
children
|
|
170
169
|
} = useLineChartProps(other);
|
|
170
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
171
171
|
return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
|
|
172
172
|
ref: ref
|
|
173
173
|
}, chartContainerProps, {
|
|
@@ -178,7 +178,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
|
|
|
178
178
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
179
179
|
"data-drawing-container": true,
|
|
180
180
|
children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
|
|
181
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
181
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
182
182
|
}));
|
|
183
183
|
});
|
|
184
184
|
process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
@@ -188,7 +188,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
188
188
|
// ----------------------------------------------------------------------
|
|
189
189
|
/**
|
|
190
190
|
* The configuration of axes highlight.
|
|
191
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
191
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
192
192
|
* @default { x: 'line' }
|
|
193
193
|
*/
|
|
194
194
|
axisHighlight: PropTypes.shape({
|
|
@@ -303,16 +303,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
303
303
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
304
304
|
*/
|
|
305
305
|
onZoomChange: PropTypes.func,
|
|
306
|
-
/**
|
|
307
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
308
|
-
* before it renders for the first time.
|
|
309
|
-
*
|
|
310
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
311
|
-
* the first render, like when used inside a grid.
|
|
312
|
-
*
|
|
313
|
-
* @default false
|
|
314
|
-
*/
|
|
315
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
316
306
|
/**
|
|
317
307
|
* Indicate which axis to display the right of the charts.
|
|
318
308
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -341,31 +331,12 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
341
331
|
slots: PropTypes.object,
|
|
342
332
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
343
333
|
title: PropTypes.string,
|
|
344
|
-
/**
|
|
345
|
-
* The configuration of the tooltip.
|
|
346
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
347
|
-
* @default { trigger: 'item' }
|
|
348
|
-
*/
|
|
349
|
-
tooltip: PropTypes.shape({
|
|
350
|
-
axisContent: PropTypes.elementType,
|
|
351
|
-
classes: PropTypes.object,
|
|
352
|
-
itemContent: PropTypes.elementType,
|
|
353
|
-
slotProps: PropTypes.object,
|
|
354
|
-
slots: PropTypes.object,
|
|
355
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
356
|
-
}),
|
|
357
334
|
/**
|
|
358
335
|
* Indicate which axis to display the top of the charts.
|
|
359
336
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
360
337
|
* @default null
|
|
361
338
|
*/
|
|
362
339
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
363
|
-
viewBox: PropTypes.shape({
|
|
364
|
-
height: PropTypes.number,
|
|
365
|
-
width: PropTypes.number,
|
|
366
|
-
x: PropTypes.number,
|
|
367
|
-
y: PropTypes.number
|
|
368
|
-
}),
|
|
369
340
|
/**
|
|
370
341
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
371
342
|
*/
|
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ This component has the following peer dependencies that you need to install as w
|
|
|
16
16
|
```json
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
19
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
20
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
19
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
20
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -49,9 +49,9 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
49
49
|
overlayProps,
|
|
50
50
|
legendProps,
|
|
51
51
|
axisHighlightProps,
|
|
52
|
-
tooltipProps,
|
|
53
52
|
children
|
|
54
53
|
} = useScatterChartProps(other);
|
|
54
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
55
55
|
return /*#__PURE__*/_jsx(ChartContainerPro, _extends({
|
|
56
56
|
ref: ref
|
|
57
57
|
}, chartContainerProps, {
|
|
@@ -61,7 +61,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
|
|
|
61
61
|
children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
62
62
|
"data-drawing-container": true,
|
|
63
63
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
64
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
64
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
65
65
|
}))
|
|
66
66
|
}));
|
|
67
67
|
});
|
|
@@ -72,7 +72,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
72
72
|
// ----------------------------------------------------------------------
|
|
73
73
|
/**
|
|
74
74
|
* The configuration of axes highlight.
|
|
75
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
75
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
76
76
|
* @default { x: 'none', y: 'none' }
|
|
77
77
|
*/
|
|
78
78
|
axisHighlight: PropTypes.shape({
|
|
@@ -171,16 +171,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
171
171
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
172
172
|
*/
|
|
173
173
|
onZoomChange: PropTypes.func,
|
|
174
|
-
/**
|
|
175
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
176
|
-
* before it renders for the first time.
|
|
177
|
-
*
|
|
178
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
179
|
-
* the first render, like when used inside a grid.
|
|
180
|
-
*
|
|
181
|
-
* @default false
|
|
182
|
-
*/
|
|
183
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
184
174
|
/**
|
|
185
175
|
* Indicate which axis to display the right of the charts.
|
|
186
176
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -209,31 +199,12 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
209
199
|
slots: PropTypes.object,
|
|
210
200
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
211
201
|
title: PropTypes.string,
|
|
212
|
-
/**
|
|
213
|
-
* The configuration of the tooltip.
|
|
214
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
215
|
-
* @default { trigger: 'item' }
|
|
216
|
-
*/
|
|
217
|
-
tooltip: PropTypes.shape({
|
|
218
|
-
axisContent: PropTypes.elementType,
|
|
219
|
-
classes: PropTypes.object,
|
|
220
|
-
itemContent: PropTypes.elementType,
|
|
221
|
-
slotProps: PropTypes.object,
|
|
222
|
-
slots: PropTypes.object,
|
|
223
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
224
|
-
}),
|
|
225
202
|
/**
|
|
226
203
|
* Indicate which axis to display the top of the charts.
|
|
227
204
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
228
205
|
* @default null
|
|
229
206
|
*/
|
|
230
207
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
231
|
-
viewBox: PropTypes.shape({
|
|
232
|
-
height: PropTypes.number,
|
|
233
|
-
width: PropTypes.number,
|
|
234
|
-
x: PropTypes.number,
|
|
235
|
-
y: PropTypes.number
|
|
236
|
-
}),
|
|
237
208
|
/**
|
|
238
209
|
* Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
|
|
239
210
|
* If `undefined`, the radius is assumed to be infinite.
|
|
@@ -3,5 +3,8 @@ import { ChartDataProviderProps } from '@mui/x-charts/internals';
|
|
|
3
3
|
import { ZoomProps } from '../ZoomProvider';
|
|
4
4
|
export interface ChartDataProviderProProps extends ChartDataProviderProps, ZoomProps {
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
6
|
+
declare function ChartDataProviderPro(props: ChartDataProviderProProps): React.JSX.Element;
|
|
7
|
+
declare namespace ChartDataProviderPro {
|
|
8
|
+
var propTypes: any;
|
|
9
|
+
}
|
|
7
10
|
export { ChartDataProviderPro };
|