@mui/x-charts 8.3.1 → 8.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/BarChart/BarChart.d.ts +9 -2
  2. package/BarChart/BarChart.js +11 -3
  3. package/BarChart/useBarChartProps.js +1 -1
  4. package/CHANGELOG.md +213 -0
  5. package/ChartContainer/ChartContainer.d.ts +21 -2
  6. package/ChartContainer/ChartContainer.js +17 -1
  7. package/ChartContainer/useChartContainerProps.js +7 -3
  8. package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  9. package/ChartDataProvider/ChartDataProvider.js +19 -2
  10. package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  11. package/ChartDataProvider/useChartDataProviderProps.js +7 -3
  12. package/ChartsAxis/axisClasses.d.ts +5 -0
  13. package/ChartsAxis/axisClasses.js +1 -1
  14. package/ChartsLegend/ChartsLegend.js +1 -0
  15. package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  16. package/ChartsSurface/ChartsSurface.js +1 -0
  17. package/ChartsXAxis/ChartsXAxis.js +7 -16
  18. package/ChartsYAxis/ChartsYAxis.js +4 -8
  19. package/Gauge/Gauge.js +1 -0
  20. package/Gauge/GaugeContainer.js +1 -0
  21. package/Gauge/GaugeProvider.js +1 -3
  22. package/LineChart/AnimatedLine.js +1 -0
  23. package/LineChart/LineChart.d.ts +9 -2
  24. package/LineChart/LineChart.js +11 -3
  25. package/LineChart/LineHighlightPlot.js +1 -4
  26. package/LineChart/MarkPlot.js +1 -4
  27. package/LineChart/useLineChartProps.js +1 -1
  28. package/PieChart/PieArc.js +1 -0
  29. package/PieChart/PieArcLabel.js +1 -0
  30. package/PieChart/PieChart.d.ts +10 -3
  31. package/PieChart/PieChart.js +18 -9
  32. package/RadarChart/RadarChart.d.ts +21 -3
  33. package/RadarChart/RadarChart.js +20 -4
  34. package/RadarChart/RadarChart.plugins.d.ts +5 -0
  35. package/RadarChart/RadarChart.plugins.js +10 -0
  36. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  37. package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
  38. package/RadarChart/index.d.ts +2 -0
  39. package/RadarChart/index.js +15 -1
  40. package/RadarChart/useRadarChartProps.d.ts +2 -1
  41. package/RadarChart/useRadarChartProps.js +3 -1
  42. package/ScatterChart/Scatter.js +3 -11
  43. package/ScatterChart/ScatterChart.d.ts +9 -2
  44. package/ScatterChart/ScatterChart.js +13 -5
  45. package/ScatterChart/useScatterChartProps.js +4 -2
  46. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  47. package/SparkLineChart/SparkLineChart.js +31 -26
  48. package/Toolbar/Toolbar.d.ts +9 -3
  49. package/Toolbar/Toolbar.js +23 -7
  50. package/Toolbar/Toolbar.types.d.ts +15 -0
  51. package/Toolbar/Toolbar.types.js +5 -0
  52. package/Toolbar/ToolbarButton.d.ts +8 -2
  53. package/Toolbar/ToolbarButton.js +25 -6
  54. package/Toolbar/chartToolbarClasses.d.ts +6 -0
  55. package/Toolbar/chartToolbarClasses.js +9 -0
  56. package/Toolbar/index.d.ts +3 -1
  57. package/Toolbar/index.js +22 -0
  58. package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  59. package/Toolbar/internals/ChartsToolbar.js +14 -0
  60. package/context/ChartProvider/ChartContext.js +1 -3
  61. package/context/ChartsSlotsContext.d.ts +20 -0
  62. package/context/ChartsSlotsContext.js +44 -0
  63. package/context/index.d.ts +2 -1
  64. package/context/index.js +11 -0
  65. package/context/useChartApiContext.d.ts +10 -0
  66. package/context/useChartApiContext.js +27 -0
  67. package/esm/BarChart/BarChart.d.ts +9 -2
  68. package/esm/BarChart/BarChart.js +11 -3
  69. package/esm/BarChart/useBarChartProps.js +1 -1
  70. package/esm/ChartContainer/ChartContainer.d.ts +21 -2
  71. package/esm/ChartContainer/ChartContainer.js +17 -1
  72. package/esm/ChartContainer/useChartContainerProps.js +7 -3
  73. package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
  74. package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
  75. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
  76. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
  77. package/esm/ChartsAxis/axisClasses.d.ts +5 -0
  78. package/esm/ChartsAxis/axisClasses.js +1 -1
  79. package/esm/ChartsLegend/ChartsLegend.js +1 -0
  80. package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
  81. package/esm/ChartsSurface/ChartsSurface.js +1 -0
  82. package/esm/ChartsXAxis/ChartsXAxis.js +7 -16
  83. package/esm/ChartsYAxis/ChartsYAxis.js +4 -8
  84. package/esm/Gauge/Gauge.js +1 -0
  85. package/esm/Gauge/GaugeContainer.js +1 -0
  86. package/esm/Gauge/GaugeProvider.js +1 -3
  87. package/esm/LineChart/AnimatedLine.js +1 -0
  88. package/esm/LineChart/LineChart.d.ts +9 -2
  89. package/esm/LineChart/LineChart.js +11 -3
  90. package/esm/LineChart/LineHighlightPlot.js +1 -4
  91. package/esm/LineChart/MarkPlot.js +1 -4
  92. package/esm/LineChart/useLineChartProps.js +1 -1
  93. package/esm/PieChart/PieArc.js +1 -0
  94. package/esm/PieChart/PieArcLabel.js +1 -0
  95. package/esm/PieChart/PieChart.d.ts +10 -3
  96. package/esm/PieChart/PieChart.js +16 -7
  97. package/esm/RadarChart/RadarChart.d.ts +21 -3
  98. package/esm/RadarChart/RadarChart.js +20 -4
  99. package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
  100. package/esm/RadarChart/RadarChart.plugins.js +4 -0
  101. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
  102. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
  103. package/esm/RadarChart/index.d.ts +2 -0
  104. package/esm/RadarChart/index.js +2 -0
  105. package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
  106. package/esm/RadarChart/useRadarChartProps.js +3 -1
  107. package/esm/ScatterChart/Scatter.js +3 -11
  108. package/esm/ScatterChart/ScatterChart.d.ts +9 -2
  109. package/esm/ScatterChart/ScatterChart.js +13 -5
  110. package/esm/ScatterChart/useScatterChartProps.js +4 -2
  111. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  112. package/esm/SparkLineChart/SparkLineChart.js +31 -26
  113. package/esm/Toolbar/Toolbar.d.ts +9 -3
  114. package/esm/Toolbar/Toolbar.js +22 -7
  115. package/esm/Toolbar/Toolbar.types.d.ts +15 -0
  116. package/esm/Toolbar/Toolbar.types.js +1 -0
  117. package/esm/Toolbar/ToolbarButton.d.ts +8 -2
  118. package/esm/Toolbar/ToolbarButton.js +24 -5
  119. package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
  120. package/esm/Toolbar/chartToolbarClasses.js +2 -0
  121. package/esm/Toolbar/index.d.ts +3 -1
  122. package/esm/Toolbar/index.js +3 -1
  123. package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
  124. package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
  125. package/esm/context/ChartProvider/ChartContext.js +1 -3
  126. package/esm/context/ChartsSlotsContext.d.ts +20 -0
  127. package/esm/context/ChartsSlotsContext.js +35 -0
  128. package/esm/context/index.d.ts +2 -1
  129. package/esm/context/index.js +1 -0
  130. package/esm/context/useChartApiContext.d.ts +10 -0
  131. package/esm/context/useChartApiContext.js +21 -0
  132. package/esm/hooks/index.d.ts +1 -0
  133. package/esm/hooks/index.js +1 -0
  134. package/esm/hooks/useTicks.js +2 -6
  135. package/esm/index.js +1 -1
  136. package/esm/internals/constants.d.ts +3 -1
  137. package/esm/internals/constants.js +2 -1
  138. package/esm/internals/consumeSlots.js +2 -1
  139. package/esm/internals/consumeThemeProps.js +3 -1
  140. package/esm/internals/dateHelpers.d.ts +15 -0
  141. package/esm/internals/dateHelpers.js +20 -0
  142. package/esm/internals/domUtils.d.ts +1 -2
  143. package/esm/internals/domUtils.js +8 -19
  144. package/esm/internals/index.d.ts +4 -1
  145. package/esm/internals/index.js +4 -1
  146. package/esm/internals/material/index.d.ts +2 -0
  147. package/esm/internals/plugins/allPlugins.d.ts +1 -0
  148. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  149. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  150. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
  151. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
  152. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  153. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
  154. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  155. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  156. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  157. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  158. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
  159. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
  160. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  161. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  162. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
  163. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  164. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  165. package/esm/models/index.d.ts +2 -2
  166. package/esm/models/index.js +1 -0
  167. package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
  168. package/hooks/index.d.ts +1 -0
  169. package/hooks/index.js +12 -0
  170. package/hooks/useTicks.js +2 -6
  171. package/index.js +1 -1
  172. package/internals/constants.d.ts +3 -1
  173. package/internals/constants.js +3 -2
  174. package/internals/consumeSlots.js +2 -1
  175. package/internals/consumeThemeProps.js +3 -1
  176. package/internals/dateHelpers.d.ts +15 -0
  177. package/internals/dateHelpers.js +28 -0
  178. package/internals/domUtils.d.ts +1 -2
  179. package/internals/domUtils.js +8 -20
  180. package/internals/index.d.ts +4 -1
  181. package/internals/index.js +44 -8
  182. package/internals/material/index.d.ts +2 -0
  183. package/internals/plugins/allPlugins.d.ts +1 -0
  184. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
  185. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
  186. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
  187. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
  188. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
  189. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +6 -3
  190. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
  191. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  192. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
  193. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
  194. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
  195. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
  196. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
  197. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
  198. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
  199. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
  200. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
  201. package/models/index.d.ts +2 -2
  202. package/models/index.js +11 -0
  203. package/models/slots/chartsBaseSlotProps.d.ts +1 -0
  204. package/package.json +3 -3
@@ -35,10 +35,11 @@ const _excluded = ["scale", "tickNumber"];
35
35
  const useUtilityClasses = ownerState => {
36
36
  const {
37
37
  classes,
38
- position
38
+ position,
39
+ id
39
40
  } = ownerState;
40
41
  const slots = {
41
- root: ['root', 'directionY', position],
42
+ root: ['root', 'directionY', position, `id-${id}`],
42
43
  line: ['line'],
43
44
  tickContainer: ['tickContainer'],
44
45
  tick: ['tick'],
@@ -243,12 +244,7 @@ function ChartsYAxis(inProps) {
243
244
  const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
244
245
  const yTickLabel = labelOffset;
245
246
  const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
246
- const showLabel = instance.isPointInside({
247
- x: -1,
248
- y: tickOffset
249
- }, {
250
- direction: 'y'
251
- });
247
+ const showLabel = instance.isYInside(tickOffset);
252
248
  const tickLabel = tickLabels.get(item);
253
249
  if (!showLabel) {
254
250
  return null;
package/Gauge/Gauge.js CHANGED
@@ -55,6 +55,7 @@ const Gauge = exports.Gauge = /*#__PURE__*/React.forwardRef(function Gauge(props
55
55
  }), children]
56
56
  }));
57
57
  });
58
+ if (process.env.NODE_ENV !== "production") Gauge.displayName = "Gauge";
58
59
  process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
59
60
  // ----------------------------- Warning --------------------------------
60
61
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -85,6 +85,7 @@ const GaugeContainer = exports.GaugeContainer = /*#__PURE__*/React.forwardRef(fu
85
85
  })
86
86
  });
87
87
  });
88
+ if (process.env.NODE_ENV !== "production") GaugeContainer.displayName = "GaugeContainer";
88
89
  process.env.NODE_ENV !== "production" ? GaugeContainer.propTypes = {
89
90
  // ----------------------------- Warning --------------------------------
90
91
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -29,9 +29,7 @@ const GaugeContext = exports.GaugeContext = /*#__PURE__*/React.createContext({
29
29
  maxRadius: 0,
30
30
  valueAngle: null
31
31
  });
32
- if (process.env.NODE_ENV !== 'production') {
33
- GaugeContext.displayName = 'GaugeContext';
34
- }
32
+ if (process.env.NODE_ENV !== "production") GaugeContext.displayName = "GaugeContext";
35
33
  function GaugeProvider(props) {
36
34
  const {
37
35
  value = null,
@@ -47,6 +47,7 @@ const AnimatedLine = exports.AnimatedLine = /*#__PURE__*/React.forwardRef(functi
47
47
  }, other, animateProps))
48
48
  });
49
49
  });
50
+ if (process.env.NODE_ENV !== "production") AnimatedLine.displayName = "AnimatedLine";
50
51
  process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
51
52
  // ----------------------------- Warning --------------------------------
52
53
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { MakeOptional } from '@mui/x-internals/types';
3
+ import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
3
4
  import { AreaPlotProps, AreaPlotSlotProps, AreaPlotSlots } from "./AreaPlot.js";
4
5
  import { LinePlotProps, LinePlotSlotProps, LinePlotSlots } from "./LinePlot.js";
5
6
  import { ChartContainerProps } from "../ChartContainer/index.js";
@@ -14,8 +15,9 @@ import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighli
14
15
  import { ChartsGridProps } from "../ChartsGrid/index.js";
15
16
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
16
17
  import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
17
- export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
18
- export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
18
+ import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
19
+ export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
20
+ export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
19
21
  export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
20
22
  /**
21
23
  * The series to display in the line chart.
@@ -67,6 +69,11 @@ export interface LineChartProps extends Omit<ChartContainerProps<'line', LineCha
67
69
  * @default false
68
70
  */
69
71
  skipAnimation?: boolean;
72
+ /**
73
+ * If true, shows the default chart toolbar.
74
+ * @default false
75
+ */
76
+ showToolbar?: boolean;
70
77
  }
71
78
  /**
72
79
  * Demos:
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _styles = require("@mui/material/styles");
14
+ var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
14
15
  var _AreaPlot = require("./AreaPlot");
15
16
  var _LinePlot = require("./LinePlot");
16
17
  var _MarkPlot = require("./MarkPlot");
@@ -64,19 +65,21 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
64
65
  chartsSurfaceProps
65
66
  } = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
66
67
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
68
+ const Toolbar = props.slots?.toolbar ?? _ChartsToolbar.ChartsToolbar;
67
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
68
70
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
69
- children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
71
+ children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
70
72
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
71
73
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
72
74
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
73
75
  "data-drawing-container": true,
74
76
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
75
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
76
- }))]
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
78
+ })), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
77
79
  }))
78
80
  }));
79
81
  });
82
+ if (process.env.NODE_ENV !== "production") LineChart.displayName = "LineChart";
80
83
  process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
81
84
  // ----------------------------- Warning --------------------------------
82
85
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -195,6 +198,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
195
198
  * An array of [[LineSeriesType]] objects.
196
199
  */
197
200
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
201
+ /**
202
+ * If true, shows the default chart toolbar.
203
+ * @default false
204
+ */
205
+ showToolbar: _propTypes.default.bool,
198
206
  /**
199
207
  * If `true`, animations are skipped.
200
208
  * @default false
@@ -91,10 +91,7 @@ function LineHighlightPlot(props) {
91
91
  const x = xScale(xData[highlightedIndex]);
92
92
  const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
93
93
 
94
- if (!instance.isPointInside({
95
- x,
96
- y
97
- })) {
94
+ if (!instance.isPointInside(x, y)) {
98
95
  return null;
99
96
  }
100
97
  const colorGetter = (0, _getColor.default)(series[seriesId], xAxis[xAxisId], yAxis[yAxisId]);
@@ -129,10 +129,7 @@ function MarkPlot(props) {
129
129
  // Remove missing data point
130
130
  return false;
131
131
  }
132
- if (!instance.isPointInside({
133
- x,
134
- y
135
- })) {
132
+ if (!instance.isPointInside(x, y)) {
136
133
  // Remove out of range
137
134
  return false;
138
135
  }
@@ -13,7 +13,7 @@ var React = _interopRequireWildcard(require("react"));
13
13
  var _useId = _interopRequireDefault(require("@mui/utils/useId"));
14
14
  var _constants = require("../constants");
15
15
  var _LineChart = require("./LineChart.plugins");
16
- const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
16
+ const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
17
17
  /**
18
18
  * A helper function that extracts LineChartProps from the input props
19
19
  * and returns an object with props for the children components of LineChart.
@@ -106,6 +106,7 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
106
106
  strokeLinejoin: "round"
107
107
  }, other, interactionProps, animatedProps));
108
108
  });
109
+ if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
109
110
  process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
110
111
  // ----------------------------- Warning --------------------------------
111
112
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -101,6 +101,7 @@ const PieArcLabel = exports.PieArcLabel = /*#__PURE__*/React.forwardRef(function
101
101
  children: formattedArcLabel
102
102
  }));
103
103
  });
104
+ if (process.env.NODE_ENV !== "production") PieArcLabel.displayName = "PieArcLabel";
104
105
  process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
105
106
  // ----------------------------- Warning --------------------------------
106
107
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -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 { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
3
5
  import { ChartContainerProps } from "../ChartContainer/index.js";
4
6
  import { PieSeriesType } from "../models/seriesType/index.js";
5
7
  import { ChartsTooltipSlots, ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
@@ -8,9 +10,9 @@ import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from "./PiePlot.js";
8
10
  import { PieValueType } from "../models/seriesType/pie.js";
9
11
  import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
10
12
  import { PieChartPluginSignatures } from "./PieChart.plugins.js";
11
- export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
12
- export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
13
- export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
13
+ export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
14
+ export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
15
+ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
14
16
  /**
15
17
  * The series to display in the pie chart.
16
18
  * An array of [[PieSeriesType]] objects.
@@ -24,6 +26,11 @@ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartP
24
26
  * Callback fired when a pie arc is clicked.
25
27
  */
26
28
  onItemClick?: PiePlotProps['onItemClick'];
29
+ /**
30
+ * If true, shows the default chart toolbar.
31
+ * @default false
32
+ */
33
+ showToolbar?: boolean;
27
34
  /**
28
35
  * Overridable component slots.
29
36
  * @default {}
@@ -12,6 +12,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _styles = require("@mui/material/styles");
15
+ var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
15
16
  var _ChartsTooltip = require("../ChartsTooltip");
16
17
  var _ChartsLegend = require("../ChartsLegend");
17
18
  var _PiePlot = require("./PiePlot");
@@ -20,10 +21,10 @@ var _ChartsSurface = require("../ChartsSurface");
20
21
  var _ChartDataProvider = require("../ChartDataProvider");
21
22
  var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
22
23
  var _ChartsWrapper = require("../internals/components/ChartsWrapper");
23
- var _PieChart = require("./PieChart.plugins");
24
+ var _PieChart2 = require("./PieChart.plugins");
24
25
  var _defaultizeMargin = require("../internals/defaultizeMargin");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
- const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
27
+ const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
27
28
  const defaultMargin = {
28
29
  top: 5,
29
30
  bottom: 5,
@@ -62,7 +63,8 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
62
63
  loading,
63
64
  highlightedItem,
64
65
  onHighlightChange,
65
- className
66
+ className,
67
+ showToolbar
66
68
  } = props,
67
69
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
68
70
  const margin = (0, _defaultizeMargin.defaultizeMargin)(marginProps, defaultMargin);
@@ -81,15 +83,16 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
81
83
  onHighlightChange,
82
84
  className,
83
85
  skipAnimation,
84
- plugins: _PieChart.PIE_CHART_PLUGINS
86
+ plugins: _PieChart2.PIE_CHART_PLUGINS
85
87
  }), ref);
86
88
  const Tooltip = slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
89
+ const Toolbar = props.slots?.toolbar ?? _ChartsToolbar.ChartsToolbar;
87
90
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
88
91
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, {
89
92
  legendPosition: props.slotProps?.legend?.position,
90
93
  legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
91
94
  sx: sx,
92
- children: [!hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
95
+ children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, {
93
96
  direction: props?.slotProps?.legend?.direction ?? 'vertical',
94
97
  slots: slots,
95
98
  slotProps: slotProps
@@ -102,13 +105,14 @@ const PieChart = exports.PieChart = /*#__PURE__*/React.forwardRef(function PieCh
102
105
  loading: loading,
103
106
  slots: slots,
104
107
  slotProps: slotProps
105
- }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
106
- trigger: "item"
107
- }, slotProps?.tooltip)), children]
108
- }))]
108
+ }), children]
109
+ })), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
110
+ trigger: "item"
111
+ }, slotProps?.tooltip))]
109
112
  })
110
113
  }));
111
114
  });
115
+ if (process.env.NODE_ENV !== "production") PieChart.displayName = "PieChart";
112
116
  process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
113
117
  // ----------------------------- Warning --------------------------------
114
118
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -186,6 +190,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
186
190
  * An array of [[PieSeriesType]] objects.
187
191
  */
188
192
  series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
193
+ /**
194
+ * If true, shows the default chart toolbar.
195
+ * @default false
196
+ */
197
+ showToolbar: _propTypes.default.bool,
189
198
  /**
190
199
  * If `true`, animations are skipped.
191
200
  * 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 };
@@ -11,6 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _styles = require("@mui/material/styles");
14
+ var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
14
15
  var _ChartsLegend = require("../ChartsLegend");
15
16
  var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
16
17
  var _useRadarChartProps = require("./useRadarChartProps");
@@ -23,6 +24,15 @@ var _RadarAxisHighlight = require("./RadarAxisHighlight");
23
24
  var _RadarMetricLabels = require("./RadarMetricLabels");
24
25
  var _ChartsTooltip = require("../ChartsTooltip");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
27
+ /**
28
+ * Demos:
29
+ *
30
+ * - [Radar Chart](https://mui.com/x/react-charts/radar/)
31
+ *
32
+ * API:
33
+ *
34
+ * - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
35
+ */
26
36
  const RadarChart = exports.RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, ref) {
27
37
  const props = (0, _styles.useThemeProps)({
28
38
  props: inProps,
@@ -39,15 +49,17 @@ const RadarChart = exports.RadarChart = /*#__PURE__*/React.forwardRef(function R
39
49
  children
40
50
  } = (0, _useRadarChartProps.useRadarChartProps)(props);
41
51
  const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
52
+ const Toolbar = props.slots?.toolbar ?? _ChartsToolbar.ChartsToolbar;
42
53
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarDataProvider.RadarDataProvider, (0, _extends2.default)({}, radarDataProviderProps, {
43
54
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
44
- children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
55
+ children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
45
56
  ref: ref,
46
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarGrid.RadarGrid, (0, _extends2.default)({}, radarGrid)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarMetricLabels.RadarMetricLabels, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarAxisHighlight.RadarAxisHighlight, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesMarks, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), children]
47
- }))]
57
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarGrid.RadarGrid, (0, _extends2.default)({}, radarGrid)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarMetricLabels.RadarMetricLabels, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarAxisHighlight.RadarAxisHighlight, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadarSeriesPlot.RadarSeriesMarks, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), children]
58
+ })), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
48
59
  }))
49
60
  }));
50
61
  });
62
+ if (process.env.NODE_ENV !== "production") RadarChart.displayName = "RadarChart";
51
63
  process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
52
64
  // ----------------------------- Warning --------------------------------
53
65
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -56,7 +68,6 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
56
68
  apiRef: _propTypes.default.shape({
57
69
  current: _propTypes.default.object
58
70
  }),
59
- children: _propTypes.default.node,
60
71
  className: _propTypes.default.string,
61
72
  /**
62
73
  * Color palette used to colorize multiple series.
@@ -152,6 +163,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
152
163
  * @default 'sharp'
153
164
  */
154
165
  shape: _propTypes.default.oneOf(['circular', 'sharp']),
166
+ /**
167
+ * If true, shows the default chart toolbar.
168
+ * @default false
169
+ */
170
+ showToolbar: _propTypes.default.bool,
155
171
  /**
156
172
  * If `true`, animations are skipped.
157
173
  * 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,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RADAR_PLUGINS = void 0;
7
+ var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
8
+ var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
9
+ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
10
+ const RADAR_PLUGINS = exports.RADAR_PLUGINS = [_useChartPolarAxis.useChartPolarAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.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 };
@@ -10,19 +10,15 @@ exports.RadarDataProvider = RadarDataProvider;
10
10
  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
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _RadarChart = require("../RadarChart.plugins");
14
14
  var _ChartDataProvider = require("../../ChartDataProvider");
15
15
  var _defaultizeMargin = require("../../internals/defaultizeMargin");
16
- var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
17
- var _useChartHighlight = require("../../internals/plugins/featurePlugins/useChartHighlight");
18
- var _useChartInteraction = require("../../internals/plugins/featurePlugins/useChartInteraction");
19
16
  var _seriesConfig = require("../seriesConfig");
20
17
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["series", "children", "width", "height", "colors", "highlightedItem", "onHighlightChange", "className", "skipAnimation", "margin", "radar", "highlight"];
18
+ const _excluded = ["series", "children", "width", "height", "colors", "skipAnimation", "margin", "radar", "highlight", "plugins"];
22
19
  const RADAR_SERIES_CONFIG = {
23
20
  radar: _seriesConfig.radarSeriesConfig
24
21
  };
25
- const RADAR_PLUGINS = [_useChartPolarAxis.useChartPolarAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight];
26
22
  const DEFAULT_RADAR_MARGIN = {
27
23
  top: 30,
28
24
  bottom: 30,
@@ -36,12 +32,11 @@ function RadarDataProvider(props) {
36
32
  width,
37
33
  height,
38
34
  colors,
39
- highlightedItem,
40
- onHighlightChange,
41
35
  skipAnimation,
42
36
  margin,
43
37
  radar,
44
- highlight
38
+ highlight,
39
+ plugins
45
40
  } = props,
46
41
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
47
42
  const rotationAxes = React.useMemo(() => [{
@@ -87,116 +82,11 @@ function RadarDataProvider(props) {
87
82
  height: height,
88
83
  margin: defaultizedMargin,
89
84
  colors: colors,
90
- highlightedItem: highlightedItem,
91
- onHighlightChange: onHighlightChange,
92
85
  skipAnimation: skipAnimation,
93
- plugins: RADAR_PLUGINS,
86
+ plugins: plugins ?? _RadarChart.RADAR_PLUGINS,
94
87
  rotationAxis: rotationAxes,
95
88
  radiusAxis: radiusAxis,
96
89
  seriesConfig: RADAR_SERIES_CONFIG,
97
90
  children: children
98
91
  }));
99
- }
100
- process.env.NODE_ENV !== "production" ? RadarDataProvider.propTypes = {
101
- // ----------------------------- Warning --------------------------------
102
- // | These PropTypes are generated from the TypeScript type definitions |
103
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
104
- // ----------------------------------------------------------------------
105
- apiRef: _propTypes.default.shape({
106
- current: _propTypes.default.object
107
- }),
108
- children: _propTypes.default.node,
109
- className: _propTypes.default.string,
110
- /**
111
- * Color palette used to colorize multiple series.
112
- * @default rainbowSurgePalette
113
- */
114
- colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
115
- desc: _propTypes.default.string,
116
- /**
117
- * If `true`, the charts will not listen to the mouse move event.
118
- * It might break interactive features, but will improve performance.
119
- * @default false
120
- */
121
- disableAxisListener: _propTypes.default.bool,
122
- /**
123
- * The height of the chart in px. If not defined, it takes the height of the parent element.
124
- */
125
- height: _propTypes.default.number,
126
- /**
127
- * Indicates if the chart should highlight items per axis or per series.
128
- * @default 'axis'
129
- */
130
- highlight: _propTypes.default.oneOf(['axis', 'none', 'series']),
131
- /**
132
- * The highlighted item.
133
- * Used when the highlight is controlled.
134
- */
135
- highlightedItem: _propTypes.default.shape({
136
- dataIndex: _propTypes.default.number,
137
- seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired
138
- }),
139
- /**
140
- * This prop is used to help implement the accessibility logic.
141
- * If you don't provide this prop. It falls back to a randomly generated id.
142
- */
143
- id: _propTypes.default.string,
144
- /**
145
- * Localized text for chart components.
146
- */
147
- localeText: _propTypes.default.object,
148
- /**
149
- * The margin between the SVG and the drawing area.
150
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
151
- *
152
- * Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
153
- */
154
- margin: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
155
- bottom: _propTypes.default.number,
156
- left: _propTypes.default.number,
157
- right: _propTypes.default.number,
158
- top: _propTypes.default.number
159
- })]),
160
- /**
161
- * The callback fired when the highlighted item changes.
162
- *
163
- * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
164
- */
165
- onHighlightChange: _propTypes.default.func,
166
- /**
167
- * The configuration of the radar scales.
168
- */
169
- radar: _propTypes.default.shape({
170
- labelFormatter: _propTypes.default.func,
171
- labelGap: _propTypes.default.number,
172
- max: _propTypes.default.number,
173
- metrics: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.arrayOf(_propTypes.default.shape({
174
- max: _propTypes.default.number,
175
- min: _propTypes.default.number,
176
- name: _propTypes.default.string.isRequired
177
- }))]).isRequired,
178
- startAngle: _propTypes.default.number
179
- }).isRequired,
180
- /**
181
- * The series to display in the bar chart.
182
- * An array of [[RadarSeriesType]] objects.
183
- */
184
- series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
185
- /**
186
- * The configuration helpers used to compute attributes according to the series type.
187
- * @ignore Unstable props for internal usage.
188
- */
189
- seriesConfig: _propTypes.default.object,
190
- /**
191
- * If `true`, animations are skipped.
192
- * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
193
- */
194
- skipAnimation: _propTypes.default.bool,
195
- sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
196
- theme: _propTypes.default.oneOf(['dark', 'light']),
197
- title: _propTypes.default.string,
198
- /**
199
- * The width of the chart in px. If not defined, it takes the width of the parent element.
200
- */
201
- width: _propTypes.default.number
202
- } : void 0;
92
+ }