@mui/x-charts 8.3.1 → 8.5.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 (204) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +11 -3
  3. package/BarChart/useBarChartProps.js +1 -1
  4. package/CHANGELOG.md +213 -0
  5. package/ChartContainer/ChartContainer.d.ts +21 -2
  6. package/ChartContainer/ChartContainer.js +17 -1
  7. package/ChartContainer/useChartContainerProps.js +7 -3
  8. package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  9. package/ChartDataProvider/ChartDataProvider.js +19 -2
  10. package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  11. package/ChartDataProvider/useChartDataProviderProps.js +7 -3
  12. package/ChartsAxis/axisClasses.d.ts +5 -0
  13. package/ChartsAxis/axisClasses.js +1 -1
  14. package/ChartsLegend/ChartsLegend.js +1 -0
  15. package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  16. package/ChartsSurface/ChartsSurface.js +1 -0
  17. package/ChartsXAxis/ChartsXAxis.js +7 -16
  18. package/ChartsYAxis/ChartsYAxis.js +4 -8
  19. package/Gauge/Gauge.js +1 -0
  20. package/Gauge/GaugeContainer.js +1 -0
  21. package/Gauge/GaugeProvider.js +1 -3
  22. package/LineChart/AnimatedLine.js +1 -0
  23. package/LineChart/LineChart.d.ts +9 -2
  24. package/LineChart/LineChart.js +11 -3
  25. package/LineChart/LineHighlightPlot.js +1 -4
  26. package/LineChart/MarkPlot.js +1 -4
  27. package/LineChart/useLineChartProps.js +1 -1
  28. package/PieChart/PieArc.js +1 -0
  29. package/PieChart/PieArcLabel.js +1 -0
  30. package/PieChart/PieChart.d.ts +10 -3
  31. package/PieChart/PieChart.js +18 -9
  32. package/RadarChart/RadarChart.d.ts +21 -3
  33. package/RadarChart/RadarChart.js +20 -4
  34. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  35. package/RadarChart/RadarChart.plugins.js +10 -0
  36. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  37. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  38. package/RadarChart/index.d.ts +2 -0
  39. package/RadarChart/index.js +15 -1
  40. package/RadarChart/useRadarChartProps.d.ts +2 -1
  41. package/RadarChart/useRadarChartProps.js +3 -1
  42. package/ScatterChart/Scatter.js +3 -11
  43. package/ScatterChart/ScatterChart.d.ts +9 -2
  44. package/ScatterChart/ScatterChart.js +13 -5
  45. package/ScatterChart/useScatterChartProps.js +4 -2
  46. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  47. package/SparkLineChart/SparkLineChart.js +31 -26
  48. package/Toolbar/Toolbar.d.ts +9 -3
  49. package/Toolbar/Toolbar.js +23 -7
  50. package/Toolbar/Toolbar.types.d.ts +15 -0
  51. package/Toolbar/Toolbar.types.js +5 -0
  52. package/Toolbar/ToolbarButton.d.ts +8 -2
  53. package/Toolbar/ToolbarButton.js +25 -6
  54. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  55. package/Toolbar/chartToolbarClasses.js +9 -0
  56. package/Toolbar/index.d.ts +3 -1
  57. package/Toolbar/index.js +22 -0
  58. package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  59. package/Toolbar/internals/ChartsToolbar.js +14 -0
  60. package/context/ChartProvider/ChartContext.js +1 -3
  61. package/context/ChartsSlotsContext.d.ts +20 -0
  62. package/context/ChartsSlotsContext.js +44 -0
  63. package/context/index.d.ts +2 -1
  64. package/context/index.js +11 -0
  65. package/context/useChartApiContext.d.ts +10 -0
  66. package/context/useChartApiContext.js +27 -0
  67. package/esm/BarChart/BarChart.d.ts +9 -2
  68. package/esm/BarChart/BarChart.js +11 -3
  69. package/esm/BarChart/useBarChartProps.js +1 -1
  70. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  71. package/esm/ChartContainer/ChartContainer.js +17 -1
  72. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  73. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  74. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  75. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  76. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  77. package/esm/ChartsAxis/axisClasses.d.ts +5 -0
  78. package/esm/ChartsAxis/axisClasses.js +1 -1
  79. package/esm/ChartsLegend/ChartsLegend.js +1 -0
  80. package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  81. package/esm/ChartsSurface/ChartsSurface.js +1 -0
  82. package/esm/ChartsXAxis/ChartsXAxis.js +7 -16
  83. package/esm/ChartsYAxis/ChartsYAxis.js +4 -8
  84. package/esm/Gauge/Gauge.js +1 -0
  85. package/esm/Gauge/GaugeContainer.js +1 -0
  86. package/esm/Gauge/GaugeProvider.js +1 -3
  87. package/esm/LineChart/AnimatedLine.js +1 -0
  88. package/esm/LineChart/LineChart.d.ts +9 -2
  89. package/esm/LineChart/LineChart.js +11 -3
  90. package/esm/LineChart/LineHighlightPlot.js +1 -4
  91. package/esm/LineChart/MarkPlot.js +1 -4
  92. package/esm/LineChart/useLineChartProps.js +1 -1
  93. package/esm/PieChart/PieArc.js +1 -0
  94. package/esm/PieChart/PieArcLabel.js +1 -0
  95. package/esm/PieChart/PieChart.d.ts +10 -3
  96. package/esm/PieChart/PieChart.js +16 -7
  97. package/esm/RadarChart/RadarChart.d.ts +21 -3
  98. package/esm/RadarChart/RadarChart.js +20 -4
  99. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  100. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  101. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  102. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  103. package/esm/RadarChart/index.d.ts +2 -0
  104. package/esm/RadarChart/index.js +2 -0
  105. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  106. package/esm/RadarChart/useRadarChartProps.js +3 -1
  107. package/esm/ScatterChart/Scatter.js +3 -11
  108. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  109. package/esm/ScatterChart/ScatterChart.js +13 -5
  110. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  111. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  112. package/esm/SparkLineChart/SparkLineChart.js +31 -26
  113. package/esm/Toolbar/Toolbar.d.ts +9 -3
  114. package/esm/Toolbar/Toolbar.js +22 -7
  115. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  116. package/esm/Toolbar/Toolbar.types.js +1 -0
  117. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  118. package/esm/Toolbar/ToolbarButton.js +24 -5
  119. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  120. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  121. package/esm/Toolbar/index.d.ts +3 -1
  122. package/esm/Toolbar/index.js +3 -1
  123. package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  124. package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
  125. package/esm/context/ChartProvider/ChartContext.js +1 -3
  126. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  127. package/esm/context/ChartsSlotsContext.js +35 -0
  128. package/esm/context/index.d.ts +2 -1
  129. package/esm/context/index.js +1 -0
  130. package/esm/context/useChartApiContext.d.ts +10 -0
  131. package/esm/context/useChartApiContext.js +21 -0
  132. package/esm/hooks/index.d.ts +1 -0
  133. package/esm/hooks/index.js +1 -0
  134. package/esm/hooks/useTicks.js +2 -6
  135. package/esm/index.js +1 -1
  136. package/esm/internals/constants.d.ts +3 -1
  137. package/esm/internals/constants.js +2 -1
  138. package/esm/internals/consumeSlots.js +2 -1
  139. package/esm/internals/consumeThemeProps.js +3 -1
  140. package/esm/internals/dateHelpers.d.ts +15 -0
  141. package/esm/internals/dateHelpers.js +20 -0
  142. package/esm/internals/domUtils.d.ts +1 -2
  143. package/esm/internals/domUtils.js +8 -19
  144. package/esm/internals/index.d.ts +4 -1
  145. package/esm/internals/index.js +4 -1
  146. package/esm/internals/material/index.d.ts +2 -0
  147. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  148. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  149. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  150. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  151. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
  152. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  153. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
  154. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  155. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  156. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  157. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  158. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
  159. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
  160. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  161. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  162. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  163. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  164. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  165. package/esm/models/index.d.ts +2 -2
  166. package/esm/models/index.js +1 -0
  167. package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
  168. package/hooks/index.d.ts +1 -0
  169. package/hooks/index.js +12 -0
  170. package/hooks/useTicks.js +2 -6
  171. package/index.js +1 -1
  172. package/internals/constants.d.ts +3 -1
  173. package/internals/constants.js +3 -2
  174. package/internals/consumeSlots.js +2 -1
  175. package/internals/consumeThemeProps.js +3 -1
  176. package/internals/dateHelpers.d.ts +15 -0
  177. package/internals/dateHelpers.js +28 -0
  178. package/internals/domUtils.d.ts +1 -2
  179. package/internals/domUtils.js +8 -20
  180. package/internals/index.d.ts +4 -1
  181. package/internals/index.js +44 -8
  182. package/internals/material/index.d.ts +2 -0
  183. package/internals/plugins/allPlugins.d.ts +1 -0
  184. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  185. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  186. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  187. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
  188. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  189. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +6 -3
  190. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  191. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  192. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  193. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  194. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
  195. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
  196. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  197. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  198. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  199. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  200. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  201. package/models/index.d.ts +2 -2
  202. package/models/index.js +11 -0
  203. package/models/slots/chartsBaseSlotProps.d.ts +1 -0
  204. package/package.json +3 -3
@@ -1,5 +1,7 @@
1
1
  export { RadarChart as Unstable_RadarChart } from "./RadarChart.js";
2
+ export { RadarChart } from "./RadarChart.js";
2
3
  export { RadarDataProvider as Unstable_RadarDataProvider } from "./RadarDataProvider/index.js";
4
+ export { RadarDataProvider } from "./RadarDataProvider/index.js";
3
5
  export type { RadarChartProps } from "./RadarChart.js";
4
6
  export type { RadarDataProviderProps } from "./RadarDataProvider/index.js";
5
7
  export * from "./RadarGrid/index.js";
@@ -5,8 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  Unstable_RadarChart: true,
8
- Unstable_RadarDataProvider: true
8
+ RadarChart: true,
9
+ Unstable_RadarDataProvider: true,
10
+ RadarDataProvider: true
9
11
  };
12
+ Object.defineProperty(exports, "RadarChart", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _RadarChart.RadarChart;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "RadarDataProvider", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _RadarDataProvider.RadarDataProvider;
22
+ }
23
+ });
10
24
  Object.defineProperty(exports, "Unstable_RadarChart", {
11
25
  enumerable: true,
12
26
  get: function () {
@@ -5,6 +5,7 @@ import type { ChartsWrapperProps } from "../internals/components/ChartsWrapper/i
5
5
  import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
6
6
  import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
7
7
  import { RadarGridProps } from "./RadarGrid/index.js";
8
+ import { RadarChartPluginsSignatures } from "./RadarChart.plugins.js";
8
9
  /**
9
10
  * A helper function that extracts RadarChartProps from the input props
10
11
  * and returns an object with props for the children components of RadarChart.
@@ -16,7 +17,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
16
17
  highlight: "none" | "series" | "axis";
17
18
  chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
18
19
  chartsSurfaceProps: ChartsSurfaceProps;
19
- radarDataProviderProps: RadarDataProviderProps;
20
+ radarDataProviderProps: RadarDataProviderProps<RadarChartPluginsSignatures>;
20
21
  radarGrid: RadarGridProps;
21
22
  overlayProps: ChartsOverlayProps;
22
23
  legendProps: ChartsLegendSlotExtension;
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.useRadarChartProps = void 0;
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
- const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight"];
10
+ const _excluded = ["apiRef", "series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight", "showToolbar"];
11
11
  /**
12
12
  * A helper function that extracts RadarChartProps from the input props
13
13
  * and returns an object with props for the children components of RadarChart.
@@ -17,6 +17,7 @@ const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx
17
17
  */
18
18
  const useRadarChartProps = props => {
19
19
  const {
20
+ apiRef,
20
21
  series,
21
22
  radar,
22
23
  width,
@@ -38,6 +39,7 @@ const useRadarChartProps = props => {
38
39
  } = props,
39
40
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
40
41
  const radarDataProviderProps = {
42
+ apiRef,
41
43
  series,
42
44
  radar,
43
45
  highlight,
@@ -61,19 +61,11 @@ function Scatter(props) {
61
61
  const scatterPoint = series.data[i];
62
62
  const x = getXPosition(scatterPoint.x);
63
63
  const y = getYPosition(scatterPoint.y);
64
- const isInRange = instance.isPointInside({
65
- x,
66
- y
67
- });
68
- const pointCtx = {
69
- type: 'scatter',
70
- seriesId: series.id,
71
- dataIndex: i
72
- };
64
+ const isInRange = instance.isPointInside(x, y);
73
65
  if (isInRange) {
74
66
  const currentItem = {
75
- seriesId: pointCtx.seriesId,
76
- dataIndex: pointCtx.dataIndex
67
+ seriesId: series.id,
68
+ dataIndex: i
77
69
  };
78
70
  const isItemHighlighted = isHighlighted(currentItem);
79
71
  temp.push({
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
4
+ import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
3
5
  import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from "./ScatterPlot.js";
4
6
  import { ChartContainerProps } from "../ChartContainer/index.js";
5
7
  import { ChartsAxisProps } from "../ChartsAxis/index.js";
@@ -12,8 +14,8 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from "../models/axis.js";
12
14
  import { ChartsGridProps } from "../ChartsGrid/index.js";
13
15
  import { UseChartVoronoiSignature } from "../internals/plugins/featurePlugins/useChartVoronoi/index.js";
14
16
  import { ScatterChartPluginsSignatures } from "./ScatterChart.plugins.js";
15
- export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
16
- export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
17
+ export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
18
+ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
17
19
  export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', ScatterChartPluginsSignatures>, 'series' | 'plugins' | 'onItemClick'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
18
20
  /**
19
21
  * The series to display in the scatter chart.
@@ -39,6 +41,11 @@ export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', S
39
41
  * If `true`, the legend is not rendered.
40
42
  */
41
43
  hideLegend?: boolean;
44
+ /**
45
+ * If true, shows the default chart toolbar.
46
+ * @default false
47
+ */
48
+ showToolbar?: boolean;
42
49
  /**
43
50
  * Overridable component slots.
44
51
  * @default {}
@@ -23,6 +23,7 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
23
23
  var _ChartDataProvider = require("../ChartDataProvider");
24
24
  var _ChartsSurface = require("../ChartsSurface");
25
25
  var _ChartsWrapper = require("../internals/components/ChartsWrapper");
26
+ var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
26
27
  var _jsxRuntime = require("react/jsx-runtime");
27
28
  /**
28
29
  * Demos:
@@ -55,19 +56,21 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
55
56
  chartsSurfaceProps
56
57
  } = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
57
58
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
59
+ const Toolbar = props.slots?.toolbar ?? _ChartsToolbar.ChartsToolbar;
58
60
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
59
61
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
60
- children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
62
+ children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
61
63
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
62
64
  "data-drawing-container": true,
63
65
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
64
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
65
- trigger: "item"
66
- }, props.slotProps?.tooltip)), children]
67
- }))]
66
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), children]
67
+ })), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
68
+ trigger: "item"
69
+ }, props.slotProps?.tooltip))]
68
70
  }))
69
71
  }));
70
72
  });
73
+ if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
71
74
  process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
72
75
  // ----------------------------- Warning --------------------------------
73
76
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -181,6 +184,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
181
184
  * An array of [[ScatterSeriesType]] objects.
182
185
  */
183
186
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
187
+ /**
188
+ * If true, shows the default chart toolbar.
189
+ * @default false
190
+ */
191
+ showToolbar: _propTypes.default.bool,
184
192
  /**
185
193
  * If `true`, animations are skipped.
186
194
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _ScatterChart = require("./ScatterChart.plugins");
14
- const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
14
+ const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
15
15
  /**
16
16
  * A helper function that extracts ScatterChartProps from the input props
17
17
  * and returns an object with props for the children components of ScatterChart.
@@ -62,7 +62,9 @@ const useScatterChartProps = props => {
62
62
  voronoiMaxRadius,
63
63
  onItemClick: disableVoronoi ? undefined : onItemClick,
64
64
  className,
65
- plugins: _ScatterChart.SCATTER_CHART_PLUGINS
65
+ plugins: _ScatterChart.SCATTER_CHART_PLUGINS,
66
+ slots,
67
+ slotProps
66
68
  });
67
69
  const chartsAxisProps = {
68
70
  slots,
@@ -13,7 +13,7 @@ import { BarPlotSlots, BarPlotSlotProps } from "../BarChart/BarPlot.js";
13
13
  import { ChartMargin } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js";
14
14
  export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots {}
15
15
  export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {}
16
- export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors'> {
16
+ export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors' | 'slots' | 'slotProps'> {
17
17
  /**
18
18
  * The xAxis configuration.
19
19
  * Notice it is a single [[AxisConfig]] object, not an array of configuration.
@@ -15,7 +15,8 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
15
15
  var _ChartsClipPath = require("../ChartsClipPath");
16
16
  var _BarChart = require("../BarChart");
17
17
  var _LineChart = require("../LineChart");
18
- var _ChartContainer = require("../ChartContainer");
18
+ var _ChartDataProvider = require("../ChartDataProvider");
19
+ var _ChartsSurface = require("../ChartsSurface");
19
20
  var _constants = require("../constants");
20
21
  var _ChartsTooltip = require("../ChartsTooltip");
21
22
  var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
@@ -78,8 +79,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
78
79
  }
79
80
  return typeof color === 'function' ? mode => [color(mode)] : [color];
80
81
  }, [color]);
81
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({}, other, {
82
- ref: ref,
82
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartDataProvider.ChartDataProvider, {
83
83
  series: [(0, _extends2.default)({
84
84
  type: plotType,
85
85
  data,
@@ -92,7 +92,6 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
92
92
  width: width,
93
93
  height: height,
94
94
  margin: margin,
95
- className: className,
96
95
  xAxis: [(0, _extends2.default)({
97
96
  id: _constants.DEFAULT_X_AXIS_KEY,
98
97
  scaleType: plotType === 'bar' ? 'band' : 'point',
@@ -109,34 +108,40 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
109
108
  position: 'none'
110
109
  })],
111
110
  colors: colors,
112
- sx: sx,
113
111
  disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
114
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
115
- clipPath: `url(#${clipPathId})`,
116
- children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
117
- skipAnimation: true,
118
- slots: slots,
119
- slotProps: slotProps
120
- }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
122
- skipAnimation: true,
123
- slots: slots,
124
- slotProps: slotProps
125
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
112
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({
113
+ className: className,
114
+ ref: ref,
115
+ sx: sx
116
+ }, other, {
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
118
+ clipPath: `url(#${clipPathId})`,
119
+ children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
126
120
  skipAnimation: true,
127
121
  slots: slots,
128
122
  slotProps: slotProps
123
+ }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
125
+ skipAnimation: true,
126
+ slots: slots,
127
+ slotProps: slotProps
128
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
129
+ skipAnimation: true,
130
+ slots: slots,
131
+ slotProps: slotProps
132
+ })]
129
133
  })]
130
- })]
131
- }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
132
- slots: slots,
133
- slotProps: slotProps
134
- }), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
135
- id: clipPathId,
136
- offset: clipPathOffset
137
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), children]
138
- }));
134
+ }), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
135
+ slots: slots,
136
+ slotProps: slotProps
137
+ }), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
138
+ id: clipPathId,
139
+ offset: clipPathOffset
140
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), children]
141
+ })), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
142
+ });
139
143
  });
144
+ if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
140
145
  process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
141
146
  // ----------------------------- Warning --------------------------------
142
147
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -1,5 +1,11 @@
1
1
  import * as React from 'react';
2
- export interface ToolbarProps extends React.PropsWithChildren {}
2
+ export interface ChartsToolbarProps extends React.ComponentProps<'div'> {
3
+ className?: string;
4
+ }
3
5
  export declare function Toolbar({
4
- children
5
- }: ToolbarProps): React.JSX.Element;
6
+ className,
7
+ ...other
8
+ }: ChartsToolbarProps): React.JSX.Element;
9
+ export declare namespace Toolbar {
10
+ var propTypes: any;
11
+ }
@@ -1,13 +1,20 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.Toolbar = Toolbar;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
11
  var React = _interopRequireWildcard(require("react"));
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
13
  var _styles = require("@mui/material/styles");
14
+ var _clsx = _interopRequireDefault(require("clsx"));
15
+ var _chartToolbarClasses = require("./chartToolbarClasses");
10
16
  var _jsxRuntime = require("react/jsx-runtime");
17
+ const _excluded = ["className"];
11
18
  const ToolbarRoot = (0, _styles.styled)('div', {
12
19
  name: 'MuiChartsToolbar',
13
20
  slot: 'Root'
@@ -25,10 +32,19 @@ const ToolbarRoot = (0, _styles.styled)('div', {
25
32
  border: `1px solid ${(theme.vars || theme).palette.divider}`,
26
33
  borderRadius: 4
27
34
  }));
28
- function Toolbar({
29
- children
30
- }) {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(ToolbarRoot, {
32
- children: children
33
- });
34
- }
35
+ function Toolbar(_ref) {
36
+ let {
37
+ className
38
+ } = _ref,
39
+ other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ToolbarRoot, (0, _extends2.default)({
41
+ className: (0, _clsx.default)(_chartToolbarClasses.chartsToolbarClasses.root, className)
42
+ }, other));
43
+ }
44
+ process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
45
+ // ----------------------------- Warning --------------------------------
46
+ // | These PropTypes are generated from the TypeScript type definitions |
47
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
48
+ // ----------------------------------------------------------------------
49
+ className: _propTypes.default.string
50
+ } : void 0;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { ChartsToolbarProps } from "./Toolbar.js";
3
+ export interface ChartsToolbarSlots {
4
+ /**
5
+ * Custom component for the toolbar.
6
+ * @default ChartsToolbar
7
+ */
8
+ toolbar?: React.ElementType<ChartsToolbarProps>;
9
+ }
10
+ export interface ChartsToolbarSlotProps {
11
+ /**
12
+ * Props for the toolbar component.
13
+ */
14
+ toolbar?: Partial<ChartsToolbarProps>;
15
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,5 +1,11 @@
1
1
  import * as React from 'react';
2
- import { ChartBaseIconButtonProps } from "../models/slots/chartsBaseSlotProps.js";
3
- export interface ToolbarButtonProps extends ChartBaseIconButtonProps {}
2
+ import { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
+ import { ChartsSlotProps } from "../internals/material/index.js";
4
+ export type ToolbarButtonProps = ChartsSlotProps['baseIconButton'] & {
5
+ /**
6
+ * A function to customize the rendering of the component.
7
+ */
8
+ render?: RenderProp<ChartsSlotProps['baseIconButton']>;
9
+ };
4
10
  declare const ToolbarButton: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
11
  export { ToolbarButton };
@@ -1,27 +1,46 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.ToolbarButton = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
12
  var React = _interopRequireWildcard(require("react"));
12
- var _material = require("../internals/material");
13
+ var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
14
+ var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
13
15
  var _jsxRuntime = require("react/jsx-runtime");
16
+ const _excluded = ["render"];
14
17
  const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
15
- const IconButton = _material.defaultSlotsMaterial.baseIconButton;
16
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(IconButton, (0, _extends2.default)({
17
- ref: ref
18
- }, props));
18
+ const {
19
+ render
20
+ } = props,
21
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
22
+ const {
23
+ slots,
24
+ slotProps
25
+ } = (0, _ChartsSlotsContext.useChartsSlots)();
26
+ const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseIconButton, render, (0, _extends2.default)({}, slotProps?.baseIconButton, other, {
27
+ ref
28
+ }));
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
30
+ children: element
31
+ });
19
32
  });
33
+ if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
20
34
  process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
21
35
  // ----------------------------- Warning --------------------------------
22
36
  // | These PropTypes are generated from the TypeScript type definitions |
23
37
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
24
38
  // ----------------------------------------------------------------------
25
39
  className: _propTypes.default.string,
40
+ disabled: _propTypes.default.bool,
41
+ /**
42
+ * A function to customize the rendering of the component.
43
+ */
44
+ render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
26
45
  style: _propTypes.default.object
27
46
  } : void 0;
@@ -0,0 +1,6 @@
1
+ export interface ChartsToolbarClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ }
5
+ export type ChartsToolbarClassKey = keyof ChartsToolbarClasses;
6
+ export declare const chartsToolbarClasses: ChartsToolbarClasses;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.chartsToolbarClasses = void 0;
8
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
9
+ const chartsToolbarClasses = exports.chartsToolbarClasses = (0, _generateUtilityClasses.default)('MuiChartsToolbar', ['root']);
@@ -1,2 +1,4 @@
1
1
  export * from "./Toolbar.js";
2
- export * from "./ToolbarButton.js";
2
+ export * from "./ToolbarButton.js";
3
+ export * from "./Toolbar.types.js";
4
+ export * from "./chartToolbarClasses.js";
package/Toolbar/index.js CHANGED
@@ -24,4 +24,26 @@ Object.keys(_ToolbarButton).forEach(function (key) {
24
24
  return _ToolbarButton[key];
25
25
  }
26
26
  });
27
+ });
28
+ var _Toolbar2 = require("./Toolbar.types");
29
+ Object.keys(_Toolbar2).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _Toolbar2[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _Toolbar2[key];
36
+ }
37
+ });
38
+ });
39
+ var _chartToolbarClasses = require("./chartToolbarClasses");
40
+ Object.keys(_chartToolbarClasses).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _chartToolbarClasses[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _chartToolbarClasses[key];
47
+ }
48
+ });
27
49
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The chart toolbar component.
3
+ *
4
+ * In the community package, this component is empty and does not render anything.
5
+ */
6
+ export declare function ChartsToolbar(): null;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChartsToolbar = ChartsToolbar;
7
+ /**
8
+ * The chart toolbar component.
9
+ *
10
+ * In the community package, this component is empty and does not render anything.
11
+ */
12
+ function ChartsToolbar() {
13
+ return null;
14
+ }
@@ -10,6 +10,4 @@ var React = _interopRequireWildcard(require("react"));
10
10
  * @ignore - internal component.
11
11
  */
12
12
  const ChartContext = exports.ChartContext = /*#__PURE__*/React.createContext(null);
13
- if (process.env.NODE_ENV !== 'production') {
14
- ChartContext.displayName = 'ChartContext';
15
- }
13
+ if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
3
+ type SlotProps<T extends Record<keyof T, React.ComponentType<any>>> = { [key in keyof T]: React.ComponentProps<T[key]> };
4
+ export interface ChartsSlotsContextValue<T extends ChartsSlots & Record<keyof T, React.ComponentType<any>> = ChartsSlots> {
5
+ slots: T;
6
+ slotProps: Partial<SlotProps<T>>;
7
+ }
8
+ export declare const ChartsSlotsContext: React.Context<ChartsSlotsContextValue<ChartsSlots> | null>;
9
+ /**
10
+ * Get the slots and slotProps from the nearest `ChartDataProvider` or `ChartDataProviderPro`.
11
+ * @returns {ChartsSlotsContextValue} The slots and slotProps from the context.
12
+ */
13
+ export declare function useChartsSlots<T extends ChartsSlots & Record<keyof T, React.ComponentType<any>> = ChartsSlots>(): ChartsSlotsContextValue<T>;
14
+ interface ChartsSlotsProviderProps {
15
+ slots?: Partial<ChartsSlots>;
16
+ slotProps?: Partial<ChartsSlotProps>;
17
+ defaultSlots: ChartsSlots;
18
+ }
19
+ export declare function ChartsSlotsProvider(props: React.PropsWithChildren<ChartsSlotsProviderProps>): React.JSX.Element;
20
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ChartsSlotsContext = void 0;
10
+ exports.ChartsSlotsProvider = ChartsSlotsProvider;
11
+ exports.useChartsSlots = useChartsSlots;
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+ var React = _interopRequireWildcard(require("react"));
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ const ChartsSlotsContext = exports.ChartsSlotsContext = /*#__PURE__*/React.createContext(null);
16
+
17
+ /**
18
+ * Get the slots and slotProps from the nearest `ChartDataProvider` or `ChartDataProviderPro`.
19
+ * @returns {ChartsSlotsContextValue} The slots and slotProps from the context.
20
+ */
21
+ if (process.env.NODE_ENV !== "production") ChartsSlotsContext.displayName = "ChartsSlotsContext";
22
+ function useChartsSlots() {
23
+ const context = React.useContext(ChartsSlotsContext);
24
+ if (context == null) {
25
+ throw new Error(['MUI X Charts: Could not find the Charts Slots context.', 'It looks like you rendered your component outside of a ChartDataProvider.', 'This can also happen if you are bundling multiple versions of the library.'].join('\n'));
26
+ }
27
+ return context;
28
+ }
29
+ function ChartsSlotsProvider(props) {
30
+ const {
31
+ slots,
32
+ slotProps = {},
33
+ defaultSlots,
34
+ children
35
+ } = props;
36
+ const value = React.useMemo(() => ({
37
+ slots: (0, _extends2.default)({}, defaultSlots, slots),
38
+ slotProps
39
+ }), [defaultSlots, slots, slotProps]);
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsSlotsContext.Provider, {
41
+ value: value,
42
+ children: children
43
+ });
44
+ }
@@ -1 +1,2 @@
1
- export type { HighlightScope, FadeOptions, HighlightItemData, HighlightOptions } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
1
+ export type { HighlightScope, FadeOptions, HighlightItemData, HighlightOptions } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
2
+ export * from "./useChartApiContext.js";
package/context/index.js CHANGED
@@ -2,4 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
+ });
6
+ var _useChartApiContext = require("./useChartApiContext");
7
+ Object.keys(_useChartApiContext).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useChartApiContext[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useChartApiContext[key];
14
+ }
15
+ });
5
16
  });