@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
@@ -0,0 +1,53 @@
1
+ export interface ZoomOptions {
2
+ /**
3
+ * The starting percentage of the zoom range. In the range of 0 to 100.
4
+ *
5
+ * @default 0
6
+ */
7
+ minStart?: number;
8
+ /**
9
+ * The ending percentage of the zoom range. In the range of 0 to 100.
10
+ *
11
+ * @default 100
12
+ */
13
+ maxEnd?: number;
14
+ /**
15
+ * The step size of the zooming function. Defines the granularity of the zoom.
16
+ *
17
+ * @default 5
18
+ */
19
+ step?: number;
20
+ /**
21
+ * Restricts the minimum span size in the range of 0 to 100.
22
+ *
23
+ * If the span size is smaller than the minSpan, the span will be resized to the minSpan.
24
+ *
25
+ * @default 10
26
+ */
27
+ minSpan?: number;
28
+ /**
29
+ * Restricts the maximum span size in the range of 0 to 100.
30
+ *
31
+ * If the span size is larger than the maxSpan, the span will be resized to the maxSpan.
32
+ *
33
+ * @default 100
34
+ */
35
+ maxSpan?: number;
36
+ /**
37
+ * Set to `false` to disable panning. Useful when you want to pan programmatically,
38
+ * or to show only a specific section of the chart.
39
+ *
40
+ * @default true
41
+ */
42
+ panning?: boolean;
43
+ /**
44
+ * Defines how to filter the axis data when it is outside of the zoomed range of this axis.
45
+ *
46
+ * - `keep`: The data outside the zoomed range is kept. And the other axes will stay the same.
47
+ * - `discard`: The data outside the zoomed range is discarded for the other axes.
48
+ * The other axes will be adjusted to fit the zoomed range.
49
+ *
50
+ * @default 'keep'
51
+ */
52
+ filterMode?: 'discard' | 'keep';
53
+ }
@@ -1,6 +1,6 @@
1
1
  import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczNjM3NzIwMDAwMA==";
3
+ const releaseInfo = "MTczNzY1ODgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
package/models/index.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export type { ZoomData } from '@mui/x-charts/internals';
1
2
  export * from './seriesType';
package/models/index.js CHANGED
@@ -1 +1,2 @@
1
- export * from "./seriesType/index.js";
1
+ export * from "./seriesType/index.js";
2
+ export {};
@@ -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 { useBarChartProps, ChartsWrapper } from '@mui/x-charts/internals';
19
19
  import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { useZoom } from "../context/ZoomProvider/useZoom.js";
20
+ import { useIsZoomInteracting } from "../hooks/zoom/index.js";
22
21
  import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
23
- import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
22
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
24
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
24
  function BarChartPlotZoom(props) {
26
- const {
27
- isInteracting
28
- } = useZoom();
25
+ const isInteracting = useIsZoomInteracting();
29
26
  return /*#__PURE__*/_jsx(BarPlot, _extends({}, props, {
30
- skipAnimation: isInteracting || undefined
27
+ skipAnimation: isInteracting || props.skipAnimation
31
28
  }));
32
29
  }
33
30
  process.env.NODE_ENV !== "production" ? BarChartPlotZoom.propTypes = {
@@ -86,8 +83,9 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
86
83
  name: 'MuiBarChartPro'
87
84
  });
88
85
  const {
89
- zoom,
90
- onZoomChange
86
+ initialZoom,
87
+ onZoomChange,
88
+ apiRef
91
89
  } = props,
92
90
  other = _objectWithoutPropertiesLoose(props, _excluded);
93
91
  const {
@@ -107,16 +105,18 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
107
105
  const {
108
106
  chartDataProviderProProps,
109
107
  chartsSurfaceProps
110
- } = useChartContainerProProps(chartContainerProps, ref);
108
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
109
+ initialZoom,
110
+ onZoomChange,
111
+ apiRef
112
+ }), ref);
111
113
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
112
114
  return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
113
- zoom: zoom,
114
- onZoomChange: onZoomChange,
115
115
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
116
116
  children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
117
117
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
118
118
  children: [/*#__PURE__*/_jsx(BarChartPlotZoom, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
119
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
119
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
120
120
  }))]
121
121
  }))
122
122
  }));
@@ -126,6 +126,11 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
126
126
  // | These PropTypes are generated from the TypeScript type definitions |
127
127
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
128
128
  // ----------------------------------------------------------------------
129
+ apiRef: PropTypes.shape({
130
+ current: PropTypes.shape({
131
+ setZoomData: PropTypes.func.isRequired
132
+ })
133
+ }),
129
134
  /**
130
135
  * The configuration of axes highlight.
131
136
  * Default is set to 'band' in the bar direction.
@@ -194,6 +199,19 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
194
199
  dataIndex: PropTypes.number,
195
200
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
196
201
  }),
202
+ /**
203
+ * This prop is used to help implement the accessibility logic.
204
+ * If you don't provide this prop. It falls back to a randomly generated id.
205
+ */
206
+ id: PropTypes.string,
207
+ /**
208
+ * The list of zoom data related to each axis.
209
+ */
210
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
211
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
212
+ end: PropTypes.number.isRequired,
213
+ start: PropTypes.number.isRequired
214
+ })),
197
215
  /**
198
216
  * The direction of the bar elements.
199
217
  * @default 'vertical'
@@ -214,7 +232,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
214
232
  * The margin between the SVG and the drawing area.
215
233
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
216
234
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
217
- * @default object Depends on the charts type.
218
235
  */
219
236
  margin: PropTypes.shape({
220
237
  bottom: PropTypes.number,
@@ -274,6 +291,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
274
291
  */
275
292
  slots: PropTypes.object,
276
293
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
294
+ theme: PropTypes.oneOf(['dark', 'light']),
277
295
  title: PropTypes.string,
278
296
  /**
279
297
  * Indicate which axis to display the top of the charts.
@@ -408,12 +426,29 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
408
426
  }), PropTypes.bool])
409
427
  })),
410
428
  /**
411
- * The list of zoom data related to each axis.
429
+ * The configuration of the z-axes.
412
430
  */
413
- zoom: PropTypes.arrayOf(PropTypes.shape({
414
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
415
- end: PropTypes.number.isRequired,
416
- start: PropTypes.number.isRequired
431
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
432
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
433
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
434
+ type: PropTypes.oneOf(['ordinal']).isRequired,
435
+ unknownColor: PropTypes.string,
436
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
437
+ }), PropTypes.shape({
438
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
439
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
440
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
441
+ type: PropTypes.oneOf(['continuous']).isRequired
442
+ }), PropTypes.shape({
443
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
444
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
445
+ type: PropTypes.oneOf(['piecewise']).isRequired
446
+ })]),
447
+ data: PropTypes.array,
448
+ dataKey: PropTypes.string,
449
+ id: PropTypes.string,
450
+ max: PropTypes.number,
451
+ min: PropTypes.number
417
452
  }))
418
453
  } : void 0;
419
454
  export { BarChartPro };
@@ -3,33 +3,58 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { Watermark } from '@mui/x-license/Watermark';
7
6
  import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
8
- import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
9
- import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
10
7
  import { useChartContainerProProps } from "./useChartContainerProProps.js";
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const releaseInfo = getReleaseInfo();
13
- const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerPro(props, ref) {
8
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ /**
11
+ * It sets up the data providers as well as the `<svg>` for the chart.
12
+ *
13
+ * This is a combination of both the `ChartDataProviderPro` and `ChartsSurface` components.
14
+ *
15
+ * Demos:
16
+ *
17
+ * - [Composition](https://mui.com/x/api/charts/composition/)
18
+ *
19
+ * API:
20
+ *
21
+ * - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
22
+ *
23
+ * @example
24
+ * ```jsx
25
+ * <ChartContainerPro
26
+ * series={[{ label: "Label", type: "bar", data: [10, 20] }]}
27
+ * xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
28
+ * >
29
+ * <BarPlot />
30
+ * <ChartsXAxis position="bottom" axisId="x-axis" />
31
+ * </ChartContainerPro>
32
+ * ```
33
+ */
34
+ const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerProInner(props, ref) {
14
35
  const {
15
36
  chartDataProviderProProps,
16
37
  children,
17
38
  chartsSurfaceProps
18
39
  } = useChartContainerProProps(props, ref);
19
- return /*#__PURE__*/_jsxs(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
20
- children: [/*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
40
+ return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
41
+ children: /*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
21
42
  children: children
22
- })), /*#__PURE__*/_jsx(Watermark, {
23
- packageName: "x-charts-pro",
24
- releaseInfo: releaseInfo
25
- })]
43
+ }))
26
44
  }));
27
45
  });
46
+
47
+ // @ts-expect-error the type coercion breaks the prop types
28
48
  process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
29
49
  // ----------------------------- Warning --------------------------------
30
50
  // | These PropTypes are generated from the TypeScript type definitions |
31
51
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
32
52
  // ----------------------------------------------------------------------
53
+ apiRef: PropTypes.shape({
54
+ current: PropTypes.shape({
55
+ setZoomData: PropTypes.func.isRequired
56
+ })
57
+ }),
33
58
  children: PropTypes.node,
34
59
  className: PropTypes.string,
35
60
  /**
@@ -59,11 +84,23 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
59
84
  dataIndex: PropTypes.number,
60
85
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
61
86
  }),
87
+ /**
88
+ * This prop is used to help implement the accessibility logic.
89
+ * If you don't provide this prop. It falls back to a randomly generated id.
90
+ */
91
+ id: PropTypes.string,
92
+ /**
93
+ * The list of zoom data related to each axis.
94
+ */
95
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
96
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
97
+ end: PropTypes.number.isRequired,
98
+ start: PropTypes.number.isRequired
99
+ })),
62
100
  /**
63
101
  * The margin between the SVG and the drawing area.
64
102
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
65
103
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
66
- * @default object Depends on the charts type.
67
104
  */
68
105
  margin: PropTypes.shape({
69
106
  bottom: PropTypes.number,
@@ -83,23 +120,19 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
83
120
  * @param {ZoomData[]} zoomData Updated zoom data.
84
121
  */
85
122
  onZoomChange: PropTypes.func,
86
- /**
87
- * An array of plugins defining how to preprocess data.
88
- * If not provided, the container supports line, bar, scatter and pie charts.
89
- */
90
- plugins: PropTypes.arrayOf(PropTypes.object),
91
123
  /**
92
124
  * The array of series to display.
93
125
  * Each type of series has its own specificity.
94
126
  * Please refer to the appropriate docs page to learn more about it.
95
127
  */
96
- series: PropTypes.arrayOf(PropTypes.object).isRequired,
128
+ series: PropTypes.arrayOf(PropTypes.object),
97
129
  /**
98
130
  * If `true`, animations are skipped.
99
131
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
100
132
  */
101
133
  skipAnimation: PropTypes.bool,
102
134
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
135
+ theme: PropTypes.oneOf(['dark', 'light']),
103
136
  title: PropTypes.string,
104
137
  /**
105
138
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -251,14 +284,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
251
284
  id: PropTypes.string,
252
285
  max: PropTypes.number,
253
286
  min: PropTypes.number
254
- })),
255
- /**
256
- * The list of zoom data related to each axis.
257
- */
258
- zoom: PropTypes.arrayOf(PropTypes.shape({
259
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
260
- end: PropTypes.number.isRequired,
261
- start: PropTypes.number.isRequired
262
287
  }))
263
288
  } : void 0;
264
289
  export { ChartContainerPro };
@@ -2,16 +2,19 @@
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", "plugins", "apiRef"];
6
6
  import { useChartContainerProps } from '@mui/x-charts/internals';
7
+ import { ALL_PLUGINS } from "../internals/plugins/allPlugins.js";
7
8
  export const useChartContainerProProps = (props, ref) => {
8
9
  const {
9
- zoom,
10
- onZoomChange
10
+ initialZoom,
11
+ onZoomChange,
12
+ plugins,
13
+ apiRef
11
14
  } = props,
12
15
  baseProps = _objectWithoutPropertiesLoose(props, _excluded);
13
16
  const chartDataProviderProProps = {
14
- zoom,
17
+ initialZoom,
15
18
  onZoomChange
16
19
  };
17
20
  const {
@@ -20,7 +23,10 @@ export const useChartContainerProProps = (props, ref) => {
20
23
  children
21
24
  } = useChartContainerProps(baseProps, ref);
22
25
  return {
23
- chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps),
26
+ chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps, {
27
+ apiRef,
28
+ plugins: plugins ?? ALL_PLUGINS
29
+ }),
24
30
  chartsSurfaceProps,
25
31
  children
26
32
  };