@mui/x-charts-pro 8.3.1 → 8.5.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 (206) hide show
  1. package/BarChartPro/BarChartPro.d.ts +13 -5
  2. package/BarChartPro/BarChartPro.js +56 -21
  3. package/CHANGELOG.md +213 -0
  4. package/ChartContainerPro/ChartContainerPro.d.ts +0 -1
  5. package/ChartContainerPro/ChartContainerPro.js +1 -0
  6. package/ChartContainerPro/ChartProApi.d.ts +26 -0
  7. package/ChartContainerPro/ChartProApi.js +5 -0
  8. package/ChartContainerPro/index.d.ts +2 -1
  9. package/ChartContainerPro/index.js +11 -0
  10. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
  11. package/ChartDataProviderPro/ChartDataProviderPro.js +19 -3
  12. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
  13. package/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
  14. package/ChartZoomSlider/index.d.ts +1 -1
  15. package/ChartZoomSlider/index.js +4 -4
  16. package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
  17. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +31 -287
  18. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
  19. package/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +251 -0
  20. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  21. package/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +92 -0
  22. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
  23. package/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +160 -0
  24. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  25. package/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +58 -0
  26. package/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  27. package/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +6 -6
  28. package/ChartZoomSlider/internals/constants.d.ts +5 -0
  29. package/ChartZoomSlider/internals/constants.js +11 -0
  30. package/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
  31. package/ChartZoomSlider/internals/zoom-utils.js +48 -0
  32. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
  33. package/ChartsToolbarPro/ChartsToolbarPro.js +42 -8
  34. package/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
  35. package/ChartsToolbarPro/ChartsToolbarZoomInButton.js +56 -0
  36. package/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
  37. package/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +56 -0
  38. package/ChartsToolbarPro/index.d.ts +3 -1
  39. package/ChartsToolbarPro/index.js +22 -0
  40. package/FunnelChart/FunnelChart.d.ts +2 -1
  41. package/FunnelChart/FunnelChart.js +6 -23
  42. package/FunnelChart/FunnelChart.plugins.d.ts +4 -0
  43. package/FunnelChart/FunnelChart.plugins.js +9 -0
  44. package/FunnelChart/FunnelPlot.js +2 -0
  45. package/FunnelChart/FunnelSection.js +2 -1
  46. package/FunnelChart/curves/curve.types.d.ts +4 -0
  47. package/FunnelChart/curves/pyramid.d.ts +3 -1
  48. package/FunnelChart/curves/pyramid.js +37 -10
  49. package/FunnelChart/curves/step-pyramid.d.ts +10 -2
  50. package/FunnelChart/curves/step-pyramid.js +96 -20
  51. package/FunnelChart/curves/step.d.ts +5 -1
  52. package/FunnelChart/curves/step.js +20 -2
  53. package/FunnelChart/funnel.types.d.ts +7 -0
  54. package/FunnelChart/funnelSlots.types.d.ts +4 -3
  55. package/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  56. package/FunnelChart/useFunnelChartProps.d.ts +2 -1
  57. package/FunnelChart/useFunnelChartProps.js +3 -1
  58. package/Heatmap/Heatmap.d.ts +18 -5
  59. package/Heatmap/Heatmap.js +64 -26
  60. package/Heatmap/Heatmap.plugins.d.ts +2 -1
  61. package/Heatmap/Heatmap.plugins.js +2 -1
  62. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  63. package/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +27 -0
  64. package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  65. package/Heatmap/HeatmapTooltip/HeatmapTooltip.js +4 -102
  66. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  67. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +5 -0
  68. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  69. package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +96 -0
  70. package/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  71. package/Heatmap/HeatmapTooltip/index.js +11 -0
  72. package/LineChartPro/LineChartPro.d.ts +13 -5
  73. package/LineChartPro/LineChartPro.js +56 -21
  74. package/RadarChartPro/RadarChartPro.d.ts +15 -0
  75. package/RadarChartPro/RadarChartPro.js +202 -0
  76. package/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
  77. package/RadarChartPro/RadarChartPro.plugins.js +9 -0
  78. package/RadarChartPro/index.d.ts +1 -0
  79. package/RadarChartPro/index.js +16 -0
  80. package/ScatterChartPro/ScatterChartPro.d.ts +13 -5
  81. package/ScatterChartPro/ScatterChartPro.js +57 -22
  82. package/context/index.d.ts +1 -0
  83. package/context/index.js +16 -0
  84. package/context/useChartApiContext.d.ts +9 -0
  85. package/context/useChartApiContext.js +17 -0
  86. package/esm/BarChartPro/BarChartPro.d.ts +13 -5
  87. package/esm/BarChartPro/BarChartPro.js +54 -19
  88. package/esm/ChartContainerPro/ChartContainerPro.d.ts +0 -1
  89. package/esm/ChartContainerPro/ChartContainerPro.js +1 -0
  90. package/esm/ChartContainerPro/ChartProApi.d.ts +26 -0
  91. package/esm/ChartContainerPro/ChartProApi.js +1 -0
  92. package/esm/ChartContainerPro/index.d.ts +2 -1
  93. package/esm/ChartContainerPro/index.js +2 -1
  94. package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +11 -1
  95. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +20 -4
  96. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +2 -0
  97. package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +5 -1
  98. package/esm/ChartZoomSlider/index.d.ts +1 -1
  99. package/esm/ChartZoomSlider/index.js +1 -1
  100. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +1 -3
  101. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +30 -283
  102. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.d.ts +24 -0
  103. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderActiveTrack.js +243 -0
  104. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.d.ts +12 -0
  105. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderThumb.js +85 -0
  106. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.d.ts +18 -0
  107. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderTrack.js +152 -0
  108. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +11 -0
  109. package/esm/ChartZoomSlider/internals/ChartsTooltipZoomSliderValue.js +52 -0
  110. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderThumbClasses.d.ts +17 -0
  111. package/esm/ChartZoomSlider/internals/{chartAxisZoomSliderHandleClasses.js → chartAxisZoomSliderThumbClasses.js} +4 -4
  112. package/esm/ChartZoomSlider/internals/constants.d.ts +5 -0
  113. package/esm/ChartZoomSlider/internals/constants.js +5 -0
  114. package/esm/ChartZoomSlider/internals/zoom-utils.d.ts +4 -0
  115. package/esm/ChartZoomSlider/internals/zoom-utils.js +40 -0
  116. package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +8 -1
  117. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +42 -9
  118. package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.d.ts +16 -0
  119. package/esm/ChartsToolbarPro/ChartsToolbarZoomInButton.js +50 -0
  120. package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.d.ts +16 -0
  121. package/esm/ChartsToolbarPro/ChartsToolbarZoomOutButton.js +50 -0
  122. package/esm/ChartsToolbarPro/index.d.ts +3 -1
  123. package/esm/ChartsToolbarPro/index.js +3 -1
  124. package/esm/FunnelChart/FunnelChart.d.ts +2 -1
  125. package/esm/FunnelChart/FunnelChart.js +6 -23
  126. package/esm/FunnelChart/FunnelChart.plugins.d.ts +4 -0
  127. package/esm/FunnelChart/FunnelChart.plugins.js +3 -0
  128. package/esm/FunnelChart/FunnelPlot.js +2 -0
  129. package/esm/FunnelChart/FunnelSection.js +1 -0
  130. package/esm/FunnelChart/curves/curve.types.d.ts +4 -0
  131. package/esm/FunnelChart/curves/pyramid.d.ts +3 -1
  132. package/esm/FunnelChart/curves/pyramid.js +37 -10
  133. package/esm/FunnelChart/curves/step-pyramid.d.ts +10 -2
  134. package/esm/FunnelChart/curves/step-pyramid.js +96 -20
  135. package/esm/FunnelChart/curves/step.d.ts +5 -1
  136. package/esm/FunnelChart/curves/step.js +20 -2
  137. package/esm/FunnelChart/funnel.types.d.ts +7 -0
  138. package/esm/FunnelChart/funnelSlots.types.d.ts +4 -3
  139. package/esm/FunnelChart/seriesConfig/seriesProcessor.js +47 -1
  140. package/esm/FunnelChart/useFunnelChartProps.d.ts +2 -1
  141. package/esm/FunnelChart/useFunnelChartProps.js +3 -1
  142. package/esm/Heatmap/Heatmap.d.ts +18 -5
  143. package/esm/Heatmap/Heatmap.js +62 -24
  144. package/esm/Heatmap/Heatmap.plugins.d.ts +2 -1
  145. package/esm/Heatmap/Heatmap.plugins.js +2 -1
  146. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.d.ts +2 -0
  147. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.classes.js +19 -0
  148. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -10
  149. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.js +5 -103
  150. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +10 -0
  151. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltip.types.js +1 -0
  152. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +7 -0
  153. package/esm/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +89 -0
  154. package/esm/Heatmap/HeatmapTooltip/index.d.ts +3 -1
  155. package/esm/Heatmap/HeatmapTooltip/index.js +3 -1
  156. package/esm/LineChartPro/LineChartPro.d.ts +13 -5
  157. package/esm/LineChartPro/LineChartPro.js +54 -19
  158. package/esm/RadarChartPro/RadarChartPro.d.ts +15 -0
  159. package/esm/RadarChartPro/RadarChartPro.js +195 -0
  160. package/esm/RadarChartPro/RadarChartPro.plugins.d.ts +4 -0
  161. package/esm/RadarChartPro/RadarChartPro.plugins.js +3 -0
  162. package/esm/RadarChartPro/index.d.ts +1 -0
  163. package/esm/RadarChartPro/index.js +1 -0
  164. package/esm/ScatterChartPro/ScatterChartPro.d.ts +13 -5
  165. package/esm/ScatterChartPro/ScatterChartPro.js +55 -20
  166. package/esm/context/index.d.ts +1 -0
  167. package/esm/context/index.js +1 -0
  168. package/esm/context/useChartApiContext.d.ts +9 -0
  169. package/esm/context/useChartApiContext.js +11 -0
  170. package/esm/hooks/index.d.ts +2 -1
  171. package/esm/hooks/index.js +2 -1
  172. package/esm/index.d.ts +2 -1
  173. package/esm/index.js +2 -1
  174. package/esm/internals/material/index.d.ts +1 -0
  175. package/esm/internals/plugins/useChartProExport/exportImage.js +1 -1
  176. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
  177. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
  178. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +15 -1
  179. package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
  180. package/esm/models/index.d.ts +1 -1
  181. package/hooks/index.d.ts +2 -1
  182. package/hooks/index.js +21 -10
  183. package/index.d.ts +2 -1
  184. package/index.js +12 -1
  185. package/internals/material/index.d.ts +1 -0
  186. package/internals/plugins/useChartProExport/exportImage.js +1 -1
  187. package/internals/plugins/useChartProZoom/useChartProZoom.js +12 -2
  188. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +358 -0
  189. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +16 -2
  190. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +7 -0
  191. package/models/index.d.ts +1 -1
  192. package/package.json +5 -5
  193. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  194. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -92
  195. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  196. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
  197. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -36
  198. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
  199. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -36
  200. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +0 -12
  201. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +0 -85
  202. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +0 -17
  203. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +0 -13
  204. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +0 -29
  205. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +0 -13
  206. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +0 -29
@@ -32,6 +32,9 @@ const seriesProcessor = params => {
32
32
  const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
33
33
  seriesOrder.forEach(seriesId => {
34
34
  const currentSeries = series[seriesId];
35
+ const firstDataPoint = currentSeries.data.at(0);
36
+ const lastDataPoint = currentSeries.data.at(-1);
37
+ const dataDirection = firstDataPoint !== undefined && lastDataPoint !== undefined && firstDataPoint.value < lastDataPoint.value ? 'increasing' : 'decreasing';
35
38
  completedSeries[seriesId] = (0, _extends2.default)({
36
39
  labelMarkType: 'square',
37
40
  layout: isHorizontal ? 'horizontal' : 'vertical',
@@ -40,6 +43,7 @@ const seriesProcessor = params => {
40
43
  data: currentSeries.data.map((v, i) => (0, _extends2.default)({
41
44
  id: `${seriesId}-funnel-item-${v.id ?? i}`
42
45
  }, v)),
46
+ dataDirection,
43
47
  dataPoints: []
44
48
  });
45
49
  const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
@@ -47,12 +51,54 @@ const seriesProcessor = params => {
47
51
  // Main = main axis, Other = other axis
48
52
  // For horizontal layout, main is y, other is x
49
53
  // For vertical layout, main is x, other is y
54
+ const isIncreasing = completedSeries[seriesId].dataDirection === 'increasing';
50
55
  const currentMaxMain = item.value;
51
- const nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
56
+ const getNextDataIndex = () => {
57
+ if (isIncreasing) {
58
+ return dataIndex === 0 ? dataIndex : dataIndex - 1;
59
+ }
60
+ return dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
61
+ };
62
+ const nextDataIndex = getNextDataIndex();
52
63
  const nextMaxMain = array[nextDataIndex].value ?? 0;
53
64
  const nextMaxOther = 0;
54
65
  const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
55
66
  const stackOffset = stackOffsets[dataIndex];
67
+ if (isIncreasing) {
68
+ return [
69
+ // Top right (vertical) or Top left (horizontal)
70
+ createPoint({
71
+ main: nextMaxMain,
72
+ other: nextMaxOther,
73
+ inverse: isHorizontal,
74
+ useBandWidth: false,
75
+ stackOffset
76
+ }),
77
+ // Bottom right (vertical) or Top right (horizontal)
78
+ createPoint({
79
+ main: currentMaxMain,
80
+ other: currentMaxOther,
81
+ inverse: isHorizontal,
82
+ useBandWidth: true,
83
+ stackOffset
84
+ }),
85
+ // Bottom left (vertical) or Bottom right (horizontal)
86
+ createPoint({
87
+ main: -currentMaxMain,
88
+ other: currentMaxOther,
89
+ inverse: isHorizontal,
90
+ useBandWidth: true,
91
+ stackOffset
92
+ }),
93
+ // Top left (vertical) or Bottom left (horizontal)
94
+ createPoint({
95
+ main: -nextMaxMain,
96
+ other: nextMaxOther,
97
+ inverse: isHorizontal,
98
+ useBandWidth: false,
99
+ stackOffset
100
+ })];
101
+ }
56
102
  return [
57
103
  // Top right (vertical) or Top left (horizontal)
58
104
  createPoint({
@@ -3,6 +3,7 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
3
3
  import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
4
4
  import { ChartsWrapperProps } from '@mui/x-charts/internals';
5
5
  import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
6
+ import { FunnelChartPluginsSignatures } from "./FunnelChart.plugins.js";
6
7
  import { FunnelPlotProps } from "./FunnelPlot.js";
7
8
  import type { FunnelChartProps } from "./FunnelChart.js";
8
9
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
@@ -14,7 +15,7 @@ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
14
15
  * @returns An object with props for the children components of FunnelChart
15
16
  */
16
17
  export declare const useFunnelChartProps: (props: FunnelChartProps) => {
17
- chartContainerProps: ChartContainerProProps<"funnel">;
18
+ chartContainerProps: ChartContainerProProps<"funnel", FunnelChartPluginsSignatures>;
18
19
  funnelPlotProps: FunnelPlotProps;
19
20
  overlayProps: ChartsOverlayProps;
20
21
  chartsAxisProps: ChartsAxisProps;
@@ -12,6 +12,7 @@ var _constants = require("@mui/x-charts/constants");
12
12
  var _internals = require("@mui/x-charts/internals");
13
13
  var _warning = require("@mui/x-internals/warning");
14
14
  var _colorPalettes = require("@mui/x-charts/colorPalettes");
15
+ var _FunnelChart = require("./FunnelChart.plugins");
15
16
  const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef", "gap"];
16
17
  function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
17
18
  const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
@@ -119,7 +120,8 @@ const useFunnelChartProps = props => {
119
120
  highlightedItem,
120
121
  onHighlightChange,
121
122
  className,
122
- apiRef
123
+ apiRef,
124
+ plugins: _FunnelChart.FUNNEL_CHART_PLUGINS
123
125
  });
124
126
  const funnelPlotProps = {
125
127
  gap,
@@ -4,22 +4,30 @@ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
4
4
  import { ChartsTooltipProps } from '@mui/x-charts/ChartsTooltip';
5
5
  import { ChartsAxisSlots, ChartsAxisSlotProps, XAxis, YAxis } from '@mui/x-charts/internals';
6
6
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
7
+ import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
8
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from '@mui/x-charts/Toolbar';
9
+ import { ChartsSlotPropsPro, ChartsSlotsPro } from "../internals/material/index.js";
7
10
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
8
11
  import { HeatmapSeriesType } from "../models/seriesType/heatmap.js";
9
- import { HeatmapTooltipProps } from "./HeatmapTooltip/HeatmapTooltip.js";
12
+ import { HeatmapTooltipProps } from "./HeatmapTooltip/index.js";
10
13
  import { HeatmapItemSlotProps, HeatmapItemSlots } from "./HeatmapItem.js";
11
14
  import { HeatmapPluginsSignatures } from "./Heatmap.plugins.js";
12
- export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots {
15
+ export interface HeatmapSlots extends ChartsAxisSlots, ChartsOverlaySlots, HeatmapItemSlots, ChartsToolbarSlots, Partial<ChartsSlotsPro> {
13
16
  /**
14
- * Custom component for the tooltip popper.
17
+ * Custom component for the tooltip.
15
18
  * @default ChartsTooltipRoot
16
19
  */
17
20
  tooltip?: React.ElementType<HeatmapTooltipProps>;
21
+ /**
22
+ * Custom component for the legend.
23
+ * @default ContinuousColorLegendProps
24
+ */
25
+ legend?: ChartsLegendSlots['legend'];
18
26
  }
19
- export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps {
27
+ export interface HeatmapSlotProps extends ChartsAxisSlotProps, ChartsOverlaySlotProps, HeatmapItemSlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotPropsPro> {
20
28
  tooltip?: Partial<HeatmapTooltipProps>;
21
29
  }
22
- export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
30
+ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', HeatmapPluginsSignatures>, 'series' | 'plugins' | 'xAxis' | 'yAxis' | 'skipAnimation' | 'slots' | 'slotProps'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
23
31
  /**
24
32
  * The configuration of the x-axes.
25
33
  * If not provided, a default axis config is used.
@@ -42,6 +50,11 @@ export interface HeatmapProps extends Omit<ChartContainerProProps<'heatmap', Hea
42
50
  * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
43
51
  */
44
52
  tooltip?: ChartsTooltipProps;
53
+ /**
54
+ * If `true`, the legend is not rendered.
55
+ * @default true
56
+ */
57
+ hideLegend?: boolean;
45
58
  /**
46
59
  * Overridable component slots.
47
60
  * @default {}
@@ -14,14 +14,17 @@ var _styles = require("@mui/material/styles");
14
14
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
15
15
  var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
16
16
  var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
17
+ var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
18
+ var _internals = require("@mui/x-charts/internals");
17
19
  var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
18
20
  var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
19
21
  var _constants = require("@mui/x-charts/constants");
20
- var _ChartContainerPro = require("../ChartContainerPro");
22
+ var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
21
23
  var _HeatmapPlot = require("./HeatmapPlot");
22
24
  var _seriesConfig = require("./seriesConfig");
23
- var _HeatmapTooltip = require("./HeatmapTooltip/HeatmapTooltip");
24
- var _Heatmap = require("./Heatmap.plugins");
25
+ var _HeatmapTooltip = require("./HeatmapTooltip");
26
+ var _Heatmap2 = require("./Heatmap.plugins");
27
+ var _ChartDataProviderPro = require("../ChartDataProviderPro");
25
28
  var _jsxRuntime = require("react/jsx-runtime");
26
29
  // The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
27
30
  const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
@@ -44,6 +47,7 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
44
47
  name: 'MuiHeatmap'
45
48
  });
46
49
  const {
50
+ apiRef,
47
51
  xAxis,
48
52
  yAxis,
49
53
  zAxis,
@@ -60,7 +64,8 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
60
64
  slotProps,
61
65
  loading,
62
66
  highlightedItem,
63
- onHighlightChange
67
+ onHighlightChange,
68
+ hideLegend = true
64
69
  } = props;
65
70
  const id = (0, _useId.default)();
66
71
  const clipPathId = `${id}-clip-path`;
@@ -88,9 +93,14 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
88
93
  color: defaultColorMap
89
94
  }
90
95
  }], [zAxis]);
91
- const Tooltip = props.slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
92
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainerPro.ChartContainerPro, {
93
- ref: ref,
96
+ const chartsWrapperProps = {
97
+ sx,
98
+ legendPosition: props.slotProps?.legend?.position,
99
+ legendDirection: props.slotProps?.legend?.direction
100
+ };
101
+ const Tooltip = slots?.tooltip ?? _HeatmapTooltip.HeatmapTooltip;
102
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProviderPro.ChartDataProviderPro, {
103
+ apiRef: apiRef,
94
104
  seriesConfig: seriesConfig,
95
105
  series: series.map(s => (0, _extends2.default)({
96
106
  type: 'heatmap'
@@ -103,37 +113,60 @@ const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap
103
113
  zAxis: zAxisWithDefault,
104
114
  colors: colors,
105
115
  dataset: dataset,
106
- sx: sx,
107
116
  disableAxisListener: true,
108
117
  highlightedItem: highlightedItem,
109
118
  onHighlightChange: onHighlightChange,
110
119
  onAxisClick: onAxisClick,
111
- plugins: _Heatmap.HEATMAP_PLUGINS,
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
113
- clipPath: `url(#${clipPathId})`,
114
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
115
- slots: slots,
116
- slotProps: slotProps
117
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
118
- loading: loading,
119
- slots: slots,
120
- slotProps: slotProps
121
- })]
122
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
123
- slots: slots,
124
- slotProps: slotProps
125
- }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
126
- id: clipPathId
127
- }), children]
120
+ plugins: _Heatmap2.HEATMAP_PLUGINS,
121
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
122
+ children: [!hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
123
+ slots: (0, _extends2.default)({}, slots, {
124
+ legend: slots?.legend ?? _ChartsLegend.ContinuousColorLegend
125
+ }),
126
+ slotProps: {
127
+ legend: (0, _extends2.default)({
128
+ labelPosition: 'extremes'
129
+ }, slotProps?.legend)
130
+ },
131
+ sx: slotProps?.legend?.direction === 'vertical' ? {
132
+ height: 150
133
+ } : {
134
+ width: '50%'
135
+ }
136
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
137
+ ref: ref,
138
+ sx: sx,
139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
140
+ clipPath: `url(#${clipPathId})`,
141
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
142
+ slots: slots,
143
+ slotProps: slotProps
144
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
145
+ loading: loading,
146
+ slots: slots,
147
+ slotProps: slotProps
148
+ })]
149
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
150
+ slots: slots,
151
+ slotProps: slotProps
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
153
+ id: clipPathId
154
+ }), children]
155
+ }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps?.tooltip))]
156
+ }))
128
157
  });
129
158
  });
159
+ if (process.env.NODE_ENV !== "production") Heatmap.displayName = "Heatmap";
130
160
  process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
131
161
  // ----------------------------- Warning --------------------------------
132
162
  // | These PropTypes are generated from the TypeScript type definitions |
133
163
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
134
164
  // ----------------------------------------------------------------------
135
165
  apiRef: _propTypes.default.shape({
136
- current: _propTypes.default.object
166
+ current: _propTypes.default.shape({
167
+ exportAsImage: _propTypes.default.func.isRequired,
168
+ exportAsPrint: _propTypes.default.func.isRequired
169
+ })
137
170
  }),
138
171
  className: _propTypes.default.string,
139
172
  /**
@@ -156,6 +189,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
156
189
  * The height of the chart in px. If not defined, it takes the height of the parent element.
157
190
  */
158
191
  height: _propTypes.default.number,
192
+ /**
193
+ * If `true`, the legend is not rendered.
194
+ * @default true
195
+ */
196
+ hideLegend: _propTypes.default.bool,
159
197
  /**
160
198
  * The highlighted item.
161
199
  * Used when the highlight is controlled.
@@ -1,3 +1,4 @@
1
1
  import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
2
- export type HeatmapPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartInteractionSignature, UseChartHighlightSignature];
2
+ import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
3
+ export type HeatmapPluginsSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'heatmap'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProExportSignature];
3
4
  export declare const HEATMAP_PLUGINS: ConvertSignaturesIntoPlugins<HeatmapPluginsSignatures>;
@@ -5,4 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.HEATMAP_PLUGINS = void 0;
7
7
  var _internals = require("@mui/x-charts/internals");
8
- const HEATMAP_PLUGINS = exports.HEATMAP_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight];
8
+ var _useChartProExport = require("../internals/plugins/useChartProExport");
9
+ const HEATMAP_PLUGINS = exports.HEATMAP_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProExport.useChartProExport];
@@ -0,0 +1,2 @@
1
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
2
+ export declare const useUtilityClasses: (props: Pick<HeatmapTooltipProps, "classes">) => Record<"mark" | "table" | "cell" | "row" | "root" | "paper" | "markContainer" | "labelCell" | "valueCell", string>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useUtilityClasses = void 0;
8
+ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
9
+ var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
10
+ const useUtilityClasses = props => {
11
+ const {
12
+ classes
13
+ } = props;
14
+ const slots = {
15
+ root: ['root'],
16
+ paper: ['paper'],
17
+ table: ['table'],
18
+ row: ['row'],
19
+ cell: ['cell'],
20
+ mark: ['mark'],
21
+ markContainer: ['markContainer'],
22
+ labelCell: ['labelCell'],
23
+ valueCell: ['valueCell']
24
+ };
25
+ return (0, _composeClasses.default)(slots, _ChartsTooltip.getChartsTooltipUtilityClass, classes);
26
+ };
27
+ exports.useUtilityClasses = useUtilityClasses;
@@ -1,14 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
3
- export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
4
- /**
5
- * Select the kind of tooltip to display
6
- * - 'item': Shows data about the item below the mouse.
7
- * - 'none': Does not display tooltip
8
- * @default 'item'
9
- */
10
- trigger?: 'item' | 'none';
11
- }
2
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
12
3
  declare function HeatmapTooltip(props: HeatmapTooltipProps): React.JSX.Element;
13
4
  declare namespace HeatmapTooltip {
14
5
  var propTypes: any;
@@ -10,118 +10,20 @@ exports.HeatmapTooltip = HeatmapTooltip;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _clsx = _interopRequireDefault(require("clsx"));
14
13
  var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
15
- var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
16
14
  var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
17
- var _hooks = require("@mui/x-charts/hooks");
18
- var _internals = require("@mui/x-charts/internals");
19
- var _useHeatmapSeries = require("../../hooks/useHeatmapSeries");
20
- var _HeatmapTooltipAxesValue = require("./HeatmapTooltipAxesValue");
15
+ var _HeatmapTooltipContent = require("./HeatmapTooltipContent");
16
+ var _HeatmapTooltip = require("./HeatmapTooltip.classes");
21
17
  var _jsxRuntime = require("react/jsx-runtime");
22
- const useUtilityClasses = props => {
23
- const {
24
- classes
25
- } = props;
26
- const slots = {
27
- root: ['root'],
28
- paper: ['paper'],
29
- table: ['table'],
30
- row: ['row'],
31
- cell: ['cell'],
32
- mark: ['mark'],
33
- markContainer: ['markContainer'],
34
- labelCell: ['labelCell'],
35
- valueCell: ['valueCell']
36
- };
37
- return (0, _composeClasses.default)(slots, _ChartsTooltip.getChartsTooltipUtilityClass, classes);
38
- };
39
- function DefaultHeatmapTooltipContent(props) {
40
- const classes = useUtilityClasses(props);
41
- const xAxis = (0, _hooks.useXAxis)();
42
- const yAxis = (0, _hooks.useYAxis)();
43
- const heatmapSeries = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
44
- const tooltipData = (0, _ChartsTooltip.useItemTooltip)();
45
- if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
46
- return null;
47
- }
48
- const {
49
- series,
50
- seriesOrder
51
- } = heatmapSeries;
52
- const seriesId = seriesOrder[0];
53
- const {
54
- color,
55
- value,
56
- identifier,
57
- markType
58
- } = tooltipData;
59
- const [xIndex, yIndex] = value;
60
- const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
61
- location: 'tooltip',
62
- scale: xAxis.scale
63
- }) ?? xAxis.data[xIndex].toLocaleString();
64
- const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
65
- location: 'tooltip',
66
- scale: yAxis.scale
67
- }) ?? yAxis.data[yIndex].toLocaleString();
68
- const formattedValue = series[seriesId].valueFormatter(value, {
69
- dataIndex: identifier.dataIndex
70
- });
71
- const seriesLabel = (0, _internals.getLabel)(series[seriesId].label, 'tooltip');
72
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipPaper, {
73
- className: classes.paper,
74
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipTable, {
75
- className: classes.table,
76
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_HeatmapTooltipAxesValue.HeatmapTooltipAxesValue, {
77
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
78
- children: formattedX
79
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
80
- children: formattedY
81
- })]
82
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipRow, {
84
- className: classes.row,
85
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipCell, {
86
- className: (0, _clsx.default)(classes.labelCell, classes.cell),
87
- component: "th",
88
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
- className: classes.markContainer,
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.ChartsLabelMark, {
91
- type: markType,
92
- color: color,
93
- className: classes.mark
94
- })
95
- }), seriesLabel]
96
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipCell, {
97
- className: (0, _clsx.default)(classes.valueCell, classes.cell),
98
- component: "td",
99
- children: formattedValue
100
- })]
101
- })
102
- })]
103
- })
104
- });
105
- }
106
- process.env.NODE_ENV !== "production" ? DefaultHeatmapTooltipContent.propTypes = {
107
- // ----------------------------- Warning --------------------------------
108
- // | These PropTypes are generated from the TypeScript type definitions |
109
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
110
- // ----------------------------------------------------------------------
111
- /**
112
- * Override or extend the styles applied to the component.
113
- */
114
- classes: _propTypes.default.object
115
- } : void 0;
116
18
  function HeatmapTooltip(props) {
117
- const classes = useUtilityClasses({
19
+ const classes = (0, _HeatmapTooltip.useUtilityClasses)({
118
20
  classes: props.classes
119
21
  });
120
22
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipContainer, (0, _extends2.default)({
121
23
  trigger: "item"
122
24
  }, props, {
123
25
  classes: classes,
124
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DefaultHeatmapTooltipContent, {
26
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapTooltipContent.HeatmapTooltipContent, {
125
27
  classes: classes
126
28
  })
127
29
  }));
@@ -0,0 +1,10 @@
1
+ import { ChartsTooltipContainerProps } from '@mui/x-charts/ChartsTooltip';
2
+ export interface HeatmapTooltipProps extends Omit<ChartsTooltipContainerProps, 'trigger' | 'children'> {
3
+ /**
4
+ * Select the kind of tooltip to display
5
+ * - 'item': Shows data about the item below the mouse.
6
+ * - 'none': Does not display tooltip
7
+ * @default 'item'
8
+ */
9
+ trigger?: 'item' | 'none';
10
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
3
+ export interface HeatmapTooltipContentProps extends Pick<HeatmapTooltipProps, 'classes'> {}
4
+ export declare function HeatmapTooltipContent(props: HeatmapTooltipContentProps): React.JSX.Element | null;
5
+ export declare namespace HeatmapTooltipContent {
6
+ var propTypes: any;
7
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.HeatmapTooltipContent = HeatmapTooltipContent;
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _clsx = _interopRequireDefault(require("clsx"));
13
+ var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
14
+ var _hooks = require("@mui/x-charts/hooks");
15
+ var _internals = require("@mui/x-charts/internals");
16
+ var _useHeatmapSeries = require("../../hooks/useHeatmapSeries");
17
+ var _HeatmapTooltipAxesValue = require("./HeatmapTooltipAxesValue");
18
+ var _HeatmapTooltip = require("./HeatmapTooltip.classes");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
+ function HeatmapTooltipContent(props) {
21
+ const classes = (0, _HeatmapTooltip.useUtilityClasses)(props);
22
+ const xAxis = (0, _hooks.useXAxis)();
23
+ const yAxis = (0, _hooks.useYAxis)();
24
+ const heatmapSeries = (0, _useHeatmapSeries.useHeatmapSeriesContext)();
25
+ const tooltipData = (0, _ChartsTooltip.useItemTooltip)();
26
+ if (!tooltipData || !heatmapSeries || heatmapSeries.seriesOrder.length === 0) {
27
+ return null;
28
+ }
29
+ const {
30
+ series,
31
+ seriesOrder
32
+ } = heatmapSeries;
33
+ const seriesId = seriesOrder[0];
34
+ const {
35
+ color,
36
+ value,
37
+ identifier,
38
+ markType
39
+ } = tooltipData;
40
+ const [xIndex, yIndex] = value;
41
+ const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
42
+ location: 'tooltip',
43
+ scale: xAxis.scale
44
+ }) ?? xAxis.data[xIndex].toLocaleString();
45
+ const formattedY = yAxis.valueFormatter?.(yAxis.data[yIndex], {
46
+ location: 'tooltip',
47
+ scale: yAxis.scale
48
+ }) ?? yAxis.data[yIndex].toLocaleString();
49
+ const formattedValue = series[seriesId].valueFormatter(value, {
50
+ dataIndex: identifier.dataIndex
51
+ });
52
+ const seriesLabel = (0, _internals.getLabel)(series[seriesId].label, 'tooltip');
53
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipPaper, {
54
+ className: classes.paper,
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipTable, {
56
+ className: classes.table,
57
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_HeatmapTooltipAxesValue.HeatmapTooltipAxesValue, {
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
59
+ children: formattedX
60
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
61
+ children: formattedY
62
+ })]
63
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
64
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipRow, {
65
+ className: classes.row,
66
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsTooltip.ChartsTooltipCell, {
67
+ className: (0, _clsx.default)(classes.labelCell, classes.cell),
68
+ component: "th",
69
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
70
+ className: classes.markContainer,
71
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.ChartsLabelMark, {
72
+ type: markType,
73
+ color: color,
74
+ className: classes.mark
75
+ })
76
+ }), seriesLabel]
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltipCell, {
78
+ className: (0, _clsx.default)(classes.valueCell, classes.cell),
79
+ component: "td",
80
+ children: formattedValue
81
+ })]
82
+ })
83
+ })]
84
+ })
85
+ });
86
+ }
87
+ process.env.NODE_ENV !== "production" ? HeatmapTooltipContent.propTypes = {
88
+ // ----------------------------- Warning --------------------------------
89
+ // | These PropTypes are generated from the TypeScript type definitions |
90
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
91
+ // ----------------------------------------------------------------------
92
+ /**
93
+ * Override or extend the styles applied to the component.
94
+ */
95
+ classes: _propTypes.default.object
96
+ } : void 0;
@@ -1 +1,3 @@
1
- export * from "./HeatmapTooltip.js";
1
+ export * from "./HeatmapTooltip.js";
2
+ export * from "./HeatmapTooltipContent.js";
3
+ export type { HeatmapTooltipProps } from "./HeatmapTooltip.types.js";
@@ -13,4 +13,15 @@ Object.keys(_HeatmapTooltip).forEach(function (key) {
13
13
  return _HeatmapTooltip[key];
14
14
  }
15
15
  });
16
+ });
17
+ var _HeatmapTooltipContent = require("./HeatmapTooltipContent");
18
+ Object.keys(_HeatmapTooltipContent).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _HeatmapTooltipContent[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _HeatmapTooltipContent[key];
25
+ }
26
+ });
16
27
  });