@mui/x-charts-pro 8.0.0-alpha.6 → 8.0.0-alpha.8

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 (157) hide show
  1. package/BarChartPro/BarChartPro.d.ts +2 -2
  2. package/BarChartPro/BarChartPro.js +68 -23
  3. package/CHANGELOG.md +242 -1
  4. package/ChartContainerPro/ChartContainerPro.d.ts +32 -4
  5. package/ChartContainerPro/ChartContainerPro.js +53 -18
  6. package/ChartContainerPro/useChartContainerProProps.d.ts +5 -5
  7. package/ChartContainerPro/useChartContainerProProps.js +11 -5
  8. package/Heatmap/Heatmap.js +28 -2
  9. package/Heatmap/HeatmapTooltip.js +6 -4
  10. package/Heatmap/extremums.d.ts +2 -2
  11. package/Heatmap/formatter.d.ts +2 -2
  12. package/Heatmap/formatter.js +2 -1
  13. package/Heatmap/plugin.d.ts +2 -2
  14. package/Heatmap/plugin.js +1 -2
  15. package/LineChartPro/LineChartPro.d.ts +2 -2
  16. package/LineChartPro/LineChartPro.js +73 -32
  17. package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
  18. package/ScatterChartPro/ScatterChartPro.js +46 -28
  19. package/hooks/index.d.ts +1 -0
  20. package/hooks/index.js +2 -1
  21. package/hooks/zoom/index.d.ts +1 -0
  22. package/hooks/zoom/index.js +1 -0
  23. package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
  24. package/hooks/zoom/useIsZoomInteracting.js +14 -0
  25. package/index.d.ts +0 -1
  26. package/index.js +2 -5
  27. package/internals/plugins/allPlugins.d.ts +10 -0
  28. package/internals/plugins/allPlugins.js +5 -0
  29. package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
  30. package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  31. package/internals/plugins/useChartProZoom/index.d.ts +3 -0
  32. package/internals/plugins/useChartProZoom/index.js +3 -0
  33. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
  34. package/internals/plugins/useChartProZoom/useChartProZoom.js +324 -0
  35. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +149 -0
  36. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -0
  37. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +54 -0
  38. package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
  39. package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  40. package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
  41. package/internals/utils/releaseInfo.js +1 -1
  42. package/models/index.d.ts +1 -0
  43. package/models/index.js +2 -1
  44. package/modern/BarChartPro/BarChartPro.js +68 -23
  45. package/modern/ChartContainerPro/ChartContainerPro.js +53 -18
  46. package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
  47. package/modern/Heatmap/Heatmap.js +28 -2
  48. package/modern/Heatmap/HeatmapTooltip.js +6 -4
  49. package/modern/Heatmap/formatter.js +2 -1
  50. package/modern/Heatmap/plugin.js +1 -2
  51. package/modern/LineChartPro/LineChartPro.js +73 -32
  52. package/modern/ScatterChartPro/ScatterChartPro.js +46 -28
  53. package/modern/hooks/index.js +2 -1
  54. package/modern/hooks/zoom/index.js +1 -0
  55. package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
  56. package/modern/index.js +2 -5
  57. package/modern/internals/plugins/allPlugins.js +5 -0
  58. package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  59. package/modern/internals/plugins/useChartProZoom/index.js +3 -0
  60. package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +324 -0
  61. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -0
  62. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
  63. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  64. package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
  65. package/modern/internals/utils/releaseInfo.js +1 -1
  66. package/modern/models/index.js +2 -1
  67. package/node/BarChartPro/BarChartPro.js +67 -22
  68. package/node/ChartContainerPro/ChartContainerPro.js +53 -18
  69. package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
  70. package/node/Heatmap/Heatmap.js +28 -2
  71. package/node/Heatmap/HeatmapTooltip.js +4 -2
  72. package/node/Heatmap/formatter.js +2 -1
  73. package/node/Heatmap/plugin.js +1 -2
  74. package/node/LineChartPro/LineChartPro.js +72 -31
  75. package/node/ScatterChartPro/ScatterChartPro.js +44 -26
  76. package/node/hooks/index.js +16 -1
  77. package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
  78. package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
  79. package/node/index.js +1 -12
  80. package/node/internals/plugins/allPlugins.js +11 -0
  81. package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
  82. package/node/internals/plugins/useChartProZoom/index.js +38 -0
  83. package/node/internals/plugins/useChartProZoom/useChartProZoom.js +331 -0
  84. package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +13 -0
  85. package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
  86. package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
  87. package/node/internals/utils/releaseInfo.js +1 -1
  88. package/package.json +5 -5
  89. package/typeOverloads/modules.d.ts +8 -1
  90. package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
  91. package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  92. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -13
  93. package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  94. package/context/CartesianProviderPro/index.d.ts +0 -1
  95. package/context/CartesianProviderPro/index.js +0 -1
  96. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -7
  97. package/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
  98. package/context/ChartDataProviderPro/index.d.ts +0 -1
  99. package/context/ChartDataProviderPro/index.js +0 -1
  100. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
  101. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  102. package/context/ZoomProvider/Zoom.types.d.ts +0 -144
  103. package/context/ZoomProvider/ZoomContext.d.ts +0 -4
  104. package/context/ZoomProvider/ZoomContext.js +0 -16
  105. package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
  106. package/context/ZoomProvider/ZoomProvider.js +0 -56
  107. package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
  108. package/context/ZoomProvider/ZoomSetup.js +0 -16
  109. package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
  110. package/context/ZoomProvider/defaultizeZoom.js +0 -32
  111. package/context/ZoomProvider/index.d.ts +0 -3
  112. package/context/ZoomProvider/index.js +0 -3
  113. package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
  114. package/context/ZoomProvider/initializeZoomData.js +0 -13
  115. package/context/ZoomProvider/useSetupPan.d.ts +0 -1
  116. package/context/ZoomProvider/useSetupPan.js +0 -106
  117. package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
  118. package/context/ZoomProvider/useSetupZoom.js +0 -274
  119. package/context/ZoomProvider/useZoom.d.ts +0 -7
  120. package/context/ZoomProvider/useZoom.js +0 -19
  121. package/context/index.d.ts +0 -3
  122. package/context/index.js +0 -5
  123. package/context/package.json +0 -6
  124. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  125. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  126. package/modern/context/CartesianProviderPro/index.js +0 -1
  127. package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
  128. package/modern/context/ChartDataProviderPro/index.js +0 -1
  129. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  130. package/modern/context/ZoomProvider/ZoomContext.js +0 -16
  131. package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
  132. package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
  133. package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
  134. package/modern/context/ZoomProvider/index.js +0 -3
  135. package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
  136. package/modern/context/ZoomProvider/useSetupPan.js +0 -106
  137. package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
  138. package/modern/context/ZoomProvider/useZoom.js +0 -19
  139. package/modern/context/index.js +0 -5
  140. package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
  141. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
  142. package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -56
  143. package/node/context/ChartDataProviderPro/index.js +0 -16
  144. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
  145. package/node/context/ZoomProvider/ZoomContext.js +0 -23
  146. package/node/context/ZoomProvider/ZoomProvider.js +0 -63
  147. package/node/context/ZoomProvider/ZoomSetup.js +0 -20
  148. package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
  149. package/node/context/ZoomProvider/index.js +0 -38
  150. package/node/context/ZoomProvider/initializeZoomData.js +0 -20
  151. package/node/context/ZoomProvider/useSetupPan.js +0 -114
  152. package/node/context/ZoomProvider/useSetupZoom.js +0 -281
  153. package/node/context/ZoomProvider/useZoom.js +0 -25
  154. package/node/context/index.js +0 -27
  155. /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
  156. /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
  157. /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["zoom", "onZoomChange"];
5
+ const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useThemeProps } from '@mui/material/styles';
@@ -15,15 +15,14 @@ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
15
15
  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
- import { useLineChartProps } from '@mui/x-charts/internals';
19
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { useZoom } from "../context/ZoomProvider/useZoom.js";
18
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
19
+ import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
20
+ import { ChartDataProvider } from '@mui/x-charts/context';
21
+ import { useIsZoomInteracting } from "../hooks/zoom/index.js";
22
+ import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  function AreaPlotZoom(props) {
24
- const {
25
- isInteracting
26
- } = useZoom();
25
+ const isInteracting = useIsZoomInteracting();
27
26
  return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
28
27
  skipAnimation: isInteracting || undefined
29
28
  }));
@@ -56,9 +55,7 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
56
55
  slots: PropTypes.object
57
56
  } : void 0;
58
57
  function LinePlotZoom(props) {
59
- const {
60
- isInteracting
61
- } = useZoom();
58
+ const isInteracting = useIsZoomInteracting();
62
59
  return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
63
60
  skipAnimation: isInteracting || undefined
64
61
  }));
@@ -91,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
91
88
  slots: PropTypes.object
92
89
  } : void 0;
93
90
  function MarkPlotZoom(props) {
94
- const {
95
- isInteracting
96
- } = useZoom();
91
+ const isInteracting = useIsZoomInteracting();
97
92
  return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
98
93
  skipAnimation: isInteracting || undefined
99
94
  }));
@@ -147,11 +142,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
147
142
  name: 'MuiLineChartPro'
148
143
  });
149
144
  const {
150
- zoom,
151
- onZoomChange
145
+ initialZoom,
146
+ onZoomChange,
147
+ apiRef
152
148
  } = props,
153
149
  other = _objectWithoutPropertiesLoose(props, _excluded);
154
150
  const {
151
+ chartsWrapperProps,
155
152
  chartContainerProps,
156
153
  axisClickHandlerProps,
157
154
  gridProps,
@@ -167,18 +164,27 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
167
164
  legendProps,
168
165
  children
169
166
  } = useLineChartProps(other);
167
+ const {
168
+ chartDataProviderProProps,
169
+ chartsSurfaceProps
170
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
171
+ apiRef
172
+ }), ref);
170
173
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
171
- return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
172
- ref: ref
173
- }, chartContainerProps, {
174
- zoom: zoom,
174
+ return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
175
+ apiRef: apiRef,
176
+ initialZoom: initialZoom,
175
177
  onZoomChange: onZoomChange,
176
- children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
177
- children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
178
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
179
- "data-drawing-container": true,
180
- children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
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]
178
+ children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
179
+ children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
180
+ children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
181
+ children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
182
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
183
+ "data-drawing-container": true,
184
+ children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
185
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
186
+ }))]
187
+ }))
182
188
  }));
183
189
  });
184
190
  process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
@@ -186,6 +192,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
186
192
  // | These PropTypes are generated from the TypeScript type definitions |
187
193
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
188
194
  // ----------------------------------------------------------------------
195
+ apiRef: PropTypes.shape({
196
+ current: PropTypes.shape({
197
+ setZoomData: PropTypes.func.isRequired
198
+ })
199
+ }),
189
200
  /**
190
201
  * The configuration of axes highlight.
191
202
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -249,6 +260,19 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
249
260
  dataIndex: PropTypes.number,
250
261
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
251
262
  }),
263
+ /**
264
+ * This prop is used to help implement the accessibility logic.
265
+ * If you don't provide this prop. It falls back to a randomly generated id.
266
+ */
267
+ id: PropTypes.string,
268
+ /**
269
+ * The list of zoom data related to each axis.
270
+ */
271
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
272
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
273
+ end: PropTypes.number.isRequired,
274
+ start: PropTypes.number.isRequired
275
+ })),
252
276
  /**
253
277
  * Indicate which axis to display the left of the charts.
254
278
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -264,7 +288,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
264
288
  * The margin between the SVG and the drawing area.
265
289
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
266
290
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
267
- * @default object Depends on the charts type.
268
291
  */
269
292
  margin: PropTypes.shape({
270
293
  bottom: PropTypes.number,
@@ -330,6 +353,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
330
353
  */
331
354
  slots: PropTypes.object,
332
355
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
356
+ theme: PropTypes.oneOf(['dark', 'light']),
333
357
  title: PropTypes.string,
334
358
  /**
335
359
  * Indicate which axis to display the top of the charts.
@@ -464,12 +488,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
464
488
  }), PropTypes.bool])
465
489
  })),
466
490
  /**
467
- * The list of zoom data related to each axis.
491
+ * The configuration of the z-axes.
468
492
  */
469
- zoom: PropTypes.arrayOf(PropTypes.shape({
470
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
471
- end: PropTypes.number.isRequired,
472
- start: PropTypes.number.isRequired
493
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
494
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
495
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
496
+ type: PropTypes.oneOf(['ordinal']).isRequired,
497
+ unknownColor: PropTypes.string,
498
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
499
+ }), PropTypes.shape({
500
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
501
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
502
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
503
+ type: PropTypes.oneOf(['continuous']).isRequired
504
+ }), PropTypes.shape({
505
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
506
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
507
+ type: PropTypes.oneOf(['piecewise']).isRequired
508
+ })]),
509
+ data: PropTypes.array,
510
+ dataKey: PropTypes.string,
511
+ id: PropTypes.string,
512
+ max: PropTypes.number,
513
+ min: PropTypes.number
473
514
  }))
474
515
  } : void 0;
475
516
  export { LineChartPro };
@@ -2,22 +2,22 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["zoom", "onZoomChange"];
5
+ const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useThemeProps } from '@mui/material/styles';
9
9
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
10
10
  import { ScatterPlot } from '@mui/x-charts/ScatterChart';
11
- import { ZAxisContextProvider } from '@mui/x-charts/context';
11
+ import { ChartDataProvider } from '@mui/x-charts/context';
12
12
  import { ChartsVoronoiHandler } from '@mui/x-charts/ChartsVoronoiHandler';
13
13
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
14
14
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
15
15
  import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
16
17
  import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
17
18
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
18
- import { useScatterChartProps } from '@mui/x-charts/internals';
19
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
19
+ import { useScatterChartProps, ChartsWrapper } from '@mui/x-charts/internals';
20
+ import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
21
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
22
  /**
23
23
  * Demos:
@@ -35,13 +35,14 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
35
35
  name: 'MuiScatterChartPro'
36
36
  });
37
37
  const {
38
- zoom,
39
- onZoomChange
38
+ initialZoom,
39
+ onZoomChange,
40
+ apiRef
40
41
  } = props,
41
42
  other = _objectWithoutPropertiesLoose(props, _excluded);
42
43
  const {
44
+ chartsWrapperProps,
43
45
  chartContainerProps,
44
- zAxisProps,
45
46
  voronoiHandlerProps,
46
47
  chartsAxisProps,
47
48
  gridProps,
@@ -51,19 +52,26 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
51
52
  axisHighlightProps,
52
53
  children
53
54
  } = useScatterChartProps(other);
55
+ const {
56
+ chartDataProviderProProps,
57
+ chartsSurfaceProps
58
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
59
+ apiRef
60
+ }), ref);
54
61
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
55
- return /*#__PURE__*/_jsx(ChartContainerPro, _extends({
56
- ref: ref
57
- }, chartContainerProps, {
58
- zoom: zoom,
62
+ return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
63
+ apiRef: apiRef,
64
+ initialZoom: initialZoom,
59
65
  onZoomChange: onZoomChange,
60
- children: /*#__PURE__*/_jsxs(ZAxisContextProvider, _extends({}, zAxisProps, {
61
- children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
62
- "data-drawing-container": true,
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(Tooltip, _extends({}, props?.slotProps?.tooltip, {
65
- trigger: "item"
66
- })), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
66
+ children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
67
+ children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
68
+ children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
69
+ "data-drawing-container": true,
70
+ children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
71
+ }), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip, {
72
+ trigger: "item"
73
+ })), children]
74
+ }))]
67
75
  }))
68
76
  }));
69
77
  });
@@ -72,6 +80,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
72
80
  // | These PropTypes are generated from the TypeScript type definitions |
73
81
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
74
82
  // ----------------------------------------------------------------------
83
+ apiRef: PropTypes.shape({
84
+ current: PropTypes.shape({
85
+ setZoomData: PropTypes.func.isRequired
86
+ })
87
+ }),
75
88
  /**
76
89
  * The configuration of axes highlight.
77
90
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -132,6 +145,19 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
132
145
  dataIndex: PropTypes.number,
133
146
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
134
147
  }),
148
+ /**
149
+ * This prop is used to help implement the accessibility logic.
150
+ * If you don't provide this prop. It falls back to a randomly generated id.
151
+ */
152
+ id: PropTypes.string,
153
+ /**
154
+ * The list of zoom data related to each axis.
155
+ */
156
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
157
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
158
+ end: PropTypes.number.isRequired,
159
+ start: PropTypes.number.isRequired
160
+ })),
135
161
  /**
136
162
  * Indicate which axis to display the left of the charts.
137
163
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -147,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
147
173
  * The margin between the SVG and the drawing area.
148
174
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
149
175
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
150
- * @default object Depends on the charts type.
151
176
  */
152
177
  margin: PropTypes.shape({
153
178
  bottom: PropTypes.number,
@@ -200,6 +225,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
200
225
  */
201
226
  slots: PropTypes.object,
202
227
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
228
+ theme: PropTypes.oneOf(['dark', 'light']),
203
229
  title: PropTypes.string,
204
230
  /**
205
231
  * Indicate which axis to display the top of the charts.
@@ -362,14 +388,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
362
388
  id: PropTypes.string,
363
389
  max: PropTypes.number,
364
390
  min: PropTypes.number
365
- })),
366
- /**
367
- * The list of zoom data related to each axis.
368
- */
369
- zoom: PropTypes.arrayOf(PropTypes.shape({
370
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
371
- end: PropTypes.number.isRequired,
372
- start: PropTypes.number.isRequired
373
391
  }))
374
392
  } : void 0;
375
393
  export { ScatterChartPro };
@@ -1 +1,2 @@
1
- export { useHeatmapSeries as unstable_useHeatmapSeries } from "./useSeries.js";
1
+ export { useHeatmapSeries as unstable_useHeatmapSeries } from "./useSeries.js";
2
+ export * from "./zoom/index.js";
@@ -0,0 +1 @@
1
+ export * from "./useIsZoomInteracting.js";
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+
3
+ import { useSelector, useStore } from '@mui/x-charts/internals';
4
+ import { selectorChartZoomIsInteracting } from "../../internals/plugins/useChartProZoom/index.js";
5
+ /**
6
+ * Get access to the zoom state.
7
+ *
8
+ * @returns {boolean} Inform the zoom is interacting.
9
+ */
10
+ export function useIsZoomInteracting() {
11
+ const store = useStore();
12
+ const isInteracting = useSelector(store, selectorChartZoomIsInteracting);
13
+ return isInteracting;
14
+ }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts-pro v8.0.0-alpha.6
2
+ * @mui/x-charts-pro v8.0.0-alpha.8
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -38,7 +38,4 @@ export * from "./Heatmap/index.js";
38
38
  export * from "./ChartContainerPro/index.js";
39
39
  export * from "./ScatterChartPro/index.js";
40
40
  export * from "./BarChartPro/index.js";
41
- export * from "./LineChartPro/index.js";
42
-
43
- // Pro context
44
- export * from "./context/index.js";
41
+ export * from "./LineChartPro/index.js";
@@ -0,0 +1,5 @@
1
+ // This file should be removed after creating all plugins in favor of a file per chart type.
2
+
3
+ import { useChartCartesianAxis, useChartInteraction, useChartZAxis } from '@mui/x-charts/internals';
4
+ import { useChartProZoom } from "./useChartProZoom/index.js";
5
+ export const ALL_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartProZoom];
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ const defaultZoomOptions = {
3
+ minStart: 0,
4
+ maxEnd: 100,
5
+ step: 5,
6
+ minSpan: 10,
7
+ maxSpan: 100,
8
+ panning: true,
9
+ filterMode: 'keep'
10
+ };
11
+ export const defaultizeZoom = (zoom, axisId, axisDirection) => {
12
+ if (!zoom) {
13
+ return undefined;
14
+ }
15
+ if (zoom === true) {
16
+ return _extends({
17
+ axisId,
18
+ axisDirection
19
+ }, defaultZoomOptions);
20
+ }
21
+ return _extends({
22
+ axisId,
23
+ axisDirection
24
+ }, defaultZoomOptions, zoom);
25
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./useChartProZoom.selectors.js";
2
+ export * from "./useChartProZoom.js";
3
+ export * from "./useChartProZoom.types.js";