@mui/x-charts 8.2.0 → 8.3.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 (134) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  3. package/ChartsClipPath/ChartsClipPath.js +8 -0
  4. package/LineChart/AppearingMask.js +1 -2
  5. package/LineChart/CircleMarkElement.d.ts +10 -0
  6. package/LineChart/CircleMarkElement.js +5 -15
  7. package/LineChart/MarkElement.d.ts +10 -0
  8. package/LineChart/MarkElement.js +15 -15
  9. package/LineChart/MarkPlot.js +18 -2
  10. package/PieChart/PieArcLabel.js +3 -4
  11. package/SparkLineChart/SparkLineChart.d.ts +19 -0
  12. package/SparkLineChart/SparkLineChart.js +52 -15
  13. package/Toolbar/Toolbar.d.ts +5 -0
  14. package/Toolbar/Toolbar.js +34 -0
  15. package/Toolbar/ToolbarButton.d.ts +5 -0
  16. package/Toolbar/ToolbarButton.js +27 -0
  17. package/Toolbar/index.d.ts +2 -0
  18. package/Toolbar/index.js +27 -0
  19. package/esm/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  20. package/esm/ChartsClipPath/ChartsClipPath.js +8 -0
  21. package/esm/LineChart/AppearingMask.js +1 -2
  22. package/esm/LineChart/CircleMarkElement.d.ts +10 -0
  23. package/esm/LineChart/CircleMarkElement.js +5 -15
  24. package/esm/LineChart/MarkElement.d.ts +10 -0
  25. package/esm/LineChart/MarkElement.js +15 -15
  26. package/esm/LineChart/MarkPlot.js +19 -3
  27. package/esm/PieChart/PieArcLabel.js +3 -4
  28. package/esm/SparkLineChart/SparkLineChart.d.ts +19 -0
  29. package/esm/SparkLineChart/SparkLineChart.js +52 -15
  30. package/esm/Toolbar/Toolbar.d.ts +5 -0
  31. package/esm/Toolbar/Toolbar.js +27 -0
  32. package/esm/Toolbar/ToolbarButton.d.ts +5 -0
  33. package/esm/Toolbar/ToolbarButton.js +20 -0
  34. package/esm/Toolbar/index.d.ts +2 -0
  35. package/esm/Toolbar/index.js +2 -0
  36. package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  37. package/esm/hooks/animation/useAnimatePieArcLabel.js +4 -4
  38. package/esm/index.d.ts +2 -1
  39. package/esm/index.js +3 -2
  40. package/esm/internals/constants.d.ts +4 -0
  41. package/esm/internals/constants.js +5 -0
  42. package/esm/internals/createSvgIcon.d.ts +3 -0
  43. package/esm/internals/createSvgIcon.js +2 -0
  44. package/esm/internals/index.d.ts +4 -1
  45. package/esm/internals/index.js +4 -1
  46. package/esm/internals/material/index.d.ts +4 -0
  47. package/esm/internals/material/index.js +7 -0
  48. package/esm/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  49. package/esm/internals/plugins/corePlugins/corePlugins.js +1 -1
  50. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  51. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +1 -1
  52. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  53. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  54. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +16 -4
  55. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  56. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  57. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  58. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  59. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
  60. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  61. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  62. package/esm/internals/plugins/models/helpers.d.ts +0 -1
  63. package/esm/internals/plugins/models/plugin.d.ts +0 -30
  64. package/esm/internals/store/useCharts.d.ts +1 -1
  65. package/esm/internals/store/useCharts.js +11 -12
  66. package/esm/locales/enUS.d.ts +2 -0
  67. package/esm/locales/enUS.js +3 -1
  68. package/esm/locales/frFR.d.ts +2 -0
  69. package/esm/locales/frFR.js +2 -0
  70. package/esm/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  71. package/esm/locales/utils/getChartsLocalization.d.ts +2 -0
  72. package/esm/models/axis.d.ts +10 -3
  73. package/esm/models/axis.js +4 -0
  74. package/esm/models/index.d.ts +2 -1
  75. package/esm/models/slots/chartsBaseSlotProps.d.ts +13 -0
  76. package/esm/models/slots/chartsBaseSlotProps.js +1 -0
  77. package/esm/models/slots/chartsBaseSlots.d.ts +5 -0
  78. package/esm/models/slots/chartsBaseSlots.js +1 -0
  79. package/esm/models/slots/chartsIconSlots.d.ts +1 -0
  80. package/esm/models/slots/chartsIconSlots.js +1 -0
  81. package/esm/models/slots/index.d.ts +3 -0
  82. package/esm/models/slots/index.js +3 -0
  83. package/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  84. package/hooks/animation/useAnimatePieArcLabel.js +4 -4
  85. package/index.d.ts +2 -1
  86. package/index.js +12 -1
  87. package/internals/constants.d.ts +4 -0
  88. package/internals/constants.js +11 -0
  89. package/internals/createSvgIcon.d.ts +3 -0
  90. package/internals/createSvgIcon.js +8 -0
  91. package/internals/index.d.ts +4 -1
  92. package/internals/index.js +36 -0
  93. package/internals/material/index.d.ts +4 -0
  94. package/internals/material/index.js +14 -0
  95. package/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  96. package/internals/plugins/corePlugins/corePlugins.js +1 -1
  97. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  98. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +2 -2
  99. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  100. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  101. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +21 -9
  102. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  103. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  104. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  105. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  106. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +3 -2
  107. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  108. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  109. package/internals/plugins/models/helpers.d.ts +0 -1
  110. package/internals/plugins/models/plugin.d.ts +0 -30
  111. package/internals/store/useCharts.d.ts +1 -1
  112. package/internals/store/useCharts.js +11 -12
  113. package/locales/enUS.d.ts +2 -0
  114. package/locales/enUS.js +3 -1
  115. package/locales/frFR.d.ts +2 -0
  116. package/locales/frFR.js +2 -0
  117. package/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  118. package/locales/utils/getChartsLocalization.d.ts +2 -0
  119. package/models/axis.d.ts +10 -3
  120. package/models/axis.js +4 -0
  121. package/models/index.d.ts +2 -1
  122. package/models/slots/chartsBaseSlotProps.d.ts +13 -0
  123. package/models/slots/chartsBaseSlotProps.js +5 -0
  124. package/models/slots/chartsBaseSlots.d.ts +5 -0
  125. package/models/slots/chartsBaseSlots.js +5 -0
  126. package/models/slots/chartsIconSlots.d.ts +1 -0
  127. package/models/slots/chartsIconSlots.js +5 -0
  128. package/models/slots/index.d.ts +3 -0
  129. package/models/slots/index.js +38 -0
  130. package/package.json +5 -5
  131. package/esm/internals/store/useChartModels.d.ts +0 -7
  132. package/esm/internals/store/useChartModels.js +0 -64
  133. package/internals/store/useChartModels.d.ts +0 -7
  134. package/internals/store/useChartModels.js +0 -73
@@ -38,6 +38,38 @@ export declare const selectorChartZoomIsInteracting: ((state: import("../../core
38
38
  memoize: typeof import("reselect").weakMapMemoize;
39
39
  argsMemoize: typeof import("reselect").weakMapMemoize;
40
40
  };
41
+ export declare const selectorChartZoomMap: ((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> & {
42
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
43
+ }) => Map<AxisId, ZoomData> | undefined) & {
44
+ clearCache: () => void;
45
+ resultsCount: () => number;
46
+ resetResultsCount: () => void;
47
+ } & {
48
+ resultFunc: (resultFuncArgs_0: {
49
+ isInteracting: boolean;
50
+ zoomData: readonly ZoomData[];
51
+ } | undefined) => Map<AxisId, ZoomData> | undefined;
52
+ memoizedResultFunc: ((resultFuncArgs_0: {
53
+ isInteracting: boolean;
54
+ zoomData: readonly ZoomData[];
55
+ } | undefined) => Map<AxisId, ZoomData> | undefined) & {
56
+ clearCache: () => void;
57
+ resultsCount: () => number;
58
+ resetResultsCount: () => void;
59
+ };
60
+ lastResult: () => Map<AxisId, ZoomData> | undefined;
61
+ dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
62
+ isInteracting: boolean;
63
+ zoomData: readonly ZoomData[];
64
+ } | undefined];
65
+ recomputations: () => number;
66
+ resetRecomputations: () => void;
67
+ dependencyRecomputations: () => number;
68
+ resetDependencyRecomputations: () => void;
69
+ } & {
70
+ memoize: typeof import("reselect").weakMapMemoize;
71
+ argsMemoize: typeof import("reselect").weakMapMemoize;
72
+ };
41
73
  export declare const selectorChartZoomOptionsLookup: ((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> & {
42
74
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
43
75
  }) => {
@@ -179,6 +211,133 @@ export declare const selectorChartZoomOptionsLookup: ((state: import("../../core
179
211
  memoize: typeof import("reselect").weakMapMemoize;
180
212
  argsMemoize: typeof import("reselect").weakMapMemoize;
181
213
  };
214
+ export declare const selectorChartAxisZoomOptionsLookup: ((state: any, axisId: AxisId) => import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions) & {
215
+ clearCache: () => void;
216
+ resultsCount: () => number;
217
+ resetResultsCount: () => void;
218
+ } & {
219
+ resultFunc: (resultFuncArgs_0: Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>, resultFuncArgs_1: Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>, resultFuncArgs_2: AxisId) => import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions;
220
+ memoizedResultFunc: ((resultFuncArgs_0: Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>, resultFuncArgs_1: Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>, resultFuncArgs_2: AxisId) => import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions) & {
221
+ clearCache: () => void;
222
+ resultsCount: () => number;
223
+ resetResultsCount: () => void;
224
+ };
225
+ lastResult: () => import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions;
226
+ 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> & {
227
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
228
+ }) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>) & {
229
+ clearCache: () => void;
230
+ resultsCount: () => number;
231
+ resetResultsCount: () => void;
232
+ } & {
233
+ resultFunc: (resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>;
234
+ memoizedResultFunc: ((resultFuncArgs_0: import("../../../index.js").DefaultedXAxis[] | undefined) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>) & {
235
+ clearCache: () => void;
236
+ resultsCount: () => number;
237
+ resetResultsCount: () => void;
238
+ };
239
+ lastResult: () => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>;
240
+ 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> & {
241
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
242
+ }) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
243
+ clearCache: () => void;
244
+ resultsCount: () => number;
245
+ resetResultsCount: () => void;
246
+ } & {
247
+ resultFunc: (resultFuncArgs_0: {
248
+ x: import("../../../index.js").DefaultedXAxis[];
249
+ y: import("../../../index.js").DefaultedYAxis[];
250
+ } | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined;
251
+ memoizedResultFunc: ((resultFuncArgs_0: {
252
+ x: import("../../../index.js").DefaultedXAxis[];
253
+ y: import("../../../index.js").DefaultedYAxis[];
254
+ } | undefined) => import("../../../index.js").DefaultedXAxis[] | undefined) & {
255
+ clearCache: () => void;
256
+ resultsCount: () => number;
257
+ resetResultsCount: () => void;
258
+ };
259
+ lastResult: () => import("../../../index.js").DefaultedXAxis[] | undefined;
260
+ dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
261
+ x: import("../../../index.js").DefaultedXAxis[];
262
+ y: import("../../../index.js").DefaultedYAxis[];
263
+ } | undefined];
264
+ recomputations: () => number;
265
+ resetRecomputations: () => void;
266
+ dependencyRecomputations: () => number;
267
+ resetDependencyRecomputations: () => void;
268
+ } & {
269
+ memoize: typeof import("reselect").weakMapMemoize;
270
+ argsMemoize: typeof import("reselect").weakMapMemoize;
271
+ }];
272
+ recomputations: () => number;
273
+ resetRecomputations: () => void;
274
+ dependencyRecomputations: () => number;
275
+ resetDependencyRecomputations: () => void;
276
+ } & {
277
+ memoize: typeof import("reselect").weakMapMemoize;
278
+ argsMemoize: typeof import("reselect").weakMapMemoize;
279
+ }, ((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> & {
280
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
281
+ }) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>) & {
282
+ clearCache: () => void;
283
+ resultsCount: () => number;
284
+ resetResultsCount: () => void;
285
+ } & {
286
+ resultFunc: (resultFuncArgs_0: import("../../../index.js").DefaultedYAxis[] | undefined) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>;
287
+ memoizedResultFunc: ((resultFuncArgs_0: import("../../../index.js").DefaultedYAxis[] | undefined) => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>) & {
288
+ clearCache: () => void;
289
+ resultsCount: () => number;
290
+ resetResultsCount: () => void;
291
+ };
292
+ lastResult: () => Record<AxisId, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions>;
293
+ 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> & {
294
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
295
+ }) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
296
+ clearCache: () => void;
297
+ resultsCount: () => number;
298
+ resetResultsCount: () => void;
299
+ } & {
300
+ resultFunc: (resultFuncArgs_0: {
301
+ x: import("../../../index.js").DefaultedXAxis[];
302
+ y: import("../../../index.js").DefaultedYAxis[];
303
+ } | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined;
304
+ memoizedResultFunc: ((resultFuncArgs_0: {
305
+ x: import("../../../index.js").DefaultedXAxis[];
306
+ y: import("../../../index.js").DefaultedYAxis[];
307
+ } | undefined) => import("../../../index.js").DefaultedYAxis[] | undefined) & {
308
+ clearCache: () => void;
309
+ resultsCount: () => number;
310
+ resetResultsCount: () => void;
311
+ };
312
+ lastResult: () => import("../../../index.js").DefaultedYAxis[] | undefined;
313
+ dependencies: [(state: ChartState<[], [UseChartCartesianAxisSignature]>) => {
314
+ x: import("../../../index.js").DefaultedXAxis[];
315
+ y: import("../../../index.js").DefaultedYAxis[];
316
+ } | undefined];
317
+ recomputations: () => number;
318
+ resetRecomputations: () => void;
319
+ dependencyRecomputations: () => number;
320
+ resetDependencyRecomputations: () => void;
321
+ } & {
322
+ memoize: typeof import("reselect").weakMapMemoize;
323
+ argsMemoize: typeof import("reselect").weakMapMemoize;
324
+ }];
325
+ recomputations: () => number;
326
+ resetRecomputations: () => void;
327
+ dependencyRecomputations: () => number;
328
+ resetDependencyRecomputations: () => void;
329
+ } & {
330
+ memoize: typeof import("reselect").weakMapMemoize;
331
+ argsMemoize: typeof import("reselect").weakMapMemoize;
332
+ }, (state: any, axisId: AxisId) => AxisId];
333
+ recomputations: () => number;
334
+ resetRecomputations: () => void;
335
+ dependencyRecomputations: () => number;
336
+ resetDependencyRecomputations: () => void;
337
+ } & {
338
+ memoize: typeof import("reselect").weakMapMemoize;
339
+ argsMemoize: typeof import("reselect").weakMapMemoize;
340
+ };
182
341
  /**
183
342
  * The only interesting selectors that merge axis data and zoom if provided.
184
343
  */
@@ -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.selectorChartZoomIsInteracting = exports.selectorChartYAxis = exports.selectorChartXAxis = exports.createZoomMap = void 0;
7
+ exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartYAxis = exports.selectorChartXAxis = 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");
@@ -28,10 +28,11 @@ const selectorChartZoomState = state => state.zoom;
28
28
  */
29
29
 
30
30
  const selectorChartZoomIsInteracting = exports.selectorChartZoomIsInteracting = (0, _selectors.createSelector)(selectorChartZoomState, zoom => zoom?.isInteracting);
31
- const selectorChartZoomMap = (0, _selectors.createSelector)(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
31
+ const selectorChartZoomMap = exports.selectorChartZoomMap = (0, _selectors.createSelector)(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
32
32
  const selectorChartXZoomOptionsLookup = (0, _selectors.createSelector)(_useChartCartesianAxisLayout.selectorChartRawXAxis, (0, _createZoomLookup.createZoomLookup)('x'));
33
33
  const selectorChartYZoomOptionsLookup = (0, _selectors.createSelector)(_useChartCartesianAxisLayout.selectorChartRawYAxis, (0, _createZoomLookup.createZoomLookup)('y'));
34
34
  const selectorChartZoomOptionsLookup = exports.selectorChartZoomOptionsLookup = (0, _selectors.createSelector)([selectorChartXZoomOptionsLookup, selectorChartYZoomOptionsLookup], (xLookup, yLookup) => (0, _extends2.default)({}, xLookup, yLookup));
35
+ const selectorChartAxisZoomOptionsLookup = exports.selectorChartAxisZoomOptionsLookup = (0, _selectors.createSelector)([selectorChartXZoomOptionsLookup, selectorChartYZoomOptionsLookup, (state, axisId) => axisId], (xLookup, yLookup, axisId) => xLookup[axisId] ?? yLookup[axisId]);
35
36
  const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup, _useChartSeries.selectorChartSeriesConfig, _useChartSeries.selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)({
36
37
  zoomMap,
37
38
  zoomOptions,
@@ -67,6 +67,16 @@ export interface ZoomOptions {
67
67
  * @default 'keep'
68
68
  */
69
69
  filterMode?: ZoomFilterMode;
70
+ /**
71
+ * Configures the zoom slider. The slider is an element that shows the zoomed range and allows its manipulation.
72
+ */
73
+ slider?: ZoomSliderOptions;
74
+ }
75
+ export interface ZoomSliderOptions {
76
+ /**
77
+ * If `true`, the slider will be shown.
78
+ */
79
+ enabled?: boolean;
70
80
  }
71
81
  export type ZoomAxisFilters = Record<AxisId, ExtremumFilter>;
72
82
  export type GetZoomAxisFilters = (params: {
@@ -6,27 +6,42 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useChartHighlight = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _useAssertModelConsistency = require("@mui/x-internals/useAssertModelConsistency");
9
10
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
10
11
  var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
11
12
  const useChartHighlight = ({
12
13
  store,
13
- params,
14
- models
14
+ params
15
15
  }) => {
16
+ (0, _useAssertModelConsistency.useAssertModelConsistency)({
17
+ warningPrefix: 'MUI X Charts',
18
+ componentName: 'Chart',
19
+ propName: 'highlightedItem',
20
+ controlled: params.highlightedItem,
21
+ defaultValue: null
22
+ });
16
23
  (0, _useEnhancedEffect.default)(() => {
17
- store.update(prevState => (0, _extends2.default)({}, prevState, {
24
+ store.update(prevState => prevState.highlight.item === params.highlightedItem ? prevState : (0, _extends2.default)({}, prevState, {
18
25
  highlight: (0, _extends2.default)({}, prevState.highlight, {
19
- item: models.highlightedItem.value
26
+ item: params.highlightedItem
20
27
  })
21
28
  }));
22
- }, [store, models.highlightedItem.value]);
29
+ }, [store, params.highlightedItem]);
23
30
  const clearHighlight = (0, _useEventCallback.default)(() => {
24
31
  params.onHighlightChange?.(null);
25
- models.highlightedItem.setControlledValue(null);
32
+ store.update(prev => (0, _extends2.default)({}, prev, {
33
+ highlight: {
34
+ item: null
35
+ }
36
+ }));
26
37
  });
27
38
  const setHighlight = (0, _useEventCallback.default)(newItem => {
28
39
  params.onHighlightChange?.(newItem);
29
- models.highlightedItem.setControlledValue(newItem);
40
+ store.update(prev => (0, _extends2.default)({}, prev, {
41
+ highlight: {
42
+ item: newItem
43
+ }
44
+ }));
30
45
  });
31
46
  return {
32
47
  instance: {
@@ -36,14 +51,14 @@ const useChartHighlight = ({
36
51
  };
37
52
  };
38
53
  exports.useChartHighlight = useChartHighlight;
39
- useChartHighlight.models = {
40
- highlightedItem: {
41
- getDefaultValue: () => null
42
- }
43
- };
54
+ useChartHighlight.getDefaultizedParams = ({
55
+ params
56
+ }) => (0, _extends2.default)({}, params, {
57
+ highlightedItem: params.highlightedItem ?? null
58
+ });
44
59
  useChartHighlight.getInitialState = params => ({
45
60
  highlight: {
46
- item: params.highlightedItem ?? null
61
+ item: params.highlightedItem
47
62
  }
48
63
  });
49
64
  useChartHighlight.params = {
@@ -2,6 +2,5 @@ import type { ChartAnyPluginSignature, ChartPlugin } from "./plugin.js";
2
2
  type IsAny<T> = 0 extends 1 & T ? true : false;
3
3
  export type OptionalIfEmpty<A extends string, B> = keyof B extends never ? Partial<Record<A, B>> : IsAny<B> extends true ? Partial<Record<A, B>> : Record<A, B>;
4
4
  export type MergeSignaturesProperty<TSignatures extends readonly any[], TProperty extends keyof ChartAnyPluginSignature> = TSignatures extends readonly [plugin: infer P, ...otherPlugin: infer R] ? P extends ChartAnyPluginSignature ? P[TProperty] & MergeSignaturesProperty<R, TProperty> : {} : {};
5
- export type ConvertPluginsIntoSignatures<TPlugins extends readonly ChartPlugin<ChartAnyPluginSignature>[]> = TPlugins extends readonly [plugin: infer TPlugin, ...otherPlugin: infer R] ? R extends readonly ChartPlugin<any>[] ? TPlugin extends ChartPlugin<infer TSignature> ? readonly [TSignature, ...ConvertPluginsIntoSignatures<R>] : never : never : [];
6
5
  export type ConvertSignaturesIntoPlugins<TSignatures extends readonly ChartAnyPluginSignature[]> = TSignatures extends readonly [signature: infer TSignature, ...otherSignatures: infer R] ? R extends readonly ChartAnyPluginSignature[] ? TSignature extends ChartAnyPluginSignature ? readonly [ChartPlugin<TSignature>, ...ConvertSignaturesIntoPlugins<R>] : never : never : [];
7
6
  export {};
@@ -12,11 +12,6 @@ export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature>
12
12
  * The parameters after being processed with the default values.
13
13
  */
14
14
  params: ChartUsedDefaultizedParams<TSignature>;
15
- /**
16
- * The store of controlled properties.
17
- * If they are not controlled by the user, they will be initialized by the plugin.
18
- */
19
- models: ChartUsedControlModels<TSignature>;
20
15
  /**
21
16
  * The store that can be used to access the state of other plugins.
22
17
  */
@@ -38,9 +33,6 @@ export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature>
38
33
  */
39
34
  seriesConfig: ChartSeriesConfig<any>;
40
35
  }
41
- type ChartControlModelsInitializer<TSignature extends ChartAnyPluginSignature> = { [TControlled in keyof TSignature['models']]: {
42
- getDefaultValue: (params: TSignature['defaultizedParams']) => Exclude<TSignature['defaultizedParams'][TControlled], undefined>;
43
- } };
44
36
  type ChartResponse<TSignature extends ChartAnyPluginSignature> = OptionalIfEmpty<'publicAPI', TSignature['publicAPI']> & OptionalIfEmpty<'instance', TSignature['instance']>;
45
37
  export type ChartPluginSignature<T extends {
46
38
  params?: {};
@@ -83,14 +75,6 @@ export type ChartPluginSignature<T extends {
83
75
  publicAPI: T extends {
84
76
  publicAPI: {};
85
77
  } ? T['publicAPI'] : {};
86
- /**
87
- * A helper for controlled properties.
88
- * Properties defined here can be controlled by the user. If they are not controlled, they will be initialized by the plugin.
89
- */
90
- models: T extends {
91
- defaultizedParams: {};
92
- modelNames: keyof T['defaultizedParams'];
93
- } ? { [TControlled in T['modelNames']]-?: ChartControlModel<Exclude<T['defaultizedParams'][TControlled], undefined>> } : {};
94
78
  /**
95
79
  * Any plugins that this plugin depends on.
96
80
  */
@@ -110,7 +94,6 @@ export type ChartAnyPluginSignature = ChartPluginSignature<{
110
94
  instance: any;
111
95
  publicAPI: any;
112
96
  state: any;
113
- modelNames: any;
114
97
  dependencies: any;
115
98
  optionalDependencies: any;
116
99
  }>;
@@ -124,14 +107,6 @@ export type ChartUsedInstance<TSignature extends ChartAnyPluginSignature> = Plug
124
107
  */
125
108
  $$signature: TSignature;
126
109
  };
127
- export interface ChartControlModel<TValue> {
128
- name: string;
129
- value: TValue;
130
- setControlledValue: (value: TValue | ((prevValue: TValue) => TValue)) => void;
131
- isControlled: boolean;
132
- }
133
- type RemoveSetValue<Models extends Record<string, ChartControlModel<any>>> = { [K in keyof Models]: Omit<Models[K], 'setValue'> };
134
- export type ChartUsedControlModels<TSignature extends ChartAnyPluginSignature> = TSignature['models'] & RemoveSetValue<MergeSignaturesProperty<ChartRequiredPlugins<TSignature>, 'models'>>;
135
110
  export type ChartUsedStore<TSignature extends ChartAnyPluginSignature> = ChartStore<[TSignature, ...TSignature['dependencies']], TSignature['optionalDependencies']>;
136
111
  export type ChartPlugin<TSignature extends ChartAnyPluginSignature> = {
137
112
  /**
@@ -152,11 +127,6 @@ export type ChartPlugin<TSignature extends ChartAnyPluginSignature> = {
152
127
  * @returns {TSignature['state']} The initial state of the plugin.
153
128
  */
154
129
  getInitialState?: (params: ChartUsedDefaultizedParams<TSignature>, currentState: MergeSignaturesProperty<ChartRequiredPlugins<TSignature>, 'state'>, seriesConfig: ChartSeriesConfig<any>) => TSignature['state'];
155
- /**
156
- * The configuration of properties that can be controlled by the user.
157
- * If they are not controlled, they will be initialized by the plugin.
158
- */
159
- models?: ChartControlModelsInitializer<TSignature>;
160
130
  /**
161
131
  * An object where each property used by the plugin is set to `true`.
162
132
  */
@@ -23,4 +23,4 @@ export declare function useCharts<TSeriesType extends ChartSeriesType, TSignatur
23
23
  chartRootRef: React.RefObject<HTMLDivElement | null>;
24
24
  };
25
25
  };
26
- export declare function useChartApiInitialization<T>(inputApiRef: React.RefObject<T | undefined> | undefined): T;
26
+ export declare function useChartApiInitialization<T>(inputApiRef: React.RefObject<T | undefined> | undefined): React.RefObject<T>;
@@ -12,7 +12,6 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
12
12
  var _ChartStore = require("../plugins/utils/ChartStore");
13
13
  var _corePlugins = require("../plugins/corePlugins");
14
14
  var _extractPluginParamsFromProps = require("./extractPluginParamsFromProps");
15
- var _useChartModels = require("./useChartModels");
16
15
  let globalId = 0;
17
16
 
18
17
  /**
@@ -32,7 +31,6 @@ function useCharts(inPlugins, props, seriesConfig) {
32
31
  props
33
32
  });
34
33
  pluginParams.id = pluginParams.id ?? chartId;
35
- const models = (0, _useChartModels.useChartModels)(plugins, pluginParams);
36
34
  const instanceRef = React.useRef({});
37
35
  const instance = instanceRef.current;
38
36
  const publicAPI = useChartApiInitialization(props.apiRef);
@@ -62,11 +60,10 @@ function useCharts(inPlugins, props, seriesConfig) {
62
60
  store: storeRef.current,
63
61
  svgRef: innerSvgRef,
64
62
  chartRootRef: innerChartRootRef,
65
- seriesConfig,
66
- models
63
+ seriesConfig
67
64
  });
68
65
  if (pluginResponse.publicAPI) {
69
- Object.assign(publicAPI, pluginResponse.publicAPI);
66
+ Object.assign(publicAPI.current, pluginResponse.publicAPI);
70
67
  }
71
68
  if (pluginResponse.instance) {
72
69
  Object.assign(instance, pluginResponse.instance);
@@ -75,7 +72,7 @@ function useCharts(inPlugins, props, seriesConfig) {
75
72
  plugins.forEach(runPlugin);
76
73
  const contextValue = React.useMemo(() => ({
77
74
  store: storeRef.current,
78
- publicAPI,
75
+ publicAPI: publicAPI.current,
79
76
  instance,
80
77
  svgRef: innerSvgRef,
81
78
  chartRootRef: innerChartRootRef
@@ -84,14 +81,16 @@ function useCharts(inPlugins, props, seriesConfig) {
84
81
  contextValue
85
82
  };
86
83
  }
84
+ function initializeInputApiRef(inputApiRef) {
85
+ if (inputApiRef.current == null) {
86
+ inputApiRef.current = {};
87
+ }
88
+ return inputApiRef;
89
+ }
87
90
  function useChartApiInitialization(inputApiRef) {
88
91
  const fallbackPublicApiRef = React.useRef({});
89
92
  if (inputApiRef) {
90
- if (inputApiRef.current == null) {
91
- // eslint-disable-next-line react-compiler/react-compiler
92
- inputApiRef.current = {};
93
- }
94
- return inputApiRef.current;
93
+ return initializeInputApiRef(inputApiRef);
95
94
  }
96
- return fallbackPublicApiRef.current;
95
+ return fallbackPublicApiRef;
97
96
  }
package/locales/enUS.d.ts CHANGED
@@ -8,6 +8,8 @@ export declare const enUS: {
8
8
  localeText: {
9
9
  loading?: string | undefined;
10
10
  noData?: string | undefined;
11
+ zoomIn?: string | undefined;
12
+ zoomOut?: string | undefined;
11
13
  };
12
14
  };
13
15
  };
package/locales/enUS.js CHANGED
@@ -10,7 +10,9 @@ var _getChartsLocalization = require("./utils/getChartsLocalization");
10
10
  const enUSLocaleText = exports.enUSLocaleText = {
11
11
  // Overlay
12
12
  loading: 'Loading data…',
13
- noData: 'No data to display'
13
+ noData: 'No data to display',
14
+ zoomIn: 'Zoom in',
15
+ zoomOut: 'Zoom out'
14
16
  };
15
17
  const DEFAULT_LOCALE = exports.DEFAULT_LOCALE = enUSLocaleText;
16
18
  const enUS = exports.enUS = (0, _getChartsLocalization.getChartsLocalization)(enUSLocaleText);
package/locales/frFR.d.ts CHANGED
@@ -7,6 +7,8 @@ export declare const frFR: {
7
7
  localeText: {
8
8
  loading?: string | undefined;
9
9
  noData?: string | undefined;
10
+ zoomIn?: string | undefined;
11
+ zoomOut?: string | undefined;
10
12
  };
11
13
  };
12
14
  };
package/locales/frFR.js CHANGED
@@ -9,5 +9,7 @@ const frFRLocalText = exports.frFRLocalText = {
9
9
  // Overlay
10
10
  loading: 'Chargement…',
11
11
  noData: 'Pas de données'
12
+ // zoomIn: 'Zoom in',
13
+ // zoomOut: 'Zoom out',
12
14
  };
13
15
  const frFR = exports.frFR = (0, _getChartsLocalization.getChartsLocalization)(frFRLocalText);
@@ -7,5 +7,13 @@ export interface ChartsLocaleText {
7
7
  * Title displayed in the overlay if there is no data to display.
8
8
  */
9
9
  noData: string;
10
+ /**
11
+ * Tooltip text shown when hovering over the zoom in button.
12
+ */
13
+ zoomIn: string;
14
+ /**
15
+ * Tooltip text shown when hovering over the zoom out button.
16
+ */
17
+ zoomOut: string;
10
18
  }
11
19
  export type ChartsTranslationKeys = keyof ChartsLocaleText;
@@ -11,6 +11,8 @@ export declare const getChartsLocalization: (chartsTranslations: Partial<ChartsL
11
11
  localeText: {
12
12
  loading?: string | undefined;
13
13
  noData?: string | undefined;
14
+ zoomIn?: string | undefined;
15
+ zoomOut?: string | undefined;
14
16
  };
15
17
  };
16
18
  };
package/models/axis.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleOrdinal, ScalePoint, ScalePower, ScaleSequential, ScaleThreshold, ScaleTime } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { SxProps } from '@mui/system/styleFunctionSx';
3
3
  import { type MakeOptional, MakeRequired } from '@mui/x-internals/types';
4
+ import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
4
5
  import { ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
5
6
  import type { TickParams } from "../hooks/useTicks.js";
6
7
  import { ChartsTextProps } from "../ChartsText/index.js";
@@ -370,7 +371,7 @@ export type PolarAxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisP
370
371
  */
371
372
  triggerTooltip?: boolean;
372
373
  };
373
- export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = MakeRequired<Omit<AxisConfig<S, V, AxisProps>, 'scaleType'>, 'offset'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
374
+ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = MakeRequired<Omit<DefaultedAxis<S, V, AxisProps>, 'scaleType'>, 'offset'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
374
375
  /**
375
376
  * An indication of the expected number of ticks.
376
377
  */
@@ -409,12 +410,18 @@ export type XAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleNam
409
410
  export type YAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsYAxisProps>, 'id'> : never;
410
411
  export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? AxisConfig<S, V, ChartsRotationAxisProps> : never;
411
412
  export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? AxisConfig<S, V, ChartsRadiusAxisProps> : never;
413
+ /**
414
+ * The axis configuration with missing values filled with default values.
415
+ */
416
+ export type DefaultedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsXAxisProps | ChartsYAxisProps> = AxisConfig<S, V, AxisProps> & {
417
+ zoom: DefaultizedZoomOptions | undefined;
418
+ };
412
419
  /**
413
420
  * The x-axis configuration with missing values filled with default values.
414
421
  */
415
- export type DefaultedXAxis<S extends ScaleName = ScaleName, V = any> = AxisConfig<S, V, ChartsXAxisProps>;
422
+ export type DefaultedXAxis<S extends ScaleName = ScaleName, V = any> = DefaultedAxis<S, V, ChartsXAxisProps>;
416
423
  /**
417
424
  * The y-axis configuration with missing values filled with default values.
418
425
  */
419
- export type DefaultedYAxis<S extends ScaleName = ScaleName, V = any> = AxisConfig<S, V, ChartsYAxisProps>;
426
+ export type DefaultedYAxis<S extends ScaleName = ScaleName, V = any> = DefaultedAxis<S, V, ChartsYAxisProps>;
420
427
  export {};
package/models/axis.js CHANGED
@@ -29,6 +29,10 @@ function isPointScaleConfig(scaleConfig) {
29
29
  * The data format returned by onAxisClick.
30
30
  */
31
31
 
32
+ /**
33
+ * The axis configuration with missing values filled with default values.
34
+ */
35
+
32
36
  /**
33
37
  * The x-axis configuration with missing values filled with default values.
34
38
  */
package/models/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from "./stacking.js";
3
3
  export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis } from "./axis.js";
4
4
  export type { PropsFromSlot } from '@mui/x-internals/slots';
5
5
  export type { Position } from "./position.js";
6
- export type { CurveType } from "./curve.js";
6
+ export type { CurveType } from "./curve.js";
7
+ export type { ChartBaseCommonProps, ChartBaseIconProps, ChartsIconSlots, ChartsBaseSlots } from "./slots/index.js";
@@ -0,0 +1,13 @@
1
+ import type * as React from 'react';
2
+ export type ChartBaseCommonProps<T = HTMLElement> = React.DOMAttributes<T> & {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ [k: `aria-${string}`]: any;
6
+ [k: `data-${string}`]: any;
7
+ };
8
+ export type ChartBaseIconProps = ChartBaseCommonProps<SVGSVGElement> & {
9
+ titleAccess?: string;
10
+ };
11
+ export type ChartBaseIconButtonProps = ChartBaseCommonProps & {
12
+ ref?: React.Ref<HTMLButtonElement>;
13
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { ChartBaseIconButtonProps } from "./chartsBaseSlotProps.js";
3
+ export interface ChartsBaseSlots {
4
+ baseIconButton: React.ComponentType<ChartBaseIconButtonProps>;
5
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export interface ChartsIconSlots {}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./chartsBaseSlots.js";
2
+ export * from "./chartsBaseSlotProps.js";
3
+ export * from "./chartsIconSlots.js";