@mui/x-charts-pro 8.0.0-alpha.7 → 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 +55 -19
  3. package/CHANGELOG.md +115 -0
  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 +57 -25
  17. package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
  18. package/ScatterChartPro/ScatterChartPro.js +37 -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 +55 -19
  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 +57 -25
  52. package/modern/ScatterChartPro/ScatterChartPro.js +37 -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 +55 -19
  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 +57 -25
  75. package/node/ScatterChartPro/ScatterChartPro.js +36 -27
  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';
@@ -17,15 +17,12 @@ import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
17
17
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
18
18
  import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
19
19
  import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { useZoom } from "../context/ZoomProvider/useZoom.js";
22
- import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
20
+ import { ChartDataProvider } from '@mui/x-charts/context';
21
+ import { useIsZoomInteracting } from "../hooks/zoom/index.js";
23
22
  import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
24
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
24
  function AreaPlotZoom(props) {
26
- const {
27
- isInteracting
28
- } = useZoom();
25
+ const isInteracting = useIsZoomInteracting();
29
26
  return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
30
27
  skipAnimation: isInteracting || undefined
31
28
  }));
@@ -58,9 +55,7 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
58
55
  slots: PropTypes.object
59
56
  } : void 0;
60
57
  function LinePlotZoom(props) {
61
- const {
62
- isInteracting
63
- } = useZoom();
58
+ const isInteracting = useIsZoomInteracting();
64
59
  return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
65
60
  skipAnimation: isInteracting || undefined
66
61
  }));
@@ -93,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
93
88
  slots: PropTypes.object
94
89
  } : void 0;
95
90
  function MarkPlotZoom(props) {
96
- const {
97
- isInteracting
98
- } = useZoom();
91
+ const isInteracting = useIsZoomInteracting();
99
92
  return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
100
93
  skipAnimation: isInteracting || undefined
101
94
  }));
@@ -149,8 +142,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
149
142
  name: 'MuiLineChartPro'
150
143
  });
151
144
  const {
152
- zoom,
153
- onZoomChange
145
+ initialZoom,
146
+ onZoomChange,
147
+ apiRef
154
148
  } = props,
155
149
  other = _objectWithoutPropertiesLoose(props, _excluded);
156
150
  const {
@@ -173,10 +167,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
173
167
  const {
174
168
  chartDataProviderProProps,
175
169
  chartsSurfaceProps
176
- } = useChartContainerProProps(chartContainerProps, ref);
170
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
171
+ apiRef
172
+ }), ref);
177
173
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
178
- return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
179
- zoom: zoom,
174
+ return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
175
+ apiRef: apiRef,
176
+ initialZoom: initialZoom,
180
177
  onZoomChange: onZoomChange,
181
178
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
182
179
  children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
@@ -185,7 +182,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
185
182
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
186
183
  "data-drawing-container": true,
187
184
  children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
188
- }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
185
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
189
186
  }))]
190
187
  }))
191
188
  }));
@@ -195,6 +192,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
195
192
  // | These PropTypes are generated from the TypeScript type definitions |
196
193
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
197
194
  // ----------------------------------------------------------------------
195
+ apiRef: PropTypes.shape({
196
+ current: PropTypes.shape({
197
+ setZoomData: PropTypes.func.isRequired
198
+ })
199
+ }),
198
200
  /**
199
201
  * The configuration of axes highlight.
200
202
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -258,6 +260,19 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
258
260
  dataIndex: PropTypes.number,
259
261
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
260
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
+ })),
261
276
  /**
262
277
  * Indicate which axis to display the left of the charts.
263
278
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -273,7 +288,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
273
288
  * The margin between the SVG and the drawing area.
274
289
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
275
290
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
276
- * @default object Depends on the charts type.
277
291
  */
278
292
  margin: PropTypes.shape({
279
293
  bottom: PropTypes.number,
@@ -339,6 +353,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
339
353
  */
340
354
  slots: PropTypes.object,
341
355
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
356
+ theme: PropTypes.oneOf(['dark', 'light']),
342
357
  title: PropTypes.string,
343
358
  /**
344
359
  * Indicate which axis to display the top of the charts.
@@ -473,12 +488,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
473
488
  }), PropTypes.bool])
474
489
  })),
475
490
  /**
476
- * The list of zoom data related to each axis.
491
+ * The configuration of the z-axes.
477
492
  */
478
- zoom: PropTypes.arrayOf(PropTypes.shape({
479
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
480
- end: PropTypes.number.isRequired,
481
- 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
482
514
  }))
483
515
  } : void 0;
484
516
  export { LineChartPro };
@@ -2,13 +2,13 @@
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';
@@ -17,8 +17,6 @@ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
17
17
  import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
18
18
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
19
19
  import { useScatterChartProps, ChartsWrapper } from '@mui/x-charts/internals';
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
22
20
  import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
23
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
22
  /**
@@ -37,14 +35,14 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
37
35
  name: 'MuiScatterChartPro'
38
36
  });
39
37
  const {
40
- zoom,
41
- onZoomChange
38
+ initialZoom,
39
+ onZoomChange,
40
+ apiRef
42
41
  } = props,
43
42
  other = _objectWithoutPropertiesLoose(props, _excluded);
44
43
  const {
45
44
  chartsWrapperProps,
46
45
  chartContainerProps,
47
- zAxisProps,
48
46
  voronoiHandlerProps,
49
47
  chartsAxisProps,
50
48
  gridProps,
@@ -57,21 +55,22 @@ const ScatterChartPro = /*#__PURE__*/React.forwardRef(function ScatterChartPro(i
57
55
  const {
58
56
  chartDataProviderProProps,
59
57
  chartsSurfaceProps
60
- } = useChartContainerProProps(chartContainerProps, ref);
58
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
59
+ apiRef
60
+ }), ref);
61
61
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
62
- return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
63
- zoom: zoom,
62
+ return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
63
+ apiRef: apiRef,
64
+ initialZoom: initialZoom,
64
65
  onZoomChange: onZoomChange,
65
66
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
66
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
67
- children: /*#__PURE__*/_jsxs(ZAxisContextProvider, _extends({}, zAxisProps, {
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
- })), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
74
- }))
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]
75
74
  }))]
76
75
  }))
77
76
  }));
@@ -81,6 +80,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
81
80
  // | These PropTypes are generated from the TypeScript type definitions |
82
81
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
83
82
  // ----------------------------------------------------------------------
83
+ apiRef: PropTypes.shape({
84
+ current: PropTypes.shape({
85
+ setZoomData: PropTypes.func.isRequired
86
+ })
87
+ }),
84
88
  /**
85
89
  * The configuration of axes highlight.
86
90
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -141,6 +145,19 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
141
145
  dataIndex: PropTypes.number,
142
146
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
143
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
+ })),
144
161
  /**
145
162
  * Indicate which axis to display the left of the charts.
146
163
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -156,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
156
173
  * The margin between the SVG and the drawing area.
157
174
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
158
175
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
159
- * @default object Depends on the charts type.
160
176
  */
161
177
  margin: PropTypes.shape({
162
178
  bottom: PropTypes.number,
@@ -209,6 +225,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
209
225
  */
210
226
  slots: PropTypes.object,
211
227
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
228
+ theme: PropTypes.oneOf(['dark', 'light']),
212
229
  title: PropTypes.string,
213
230
  /**
214
231
  * Indicate which axis to display the top of the charts.
@@ -371,14 +388,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
371
388
  id: PropTypes.string,
372
389
  max: PropTypes.number,
373
390
  min: PropTypes.number
374
- })),
375
- /**
376
- * The list of zoom data related to each axis.
377
- */
378
- zoom: PropTypes.arrayOf(PropTypes.shape({
379
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
380
- end: PropTypes.number.isRequired,
381
- start: PropTypes.number.isRequired
382
391
  }))
383
392
  } : void 0;
384
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.7
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";