@mui/x-charts-pro 8.0.0-alpha.1 → 8.0.0-alpha.10

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 (178) hide show
  1. package/BarChartPro/BarChartPro.d.ts +2 -2
  2. package/BarChartPro/BarChartPro.js +72 -31
  3. package/CHANGELOG.md +1903 -231
  4. package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
  5. package/ChartContainerPro/ChartContainerPro.js +55 -37
  6. package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
  7. package/ChartContainerPro/useChartContainerProProps.js +11 -7
  8. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
  9. package/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
  10. package/{context → ChartDataProviderPro}/package.json +1 -1
  11. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
  12. package/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
  13. package/Heatmap/Heatmap.js +31 -8
  14. package/Heatmap/HeatmapItem.js +1 -1
  15. package/Heatmap/HeatmapTooltip.js +8 -28
  16. package/Heatmap/extremums.d.ts +2 -2
  17. package/Heatmap/formatter.d.ts +2 -2
  18. package/Heatmap/formatter.js +2 -1
  19. package/Heatmap/heatmapClasses.js +2 -1
  20. package/Heatmap/plugin.d.ts +2 -2
  21. package/Heatmap/plugin.js +4 -2
  22. package/Heatmap/tooltip.d.ts +3 -0
  23. package/Heatmap/tooltip.js +25 -0
  24. package/LineChartPro/LineChartPro.d.ts +2 -2
  25. package/LineChartPro/LineChartPro.js +78 -51
  26. package/README.md +1 -1
  27. package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
  28. package/ScatterChartPro/ScatterChartPro.js +49 -33
  29. package/hooks/index.d.ts +1 -0
  30. package/hooks/index.js +2 -1
  31. package/hooks/useSeries.d.ts +2 -4
  32. package/hooks/zoom/index.d.ts +1 -0
  33. package/hooks/zoom/index.js +1 -0
  34. package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
  35. package/hooks/zoom/useIsZoomInteracting.js +14 -0
  36. package/index.d.ts +3 -1
  37. package/index.js +5 -5
  38. package/internals/plugins/allPlugins.d.ts +11 -0
  39. package/internals/plugins/allPlugins.js +5 -0
  40. package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
  41. package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  42. package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
  43. package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  44. package/internals/plugins/useChartProZoom/index.d.ts +3 -0
  45. package/internals/plugins/useChartProZoom/index.js +3 -0
  46. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
  47. package/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  48. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +377 -0
  49. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  50. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +50 -0
  51. package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
  52. package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  53. package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
  54. package/internals/utils/releaseInfo.js +2 -2
  55. package/models/index.d.ts +1 -0
  56. package/models/index.js +2 -1
  57. package/modern/BarChartPro/BarChartPro.js +72 -31
  58. package/modern/ChartContainerPro/ChartContainerPro.js +55 -37
  59. package/modern/ChartContainerPro/useChartContainerProProps.js +11 -7
  60. package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
  61. package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
  62. package/modern/Heatmap/Heatmap.js +31 -8
  63. package/modern/Heatmap/HeatmapItem.js +1 -1
  64. package/modern/Heatmap/HeatmapTooltip.js +8 -28
  65. package/modern/Heatmap/formatter.js +2 -1
  66. package/modern/Heatmap/heatmapClasses.js +2 -1
  67. package/modern/Heatmap/plugin.js +4 -2
  68. package/modern/Heatmap/tooltip.js +25 -0
  69. package/modern/LineChartPro/LineChartPro.js +78 -51
  70. package/modern/ScatterChartPro/ScatterChartPro.js +49 -33
  71. package/modern/hooks/index.js +2 -1
  72. package/modern/hooks/zoom/index.js +1 -0
  73. package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
  74. package/modern/index.js +5 -5
  75. package/modern/internals/plugins/allPlugins.js +5 -0
  76. package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -0
  77. package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
  78. package/modern/internals/plugins/useChartProZoom/index.js +3 -0
  79. package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +303 -0
  80. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
  81. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
  82. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
  83. package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
  84. package/modern/internals/utils/releaseInfo.js +2 -2
  85. package/modern/models/index.js +2 -1
  86. package/node/BarChartPro/BarChartPro.js +71 -30
  87. package/node/ChartContainerPro/ChartContainerPro.js +54 -36
  88. package/node/ChartContainerPro/useChartContainerProProps.js +11 -7
  89. package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +67 -77
  90. package/node/ChartDataProviderPro/useChartDataProviderProProps.js +21 -0
  91. package/node/Heatmap/Heatmap.js +31 -8
  92. package/node/Heatmap/HeatmapItem.js +2 -2
  93. package/node/Heatmap/HeatmapTooltip.js +6 -26
  94. package/node/Heatmap/formatter.js +2 -1
  95. package/node/Heatmap/heatmapClasses.js +5 -4
  96. package/node/Heatmap/plugin.js +4 -2
  97. package/node/Heatmap/tooltip.js +31 -0
  98. package/node/LineChartPro/LineChartPro.js +77 -50
  99. package/node/ScatterChartPro/ScatterChartPro.js +48 -32
  100. package/node/hooks/index.js +16 -1
  101. package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
  102. package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
  103. package/node/index.js +34 -12
  104. package/node/internals/plugins/allPlugins.js +11 -0
  105. package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -0
  106. package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
  107. package/node/internals/plugins/useChartProZoom/index.js +38 -0
  108. package/node/internals/plugins/useChartProZoom/useChartProZoom.js +310 -0
  109. package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +18 -0
  110. package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
  111. package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
  112. package/node/internals/utils/releaseInfo.js +4 -3
  113. package/package.json +6 -6
  114. package/typeOverloads/modules.d.ts +8 -1
  115. package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
  116. package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  117. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -12
  118. package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  119. package/context/CartesianProviderPro/index.d.ts +0 -1
  120. package/context/CartesianProviderPro/index.js +0 -1
  121. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -10
  122. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
  123. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  124. package/context/ZoomProvider/Zoom.types.d.ts +0 -144
  125. package/context/ZoomProvider/ZoomContext.d.ts +0 -4
  126. package/context/ZoomProvider/ZoomContext.js +0 -16
  127. package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
  128. package/context/ZoomProvider/ZoomProvider.js +0 -56
  129. package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
  130. package/context/ZoomProvider/ZoomSetup.js +0 -16
  131. package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
  132. package/context/ZoomProvider/defaultizeZoom.js +0 -32
  133. package/context/ZoomProvider/index.d.ts +0 -3
  134. package/context/ZoomProvider/index.js +0 -3
  135. package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
  136. package/context/ZoomProvider/initializeZoomData.js +0 -13
  137. package/context/ZoomProvider/useSetupPan.d.ts +0 -1
  138. package/context/ZoomProvider/useSetupPan.js +0 -106
  139. package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
  140. package/context/ZoomProvider/useSetupZoom.js +0 -274
  141. package/context/ZoomProvider/useZoom.d.ts +0 -7
  142. package/context/ZoomProvider/useZoom.js +0 -19
  143. package/context/index.d.ts +0 -3
  144. package/context/index.js +0 -5
  145. package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
  146. package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
  147. package/modern/context/CartesianProviderPro/index.js +0 -1
  148. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
  149. package/modern/context/ZoomProvider/ZoomContext.js +0 -16
  150. package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
  151. package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
  152. package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
  153. package/modern/context/ZoomProvider/index.js +0 -3
  154. package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
  155. package/modern/context/ZoomProvider/useSetupPan.js +0 -106
  156. package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
  157. package/modern/context/ZoomProvider/useZoom.js +0 -19
  158. package/modern/context/index.js +0 -5
  159. package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
  160. package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
  161. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
  162. package/node/context/ZoomProvider/ZoomContext.js +0 -23
  163. package/node/context/ZoomProvider/ZoomProvider.js +0 -63
  164. package/node/context/ZoomProvider/ZoomSetup.js +0 -20
  165. package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
  166. package/node/context/ZoomProvider/index.js +0 -38
  167. package/node/context/ZoomProvider/initializeZoomData.js +0 -20
  168. package/node/context/ZoomProvider/useSetupPan.js +0 -114
  169. package/node/context/ZoomProvider/useSetupZoom.js +0 -281
  170. package/node/context/ZoomProvider/useZoom.js +0 -25
  171. package/node/context/index.js +0 -27
  172. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.d.ts +0 -0
  173. /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  174. /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
  175. /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
  176. /package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  177. /package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
  178. /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
@@ -17,6 +17,9 @@ import { HeatmapTooltip } from "./HeatmapTooltip.js";
17
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
19
19
  const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
20
+ const seriesConfig = {
21
+ heatmap: heatmapPlugin
22
+ };
20
23
  const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
21
24
  const props = useThemeProps({
22
25
  props: inProps,
@@ -66,7 +69,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
66
69
  const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
67
70
  return /*#__PURE__*/_jsxs(ChartContainerPro, {
68
71
  ref: ref,
69
- plugins: [heatmapPlugin],
72
+ seriesConfig: seriesConfig,
70
73
  series: series.map(s => _extends({
71
74
  type: 'heatmap'
72
75
  }, s)),
@@ -111,6 +114,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
111
114
  // | These PropTypes are generated from the TypeScript type definitions |
112
115
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
113
116
  // ----------------------------------------------------------------------
117
+ apiRef: PropTypes.shape({
118
+ current: PropTypes.shape({
119
+ setZoomData: PropTypes.func.isRequired
120
+ })
121
+ }),
114
122
  /**
115
123
  * Indicate which axis to display the bottom of the charts.
116
124
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -140,12 +148,26 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
140
148
  */
141
149
  height: PropTypes.number,
142
150
  /**
143
- * The item currently highlighted. Turns highlighting into a controlled prop.
151
+ * The highlighted item.
152
+ * Used when the highlight is controlled.
144
153
  */
145
154
  highlightedItem: PropTypes.shape({
146
155
  dataIndex: PropTypes.number,
147
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
156
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
148
157
  }),
158
+ /**
159
+ * This prop is used to help implement the accessibility logic.
160
+ * If you don't provide this prop. It falls back to a randomly generated id.
161
+ */
162
+ id: PropTypes.string,
163
+ /**
164
+ * The list of zoom data related to each axis.
165
+ */
166
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
167
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
168
+ end: PropTypes.number.isRequired,
169
+ start: PropTypes.number.isRequired
170
+ })),
149
171
  /**
150
172
  * Indicate which axis to display the left of the charts.
151
173
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -161,7 +183,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
161
183
  * The margin between the SVG and the drawing area.
162
184
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
163
185
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
164
- * @default object Depends on the charts type.
165
186
  */
166
187
  margin: PropTypes.shape({
167
188
  bottom: PropTypes.number,
@@ -193,6 +214,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
193
214
  * An array of [[HeatmapSeriesType]] objects.
194
215
  */
195
216
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
217
+ /**
218
+ * The configuration helpers used to compute attributes according to the serries type.
219
+ * @ignore Unstable props for internal usage.
220
+ */
221
+ seriesConfig: PropTypes.object,
196
222
  /**
197
223
  * The props used for each component slot.
198
224
  * @default {}
@@ -204,6 +230,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
204
230
  */
205
231
  slots: PropTypes.object,
206
232
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
233
+ theme: PropTypes.oneOf(['dark', 'light']),
207
234
  title: PropTypes.string,
208
235
  /**
209
236
  * The configuration of the tooltip.
@@ -253,7 +280,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
253
280
  hideTooltip: PropTypes.bool,
254
281
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
255
282
  label: PropTypes.string,
256
- labelFontSize: PropTypes.number,
257
283
  labelStyle: PropTypes.object,
258
284
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
259
285
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -264,7 +290,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
264
290
  slots: PropTypes.object,
265
291
  stroke: PropTypes.string,
266
292
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
267
- tickFontSize: PropTypes.number,
268
293
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
269
294
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
270
295
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -318,7 +343,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
318
343
  hideTooltip: PropTypes.bool,
319
344
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
320
345
  label: PropTypes.string,
321
- labelFontSize: PropTypes.number,
322
346
  labelStyle: PropTypes.object,
323
347
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
324
348
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -329,7 +353,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
329
353
  slots: PropTypes.object,
330
354
  stroke: PropTypes.string,
331
355
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
332
- tickFontSize: PropTypes.number,
333
356
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
334
357
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
335
358
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { styled } from '@mui/material/styles';
7
7
  import useSlotProps from '@mui/utils/useSlotProps';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
- import { useItemHighlighted } from '@mui/x-charts/context';
9
+ import { useItemHighlighted } from '@mui/x-charts/hooks';
10
10
  import { useInteractionItemProps } from '@mui/x-charts/internals';
11
11
  import { getHeatmapUtilityClass } from "./heatmapClasses.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -4,10 +4,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
+ import HTMLElementType from '@mui/utils/HTMLElementType';
7
8
  import composeClasses from '@mui/utils/composeClasses';
8
- import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
9
+ import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
9
10
  import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
10
- import { getLabel } from '@mui/x-charts/internals';
11
+ import { getLabel, ChartsLabelMark } from '@mui/x-charts/internals';
11
12
  import { useHeatmapSeries } from "../hooks/useSeries.js";
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const useUtilityClasses = ownerState => {
@@ -27,10 +28,6 @@ const useUtilityClasses = ownerState => {
27
28
  };
28
29
  return composeClasses(slots, getChartsTooltipUtilityClass, classes);
29
30
  };
30
-
31
- /**
32
- * @ignore - internal component.
33
- */
34
31
  function DefaultHeatmapTooltipContent(props) {
35
32
  const {
36
33
  classes
@@ -50,7 +47,8 @@ function DefaultHeatmapTooltipContent(props) {
50
47
  const {
51
48
  color,
52
49
  value,
53
- identifier
50
+ identifier,
51
+ markType
54
52
  } = tooltipData;
55
53
  const [xIndex, yIndex] = value;
56
54
  const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
@@ -83,7 +81,8 @@ function DefaultHeatmapTooltipContent(props) {
83
81
  className: classes?.row,
84
82
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
85
83
  className: clsx(classes?.markCell, classes?.cell),
86
- children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
84
+ children: /*#__PURE__*/_jsx(ChartsLabelMark, {
85
+ type: markType,
87
86
  color: color,
88
87
  className: classes?.mark
89
88
  })
@@ -132,26 +131,7 @@ process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
132
131
  * It's used to set the position of the popper.
133
132
  * The return value will passed as the reference object of the Popper instance.
134
133
  */
135
- anchorEl: PropTypes.oneOfType([(props, propName) => {
136
- if (props[propName] == null) {
137
- return new Error(`Prop '${propName}' is required but wasn't specified`);
138
- }
139
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
140
- return new Error(`Expected prop '${propName}' to be of type Element`);
141
- }
142
- return null;
143
- }, PropTypes.func, PropTypes.shape({
144
- contextElement: (props, propName) => {
145
- if (props[propName] == null) {
146
- return null;
147
- }
148
- if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
149
- return new Error(`Expected prop '${propName}' to be of type Element`);
150
- }
151
- return null;
152
- },
153
- getBoundingClientRect: PropTypes.func.isRequired
154
- })]),
134
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]),
155
135
  /**
156
136
  * Override or extend the styles applied to the component.
157
137
  */
@@ -1,2 +1,2 @@
1
- import { ExtremumGetter } from '@mui/x-charts/internals';
2
- export declare const getBaseExtremum: ExtremumGetter<'heatmap'>;
1
+ import { CartesianExtremumGetter } from '@mui/x-charts/internals';
2
+ export declare const getBaseExtremum: CartesianExtremumGetter<'heatmap'>;
@@ -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,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
4
  export function getHeatmapUtilityClass(slot) {
4
5
  // Those should be common to all charts
5
6
  if (['highlighted', 'faded'].includes(slot)) {
@@ -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
@@ -1,10 +1,12 @@
1
1
  import { getBaseExtremum } from "./extremums.js";
2
2
  import formatter from "./formatter.js";
3
3
  import getColor from "./getColor.js";
4
+ import tooltipGetter from "./tooltip.js";
4
5
  export const plugin = {
5
- seriesType: 'heatmap',
6
- seriesFormatter: formatter,
6
+ seriesProcessor: formatter,
7
7
  colorProcessor: getColor,
8
+ legendGetter: () => [],
9
+ tooltipGetter,
8
10
  xExtremumGetter: getBaseExtremum,
9
11
  yExtremumGetter: getBaseExtremum
10
12
  };
@@ -0,0 +1,3 @@
1
+ import { TooltipGetter } from '@mui/x-charts/internals';
2
+ declare const tooltipGetter: TooltipGetter<'heatmap'>;
3
+ export default tooltipGetter;
@@ -0,0 +1,25 @@
1
+ import { getLabel } from '@mui/x-charts/internals';
2
+ const tooltipGetter = params => {
3
+ const {
4
+ series,
5
+ getColor,
6
+ identifier
7
+ } = params;
8
+ if (!identifier || identifier.dataIndex === undefined) {
9
+ return null;
10
+ }
11
+ const label = getLabel(series.label, 'tooltip');
12
+ const value = series.data[identifier.dataIndex];
13
+ const formattedValue = series.valueFormatter(value, {
14
+ dataIndex: identifier.dataIndex
15
+ });
16
+ return {
17
+ identifier,
18
+ color: getColor(identifier.dataIndex),
19
+ label,
20
+ value,
21
+ formattedValue,
22
+ markType: series.labelMarkType
23
+ };
24
+ };
25
+ export default tooltipGetter;
@@ -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';
@@ -15,17 +15,16 @@ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
15
15
  import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
16
  import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
17
17
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
18
- import { useLineChartProps } from '@mui/x-charts/internals';
19
- import { ChartContainerPro } from "../ChartContainerPro/index.js";
20
- import { ZoomSetup } from "../context/ZoomProvider/ZoomSetup.js";
21
- import { useZoom } from "../context/ZoomProvider/useZoom.js";
18
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
19
+ import { useLineChartProps, ChartsWrapper } from '@mui/x-charts/internals';
20
+ import { useIsZoomInteracting } from "../hooks/zoom/index.js";
21
+ import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
22
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  function AreaPlotZoom(props) {
24
- const {
25
- isInteracting
26
- } = useZoom();
25
+ const isInteracting = useIsZoomInteracting();
27
26
  return /*#__PURE__*/_jsx(AreaPlot, _extends({}, props, {
28
- skipAnimation: isInteracting || undefined
27
+ skipAnimation: isInteracting || props.skipAnimation
29
28
  }));
30
29
  }
31
30
  process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
@@ -56,11 +55,9 @@ process.env.NODE_ENV !== "production" ? AreaPlotZoom.propTypes = {
56
55
  slots: PropTypes.object
57
56
  } : void 0;
58
57
  function LinePlotZoom(props) {
59
- const {
60
- isInteracting
61
- } = useZoom();
58
+ const isInteracting = useIsZoomInteracting();
62
59
  return /*#__PURE__*/_jsx(LinePlot, _extends({}, props, {
63
- skipAnimation: isInteracting || undefined
60
+ skipAnimation: isInteracting || props.skipAnimation
64
61
  }));
65
62
  }
66
63
  process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
@@ -91,9 +88,7 @@ process.env.NODE_ENV !== "production" ? LinePlotZoom.propTypes = {
91
88
  slots: PropTypes.object
92
89
  } : void 0;
93
90
  function MarkPlotZoom(props) {
94
- const {
95
- isInteracting
96
- } = useZoom();
91
+ const isInteracting = useIsZoomInteracting();
97
92
  return /*#__PURE__*/_jsx(MarkPlot, _extends({}, props, {
98
93
  skipAnimation: isInteracting || undefined
99
94
  }));
@@ -103,12 +98,6 @@ process.env.NODE_ENV !== "production" ? MarkPlotZoom.propTypes = {
103
98
  // | These PropTypes are generated from the TypeScript type definitions |
104
99
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
105
100
  // ----------------------------------------------------------------------
106
- /**
107
- * If `true` the mark element will only be able to render circle.
108
- * Giving fewer customization options, but saving around 40ms per 1.000 marks.
109
- * @default false
110
- */
111
- experimentalRendering: PropTypes.bool,
112
101
  /**
113
102
  * Callback fired when a line mark item is clicked.
114
103
  * @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
@@ -147,11 +136,13 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
147
136
  name: 'MuiLineChartPro'
148
137
  });
149
138
  const {
150
- zoom,
151
- onZoomChange
139
+ initialZoom,
140
+ onZoomChange,
141
+ apiRef
152
142
  } = props,
153
143
  other = _objectWithoutPropertiesLoose(props, _excluded);
154
144
  const {
145
+ chartsWrapperProps,
155
146
  chartContainerProps,
156
147
  axisClickHandlerProps,
157
148
  gridProps,
@@ -167,18 +158,26 @@ const LineChartPro = /*#__PURE__*/React.forwardRef(function LineChartPro(inProps
167
158
  legendProps,
168
159
  children
169
160
  } = useLineChartProps(other);
161
+ const {
162
+ chartDataProviderProProps,
163
+ chartsSurfaceProps
164
+ } = useChartContainerProProps(_extends({}, chartContainerProps, {
165
+ initialZoom,
166
+ onZoomChange,
167
+ apiRef
168
+ }), ref);
170
169
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
171
- return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
172
- ref: ref
173
- }, chartContainerProps, {
174
- zoom: zoom,
175
- onZoomChange: onZoomChange,
176
- children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
177
- children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
178
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
179
- "data-drawing-container": true,
180
- children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
181
- }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
170
+ return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
171
+ children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
172
+ children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
173
+ children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
174
+ children: [/*#__PURE__*/_jsx(AreaPlotZoom, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlotZoom, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
175
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
176
+ "data-drawing-container": true,
177
+ children: /*#__PURE__*/_jsx(MarkPlotZoom, _extends({}, markPlotProps))
178
+ }), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
179
+ }))]
180
+ }))
182
181
  }));
183
182
  });
184
183
  process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
@@ -186,6 +185,11 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
186
185
  // | These PropTypes are generated from the TypeScript type definitions |
187
186
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
188
187
  // ----------------------------------------------------------------------
188
+ apiRef: PropTypes.shape({
189
+ current: PropTypes.shape({
190
+ setZoomData: PropTypes.func.isRequired
191
+ })
192
+ }),
189
193
  /**
190
194
  * The configuration of axes highlight.
191
195
  * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
@@ -223,10 +227,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
223
227
  * If `true`, render the line highlight item.
224
228
  */
225
229
  disableLineItemHighlight: PropTypes.bool,
226
- /**
227
- * If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
228
- */
229
- experimentalMarkRendering: PropTypes.bool,
230
230
  /**
231
231
  * Option to display a cartesian grid in the background.
232
232
  */
@@ -243,12 +243,26 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
243
243
  */
244
244
  hideLegend: PropTypes.bool,
245
245
  /**
246
- * The item currently highlighted. Turns highlighting into a controlled prop.
246
+ * The highlighted item.
247
+ * Used when the highlight is controlled.
247
248
  */
248
249
  highlightedItem: PropTypes.shape({
249
250
  dataIndex: PropTypes.number,
250
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
251
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
251
252
  }),
253
+ /**
254
+ * This prop is used to help implement the accessibility logic.
255
+ * If you don't provide this prop. It falls back to a randomly generated id.
256
+ */
257
+ id: PropTypes.string,
258
+ /**
259
+ * The list of zoom data related to each axis.
260
+ */
261
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
262
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
263
+ end: PropTypes.number.isRequired,
264
+ start: PropTypes.number.isRequired
265
+ })),
252
266
  /**
253
267
  * Indicate which axis to display the left of the charts.
254
268
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -264,7 +278,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
264
278
  * The margin between the SVG and the drawing area.
265
279
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
266
280
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
267
- * @default object Depends on the charts type.
268
281
  */
269
282
  margin: PropTypes.shape({
270
283
  bottom: PropTypes.number,
@@ -330,6 +343,7 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
330
343
  */
331
344
  slots: PropTypes.object,
332
345
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
346
+ theme: PropTypes.oneOf(['dark', 'light']),
333
347
  title: PropTypes.string,
334
348
  /**
335
349
  * Indicate which axis to display the top of the charts.
@@ -372,7 +386,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
372
386
  hideTooltip: PropTypes.bool,
373
387
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
374
388
  label: PropTypes.string,
375
- labelFontSize: PropTypes.number,
376
389
  labelStyle: PropTypes.object,
377
390
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
378
391
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -383,7 +396,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
383
396
  slots: PropTypes.object,
384
397
  stroke: PropTypes.string,
385
398
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
386
- tickFontSize: PropTypes.number,
387
399
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
388
400
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
389
401
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -435,7 +447,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
435
447
  hideTooltip: PropTypes.bool,
436
448
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
437
449
  label: PropTypes.string,
438
- labelFontSize: PropTypes.number,
439
450
  labelStyle: PropTypes.object,
440
451
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
441
452
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -446,7 +457,6 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
446
457
  slots: PropTypes.object,
447
458
  stroke: PropTypes.string,
448
459
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
449
- tickFontSize: PropTypes.number,
450
460
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
451
461
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
452
462
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -468,12 +478,29 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
468
478
  }), PropTypes.bool])
469
479
  })),
470
480
  /**
471
- * The list of zoom data related to each axis.
481
+ * The configuration of the z-axes.
472
482
  */
473
- zoom: PropTypes.arrayOf(PropTypes.shape({
474
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
475
- end: PropTypes.number.isRequired,
476
- start: PropTypes.number.isRequired
483
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
484
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
485
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
486
+ type: PropTypes.oneOf(['ordinal']).isRequired,
487
+ unknownColor: PropTypes.string,
488
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
489
+ }), PropTypes.shape({
490
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
491
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
492
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
493
+ type: PropTypes.oneOf(['continuous']).isRequired
494
+ }), PropTypes.shape({
495
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
496
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
497
+ type: PropTypes.oneOf(['piecewise']).isRequired
498
+ })]),
499
+ data: PropTypes.array,
500
+ dataKey: PropTypes.string,
501
+ id: PropTypes.string,
502
+ max: PropTypes.number,
503
+ min: PropTypes.number
477
504
  }))
478
505
  } : void 0;
479
506
  export { LineChartPro };
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # MUI X Pro
2
2
 
3
3
  This package is the Pro plan edition of the chart components.
4
- It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
4
+ It's part of [MUI X](https://mui.com/x/), an open-core extension of our Core libraries, with advanced components.
5
5
 
6
6
  ## Installation
7
7
 
@@ -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: