@mui/x-charts 8.4.0 → 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 (148) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +8 -1
  3. package/BarChart/useBarChartProps.js +1 -1
  4. package/CHANGELOG.md +103 -0
  5. package/ChartContainer/ChartContainer.d.ts +21 -2
  6. package/ChartContainer/ChartContainer.js +16 -0
  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/LineChart/LineChart.d.ts +9 -2
  13. package/LineChart/LineChart.js +8 -1
  14. package/LineChart/useLineChartProps.js +1 -1
  15. package/PieChart/PieChart.d.ts +10 -3
  16. package/PieChart/PieChart.js +11 -3
  17. package/RadarChart/RadarChart.d.ts +21 -3
  18. package/RadarChart/RadarChart.js +17 -2
  19. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  20. package/RadarChart/RadarChart.plugins.js +10 -0
  21. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  22. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  23. package/RadarChart/index.d.ts +2 -0
  24. package/RadarChart/index.js +15 -1
  25. package/RadarChart/useRadarChartProps.d.ts +2 -1
  26. package/RadarChart/useRadarChartProps.js +3 -1
  27. package/ScatterChart/ScatterChart.d.ts +9 -2
  28. package/ScatterChart/ScatterChart.js +8 -1
  29. package/ScatterChart/useScatterChartProps.js +4 -2
  30. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  31. package/Toolbar/Toolbar.d.ts +9 -3
  32. package/Toolbar/Toolbar.js +23 -7
  33. package/Toolbar/Toolbar.types.d.ts +15 -0
  34. package/Toolbar/Toolbar.types.js +5 -0
  35. package/Toolbar/ToolbarButton.d.ts +8 -2
  36. package/Toolbar/ToolbarButton.js +24 -6
  37. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  38. package/Toolbar/chartToolbarClasses.js +9 -0
  39. package/Toolbar/index.d.ts +3 -1
  40. package/Toolbar/index.js +22 -0
  41. package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  42. package/Toolbar/internals/ChartsToolbar.js +14 -0
  43. package/context/ChartsSlotsContext.d.ts +20 -0
  44. package/context/ChartsSlotsContext.js +44 -0
  45. package/context/index.d.ts +2 -1
  46. package/context/index.js +11 -0
  47. package/context/useChartApiContext.d.ts +10 -0
  48. package/context/useChartApiContext.js +27 -0
  49. package/esm/BarChart/BarChart.d.ts +9 -2
  50. package/esm/BarChart/BarChart.js +8 -1
  51. package/esm/BarChart/useBarChartProps.js +1 -1
  52. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  53. package/esm/ChartContainer/ChartContainer.js +16 -0
  54. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  55. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  56. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  57. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  58. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  59. package/esm/LineChart/LineChart.d.ts +9 -2
  60. package/esm/LineChart/LineChart.js +8 -1
  61. package/esm/LineChart/useLineChartProps.js +1 -1
  62. package/esm/PieChart/PieChart.d.ts +10 -3
  63. package/esm/PieChart/PieChart.js +11 -3
  64. package/esm/RadarChart/RadarChart.d.ts +21 -3
  65. package/esm/RadarChart/RadarChart.js +17 -2
  66. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  67. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  68. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  69. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  70. package/esm/RadarChart/index.d.ts +2 -0
  71. package/esm/RadarChart/index.js +2 -0
  72. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  73. package/esm/RadarChart/useRadarChartProps.js +3 -1
  74. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  75. package/esm/ScatterChart/ScatterChart.js +8 -1
  76. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  77. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  78. package/esm/Toolbar/Toolbar.d.ts +9 -3
  79. package/esm/Toolbar/Toolbar.js +22 -7
  80. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  81. package/esm/Toolbar/Toolbar.types.js +1 -0
  82. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  83. package/esm/Toolbar/ToolbarButton.js +23 -5
  84. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  85. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  86. package/esm/Toolbar/index.d.ts +3 -1
  87. package/esm/Toolbar/index.js +3 -1
  88. package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  89. package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
  90. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  91. package/esm/context/ChartsSlotsContext.js +35 -0
  92. package/esm/context/index.d.ts +2 -1
  93. package/esm/context/index.js +1 -0
  94. package/esm/context/useChartApiContext.d.ts +10 -0
  95. package/esm/context/useChartApiContext.js +21 -0
  96. package/esm/hooks/index.d.ts +1 -0
  97. package/esm/hooks/index.js +1 -0
  98. package/esm/index.js +1 -1
  99. package/esm/internals/constants.d.ts +3 -1
  100. package/esm/internals/constants.js +2 -1
  101. package/esm/internals/dateHelpers.d.ts +15 -0
  102. package/esm/internals/dateHelpers.js +20 -0
  103. package/esm/internals/domUtils.d.ts +1 -2
  104. package/esm/internals/domUtils.js +8 -19
  105. package/esm/internals/index.d.ts +4 -1
  106. package/esm/internals/index.js +4 -1
  107. package/esm/internals/material/index.d.ts +2 -0
  108. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  109. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  110. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  111. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  112. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  113. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  114. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
  115. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  116. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  117. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  118. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  119. package/esm/models/index.d.ts +2 -2
  120. package/esm/models/index.js +1 -0
  121. package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
  122. package/hooks/index.d.ts +1 -0
  123. package/hooks/index.js +12 -0
  124. package/index.js +1 -1
  125. package/internals/constants.d.ts +3 -1
  126. package/internals/constants.js +3 -2
  127. package/internals/dateHelpers.d.ts +15 -0
  128. package/internals/dateHelpers.js +28 -0
  129. package/internals/domUtils.d.ts +1 -2
  130. package/internals/domUtils.js +8 -20
  131. package/internals/index.d.ts +4 -1
  132. package/internals/index.js +44 -8
  133. package/internals/material/index.d.ts +2 -0
  134. package/internals/plugins/allPlugins.d.ts +1 -0
  135. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  136. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  137. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
  138. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  139. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  140. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
  141. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
  142. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  143. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  144. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  145. package/models/index.d.ts +2 -2
  146. package/models/index.js +11 -0
  147. package/models/slots/chartsBaseSlotProps.d.ts +1 -0
  148. package/package.json +2 -2
@@ -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 };
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useThemeProps } from '@mui/material/styles';
7
+ import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
7
8
  import { ChartsLegend } from "../ChartsLegend/index.js";
8
9
  import { ChartsOverlay } from "../ChartsOverlay/ChartsOverlay.js";
9
10
  import { useRadarChartProps } from "./useRadarChartProps.js";
@@ -16,6 +17,15 @@ import { RadarAxisHighlight } from "./RadarAxisHighlight/index.js";
16
17
  import { RadarMetricLabels } from "./RadarMetricLabels/index.js";
17
18
  import { ChartsTooltip } from "../ChartsTooltip/index.js";
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ /**
21
+ * Demos:
22
+ *
23
+ * - [Radar Chart](https://mui.com/x/react-charts/radar/)
24
+ *
25
+ * API:
26
+ *
27
+ * - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
28
+ */
19
29
  const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, ref) {
20
30
  const props = useThemeProps({
21
31
  props: inProps,
@@ -32,9 +42,10 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
32
42
  children
33
43
  } = useRadarChartProps(props);
34
44
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
45
+ const Toolbar = props.slots?.toolbar ?? ChartsToolbar;
35
46
  return /*#__PURE__*/_jsx(RadarDataProvider, _extends({}, radarDataProviderProps, {
36
47
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
37
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
48
+ children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
38
49
  ref: ref,
39
50
  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
51
  })), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
@@ -50,7 +61,6 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
50
61
  apiRef: PropTypes.shape({
51
62
  current: PropTypes.object
52
63
  }),
53
- children: PropTypes.node,
54
64
  className: PropTypes.string,
55
65
  /**
56
66
  * Color palette used to colorize multiple series.
@@ -146,6 +156,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
146
156
  * @default 'sharp'
147
157
  */
148
158
  shape: PropTypes.oneOf(['circular', 'sharp']),
159
+ /**
160
+ * If true, shows the default chart toolbar.
161
+ * @default false
162
+ */
163
+ showToolbar: PropTypes.bool,
149
164
  /**
150
165
  * If `true`, animations are skipped.
151
166
  * 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 {}
@@ -16,6 +16,7 @@ import { useChartContainerProps } from "../ChartContainer/useChartContainerProps
16
16
  import { ChartDataProvider } from "../ChartDataProvider/index.js";
17
17
  import { ChartsSurface } from "../ChartsSurface/index.js";
18
18
  import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
19
+ import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
19
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
21
  /**
21
22
  * Demos:
@@ -48,9 +49,10 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
48
49
  chartsSurfaceProps
49
50
  } = useChartContainerProps(chartContainerProps, ref);
50
51
  const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
52
+ const Toolbar = props.slots?.toolbar ?? ChartsToolbar;
51
53
  return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
52
54
  children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
53
- children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
55
+ children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
54
56
  children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
55
57
  "data-drawing-container": true,
56
58
  children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
@@ -175,6 +177,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
175
177
  * An array of [[ScatterSeriesType]] objects.
176
178
  */
177
179
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
180
+ /**
181
+ * If true, shows the default chart toolbar.
182
+ * @default false
183
+ */
184
+ showToolbar: PropTypes.bool,
178
185
  /**
179
186
  * If `true`, animations are skipped.
180
187
  * 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,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,5 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["className"];
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 { chartsToolbarClasses } from "./chartToolbarClasses.js";
3
9
  import { jsx as _jsx } from "react/jsx-runtime";
4
10
  const ToolbarRoot = styled('div', {
5
11
  name: 'MuiChartsToolbar',
@@ -18,10 +24,19 @@ const ToolbarRoot = styled('div', {
18
24
  border: `1px solid ${(theme.vars || theme).palette.divider}`,
19
25
  borderRadius: 4
20
26
  }));
21
- export function Toolbar({
22
- children
23
- }) {
24
- return /*#__PURE__*/_jsx(ToolbarRoot, {
25
- children: children
26
- });
27
- }
27
+ export function Toolbar(_ref) {
28
+ let {
29
+ className
30
+ } = _ref,
31
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
32
+ return /*#__PURE__*/_jsx(ToolbarRoot, _extends({
33
+ className: clsx(chartsToolbarClasses.root, className)
34
+ }, other));
35
+ }
36
+ process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
37
+ // ----------------------------- Warning --------------------------------
38
+ // | These PropTypes are generated from the TypeScript type definitions |
39
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
40
+ // ----------------------------------------------------------------------
41
+ className: PropTypes.string
42
+ } : 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 @@
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 };
@@ -1,13 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["render"];
2
4
  import PropTypes from 'prop-types';
3
5
  import * as React from 'react';
4
- import { defaultSlotsMaterial } from "../internals/material/index.js";
6
+ import { useComponentRenderer } from '@mui/x-internals/useComponentRenderer';
7
+ import { useChartsSlots } from "../context/ChartsSlotsContext.js";
5
8
  import { jsx as _jsx } from "react/jsx-runtime";
6
9
  const ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
7
- const IconButton = defaultSlotsMaterial.baseIconButton;
8
- return /*#__PURE__*/_jsx(IconButton, _extends({
9
- ref: ref
10
- }, props));
10
+ const {
11
+ render
12
+ } = props,
13
+ other = _objectWithoutPropertiesLoose(props, _excluded);
14
+ const {
15
+ slots,
16
+ slotProps
17
+ } = useChartsSlots();
18
+ const element = useComponentRenderer(slots.baseIconButton, render, _extends({}, slotProps?.baseIconButton, other, {
19
+ ref
20
+ }));
21
+ return /*#__PURE__*/_jsx(React.Fragment, {
22
+ children: element
23
+ });
11
24
  });
12
25
  if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
13
26
  process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
@@ -16,6 +29,11 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
16
29
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
17
30
  // ----------------------------------------------------------------------
18
31
  className: PropTypes.string,
32
+ disabled: PropTypes.bool,
33
+ /**
34
+ * A function to customize the rendering of the component.
35
+ */
36
+ render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
19
37
  style: PropTypes.object
20
38
  } : void 0;
21
39
  export { ToolbarButton };
@@ -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,2 @@
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
+ export const chartsToolbarClasses = generateUtilityClasses('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";
@@ -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";
@@ -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,8 @@
1
+ /**
2
+ * The chart toolbar component.
3
+ *
4
+ * In the community package, this component is empty and does not render anything.
5
+ */
6
+ export function ChartsToolbar() {
7
+ return null;
8
+ }