@mui/x-charts 6.0.0-alpha.5 → 6.0.0-alpha.7

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 (163) hide show
  1. package/BarChart/BarChart.d.ts +18 -2
  2. package/BarChart/BarChart.js +74 -17
  3. package/BarChart/BarElement.d.ts +22 -0
  4. package/BarChart/BarElement.js +21 -10
  5. package/BarChart/BarPlot.d.ts +14 -1
  6. package/BarChart/BarPlot.js +23 -4
  7. package/BarChart/formatter.js +23 -12
  8. package/CHANGELOG.md +154 -0
  9. package/ChartContainer/index.js +3 -0
  10. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  11. package/ChartsAxis/ChartsAxis.js +51 -6
  12. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  13. package/ChartsLegend/ChartsLegend.js +49 -17
  14. package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  15. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  16. package/ChartsXAxis/ChartsXAxis.js +44 -9
  17. package/ChartsYAxis/ChartsYAxis.js +44 -9
  18. package/LineChart/AreaElement.d.ts +22 -0
  19. package/LineChart/AreaElement.js +31 -11
  20. package/LineChart/AreaPlot.d.ts +14 -1
  21. package/LineChart/AreaPlot.js +32 -5
  22. package/LineChart/LineChart.d.ts +20 -2
  23. package/LineChart/LineChart.js +76 -16
  24. package/LineChart/LineElement.d.ts +22 -0
  25. package/LineChart/LineElement.js +31 -10
  26. package/LineChart/LinePlot.d.ts +14 -1
  27. package/LineChart/LinePlot.js +38 -6
  28. package/LineChart/MarkElement.js +1 -1
  29. package/LineChart/MarkPlot.d.ts +24 -1
  30. package/LineChart/MarkPlot.js +30 -6
  31. package/LineChart/formatter.js +23 -12
  32. package/PieChart/PieArcLabel.js +0 -1
  33. package/PieChart/PieChart.d.ts +14 -2
  34. package/PieChart/PieChart.js +60 -13
  35. package/PieChart/PiePlot.d.ts +27 -1
  36. package/PieChart/PiePlot.js +29 -6
  37. package/ScatterChart/ScatterChart.d.ts +18 -2
  38. package/ScatterChart/ScatterChart.js +64 -13
  39. package/ScatterChart/ScatterPlot.d.ts +24 -1
  40. package/ScatterChart/ScatterPlot.js +28 -4
  41. package/SparkLineChart/SparkLineChart.d.ts +73 -0
  42. package/SparkLineChart/SparkLineChart.js +218 -0
  43. package/SparkLineChart/index.d.ts +1 -0
  44. package/SparkLineChart/index.js +12 -0
  45. package/SparkLineChart/package.json +6 -0
  46. package/colorPalettes/colorPalettes.js +2 -2
  47. package/context/CartesianContextProvider.d.ts +3 -1
  48. package/context/CartesianContextProvider.js +50 -14
  49. package/context/SeriesContextProvider.d.ts +3 -2
  50. package/context/SeriesContextProvider.js +5 -3
  51. package/esm/BarChart/BarChart.js +77 -17
  52. package/esm/BarChart/BarElement.js +21 -11
  53. package/esm/BarChart/BarPlot.js +23 -4
  54. package/esm/BarChart/formatter.js +23 -12
  55. package/esm/ChartContainer/index.js +3 -0
  56. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  57. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  58. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  59. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  60. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  61. package/esm/LineChart/AreaElement.js +31 -11
  62. package/esm/LineChart/AreaPlot.js +33 -5
  63. package/esm/LineChart/LineChart.js +79 -16
  64. package/esm/LineChart/LineElement.js +31 -11
  65. package/esm/LineChart/LinePlot.js +45 -9
  66. package/esm/LineChart/MarkElement.js +1 -1
  67. package/esm/LineChart/MarkPlot.js +31 -6
  68. package/esm/LineChart/formatter.js +23 -13
  69. package/esm/PieChart/PieArcLabel.js +0 -1
  70. package/esm/PieChart/PieChart.js +60 -13
  71. package/esm/PieChart/PiePlot.js +31 -6
  72. package/esm/ScatterChart/ScatterChart.js +64 -13
  73. package/esm/ScatterChart/ScatterPlot.js +29 -4
  74. package/esm/SparkLineChart/SparkLineChart.js +210 -0
  75. package/esm/SparkLineChart/index.js +1 -0
  76. package/esm/colorPalettes/colorPalettes.js +2 -2
  77. package/esm/context/CartesianContextProvider.js +50 -14
  78. package/esm/context/SeriesContextProvider.js +5 -3
  79. package/esm/hooks/useTicks.js +9 -6
  80. package/esm/index.js +1 -0
  81. package/esm/internals/components/AxisSharedComponents.js +10 -10
  82. package/esm/models/index.js +3 -1
  83. package/hooks/useTicks.d.ts +20 -5
  84. package/hooks/useTicks.js +9 -6
  85. package/index.d.ts +1 -0
  86. package/index.js +12 -1
  87. package/internals/components/AxisSharedComponents.d.ts +4 -4
  88. package/internals/components/AxisSharedComponents.js +15 -15
  89. package/internals/defaultizeColor.d.ts +4 -2
  90. package/legacy/BarChart/BarChart.js +75 -17
  91. package/legacy/BarChart/BarElement.js +20 -10
  92. package/legacy/BarChart/BarPlot.js +23 -4
  93. package/legacy/BarChart/formatter.js +23 -10
  94. package/legacy/ChartContainer/index.js +3 -0
  95. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  96. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  97. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  98. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  99. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  100. package/legacy/LineChart/AreaElement.js +30 -10
  101. package/legacy/LineChart/AreaPlot.js +31 -5
  102. package/legacy/LineChart/LineChart.js +77 -16
  103. package/legacy/LineChart/LineElement.js +30 -10
  104. package/legacy/LineChart/LinePlot.js +38 -6
  105. package/legacy/LineChart/MarkElement.js +1 -1
  106. package/legacy/LineChart/MarkPlot.js +29 -6
  107. package/legacy/LineChart/formatter.js +23 -11
  108. package/legacy/PieChart/PieArcLabel.js +0 -1
  109. package/legacy/PieChart/PieChart.js +60 -13
  110. package/legacy/PieChart/PiePlot.js +29 -6
  111. package/legacy/ScatterChart/ScatterChart.js +64 -13
  112. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  113. package/legacy/SparkLineChart/SparkLineChart.js +214 -0
  114. package/legacy/SparkLineChart/index.js +1 -0
  115. package/legacy/colorPalettes/colorPalettes.js +2 -2
  116. package/legacy/context/CartesianContextProvider.js +59 -15
  117. package/legacy/context/SeriesContextProvider.js +6 -4
  118. package/legacy/hooks/useTicks.js +9 -9
  119. package/legacy/index.js +2 -1
  120. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  121. package/legacy/models/index.js +3 -1
  122. package/models/axis.d.ts +34 -3
  123. package/models/index.d.ts +2 -0
  124. package/models/index.js +11 -0
  125. package/models/seriesType/bar.d.ts +8 -1
  126. package/models/seriesType/common.d.ts +2 -2
  127. package/models/seriesType/config.d.ts +4 -1
  128. package/models/seriesType/line.d.ts +8 -1
  129. package/modern/BarChart/BarChart.js +74 -17
  130. package/modern/BarChart/BarElement.js +20 -11
  131. package/modern/BarChart/BarPlot.js +23 -4
  132. package/modern/BarChart/formatter.js +23 -12
  133. package/modern/ChartContainer/index.js +3 -0
  134. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  135. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  136. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  137. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  138. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  139. package/modern/LineChart/AreaElement.js +30 -11
  140. package/modern/LineChart/AreaPlot.js +33 -5
  141. package/modern/LineChart/LineChart.js +76 -16
  142. package/modern/LineChart/LineElement.js +30 -11
  143. package/modern/LineChart/LinePlot.js +39 -6
  144. package/modern/LineChart/MarkElement.js +1 -1
  145. package/modern/LineChart/MarkPlot.js +30 -6
  146. package/modern/LineChart/formatter.js +23 -13
  147. package/modern/PieChart/PieArcLabel.js +0 -1
  148. package/modern/PieChart/PieChart.js +60 -13
  149. package/modern/PieChart/PiePlot.js +30 -6
  150. package/modern/ScatterChart/ScatterChart.js +64 -13
  151. package/modern/ScatterChart/ScatterPlot.js +28 -4
  152. package/modern/SparkLineChart/SparkLineChart.js +210 -0
  153. package/modern/SparkLineChart/index.js +1 -0
  154. package/modern/colorPalettes/colorPalettes.js +2 -2
  155. package/modern/context/CartesianContextProvider.js +50 -14
  156. package/modern/context/SeriesContextProvider.js +5 -3
  157. package/modern/hooks/useTicks.js +9 -6
  158. package/modern/index.js +2 -1
  159. package/modern/internals/components/AxisSharedComponents.js +10 -10
  160. package/modern/models/index.js +3 -1
  161. package/package.json +4 -2
  162. package/themeAugmentation/components.d.ts +0 -10
  163. package/themeAugmentation/overrides.d.ts +0 -2
@@ -15,12 +15,23 @@ const getAxisId = propsValue => {
15
15
  }
16
16
  return propsValue;
17
17
  };
18
+ const mergeProps = (axisConfig, slots, slotProps) => {
19
+ return typeof axisConfig === 'object' ? _extends({}, axisConfig, {
20
+ slots: _extends({}, slots, axisConfig == null ? void 0 : axisConfig.slots),
21
+ slotProps: _extends({}, slotProps, axisConfig == null ? void 0 : axisConfig.slotProps)
22
+ }) : {
23
+ slots,
24
+ slotProps
25
+ };
26
+ };
18
27
  function ChartsAxis(props) {
19
28
  const {
20
29
  topAxis,
21
30
  leftAxis,
22
31
  rightAxis,
23
- bottomAxis
32
+ bottomAxis,
33
+ slots,
34
+ slotProps
24
35
  } = props;
25
36
  const {
26
37
  xAxis,
@@ -48,20 +59,24 @@ function ChartsAxis(props) {
48
59
  if (bottomId !== null && !xAxis[bottomId]) {
49
60
  throw Error(`MUI: id used for bottom axis "${bottomId}" is not defined`);
50
61
  }
62
+ const topAxisProps = mergeProps(topAxis, slots, slotProps);
63
+ const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
64
+ const leftAxisProps = mergeProps(leftAxis, slots, slotProps);
65
+ const rightAxisProps = mergeProps(rightAxis, slots, slotProps);
51
66
  return /*#__PURE__*/_jsxs(React.Fragment, {
52
- children: [topId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({
67
+ children: [topId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({}, topAxisProps, {
53
68
  position: "top",
54
69
  axisId: topId
55
- }, typeof topAxis === 'object' ? topAxis : {})), bottomId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({
70
+ })), bottomId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({}, bottomAxisProps, {
56
71
  position: "bottom",
57
72
  axisId: bottomId
58
- }, typeof bottomAxis === 'object' ? bottomAxis : {})), leftId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({
73
+ })), leftId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({}, leftAxisProps, {
59
74
  position: "left",
60
75
  axisId: leftId
61
- }, typeof leftAxis === 'object' ? leftAxis : {})), rightId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({
76
+ })), rightId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({}, rightAxisProps, {
62
77
  position: "right",
63
78
  axisId: rightId
64
- }, typeof rightAxis === 'object' ? rightAxis : {}))]
79
+ }))]
65
80
  });
66
81
  }
67
82
  process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
@@ -83,8 +98,13 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
83
98
  label: PropTypes.string,
84
99
  labelFontSize: PropTypes.number,
85
100
  position: PropTypes.oneOf(['bottom', 'top']),
101
+ slotProps: PropTypes.object,
102
+ slots: PropTypes.object,
86
103
  stroke: PropTypes.string,
87
104
  tickFontSize: PropTypes.number,
105
+ tickMaxStep: PropTypes.number,
106
+ tickMinStep: PropTypes.number,
107
+ tickNumber: PropTypes.number,
88
108
  tickSize: PropTypes.number
89
109
  }), PropTypes.string]),
90
110
  /**
@@ -101,8 +121,13 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
101
121
  label: PropTypes.string,
102
122
  labelFontSize: PropTypes.number,
103
123
  position: PropTypes.oneOf(['left', 'right']),
124
+ slotProps: PropTypes.object,
125
+ slots: PropTypes.object,
104
126
  stroke: PropTypes.string,
105
127
  tickFontSize: PropTypes.number,
128
+ tickMaxStep: PropTypes.number,
129
+ tickMinStep: PropTypes.number,
130
+ tickNumber: PropTypes.number,
106
131
  tickSize: PropTypes.number
107
132
  }), PropTypes.string]),
108
133
  /**
@@ -119,10 +144,25 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
119
144
  label: PropTypes.string,
120
145
  labelFontSize: PropTypes.number,
121
146
  position: PropTypes.oneOf(['left', 'right']),
147
+ slotProps: PropTypes.object,
148
+ slots: PropTypes.object,
122
149
  stroke: PropTypes.string,
123
150
  tickFontSize: PropTypes.number,
151
+ tickMaxStep: PropTypes.number,
152
+ tickMinStep: PropTypes.number,
153
+ tickNumber: PropTypes.number,
124
154
  tickSize: PropTypes.number
125
155
  }), PropTypes.string]),
156
+ /**
157
+ * The props used for each component slot.
158
+ * @default {}
159
+ */
160
+ slotProps: PropTypes.object,
161
+ /**
162
+ * Overridable component slots.
163
+ * @default {}
164
+ */
165
+ slots: PropTypes.object,
126
166
  /**
127
167
  * Indicate which axis to display the top of the charts.
128
168
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -137,8 +177,13 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
137
177
  label: PropTypes.string,
138
178
  labelFontSize: PropTypes.number,
139
179
  position: PropTypes.oneOf(['bottom', 'top']),
180
+ slotProps: PropTypes.object,
181
+ slots: PropTypes.object,
140
182
  stroke: PropTypes.string,
141
183
  tickFontSize: PropTypes.number,
184
+ tickMaxStep: PropTypes.number,
185
+ tickMinStep: PropTypes.number,
186
+ tickNumber: PropTypes.number,
142
187
  tickSize: PropTypes.number
143
188
  }), PropTypes.string])
144
189
  } : void 0;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { useSlotProps } from '@mui/base/utils';
3
4
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
4
5
  import { useThemeProps, useTheme, styled } from '@mui/material/styles';
5
6
  import { DrawingContext } from '../context/DrawingProvider';
@@ -126,7 +127,7 @@ export const ChartsLegendLabel = styled('text', {
126
127
  calc(0.5 * var(--ChartsLegend-itemMarkSize))
127
128
  )`,
128
129
  fill: theme.palette.text.primary,
129
- alignmentBaseline: 'central'
130
+ dominantBaseline: 'central'
130
131
  }));
131
132
  const defaultProps = {
132
133
  position: {
@@ -138,27 +139,20 @@ const defaultProps = {
138
139
  itemWidth: 100,
139
140
  spacing: 2
140
141
  };
141
- export function ChartsLegend(inProps) {
142
- const props = useThemeProps({
143
- props: _extends({}, defaultProps, inProps),
144
- name: 'MuiChartsLegend'
145
- });
142
+ function DefaultChartsLegend(props) {
146
143
  const {
144
+ hidden,
147
145
  position,
148
146
  direction,
149
147
  offset,
150
- hidden
148
+ series,
149
+ seriesToDisplay,
150
+ drawingArea,
151
+ classes
151
152
  } = props;
152
- const theme = useTheme();
153
- const classes = useUtilityClasses(_extends({}, props, {
154
- theme
155
- }));
156
- const drawingArea = React.useContext(DrawingContext);
157
- const series = React.useContext(SeriesContext);
158
153
  if (hidden) {
159
154
  return null;
160
155
  }
161
- const seriesToDisplay = getSeriesToDisplay(series);
162
156
  return /*#__PURE__*/_jsx(ChartsLegendRoot, {
163
157
  ownerState: {
164
158
  direction,
@@ -190,4 +184,43 @@ export function ChartsLegend(inProps) {
190
184
  })]
191
185
  }, id))
192
186
  });
187
+ }
188
+ export function ChartsLegend(inProps) {
189
+ var _slots$legend;
190
+ const props = useThemeProps({
191
+ props: _extends({}, defaultProps, inProps),
192
+ name: 'MuiChartsLegend'
193
+ });
194
+ const {
195
+ position,
196
+ direction,
197
+ offset,
198
+ hidden,
199
+ slots,
200
+ slotProps
201
+ } = props;
202
+ const theme = useTheme();
203
+ const classes = useUtilityClasses(_extends({}, props, {
204
+ theme
205
+ }));
206
+ const drawingArea = React.useContext(DrawingContext);
207
+ const series = React.useContext(SeriesContext);
208
+ const seriesToDisplay = getSeriesToDisplay(series);
209
+ const ChartLegendRender = (_slots$legend = slots == null ? void 0 : slots.legend) != null ? _slots$legend : DefaultChartsLegend;
210
+ const chartLegendRenderProps = useSlotProps({
211
+ elementType: ChartLegendRender,
212
+ externalSlotProps: slotProps == null ? void 0 : slotProps.legend,
213
+ additionalProps: {
214
+ position,
215
+ direction,
216
+ offset,
217
+ classes,
218
+ drawingArea,
219
+ series,
220
+ hidden,
221
+ seriesToDisplay
222
+ },
223
+ ownerState: {}
224
+ });
225
+ return /*#__PURE__*/_jsx(ChartLegendRender, _extends({}, chartLegendRenderProps));
193
226
  }
@@ -24,7 +24,7 @@ export function DefaultChartsAxisContent(props) {
24
24
  variant: "outlined",
25
25
  className: classes.root,
26
26
  children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
27
- children: [axisValue != null && /*#__PURE__*/_jsx("thead", {
27
+ children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
28
28
  children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
29
29
  children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
30
30
  colSpan: 3,
@@ -9,7 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
9
9
  import { DrawingContext } from '../context/DrawingProvider';
10
10
  import useTicks from '../hooks/useTicks';
11
11
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
12
- import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
12
+ import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  const useUtilityClasses = ownerState => {
@@ -36,6 +36,7 @@ const defaultProps = {
36
36
  tickSize: 6
37
37
  };
38
38
  function ChartsXAxis(inProps) {
39
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
39
40
  const props = useThemeProps({
40
41
  props: _extends({}, defaultProps, inProps),
41
42
  name: 'MuiChartsXAxis'
@@ -60,7 +61,9 @@ function ChartsXAxis(inProps) {
60
61
  label,
61
62
  labelFontSize,
62
63
  tickSize: tickSizeProp,
63
- valueFormatter
64
+ valueFormatter,
65
+ slots,
66
+ slotProps
64
67
  } = defaultizedProps;
65
68
  const theme = useTheme();
66
69
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -83,14 +86,18 @@ function ChartsXAxis(inProps) {
83
86
  x: left + width / 2,
84
87
  y: positionSigne * (tickFontSize + tickSize + 10)
85
88
  };
89
+ const Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
90
+ const Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
91
+ const TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
92
+ const Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
86
93
  return /*#__PURE__*/_jsxs(AxisRoot, {
87
94
  transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
88
95
  className: classes.root,
89
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
96
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
90
97
  x1: xScale.range()[0],
91
98
  x2: xScale.range()[1],
92
99
  className: classes.line
93
- }), xTicks.map(({
100
+ }, slotProps == null ? void 0 : slotProps.axisLine)), xTicks.map(({
94
101
  formattedValue,
95
102
  offset,
96
103
  labelOffset
@@ -100,26 +107,28 @@ function ChartsXAxis(inProps) {
100
107
  return /*#__PURE__*/_jsxs("g", {
101
108
  transform: `translate(${offset}, 0)`,
102
109
  className: classes.tickContainer,
103
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
110
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
104
111
  y2: positionSigne * tickSize,
105
112
  className: classes.tick
106
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
113
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
107
114
  x: xTickLabel,
108
115
  y: yTickLabel,
109
116
  "transform-origin": `${xTickLabel}px ${yTickLabel}px`,
110
117
  sx: {
111
118
  fontSize: tickFontSize
112
119
  },
113
- className: classes.tickLabel,
120
+ className: classes.tickLabel
121
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
114
122
  children: formattedValue
115
- })]
123
+ }))]
116
124
  }, index);
117
125
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
118
126
  sx: {
119
127
  fontSize: labelFontSize,
120
128
  transformOrigin: `${labelRefPoint.x}px ${labelRefPoint.y}px`
121
129
  },
122
- className: classes.label,
130
+ className: classes.label
131
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
123
132
  children: label
124
133
  }))]
125
134
  });
@@ -165,6 +174,16 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
165
174
  * Position of the axis.
166
175
  */
167
176
  position: PropTypes.oneOf(['bottom', 'top']),
177
+ /**
178
+ * The props used for each component slot.
179
+ * @default {}
180
+ */
181
+ slotProps: PropTypes.object,
182
+ /**
183
+ * Overridable component slots.
184
+ * @default {}
185
+ */
186
+ slots: PropTypes.object,
168
187
  /**
169
188
  * The stroke color of the axis line.
170
189
  * @default 'currentColor'
@@ -175,6 +194,23 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
175
194
  * @default 12
176
195
  */
177
196
  tickFontSize: PropTypes.number,
197
+ /**
198
+ * Maximal step between two ticks.
199
+ * When using time data, the value is assumed to be in ms.
200
+ * Not supported by categorical axis (band, points).
201
+ */
202
+ tickMaxStep: PropTypes.number,
203
+ /**
204
+ * Maximal step between two ticks.
205
+ * When using time data, the value is assumed to be in ms.
206
+ * Not supported by categorical axis (band, points).
207
+ */
208
+ tickMinStep: PropTypes.number,
209
+ /**
210
+ * The number of ticks. This number is not guaranted.
211
+ * Not supported by categorical axis (band, points).
212
+ */
213
+ tickNumber: PropTypes.number,
178
214
  /**
179
215
  * The size of the ticks.
180
216
  * @default 6
@@ -8,7 +8,7 @@ import { useThemeProps, useTheme } from '@mui/material/styles';
8
8
  import { CartesianContext } from '../context/CartesianContextProvider';
9
9
  import { DrawingContext } from '../context/DrawingProvider';
10
10
  import useTicks from '../hooks/useTicks';
11
- import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
11
+ import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
12
12
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -36,6 +36,7 @@ const defaultProps = {
36
36
  tickSize: 6
37
37
  };
38
38
  function ChartsYAxis(inProps) {
39
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
39
40
  const props = useThemeProps({
40
41
  props: _extends({}, defaultProps, inProps),
41
42
  name: 'MuiChartsYAxis'
@@ -60,7 +61,9 @@ function ChartsYAxis(inProps) {
60
61
  label,
61
62
  labelFontSize,
62
63
  tickSize: tickSizeProp,
63
- valueFormatter
64
+ valueFormatter,
65
+ slots,
66
+ slotProps
64
67
  } = defaultizedProps;
65
68
  const theme = useTheme();
66
69
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -83,14 +86,18 @@ function ChartsYAxis(inProps) {
83
86
  x: positionSigne * (tickFontSize + tickSize + 10),
84
87
  y: top + height / 2
85
88
  };
89
+ const Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
90
+ const Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
91
+ const TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
92
+ const Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
86
93
  return /*#__PURE__*/_jsxs(AxisRoot, {
87
94
  transform: `translate(${position === 'right' ? left + width : left}, 0)`,
88
95
  className: classes.root,
89
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
96
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
90
97
  y1: yScale.range()[0],
91
98
  y2: yScale.range()[1],
92
99
  className: classes.line
93
- }), yTicks.map(({
100
+ }, slotProps == null ? void 0 : slotProps.axisLine)), yTicks.map(({
94
101
  formattedValue,
95
102
  offset,
96
103
  labelOffset
@@ -100,19 +107,20 @@ function ChartsYAxis(inProps) {
100
107
  return /*#__PURE__*/_jsxs("g", {
101
108
  transform: `translate(0, ${offset})`,
102
109
  className: classes.tickContainer,
103
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
110
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
104
111
  x2: positionSigne * tickSize,
105
112
  className: classes.tick
106
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
113
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
107
114
  x: xTickLabel,
108
115
  y: yTickLabel,
109
116
  "transform-origin": `${xTickLabel}px ${yTickLabel}px`,
110
117
  sx: {
111
118
  fontSize: tickFontSize
112
119
  },
113
- className: classes.tickLabel,
120
+ className: classes.tickLabel
121
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
114
122
  children: formattedValue.toLocaleString()
115
- })]
123
+ }))]
116
124
  }, index);
117
125
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
118
126
  sx: {
@@ -120,7 +128,8 @@ function ChartsYAxis(inProps) {
120
128
  transform: `rotate(${positionSigne * 90}deg)`,
121
129
  transformOrigin: `${labelRefPoint.x}px ${labelRefPoint.y}px`
122
130
  },
123
- className: classes.label,
131
+ className: classes.label
132
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
124
133
  children: label
125
134
  }))]
126
135
  });
@@ -166,6 +175,16 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
166
175
  * Position of the axis.
167
176
  */
168
177
  position: PropTypes.oneOf(['left', 'right']),
178
+ /**
179
+ * The props used for each component slot.
180
+ * @default {}
181
+ */
182
+ slotProps: PropTypes.object,
183
+ /**
184
+ * Overridable component slots.
185
+ * @default {}
186
+ */
187
+ slots: PropTypes.object,
169
188
  /**
170
189
  * The stroke color of the axis line.
171
190
  * @default 'currentColor'
@@ -176,6 +195,23 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
176
195
  * @default 12
177
196
  */
178
197
  tickFontSize: PropTypes.number,
198
+ /**
199
+ * Maximal step between two ticks.
200
+ * When using time data, the value is assumed to be in ms.
201
+ * Not supported by categorical axis (band, points).
202
+ */
203
+ tickMaxStep: PropTypes.number,
204
+ /**
205
+ * Maximal step between two ticks.
206
+ * When using time data, the value is assumed to be in ms.
207
+ * Not supported by categorical axis (band, points).
208
+ */
209
+ tickMinStep: PropTypes.number,
210
+ /**
211
+ * The number of ticks. This number is not guaranted.
212
+ * Not supported by categorical axis (band, points).
213
+ */
214
+ tickNumber: PropTypes.number,
179
215
  /**
180
216
  * The size of the ticks.
181
217
  * @default 6
@@ -1,9 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "classes", "color", "highlightScope"];
3
+ const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
+ import { useSlotProps } from '@mui/base/utils';
7
8
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
9
  import { styled } from '@mui/material/styles';
9
10
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
@@ -27,7 +28,7 @@ const useUtilityClasses = ownerState => {
27
28
  };
28
29
  return composeClasses(slots, getAreaElementUtilityClass, classes);
29
30
  };
30
- const AreaElementPath = styled('path', {
31
+ export const AreaElementPath = styled('path', {
31
32
  name: 'MuiAreaElement',
32
33
  slot: 'Root',
33
34
  overridesResolver: (_, styles) => styles.root
@@ -55,11 +56,14 @@ AreaElementPath.propTypes = {
55
56
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
56
57
  };
57
58
  function AreaElement(props) {
59
+ var _slots$area;
58
60
  const {
59
61
  id,
60
62
  classes: innerClasses,
61
63
  color,
62
- highlightScope
64
+ highlightScope,
65
+ slots,
66
+ slotProps
63
67
  } = props,
64
68
  other = _objectWithoutPropertiesLoose(props, _excluded);
65
69
  const getInteractionItemProps = useInteractionItemProps(highlightScope);
@@ -82,13 +86,19 @@ function AreaElement(props) {
82
86
  isHighlighted
83
87
  };
84
88
  const classes = useUtilityClasses(ownerState);
85
- return /*#__PURE__*/_jsx(AreaElementPath, _extends({}, other, {
86
- ownerState: ownerState,
87
- className: classes.root
88
- }, getInteractionItemProps({
89
- type: 'line',
90
- seriesId: id
91
- })));
89
+ const Area = (_slots$area = slots == null ? void 0 : slots.area) != null ? _slots$area : AreaElementPath;
90
+ const areaProps = useSlotProps({
91
+ elementType: Area,
92
+ externalSlotProps: slotProps == null ? void 0 : slotProps.area,
93
+ additionalProps: _extends({}, other, getInteractionItemProps({
94
+ type: 'line',
95
+ seriesId: id
96
+ }), {
97
+ className: classes.root
98
+ }),
99
+ ownerState
100
+ });
101
+ return /*#__PURE__*/_jsx(Area, _extends({}, areaProps));
92
102
  }
93
103
  process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
94
104
  // ----------------------------- Warning --------------------------------
@@ -99,6 +109,16 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
99
109
  highlightScope: PropTypes.shape({
100
110
  faded: PropTypes.oneOf(['global', 'none', 'series']),
101
111
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
102
- })
112
+ }),
113
+ /**
114
+ * The props used for each component slot.
115
+ * @default {}
116
+ */
117
+ slotProps: PropTypes.object,
118
+ /**
119
+ * Overridable component slots.
120
+ * @default {}
121
+ */
122
+ slots: PropTypes.object
103
123
  } : void 0;
104
124
  export { AreaElement };
@@ -1,4 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["slots", "slotProps"];
1
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
2
6
  import { area as d3Area } from 'd3-shape';
3
7
  import { SeriesContext } from '../context/SeriesContextProvider';
4
8
  import { CartesianContext } from '../context/CartesianContextProvider';
@@ -6,7 +10,12 @@ import { AreaElement } from './AreaElement';
6
10
  import { getValueToPositionMapper } from '../hooks/useScale';
7
11
  import getCurveFactory from '../internals/getCurve';
8
12
  import { jsx as _jsx } from "react/jsx-runtime";
9
- export function AreaPlot() {
13
+ function AreaPlot(props) {
14
+ const {
15
+ slots,
16
+ slotProps
17
+ } = props,
18
+ other = _objectWithoutPropertiesLoose(props, _excluded);
10
19
  const seriesData = React.useContext(SeriesContext).line;
11
20
  const axisData = React.useContext(CartesianContext);
12
21
  if (seriesData === undefined) {
@@ -24,7 +33,7 @@ export function AreaPlot() {
24
33
  } = axisData;
25
34
  const defaultXAxisId = xAxisIds[0];
26
35
  const defaultYAxisId = yAxisIds[0];
27
- return /*#__PURE__*/_jsx("g", {
36
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
28
37
  children: stackingGroups.flatMap(({
29
38
  ids: groupIds
30
39
  }) => {
@@ -50,9 +59,28 @@ export function AreaPlot() {
50
59
  id: seriesId,
51
60
  d: areaPath.curve(curve)(d3Data) || undefined,
52
61
  color: series[seriesId].color,
53
- highlightScope: series[seriesId].highlightScope
62
+ highlightScope: series[seriesId].highlightScope,
63
+ slots: slots,
64
+ slotProps: slotProps
54
65
  }, seriesId);
55
66
  });
56
67
  })
57
- });
58
- }
68
+ }));
69
+ }
70
+ process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
71
+ // ----------------------------- Warning --------------------------------
72
+ // | These PropTypes are generated from the TypeScript type definitions |
73
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
74
+ // ----------------------------------------------------------------------
75
+ /**
76
+ * The props used for each component slot.
77
+ * @default {}
78
+ */
79
+ slotProps: PropTypes.object,
80
+ /**
81
+ * Overridable component slots.
82
+ * @default {}
83
+ */
84
+ slots: PropTypes.object
85
+ } : void 0;
86
+ export { AreaPlot };