@mui/x-charts 7.11.1 → 7.12.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 (177) hide show
  1. package/BarChart/BarChart.js +0 -2
  2. package/BarChart/BarElement.d.ts +20 -20
  3. package/BarChart/BarElement.js +3 -3
  4. package/BarChart/BarLabel/BarLabel.d.ts +20 -20
  5. package/BarChart/BarLabel/BarLabelItem.js +2 -2
  6. package/BarChart/formatter.js +1 -1
  7. package/CHANGELOG.md +110 -4
  8. package/ChartContainer/ChartContainer.d.ts +3 -3
  9. package/ChartContainer/ChartContainer.js +3 -5
  10. package/ChartContainer/useChartContainerProps.d.ts +50 -52
  11. package/ChartContainer/useChartContainerProps.js +2 -2
  12. package/ChartContainer/useDefaultizeAxis.d.ts +24 -25
  13. package/ChartContainer/usePluginsMerge.d.ts +1 -1
  14. package/ChartsLegend/ChartsLegend.js +6 -6
  15. package/ChartsLegend/DefaultChartsLegend.d.ts +1 -1
  16. package/ChartsLegend/LegendPerItem.js +2 -2
  17. package/ChartsLegend/utils.d.ts +1 -1
  18. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
  19. package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  20. package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
  21. package/ChartsTooltip/ChartsTooltip.js +10 -10
  22. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
  23. package/ChartsXAxis/ChartsXAxis.js +5 -5
  24. package/ChartsYAxis/ChartsYAxis.js +6 -6
  25. package/Gauge/GaugeReferenceArc.js +1 -1
  26. package/Gauge/GaugeValueArc.js +1 -1
  27. package/LineChart/AnimatedArea.d.ts +20 -20
  28. package/LineChart/AnimatedArea.js +1 -1
  29. package/LineChart/AnimatedLine.d.ts +20 -20
  30. package/LineChart/AnimatedLine.js +1 -1
  31. package/LineChart/AreaElement.js +2 -2
  32. package/LineChart/AreaPlot.js +1 -1
  33. package/LineChart/LineChart.js +0 -2
  34. package/LineChart/LineElement.js +2 -2
  35. package/LineChart/LinePlot.js +1 -1
  36. package/LineChart/MarkElement.js +1 -1
  37. package/LineChart/formatter.js +1 -1
  38. package/PieChart/PieArc.js +1 -1
  39. package/PieChart/PieArcLabel.js +1 -1
  40. package/PieChart/PieChart.js +0 -2
  41. package/PieChart/formatter.js +1 -1
  42. package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  43. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +2 -2
  44. package/ScatterChart/ScatterChart.js +0 -2
  45. package/SparkLineChart/SparkLineChart.js +0 -2
  46. package/context/CartesianProvider/computeValue.d.ts +1 -1
  47. package/context/CartesianProvider/computeValue.js +1 -1
  48. package/context/CartesianProvider/defaultizeAxis.d.ts +24 -25
  49. package/context/CartesianProvider/getAxisExtremum.d.ts +1 -1
  50. package/context/{SeriesContextProvider.d.ts → SeriesProvider/Series.types.d.ts} +4 -8
  51. package/context/SeriesProvider/Series.types.js +5 -0
  52. package/context/SeriesProvider/SeriesContext.d.ts +4 -0
  53. package/context/SeriesProvider/SeriesContext.js +16 -0
  54. package/context/SeriesProvider/SeriesProvider.d.ts +5 -0
  55. package/context/SeriesProvider/SeriesProvider.js +37 -0
  56. package/context/SeriesProvider/index.d.ts +12 -0
  57. package/context/SeriesProvider/index.js +49 -0
  58. package/context/SeriesProvider/processSeries.d.ts +17 -0
  59. package/context/SeriesProvider/processSeries.js +55 -0
  60. package/esm/BarChart/BarChart.js +0 -2
  61. package/esm/BarChart/BarElement.js +2 -2
  62. package/esm/BarChart/BarLabel/BarLabelItem.js +1 -1
  63. package/esm/BarChart/formatter.js +1 -1
  64. package/esm/ChartContainer/ChartContainer.js +3 -5
  65. package/esm/ChartContainer/useChartContainerProps.js +2 -2
  66. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  67. package/esm/ChartsLegend/LegendPerItem.js +1 -1
  68. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  69. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  70. package/esm/ChartsTooltip/ChartsTooltip.js +3 -3
  71. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
  72. package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
  73. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  74. package/esm/Gauge/GaugeReferenceArc.js +1 -1
  75. package/esm/Gauge/GaugeValueArc.js +1 -1
  76. package/esm/LineChart/AnimatedArea.js +1 -1
  77. package/esm/LineChart/AnimatedLine.js +1 -1
  78. package/esm/LineChart/AreaElement.js +1 -1
  79. package/esm/LineChart/AreaPlot.js +1 -1
  80. package/esm/LineChart/LineChart.js +0 -2
  81. package/esm/LineChart/LineElement.js +1 -1
  82. package/esm/LineChart/LinePlot.js +1 -1
  83. package/esm/LineChart/MarkElement.js +1 -1
  84. package/esm/LineChart/formatter.js +1 -1
  85. package/esm/PieChart/PieArc.js +1 -1
  86. package/esm/PieChart/PieArcLabel.js +1 -1
  87. package/esm/PieChart/PieChart.js +0 -2
  88. package/esm/PieChart/formatter.js +1 -1
  89. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  90. package/esm/ScatterChart/ScatterChart.js +0 -2
  91. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  92. package/esm/context/CartesianProvider/computeValue.js +1 -1
  93. package/esm/context/SeriesProvider/Series.types.js +1 -0
  94. package/esm/context/SeriesProvider/SeriesContext.js +8 -0
  95. package/esm/context/SeriesProvider/SeriesProvider.js +30 -0
  96. package/esm/context/SeriesProvider/index.js +8 -0
  97. package/esm/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +9 -34
  98. package/esm/hooks/useReducedMotion.js +2 -2
  99. package/esm/hooks/useSeries.js +1 -1
  100. package/esm/internals/colorScale.js +1 -1
  101. package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
  102. package/esm/internals/getCurve.js +1 -1
  103. package/esm/internals/getScale.js +1 -1
  104. package/esm/internals/index.js +1 -1
  105. package/esm/internals/stackSeries.js +1 -1
  106. package/esm/internals/useAnimatedPath.js +1 -1
  107. package/hooks/useReducedMotion.js +2 -2
  108. package/hooks/useSeries.d.ts +1 -1
  109. package/hooks/useSeries.js +2 -2
  110. package/hooks/useTicks.d.ts +1 -1
  111. package/index.js +1 -1
  112. package/internals/colorScale.d.ts +3 -3
  113. package/internals/colorScale.js +1 -1
  114. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
  115. package/internals/defaultizeColor.d.ts +1 -1
  116. package/internals/getCurve.d.ts +1 -1
  117. package/internals/getCurve.js +1 -1
  118. package/internals/getScale.js +1 -1
  119. package/internals/index.d.ts +1 -1
  120. package/internals/index.js +4 -4
  121. package/internals/isBandScale.d.ts +1 -1
  122. package/internals/stackSeries.d.ts +1 -1
  123. package/internals/stackSeries.js +1 -1
  124. package/internals/useAnimatedPath.js +1 -1
  125. package/models/axis.d.ts +2 -2
  126. package/models/seriesType/pie.d.ts +1 -1
  127. package/models/z-axis.d.ts +1 -1
  128. package/modern/BarChart/BarChart.js +0 -2
  129. package/modern/BarChart/BarElement.js +2 -2
  130. package/modern/BarChart/BarLabel/BarLabelItem.js +1 -1
  131. package/modern/BarChart/formatter.js +1 -1
  132. package/modern/ChartContainer/ChartContainer.js +3 -5
  133. package/modern/ChartContainer/useChartContainerProps.js +2 -2
  134. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  135. package/modern/ChartsLegend/LegendPerItem.js +1 -1
  136. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  137. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  138. package/modern/ChartsTooltip/ChartsTooltip.js +3 -3
  139. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
  140. package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
  141. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  142. package/modern/Gauge/GaugeReferenceArc.js +1 -1
  143. package/modern/Gauge/GaugeValueArc.js +1 -1
  144. package/modern/LineChart/AnimatedArea.js +1 -1
  145. package/modern/LineChart/AnimatedLine.js +1 -1
  146. package/modern/LineChart/AreaElement.js +1 -1
  147. package/modern/LineChart/AreaPlot.js +1 -1
  148. package/modern/LineChart/LineChart.js +0 -2
  149. package/modern/LineChart/LineElement.js +1 -1
  150. package/modern/LineChart/LinePlot.js +1 -1
  151. package/modern/LineChart/MarkElement.js +1 -1
  152. package/modern/LineChart/formatter.js +1 -1
  153. package/modern/PieChart/PieArc.js +1 -1
  154. package/modern/PieChart/PieArcLabel.js +1 -1
  155. package/modern/PieChart/PieChart.js +0 -2
  156. package/modern/PieChart/formatter.js +1 -1
  157. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  158. package/modern/ScatterChart/ScatterChart.js +0 -2
  159. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  160. package/modern/context/CartesianProvider/computeValue.js +1 -1
  161. package/modern/context/SeriesProvider/Series.types.js +1 -0
  162. package/modern/context/SeriesProvider/SeriesContext.js +8 -0
  163. package/modern/context/SeriesProvider/SeriesProvider.js +30 -0
  164. package/modern/context/SeriesProvider/index.js +8 -0
  165. package/modern/context/{SeriesContextProvider.js → SeriesProvider/processSeries.js} +9 -34
  166. package/modern/hooks/useReducedMotion.js +2 -2
  167. package/modern/hooks/useSeries.js +1 -1
  168. package/modern/index.js +1 -1
  169. package/modern/internals/colorScale.js +1 -1
  170. package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -1
  171. package/modern/internals/getCurve.js +1 -1
  172. package/modern/internals/getScale.js +1 -1
  173. package/modern/internals/index.js +1 -1
  174. package/modern/internals/stackSeries.js +1 -1
  175. package/modern/internals/useAnimatedPath.js +1 -1
  176. package/package.json +6 -23
  177. package/context/SeriesContextProvider.js +0 -81
@@ -254,7 +254,6 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
254
254
  * Notice it is a single [[AxisConfig]] object, not an array of configuration.
255
255
  */
256
256
  xAxis: _propTypes.default.shape({
257
- axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
258
257
  classes: _propTypes.default.object,
259
258
  colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
260
259
  colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
@@ -306,7 +305,6 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
306
305
  * Notice it is a single [[AxisConfig]] object, not an array of configuration.
307
306
  */
308
307
  yAxis: _propTypes.default.shape({
309
- axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
310
308
  classes: _propTypes.default.object,
311
309
  colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
312
310
  colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
@@ -3,7 +3,7 @@ import { ChartsXAxisProps, ChartsAxisProps, ChartsYAxisProps, AxisId } from '../
3
3
  import { CartesianChartSeriesType, DatasetType, ExtremumGetter } from '../../models/seriesType/config';
4
4
  import { DefaultizedAxisConfig } from './CartesianContext';
5
5
  import { DrawingArea } from '../DrawingProvider';
6
- import { FormattedSeries } from '../SeriesContextProvider';
6
+ import { FormattedSeries } from '../SeriesProvider';
7
7
  export declare function computeValue(options: {
8
8
  drawingArea: DrawingArea;
9
9
  formattedSeries: FormattedSeries;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.computeValue = computeValue;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _d3Scale = require("d3-scale");
9
+ var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
10
10
  var _axis = require("../../models/axis");
11
11
  var _colorScale = require("../../internals/colorScale");
12
12
  var _useTicks = require("../../hooks/useTicks");
@@ -2,35 +2,34 @@ import { MakeOptional } from '../../models/helpers';
2
2
  import { AxisConfig, ScaleName } from '../../models';
3
3
  import { ChartsAxisProps } from '../../models/axis';
4
4
  export declare const defaultizeAxis: (inAxis: MakeOptional<AxisConfig<ScaleName, any, ChartsAxisProps>, "id">[] | undefined, axisName: "x" | "y") => {
5
- reverse?: boolean;
6
- fill?: string;
7
- stroke?: string;
5
+ reverse?: boolean | undefined;
6
+ fill?: string | undefined;
7
+ stroke?: string | undefined;
8
8
  data?: any[] | undefined;
9
- label?: string;
10
- max?: number | Date;
11
- min?: number | Date;
12
- classes?: Partial<import("../..").ChartsAxisClasses>;
13
- slots?: Partial<import("../../models/axis").ChartsAxisSlots>;
14
- slotProps?: Partial<import("../../models/axis").ChartsAxisSlotProps>;
15
- dataKey?: string;
9
+ label?: string | undefined;
10
+ max?: (number | Date) | undefined;
11
+ min?: (number | Date) | undefined;
12
+ classes?: Partial<import("../..").ChartsAxisClasses> | undefined;
13
+ slots?: Partial<import("../../models/axis").ChartsAxisSlots> | undefined;
14
+ slotProps?: Partial<import("../../models/axis").ChartsAxisSlotProps> | undefined;
15
+ dataKey?: string | undefined;
16
16
  valueFormatter?: ((value: any, context: import("../../models/axis").AxisValueFormatterContext) => string) | undefined;
17
17
  colorMap?: import("../../models/colorMapping").ContinuousColorConfig<number | Date> | import("../../models/colorMapping").PiecewiseColorConfig<number | Date> | import("../../models/colorMapping").OrdinalColorConfig<string | number | Date> | undefined;
18
- tickMaxStep?: number;
19
- tickMinStep?: number;
20
- tickNumber?: number;
21
- tickPlacement?: "start" | "end" | "middle" | "extremities";
22
- tickLabelPlacement?: "middle" | "tick";
23
- scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
24
- axisId?: import("../../models/axis").AxisId;
25
- disableLine?: boolean;
26
- disableTicks?: boolean;
27
- tickFontSize?: number;
18
+ tickMaxStep?: number | undefined;
19
+ tickMinStep?: number | undefined;
20
+ tickNumber?: number | undefined;
21
+ disableLine?: boolean | undefined;
22
+ disableTicks?: boolean | undefined;
23
+ tickFontSize?: number | undefined;
28
24
  tickLabelStyle?: import("../..").ChartsTextProps["style"];
29
25
  labelStyle?: import("../..").ChartsTextProps["style"];
30
- tickLabelInterval?: "auto" | ((value: any, index: number) => boolean);
31
- labelFontSize?: number;
32
- tickSize?: number;
33
- tickInterval?: "auto" | ((value: any, index: number) => boolean) | any[];
34
- hideTooltip?: boolean;
26
+ tickLabelInterval?: ("auto" | ((value: any, index: number) => boolean)) | undefined;
27
+ labelFontSize?: number | undefined;
28
+ tickSize?: number | undefined;
29
+ tickInterval?: ("auto" | ((value: any, index: number) => boolean) | any[]) | undefined;
30
+ tickPlacement?: ("start" | "end" | "middle" | "extremities") | undefined;
31
+ tickLabelPlacement?: ("middle" | "tick") | undefined;
32
+ scaleType?: "linear" | "time" | "log" | "band" | "point" | "pow" | "sqrt" | "utc" | undefined;
33
+ hideTooltip?: boolean | undefined;
35
34
  id: import("../../models/axis").AxisId;
36
35
  }[];
@@ -1,4 +1,4 @@
1
1
  import { AxisConfig, ExtremumGettersConfig } from '../../models';
2
2
  import { ExtremumGetterResult } from '../../models/seriesType/config';
3
- import { FormattedSeries } from '../SeriesContextProvider';
3
+ import { FormattedSeries } from '../SeriesProvider';
4
4
  export declare const getAxisExtremum: (axis: AxisConfig, getters: ExtremumGettersConfig, isDefaultAxis: boolean, formattedSeries: FormattedSeries) => ExtremumGetterResult;
@@ -1,12 +1,11 @@
1
1
  import * as React from 'react';
2
- import { AllSeriesType } from '../models/seriesType';
3
- import { ChartSeriesType, DatasetType, FormatterParams, FormatterResult } from '../models/seriesType/config';
4
- import { ChartsColorPalette } from '../colorPalettes';
5
- import { Initializable } from './context.types';
2
+ import { AllSeriesType } from '../../models/seriesType';
3
+ import { ChartSeriesType, DatasetType, FormatterParams, FormatterResult } from '../../models/seriesType/config';
4
+ import { ChartsColorPalette } from '../../colorPalettes';
6
5
  export type SeriesFormatterType<T extends ChartSeriesType> = (series: AllSeriesType<T>[], colors: string[], dataset?: DatasetType) => {
7
6
  [type in T]?: FormatterResult<type>;
8
7
  };
9
- export type SeriesContextProviderProps<T extends ChartSeriesType = ChartSeriesType> = {
8
+ export type SeriesProviderProps<T extends ChartSeriesType = ChartSeriesType> = {
10
9
  dataset?: DatasetType;
11
10
  /**
12
11
  * The array of series to display.
@@ -28,9 +27,6 @@ export type SeriesContextProviderProps<T extends ChartSeriesType = ChartSeriesTy
28
27
  export type FormattedSeries = {
29
28
  [type in ChartSeriesType]?: FormatterResult<type>;
30
29
  };
31
- export declare const SeriesContext: React.Context<Initializable<FormattedSeries>>;
32
30
  export type SeriesFormatterConfig<T extends ChartSeriesType = ChartSeriesType> = {
33
31
  [K in T]?: (series: FormatterParams<K>, dataset?: DatasetType) => any;
34
32
  };
35
- declare function SeriesContextProvider<T extends ChartSeriesType>(props: SeriesContextProviderProps<T>): React.JSX.Element;
36
- export { SeriesContextProvider };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { Initializable } from '../context.types';
3
+ import { FormattedSeries } from './Series.types';
4
+ export declare const SeriesContext: React.Context<Initializable<FormattedSeries>>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SeriesContext = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const SeriesContext = exports.SeriesContext = /*#__PURE__*/React.createContext({
11
+ isInitialized: false,
12
+ data: {}
13
+ });
14
+ if (process.env.NODE_ENV !== 'production') {
15
+ SeriesContext.displayName = 'SeriesContext';
16
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { ChartSeriesType } from '../../models/seriesType/config';
3
+ import { SeriesProviderProps } from './Series.types';
4
+ declare function SeriesProvider<T extends ChartSeriesType>(props: SeriesProviderProps<T>): React.JSX.Element;
5
+ export { SeriesProvider };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SeriesProvider = SeriesProvider;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _styles = require("@mui/material/styles");
9
+ var _colorPalettes = require("../../colorPalettes");
10
+ var _SeriesContext = require("./SeriesContext");
11
+ var _processSeries = require("./processSeries");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ function SeriesProvider(props) {
16
+ const {
17
+ series,
18
+ dataset,
19
+ colors = _colorPalettes.blueberryTwilightPalette,
20
+ seriesFormatters,
21
+ children
22
+ } = props;
23
+ const theme = (0, _styles.useTheme)();
24
+ const formattedSeries = React.useMemo(() => ({
25
+ isInitialized: true,
26
+ data: (0, _processSeries.preprocessSeries)({
27
+ series,
28
+ colors: typeof colors === 'function' ? colors(theme.palette.mode) : colors,
29
+ seriesFormatters,
30
+ dataset: dataset
31
+ })
32
+ }), [series, colors, theme.palette.mode, seriesFormatters, dataset]);
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SeriesContext.SeriesContext.Provider, {
34
+ value: formattedSeries,
35
+ children: children
36
+ });
37
+ }
@@ -0,0 +1,12 @@
1
+ export * from './SeriesProvider';
2
+ export * from './SeriesContext';
3
+ export * from './Series.types';
4
+ declare const seriesProviderUtils: {
5
+ preprocessSeries: <T extends import("../../internals").ChartSeriesType>({ series, colors, seriesFormatters, dataset, }: {
6
+ series: import("../..").AllSeriesType<T>[];
7
+ colors: string[];
8
+ seriesFormatters: import("./Series.types").SeriesFormatterConfig<T>;
9
+ dataset?: import("../../internals").DatasetType;
10
+ }) => import("./Series.types").FormattedSeries;
11
+ };
12
+ export { seriesProviderUtils };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ seriesProviderUtils: true
8
+ };
9
+ exports.seriesProviderUtils = void 0;
10
+ var _processSeries = require("./processSeries");
11
+ var _SeriesProvider = require("./SeriesProvider");
12
+ Object.keys(_SeriesProvider).forEach(function (key) {
13
+ if (key === "default" || key === "__esModule") return;
14
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
15
+ if (key in exports && exports[key] === _SeriesProvider[key]) return;
16
+ Object.defineProperty(exports, key, {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _SeriesProvider[key];
20
+ }
21
+ });
22
+ });
23
+ var _SeriesContext = require("./SeriesContext");
24
+ Object.keys(_SeriesContext).forEach(function (key) {
25
+ if (key === "default" || key === "__esModule") return;
26
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27
+ if (key in exports && exports[key] === _SeriesContext[key]) return;
28
+ Object.defineProperty(exports, key, {
29
+ enumerable: true,
30
+ get: function () {
31
+ return _SeriesContext[key];
32
+ }
33
+ });
34
+ });
35
+ var _Series = require("./Series.types");
36
+ Object.keys(_Series).forEach(function (key) {
37
+ if (key === "default" || key === "__esModule") return;
38
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
39
+ if (key in exports && exports[key] === _Series[key]) return;
40
+ Object.defineProperty(exports, key, {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _Series[key];
44
+ }
45
+ });
46
+ });
47
+ const seriesProviderUtils = exports.seriesProviderUtils = {
48
+ preprocessSeries: _processSeries.preprocessSeries
49
+ };
@@ -0,0 +1,17 @@
1
+ import { AllSeriesType } from '../../models/seriesType';
2
+ import { ChartSeriesType, DatasetType } from '../../models/seriesType/config';
3
+ import { FormattedSeries, SeriesFormatterConfig } from './Series.types';
4
+ /**
5
+ * This methods is the interface between what the developer is providing and what components receives
6
+ * To simplify the components behaviors, it groups series by type, such that LinePlots props are not updated if some line data are modified
7
+ * It also add defaultized values such as the ids, colors
8
+ * @param series The array of series provided by the developer
9
+ * @param colors The color palette used to defaultize series colors
10
+ * @returns An object structuring all the series by type.
11
+ */
12
+ export declare const preprocessSeries: <T extends ChartSeriesType>({ series, colors, seriesFormatters, dataset, }: {
13
+ series: AllSeriesType<T>[];
14
+ colors: string[];
15
+ seriesFormatters: SeriesFormatterConfig<T>;
16
+ dataset?: DatasetType;
17
+ }) => FormattedSeries;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.preprocessSeries = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _defaultizeColor = require("../../internals/defaultizeColor");
10
+ /**
11
+ * This methods is the interface between what the developer is providing and what components receives
12
+ * To simplify the components behaviors, it groups series by type, such that LinePlots props are not updated if some line data are modified
13
+ * It also add defaultized values such as the ids, colors
14
+ * @param series The array of series provided by the developer
15
+ * @param colors The color palette used to defaultize series colors
16
+ * @returns An object structuring all the series by type.
17
+ */
18
+ const preprocessSeries = ({
19
+ series,
20
+ colors,
21
+ seriesFormatters,
22
+ dataset
23
+ }) => {
24
+ // Group series by type
25
+ const seriesGroups = {};
26
+ series.forEach((seriesData, seriesIndex) => {
27
+ const {
28
+ id = `auto-generated-id-${seriesIndex}`,
29
+ type
30
+ } = seriesData;
31
+ if (seriesGroups[type] === undefined) {
32
+ seriesGroups[type] = {
33
+ series: {},
34
+ seriesOrder: []
35
+ };
36
+ }
37
+ if (seriesGroups[type]?.series[id] !== undefined) {
38
+ throw new Error(`MUI X: series' id "${id}" is not unique.`);
39
+ }
40
+ seriesGroups[type].series[id] = (0, _extends2.default)({
41
+ id
42
+ }, (0, _defaultizeColor.defaultizeColor)(seriesData, seriesIndex, colors));
43
+ seriesGroups[type].seriesOrder.push(id);
44
+ });
45
+ const formattedSeries = {};
46
+ // Apply formatter on a type group
47
+ Object.keys(seriesFormatters).forEach(type => {
48
+ const group = seriesGroups[type];
49
+ if (group !== undefined) {
50
+ formattedSeries[type] = seriesFormatters[type]?.(group, dataset) ?? seriesGroups[type];
51
+ }
52
+ });
53
+ return formattedSeries;
54
+ };
55
+ exports.preprocessSeries = preprocessSeries;
@@ -239,7 +239,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
239
239
  * An array of [[AxisConfig]] objects.
240
240
  */
241
241
  xAxis: PropTypes.arrayOf(PropTypes.shape({
242
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
243
242
  classes: PropTypes.object,
244
243
  colorMap: PropTypes.oneOfType([PropTypes.shape({
245
244
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -292,7 +291,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
292
291
  * An array of [[AxisConfig]] objects.
293
292
  */
294
293
  yAxis: PropTypes.arrayOf(PropTypes.shape({
295
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
296
294
  classes: PropTypes.object,
297
295
  colorMap: PropTypes.oneOfType([PropTypes.shape({
298
296
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -4,11 +4,11 @@ const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps",
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import { useSlotProps } from '@mui/base/utils';
7
+ import useSlotProps from '@mui/utils/useSlotProps';
8
8
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
9
  import { styled } from '@mui/material/styles';
10
- import { color as d3Color } from 'd3-color';
11
10
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
11
+ import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
12
12
  import { animated } from '@react-spring/web';
13
13
  import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
14
14
  import { useItemHighlighted } from '../context';
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["seriesId", "classes", "color", "style", "dataIndex", "barLabel", "slots", "slotProps", "height", "width", "value"],
4
4
  _excluded2 = ["ownerState"];
5
5
  import * as React from 'react';
6
- import { useSlotProps } from '@mui/base/utils';
6
+ import useSlotProps from '@mui/utils/useSlotProps';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useUtilityClasses } from './barLabelClasses';
9
9
  import { getBarLabel } from './getBarLabel';
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { stack as d3Stack } from 'd3-shape';
2
+ import { stack as d3Stack } from '@mui/x-charts-vendor/d3-shape';
3
3
  import { getStackingGroups } from '../internals/stackSeries';
4
4
  import { defaultizeValueFormatter } from '../internals/defaultizeValueFormatter';
5
5
  let warnOnce = false;
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { DrawingProvider } from '../context/DrawingProvider';
5
- import { SeriesContextProvider } from '../context/SeriesContextProvider';
5
+ import { SeriesProvider } from '../context/SeriesProvider';
6
6
  import { InteractionProvider } from '../context/InteractionProvider';
7
7
  import { ColorProvider } from '../context/ColorProvider';
8
8
  import { ChartsSurface } from '../ChartsSurface';
@@ -16,7 +16,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
16
16
  children,
17
17
  drawingProviderProps,
18
18
  colorProviderProps,
19
- seriesContextProps,
19
+ seriesProviderProps,
20
20
  cartesianContextProps,
21
21
  zAxisContextProps,
22
22
  highlightedProviderProps,
@@ -24,7 +24,7 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
24
24
  } = useChartContainerProps(props, ref);
25
25
  return /*#__PURE__*/_jsx(DrawingProvider, _extends({}, drawingProviderProps, {
26
26
  children: /*#__PURE__*/_jsx(ColorProvider, _extends({}, colorProviderProps, {
27
- children: /*#__PURE__*/_jsx(SeriesContextProvider, _extends({}, seriesContextProps, {
27
+ children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
28
28
  children: /*#__PURE__*/_jsx(CartesianContextProvider, _extends({}, cartesianContextProps, {
29
29
  children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
30
30
  children: /*#__PURE__*/_jsx(InteractionProvider, {
@@ -121,7 +121,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
121
121
  * An array of [[AxisConfig]] objects.
122
122
  */
123
123
  xAxis: PropTypes.arrayOf(PropTypes.shape({
124
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
125
124
  classes: PropTypes.object,
126
125
  colorMap: PropTypes.oneOfType([PropTypes.shape({
127
126
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -174,7 +173,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
174
173
  * An array of [[AxisConfig]] objects.
175
174
  */
176
175
  yAxis: PropTypes.arrayOf(PropTypes.shape({
177
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
178
176
  classes: PropTypes.object,
179
177
  colorMap: PropTypes.oneOfType([PropTypes.shape({
180
178
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -42,7 +42,7 @@ export const useChartContainerProps = (props, ref) => {
42
42
  const colorProviderProps = {
43
43
  colorProcessors
44
44
  };
45
- const seriesContextProps = {
45
+ const seriesProviderProps = {
46
46
  series,
47
47
  colors,
48
48
  dataset,
@@ -76,7 +76,7 @@ export const useChartContainerProps = (props, ref) => {
76
76
  children,
77
77
  drawingProviderProps,
78
78
  colorProviderProps,
79
- seriesContextProps,
79
+ seriesProviderProps,
80
80
  cartesianContextProps,
81
81
  zAxisContextProps,
82
82
  highlightedProviderProps,
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { useSlotProps } from '@mui/base/utils';
5
- import { unstable_composeClasses as composeClasses } from '@mui/utils';
4
+ import useSlotProps from '@mui/utils/useSlotProps';
5
+ import composeClasses from '@mui/utils/composeClasses';
6
6
  import { useThemeProps, useTheme } from '@mui/material/styles';
7
7
  import { getSeriesToDisplay } from './utils';
8
8
  import { getLegendUtilityClass } from './chartsLegendClasses';
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["rotate", "dominantBaseline"];
4
4
  import * as React from 'react';
5
- import { NoSsr } from '@mui/base/NoSsr';
5
+ import NoSsr from '@mui/material/NoSsr';
6
6
  import { useTheme, styled } from '@mui/material/styles';
7
7
  import { ChartsText } from '../ChartsText';
8
8
  import { getWordsByLines } from '../internals/getWordsByLines';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useSlotProps } from '@mui/base/utils';
3
+ import useSlotProps from '@mui/utils/useSlotProps';
4
4
  import { useCartesianContext } from '../context/CartesianProvider';
5
5
  import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
6
6
  import { ZAxisContext } from '../context/ZAxisContextProvider';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useSlotProps } from '@mui/base/utils';
3
+ import useSlotProps from '@mui/utils/useSlotProps';
4
4
  import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
5
5
  import { useCartesianContext } from '../context/CartesianProvider';
6
6
  import { ZAxisContext } from '../context/ZAxisContextProvider';
@@ -3,9 +3,9 @@ import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
5
  import { styled, useThemeProps } from '@mui/material/styles';
6
- import { Popper } from '@mui/base/Popper';
7
- import { NoSsr } from '@mui/base/NoSsr';
8
- import { useSlotProps } from '@mui/base/utils';
6
+ import Popper from '@mui/material/Popper';
7
+ import NoSsr from '@mui/material/NoSsr';
8
+ import useSlotProps from '@mui/utils/useSlotProps';
9
9
  import { InteractionContext } from '../context/InteractionProvider';
10
10
  import { generateVirtualElement, useMouseTracker, getTooltipHasData } from './utils';
11
11
  import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Delaunay } from 'd3-delaunay';
3
+ import { Delaunay } from '@mui/x-charts-vendor/d3-delaunay';
4
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
5
  import { InteractionContext } from '../context/InteractionProvider';
6
6
  import { useCartesianContext } from '../context/CartesianProvider';
@@ -3,8 +3,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["scale", "tickNumber", "reverse"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { useSlotProps } from '@mui/base/utils';
7
- import { unstable_composeClasses as composeClasses } from '@mui/utils';
6
+ import useSlotProps from '@mui/utils/useSlotProps';
7
+ import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { useCartesianContext } from '../context/CartesianProvider';
10
10
  import { useTicks } from '../hooks/useTicks';
@@ -3,8 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["scale", "tickNumber"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { useSlotProps } from '@mui/base/utils';
7
- import { unstable_composeClasses as composeClasses } from '@mui/utils';
6
+ import useSlotProps from '@mui/utils/useSlotProps';
7
+ import composeClasses from '@mui/utils/composeClasses';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { useCartesianContext } from '../context/CartesianProvider';
10
10
  import { useTicks } from '../hooks/useTicks';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { arc as d3Arc } from 'd3-shape';
3
+ import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useGaugeState } from './GaugeProvider';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { arc as d3Arc } from 'd3-shape';
3
+ import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useGaugeState } from './GaugeProvider';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -4,8 +4,8 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { styled } from '@mui/material/styles';
7
- import { color as d3Color } from 'd3-color';
8
7
  import { animated, useSpring } from '@react-spring/web';
8
+ import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
9
9
  import { useAnimatedPath } from '../internals/useAnimatedPath';
10
10
  import { cleanId } from '../internals/cleanId';
11
11
  import { useChartId, useDrawingArea } from '../hooks';
@@ -4,7 +4,7 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { animated, useSpring } from '@react-spring/web';
7
- import { color as d3Color } from 'd3-color';
7
+ import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
8
8
  import { styled } from '@mui/material/styles';
9
9
  import { useAnimatedPath } from '../internals/useAnimatedPath';
10
10
  import { cleanId } from '../internals/cleanId';
@@ -4,7 +4,7 @@ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps",
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
- import { useSlotProps } from '@mui/base/utils';
7
+ import useSlotProps from '@mui/utils/useSlotProps';
8
8
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
9
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
10
10
  import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { area as d3Area } from 'd3-shape';
6
+ import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
7
7
  import { useCartesianContext } from '../context/CartesianProvider';
8
8
  import { AreaElement } from './AreaElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
@@ -240,7 +240,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
240
240
  * An array of [[AxisConfig]] objects.
241
241
  */
242
242
  xAxis: PropTypes.arrayOf(PropTypes.shape({
243
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
244
243
  classes: PropTypes.object,
245
244
  colorMap: PropTypes.oneOfType([PropTypes.shape({
246
245
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -293,7 +292,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
293
292
  * An array of [[AxisConfig]] objects.
294
293
  */
295
294
  yAxis: PropTypes.arrayOf(PropTypes.shape({
296
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
297
295
  classes: PropTypes.object,
298
296
  colorMap: PropTypes.oneOfType([PropTypes.shape({
299
297
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,