@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
@@ -4,160 +4,57 @@ 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 { useThemeProps } from '@mui/material/styles';
7
- import useId from '@mui/utils/useId';
8
- import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
9
7
  import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
10
8
  import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
11
9
  import { ChartsWrapper } from '@mui/x-charts/ChartsWrapper';
12
10
  import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
13
11
  import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
14
- import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
15
- import { ChartsLegend, ContinuousColorLegend } from '@mui/x-charts/ChartsLegend';
12
+ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
16
13
  import { ChartsBrushOverlay } from '@mui/x-charts/ChartsBrushOverlay';
17
14
  import { HeatmapPlot } from "./HeatmapPlot.js";
18
- import { heatmapSeriesConfig } from "./seriesConfig/index.js";
19
15
  import { HeatmapTooltip } from "./HeatmapTooltip/index.js";
20
- import { HEATMAP_PLUGINS } from "./Heatmap.plugins.js";
21
16
  import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
22
17
  import { ChartsToolbarPro } from "../ChartsToolbarPro/index.js";
23
18
  import { FocusedHeatmapCell } from "./FocusedHeatmapCell.js";
19
+ import { useHeatmapProps } from "./useHeatmapProps.js";
24
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
- // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
26
- const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
27
- const seriesConfig = {
28
- heatmap: heatmapSeriesConfig
29
- };
30
- function getDefaultDataForAxis(series, dimension) {
31
- if (series?.[0]?.data === undefined || series[0].data.length === 0) {
32
- return [];
33
- }
34
- return Array.from({
35
- length: Math.max(...series[0].data.map(dataPoint => dataPoint[dimension])) + 1
36
- }, (_, index) => index);
37
- }
38
- const getDefaultDataForXAxis = series => getDefaultDataForAxis(series, 0);
39
- const getDefaultDataForYAxis = series => getDefaultDataForAxis(series, 1);
40
21
  const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
41
22
  const props = useThemeProps({
42
23
  props: inProps,
43
24
  name: 'MuiHeatmap'
44
25
  });
45
26
  const {
46
- apiRef,
47
- xAxis,
48
- yAxis,
49
- zAxis,
50
- series,
51
- width,
52
- height,
53
- margin,
54
- colors,
55
- dataset,
56
27
  sx,
57
- onAxisClick,
58
- children,
59
28
  slots,
60
29
  slotProps,
61
30
  loading,
62
- highlightedItem,
63
- onHighlightChange,
64
- onItemClick,
65
- enableKeyboardNavigation,
66
- hideLegend = true,
31
+ hideLegend,
67
32
  showToolbar = false
68
33
  } = props;
69
- const id = useId();
70
- const clipPathId = `${id}-clip-path`;
71
- const xAxisWithDefault = React.useMemo(() => (xAxis && xAxis.length > 0 ? xAxis : [{
72
- id: DEFAULT_X_AXIS_KEY
73
- }]).map(axis => _extends({
74
- scaleType: 'band',
75
- categoryGapRatio: 0
76
- }, axis, {
77
- data: axis.data ?? getDefaultDataForXAxis(series)
78
- })), [series, xAxis]);
79
- const yAxisWithDefault = React.useMemo(() => (yAxis && yAxis.length > 0 ? yAxis : [{
80
- id: DEFAULT_Y_AXIS_KEY
81
- }]).map(axis => _extends({
82
- scaleType: 'band',
83
- categoryGapRatio: 0
84
- }, axis, {
85
- data: axis.data ?? getDefaultDataForYAxis(series)
86
- })), [series, yAxis]);
87
- const zAxisWithDefault = React.useMemo(() => zAxis ?? [{
88
- colorMap: {
89
- type: 'continuous',
90
- min: 0,
91
- max: 100,
92
- color: defaultColorMap
93
- }
94
- }], [zAxis]);
95
- const chartsWrapperProps = {
96
- sx,
97
- legendPosition: props.slotProps?.legend?.position,
98
- legendDirection: props.slotProps?.legend?.direction,
99
- hideLegend
100
- };
34
+ const {
35
+ chartDataProviderProProps,
36
+ chartsWrapperProps,
37
+ chartsAxisProps,
38
+ clipPathProps,
39
+ clipPathGroupProps,
40
+ legendProps,
41
+ heatmapPlotProps,
42
+ overlayProps,
43
+ children
44
+ } = useHeatmapProps(props);
101
45
  const Tooltip = slots?.tooltip ?? HeatmapTooltip;
102
46
  const Toolbar = slots?.toolbar ?? ChartsToolbarPro;
103
- return /*#__PURE__*/_jsx(ChartDataProviderPro, {
104
- apiRef: apiRef,
105
- seriesConfig: seriesConfig,
106
- series: series.map(s => _extends({
107
- type: 'heatmap'
108
- }, s)),
109
- width: width,
110
- height: height,
111
- margin: margin,
112
- xAxis: xAxisWithDefault,
113
- yAxis: yAxisWithDefault,
114
- zAxis: zAxisWithDefault,
115
- colors: colors,
116
- dataset: dataset,
117
- disableAxisListener: true,
118
- highlightedItem: highlightedItem,
119
- onHighlightChange: onHighlightChange,
120
- enableKeyboardNavigation: enableKeyboardNavigation,
121
- onAxisClick: onAxisClick,
122
- onItemClick: onItemClick,
123
- plugins: HEATMAP_PLUGINS,
47
+ return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
124
48
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
125
- children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
126
- slots: _extends({}, slots, {
127
- legend: slots?.legend ?? ContinuousColorLegend
128
- }),
129
- slotProps: {
130
- legend: _extends({
131
- labelPosition: 'extremes'
132
- }, slotProps?.legend)
133
- },
134
- sx: slotProps?.legend?.direction === 'vertical' ? {
135
- height: 150
136
- } : {
137
- width: '50%'
138
- }
139
- }), /*#__PURE__*/_jsxs(ChartsSurface, {
49
+ children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, {
140
50
  ref: ref,
141
51
  sx: sx,
142
- children: [/*#__PURE__*/_jsxs("g", {
143
- clipPath: `url(#${clipPathId})`,
144
- children: [/*#__PURE__*/_jsx(HeatmapPlot, {
145
- slots: slots,
146
- slotProps: slotProps
147
- }), /*#__PURE__*/_jsx(FocusedHeatmapCell, {}), /*#__PURE__*/_jsx(ChartsOverlay, {
148
- loading: loading,
149
- slots: slots,
150
- slotProps: slotProps
151
- })]
152
- }), /*#__PURE__*/_jsx(ChartsAxis, {
153
- slots: slots,
154
- slotProps: slotProps
155
- }), /*#__PURE__*/_jsx(ChartsClipPath, {
156
- id: clipPathId
157
- }), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
52
+ children: [/*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
53
+ children: [/*#__PURE__*/_jsx(HeatmapPlot, _extends({}, heatmapPlotProps)), /*#__PURE__*/_jsx(FocusedHeatmapCell, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps))]
54
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), children]
158
55
  }), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip))]
159
56
  }))
160
- });
57
+ }));
161
58
  });
162
59
  if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
163
60
  process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
@@ -173,6 +70,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
173
70
  setZoomData: PropTypes.func.isRequired
174
71
  })
175
72
  }),
73
+ /**
74
+ * The border radius of the heatmap cells in pixels.
75
+ */
76
+ borderRadius: PropTypes.number,
176
77
  /**
177
78
  * Configuration for the brush interaction.
178
79
  */
@@ -205,7 +106,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
205
106
  height: PropTypes.number,
206
107
  /**
207
108
  * If `true`, the legend is not rendered.
208
- * @default true
209
109
  */
210
110
  hideLegend: PropTypes.bool,
211
111
  /**
@@ -214,7 +114,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
214
114
  */
215
115
  highlightedItem: PropTypes.shape({
216
116
  dataIndex: PropTypes.number,
217
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
117
+ seriesId: PropTypes.string.isRequired
218
118
  }),
219
119
  /**
220
120
  * This prop is used to help implement the accessibility logic.
@@ -290,11 +190,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
290
190
  * An array of [[HeatmapSeries]] objects.
291
191
  */
292
192
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
293
- /**
294
- * The configuration helpers used to compute attributes according to the series type.
295
- * @ignore Unstable props for internal usage.
296
- */
297
- seriesConfig: PropTypes.object,
298
193
  /**
299
194
  * If true, shows the default chart toolbar.
300
195
  * @default false
@@ -324,10 +219,10 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
324
219
  */
325
220
  tooltipItem: PropTypes.shape({
326
221
  dataIndex: PropTypes.number,
327
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
222
+ seriesId: PropTypes.string.isRequired,
328
223
  type: PropTypes.oneOf(['heatmap']).isRequired,
329
- xIndex: PropTypes.number,
330
- yIndex: PropTypes.number
224
+ xIndex: PropTypes.number.isRequired,
225
+ yIndex: PropTypes.number.isRequired
331
226
  }),
332
227
  /**
333
228
  * 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 @@
1
+ export {};
@@ -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 {}
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "slotProps", "slots"];
3
+ const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "isFaded", "borderRadius", "xIndex", "yIndex", "slotProps", "slots"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import useSlotProps from '@mui/utils/useSlotProps';
@@ -34,6 +34,9 @@ function HeatmapItem(props) {
34
34
  value,
35
35
  isHighlighted = false,
36
36
  isFaded = false,
37
+ borderRadius,
38
+ xIndex,
39
+ yIndex,
37
40
  slotProps = {},
38
41
  slots = {}
39
42
  } = props,
@@ -45,7 +48,9 @@ function HeatmapItem(props) {
45
48
  const interactionProps = useInteractionItemProps({
46
49
  type: 'heatmap',
47
50
  seriesId,
48
- dataIndex
51
+ dataIndex,
52
+ xIndex,
53
+ yIndex
49
54
  }, skipInteractionItemProps);
50
55
  const ownerState = {
51
56
  seriesId,
@@ -59,7 +64,10 @@ function HeatmapItem(props) {
59
64
  const Cell = slots?.cell ?? HeatmapCell;
60
65
  const cellProps = useSlotProps({
61
66
  elementType: Cell,
62
- additionalProps: interactionProps,
67
+ additionalProps: _extends({}, interactionProps, {
68
+ rx: borderRadius,
69
+ ry: borderRadius
70
+ }),
63
71
  externalForwardedProps: _extends({}, other),
64
72
  externalSlotProps: slotProps.cell,
65
73
  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
  }
@@ -1,69 +1,30 @@
1
1
  'use client';
2
2
 
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["borderRadius"];
3
6
  import * as React from 'react';
4
7
  import PropTypes from 'prop-types';
5
- import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
6
- import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback, useStore } from '@mui/x-charts/internals';
7
- import { useRegisterPointerInteractions } from '@mui/x-charts/internals';
8
- import { useHeatmapSeriesContext } from "../hooks/useHeatmapSeries.js";
9
- import { HeatmapItem } from "./HeatmapItem.js";
10
- import { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.js";
11
- import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.js";
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- function HeatmapPlot(props) {
14
- const store = useStore();
15
- const xScale = useXScale();
16
- const yScale = useYScale();
17
- const colorScale = useZColorScale();
18
- const series = useHeatmapSeriesContext();
19
- const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
20
- const isFaded = store.use(selectorChartsIsFadedCallback);
21
- const xDomain = xScale.domain();
22
- const yDomain = yScale.domain();
23
- if (!series || series.seriesOrder.length === 0) {
24
- return null;
25
- }
26
- const seriesToDisplay = series.series[series.seriesOrder[0]];
27
- return /*#__PURE__*/_jsxs(React.Fragment, {
28
- children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx("g", {
29
- children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
30
- const x = xScale(xDomain[xIndex]);
31
- const y = yScale(yDomain[yIndex]);
32
- const color = colorScale?.(value);
33
- if (x === undefined || y === undefined || !color) {
34
- return null;
35
- }
36
- const item = {
37
- seriesId: seriesToDisplay.id,
38
- dataIndex
39
- };
40
- return /*#__PURE__*/_jsx(HeatmapItem, {
41
- width: xScale.bandwidth(),
42
- height: yScale.bandwidth(),
43
- x: x,
44
- y: y,
45
- color: color,
46
- dataIndex: dataIndex,
47
- seriesId: series.seriesOrder[0],
48
- value: value,
49
- slots: props.slots,
50
- slotProps: props.slotProps,
51
- isHighlighted: isHighlighted(item),
52
- isFaded: isFaded(item)
53
- }, `${xIndex}_${yIndex}`);
54
- })
55
- })]
56
- });
57
- }
58
- function RegisterHeatmapPointerInteractions() {
59
- useRegisterPointerInteractions(selectorHeatmapItemAtPosition);
60
- return null;
8
+ import { HeatmapSVGPlot } from "./HeatmapSVGPlot.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ function HeatmapPlot(_ref) {
11
+ let {
12
+ borderRadius
13
+ } = _ref,
14
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ return /*#__PURE__*/_jsx(HeatmapSVGPlot, _extends({
16
+ borderRadius: borderRadius
17
+ }, props));
61
18
  }
62
19
  process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
63
20
  // ----------------------------- Warning --------------------------------
64
21
  // | These PropTypes are generated from the TypeScript type definitions |
65
22
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
66
23
  // ----------------------------------------------------------------------
24
+ /**
25
+ * The border radius of the heatmap cells in pixels.
26
+ */
27
+ borderRadius: PropTypes.number,
67
28
  /**
68
29
  * The props used for each component slot.
69
30
  * @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,64 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { useXScale, useYScale, useZColorScale } from '@mui/x-charts/hooks';
5
+ import { selectorChartsIsFadedCallback, selectorChartsIsHighlightedCallback, useStore, useRegisterPointerInteractions } from '@mui/x-charts/internals';
6
+ import { useHeatmapSeriesContext } from "../hooks/index.js";
7
+ import { HeatmapItem } from "./HeatmapItem.js";
8
+ import { selectorHeatmapItemAtPosition } from "../plugins/selectors/useChartHeatmapPosition.selectors.js";
9
+ import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.js";
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const MemoHeatmapItem = /*#__PURE__*/React.memo(HeatmapItem);
12
+ if (process.env.NODE_ENV !== "production") MemoHeatmapItem.displayName = "MemoHeatmapItem";
13
+ export function HeatmapSVGPlot(props) {
14
+ const store = useStore();
15
+ const xScale = useXScale();
16
+ const yScale = useYScale();
17
+ const colorScale = useZColorScale();
18
+ const series = useHeatmapSeriesContext();
19
+ const isHighlighted = store.use(selectorChartsIsHighlightedCallback);
20
+ const isFaded = store.use(selectorChartsIsFadedCallback);
21
+ const xDomain = xScale.domain();
22
+ const yDomain = yScale.domain();
23
+ if (!series || series.seriesOrder.length === 0) {
24
+ return null;
25
+ }
26
+ const seriesToDisplay = series.series[series.seriesOrder[0]];
27
+ return /*#__PURE__*/_jsxs(React.Fragment, {
28
+ children: [shouldRegisterPointerInteractionsGlobally(props.slots, props.slotProps) ? /*#__PURE__*/_jsx(RegisterHeatmapPointerInteractions, {}) : null, /*#__PURE__*/_jsx("g", {
29
+ children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
30
+ const x = xScale(xDomain[xIndex]);
31
+ const y = yScale(yDomain[yIndex]);
32
+ const color = colorScale?.(value);
33
+ if (x === undefined || y === undefined || !color) {
34
+ return null;
35
+ }
36
+ const item = {
37
+ seriesId: seriesToDisplay.id,
38
+ dataIndex
39
+ };
40
+ return /*#__PURE__*/_jsx(MemoHeatmapItem, {
41
+ width: xScale.bandwidth(),
42
+ height: yScale.bandwidth(),
43
+ x: x,
44
+ y: y,
45
+ xIndex: xIndex,
46
+ yIndex: yIndex,
47
+ color: color,
48
+ dataIndex: dataIndex,
49
+ seriesId: series.seriesOrder[0],
50
+ value: value,
51
+ slots: props.slots,
52
+ slotProps: props.slotProps,
53
+ isHighlighted: isHighlighted(item),
54
+ isFaded: isFaded(item),
55
+ borderRadius: props.borderRadius
56
+ }, `${xIndex}_${yIndex}`);
57
+ })
58
+ })]
59
+ });
60
+ }
61
+ function RegisterHeatmapPointerInteractions() {
62
+ useRegisterPointerInteractions(selectorHeatmapItemAtPosition);
63
+ return null;
64
+ }
@@ -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";
@@ -24,12 +24,16 @@ export default function getItemAtPosition(state, point) {
24
24
  if (dataIndex === -1) {
25
25
  return {
26
26
  type: 'heatmap',
27
- seriesId
27
+ seriesId,
28
+ xIndex,
29
+ yIndex
28
30
  };
29
31
  }
30
32
  return {
31
33
  type: 'heatmap',
32
34
  seriesId,
33
- dataIndex
35
+ dataIndex,
36
+ xIndex,
37
+ yIndex
34
38
  };
35
39
  }
@@ -1,4 +1,4 @@
1
- import { cartesianSeriesTypes, identifierSerializerSeriesIdDataIndex } from '@mui/x-charts/internals';
1
+ import { cartesianSeriesTypes, identifierSerializerSeriesIdDataIndex, identifierCleanerSeriesIdDataIndex } from '@mui/x-charts/internals';
2
2
  import { getBaseExtremum } from "./extremums.js";
3
3
  import seriesProcessor from "./seriesProcessor.js";
4
4
  import getColor from "./getColor.js";
@@ -18,6 +18,7 @@ export const heatmapSeriesConfig = {
18
18
  yExtremumGetter: getBaseExtremum,
19
19
  getSeriesWithDefaultValues,
20
20
  identifierSerializer: identifierSerializerSeriesIdDataIndex,
21
+ identifierCleaner: identifierCleanerSeriesIdDataIndex,
21
22
  getItemAtPosition,
22
23
  keyboardFocusHandler
23
24
  };
@@ -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
+ };