@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
@@ -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", "skipAnimation", "onItemClick"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { line as d3Line } from 'd3-shape';
6
+ import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
7
7
  import { useCartesianContext } from '../context/CartesianProvider';
8
8
  import { LineElement } from './LineElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
@@ -7,7 +7,7 @@ import composeClasses from '@mui/utils/composeClasses';
7
7
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
8
  import { styled } from '@mui/material/styles';
9
9
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
10
- import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from 'd3-shape';
10
+ import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
11
11
  import { animated, to, useSpring } from '@react-spring/web';
12
12
  import { getSymbol } from '../internals/getSymbol';
13
13
  import { InteractionContext } from '../context/InteractionProvider';
@@ -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 warnedOnce = false;
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle", "highlightScope"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { arc as d3Arc } from 'd3-shape';
6
+ import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
7
7
  import { animated, to } from '@react-spring/web';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
9
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
@@ -4,7 +4,7 @@ const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingA
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { animated, to } from '@react-spring/web';
7
- import { arc as d3Arc } from 'd3-shape';
7
+ import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
8
8
  import composeClasses from '@mui/utils/composeClasses';
9
9
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
10
10
  import { styled } from '@mui/material/styles';
@@ -284,7 +284,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
284
284
  * An array of [[AxisConfig]] objects.
285
285
  */
286
286
  xAxis: PropTypes.arrayOf(PropTypes.shape({
287
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
288
287
  classes: PropTypes.object,
289
288
  colorMap: PropTypes.oneOfType([PropTypes.shape({
290
289
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -337,7 +336,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
337
336
  * An array of [[AxisConfig]] objects.
338
337
  */
339
338
  yAxis: PropTypes.arrayOf(PropTypes.shape({
340
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
341
339
  classes: PropTypes.object,
342
340
  colorMap: PropTypes.oneOfType([PropTypes.shape({
343
341
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { pie as d3Pie } from 'd3-shape';
2
+ import { pie as d3Pie } from '@mui/x-charts-vendor/d3-shape';
3
3
  import { getLabel } from '../internals/getLabel';
4
4
  const getSortingComparator = (comparator = 'none') => {
5
5
  if (typeof comparator === 'function') {
@@ -96,7 +96,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
96
96
  * An array of [[AxisConfig]] objects.
97
97
  */
98
98
  xAxis: PropTypes.arrayOf(PropTypes.shape({
99
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
100
99
  classes: PropTypes.object,
101
100
  colorMap: PropTypes.oneOfType([PropTypes.shape({
102
101
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -149,7 +148,6 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
149
148
  * An array of [[AxisConfig]] objects.
150
149
  */
151
150
  yAxis: PropTypes.arrayOf(PropTypes.shape({
152
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
153
151
  classes: PropTypes.object,
154
152
  colorMap: PropTypes.oneOfType([PropTypes.shape({
155
153
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -221,7 +221,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
221
221
  * An array of [[AxisConfig]] objects.
222
222
  */
223
223
  xAxis: PropTypes.arrayOf(PropTypes.shape({
224
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
225
224
  classes: PropTypes.object,
226
225
  colorMap: PropTypes.oneOfType([PropTypes.shape({
227
226
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -274,7 +273,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
274
273
  * An array of [[AxisConfig]] objects.
275
274
  */
276
275
  yAxis: PropTypes.arrayOf(PropTypes.shape({
277
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
278
276
  classes: PropTypes.object,
279
277
  colorMap: PropTypes.oneOfType([PropTypes.shape({
280
278
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -245,7 +245,6 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
245
245
  * Notice it is a single [[AxisConfig]] object, not an array of configuration.
246
246
  */
247
247
  xAxis: PropTypes.shape({
248
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
249
248
  classes: PropTypes.object,
250
249
  colorMap: PropTypes.oneOfType([PropTypes.shape({
251
250
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -297,7 +296,6 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
297
296
  * Notice it is a single [[AxisConfig]] object, not an array of configuration.
298
297
  */
299
298
  yAxis: PropTypes.shape({
300
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
301
299
  classes: PropTypes.object,
302
300
  colorMap: PropTypes.oneOfType([PropTypes.shape({
303
301
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { scaleBand, scalePoint, scaleTime } from 'd3-scale';
2
+ import { scaleBand, scalePoint, scaleTime } from '@mui/x-charts-vendor/d3-scale';
3
3
  import { isBandScaleConfig, isPointScaleConfig } from '../../models/axis';
4
4
  import { getColorScale, getOrdinalColorScale } from '../../internals/colorScale';
5
5
  import { getTickNumber } from '../../hooks/useTicks';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ export const SeriesContext = /*#__PURE__*/React.createContext({
3
+ isInitialized: false,
4
+ data: {}
5
+ });
6
+ if (process.env.NODE_ENV !== 'production') {
7
+ SeriesContext.displayName = 'SeriesContext';
8
+ }
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import { useTheme } from '@mui/material/styles';
3
+ import { blueberryTwilightPalette } from '../../colorPalettes';
4
+ import { SeriesContext } from './SeriesContext';
5
+ import { preprocessSeries } from './processSeries';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ function SeriesProvider(props) {
8
+ const {
9
+ series,
10
+ dataset,
11
+ colors = blueberryTwilightPalette,
12
+ seriesFormatters,
13
+ children
14
+ } = props;
15
+ const theme = useTheme();
16
+ const formattedSeries = React.useMemo(() => ({
17
+ isInitialized: true,
18
+ data: preprocessSeries({
19
+ series,
20
+ colors: typeof colors === 'function' ? colors(theme.palette.mode) : colors,
21
+ seriesFormatters,
22
+ dataset: dataset
23
+ })
24
+ }), [series, colors, theme.palette.mode, seriesFormatters, dataset]);
25
+ return /*#__PURE__*/_jsx(SeriesContext.Provider, {
26
+ value: formattedSeries,
27
+ children: children
28
+ });
29
+ }
30
+ export { SeriesProvider };
@@ -0,0 +1,8 @@
1
+ import { preprocessSeries } from './processSeries';
2
+ export * from './SeriesProvider';
3
+ export * from './SeriesContext';
4
+ export * from './Series.types';
5
+ const seriesProviderUtils = {
6
+ preprocessSeries
7
+ };
8
+ export { seriesProviderUtils };
@@ -1,25 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import { useTheme } from '@mui/material/styles';
4
- import { defaultizeColor } from '../internals/defaultizeColor';
5
- import { blueberryTwilightPalette } from '../colorPalettes';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export const SeriesContext = /*#__PURE__*/React.createContext({
8
- isInitialized: false,
9
- data: {}
10
- });
11
- if (process.env.NODE_ENV !== 'production') {
12
- SeriesContext.displayName = 'SeriesContext';
13
- }
2
+ import { defaultizeColor } from '../../internals/defaultizeColor';
14
3
  /**
15
4
  * This methods is the interface between what the developer is providing and what components receives
16
5
  * To simplify the components behaviors, it groups series by type, such that LinePlots props are not updated if some line data are modified
17
6
  * It also add defaultized values such as the ids, colors
18
- * @param series The array of series provided by devs
7
+ * @param series The array of series provided by the developer
19
8
  * @param colors The color palette used to defaultize series colors
20
9
  * @returns An object structuring all the series by type.
21
10
  */
22
- const preprocessSeries = (series, colors, seriesFormatters, dataset) => {
11
+ export const preprocessSeries = ({
12
+ series,
13
+ colors,
14
+ seriesFormatters,
15
+ dataset
16
+ }) => {
23
17
  // Group series by type
24
18
  const seriesGroups = {};
25
19
  series.forEach((seriesData, seriesIndex) => {
@@ -50,23 +44,4 @@ const preprocessSeries = (series, colors, seriesFormatters, dataset) => {
50
44
  }
51
45
  });
52
46
  return formattedSeries;
53
- };
54
- function SeriesContextProvider(props) {
55
- const {
56
- series,
57
- dataset,
58
- colors = blueberryTwilightPalette,
59
- seriesFormatters,
60
- children
61
- } = props;
62
- const theme = useTheme();
63
- const formattedSeries = React.useMemo(() => ({
64
- isInitialized: true,
65
- data: preprocessSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, seriesFormatters, dataset)
66
- }), [series, colors, theme.palette.mode, seriesFormatters, dataset]);
67
- return /*#__PURE__*/_jsx(SeriesContext.Provider, {
68
- value: formattedSeries,
69
- children: children
70
- });
71
- }
72
- export { SeriesContextProvider };
47
+ };
@@ -19,10 +19,10 @@ export const useReducedMotion = () => {
19
19
  return () => {};
20
20
  }
21
21
  const mql = window.matchMedia('(prefers-reduced-motion)');
22
- const handleMediaChange = e => {
22
+ const handleMediaChange = event => {
23
23
  Globals.assign({
24
24
  // Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
25
- skipAnimation: e.matches || undefined
25
+ skipAnimation: event.matches || undefined
26
26
  });
27
27
  };
28
28
  handleMediaChange(mql);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SeriesContext } from '../context/SeriesContextProvider';
2
+ import { SeriesContext } from '../context/SeriesProvider';
3
3
 
4
4
  /**
5
5
  * Get access to the internal state of series.
@@ -1,4 +1,4 @@
1
- import { scaleOrdinal, scaleThreshold, scaleSequential } from 'd3-scale';
1
+ import { scaleOrdinal, scaleThreshold, scaleSequential } from '@mui/x-charts-vendor/d3-scale';
2
2
  export function getSequentialColorScale(config) {
3
3
  if (config.type === 'piecewise') {
4
4
  return scaleThreshold(config.thresholds, config.colors);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { interpolateDate, interpolateNumber } from 'd3-interpolate';
2
+ import { interpolateDate, interpolateNumber } from '@mui/x-charts-vendor/d3-interpolate';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  const PX_PRECISION = 10;
5
5
  export default function ChartsContinuousGradient(props) {
@@ -1,4 +1,4 @@
1
- import { curveCatmullRom, curveLinear, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from 'd3-shape';
1
+ import { curveCatmullRom, curveLinear, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from '@mui/x-charts-vendor/d3-shape';
2
2
  export default function getCurveFactory(curveType) {
3
3
  switch (curveType) {
4
4
  case 'catmullRom':
@@ -1,4 +1,4 @@
1
- import { scaleLog, scalePow, scaleSqrt, scaleTime, scaleUtc, scaleLinear } from 'd3-scale';
1
+ import { scaleLog, scalePow, scaleSqrt, scaleTime, scaleUtc, scaleLinear } from '@mui/x-charts-vendor/d3-scale';
2
2
  export function getScale(scaleType, domain, range) {
3
3
  switch (scaleType) {
4
4
  case 'log':
@@ -27,7 +27,7 @@ export * from '../context/CartesianProvider';
27
27
  export * from '../context/DrawingProvider';
28
28
  export * from '../context/ColorProvider';
29
29
  export * from '../context/InteractionProvider';
30
- export * from '../context/SeriesContextProvider';
30
+ export * from '../context/SeriesProvider';
31
31
  export * from '../context/ZAxisContextProvider';
32
32
  // series configuration
33
33
  export * from '../models/seriesType/config';
@@ -1,4 +1,4 @@
1
- import { stackOrderAppearance as d3StackOrderAppearance, stackOrderAscending as d3StackOrderAscending, stackOrderDescending as d3StackOrderDescending, stackOrderInsideOut as d3StackOrderInsideOut, stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOffsetExpand as d3StackOffsetExpand, stackOffsetDiverging as d3StackOffsetDiverging, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle } from 'd3-shape';
1
+ import { stackOrderAppearance as d3StackOrderAppearance, stackOrderAscending as d3StackOrderAscending, stackOrderDescending as d3StackOrderDescending, stackOrderInsideOut as d3StackOrderInsideOut, stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOffsetExpand as d3StackOffsetExpand, stackOffsetDiverging as d3StackOffsetDiverging, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle } from '@mui/x-charts-vendor/d3-shape';
2
2
  export const StackOrder = {
3
3
  /**
4
4
  * Series order such that the earliest series (according to the maximum value) is at the bottom.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { interpolateString } from 'd3-interpolate';
2
+ import { interpolateString } from '@mui/x-charts-vendor/d3-interpolate';
3
3
  import { useSpring, to } from '@react-spring/web';
4
4
  function usePrevious(value) {
5
5
  const ref = React.useRef(null);
@@ -24,10 +24,10 @@ const useReducedMotion = () => {
24
24
  return () => {};
25
25
  }
26
26
  const mql = window.matchMedia('(prefers-reduced-motion)');
27
- const handleMediaChange = e => {
27
+ const handleMediaChange = event => {
28
28
  _web.Globals.assign({
29
29
  // Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
30
- skipAnimation: e.matches || undefined
30
+ skipAnimation: event.matches || undefined
31
31
  });
32
32
  };
33
33
  handleMediaChange(mql);
@@ -1,4 +1,4 @@
1
- import { FormattedSeries } from '../context/SeriesContextProvider';
1
+ import { FormattedSeries } from '../context/SeriesProvider';
2
2
  /**
3
3
  * Get access to the internal state of series.
4
4
  * Structured by type of series:
@@ -9,7 +9,7 @@ exports.usePieSeries = usePieSeries;
9
9
  exports.useScatterSeries = useScatterSeries;
10
10
  exports.useSeries = useSeries;
11
11
  var React = _interopRequireWildcard(require("react"));
12
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
12
+ var _SeriesProvider = require("../context/SeriesProvider");
13
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
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
15
  /**
@@ -22,7 +22,7 @@ function useSeries() {
22
22
  const {
23
23
  isInitialized,
24
24
  data
25
- } = React.useContext(_SeriesContextProvider.SeriesContext);
25
+ } = React.useContext(_SeriesProvider.SeriesContext);
26
26
  if (!isInitialized) {
27
27
  throw new Error(['MUI X: Could not find the series ref context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
28
28
  }
@@ -41,7 +41,7 @@ export interface TickParams {
41
41
  tickLabelPlacement?: 'middle' | 'tick';
42
42
  }
43
43
  export declare function getTickNumber(params: TickParams & {
44
- range: any[];
44
+ range: number[];
45
45
  domain: any[];
46
46
  }): number;
47
47
  export type TickItemType = {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.11.1
2
+ * @mui/x-charts v7.12.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,5 +1,5 @@
1
- import { ScaleOrdinal } from 'd3-scale';
1
+ import { ScaleOrdinal } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { ContinuousColorConfig, PiecewiseColorConfig, OrdinalColorConfig } from '../models/colorMapping';
3
- export declare function getSequentialColorScale<Value extends number | Date>(config: ContinuousColorConfig<Value> | PiecewiseColorConfig<Value>): import("d3-scale").ScaleThreshold<Value, string, never> | import("d3-scale").ScaleSequential<string, never>;
3
+ export declare function getSequentialColorScale<Value extends number | Date>(config: ContinuousColorConfig<Value> | PiecewiseColorConfig<Value>): import("@mui/x-charts-vendor/d3-scale").ScaleThreshold<Value, string, never> | import("@mui/x-charts-vendor/d3-scale").ScaleSequential<string, never>;
4
4
  export declare function getOrdinalColorScale<Value extends number | Date | string>(config: OrdinalColorConfig<Value>): ScaleOrdinal<Value, string, null | string> | ScaleOrdinal<number, string, null | string>;
5
- export declare function getColorScale(config: ContinuousColorConfig | PiecewiseColorConfig | OrdinalColorConfig): import("d3-scale").ScaleSequential<string, never> | ScaleOrdinal<number, string, string | null> | ScaleOrdinal<string | number | Date, string, string | null> | import("d3-scale").ScaleThreshold<number | Date, string, never>;
5
+ export declare function getColorScale(config: ContinuousColorConfig | PiecewiseColorConfig | OrdinalColorConfig): import("@mui/x-charts-vendor/d3-scale").ScaleSequential<string, never> | ScaleOrdinal<number, string, string | null> | ScaleOrdinal<string | number | Date, string, string | null> | import("@mui/x-charts-vendor/d3-scale").ScaleThreshold<number | Date, string, never>;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getColorScale = getColorScale;
7
7
  exports.getOrdinalColorScale = getOrdinalColorScale;
8
8
  exports.getSequentialColorScale = getSequentialColorScale;
9
- var _d3Scale = require("d3-scale");
9
+ var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
10
10
  function getSequentialColorScale(config) {
11
11
  if (config.type === 'piecewise') {
12
12
  return (0, _d3Scale.scaleThreshold)(config.thresholds, config.colors);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = ChartsContinuousGradient;
7
7
  var React = _interopRequireWildcard(require("react"));
8
- var _d3Interpolate = require("d3-interpolate");
8
+ var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
  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); }
11
11
  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; }
@@ -2,7 +2,7 @@ import { AllSeriesType } from '../models/seriesType';
2
2
  export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors?: string[]): {
3
3
  data: {
4
4
  color: string;
5
- label?: string | ((location: "tooltip" | "legend" | "arc") => string);
5
+ label?: (string | ((location: "tooltip" | "legend" | "arc") => string)) | undefined;
6
6
  value: number;
7
7
  id?: import("../models/seriesType").PieItemId | undefined;
8
8
  }[];
@@ -1,2 +1,2 @@
1
1
  import { CurveType } from '../models/seriesType/line';
2
- export default function getCurveFactory(curveType?: CurveType): import("d3-shape").CurveFactory;
2
+ export default function getCurveFactory(curveType?: CurveType): import("@mui/x-charts-vendor/d3-shape").CurveFactory;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getCurveFactory;
7
- var _d3Shape = require("d3-shape");
7
+ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
8
8
  function getCurveFactory(curveType) {
9
9
  switch (curveType) {
10
10
  case 'catmullRom':
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getScale = getScale;
7
- var _d3Scale = require("d3-scale");
7
+ var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
8
8
  function getScale(scaleType, domain, range) {
9
9
  switch (scaleType) {
10
10
  case 'log':
@@ -19,7 +19,7 @@ export * from '../context/CartesianProvider';
19
19
  export * from '../context/DrawingProvider';
20
20
  export * from '../context/ColorProvider';
21
21
  export * from '../context/InteractionProvider';
22
- export * from '../context/SeriesContextProvider';
22
+ export * from '../context/SeriesProvider';
23
23
  export * from '../context/ZAxisContextProvider';
24
24
  export type * from '../context/context.types';
25
25
  export * from '../models/seriesType/config';
@@ -221,15 +221,15 @@ Object.keys(_InteractionProvider).forEach(function (key) {
221
221
  }
222
222
  });
223
223
  });
224
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
225
- Object.keys(_SeriesContextProvider).forEach(function (key) {
224
+ var _SeriesProvider = require("../context/SeriesProvider");
225
+ Object.keys(_SeriesProvider).forEach(function (key) {
226
226
  if (key === "default" || key === "__esModule") return;
227
227
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
228
- if (key in exports && exports[key] === _SeriesContextProvider[key]) return;
228
+ if (key in exports && exports[key] === _SeriesProvider[key]) return;
229
229
  Object.defineProperty(exports, key, {
230
230
  enumerable: true,
231
231
  get: function () {
232
- return _SeriesContextProvider[key];
232
+ return _SeriesProvider[key];
233
233
  }
234
234
  });
235
235
  });
@@ -1,4 +1,4 @@
1
- import type { ScaleBand, ScalePoint } from 'd3-scale';
1
+ import type { ScaleBand, ScalePoint } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { D3Scale } from '../models/axis';
3
3
  export declare function isBandScale<T extends {
4
4
  toString(): string;
@@ -1,4 +1,4 @@
1
- import { Series } from 'd3-shape';
1
+ import { Series } from '@mui/x-charts-vendor/d3-shape';
2
2
  import type { BarSeriesType, LineSeriesType } from '../models/seriesType';
3
3
  import type { StackOffsetType, StackOrderType } from '../models/stacking';
4
4
  import { SeriesId } from '../models/seriesType/common';
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getStackingGroups = exports.StackOrder = exports.StackOffset = void 0;
7
- var _d3Shape = require("d3-shape");
7
+ var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
8
8
  const StackOrder = exports.StackOrder = {
9
9
  /**
10
10
  * Series order such that the earliest series (according to the maximum value) is at the bottom.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useAnimatedPath = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
- var _d3Interpolate = require("d3-interpolate");
8
+ var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
9
9
  var _web = require("@react-spring/web");
10
10
  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); }
11
11
  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; }
package/models/axis.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
1
+ import type { ScaleBand, ScaleLogarithmic, ScalePower, ScaleTime, ScaleLinear, ScalePoint, ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { ChartsAxisClasses } from '../ChartsAxis/axisClasses';
3
3
  import type { TickParams } from '../hooks/useTicks';
4
4
  import { ChartsTextProps } from '../ChartsText';
@@ -254,7 +254,7 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps = Cha
254
254
  * If `true`, Reverse the axis scaleBand.
255
255
  */
256
256
  reverse?: boolean;
257
- } & Partial<AxisProps> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
257
+ } & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & TickParams & AxisConfigExtension;
258
258
  export interface AxisConfigExtension {
259
259
  }
260
260
  export type AxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps = ChartsXAxisProps | ChartsYAxisProps> = Omit<AxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
@@ -1,4 +1,4 @@
1
- import { PieArcDatum as D3PieArcDatum } from 'd3-shape';
1
+ import { PieArcDatum as D3PieArcDatum } from '@mui/x-charts-vendor/d3-shape';
2
2
  import { DefaultizedProps } from '../helpers';
3
3
  import { CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
4
4
  export type PieItemId = string | number;
@@ -1,4 +1,4 @@
1
- import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from 'd3-scale';
1
+ import type { ScaleOrdinal, ScaleSequential, ScaleThreshold } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from './colorMapping';
3
3
  export interface ZAxisConfig<V = any> {
4
4
  id: string;
@@ -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;