@mui/x-charts 6.0.0-alpha.6 → 6.0.0-alpha.8

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 (142) hide show
  1. package/BarChart/BarChart.d.ts +19 -2
  2. package/BarChart/BarChart.js +84 -22
  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 +48 -19
  7. package/BarChart/extremums.js +19 -3
  8. package/BarChart/formatter.js +3 -1
  9. package/CHANGELOG.md +213 -28
  10. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  11. package/ChartsAxis/ChartsAxis.js +51 -6
  12. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +3 -2
  13. package/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  14. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  15. package/ChartsLegend/ChartsLegend.js +49 -17
  16. package/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  17. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  18. package/ChartsXAxis/ChartsXAxis.js +44 -9
  19. package/ChartsYAxis/ChartsYAxis.js +44 -9
  20. package/LineChart/AreaElement.d.ts +22 -0
  21. package/LineChart/AreaElement.js +31 -11
  22. package/LineChart/AreaPlot.d.ts +14 -1
  23. package/LineChart/AreaPlot.js +29 -3
  24. package/LineChart/LineChart.d.ts +20 -2
  25. package/LineChart/LineChart.js +63 -11
  26. package/LineChart/LineElement.d.ts +22 -0
  27. package/LineChart/LineElement.js +31 -10
  28. package/LineChart/LinePlot.d.ts +14 -1
  29. package/LineChart/LinePlot.js +35 -4
  30. package/LineChart/MarkPlot.d.ts +24 -1
  31. package/LineChart/MarkPlot.js +29 -4
  32. package/PieChart/PieArcLabel.js +0 -1
  33. package/PieChart/PieChart.d.ts +14 -2
  34. package/PieChart/PieChart.js +52 -10
  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 +56 -10
  39. package/ScatterChart/ScatterPlot.d.ts +24 -1
  40. package/ScatterChart/ScatterPlot.js +28 -4
  41. package/SparkLineChart/SparkLineChart.d.ts +18 -0
  42. package/SparkLineChart/SparkLineChart.js +29 -6
  43. package/colorPalettes/colorPalettes.js +2 -2
  44. package/context/CartesianContextProvider.js +18 -12
  45. package/esm/BarChart/BarChart.js +88 -26
  46. package/esm/BarChart/BarElement.js +21 -11
  47. package/esm/BarChart/BarPlot.js +49 -20
  48. package/esm/BarChart/extremums.js +18 -2
  49. package/esm/BarChart/formatter.js +3 -1
  50. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  51. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  52. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  53. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  54. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  55. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  56. package/esm/LineChart/AreaElement.js +31 -11
  57. package/esm/LineChart/AreaPlot.js +31 -4
  58. package/esm/LineChart/LineChart.js +63 -11
  59. package/esm/LineChart/LineElement.js +31 -11
  60. package/esm/LineChart/LinePlot.js +43 -8
  61. package/esm/LineChart/MarkPlot.js +32 -5
  62. package/esm/PieChart/PieArcLabel.js +0 -1
  63. package/esm/PieChart/PieChart.js +52 -10
  64. package/esm/PieChart/PiePlot.js +31 -6
  65. package/esm/ScatterChart/ScatterChart.js +56 -10
  66. package/esm/ScatterChart/ScatterPlot.js +29 -4
  67. package/esm/SparkLineChart/SparkLineChart.js +29 -6
  68. package/esm/colorPalettes/colorPalettes.js +2 -2
  69. package/esm/context/CartesianContextProvider.js +18 -12
  70. package/esm/hooks/useAxisEvents.js +21 -38
  71. package/esm/hooks/useTicks.js +11 -8
  72. package/esm/internals/components/AxisSharedComponents.js +10 -10
  73. package/hooks/useAxisEvents.js +21 -38
  74. package/hooks/useTicks.d.ts +20 -5
  75. package/hooks/useTicks.js +11 -8
  76. package/index.js +1 -1
  77. package/internals/components/AxisSharedComponents.d.ts +4 -4
  78. package/internals/components/AxisSharedComponents.js +15 -15
  79. package/internals/defaultizeColor.d.ts +1 -0
  80. package/legacy/BarChart/BarChart.js +93 -29
  81. package/legacy/BarChart/BarElement.js +20 -10
  82. package/legacy/BarChart/BarPlot.js +49 -20
  83. package/legacy/BarChart/extremums.js +22 -2
  84. package/legacy/BarChart/formatter.js +3 -1
  85. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  86. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  87. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  88. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  89. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  90. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  91. package/legacy/LineChart/AreaElement.js +30 -10
  92. package/legacy/LineChart/AreaPlot.js +29 -4
  93. package/legacy/LineChart/LineChart.js +63 -11
  94. package/legacy/LineChart/LineElement.js +30 -10
  95. package/legacy/LineChart/LinePlot.js +36 -5
  96. package/legacy/LineChart/MarkPlot.js +30 -5
  97. package/legacy/PieChart/PieArcLabel.js +0 -1
  98. package/legacy/PieChart/PieChart.js +52 -10
  99. package/legacy/PieChart/PiePlot.js +29 -6
  100. package/legacy/ScatterChart/ScatterChart.js +56 -10
  101. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  102. package/legacy/SparkLineChart/SparkLineChart.js +29 -6
  103. package/legacy/colorPalettes/colorPalettes.js +2 -2
  104. package/legacy/context/CartesianContextProvider.js +18 -12
  105. package/legacy/hooks/useAxisEvents.js +21 -37
  106. package/legacy/hooks/useTicks.js +11 -11
  107. package/legacy/index.js +1 -1
  108. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  109. package/models/axis.d.ts +24 -1
  110. package/models/seriesType/bar.d.ts +6 -1
  111. package/modern/BarChart/BarChart.js +85 -23
  112. package/modern/BarChart/BarElement.js +20 -11
  113. package/modern/BarChart/BarPlot.js +48 -19
  114. package/modern/BarChart/extremums.js +18 -2
  115. package/modern/BarChart/formatter.js +3 -1
  116. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  117. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  118. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  119. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  120. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  121. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  122. package/modern/LineChart/AreaElement.js +30 -11
  123. package/modern/LineChart/AreaPlot.js +31 -4
  124. package/modern/LineChart/LineChart.js +63 -11
  125. package/modern/LineChart/LineElement.js +30 -11
  126. package/modern/LineChart/LinePlot.js +37 -5
  127. package/modern/LineChart/MarkPlot.js +31 -5
  128. package/modern/PieChart/PieArcLabel.js +0 -1
  129. package/modern/PieChart/PieChart.js +52 -10
  130. package/modern/PieChart/PiePlot.js +30 -6
  131. package/modern/ScatterChart/ScatterChart.js +56 -10
  132. package/modern/ScatterChart/ScatterPlot.js +28 -4
  133. package/modern/SparkLineChart/SparkLineChart.js +29 -6
  134. package/modern/colorPalettes/colorPalettes.js +2 -2
  135. package/modern/context/CartesianContextProvider.js +18 -12
  136. package/modern/hooks/useAxisEvents.js +21 -38
  137. package/modern/hooks/useTicks.js +11 -8
  138. package/modern/index.js +1 -1
  139. package/modern/internals/components/AxisSharedComponents.js +10 -10
  140. package/package.json +5 -5
  141. package/themeAugmentation/components.d.ts +0 -10
  142. package/themeAugmentation/overrides.d.ts +0 -2
@@ -1,16 +1,34 @@
1
1
  import * as React from 'react';
2
+ import { AreaPlotSlotComponentProps, AreaPlotSlotsComponent } from './AreaPlot';
3
+ import { LinePlotSlotComponentProps, LinePlotSlotsComponent } from './LinePlot';
2
4
  import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
5
+ import { MarkPlotSlotComponentProps, MarkPlotSlotsComponent } from './MarkPlot';
3
6
  import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
4
7
  import { LineSeriesType } from '../models/seriesType/line';
5
8
  import { MakeOptional } from '../models/helpers';
6
9
  import { ChartsTooltipProps } from '../ChartsTooltip';
7
- import { ChartsLegendProps } from '../ChartsLegend';
10
+ import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
8
11
  import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
9
- export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, ChartsAxisProps {
12
+ import { ChartsAxisSlotComponentProps, ChartsAxisSlotsComponent } from '../models/axis';
13
+ export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, ChartsLegendSlotsComponent {
14
+ }
15
+ export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, ChartsLegendSlotComponentProps {
16
+ }
17
+ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
10
18
  series: MakeOptional<LineSeriesType, 'type'>[];
11
19
  tooltip?: ChartsTooltipProps;
12
20
  axisHighlight?: ChartsAxisHighlightProps;
13
21
  legend?: ChartsLegendProps;
22
+ /**
23
+ * Overridable component slots.
24
+ * @default {}
25
+ */
26
+ slots?: LineChartSlotsComponent;
27
+ /**
28
+ * The props used for each component slot.
29
+ * @default {}
30
+ */
31
+ slotProps?: LineChartSlotComponentProps;
14
32
  }
15
33
  declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
16
34
  export { LineChart };
@@ -42,7 +42,9 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
42
42
  leftAxis,
43
43
  rightAxis,
44
44
  bottomAxis,
45
- children
45
+ children,
46
+ slots,
47
+ slotProps
46
48
  } = props;
47
49
  const id = (0, _useId.default)();
48
50
  const clipPathId = `${id}-clip-path`;
@@ -68,13 +70,27 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
68
70
  disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
69
71
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
70
72
  clipPath: `url(#${clipPathId})`,
71
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, {})]
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, {
74
+ slots: slots,
75
+ slotProps: slotProps
76
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, {
77
+ slots: slots,
78
+ slotProps: slotProps
79
+ })]
72
80
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
73
81
  topAxis: topAxis,
74
82
  leftAxis: leftAxis,
75
83
  rightAxis: rightAxis,
76
- bottomAxis: bottomAxis
77
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
84
+ bottomAxis: bottomAxis,
85
+ slots: slots,
86
+ slotProps: slotProps
87
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, {
88
+ slots: slots,
89
+ slotProps: slotProps
90
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
91
+ slots: slots,
92
+ slotProps: slotProps
93
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
78
94
  id: clipPathId
79
95
  }), children]
80
96
  });
@@ -87,7 +103,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
87
103
  // ----------------------------------------------------------------------
88
104
  axisHighlight: _propTypes.default.shape({
89
105
  x: _propTypes.default.oneOf(['band', 'line', 'none']),
90
- y: _propTypes.default.oneOf(['line', 'none'])
106
+ y: _propTypes.default.oneOf(['band', 'line', 'none'])
91
107
  }),
92
108
  /**
93
109
  * Indicate which axis to display the bottom of the charts.
@@ -103,8 +119,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
103
119
  label: _propTypes.default.string,
104
120
  labelFontSize: _propTypes.default.number,
105
121
  position: _propTypes.default.oneOf(['bottom', 'top']),
122
+ slotProps: _propTypes.default.object,
123
+ slots: _propTypes.default.object,
106
124
  stroke: _propTypes.default.string,
107
125
  tickFontSize: _propTypes.default.number,
126
+ tickMaxStep: _propTypes.default.number,
127
+ tickMinStep: _propTypes.default.number,
128
+ tickNumber: _propTypes.default.number,
108
129
  tickSize: _propTypes.default.number
109
130
  }), _propTypes.default.string]),
110
131
  children: _propTypes.default.node,
@@ -131,8 +152,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
131
152
  label: _propTypes.default.string,
132
153
  labelFontSize: _propTypes.default.number,
133
154
  position: _propTypes.default.oneOf(['left', 'right']),
155
+ slotProps: _propTypes.default.object,
156
+ slots: _propTypes.default.object,
134
157
  stroke: _propTypes.default.string,
135
158
  tickFontSize: _propTypes.default.number,
159
+ tickMaxStep: _propTypes.default.number,
160
+ tickMinStep: _propTypes.default.number,
161
+ tickNumber: _propTypes.default.number,
136
162
  tickSize: _propTypes.default.number
137
163
  }), _propTypes.default.string]),
138
164
  legend: _propTypes.default.shape({
@@ -149,6 +175,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
149
175
  horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
150
176
  vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
151
177
  }),
178
+ slotProps: _propTypes.default.object,
179
+ slots: _propTypes.default.object,
152
180
  spacing: _propTypes.default.number
153
181
  }),
154
182
  margin: _propTypes.default.shape({
@@ -171,8 +199,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
171
199
  label: _propTypes.default.string,
172
200
  labelFontSize: _propTypes.default.number,
173
201
  position: _propTypes.default.oneOf(['left', 'right']),
202
+ slotProps: _propTypes.default.object,
203
+ slots: _propTypes.default.object,
174
204
  stroke: _propTypes.default.string,
175
205
  tickFontSize: _propTypes.default.number,
206
+ tickMaxStep: _propTypes.default.number,
207
+ tickMinStep: _propTypes.default.number,
208
+ tickNumber: _propTypes.default.number,
176
209
  tickSize: _propTypes.default.number
177
210
  }), _propTypes.default.string]),
178
211
  series: _propTypes.default.arrayOf(_propTypes.default.shape({
@@ -195,6 +228,16 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
195
228
  xAxisKey: _propTypes.default.string,
196
229
  yAxisKey: _propTypes.default.string
197
230
  })).isRequired,
231
+ /**
232
+ * The props used for each component slot.
233
+ * @default {}
234
+ */
235
+ slotProps: _propTypes.default.object,
236
+ /**
237
+ * Overridable component slots.
238
+ * @default {}
239
+ */
240
+ slots: _propTypes.default.object,
198
241
  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]),
199
242
  title: _propTypes.default.string,
200
243
  tooltip: _propTypes.default.shape({
@@ -217,8 +260,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
217
260
  label: _propTypes.default.string,
218
261
  labelFontSize: _propTypes.default.number,
219
262
  position: _propTypes.default.oneOf(['bottom', 'top']),
263
+ slotProps: _propTypes.default.object,
264
+ slots: _propTypes.default.object,
220
265
  stroke: _propTypes.default.string,
221
266
  tickFontSize: _propTypes.default.number,
267
+ tickMaxStep: _propTypes.default.number,
268
+ tickMinStep: _propTypes.default.number,
269
+ tickNumber: _propTypes.default.number,
222
270
  tickSize: _propTypes.default.number
223
271
  }), _propTypes.default.string]),
224
272
  viewBox: _propTypes.default.shape({
@@ -241,15 +289,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
241
289
  label: _propTypes.default.string,
242
290
  labelFontSize: _propTypes.default.number,
243
291
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
244
- maxTicks: _propTypes.default.number,
245
292
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
246
- minTicks: _propTypes.default.number,
247
293
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
248
294
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
295
+ slotProps: _propTypes.default.object,
296
+ slots: _propTypes.default.object,
249
297
  stroke: _propTypes.default.string,
250
298
  tickFontSize: _propTypes.default.number,
299
+ tickMaxStep: _propTypes.default.number,
300
+ tickMinStep: _propTypes.default.number,
301
+ tickNumber: _propTypes.default.number,
251
302
  tickSize: _propTypes.default.number,
252
- tickSpacing: _propTypes.default.number,
253
303
  valueFormatter: _propTypes.default.func
254
304
  })),
255
305
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
@@ -265,15 +315,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
265
315
  label: _propTypes.default.string,
266
316
  labelFontSize: _propTypes.default.number,
267
317
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
268
- maxTicks: _propTypes.default.number,
269
318
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
270
- minTicks: _propTypes.default.number,
271
319
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
272
320
  scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
321
+ slotProps: _propTypes.default.object,
322
+ slots: _propTypes.default.object,
273
323
  stroke: _propTypes.default.string,
274
324
  tickFontSize: _propTypes.default.number,
325
+ tickMaxStep: _propTypes.default.number,
326
+ tickMinStep: _propTypes.default.number,
327
+ tickNumber: _propTypes.default.number,
275
328
  tickSize: _propTypes.default.number,
276
- tickSpacing: _propTypes.default.number,
277
329
  valueFormatter: _propTypes.default.func
278
330
  }))
279
331
  } : void 0;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { SlotComponentProps } from '@mui/base';
2
3
  import { HighlightScope } from '../context/HighlightProvider';
3
4
  export interface LineElementClasses {
4
5
  /** Styles applied to the root element. */
@@ -18,8 +19,29 @@ export interface LineElementOwnerState {
18
19
  }
19
20
  export declare function getLineElementUtilityClass(slot: string): string;
20
21
  export declare const lineElementClasses: LineElementClasses;
22
+ export declare const LineElementPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
23
+ ownerState: LineElementOwnerState;
24
+ }, Pick<React.SVGProps<SVGPathElement>, keyof React.SVGProps<SVGPathElement>>, {}>;
21
25
  export type LineElementProps = Omit<LineElementOwnerState, 'isFaded' | 'isHighlighted'> & React.ComponentPropsWithoutRef<'path'> & {
22
26
  highlightScope?: Partial<HighlightScope>;
27
+ /**
28
+ * The props used for each component slot.
29
+ * @default {}
30
+ */
31
+ slotProps?: {
32
+ line?: SlotComponentProps<'path', {}, LineElementOwnerState>;
33
+ };
34
+ /**
35
+ * Overridable component slots.
36
+ * @default {}
37
+ */
38
+ slots?: {
39
+ /**
40
+ * The component that renders the root.
41
+ * @default LineElementPath
42
+ */
43
+ line?: React.ElementType;
44
+ };
23
45
  };
24
46
  declare function LineElement(props: LineElementProps): React.JSX.Element;
25
47
  declare namespace LineElement {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.LineElement = LineElement;
8
+ exports.LineElementPath = void 0;
8
9
  exports.getLineElementUtilityClass = getLineElementUtilityClass;
9
10
  exports.lineElementClasses = void 0;
10
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -13,13 +14,14 @@ var React = _interopRequireWildcard(require("react"));
13
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
15
  var _d3Color = require("d3-color");
15
16
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
+ var _utils = require("@mui/base/utils");
16
18
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
17
19
  var _styles = require("@mui/material/styles");
18
20
  var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
19
21
  var _InteractionProvider = require("../context/InteractionProvider");
20
22
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
21
23
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["id", "classes", "color", "highlightScope"];
24
+ const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
23
25
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
27
  function getLineElementUtilityClass(slot) {
@@ -53,6 +55,7 @@ const LineElementPath = (0, _styles.styled)('path', {
53
55
  transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
54
56
  opacity: ownerState.isFaded ? 0.3 : 1
55
57
  }));
58
+ exports.LineElementPath = LineElementPath;
56
59
  LineElementPath.propTypes = {
57
60
  // ----------------------------- Warning --------------------------------
58
61
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -73,7 +76,9 @@ function LineElement(props) {
73
76
  id,
74
77
  classes: innerClasses,
75
78
  color,
76
- highlightScope
79
+ highlightScope,
80
+ slots,
81
+ slotProps
77
82
  } = props,
78
83
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
79
84
  const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(highlightScope);
@@ -96,13 +101,19 @@ function LineElement(props) {
96
101
  isHighlighted
97
102
  };
98
103
  const classes = useUtilityClasses(ownerState);
99
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(LineElementPath, (0, _extends2.default)({}, other, {
100
- ownerState: ownerState,
101
- className: classes.root
102
- }, getInteractionItemProps({
103
- type: 'line',
104
- seriesId: id
105
- })));
104
+ const Line = slots?.line ?? LineElementPath;
105
+ const lineProps = (0, _utils.useSlotProps)({
106
+ elementType: Line,
107
+ externalSlotProps: slotProps?.line,
108
+ additionalProps: (0, _extends2.default)({}, other, getInteractionItemProps({
109
+ type: 'line',
110
+ seriesId: id
111
+ }), {
112
+ className: classes.root
113
+ }),
114
+ ownerState
115
+ });
116
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Line, (0, _extends2.default)({}, lineProps));
106
117
  }
107
118
  process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
108
119
  // ----------------------------- Warning --------------------------------
@@ -113,5 +124,15 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
113
124
  highlightScope: _propTypes.default.shape({
114
125
  faded: _propTypes.default.oneOf(['global', 'none', 'series']),
115
126
  highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
116
- })
127
+ }),
128
+ /**
129
+ * The props used for each component slot.
130
+ * @default {}
131
+ */
132
+ slotProps: _propTypes.default.object,
133
+ /**
134
+ * Overridable component slots.
135
+ * @default {}
136
+ */
137
+ slots: _propTypes.default.object
117
138
  } : void 0;
@@ -1,2 +1,15 @@
1
1
  import * as React from 'react';
2
- export declare function LinePlot(props: React.SVGAttributes<SVGSVGElement>): React.JSX.Element | null;
2
+ import { LineElementProps } from './LineElement';
3
+ export interface LinePlotSlotsComponent {
4
+ line?: React.JSXElementConstructor<LineElementProps>;
5
+ }
6
+ export interface LinePlotSlotComponentProps {
7
+ line?: Partial<LineElementProps>;
8
+ }
9
+ export interface LinePlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<LineElementProps, 'slots' | 'slotProps'> {
10
+ }
11
+ declare function LinePlot(props: LinePlotProps): React.JSX.Element | null;
12
+ declare namespace LinePlot {
13
+ var propTypes: any;
14
+ }
15
+ export { LinePlot };
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.LinePlot = LinePlot;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
10
  var React = _interopRequireWildcard(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
12
  var _d3Shape = require("d3-shape");
11
13
  var _SeriesContextProvider = require("../context/SeriesContextProvider");
12
14
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
@@ -14,9 +16,15 @@ var _LineElement = require("./LineElement");
14
16
  var _useScale = require("../hooks/useScale");
15
17
  var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
16
18
  var _jsxRuntime = require("react/jsx-runtime");
19
+ const _excluded = ["slots", "slotProps"];
17
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
22
  function LinePlot(props) {
23
+ const {
24
+ slots,
25
+ slotProps
26
+ } = props,
27
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
20
28
  const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).line;
21
29
  const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
22
30
  if (seriesData === undefined) {
@@ -34,7 +42,7 @@ function LinePlot(props) {
34
42
  } = axisData;
35
43
  const defaultXAxisId = xAxisIds[0];
36
44
  const defaultYAxisId = yAxisIds[0];
37
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, props, {
45
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
38
46
  children: stackingGroups.flatMap(({
39
47
  ids: groupIds
40
48
  }) => {
@@ -51,18 +59,41 @@ function LinePlot(props) {
51
59
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
52
60
  }
53
61
  const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).y(d => yScale(d.y[1]));
62
+ if (process.env.NODE_ENV !== 'production') {
63
+ if (xData.length !== stackedData.length) {
64
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) does not match length of series (${stackedData.length} items)`);
65
+ }
66
+ }
54
67
  const curve = (0, _getCurve.default)(series[seriesId].curve);
55
68
  const d3Data = xData?.map((x, index) => ({
56
69
  x,
57
- y: stackedData[index]
70
+ y: stackedData[index] ?? [0, 0]
58
71
  }));
59
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineElement.LineElement, {
60
73
  id: seriesId,
61
74
  d: linePath.curve(curve)(d3Data) || undefined,
62
75
  color: series[seriesId].color,
63
- highlightScope: series[seriesId].highlightScope
76
+ highlightScope: series[seriesId].highlightScope,
77
+ slots: slots,
78
+ slotProps: slotProps
64
79
  }, seriesId);
65
80
  });
66
81
  })
67
82
  }));
68
- }
83
+ }
84
+ process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
85
+ // ----------------------------- Warning --------------------------------
86
+ // | These PropTypes are generated from the TypeScript type definitions |
87
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
88
+ // ----------------------------------------------------------------------
89
+ /**
90
+ * The props used for each component slot.
91
+ * @default {}
92
+ */
93
+ slotProps: _propTypes.default.object,
94
+ /**
95
+ * Overridable component slots.
96
+ * @default {}
97
+ */
98
+ slots: _propTypes.default.object
99
+ } : void 0;
@@ -1,2 +1,25 @@
1
1
  import * as React from 'react';
2
- export declare function MarkPlot(props: React.SVGAttributes<SVGSVGElement>): React.JSX.Element | null;
2
+ import { MarkElementProps } from './MarkElement';
3
+ export interface MarkPlotSlotsComponent {
4
+ mark?: React.JSXElementConstructor<MarkElementProps>;
5
+ }
6
+ export interface MarkPlotSlotComponentProps {
7
+ mark?: Partial<MarkElementProps>;
8
+ }
9
+ export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement> {
10
+ /**
11
+ * Overridable component slots.
12
+ * @default {}
13
+ */
14
+ slots?: MarkPlotSlotsComponent;
15
+ /**
16
+ * The props used for each component slot.
17
+ * @default {}
18
+ */
19
+ slotProps?: MarkPlotSlotComponentProps;
20
+ }
21
+ declare function MarkPlot(props: MarkPlotProps): React.JSX.Element | null;
22
+ declare namespace MarkPlot {
23
+ var propTypes: any;
24
+ }
25
+ export { MarkPlot };
@@ -6,17 +6,26 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.MarkPlot = MarkPlot;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
10
  var React = _interopRequireWildcard(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
12
  var _SeriesContextProvider = require("../context/SeriesContextProvider");
11
13
  var _CartesianContextProvider = require("../context/CartesianContextProvider");
12
14
  var _MarkElement = require("./MarkElement");
13
15
  var _useScale = require("../hooks/useScale");
14
16
  var _jsxRuntime = require("react/jsx-runtime");
17
+ const _excluded = ["slots", "slotProps"];
15
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
20
  function MarkPlot(props) {
21
+ const {
22
+ slots,
23
+ slotProps
24
+ } = props,
25
+ other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
18
26
  const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).line;
19
27
  const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
28
+ const Mark = slots?.mark ?? _MarkElement.MarkElement;
20
29
  if (seriesData === undefined) {
21
30
  return null;
22
31
  }
@@ -32,7 +41,7 @@ function MarkPlot(props) {
32
41
  } = axisData;
33
42
  const defaultXAxisId = xAxisIds[0];
34
43
  const defaultYAxisId = yAxisIds[0];
35
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, props, {
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
36
45
  children: stackingGroups.flatMap(({
37
46
  ids: groupIds
38
47
  }) => {
@@ -73,7 +82,7 @@ function MarkPlot(props) {
73
82
  x,
74
83
  y,
75
84
  index
76
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkElement.MarkElement, {
85
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Mark, (0, _extends2.default)({
77
86
  id: seriesId,
78
87
  dataIndex: index,
79
88
  shape: "circle",
@@ -81,8 +90,24 @@ function MarkPlot(props) {
81
90
  x: x,
82
91
  y: y,
83
92
  highlightScope: series[seriesId].highlightScope
84
- }, `${seriesId}-${index}`));
93
+ }, slotProps?.mark), `${seriesId}-${index}`));
85
94
  });
86
95
  })
87
96
  }));
88
- }
97
+ }
98
+ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
99
+ // ----------------------------- Warning --------------------------------
100
+ // | These PropTypes are generated from the TypeScript type definitions |
101
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
102
+ // ----------------------------------------------------------------------
103
+ /**
104
+ * The props used for each component slot.
105
+ * @default {}
106
+ */
107
+ slotProps: _propTypes.default.object,
108
+ /**
109
+ * Overridable component slots.
110
+ * @default {}
111
+ */
112
+ slots: _propTypes.default.object
113
+ } : void 0;
@@ -47,7 +47,6 @@ const PieArcLabelRoot = (0, _styles.styled)('text', {
47
47
  theme
48
48
  }) => ({
49
49
  fill: theme.palette.text.primary,
50
- alignmentBaseline: 'baseline',
51
50
  textAnchor: 'middle'
52
51
  }));
53
52
  function PieArcLabel(props) {
@@ -4,14 +4,26 @@ import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
4
4
  import { PieSeriesType } from '../models/seriesType';
5
5
  import { MakeOptional } from '../models/helpers';
6
6
  import { ChartsTooltipProps } from '../ChartsTooltip';
7
- import { ChartsLegendProps } from '../ChartsLegend';
7
+ import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
8
8
  import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
9
+ import { PiePlotSlotComponentProps, PiePlotSlotsComponent } from './PiePlot';
9
10
  import { PieValueType } from '../models/seriesType/pie';
10
- export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, ChartsAxisProps {
11
+ import { ChartsAxisSlotsComponent, ChartsAxisSlotComponentProps } from '../models/axis';
12
+ export interface PieChartSlotsComponent extends ChartsAxisSlotsComponent, PiePlotSlotsComponent, ChartsLegendSlotsComponent {
13
+ }
14
+ export interface PieChartSlotComponentProps extends ChartsAxisSlotComponentProps, PiePlotSlotComponentProps, ChartsLegendSlotComponentProps {
15
+ }
16
+ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
11
17
  series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>[];
12
18
  tooltip?: ChartsTooltipProps;
13
19
  axisHighlight?: ChartsAxisHighlightProps;
14
20
  legend?: ChartsLegendProps;
21
+ slots?: PieChartSlotsComponent;
22
+ /**
23
+ * The props used for each component slot.
24
+ * @default {}
25
+ */
26
+ slotProps?: PieChartSlotComponentProps;
15
27
  }
16
28
  declare function PieChart(props: PieChartProps): React.JSX.Element;
17
29
  declare namespace PieChart {