@mui/x-charts-pro 8.0.0-alpha.0 → 8.0.0-alpha.2

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 (53) hide show
  1. package/BarChartPro/BarChartPro.js +3 -35
  2. package/CHANGELOG.md +651 -6
  3. package/ChartContainerPro/ChartContainerPro.js +7 -25
  4. package/ChartContainerPro/useChartContainerProProps.d.ts +2 -39
  5. package/ChartContainerPro/useChartContainerProProps.js +4 -4
  6. package/Heatmap/Heatmap.d.ts +11 -4
  7. package/Heatmap/Heatmap.js +4 -39
  8. package/Heatmap/HeatmapTooltip.d.ts +9 -0
  9. package/Heatmap/HeatmapTooltip.js +272 -0
  10. package/Heatmap/heatmapClasses.js +2 -1
  11. package/Heatmap/index.d.ts +1 -1
  12. package/Heatmap/index.js +1 -1
  13. package/LineChartPro/LineChartPro.js +3 -36
  14. package/README.md +2 -2
  15. package/ScatterChartPro/ScatterChartPro.js +3 -36
  16. package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +2 -1
  17. package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
  18. package/context/ChartDataProviderPro/ChartDataProviderPro.js +20 -268
  19. package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -5
  20. package/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
  21. package/index.js +1 -1
  22. package/internals/utils/releaseInfo.js +2 -2
  23. package/modern/BarChartPro/BarChartPro.js +3 -35
  24. package/modern/ChartContainerPro/ChartContainerPro.js +7 -25
  25. package/modern/ChartContainerPro/useChartContainerProProps.js +4 -4
  26. package/modern/Heatmap/Heatmap.js +4 -39
  27. package/modern/Heatmap/HeatmapTooltip.js +272 -0
  28. package/modern/Heatmap/heatmapClasses.js +2 -1
  29. package/modern/Heatmap/index.js +1 -1
  30. package/modern/LineChartPro/LineChartPro.js +3 -36
  31. package/modern/ScatterChartPro/ScatterChartPro.js +3 -36
  32. package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +20 -268
  33. package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
  34. package/modern/index.js +1 -1
  35. package/modern/internals/utils/releaseInfo.js +2 -2
  36. package/node/BarChartPro/BarChartPro.js +3 -35
  37. package/node/ChartContainerPro/ChartContainerPro.js +7 -25
  38. package/node/ChartContainerPro/useChartContainerProProps.js +4 -4
  39. package/node/Heatmap/Heatmap.js +4 -39
  40. package/node/Heatmap/HeatmapTooltip.js +278 -0
  41. package/node/Heatmap/heatmapClasses.js +5 -4
  42. package/node/Heatmap/index.js +4 -4
  43. package/node/LineChartPro/LineChartPro.js +3 -36
  44. package/node/ScatterChartPro/ScatterChartPro.js +3 -36
  45. package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +19 -267
  46. package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
  47. package/node/index.js +1 -1
  48. package/node/internals/utils/releaseInfo.js +4 -3
  49. package/package.json +7 -7
  50. package/Heatmap/DefaultHeatmapTooltip.d.ts +0 -7
  51. package/Heatmap/DefaultHeatmapTooltip.js +0 -99
  52. package/modern/Heatmap/DefaultHeatmapTooltip.js +0 -99
  53. package/node/Heatmap/DefaultHeatmapTooltip.js +0 -105
@@ -99,9 +99,9 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
99
99
  chartsAxisProps,
100
100
  axisHighlightProps,
101
101
  legendProps,
102
- tooltipProps,
103
102
  children
104
103
  } = useBarChartProps(other);
104
+ const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
105
105
  return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
106
106
  ref: ref
107
107
  }, chartContainerProps, {
@@ -109,7 +109,7 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
109
109
  onZoomChange: onZoomChange,
110
110
  children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
111
111
  children: [/*#__PURE__*/_jsx(BarChartPlotZoom, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
112
- })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
112
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !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]
113
113
  }));
114
114
  });
115
115
  process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
@@ -121,7 +121,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
121
121
  * The configuration of axes highlight.
122
122
  * Default is set to 'band' in the bar direction.
123
123
  * Depends on `layout` prop.
124
- * @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
124
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
125
125
  */
126
126
  axisHighlight: PropTypes.shape({
127
127
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -238,16 +238,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
238
238
  * @param {ZoomData[]} zoomData Updated zoom data.
239
239
  */
240
240
  onZoomChange: PropTypes.func,
241
- /**
242
- * The chart will try to wait for the parent container to resolve its size
243
- * before it renders for the first time.
244
- *
245
- * This can be useful in some scenarios where the chart appear to grow after
246
- * the first render, like when used inside a grid.
247
- *
248
- * @default false
249
- */
250
- resolveSizeBeforeRender: PropTypes.bool,
251
241
  /**
252
242
  * Indicate which axis to display the right of the charts.
253
243
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -276,30 +266,12 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
276
266
  slots: PropTypes.object,
277
267
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
278
268
  title: PropTypes.string,
279
- /**
280
- * The configuration of the tooltip.
281
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
282
- */
283
- tooltip: PropTypes.shape({
284
- axisContent: PropTypes.elementType,
285
- classes: PropTypes.object,
286
- itemContent: PropTypes.elementType,
287
- slotProps: PropTypes.object,
288
- slots: PropTypes.object,
289
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
290
- }),
291
269
  /**
292
270
  * Indicate which axis to display the top of the charts.
293
271
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
294
272
  * @default null
295
273
  */
296
274
  topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
297
- viewBox: PropTypes.shape({
298
- height: PropTypes.number,
299
- width: PropTypes.number,
300
- x: PropTypes.number,
301
- y: PropTypes.number
302
- }),
303
275
  /**
304
276
  * The width of the chart in px. If not defined, it takes the width of the parent element.
305
277
  */
@@ -335,7 +307,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
335
307
  hideTooltip: PropTypes.bool,
336
308
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
337
309
  label: PropTypes.string,
338
- labelFontSize: PropTypes.number,
339
310
  labelStyle: PropTypes.object,
340
311
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
341
312
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -346,7 +317,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
346
317
  slots: PropTypes.object,
347
318
  stroke: PropTypes.string,
348
319
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
349
- tickFontSize: PropTypes.number,
350
320
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
351
321
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
352
322
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -398,7 +368,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
398
368
  hideTooltip: PropTypes.bool,
399
369
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
400
370
  label: PropTypes.string,
401
- labelFontSize: PropTypes.number,
402
371
  labelStyle: PropTypes.object,
403
372
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
404
373
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -409,7 +378,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
409
378
  slots: PropTypes.object,
410
379
  stroke: PropTypes.string,
411
380
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
412
- tickFontSize: PropTypes.number,
413
381
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
414
382
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
415
383
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -4,7 +4,7 @@ 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 { Watermark } from '@mui/x-license/Watermark';
7
- import { ResizableContainer } from '@mui/x-charts/internals';
7
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
8
8
  import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
9
9
  import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
10
10
  import { useChartContainerProProps } from "./useChartContainerProProps.js";
@@ -13,11 +13,13 @@ const releaseInfo = getReleaseInfo();
13
13
  const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerPro(props, ref) {
14
14
  const {
15
15
  chartDataProviderProProps,
16
- resizableChartContainerProps,
17
- hasIntrinsicSize
16
+ children,
17
+ chartsSurfaceProps
18
18
  } = useChartContainerProProps(props, ref);
19
- return /*#__PURE__*/_jsxs(ResizableContainer, _extends({}, resizableChartContainerProps, {
20
- children: [hasIntrinsicSize ? /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps)) : null, /*#__PURE__*/_jsx(Watermark, {
19
+ return /*#__PURE__*/_jsxs(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
20
+ children: [/*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
21
+ children: children
22
+ })), /*#__PURE__*/_jsx(Watermark, {
21
23
  packageName: "x-charts-pro",
22
24
  releaseInfo: releaseInfo
23
25
  })]
@@ -86,16 +88,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
86
88
  * If not provided, the container supports line, bar, scatter and pie charts.
87
89
  */
88
90
  plugins: PropTypes.arrayOf(PropTypes.object),
89
- /**
90
- * The chart will try to wait for the parent container to resolve its size
91
- * before it renders for the first time.
92
- *
93
- * This can be useful in some scenarios where the chart appear to grow after
94
- * the first render, like when used inside a grid.
95
- *
96
- * @default false
97
- */
98
- resolveSizeBeforeRender: PropTypes.bool,
99
91
  /**
100
92
  * The array of series to display.
101
93
  * Each type of series has its own specificity.
@@ -109,12 +101,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
109
101
  skipAnimation: PropTypes.bool,
110
102
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
111
103
  title: PropTypes.string,
112
- viewBox: PropTypes.shape({
113
- height: PropTypes.number,
114
- width: PropTypes.number,
115
- x: PropTypes.number,
116
- y: PropTypes.number
117
- }),
118
104
  /**
119
105
  * The width of the chart in px. If not defined, it takes the width of the parent element.
120
106
  */
@@ -150,7 +136,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
150
136
  hideTooltip: PropTypes.bool,
151
137
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
152
138
  label: PropTypes.string,
153
- labelFontSize: PropTypes.number,
154
139
  labelStyle: PropTypes.object,
155
140
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
156
141
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -161,7 +146,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
161
146
  slots: PropTypes.object,
162
147
  stroke: PropTypes.string,
163
148
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
164
- tickFontSize: PropTypes.number,
165
149
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
166
150
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
167
151
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -213,7 +197,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
213
197
  hideTooltip: PropTypes.bool,
214
198
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
215
199
  label: PropTypes.string,
216
- labelFontSize: PropTypes.number,
217
200
  labelStyle: PropTypes.object,
218
201
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
219
202
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -224,7 +207,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
224
207
  slots: PropTypes.object,
225
208
  stroke: PropTypes.string,
226
209
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
227
- tickFontSize: PropTypes.number,
228
210
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
229
211
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
230
212
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -16,12 +16,12 @@ export const useChartContainerProProps = (props, ref) => {
16
16
  };
17
17
  const {
18
18
  chartDataProviderProps,
19
- resizableChartContainerProps,
20
- hasIntrinsicSize
19
+ chartsSurfaceProps,
20
+ children
21
21
  } = useChartContainerProps(baseProps, ref);
22
22
  return {
23
23
  chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps),
24
- resizableChartContainerProps,
25
- hasIntrinsicSize
24
+ chartsSurfaceProps,
25
+ children
26
26
  };
27
27
  };
@@ -7,14 +7,13 @@ import { useThemeProps } from '@mui/material/styles';
7
7
  import useId from '@mui/utils/useId';
8
8
  import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
9
9
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
10
- import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
11
10
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
12
11
  import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
13
12
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
14
13
  import { ChartContainerPro } from "../ChartContainerPro/index.js";
15
14
  import { HeatmapPlot } from "./HeatmapPlot.js";
16
15
  import { plugin as heatmapPlugin } from "./plugin.js";
17
- import { DefaultHeatmapTooltip } from "./DefaultHeatmapTooltip.js";
16
+ import { HeatmapTooltip } from "./HeatmapTooltip.js";
18
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
18
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
20
19
  const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
@@ -34,7 +33,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
34
33
  colors,
35
34
  dataset,
36
35
  sx,
37
- tooltip,
38
36
  topAxis,
39
37
  leftAxis,
40
38
  rightAxis,
@@ -65,6 +63,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
65
63
  color: defaultColorMap
66
64
  }
67
65
  }], [zAxis]);
66
+ const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
68
67
  return /*#__PURE__*/_jsxs(ChartContainerPro, {
69
68
  ref: ref,
70
69
  plugins: [heatmapPlugin],
@@ -102,14 +101,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
102
101
  bottomAxis: bottomAxis,
103
102
  slots: slots,
104
103
  slotProps: slotProps
105
- }), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({
106
- trigger: "item"
107
- }, tooltip, {
108
- slots: _extends({
109
- itemContent: DefaultHeatmapTooltip
110
- }, slots),
111
- slotProps: slotProps
112
- })), /*#__PURE__*/_jsx(ChartsClipPath, {
104
+ }), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
113
105
  id: clipPathId
114
106
  }), children]
115
107
  });
@@ -190,16 +182,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
190
182
  * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
191
183
  */
192
184
  onHighlightChange: PropTypes.func,
193
- /**
194
- * The chart will try to wait for the parent container to resolve its size
195
- * before it renders for the first time.
196
- *
197
- * This can be useful in some scenarios where the chart appear to grow after
198
- * the first render, like when used inside a grid.
199
- *
200
- * @default false
201
- */
202
- resolveSizeBeforeRender: PropTypes.bool,
203
185
  /**
204
186
  * Indicate which axis to display the right of the charts.
205
187
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -227,26 +209,13 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
227
209
  * The configuration of the tooltip.
228
210
  * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
229
211
  */
230
- tooltip: PropTypes.shape({
231
- axisContent: PropTypes.elementType,
232
- classes: PropTypes.object,
233
- itemContent: PropTypes.elementType,
234
- slotProps: PropTypes.object,
235
- slots: PropTypes.object,
236
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
237
- }),
212
+ tooltip: PropTypes.object,
238
213
  /**
239
214
  * Indicate which axis to display the top of the charts.
240
215
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
241
216
  * @default null
242
217
  */
243
218
  topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
244
- viewBox: PropTypes.shape({
245
- height: PropTypes.number,
246
- width: PropTypes.number,
247
- x: PropTypes.number,
248
- y: PropTypes.number
249
- }),
250
219
  /**
251
220
  * The width of the chart in px. If not defined, it takes the width of the parent element.
252
221
  */
@@ -284,7 +253,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
284
253
  hideTooltip: PropTypes.bool,
285
254
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
286
255
  label: PropTypes.string,
287
- labelFontSize: PropTypes.number,
288
256
  labelStyle: PropTypes.object,
289
257
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
290
258
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -295,7 +263,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
295
263
  slots: PropTypes.object,
296
264
  stroke: PropTypes.string,
297
265
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
298
- tickFontSize: PropTypes.number,
299
266
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
300
267
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
301
268
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -349,7 +316,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
349
316
  hideTooltip: PropTypes.bool,
350
317
  id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
351
318
  label: PropTypes.string,
352
- labelFontSize: PropTypes.number,
353
319
  labelStyle: PropTypes.object,
354
320
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
355
321
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -360,7 +326,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
360
326
  slots: PropTypes.object,
361
327
  stroke: PropTypes.string,
362
328
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
363
- tickFontSize: PropTypes.number,
364
329
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
365
330
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
366
331
  tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
@@ -0,0 +1,272 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import clsx from 'clsx';
7
+ import HTMLElementType from '@mui/utils/HTMLElementType';
8
+ import composeClasses from '@mui/utils/composeClasses';
9
+ import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, ChartsTooltipMark, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
10
+ import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
11
+ import { getLabel } from '@mui/x-charts/internals';
12
+ import { useHeatmapSeries } from "../hooks/useSeries.js";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const useUtilityClasses = ownerState => {
15
+ const {
16
+ classes
17
+ } = ownerState;
18
+ const slots = {
19
+ root: ['root'],
20
+ paper: ['paper'],
21
+ table: ['table'],
22
+ row: ['row'],
23
+ cell: ['cell'],
24
+ mark: ['mark'],
25
+ markCell: ['markCell'],
26
+ labelCell: ['labelCell'],
27
+ valueCell: ['valueCell']
28
+ };
29
+ return composeClasses(slots, getChartsTooltipUtilityClass, classes);
30
+ };
31
+ function DefaultHeatmapTooltipContent(props) {
32
+ const {
33
+ classes
34
+ } = props;
35
+ const xAxis = useXAxis();
36
+ const yAxis = useYAxis();
37
+ const heatmapSeries = useHeatmapSeries();
38
+ const tooltipData = useItemTooltip();
39
+ if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
40
+ return null;
41
+ }
42
+ const {
43
+ series,
44
+ seriesOrder
45
+ } = heatmapSeries;
46
+ const seriesId = seriesOrder[0];
47
+ const {
48
+ color,
49
+ value,
50
+ identifier
51
+ } = tooltipData;
52
+ const [xIndex, yIndex] = value;
53
+ const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
54
+ location: 'tooltip'
55
+ }) ?? xAxis.data[xIndex].toLocaleString();
56
+ const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
57
+ location: 'tooltip'
58
+ }) ?? yAxis.data[yIndex].toLocaleString();
59
+ const formattedValue = series[seriesId].valueFormatter(value, {
60
+ dataIndex: identifier.dataIndex
61
+ });
62
+ const seriesLabel = getLabel(series[seriesId].label, 'tooltip');
63
+ return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
64
+ className: classes?.paper,
65
+ children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
66
+ className: classes?.table,
67
+ children: [/*#__PURE__*/_jsx("thead", {
68
+ children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
69
+ className: classes?.row,
70
+ children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
71
+ className: classes?.cell,
72
+ children: formattedX
73
+ }), formattedX && formattedY && /*#__PURE__*/_jsx(ChartsTooltipCell, {}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
74
+ className: classes?.cell,
75
+ children: formattedY
76
+ })]
77
+ })
78
+ }), /*#__PURE__*/_jsx("tbody", {
79
+ children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
80
+ className: classes?.row,
81
+ children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
82
+ className: clsx(classes?.markCell, classes?.cell),
83
+ children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
84
+ color: color,
85
+ className: classes?.mark
86
+ })
87
+ }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
88
+ className: clsx(classes?.labelCell, classes?.cell),
89
+ children: seriesLabel
90
+ }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
91
+ className: clsx(classes?.valueCell, classes?.cell),
92
+ children: formattedValue
93
+ })]
94
+ })
95
+ })]
96
+ })
97
+ });
98
+ }
99
+ process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
100
+ // ----------------------------- Warning --------------------------------
101
+ // | These PropTypes are generated from the TypeScript type definitions |
102
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
103
+ // ----------------------------------------------------------------------
104
+ /**
105
+ * Override or extend the styles applied to the component.
106
+ */
107
+ classes: PropTypes.object
108
+ } : void 0;
109
+ function HeatmapTooltip(props) {
110
+ const classes = useUtilityClasses({
111
+ classes: props.classes
112
+ });
113
+ return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
114
+ classes: classes,
115
+ trigger: "item",
116
+ children: /*#__PURE__*/_jsx(DefaultHeatmapTooltipContent, {
117
+ classes: classes
118
+ })
119
+ }));
120
+ }
121
+ process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
122
+ // ----------------------------- Warning --------------------------------
123
+ // | These PropTypes are generated from the TypeScript type definitions |
124
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
125
+ // ----------------------------------------------------------------------
126
+ /**
127
+ * An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
128
+ * or a function that returns either.
129
+ * It's used to set the position of the popper.
130
+ * The return value will passed as the reference object of the Popper instance.
131
+ */
132
+ anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]),
133
+ /**
134
+ * Override or extend the styles applied to the component.
135
+ */
136
+ classes: PropTypes.object,
137
+ /**
138
+ * The component used for the root node.
139
+ * Either a string to use a HTML element or a component.
140
+ */
141
+ component: PropTypes.elementType,
142
+ /**
143
+ * The components used for each slot inside the Popper.
144
+ * Either a string to use a HTML element or a component.
145
+ * @default {}
146
+ */
147
+ components: PropTypes.shape({
148
+ Root: PropTypes.elementType
149
+ }),
150
+ /**
151
+ * The props used for each slot inside the Popper.
152
+ * @default {}
153
+ */
154
+ componentsProps: PropTypes.shape({
155
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
156
+ }),
157
+ /**
158
+ * An HTML element or function that returns one.
159
+ * The `container` will have the portal children appended to it.
160
+ *
161
+ * You can also provide a callback, which is called in a React layout effect.
162
+ * This lets you set the container from a ref, and also makes server-side rendering possible.
163
+ *
164
+ * By default, it uses the body of the top-level document object,
165
+ * so it's simply `document.body` most of the time.
166
+ */
167
+ container: PropTypes.oneOfType([(props, propName) => {
168
+ if (props[propName] == null) {
169
+ return new Error(`Prop '${propName}' is required but wasn't specified`);
170
+ }
171
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
172
+ return new Error(`Expected prop '${propName}' to be of type Element`);
173
+ }
174
+ return null;
175
+ }, PropTypes.func]),
176
+ /**
177
+ * The `children` will be under the DOM hierarchy of the parent component.
178
+ * @default false
179
+ */
180
+ disablePortal: PropTypes.bool,
181
+ /**
182
+ * Always keep the children in the DOM.
183
+ * This prop can be useful in SEO situation or
184
+ * when you want to maximize the responsiveness of the Popper.
185
+ * @default false
186
+ */
187
+ keepMounted: PropTypes.bool,
188
+ /**
189
+ * Popper.js is based on a "plugin-like" architecture,
190
+ * most of its features are fully encapsulated "modifiers".
191
+ *
192
+ * A modifier is a function that is called each time Popper.js needs to
193
+ * compute the position of the popper.
194
+ * For this reason, modifiers should be very performant to avoid bottlenecks.
195
+ * To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
196
+ */
197
+ modifiers: PropTypes.arrayOf(PropTypes.shape({
198
+ data: PropTypes.object,
199
+ effect: PropTypes.func,
200
+ enabled: PropTypes.bool,
201
+ fn: PropTypes.func,
202
+ name: PropTypes.any,
203
+ options: PropTypes.object,
204
+ phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
205
+ requires: PropTypes.arrayOf(PropTypes.string),
206
+ requiresIfExists: PropTypes.arrayOf(PropTypes.string)
207
+ })),
208
+ /**
209
+ * If `true`, the component is shown.
210
+ */
211
+ open: PropTypes.bool,
212
+ /**
213
+ * Popper placement.
214
+ * @default 'bottom'
215
+ */
216
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
217
+ /**
218
+ * Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
219
+ * @default {}
220
+ */
221
+ popperOptions: PropTypes.shape({
222
+ modifiers: PropTypes.array,
223
+ onFirstUpdate: PropTypes.func,
224
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
225
+ strategy: PropTypes.oneOf(['absolute', 'fixed'])
226
+ }),
227
+ /**
228
+ * A ref that points to the used popper instance.
229
+ */
230
+ popperRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
231
+ current: PropTypes.shape({
232
+ destroy: PropTypes.func.isRequired,
233
+ forceUpdate: PropTypes.func.isRequired,
234
+ setOptions: PropTypes.func.isRequired,
235
+ state: PropTypes.shape({
236
+ attributes: PropTypes.object.isRequired,
237
+ elements: PropTypes.object.isRequired,
238
+ modifiersData: PropTypes.object.isRequired,
239
+ options: PropTypes.object.isRequired,
240
+ orderedModifiers: PropTypes.arrayOf(PropTypes.object).isRequired,
241
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']).isRequired,
242
+ rects: PropTypes.object.isRequired,
243
+ reset: PropTypes.bool.isRequired,
244
+ scrollParents: PropTypes.object.isRequired,
245
+ strategy: PropTypes.oneOf(['absolute', 'fixed']).isRequired,
246
+ styles: PropTypes.object.isRequired
247
+ }).isRequired,
248
+ update: PropTypes.func.isRequired
249
+ })
250
+ })]),
251
+ /**
252
+ * The props used for each slot inside the Popper.
253
+ * @default {}
254
+ */
255
+ slotProps: PropTypes.object,
256
+ /**
257
+ * The components used for each slot inside the Popper.
258
+ * Either a string to use a HTML element or a component.
259
+ * @default {}
260
+ */
261
+ slots: PropTypes.object,
262
+ /**
263
+ * The system prop that allows defining system overrides as well as additional CSS styles.
264
+ */
265
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
266
+ /**
267
+ * Help supporting a react-transition-group/Transition component.
268
+ * @default false
269
+ */
270
+ transition: PropTypes.bool
271
+ } : void 0;
272
+ export { HeatmapTooltip };
@@ -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,4 +1,4 @@
1
1
  export { Heatmap } from "./Heatmap.js";
2
2
  export { HeatmapPlot } from "./HeatmapPlot.js";
3
- export * from "./DefaultHeatmapTooltip.js";
3
+ export * from "./HeatmapTooltip.js";
4
4
  export * from "./heatmapClasses.js";