@mui/x-charts 7.5.0 → 7.6.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 (245) hide show
  1. package/BarChart/BarChart.js +30 -3
  2. package/BarChart/BarElement.d.ts +0 -3
  3. package/BarChart/BarElement.js +8 -19
  4. package/BarChart/BarLabel/BarLabel.d.ts +1342 -0
  5. package/BarChart/BarLabel/BarLabel.js +60 -0
  6. package/BarChart/BarLabel/BarLabel.types.d.ts +39 -0
  7. package/BarChart/BarLabel/BarLabel.types.js +5 -0
  8. package/BarChart/BarLabel/BarLabelItem.d.ts +53 -0
  9. package/BarChart/BarLabel/BarLabelItem.js +127 -0
  10. package/BarChart/BarLabel/BarLabelPlot.d.ts +16 -0
  11. package/BarChart/BarLabel/BarLabelPlot.js +106 -0
  12. package/BarChart/BarLabel/barLabelClasses.d.ts +13 -0
  13. package/BarChart/BarLabel/barLabelClasses.js +29 -0
  14. package/BarChart/BarLabel/getBarLabel.d.ts +10 -0
  15. package/BarChart/BarLabel/getBarLabel.js +31 -0
  16. package/BarChart/BarLabel/index.d.ts +6 -0
  17. package/BarChart/BarLabel/index.js +25 -0
  18. package/BarChart/BarPlot.d.ts +15 -4
  19. package/BarChart/BarPlot.js +22 -34
  20. package/BarChart/checkScaleErrors.d.ts +11 -0
  21. package/BarChart/checkScaleErrors.js +33 -0
  22. package/BarChart/index.d.ts +1 -0
  23. package/BarChart/index.js +11 -0
  24. package/BarChart/types.d.ts +0 -2
  25. package/CHANGELOG.md +148 -5418
  26. package/ChartContainer/ChartContainer.d.ts +3 -2
  27. package/ChartContainer/ChartContainer.js +20 -3
  28. package/ChartsAxis/ChartsAxis.js +1 -1
  29. package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  30. package/ChartsClipPath/ChartsClipPath.js +1 -1
  31. package/ChartsGrid/ChartsGrid.js +1 -1
  32. package/ChartsLegend/ChartsLegend.js +1 -1
  33. package/ChartsLegend/DefaultChartsLegend.js +1 -1
  34. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  35. package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  36. package/ChartsSurface.js +1 -1
  37. package/ChartsText/ChartsText.js +1 -1
  38. package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  39. package/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  40. package/ChartsTooltip/ChartsTooltip.js +1 -1
  41. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  42. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  43. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
  44. package/ChartsXAxis/ChartsXAxis.js +1 -1
  45. package/ChartsYAxis/ChartsYAxis.js +1 -1
  46. package/Gauge/Gauge.js +1 -1
  47. package/Gauge/GaugeContainer.js +1 -1
  48. package/Gauge/GaugeValueText.js +1 -1
  49. package/LineChart/AnimatedArea.js +1 -1
  50. package/LineChart/AnimatedLine.js +1 -1
  51. package/LineChart/AreaElement.d.ts +0 -2
  52. package/LineChart/AreaElement.js +8 -18
  53. package/LineChart/AreaPlot.js +1 -3
  54. package/LineChart/LineChart.js +19 -2
  55. package/LineChart/LineElement.d.ts +0 -2
  56. package/LineChart/LineElement.js +8 -18
  57. package/LineChart/LineHighlightElement.js +1 -1
  58. package/LineChart/LineHighlightPlot.js +1 -1
  59. package/LineChart/LinePlot.js +1 -3
  60. package/LineChart/MarkElement.d.ts +0 -2
  61. package/LineChart/MarkElement.js +11 -33
  62. package/LineChart/MarkPlot.js +1 -2
  63. package/PieChart/PieArc.d.ts +4 -1
  64. package/PieChart/PieArc.js +8 -4
  65. package/PieChart/PieArcLabel.js +1 -1
  66. package/PieChart/PieArcLabelPlot.d.ts +1 -1
  67. package/PieChart/PieArcLabelPlot.js +2 -8
  68. package/PieChart/PieArcPlot.d.ts +1 -1
  69. package/PieChart/PieArcPlot.js +6 -8
  70. package/PieChart/PieChart.js +19 -2
  71. package/PieChart/PiePlot.js +3 -7
  72. package/PieChart/dataTransform/useTransformData.d.ts +1 -1
  73. package/PieChart/dataTransform/useTransformData.js +10 -25
  74. package/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
  75. package/ScatterChart/Scatter.js +15 -11
  76. package/ScatterChart/ScatterChart.js +19 -2
  77. package/ScatterChart/ScatterPlot.js +1 -1
  78. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  79. package/SparkLineChart/SparkLineChart.js +14 -1
  80. package/context/HighlightedProvider/HighlightedContext.d.ts +65 -0
  81. package/context/HighlightedProvider/HighlightedContext.js +36 -0
  82. package/context/HighlightedProvider/HighlightedProvider.d.ts +20 -0
  83. package/context/HighlightedProvider/HighlightedProvider.js +97 -0
  84. package/context/HighlightedProvider/createIsFaded.d.ts +2 -0
  85. package/context/HighlightedProvider/createIsFaded.js +19 -0
  86. package/context/HighlightedProvider/createIsHighlighted.d.ts +2 -0
  87. package/context/HighlightedProvider/createIsHighlighted.js +19 -0
  88. package/context/HighlightedProvider/index.d.ts +4 -0
  89. package/context/HighlightedProvider/index.js +49 -0
  90. package/context/HighlightedProvider/useHighlighted.d.ts +9 -0
  91. package/context/HighlightedProvider/useHighlighted.js +24 -0
  92. package/context/HighlightedProvider/useItemHighlighted.d.ts +21 -0
  93. package/context/HighlightedProvider/useItemHighlighted.js +37 -0
  94. package/context/ZAxisContextProvider.js +1 -1
  95. package/context/index.d.ts +1 -1
  96. package/context/index.js +15 -0
  97. package/esm/BarChart/BarChart.js +30 -3
  98. package/esm/BarChart/BarElement.js +9 -20
  99. package/esm/BarChart/BarLabel/BarLabel.js +51 -0
  100. package/esm/BarChart/BarLabel/BarLabel.types.js +1 -0
  101. package/esm/BarChart/BarLabel/BarLabelItem.js +119 -0
  102. package/esm/BarChart/BarLabel/BarLabelPlot.js +98 -0
  103. package/esm/BarChart/BarLabel/barLabelClasses.js +19 -0
  104. package/esm/BarChart/BarLabel/getBarLabel.js +24 -0
  105. package/esm/BarChart/BarLabel/index.js +2 -0
  106. package/esm/BarChart/BarPlot.js +22 -34
  107. package/esm/BarChart/checkScaleErrors.js +27 -0
  108. package/esm/BarChart/index.js +2 -1
  109. package/esm/ChartContainer/ChartContainer.js +20 -3
  110. package/esm/ChartsAxis/ChartsAxis.js +1 -1
  111. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  112. package/esm/ChartsClipPath/ChartsClipPath.js +1 -1
  113. package/esm/ChartsGrid/ChartsGrid.js +1 -1
  114. package/esm/ChartsLegend/ChartsLegend.js +1 -1
  115. package/esm/ChartsLegend/DefaultChartsLegend.js +1 -1
  116. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  117. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  118. package/esm/ChartsSurface.js +1 -1
  119. package/esm/ChartsText/ChartsText.js +1 -1
  120. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  121. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  122. package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
  123. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  124. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  125. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
  126. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  127. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  128. package/esm/Gauge/Gauge.js +1 -1
  129. package/esm/Gauge/GaugeContainer.js +1 -1
  130. package/esm/Gauge/GaugeValueText.js +1 -1
  131. package/esm/LineChart/AnimatedArea.js +1 -1
  132. package/esm/LineChart/AnimatedLine.js +1 -1
  133. package/esm/LineChart/AreaElement.js +9 -19
  134. package/esm/LineChart/AreaPlot.js +1 -3
  135. package/esm/LineChart/LineChart.js +19 -2
  136. package/esm/LineChart/LineElement.js +9 -19
  137. package/esm/LineChart/LineHighlightElement.js +1 -1
  138. package/esm/LineChart/LineHighlightPlot.js +1 -1
  139. package/esm/LineChart/LinePlot.js +1 -3
  140. package/esm/LineChart/MarkElement.js +12 -34
  141. package/esm/LineChart/MarkPlot.js +1 -2
  142. package/esm/PieChart/PieArc.js +8 -4
  143. package/esm/PieChart/PieArcLabel.js +1 -1
  144. package/esm/PieChart/PieArcLabelPlot.js +2 -8
  145. package/esm/PieChart/PieArcPlot.js +6 -8
  146. package/esm/PieChart/PieChart.js +19 -2
  147. package/esm/PieChart/PiePlot.js +3 -7
  148. package/esm/PieChart/dataTransform/useTransformData.js +10 -25
  149. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
  150. package/esm/ScatterChart/Scatter.js +16 -12
  151. package/esm/ScatterChart/ScatterChart.js +19 -2
  152. package/esm/ScatterChart/ScatterPlot.js +1 -1
  153. package/esm/SparkLineChart/SparkLineChart.js +14 -1
  154. package/esm/context/HighlightedProvider/HighlightedContext.js +29 -0
  155. package/esm/context/HighlightedProvider/HighlightedProvider.js +89 -0
  156. package/esm/context/HighlightedProvider/createIsFaded.js +12 -0
  157. package/esm/context/HighlightedProvider/createIsHighlighted.js +12 -0
  158. package/esm/context/HighlightedProvider/index.js +4 -0
  159. package/esm/context/HighlightedProvider/useHighlighted.js +17 -0
  160. package/esm/context/HighlightedProvider/useItemHighlighted.js +29 -0
  161. package/esm/context/ZAxisContextProvider.js +1 -1
  162. package/esm/context/index.js +1 -0
  163. package/esm/hooks/useInteractionItemProps.js +9 -41
  164. package/hooks/useInteractionItemProps.d.ts +1 -4
  165. package/hooks/useInteractionItemProps.js +11 -45
  166. package/index.js +1 -1
  167. package/internals/colorScale.d.ts +1 -1
  168. package/internals/defaultizeColor.d.ts +13 -13
  169. package/models/seriesType/common.d.ts +4 -1
  170. package/modern/BarChart/BarChart.js +30 -3
  171. package/modern/BarChart/BarElement.js +9 -20
  172. package/modern/BarChart/BarLabel/BarLabel.js +51 -0
  173. package/modern/BarChart/BarLabel/BarLabel.types.js +1 -0
  174. package/modern/BarChart/BarLabel/BarLabelItem.js +119 -0
  175. package/modern/BarChart/BarLabel/BarLabelPlot.js +98 -0
  176. package/modern/BarChart/BarLabel/barLabelClasses.js +19 -0
  177. package/modern/BarChart/BarLabel/getBarLabel.js +24 -0
  178. package/modern/BarChart/BarLabel/index.js +2 -0
  179. package/modern/BarChart/BarPlot.js +22 -34
  180. package/modern/BarChart/checkScaleErrors.js +27 -0
  181. package/modern/BarChart/index.js +2 -1
  182. package/modern/ChartContainer/ChartContainer.js +20 -3
  183. package/modern/ChartsAxis/ChartsAxis.js +1 -1
  184. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  185. package/modern/ChartsClipPath/ChartsClipPath.js +1 -1
  186. package/modern/ChartsGrid/ChartsGrid.js +1 -1
  187. package/modern/ChartsLegend/ChartsLegend.js +1 -1
  188. package/modern/ChartsLegend/DefaultChartsLegend.js +1 -1
  189. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  190. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  191. package/modern/ChartsSurface.js +1 -1
  192. package/modern/ChartsText/ChartsText.js +1 -1
  193. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  194. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
  195. package/modern/ChartsTooltip/ChartsTooltip.js +1 -1
  196. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  197. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  198. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
  199. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  200. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  201. package/modern/Gauge/Gauge.js +1 -1
  202. package/modern/Gauge/GaugeContainer.js +1 -1
  203. package/modern/Gauge/GaugeValueText.js +1 -1
  204. package/modern/LineChart/AnimatedArea.js +1 -1
  205. package/modern/LineChart/AnimatedLine.js +1 -1
  206. package/modern/LineChart/AreaElement.js +9 -19
  207. package/modern/LineChart/AreaPlot.js +1 -3
  208. package/modern/LineChart/LineChart.js +19 -2
  209. package/modern/LineChart/LineElement.js +9 -19
  210. package/modern/LineChart/LineHighlightElement.js +1 -1
  211. package/modern/LineChart/LineHighlightPlot.js +1 -1
  212. package/modern/LineChart/LinePlot.js +1 -3
  213. package/modern/LineChart/MarkElement.js +12 -34
  214. package/modern/LineChart/MarkPlot.js +1 -2
  215. package/modern/PieChart/PieArc.js +8 -4
  216. package/modern/PieChart/PieArcLabel.js +1 -1
  217. package/modern/PieChart/PieArcLabelPlot.js +2 -8
  218. package/modern/PieChart/PieArcPlot.js +6 -8
  219. package/modern/PieChart/PieChart.js +19 -2
  220. package/modern/PieChart/PiePlot.js +3 -7
  221. package/modern/PieChart/dataTransform/useTransformData.js +10 -25
  222. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
  223. package/modern/ScatterChart/Scatter.js +16 -12
  224. package/modern/ScatterChart/ScatterChart.js +19 -2
  225. package/modern/ScatterChart/ScatterPlot.js +1 -1
  226. package/modern/SparkLineChart/SparkLineChart.js +14 -1
  227. package/modern/context/HighlightedProvider/HighlightedContext.js +29 -0
  228. package/modern/context/HighlightedProvider/HighlightedProvider.js +89 -0
  229. package/modern/context/HighlightedProvider/createIsFaded.js +12 -0
  230. package/modern/context/HighlightedProvider/createIsHighlighted.js +12 -0
  231. package/modern/context/HighlightedProvider/index.js +4 -0
  232. package/modern/context/HighlightedProvider/useHighlighted.js +17 -0
  233. package/modern/context/HighlightedProvider/useItemHighlighted.js +29 -0
  234. package/modern/context/ZAxisContextProvider.js +1 -1
  235. package/modern/context/index.js +1 -0
  236. package/modern/hooks/useInteractionItemProps.js +9 -41
  237. package/modern/index.js +1 -1
  238. package/package.json +3 -3
  239. package/themeAugmentation/components.d.ts +4 -0
  240. package/themeAugmentation/overrides.d.ts +3 -0
  241. package/themeAugmentation/props.d.ts +2 -0
  242. package/context/HighlightProvider.d.ts +0 -45
  243. package/context/HighlightProvider.js +0 -60
  244. package/esm/context/HighlightProvider.js +0 -51
  245. package/modern/context/HighlightProvider.js +0 -51
@@ -3,10 +3,11 @@ import { DrawingProviderProps } from '../context/DrawingProvider';
3
3
  import { SeriesContextProviderProps } from '../context/SeriesContextProvider';
4
4
  import { ChartsSurfaceProps } from '../ChartsSurface';
5
5
  import { CartesianContextProviderProps } from '../context/CartesianContextProvider';
6
- export type ChartContainerProps = Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, 'svgRef'> & CartesianContextProviderProps, 'children'> & {
6
+ import { HighlightedProviderProps } from '../context';
7
+ export type ChartContainerProps = Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, 'svgRef'> & CartesianContextProviderProps & HighlightedProviderProps, 'children'> & {
7
8
  children?: React.ReactNode;
8
9
  };
9
- declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, "svgRef"> & CartesianContextProviderProps, "children"> & {
10
+ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartsSurfaceProps & SeriesContextProviderProps & Omit<DrawingProviderProps, "svgRef"> & CartesianContextProviderProps & HighlightedProviderProps, "children"> & {
10
11
  children?: React.ReactNode;
11
12
  } & React.RefAttributes<unknown>>;
12
13
  export { ChartContainer };
@@ -14,8 +14,8 @@ var _InteractionProvider = require("../context/InteractionProvider");
14
14
  var _useReducedMotion = require("../hooks/useReducedMotion");
15
15
  var _ChartsSurface = require("../ChartsSurface");
16
16
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
17
- var _HighlightProvider = require("../context/HighlightProvider");
18
17
  var _ChartsAxesGradients = require("../internals/components/ChartsAxesGradients");
18
+ var _context = require("../context");
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; }
@@ -33,6 +33,8 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
33
33
  title,
34
34
  desc,
35
35
  disableAxisListener,
36
+ highlightedItem,
37
+ onHighlightChange,
36
38
  children
37
39
  } = props;
38
40
  const svgRef = React.useRef(null);
@@ -53,7 +55,9 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
53
55
  yAxis: yAxis,
54
56
  dataset: dataset,
55
57
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InteractionProvider.InteractionProvider, {
56
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HighlightProvider.HighlightProvider, {
58
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.HighlightedProvider, {
59
+ highlightedItem: highlightedItem,
60
+ onHighlightChange: onHighlightChange,
57
61
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, {
58
62
  width: width,
59
63
  height: height,
@@ -73,7 +77,7 @@ const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(fu
73
77
  process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
74
78
  // ----------------------------- Warning --------------------------------
75
79
  // | These PropTypes are generated from the TypeScript type definitions |
76
- // | To update them edit the TypeScript types and run "yarn proptypes" |
80
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
77
81
  // ----------------------------------------------------------------------
78
82
  children: _propTypes.default.node,
79
83
  className: _propTypes.default.string,
@@ -97,6 +101,13 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
97
101
  * The height of the chart in px.
98
102
  */
99
103
  height: _propTypes.default.number.isRequired,
104
+ /**
105
+ * The item currently highlighted. Turns highlighting into a controlled prop.
106
+ */
107
+ highlightedItem: _propTypes.default.shape({
108
+ dataIndex: _propTypes.default.number,
109
+ seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
110
+ }),
100
111
  /**
101
112
  * The margin between the SVG and the drawing area.
102
113
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -109,6 +120,12 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
109
120
  right: _propTypes.default.number,
110
121
  top: _propTypes.default.number
111
122
  }),
123
+ /**
124
+ * The callback fired when the highlighted item changes.
125
+ *
126
+ * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
127
+ */
128
+ onHighlightChange: _propTypes.default.func,
112
129
  /**
113
130
  * The array of series to display.
114
131
  * Each type of series has its own specificity.
@@ -100,7 +100,7 @@ function ChartsAxis(props) {
100
100
  process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
101
101
  // ----------------------------- Warning --------------------------------
102
102
  // | These PropTypes are generated from the TypeScript type definitions |
103
- // | To update them edit the TypeScript types and run "yarn proptypes" |
103
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
104
104
  // ----------------------------------------------------------------------
105
105
  /**
106
106
  * Indicate which axis to display the bottom of the charts.
@@ -108,7 +108,7 @@ function ChartsAxisHighlight(props) {
108
108
  process.env.NODE_ENV !== "production" ? ChartsAxisHighlight.propTypes = {
109
109
  // ----------------------------- Warning --------------------------------
110
110
  // | These PropTypes are generated from the TypeScript type definitions |
111
- // | To update them edit the TypeScript types and run "yarn proptypes" |
111
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
112
112
  // ----------------------------------------------------------------------
113
113
  x: _propTypes.default.oneOf(['band', 'line', 'none']),
114
114
  y: _propTypes.default.oneOf(['band', 'line', 'none'])
@@ -47,7 +47,7 @@ function ChartsClipPath(props) {
47
47
  process.env.NODE_ENV !== "production" ? ChartsClipPath.propTypes = {
48
48
  // ----------------------------- Warning --------------------------------
49
49
  // | These PropTypes are generated from the TypeScript type definitions |
50
- // | To update them edit the TypeScript types and run "yarn proptypes" |
50
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
51
51
  // ----------------------------------------------------------------------
52
52
  id: _propTypes.default.string.isRequired,
53
53
  offset: _propTypes.default.shape({
@@ -122,7 +122,7 @@ function ChartsGrid(props) {
122
122
  process.env.NODE_ENV !== "production" ? ChartsGrid.propTypes = {
123
123
  // ----------------------------- Warning --------------------------------
124
124
  // | These PropTypes are generated from the TypeScript type definitions |
125
- // | To update them edit the TypeScript types and run "yarn proptypes" |
125
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
126
126
  // ----------------------------------------------------------------------
127
127
  /**
128
128
  * Override or extend the styles applied to the component.
@@ -78,7 +78,7 @@ function ChartsLegend(inProps) {
78
78
  process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
79
79
  // ----------------------------- Warning --------------------------------
80
80
  // | These PropTypes are generated from the TypeScript type definitions |
81
- // | To update them edit the TypeScript types and run "yarn proptypes" |
81
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
82
82
  // ----------------------------------------------------------------------
83
83
  /**
84
84
  * Override or extend the styles applied to the component.
@@ -214,7 +214,7 @@ function DefaultChartsLegend(props) {
214
214
  process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
215
215
  // ----------------------------- Warning --------------------------------
216
216
  // | These PropTypes are generated from the TypeScript type definitions |
217
- // | To update them edit the TypeScript types and run "yarn proptypes" |
217
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
218
218
  // ----------------------------------------------------------------------
219
219
  /**
220
220
  * Override or extend the styles applied to the component.
@@ -71,7 +71,7 @@ function ChartsOnAxisClickHandler(props) {
71
71
  process.env.NODE_ENV !== "production" ? ChartsOnAxisClickHandler.propTypes = {
72
72
  // ----------------------------- Warning --------------------------------
73
73
  // | These PropTypes are generated from the TypeScript type definitions |
74
- // | To update them edit the TypeScript types and run "yarn proptypes" |
74
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
75
75
  // ----------------------------------------------------------------------
76
76
  /**
77
77
  * The function called for onClick events.
@@ -32,7 +32,7 @@ function ChartsReferenceLine(props) {
32
32
  process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
33
33
  // ----------------------------- Warning --------------------------------
34
34
  // | These PropTypes are generated from the TypeScript type definitions |
35
- // | To update them edit the TypeScript types and run "yarn proptypes" |
35
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
36
36
  // ----------------------------------------------------------------------
37
37
  /**
38
38
  * The id of the axis used for the reference value.
package/ChartsSurface.js CHANGED
@@ -53,7 +53,7 @@ const ChartsSurface = exports.ChartsSurface = /*#__PURE__*/React.forwardRef(func
53
53
  process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
54
54
  // ----------------------------- Warning --------------------------------
55
55
  // | These PropTypes are generated from the TypeScript type definitions |
56
- // | To update them edit the TypeScript types and run "yarn proptypes" |
56
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
57
57
  // ----------------------------------------------------------------------
58
58
  children: _propTypes.default.node,
59
59
  className: _propTypes.default.string,
@@ -79,7 +79,7 @@ function ChartsText(props) {
79
79
  process.env.NODE_ENV !== "production" ? ChartsText.propTypes = {
80
80
  // ----------------------------- Warning --------------------------------
81
81
  // | These PropTypes are generated from the TypeScript type definitions |
82
- // | To update them edit the TypeScript types and run "yarn proptypes" |
82
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
83
83
  // ----------------------------------------------------------------------
84
84
  /**
85
85
  * Height of a text line (in `em`).
@@ -89,7 +89,7 @@ function ChartsAxisTooltipContent(props) {
89
89
  process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
90
90
  // ----------------------------- Warning --------------------------------
91
91
  // | These PropTypes are generated from the TypeScript type definitions |
92
- // | To update them edit the TypeScript types and run "yarn proptypes" |
92
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
93
93
  // ----------------------------------------------------------------------
94
94
  axisData: _propTypes.default.shape({
95
95
  x: _propTypes.default.shape({
@@ -69,7 +69,7 @@ function ChartsItemTooltipContent(props) {
69
69
  process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
70
70
  // ----------------------------- Warning --------------------------------
71
71
  // | These PropTypes are generated from the TypeScript type definitions |
72
- // | To update them edit the TypeScript types and run "yarn proptypes" |
72
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
73
73
  // ----------------------------------------------------------------------
74
74
  classes: _propTypes.default.object.isRequired,
75
75
  content: _propTypes.default.elementType,
@@ -119,7 +119,7 @@ function ChartsTooltip(props) {
119
119
  process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
120
120
  // ----------------------------- Warning --------------------------------
121
121
  // | These PropTypes are generated from the TypeScript type definitions |
122
- // | To update them edit the TypeScript types and run "yarn proptypes" |
122
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
123
123
  // ----------------------------------------------------------------------
124
124
  /**
125
125
  * Component to override the tooltip content when trigger is set to 'axis'.
@@ -89,7 +89,7 @@ function DefaultChartsAxisTooltipContent(props) {
89
89
  process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propTypes = {
90
90
  // ----------------------------- Warning --------------------------------
91
91
  // | These PropTypes are generated from the TypeScript type definitions |
92
- // | To update them edit the TypeScript types and run "yarn proptypes" |
92
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
93
93
  // ----------------------------------------------------------------------
94
94
  /**
95
95
  * The properties of the triggered axis.
@@ -70,7 +70,7 @@ function DefaultChartsItemTooltipContent(props) {
70
70
  process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propTypes = {
71
71
  // ----------------------------- Warning --------------------------------
72
72
  // | These PropTypes are generated from the TypeScript type definitions |
73
- // | To update them edit the TypeScript types and run "yarn proptypes" |
73
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
74
74
  // ----------------------------------------------------------------------
75
75
  /**
76
76
  * Override or extend the styles applied to the component.
@@ -15,6 +15,7 @@ var _SeriesContextProvider = require("../context/SeriesContextProvider");
15
15
  var _useScale = require("../hooks/useScale");
16
16
  var _utils = require("../internals/utils");
17
17
  var _hooks = require("../hooks");
18
+ var _context = require("../context");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
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); }
20
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; }
@@ -45,6 +46,10 @@ function ChartsVoronoiHandler(props) {
45
46
  } = React.useContext(_SeriesContextProvider.SeriesContext).scatter ?? {};
46
47
  const voronoiRef = React.useRef({});
47
48
  const delauneyRef = React.useRef(undefined);
49
+ const {
50
+ setHighlighted,
51
+ clearHighlighted
52
+ } = (0, _context.useHighlighted)();
48
53
  const defaultXAxisId = xAxisIds[0];
49
54
  const defaultYAxisId = yAxisIds[0];
50
55
  (0, _useEnhancedEffect.default)(() => {
@@ -138,6 +143,7 @@ function ChartsVoronoiHandler(props) {
138
143
  dispatch({
139
144
  type: 'exitChart'
140
145
  });
146
+ clearHighlighted();
141
147
  };
142
148
  const handleMouseMove = event => {
143
149
  const closestPoint = getClosestPoint(event);
@@ -145,6 +151,7 @@ function ChartsVoronoiHandler(props) {
145
151
  dispatch({
146
152
  type: 'exitChart'
147
153
  });
154
+ clearHighlighted();
148
155
  return;
149
156
  }
150
157
  if (closestPoint === 'outside-voronoi-max-radius' || closestPoint === 'no-point-found') {
@@ -154,6 +161,7 @@ function ChartsVoronoiHandler(props) {
154
161
  type: 'scatter'
155
162
  }
156
163
  });
164
+ clearHighlighted();
157
165
  return;
158
166
  }
159
167
  const {
@@ -168,6 +176,10 @@ function ChartsVoronoiHandler(props) {
168
176
  dataIndex
169
177
  }
170
178
  });
179
+ setHighlighted({
180
+ seriesId,
181
+ dataIndex
182
+ });
171
183
  };
172
184
  const handleMouseClick = event => {
173
185
  if (!onItemClick) {
@@ -196,7 +208,7 @@ function ChartsVoronoiHandler(props) {
196
208
  element.removeEventListener('mousemove', handleMouseMove);
197
209
  element.removeEventListener('click', handleMouseClick);
198
210
  };
199
- }, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick]);
211
+ }, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted]);
200
212
 
201
213
  // eslint-disable-next-line react/jsx-no-useless-fragment
202
214
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {});
@@ -204,7 +216,7 @@ function ChartsVoronoiHandler(props) {
204
216
  process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
205
217
  // ----------------------------- Warning --------------------------------
206
218
  // | These PropTypes are generated from the TypeScript type definitions |
207
- // | To update them edit the TypeScript types and run "yarn proptypes" |
219
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
208
220
  // ----------------------------------------------------------------------
209
221
  /**
210
222
  * Callback fired when clicking on a scatter item.
@@ -257,7 +257,7 @@ function ChartsXAxis(inProps) {
257
257
  process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
258
258
  // ----------------------------- Warning --------------------------------
259
259
  // | These PropTypes are generated from the TypeScript type definitions |
260
- // | To update them edit the TypeScript types and run "yarn proptypes" |
260
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
261
261
  // ----------------------------------------------------------------------
262
262
  /**
263
263
  * The id of the axis to render.
@@ -193,7 +193,7 @@ function ChartsYAxis(inProps) {
193
193
  process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
194
194
  // ----------------------------- Warning --------------------------------
195
195
  // | These PropTypes are generated from the TypeScript type definitions |
196
- // | To update them edit the TypeScript types and run "yarn proptypes" |
196
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
197
197
  // ----------------------------------------------------------------------
198
198
  /**
199
199
  * The id of the axis to render.
package/Gauge/Gauge.js CHANGED
@@ -53,7 +53,7 @@ function Gauge(props) {
53
53
  process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
54
54
  // ----------------------------- Warning --------------------------------
55
55
  // | These PropTypes are generated from the TypeScript type definitions |
56
- // | To update them edit the TypeScript types and run "yarn proptypes" |
56
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
57
57
  // ----------------------------------------------------------------------
58
58
  children: _propTypes.default.node,
59
59
  classes: _propTypes.default.object,
@@ -115,7 +115,7 @@ const GaugeContainer = exports.GaugeContainer = /*#__PURE__*/React.forwardRef(fu
115
115
  process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
116
116
  // ----------------------------- Warning --------------------------------
117
117
  // | These PropTypes are generated from the TypeScript type definitions |
118
- // | To update them edit the TypeScript types and run "yarn proptypes" |
118
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
119
119
  // ----------------------------------------------------------------------
120
120
  children: _propTypes.default.node,
121
121
  className: _propTypes.default.string,
@@ -57,7 +57,7 @@ function GaugeValueText(props) {
57
57
  process.env.NODE_ENV !== "production" ? GaugeValueText.propTypes = {
58
58
  // ----------------------------- Warning --------------------------------
59
59
  // | These PropTypes are generated from the TypeScript type definitions |
60
- // | To update them edit the TypeScript types and run "yarn proptypes" |
60
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
61
61
  // ----------------------------------------------------------------------
62
62
  /**
63
63
  * Height of a text line (in `em`).
@@ -93,7 +93,7 @@ function AnimatedArea(props) {
93
93
  process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
94
94
  // ----------------------------- Warning --------------------------------
95
95
  // | These PropTypes are generated from the TypeScript type definitions |
96
- // | To update them edit the TypeScript types and run "yarn proptypes" |
96
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
97
97
  // ----------------------------------------------------------------------
98
98
  d: _propTypes.default.string.isRequired,
99
99
  ownerState: _propTypes.default.shape({
@@ -96,7 +96,7 @@ function AnimatedLine(props) {
96
96
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
97
97
  // ----------------------------- Warning --------------------------------
98
98
  // | These PropTypes are generated from the TypeScript type definitions |
99
- // | To update them edit the TypeScript types and run "yarn proptypes" |
99
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
100
100
  // ----------------------------------------------------------------------
101
101
  d: _propTypes.default.string.isRequired,
102
102
  ownerState: _propTypes.default.shape({
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { HighlightScope } from '../context/HighlightProvider';
3
2
  import { AnimatedAreaProps } from './AnimatedArea';
4
3
  import { SeriesId } from '../models/seriesType/common';
5
4
  export interface AreaElementClasses {
@@ -33,7 +32,6 @@ export interface AreaElementSlotProps {
33
32
  }
34
33
  export interface AreaElementProps extends Omit<AreaElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedAreaProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
35
34
  d: string;
36
- highlightScope?: Partial<HighlightScope>;
37
35
  /**
38
36
  * The props used for each component slot.
39
37
  * @default {}
@@ -16,10 +16,10 @@ var _utils = require("@mui/base/utils");
16
16
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
17
17
  var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
18
18
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
19
- var _InteractionProvider = require("../context/InteractionProvider");
20
19
  var _AnimatedArea = require("./AnimatedArea");
20
+ var _context = require("../context");
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["id", "classes", "color", "gradientId", "highlightScope", "slots", "slotProps", "onClick"];
22
+ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
23
23
  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); }
24
24
  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
25
  function getAreaElementUtilityClass(slot) {
@@ -54,24 +54,18 @@ function AreaElement(props) {
54
54
  classes: innerClasses,
55
55
  color,
56
56
  gradientId,
57
- highlightScope,
58
57
  slots,
59
58
  slotProps,
60
59
  onClick
61
60
  } = props,
62
61
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
63
- const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(highlightScope);
62
+ const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)();
64
63
  const {
65
- item
66
- } = React.useContext(_InteractionProvider.InteractionContext);
67
- const isHighlighted = (0, _useInteractionItemProps.getIsHighlighted)(item, {
68
- type: 'line',
69
- seriesId: id
70
- }, highlightScope);
71
- const isFaded = !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(item, {
72
- type: 'line',
64
+ isFaded,
65
+ isHighlighted
66
+ } = (0, _context.useItemHighlighted)({
73
67
  seriesId: id
74
- }, highlightScope);
68
+ });
75
69
  const ownerState = {
76
70
  id,
77
71
  classes: innerClasses,
@@ -100,16 +94,12 @@ function AreaElement(props) {
100
94
  process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
101
95
  // ----------------------------- Warning --------------------------------
102
96
  // | These PropTypes are generated from the TypeScript type definitions |
103
- // | To update them edit the TypeScript types and run "yarn proptypes" |
97
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
104
98
  // ----------------------------------------------------------------------
105
99
  classes: _propTypes.default.object,
106
100
  color: _propTypes.default.string.isRequired,
107
101
  d: _propTypes.default.string.isRequired,
108
102
  gradientId: _propTypes.default.string,
109
- highlightScope: _propTypes.default.shape({
110
- faded: _propTypes.default.oneOf(['global', 'none', 'series']),
111
- highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
112
- }),
113
103
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
114
104
  /**
115
105
  * If `true`, animations are skipped.
@@ -106,7 +106,6 @@ function AreaPlot(props) {
106
106
  d,
107
107
  seriesId,
108
108
  color,
109
- highlightScope,
110
109
  area,
111
110
  gradientUsed
112
111
  }) => !!area && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaElement.AreaElement, {
@@ -114,7 +113,6 @@ function AreaPlot(props) {
114
113
  d: d,
115
114
  color: color,
116
115
  gradientId: gradientUsed && getGradientId(...gradientUsed),
117
- highlightScope: highlightScope,
118
116
  slots: slots,
119
117
  slotProps: slotProps,
120
118
  onClick: onItemClick && (event => onItemClick(event, {
@@ -128,7 +126,7 @@ function AreaPlot(props) {
128
126
  process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
129
127
  // ----------------------------- Warning --------------------------------
130
128
  // | These PropTypes are generated from the TypeScript type definitions |
131
- // | To update them edit the TypeScript types and run "yarn proptypes" |
129
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
132
130
  // ----------------------------------------------------------------------
133
131
  /**
134
132
  * Callback fired when a line area item is clicked.
@@ -66,7 +66,9 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
66
66
  slots,
67
67
  slotProps,
68
68
  skipAnimation,
69
- loading
69
+ loading,
70
+ highlightedItem,
71
+ onHighlightChange
70
72
  } = props;
71
73
  const id = (0, _useId.default)();
72
74
  const clipPathId = `${id}-clip-path`;
@@ -91,6 +93,8 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
91
93
  dataset: dataset,
92
94
  sx: sx,
93
95
  disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
96
+ highlightedItem: highlightedItem,
97
+ onHighlightChange: onHighlightChange,
94
98
  children: [onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, {
95
99
  onAxisClick: onAxisClick
96
100
  }), grid && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, {
@@ -142,7 +146,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
142
146
  process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
143
147
  // ----------------------------- Warning --------------------------------
144
148
  // | These PropTypes are generated from the TypeScript type definitions |
145
- // | To update them edit the TypeScript types and run "yarn proptypes" |
149
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
146
150
  // ----------------------------------------------------------------------
147
151
  /**
148
152
  * The configuration of axes highlight.
@@ -192,6 +196,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
192
196
  * The height of the chart in px. If not defined, it takes the height of the parent element.
193
197
  */
194
198
  height: _propTypes.default.number,
199
+ /**
200
+ * The item currently highlighted. Turns highlighting into a controlled prop.
201
+ */
202
+ highlightedItem: _propTypes.default.shape({
203
+ dataIndex: _propTypes.default.number,
204
+ seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
205
+ }),
195
206
  /**
196
207
  * Indicate which axis to display the left of the charts.
197
208
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
@@ -240,6 +251,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
240
251
  * @param {null | AxisData} data The data about the clicked axis and items associated with it.
241
252
  */
242
253
  onAxisClick: _propTypes.default.func,
254
+ /**
255
+ * The callback fired when the highlighted item changes.
256
+ *
257
+ * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
258
+ */
259
+ onHighlightChange: _propTypes.default.func,
243
260
  /**
244
261
  * Callback fired when a line element is clicked.
245
262
  */
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { HighlightScope } from '../context/HighlightProvider';
3
2
  import { AnimatedLineProps } from './AnimatedLine';
4
3
  import { SeriesId } from '../models/seriesType/common';
5
4
  export interface LineElementClasses {
@@ -33,7 +32,6 @@ export interface LineElementSlotProps {
33
32
  }
34
33
  export interface LineElementProps extends Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'>, Pick<AnimatedLineProps, 'skipAnimation'>, Omit<React.SVGProps<SVGPathElement>, 'ref' | 'color' | 'id'> {
35
34
  d: string;
36
- highlightScope?: Partial<HighlightScope>;
37
35
  /**
38
36
  * The props used for each component slot.
39
37
  * @default {}
@@ -15,11 +15,11 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
15
15
  var _utils = require("@mui/base/utils");
16
16
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
17
17
  var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
18
- var _InteractionProvider = require("../context/InteractionProvider");
19
18
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
20
19
  var _AnimatedLine = require("./AnimatedLine");
20
+ var _context = require("../context");
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["id", "classes", "color", "gradientId", "highlightScope", "slots", "slotProps", "onClick"];
22
+ const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
23
23
  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); }
24
24
  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
25
  function getLineElementUtilityClass(slot) {
@@ -54,24 +54,18 @@ function LineElement(props) {
54
54
  classes: innerClasses,
55
55
  color,
56
56
  gradientId,
57
- highlightScope,
58
57
  slots,
59
58
  slotProps,
60
59
  onClick
61
60
  } = props,
62
61
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
63
- const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(highlightScope);
62
+ const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)();
64
63
  const {
65
- item
66
- } = React.useContext(_InteractionProvider.InteractionContext);
67
- const isHighlighted = (0, _useInteractionItemProps.getIsHighlighted)(item, {
68
- type: 'line',
69
- seriesId: id
70
- }, highlightScope);
71
- const isFaded = !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(item, {
72
- type: 'line',
64
+ isFaded,
65
+ isHighlighted
66
+ } = (0, _context.useItemHighlighted)({
73
67
  seriesId: id
74
- }, highlightScope);
68
+ });
75
69
  const ownerState = {
76
70
  id,
77
71
  classes: innerClasses,
@@ -100,16 +94,12 @@ function LineElement(props) {
100
94
  process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
101
95
  // ----------------------------- Warning --------------------------------
102
96
  // | These PropTypes are generated from the TypeScript type definitions |
103
- // | To update them edit the TypeScript types and run "yarn proptypes" |
97
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
104
98
  // ----------------------------------------------------------------------
105
99
  classes: _propTypes.default.object,
106
100
  color: _propTypes.default.string.isRequired,
107
101
  d: _propTypes.default.string.isRequired,
108
102
  gradientId: _propTypes.default.string,
109
- highlightScope: _propTypes.default.shape({
110
- faded: _propTypes.default.oneOf(['global', 'none', 'series']),
111
- highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
112
- }),
113
103
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
114
104
  /**
115
105
  * If `true`, animations are skipped.
@@ -83,7 +83,7 @@ function LineHighlightElement(props) {
83
83
  process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
84
84
  // ----------------------------- Warning --------------------------------
85
85
  // | These PropTypes are generated from the TypeScript type definitions |
86
- // | To update them edit the TypeScript types and run "yarn proptypes" |
86
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
87
87
  // ----------------------------------------------------------------------
88
88
  classes: _propTypes.default.object,
89
89
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired