@mui/x-charts-pro 8.0.0-alpha.7 → 8.0.0-alpha.9

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 (169) hide show
  1. package/BarChartPro/BarChartPro.d.ts +2 -2
  2. package/BarChartPro/BarChartPro.js +55 -20
  3. package/CHANGELOG.md +551 -3
  4. package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
  5. package/ChartContainerPro/ChartContainerPro.js +52 -27
  6. package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
  7. package/ChartContainerPro/useChartContainerProProps.js +11 -5
  8. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
  9. package/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
  10. package/{context → ChartDataProviderPro}/package.json +1 -1
  11. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
  12. package/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
  13. package/Heatmap/Heatmap.js +28 -2
  14. package/Heatmap/HeatmapTooltip.js +6 -4
  15. package/Heatmap/extremums.d.ts +2 -2
  16. package/Heatmap/formatter.d.ts +2 -2
  17. package/Heatmap/formatter.js +2 -1
  18. package/Heatmap/plugin.d.ts +2 -2
  19. package/Heatmap/plugin.js +2 -2
  20. package/LineChartPro/LineChartPro.d.ts +2 -2
  21. package/LineChartPro/LineChartPro.js +58 -37
  22. package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
  23. package/ScatterChartPro/ScatterChartPro.js +36 -28
  24. package/hooks/index.d.ts +1 -0
  25. package/hooks/index.js +2 -1
  26. package/hooks/zoom/index.d.ts +1 -0
  27. package/hooks/zoom/index.js +1 -0
  28. package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
  29. package/hooks/zoom/useIsZoomInteracting.js +14 -0
  30. package/index.d.ts +3 -1
  31. package/index.js +5 -5
  32. package/internals/plugins/allPlugins.d.ts +10 -0
  33. package/internals/plugins/allPlugins.js +5 -0
  34. package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
  35. package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  36. package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
  37. package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  38. package/internals/plugins/useChartProZoom/index.d.ts +3 -0
  39. package/internals/plugins/useChartProZoom/index.js +3 -0
  40. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
  41. package/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  42. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +377 -0
  43. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  44. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +50 -0
  45. package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
  46. package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  47. package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
  48. package/internals/utils/releaseInfo.js +1 -1
  49. package/models/index.d.ts +1 -0
  50. package/models/index.js +2 -1
  51. package/modern/BarChartPro/BarChartPro.js +55 -20
  52. package/modern/ChartContainerPro/ChartContainerPro.js +52 -27
  53. package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
  54. package/modern/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
  55. package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
  56. package/modern/Heatmap/Heatmap.js +28 -2
  57. package/modern/Heatmap/HeatmapTooltip.js +6 -4
  58. package/modern/Heatmap/formatter.js +2 -1
  59. package/modern/Heatmap/plugin.js +2 -2
  60. package/modern/LineChartPro/LineChartPro.js +58 -37
  61. package/modern/ScatterChartPro/ScatterChartPro.js +36 -28
  62. package/modern/hooks/index.js +2 -1
  63. package/modern/hooks/zoom/index.js +1 -0
  64. package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
  65. package/modern/index.js +5 -5
  66. package/modern/internals/plugins/allPlugins.js +5 -0
  67. package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  68. package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  69. package/modern/internals/plugins/useChartProZoom/index.js +3 -0
  70. package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  71. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  72. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
  73. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  74. package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
  75. package/modern/internals/utils/releaseInfo.js +1 -1
  76. package/modern/models/index.js +2 -1
  77. package/node/BarChartPro/BarChartPro.js +55 -20
  78. package/node/ChartContainerPro/ChartContainerPro.js +51 -26
  79. package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
  80. package/node/ChartDataProviderPro/ChartDataProviderPro.js +298 -0
  81. package/node/ChartDataProviderPro/useChartDataProviderProProps.js +23 -0
  82. package/node/Heatmap/Heatmap.js +28 -2
  83. package/node/Heatmap/HeatmapTooltip.js +4 -2
  84. package/node/Heatmap/formatter.js +2 -1
  85. package/node/Heatmap/plugin.js +2 -2
  86. package/node/LineChartPro/LineChartPro.js +58 -37
  87. package/node/ScatterChartPro/ScatterChartPro.js +36 -28
  88. package/node/hooks/index.js +16 -1
  89. package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
  90. package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
  91. package/node/index.js +34 -12
  92. package/node/internals/plugins/allPlugins.js +11 -0
  93. package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -0
  94. package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
  95. package/node/internals/plugins/useChartProZoom/index.js +38 -0
  96. package/node/internals/plugins/useChartProZoom/useChartProZoom.js +310 -0
  97. package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +18 -0
  98. package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
  99. package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
  100. package/node/internals/utils/releaseInfo.js +1 -1
  101. package/package.json +5 -5
  102. package/typeOverloads/modules.d.ts +8 -1
  103. package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
  104. package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  105. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -13
  106. package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  107. package/context/CartesianProviderPro/index.d.ts +0 -1
  108. package/context/CartesianProviderPro/index.js +0 -1
  109. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -7
  110. package/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
  111. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
  112. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  113. package/context/ZoomProvider/Zoom.types.d.ts +0 -144
  114. package/context/ZoomProvider/ZoomContext.d.ts +0 -4
  115. package/context/ZoomProvider/ZoomContext.js +0 -16
  116. package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
  117. package/context/ZoomProvider/ZoomProvider.js +0 -56
  118. package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
  119. package/context/ZoomProvider/ZoomSetup.js +0 -16
  120. package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
  121. package/context/ZoomProvider/defaultizeZoom.js +0 -32
  122. package/context/ZoomProvider/index.d.ts +0 -3
  123. package/context/ZoomProvider/index.js +0 -3
  124. package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
  125. package/context/ZoomProvider/initializeZoomData.js +0 -13
  126. package/context/ZoomProvider/useSetupPan.d.ts +0 -1
  127. package/context/ZoomProvider/useSetupPan.js +0 -106
  128. package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
  129. package/context/ZoomProvider/useSetupZoom.js +0 -274
  130. package/context/ZoomProvider/useZoom.d.ts +0 -7
  131. package/context/ZoomProvider/useZoom.js +0 -19
  132. package/context/index.d.ts +0 -3
  133. package/context/index.js +0 -5
  134. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  135. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  136. package/modern/context/CartesianProviderPro/index.js +0 -1
  137. package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
  138. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  139. package/modern/context/ZoomProvider/ZoomContext.js +0 -16
  140. package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
  141. package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
  142. package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
  143. package/modern/context/ZoomProvider/index.js +0 -3
  144. package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
  145. package/modern/context/ZoomProvider/useSetupPan.js +0 -106
  146. package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
  147. package/modern/context/ZoomProvider/useZoom.js +0 -19
  148. package/modern/context/index.js +0 -5
  149. package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
  150. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
  151. package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -56
  152. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
  153. package/node/context/ZoomProvider/ZoomContext.js +0 -23
  154. package/node/context/ZoomProvider/ZoomProvider.js +0 -63
  155. package/node/context/ZoomProvider/ZoomSetup.js +0 -20
  156. package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
  157. package/node/context/ZoomProvider/index.js +0 -38
  158. package/node/context/ZoomProvider/initializeZoomData.js +0 -20
  159. package/node/context/ZoomProvider/useSetupPan.js +0 -114
  160. package/node/context/ZoomProvider/useSetupZoom.js +0 -281
  161. package/node/context/ZoomProvider/useZoom.js +0 -25
  162. package/node/context/index.js +0 -27
  163. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.d.ts +0 -0
  164. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  165. /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
  166. /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
  167. /package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  168. /package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  169. /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
@@ -1,3 +1,3 @@
1
- import { SeriesFormatter } from '@mui/x-charts/internals';
2
- declare const formatter: SeriesFormatter<'heatmap'>;
1
+ import { SeriesProcessor } from '@mui/x-charts/internals';
2
+ declare const formatter: SeriesProcessor<'heatmap'>;
3
3
  export default formatter;
@@ -9,7 +9,8 @@ const formatter = params => {
9
9
  defaultizedSeries[seriesId] = _extends({
10
10
  // Defaultize the data and the value formatter.
11
11
  valueFormatter: v => v[2].toString(),
12
- data: []
12
+ data: [],
13
+ labelMarkType: 'square'
13
14
  }, series[seriesId]);
14
15
  });
15
16
  return {
@@ -1,2 +1,2 @@
1
- import { ChartsPlugin } from '@mui/x-charts/internals';
2
- export declare const plugin: ChartsPlugin<'heatmap'>;
1
+ import { ChartSeriesTypeConfig } from '@mui/x-charts/internals';
2
+ export declare const plugin: ChartSeriesTypeConfig<'heatmap'>;
package/Heatmap/plugin.js CHANGED
@@ -2,9 +2,9 @@ import { getBaseExtremum } from "./extremums.js";
2
2
  import formatter from "./formatter.js";
3
3
  import getColor from "./getColor.js";
4
4
  export const plugin = {
5
- seriesType: 'heatmap',
6
- seriesFormatter: formatter,
5
+ seriesProcessor: formatter,
7
6
  colorProcessor: getColor,
7
+ legendGetter: () => [],
8
8
  xExtremumGetter: getBaseExtremum,
9
9
  yExtremumGetter: getBaseExtremum
10
10
  };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { LineChartProps } from '@mui/x-charts/LineChart';
3
- import { ZoomProps } from '../context/ZoomProvider';
4
- export interface LineChartProProps extends LineChartProps, ZoomProps {
3
+ import { ChartContainerProProps } from '../ChartContainerPro';
4
+ export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line'>, 'series' | 'plugins' | 'seriesConfig'> {
5
5
  }
6
6
  /**
7
7
  * Demos:
@@ -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,17 +17,14 @@ 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 { useIsZoomInteracting } from "../hooks/zoom/index.js";
23
21
  import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
22
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.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
- skipAnimation: isInteracting || undefined
27
+ skipAnimation: isInteracting || props.skipAnimation
31
28
  }));
32
29
  }
33
30
  process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
@@ -58,11 +55,9 @@ 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
- skipAnimation: isInteracting || undefined
60
+ skipAnimation: isInteracting || props.skipAnimation
66
61
  }));
67
62
  }
68
63
  process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
@@ -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
  }));
@@ -105,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
105
98
  // | These PropTypes are generated from the TypeScript type definitions |
106
99
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
107
100
  // ----------------------------------------------------------------------
108
- /**
109
- * If `true` the mark element will only be able to render circle.
110
- * Giving fewer customization options, but saving around 40ms per 1.000 marks.
111
- * @default false
112
- */
113
- experimentalRendering: PropTypes.bool,
114
101
  /**
115
102
  * Callback fired when a line mark item is clicked.
116
103
  * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
@@ -149,8 +136,9 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
149
136
  name: 'MuiLineChartPro'
150
137
  });
151
138
  const {
152
- zoom,
153
- onZoomChange
139
+ initialZoom,
140
+ onZoomChange,
141
+ apiRef
154
142
  } = props,
155
143
  other = _objectWithoutPropertiesLoose(props, _excluded);
156
144
  const {
@@ -173,11 +161,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
173
161
  const {
174
162
  chartDataProviderProProps,
175
163
  chartsSurfaceProps
176
- } = useChartContainerProProps(chartContainerProps, ref);
164
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
165
+ initialZoom,
166
+ onZoomChange,
167
+ apiRef
168
+ }), ref);
177
169
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
178
170
  return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
179
- zoom: zoom,
180
- onZoomChange: onZoomChange,
181
171
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
182
172
  children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
183
173
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
@@ -185,7 +175,7 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
185
175
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
186
176
  "data-drawing-container": true,
187
177
  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]
178
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
189
179
  }))]
190
180
  }))
191
181
  }));
@@ -195,6 +185,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
195
185
  // | These PropTypes are generated from the TypeScript type definitions |
196
186
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
197
187
  // ----------------------------------------------------------------------
188
+ apiRef: PropTypes.shape({
189
+ current: PropTypes.shape({
190
+ setZoomData: PropTypes.func.isRequired
191
+ })
192
+ }),
198
193
  /**
199
194
  * The configuration of axes highlight.
200
195
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -232,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
232
227
  * If `true`, render the line highlight item.
233
228
  */
234
229
  disableLineItemHighlight: PropTypes.bool,
235
- /**
236
- * If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
237
- */
238
- experimentalMarkRendering: PropTypes.bool,
239
230
  /**
240
231
  * Option to display a cartesian grid in the background.
241
232
  */
@@ -258,6 +249,19 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
258
249
  dataIndex: PropTypes.number,
259
250
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
260
251
  }),
252
+ /**
253
+ * This prop is used to help implement the accessibility logic.
254
+ * If you don't provide this prop. It falls back to a randomly generated id.
255
+ */
256
+ id: PropTypes.string,
257
+ /**
258
+ * The list of zoom data related to each axis.
259
+ */
260
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
261
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
262
+ end: PropTypes.number.isRequired,
263
+ start: PropTypes.number.isRequired
264
+ })),
261
265
  /**
262
266
  * Indicate which axis to display the left of the charts.
263
267
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -273,7 +277,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
273
277
  * The margin between the SVG and the drawing area.
274
278
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
275
279
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
276
- * @default object Depends on the charts type.
277
280
  */
278
281
  margin: PropTypes.shape({
279
282
  bottom: PropTypes.number,
@@ -339,6 +342,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
339
342
  */
340
343
  slots: PropTypes.object,
341
344
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
345
+ theme: PropTypes.oneOf(['dark', 'light']),
342
346
  title: PropTypes.string,
343
347
  /**
344
348
  * Indicate which axis to display the top of the charts.
@@ -473,12 +477,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
473
477
  }), PropTypes.bool])
474
478
  })),
475
479
  /**
476
- * The list of zoom data related to each axis.
480
+ * The configuration of the z-axes.
477
481
  */
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
482
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
483
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
484
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
485
+ type: PropTypes.oneOf(['ordinal']).isRequired,
486
+ unknownColor: PropTypes.string,
487
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
488
+ }), PropTypes.shape({
489
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
490
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
491
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
492
+ type: PropTypes.oneOf(['continuous']).isRequired
493
+ }), PropTypes.shape({
494
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
495
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
496
+ type: PropTypes.oneOf(['piecewise']).isRequired
497
+ })]),
498
+ data: PropTypes.array,
499
+ dataKey: PropTypes.string,
500
+ id: PropTypes.string,
501
+ max: PropTypes.number,
502
+ min: PropTypes.number
482
503
  }))
483
504
  } : void 0;
484
505
  export { LineChartPro };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ScatterChartProps } from '@mui/x-charts/ScatterChart';
3
- import { ZoomProps } from '../context/ZoomProvider';
4
- export interface ScatterChartProProps extends ScatterChartProps, ZoomProps {
3
+ import { ChartContainerProProps } from '../ChartContainerPro/ChartContainerPro';
4
+ export interface ScatterChartProProps extends Omit<ScatterChartProps, 'apiRef'>, Omit<ChartContainerProProps<'scatter'>, 'series' | 'plugins' | 'seriesConfig'> {
5
5
  }
6
6
  /**
7
7
  * Demos:
@@ -2,13 +2,12 @@
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';
12
11
  import { ChartsVoronoiHandler } from '@mui/x-charts/ChartsVoronoiHandler';
13
12
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
14
13
  import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
@@ -17,9 +16,8 @@ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
17
16
  import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
18
17
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
19
18
  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
19
  import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
20
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
23
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
22
  /**
25
23
  * Demos:
@@ -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,21 @@ 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
+ initialZoom,
60
+ onZoomChange,
61
+ apiRef
62
+ }), ref);
61
63
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
62
64
  return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
63
- zoom: zoom,
64
- onZoomChange: onZoomChange,
65
65
  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
- }))
66
+ children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
67
+ children: [!props.disableVoronoi && /*#__PURE__*/_jsx(ChartsVoronoiHandler, _extends({}, voronoiHandlerProps)), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
68
+ "data-drawing-container": true,
69
+ children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
70
+ }), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props?.slotProps?.tooltip, {
71
+ trigger: "item"
72
+ })), children]
75
73
  }))]
76
74
  }))
77
75
  }));
@@ -81,6 +79,11 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
81
79
  // | These PropTypes are generated from the TypeScript type definitions |
82
80
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
83
81
  // ----------------------------------------------------------------------
82
+ apiRef: PropTypes.shape({
83
+ current: PropTypes.shape({
84
+ setZoomData: PropTypes.func.isRequired
85
+ })
86
+ }),
84
87
  /**
85
88
  * The configuration of axes highlight.
86
89
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -141,6 +144,19 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
141
144
  dataIndex: PropTypes.number,
142
145
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
143
146
  }),
147
+ /**
148
+ * This prop is used to help implement the accessibility logic.
149
+ * If you don't provide this prop. It falls back to a randomly generated id.
150
+ */
151
+ id: PropTypes.string,
152
+ /**
153
+ * The list of zoom data related to each axis.
154
+ */
155
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
156
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
157
+ end: PropTypes.number.isRequired,
158
+ start: PropTypes.number.isRequired
159
+ })),
144
160
  /**
145
161
  * Indicate which axis to display the left of the charts.
146
162
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -156,7 +172,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
156
172
  * The margin between the SVG and the drawing area.
157
173
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
158
174
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
159
- * @default object Depends on the charts type.
160
175
  */
161
176
  margin: PropTypes.shape({
162
177
  bottom: PropTypes.number,
@@ -209,6 +224,7 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
209
224
  */
210
225
  slots: PropTypes.object,
211
226
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
227
+ theme: PropTypes.oneOf(['dark', 'light']),
212
228
  title: PropTypes.string,
213
229
  /**
214
230
  * Indicate which axis to display the top of the charts.
@@ -371,14 +387,6 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
371
387
  id: PropTypes.string,
372
388
  max: PropTypes.number,
373
389
  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
390
  }))
383
391
  } : void 0;
384
392
  export { ScatterChartPro };
package/hooks/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { useHeatmapSeries as unstable_useHeatmapSeries } from './useSeries';
2
+ export * from './zoom';
package/hooks/index.js CHANGED
@@ -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';
@@ -0,0 +1 @@
1
+ export * from "./useIsZoomInteracting.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get access to the zoom state.
3
+ *
4
+ * @returns {boolean} Inform the zoom is interacting.
5
+ */
6
+ export declare function useIsZoomInteracting(): boolean;
@@ -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/index.d.ts CHANGED
@@ -22,9 +22,11 @@ export * from '@mui/x-charts/ScatterChart';
22
22
  export * from '@mui/x-charts/SparkLineChart';
23
23
  export * from '@mui/x-charts/Gauge';
24
24
  export * from '@mui/x-charts/ChartsSurface';
25
+ export * from '@mui/x-charts/ChartDataProvider';
26
+ export * from '@mui/x-charts/ChartsLabel';
25
27
  export * from './Heatmap';
26
28
  export * from './ChartContainerPro';
29
+ export * from './ChartDataProviderPro';
27
30
  export * from './ScatterChartPro';
28
31
  export * from './BarChartPro';
29
32
  export * from './LineChartPro';
30
- export * from './context';
package/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.9
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -32,13 +32,13 @@ export * from '@mui/x-charts/ScatterChart';
32
32
  export * from '@mui/x-charts/SparkLineChart';
33
33
  export * from '@mui/x-charts/Gauge';
34
34
  export * from '@mui/x-charts/ChartsSurface';
35
+ export * from '@mui/x-charts/ChartDataProvider';
36
+ export * from '@mui/x-charts/ChartsLabel';
35
37
 
36
38
  // Pro components
37
39
  export * from "./Heatmap/index.js";
38
40
  export * from "./ChartContainerPro/index.js";
41
+ export * from "./ChartDataProviderPro/index.js";
39
42
  export * from "./ScatterChartPro/index.js";
40
43
  export * from "./BarChartPro/index.js";
41
- export * from "./LineChartPro/index.js";
42
-
43
- // Pro context
44
- export * from "./context/index.js";
44
+ export * from "./LineChartPro/index.js";
@@ -0,0 +1,10 @@
1
+ import { ChartSeriesType, ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartZAxisSignature } from '@mui/x-charts/internals';
2
+ import { UseChartProZoomSignature } from './useChartProZoom';
3
+ export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [
4
+ UseChartZAxisSignature,
5
+ UseChartCartesianAxisSignature<TSeries>,
6
+ UseChartInteractionSignature,
7
+ UseChartProZoomSignature
8
+ ];
9
+ export type AllPluginsType<TSeries extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<TSeries>>;
10
+ export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<keyof import("@mui/x-charts/internals").ChartsSeriesConfig>>)[];
@@ -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,3 @@
1
+ import { AxisId, DefaultizedZoomOptions } from '@mui/x-charts/internals';
2
+ import { AxisConfig, ChartsXAxisProps, ChartsYAxisProps, ScaleName } from '@mui/x-charts/models';
3
+ export declare const creatZoomLookup: (axes: AxisConfig<ScaleName, any, ChartsXAxisProps | ChartsYAxisProps>[]) => Record<AxisId, DefaultizedZoomOptions>;
@@ -0,0 +1,12 @@
1
+ import { defaultizeZoom } from "./defaultizeZoom.js";
2
+ export const creatZoomLookup = axes => axes.reduce((acc, v) => {
3
+ const {
4
+ zoom,
5
+ id: axisId
6
+ } = v;
7
+ const defaultizedZoom = defaultizeZoom(zoom, axisId, 'x');
8
+ if (defaultizedZoom) {
9
+ acc[axisId] = defaultizedZoom;
10
+ }
11
+ return acc;
12
+ }, {});
@@ -0,0 +1,2 @@
1
+ import { AxisId, DefaultizedZoomOptions, ZoomOptions } from '@mui/x-charts/internals';
2
+ export declare const defaultizeZoom: (zoom: boolean | ZoomOptions | undefined, axisId: AxisId, axisDirection: "x" | "y") => DefaultizedZoomOptions | undefined;
@@ -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';
2
+ export * from './useChartProZoom';
3
+ export * from './useChartProZoom.types';
@@ -0,0 +1,3 @@
1
+ export * from "./useChartProZoom.selectors.js";
2
+ export * from "./useChartProZoom.js";
3
+ export * from "./useChartProZoom.types.js";
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from '@mui/x-charts/internals';
2
+ import { UseChartProZoomSignature } from './useChartProZoom.types';
3
+ export declare const useChartProZoom: ChartPlugin<UseChartProZoomSignature>;