@mui/x-charts 8.4.0 → 8.5.1

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 (194) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +7 -1
  3. package/BarChart/BarLabel/BarLabel.d.ts +1 -1
  4. package/BarChart/seriesConfig/seriesProcessor.js +1 -1
  5. package/BarChart/useBarChartProps.js +1 -1
  6. package/CHANGELOG.md +215 -0
  7. package/ChartContainer/ChartContainer.d.ts +21 -2
  8. package/ChartContainer/ChartContainer.js +16 -0
  9. package/ChartContainer/useChartContainerProps.js +7 -3
  10. package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  11. package/ChartDataProvider/ChartDataProvider.js +19 -2
  12. package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  13. package/ChartDataProvider/useChartDataProviderProps.js +7 -3
  14. package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  15. package/ChartsGrid/styledComponents.d.ts +2 -2
  16. package/ChartsReferenceLine/common.d.ts +1 -1
  17. package/ChartsTooltip/ChartsTooltip.js +1 -1
  18. package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
  19. package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  20. package/ChartsTooltip/utils.d.ts +6 -0
  21. package/ChartsTooltip/utils.js +19 -1
  22. package/LineChart/LineChart.d.ts +9 -2
  23. package/LineChart/LineChart.js +7 -1
  24. package/LineChart/useLineChartProps.js +1 -1
  25. package/PieChart/PieChart.d.ts +10 -3
  26. package/PieChart/PieChart.js +12 -11
  27. package/RadarChart/RadarChart.d.ts +21 -3
  28. package/RadarChart/RadarChart.js +16 -2
  29. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  30. package/RadarChart/RadarChart.plugins.js +10 -0
  31. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  32. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  33. package/RadarChart/index.d.ts +2 -0
  34. package/RadarChart/index.js +15 -1
  35. package/RadarChart/useRadarChartProps.d.ts +2 -1
  36. package/RadarChart/useRadarChartProps.js +3 -1
  37. package/ScatterChart/ScatterChart.d.ts +9 -2
  38. package/ScatterChart/ScatterChart.js +7 -1
  39. package/ScatterChart/useScatterChartProps.js +4 -2
  40. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  41. package/Toolbar/Toolbar.d.ts +11 -4
  42. package/Toolbar/Toolbar.js +38 -7
  43. package/Toolbar/Toolbar.types.d.ts +15 -0
  44. package/Toolbar/Toolbar.types.js +5 -0
  45. package/Toolbar/ToolbarButton.d.ts +8 -2
  46. package/Toolbar/ToolbarButton.js +39 -7
  47. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  48. package/Toolbar/chartToolbarClasses.js +9 -0
  49. package/Toolbar/index.d.ts +3 -1
  50. package/Toolbar/index.js +22 -0
  51. package/context/ChartsSlotsContext.d.ts +20 -0
  52. package/context/ChartsSlotsContext.js +44 -0
  53. package/context/index.d.ts +2 -1
  54. package/context/index.js +11 -0
  55. package/context/useChartApiContext.d.ts +10 -0
  56. package/context/useChartApiContext.js +27 -0
  57. package/esm/BarChart/BarChart.d.ts +9 -2
  58. package/esm/BarChart/BarChart.js +7 -1
  59. package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
  60. package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
  61. package/esm/BarChart/useBarChartProps.js +1 -1
  62. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  63. package/esm/ChartContainer/ChartContainer.js +16 -0
  64. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  65. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  66. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  67. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  68. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  69. package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
  70. package/esm/ChartsGrid/styledComponents.d.ts +2 -2
  71. package/esm/ChartsReferenceLine/common.d.ts +1 -1
  72. package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
  73. package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
  74. package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
  75. package/esm/ChartsTooltip/utils.d.ts +6 -0
  76. package/esm/ChartsTooltip/utils.js +16 -1
  77. package/esm/LineChart/LineChart.d.ts +9 -2
  78. package/esm/LineChart/LineChart.js +7 -1
  79. package/esm/LineChart/useLineChartProps.js +1 -1
  80. package/esm/PieChart/PieChart.d.ts +10 -3
  81. package/esm/PieChart/PieChart.js +12 -11
  82. package/esm/RadarChart/RadarChart.d.ts +21 -3
  83. package/esm/RadarChart/RadarChart.js +16 -2
  84. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  85. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  86. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  87. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  88. package/esm/RadarChart/index.d.ts +2 -0
  89. package/esm/RadarChart/index.js +2 -0
  90. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  91. package/esm/RadarChart/useRadarChartProps.js +3 -1
  92. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  93. package/esm/ScatterChart/ScatterChart.js +7 -1
  94. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  95. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  96. package/esm/Toolbar/Toolbar.d.ts +11 -4
  97. package/esm/Toolbar/Toolbar.js +36 -6
  98. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  99. package/esm/Toolbar/Toolbar.types.js +1 -0
  100. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  101. package/esm/Toolbar/ToolbarButton.js +39 -6
  102. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  103. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  104. package/esm/Toolbar/index.d.ts +3 -1
  105. package/esm/Toolbar/index.js +3 -1
  106. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  107. package/esm/context/ChartsSlotsContext.js +35 -0
  108. package/esm/context/index.d.ts +2 -1
  109. package/esm/context/index.js +1 -0
  110. package/esm/context/useChartApiContext.d.ts +10 -0
  111. package/esm/context/useChartApiContext.js +21 -0
  112. package/esm/hooks/index.d.ts +1 -0
  113. package/esm/hooks/index.js +1 -0
  114. package/esm/index.js +1 -1
  115. package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
  116. package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  117. package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  118. package/esm/internals/constants.d.ts +10 -1
  119. package/esm/internals/constants.js +10 -1
  120. package/esm/internals/dateHelpers.d.ts +15 -0
  121. package/esm/internals/dateHelpers.js +20 -0
  122. package/esm/internals/domUtils.d.ts +1 -2
  123. package/esm/internals/domUtils.js +8 -19
  124. package/esm/internals/index.d.ts +6 -1
  125. package/esm/internals/index.js +6 -1
  126. package/esm/internals/invertScale.d.ts +2 -0
  127. package/esm/internals/invertScale.js +8 -0
  128. package/esm/internals/material/index.d.ts +2 -0
  129. package/esm/internals/material/index.js +2 -0
  130. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  131. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  132. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  133. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  134. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  135. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
  136. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -1
  137. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  138. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  139. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  140. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  141. package/esm/locales/index.d.ts +3 -1
  142. package/esm/locales/index.js +2 -0
  143. package/esm/locales/ptBR.d.ts +16 -0
  144. package/esm/locales/ptBR.js +9 -0
  145. package/esm/locales/ptPT.d.ts +16 -0
  146. package/esm/locales/ptPT.js +9 -0
  147. package/esm/models/axis.d.ts +2 -1
  148. package/esm/models/index.d.ts +2 -2
  149. package/esm/models/index.js +1 -0
  150. package/esm/models/seriesType/bar.d.ts +2 -2
  151. package/esm/models/slots/chartsBaseSlotProps.d.ts +7 -0
  152. package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
  153. package/hooks/index.d.ts +1 -0
  154. package/hooks/index.js +12 -0
  155. package/index.js +1 -1
  156. package/internals/components/AxisSharedComponents.d.ts +1 -1
  157. package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  158. package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
  159. package/internals/constants.d.ts +10 -1
  160. package/internals/constants.js +11 -2
  161. package/internals/dateHelpers.d.ts +15 -0
  162. package/internals/dateHelpers.js +28 -0
  163. package/internals/domUtils.d.ts +1 -2
  164. package/internals/domUtils.js +8 -20
  165. package/internals/index.d.ts +6 -1
  166. package/internals/index.js +68 -8
  167. package/internals/invertScale.d.ts +2 -0
  168. package/internals/invertScale.js +14 -0
  169. package/internals/material/index.d.ts +2 -0
  170. package/internals/material/index.js +2 -0
  171. package/internals/plugins/allPlugins.d.ts +1 -0
  172. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  173. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  174. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  175. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  176. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
  177. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +10 -2
  178. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  179. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  180. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  181. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  182. package/locales/index.d.ts +3 -1
  183. package/locales/index.js +22 -0
  184. package/locales/ptBR.d.ts +16 -0
  185. package/locales/ptBR.js +15 -0
  186. package/locales/ptPT.d.ts +16 -0
  187. package/locales/ptPT.js +15 -0
  188. package/models/axis.d.ts +2 -1
  189. package/models/index.d.ts +2 -2
  190. package/models/index.js +11 -0
  191. package/models/seriesType/bar.d.ts +2 -2
  192. package/models/slots/chartsBaseSlotProps.d.ts +7 -0
  193. package/models/slots/chartsBaseSlots.d.ts +2 -1
  194. package/package.json +5 -5
@@ -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,
@@ -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 {}
@@ -55,9 +55,10 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
55
55
  chartsSurfaceProps
56
56
  } = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
57
57
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
58
+ const Toolbar = props.slots?.toolbar;
58
59
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
59
60
  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, {
61
+ children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.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
62
  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
63
  "data-drawing-container": true,
63
64
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
@@ -182,6 +183,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
182
183
  * An array of [[ScatterSeriesType]] objects.
183
184
  */
184
185
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
186
+ /**
187
+ * If true, shows the default chart toolbar.
188
+ * @default false
189
+ */
190
+ showToolbar: _propTypes.default.bool,
185
191
  /**
186
192
  * If `true`, animations are skipped.
187
193
  * 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.
@@ -1,5 +1,12 @@
1
1
  import * as React from 'react';
2
- export interface ToolbarProps extends React.PropsWithChildren {}
3
- export declare function Toolbar({
4
- children
5
- }: ToolbarProps): React.JSX.Element;
2
+ import { RenderProp } from '@mui/x-internals/useComponentRenderer';
3
+ declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
4
+ export interface ToolbarProps extends React.ComponentProps<'div'> {
5
+ className?: string;
6
+ /**
7
+ * A function to customize rendering of the component.
8
+ */
9
+ render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
10
+ }
11
+ export declare const Toolbar: React.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ export {};
@@ -1,13 +1,22 @@
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
- exports.Toolbar = Toolbar;
8
+ exports.Toolbar = void 0;
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 _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
16
+ var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
17
+ var _chartToolbarClasses = require("./chartToolbarClasses");
10
18
  var _jsxRuntime = require("react/jsx-runtime");
19
+ const _excluded = ["className", "render"];
11
20
  const ToolbarRoot = (0, _styles.styled)('div', {
12
21
  name: 'MuiChartsToolbar',
13
22
  slot: 'Root'
@@ -25,10 +34,32 @@ const ToolbarRoot = (0, _styles.styled)('div', {
25
34
  border: `1px solid ${(theme.vars || theme).palette.divider}`,
26
35
  borderRadius: 4
27
36
  }));
28
- function Toolbar({
29
- children
30
- }) {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(ToolbarRoot, {
32
- children: children
37
+ const Toolbar = exports.Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(_ref, ref) {
38
+ let {
39
+ className,
40
+ render
41
+ } = _ref,
42
+ other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
43
+ const element = (0, _useComponentRenderer.useComponentRenderer)(ToolbarRoot, render, (0, _extends2.default)({
44
+ role: 'toolbar',
45
+ 'aria-orientation': 'horizontal',
46
+ className: (0, _clsx.default)(_chartToolbarClasses.chartsToolbarClasses.root, className)
47
+ }, other, {
48
+ ref
49
+ }));
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarContext.ToolbarContextProvider, {
51
+ children: element
33
52
  });
34
- }
53
+ });
54
+ if (process.env.NODE_ENV !== "production") Toolbar.displayName = "Toolbar";
55
+ process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
56
+ // ----------------------------- Warning --------------------------------
57
+ // | These PropTypes are generated from the TypeScript type definitions |
58
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
59
+ // ----------------------------------------------------------------------
60
+ className: _propTypes.default.string,
61
+ /**
62
+ * A function to customize rendering of the component.
63
+ */
64
+ render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func])
65
+ } : void 0;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export interface ChartsToolbarProps {}
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,21 +1,47 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
7
8
  });
8
9
  exports.ToolbarButton = void 0;
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
13
  var React = _interopRequireWildcard(require("react"));
12
- var _material = require("../internals/material");
14
+ var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
15
+ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
16
+ var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
17
+ var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
13
18
  var _jsxRuntime = require("react/jsx-runtime");
19
+ const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
20
+ _excluded2 = ["tabIndex"];
14
21
  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));
22
+ const {
23
+ render
24
+ } = props,
25
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
26
+ const {
27
+ slots,
28
+ slotProps
29
+ } = (0, _ChartsSlotsContext.useChartsSlots)();
30
+ const buttonRef = React.useRef(null);
31
+ const handleRef = (0, _useForkRef.default)(buttonRef, ref);
32
+ const _useRegisterToolbarBu = (0, _ToolbarContext.useRegisterToolbarButton)(props, buttonRef),
33
+ {
34
+ tabIndex
35
+ } = _useRegisterToolbarBu,
36
+ toolbarButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_useRegisterToolbarBu, _excluded2);
37
+ const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseIconButton, render, (0, _extends2.default)({}, slotProps?.baseIconButton, {
38
+ tabIndex
39
+ }, other, toolbarButtonProps, {
40
+ ref: handleRef
41
+ }));
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
43
+ children: element
44
+ });
19
45
  });
20
46
  if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
21
47
  process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
@@ -24,5 +50,11 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
24
50
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
25
51
  // ----------------------------------------------------------------------
26
52
  className: _propTypes.default.string,
27
- style: _propTypes.default.object
53
+ disabled: _propTypes.default.bool,
54
+ /**
55
+ * A function to customize the rendering of the component.
56
+ */
57
+ render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
58
+ style: _propTypes.default.object,
59
+ tabIndex: _propTypes.default.number
28
60
  } : 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,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
  });
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { ChartApi } from "../ChartContainer/index.js";
3
+ /**
4
+ * The `useChartApiContext` hook provides access to the chart API.
5
+ * This is only available when the chart is rendered within a chart or a `ChartDataProvider` component.
6
+ * If you want to access the chart API outside those components, you should use the `apiRef` prop instead.
7
+ * @example
8
+ * const apiRef = useChartApiContext<ChartApi<'bar'>>();
9
+ */
10
+ export declare function useChartApiContext<Api extends ChartApi>(): React.RefObject<Api>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useChartApiContext = useChartApiContext;
9
+ var React = _interopRequireWildcard(require("react"));
10
+ var _ChartProvider = require("./ChartProvider");
11
+ /**
12
+ * The `useChartApiContext` hook provides access to the chart API.
13
+ * This is only available when the chart is rendered within a chart or a `ChartDataProvider` component.
14
+ * If you want to access the chart API outside those components, you should use the `apiRef` prop instead.
15
+ * @example
16
+ * const apiRef = useChartApiContext<ChartApi<'bar'>>();
17
+ */
18
+ function useChartApiContext() {
19
+ const {
20
+ publicAPI
21
+ } = (0, _ChartProvider.useChartContext)();
22
+ const apiRef = React.useRef(publicAPI);
23
+ React.useEffect(() => {
24
+ apiRef.current = publicAPI;
25
+ }, [publicAPI]);
26
+ return apiRef;
27
+ }
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
+ import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
4
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
3
5
  import { BarPlotProps, BarPlotSlotProps, BarPlotSlots } from "./BarPlot.js";
4
6
  import { ChartContainerProps } from "../ChartContainer/index.js";
5
7
  import { ChartsAxisProps } from "../ChartsAxis/index.js";
@@ -11,8 +13,8 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from "../models/axis.js";
11
13
  import { ChartsGridProps } from "../ChartsGrid/index.js";
12
14
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/ChartsOverlay.js";
13
15
  import { BarChartPluginsSignatures } from "./BarChart.plugins.js";
14
- export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
15
- export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
16
+ export interface BarChartSlots extends ChartsAxisSlots, BarPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
17
+ export interface BarChartSlotProps extends ChartsAxisSlotProps, BarPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
16
18
  export interface BarChartProps extends Omit<ChartContainerProps<'bar', BarChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<BarPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
17
19
  /**
18
20
  * The series to display in the bar chart.
@@ -50,6 +52,11 @@ export interface BarChartProps extends Omit<ChartContainerProps<'bar', BarChartP
50
52
  * @default 'vertical'
51
53
  */
52
54
  layout?: BarSeriesType['layout'];
55
+ /**
56
+ * If true, shows the default chart toolbar.
57
+ * @default false
58
+ */
59
+ showToolbar?: boolean;
53
60
  }
54
61
  /**
55
62
  * Demos:
@@ -52,9 +52,10 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
52
52
  chartsSurfaceProps
53
53
  } = useChartContainerProps(chartContainerProps, ref);
54
54
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
55
+ const Toolbar = props.slots?.toolbar;
55
56
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
56
57
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
57
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
58
+ children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
58
59
  children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
59
60
  children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
60
61
  })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
@@ -189,6 +190,11 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
189
190
  * An array of [[BarSeriesType]] objects.
190
191
  */
191
192
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
193
+ /**
194
+ * If true, shows the default chart toolbar.
195
+ * @default false
196
+ */
197
+ showToolbar: PropTypes.bool,
192
198
  /**
193
199
  * If `true`, animations are skipped.
194
200
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { BarLabelOwnerState } from "./BarLabel.types.js";
3
- export declare const BarLabelComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.SVGTextElementAttributes<SVGTextElement>, keyof React.SVGTextElementAttributes<SVGTextElement>>, {}>;
3
+ export declare const BarLabelComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.SVGTextElementAttributes<SVGTextElement>, keyof React.SVGTextElementAttributes<SVGTextElement>>, {}>;
4
4
  export type BarLabelProps = Omit<React.SVGProps<SVGTextElement>, 'ref' | 'id' | 'x' | 'y' | 'width' | 'height'> & BarLabelOwnerState & {
5
5
  /**
6
6
  * The x-coordinate of the stack this bar label belongs to.
@@ -56,7 +56,7 @@ const seriesProcessor = (params, dataset) => {
56
56
  warnOnce([`MUI X Charts: your dataset key "${dataKey}" is used for plotting bars, but contains nonnumerical elements.`, 'Bar plots only support numbers and null values.']);
57
57
  }
58
58
  }
59
- return 0;
59
+ return null;
60
60
  }
61
61
  return value;
62
62
  }) : series[id].data,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
5
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar"];
6
6
  import * as React from 'react';
7
7
  import useId from '@mui/utils/useId';
8
8
  import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";