@mui/x-charts-pro 7.0.0-beta.7 → 8.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/BarChartPro/BarChartPro.d.ts +1 -1
  2. package/BarChartPro/BarChartPro.js +7 -29
  3. package/CHANGELOG.md +142 -155
  4. package/ChartContainerPro/ChartContainerPro.d.ts +1 -1
  5. package/ChartContainerPro/ChartContainerPro.js +26 -42
  6. package/ChartContainerPro/useChartContainerProProps.d.ts +42 -13
  7. package/ChartContainerPro/useChartContainerProProps.js +11 -27
  8. package/Heatmap/Heatmap.d.ts +5 -4
  9. package/Heatmap/Heatmap.js +2 -2
  10. package/LineChartPro/LineChartPro.d.ts +1 -1
  11. package/LineChartPro/LineChartPro.js +7 -29
  12. package/README.md +2 -2
  13. package/ScatterChartPro/ScatterChartPro.d.ts +1 -1
  14. package/ScatterChartPro/ScatterChartPro.js +7 -29
  15. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +7 -0
  16. package/{modern/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js → context/ChartDataProviderPro/ChartDataProviderPro.js} +47 -31
  17. package/context/ChartDataProviderPro/index.d.ts +1 -0
  18. package/context/ChartDataProviderPro/index.js +1 -0
  19. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +16 -0
  20. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +43 -0
  21. package/context/ZoomProvider/ZoomProvider.js +1 -0
  22. package/index.d.ts +0 -1
  23. package/index.js +1 -2
  24. package/internals/utils/releaseInfo.js +1 -1
  25. package/models/seriesType/heatmap.d.ts +2 -1
  26. package/modern/BarChartPro/BarChartPro.js +7 -29
  27. package/modern/ChartContainerPro/ChartContainerPro.js +26 -42
  28. package/modern/ChartContainerPro/useChartContainerProProps.js +11 -27
  29. package/modern/Heatmap/Heatmap.js +2 -2
  30. package/modern/LineChartPro/LineChartPro.js +7 -29
  31. package/modern/ScatterChartPro/ScatterChartPro.js +7 -29
  32. package/{ResponsiveChartContainerPro/ResponsiveChartContainerPro.js → modern/context/ChartDataProviderPro/ChartDataProviderPro.js} +47 -31
  33. package/modern/context/ChartDataProviderPro/index.js +1 -0
  34. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +43 -0
  35. package/modern/context/ZoomProvider/ZoomProvider.js +1 -0
  36. package/modern/index.js +1 -2
  37. package/modern/internals/utils/releaseInfo.js +1 -1
  38. package/node/BarChartPro/BarChartPro.js +7 -29
  39. package/node/ChartContainerPro/ChartContainerPro.js +25 -41
  40. package/node/ChartContainerPro/useChartContainerProProps.js +11 -27
  41. package/node/Heatmap/Heatmap.js +2 -2
  42. package/node/LineChartPro/LineChartPro.js +7 -29
  43. package/node/ScatterChartPro/ScatterChartPro.js +7 -29
  44. package/node/{ResponsiveChartContainerPro/ResponsiveChartContainerPro.js → context/ChartDataProviderPro/ChartDataProviderPro.js} +46 -30
  45. package/node/context/ChartDataProviderPro/index.js +16 -0
  46. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +50 -0
  47. package/node/context/ZoomProvider/ZoomProvider.js +1 -0
  48. package/node/index.js +1 -12
  49. package/node/internals/utils/releaseInfo.js +1 -1
  50. package/package.json +6 -6
  51. package/typeOverloads/modules.d.ts +1 -1
  52. package/ResponsiveChartContainerPro/ResponsiveChartContainerPro.d.ts +0 -7
  53. package/ResponsiveChartContainerPro/index.d.ts +0 -1
  54. package/ResponsiveChartContainerPro/index.js +0 -1
  55. package/ResponsiveChartContainerPro/package.json +0 -6
  56. package/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.d.ts +0 -42
  57. package/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +0 -27
  58. package/modern/ResponsiveChartContainerPro/index.js +0 -1
  59. package/modern/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +0 -27
  60. package/node/ResponsiveChartContainerPro/index.js +0 -16
  61. package/node/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +0 -34
@@ -16,7 +16,7 @@ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
16
16
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
17
17
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
18
18
  import { useBarChartProps } from '@mui/x-charts/internals';
19
- import { ResponsiveChartContainerPro } from "../ResponsiveChartContainerPro/index.js";
19
+ import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
20
  import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
21
  import { useZoom } from "../context/ZoomProvider/useZoom.js";
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -102,14 +102,14 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
102
102
  tooltipProps,
103
103
  children
104
104
  } = useBarChartProps(other);
105
- return /*#__PURE__*/_jsxs(ResponsiveChartContainerPro, _extends({
105
+ return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
106
106
  ref: ref
107
107
  }, chartContainerProps, {
108
108
  zoom: zoom,
109
109
  onZoomChange: onZoomChange,
110
110
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
111
111
  children: [/*#__PURE__*/_jsx(BarChartPlotZoom, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
112
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
112
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
113
113
  }));
114
114
  });
115
115
  process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
@@ -174,6 +174,10 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
174
174
  * The height of the chart in px. If not defined, it takes the height of the parent element.
175
175
  */
176
176
  height: PropTypes.number,
177
+ /**
178
+ * If `true`, the legend is not rendered.
179
+ */
180
+ hideLegend: PropTypes.bool,
177
181
  /**
178
182
  * The item currently highlighted. Turns highlighting into a controlled prop.
179
183
  */
@@ -192,32 +196,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
192
196
  * @default yAxisIds[0] The id of the first provided axis
193
197
  */
194
198
  leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
195
- /**
196
- * @deprecated Consider using `slotProps.legend` instead.
197
- */
198
- legend: PropTypes.shape({
199
- classes: PropTypes.object,
200
- direction: PropTypes.oneOf(['column', 'row']),
201
- hidden: PropTypes.bool,
202
- itemGap: PropTypes.number,
203
- itemMarkHeight: PropTypes.number,
204
- itemMarkWidth: PropTypes.number,
205
- labelStyle: PropTypes.object,
206
- markGap: PropTypes.number,
207
- onItemClick: PropTypes.func,
208
- padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
209
- bottom: PropTypes.number,
210
- left: PropTypes.number,
211
- right: PropTypes.number,
212
- top: PropTypes.number
213
- })]),
214
- position: PropTypes.shape({
215
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
216
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
217
- }),
218
- slotProps: PropTypes.object,
219
- slots: PropTypes.object
220
- }),
221
199
  /**
222
200
  * If `true`, a loading overlay is displayed.
223
201
  * @default false
@@ -3,50 +3,24 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
7
- import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context';
8
- import { ChartsAxesGradients, DrawingProvider, InteractionProvider, PluginProvider, SeriesProvider, AnimationProvider } from '@mui/x-charts/internals';
9
- import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
6
+ import { Watermark } from '@mui/x-license/Watermark';
7
+ import { ResizableContainer } from '@mui/x-charts/internals';
10
8
  import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
11
- import { CartesianProviderPro } from "../context/CartesianProviderPro/index.js";
12
- import { ZoomProvider } from "../context/ZoomProvider/index.js";
9
+ import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
13
10
  import { useChartContainerProProps } from "./useChartContainerProProps.js";
14
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
12
  const releaseInfo = getReleaseInfo();
16
- const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
13
+ const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerPro(props, ref) {
17
14
  const {
18
- zoomProviderProps,
19
- drawingProviderProps,
20
- seriesProviderProps,
21
- zAxisContextProps,
22
- highlightedProviderProps,
23
- cartesianProviderProps,
24
- chartsSurfaceProps,
25
- pluginProviderProps,
26
- animationProviderProps,
27
- children
15
+ chartDataProviderProProps,
16
+ resizableChartContainerProps,
17
+ hasIntrinsicSize
28
18
  } = useChartContainerProProps(props, ref);
29
- useLicenseVerifier('x-charts-pro', releaseInfo);
30
- return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
31
- children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
32
- children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
33
- children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
34
- children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
35
- children: /*#__PURE__*/_jsx(CartesianProviderPro, _extends({}, cartesianProviderProps, {
36
- children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
37
- children: /*#__PURE__*/_jsx(InteractionProvider, {
38
- children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
39
- children: /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
40
- children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
41
- }))
42
- }))
43
- })
44
- }))
45
- }))
46
- }))
47
- }))
48
- }))
49
- }))
19
+ return /*#__PURE__*/_jsxs(ResizableContainer, _extends({}, resizableChartContainerProps, {
20
+ children: [hasIntrinsicSize ? /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps)) : null, /*#__PURE__*/_jsx(Watermark, {
21
+ packageName: "x-charts-pro",
22
+ releaseInfo: releaseInfo
23
+ })]
50
24
  }));
51
25
  });
52
26
  process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
@@ -73,9 +47,9 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
73
47
  */
74
48
  disableAxisListener: PropTypes.bool,
75
49
  /**
76
- * The height of the chart in px.
50
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
77
51
  */
78
- height: PropTypes.number.isRequired,
52
+ height: PropTypes.number,
79
53
  /**
80
54
  * The item currently highlighted. Turns highlighting into a controlled prop.
81
55
  */
@@ -112,6 +86,16 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
112
86
  * If not provided, the container supports line, bar, scatter and pie charts.
113
87
  */
114
88
  plugins: PropTypes.arrayOf(PropTypes.object),
89
+ /**
90
+ * The chart will try to wait for the parent container to resolve its size
91
+ * before it renders for the first time.
92
+ *
93
+ * This can be useful in some scenarios where the chart appear to grow after
94
+ * the first render, like when used inside a grid.
95
+ *
96
+ * @default false
97
+ */
98
+ resolveSizeBeforeRender: PropTypes.bool,
115
99
  /**
116
100
  * The array of series to display.
117
101
  * Each type of series has its own specificity.
@@ -132,9 +116,9 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
132
116
  y: PropTypes.number
133
117
  }),
134
118
  /**
135
- * The width of the chart in px.
119
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
136
120
  */
137
- width: PropTypes.number.isRequired,
121
+ width: PropTypes.number,
138
122
  /**
139
123
  * The configuration of the x-axes.
140
124
  * If not provided, a default axis config is used.
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
5
  const _excluded = ["zoom", "onZoomChange"];
5
6
  import { useChartContainerProps } from '@mui/x-charts/internals';
@@ -9,35 +10,18 @@ export const useChartContainerProProps = (props, ref) => {
9
10
  onZoomChange
10
11
  } = props,
11
12
  baseProps = _objectWithoutPropertiesLoose(props, _excluded);
12
- const {
13
- children,
14
- drawingProviderProps,
15
- seriesProviderProps,
16
- cartesianProviderProps,
17
- zAxisContextProps,
18
- highlightedProviderProps,
19
- chartsSurfaceProps,
20
- pluginProviderProps,
21
- animationProviderProps,
22
- xAxis,
23
- yAxis
24
- } = useChartContainerProps(baseProps, ref);
25
- const zoomProviderProps = {
13
+ const chartDataProviderProProps = {
26
14
  zoom,
27
- onZoomChange,
28
- xAxis,
29
- yAxis
15
+ onZoomChange
30
16
  };
17
+ const {
18
+ chartDataProviderProps,
19
+ resizableChartContainerProps,
20
+ hasIntrinsicSize
21
+ } = useChartContainerProps(baseProps, ref);
31
22
  return {
32
- zoomProviderProps,
33
- children,
34
- drawingProviderProps,
35
- pluginProviderProps,
36
- seriesProviderProps,
37
- cartesianProviderProps,
38
- zAxisContextProps,
39
- highlightedProviderProps,
40
- chartsSurfaceProps,
41
- animationProviderProps
23
+ chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps),
24
+ resizableChartContainerProps,
25
+ hasIntrinsicSize
42
26
  };
43
27
  };
@@ -11,7 +11,7 @@ import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
11
11
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
12
12
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
13
13
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
14
- import { ResponsiveChartContainerPro } from "../ResponsiveChartContainerPro/index.js";
14
+ import { ChartContainerPro } from "../ChartContainerPro/index.js";
15
15
  import { HeatmapPlot } from "./HeatmapPlot.js";
16
16
  import { plugin as heatmapPlugin } from "./plugin.js";
17
17
  import { DefaultHeatmapTooltip } from "./DefaultHeatmapTooltip.js";
@@ -65,7 +65,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
65
65
  color: defaultColorMap
66
66
  }
67
67
  }], [zAxis]);
68
- return /*#__PURE__*/_jsxs(ResponsiveChartContainerPro, {
68
+ return /*#__PURE__*/_jsxs(ChartContainerPro, {
69
69
  ref: ref,
70
70
  plugins: [heatmapPlugin],
71
71
  series: series.map(s => _extends({
@@ -16,7 +16,7 @@ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
16
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
17
17
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
18
18
  import { useLineChartProps } from '@mui/x-charts/internals';
19
- import { ResponsiveChartContainerPro } from "../ResponsiveChartContainerPro/index.js";
19
+ import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
20
  import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
21
  import { useZoom } from "../context/ZoomProvider/useZoom.js";
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -168,7 +168,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
168
168
  tooltipProps,
169
169
  children
170
170
  } = useLineChartProps(other);
171
- return /*#__PURE__*/_jsxs(ResponsiveChartContainerPro, _extends({
171
+ return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
172
172
  ref: ref
173
173
  }, chartContainerProps, {
174
174
  zoom: zoom,
@@ -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)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
181
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
182
182
  }));
183
183
  });
184
184
  process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
@@ -238,6 +238,10 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
238
238
  * The height of the chart in px. If not defined, it takes the height of the parent element.
239
239
  */
240
240
  height: PropTypes.number,
241
+ /**
242
+ * If `true`, the legend is not rendered.
243
+ */
244
+ hideLegend: PropTypes.bool,
241
245
  /**
242
246
  * The item currently highlighted. Turns highlighting into a controlled prop.
243
247
  */
@@ -251,32 +255,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
251
255
  * @default yAxisIds[0] The id of the first provided axis
252
256
  */
253
257
  leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
254
- /**
255
- * @deprecated Consider using `slotProps.legend` instead.
256
- */
257
- legend: PropTypes.shape({
258
- classes: PropTypes.object,
259
- direction: PropTypes.oneOf(['column', 'row']),
260
- hidden: PropTypes.bool,
261
- itemGap: PropTypes.number,
262
- itemMarkHeight: PropTypes.number,
263
- itemMarkWidth: PropTypes.number,
264
- labelStyle: PropTypes.object,
265
- markGap: PropTypes.number,
266
- onItemClick: PropTypes.func,
267
- padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
268
- bottom: PropTypes.number,
269
- left: PropTypes.number,
270
- right: PropTypes.number,
271
- top: PropTypes.number
272
- })]),
273
- position: PropTypes.shape({
274
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
275
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
276
- }),
277
- slotProps: PropTypes.object,
278
- slots: PropTypes.object
279
- }),
280
258
  /**
281
259
  * If `true`, a loading overlay is displayed.
282
260
  * @default false
@@ -16,7 +16,7 @@ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
16
  import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
17
17
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
18
18
  import { useScatterChartProps } from '@mui/x-charts/internals';
19
- import { ResponsiveChartContainerPro } from "../ResponsiveChartContainerPro/index.js";
19
+ import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
20
  import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
22
  /**
@@ -52,7 +52,7 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
52
52
  tooltipProps,
53
53
  children
54
54
  } = useScatterChartProps(other);
55
- return /*#__PURE__*/_jsx(ResponsiveChartContainerPro, _extends({
55
+ return /*#__PURE__*/_jsx(ChartContainerPro, _extends({
56
56
  ref: ref
57
57
  }, chartContainerProps, {
58
58
  zoom: zoom,
@@ -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)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
64
+ }), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
65
65
  }))
66
66
  }));
67
67
  });
@@ -119,6 +119,10 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
119
119
  * The height of the chart in px. If not defined, it takes the height of the parent element.
120
120
  */
121
121
  height: PropTypes.number,
122
+ /**
123
+ * If `true`, the legend is not rendered.
124
+ */
125
+ hideLegend: PropTypes.bool,
122
126
  /**
123
127
  * The item currently highlighted. Turns highlighting into a controlled prop.
124
128
  */
@@ -132,32 +136,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
132
136
  * @default yAxisIds[0] The id of the first provided axis
133
137
  */
134
138
  leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
135
- /**
136
- * @deprecated Consider using `slotProps.legend` instead.
137
- */
138
- legend: PropTypes.shape({
139
- classes: PropTypes.object,
140
- direction: PropTypes.oneOf(['column', 'row']),
141
- hidden: PropTypes.bool,
142
- itemGap: PropTypes.number,
143
- itemMarkHeight: PropTypes.number,
144
- itemMarkWidth: PropTypes.number,
145
- labelStyle: PropTypes.object,
146
- markGap: PropTypes.number,
147
- onItemClick: PropTypes.func,
148
- padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
149
- bottom: PropTypes.number,
150
- left: PropTypes.number,
151
- right: PropTypes.number,
152
- top: PropTypes.number
153
- })]),
154
- position: PropTypes.shape({
155
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
156
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
157
- }),
158
- slotProps: PropTypes.object,
159
- slots: PropTypes.object
160
- }),
161
139
  /**
162
140
  * If `true`, a loading overlay is displayed.
163
141
  * @default false
@@ -3,27 +3,53 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { Watermark } from '@mui/x-license/Watermark';
7
- import { ResizableContainer } from '@mui/x-charts/internals';
8
- import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
9
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
10
- import { useResponsiveChartContainerProProps } from "./useResponsiveChartContainerProProps.js";
6
+ import { ChartsAxesGradients, DrawingProvider, InteractionProvider, PluginProvider, SeriesProvider, AnimationProvider } from '@mui/x-charts/internals';
7
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
8
+ import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context';
9
+ import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
10
+ import { getReleaseInfo } from "../../internals/utils/releaseInfo.js";
11
+ import { CartesianProviderPro } from "../CartesianProviderPro/index.js";
12
+ import { ZoomProvider } from "../ZoomProvider/index.js";
13
+ import { useChartContainerProProps } from "./useChartDataProviderProProps.js";
11
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
15
  const releaseInfo = getReleaseInfo();
13
- const ResponsiveChartContainerPro = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainerPro(props, ref) {
16
+ const ChartDataProviderPro = /*#__PURE__*/React.forwardRef(function ChartDataProviderPro(props, ref) {
14
17
  const {
15
- chartContainerProProps,
16
- resizableChartContainerProps,
17
- hasIntrinsicSize
18
- } = useResponsiveChartContainerProProps(props, ref);
19
- return /*#__PURE__*/_jsxs(ResizableContainer, _extends({}, resizableChartContainerProps, {
20
- children: [hasIntrinsicSize ? /*#__PURE__*/_jsx(ChartContainerPro, _extends({}, chartContainerProProps)) : null, /*#__PURE__*/_jsx(Watermark, {
21
- packageName: "x-charts-pro",
22
- releaseInfo: releaseInfo
23
- })]
18
+ zoomProviderProps,
19
+ drawingProviderProps,
20
+ seriesProviderProps,
21
+ zAxisContextProps,
22
+ highlightedProviderProps,
23
+ cartesianProviderProps,
24
+ chartsSurfaceProps,
25
+ pluginProviderProps,
26
+ animationProviderProps,
27
+ children
28
+ } = useChartContainerProProps(props, ref);
29
+ useLicenseVerifier('x-charts-pro', releaseInfo);
30
+ return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
31
+ children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
32
+ children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
33
+ children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
34
+ children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
35
+ children: /*#__PURE__*/_jsx(CartesianProviderPro, _extends({}, cartesianProviderProps, {
36
+ children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
37
+ children: /*#__PURE__*/_jsx(InteractionProvider, {
38
+ children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
39
+ children: /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
40
+ children: [/*#__PURE__*/_jsx(ChartsAxesGradients, {}), children]
41
+ }))
42
+ }))
43
+ })
44
+ }))
45
+ }))
46
+ }))
47
+ }))
48
+ }))
49
+ }))
24
50
  }));
25
51
  });
26
- process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes = {
52
+ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
27
53
  // ----------------------------- Warning --------------------------------
28
54
  // | These PropTypes are generated from the TypeScript type definitions |
29
55
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
@@ -47,9 +73,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
47
73
  */
48
74
  disableAxisListener: PropTypes.bool,
49
75
  /**
50
- * The height of the chart in px. If not defined, it takes the height of the parent element.
76
+ * The height of the chart in px.
51
77
  */
52
- height: PropTypes.number,
78
+ height: PropTypes.number.isRequired,
53
79
  /**
54
80
  * The item currently highlighted. Turns highlighting into a controlled prop.
55
81
  */
@@ -86,16 +112,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
86
112
  * If not provided, the container supports line, bar, scatter and pie charts.
87
113
  */
88
114
  plugins: PropTypes.arrayOf(PropTypes.object),
89
- /**
90
- * The chart will try to wait for the parent container to resolve its size
91
- * before it renders for the first time.
92
- *
93
- * This can be useful in some scenarios where the chart appear to grow after
94
- * the first render, like when used inside a grid.
95
- *
96
- * @default false
97
- */
98
- resolveSizeBeforeRender: PropTypes.bool,
99
115
  /**
100
116
  * The array of series to display.
101
117
  * Each type of series has its own specificity.
@@ -116,9 +132,9 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
116
132
  y: PropTypes.number
117
133
  }),
118
134
  /**
119
- * The width of the chart in px. If not defined, it takes the width of the parent element.
135
+ * The width of the chart in px.
120
136
  */
121
- width: PropTypes.number,
137
+ width: PropTypes.number.isRequired,
122
138
  /**
123
139
  * The configuration of the x-axes.
124
140
  * If not provided, a default axis config is used.
@@ -279,4 +295,4 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainerPro.propTypes =
279
295
  start: PropTypes.number.isRequired
280
296
  }))
281
297
  } : void 0;
282
- export { ResponsiveChartContainerPro };
298
+ export { ChartDataProviderPro };
@@ -0,0 +1 @@
1
+ export * from "./ChartDataProviderPro.js";
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
+ const _excluded = ["zoom", "onZoomChange"];
5
+ import { useChartDataProviderProps } from '@mui/x-charts/internals';
6
+ export const useChartContainerProProps = (props, ref) => {
7
+ const {
8
+ zoom,
9
+ onZoomChange
10
+ } = props,
11
+ baseProps = _objectWithoutPropertiesLoose(props, _excluded);
12
+ const {
13
+ children,
14
+ drawingProviderProps,
15
+ seriesProviderProps,
16
+ cartesianProviderProps,
17
+ zAxisContextProps,
18
+ highlightedProviderProps,
19
+ chartsSurfaceProps,
20
+ pluginProviderProps,
21
+ animationProviderProps,
22
+ xAxis,
23
+ yAxis
24
+ } = useChartDataProviderProps(baseProps, ref);
25
+ const zoomProviderProps = {
26
+ zoom,
27
+ onZoomChange,
28
+ xAxis,
29
+ yAxis
30
+ };
31
+ return {
32
+ zoomProviderProps,
33
+ children,
34
+ drawingProviderProps,
35
+ pluginProviderProps,
36
+ seriesProviderProps,
37
+ cartesianProviderProps,
38
+ zAxisContextProps,
39
+ highlightedProviderProps,
40
+ chartsSurfaceProps,
41
+ animationProviderProps
42
+ };
43
+ };
@@ -25,6 +25,7 @@ export function ZoomProvider({
25
25
  const defaultZoomData = React.useRef(initializeZoomData(options));
26
26
  const [zoomData, setZoomData] = useControlled({
27
27
  controlled: zoom,
28
+ // eslint-disable-next-line react-compiler/react-compiler
28
29
  default: defaultZoomData.current,
29
30
  name: 'ZoomProvider',
30
31
  state: 'zoom'
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts-pro v7.0.0-beta.7
2
+ * @mui/x-charts-pro v8.0.0-alpha.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -35,7 +35,6 @@ export * from '@mui/x-charts/ChartsSurface';
35
35
 
36
36
  // Pro components
37
37
  export * from "./Heatmap/index.js";
38
- export * from "./ResponsiveChartContainerPro/index.js";
39
38
  export * from "./ChartContainerPro/index.js";
40
39
  export * from "./ScatterChartPro/index.js";
41
40
  export * from "./BarChartPro/index.js";
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczMTAyMDQwMDAwMA==";
3
+ const releaseInfo = "MTczMTUzODgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -22,7 +22,7 @@ var _ChartsAxisHighlight = require("@mui/x-charts/ChartsAxisHighlight");
22
22
  var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
23
23
  var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
24
24
  var _internals = require("@mui/x-charts/internals");
25
- var _ResponsiveChartContainerPro = require("../ResponsiveChartContainerPro");
25
+ var _ChartContainerPro = require("../ChartContainerPro");
26
26
  var _ZoomSetup = require("../context/ZoomProvider/ZoomSetup");
27
27
  var _useZoom = require("../context/ZoomProvider/useZoom");
28
28
  var _jsxRuntime = require("react/jsx-runtime");
@@ -109,14 +109,14 @@ const BarChartPro = exports.BarChartPro = /*#__PURE__*/React.forwardRef(function
109
109
  tooltipProps,
110
110
  children
111
111
  } = (0, _internals.useBarChartProps)(other);
112
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainerPro.ResponsiveChartContainerPro, (0, _extends2.default)({
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainerPro.ChartContainerPro, (0, _extends2.default)({
113
113
  ref: ref
114
114
  }, chartContainerProps, {
115
115
  zoom: zoom,
116
116
  onZoomChange: onZoomChange,
117
117
  children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
118
118
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BarChartPlotZoom, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
119
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ZoomSetup.ZoomSetup, {}), children]
119
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltipProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ZoomSetup.ZoomSetup, {}), children]
120
120
  }));
121
121
  });
122
122
  process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
@@ -181,6 +181,10 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
181
181
  * The height of the chart in px. If not defined, it takes the height of the parent element.
182
182
  */
183
183
  height: _propTypes.default.number,
184
+ /**
185
+ * If `true`, the legend is not rendered.
186
+ */
187
+ hideLegend: _propTypes.default.bool,
184
188
  /**
185
189
  * The item currently highlighted. Turns highlighting into a controlled prop.
186
190
  */
@@ -199,32 +203,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
199
203
  * @default yAxisIds[0] The id of the first provided axis
200
204
  */
201
205
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
202
- /**
203
- * @deprecated Consider using `slotProps.legend` instead.
204
- */
205
- legend: _propTypes.default.shape({
206
- classes: _propTypes.default.object,
207
- direction: _propTypes.default.oneOf(['column', 'row']),
208
- hidden: _propTypes.default.bool,
209
- itemGap: _propTypes.default.number,
210
- itemMarkHeight: _propTypes.default.number,
211
- itemMarkWidth: _propTypes.default.number,
212
- labelStyle: _propTypes.default.object,
213
- markGap: _propTypes.default.number,
214
- onItemClick: _propTypes.default.func,
215
- padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
216
- bottom: _propTypes.default.number,
217
- left: _propTypes.default.number,
218
- right: _propTypes.default.number,
219
- top: _propTypes.default.number
220
- })]),
221
- position: _propTypes.default.shape({
222
- horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
223
- vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
224
- }),
225
- slotProps: _propTypes.default.object,
226
- slots: _propTypes.default.object
227
- }),
228
206
  /**
229
207
  * If `true`, a loading overlay is displayed.
230
208
  * @default false