@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
@@ -1,6 +1,41 @@
1
1
  import { ChartRootSelector } from "../../utils/selectors.js";
2
2
  import type { UseChartDimensionsSignature } from "./useChartDimensions.types.js";
3
3
  export declare const selectorChartDimensionsState: ChartRootSelector<UseChartDimensionsSignature>;
4
+ export declare const selectorChartMargin: ((state: import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<{}> & {
5
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
6
+ }) => import("./useChartDimensions.types.js").ChartMargin) & {
7
+ clearCache: () => void;
8
+ resultsCount: () => number;
9
+ resetResultsCount: () => void;
10
+ } & {
11
+ resultFunc: (resultFuncArgs_0: {
12
+ margin: import("./useChartDimensions.types.js").ChartMargin;
13
+ width: number;
14
+ height: number;
15
+ propsWidth: number | undefined;
16
+ propsHeight: number | undefined;
17
+ }) => import("./useChartDimensions.types.js").ChartMargin;
18
+ memoizedResultFunc: ((resultFuncArgs_0: {
19
+ margin: import("./useChartDimensions.types.js").ChartMargin;
20
+ width: number;
21
+ height: number;
22
+ propsWidth: number | undefined;
23
+ propsHeight: number | undefined;
24
+ }) => import("./useChartDimensions.types.js").ChartMargin) & {
25
+ clearCache: () => void;
26
+ resultsCount: () => number;
27
+ resetResultsCount: () => void;
28
+ };
29
+ lastResult: () => import("./useChartDimensions.types.js").ChartMargin;
30
+ dependencies: [ChartRootSelector<UseChartDimensionsSignature>];
31
+ recomputations: () => number;
32
+ resetRecomputations: () => void;
33
+ dependencyRecomputations: () => number;
34
+ resetDependencyRecomputations: () => void;
35
+ } & {
36
+ memoize: typeof import("reselect").weakMapMemoize;
37
+ argsMemoize: typeof import("reselect").weakMapMemoize;
38
+ };
4
39
  export declare const selectorChartDrawingArea: ((state: import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & Partial<{}> & {
5
40
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
6
41
  } & Partial<import("../../../index.js").UseChartCartesianAxisState>) => {
@@ -1,7 +1,7 @@
1
1
  import { createSelector } from "../../utils/selectors.js";
2
2
  import { selectorChartBottomAxisSize, selectorChartLeftAxisSize, selectorChartRightAxisSize, selectorChartTopAxisSize } from "../../featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js";
3
3
  export const selectorChartDimensionsState = state => state.dimensions;
4
- const selectorChartMargin = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.margin);
4
+ export const selectorChartMargin = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.margin);
5
5
  const selectorChartWidth = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.width);
6
6
  const selectorChartHeight = createSelector(selectorChartDimensionsState, dimensionsState => dimensionsState.height);
7
7
  const selectorChartTopMargin = createSelector(selectorChartMargin, margin => margin.top);
@@ -1,5 +1,4 @@
1
- import { AxisConfig, ScaleName } from "../../../../models/index.js";
2
- import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps, AxisId } from "../../../../models/axis.js";
1
+ import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps, AxisId, DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
3
2
  import { ChartSeriesType } from "../../../../models/seriesType/config.js";
4
3
  import type { ChartDrawingArea } from "../../../../hooks/index.js";
5
4
  import { ChartSeriesConfig } from "../../models/seriesConfig/index.js";
@@ -19,11 +18,11 @@ type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
19
18
  getFilters?: GetZoomAxisFilters;
20
19
  };
21
20
  export declare function computeAxisValue<T extends ChartSeriesType>(options: ComputeCommonParams<T> & {
22
- axis?: AxisConfig<ScaleName, any, ChartsYAxisProps>[];
21
+ axis?: DefaultedYAxis[];
23
22
  axisDirection: 'y';
24
23
  }): ComputeResult<ChartsYAxisProps>;
25
24
  export declare function computeAxisValue<T extends ChartSeriesType>(options: ComputeCommonParams<T> & {
26
- axis?: AxisConfig<ScaleName, any, ChartsXAxisProps>[];
25
+ axis?: DefaultedXAxis[];
27
26
  axisDirection: 'x';
28
27
  }): ComputeResult<ChartsXAxisProps>;
29
28
  export {};
@@ -1,5 +1,13 @@
1
+ import { ZoomOptions } from "./zoom.types.js";
1
2
  import { XAxis, YAxis } from "../../../../models/index.js";
2
3
  import { DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
3
4
  import { DatasetType } from "../../../../models/seriesType/config.js";
4
- export declare function defaultizeXAxis(inAxes: readonly XAxis[] | undefined, dataset: Readonly<DatasetType> | undefined): DefaultedXAxis[];
5
- export declare function defaultizeYAxis(inAxes: readonly YAxis[] | undefined, dataset: Readonly<DatasetType> | undefined): DefaultedYAxis[];
5
+ type InXAxis = XAxis & {
6
+ zoom?: boolean | ZoomOptions;
7
+ };
8
+ export declare function defaultizeXAxis(inAxes: readonly InXAxis[] | undefined, dataset: Readonly<DatasetType> | undefined): DefaultedXAxis[];
9
+ type InYAxis = YAxis & {
10
+ zoom?: boolean | ZoomOptions;
11
+ };
12
+ export declare function defaultizeYAxis(inAxes: readonly InYAxis[] | undefined, dataset: Readonly<DatasetType> | undefined): DefaultedYAxis[];
13
+ export {};
@@ -1,4 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { ZOOM_SLIDER_SIZE } from "../../../constants.js";
3
+ import { defaultizeZoom } from "./defaultizeZoom.js";
2
4
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY, DEFAULT_AXIS_SIZE_HEIGHT, DEFAULT_AXIS_SIZE_WIDTH, AXIS_LABEL_DEFAULT_HEIGHT } from "../../../../constants/index.js";
3
5
  export function defaultizeXAxis(inAxes, dataset) {
4
6
  const offsets = {
@@ -17,17 +19,22 @@ export function defaultizeXAxis(inAxes, dataset) {
17
19
  const defaultPosition = index === 0 ? 'bottom' : 'none';
18
20
  const position = axisConfig.position ?? defaultPosition;
19
21
  const defaultHeight = DEFAULT_AXIS_SIZE_HEIGHT + (axisConfig.label ? AXIS_LABEL_DEFAULT_HEIGHT : 0);
22
+ const id = axisConfig.id ?? `defaultized-x-axis-${index}`;
20
23
  const sharedConfig = _extends({
21
- id: `defaultized-x-axis-${index}`,
22
24
  offset: offsets[position]
23
25
  }, axisConfig, {
26
+ id,
24
27
  position,
25
- height: axisConfig.height ?? defaultHeight
28
+ height: axisConfig.height ?? defaultHeight,
29
+ zoom: defaultizeZoom(axisConfig.zoom, id, 'x')
26
30
  });
27
31
 
28
32
  // Increment the offset for the next axis
29
33
  if (position !== 'none') {
30
34
  offsets[position] += sharedConfig.height;
35
+ if (sharedConfig.zoom?.slider.enabled) {
36
+ offsets[position] += ZOOM_SLIDER_SIZE;
37
+ }
31
38
  }
32
39
 
33
40
  // If `dataKey` is NOT provided
@@ -62,17 +69,22 @@ export function defaultizeYAxis(inAxes, dataset) {
62
69
  const defaultPosition = index === 0 ? 'left' : 'none';
63
70
  const position = axisConfig.position ?? defaultPosition;
64
71
  const defaultWidth = DEFAULT_AXIS_SIZE_WIDTH + (axisConfig.label ? AXIS_LABEL_DEFAULT_HEIGHT : 0);
72
+ const id = axisConfig.id ?? `defaultized-y-axis-${index}`;
65
73
  const sharedConfig = _extends({
66
- id: `defaultized-y-axis-${index}`,
67
74
  offset: offsets[position]
68
75
  }, axisConfig, {
76
+ id,
69
77
  position,
70
- width: axisConfig.width ?? defaultWidth
78
+ width: axisConfig.width ?? defaultWidth,
79
+ zoom: defaultizeZoom(axisConfig.zoom, id, 'y')
71
80
  });
72
81
 
73
82
  // Increment the offset for the next axis
74
83
  if (position !== 'none') {
75
84
  offsets[position] += sharedConfig.width;
85
+ if (sharedConfig.zoom?.slider.enabled) {
86
+ offsets[position] += ZOOM_SLIDER_SIZE;
87
+ }
76
88
  }
77
89
 
78
90
  // If `dataKey` is NOT provided
@@ -6,7 +6,10 @@ const defaultZoomOptions = {
6
6
  minSpan: 10,
7
7
  maxSpan: 100,
8
8
  panning: true,
9
- filterMode: 'keep'
9
+ filterMode: 'keep',
10
+ slider: {
11
+ enabled: false
12
+ }
10
13
  };
11
14
  export const defaultizeZoom = (zoom, axisId, axisDirection) => {
12
15
  if (!zoom) {
@@ -21,5 +24,7 @@ export const defaultizeZoom = (zoom, axisId, axisDirection) => {
21
24
  return _extends({
22
25
  axisId,
23
26
  axisDirection
24
- }, defaultZoomOptions, zoom);
27
+ }, defaultZoomOptions, zoom, {
28
+ slider: _extends({}, defaultZoomOptions.slider, zoom.slider)
29
+ });
25
30
  };
@@ -1,6 +1,7 @@
1
+ import { ZOOM_SLIDER_SIZE } from "../../../constants.js";
1
2
  import { selectorChartRawXAxis, selectorChartRawYAxis } from "./useChartCartesianAxisLayout.selectors.js";
2
3
  import { createSelector } from "../../utils/selectors.js";
3
- export const selectorChartLeftAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) : acc, 0));
4
- export const selectorChartRightAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) : acc, 0));
5
- export const selectorChartTopAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) : acc, 0));
6
- export const selectorChartBottomAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) : acc, 0));
4
+ export const selectorChartLeftAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'left' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? ZOOM_SLIDER_SIZE : 0) : acc, 0));
5
+ export const selectorChartRightAxisSize = createSelector([selectorChartRawYAxis], yAxis => (yAxis ?? []).reduce((acc, axis) => axis.position === 'right' ? acc + (axis.width || 0) + (axis.zoom?.slider.enabled ? ZOOM_SLIDER_SIZE : 0) : acc, 0));
6
+ export const selectorChartTopAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'top' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? ZOOM_SLIDER_SIZE : 0) : acc, 0));
7
+ export const selectorChartBottomAxisSize = createSelector([selectorChartRawXAxis], xAxis => (xAxis ?? []).reduce((acc, axis) => axis.position === 'bottom' ? acc + (axis.height || 0) + (axis.zoom?.slider.enabled ? ZOOM_SLIDER_SIZE : 0) : acc, 0));
@@ -47,9 +47,10 @@ export type UseChartCartesianAxisDefaultizedParameters<S extends ScaleName = Sca
47
47
  defaultizedXAxis: DefaultedXAxis<S>[];
48
48
  defaultizedYAxis: DefaultedYAxis<S>[];
49
49
  };
50
- export interface DefaultizedZoomOptions extends Required<ZoomOptions> {
50
+ export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slider'>> {
51
51
  axisId: AxisId;
52
52
  axisDirection: 'x' | 'y';
53
+ slider: NonNullable<Required<ZoomOptions['slider']>>;
53
54
  }
54
55
  export interface UseChartCartesianAxisState {
55
56
  /**
@@ -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
  */
@@ -20,10 +20,11 @@ const selectorChartZoomState = state => state.zoom;
20
20
  */
21
21
 
22
22
  export const selectorChartZoomIsInteracting = createSelector(selectorChartZoomState, zoom => zoom?.isInteracting);
23
- const selectorChartZoomMap = createSelector(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
23
+ export const selectorChartZoomMap = createSelector(selectorChartZoomState, zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
24
24
  const selectorChartXZoomOptionsLookup = createSelector(selectorChartRawXAxis, createZoomLookup('x'));
25
25
  const selectorChartYZoomOptionsLookup = createSelector(selectorChartRawYAxis, createZoomLookup('y'));
26
26
  export const selectorChartZoomOptionsLookup = createSelector([selectorChartXZoomOptionsLookup, selectorChartYZoomOptionsLookup], (xLookup, yLookup) => _extends({}, xLookup, yLookup));
27
+ export const selectorChartAxisZoomOptionsLookup = createSelector([selectorChartXZoomOptionsLookup, selectorChartYZoomOptionsLookup, (state, axisId) => axisId], (xLookup, yLookup, axisId) => xLookup[axisId] ?? yLookup[axisId]);
27
28
  const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
28
29
  zoomMap,
29
30
  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: {
@@ -1,25 +1,40 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { useAssertModelConsistency } from '@mui/x-internals/useAssertModelConsistency';
2
3
  import useEventCallback from '@mui/utils/useEventCallback';
3
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
4
5
  export const useChartHighlight = ({
5
6
  store,
6
- params,
7
- models
7
+ params
8
8
  }) => {
9
+ useAssertModelConsistency({
10
+ warningPrefix: 'MUI X Charts',
11
+ componentName: 'Chart',
12
+ propName: 'highlightedItem',
13
+ controlled: params.highlightedItem,
14
+ defaultValue: null
15
+ });
9
16
  useEnhancedEffect(() => {
10
- store.update(prevState => _extends({}, prevState, {
17
+ store.update(prevState => prevState.highlight.item === params.highlightedItem ? prevState : _extends({}, prevState, {
11
18
  highlight: _extends({}, prevState.highlight, {
12
- item: models.highlightedItem.value
19
+ item: params.highlightedItem
13
20
  })
14
21
  }));
15
- }, [store, models.highlightedItem.value]);
22
+ }, [store, params.highlightedItem]);
16
23
  const clearHighlight = useEventCallback(() => {
17
24
  params.onHighlightChange?.(null);
18
- models.highlightedItem.setControlledValue(null);
25
+ store.update(prev => _extends({}, prev, {
26
+ highlight: {
27
+ item: null
28
+ }
29
+ }));
19
30
  });
20
31
  const setHighlight = useEventCallback(newItem => {
21
32
  params.onHighlightChange?.(newItem);
22
- models.highlightedItem.setControlledValue(newItem);
33
+ store.update(prev => _extends({}, prev, {
34
+ highlight: {
35
+ item: newItem
36
+ }
37
+ }));
23
38
  });
24
39
  return {
25
40
  instance: {
@@ -28,14 +43,14 @@ export const useChartHighlight = ({
28
43
  }
29
44
  };
30
45
  };
31
- useChartHighlight.models = {
32
- highlightedItem: {
33
- getDefaultValue: () => null
34
- }
35
- };
46
+ useChartHighlight.getDefaultizedParams = ({
47
+ params
48
+ }) => _extends({}, params, {
49
+ highlightedItem: params.highlightedItem ?? null
50
+ });
36
51
  useChartHighlight.getInitialState = params => ({
37
52
  highlight: {
38
- item: params.highlightedItem ?? null
53
+ item: params.highlightedItem
39
54
  }
40
55
  });
41
56
  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>;
@@ -3,7 +3,6 @@ import useId from '@mui/utils/useId';
3
3
  import { ChartStore } from "../plugins/utils/ChartStore.js";
4
4
  import { CHART_CORE_PLUGINS } from "../plugins/corePlugins/index.js";
5
5
  import { extractPluginParamsFromProps } from "./extractPluginParamsFromProps.js";
6
- import { useChartModels } from "./useChartModels.js";
7
6
  let globalId = 0;
8
7
 
9
8
  /**
@@ -23,7 +22,6 @@ export function useCharts(inPlugins, props, seriesConfig) {
23
22
  props
24
23
  });
25
24
  pluginParams.id = pluginParams.id ?? chartId;
26
- const models = useChartModels(plugins, pluginParams);
27
25
  const instanceRef = React.useRef({});
28
26
  const instance = instanceRef.current;
29
27
  const publicAPI = useChartApiInitialization(props.apiRef);
@@ -53,11 +51,10 @@ export function useCharts(inPlugins, props, seriesConfig) {
53
51
  store: storeRef.current,
54
52
  svgRef: innerSvgRef,
55
53
  chartRootRef: innerChartRootRef,
56
- seriesConfig,
57
- models
54
+ seriesConfig
58
55
  });
59
56
  if (pluginResponse.publicAPI) {
60
- Object.assign(publicAPI, pluginResponse.publicAPI);
57
+ Object.assign(publicAPI.current, pluginResponse.publicAPI);
61
58
  }
62
59
  if (pluginResponse.instance) {
63
60
  Object.assign(instance, pluginResponse.instance);
@@ -66,7 +63,7 @@ export function useCharts(inPlugins, props, seriesConfig) {
66
63
  plugins.forEach(runPlugin);
67
64
  const contextValue = React.useMemo(() => ({
68
65
  store: storeRef.current,
69
- publicAPI,
66
+ publicAPI: publicAPI.current,
70
67
  instance,
71
68
  svgRef: innerSvgRef,
72
69
  chartRootRef: innerChartRootRef
@@ -75,14 +72,16 @@ export function useCharts(inPlugins, props, seriesConfig) {
75
72
  contextValue
76
73
  };
77
74
  }
75
+ function initializeInputApiRef(inputApiRef) {
76
+ if (inputApiRef.current == null) {
77
+ inputApiRef.current = {};
78
+ }
79
+ return inputApiRef;
80
+ }
78
81
  export function useChartApiInitialization(inputApiRef) {
79
82
  const fallbackPublicApiRef = React.useRef({});
80
83
  if (inputApiRef) {
81
- if (inputApiRef.current == null) {
82
- // eslint-disable-next-line react-compiler/react-compiler
83
- inputApiRef.current = {};
84
- }
85
- return inputApiRef.current;
84
+ return initializeInputApiRef(inputApiRef);
86
85
  }
87
- return fallbackPublicApiRef.current;
86
+ return fallbackPublicApiRef;
88
87
  }
@@ -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
  };