@mui/x-charts 8.12.0 → 8.13.1

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 (52) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/ChartsSurface/ChartsSurface.js +4 -3
  3. package/PieChart/PieArc.d.ts +3 -0
  4. package/PieChart/PieArc.js +13 -12
  5. package/PieChart/PieArcPlot.js +27 -3
  6. package/esm/ChartsSurface/ChartsSurface.js +4 -3
  7. package/esm/PieChart/PieArc.d.ts +3 -0
  8. package/esm/PieChart/PieArc.js +14 -13
  9. package/esm/PieChart/PieArcPlot.js +29 -5
  10. package/esm/index.js +1 -1
  11. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +60 -32
  12. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  13. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +5 -2
  14. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -10
  15. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +7 -5
  16. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  17. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +13 -4
  18. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  19. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  20. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  21. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  22. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +2 -1
  23. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  24. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +115 -155
  25. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +14 -2
  26. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +27 -1
  27. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -0
  28. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -5
  29. package/esm/internals/ticks.d.ts +3 -5
  30. package/esm/internals/ticks.js +6 -5
  31. package/index.js +1 -1
  32. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +59 -31
  33. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +19 -5
  34. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +5 -2
  35. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -11
  36. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +6 -4
  37. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  38. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +14 -5
  39. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +2 -2
  40. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +30 -7
  41. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +6 -4
  42. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -1
  43. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +3 -2
  44. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +6 -0
  45. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +115 -155
  46. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +14 -2
  47. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +28 -2
  48. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -0
  49. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -4
  50. package/internals/ticks.d.ts +3 -5
  51. package/internals/ticks.js +7 -5
  52. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,213 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.13.1
9
+
10
+ _Oct 1, 2025_
11
+
12
+ - 🐛 Fix `@mui/x-charts-pro` failure on import due to missing `@mui/x-internals` release
13
+
14
+ ### Data Grid
15
+
16
+ #### `@mui/x-data-grid@8.13.1`
17
+
18
+ Internal changes.
19
+
20
+ #### `@mui/x-data-grid-pro@8.13.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
21
+
22
+ Same changes as in `@mui/x-data-grid@8.13.1`.
23
+
24
+ #### `@mui/x-data-grid-premium@8.13.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
25
+
26
+ Same changes as in `@mui/x-data-grid-pro@8.13.1`.
27
+
28
+ ### Date and Time Pickers
29
+
30
+ #### `@mui/x-date-pickers@8.12.0`
31
+
32
+ Internal changes.
33
+
34
+ #### `@mui/x-date-pickers-pro@8.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
35
+
36
+ Same changes as in `@mui/x-date-pickers@8.12.0`.
37
+
38
+ ### Charts
39
+
40
+ #### `@mui/x-charts@8.13.1`
41
+
42
+ Internal changes.
43
+
44
+ #### `@mui/x-charts-pro@8.13.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
45
+
46
+ Same changes as in `@mui/x-charts@8.13.1`, plus:
47
+
48
+ - [charts-pro] Fix `@mui/x-charts-pro` failure on import due to missing `@mui/x-internals` release @bernardobelchior
49
+
50
+ #### `@mui/x-charts-premium@8.13.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
51
+
52
+ Same changes as in `@mui/x-charts-pro@8.13.1`.
53
+
54
+ ### Tree View
55
+
56
+ #### `@mui/x-tree-view@8.13.1`
57
+
58
+ Internal changes.
59
+
60
+ #### `@mui/x-tree-view-pro@8.13.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
61
+
62
+ Same changes as in `@mui/x-tree-view@8.13.1`.
63
+
64
+ ### Codemod
65
+
66
+ #### `@mui/x-codemod@8.12.0`
67
+
68
+ Internal changes.
69
+
70
+ ## 8.13.0
71
+
72
+ _Oct 1, 2025_
73
+
74
+ We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
75
+
76
+ - 📊 The chart zoom now supports the `tapAndDrag` gesture. Zoom in/out by tapping twice and dragging vertically.
77
+ - 🔎 Charts now allow [fine-grained control for zoom interactions](https://mui.com/x/react-charts/zoom-and-pan/#zoom-interactions-configuration).
78
+ ```jsx
79
+ <BarChartPro
80
+ zoomInteractionConfig={{
81
+ // Only zoom when Control key is pressed
82
+ zoom: [{ type: 'wheel', keys: ['Control'] }],
83
+ // Only pan when Shift key is pressed
84
+ pan: [{ type: 'drag', keys: ['Shift'] }],
85
+ }}
86
+ />
87
+ ```
88
+ - ➡️ Data Grid grouping rows now persist their expansion state when the rows are updated.
89
+ - 📜 Updated Data Grid vertical scrollbar to include pinned rows and aggregation sections.
90
+ - 📌 Improved the appearance of [pinned columns](https://mui.com/x/react-data-grid/column-pinning/#pinned-columns-appearance) and [pinned rows](https://mui.com/x/react-data-grid/row-pinning/#pinned-rows-appearance) sections in the Data Grid.
91
+ - 🚀 Tree View now fetches the children of expanded items on mount when using lazy loading.
92
+ - 🐞 Bugfixes
93
+ - 📚 Documentation improvements
94
+
95
+ Special thanks go out to the community members for their valuable contributions:
96
+ @sai6855
97
+
98
+ The following are all team members who have contributed to this release:
99
+ @alexfauquette, @arminmeh, @bernardobelchior, @flaviendelangle, @hasdfa, @Janpot, @JCQuintas, @KenanYusuf, @mapache-salvaje, @MBilalShafi, @mnajdova, @rita-codes, @siriwatknp
100
+
101
+ ### Data Grid
102
+
103
+ #### `@mui/x-data-grid@8.13.0`
104
+
105
+ - [DataGrid] Add scroll shadows and fix scrollbar overlap (#16476) @KenanYusuf
106
+ - [DataGrid] Fix row spanning stale state issue (#19733) @MBilalShafi
107
+ - [DataGrid] Fix toolbar `slotProps` not being applied (#19769) @sai6855
108
+ - [DataGrid] Skip calling `fetchRows()` when strategy is not initialized (#19728) @MBilalShafi
109
+
110
+ #### `@mui/x-data-grid-pro@8.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
111
+
112
+ Same changes as in `@mui/x-data-grid@8.13.0`, plus:
113
+
114
+ - [DataGridPro] Retain expansion state on rows update (#19697) @MBilalShafi
115
+
116
+ #### `@mui/x-data-grid-premium@8.13.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
117
+
118
+ Same changes as in `@mui/x-data-grid-pro@8.13.0`, plus:
119
+
120
+ - [DataGridPremium] Add `metadata.referenceId` to AI assistant prompt resolver (#19695) @hasdfa
121
+ - [DataGridPremium] Fix aggregation value retrieval (#19724) @arminmeh
122
+ - [DataGridPremium] Get correct active chart id while rebuilding data (#19720) @arminmeh
123
+
124
+ ### Date and Time Pickers
125
+
126
+ #### `@mui/x-date-pickers@8.12.0`
127
+
128
+ Internal changes.
129
+
130
+ #### `@mui/x-date-pickers-pro@8.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
131
+
132
+ Same changes as in `@mui/x-date-pickers@8.12.0`.
133
+
134
+ ### Charts
135
+
136
+ #### `@mui/x-charts@8.13.0`
137
+
138
+ - [charts] Add `tapAndDrag` zoom gesture (#19727) @JCQuintas
139
+ - [charts] Add arc focus indicator that follows the arc form (#19696) @mnajdova
140
+ - [charts] Fix outline color (#19752) @alexfauquette
141
+ - [charts] Improve tooltip doc (#19731) @JCQuintas
142
+ - [charts] Make axis highlight reflect the keyboard interaction (#19631) @alexfauquette
143
+ - [charts] Prevent horizontal scroll on keyboard navigation (#19704) @alexfauquette
144
+ - [charts] Simplify gestures by removing bindings (#19767) @JCQuintas
145
+
146
+ #### `@mui/x-charts-pro@8.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
147
+
148
+ Same changes as in `@mui/x-charts@8.13.0`, plus:
149
+
150
+ - [charts-pro] Allow zoom interactions to be configured (#18646) @JCQuintas
151
+ - [charts-pro] Fix zoom preview having wrong domain in some cases (#19723) @bernardobelchior
152
+
153
+ #### `@mui/x-charts-premium@8.13.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
154
+
155
+ Same changes as in `@mui/x-charts-pro@8.13.0`.
156
+
157
+ ### Tree View
158
+
159
+ #### `@mui/x-tree-view@8.13.0`
160
+
161
+ - [tree view] Export the `apiRef` type of each Tree View component (#19543) @flaviendelangle
162
+ - [tree view] Fix indeterminate checkbox state (#19544) @flaviendelangle
163
+ - [tree view] Improve the lazy loading initial expansion (#19284) @flaviendelangle
164
+ - [tree view] Use Base UI utils whenever possible (#19502) @flaviendelangle
165
+
166
+ #### `@mui/x-tree-view-pro@8.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
167
+
168
+ Same changes as in `@mui/x-tree-view@8.13.0`.
169
+
170
+ ### Codemod
171
+
172
+ #### `@mui/x-codemod@8.12.0`
173
+
174
+ Internal changes.
175
+
176
+ ### Docs
177
+
178
+ - [docs] Add a recipe to customize editing component with Autocomplete (#19651) @siriwatknp
179
+ - [docs] Refine the electricity scatter tooltip (#19689) @alexfauquette
180
+ - [docs] Revise the Axis doc (#19052) @mapache-salvaje
181
+ - [docs] Remove reference to nonexistent `FocusedMark` API page (#19773) @bernardobelchior
182
+
183
+ ### Core
184
+
185
+ - [code-infra] Change charts codspeed integration to use walltime (#19729) @JCQuintas
186
+ - [code-infra] Port stylelint from core repo (#19633) @Janpot
187
+ - [code-infra] Stabilize fake timers in regression tests (#19719) @Janpot
188
+ - [code-infra] Stabilize size for bundles with `releaseInfo` (#19674) @Janpot
189
+ - [code-infra] Fix `pnpm-lock.yaml` broken lockfile (#19755) @bernardobelchior
190
+
191
+ ## 8.12.1
192
+
193
+ _Sep 25, 2025_
194
+
195
+ Release highlight ✨:
196
+
197
+ - 🐞 Hotfix for Grid-Charts integration issue with aggregated values
198
+
199
+ ### Data Grid
200
+
201
+ #### `@mui/x-data-grid@8.12.1`
202
+
203
+ Internal changes.
204
+
205
+ #### `@mui/x-data-grid-pro@8.12.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
206
+
207
+ Same changes as in `@mui/x-data-grid@8.12.1`.
208
+
209
+ #### `@mui/x-data-grid-premium@8.12.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
210
+
211
+ Same changes as in `@mui/x-data-grid-pro@8.12.1`, plus:
212
+
213
+ - [DataGridPremium] Collect aggregated values properly for the charts integration context (#19714) @arminmeh
214
+
8
215
  ## 8.12.0
9
216
 
10
217
  _Sep 25, 2025_
@@ -25,7 +25,8 @@ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
25
25
  name: 'MuiChartsSurface',
26
26
  slot: 'Root'
27
27
  })(({
28
- ownerState
28
+ ownerState,
29
+ theme
29
30
  }) => ({
30
31
  width: ownerState.width ?? '100%',
31
32
  height: ownerState.height ?? '100%',
@@ -45,14 +46,14 @@ const ChartsSurfaceStyles = (0, _styles.styled)('svg', {
45
46
  },
46
47
  '&:focus-visible': {
47
48
  // Show focus outline on the SVG container only when using keyboard navigation
48
- outline: 'auto',
49
+ outline: `${(theme.vars ?? theme).palette.text.primary} solid 2px`,
49
50
  '&[data-has-focused-item=true]': {
50
51
  // But not if the chart has a focused children item
51
52
  outline: 'none'
52
53
  }
53
54
  },
54
55
  '& [data-focused=true]': {
55
- outline: 'auto'
56
+ outline: `${(theme.vars ?? theme).palette.text.primary} solid 2px`
56
57
  }
57
58
  }));
58
59
 
@@ -12,6 +12,8 @@ export interface PieArcClasses {
12
12
  * Needs to be suffixed with the series ID: `.${pieArcClasses.series}-${seriesId}`.
13
13
  */
14
14
  series: string;
15
+ /** Styles applied to the focus indicator element. */
16
+ focusIndicator: string;
15
17
  }
16
18
  export type PieArcClassKey = keyof PieArcClasses;
17
19
  interface PieArcOwnerState {
@@ -21,6 +23,7 @@ interface PieArcOwnerState {
21
23
  isFaded: boolean;
22
24
  isHighlighted: boolean;
23
25
  isFocused: boolean;
26
+ stroke?: string;
24
27
  classes?: Partial<PieArcClasses>;
25
28
  }
26
29
  export declare function getPieArcUtilityClass(slot: string): string;
@@ -13,6 +13,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
14
14
  var React = _interopRequireWildcard(require("react"));
15
15
  var _propTypes = _interopRequireDefault(require("prop-types"));
16
+ var _clsx = _interopRequireDefault(require("clsx"));
16
17
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
18
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
18
19
  var _styles = require("@mui/material/styles");
@@ -21,11 +22,11 @@ var _hooks = require("../hooks");
21
22
  var _animation = require("../internals/animation/animation");
22
23
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
- const _excluded = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
25
+ const _excluded = ["className", "classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "stroke"];
25
26
  function getPieArcUtilityClass(slot) {
26
27
  return (0, _generateUtilityClass.default)('MuiPieArc', slot);
27
28
  }
28
- const pieArcClasses = exports.pieArcClasses = (0, _generateUtilityClasses.default)('MuiPieArc', ['root', 'highlighted', 'faded', 'series']);
29
+ const pieArcClasses = exports.pieArcClasses = (0, _generateUtilityClasses.default)('MuiPieArc', ['root', 'highlighted', 'faded', 'series', 'focusIndicator']);
29
30
  const useUtilityClasses = ownerState => {
30
31
  const {
31
32
  classes,
@@ -43,17 +44,14 @@ const PieArcRoot = (0, _styles.styled)('path', {
43
44
  name: 'MuiPieArc',
44
45
  slot: 'Root',
45
46
  overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
46
- })(({
47
- theme
48
- }) => ({
49
- // Got to move stroke to an element prop instead of style.
50
- stroke: (theme.vars || theme).palette.background.paper,
47
+ })({
51
48
  transitionProperty: 'opacity, fill, filter',
52
49
  transitionDuration: `${_animation.ANIMATION_DURATION_MS}ms`,
53
50
  transitionTimingFunction: _animation.ANIMATION_TIMING_FUNCTION
54
- }));
51
+ });
55
52
  const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
56
53
  const {
54
+ className,
57
55
  classes: innerClasses,
58
56
  color,
59
57
  dataIndex,
@@ -68,9 +66,12 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
68
66
  innerRadius,
69
67
  outerRadius,
70
68
  paddingAngle,
71
- skipAnimation
69
+ skipAnimation,
70
+ stroke: strokeProp
72
71
  } = props,
73
72
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
73
+ const theme = (0, _styles.useTheme)();
74
+ const stroke = strokeProp ?? (theme.vars || theme).palette.background.paper;
74
75
  const ownerState = {
75
76
  id,
76
77
  dataIndex,
@@ -100,15 +101,15 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
100
101
  onClick: onClick,
101
102
  cursor: onClick ? 'pointer' : 'unset',
102
103
  ownerState: ownerState,
103
- className: classes.root,
104
+ className: (0, _clsx.default)(classes.root, className),
104
105
  fill: ownerState.color,
105
106
  opacity: ownerState.isFaded ? 0.3 : 1,
106
107
  filter: ownerState.isHighlighted ? 'brightness(120%)' : 'none',
108
+ stroke: stroke,
107
109
  strokeWidth: 1,
108
110
  strokeLinejoin: "round",
109
111
  "data-highlighted": ownerState.isHighlighted || undefined,
110
- "data-faded": ownerState.isFaded || undefined,
111
- "data-focused": isFocused || undefined
112
+ "data-faded": ownerState.isFaded || undefined
112
113
  }, other, interactionProps, animatedProps));
113
114
  });
114
115
  if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
@@ -11,6 +11,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _styles = require("@mui/material/styles");
15
+ var _useFocusedItem = require("../hooks/useFocusedItem");
14
16
  var _PieArc = require("./PieArc");
15
17
  var _useTransformData = require("./dataTransform/useTransformData");
16
18
  var _jsxRuntime = require("react/jsx-runtime");
@@ -33,6 +35,7 @@ function PieArcPlot(props) {
33
35
  skipAnimation
34
36
  } = props,
35
37
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
38
+ const theme = (0, _styles.useTheme)();
36
39
  const transformedData = (0, _useTransformData.useTransformData)({
37
40
  innerRadius,
38
41
  outerRadius,
@@ -43,12 +46,16 @@ function PieArcPlot(props) {
43
46
  faded,
44
47
  data
45
48
  });
49
+ const {
50
+ dataIndex: focusedIndex = -1
51
+ } = (0, _useFocusedItem.useFocusedItem)() ?? {};
52
+ const focusedItem = focusedIndex !== -1 ? transformedData[focusedIndex] : null;
46
53
  if (data.length === 0) {
47
54
  return null;
48
55
  }
49
56
  const Arc = slots?.pieArc ?? _PieArc.PieArc;
50
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
51
- children: transformedData.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Arc, (0, _extends2.default)({
57
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, other, {
58
+ children: [transformedData.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(Arc, (0, _extends2.default)({
52
59
  startAngle: item.startAngle,
53
60
  endAngle: item.endAngle,
54
61
  paddingAngle: item.paddingAngle,
@@ -69,7 +76,24 @@ function PieArcPlot(props) {
69
76
  dataIndex: index
70
77
  }, item);
71
78
  })
72
- }, slotProps?.pieArc), item.dataIndex))
79
+ }, slotProps?.pieArc), item.dataIndex)), focusedItem && /*#__PURE__*/(0, _jsxRuntime.jsx)(Arc, {
80
+ startAngle: focusedItem.startAngle,
81
+ endAngle: focusedItem.endAngle,
82
+ paddingAngle: focusedItem.paddingAngle,
83
+ innerRadius: focusedItem.innerRadius,
84
+ color: focusedItem.color,
85
+ outerRadius: focusedItem.outerRadius,
86
+ cornerRadius: focusedItem.cornerRadius,
87
+ skipAnimation: true,
88
+ stroke: (theme.vars ?? theme).palette.text.primary,
89
+ id: id,
90
+ className: _PieArc.pieArcClasses.focusIndicator,
91
+ dataIndex: focusedIndex,
92
+ isFaded: false,
93
+ isHighlighted: false,
94
+ isFocused: false,
95
+ strokeWidth: 3
96
+ })]
73
97
  }));
74
98
  }
75
99
  process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
@@ -18,7 +18,8 @@ const ChartsSurfaceStyles = styled('svg', {
18
18
  name: 'MuiChartsSurface',
19
19
  slot: 'Root'
20
20
  })(({
21
- ownerState
21
+ ownerState,
22
+ theme
22
23
  }) => ({
23
24
  width: ownerState.width ?? '100%',
24
25
  height: ownerState.height ?? '100%',
@@ -38,14 +39,14 @@ const ChartsSurfaceStyles = styled('svg', {
38
39
  },
39
40
  '&:focus-visible': {
40
41
  // Show focus outline on the SVG container only when using keyboard navigation
41
- outline: 'auto',
42
+ outline: `${(theme.vars ?? theme).palette.text.primary} solid 2px`,
42
43
  '&[data-has-focused-item=true]': {
43
44
  // But not if the chart has a focused children item
44
45
  outline: 'none'
45
46
  }
46
47
  },
47
48
  '& [data-focused=true]': {
48
- outline: 'auto'
49
+ outline: `${(theme.vars ?? theme).palette.text.primary} solid 2px`
49
50
  }
50
51
  }));
51
52
 
@@ -12,6 +12,8 @@ export interface PieArcClasses {
12
12
  * Needs to be suffixed with the series ID: `.${pieArcClasses.series}-${seriesId}`.
13
13
  */
14
14
  series: string;
15
+ /** Styles applied to the focus indicator element. */
16
+ focusIndicator: string;
15
17
  }
16
18
  export type PieArcClassKey = keyof PieArcClasses;
17
19
  interface PieArcOwnerState {
@@ -21,6 +23,7 @@ interface PieArcOwnerState {
21
23
  isFaded: boolean;
22
24
  isHighlighted: boolean;
23
25
  isFocused: boolean;
26
+ stroke?: string;
24
27
  classes?: Partial<PieArcClasses>;
25
28
  }
26
29
  export declare function getPieArcUtilityClass(slot: string): string;
@@ -2,12 +2,13 @@
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 = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
5
+ const _excluded = ["className", "classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "stroke"];
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
- import { styled } from '@mui/material/styles';
11
+ import { styled, useTheme } from '@mui/material/styles';
11
12
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
12
13
  import { useAnimatePieArc } from "../hooks/index.js";
13
14
  import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
@@ -16,7 +17,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
16
17
  export function getPieArcUtilityClass(slot) {
17
18
  return generateUtilityClass('MuiPieArc', slot);
18
19
  }
19
- export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded', 'series']);
20
+ export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded', 'series', 'focusIndicator']);
20
21
  const useUtilityClasses = ownerState => {
21
22
  const {
22
23
  classes,
@@ -34,17 +35,14 @@ const PieArcRoot = styled('path', {
34
35
  name: 'MuiPieArc',
35
36
  slot: 'Root',
36
37
  overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
37
- })(({
38
- theme
39
- }) => ({
40
- // Got to move stroke to an element prop instead of style.
41
- stroke: (theme.vars || theme).palette.background.paper,
38
+ })({
42
39
  transitionProperty: 'opacity, fill, filter',
43
40
  transitionDuration: `${ANIMATION_DURATION_MS}ms`,
44
41
  transitionTimingFunction: ANIMATION_TIMING_FUNCTION
45
- }));
42
+ });
46
43
  const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
47
44
  const {
45
+ className,
48
46
  classes: innerClasses,
49
47
  color,
50
48
  dataIndex,
@@ -59,9 +57,12 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
59
57
  innerRadius,
60
58
  outerRadius,
61
59
  paddingAngle,
62
- skipAnimation
60
+ skipAnimation,
61
+ stroke: strokeProp
63
62
  } = props,
64
63
  other = _objectWithoutPropertiesLoose(props, _excluded);
64
+ const theme = useTheme();
65
+ const stroke = strokeProp ?? (theme.vars || theme).palette.background.paper;
65
66
  const ownerState = {
66
67
  id,
67
68
  dataIndex,
@@ -91,15 +92,15 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
91
92
  onClick: onClick,
92
93
  cursor: onClick ? 'pointer' : 'unset',
93
94
  ownerState: ownerState,
94
- className: classes.root,
95
+ className: clsx(classes.root, className),
95
96
  fill: ownerState.color,
96
97
  opacity: ownerState.isFaded ? 0.3 : 1,
97
98
  filter: ownerState.isHighlighted ? 'brightness(120%)' : 'none',
99
+ stroke: stroke,
98
100
  strokeWidth: 1,
99
101
  strokeLinejoin: "round",
100
102
  "data-highlighted": ownerState.isHighlighted || undefined,
101
- "data-faded": ownerState.isFaded || undefined,
102
- "data-focused": isFocused || undefined
103
+ "data-faded": ownerState.isFaded || undefined
103
104
  }, other, interactionProps, animatedProps));
104
105
  });
105
106
  if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
@@ -5,9 +5,11 @@ 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 { PieArc } from "./PieArc.js";
8
+ import { useTheme } from '@mui/material/styles';
9
+ import { useFocusedItem } from "../hooks/useFocusedItem.js";
10
+ import { PieArc, pieArcClasses } from "./PieArc.js";
9
11
  import { useTransformData } from "./dataTransform/useTransformData.js";
10
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
13
  function PieArcPlot(props) {
12
14
  const {
13
15
  slots,
@@ -26,6 +28,7 @@ function PieArcPlot(props) {
26
28
  skipAnimation
27
29
  } = props,
28
30
  other = _objectWithoutPropertiesLoose(props, _excluded);
31
+ const theme = useTheme();
29
32
  const transformedData = useTransformData({
30
33
  innerRadius,
31
34
  outerRadius,
@@ -36,12 +39,16 @@ function PieArcPlot(props) {
36
39
  faded,
37
40
  data
38
41
  });
42
+ const {
43
+ dataIndex: focusedIndex = -1
44
+ } = useFocusedItem() ?? {};
45
+ const focusedItem = focusedIndex !== -1 ? transformedData[focusedIndex] : null;
39
46
  if (data.length === 0) {
40
47
  return null;
41
48
  }
42
49
  const Arc = slots?.pieArc ?? PieArc;
43
- return /*#__PURE__*/_jsx("g", _extends({}, other, {
44
- children: transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
50
+ return /*#__PURE__*/_jsxs("g", _extends({}, other, {
51
+ children: [transformedData.map((item, index) => /*#__PURE__*/_jsx(Arc, _extends({
45
52
  startAngle: item.startAngle,
46
53
  endAngle: item.endAngle,
47
54
  paddingAngle: item.paddingAngle,
@@ -62,7 +69,24 @@ function PieArcPlot(props) {
62
69
  dataIndex: index
63
70
  }, item);
64
71
  })
65
- }, slotProps?.pieArc), item.dataIndex))
72
+ }, slotProps?.pieArc), item.dataIndex)), focusedItem && /*#__PURE__*/_jsx(Arc, {
73
+ startAngle: focusedItem.startAngle,
74
+ endAngle: focusedItem.endAngle,
75
+ paddingAngle: focusedItem.paddingAngle,
76
+ innerRadius: focusedItem.innerRadius,
77
+ color: focusedItem.color,
78
+ outerRadius: focusedItem.outerRadius,
79
+ cornerRadius: focusedItem.cornerRadius,
80
+ skipAnimation: true,
81
+ stroke: (theme.vars ?? theme).palette.text.primary,
82
+ id: id,
83
+ className: pieArcClasses.focusIndicator,
84
+ dataIndex: focusedIndex,
85
+ isFaded: false,
86
+ isHighlighted: false,
87
+ isFocused: false,
88
+ strokeWidth: 3
89
+ })]
66
90
  }));
67
91
  }
68
92
  process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.12.0
2
+ * @mui/x-charts v8.13.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the