@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
@@ -2,10 +2,11 @@
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 = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
5
+ const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { useThemeProps } from '@mui/material/styles';
9
+ import { DEFAULT_PIE_CHART_MARGIN } from "../internals/constants.js";
9
10
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
10
11
  import { ChartsLegend } from "../ChartsLegend/index.js";
11
12
  import { PiePlot } from "./PiePlot.js";
@@ -17,13 +18,6 @@ import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
17
18
  import { PIE_CHART_PLUGINS } from "./PieChart.plugins.js";
18
19
  import { defaultizeMargin } from "../internals/defaultizeMargin.js";
19
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- const defaultMargin = {
21
- top: 5,
22
- bottom: 5,
23
- left: 5,
24
- right: 5
25
- };
26
-
27
21
  /**
28
22
  * Demos:
29
23
  *
@@ -55,10 +49,11 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
55
49
  loading,
56
50
  highlightedItem,
57
51
  onHighlightChange,
58
- className
52
+ className,
53
+ showToolbar
59
54
  } = props,
60
55
  other = _objectWithoutPropertiesLoose(props, _excluded);
61
- const margin = defaultizeMargin(marginProps, defaultMargin);
56
+ const margin = defaultizeMargin(marginProps, DEFAULT_PIE_CHART_MARGIN);
62
57
  const {
63
58
  chartDataProviderProps,
64
59
  chartsSurfaceProps
@@ -77,12 +72,13 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
77
72
  plugins: PIE_CHART_PLUGINS
78
73
  }), ref);
79
74
  const Tooltip = slots?.tooltip ?? ChartsTooltip;
75
+ const Toolbar = props.slots?.toolbar;
80
76
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
81
77
  children: /*#__PURE__*/_jsxs(ChartsWrapper, {
82
78
  legendPosition: props.slotProps?.legend?.position,
83
79
  legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
84
80
  sx: sx,
85
- children: [!hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
81
+ children: [showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
86
82
  direction: props?.slotProps?.legend?.direction ?? 'vertical',
87
83
  slots: slots,
88
84
  slotProps: slotProps
@@ -180,6 +176,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
180
176
  * An array of [[PieSeriesType]] objects.
181
177
  */
182
178
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
179
+ /**
180
+ * If true, shows the default chart toolbar.
181
+ * @default false
182
+ */
183
+ showToolbar: PropTypes.bool,
183
184
  /**
184
185
  * If `true`, animations are skipped.
185
186
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
@@ -1,17 +1,26 @@
1
1
  import * as React from 'react';
2
2
  import { ChartsLegendSlotProps, ChartsLegendSlots } from "../ChartsLegend/index.js";
3
3
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/ChartsOverlay.js";
4
+ import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
5
+ import { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
4
6
  import { RadarGridProps } from "./RadarGrid/index.js";
5
7
  import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
6
8
  import { RadarAxisHighlightProps } from "./RadarAxisHighlight/index.js";
7
9
  import { ChartsTooltipSlotProps, ChartsTooltipSlots } from "../ChartsTooltip/index.js";
8
- export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots {}
9
- export interface RadarChartSlotProps extends ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsLegendSlotProps {}
10
- export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
10
+ import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
11
+ import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
12
+ export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
13
+ export interface RadarChartSlotProps extends ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
14
+ export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'> {
11
15
  /**
12
16
  * If `true`, the legend is not rendered.
13
17
  */
14
18
  hideLegend?: boolean;
19
+ /**
20
+ * If true, shows the default chart toolbar.
21
+ * @default false
22
+ */
23
+ showToolbar?: boolean;
15
24
  /**
16
25
  * Overridable component slots.
17
26
  * @default {}
@@ -23,5 +32,14 @@ export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridP
23
32
  */
24
33
  slotProps?: RadarChartSlotProps;
25
34
  }
35
+ /**
36
+ * Demos:
37
+ *
38
+ * - [Radar Chart](https://mui.com/x/react-charts/radar/)
39
+ *
40
+ * API:
41
+ *
42
+ * - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
43
+ */
26
44
  declare const RadarChart: React.ForwardRefExoticComponent<RadarChartProps & React.RefAttributes<SVGSVGElement>>;
27
45
  export { RadarChart };
@@ -16,6 +16,15 @@ import { RadarAxisHighlight } from "./RadarAxisHighlight/index.js";
16
16
  import { RadarMetricLabels } from "./RadarMetricLabels/index.js";
17
17
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
18
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ /**
20
+ * Demos:
21
+ *
22
+ * - [Radar Chart](https://mui.com/x/react-charts/radar/)
23
+ *
24
+ * API:
25
+ *
26
+ * - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
27
+ */
19
28
  const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, ref) {
20
29
  const props = useThemeProps({
21
30
  props: inProps,
@@ -32,9 +41,10 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
32
41
  children
33
42
  } = useRadarChartProps(props);
34
43
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
44
+ const Toolbar = props.slots?.toolbar;
35
45
  return /*#__PURE__*/_jsx(RadarDataProvider, _extends({}, radarDataProviderProps, {
36
46
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
37
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
47
+ children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
38
48
  ref: ref,
39
49
  children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), children]
40
50
  })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
@@ -50,7 +60,6 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
50
60
  apiRef: PropTypes.shape({
51
61
  current: PropTypes.object
52
62
  }),
53
- children: PropTypes.node,
54
63
  className: PropTypes.string,
55
64
  /**
56
65
  * Color palette used to colorize multiple series.
@@ -146,6 +155,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
146
155
  * @default 'sharp'
147
156
  */
148
157
  shape: PropTypes.oneOf(['circular', 'sharp']),
158
+ /**
159
+ * If true, shows the default chart toolbar.
160
+ * @default false
161
+ */
162
+ showToolbar: PropTypes.bool,
149
163
  /**
150
164
  * If `true`, animations are skipped.
151
165
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
@@ -0,0 +1,5 @@
1
+ import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
2
+ import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
3
+ import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
4
+ export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>];
5
+ export type RadarChartPluginsSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
@@ -0,0 +1,4 @@
1
+ import { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
2
+ import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
3
+ import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
4
+ export const RADAR_PLUGINS = [useChartPolarAxis, useChartInteraction, useChartHighlight];
@@ -1,13 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
- import { ChartContainerProps } from "../../ChartContainer/index.js";
3
+ import { RadarChartPluginsSignatures } from "../RadarChart.plugins.js";
4
4
  import { RadarSeriesType } from "../../models/seriesType/radar.js";
5
- import { UseChartPolarAxisSignature } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
6
- import { UseChartHighlightSignature } from "../../internals/plugins/featurePlugins/useChartHighlight/index.js";
7
- import { UseChartInteractionSignature } from "../../internals/plugins/featurePlugins/useChartInteraction/index.js";
5
+ import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
8
6
  import { RadarConfig } from "./radar.types.js";
9
- type RadarPluginSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
10
- export interface RadarDataProviderProps extends Omit<ChartContainerProps<'radar', RadarPluginSignatures>, 'series' | 'plugins' | 'rotationAxis' | 'radiusAxis' | 'dataset'> {
7
+ import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
8
+ export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginsSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset'> & {
11
9
  /**
12
10
  * The series to display in the bar chart.
13
11
  * An array of [[RadarSeriesType]] objects.
@@ -22,9 +20,6 @@ export interface RadarDataProviderProps extends Omit<ChartContainerProps<'radar'
22
20
  * @default 'axis'
23
21
  */
24
22
  highlight?: 'axis' | 'series' | 'none';
25
- }
26
- declare function RadarDataProvider(props: RadarDataProviderProps): React.JSX.Element;
27
- declare namespace RadarDataProvider {
28
- var propTypes: any;
29
- }
23
+ };
24
+ declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginsSignatures>(props: RadarDataProviderProps<TSignatures>): React.JSX.Element;
30
25
  export { RadarDataProvider };
@@ -2,20 +2,16 @@
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 = ["series", "children", "width", "height", "colors", "highlightedItem", "onHighlightChange", "className", "skipAnimation", "margin", "radar", "highlight"];
5
+ const _excluded = ["series", "children", "width", "height", "colors", "skipAnimation", "margin", "radar", "highlight", "plugins"];
6
6
  import * as React from 'react';
7
- import PropTypes from 'prop-types';
7
+ import { RADAR_PLUGINS } from "../RadarChart.plugins.js";
8
8
  import { ChartDataProvider } from "../../ChartDataProvider/index.js";
9
9
  import { defaultizeMargin } from "../../internals/defaultizeMargin.js";
10
- import { useChartPolarAxis } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
11
- import { useChartHighlight } from "../../internals/plugins/featurePlugins/useChartHighlight/index.js";
12
- import { useChartInteraction } from "../../internals/plugins/featurePlugins/useChartInteraction/index.js";
13
10
  import { radarSeriesConfig } from "../seriesConfig/index.js";
14
11
  import { jsx as _jsx } from "react/jsx-runtime";
15
12
  const RADAR_SERIES_CONFIG = {
16
13
  radar: radarSeriesConfig
17
14
  };
18
- const RADAR_PLUGINS = [useChartPolarAxis, useChartInteraction, useChartHighlight];
19
15
  const DEFAULT_RADAR_MARGIN = {
20
16
  top: 30,
21
17
  bottom: 30,
@@ -29,12 +25,11 @@ function RadarDataProvider(props) {
29
25
  width,
30
26
  height,
31
27
  colors,
32
- highlightedItem,
33
- onHighlightChange,
34
28
  skipAnimation,
35
29
  margin,
36
30
  radar,
37
- highlight
31
+ highlight,
32
+ plugins
38
33
  } = props,
39
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
40
35
  const rotationAxes = React.useMemo(() => [{
@@ -80,117 +75,12 @@ function RadarDataProvider(props) {
80
75
  height: height,
81
76
  margin: defaultizedMargin,
82
77
  colors: colors,
83
- highlightedItem: highlightedItem,
84
- onHighlightChange: onHighlightChange,
85
78
  skipAnimation: skipAnimation,
86
- plugins: RADAR_PLUGINS,
79
+ plugins: plugins ?? RADAR_PLUGINS,
87
80
  rotationAxis: rotationAxes,
88
81
  radiusAxis: radiusAxis,
89
82
  seriesConfig: RADAR_SERIES_CONFIG,
90
83
  children: children
91
84
  }));
92
85
  }
93
- process.env.NODE_ENV !== "production" ? RadarDataProvider.propTypes = {
94
- // ----------------------------- Warning --------------------------------
95
- // | These PropTypes are generated from the TypeScript type definitions |
96
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
97
- // ----------------------------------------------------------------------
98
- apiRef: PropTypes.shape({
99
- current: PropTypes.object
100
- }),
101
- children: PropTypes.node,
102
- className: PropTypes.string,
103
- /**
104
- * Color palette used to colorize multiple series.
105
- * @default rainbowSurgePalette
106
- */
107
- colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
108
- desc: PropTypes.string,
109
- /**
110
- * If `true`, the charts will not listen to the mouse move event.
111
- * It might break interactive features, but will improve performance.
112
- * @default false
113
- */
114
- disableAxisListener: PropTypes.bool,
115
- /**
116
- * The height of the chart in px. If not defined, it takes the height of the parent element.
117
- */
118
- height: PropTypes.number,
119
- /**
120
- * Indicates if the chart should highlight items per axis or per series.
121
- * @default 'axis'
122
- */
123
- highlight: PropTypes.oneOf(['axis', 'none', 'series']),
124
- /**
125
- * The highlighted item.
126
- * Used when the highlight is controlled.
127
- */
128
- highlightedItem: PropTypes.shape({
129
- dataIndex: PropTypes.number,
130
- seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
131
- }),
132
- /**
133
- * This prop is used to help implement the accessibility logic.
134
- * If you don't provide this prop. It falls back to a randomly generated id.
135
- */
136
- id: PropTypes.string,
137
- /**
138
- * Localized text for chart components.
139
- */
140
- localeText: PropTypes.object,
141
- /**
142
- * The margin between the SVG and the drawing area.
143
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
144
- *
145
- * Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
146
- */
147
- margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
148
- bottom: PropTypes.number,
149
- left: PropTypes.number,
150
- right: PropTypes.number,
151
- top: PropTypes.number
152
- })]),
153
- /**
154
- * The callback fired when the highlighted item changes.
155
- *
156
- * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
157
- */
158
- onHighlightChange: PropTypes.func,
159
- /**
160
- * The configuration of the radar scales.
161
- */
162
- radar: PropTypes.shape({
163
- labelFormatter: PropTypes.func,
164
- labelGap: PropTypes.number,
165
- max: PropTypes.number,
166
- metrics: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.shape({
167
- max: PropTypes.number,
168
- min: PropTypes.number,
169
- name: PropTypes.string.isRequired
170
- }))]).isRequired,
171
- startAngle: PropTypes.number
172
- }).isRequired,
173
- /**
174
- * The series to display in the bar chart.
175
- * An array of [[RadarSeriesType]] objects.
176
- */
177
- series: PropTypes.arrayOf(PropTypes.object).isRequired,
178
- /**
179
- * The configuration helpers used to compute attributes according to the series type.
180
- * @ignore Unstable props for internal usage.
181
- */
182
- seriesConfig: PropTypes.object,
183
- /**
184
- * If `true`, animations are skipped.
185
- * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
186
- */
187
- skipAnimation: PropTypes.bool,
188
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
189
- theme: PropTypes.oneOf(['dark', 'light']),
190
- title: PropTypes.string,
191
- /**
192
- * The width of the chart in px. If not defined, it takes the width of the parent element.
193
- */
194
- width: PropTypes.number
195
- } : void 0;
196
86
  export { RadarDataProvider };
@@ -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";
@@ -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 * from "./RadarGrid/index.js";
4
6
  export * from "./RadarAxisHighlight/index.js";
5
7
  export * from "./RadarMetricLabels/index.js";
@@ -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;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
- const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight"];
4
+ const _excluded = ["apiRef", "series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight", "showToolbar"];
5
5
  /**
6
6
  * A helper function that extracts RadarChartProps from the input props
7
7
  * and returns an object with props for the children components of RadarChart.
@@ -11,6 +11,7 @@ const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx
11
11
  */
12
12
  export const useRadarChartProps = props => {
13
13
  const {
14
+ apiRef,
14
15
  series,
15
16
  radar,
16
17
  width,
@@ -32,6 +33,7 @@ export const useRadarChartProps = props => {
32
33
  } = props,
33
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
34
35
  const radarDataProviderProps = {
36
+ apiRef,
35
37
  series,
36
38
  radar,
37
39
  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 {}
@@ -48,9 +48,10 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
48
48
  chartsSurfaceProps
49
49
  } = useChartContainerProps(chartContainerProps, ref);
50
50
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
51
+ const Toolbar = props.slots?.toolbar;
51
52
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
52
53
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
53
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
54
+ children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
54
55
  children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
55
56
  "data-drawing-container": true,
56
57
  children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
@@ -175,6 +176,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
175
176
  * An array of [[ScatterSeriesType]] objects.
176
177
  */
177
178
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
179
+ /**
180
+ * If true, shows the default chart toolbar.
181
+ * @default false
182
+ */
183
+ showToolbar: PropTypes.bool,
178
184
  /**
179
185
  * If `true`, animations are skipped.
180
186
  * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
@@ -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", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
5
+ 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"];
6
6
  import * as React from 'react';
7
7
  import { SCATTER_CHART_PLUGINS } from "./ScatterChart.plugins.js";
8
8
  /**
@@ -55,7 +55,9 @@ export const useScatterChartProps = props => {
55
55
  voronoiMaxRadius,
56
56
  onItemClick: disableVoronoi ? undefined : onItemClick,
57
57
  className,
58
- plugins: SCATTER_CHART_PLUGINS
58
+ plugins: SCATTER_CHART_PLUGINS,
59
+ slots,
60
+ slotProps
59
61
  });
60
62
  const chartsAxisProps = {
61
63
  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,5 +1,13 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["className", "render"];
1
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
2
6
  import { styled } from '@mui/material/styles';
7
+ import clsx from 'clsx';
8
+ import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
9
+ import { ToolbarContextProvider } from '@mui/x-internals/ToolbarContext';
10
+ import { chartsToolbarClasses } from "./chartToolbarClasses.js";
3
11
  import { jsx as _jsx } from "react/jsx-runtime";
4
12
  const ToolbarRoot = styled('div', {
5
13
  name: 'MuiChartsToolbar',
@@ -18,10 +26,32 @@ const ToolbarRoot = styled('div', {
18
26
  border: `1px solid ${(theme.vars || theme).palette.divider}`,
19
27
  borderRadius: 4
20
28
  }));
21
- export function Toolbar({
22
- children
23
- }) {
24
- return /*#__PURE__*/_jsx(ToolbarRoot, {
25
- children: children
29
+ export const Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(_ref, ref) {
30
+ let {
31
+ className,
32
+ render
33
+ } = _ref,
34
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
35
+ const element = useComponentRenderer(ToolbarRoot, render, _extends({
36
+ role: 'toolbar',
37
+ 'aria-orientation': 'horizontal',
38
+ className: clsx(chartsToolbarClasses.root, className)
39
+ }, other, {
40
+ ref
41
+ }));
42
+ return /*#__PURE__*/_jsx(ToolbarContextProvider, {
43
+ children: element
26
44
  });
27
- }
45
+ });
46
+ if (process.env.NODE_ENV !== "production") Toolbar.displayName = "Toolbar";
47
+ process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
48
+ // ----------------------------- Warning --------------------------------
49
+ // | These PropTypes are generated from the TypeScript type definitions |
50
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
51
+ // ----------------------------------------------------------------------
52
+ className: PropTypes.string,
53
+ /**
54
+ * A function to customize rendering of the component.
55
+ */
56
+ render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
57
+ } : 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 @@
1
+ export {};
@@ -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 };