@mui/x-charts 8.5.2 → 8.6.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 (188) hide show
  1. package/BarChart/AnimatedBarElement.js +3 -1
  2. package/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
  3. package/BarChart/BarLabel/BarLabelPlot.js +33 -25
  4. package/BarChart/BarPlot.js +55 -40
  5. package/BarChart/barClasses.d.ts +12 -0
  6. package/BarChart/barClasses.js +25 -0
  7. package/BarChart/index.d.ts +3 -1
  8. package/BarChart/index.js +23 -1
  9. package/BarChart/types.d.ts +5 -1
  10. package/CHANGELOG.md +203 -11
  11. package/ChartsLegend/ChartsLegend.d.ts +1 -0
  12. package/ChartsLegend/ChartsLegend.js +2 -0
  13. package/ChartsLegend/ContinuousColorLegend.d.ts +1 -0
  14. package/ChartsLegend/PiecewiseColorLegend.d.ts +1 -0
  15. package/ChartsLegend/chartsLegendClasses.d.ts +3 -1
  16. package/ChartsLegend/chartsLegendClasses.js +2 -1
  17. package/ChartsSurface/ChartsSurface.d.ts +1 -1
  18. package/ChartsXAxis/ChartsXAxis.js +4 -108
  19. package/ChartsXAxis/getVisibleLabels.d.ts +14 -0
  20. package/ChartsXAxis/getVisibleLabels.js +71 -0
  21. package/ChartsXAxis/shortenLabels.d.ts +4 -0
  22. package/ChartsXAxis/shortenLabels.js +48 -0
  23. package/ChartsYAxis/ChartsYAxis.js +2 -39
  24. package/ChartsYAxis/shortenLabels.d.ts +4 -0
  25. package/ChartsYAxis/shortenLabels.js +46 -0
  26. package/LineChart/AnimatedArea.js +4 -1
  27. package/LineChart/AnimatedLine.js +4 -1
  28. package/LineChart/CircleMarkElement.js +4 -1
  29. package/LineChart/MarkElement.js +4 -1
  30. package/LineChart/MarkPlot.js +1 -0
  31. package/PieChart/PieArc.js +3 -1
  32. package/PieChart/PiePlot.js +6 -0
  33. package/PieChart/index.d.ts +3 -1
  34. package/PieChart/index.js +18 -1
  35. package/PieChart/pieClasses.d.ts +12 -0
  36. package/PieChart/pieClasses.js +24 -0
  37. package/ScatterChart/Scatter.d.ts +2 -0
  38. package/ScatterChart/Scatter.js +9 -1
  39. package/ScatterChart/index.d.ts +3 -1
  40. package/ScatterChart/index.js +16 -1
  41. package/ScatterChart/scatterClasses.d.ts +8 -0
  42. package/ScatterChart/scatterClasses.js +22 -0
  43. package/Toolbar/ToolbarButton.js +2 -0
  44. package/esm/BarChart/AnimatedBarElement.js +3 -1
  45. package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +2 -2
  46. package/esm/BarChart/BarLabel/BarLabelPlot.js +33 -25
  47. package/esm/BarChart/BarPlot.js +55 -40
  48. package/esm/BarChart/barClasses.d.ts +12 -0
  49. package/esm/BarChart/barClasses.js +15 -0
  50. package/esm/BarChart/index.d.ts +3 -1
  51. package/esm/BarChart/index.js +2 -1
  52. package/esm/BarChart/types.d.ts +5 -1
  53. package/esm/ChartsLegend/ChartsLegend.d.ts +1 -0
  54. package/esm/ChartsLegend/ChartsLegend.js +2 -0
  55. package/esm/ChartsLegend/ContinuousColorLegend.d.ts +1 -0
  56. package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +1 -0
  57. package/esm/ChartsLegend/chartsLegendClasses.d.ts +3 -1
  58. package/esm/ChartsLegend/chartsLegendClasses.js +2 -1
  59. package/esm/ChartsSurface/ChartsSurface.d.ts +1 -1
  60. package/esm/ChartsXAxis/ChartsXAxis.js +2 -106
  61. package/esm/ChartsXAxis/getVisibleLabels.d.ts +14 -0
  62. package/esm/ChartsXAxis/getVisibleLabels.js +67 -0
  63. package/esm/ChartsXAxis/shortenLabels.d.ts +4 -0
  64. package/esm/ChartsXAxis/shortenLabels.js +42 -0
  65. package/esm/ChartsYAxis/ChartsYAxis.js +1 -38
  66. package/esm/ChartsYAxis/shortenLabels.d.ts +4 -0
  67. package/esm/ChartsYAxis/shortenLabels.js +41 -0
  68. package/esm/LineChart/AnimatedArea.js +4 -1
  69. package/esm/LineChart/AnimatedLine.js +4 -1
  70. package/esm/LineChart/CircleMarkElement.js +4 -1
  71. package/esm/LineChart/MarkElement.js +4 -1
  72. package/esm/LineChart/MarkPlot.js +1 -0
  73. package/esm/PieChart/PieArc.js +3 -1
  74. package/esm/PieChart/PiePlot.js +6 -0
  75. package/esm/PieChart/index.d.ts +3 -1
  76. package/esm/PieChart/index.js +2 -1
  77. package/esm/PieChart/pieClasses.d.ts +12 -0
  78. package/esm/PieChart/pieClasses.js +15 -0
  79. package/esm/ScatterChart/Scatter.d.ts +2 -0
  80. package/esm/ScatterChart/Scatter.js +9 -1
  81. package/esm/ScatterChart/index.d.ts +3 -1
  82. package/esm/ScatterChart/index.js +2 -1
  83. package/esm/ScatterChart/scatterClasses.d.ts +8 -0
  84. package/esm/ScatterChart/scatterClasses.js +13 -0
  85. package/esm/Toolbar/ToolbarButton.js +2 -0
  86. package/esm/hooks/useItemHighlighted.js +2 -2
  87. package/esm/index.js +1 -1
  88. package/esm/internals/components/NotRendered.d.ts +9 -0
  89. package/esm/internals/components/NotRendered.js +10 -0
  90. package/esm/internals/createSeriesSelectorOfType.js +2 -2
  91. package/esm/internals/index.d.ts +1 -0
  92. package/esm/internals/index.js +1 -0
  93. package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +3 -29
  94. package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +1 -1
  95. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +30 -2
  96. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +14 -724
  97. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +10 -10
  98. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +8 -2
  99. package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +3 -29
  100. package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +1 -1
  101. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +6 -54
  102. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +2 -2
  103. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +12 -208
  104. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +7 -66
  105. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +2 -3
  106. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +21 -6222
  107. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +4 -6
  108. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +50 -5
  109. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +18 -622
  110. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -3
  111. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +18 -230
  112. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +6 -6
  113. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +20 -4
  114. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +17 -2012
  115. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +2 -2
  116. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +39 -4
  117. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +3 -27
  118. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +1 -1
  119. package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +5 -40
  120. package/esm/internals/plugins/utils/selectors.d.ts +18 -6
  121. package/esm/internals/plugins/utils/selectors.js +3 -3
  122. package/esm/internals/store/useSelector.d.ts +2 -2
  123. package/esm/internals/store/useSelector.js +2 -2
  124. package/esm/locales/enUS.d.ts +3 -0
  125. package/esm/locales/enUS.js +8 -2
  126. package/esm/locales/frFR.d.ts +3 -0
  127. package/esm/locales/frFR.js +7 -0
  128. package/esm/locales/ptBR.d.ts +3 -0
  129. package/esm/locales/ptBR.js +7 -1
  130. package/esm/locales/ptPT.d.ts +3 -0
  131. package/esm/locales/ptPT.js +7 -1
  132. package/esm/locales/utils/chartsLocaleTextApi.d.ts +17 -0
  133. package/esm/locales/utils/getChartsLocalization.d.ts +3 -0
  134. package/esm/locales/utils/imageMimeTypes.d.ts +2 -0
  135. package/esm/locales/utils/imageMimeTypes.js +5 -0
  136. package/esm/models/slots/chartsBaseSlotProps.d.ts +4 -0
  137. package/hooks/useItemHighlighted.js +2 -2
  138. package/index.js +1 -1
  139. package/internals/components/NotRendered.d.ts +9 -0
  140. package/internals/components/NotRendered.js +16 -0
  141. package/internals/createSeriesSelectorOfType.js +2 -2
  142. package/internals/index.d.ts +1 -0
  143. package/internals/index.js +12 -0
  144. package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +3 -29
  145. package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +1 -1
  146. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +30 -2
  147. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +14 -724
  148. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +11 -10
  149. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +8 -2
  150. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +3 -29
  151. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +1 -1
  152. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +6 -54
  153. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +2 -2
  154. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +12 -208
  155. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +7 -66
  156. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -3
  157. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +21 -6222
  158. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +4 -6
  159. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +50 -5
  160. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +18 -622
  161. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -3
  162. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +18 -230
  163. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +6 -6
  164. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +20 -4
  165. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +17 -2012
  166. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +2 -2
  167. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +39 -4
  168. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +3 -27
  169. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +1 -1
  170. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +5 -40
  171. package/internals/plugins/utils/selectors.d.ts +18 -6
  172. package/internals/plugins/utils/selectors.js +3 -3
  173. package/internals/store/useSelector.d.ts +2 -2
  174. package/internals/store/useSelector.js +2 -2
  175. package/locales/enUS.d.ts +3 -0
  176. package/locales/enUS.js +8 -2
  177. package/locales/frFR.d.ts +3 -0
  178. package/locales/frFR.js +7 -0
  179. package/locales/ptBR.d.ts +3 -0
  180. package/locales/ptBR.js +7 -1
  181. package/locales/ptPT.d.ts +3 -0
  182. package/locales/ptPT.js +7 -1
  183. package/locales/utils/chartsLocaleTextApi.d.ts +17 -0
  184. package/locales/utils/getChartsLocalization.d.ts +3 -0
  185. package/locales/utils/imageMimeTypes.d.ts +2 -0
  186. package/locales/utils/imageMimeTypes.js +11 -0
  187. package/models/slots/chartsBaseSlotProps.d.ts +4 -0
  188. package/package.json +3 -3
@@ -3,6 +3,7 @@ import { ScatterMarkerSlotProps, ScatterMarkerSlots } from "./ScatterMarker.type
3
3
  import { DefaultizedScatterSeriesType, ScatterItemIdentifier } from "../models/seriesType/scatter.js";
4
4
  import { D3Scale } from "../models/axis.js";
5
5
  import { ColorGetter } from "../internals/plugins/models/seriesConfig/index.js";
6
+ import { ScatterClasses } from "./scatterClasses.js";
6
7
  export interface ScatterProps {
7
8
  series: DefaultizedScatterSeriesType;
8
9
  xScale: D3Scale;
@@ -15,6 +16,7 @@ export interface ScatterProps {
15
16
  * @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
16
17
  */
17
18
  onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, scatterItemIdentifier: ScatterItemIdentifier) => void;
19
+ classes?: Partial<ScatterClasses>;
18
20
  slots?: ScatterSlots;
19
21
  slotProps?: ScatterSlotProps;
20
22
  }
@@ -20,6 +20,7 @@ var _useItemHighlightedGetter = require("../hooks/useItemHighlightedGetter");
20
20
  var _useChartVoronoi = require("../internals/plugins/featurePlugins/useChartVoronoi");
21
21
  var _ChartProvider = require("../context/ChartProvider");
22
22
  var _ScatterMarker = require("./ScatterMarker");
23
+ var _scatterClasses = require("./scatterClasses");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
25
  const _excluded = ["ownerState"];
25
26
  /**
@@ -40,6 +41,7 @@ function Scatter(props) {
40
41
  color,
41
42
  colorGetter,
42
43
  onItemClick,
44
+ classes: inClasses,
43
45
  slots,
44
46
  slotProps
45
47
  } = props;
@@ -95,7 +97,10 @@ function Scatter(props) {
95
97
  ownerState: {}
96
98
  }),
97
99
  markerProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded);
100
+ const classes = (0, _scatterClasses.useUtilityClasses)(inClasses);
98
101
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
102
+ "data-series": series.id,
103
+ className: classes.root,
99
104
  children: cleanData.map((dataPoint, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Marker, (0, _extends2.default)({
100
105
  dataIndex: dataPoint.dataIndex,
101
106
  color: dataPoint.color,
@@ -107,7 +112,9 @@ function Scatter(props) {
107
112
  type: 'scatter',
108
113
  seriesId: series.id,
109
114
  dataIndex: dataPoint.dataIndex
110
- }))
115
+ })),
116
+ "data-highlighted": dataPoint.isHighlighted || undefined,
117
+ "data-faded": dataPoint.isFaded || undefined
111
118
  }, interactionItemProps[i], markerProps), dataPoint.id ?? dataPoint.dataIndex))
112
119
  });
113
120
  }
@@ -116,6 +123,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
116
123
  // | These PropTypes are generated from the TypeScript type definitions |
117
124
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
118
125
  // ----------------------------------------------------------------------
126
+ classes: _propTypes.default.object,
119
127
  color: _propTypes.default.string.isRequired,
120
128
  colorGetter: _propTypes.default.func,
121
129
  /**
@@ -2,4 +2,6 @@ export * from "./ScatterChart.js";
2
2
  export * from "./ScatterPlot.js";
3
3
  export * from "./Scatter.js";
4
4
  export * from "./ScatterMarker.types.js";
5
- export * from "./ScatterMarker.js";
5
+ export * from "./ScatterMarker.js";
6
+ export type { ScatterClasses } from "./scatterClasses.js";
7
+ export { scatterClasses } from "./scatterClasses.js";
@@ -3,9 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ scatterClasses: true
8
+ };
9
+ Object.defineProperty(exports, "scatterClasses", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _scatterClasses.scatterClasses;
13
+ }
14
+ });
6
15
  var _ScatterChart = require("./ScatterChart");
7
16
  Object.keys(_ScatterChart).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _ScatterChart[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -17,6 +27,7 @@ Object.keys(_ScatterChart).forEach(function (key) {
17
27
  var _ScatterPlot = require("./ScatterPlot");
18
28
  Object.keys(_ScatterPlot).forEach(function (key) {
19
29
  if (key === "default" || key === "__esModule") return;
30
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
31
  if (key in exports && exports[key] === _ScatterPlot[key]) return;
21
32
  Object.defineProperty(exports, key, {
22
33
  enumerable: true,
@@ -28,6 +39,7 @@ Object.keys(_ScatterPlot).forEach(function (key) {
28
39
  var _Scatter = require("./Scatter");
29
40
  Object.keys(_Scatter).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
42
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
43
  if (key in exports && exports[key] === _Scatter[key]) return;
32
44
  Object.defineProperty(exports, key, {
33
45
  enumerable: true,
@@ -39,6 +51,7 @@ Object.keys(_Scatter).forEach(function (key) {
39
51
  var _ScatterMarker = require("./ScatterMarker.types");
40
52
  Object.keys(_ScatterMarker).forEach(function (key) {
41
53
  if (key === "default" || key === "__esModule") return;
54
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
55
  if (key in exports && exports[key] === _ScatterMarker[key]) return;
43
56
  Object.defineProperty(exports, key, {
44
57
  enumerable: true,
@@ -50,6 +63,7 @@ Object.keys(_ScatterMarker).forEach(function (key) {
50
63
  var _ScatterMarker2 = require("./ScatterMarker");
51
64
  Object.keys(_ScatterMarker2).forEach(function (key) {
52
65
  if (key === "default" || key === "__esModule") return;
66
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
53
67
  if (key in exports && exports[key] === _ScatterMarker2[key]) return;
54
68
  Object.defineProperty(exports, key, {
55
69
  enumerable: true,
@@ -57,4 +71,5 @@ Object.keys(_ScatterMarker2).forEach(function (key) {
57
71
  return _ScatterMarker2[key];
58
72
  }
59
73
  });
60
- });
74
+ });
75
+ var _scatterClasses = require("./scatterClasses");
@@ -0,0 +1,8 @@
1
+ export interface ScatterClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ }
5
+ export type ScatterClassKey = keyof ScatterClasses;
6
+ export declare function getScatterUtilityClass(slot: string): string;
7
+ export declare const scatterClasses: ScatterClasses;
8
+ export declare const useUtilityClasses: (classes?: Partial<ScatterClasses>) => Record<"root", string>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getScatterUtilityClass = getScatterUtilityClass;
8
+ exports.useUtilityClasses = exports.scatterClasses = void 0;
9
+ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
10
+ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
11
+ var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
12
+ function getScatterUtilityClass(slot) {
13
+ return (0, _generateUtilityClass.default)('MuiScatter', slot);
14
+ }
15
+ const scatterClasses = exports.scatterClasses = (0, _generateUtilityClasses.default)('MuiScatter', ['root']);
16
+ const useUtilityClasses = classes => {
17
+ const slots = {
18
+ root: ['root']
19
+ };
20
+ return (0, _composeClasses.default)(slots, getScatterUtilityClass, classes);
21
+ };
22
+ exports.useUtilityClasses = useUtilityClasses;
@@ -51,10 +51,12 @@ process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
51
51
  // ----------------------------------------------------------------------
52
52
  className: _propTypes.default.string,
53
53
  disabled: _propTypes.default.bool,
54
+ id: _propTypes.default.string,
54
55
  /**
55
56
  * A function to customize the rendering of the component.
56
57
  */
57
58
  render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
59
+ size: _propTypes.default.oneOf(['large', 'medium', 'small']),
58
60
  style: _propTypes.default.object,
59
61
  tabIndex: _propTypes.default.number
60
62
  } : void 0;
@@ -14,6 +14,8 @@ export function AnimatedBarElement(props) {
14
14
  const animatedProps = useAnimateBar(props);
15
15
  return /*#__PURE__*/_jsx("rect", _extends({}, other, {
16
16
  filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
17
- opacity: ownerState.isFaded ? 0.3 : 1
17
+ opacity: ownerState.isFaded ? 0.3 : 1,
18
+ "data-highlighted": ownerState.isHighlighted || undefined,
19
+ "data-faded": ownerState.isFaded || undefined
18
20
  }, animatedProps));
19
21
  }
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import type { CompletedBarData } from "../types.js";
2
+ import type { ProcessedBarSeriesData } from "../types.js";
3
3
  import { BarLabelItemProps } from "./BarLabelItem.js";
4
4
  type BarLabelPlotProps = {
5
- bars: CompletedBarData[];
5
+ bars: ProcessedBarSeriesData[];
6
6
  skipAnimation?: boolean;
7
7
  barLabel?: BarLabelItemProps['barLabel'];
8
8
  };
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["bars", "skipAnimation"];
4
4
  import * as React from 'react';
5
5
  import { BarLabelItem } from "./BarLabelItem.js";
6
+ import { useUtilityClasses } from "../barClasses.js";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  /**
8
9
  * @ignore - internal component.
@@ -13,33 +14,40 @@ function BarLabelPlot(props) {
13
14
  skipAnimation
14
15
  } = props,
15
16
  other = _objectWithoutPropertiesLoose(props, _excluded);
17
+ const classes = useUtilityClasses();
16
18
  return /*#__PURE__*/_jsx(React.Fragment, {
17
- children: bars.map(({
18
- xOrigin,
19
- yOrigin,
20
- x,
21
- y,
19
+ children: bars.flatMap(({
22
20
  seriesId,
23
- dataIndex,
24
- color,
25
- value,
26
- width,
27
- height,
28
- layout
29
- }) => /*#__PURE__*/_jsx(BarLabelItem, _extends({
30
- seriesId: seriesId,
31
- dataIndex: dataIndex,
32
- value: value,
33
- color: color,
34
- xOrigin: xOrigin,
35
- yOrigin: yOrigin,
36
- x: x,
37
- y: y,
38
- width: width,
39
- height: height,
40
- skipAnimation: skipAnimation ?? false,
41
- layout: layout ?? 'vertical'
42
- }, other), `${seriesId}-${dataIndex}`))
21
+ data
22
+ }) => /*#__PURE__*/_jsx("g", {
23
+ className: classes.seriesLabels,
24
+ "data-series": seriesId,
25
+ children: data.map(({
26
+ xOrigin,
27
+ yOrigin,
28
+ x,
29
+ y,
30
+ dataIndex,
31
+ color,
32
+ value,
33
+ width,
34
+ height,
35
+ layout
36
+ }) => /*#__PURE__*/_jsx(BarLabelItem, _extends({
37
+ seriesId: seriesId,
38
+ dataIndex: dataIndex,
39
+ value: value,
40
+ color: color,
41
+ xOrigin: xOrigin,
42
+ yOrigin: yOrigin,
43
+ x: x,
44
+ y: y,
45
+ width: width,
46
+ height: height,
47
+ skipAnimation: skipAnimation ?? false,
48
+ layout: layout ?? 'vertical'
49
+ }, other), dataIndex))
50
+ }, seriesId))
43
51
  });
44
52
  }
45
53
  export { BarLabelPlot };
@@ -16,6 +16,7 @@ import { checkScaleErrors } from "./checkScaleErrors.js";
16
16
  import { useBarSeriesContext } from "../hooks/useBarSeries.js";
17
17
  import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
18
18
  import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
19
+ import { useUtilityClasses } from "./barClasses.js";
19
20
 
20
21
  /**
21
22
  * Solution of the equations
@@ -69,13 +70,13 @@ const useAggregatedData = () => {
69
70
  const defaultYAxisId = yAxisIds[0];
70
71
  const masks = {};
71
72
  const data = stackingGroups.flatMap(({
72
- ids: groupIds
73
+ ids: seriesIds
73
74
  }, groupIndex) => {
74
75
  const xMin = drawingArea.left;
75
76
  const xMax = drawingArea.left + drawingArea.width;
76
77
  const yMin = drawingArea.top;
77
78
  const yMax = drawingArea.top + drawingArea.height;
78
- return groupIds.flatMap(seriesId => {
79
+ return seriesIds.map(seriesId => {
79
80
  const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
80
81
  const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
81
82
  const xAxisConfig = xAxis[xAxisId];
@@ -101,7 +102,7 @@ const useAggregatedData = () => {
101
102
  data: currentSeriesData,
102
103
  layout
103
104
  } = series[seriesId];
104
- return baseScaleConfig.data.map((baseValue, dataIndex) => {
105
+ const seriesDataPoints = baseScaleConfig.data.map((baseValue, dataIndex) => {
105
106
  if (currentSeriesData[dataIndex] == null) {
106
107
  return null;
107
108
  }
@@ -150,6 +151,10 @@ const useAggregatedData = () => {
150
151
  mask.hasPositive = mask.hasPositive || (result.value ?? 0) > 0;
151
152
  return result;
152
153
  }).filter(rectangle => rectangle !== null);
154
+ return {
155
+ seriesId,
156
+ data: seriesDataPoints
157
+ };
153
158
  });
154
159
  });
155
160
  return {
@@ -192,7 +197,9 @@ function BarPlot(props) {
192
197
  const isZoomInteracting = useInternalIsZoomInteracting();
193
198
  const skipAnimation = useSkipAnimation(isZoomInteracting || inSkipAnimation);
194
199
  const withoutBorderRadius = !borderRadius || borderRadius <= 0;
200
+ const classes = useUtilityClasses();
195
201
  return /*#__PURE__*/_jsxs(BarPlotRoot, {
202
+ className: classes.root,
196
203
  children: [!withoutBorderRadius && masksData.map(({
197
204
  id,
198
205
  x,
@@ -217,45 +224,53 @@ function BarPlot(props) {
217
224
  }, id);
218
225
  }), completedData.map(({
219
226
  seriesId,
220
- dataIndex,
221
- color,
222
- maskId,
223
- layout,
224
- x,
225
- xOrigin,
226
- y,
227
- yOrigin,
228
- width,
229
- height
227
+ data
230
228
  }) => {
231
- const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
232
- id: seriesId,
233
- dataIndex: dataIndex,
234
- color: color,
235
- skipAnimation: skipAnimation ?? false,
236
- layout: layout ?? 'vertical',
237
- x: x,
238
- xOrigin: xOrigin,
239
- y: y,
240
- yOrigin: yOrigin,
241
- width: width,
242
- height: height
243
- }, other, {
244
- onClick: onItemClick && (event => {
245
- onItemClick(event, {
246
- type: 'bar',
247
- seriesId,
248
- dataIndex
249
- });
250
- })
251
- }), `${seriesId}-${dataIndex}`);
252
- if (withoutBorderRadius) {
253
- return barElement;
254
- }
255
229
  return /*#__PURE__*/_jsx("g", {
256
- clipPath: `url(#${maskId})`,
257
- children: barElement
258
- }, `${seriesId}-${dataIndex}`);
230
+ "data-series": seriesId,
231
+ className: classes.series,
232
+ children: data.map(({
233
+ dataIndex,
234
+ color,
235
+ maskId,
236
+ layout,
237
+ x,
238
+ xOrigin,
239
+ y,
240
+ yOrigin,
241
+ width,
242
+ height
243
+ }) => {
244
+ const barElement = /*#__PURE__*/_jsx(BarElement, _extends({
245
+ id: seriesId,
246
+ dataIndex: dataIndex,
247
+ color: color,
248
+ skipAnimation: skipAnimation ?? false,
249
+ layout: layout ?? 'vertical',
250
+ x: x,
251
+ xOrigin: xOrigin,
252
+ y: y,
253
+ yOrigin: yOrigin,
254
+ width: width,
255
+ height: height
256
+ }, other, {
257
+ onClick: onItemClick && (event => {
258
+ onItemClick(event, {
259
+ type: 'bar',
260
+ seriesId,
261
+ dataIndex
262
+ });
263
+ })
264
+ }), dataIndex);
265
+ if (withoutBorderRadius) {
266
+ return barElement;
267
+ }
268
+ return /*#__PURE__*/_jsx("g", {
269
+ clipPath: `url(#${maskId})`,
270
+ children: barElement
271
+ }, dataIndex);
272
+ })
273
+ }, seriesId);
259
274
  }), barLabel && /*#__PURE__*/_jsx(BarLabelPlot, _extends({
260
275
  bars: completedData,
261
276
  skipAnimation: skipAnimation,
@@ -0,0 +1,12 @@
1
+ export interface BarClasses {
2
+ /** Styles applied to the bar plot element. */
3
+ root: string;
4
+ /** Styles applied to the group surrounding a series' bar elements. */
5
+ series: string;
6
+ /** Styles applied to the group surrounding a series' labels. */
7
+ seriesLabels: string;
8
+ }
9
+ export type BarClassKey = keyof BarClasses;
10
+ export declare function getBarUtilityClass(slot: string): string;
11
+ export declare const barClasses: BarClasses;
12
+ export declare const useUtilityClasses: (classes?: Partial<BarClasses>) => Record<"root" | "series" | "seriesLabels", string>;
@@ -0,0 +1,15 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import composeClasses from '@mui/utils/composeClasses';
3
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
4
+ export function getBarUtilityClass(slot) {
5
+ return generateUtilityClass('MuiBar', slot);
6
+ }
7
+ export const barClasses = generateUtilityClasses('MuiBar', ['root', 'series', 'seriesLabels']);
8
+ export const useUtilityClasses = classes => {
9
+ const slots = {
10
+ root: ['root'],
11
+ series: ['series'],
12
+ seriesLabels: ['seriesLabels']
13
+ };
14
+ return composeClasses(slots, getBarUtilityClass, classes);
15
+ };
@@ -2,4 +2,6 @@ export * from "./BarChart.js";
2
2
  export * from "./BarPlot.js";
3
3
  export * from "./BarElement.js";
4
4
  export * from "./BarLabel/index.js";
5
- export * from "./barElementClasses.js";
5
+ export * from "./barElementClasses.js";
6
+ export { barClasses, getBarUtilityClass } from "./barClasses.js";
7
+ export type { BarClassKey, BarClasses } from "./barClasses.js";
@@ -2,4 +2,5 @@ export * from "./BarChart.js";
2
2
  export * from "./BarPlot.js";
3
3
  export * from "./BarElement.js";
4
4
  export * from "./BarLabel/index.js";
5
- export * from "./barElementClasses.js";
5
+ export * from "./barElementClasses.js";
6
+ export { barClasses, getBarUtilityClass } from "./barClasses.js";
@@ -9,7 +9,11 @@ export type AnimationData = {
9
9
  xOrigin: number;
10
10
  layout: BarSeriesType['layout'];
11
11
  };
12
- export interface CompletedBarData extends AnimationData {
12
+ export interface ProcessedBarSeriesData {
13
+ seriesId: SeriesId;
14
+ data: ProcessedBarData[];
15
+ }
16
+ export interface ProcessedBarData extends AnimationData {
13
17
  seriesId: SeriesId;
14
18
  dataIndex: number;
15
19
  color: string;
@@ -22,6 +22,7 @@ export interface ChartsLegendProps {
22
22
  classes?: Partial<ChartsLegendClasses>;
23
23
  className?: string;
24
24
  sx?: SxProps<Theme>;
25
+ tabIndex?: number;
25
26
  }
26
27
  declare const ChartsLegend: React.ForwardRefExoticComponent<ChartsLegendProps & import("./chartsLegend.types.js").ChartsLegendSlotExtension & React.RefAttributes<{}>>;
27
28
  export { ChartsLegend };
@@ -80,6 +80,8 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
80
80
  ownerState: props,
81
81
  children: data.items.map((item, i) => {
82
82
  return /*#__PURE__*/_jsx("li", {
83
+ className: classes?.item,
84
+ "data-series": item.id,
83
85
  children: /*#__PURE__*/_jsxs(Element, {
84
86
  className: classes?.series,
85
87
  role: onItemClick ? 'button' : undefined,
@@ -51,6 +51,7 @@ export interface ContinuousColorLegendProps extends ColorLegendSelector, AppendK
51
51
  classes?: Partial<ContinuousColorLegendClasses>;
52
52
  className?: string;
53
53
  sx?: SxProps<Theme>;
54
+ tabIndex?: number;
54
55
  }
55
56
  declare const ContinuousColorLegend: React.ForwardRefExoticComponent<ContinuousColorLegendProps & import("./chartsLegend.types.js").ChartsLegendSlotExtension & React.RefAttributes<{}>>;
56
57
  export { ContinuousColorLegend };
@@ -37,6 +37,7 @@ export interface PiecewiseColorLegendProps extends ColorLegendSelector, PrependK
37
37
  classes?: Partial<PiecewiseColorLegendClasses>;
38
38
  className?: string;
39
39
  sx?: SxProps<Theme>;
40
+ tabIndex?: number;
40
41
  }
41
42
  declare const PiecewiseColorLegend: React.ForwardRefExoticComponent<PiecewiseColorLegendProps & import("./chartsLegend.types.js").ChartsLegendSlotExtension & React.RefAttributes<{}>>;
42
43
  export { PiecewiseColorLegend };
@@ -3,6 +3,8 @@ import type { ChartsLegendSlotExtension } from "./chartsLegend.types.js";
3
3
  export interface ChartsLegendClasses {
4
4
  /** Styles applied to the root element. */
5
5
  root: string;
6
+ /** Styles applied to the list item around each series in the legend. */
7
+ item: string;
6
8
  /** Styles applied to a series element. */
7
9
  series: string;
8
10
  /** Styles applied to series mark element. */
@@ -14,5 +16,5 @@ export interface ChartsLegendClasses {
14
16
  /** Styles applied to the legend in row layout. */
15
17
  horizontal: string;
16
18
  }
17
- export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "series", string>;
19
+ export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "item" | "series", string>;
18
20
  export declare const legendClasses: ChartsLegendClasses;
@@ -11,10 +11,11 @@ export const useUtilityClasses = props => {
11
11
  } = props;
12
12
  const slots = {
13
13
  root: ['root', direction],
14
+ item: ['item'],
14
15
  mark: ['mark'],
15
16
  label: ['label'],
16
17
  series: ['series']
17
18
  };
18
19
  return composeClasses(slots, getLegendUtilityClass, classes);
19
20
  };
20
- export const legendClasses = generateUtilityClasses('MuiChartsLegend', ['root', 'series', 'mark', 'label', 'vertical', 'horizontal']);
21
+ export const legendClasses = generateUtilityClasses('MuiChartsLegend', ['root', 'item', 'series', 'mark', 'label', 'vertical', 'horizontal']);
@@ -1,6 +1,6 @@
1
1
  import { SxProps, Theme } from '@mui/material/styles';
2
2
  import * as React from 'react';
3
- export interface ChartsSurfaceProps {
3
+ export interface ChartsSurfaceProps extends Omit<React.SVGProps<SVGSVGElement>, 'id' | 'children' | 'className' | 'height' | 'width' | 'cx' | 'cy' | 'viewBox' | 'color' | 'ref'> {
4
4
  className?: string;
5
5
  title?: string;
6
6
  desc?: string;