@mui/x-charts 7.6.0 → 7.6.2

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 (199) hide show
  1. package/BarChart/BarChart.d.ts +1 -1
  2. package/BarChart/BarChart.js +2 -2
  3. package/BarChart/BarPlot.js +2 -2
  4. package/BarChart/formatter.js +2 -2
  5. package/BarChart/getColor.d.ts +1 -1
  6. package/BarChart/getColor.js +4 -4
  7. package/BarChart/plugin.d.ts +2 -0
  8. package/BarChart/plugin.js +17 -0
  9. package/CHANGELOG.md +91 -0
  10. package/ChartContainer/ChartContainer.d.ts +14 -2
  11. package/ChartContainer/ChartContainer.js +13 -2
  12. package/ChartContainer/defaultPlugins.d.ts +2 -0
  13. package/ChartContainer/defaultPlugins.js +11 -0
  14. package/ChartContainer/usePluginsMerge.d.ts +10 -0
  15. package/ChartContainer/usePluginsMerge.js +39 -0
  16. package/ChartsLegend/ChartsLegend.js +2 -2
  17. package/ChartsLegend/utils.js +4 -1
  18. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  19. package/ChartsTooltip/ChartsAxisTooltipContent.js +4 -4
  20. package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  21. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -1
  22. package/ChartsTooltip/utils.d.ts +1 -7
  23. package/ChartsTooltip/utils.js +2 -10
  24. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  25. package/ChartsXAxis/ChartsXAxis.js +17 -19
  26. package/ChartsYAxis/ChartsYAxis.js +17 -19
  27. package/LineChart/AreaPlot.js +2 -2
  28. package/LineChart/LineChart.d.ts +1 -1
  29. package/LineChart/LineChart.js +2 -2
  30. package/LineChart/LineHighlightPlot.js +2 -2
  31. package/LineChart/LinePlot.js +2 -2
  32. package/LineChart/MarkPlot.js +2 -2
  33. package/LineChart/formatter.js +2 -2
  34. package/LineChart/getColor.d.ts +1 -1
  35. package/LineChart/getColor.js +2 -2
  36. package/LineChart/plugin.d.ts +2 -0
  37. package/LineChart/plugin.js +17 -0
  38. package/PieChart/PieChart.d.ts +1 -1
  39. package/PieChart/PieChart.js +2 -2
  40. package/PieChart/PiePlot.js +2 -2
  41. package/PieChart/plugin.d.ts +2 -0
  42. package/PieChart/plugin.js +14 -0
  43. package/ResponsiveChartContainer/ResponsiveChartContainer.js +7 -2
  44. package/ScatterChart/ScatterChart.d.ts +1 -1
  45. package/ScatterChart/ScatterChart.js +2 -2
  46. package/ScatterChart/ScatterPlot.js +2 -2
  47. package/ScatterChart/formatter.js +2 -3
  48. package/ScatterChart/getColor.d.ts +1 -1
  49. package/ScatterChart/getColor.js +2 -2
  50. package/ScatterChart/plugin.d.ts +2 -0
  51. package/ScatterChart/plugin.js +17 -0
  52. package/SparkLineChart/SparkLineChart.d.ts +3 -3
  53. package/SparkLineChart/SparkLineChart.js +1 -1
  54. package/context/CartesianContextProvider.d.ts +13 -10
  55. package/context/CartesianContextProvider.js +2 -2
  56. package/context/DrawingProvider.d.ts +3 -1
  57. package/context/DrawingProvider.js +9 -2
  58. package/context/HighlightedProvider/HighlightedContext.d.ts +2 -1
  59. package/context/HighlightedProvider/HighlightedContext.js +8 -5
  60. package/context/HighlightedProvider/HighlightedProvider.js +15 -12
  61. package/context/HighlightedProvider/useHighlighted.js +6 -3
  62. package/context/HighlightedProvider/useItemHighlighted.js +2 -8
  63. package/context/SeriesContextProvider.d.ts +16 -5
  64. package/context/SeriesContextProvider.js +14 -17
  65. package/context/context.types.d.ts +4 -0
  66. package/context/context.types.js +5 -0
  67. package/esm/BarChart/BarChart.js +2 -2
  68. package/esm/BarChart/BarPlot.js +2 -2
  69. package/esm/BarChart/formatter.js +1 -1
  70. package/esm/BarChart/getColor.js +4 -4
  71. package/esm/BarChart/plugin.js +10 -0
  72. package/esm/ChartContainer/ChartContainer.js +13 -2
  73. package/esm/ChartContainer/defaultPlugins.js +5 -0
  74. package/esm/ChartContainer/usePluginsMerge.js +31 -0
  75. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  76. package/esm/ChartsLegend/utils.js +4 -1
  77. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  78. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
  79. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  80. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -1
  81. package/esm/ChartsTooltip/utils.js +2 -8
  82. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  83. package/esm/ChartsXAxis/ChartsXAxis.js +17 -19
  84. package/esm/ChartsYAxis/ChartsYAxis.js +17 -19
  85. package/esm/LineChart/AreaPlot.js +2 -2
  86. package/esm/LineChart/LineChart.js +2 -2
  87. package/esm/LineChart/LineHighlightPlot.js +2 -2
  88. package/esm/LineChart/LinePlot.js +2 -2
  89. package/esm/LineChart/MarkPlot.js +2 -2
  90. package/esm/LineChart/formatter.js +1 -1
  91. package/esm/LineChart/getColor.js +2 -2
  92. package/esm/LineChart/plugin.js +10 -0
  93. package/esm/PieChart/PieChart.js +2 -2
  94. package/esm/PieChart/PiePlot.js +2 -2
  95. package/esm/PieChart/plugin.js +7 -0
  96. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +7 -2
  97. package/esm/ScatterChart/ScatterChart.js +2 -2
  98. package/esm/ScatterChart/ScatterPlot.js +2 -2
  99. package/esm/ScatterChart/formatter.js +1 -1
  100. package/esm/ScatterChart/getColor.js +2 -2
  101. package/esm/ScatterChart/plugin.js +10 -0
  102. package/esm/SparkLineChart/SparkLineChart.js +1 -1
  103. package/esm/context/CartesianContextProvider.js +2 -2
  104. package/esm/context/DrawingProvider.js +9 -2
  105. package/esm/context/HighlightedProvider/HighlightedContext.js +8 -5
  106. package/esm/context/HighlightedProvider/HighlightedProvider.js +15 -12
  107. package/esm/context/HighlightedProvider/useHighlighted.js +6 -3
  108. package/esm/context/HighlightedProvider/useItemHighlighted.js +2 -6
  109. package/esm/context/SeriesContextProvider.js +14 -17
  110. package/esm/context/context.types.js +1 -0
  111. package/esm/hooks/useInteractionItemProps.js +2 -2
  112. package/esm/hooks/useSeries.js +6 -3
  113. package/esm/hooks/useSvgRef.js +6 -3
  114. package/esm/internals/configInit.js +20 -0
  115. package/esm/internals/defaultizeValueFormatter.js +2 -3
  116. package/esm/internals/index.js +1 -0
  117. package/esm/internals/isCartesian.js +7 -0
  118. package/esm/models/index.js +1 -0
  119. package/esm/models/plugin.js +1 -0
  120. package/esm/models/seriesType/index.js +6 -0
  121. package/hooks/useInteractionItemProps.js +1 -1
  122. package/hooks/useSeries.d.ts +6 -11
  123. package/hooks/useSeries.js +6 -3
  124. package/hooks/useSvgRef.js +6 -3
  125. package/hooks/useTicks.d.ts +4 -2
  126. package/index.js +1 -1
  127. package/internals/configInit.d.ts +9 -0
  128. package/internals/configInit.js +26 -0
  129. package/internals/defaultizeValueFormatter.d.ts +1 -2
  130. package/internals/defaultizeValueFormatter.js +2 -3
  131. package/internals/index.d.ts +1 -0
  132. package/internals/index.js +16 -0
  133. package/internals/isCartesian.d.ts +7 -0
  134. package/internals/isCartesian.js +14 -0
  135. package/internals/package.json +6 -0
  136. package/models/axis.d.ts +3 -3
  137. package/models/index.d.ts +1 -0
  138. package/models/index.js +11 -0
  139. package/models/plugin.d.ts +16 -0
  140. package/models/plugin.js +5 -0
  141. package/models/seriesType/config.d.ts +30 -5
  142. package/models/seriesType/index.d.ts +8 -11
  143. package/models/seriesType/index.js +6 -0
  144. package/modern/BarChart/BarChart.js +2 -2
  145. package/modern/BarChart/BarPlot.js +2 -2
  146. package/modern/BarChart/formatter.js +1 -1
  147. package/modern/BarChart/getColor.js +4 -4
  148. package/modern/BarChart/plugin.js +10 -0
  149. package/modern/ChartContainer/ChartContainer.js +13 -2
  150. package/modern/ChartContainer/defaultPlugins.js +5 -0
  151. package/modern/ChartContainer/usePluginsMerge.js +31 -0
  152. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  153. package/modern/ChartsLegend/utils.js +4 -1
  154. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
  155. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
  156. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  157. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -1
  158. package/modern/ChartsTooltip/utils.js +2 -8
  159. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -2
  160. package/modern/ChartsXAxis/ChartsXAxis.js +17 -19
  161. package/modern/ChartsYAxis/ChartsYAxis.js +17 -19
  162. package/modern/LineChart/AreaPlot.js +2 -2
  163. package/modern/LineChart/LineChart.js +2 -2
  164. package/modern/LineChart/LineHighlightPlot.js +2 -2
  165. package/modern/LineChart/LinePlot.js +2 -2
  166. package/modern/LineChart/MarkPlot.js +2 -2
  167. package/modern/LineChart/formatter.js +1 -1
  168. package/modern/LineChart/getColor.js +2 -2
  169. package/modern/LineChart/plugin.js +10 -0
  170. package/modern/PieChart/PieChart.js +2 -2
  171. package/modern/PieChart/PiePlot.js +2 -2
  172. package/modern/PieChart/plugin.js +7 -0
  173. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +7 -2
  174. package/modern/ScatterChart/ScatterChart.js +2 -2
  175. package/modern/ScatterChart/ScatterPlot.js +2 -2
  176. package/modern/ScatterChart/formatter.js +1 -1
  177. package/modern/ScatterChart/getColor.js +2 -2
  178. package/modern/ScatterChart/plugin.js +10 -0
  179. package/modern/SparkLineChart/SparkLineChart.js +1 -1
  180. package/modern/context/CartesianContextProvider.js +2 -2
  181. package/modern/context/DrawingProvider.js +9 -2
  182. package/modern/context/HighlightedProvider/HighlightedContext.js +8 -5
  183. package/modern/context/HighlightedProvider/HighlightedProvider.js +15 -12
  184. package/modern/context/HighlightedProvider/useHighlighted.js +6 -3
  185. package/modern/context/HighlightedProvider/useItemHighlighted.js +2 -6
  186. package/modern/context/SeriesContextProvider.js +14 -17
  187. package/modern/context/context.types.js +1 -0
  188. package/modern/hooks/useInteractionItemProps.js +2 -2
  189. package/modern/hooks/useSeries.js +6 -3
  190. package/modern/hooks/useSvgRef.js +6 -3
  191. package/modern/index.js +1 -1
  192. package/modern/internals/configInit.js +20 -0
  193. package/modern/internals/defaultizeValueFormatter.js +2 -3
  194. package/modern/internals/index.js +1 -0
  195. package/modern/internals/isCartesian.js +7 -0
  196. package/modern/models/index.js +1 -0
  197. package/modern/models/plugin.js +1 -0
  198. package/modern/models/seriesType/index.js +6 -0
  199. package/package.json +1 -1
@@ -15,7 +15,7 @@ export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLege
15
15
  }
16
16
  export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps {
17
17
  }
18
- export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<BarPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
18
+ export interface BarChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'plugins'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<BarPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
19
19
  /**
20
20
  * The series to display in the bar chart.
21
21
  * An array of [[BarSeriesType]] objects.
@@ -360,7 +360,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
360
360
  labelStyle: _propTypes.default.object,
361
361
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
362
362
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
363
- position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
363
+ position: _propTypes.default.oneOf(['bottom', 'top']),
364
364
  reverse: _propTypes.default.bool,
365
365
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
366
366
  slotProps: _propTypes.default.object,
@@ -413,7 +413,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
413
413
  labelStyle: _propTypes.default.object,
414
414
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
415
415
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
416
- position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
416
+ position: _propTypes.default.oneOf(['left', 'right']),
417
417
  reverse: _propTypes.default.bool,
418
418
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
419
419
  slotProps: _propTypes.default.object,
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _web = require("@react-spring/web");
13
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
14
13
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
15
14
  var _BarElement = require("./BarElement");
16
15
  var _getColor = _interopRequireDefault(require("./getColor"));
@@ -18,6 +17,7 @@ var _hooks = require("../hooks");
18
17
  var _BarClipPath = require("./BarClipPath");
19
18
  var _BarLabelPlot = require("./BarLabel/BarLabelPlot");
20
19
  var _checkScaleErrors = require("./checkScaleErrors");
20
+ var _useSeries = require("../hooks/useSeries");
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
22
  const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
23
23
  /**
@@ -50,7 +50,7 @@ function getBandSize({
50
50
  };
51
51
  }
52
52
  const useAggregatedData = () => {
53
- const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).bar ?? {
53
+ const seriesData = (0, _useSeries.useBarSeries)() ?? {
54
54
  series: {},
55
55
  stackingGroups: [],
56
56
  seriesOrder: []
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _d3Shape = require("d3-shape");
10
10
  var _stackSeries = require("../internals/stackSeries");
11
- var _defaultizeValueFormatter = _interopRequireDefault(require("../internals/defaultizeValueFormatter"));
11
+ var _defaultizeValueFormatter = require("../internals/defaultizeValueFormatter");
12
12
  let warnOnce = false;
13
13
  const formatter = (params, dataset) => {
14
14
  const {
@@ -72,7 +72,7 @@ const formatter = (params, dataset) => {
72
72
  return {
73
73
  seriesOrder,
74
74
  stackingGroups,
75
- series: (0, _defaultizeValueFormatter.default)(completedSeries, v => v == null ? '' : v.toLocaleString())
75
+ series: (0, _defaultizeValueFormatter.defaultizeValueFormatter)(completedSeries, v => v == null ? '' : v.toLocaleString())
76
76
  };
77
77
  };
78
78
  var _default = exports.default = formatter;
@@ -1,3 +1,3 @@
1
1
  import { AxisDefaultized } from '../models/axis';
2
2
  import { DefaultizedBarSeriesType } from '../models/seriesType/bar';
3
- export default function getColor(series: DefaultizedBarSeriesType, xAxis: AxisDefaultized, yAxis: AxisDefaultized): (dataIndex: number) => string;
3
+ export default function getColor(series: DefaultizedBarSeriesType, xAxis?: AxisDefaultized, yAxis?: AxisDefaultized): (dataIndex: number) => string;
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = getColor;
7
7
  function getColor(series, xAxis, yAxis) {
8
8
  const verticalLayout = series.layout === 'vertical';
9
- const bandColorScale = verticalLayout ? xAxis.colorScale : yAxis.colorScale;
10
- const valueColorScale = verticalLayout ? yAxis.colorScale : xAxis.colorScale;
11
- const bandValues = verticalLayout ? xAxis.data : yAxis.data;
9
+ const bandColorScale = verticalLayout ? xAxis?.colorScale : yAxis?.colorScale;
10
+ const valueColorScale = verticalLayout ? yAxis?.colorScale : xAxis?.colorScale;
11
+ const bandValues = verticalLayout ? xAxis?.data : yAxis?.data;
12
12
  if (valueColorScale) {
13
13
  return dataIndex => {
14
14
  const value = series.data[dataIndex];
@@ -19,7 +19,7 @@ function getColor(series, xAxis, yAxis) {
19
19
  return color;
20
20
  };
21
21
  }
22
- if (bandColorScale) {
22
+ if (bandColorScale && bandValues) {
23
23
  return dataIndex => {
24
24
  const value = bandValues[dataIndex];
25
25
  const color = value === null ? series.color : bandColorScale(value);
@@ -0,0 +1,2 @@
1
+ import { ChartsPluginType } from '../models/plugin';
2
+ export declare const plugin: ChartsPluginType<'bar'>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.plugin = void 0;
8
+ var _extremums = require("./extremums");
9
+ var _formatter = _interopRequireDefault(require("./formatter"));
10
+ var _getColor = _interopRequireDefault(require("./getColor"));
11
+ const plugin = exports.plugin = {
12
+ seriesType: 'bar',
13
+ seriesFormatter: _formatter.default,
14
+ colorProcessor: _getColor.default,
15
+ xExtremumGetter: _extremums.getExtremumX,
16
+ yExtremumGetter: _extremums.getExtremumY
17
+ };
package/CHANGELOG.md CHANGED
@@ -3,6 +3,97 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.6.2
7
+
8
+ _Jun 6, 2024_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 📚 Adds Date and Time Pickers accessibility page
13
+ - 🐞 Bugfixes
14
+ - 📚 Documentation improvements
15
+
16
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
17
+
18
+ ### Data Grid
19
+
20
+ #### `@mui/x-data-grid@7.6.2`
21
+
22
+ - [DataGrid] Add the `areElementSizesEqual` utility to improve code readability (#13254) @layerok
23
+ - [DataGrid] Clean up IE remnants from the codebase (#13390) @MBilalShafi
24
+
25
+ #### `@mui/x-data-grid-pro@7.6.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
26
+
27
+ Same changes as in `@mui/x-data-grid@7.6.2`.
28
+
29
+ #### `@mui/x-data-grid-premium@7.6.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
30
+
31
+ Same changes as in `@mui/x-data-grid-pro@7.6.2`.
32
+
33
+ ### Date and Time Pickers
34
+
35
+ #### `@mui/x-date-pickers@7.6.2`
36
+
37
+ - [fields] Fix `PageUp` and `PageDown` editing on letter sections (#13310) @arthurbalduini
38
+ - [pickers] Fix `AdapterDayjs` timezone behavior (#13362) @LukasTy
39
+ - [pickers] Use `useRtl` instead of `useTheme` to access direction (#13363) @flaviendelangle
40
+
41
+ #### `@mui/x-date-pickers-pro@7.6.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
42
+
43
+ Same changes as in `@mui/x-date-pickers@7.6.2`.
44
+
45
+ ### Charts
46
+
47
+ #### `@mui/x-charts@7.6.2`
48
+
49
+ - [charts] Add `Initializable` type and behaviour to allow checking if a complex context has been initialized. (#13365) @JCQuintas
50
+ - [charts] Fix some props not working in `xAxis` and `yAxis` (#13372) @Valyok26
51
+ - [charts] Harmonize charts types (#13366) @alexfauquette
52
+ - [charts] Introduce plugins system (#13367) @alexfauquette
53
+ - [charts] Simplify plugin types (#13396) @JCQuintas
54
+
55
+ ### Docs
56
+
57
+ - [docs] Add badges like in Material UI @oliviertassinari
58
+ - [docs] Update twitter.com to x.com @oliviertassinari
59
+ - [docs] Fix the description of `tickInterval` (#13355) @alexfauquette
60
+ - [docs] Adjust the code example for `quickFilterValues` (#12919) @michelengelen
61
+ - [docs] Create Pickers accessibility page (#13274) @arthurbalduini
62
+
63
+ ### Core
64
+
65
+ - [core] Comment on `CSS.escape` for the future @oliviertassinari
66
+ - [core] Fix `l10n` action setup (#13382) @LukasTy
67
+ - [core] Fixes in preparation for React 18.3 (#13378) @LukasTy
68
+ - [core] Remove explicit `marked` dependency (#13383) @LukasTy
69
+ - [core] Remove unused `@types/prettier` dependency (#13389) @LukasTy
70
+ - [core] Add `docs/.env.local` to `.gitignore` (#13377) @KenanYusuf
71
+
72
+ ## 7.6.1
73
+
74
+ _May 31, 2024_
75
+
76
+ We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
77
+
78
+ 🐞 Address the `@mui/internal-test-utils` added as a direct dependency to `@mui/x-data-grid` by mistake.
79
+
80
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
81
+
82
+ ### Data Grid
83
+
84
+ #### `@mui/x-data-grid@7.6.1`
85
+
86
+ - [DataGrid] Fix column resize not working with special character (#13069) @oukunan
87
+ - [DataGrid] Move `@mui/internal-test-utils` to dev dependency (#13318) @LukasTy
88
+
89
+ #### `@mui/x-data-grid-pro@7.6.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
90
+
91
+ Same changes as in `@mui/x-data-grid@7.6.1`.
92
+
93
+ #### `@mui/x-data-grid-premium@7.6.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
94
+
95
+ Same changes as in `@mui/x-data-grid-pro@7.6.1`.
96
+
6
97
  ## 7.6.0
7
98
 
8
99
  _May 30, 2024_
@@ -4,10 +4,22 @@ import { SeriesContextProviderProps } from '../context/SeriesContextProvider';
4
4
  import { ChartsSurfaceProps } from '../ChartsSurface';
5
5
  import { CartesianContextProviderProps } from '../context/CartesianContextProvider';
6
6
  import { HighlightedProviderProps } from '../context';
7
- export type ChartContainerProps = Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, 'svgRef'> & CartesianContextProviderProps & HighlightedProviderProps, 'children'> & {
7
+ import { ChartsPluginType } from '../models/plugin';
8
+ import { ChartSeriesType } from '../models/seriesType/config';
9
+ export type ChartContainerProps = Omit<ChartsSurfaceProps & Omit<SeriesContextProviderProps, 'seriesFormatters'> & Omit<DrawingProviderProps, 'svgRef'> & Omit<CartesianContextProviderProps, 'xExtremumGetters' | 'yExtremumGetters'> & HighlightedProviderProps, 'children'> & {
8
10
  children?: React.ReactNode;
11
+ /**
12
+ * An array of plugins defining how to preprocess data.
13
+ * If not provided, the container supports line, bar, scatter and pie charts.
14
+ */
15
+ plugins?: ChartsPluginType<ChartSeriesType>[];
9
16
  };
10
- declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, "svgRef"> & CartesianContextProviderProps & HighlightedProviderProps, "children"> & {
17
+ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & Omit<SeriesContextProviderProps, "seriesFormatters"> & Omit<DrawingProviderProps, "svgRef"> & Omit<CartesianContextProviderProps, "xExtremumGetters" | "yExtremumGetters"> & HighlightedProviderProps, "children"> & {
11
18
  children?: React.ReactNode;
19
+ /**
20
+ * An array of plugins defining how to preprocess data.
21
+ * If not provided, the container supports line, bar, scatter and pie charts.
22
+ */
23
+ plugins?: ChartsPluginType<keyof import("../models/seriesType/config").ChartsSeriesConfig>[] | undefined;
12
24
  } & React.RefAttributes<unknown>>;
13
25
  export { ChartContainer };
@@ -16,6 +16,7 @@ var _ChartsSurface = require("../ChartsSurface");
16
16
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
17
17
  var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
18
18
  var _context = require("../context");
19
+ var _usePluginsMerge = require("./usePluginsMerge");
19
20
  var _jsxRuntime = require("react/jsx-runtime");
20
21
  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); }
21
22
  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; }
@@ -35,10 +36,14 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
35
36
  disableAxisListener,
36
37
  highlightedItem,
37
38
  onHighlightChange,
39
+ plugins,
38
40
  children
39
41
  } = props;
40
42
  const svgRef = React.useRef(null);
41
43
  const handleRef = (0, _useForkRef.default)(ref, svgRef);
44
+ const {
45
+ seriesFormatters
46
+ } = (0, _usePluginsMerge.usePluginsMerge)(plugins);
42
47
  (0, _useReducedMotion.useReducedMotion)(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
43
48
 
44
49
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DrawingProvider.DrawingProvider, {
@@ -50,6 +55,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
50
55
  series: series,
51
56
  colors: colors,
52
57
  dataset: dataset,
58
+ seriesFormatters: seriesFormatters,
53
59
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CartesianContextProvider.CartesianContextProvider, {
54
60
  xAxis: xAxis,
55
61
  yAxis: yAxis,
@@ -126,6 +132,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
126
132
  * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
127
133
  */
128
134
  onHighlightChange: _propTypes.default.func,
135
+ /**
136
+ * An array of plugins defining how to preprocess data.
137
+ * If not provided, the container supports line, bar, scatter and pie charts.
138
+ */
139
+ plugins: _propTypes.default.arrayOf(_propTypes.default.object),
129
140
  /**
130
141
  * The array of series to display.
131
142
  * Each type of series has its own specificity.
@@ -179,7 +190,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
179
190
  labelStyle: _propTypes.default.object,
180
191
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
181
192
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
182
- position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
193
+ position: _propTypes.default.oneOf(['bottom', 'top']),
183
194
  reverse: _propTypes.default.bool,
184
195
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
185
196
  slotProps: _propTypes.default.object,
@@ -232,7 +243,7 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
232
243
  labelStyle: _propTypes.default.object,
233
244
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
234
245
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
235
- position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
246
+ position: _propTypes.default.oneOf(['left', 'right']),
236
247
  reverse: _propTypes.default.bool,
237
248
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
238
249
  slotProps: _propTypes.default.object,
@@ -0,0 +1,2 @@
1
+ import { ChartsPluginType } from '../models';
2
+ export declare const defaultPlugins: ChartsPluginType<'bar' | 'scatter' | 'line' | 'pie'>[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultPlugins = void 0;
7
+ var _plugin = require("../BarChart/plugin");
8
+ var _plugin2 = require("../ScatterChart/plugin");
9
+ var _plugin3 = require("../LineChart/plugin");
10
+ var _plugin4 = require("../PieChart/plugin");
11
+ const defaultPlugins = exports.defaultPlugins = [_plugin.plugin, _plugin2.plugin, _plugin3.plugin, _plugin4.plugin];
@@ -0,0 +1,10 @@
1
+ import { ChartsPluginType, ColorProcessorsConfig } from '../models';
2
+ import { ChartSeriesType } from '../models/seriesType/config';
3
+ import { ExtremumGettersConfig } from '../context/CartesianContextProvider';
4
+ import { SeriesFormatterConfig } from '../context/SeriesContextProvider';
5
+ export declare function usePluginsMerge<T extends ChartSeriesType>(plugins?: ChartsPluginType<T>[]): {
6
+ seriesFormatters: SeriesFormatterConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
7
+ colorProcessors: ColorProcessorsConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
8
+ xExtremumGetters: ExtremumGettersConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
9
+ yExtremumGetters: ExtremumGettersConfig<keyof import("../models/seriesType/config").ChartsSeriesConfig>;
10
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePluginsMerge = usePluginsMerge;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _defaultPlugins = require("./defaultPlugins");
9
+ 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); }
10
+ 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; }
11
+ function usePluginsMerge(plugins) {
12
+ const defaultizedPlugins = plugins ?? _defaultPlugins.defaultPlugins;
13
+ return React.useMemo(() => {
14
+ const seriesFormatters = {};
15
+ const colorProcessors = {};
16
+ const xExtremumGetters = {};
17
+ const yExtremumGetters = {};
18
+ for (let i = 0; i < defaultizedPlugins.length; i += 1) {
19
+ const plugin = defaultizedPlugins[i];
20
+
21
+ // To remove those any we will need to solve this union discrimination issue:
22
+ // https://www.typescriptlang.org/play/?#code/FDAuE8AcFMAIDkCuBbARtATgYQPYDsAzASwHNYBeWAb2FlgGsi8ATALlgHI8V0MOBuWrBwwMAQ1A4M7ABQAPdtzSYAlBQB8sJb0EBfEBBiwAyqAxMSuQqQrUhjFuw4BnMxYFCRmCVNkLYruZ4JGrkmoEWeiAAxviuWqhWxCTsSMrY+Mm2VAxMbLAARNqYBQA0wqI+0rByGrAATLAAVDWw+rF48YFJpOymQZaZNpQ5DvkFEcFlFd6S1bVhsAAG9S0AJFRyukttMXGgsB3JzrYA2niJQyTl3VcAugZQcADylXPOALJikJAW2ULFDAAflSPEwPRIpw4XnEcw4d1KQkmJBBJjcwQhUJhVXhiN0gmAHXi2LmXx+FnYr1mUk+31+wWy+JABCksBkABtoAcjjYcARDldnGoaCA6AB6MWwADqUnoJxw9FgRH5AHc4L9ooroGJogALQ5iZxwPJEABuRGYiDE7PASJVRFAerZPJIADoxsKhHRooa4FwwXxWF66DNYVIyfTIS73Xk7rZoySpIIQyHUBhtfRkyGfUbOMiOEGU3RExgIxZTtGxnHKAm3kng8xoAQxIh2aBC0W0xms-pvftqLkWOUS2141chBLYABJDimuB4HBKxtiWBiVA4RAHXU4FWwSSwTkHAAqxlgiBYmFcYhYAusbrGq5vtepGFX6YPTHo0GYnjrpbp5ZVrYJZ6EAA
23
+ seriesFormatters[plugin.seriesType] = plugin.seriesFormatter;
24
+ colorProcessors[plugin.seriesType] = plugin.colorProcessor;
25
+ if (plugin.xExtremumGetter) {
26
+ xExtremumGetters[plugin.seriesType] = plugin.xExtremumGetter;
27
+ }
28
+ if (plugin.yExtremumGetter) {
29
+ yExtremumGetters[plugin.seriesType] = plugin.yExtremumGetter;
30
+ }
31
+ }
32
+ return {
33
+ seriesFormatters,
34
+ colorProcessors,
35
+ xExtremumGetters,
36
+ yExtremumGetters
37
+ };
38
+ }, [defaultizedPlugins]);
39
+ }
@@ -12,10 +12,10 @@ var _utils = require("@mui/base/utils");
12
12
  var _utils2 = require("@mui/utils");
13
13
  var _styles = require("@mui/material/styles");
14
14
  var _utils3 = require("./utils");
15
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
16
15
  var _chartsLegendClasses = require("./chartsLegendClasses");
17
16
  var _DefaultChartsLegend = require("./DefaultChartsLegend");
18
17
  var _hooks = require("../hooks");
18
+ var _useSeries = require("../hooks/useSeries");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
20
  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); }
21
21
  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; }
@@ -56,7 +56,7 @@ function ChartsLegend(inProps) {
56
56
  theme
57
57
  }));
58
58
  const drawingArea = (0, _hooks.useDrawingArea)();
59
- const series = React.useContext(_SeriesContextProvider.SeriesContext);
59
+ const series = (0, _useSeries.useSeries)();
60
60
  const seriesToDisplay = (0, _utils3.getSeriesToDisplay)(series);
61
61
  const ChartLegendRender = slots?.legend ?? _DefaultChartsLegend.DefaultChartsLegend;
62
62
  const chartLegendRenderProps = (0, _utils.useSlotProps)({
@@ -16,5 +16,8 @@ const legendGetter = {
16
16
  pie: _legend4.default
17
17
  };
18
18
  function getSeriesToDisplay(series) {
19
- return Object.keys(series).flatMap(seriesType => legendGetter[seriesType](series[seriesType]));
19
+ return Object.keys(series).flatMap(seriesType => {
20
+ const getter = legendGetter[seriesType];
21
+ return getter === undefined ? [] : getter(series[seriesType]);
22
+ });
20
23
  }
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.ChartsOnAxisClickHandler = ChartsOnAxisClickHandler;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _DrawingProvider = require("../context/DrawingProvider");
11
10
  var _InteractionProvider = require("../context/InteractionProvider");
12
11
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
13
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
12
+ var _useSeries = require("../hooks/useSeries");
13
+ var _hooks = require("../hooks");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  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); }
16
16
  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; }
@@ -18,8 +18,8 @@ function ChartsOnAxisClickHandler(props) {
18
18
  const {
19
19
  onAxisClick
20
20
  } = props;
21
- const svgRef = React.useContext(_DrawingProvider.SvgContext);
22
- const series = React.useContext(_SeriesContextProvider.SeriesContext);
21
+ const svgRef = (0, _hooks.useSvgRef)();
22
+ const series = (0, _useSeries.useSeries)();
23
23
  const {
24
24
  axis
25
25
  } = React.useContext(_InteractionProvider.InteractionContext);
@@ -9,12 +9,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _utils = require("@mui/base/utils");
12
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
13
12
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
14
13
  var _DefaultChartsAxisTooltipContent = require("./DefaultChartsAxisTooltipContent");
15
- var _utils2 = require("./utils");
14
+ var _isCartesian = require("../internals/isCartesian");
16
15
  var _colorGetter = _interopRequireDefault(require("../internals/colorGetter"));
17
16
  var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
17
+ var _useSeries = require("../hooks/useSeries");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  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); }
20
20
  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; }
@@ -39,11 +39,11 @@ function ChartsAxisTooltipContent(props) {
39
39
  zAxisIds,
40
40
  zAxis
41
41
  } = React.useContext(_ZAxisContextProvider.ZAxisContext);
42
- const series = React.useContext(_SeriesContextProvider.SeriesContext);
42
+ const series = (0, _useSeries.useSeries)();
43
43
  const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
44
44
  const relevantSeries = React.useMemo(() => {
45
45
  const rep = [];
46
- Object.keys(series).filter(_utils2.isCartesianSeriesType).forEach(seriesType => {
46
+ Object.keys(series).filter(_isCartesian.isCartesianSeriesType).forEach(seriesType => {
47
47
  series[seriesType].seriesOrder.forEach(seriesId => {
48
48
  const item = series[seriesType].series[seriesId];
49
49
  const axisKey = isXaxis ? item.xAxisKey : item.yAxisKey;
@@ -9,11 +9,11 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _utils = require("@mui/base/utils");
12
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
13
12
  var _DefaultChartsItemTooltipContent = require("./DefaultChartsItemTooltipContent");
14
13
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
15
14
  var _colorGetter = _interopRequireDefault(require("../internals/colorGetter"));
16
15
  var _ZAxisContextProvider = require("../context/ZAxisContextProvider");
16
+ var _useSeries = require("../hooks/useSeries");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  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); }
19
19
  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; }
@@ -25,7 +25,7 @@ function ChartsItemTooltipContent(props) {
25
25
  classes,
26
26
  contentProps
27
27
  } = props;
28
- const series = React.useContext(_SeriesContextProvider.SeriesContext)[itemData.type].series[itemData.seriesId];
28
+ const series = (0, _useSeries.useSeries)()[itemData.type].series[itemData.seriesId];
29
29
  const {
30
30
  xAxis,
31
31
  yAxis,
@@ -12,6 +12,7 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
12
12
  var _ChartsTooltipTable = require("./ChartsTooltipTable");
13
13
  var _utils = require("./utils");
14
14
  var _getLabel = require("../internals/getLabel");
15
+ var _isCartesian = require("../internals/isCartesian");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  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); }
17
18
  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; }
@@ -45,7 +46,7 @@ function DefaultChartsAxisTooltipContent(props) {
45
46
  })
46
47
  })
47
48
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
48
- children: series.filter(_utils.isCartesianSeries).map(({
49
+ children: series.filter(_isCartesian.isCartesianSeries).map(({
49
50
  color,
50
51
  id,
51
52
  label,
@@ -1,5 +1,5 @@
1
1
  import { AxisInteractionData, ItemInteractionData } from '../context/InteractionProvider';
2
- import { CartesianChartSeriesType, ChartSeriesDefaultized, ChartSeriesType } from '../models/seriesType/config';
2
+ import { ChartSeriesType } from '../models/seriesType/config';
3
3
  export declare function generateVirtualElement(mousePosition: {
4
4
  x: number;
5
5
  y: number;
@@ -22,10 +22,4 @@ export declare function useMouseTracker(): {
22
22
  } | null;
23
23
  export type TriggerOptions = 'item' | 'axis' | 'none';
24
24
  export declare function getTooltipHasData(trigger: TriggerOptions, displayedData: null | AxisInteractionData | ItemInteractionData<ChartSeriesType>): boolean;
25
- export declare function isCartesianSeriesType(seriesType: string): seriesType is CartesianChartSeriesType;
26
- export declare function isCartesianSeries(series: ChartSeriesDefaultized<ChartSeriesType> & {
27
- getColor: (dataIndex: number) => string;
28
- }): series is ChartSeriesDefaultized<CartesianChartSeriesType> & {
29
- getColor: (dataIndex: number) => string;
30
- };
31
25
  export declare function utcFormatter(v: string | number | Date): string;
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.generateVirtualElement = generateVirtualElement;
7
7
  exports.getTooltipHasData = getTooltipHasData;
8
- exports.isCartesianSeries = isCartesianSeries;
9
- exports.isCartesianSeriesType = isCartesianSeriesType;
10
8
  exports.useMouseTracker = useMouseTracker;
11
9
  exports.utcFormatter = utcFormatter;
12
10
  var React = _interopRequireWildcard(require("react"));
13
- var _DrawingProvider = require("../context/DrawingProvider");
11
+ var _hooks = require("../hooks");
14
12
  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); }
15
13
  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; }
16
14
  function generateVirtualElement(mousePosition) {
@@ -57,7 +55,7 @@ function generateVirtualElement(mousePosition) {
57
55
  };
58
56
  }
59
57
  function useMouseTracker() {
60
- const svgRef = React.useContext(_DrawingProvider.SvgContext);
58
+ const svgRef = (0, _hooks.useSvgRef)();
61
59
 
62
60
  // Use a ref to avoid rerendering on every mousemove event.
63
61
  const [mousePosition, setMousePosition] = React.useState(null);
@@ -97,12 +95,6 @@ function getTooltipHasData(trigger, displayedData) {
97
95
  const hasAxisYData = displayedData.y !== null;
98
96
  return hasAxisXData || hasAxisYData;
99
97
  }
100
- function isCartesianSeriesType(seriesType) {
101
- return ['bar', 'line', 'scatter'].includes(seriesType);
102
- }
103
- function isCartesianSeries(series) {
104
- return isCartesianSeriesType(series.type);
105
- }
106
98
  function utcFormatter(v) {
107
99
  if (v instanceof Date) {
108
100
  return v.toUTCString();
@@ -11,11 +11,11 @@ var _d3Delaunay = require("d3-delaunay");
11
11
  var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
12
12
  var _InteractionProvider = require("../context/InteractionProvider");
13
13
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
14
- var _SeriesContextProvider = require("../context/SeriesContextProvider");
15
14
  var _useScale = require("../hooks/useScale");
16
15
  var _utils = require("../internals/utils");
17
16
  var _hooks = require("../hooks");
18
17
  var _context = require("../context");
18
+ var _useSeries = require("../hooks/useSeries");
19
19
  var _jsxRuntime = require("react/jsx-runtime");
20
20
  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); }
21
21
  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; }
@@ -43,7 +43,7 @@ function ChartsVoronoiHandler(props) {
43
43
  const {
44
44
  series,
45
45
  seriesOrder
46
- } = React.useContext(_SeriesContextProvider.SeriesContext).scatter ?? {};
46
+ } = (0, _useSeries.useScatterSeries)() ?? {};
47
47
  const voronoiRef = React.useRef({});
48
48
  const delauneyRef = React.useRef(undefined);
49
49
  const {