@mui/x-charts-pro 8.27.0 → 9.0.0-alpha.0

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 (200) hide show
  1. package/BarChartPro/BarChartPro.js +9 -4
  2. package/CHANGELOG.md +255 -3
  3. package/ChartContainerPro/ChartContainerPro.d.ts +17 -31
  4. package/ChartContainerPro/ChartContainerPro.js +14 -287
  5. package/ChartContainerPro/useChartContainerProProps.d.ts +9 -5
  6. package/ChartContainerPro/useChartContainerProProps.js +9 -34
  7. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
  8. package/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
  9. package/ChartDataProviderPro/index.d.ts +1 -1
  10. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
  11. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +8 -6
  12. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +6 -4
  13. package/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
  14. package/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
  15. package/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
  16. package/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
  17. package/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
  18. package/ChartsContainer/index.d.ts +1 -0
  19. package/ChartsContainer/index.js +16 -0
  20. package/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
  21. package/ChartsContainerPro/ChartsContainerPro.js +187 -0
  22. package/ChartsContainerPro/index.d.ts +9 -0
  23. package/ChartsContainerPro/index.js +17 -0
  24. package/ChartsContainerPro/useChartsContainerProProps.d.ts +9 -0
  25. package/ChartsContainerPro/useChartsContainerProProps.js +44 -0
  26. package/FunnelChart/FunnelChart.js +4 -4
  27. package/FunnelChart/FunnelSection.d.ts +1 -1
  28. package/FunnelChart/funnel.types.d.ts +1 -1
  29. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +12 -9
  30. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
  31. package/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  32. package/FunnelChart/index.d.ts +1 -0
  33. package/FunnelChart/index.js +12 -0
  34. package/FunnelChart/seriesConfig/index.js +2 -1
  35. package/FunnelChart/seriesConfig/legend.js +0 -1
  36. package/Heatmap/Heatmap.d.ts +5 -2
  37. package/Heatmap/Heatmap.js +27 -132
  38. package/Heatmap/Heatmap.types.d.ts +19 -0
  39. package/Heatmap/Heatmap.types.js +5 -0
  40. package/Heatmap/HeatmapItem.d.ts +6 -0
  41. package/Heatmap/HeatmapItem.js +11 -3
  42. package/Heatmap/HeatmapPlot.d.ts +7 -3
  43. package/Heatmap/HeatmapPlot.js +16 -54
  44. package/Heatmap/HeatmapSVGPlot.d.ts +2 -0
  45. package/Heatmap/HeatmapSVGPlot.js +70 -0
  46. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +5 -1
  47. package/Heatmap/HeatmapTooltip/index.d.ts +1 -1
  48. package/Heatmap/index.d.ts +3 -2
  49. package/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
  50. package/Heatmap/seriesConfig/index.js +1 -0
  51. package/Heatmap/useHeatmapProps.d.ts +24 -0
  52. package/Heatmap/useHeatmapProps.js +159 -0
  53. package/LineChartPro/LineChartPro.js +9 -4
  54. package/PieChartPro/PieChartPro.js +4 -4
  55. package/RadarChartPro/RadarChartPro.js +4 -4
  56. package/SankeyChart/SankeyChart.js +4 -4
  57. package/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
  58. package/SankeyChart/SankeyTooltip/index.d.ts +1 -1
  59. package/SankeyChart/index.d.ts +1 -1
  60. package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
  61. package/SankeyChart/sankey.highlight.types.d.ts +4 -0
  62. package/SankeyChart/sankey.types.d.ts +6 -3
  63. package/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
  64. package/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
  65. package/SankeyChart/seriesConfig/identifierCleaner.js +24 -0
  66. package/SankeyChart/seriesConfig/index.js +3 -1
  67. package/ScatterChartPro/ScatterChartPro.js +9 -4
  68. package/esm/BarChartPro/BarChartPro.js +9 -4
  69. package/esm/ChartContainerPro/ChartContainerPro.d.ts +17 -31
  70. package/esm/ChartContainerPro/ChartContainerPro.js +15 -286
  71. package/esm/ChartContainerPro/useChartContainerProProps.d.ts +9 -5
  72. package/esm/ChartContainerPro/useChartContainerProProps.js +10 -33
  73. package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +5 -3
  74. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +2 -2
  75. package/esm/ChartDataProviderPro/index.d.ts +1 -1
  76. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -3
  77. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +9 -7
  78. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +7 -5
  79. package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
  80. package/esm/ChartZoomSlider/internals/previews/AreaPreviewPlot.js +4 -4
  81. package/esm/ChartZoomSlider/internals/previews/BarPreviewPlot.js +1 -1
  82. package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
  83. package/esm/ChartZoomSlider/internals/previews/LinePreviewPlot.js +4 -4
  84. package/esm/ChartsContainer/index.d.ts +1 -0
  85. package/esm/ChartsContainer/index.js +2 -0
  86. package/esm/ChartsContainerPro/ChartsContainerPro.d.ts +37 -0
  87. package/esm/ChartsContainerPro/ChartsContainerPro.js +181 -0
  88. package/esm/ChartsContainerPro/index.d.ts +9 -0
  89. package/esm/ChartsContainerPro/index.js +6 -0
  90. package/esm/ChartsContainerPro/useChartsContainerProProps.d.ts +9 -0
  91. package/esm/ChartsContainerPro/useChartsContainerProProps.js +37 -0
  92. package/esm/FunnelChart/FunnelChart.js +4 -4
  93. package/esm/FunnelChart/FunnelSection.d.ts +1 -1
  94. package/esm/FunnelChart/funnel.types.d.ts +1 -1
  95. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.js +13 -10
  96. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxis.types.d.ts +3 -2
  97. package/esm/FunnelChart/funnelAxisPlugin/useChartFunnelAxisRendering.selectors.d.ts +3 -3
  98. package/esm/FunnelChart/index.d.ts +1 -0
  99. package/esm/FunnelChart/index.js +1 -0
  100. package/esm/FunnelChart/seriesConfig/index.js +3 -2
  101. package/esm/FunnelChart/seriesConfig/legend.js +0 -1
  102. package/esm/Heatmap/Heatmap.d.ts +5 -2
  103. package/esm/Heatmap/Heatmap.js +28 -133
  104. package/esm/Heatmap/Heatmap.types.d.ts +19 -0
  105. package/esm/Heatmap/Heatmap.types.js +1 -0
  106. package/esm/Heatmap/HeatmapItem.d.ts +6 -0
  107. package/esm/Heatmap/HeatmapItem.js +11 -3
  108. package/esm/Heatmap/HeatmapPlot.d.ts +7 -3
  109. package/esm/Heatmap/HeatmapPlot.js +17 -56
  110. package/esm/Heatmap/HeatmapSVGPlot.d.ts +2 -0
  111. package/esm/Heatmap/HeatmapSVGPlot.js +64 -0
  112. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +5 -1
  113. package/esm/Heatmap/HeatmapTooltip/index.d.ts +1 -1
  114. package/esm/Heatmap/index.d.ts +3 -2
  115. package/esm/Heatmap/seriesConfig/getItemAtPosition.js +6 -2
  116. package/esm/Heatmap/seriesConfig/index.js +2 -1
  117. package/esm/Heatmap/useHeatmapProps.d.ts +24 -0
  118. package/esm/Heatmap/useHeatmapProps.js +151 -0
  119. package/esm/LineChartPro/LineChartPro.js +9 -4
  120. package/esm/PieChartPro/PieChartPro.js +4 -4
  121. package/esm/RadarChartPro/RadarChartPro.js +4 -4
  122. package/esm/SankeyChart/SankeyChart.js +4 -4
  123. package/esm/SankeyChart/SankeyTooltip/SankeyTooltip.types.d.ts +5 -1
  124. package/esm/SankeyChart/SankeyTooltip/index.d.ts +1 -1
  125. package/esm/SankeyChart/index.d.ts +1 -1
  126. package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +7 -7
  127. package/esm/SankeyChart/sankey.highlight.types.d.ts +4 -0
  128. package/esm/SankeyChart/sankey.types.d.ts +6 -3
  129. package/esm/SankeyChart/seriesConfig/getSeriesWithDefaultValues.js +13 -1
  130. package/esm/SankeyChart/seriesConfig/identifierCleaner.d.ts +3 -0
  131. package/esm/SankeyChart/seriesConfig/identifierCleaner.js +18 -0
  132. package/esm/SankeyChart/seriesConfig/index.js +3 -1
  133. package/esm/ScatterChartPro/ScatterChartPro.js +9 -4
  134. package/esm/index.d.ts +3 -1
  135. package/esm/index.js +2 -1
  136. package/esm/internals/index.d.ts +7 -1
  137. package/esm/internals/index.js +5 -1
  138. package/esm/internals/plugins/useChartProExport/common.d.ts +5 -1
  139. package/esm/internals/plugins/useChartProExport/common.js +36 -0
  140. package/esm/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
  141. package/esm/internals/plugins/useChartProExport/exportImage.js +10 -1
  142. package/esm/internals/plugins/useChartProExport/print.d.ts +1 -1
  143. package/esm/internals/plugins/useChartProExport/print.js +2 -1
  144. package/esm/internals/plugins/useChartProExport/useChartProExport.js +4 -2
  145. package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
  146. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
  147. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
  148. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
  149. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
  150. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
  151. package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +6 -4
  152. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
  153. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +7 -5
  154. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
  155. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
  156. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
  157. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +6 -4
  158. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
  159. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +6 -4
  160. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
  161. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +6 -4
  162. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
  163. package/esm/models/seriesType/heatmap.d.ts +3 -3
  164. package/esm/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
  165. package/esm/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
  166. package/esm/typeOverloads/modules.d.ts +9 -5
  167. package/index.d.ts +3 -1
  168. package/index.js +9 -1
  169. package/internals/index.d.ts +7 -1
  170. package/internals/index.js +43 -1
  171. package/internals/plugins/useChartProExport/common.d.ts +5 -1
  172. package/internals/plugins/useChartProExport/common.js +37 -0
  173. package/internals/plugins/useChartProExport/exportImage.d.ts +1 -1
  174. package/internals/plugins/useChartProExport/exportImage.js +9 -0
  175. package/internals/plugins/useChartProExport/print.d.ts +1 -1
  176. package/internals/plugins/useChartProExport/print.js +1 -0
  177. package/internals/plugins/useChartProExport/useChartProExport.js +4 -2
  178. package/internals/plugins/useChartProZoom/ZoomInteractionConfig.selectors.d.ts +2 -2
  179. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.d.ts +2 -3
  180. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +4 -2
  181. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.d.ts +2 -3
  182. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +4 -2
  183. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.d.ts +2 -3
  184. package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +5 -3
  185. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.d.ts +2 -3
  186. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +6 -4
  187. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.d.ts +2 -3
  188. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnDoubleTapReset.js +4 -2
  189. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.d.ts +2 -3
  190. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +5 -3
  191. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.d.ts +2 -3
  192. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +5 -3
  193. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.d.ts +2 -3
  194. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +5 -3
  195. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +5 -5
  196. package/models/seriesType/heatmap.d.ts +3 -3
  197. package/package.json +8 -8
  198. package/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +1 -1
  199. package/plugins/selectors/useChartHeatmapPosition.selectors.js +3 -1
  200. package/typeOverloads/modules.d.ts +9 -5
@@ -11,160 +11,57 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _styles = require("@mui/material/styles");
14
- var _useId = _interopRequireDefault(require("@mui/utils/useId"));
15
- var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
16
14
  var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
17
15
  var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
18
16
  var _ChartsWrapper = require("@mui/x-charts/ChartsWrapper");
19
17
  var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
20
18
  var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
21
- var _constants = require("@mui/x-charts/constants");
22
19
  var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
23
20
  var _ChartsBrushOverlay = require("@mui/x-charts/ChartsBrushOverlay");
24
21
  var _HeatmapPlot = require("./HeatmapPlot");
25
- var _seriesConfig = require("./seriesConfig");
26
22
  var _HeatmapTooltip = require("./HeatmapTooltip");
27
- var _Heatmap2 = require("./Heatmap.plugins");
28
23
  var _ChartDataProviderPro = require("../ChartDataProviderPro");
29
24
  var _ChartsToolbarPro = require("../ChartsToolbarPro");
30
25
  var _FocusedHeatmapCell = require("./FocusedHeatmapCell");
26
+ var _useHeatmapProps = require("./useHeatmapProps");
31
27
  var _jsxRuntime = require("react/jsx-runtime");
32
- // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
33
- const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
34
- const seriesConfig = {
35
- heatmap: _seriesConfig.heatmapSeriesConfig
36
- };
37
- function getDefaultDataForAxis(series, dimension) {
38
- if (series?.[0]?.data === undefined || series[0].data.length === 0) {
39
- return [];
40
- }
41
- return Array.from({
42
- length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
43
- }, (_, index) => index);
44
- }
45
- const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
46
- const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
47
28
  const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
48
29
  const props = (0, _styles.useThemeProps)({
49
30
  props: inProps,
50
31
  name: 'MuiHeatmap'
51
32
  });
52
33
  const {
53
- apiRef,
54
- xAxis,
55
- yAxis,
56
- zAxis,
57
- series,
58
- width,
59
- height,
60
- margin,
61
- colors,
62
- dataset,
63
34
  sx,
64
- onAxisClick,
65
- children,
66
35
  slots,
67
36
  slotProps,
68
37
  loading,
69
- highlightedItem,
70
- onHighlightChange,
71
- onItemClick,
72
- enableKeyboardNavigation,
73
- hideLegend = true,
38
+ hideLegend,
74
39
  showToolbar = false
75
40
  } = props;
76
- const id = (0, _useId.default)();
77
- const clipPathId = `${id}-clip-path`;
78
- const xAxisWithDefault = React.useMemo(() => (xAxis && xAxis.length > 0 ? xAxis : [{
79
- id: _constants.DEFAULT_X_AXIS_KEY
80
- }]).map(axis => (0, _extends2.default)({
81
- scaleType: 'band',
82
- categoryGapRatio: 0
83
- }, axis, {
84
- data: axis.data ?? getDefaultDataForXAxis(series)
85
- })), [series, xAxis]);
86
- const yAxisWithDefault = React.useMemo(() => (yAxis && yAxis.length > 0 ? yAxis : [{
87
- id: _constants.DEFAULT_Y_AXIS_KEY
88
- }]).map(axis => (0, _extends2.default)({
89
- scaleType: 'band',
90
- categoryGapRatio: 0
91
- }, axis, {
92
- data: axis.data ?? getDefaultDataForYAxis(series)
93
- })), [series, yAxis]);
94
- const zAxisWithDefault = React.useMemo(() => zAxis ?? [{
95
- colorMap: {
96
- type: 'continuous',
97
- min: 0,
98
- max: 100,
99
- color: defaultColorMap
100
- }
101
- }], [zAxis]);
102
- const chartsWrapperProps = {
103
- sx,
104
- legendPosition: props.slotProps?.legend?.position,
105
- legendDirection: props.slotProps?.legend?.direction,
106
- hideLegend
107
- };
41
+ const {
42
+ chartDataProviderProProps,
43
+ chartsWrapperProps,
44
+ chartsAxisProps,
45
+ clipPathProps,
46
+ clipPathGroupProps,
47
+ legendProps,
48
+ heatmapPlotProps,
49
+ overlayProps,
50
+ children
51
+ } = (0, _useHeatmapProps.useHeatmapProps)(props);
108
52
  const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
109
53
  const Toolbar = slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
110
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
111
- apiRef: apiRef,
112
- seriesConfig: seriesConfig,
113
- series: series.map(s => (0, _extends2.default)({
114
- type: 'heatmap'
115
- }, s)),
116
- width: width,
117
- height: height,
118
- margin: margin,
119
- xAxis: xAxisWithDefault,
120
- yAxis: yAxisWithDefault,
121
- zAxis: zAxisWithDefault,
122
- colors: colors,
123
- dataset: dataset,
124
- disableAxisListener: true,
125
- highlightedItem: highlightedItem,
126
- onHighlightChange: onHighlightChange,
127
- enableKeyboardNavigation: enableKeyboardNavigation,
128
- onAxisClick: onAxisClick,
129
- onItemClick: onItemClick,
130
- plugins: _Heatmap2.HEATMAP_PLUGINS,
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, (0, _extends2.default)({}, chartDataProviderProProps, {
131
55
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
132
- children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
133
- slots: (0, _extends2.default)({}, slots, {
134
- legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
135
- }),
136
- slotProps: {
137
- legend: (0, _extends2.default)({
138
- labelPosition: 'extremes'
139
- }, slotProps?.legend)
140
- },
141
- sx: slotProps?.legend?.direction === 'vertical' ? {
142
- height: 150
143
- } : {
144
- width: '50%'
145
- }
146
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
56
+ children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
147
57
  ref: ref,
148
58
  sx: sx,
149
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
150
- clipPath: `url(#${clipPathId})`,
151
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
152
- slots: slots,
153
- slotProps: slotProps
154
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedHeatmapCell.FocusedHeatmapCell, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
155
- loading: loading,
156
- slots: slots,
157
- slotProps: slotProps
158
- })]
159
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
160
- slots: slots,
161
- slotProps: slotProps
162
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
163
- id: clipPathId
164
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), children]
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
60
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, (0, _extends2.default)({}, heatmapPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedHeatmapCell.FocusedHeatmapCell, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps))]
61
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), children]
165
62
  }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
166
63
  }))
167
- });
64
+ }));
168
65
  });
169
66
  if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
170
67
  process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
@@ -180,6 +77,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
180
77
  setZoomData: _propTypes.default.func.isRequired
181
78
  })
182
79
  }),
80
+ /**
81
+ * The border radius of the heatmap cells in pixels.
82
+ */
83
+ borderRadius: _propTypes.default.number,
183
84
  /**
184
85
  * Configuration for the brush interaction.
185
86
  */
@@ -212,7 +113,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
212
113
  height: _propTypes.default.number,
213
114
  /**
214
115
  * If `true`, the legend is not rendered.
215
- * @default true
216
116
  */
217
117
  hideLegend: _propTypes.default.bool,
218
118
  /**
@@ -221,7 +121,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
221
121
  */
222
122
  highlightedItem: _propTypes.default.shape({
223
123
  dataIndex: _propTypes.default.number,
224
- seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired
124
+ seriesId: _propTypes.default.string.isRequired
225
125
  }),
226
126
  /**
227
127
  * This prop is used to help implement the accessibility logic.
@@ -297,11 +197,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
297
197
  * An array of [[HeatmapSeries]] objects.
298
198
  */
299
199
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
300
- /**
301
- * The configuration helpers used to compute attributes according to the series type.
302
- * @ignore Unstable props for internal usage.
303
- */
304
- seriesConfig: _propTypes.default.object,
305
200
  /**
306
201
  * If true, shows the default chart toolbar.
307
202
  * @default false
@@ -331,10 +226,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
331
226
  */
332
227
  tooltipItem: _propTypes.default.shape({
333
228
  dataIndex: _propTypes.default.number,
334
- seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
229
+ seriesId: _propTypes.default.string.isRequired,
335
230
  type: _propTypes.default.oneOf(['heatmap']).isRequired,
336
- xIndex: _propTypes.default.number,
337
- yIndex: _propTypes.default.number
231
+ xIndex: _propTypes.default.number.isRequired,
232
+ yIndex: _propTypes.default.number.isRequired
338
233
  }),
339
234
  /**
340
235
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -0,0 +1,19 @@
1
+ import { type HeatmapItemProps, type HeatmapItemSlotProps, type HeatmapItemSlots } from "./HeatmapItem.js";
2
+ export interface HeatmapPlotSlots extends HeatmapItemSlots {}
3
+ export interface HeatmapPlotSlotProps extends HeatmapItemSlotProps {}
4
+ export interface HeatmapRendererPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {
5
+ /**
6
+ * The border radius of the heatmap cells in pixels.
7
+ */
8
+ borderRadius?: number;
9
+ /**
10
+ * Overridable component slots.
11
+ * @default {}
12
+ */
13
+ slots?: HeatmapPlotSlots;
14
+ /**
15
+ * The props used for each component slot.
16
+ * @default {}
17
+ */
18
+ slotProps?: HeatmapPlotSlotProps;
19
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -19,9 +19,15 @@ export interface HeatmapItemProps {
19
19
  height: number;
20
20
  x: number;
21
21
  y: number;
22
+ xIndex: number;
23
+ yIndex: number;
22
24
  color: string;
23
25
  isHighlighted?: boolean;
24
26
  isFaded?: boolean;
27
+ /**
28
+ * The border radius of the heatmap cell in pixels.
29
+ */
30
+ borderRadius?: number;
25
31
  /**
26
32
  * The props used for each component slot.
27
33
  * @default {}
@@ -17,7 +17,7 @@ var _heatmapClasses = require("./heatmapClasses");
17
17
  var _HeatmapCell = require("./internals/HeatmapCell");
18
18
  var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
- const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "slotProps", "slots"];
20
+ const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
21
21
  const useUtilityClasses = ownerState => {
22
22
  const {
23
23
  classes,
@@ -42,6 +42,9 @@ function HeatmapItem(props) {
42
42
  value,
43
43
  isHighlighted = false,
44
44
  isFaded = false,
45
+ borderRadius,
46
+ xIndex,
47
+ yIndex,
45
48
  slotProps = {},
46
49
  slots = {}
47
50
  } = props,
@@ -53,7 +56,9 @@ function HeatmapItem(props) {
53
56
  const interactionProps = (0, _internals.useInteractionItemProps)({
54
57
  type: 'heatmap',
55
58
  seriesId,
56
- dataIndex
59
+ dataIndex,
60
+ xIndex,
61
+ yIndex
57
62
  }, skipInteractionItemProps);
58
63
  const ownerState = {
59
64
  seriesId,
@@ -67,7 +72,10 @@ function HeatmapItem(props) {
67
72
  const Cell = slots?.cell ?? _HeatmapCell.HeatmapCell;
68
73
  const cellProps = (0, _useSlotProps.default)({
69
74
  elementType: Cell,
70
- additionalProps: interactionProps,
75
+ additionalProps: (0, _extends2.default)({}, interactionProps, {
76
+ rx: borderRadius,
77
+ ry: borderRadius
78
+ }),
71
79
  externalForwardedProps: (0, _extends2.default)({}, other),
72
80
  externalSlotProps: slotProps.cell,
73
81
  ownerState,
@@ -1,6 +1,10 @@
1
- import { type HeatmapItemProps } from "./HeatmapItem.js";
2
- export interface HeatmapPlotProps extends Pick<HeatmapItemProps, 'slots' | 'slotProps'> {}
3
- declare function HeatmapPlot(props: HeatmapPlotProps): import("react/jsx-runtime").JSX.Element | null;
1
+ import * as React from 'react';
2
+ import { type HeatmapRendererPlotProps } from "./Heatmap.types.js";
3
+ export interface HeatmapPlotProps extends HeatmapRendererPlotProps {}
4
+ declare function HeatmapPlot({
5
+ borderRadius,
6
+ ...props
7
+ }: HeatmapPlotProps): React.ReactNode;
4
8
  declare namespace HeatmapPlot {
5
9
  var propTypes: any;
6
10
  }
@@ -7,69 +7,31 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.HeatmapPlot = HeatmapPlot;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
12
  var React = _interopRequireWildcard(require("react"));
11
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _hooks = require("@mui/x-charts/hooks");
13
- var _internals = require("@mui/x-charts/internals");
14
- var _useHeatmapSeries = require("../hooks/useHeatmapSeries");
15
- var _HeatmapItem = require("./HeatmapItem");
16
- var _useChartHeatmapPosition = require("../plugins/selectors/useChartHeatmapPosition.selectors");
17
- var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
14
+ var _HeatmapSVGPlot = require("./HeatmapSVGPlot");
18
15
  var _jsxRuntime = require("react/jsx-runtime");
19
- function HeatmapPlot(props) {
20
- const store = (0, _internals.useStore)();
21
- const xScale = (0, _hooks.useXScale)();
22
- const yScale = (0, _hooks.useYScale)();
23
- const colorScale = (0, _hooks.useZColorScale)();
24
- const series = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
25
- const isHighlighted = store.use(_internals.selectorChartsIsHighlightedCallback);
26
- const isFaded = store.use(_internals.selectorChartsIsFadedCallback);
27
- const xDomain = xScale.domain();
28
- const yDomain = yScale.domain();
29
- if (!series || series.seriesOrder.length === 0) {
30
- return null;
31
- }
32
- const seriesToDisplay = series.series[series.seriesOrder[0]];
33
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
34
- children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
35
- children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
36
- const x = xScale(xDomain[xIndex]);
37
- const y = yScale(yDomain[yIndex]);
38
- const color = colorScale?.(value);
39
- if (x === undefined || y === undefined || !color) {
40
- return null;
41
- }
42
- const item = {
43
- seriesId: seriesToDisplay.id,
44
- dataIndex
45
- };
46
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapItem.HeatmapItem, {
47
- width: xScale.bandwidth(),
48
- height: yScale.bandwidth(),
49
- x: x,
50
- y: y,
51
- color: color,
52
- dataIndex: dataIndex,
53
- seriesId: series.seriesOrder[0],
54
- value: value,
55
- slots: props.slots,
56
- slotProps: props.slotProps,
57
- isHighlighted: isHighlighted(item),
58
- isFaded: isFaded(item)
59
- }, `${xIndex}_${yIndex}`);
60
- })
61
- })]
62
- });
63
- }
64
- function RegisterHeatmapPointerInteractions() {
65
- (0, _internals.useRegisterPointerInteractions)(_useChartHeatmapPosition.selectorHeatmapItemAtPosition);
66
- return null;
16
+ const _excluded = ["borderRadius"];
17
+ function HeatmapPlot(_ref) {
18
+ let {
19
+ borderRadius
20
+ } = _ref,
21
+ props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapSVGPlot.HeatmapSVGPlot, (0, _extends2.default)({
23
+ borderRadius: borderRadius
24
+ }, props));
67
25
  }
68
26
  process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
69
27
  // ----------------------------- Warning --------------------------------
70
28
  // | These PropTypes are generated from the TypeScript type definitions |
71
29
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
72
30
  // ----------------------------------------------------------------------
31
+ /**
32
+ * The border radius of the heatmap cells in pixels.
33
+ */
34
+ borderRadius: _propTypes.default.number,
73
35
  /**
74
36
  * The props used for each component slot.
75
37
  * @default {}
@@ -0,0 +1,2 @@
1
+ import { type HeatmapRendererPlotProps } from "./Heatmap.types.js";
2
+ export declare function HeatmapSVGPlot(props: HeatmapRendererPlotProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.HeatmapSVGPlot = HeatmapSVGPlot;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _hooks = require("@mui/x-charts/hooks");
11
+ var _internals = require("@mui/x-charts/internals");
12
+ var _hooks2 = require("../hooks");
13
+ var _HeatmapItem = require("./HeatmapItem");
14
+ var _useChartHeatmapPosition = require("../plugins/selectors/useChartHeatmapPosition.selectors");
15
+ var _shouldRegisterPointerInteractionsGlobally = require("./shouldRegisterPointerInteractionsGlobally");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ const MemoHeatmapItem = /*#__PURE__*/React.memo(_HeatmapItem.HeatmapItem);
18
+ if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
19
+ function HeatmapSVGPlot(props) {
20
+ const store = (0, _internals.useStore)();
21
+ const xScale = (0, _hooks.useXScale)();
22
+ const yScale = (0, _hooks.useYScale)();
23
+ const colorScale = (0, _hooks.useZColorScale)();
24
+ const series = (0, _hooks2.useHeatmapSeriesContext)();
25
+ const isHighlighted = store.use(_internals.selectorChartsIsHighlightedCallback);
26
+ const isFaded = store.use(_internals.selectorChartsIsFadedCallback);
27
+ const xDomain = xScale.domain();
28
+ const yDomain = yScale.domain();
29
+ if (!series || series.seriesOrder.length === 0) {
30
+ return null;
31
+ }
32
+ const seriesToDisplay = series.series[series.seriesOrder[0]];
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
34
+ children: [(0, _shouldRegisterPointerInteractionsGlobally.shouldRegisterPointerInteractionsGlobally)(props.slots, props.slotProps) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
35
+ children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
36
+ const x = xScale(xDomain[xIndex]);
37
+ const y = yScale(yDomain[yIndex]);
38
+ const color = colorScale?.(value);
39
+ if (x === undefined || y === undefined || !color) {
40
+ return null;
41
+ }
42
+ const item = {
43
+ seriesId: seriesToDisplay.id,
44
+ dataIndex
45
+ };
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoHeatmapItem, {
47
+ width: xScale.bandwidth(),
48
+ height: yScale.bandwidth(),
49
+ x: x,
50
+ y: y,
51
+ xIndex: xIndex,
52
+ yIndex: yIndex,
53
+ color: color,
54
+ dataIndex: dataIndex,
55
+ seriesId: series.seriesOrder[0],
56
+ value: value,
57
+ slots: props.slots,
58
+ slotProps: props.slotProps,
59
+ isHighlighted: isHighlighted(item),
60
+ isFaded: isFaded(item),
61
+ borderRadius: props.borderRadius
62
+ }, `${xIndex}_${yIndex}`);
63
+ })
64
+ })]
65
+ });
66
+ }
67
+ function RegisterHeatmapPointerInteractions() {
68
+ (0, _internals.useRegisterPointerInteractions)(_useChartHeatmapPosition.selectorHeatmapItemAtPosition);
69
+ return null;
70
+ }
@@ -1,4 +1,8 @@
1
- import { type ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
1
+ import { type ChartsTooltipContainerProps, type ChartsTooltipClasses, type ChartsTooltipSlots, type ChartsTooltipSlotProps } from '@mui/x-charts/ChartsTooltip';
2
+ export interface HeatmapTooltipSlots extends ChartsTooltipSlots {}
3
+ export interface HeatmapTooltipSlotProps extends ChartsTooltipSlotProps {}
4
+ export interface HeatmapTooltipClasses extends ChartsTooltipClasses {}
5
+ export interface HeatmapTooltipContentClasses extends ChartsTooltipClasses {}
2
6
  export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
3
7
  /**
4
8
  * Select the kind of tooltip to display
@@ -1,3 +1,3 @@
1
1
  export * from "./HeatmapTooltip.js";
2
2
  export * from "./HeatmapTooltipContent.js";
3
- export type { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
3
+ export type { HeatmapTooltipProps, HeatmapTooltipClasses, HeatmapTooltipContentClasses, HeatmapTooltipSlots, HeatmapTooltipSlotProps } from "./HeatmapTooltip.types.js";
@@ -1,6 +1,7 @@
1
1
  export { Heatmap } from "./Heatmap.js";
2
- export type { HeatmapSeries, HeatmapProps } from "./Heatmap.js";
3
- export { HeatmapPlot } from "./HeatmapPlot.js";
2
+ export type { HeatmapSeries, HeatmapProps, HeatmapSlots, HeatmapSlotProps } from "./Heatmap.js";
3
+ export { HeatmapPlot, type HeatmapPlotProps } from "./HeatmapPlot.js";
4
+ export type { HeatmapPlotSlots, HeatmapPlotSlotProps } from "./Heatmap.types.js";
4
5
  export * from "./FocusedHeatmapCell.js";
5
6
  export type { HeatmapCellProps } from "./internals/HeatmapCell.js";
6
7
  export * from "./HeatmapTooltip/index.js";
@@ -30,12 +30,16 @@ function getItemAtPosition(state, point) {
30
30
  if (dataIndex === -1) {
31
31
  return {
32
32
  type: 'heatmap',
33
- seriesId
33
+ seriesId,
34
+ xIndex,
35
+ yIndex
34
36
  };
35
37
  }
36
38
  return {
37
39
  type: 'heatmap',
38
40
  seriesId,
39
- dataIndex
41
+ dataIndex,
42
+ xIndex,
43
+ yIndex
40
44
  };
41
45
  }
@@ -25,6 +25,7 @@ const heatmapSeriesConfig = exports.heatmapSeriesConfig = {
25
25
  yExtremumGetter: _extremums.getBaseExtremum,
26
26
  getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
27
27
  identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
28
+ identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
28
29
  getItemAtPosition: _getItemAtPosition.default,
29
30
  keyboardFocusHandler: _keyboardFocusHandler.default
30
31
  };
@@ -0,0 +1,24 @@
1
+ import { type ChartsWrapperProps } from '@mui/x-charts/ChartsWrapper';
2
+ import * as React from 'react';
3
+ import { type ChartsLegendProps, type ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
4
+ import type { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
5
+ import { type ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
6
+ import type { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
7
+ import { type HeatmapPluginSignatures } from "./Heatmap.plugins.js";
8
+ import { type HeatmapProps } from "./Heatmap.js";
9
+ import { type ChartDataProviderProProps } from "../ChartDataProviderPro/index.js";
10
+ import { type HeatmapPlotProps } from "./HeatmapPlot.js";
11
+ export type UseHeatmapProps = HeatmapProps;
12
+ export declare function useHeatmapProps(props: UseHeatmapProps): {
13
+ chartDataProviderProProps: ChartDataProviderProProps<"heatmap", HeatmapPluginSignatures>;
14
+ chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
15
+ heatmapPlotProps: HeatmapPlotProps;
16
+ clipPathProps: ChartsClipPathProps;
17
+ clipPathGroupProps: {
18
+ clipPath: string;
19
+ };
20
+ overlayProps: ChartsOverlayProps;
21
+ chartsAxisProps: ChartsAxisProps;
22
+ legendProps: ChartsLegendProps | ChartsLegendSlotExtension;
23
+ children: React.ReactNode;
24
+ };