@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
@@ -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';
@@ -123,7 +124,7 @@ export var ChartsLegendLabel = styled('text', {
123
124
  color: 'inherit',
124
125
  transform: "translate(\n calc(var(--ChartsLegend-itemMarkSize) + var(--ChartsLegend-labelSpacing)),\n calc(0.5 * var(--ChartsLegend-itemMarkSize))\n )",
125
126
  fill: theme.palette.text.primary,
126
- alignmentBaseline: 'central'
127
+ dominantBaseline: 'central'
127
128
  });
128
129
  });
129
130
  var defaultProps = {
@@ -136,25 +137,18 @@ var defaultProps = {
136
137
  itemWidth: 100,
137
138
  spacing: 2
138
139
  };
139
- export function ChartsLegend(inProps) {
140
- var props = useThemeProps({
141
- props: _extends({}, defaultProps, inProps),
142
- name: 'MuiChartsLegend'
143
- });
144
- var position = props.position,
140
+ function DefaultChartsLegend(props) {
141
+ var hidden = props.hidden,
142
+ position = props.position,
145
143
  direction = props.direction,
146
144
  offset = props.offset,
147
- hidden = props.hidden;
148
- var theme = useTheme();
149
- var classes = useUtilityClasses(_extends({}, props, {
150
- theme: theme
151
- }));
152
- var drawingArea = React.useContext(DrawingContext);
153
- var series = React.useContext(SeriesContext);
145
+ series = props.series,
146
+ seriesToDisplay = props.seriesToDisplay,
147
+ drawingArea = props.drawingArea,
148
+ classes = props.classes;
154
149
  if (hidden) {
155
150
  return null;
156
151
  }
157
- var seriesToDisplay = getSeriesToDisplay(series);
158
152
  return /*#__PURE__*/_jsx(ChartsLegendRoot, {
159
153
  ownerState: {
160
154
  direction: direction,
@@ -187,4 +181,41 @@ export function ChartsLegend(inProps) {
187
181
  }, id);
188
182
  })
189
183
  });
184
+ }
185
+ export function ChartsLegend(inProps) {
186
+ var _slots$legend;
187
+ var props = useThemeProps({
188
+ props: _extends({}, defaultProps, inProps),
189
+ name: 'MuiChartsLegend'
190
+ });
191
+ var position = props.position,
192
+ direction = props.direction,
193
+ offset = props.offset,
194
+ hidden = props.hidden,
195
+ slots = props.slots,
196
+ slotProps = props.slotProps;
197
+ var theme = useTheme();
198
+ var classes = useUtilityClasses(_extends({}, props, {
199
+ theme: theme
200
+ }));
201
+ var drawingArea = React.useContext(DrawingContext);
202
+ var series = React.useContext(SeriesContext);
203
+ var seriesToDisplay = getSeriesToDisplay(series);
204
+ var ChartLegendRender = (_slots$legend = slots == null ? void 0 : slots.legend) != null ? _slots$legend : DefaultChartsLegend;
205
+ var chartLegendRenderProps = useSlotProps({
206
+ elementType: ChartLegendRender,
207
+ externalSlotProps: slotProps == null ? void 0 : slotProps.legend,
208
+ additionalProps: {
209
+ position: position,
210
+ direction: direction,
211
+ offset: offset,
212
+ classes: classes,
213
+ drawingArea: drawingArea,
214
+ series: series,
215
+ hidden: hidden,
216
+ seriesToDisplay: seriesToDisplay
217
+ },
218
+ ownerState: {}
219
+ });
220
+ return /*#__PURE__*/_jsx(ChartLegendRender, _extends({}, chartLegendRenderProps));
190
221
  }
@@ -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
  var useUtilityClasses = function useUtilityClasses(ownerState) {
@@ -34,6 +34,7 @@ var defaultProps = {
34
34
  tickSize: 6
35
35
  };
36
36
  function ChartsXAxis(inProps) {
37
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
37
38
  var props = useThemeProps({
38
39
  props: _extends({}, defaultProps, inProps),
39
40
  name: 'MuiChartsXAxis'
@@ -51,7 +52,9 @@ function ChartsXAxis(inProps) {
51
52
  label = defaultizedProps.label,
52
53
  labelFontSize = defaultizedProps.labelFontSize,
53
54
  tickSizeProp = defaultizedProps.tickSize,
54
- valueFormatter = defaultizedProps.valueFormatter;
55
+ valueFormatter = defaultizedProps.valueFormatter,
56
+ slots = defaultizedProps.slots,
57
+ slotProps = defaultizedProps.slotProps;
55
58
  var theme = useTheme();
56
59
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
57
60
  theme: theme
@@ -72,14 +75,18 @@ function ChartsXAxis(inProps) {
72
75
  x: left + width / 2,
73
76
  y: positionSigne * (tickFontSize + tickSize + 10)
74
77
  };
78
+ var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
79
+ var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
80
+ var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
81
+ var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
75
82
  return /*#__PURE__*/_jsxs(AxisRoot, {
76
83
  transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
77
84
  className: classes.root,
78
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
85
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
79
86
  x1: xScale.range()[0],
80
87
  x2: xScale.range()[1],
81
88
  className: classes.line
82
- }), xTicks.map(function (_ref, index) {
89
+ }, slotProps == null ? void 0 : slotProps.axisLine)), xTicks.map(function (_ref, index) {
83
90
  var formattedValue = _ref.formattedValue,
84
91
  offset = _ref.offset,
85
92
  labelOffset = _ref.labelOffset;
@@ -88,26 +95,28 @@ function ChartsXAxis(inProps) {
88
95
  return /*#__PURE__*/_jsxs("g", {
89
96
  transform: "translate(".concat(offset, ", 0)"),
90
97
  className: classes.tickContainer,
91
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
98
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
92
99
  y2: positionSigne * tickSize,
93
100
  className: classes.tick
94
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
101
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
95
102
  x: xTickLabel,
96
103
  y: yTickLabel,
97
104
  "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
98
105
  sx: {
99
106
  fontSize: tickFontSize
100
107
  },
101
- className: classes.tickLabel,
108
+ className: classes.tickLabel
109
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
102
110
  children: formattedValue
103
- })]
111
+ }))]
104
112
  }, index);
105
113
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
106
114
  sx: {
107
115
  fontSize: labelFontSize,
108
116
  transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
109
117
  },
110
- className: classes.label,
118
+ className: classes.label
119
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
111
120
  children: label
112
121
  }))]
113
122
  });
@@ -153,6 +162,16 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
153
162
  * Position of the axis.
154
163
  */
155
164
  position: PropTypes.oneOf(['bottom', 'top']),
165
+ /**
166
+ * The props used for each component slot.
167
+ * @default {}
168
+ */
169
+ slotProps: PropTypes.object,
170
+ /**
171
+ * Overridable component slots.
172
+ * @default {}
173
+ */
174
+ slots: PropTypes.object,
156
175
  /**
157
176
  * The stroke color of the axis line.
158
177
  * @default 'currentColor'
@@ -163,6 +182,23 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
163
182
  * @default 12
164
183
  */
165
184
  tickFontSize: PropTypes.number,
185
+ /**
186
+ * Maximal step between two ticks.
187
+ * When using time data, the value is assumed to be in ms.
188
+ * Not supported by categorical axis (band, points).
189
+ */
190
+ tickMaxStep: PropTypes.number,
191
+ /**
192
+ * Maximal step between two ticks.
193
+ * When using time data, the value is assumed to be in ms.
194
+ * Not supported by categorical axis (band, points).
195
+ */
196
+ tickMinStep: PropTypes.number,
197
+ /**
198
+ * The number of ticks. This number is not guaranted.
199
+ * Not supported by categorical axis (band, points).
200
+ */
201
+ tickNumber: PropTypes.number,
166
202
  /**
167
203
  * The size of the ticks.
168
204
  * @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";
@@ -34,6 +34,7 @@ var defaultProps = {
34
34
  tickSize: 6
35
35
  };
36
36
  function ChartsYAxis(inProps) {
37
+ var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
37
38
  var props = useThemeProps({
38
39
  props: _extends({}, defaultProps, inProps),
39
40
  name: 'MuiChartsYAxis'
@@ -51,7 +52,9 @@ function ChartsYAxis(inProps) {
51
52
  label = defaultizedProps.label,
52
53
  labelFontSize = defaultizedProps.labelFontSize,
53
54
  tickSizeProp = defaultizedProps.tickSize,
54
- valueFormatter = defaultizedProps.valueFormatter;
55
+ valueFormatter = defaultizedProps.valueFormatter,
56
+ slots = defaultizedProps.slots,
57
+ slotProps = defaultizedProps.slotProps;
55
58
  var theme = useTheme();
56
59
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
57
60
  theme: theme
@@ -72,14 +75,18 @@ function ChartsYAxis(inProps) {
72
75
  x: positionSigne * (tickFontSize + tickSize + 10),
73
76
  y: top + height / 2
74
77
  };
78
+ var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
79
+ var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
80
+ var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
81
+ var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
75
82
  return /*#__PURE__*/_jsxs(AxisRoot, {
76
83
  transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
77
84
  className: classes.root,
78
- children: [!disableLine && /*#__PURE__*/_jsx(Line, {
85
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
79
86
  y1: yScale.range()[0],
80
87
  y2: yScale.range()[1],
81
88
  className: classes.line
82
- }), yTicks.map(function (_ref, index) {
89
+ }, slotProps == null ? void 0 : slotProps.axisLine)), yTicks.map(function (_ref, index) {
83
90
  var formattedValue = _ref.formattedValue,
84
91
  offset = _ref.offset,
85
92
  labelOffset = _ref.labelOffset;
@@ -88,19 +95,20 @@ function ChartsYAxis(inProps) {
88
95
  return /*#__PURE__*/_jsxs("g", {
89
96
  transform: "translate(0, ".concat(offset, ")"),
90
97
  className: classes.tickContainer,
91
- children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
98
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
92
99
  x2: positionSigne * tickSize,
93
100
  className: classes.tick
94
- }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
101
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
95
102
  x: xTickLabel,
96
103
  y: yTickLabel,
97
104
  "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
98
105
  sx: {
99
106
  fontSize: tickFontSize
100
107
  },
101
- className: classes.tickLabel,
108
+ className: classes.tickLabel
109
+ }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
102
110
  children: formattedValue.toLocaleString()
103
- })]
111
+ }))]
104
112
  }, index);
105
113
  }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
106
114
  sx: {
@@ -108,7 +116,8 @@ function ChartsYAxis(inProps) {
108
116
  transform: "rotate(".concat(positionSigne * 90, "deg)"),
109
117
  transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
110
118
  },
111
- className: classes.label,
119
+ className: classes.label
120
+ }, slotProps == null ? void 0 : slotProps.axisLabel, {
112
121
  children: label
113
122
  }))]
114
123
  });
@@ -154,6 +163,16 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
154
163
  * Position of the axis.
155
164
  */
156
165
  position: PropTypes.oneOf(['left', 'right']),
166
+ /**
167
+ * The props used for each component slot.
168
+ * @default {}
169
+ */
170
+ slotProps: PropTypes.object,
171
+ /**
172
+ * Overridable component slots.
173
+ * @default {}
174
+ */
175
+ slots: PropTypes.object,
157
176
  /**
158
177
  * The stroke color of the axis line.
159
178
  * @default 'currentColor'
@@ -164,6 +183,23 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
164
183
  * @default 12
165
184
  */
166
185
  tickFontSize: PropTypes.number,
186
+ /**
187
+ * Maximal step between two ticks.
188
+ * When using time data, the value is assumed to be in ms.
189
+ * Not supported by categorical axis (band, points).
190
+ */
191
+ tickMaxStep: PropTypes.number,
192
+ /**
193
+ * Maximal step between two ticks.
194
+ * When using time data, the value is assumed to be in ms.
195
+ * Not supported by categorical axis (band, points).
196
+ */
197
+ tickMinStep: PropTypes.number,
198
+ /**
199
+ * The number of ticks. This number is not guaranted.
200
+ * Not supported by categorical axis (band, points).
201
+ */
202
+ tickNumber: PropTypes.number,
167
203
  /**
168
204
  * The size of the ticks.
169
205
  * @default 6
@@ -1,9 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "classes", "color", "highlightScope"];
3
+ var _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';
@@ -25,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
25
26
  };
26
27
  return composeClasses(slots, getAreaElementUtilityClass, classes);
27
28
  };
28
- var AreaElementPath = styled('path', {
29
+ export var AreaElementPath = styled('path', {
29
30
  name: 'MuiAreaElement',
30
31
  slot: 'Root',
31
32
  overridesResolver: function overridesResolver(_, styles) {
@@ -56,10 +57,13 @@ AreaElementPath.propTypes = {
56
57
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
57
58
  };
58
59
  function AreaElement(props) {
60
+ var _slots$area;
59
61
  var id = props.id,
60
62
  innerClasses = props.classes,
61
63
  color = props.color,
62
64
  highlightScope = props.highlightScope,
65
+ slots = props.slots,
66
+ slotProps = props.slotProps,
63
67
  other = _objectWithoutProperties(props, _excluded);
64
68
  var getInteractionItemProps = useInteractionItemProps(highlightScope);
65
69
  var _React$useContext = React.useContext(InteractionContext),
@@ -80,13 +84,19 @@ function AreaElement(props) {
80
84
  isHighlighted: isHighlighted
81
85
  };
82
86
  var classes = useUtilityClasses(ownerState);
83
- return /*#__PURE__*/_jsx(AreaElementPath, _extends({}, other, {
84
- ownerState: ownerState,
85
- className: classes.root
86
- }, getInteractionItemProps({
87
- type: 'line',
88
- seriesId: id
89
- })));
87
+ var Area = (_slots$area = slots == null ? void 0 : slots.area) != null ? _slots$area : AreaElementPath;
88
+ var areaProps = useSlotProps({
89
+ elementType: Area,
90
+ externalSlotProps: slotProps == null ? void 0 : slotProps.area,
91
+ additionalProps: _extends({}, other, getInteractionItemProps({
92
+ type: 'line',
93
+ seriesId: id
94
+ }), {
95
+ className: classes.root
96
+ }),
97
+ ownerState: ownerState
98
+ });
99
+ return /*#__PURE__*/_jsx(Area, _extends({}, areaProps));
90
100
  }
91
101
  process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
92
102
  // ----------------------------- Warning --------------------------------
@@ -97,6 +107,16 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
97
107
  highlightScope: PropTypes.shape({
98
108
  faded: PropTypes.oneOf(['global', 'none', 'series']),
99
109
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
100
- })
110
+ }),
111
+ /**
112
+ * The props used for each component slot.
113
+ * @default {}
114
+ */
115
+ slotProps: PropTypes.object,
116
+ /**
117
+ * Overridable component slots.
118
+ * @default {}
119
+ */
120
+ slots: PropTypes.object
101
121
  } : void 0;
102
122
  export { AreaElement };
@@ -1,4 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _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,10 @@ 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
+ var slots = props.slots,
15
+ slotProps = props.slotProps,
16
+ other = _objectWithoutProperties(props, _excluded);
10
17
  var seriesData = React.useContext(SeriesContext).line;
11
18
  var axisData = React.useContext(CartesianContext);
12
19
  if (seriesData === undefined) {
@@ -20,7 +27,7 @@ export function AreaPlot() {
20
27
  yAxisIds = axisData.yAxisIds;
21
28
  var defaultXAxisId = xAxisIds[0];
22
29
  var defaultYAxisId = yAxisIds[0];
23
- return /*#__PURE__*/_jsx("g", {
30
+ return /*#__PURE__*/_jsx("g", _extends({}, other, {
24
31
  children: stackingGroups.flatMap(function (_ref) {
25
32
  var groupIds = _ref.ids;
26
33
  return groupIds.flatMap(function (seriesId) {
@@ -54,9 +61,28 @@ export function AreaPlot() {
54
61
  id: seriesId,
55
62
  d: areaPath.curve(curve)(d3Data) || undefined,
56
63
  color: series[seriesId].color,
57
- highlightScope: series[seriesId].highlightScope
64
+ highlightScope: series[seriesId].highlightScope,
65
+ slots: slots,
66
+ slotProps: slotProps
58
67
  }, seriesId);
59
68
  });
60
69
  })
61
- });
62
- }
70
+ }));
71
+ }
72
+ process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
73
+ // ----------------------------- Warning --------------------------------
74
+ // | These PropTypes are generated from the TypeScript type definitions |
75
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
76
+ // ----------------------------------------------------------------------
77
+ /**
78
+ * The props used for each component slot.
79
+ * @default {}
80
+ */
81
+ slotProps: PropTypes.object,
82
+ /**
83
+ * Overridable component slots.
84
+ * @default {}
85
+ */
86
+ slots: PropTypes.object
87
+ } : void 0;
88
+ export { AreaPlot };