@mui/x-charts 8.27.4 → 8.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/BarChart/AnimatedBarElement.d.ts +1 -1
  2. package/BarChart/BarElement.d.ts +2 -2
  3. package/BarChart/BarElement.js +4 -2
  4. package/BarChart/BarLabel/BarLabel.js +4 -0
  5. package/BarChart/BarLabel/BarLabel.types.d.ts +2 -2
  6. package/BarChart/BarLabel/BarLabelItem.js +6 -2
  7. package/BarChart/BarLabel/barLabelClasses.d.ts +22 -2
  8. package/BarChart/BarLabel/barLabelClasses.js +19 -0
  9. package/BarChart/BarPlot.js +1 -2
  10. package/BarChart/barClasses.d.ts +21 -1
  11. package/BarChart/barClasses.js +9 -3
  12. package/BarChart/barElementClasses.d.ts +22 -10
  13. package/BarChart/barElementClasses.js +19 -0
  14. package/BarChart/index.d.ts +1 -1
  15. package/BarChart/index.js +1 -8
  16. package/CHANGELOG.md +143 -0
  17. package/LineChart/AreaElement.d.ts +17 -1
  18. package/LineChart/AreaElement.js +27 -4
  19. package/LineChart/AreaPlot.js +10 -4
  20. package/LineChart/CircleMarkElement.js +10 -2
  21. package/LineChart/LineElement.d.ts +17 -1
  22. package/LineChart/LineElement.js +27 -4
  23. package/LineChart/LineHighlightElement.d.ts +12 -0
  24. package/LineChart/LineHighlightElement.js +22 -3
  25. package/LineChart/LinePlot.js +11 -5
  26. package/LineChart/MarkElement.js +10 -2
  27. package/LineChart/MarkPlot.js +15 -3
  28. package/LineChart/index.d.ts +3 -1
  29. package/LineChart/index.js +10 -2
  30. package/LineChart/lineClasses.d.ts +34 -0
  31. package/LineChart/lineClasses.js +32 -0
  32. package/LineChart/markElementClasses.d.ts +26 -10
  33. package/LineChart/markElementClasses.js +19 -0
  34. package/PieChart/FocusedPieArc.js +4 -1
  35. package/PieChart/PieArc.d.ts +15 -12
  36. package/PieChart/PieArc.js +25 -7
  37. package/PieChart/PieArcLabel.d.ts +16 -2
  38. package/PieChart/PieArcLabel.js +28 -5
  39. package/PieChart/PieArcLabelPlot.js +6 -1
  40. package/PieChart/PieArcPlot.js +6 -1
  41. package/PieChart/PiePlot.d.ts +1 -0
  42. package/PieChart/PiePlot.js +4 -1
  43. package/PieChart/pieClasses.d.ts +22 -1
  44. package/PieChart/pieClasses.js +10 -3
  45. package/RadarChart/RadarAxis/RadarAxis.js +6 -4
  46. package/RadarChart/RadarAxis/radarAxisClasses.d.ts +27 -3
  47. package/RadarChart/RadarAxis/radarAxisClasses.js +19 -0
  48. package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +6 -13
  49. package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.d.ts +29 -4
  50. package/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.js +31 -1
  51. package/RadarChart/RadarGrid/RadarGrid.js +8 -1
  52. package/RadarChart/RadarGrid/radarGridClasses.d.ts +27 -3
  53. package/RadarChart/RadarGrid/radarGridClasses.js +19 -0
  54. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +7 -1
  55. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +8 -2
  56. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +9 -3
  57. package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.d.ts +26 -3
  58. package/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.js +19 -0
  59. package/RadarChart/index.d.ts +3 -1
  60. package/RadarChart/index.js +9 -1
  61. package/RadarChart/radarClasses.d.ts +32 -0
  62. package/RadarChart/radarClasses.js +36 -0
  63. package/ScatterChart/BatchScatter.d.ts +2 -1
  64. package/ScatterChart/BatchScatter.js +5 -3
  65. package/ScatterChart/FocusedScatterMark.d.ts +4 -1
  66. package/ScatterChart/FocusedScatterMark.js +12 -2
  67. package/ScatterChart/Scatter.d.ts +1 -1
  68. package/ScatterChart/Scatter.js +6 -2
  69. package/ScatterChart/ScatterPlot.d.ts +2 -1
  70. package/ScatterChart/ScatterPlot.js +16 -2
  71. package/ScatterChart/index.d.ts +2 -2
  72. package/ScatterChart/scatterClasses.d.ts +14 -2
  73. package/ScatterChart/scatterClasses.js +10 -4
  74. package/esm/BarChart/AnimatedBarElement.d.ts +1 -1
  75. package/esm/BarChart/BarElement.d.ts +2 -2
  76. package/esm/BarChart/BarElement.js +4 -2
  77. package/esm/BarChart/BarLabel/BarLabel.js +4 -0
  78. package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -2
  79. package/esm/BarChart/BarLabel/BarLabelItem.js +6 -2
  80. package/esm/BarChart/BarLabel/barLabelClasses.d.ts +22 -2
  81. package/esm/BarChart/BarLabel/barLabelClasses.js +20 -0
  82. package/esm/BarChart/BarPlot.js +2 -3
  83. package/esm/BarChart/barClasses.d.ts +21 -1
  84. package/esm/BarChart/barClasses.js +9 -3
  85. package/esm/BarChart/barElementClasses.d.ts +22 -10
  86. package/esm/BarChart/barElementClasses.js +20 -0
  87. package/esm/BarChart/index.d.ts +1 -1
  88. package/esm/BarChart/index.js +1 -1
  89. package/esm/LineChart/AreaElement.d.ts +17 -1
  90. package/esm/LineChart/AreaElement.js +29 -4
  91. package/esm/LineChart/AreaPlot.js +11 -5
  92. package/esm/LineChart/CircleMarkElement.js +11 -3
  93. package/esm/LineChart/LineElement.d.ts +17 -1
  94. package/esm/LineChart/LineElement.js +29 -4
  95. package/esm/LineChart/LineHighlightElement.d.ts +12 -0
  96. package/esm/LineChart/LineHighlightElement.js +24 -3
  97. package/esm/LineChart/LinePlot.js +12 -6
  98. package/esm/LineChart/MarkElement.js +11 -3
  99. package/esm/LineChart/MarkPlot.js +15 -3
  100. package/esm/LineChart/index.d.ts +3 -1
  101. package/esm/LineChart/index.js +2 -1
  102. package/esm/LineChart/lineClasses.d.ts +34 -0
  103. package/esm/LineChart/lineClasses.js +23 -0
  104. package/esm/LineChart/markElementClasses.d.ts +26 -10
  105. package/esm/LineChart/markElementClasses.js +20 -0
  106. package/esm/PieChart/FocusedPieArc.js +4 -1
  107. package/esm/PieChart/PieArc.d.ts +15 -12
  108. package/esm/PieChart/PieArc.js +27 -7
  109. package/esm/PieChart/PieArcLabel.d.ts +16 -2
  110. package/esm/PieChart/PieArcLabel.js +30 -5
  111. package/esm/PieChart/PieArcLabelPlot.js +6 -1
  112. package/esm/PieChart/PieArcPlot.js +6 -1
  113. package/esm/PieChart/PiePlot.d.ts +1 -0
  114. package/esm/PieChart/PiePlot.js +4 -1
  115. package/esm/PieChart/pieClasses.d.ts +22 -1
  116. package/esm/PieChart/pieClasses.js +10 -3
  117. package/esm/RadarChart/RadarAxis/RadarAxis.js +7 -5
  118. package/esm/RadarChart/RadarAxis/radarAxisClasses.d.ts +27 -3
  119. package/esm/RadarChart/RadarAxis/radarAxisClasses.js +20 -0
  120. package/esm/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +7 -14
  121. package/esm/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.d.ts +29 -4
  122. package/esm/RadarChart/RadarAxisHighlight/radarAxisHighlightClasses.js +30 -1
  123. package/esm/RadarChart/RadarGrid/RadarGrid.js +9 -2
  124. package/esm/RadarChart/RadarGrid/radarGridClasses.d.ts +27 -3
  125. package/esm/RadarChart/RadarGrid/radarGridClasses.js +20 -0
  126. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +8 -2
  127. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +8 -2
  128. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +9 -3
  129. package/esm/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.d.ts +26 -3
  130. package/esm/RadarChart/RadarSeriesPlot/radarSeriesPlotClasses.js +20 -0
  131. package/esm/RadarChart/index.d.ts +3 -1
  132. package/esm/RadarChart/index.js +2 -1
  133. package/esm/RadarChart/radarClasses.d.ts +32 -0
  134. package/esm/RadarChart/radarClasses.js +27 -0
  135. package/esm/ScatterChart/BatchScatter.d.ts +2 -1
  136. package/esm/ScatterChart/BatchScatter.js +4 -3
  137. package/esm/ScatterChart/FocusedScatterMark.d.ts +4 -1
  138. package/esm/ScatterChart/FocusedScatterMark.js +11 -1
  139. package/esm/ScatterChart/Scatter.d.ts +1 -1
  140. package/esm/ScatterChart/Scatter.js +6 -2
  141. package/esm/ScatterChart/ScatterPlot.d.ts +2 -1
  142. package/esm/ScatterChart/ScatterPlot.js +16 -2
  143. package/esm/ScatterChart/index.d.ts +2 -2
  144. package/esm/ScatterChart/scatterClasses.d.ts +14 -2
  145. package/esm/ScatterChart/scatterClasses.js +10 -4
  146. package/esm/index.js +1 -1
  147. package/esm/themeAugmentation/components.d.ts +29 -1
  148. package/esm/themeAugmentation/overrides.d.ts +17 -1
  149. package/index.js +1 -1
  150. package/package.json +3 -3
  151. package/themeAugmentation/components.d.ts +29 -1
  152. package/themeAugmentation/overrides.d.ts +17 -1
@@ -2,22 +2,24 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
5
+ const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick", "className"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled } from '@mui/material/styles';
9
- import { LineElement, lineElementClasses } from "./LineElement.js";
9
+ import clsx from 'clsx';
10
+ import { LineElement } from "./LineElement.js";
10
11
  import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
11
12
  import { useXAxes, useYAxes } from "../hooks/index.js";
12
13
  import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
13
14
  import { useLinePlotData } from "./useLinePlotData.js";
14
15
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
16
+ import { lineClasses, useUtilityClasses } from "./lineClasses.js";
15
17
  import { jsx as _jsx } from "react/jsx-runtime";
16
18
  const LinePlotRoot = styled('g', {
17
- name: 'MuiAreaPlot',
19
+ name: 'MuiLinePlot',
18
20
  slot: 'Root'
19
21
  })({
20
- [`& .${lineElementClasses.root}`]: {
22
+ [`& .${lineClasses.line}`]: {
21
23
  transitionProperty: 'opacity, fill',
22
24
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
23
25
  transitionTimingFunction: ANIMATION_TIMING_FUNCTION
@@ -48,13 +50,17 @@ function LinePlot(props) {
48
50
  slots,
49
51
  slotProps,
50
52
  skipAnimation: inSkipAnimation,
51
- onItemClick
53
+ onItemClick,
54
+ className
52
55
  } = props,
53
56
  other = _objectWithoutPropertiesLoose(props, _excluded);
54
57
  const isZoomInteracting = useInternalIsZoomInteracting();
55
58
  const skipAnimation = useSkipAnimation(isZoomInteracting || inSkipAnimation);
56
59
  const completedData = useAggregatedData();
57
- return /*#__PURE__*/_jsx(LinePlotRoot, _extends({}, other, {
60
+ const classes = useUtilityClasses();
61
+ return /*#__PURE__*/_jsx(LinePlotRoot, _extends({
62
+ className: clsx(classes.linePlot, className)
63
+ }, other, {
58
64
  children: completedData.map(({
59
65
  d,
60
66
  seriesId,
@@ -10,7 +10,8 @@ import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-
10
10
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
11
11
  import { getSymbol } from "../internals/getSymbol.js";
12
12
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
13
- import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
13
+ import { markElementClasses, useUtilityClasses as useDeprecatedUtilityClasses } from "./markElementClasses.js";
14
+ import { useUtilityClasses as useLineUtilityClasses } from "./lineClasses.js";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  const MarkElementPath = styled('path', {
16
17
  name: 'MuiMarkElement',
@@ -64,14 +65,18 @@ function MarkElement(props) {
64
65
  isFaded,
65
66
  skipAnimation
66
67
  };
67
- const classes = useUtilityClasses(ownerState);
68
+ const classes = useLineUtilityClasses({
69
+ skipAnimation,
70
+ classes: innerClasses
71
+ });
72
+ const deprecatedClasses = useDeprecatedUtilityClasses(ownerState);
68
73
  return /*#__PURE__*/_jsx(MarkElementPath, _extends({}, other, {
69
74
  style: _extends({}, style, {
70
75
  transform: `translate(${x}px, ${y}px)`,
71
76
  transformOrigin: `${x}px ${y}px`
72
77
  }),
73
78
  ownerState: ownerState,
74
- className: classes.root,
79
+ className: `${classes.mark} ${deprecatedClasses.root}`,
75
80
  d: d3Symbol(d3SymbolsFill[getSymbol(shape)])(),
76
81
  onClick: onClick,
77
82
  cursor: onClick ? 'pointer' : 'unset',
@@ -79,6 +84,9 @@ function MarkElement(props) {
79
84
  }, interactionProps, {
80
85
  "data-highlighted": isHighlighted || undefined,
81
86
  "data-faded": isFaded || undefined,
87
+ "data-series-id": id,
88
+ "data-series": id,
89
+ "data-index": dataIndex,
82
90
  opacity: hidden ? 0 : 1,
83
91
  strokeWidth: 2,
84
92
  stroke: color
@@ -2,9 +2,11 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
5
+ const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick", "className"];
6
6
  import PropTypes from 'prop-types';
7
7
  import * as React from 'react';
8
+ import { styled } from '@mui/material/styles';
9
+ import clsx from 'clsx';
8
10
  import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
9
11
  import { CircleMarkElement } from "./CircleMarkElement.js";
10
12
  import { MarkElement } from "./MarkElement.js";
@@ -13,7 +15,13 @@ import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugin
13
15
  import { selectorChartsHighlightXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
14
16
  import { useChartContext } from "../context/ChartProvider/index.js";
15
17
  import { useMarkPlotData } from "./useMarkPlotData.js";
18
+ import { useUtilityClasses } from "./lineClasses.js";
16
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
+ const MarkPlotRoot = styled('g', {
21
+ name: 'MuiMarkPlot',
22
+ slot: 'Root'
23
+ })({});
24
+
17
25
  /**
18
26
  * Demos:
19
27
  *
@@ -29,7 +37,8 @@ function MarkPlot(props) {
29
37
  slots,
30
38
  slotProps,
31
39
  skipAnimation: inSkipAnimation,
32
- onItemClick
40
+ onItemClick,
41
+ className
33
42
  } = props,
34
43
  other = _objectWithoutPropertiesLoose(props, _excluded);
35
44
  const isZoomInteracting = useInternalIsZoomInteracting();
@@ -63,7 +72,10 @@ function MarkPlot(props) {
63
72
  return rep;
64
73
  }, [xAxisHighlightIndexes]);
65
74
  const completedData = useMarkPlotData(xAxis, yAxis);
66
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
75
+ const classes = useUtilityClasses();
76
+ return /*#__PURE__*/_jsx(MarkPlotRoot, _extends({
77
+ className: clsx(classes.markPlot, className)
78
+ }, other, {
67
79
  children: completedData.map(({
68
80
  seriesId,
69
81
  clipId,
@@ -12,4 +12,6 @@ export * from "./FocusedLineMark.js";
12
12
  export * from "./LineHighlightElement.js";
13
13
  export * from "./LineChart.plugins.js";
14
14
  export type { MarkElementClasses, MarkElementClassKey } from "./markElementClasses.js";
15
- export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
15
+ export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
16
+ export { lineClasses } from "./lineClasses.js";
17
+ export type { LineClassKey, LineClasses } from "./lineClasses.js";
@@ -11,4 +11,5 @@ export * from "./MarkElement.js";
11
11
  export * from "./FocusedLineMark.js";
12
12
  export * from "./LineHighlightElement.js";
13
13
  export * from "./LineChart.plugins.js";
14
- export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
14
+ export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
15
+ export { lineClasses } from "./lineClasses.js";
@@ -0,0 +1,34 @@
1
+ import { type SeriesId } from "../models/seriesType/common.js";
2
+ export interface LineClasses {
3
+ /** Styles applied to the area element. */
4
+ area: string;
5
+ /** Styles applied to the line element. */
6
+ line: string;
7
+ /** Styles applied to the mark element. */
8
+ mark: string;
9
+ /** Styles applied to a mark element when it is animated. */
10
+ markAnimate: string;
11
+ /** Styles applied to the highlight element. */
12
+ highlight: string;
13
+ /** Styles applied to the AreaPlot root element. */
14
+ areaPlot: string;
15
+ /** Styles applied to the LinePlot root element. */
16
+ linePlot: string;
17
+ /** Styles applied to the MarkPlot root element. */
18
+ markPlot: string;
19
+ }
20
+ export type LineClassKey = keyof LineClasses;
21
+ export interface MarkElementOwnerState {
22
+ id: SeriesId;
23
+ isFaded: boolean;
24
+ isHighlighted: boolean;
25
+ classes?: Partial<LineClasses>;
26
+ skipAnimation?: boolean;
27
+ }
28
+ export declare function getLineUtilityClass(slot: string): string;
29
+ export declare const lineClasses: LineClasses;
30
+ export interface UseUtilityClassesOptions {
31
+ skipAnimation?: boolean;
32
+ classes?: Partial<LineClasses>;
33
+ }
34
+ export declare const useUtilityClasses: (options?: UseUtilityClassesOptions) => Record<"line" | "area" | "mark" | "highlight" | "areaPlot" | "linePlot" | "markPlot", string>;
@@ -0,0 +1,23 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import composeClasses from '@mui/utils/composeClasses';
3
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
4
+ export function getLineUtilityClass(slot) {
5
+ return generateUtilityClass('MuiLineChart', slot);
6
+ }
7
+ export const lineClasses = generateUtilityClasses('MuiLineChart', ['area', 'line', 'mark', 'markAnimate', 'highlight', 'areaPlot', 'linePlot', 'markPlot']);
8
+ export const useUtilityClasses = options => {
9
+ const {
10
+ skipAnimation,
11
+ classes
12
+ } = options ?? {};
13
+ const slots = {
14
+ area: ['area'],
15
+ line: ['line'],
16
+ mark: ['mark', !skipAnimation && 'markAnimate'],
17
+ highlight: ['highlight'],
18
+ areaPlot: ['areaPlot'],
19
+ linePlot: ['linePlot'],
20
+ markPlot: ['markPlot']
21
+ };
22
+ return composeClasses(slots, getLineUtilityClass, classes);
23
+ };
@@ -1,27 +1,43 @@
1
- import { type SeriesId } from "../models/seriesType/common.js";
1
+ import type { MarkElementOwnerState } from "./lineClasses.js";
2
+ export { type MarkElementOwnerState };
3
+ /**
4
+ * @deprecated Use `LineClasses` instead.
5
+ */
2
6
  export interface MarkElementClasses {
3
- /** Styles applied to the root element. */
7
+ /**
8
+ * Styles applied to the root element.
9
+ * @deprecated Use `lineClasses.mark` instead.
10
+ */
4
11
  root: string;
5
12
  /** Styles applied to the root element when highlighted. */
6
13
  highlighted: string;
7
14
  /** Styles applied to the root element when faded. */
8
15
  faded: string;
9
- /** Styles applied to the root element when animation is not skipped. */
16
+ /**
17
+ * Styles applied to the root element when animation is not skipped.
18
+ * @deprecated Use `lineClasses.markAnimate` instead.
19
+ */
10
20
  animate: string;
11
21
  /**
12
22
  * Styles applied to the root element for a specified series.
13
23
  * Needs to be suffixed with the series ID: `.${markElementClasses.series}-${seriesId}`.
24
+ * @deprecated Use `[data-series="${seriesId}"]` selector instead.
14
25
  */
15
26
  series: string;
16
27
  }
28
+ /**
29
+ * @deprecated Use `LineClassKey` instead.
30
+ */
17
31
  export type MarkElementClassKey = keyof MarkElementClasses;
18
- export interface MarkElementOwnerState {
19
- id: SeriesId;
20
- isFaded: boolean;
21
- isHighlighted: boolean;
22
- classes?: Partial<MarkElementClasses>;
23
- skipAnimation?: boolean;
24
- }
32
+ /**
33
+ * @deprecated Use `getLineUtilityClass` instead.
34
+ */
25
35
  export declare function getMarkElementUtilityClass(slot: string): string;
36
+ /**
37
+ * @deprecated Use `lineClasses` instead.
38
+ */
26
39
  export declare const markElementClasses: MarkElementClasses;
40
+ /**
41
+ * @deprecated Use `useUtilityClasses` instead.
42
+ */
27
43
  export declare const useUtilityClasses: (ownerState: MarkElementOwnerState) => Record<"root", string>;
@@ -1,10 +1,30 @@
1
1
  import composeClasses from '@mui/utils/composeClasses';
2
2
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
3
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
4
+
5
+ /**
6
+ * @deprecated Use `LineClasses` instead.
7
+ */
8
+
9
+ /**
10
+ * @deprecated Use `LineClassKey` instead.
11
+ */
12
+
13
+ /**
14
+ * @deprecated Use `getLineUtilityClass` instead.
15
+ */
4
16
  export function getMarkElementUtilityClass(slot) {
5
17
  return generateUtilityClass('MuiMarkElement', slot);
6
18
  }
19
+
20
+ /**
21
+ * @deprecated Use `lineClasses` instead.
22
+ */
7
23
  export const markElementClasses = generateUtilityClasses('MuiMarkElement', ['root', 'highlighted', 'faded', 'animate', 'series']);
24
+
25
+ /**
26
+ * @deprecated Use `useUtilityClasses` instead.
27
+ */
8
28
  export const useUtilityClasses = ownerState => {
9
29
  const {
10
30
  classes,
@@ -4,10 +4,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["arcLabelRadius"];
6
6
  import * as React from 'react';
7
+ import clsx from 'clsx';
7
8
  import { useTheme } from '@mui/material/styles';
8
9
  import { useFocusedItem } from "../hooks/useFocusedItem.js";
9
10
  import { usePieSeriesContext, usePieSeriesLayout } from "../hooks/usePieSeries.js";
10
11
  import { PieArc, pieArcClasses } from "./PieArc.js";
12
+ import { useUtilityClasses } from "./pieClasses.js";
11
13
  import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
12
14
  import { getModifiedArcProperties } from "./dataTransform/getModifiedArcProperties.js";
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -20,6 +22,7 @@ export function FocusedPieArc(props) {
20
22
  isFaded
21
23
  } = useItemHighlighted(focusedItem);
22
24
  const pieSeries = usePieSeriesContext();
25
+ const classes = useUtilityClasses();
23
26
  if (focusedItem === null || focusedItem.type !== 'pie' || !pieSeries) {
24
27
  return null;
25
28
  }
@@ -44,7 +47,7 @@ export function FocusedPieArc(props) {
44
47
  skipAnimation: true,
45
48
  stroke: (theme.vars ?? theme).palette.text.primary,
46
49
  id: series.id,
47
- className: pieArcClasses.focusIndicator,
50
+ className: clsx(classes.focusIndicator, pieArcClasses.focusIndicator),
48
51
  dataIndex: focusedItem.dataIndex,
49
52
  isFaded: false,
50
53
  isHighlighted: false,
@@ -1,5 +1,9 @@
1
1
  import * as React from 'react';
2
- import { type PieItemId } from "../models/index.js";
2
+ import { type PieArcOwnerState } from "./pieClasses.js";
3
+ export { type PieArcOwnerState };
4
+ /**
5
+ * @deprecated Use `PieClasses` instead.
6
+ */
3
7
  export interface PieArcClasses {
4
8
  /** Styles applied to the root element. */
5
9
  root: string;
@@ -15,20 +19,19 @@ export interface PieArcClasses {
15
19
  /** Styles applied to the focus indicator element. */
16
20
  focusIndicator: string;
17
21
  }
22
+ /**
23
+ * @deprecated Use `PieClassKey` instead.
24
+ */
18
25
  export type PieArcClassKey = keyof PieArcClasses;
19
- interface PieArcOwnerState {
20
- id: PieItemId;
21
- dataIndex: number;
22
- color: string;
23
- isFaded: boolean;
24
- isHighlighted: boolean;
25
- isFocused: boolean;
26
- stroke?: string;
27
- classes?: Partial<PieArcClasses>;
28
- }
26
+ /**
27
+ * @deprecated Use `getPieUtilityClass` instead.
28
+ */
29
29
  export declare function getPieArcUtilityClass(slot: string): string;
30
+ /**
31
+ * @deprecated Use `pieClasses` instead.
32
+ */
30
33
  export declare const pieArcClasses: PieArcClasses;
31
- export type PieArcProps = Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & PieArcOwnerState & {
34
+ export type PieArcProps = Omit<React.SVGProps<SVGPathElement>, 'id' | 'ref'> & PieArcOwnerState & {
32
35
  cornerRadius: number;
33
36
  endAngle: number;
34
37
  innerRadius: number;
@@ -13,11 +13,31 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
13
13
  import { useAnimatePieArc } from "../hooks/index.js";
14
14
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
15
15
  import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
16
+ import { useUtilityClasses as usePieUtilityClasses } from "./pieClasses.js";
17
+
18
+ /**
19
+ * @deprecated Use `PieClasses` instead.
20
+ */
21
+
22
+ /**
23
+ * @deprecated Use `PieClassKey` instead.
24
+ */
16
25
  import { jsx as _jsx } from "react/jsx-runtime";
26
+ /**
27
+ * @deprecated Use `getPieUtilityClass` instead.
28
+ */
17
29
  export function getPieArcUtilityClass(slot) {
18
30
  return generateUtilityClass('MuiPieArc', slot);
19
31
  }
32
+
33
+ /**
34
+ * @deprecated Use `pieClasses` instead.
35
+ */
20
36
  export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded', 'series', 'focusIndicator']);
37
+
38
+ /**
39
+ * @deprecated Use `useUtilityClasses` instead.
40
+ */
21
41
  const useUtilityClasses = ownerState => {
22
42
  const {
23
43
  classes,
@@ -33,8 +53,7 @@ const useUtilityClasses = ownerState => {
33
53
  };
34
54
  const PieArcRoot = styled('path', {
35
55
  name: 'MuiPieArc',
36
- slot: 'Root',
37
- overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
56
+ slot: 'Root'
38
57
  })({
39
58
  transitionProperty: 'opacity, fill, filter',
40
59
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
@@ -73,7 +92,8 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
73
92
  isHighlighted,
74
93
  isFocused
75
94
  };
76
- const classes = useUtilityClasses(ownerState);
95
+ const classes = usePieUtilityClasses(ownerState);
96
+ const deprecatedClasses = useUtilityClasses(ownerState);
77
97
  const interactionProps = useInteractionItemProps({
78
98
  type: 'pie',
79
99
  seriesId: id,
@@ -93,10 +113,10 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
93
113
  onClick: onClick,
94
114
  cursor: onClick ? 'pointer' : 'unset',
95
115
  ownerState: ownerState,
96
- className: clsx(classes.root, className),
97
- fill: ownerState.color,
98
- opacity: ownerState.isFaded ? 0.3 : 1,
99
- filter: ownerState.isHighlighted ? 'brightness(120%)' : 'none',
116
+ className: clsx(classes.arc, deprecatedClasses.root, className),
117
+ fill: color,
118
+ opacity: isFaded ? 0.3 : 1,
119
+ filter: isHighlighted ? 'brightness(120%)' : 'none',
100
120
  stroke: stroke,
101
121
  strokeWidth: 1,
102
122
  strokeLinejoin: "round",
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react';
2
- import { type PieItemId } from "../models/seriesType/pie.js";
2
+ import { type PieItemId } from "../models/index.js";
3
+ /**
4
+ * @deprecated Use `PieClasses` instead.
5
+ */
3
6
  export interface PieArcLabelClasses {
4
7
  /** Styles applied to the root element. */
5
8
  root: string;
@@ -7,7 +10,9 @@ export interface PieArcLabelClasses {
7
10
  highlighted: string;
8
11
  /** Styles applied to the root element when faded. */
9
12
  faded: string;
10
- /** Styles applied to the root element when animation is not skipped. */
13
+ /** Styles applied to the root element when animation is not skipped.
14
+ * @deprecated Use the `animate` class from `./pieClasses` instead.
15
+ */
11
16
  animate: string;
12
17
  /**
13
18
  * Styles applied to the root element for a specified series.
@@ -15,6 +20,9 @@ export interface PieArcLabelClasses {
15
20
  */
16
21
  series: string;
17
22
  }
23
+ /**
24
+ * @deprecated Use `PieClassKey` instead.
25
+ */
18
26
  export type PieArcLabelClassKey = keyof PieArcLabelClasses;
19
27
  interface PieArcLabelOwnerState {
20
28
  id: PieItemId;
@@ -24,7 +32,13 @@ interface PieArcLabelOwnerState {
24
32
  skipAnimation: boolean;
25
33
  classes?: Partial<PieArcLabelClasses>;
26
34
  }
35
+ /**
36
+ * @deprecated Use `getPieUtilityClass` instead.
37
+ */
27
38
  export declare function getPieArcLabelUtilityClass(slot: string): string;
39
+ /**
40
+ * @deprecated Use `pieClasses` instead.
41
+ */
28
42
  export declare const pieArcLabelClasses: PieArcLabelClasses;
29
43
  export type PieArcLabelProps = PieArcLabelOwnerState & Omit<React.SVGProps<SVGTextElement>, 'ref' | 'color' | 'id'> & {
30
44
  startAngle: number;
@@ -2,20 +2,41 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "skipAnimation", "hidden"];
5
+ const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "skipAnimation", "hidden", "className"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import clsx from 'clsx';
8
9
  import composeClasses from '@mui/utils/composeClasses';
9
10
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
10
11
  import { styled } from '@mui/material/styles';
11
12
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
12
13
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
13
14
  import { useAnimatePieArcLabel } from "../hooks/animation/useAnimatePieArcLabel.js";
15
+ import { pieClasses, useUtilityClasses as usePieUtilityClasses } from "./pieClasses.js";
16
+
17
+ /**
18
+ * @deprecated Use `PieClasses` instead.
19
+ */
20
+
21
+ /**
22
+ * @deprecated Use `PieClassKey` instead.
23
+ */
14
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ /**
26
+ * @deprecated Use `getPieUtilityClass` instead.
27
+ */
15
28
  export function getPieArcLabelUtilityClass(slot) {
16
29
  return generateUtilityClass('MuiPieArcLabel', slot);
17
30
  }
31
+
32
+ /**
33
+ * @deprecated Use `pieClasses` instead.
34
+ */
18
35
  export const pieArcLabelClasses = generateUtilityClasses('MuiPieArcLabel', ['root', 'highlighted', 'faded', 'animate', 'series']);
36
+
37
+ /**
38
+ * @deprecated Use `useUtilityClasses` instead.
39
+ */
19
40
  const useUtilityClasses = ownerState => {
20
41
  const {
21
42
  classes,
@@ -45,7 +66,7 @@ const PieArcLabelRoot = styled('text', {
45
66
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
46
67
  transitionProperty: 'opacity',
47
68
  transitionTimingFunction: ANIMATION_TIMING_FUNCTION,
48
- [`&.${pieArcLabelClasses.animate}`]: {
69
+ [`&.${pieClasses.animate}`]: {
49
70
  animationDuration: `${ANIMATION_DURATION_MS}ms`
50
71
  },
51
72
  '@keyframes animate-opacity': {
@@ -68,7 +89,8 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
68
89
  isHighlighted,
69
90
  isFaded,
70
91
  skipAnimation,
71
- hidden
92
+ hidden,
93
+ className
72
94
  } = props,
73
95
  other = _objectWithoutPropertiesLoose(props, _excluded);
74
96
  const ownerState = {
@@ -79,7 +101,8 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
79
101
  isHighlighted,
80
102
  skipAnimation
81
103
  };
82
- const classes = useUtilityClasses(ownerState);
104
+ const classes = usePieUtilityClasses(ownerState);
105
+ const deprecatedClasses = useUtilityClasses(ownerState);
83
106
  const animatedProps = useAnimatePieArcLabel({
84
107
  cornerRadius,
85
108
  startAngle,
@@ -91,7 +114,9 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
91
114
  ref
92
115
  });
93
116
  return /*#__PURE__*/_jsx(PieArcLabelRoot, _extends({
94
- className: classes.root
117
+ className: clsx(classes.arcLabel, deprecatedClasses.root, className),
118
+ "data-highlighted": isHighlighted || undefined,
119
+ "data-faded": isFaded || undefined
95
120
  }, other, animatedProps, {
96
121
  opacity: hidden ? 0 : 1,
97
122
  children: formattedArcLabel
@@ -5,6 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
5
5
  const _excluded = ["arcLabel", "arcLabelMinAngle", "arcLabelRadius", "cornerRadius", "data", "faded", "highlighted", "id", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "slotProps", "slots"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { styled } from '@mui/material/styles';
8
9
  import { useTransformData } from "./dataTransform/useTransformData.js";
9
10
  import { PieArcLabel } from "./PieArcLabel.js";
10
11
  import { getLabel } from "../internals/getLabel.js";
@@ -31,6 +32,10 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
31
32
  }));
32
33
  }
33
34
  }
35
+ const PieArcLabelPlotRoot = styled('g', {
36
+ name: 'MuiPieArcLabelPlot',
37
+ slot: 'Root'
38
+ })();
34
39
  function PieArcLabelPlot(props) {
35
40
  const {
36
41
  arcLabel,
@@ -66,7 +71,7 @@ function PieArcLabelPlot(props) {
66
71
  return null;
67
72
  }
68
73
  const ArcLabel = slots?.pieArcLabel ?? PieArcLabel;
69
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
74
+ return /*#__PURE__*/_jsx(PieArcLabelPlotRoot, _extends({}, other, {
70
75
  children: transformedData.map(item => /*#__PURE__*/_jsx(ArcLabel, _extends({
71
76
  startAngle: item.startAngle,
72
77
  endAngle: item.endAngle,
@@ -5,9 +5,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
5
5
  const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlighted", "faded", "data", "onItemClick", "skipAnimation"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { styled } from '@mui/material/styles';
8
9
  import { PieArc } from "./PieArc.js";
9
10
  import { useTransformData } from "./dataTransform/useTransformData.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ const PieArcPlotRoot = styled('g', {
13
+ name: 'MuiPieArcPlot',
14
+ slot: 'Root'
15
+ })();
11
16
  function PieArcPlot(props) {
12
17
  const {
13
18
  slots,
@@ -40,7 +45,7 @@ function PieArcPlot(props) {
40
45
  return null;
41
46
  }
42
47
  const Arc = slots?.pieArc ?? PieArc;
43
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
48
+ return /*#__PURE__*/_jsx(PieArcPlotRoot, _extends({}, other, {
44
49
  children: transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
45
50
  startAngle: item.startAngle,
46
51
  endAngle: item.endAngle,
@@ -3,6 +3,7 @@ import { type PieArcLabelPlotSlots, type PieArcLabelPlotSlotProps } from "./PieA
3
3
  export interface PiePlotSlots extends PieArcPlotSlots, PieArcLabelPlotSlots {}
4
4
  export interface PiePlotSlotProps extends PieArcPlotSlotProps, PieArcLabelPlotSlotProps {}
5
5
  export interface PiePlotProps extends Pick<PieArcPlotProps, 'skipAnimation' | 'onItemClick'> {
6
+ className?: string;
6
7
  /**
7
8
  * Overridable component slots.
8
9
  * @default {}
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import clsx from 'clsx';
3
4
  import PropTypes from 'prop-types';
4
5
  import { PieArcPlot } from "./PieArcPlot.js";
5
6
  import { PieArcLabelPlot } from "./PieArcLabelPlot.js";
@@ -22,7 +23,8 @@ function PiePlot(props) {
22
23
  skipAnimation: inSkipAnimation,
23
24
  slots,
24
25
  slotProps,
25
- onItemClick
26
+ onItemClick,
27
+ className
26
28
  } = props;
27
29
  const seriesData = usePieSeriesContext();
28
30
  const seriesLayout = usePieSeriesLayout();
@@ -36,6 +38,7 @@ function PiePlot(props) {
36
38
  seriesOrder
37
39
  } = seriesData;
38
40
  return /*#__PURE__*/_jsxs("g", {
41
+ className: clsx(classes.root, className),
39
42
  children: [seriesOrder.map(seriesId => {
40
43
  const {
41
44
  cornerRadius,