@mui/x-charts 8.4.0 → 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 (148) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +8 -1
  3. package/BarChart/useBarChartProps.js +1 -1
  4. package/CHANGELOG.md +103 -0
  5. package/ChartContainer/ChartContainer.d.ts +21 -2
  6. package/ChartContainer/ChartContainer.js +16 -0
  7. package/ChartContainer/useChartContainerProps.js +7 -3
  8. package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  9. package/ChartDataProvider/ChartDataProvider.js +19 -2
  10. package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  11. package/ChartDataProvider/useChartDataProviderProps.js +7 -3
  12. package/LineChart/LineChart.d.ts +9 -2
  13. package/LineChart/LineChart.js +8 -1
  14. package/LineChart/useLineChartProps.js +1 -1
  15. package/PieChart/PieChart.d.ts +10 -3
  16. package/PieChart/PieChart.js +11 -3
  17. package/RadarChart/RadarChart.d.ts +21 -3
  18. package/RadarChart/RadarChart.js +17 -2
  19. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  20. package/RadarChart/RadarChart.plugins.js +10 -0
  21. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  22. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  23. package/RadarChart/index.d.ts +2 -0
  24. package/RadarChart/index.js +15 -1
  25. package/RadarChart/useRadarChartProps.d.ts +2 -1
  26. package/RadarChart/useRadarChartProps.js +3 -1
  27. package/ScatterChart/ScatterChart.d.ts +9 -2
  28. package/ScatterChart/ScatterChart.js +8 -1
  29. package/ScatterChart/useScatterChartProps.js +4 -2
  30. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  31. package/Toolbar/Toolbar.d.ts +9 -3
  32. package/Toolbar/Toolbar.js +23 -7
  33. package/Toolbar/Toolbar.types.d.ts +15 -0
  34. package/Toolbar/Toolbar.types.js +5 -0
  35. package/Toolbar/ToolbarButton.d.ts +8 -2
  36. package/Toolbar/ToolbarButton.js +24 -6
  37. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  38. package/Toolbar/chartToolbarClasses.js +9 -0
  39. package/Toolbar/index.d.ts +3 -1
  40. package/Toolbar/index.js +22 -0
  41. package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  42. package/Toolbar/internals/ChartsToolbar.js +14 -0
  43. package/context/ChartsSlotsContext.d.ts +20 -0
  44. package/context/ChartsSlotsContext.js +44 -0
  45. package/context/index.d.ts +2 -1
  46. package/context/index.js +11 -0
  47. package/context/useChartApiContext.d.ts +10 -0
  48. package/context/useChartApiContext.js +27 -0
  49. package/esm/BarChart/BarChart.d.ts +9 -2
  50. package/esm/BarChart/BarChart.js +8 -1
  51. package/esm/BarChart/useBarChartProps.js +1 -1
  52. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  53. package/esm/ChartContainer/ChartContainer.js +16 -0
  54. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  55. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  56. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  57. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  58. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  59. package/esm/LineChart/LineChart.d.ts +9 -2
  60. package/esm/LineChart/LineChart.js +8 -1
  61. package/esm/LineChart/useLineChartProps.js +1 -1
  62. package/esm/PieChart/PieChart.d.ts +10 -3
  63. package/esm/PieChart/PieChart.js +11 -3
  64. package/esm/RadarChart/RadarChart.d.ts +21 -3
  65. package/esm/RadarChart/RadarChart.js +17 -2
  66. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  67. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  68. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  69. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  70. package/esm/RadarChart/index.d.ts +2 -0
  71. package/esm/RadarChart/index.js +2 -0
  72. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  73. package/esm/RadarChart/useRadarChartProps.js +3 -1
  74. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  75. package/esm/ScatterChart/ScatterChart.js +8 -1
  76. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  77. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  78. package/esm/Toolbar/Toolbar.d.ts +9 -3
  79. package/esm/Toolbar/Toolbar.js +22 -7
  80. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  81. package/esm/Toolbar/Toolbar.types.js +1 -0
  82. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  83. package/esm/Toolbar/ToolbarButton.js +23 -5
  84. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  85. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  86. package/esm/Toolbar/index.d.ts +3 -1
  87. package/esm/Toolbar/index.js +3 -1
  88. package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  89. package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
  90. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  91. package/esm/context/ChartsSlotsContext.js +35 -0
  92. package/esm/context/index.d.ts +2 -1
  93. package/esm/context/index.js +1 -0
  94. package/esm/context/useChartApiContext.d.ts +10 -0
  95. package/esm/context/useChartApiContext.js +21 -0
  96. package/esm/hooks/index.d.ts +1 -0
  97. package/esm/hooks/index.js +1 -0
  98. package/esm/index.js +1 -1
  99. package/esm/internals/constants.d.ts +3 -1
  100. package/esm/internals/constants.js +2 -1
  101. package/esm/internals/dateHelpers.d.ts +15 -0
  102. package/esm/internals/dateHelpers.js +20 -0
  103. package/esm/internals/domUtils.d.ts +1 -2
  104. package/esm/internals/domUtils.js +8 -19
  105. package/esm/internals/index.d.ts +4 -1
  106. package/esm/internals/index.js +4 -1
  107. package/esm/internals/material/index.d.ts +2 -0
  108. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  109. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  110. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  111. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  112. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  113. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  114. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
  115. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  116. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  117. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  118. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  119. package/esm/models/index.d.ts +2 -2
  120. package/esm/models/index.js +1 -0
  121. package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
  122. package/hooks/index.d.ts +1 -0
  123. package/hooks/index.js +12 -0
  124. package/index.js +1 -1
  125. package/internals/constants.d.ts +3 -1
  126. package/internals/constants.js +3 -2
  127. package/internals/dateHelpers.d.ts +15 -0
  128. package/internals/dateHelpers.js +28 -0
  129. package/internals/domUtils.d.ts +1 -2
  130. package/internals/domUtils.js +8 -20
  131. package/internals/index.d.ts +4 -1
  132. package/internals/index.js +44 -8
  133. package/internals/material/index.d.ts +2 -0
  134. package/internals/plugins/allPlugins.d.ts +1 -0
  135. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  136. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  137. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  138. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  139. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  140. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
  141. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  142. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  143. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  144. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  145. package/models/index.d.ts +2 -2
  146. package/models/index.js +11 -0
  147. package/models/slots/chartsBaseSlotProps.d.ts +1 -0
  148. package/package.json +2 -2
@@ -10,4 +10,5 @@ export type ChartBaseIconProps = ChartBaseCommonProps<SVGSVGElement> & {
10
10
  };
11
11
  export type ChartBaseIconButtonProps = ChartBaseCommonProps & {
12
12
  ref?: React.Ref<HTMLButtonElement>;
13
+ disabled?: boolean;
13
14
  };
package/hooks/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./useScatterSeries.js";
10
10
  export * from "./usePieSeries.js";
11
11
  export * from "./useBarSeries.js";
12
12
  export * from "./useLineSeries.js";
13
+ export * from "./useRadarSeries.js";
13
14
  export * from "./useItemHighlighted.js";
14
15
  export * from "./useItemHighlightedGetter.js";
15
16
  export * from "./useLegend.js";
package/hooks/index.js CHANGED
@@ -163,6 +163,18 @@ Object.keys(_useLineSeries).forEach(function (key) {
163
163
  }
164
164
  });
165
165
  });
166
+ var _useRadarSeries = require("./useRadarSeries");
167
+ Object.keys(_useRadarSeries).forEach(function (key) {
168
+ if (key === "default" || key === "__esModule") return;
169
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
170
+ if (key in exports && exports[key] === _useRadarSeries[key]) return;
171
+ Object.defineProperty(exports, key, {
172
+ enumerable: true,
173
+ get: function () {
174
+ return _useRadarSeries[key];
175
+ }
176
+ });
177
+ });
166
178
  var _useItemHighlighted = require("./useItemHighlighted");
167
179
  Object.keys(_useItemHighlighted).forEach(function (key) {
168
180
  if (key === "default" || key === "__esModule") return;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.4.0
2
+ * @mui/x-charts v8.5.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,6 @@
1
+ import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/zoom.types.js";
1
2
  /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
2
3
  export declare const ZOOM_SLIDER_MARGIN = 4;
3
4
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
4
- export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
5
+ export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
6
+ export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = void 0;
6
+ exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = void 0;
7
7
  /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
8
8
  const ZOOM_SLIDER_MARGIN = exports.ZOOM_SLIDER_MARGIN = 4;
9
9
 
10
10
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
11
- const DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
11
+ const DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
12
+ const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
@@ -0,0 +1,15 @@
1
+ import { AxisConfig } from "../models/index.js";
2
+ import { ChartsAxisProps } from "../models/axis.js";
3
+ /**
4
+ * Checks if the provided data array contains Date objects.
5
+ * @param data The data array to check.
6
+ * @returns A type predicate indicating if the data is an array of Date objects.
7
+ */
8
+ export declare const isDateData: (data?: readonly any[]) => data is Date[];
9
+ /**
10
+ * Creates a formatter function for date values.
11
+ * @param axis The axis configuration.
12
+ * @param range The range for the time scale.
13
+ * @returns A formatter function for date values.
14
+ */
15
+ export declare function createDateFormatter(axis: AxisConfig<'band' | 'point', any, ChartsAxisProps>, range: number[]): AxisConfig<'band' | 'point', any, ChartsAxisProps>['valueFormatter'];
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createDateFormatter = createDateFormatter;
7
+ exports.isDateData = void 0;
8
+ var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
9
+ /**
10
+ * Checks if the provided data array contains Date objects.
11
+ * @param data The data array to check.
12
+ * @returns A type predicate indicating if the data is an array of Date objects.
13
+ */
14
+ const isDateData = data => data?.[0] instanceof Date;
15
+
16
+ /**
17
+ * Creates a formatter function for date values.
18
+ * @param axis The axis configuration.
19
+ * @param range The range for the time scale.
20
+ * @returns A formatter function for date values.
21
+ */
22
+ exports.isDateData = isDateData;
23
+ function createDateFormatter(axis, range) {
24
+ const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
25
+ return (v, {
26
+ location
27
+ }) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
28
+ }
@@ -14,5 +14,4 @@ export declare const getStyleString: (style: React.CSSProperties) => string;
14
14
  export declare const getStringSize: (text: string | number, style?: React.CSSProperties) => {
15
15
  width: number;
16
16
  height: number;
17
- };
18
- export declare function unstable_cleanupDOM(): void;
17
+ };
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getStyleString = exports.getStringSize = exports.MEASUREMENT_SPAN_ID = void 0;
8
- exports.unstable_cleanupDOM = unstable_cleanupDOM;
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
9
  // DOM utils taken from
11
10
  // https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
@@ -13,10 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
12
  function isSsr() {
14
13
  return typeof window === 'undefined';
15
14
  }
16
- const stringCache = {
17
- widthCache: {},
18
- cacheCount: 0
19
- };
15
+ const stringCache = new Map();
20
16
  const MAX_CACHE_NUM = 2000;
21
17
  const SPAN_STYLE = {
22
18
  position: 'absolute',
@@ -84,8 +80,9 @@ const getStringSize = (text, style = {}) => {
84
80
  const str = `${text}`;
85
81
  const styleString = getStyleString(style);
86
82
  const cacheKey = `${str}-${styleString}`;
87
- if (stringCache.widthCache[cacheKey]) {
88
- return stringCache.widthCache[cacheKey];
83
+ const size = stringCache.get(cacheKey);
84
+ if (size) {
85
+ return size;
89
86
  }
90
87
  try {
91
88
  let measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
@@ -108,12 +105,9 @@ const getStringSize = (text, style = {}) => {
108
105
  width: rect.width,
109
106
  height: rect.height
110
107
  };
111
- stringCache.widthCache[cacheKey] = result;
112
- if (stringCache.cacheCount + 1 > MAX_CACHE_NUM) {
113
- stringCache.cacheCount = 0;
114
- stringCache.widthCache = {};
115
- } else {
116
- stringCache.cacheCount += 1;
108
+ stringCache.set(cacheKey, result);
109
+ if (stringCache.size + 1 > MAX_CACHE_NUM) {
110
+ stringCache.clear();
117
111
  }
118
112
  if (process.env.NODE_ENV === 'test') {
119
113
  // In test environment, we clean the measurement span immediately
@@ -135,10 +129,4 @@ const getStringSize = (text, style = {}) => {
135
129
  };
136
130
  }
137
131
  };
138
-
139
- // eslint-disable-next-line @typescript-eslint/naming-convention
140
- exports.getStringSize = getStringSize;
141
- function unstable_cleanupDOM() {
142
- // const measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
143
- // measurementSpan?.remove();
144
- }
132
+ exports.getStringSize = getStringSize;
@@ -7,6 +7,7 @@ export { useDrawingArea } from "../hooks/useDrawingArea.js";
7
7
  export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
8
8
  export { useLineChartProps } from "../LineChart/useLineChartProps.js";
9
9
  export { useBarChartProps } from "../BarChart/useBarChartProps.js";
10
+ export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
10
11
  export * from "../ChartContainer/useChartContainerProps.js";
11
12
  export * from "../ChartDataProvider/useChartDataProviderProps.js";
12
13
  export * from "./createSeriesSelectorOfType.js";
@@ -26,20 +27,22 @@ export * from "./store/useSelector.js";
26
27
  export * from "../BarChart/BarChart.plugins.js";
27
28
  export * from "../LineChart/LineChart.plugins.js";
28
29
  export * from "../ScatterChart/ScatterChart.plugins.js";
30
+ export * from "../RadarChart/RadarChart.plugins.js";
29
31
  export * from "./defaultizeValueFormatter.js";
30
32
  export * from "./configInit.js";
31
33
  export * from "./getLabel.js";
32
34
  export * from "./getSVGPoint.js";
33
35
  export * from "./isDefined.js";
34
- export { unstable_cleanupDOM } from "./domUtils.js";
35
36
  export * from "./getScale.js";
36
37
  export * from "./stackSeries.js";
37
38
  export * from "./getCurve.js";
38
39
  export * from "./consumeSlots.js";
39
40
  export * from "./consumeThemeProps.js";
40
41
  export * from "./defaultizeMargin.js";
42
+ export * from "./dateHelpers.js";
41
43
  export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
42
44
  export * from "../context/ChartProvider/index.js";
45
+ export * from "../context/ChartsSlotsContext.js";
43
46
  export * from "../models/seriesType/config.js";
44
47
  export * from "../models/seriesType/common.js";
45
48
  export * from "../models/z-axis.js";
@@ -10,7 +10,7 @@ var _exportNames = {
10
10
  useScatterChartProps: true,
11
11
  useLineChartProps: true,
12
12
  useBarChartProps: true,
13
- unstable_cleanupDOM: true,
13
+ useRadarChartProps: true,
14
14
  getAxisExtremum: true
15
15
  };
16
16
  Object.defineProperty(exports, "getAxisExtremum", {
@@ -19,12 +19,6 @@ Object.defineProperty(exports, "getAxisExtremum", {
19
19
  return _getAxisExtremum.getAxisExtremum;
20
20
  }
21
21
  });
22
- Object.defineProperty(exports, "unstable_cleanupDOM", {
23
- enumerable: true,
24
- get: function () {
25
- return _domUtils.unstable_cleanupDOM;
26
- }
27
- });
28
22
  Object.defineProperty(exports, "useBarChartProps", {
29
23
  enumerable: true,
30
24
  get: function () {
@@ -49,6 +43,12 @@ Object.defineProperty(exports, "useLineChartProps", {
49
43
  return _useLineChartProps.useLineChartProps;
50
44
  }
51
45
  });
46
+ Object.defineProperty(exports, "useRadarChartProps", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _useRadarChartProps.useRadarChartProps;
50
+ }
51
+ });
52
52
  Object.defineProperty(exports, "useScatterChartProps", {
53
53
  enumerable: true,
54
54
  get: function () {
@@ -103,6 +103,7 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
103
103
  var _useScatterChartProps = require("../ScatterChart/useScatterChartProps");
104
104
  var _useLineChartProps = require("../LineChart/useLineChartProps");
105
105
  var _useBarChartProps = require("../BarChart/useBarChartProps");
106
+ var _useRadarChartProps = require("../RadarChart/useRadarChartProps");
106
107
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
107
108
  Object.keys(_useChartContainerProps).forEach(function (key) {
108
109
  if (key === "default" || key === "__esModule") return;
@@ -331,6 +332,18 @@ Object.keys(_ScatterChart).forEach(function (key) {
331
332
  }
332
333
  });
333
334
  });
335
+ var _RadarChart = require("../RadarChart/RadarChart.plugins");
336
+ Object.keys(_RadarChart).forEach(function (key) {
337
+ if (key === "default" || key === "__esModule") return;
338
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
339
+ if (key in exports && exports[key] === _RadarChart[key]) return;
340
+ Object.defineProperty(exports, key, {
341
+ enumerable: true,
342
+ get: function () {
343
+ return _RadarChart[key];
344
+ }
345
+ });
346
+ });
334
347
  var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
335
348
  Object.keys(_defaultizeValueFormatter).forEach(function (key) {
336
349
  if (key === "default" || key === "__esModule") return;
@@ -391,7 +404,6 @@ Object.keys(_isDefined).forEach(function (key) {
391
404
  }
392
405
  });
393
406
  });
394
- var _domUtils = require("./domUtils");
395
407
  var _getScale = require("./getScale");
396
408
  Object.keys(_getScale).forEach(function (key) {
397
409
  if (key === "default" || key === "__esModule") return;
@@ -464,6 +476,18 @@ Object.keys(_defaultizeMargin).forEach(function (key) {
464
476
  }
465
477
  });
466
478
  });
479
+ var _dateHelpers = require("./dateHelpers");
480
+ Object.keys(_dateHelpers).forEach(function (key) {
481
+ if (key === "default" || key === "__esModule") return;
482
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
483
+ if (key in exports && exports[key] === _dateHelpers[key]) return;
484
+ Object.defineProperty(exports, key, {
485
+ enumerable: true,
486
+ get: function () {
487
+ return _dateHelpers[key];
488
+ }
489
+ });
490
+ });
467
491
  var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
468
492
  var _ChartProvider = require("../context/ChartProvider");
469
493
  Object.keys(_ChartProvider).forEach(function (key) {
@@ -477,6 +501,18 @@ Object.keys(_ChartProvider).forEach(function (key) {
477
501
  }
478
502
  });
479
503
  });
504
+ var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
505
+ Object.keys(_ChartsSlotsContext).forEach(function (key) {
506
+ if (key === "default" || key === "__esModule") return;
507
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
508
+ if (key in exports && exports[key] === _ChartsSlotsContext[key]) return;
509
+ Object.defineProperty(exports, key, {
510
+ enumerable: true,
511
+ get: function () {
512
+ return _ChartsSlotsContext[key];
513
+ }
514
+ });
515
+ });
480
516
  var _config = require("../models/seriesType/config");
481
517
  Object.keys(_config).forEach(function (key) {
482
518
  if (key === "default" || key === "__esModule") return;
@@ -1,4 +1,6 @@
1
+ import type * as React from 'react';
1
2
  import { ChartsBaseSlots } from "../../models/slots/chartsBaseSlots.js";
2
3
  import { ChartsIconSlots } from "../../models/slots/chartsIconSlots.js";
3
4
  export type ChartsSlots = ChartsBaseSlots & ChartsIconSlots;
5
+ export type ChartsSlotProps = { [key in keyof ChartsSlots]: React.ComponentProps<ChartsSlots[key]> };
4
6
  export declare const defaultSlotsMaterial: ChartsSlots;
@@ -6,4 +6,5 @@ import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/i
6
6
  import { UseChartVoronoiSignature } from "./featurePlugins/useChartVoronoi/index.js";
7
7
  import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
8
8
  export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
9
+ export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
9
10
  export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVoronoiSignature>];
@@ -11,6 +11,7 @@ var _axis = require("../../../../models/axis");
11
11
  var _colorScale = require("../../../colorScale");
12
12
  var _ticks = require("../../../ticks");
13
13
  var _getScale = require("../../../getScale");
14
+ var _dateHelpers = require("../../../dateHelpers");
14
15
  var _zoom = require("./zoom");
15
16
  var _getAxisExtremum = require("./getAxisExtremum");
16
17
  var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
@@ -20,13 +21,6 @@ axis) {
20
21
  const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
21
22
  return axis.reverse ? [range[1], range[0]] : range;
22
23
  }
23
- const isDateData = data => data?.[0] instanceof Date;
24
- function createDateFormatter(axis, range) {
25
- const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
26
- return (v, {
27
- location
28
- }) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
29
- }
30
24
  const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
31
25
  const DEFAULT_BAR_GAP_RATIO = 0.1;
32
26
  function computeAxisValue({
@@ -77,8 +71,8 @@ function computeAxisValue({
77
71
  values: axis.data
78
72
  }, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
79
73
  });
80
- if (isDateData(axis.data)) {
81
- const dateFormatter = createDateFormatter(axis, scaleRange);
74
+ if ((0, _dateHelpers.isDateData)(axis.data)) {
75
+ const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
82
76
  completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
83
77
  }
84
78
  }
@@ -97,8 +91,8 @@ function computeAxisValue({
97
91
  values: axis.data
98
92
  }, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
99
93
  });
100
- if (isDateData(axis.data)) {
101
- const dateFormatter = createDateFormatter(axis, scaleRange);
94
+ if ((0, _dateHelpers.isDateData)(axis.data)) {
95
+ const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
102
96
  completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
103
97
  }
104
98
  }
@@ -1,4 +1,18 @@
1
1
  import { AxisId } from "../../../../models/axis.js";
2
2
  import { DefaultizedZoomOptions } from "./useChartCartesianAxis.types.js";
3
3
  import { ZoomOptions } from "./zoom.types.js";
4
+ export declare const defaultZoomOptions: {
5
+ minStart: number;
6
+ maxEnd: number;
7
+ step: number;
8
+ minSpan: number;
9
+ maxSpan: number;
10
+ panning: true;
11
+ filterMode: "keep";
12
+ slider: {
13
+ enabled: false;
14
+ size: number;
15
+ showTooltip: import("./zoom.types.js").ZoomSliderShowTooltip;
16
+ };
17
+ };
4
18
  export declare const defaultizeZoom: (zoom: boolean | ZoomOptions | undefined, axisId: AxisId, axisDirection: "x" | "y") => DefaultizedZoomOptions | undefined;
@@ -4,10 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.defaultizeZoom = void 0;
7
+ exports.defaultizeZoom = exports.defaultZoomOptions = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _constants = require("../../../constants");
10
- const defaultZoomOptions = {
10
+ const defaultZoomOptions = exports.defaultZoomOptions = {
11
11
  minStart: 0,
12
12
  maxEnd: 100,
13
13
  step: 5,
@@ -17,7 +17,8 @@ const defaultZoomOptions = {
17
17
  filterMode: 'keep',
18
18
  slider: {
19
19
  enabled: false,
20
- size: _constants.DEFAULT_ZOOM_SLIDER_SIZE
20
+ size: _constants.DEFAULT_ZOOM_SLIDER_SIZE,
21
+ showTooltip: _constants.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
21
22
  }
22
23
  };
23
24
  const defaultizeZoom = (zoom, axisId, axisDirection) => {
@@ -2,7 +2,7 @@ import type { ChartPluginSignature } from "../../models/index.js";
2
2
  import type { ChartSeriesType, DatasetType } from "../../../../models/seriesType/config.js";
3
3
  import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
4
4
  import type { UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
5
- import type { ZoomData, ZoomOptions } from "./zoom.types.js";
5
+ import type { ZoomData, ZoomOptions, ZoomSliderShowTooltip } from "./zoom.types.js";
6
6
  import type { UseChartInteractionSignature } from "../useChartInteraction/index.js";
7
7
  import type { ChartsAxisProps } from "../../../../ChartsAxis/index.js";
8
8
  /**
@@ -47,10 +47,13 @@ export type UseChartCartesianAxisDefaultizedParameters<S extends ScaleName = Sca
47
47
  defaultizedXAxis: DefaultedXAxis<S>[];
48
48
  defaultizedYAxis: DefaultedYAxis<S>[];
49
49
  };
50
+ export interface DefaultedZoomSliderOptions extends Omit<NonNullable<Required<ZoomOptions['slider']>>, 'showTooltip'> {
51
+ showTooltip: ZoomSliderShowTooltip;
52
+ }
50
53
  export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slider'>> {
51
54
  axisId: AxisId;
52
55
  axisDirection: 'x' | 'y';
53
- slider: NonNullable<Required<ZoomOptions['slider']>>;
56
+ slider: DefaultedZoomSliderOptions;
54
57
  }
55
58
  export interface UseChartCartesianAxisState {
56
59
  /**
@@ -3238,4 +3238,87 @@ export declare const selectorChartYAxis: ((state: import("../../corePlugins/useC
3238
3238
  } & {
3239
3239
  memoize: typeof import("reselect").weakMapMemoize;
3240
3240
  argsMemoize: typeof import("reselect").weakMapMemoize;
3241
+ };
3242
+ export declare const selectorChartRawAxis: ((state: any, axisId: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined) & {
3243
+ clearCache: () => void;
3244
+ resultsCount: () => number;
3245
+ resetResultsCount: () => void;
3246
+ } & {
3247
+ resultFunc: (resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined, resultFuncArgs_1: import("../../../index.js").DefaultedYAxis[] | undefined, resultFuncArgs_2: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined;
3248
+ memoizedResultFunc: ((resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined, resultFuncArgs_1: import("../../../index.js").DefaultedYAxis[] | undefined, resultFuncArgs_2: AxisId) => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined) & {
3249
+ clearCache: () => void;
3250
+ resultsCount: () => number;
3251
+ resetResultsCount: () => void;
3252
+ };
3253
+ lastResult: () => import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined;
3254
+ dependencies: [((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
3255
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
3256
+ }) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
3257
+ clearCache: () => void;
3258
+ resultsCount: () => number;
3259
+ resetResultsCount: () => void;
3260
+ } & {
3261
+ resultFunc: (resultFuncArgs_0: {
3262
+ x: import("../../../index.js").DefaultedXAxis[];
3263
+ y: import("../../../index.js").DefaultedYAxis[];
3264
+ } | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined;
3265
+ memoizedResultFunc: ((resultFuncArgs_0: {
3266
+ x: import("../../../index.js").DefaultedXAxis[];
3267
+ y: import("../../../index.js").DefaultedYAxis[];
3268
+ } | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
3269
+ clearCache: () => void;
3270
+ resultsCount: () => number;
3271
+ resetResultsCount: () => void;
3272
+ };
3273
+ lastResult: () => import("../../../index.js").DefaultedXAxis[] | undefined;
3274
+ dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
3275
+ x: import("../../../index.js").DefaultedXAxis[];
3276
+ y: import("../../../index.js").DefaultedYAxis[];
3277
+ } | undefined];
3278
+ recomputations: () => number;
3279
+ resetRecomputations: () => void;
3280
+ dependencyRecomputations: () => number;
3281
+ resetDependencyRecomputations: () => void;
3282
+ } & {
3283
+ memoize: typeof import("reselect").weakMapMemoize;
3284
+ argsMemoize: typeof import("reselect").weakMapMemoize;
3285
+ }, ((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
3286
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
3287
+ }) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
3288
+ clearCache: () => void;
3289
+ resultsCount: () => number;
3290
+ resetResultsCount: () => void;
3291
+ } & {
3292
+ resultFunc: (resultFuncArgs_0: {
3293
+ x: import("../../../index.js").DefaultedXAxis[];
3294
+ y: import("../../../index.js").DefaultedYAxis[];
3295
+ } | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined;
3296
+ memoizedResultFunc: ((resultFuncArgs_0: {
3297
+ x: import("../../../index.js").DefaultedXAxis[];
3298
+ y: import("../../../index.js").DefaultedYAxis[];
3299
+ } | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
3300
+ clearCache: () => void;
3301
+ resultsCount: () => number;
3302
+ resetResultsCount: () => void;
3303
+ };
3304
+ lastResult: () => import("../../../index.js").DefaultedYAxis[] | undefined;
3305
+ dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
3306
+ x: import("../../../index.js").DefaultedXAxis[];
3307
+ y: import("../../../index.js").DefaultedYAxis[];
3308
+ } | undefined];
3309
+ recomputations: () => number;
3310
+ resetRecomputations: () => void;
3311
+ dependencyRecomputations: () => number;
3312
+ resetDependencyRecomputations: () => void;
3313
+ } & {
3314
+ memoize: typeof import("reselect").weakMapMemoize;
3315
+ argsMemoize: typeof import("reselect").weakMapMemoize;
3316
+ }, (state: any, axisId: AxisId) => AxisId];
3317
+ recomputations: () => number;
3318
+ resetRecomputations: () => void;
3319
+ dependencyRecomputations: () => number;
3320
+ resetDependencyRecomputations: () => void;
3321
+ } & {
3322
+ memoize: typeof import("reselect").weakMapMemoize;
3323
+ argsMemoize: typeof import("reselect").weakMapMemoize;
3241
3324
  };
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartYAxis = exports.selectorChartXAxis = exports.selectorChartAxisZoomOptionsLookup = exports.createZoomMap = void 0;
7
+ exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartYAxis = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.createZoomMap = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _useChartDimensions = require("../../corePlugins/useChartDimensions");
10
10
  var _useChartSeries = require("../../corePlugins/useChartSeries");
@@ -95,4 +95,11 @@ const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSel
95
95
  zoomMap,
96
96
  zoomOptions,
97
97
  getFilters
98
- }));
98
+ }));
99
+ const selectorChartRawAxis = exports.selectorChartRawAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
100
+ const axis = xAxes?.find(a => a.id === axisId) ?? yAxes?.find(a => a.id === axisId) ?? null;
101
+ if (!axis) {
102
+ return undefined;
103
+ }
104
+ return axis;
105
+ });
@@ -15,6 +15,7 @@ export type ZoomData = {
15
15
  end: number;
16
16
  };
17
17
  export type ZoomFilterMode = 'keep' | 'discard';
18
+ export type ZoomSliderShowTooltip = 'always' | 'hover' | 'never';
18
19
  export interface ZoomOptions {
19
20
  /**
20
21
  * The starting percentage of the zoom range. In the range of 0 to 100.
@@ -85,6 +86,14 @@ export interface ZoomSliderOptions {
85
86
  * @default 28
86
87
  */
87
88
  size?: number;
89
+ /**
90
+ * Defines when the tooltip with the zoom values should be shown.
91
+ * - 'always': The tooltip is always shown.
92
+ * - 'hover': The tooltip is shown when hovering over the track or thumb.
93
+ * - 'never': The tooltip is never shown.
94
+ * @default 'hover'
95
+ */
96
+ showTooltip?: ZoomSliderShowTooltip;
88
97
  }
89
98
  export type ZoomAxisFilters = Record<AxisId, ExtremumFilter>;
90
99
  export type GetZoomAxisFilters = (params: {
@@ -9,6 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _useAssertModelConsistency = require("@mui/x-internals/useAssertModelConsistency");
10
10
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
11
11
  var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
12
+ var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
12
13
  const useChartHighlight = ({
13
14
  store,
14
15
  params
@@ -36,6 +37,10 @@ const useChartHighlight = ({
36
37
  }));
37
38
  });
38
39
  const setHighlight = (0, _useEventCallback.default)(newItem => {
40
+ const prevItem = store.getSnapshot().highlight.item;
41
+ if ((0, _fastObjectShallowCompare.fastObjectShallowCompare)(prevItem, newItem)) {
42
+ return;
43
+ }
39
44
  params.onHighlightChange?.(newItem);
40
45
  store.update(prev => (0, _extends2.default)({}, prev, {
41
46
  highlight: {
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.useChartInteraction = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
10
+ var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
10
11
  const useChartInteraction = ({
11
12
  store
12
13
  }) => {
@@ -43,11 +44,16 @@ const useChartInteraction = ({
43
44
  });
44
45
  });
45
46
  const setItemInteraction = (0, _useEventCallback.default)(newItem => {
46
- store.update(prev => (0, _extends2.default)({}, prev, {
47
- interaction: (0, _extends2.default)({}, prev.interaction, {
48
- item: newItem
49
- })
50
- }));
47
+ store.update(prev => {
48
+ if ((0, _fastObjectShallowCompare.fastObjectShallowCompare)(prev.interaction.item, newItem)) {
49
+ return prev;
50
+ }
51
+ return (0, _extends2.default)({}, prev, {
52
+ interaction: (0, _extends2.default)({}, prev.interaction, {
53
+ item: newItem
54
+ })
55
+ });
56
+ });
51
57
  });
52
58
  const setPointerCoordinate = (0, _useEventCallback.default)(coordinate => {
53
59
  store.update(prev => (0, _extends2.default)({}, prev, {