@mui/x-charts-pro 9.2.0 → 9.4.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 (78) hide show
  1. package/BarChartPro/BarChartPro.js +62 -32
  2. package/BarChartPro/BarChartPro.mjs +62 -32
  3. package/CHANGELOG.md +314 -0
  4. package/ChartsDataProviderPro/ChartsDataProviderPro.js +2 -2
  5. package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +2 -2
  6. package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -0
  7. package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.mjs +1 -0
  8. package/ChartsToolbarPro/ChartsToolbarPro.d.mts +1 -1
  9. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +1 -1
  10. package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.mts +1 -1
  11. package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.ts +1 -1
  12. package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.js +35 -38
  13. package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.mjs +37 -40
  14. package/ChartsToolbarPro/Toolbar.types.d.mts +3 -2
  15. package/ChartsToolbarPro/Toolbar.types.d.ts +3 -2
  16. package/ChartsToolbarPro/rangeButtonValueToZoom.d.mts +18 -2
  17. package/ChartsToolbarPro/rangeButtonValueToZoom.d.ts +18 -2
  18. package/ChartsToolbarPro/rangeButtonValueToZoom.js +73 -10
  19. package/ChartsToolbarPro/rangeButtonValueToZoom.mjs +72 -10
  20. package/ChartsZoomSlider/internals/chartsAxisZoomSliderThumbClasses.js +9 -2
  21. package/ChartsZoomSlider/internals/chartsAxisZoomSliderThumbClasses.mjs +9 -2
  22. package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.js +2 -1
  23. package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.mjs +2 -1
  24. package/FunnelChart/FunnelChart.js +15 -15
  25. package/FunnelChart/FunnelChart.mjs +15 -15
  26. package/FunnelChart/funnelPlotSlots.types.d.mts +5 -4
  27. package/FunnelChart/funnelPlotSlots.types.d.ts +5 -4
  28. package/Heatmap/Heatmap.d.mts +3 -2
  29. package/Heatmap/Heatmap.d.ts +3 -2
  30. package/Heatmap/Heatmap.js +52 -22
  31. package/Heatmap/Heatmap.mjs +52 -22
  32. package/Heatmap/HeatmapItem.d.mts +3 -2
  33. package/Heatmap/HeatmapItem.d.ts +3 -2
  34. package/Heatmap/HeatmapItem.js +2 -0
  35. package/Heatmap/HeatmapItem.mjs +2 -0
  36. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.mts +3 -2
  37. package/Heatmap/HeatmapTooltip/HeatmapTooltip.types.d.ts +3 -2
  38. package/LineChartPro/LineChartPro.js +58 -28
  39. package/LineChartPro/LineChartPro.mjs +58 -28
  40. package/PieChartPro/PieChartPro.js +6 -6
  41. package/PieChartPro/PieChartPro.mjs +6 -6
  42. package/RadarChartPro/RadarChartPro.js +8 -8
  43. package/RadarChartPro/RadarChartPro.mjs +8 -8
  44. package/SankeyChart/SankeyChart.js +16 -16
  45. package/SankeyChart/SankeyChart.mjs +16 -16
  46. package/ScatterChartPro/ScatterChartPro.d.mts +2 -1
  47. package/ScatterChartPro/ScatterChartPro.d.ts +2 -1
  48. package/ScatterChartPro/ScatterChartPro.js +58 -28
  49. package/ScatterChartPro/ScatterChartPro.mjs +58 -28
  50. package/index.js +1 -1
  51. package/index.mjs +1 -1
  52. package/internals/plugins/useChartProExport/exportImage.js +8 -2
  53. package/internals/plugins/useChartProExport/exportImage.mjs +8 -2
  54. package/internals/plugins/useChartProExport/print.js +1 -0
  55. package/internals/plugins/useChartProExport/print.mjs +1 -0
  56. package/internals/plugins/useChartProExport/useChartProExport.types.d.mts +6 -0
  57. package/internals/plugins/useChartProExport/useChartProExport.types.d.ts +6 -0
  58. package/internals/plugins/useChartProZoom/useChartProZoom.js +77 -14
  59. package/internals/plugins/useChartProZoom/useChartProZoom.mjs +79 -15
  60. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.mts +0 -3
  61. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +0 -3
  62. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +1 -2
  63. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.mjs +0 -1
  64. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.mts +28 -11
  65. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +28 -11
  66. package/internals/slots/chartsBaseSlots.d.mts +6 -5
  67. package/internals/slots/chartsBaseSlots.d.ts +6 -5
  68. package/internals/slots/chartsIconSlots.d.mts +4 -3
  69. package/internals/slots/chartsIconSlots.d.ts +4 -3
  70. package/models/chartsSlotsComponentsPropsPro.d.mts +11 -0
  71. package/models/chartsSlotsComponentsPropsPro.d.ts +11 -0
  72. package/models/chartsSlotsComponentsPropsPro.js +5 -0
  73. package/models/chartsSlotsComponentsPropsPro.mjs +1 -0
  74. package/models/index.d.mts +1 -0
  75. package/models/index.d.ts +1 -0
  76. package/models/index.js +12 -0
  77. package/models/index.mjs +1 -0
  78. package/package.json +6 -6
@@ -2,11 +2,13 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
- import { selectorChartZoomOptionsLookup, createZoomLookup, selectorChartAxisZoomOptionsLookup } from '@mui/x-charts/internals';
5
+ import { selectorChartZoomOptionsLookup, createZoomLookup, selectorChartAxisZoomOptionsLookup, selectorChartXAxisWithDomains, selectorChartYAxisWithDomains } from '@mui/x-charts/internals';
6
6
  import debounce from '@mui/utils/debounce';
7
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
7
8
  import { useEffectAfterFirstRender } from '@mui/x-internals/useEffectAfterFirstRender';
8
9
  import { useEventCallback } from '@mui/material/utils';
9
10
  import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
11
+ import { getRangeButtonDomainParams, rangeButtonValueToZoom } from "../../../ChartsToolbarPro/rangeButtonValueToZoom.mjs";
10
12
  import { calculateZoom } from "./calculateZoom.mjs";
11
13
  import { useZoomOnWheel } from "./gestureHooks/useZoomOnWheel.mjs";
12
14
  import { useZoomOnPinch } from "./gestureHooks/useZoomOnPinch.mjs";
@@ -18,6 +20,13 @@ import { useZoomOnBrush } from "./gestureHooks/useZoomOnBrush.mjs";
18
20
  import { useZoomOnDoubleTapReset } from "./gestureHooks/useZoomOnDoubleTapReset.mjs";
19
21
  import { initializeZoomInteractionConfig } from "./initializeZoomInteractionConfig.mjs";
20
22
  import { initializeZoomData } from "./initializeZoomData.mjs";
23
+
24
+ /**
25
+ * Type guard for `initialZoom` entries provided as a range value.
26
+ */
27
+ function isInitialZoomRange(entry) {
28
+ return 'value' in entry;
29
+ }
21
30
  export const useChartProZoom = pluginData => {
22
31
  const {
23
32
  store,
@@ -55,6 +64,68 @@ export const useChartProZoom = pluginData => {
55
64
  }));
56
65
  removeIsInteracting();
57
66
  }, [store, paramsZoomData, removeIsInteracting]);
67
+
68
+ // Resolve `initialZoom` entries provided as range values (e.g. `{ axisId, value: { unit: 'month' } }`).
69
+ // These depend on the computed axis domains, which are only available after the first render
70
+ // (unless the user provides explicit `width`/`height`), so they are resolved once on mount.
71
+ // A layout effect avoids a visible unzoomed frame.
72
+ const hasResolvedInitialZoomRanges = React.useRef(false);
73
+ useEnhancedEffect(() => {
74
+ if (hasResolvedInitialZoomRanges.current) {
75
+ // `initialZoom` is only read on mount, like the rest of the initial zoom state.
76
+ return;
77
+ }
78
+ hasResolvedInitialZoomRanges.current = true;
79
+ if (paramsZoomData !== undefined) {
80
+ // The zoom is controlled, `initialZoom` is ignored.
81
+ return;
82
+ }
83
+ const rangeEntries = (params.initialZoom ?? []).filter(isInitialZoomRange);
84
+ if (rangeEntries.length === 0) {
85
+ return;
86
+ }
87
+ const {
88
+ axes: xAxes,
89
+ domains: xDomains
90
+ } = selectorChartXAxisWithDomains(store.state);
91
+ const {
92
+ axes: yAxes,
93
+ domains: yDomains
94
+ } = selectorChartYAxisWithDomains(store.state);
95
+ const resolvedZoom = new Map();
96
+ rangeEntries.forEach(entry => {
97
+ const xAxis = xAxes?.find(axis => axis.id === entry.axisId);
98
+ const axis = xAxis ?? yAxes?.find(candidate => candidate.id === entry.axisId);
99
+ if (!axis) {
100
+ if (process.env.NODE_ENV !== 'production') {
101
+ console.error(`MUI X Charts: \`initialZoom\` references the axis with id "${entry.axisId}", which does not exist.\n` + 'The range cannot be resolved. Provide an `axisId` that matches a chart axis.');
102
+ }
103
+ return;
104
+ }
105
+ const domain = (xAxis ? xDomains : yDomains)[entry.axisId]?.domain;
106
+ const domainParams = getRangeButtonDomainParams(axis, domain);
107
+ if (!domainParams) {
108
+ return;
109
+ }
110
+ const {
111
+ start,
112
+ end
113
+ } = rangeButtonValueToZoom(entry.value, domainParams);
114
+ resolvedZoom.set(entry.axisId, {
115
+ axisId: entry.axisId,
116
+ start,
117
+ end
118
+ });
119
+ });
120
+ if (resolvedZoom.size === 0) {
121
+ return;
122
+ }
123
+ store.set('zoom', _extends({}, store.state.zoom, {
124
+ isInteracting: true,
125
+ zoomData: store.state.zoom.zoomData.map(zoom => resolvedZoom.get(zoom.axisId) ?? zoom)
126
+ }));
127
+ removeIsInteracting();
128
+ }, [store, paramsZoomData, params.initialZoom, removeIsInteracting]);
58
129
  const setZoomDataCallback = React.useCallback(zoomData => {
59
130
  const newZoomData = typeof zoomData === 'function' ? zoomData([...store.state.zoom.zoomData]) : zoomData;
60
131
  if (isDeepEqual(store.state.zoom.zoomData, newZoomData)) {
@@ -63,14 +134,12 @@ export const useChartProZoom = pluginData => {
63
134
  onZoomChange(newZoomData);
64
135
  if (store.state.zoom.isControlled) {
65
136
  store.set('zoom', _extends({}, store.state.zoom, {
66
- isInteracting: true,
67
- activeRangeButtonKey: null
137
+ isInteracting: true
68
138
  }));
69
139
  } else {
70
140
  store.set('zoom', _extends({}, store.state.zoom, {
71
141
  isInteracting: true,
72
- zoomData: newZoomData,
73
- activeRangeButtonKey: null
142
+ zoomData: newZoomData
74
143
  }));
75
144
  removeIsInteracting();
76
145
  }
@@ -134,11 +203,6 @@ export const useChartProZoom = pluginData => {
134
203
  }, [setZoomDataCallback, store]);
135
204
  const zoomIn = React.useCallback(() => zoom(0.1), [zoom]);
136
205
  const zoomOut = React.useCallback(() => zoom(-0.1), [zoom]);
137
- const setActiveRangeButtonKey = React.useCallback(key => {
138
- store.set('zoom', _extends({}, store.state.zoom, {
139
- activeRangeButtonKey: key
140
- }));
141
- }, [store]);
142
206
  return {
143
207
  publicAPI: {
144
208
  setZoomData: setZoomDataCallback,
@@ -151,8 +215,7 @@ export const useChartProZoom = pluginData => {
151
215
  setAxisZoomData,
152
216
  moveZoomRange,
153
217
  zoomIn,
154
- zoomOut,
155
- setActiveRangeButtonKey
218
+ zoomOut
156
219
  }
157
220
  };
158
221
  };
@@ -170,16 +233,17 @@ useChartProZoom.getInitialState = params => {
170
233
  defaultizedYAxis
171
234
  } = params;
172
235
  const optionsLookup = _extends({}, createZoomLookup('x')(defaultizedXAxis), createZoomLookup('y')(defaultizedYAxis));
236
+ // Range-value entries of `initialZoom` are resolved after the first render, once the axis
237
+ // domains are computed. Only the explicit `ZoomData` entries are applied to the initial state.
173
238
  const userZoomData =
174
239
  // eslint-disable-next-line no-nested-ternary
175
- zoomData !== undefined ? zoomData : initialZoom !== undefined ? initialZoom : undefined;
240
+ zoomData !== undefined ? zoomData : initialZoom !== undefined ? initialZoom.filter(entry => !isInitialZoomRange(entry)) : undefined;
176
241
  return {
177
242
  zoom: {
178
243
  zoomData: initializeZoomData(optionsLookup, userZoomData),
179
244
  isInteracting: false,
180
245
  isControlled: zoomData !== undefined,
181
- zoomInteractionConfig: initializeZoomInteractionConfig(params.zoomInteractionConfig, optionsLookup),
182
- activeRangeButtonKey: null
246
+ zoomInteractionConfig: initializeZoomInteractionConfig(params.zoomInteractionConfig, optionsLookup)
183
247
  }
184
248
  };
185
249
  };
@@ -13,9 +13,6 @@ export declare const selectorChartAxisZoomData: (args_0: import("@mui/x-charts/i
13
13
  export declare const selectorChartCanZoomOut: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.mjs").UseChartProZoomState & Partial<{}> & {
14
14
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
15
15
  }) => boolean;
16
- export declare const selectorChartActiveRangeButtonKey: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.mjs").UseChartProZoomState & Partial<{}> & {
17
- cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
18
- }) => string | null;
19
16
  export declare const selectorChartCanZoomIn: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.mjs").UseChartProZoomState & Partial<{}> & {
20
17
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
21
18
  }) => boolean;
@@ -13,9 +13,6 @@ export declare const selectorChartAxisZoomData: (args_0: import("@mui/x-charts/i
13
13
  export declare const selectorChartCanZoomOut: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
14
14
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
15
15
  }) => boolean;
16
- export declare const selectorChartActiveRangeButtonKey: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
17
- cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
18
- }) => string | null;
19
16
  export declare const selectorChartCanZoomIn: (args_0: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types").UseChartSeriesConfigState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types").UseChartExperimentalFeaturesState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("@mui/x-charts/internals").UseChartInteractionListenerState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
20
17
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
21
18
  }) => boolean;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.selectorChartZoomState = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomIsEnabled = exports.selectorChartCanZoomOut = exports.selectorChartCanZoomIn = exports.selectorChartAxisZoomData = exports.selectorChartActiveRangeButtonKey = void 0;
6
+ exports.selectorChartZoomState = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomIsEnabled = exports.selectorChartCanZoomOut = exports.selectorChartCanZoomIn = exports.selectorChartAxisZoomData = void 0;
7
7
  var _store = require("@mui/x-internals/store");
8
8
  var _internals = require("@mui/x-charts/internals");
9
9
  const selectorChartZoomState = state => state.zoom;
@@ -18,7 +18,6 @@ const selectorChartCanZoomOut = exports.selectorChartCanZoomOut = (0, _store.cre
18
18
  return zoomData.start === options.minStart && zoomData.end === options.maxEnd || span === options.maxSpan;
19
19
  });
20
20
  });
21
- const selectorChartActiveRangeButtonKey = exports.selectorChartActiveRangeButtonKey = (0, _store.createSelector)(selectorChartZoomState, zoom => zoom.activeRangeButtonKey);
22
21
  const selectorChartCanZoomIn = exports.selectorChartCanZoomIn = (0, _store.createSelector)(selectorChartZoomState, _internals.selectorChartZoomOptionsLookup, (zoomState, zoomOptions) => {
23
22
  return !zoomState.zoomData.every(zoomData => {
24
23
  const span = zoomData.end - zoomData.start;
@@ -11,7 +11,6 @@ export const selectorChartCanZoomOut = createSelector(selectorChartZoomState, se
11
11
  return zoomData.start === options.minStart && zoomData.end === options.maxEnd || span === options.maxSpan;
12
12
  });
13
13
  });
14
- export const selectorChartActiveRangeButtonKey = createSelector(selectorChartZoomState, zoom => zoom.activeRangeButtonKey);
15
14
  export const selectorChartCanZoomIn = createSelector(selectorChartZoomState, selectorChartZoomOptionsLookup, (zoomState, zoomOptions) => {
16
15
  return !zoomState.zoomData.every(zoomData => {
17
16
  const span = zoomData.end - zoomData.start;
@@ -1,11 +1,38 @@
1
1
  import { type UseChartSeriesSignature, type ChartPluginSignature, type UseChartCartesianAxisSignature, type UseChartCartesianAxisDefaultizedParameters, type ZoomData, type AxisId, type UseChartBrushSignature } from '@mui/x-charts/internals';
2
2
  import { type ZoomInteractionConfig, type DefaultizedZoomInteractionConfig } from "./ZoomInteractionConfig.types.mjs";
3
+ import { type RangeButtonValue } from "../../../ChartsToolbarPro/rangeButtonValueToZoom.mjs";
4
+ /**
5
+ * Initializes the zoom of an axis with a range value instead of zoom percentages.
6
+ */
7
+ export interface InitialZoomRange {
8
+ /**
9
+ * The id of the axis to apply the zoom to.
10
+ */
11
+ axisId: AxisId;
12
+ /**
13
+ * The range to zoom to. Accepts the same values as a range button:
14
+ *
15
+ * - `{ unit, step }` — A calendar interval from the end of the data.
16
+ * - `[start, end]` — An absolute date range, or a range between two ordinal axis values.
17
+ * - `(params) => { start, end }` — A function returning zoom percentages (0-100).
18
+ * - `null` — Shows all data.
19
+ */
20
+ value: RangeButtonValue;
21
+ }
22
+ /**
23
+ * An entry of the `initialZoom` prop. Either explicit zoom percentages ({@link ZoomData})
24
+ * or a range value resolved against the axis ({@link InitialZoomRange}).
25
+ */
26
+ export type InitialZoom = ZoomData | InitialZoomRange;
3
27
  export interface UseChartProZoomParameters {
4
28
  /**
5
29
  * The list of zoom data related to each axis.
6
30
  * Used to initialize the zoom in a specific configuration without controlling it.
31
+ *
32
+ * Each entry is either explicit zoom percentages (`{ axisId, start, end }`) or a
33
+ * range value (`{ axisId, value }`) resolved against the axis domain.
7
34
  */
8
- initialZoom?: readonly ZoomData[];
35
+ initialZoom?: readonly InitialZoom[];
9
36
  /**
10
37
  * Callback fired when the zoom has changed.
11
38
  *
@@ -41,11 +68,6 @@ export interface UseChartProZoomState {
41
68
  * Configuration for zoom interactions.
42
69
  */
43
70
  zoomInteractionConfig: DefaultizedZoomInteractionConfig;
44
- /**
45
- * The key of the currently active range button, or `null` if no range button is active.
46
- * Cleared when the user manually zooms or pans the chart.
47
- */
48
- activeRangeButtonKey: string | null;
49
71
  };
50
72
  }
51
73
  export interface UseChartProZoomPublicApi {
@@ -78,11 +100,6 @@ export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {
78
100
  * Zoom out the chart.
79
101
  */
80
102
  zoomOut: () => void;
81
- /**
82
- * Set the active range button key. Pass `null` to clear.
83
- * @param {string | null} key The key of the active range button.
84
- */
85
- setActiveRangeButtonKey: (key: string | null) => void;
86
103
  }
87
104
  export type UseChartProZoomSignature = ChartPluginSignature<{
88
105
  params: UseChartProZoomParameters;
@@ -1,11 +1,38 @@
1
1
  import { type UseChartSeriesSignature, type ChartPluginSignature, type UseChartCartesianAxisSignature, type UseChartCartesianAxisDefaultizedParameters, type ZoomData, type AxisId, type UseChartBrushSignature } from '@mui/x-charts/internals';
2
2
  import { type ZoomInteractionConfig, type DefaultizedZoomInteractionConfig } from "./ZoomInteractionConfig.types.js";
3
+ import { type RangeButtonValue } from "../../../ChartsToolbarPro/rangeButtonValueToZoom.js";
4
+ /**
5
+ * Initializes the zoom of an axis with a range value instead of zoom percentages.
6
+ */
7
+ export interface InitialZoomRange {
8
+ /**
9
+ * The id of the axis to apply the zoom to.
10
+ */
11
+ axisId: AxisId;
12
+ /**
13
+ * The range to zoom to. Accepts the same values as a range button:
14
+ *
15
+ * - `{ unit, step }` — A calendar interval from the end of the data.
16
+ * - `[start, end]` — An absolute date range, or a range between two ordinal axis values.
17
+ * - `(params) => { start, end }` — A function returning zoom percentages (0-100).
18
+ * - `null` — Shows all data.
19
+ */
20
+ value: RangeButtonValue;
21
+ }
22
+ /**
23
+ * An entry of the `initialZoom` prop. Either explicit zoom percentages ({@link ZoomData})
24
+ * or a range value resolved against the axis ({@link InitialZoomRange}).
25
+ */
26
+ export type InitialZoom = ZoomData | InitialZoomRange;
3
27
  export interface UseChartProZoomParameters {
4
28
  /**
5
29
  * The list of zoom data related to each axis.
6
30
  * Used to initialize the zoom in a specific configuration without controlling it.
31
+ *
32
+ * Each entry is either explicit zoom percentages (`{ axisId, start, end }`) or a
33
+ * range value (`{ axisId, value }`) resolved against the axis domain.
7
34
  */
8
- initialZoom?: readonly ZoomData[];
35
+ initialZoom?: readonly InitialZoom[];
9
36
  /**
10
37
  * Callback fired when the zoom has changed.
11
38
  *
@@ -41,11 +68,6 @@ export interface UseChartProZoomState {
41
68
  * Configuration for zoom interactions.
42
69
  */
43
70
  zoomInteractionConfig: DefaultizedZoomInteractionConfig;
44
- /**
45
- * The key of the currently active range button, or `null` if no range button is active.
46
- * Cleared when the user manually zooms or pans the chart.
47
- */
48
- activeRangeButtonKey: string | null;
49
71
  };
50
72
  }
51
73
  export interface UseChartProZoomPublicApi {
@@ -78,11 +100,6 @@ export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {
78
100
  * Zoom out the chart.
79
101
  */
80
102
  zoomOut: () => void;
81
- /**
82
- * Set the active range button key. Pass `null` to clear.
83
- * @param {string | null} key The key of the active range button.
84
- */
85
- setActiveRangeButtonKey: (key: string | null) => void;
86
103
  }
87
104
  export type UseChartProZoomSignature = ChartPluginSignature<{
88
105
  params: UseChartProZoomParameters;
@@ -1,10 +1,11 @@
1
1
  import { type ChartsBaseSlots } from '@mui/x-charts/models';
2
2
  import type * as React from 'react';
3
3
  import { type ChartBaseDividerProps, type ChartBaseMenuItemProps, type ChartBaseMenuListProps, type ChartBasePopperProps, type ChartBaseTooltipProps } from "./chartBaseSlotProps.mjs";
4
+ import type { BaseDividerPropsOverrides, BaseMenuItemPropsOverrides, BaseMenuListPropsOverrides, BasePopperPropsOverrides, BaseTooltipPropsOverrides } from "../../models/chartsSlotsComponentsPropsPro.mjs";
4
5
  export interface ChartsBaseSlotsPro extends ChartsBaseSlots {
5
- baseDivider: React.ComponentType<ChartBaseDividerProps>;
6
- baseMenuItem: React.ComponentType<ChartBaseMenuItemProps>;
7
- baseMenuList: React.ComponentType<ChartBaseMenuListProps>;
8
- basePopper: React.ComponentType<ChartBasePopperProps>;
9
- baseTooltip: React.ComponentType<ChartBaseTooltipProps>;
6
+ baseDivider: React.ComponentType<ChartBaseDividerProps & BaseDividerPropsOverrides>;
7
+ baseMenuItem: React.ComponentType<ChartBaseMenuItemProps & BaseMenuItemPropsOverrides>;
8
+ baseMenuList: React.ComponentType<ChartBaseMenuListProps & BaseMenuListPropsOverrides>;
9
+ basePopper: React.ComponentType<ChartBasePopperProps & BasePopperPropsOverrides>;
10
+ baseTooltip: React.ComponentType<ChartBaseTooltipProps & BaseTooltipPropsOverrides>;
10
11
  }
@@ -1,10 +1,11 @@
1
1
  import { type ChartsBaseSlots } from '@mui/x-charts/models';
2
2
  import type * as React from 'react';
3
3
  import { type ChartBaseDividerProps, type ChartBaseMenuItemProps, type ChartBaseMenuListProps, type ChartBasePopperProps, type ChartBaseTooltipProps } from "./chartBaseSlotProps.js";
4
+ import type { BaseDividerPropsOverrides, BaseMenuItemPropsOverrides, BaseMenuListPropsOverrides, BasePopperPropsOverrides, BaseTooltipPropsOverrides } from "../../models/chartsSlotsComponentsPropsPro.js";
4
5
  export interface ChartsBaseSlotsPro extends ChartsBaseSlots {
5
- baseDivider: React.ComponentType<ChartBaseDividerProps>;
6
- baseMenuItem: React.ComponentType<ChartBaseMenuItemProps>;
7
- baseMenuList: React.ComponentType<ChartBaseMenuListProps>;
8
- basePopper: React.ComponentType<ChartBasePopperProps>;
9
- baseTooltip: React.ComponentType<ChartBaseTooltipProps>;
6
+ baseDivider: React.ComponentType<ChartBaseDividerProps & BaseDividerPropsOverrides>;
7
+ baseMenuItem: React.ComponentType<ChartBaseMenuItemProps & BaseMenuItemPropsOverrides>;
8
+ baseMenuList: React.ComponentType<ChartBaseMenuListProps & BaseMenuListPropsOverrides>;
9
+ basePopper: React.ComponentType<ChartBasePopperProps & BasePopperPropsOverrides>;
10
+ baseTooltip: React.ComponentType<ChartBaseTooltipProps & BaseTooltipPropsOverrides>;
10
11
  }
@@ -1,19 +1,20 @@
1
1
  import type * as React from 'react';
2
2
  import { type ChartBaseIconProps, type ChartsIconSlots } from '@mui/x-charts/models';
3
+ import type { ZoomInIconPropsOverrides, ZoomOutIconPropsOverrides, ExportIconPropsOverrides } from "../../models/chartsSlotsComponentsPropsPro.mjs";
3
4
  export interface ChartsIconSlotsPro extends ChartsIconSlots {
4
5
  /**
5
6
  * Icon displayed on the toolbar's zoom in button.
6
7
  * @default ChartsZoomInIcon
7
8
  */
8
- zoomInIcon: React.ComponentType<ChartBaseIconProps>;
9
+ zoomInIcon: React.ComponentType<ChartBaseIconProps & ZoomInIconPropsOverrides>;
9
10
  /**
10
11
  * Icon displayed on the toolbar's zoom out button.
11
12
  * @default ChartsZoomOutIcon
12
13
  */
13
- zoomOutIcon: React.ComponentType<ChartBaseIconProps>;
14
+ zoomOutIcon: React.ComponentType<ChartBaseIconProps & ZoomOutIconPropsOverrides>;
14
15
  /**
15
16
  * Icon displayed on the toolbar's export button.
16
17
  * @default ChartsExportIcon
17
18
  */
18
- exportIcon: React.ComponentType<ChartBaseIconProps>;
19
+ exportIcon: React.ComponentType<ChartBaseIconProps & ExportIconPropsOverrides>;
19
20
  }
@@ -1,19 +1,20 @@
1
1
  import type * as React from 'react';
2
2
  import { type ChartBaseIconProps, type ChartsIconSlots } from '@mui/x-charts/models';
3
+ import type { ZoomInIconPropsOverrides, ZoomOutIconPropsOverrides, ExportIconPropsOverrides } from "../../models/chartsSlotsComponentsPropsPro.js";
3
4
  export interface ChartsIconSlotsPro extends ChartsIconSlots {
4
5
  /**
5
6
  * Icon displayed on the toolbar's zoom in button.
6
7
  * @default ChartsZoomInIcon
7
8
  */
8
- zoomInIcon: React.ComponentType<ChartBaseIconProps>;
9
+ zoomInIcon: React.ComponentType<ChartBaseIconProps & ZoomInIconPropsOverrides>;
9
10
  /**
10
11
  * Icon displayed on the toolbar's zoom out button.
11
12
  * @default ChartsZoomOutIcon
12
13
  */
13
- zoomOutIcon: React.ComponentType<ChartBaseIconProps>;
14
+ zoomOutIcon: React.ComponentType<ChartBaseIconProps & ZoomOutIconPropsOverrides>;
14
15
  /**
15
16
  * Icon displayed on the toolbar's export button.
16
17
  * @default ChartsExportIcon
17
18
  */
18
- exportIcon: React.ComponentType<ChartBaseIconProps>;
19
+ exportIcon: React.ComponentType<ChartBaseIconProps & ExportIconPropsOverrides>;
19
20
  }
@@ -0,0 +1,11 @@
1
+ export interface BaseDividerPropsOverrides {}
2
+ export interface BaseMenuItemPropsOverrides {}
3
+ export interface BaseMenuListPropsOverrides {}
4
+ export interface BasePopperPropsOverrides {}
5
+ export interface BaseTooltipPropsOverrides {}
6
+ export interface ZoomInIconPropsOverrides {}
7
+ export interface ZoomOutIconPropsOverrides {}
8
+ export interface ExportIconPropsOverrides {}
9
+ export interface CellPropsOverrides {}
10
+ export interface FunnelSectionPropsOverrides {}
11
+ export interface FunnelSectionLabelPropsOverrides {}
@@ -0,0 +1,11 @@
1
+ export interface BaseDividerPropsOverrides {}
2
+ export interface BaseMenuItemPropsOverrides {}
3
+ export interface BaseMenuListPropsOverrides {}
4
+ export interface BasePopperPropsOverrides {}
5
+ export interface BaseTooltipPropsOverrides {}
6
+ export interface ZoomInIconPropsOverrides {}
7
+ export interface ZoomOutIconPropsOverrides {}
8
+ export interface ExportIconPropsOverrides {}
9
+ export interface CellPropsOverrides {}
10
+ export interface FunnelSectionPropsOverrides {}
11
+ export interface FunnelSectionLabelPropsOverrides {}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from '@mui/x-charts/models';
2
2
  export type { ZoomData, ZoomFilterMode, ZoomOptions, ZoomSliderOptions, ZoomSliderShowTooltip } from '@mui/x-charts/internals';
3
3
  export * from "./seriesType/index.mjs";
4
+ export * from "./chartsSlotsComponentsPropsPro.mjs";
4
5
  export { defaultOnBeforeExport } from "../internals/plugins/useChartProExport/defaults.mjs";
package/models/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from '@mui/x-charts/models';
2
2
  export type { ZoomData, ZoomFilterMode, ZoomOptions, ZoomSliderOptions, ZoomSliderShowTooltip } from '@mui/x-charts/internals';
3
3
  export * from "./seriesType/index.js";
4
+ export * from "./chartsSlotsComponentsPropsPro.js";
4
5
  export { defaultOnBeforeExport } from "../internals/plugins/useChartProExport/defaults.js";
package/models/index.js CHANGED
@@ -36,4 +36,16 @@ Object.keys(_seriesType).forEach(function (key) {
36
36
  }
37
37
  });
38
38
  });
39
+ var _chartsSlotsComponentsPropsPro = require("./chartsSlotsComponentsPropsPro");
40
+ Object.keys(_chartsSlotsComponentsPropsPro).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
43
+ if (key in exports && exports[key] === _chartsSlotsComponentsPropsPro[key]) return;
44
+ Object.defineProperty(exports, key, {
45
+ enumerable: true,
46
+ get: function () {
47
+ return _chartsSlotsComponentsPropsPro[key];
48
+ }
49
+ });
50
+ });
39
51
  var _defaults = require("../internals/plugins/useChartProExport/defaults");
package/models/index.mjs CHANGED
@@ -3,4 +3,5 @@ export * from '@mui/x-charts/models';
3
3
  // End of re-export-block
4
4
 
5
5
  export * from "./seriesType/index.mjs";
6
+ export * from "./chartsSlotsComponentsPropsPro.mjs";
6
7
  export { defaultOnBeforeExport } from "../internals/plugins/useChartProExport/defaults.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts-pro",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Pro plan edition of the MUI X Charts components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -27,15 +27,15 @@
27
27
  "directory": "packages/x-charts-pro"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.29.2",
30
+ "@babel/runtime": "^7.29.7",
31
31
  "@mui/utils": "9.0.1",
32
32
  "clsx": "^2.1.1",
33
33
  "prop-types": "^15.8.1",
34
- "@mui/x-charts-vendor": "^9.0.0",
35
- "@mui/x-charts": "^9.2.0",
34
+ "@mui/x-charts": "^9.4.0",
35
+ "@mui/x-internal-gestures": "^9.3.0",
36
+ "@mui/x-charts-vendor": "^9.4.0",
36
37
  "@mui/x-internals": "^9.1.0",
37
- "@mui/x-license": "^9.2.0",
38
- "@mui/x-internal-gestures": "^9.2.0"
38
+ "@mui/x-license": "^9.4.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@emotion/react": "^11.9.0",