@mui/material 9.0.0-alpha.1 → 9.0.0-alpha.3

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 (74) hide show
  1. package/Autocomplete/Autocomplete.d.mts +16 -0
  2. package/Autocomplete/Autocomplete.d.ts +16 -0
  3. package/Autocomplete/Autocomplete.js +48 -25
  4. package/Autocomplete/Autocomplete.mjs +48 -25
  5. package/Box/Box.d.mts +1 -0
  6. package/Box/Box.d.ts +1 -0
  7. package/Button/Button.d.mts +1 -0
  8. package/Button/Button.d.ts +1 -0
  9. package/CHANGELOG.md +65 -0
  10. package/CardHeader/CardHeader.js +1 -0
  11. package/CardHeader/CardHeader.mjs +1 -0
  12. package/Divider/Divider.d.mts +1 -0
  13. package/Divider/Divider.d.ts +1 -0
  14. package/List/List.d.mts +1 -0
  15. package/List/List.d.ts +1 -0
  16. package/ListItemButton/ListItemButton.d.mts +1 -0
  17. package/ListItemButton/ListItemButton.d.ts +1 -0
  18. package/ListItemIcon/ListItemIcon.d.mts +1 -0
  19. package/ListItemIcon/ListItemIcon.d.ts +1 -0
  20. package/ListItemText/ListItemText.d.mts +1 -0
  21. package/ListItemText/ListItemText.d.ts +1 -0
  22. package/ListItemText/ListItemText.js +1 -0
  23. package/ListItemText/ListItemText.mjs +1 -0
  24. package/ListSubheader/ListSubheader.d.mts +1 -0
  25. package/ListSubheader/ListSubheader.d.ts +1 -0
  26. package/MenuList/MenuList.js +76 -106
  27. package/MenuList/MenuList.mjs +76 -106
  28. package/Paper/Paper.d.mts +1 -0
  29. package/Paper/Paper.d.ts +1 -0
  30. package/SpeedDialIcon/SpeedDialIcon.js +4 -10
  31. package/SpeedDialIcon/SpeedDialIcon.mjs +4 -10
  32. package/Step/Step.js +7 -5
  33. package/Step/Step.mjs +7 -5
  34. package/StepButton/StepButton.js +16 -6
  35. package/StepButton/StepButton.mjs +16 -6
  36. package/StepConnector/StepConnector.js +2 -2
  37. package/StepConnector/StepConnector.mjs +2 -2
  38. package/StepContent/StepContent.js +2 -2
  39. package/StepContent/StepContent.mjs +2 -2
  40. package/StepIcon/StepIcon.js +1 -4
  41. package/StepIcon/StepIcon.mjs +1 -4
  42. package/StepLabel/StepLabel.js +3 -7
  43. package/StepLabel/StepLabel.mjs +3 -7
  44. package/Stepper/Stepper.js +44 -7
  45. package/Stepper/Stepper.mjs +44 -7
  46. package/Stepper/StepperContext.d.mts +7 -0
  47. package/Stepper/StepperContext.d.ts +7 -0
  48. package/Stepper/StepperContext.js +2 -1
  49. package/Stepper/StepperContext.mjs +1 -0
  50. package/Stepper/index.d.mts +0 -1
  51. package/Stepper/index.d.ts +0 -1
  52. package/Tab/Tab.js +0 -1
  53. package/Tab/Tab.mjs +0 -1
  54. package/Tabs/Tabs.js +46 -97
  55. package/Tabs/Tabs.mjs +46 -97
  56. package/Typography/Typography.d.mts +1 -0
  57. package/Typography/Typography.d.ts +1 -0
  58. package/index.js +1 -1
  59. package/index.mjs +1 -1
  60. package/package.json +20 -6
  61. package/themeCssVarsAugmentation/index.js +5 -0
  62. package/themeCssVarsAugmentation/index.mjs +5 -0
  63. package/useAutocomplete/useAutocomplete.js +24 -0
  64. package/useAutocomplete/useAutocomplete.mjs +24 -0
  65. package/utils/index.d.mts +2 -0
  66. package/utils/index.d.ts +2 -0
  67. package/utils/index.js +14 -0
  68. package/utils/index.mjs +2 -0
  69. package/utils/useRovingTabIndex.d.mts +2 -0
  70. package/utils/useRovingTabIndex.d.ts +2 -0
  71. package/utils/useRovingTabIndex.js +9 -0
  72. package/utils/useRovingTabIndex.mjs +2 -0
  73. package/version/index.js +2 -2
  74. package/version/index.mjs +2 -2
@@ -10,6 +10,7 @@ exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _reactIs = require("react-is");
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _useRovingTabIndex = _interopRequireDefault(require("../utils/useRovingTabIndex"));
13
14
  var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
14
15
  var _List = _interopRequireDefault(require("../List"));
15
16
  var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
@@ -18,24 +19,6 @@ var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
18
19
  var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
19
20
  var _utils = require("../utils");
20
21
  var _jsxRuntime = require("react/jsx-runtime");
21
- function nextItem(list, item, disableListWrap) {
22
- if (list === item) {
23
- return list.firstChild;
24
- }
25
- if (item && item.nextElementSibling) {
26
- return item.nextElementSibling;
27
- }
28
- return disableListWrap ? null : list.firstChild;
29
- }
30
- function previousItem(list, item, disableListWrap) {
31
- if (list === item) {
32
- return disableListWrap ? list.firstChild : list.lastChild;
33
- }
34
- if (item && item.previousElementSibling) {
35
- return item.previousElementSibling;
36
- }
37
- return disableListWrap ? null : list.lastChild;
38
- }
39
22
  function textCriteriaMatches(nextFocus, textCriteria) {
40
23
  if (textCriteria === undefined) {
41
24
  return true;
@@ -54,29 +37,20 @@ function textCriteriaMatches(nextFocus, textCriteria) {
54
37
  }
55
38
  return text.startsWith(textCriteria.keys.join(''));
56
39
  }
57
- function moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, traversalFunction, textCriteria) {
58
- let wrappedOnce = false;
59
- let nextFocus = traversalFunction(list, currentFocus, currentFocus ? disableListWrap : false);
60
- while (nextFocus) {
61
- // Prevent infinite loop.
62
- if (nextFocus === list.firstChild) {
63
- if (wrappedOnce) {
64
- return false;
65
- }
66
- wrappedOnce = true;
67
- }
68
-
69
- // Same logic as useAutocomplete.js
70
- const nextFocusDisabled = disabledItemsFocusable ? false : nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';
71
- if (!nextFocus.hasAttribute('tabindex') || !textCriteriaMatches(nextFocus, textCriteria) || nextFocusDisabled) {
72
- // Move to the next element.
73
- nextFocus = traversalFunction(list, nextFocus, disableListWrap);
74
- } else {
75
- nextFocus.focus();
76
- return true;
77
- }
40
+ function shouldFocusWithTextCriteria(element, criteria, disabledItemsFocusable) {
41
+ if (!textCriteriaMatches(element, criteria)) {
42
+ return false;
43
+ }
44
+ return shouldFocus(element, disabledItemsFocusable);
45
+ }
46
+ function shouldFocus(element, disabledItemsFocusable) {
47
+ if (!element || !element.hasAttribute('tabindex')) {
48
+ return false;
49
+ }
50
+ if (disabledItemsFocusable) {
51
+ return true;
78
52
  }
79
- return false;
53
+ return !element.disabled && element.getAttribute('aria-disabled') !== 'true';
80
54
  }
81
55
 
82
56
  /**
@@ -127,65 +101,6 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
127
101
  return listRef.current;
128
102
  }
129
103
  }), []);
130
- const handleKeyDown = event => {
131
- const list = listRef.current;
132
- const key = event.key;
133
- const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
134
- if (isModifierKeyPressed) {
135
- if (onKeyDown) {
136
- onKeyDown(event);
137
- }
138
- return;
139
- }
140
-
141
- /**
142
- * @type {Element} - will always be defined since we are in a keydown handler
143
- * attached to an element. A keydown event is either dispatched to the activeElement
144
- * or document.body or document.documentElement. Only the first case will
145
- * trigger this specific handler.
146
- */
147
- const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(list));
148
- if (key === 'ArrowDown') {
149
- // Prevent scroll of the page
150
- event.preventDefault();
151
- moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, nextItem);
152
- } else if (key === 'ArrowUp') {
153
- event.preventDefault();
154
- moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, previousItem);
155
- } else if (key === 'Home') {
156
- event.preventDefault();
157
- moveFocus(list, null, disableListWrap, disabledItemsFocusable, nextItem);
158
- } else if (key === 'End') {
159
- event.preventDefault();
160
- moveFocus(list, null, disableListWrap, disabledItemsFocusable, previousItem);
161
- } else if (key.length === 1) {
162
- const criteria = textCriteriaRef.current;
163
- const lowerKey = key.toLowerCase();
164
- const currTime = performance.now();
165
- if (criteria.keys.length > 0) {
166
- // Reset
167
- if (currTime - criteria.lastTime > 500) {
168
- criteria.keys = [];
169
- criteria.repeating = true;
170
- criteria.previousKeyMatched = true;
171
- } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {
172
- criteria.repeating = false;
173
- }
174
- }
175
- criteria.lastTime = currTime;
176
- criteria.keys.push(lowerKey);
177
- const keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);
178
- if (criteria.previousKeyMatched && (keepFocusOnCurrent || moveFocus(list, currentFocus, false, disabledItemsFocusable, nextItem, criteria))) {
179
- event.preventDefault();
180
- } else {
181
- criteria.previousKeyMatched = false;
182
- }
183
- }
184
- if (onKeyDown) {
185
- onKeyDown(event);
186
- }
187
- };
188
- const handleRef = (0, _useForkRef.default)(listRef, ref);
189
104
 
190
105
  /**
191
106
  * the index of the item should receive focus
@@ -227,25 +142,80 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
227
142
  }
228
143
  }
229
144
  });
145
+ const {
146
+ focusNext,
147
+ getContainerProps,
148
+ getItemProps
149
+ } = (0, _useRovingTabIndex.default)({
150
+ focusableIndex: activeItemIndex,
151
+ orientation: 'vertical',
152
+ shouldWrap: !disableListWrap,
153
+ shouldFocus: element => shouldFocus(element, disabledItemsFocusable)
154
+ });
155
+ const rovingTabIndexContainerProps = getContainerProps();
156
+ const handleRef = (0, _useForkRef.default)(listRef, rovingTabIndexContainerProps.ref, ref);
157
+ let focusableIndex = 0;
230
158
  const items = React.Children.map(children, (child, index) => {
159
+ if (! /*#__PURE__*/React.isValidElement(child) || child.props.muiSkipListHighlight || child.type.muiSkipListHighlight) {
160
+ return child;
161
+ }
162
+ const rovingTabIndexItemProps = getItemProps(focusableIndex, child.ref);
163
+ const newChildProps = {
164
+ ref: rovingTabIndexItemProps.ref
165
+ };
166
+ if (child.props.tabIndex === undefined && variant === 'selectedMenu') {
167
+ newChildProps.tabIndex = rovingTabIndexItemProps.tabIndex;
168
+ }
231
169
  if (index === activeItemIndex) {
232
- const newChildProps = {};
233
170
  if (autoFocusItem) {
234
171
  newChildProps.autoFocus = true;
235
172
  }
236
- if (child.props.tabIndex === undefined && variant === 'selectedMenu') {
237
- newChildProps.tabIndex = 0;
238
- }
239
- return /*#__PURE__*/React.cloneElement(child, newChildProps);
240
173
  }
241
- return child;
174
+ focusableIndex += 1;
175
+ return /*#__PURE__*/React.cloneElement(child, newChildProps);
242
176
  });
177
+ const handleKeyDown = event => {
178
+ const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
179
+ if (isModifierKeyPressed && onKeyDown) {
180
+ onKeyDown(event);
181
+ return;
182
+ }
183
+ rovingTabIndexContainerProps.onKeyDown(event);
184
+ if (event.key.length === 1) {
185
+ const criteria = textCriteriaRef.current;
186
+ const lowerKey = event.key.toLowerCase();
187
+ const currTime = performance.now();
188
+ if (criteria.keys.length > 0) {
189
+ // Reset
190
+ if (currTime - criteria.lastTime > 500) {
191
+ criteria.keys = [];
192
+ criteria.repeating = true;
193
+ criteria.previousKeyMatched = true;
194
+ } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {
195
+ criteria.repeating = false;
196
+ }
197
+ }
198
+ criteria.lastTime = currTime;
199
+ criteria.keys.push(lowerKey);
200
+ const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(listRef.current));
201
+ const keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);
202
+ if (criteria.previousKeyMatched && (keepFocusOnCurrent || focusNext(element => shouldFocusWithTextCriteria(element, criteria, disabledItemsFocusable)) !== -1)) {
203
+ event.preventDefault();
204
+ } else {
205
+ criteria.previousKeyMatched = false;
206
+ }
207
+ }
208
+ if (onKeyDown) {
209
+ onKeyDown(event);
210
+ }
211
+ };
243
212
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_List.default, {
244
213
  role: "menu",
245
214
  ref: handleRef,
246
215
  className: className,
247
216
  onKeyDown: handleKeyDown,
248
- tabIndex: autoFocus ? 0 : -1,
217
+ onFocus: rovingTabIndexContainerProps.onFocus,
218
+ tabIndex: -1,
249
219
  ...other,
250
220
  children: items
251
221
  });
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import { isFragment } from 'react-is';
5
5
  import PropTypes from 'prop-types';
6
+ import useRovingTabIndex from "../utils/useRovingTabIndex.mjs";
6
7
  import ownerDocument from "../utils/ownerDocument.mjs";
7
8
  import List from "../List/index.mjs";
8
9
  import getActiveElement from "../utils/getActiveElement.mjs";
@@ -11,24 +12,6 @@ import useForkRef from "../utils/useForkRef.mjs";
11
12
  import useEnhancedEffect from "../utils/useEnhancedEffect.mjs";
12
13
  import { ownerWindow } from "../utils/index.mjs";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
- function nextItem(list, item, disableListWrap) {
15
- if (list === item) {
16
- return list.firstChild;
17
- }
18
- if (item && item.nextElementSibling) {
19
- return item.nextElementSibling;
20
- }
21
- return disableListWrap ? null : list.firstChild;
22
- }
23
- function previousItem(list, item, disableListWrap) {
24
- if (list === item) {
25
- return disableListWrap ? list.firstChild : list.lastChild;
26
- }
27
- if (item && item.previousElementSibling) {
28
- return item.previousElementSibling;
29
- }
30
- return disableListWrap ? null : list.lastChild;
31
- }
32
15
  function textCriteriaMatches(nextFocus, textCriteria) {
33
16
  if (textCriteria === undefined) {
34
17
  return true;
@@ -47,29 +30,20 @@ function textCriteriaMatches(nextFocus, textCriteria) {
47
30
  }
48
31
  return text.startsWith(textCriteria.keys.join(''));
49
32
  }
50
- function moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, traversalFunction, textCriteria) {
51
- let wrappedOnce = false;
52
- let nextFocus = traversalFunction(list, currentFocus, currentFocus ? disableListWrap : false);
53
- while (nextFocus) {
54
- // Prevent infinite loop.
55
- if (nextFocus === list.firstChild) {
56
- if (wrappedOnce) {
57
- return false;
58
- }
59
- wrappedOnce = true;
60
- }
61
-
62
- // Same logic as useAutocomplete.js
63
- const nextFocusDisabled = disabledItemsFocusable ? false : nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';
64
- if (!nextFocus.hasAttribute('tabindex') || !textCriteriaMatches(nextFocus, textCriteria) || nextFocusDisabled) {
65
- // Move to the next element.
66
- nextFocus = traversalFunction(list, nextFocus, disableListWrap);
67
- } else {
68
- nextFocus.focus();
69
- return true;
70
- }
33
+ function shouldFocusWithTextCriteria(element, criteria, disabledItemsFocusable) {
34
+ if (!textCriteriaMatches(element, criteria)) {
35
+ return false;
36
+ }
37
+ return shouldFocus(element, disabledItemsFocusable);
38
+ }
39
+ function shouldFocus(element, disabledItemsFocusable) {
40
+ if (!element || !element.hasAttribute('tabindex')) {
41
+ return false;
42
+ }
43
+ if (disabledItemsFocusable) {
44
+ return true;
71
45
  }
72
- return false;
46
+ return !element.disabled && element.getAttribute('aria-disabled') !== 'true';
73
47
  }
74
48
 
75
49
  /**
@@ -120,65 +94,6 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
120
94
  return listRef.current;
121
95
  }
122
96
  }), []);
123
- const handleKeyDown = event => {
124
- const list = listRef.current;
125
- const key = event.key;
126
- const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
127
- if (isModifierKeyPressed) {
128
- if (onKeyDown) {
129
- onKeyDown(event);
130
- }
131
- return;
132
- }
133
-
134
- /**
135
- * @type {Element} - will always be defined since we are in a keydown handler
136
- * attached to an element. A keydown event is either dispatched to the activeElement
137
- * or document.body or document.documentElement. Only the first case will
138
- * trigger this specific handler.
139
- */
140
- const currentFocus = getActiveElement(ownerDocument(list));
141
- if (key === 'ArrowDown') {
142
- // Prevent scroll of the page
143
- event.preventDefault();
144
- moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, nextItem);
145
- } else if (key === 'ArrowUp') {
146
- event.preventDefault();
147
- moveFocus(list, currentFocus, disableListWrap, disabledItemsFocusable, previousItem);
148
- } else if (key === 'Home') {
149
- event.preventDefault();
150
- moveFocus(list, null, disableListWrap, disabledItemsFocusable, nextItem);
151
- } else if (key === 'End') {
152
- event.preventDefault();
153
- moveFocus(list, null, disableListWrap, disabledItemsFocusable, previousItem);
154
- } else if (key.length === 1) {
155
- const criteria = textCriteriaRef.current;
156
- const lowerKey = key.toLowerCase();
157
- const currTime = performance.now();
158
- if (criteria.keys.length > 0) {
159
- // Reset
160
- if (currTime - criteria.lastTime > 500) {
161
- criteria.keys = [];
162
- criteria.repeating = true;
163
- criteria.previousKeyMatched = true;
164
- } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {
165
- criteria.repeating = false;
166
- }
167
- }
168
- criteria.lastTime = currTime;
169
- criteria.keys.push(lowerKey);
170
- const keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);
171
- if (criteria.previousKeyMatched && (keepFocusOnCurrent || moveFocus(list, currentFocus, false, disabledItemsFocusable, nextItem, criteria))) {
172
- event.preventDefault();
173
- } else {
174
- criteria.previousKeyMatched = false;
175
- }
176
- }
177
- if (onKeyDown) {
178
- onKeyDown(event);
179
- }
180
- };
181
- const handleRef = useForkRef(listRef, ref);
182
97
 
183
98
  /**
184
99
  * the index of the item should receive focus
@@ -220,25 +135,80 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
220
135
  }
221
136
  }
222
137
  });
138
+ const {
139
+ focusNext,
140
+ getContainerProps,
141
+ getItemProps
142
+ } = useRovingTabIndex({
143
+ focusableIndex: activeItemIndex,
144
+ orientation: 'vertical',
145
+ shouldWrap: !disableListWrap,
146
+ shouldFocus: element => shouldFocus(element, disabledItemsFocusable)
147
+ });
148
+ const rovingTabIndexContainerProps = getContainerProps();
149
+ const handleRef = useForkRef(listRef, rovingTabIndexContainerProps.ref, ref);
150
+ let focusableIndex = 0;
223
151
  const items = React.Children.map(children, (child, index) => {
152
+ if (! /*#__PURE__*/React.isValidElement(child) || child.props.muiSkipListHighlight || child.type.muiSkipListHighlight) {
153
+ return child;
154
+ }
155
+ const rovingTabIndexItemProps = getItemProps(focusableIndex, child.ref);
156
+ const newChildProps = {
157
+ ref: rovingTabIndexItemProps.ref
158
+ };
159
+ if (child.props.tabIndex === undefined && variant === 'selectedMenu') {
160
+ newChildProps.tabIndex = rovingTabIndexItemProps.tabIndex;
161
+ }
224
162
  if (index === activeItemIndex) {
225
- const newChildProps = {};
226
163
  if (autoFocusItem) {
227
164
  newChildProps.autoFocus = true;
228
165
  }
229
- if (child.props.tabIndex === undefined && variant === 'selectedMenu') {
230
- newChildProps.tabIndex = 0;
231
- }
232
- return /*#__PURE__*/React.cloneElement(child, newChildProps);
233
166
  }
234
- return child;
167
+ focusableIndex += 1;
168
+ return /*#__PURE__*/React.cloneElement(child, newChildProps);
235
169
  });
170
+ const handleKeyDown = event => {
171
+ const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
172
+ if (isModifierKeyPressed && onKeyDown) {
173
+ onKeyDown(event);
174
+ return;
175
+ }
176
+ rovingTabIndexContainerProps.onKeyDown(event);
177
+ if (event.key.length === 1) {
178
+ const criteria = textCriteriaRef.current;
179
+ const lowerKey = event.key.toLowerCase();
180
+ const currTime = performance.now();
181
+ if (criteria.keys.length > 0) {
182
+ // Reset
183
+ if (currTime - criteria.lastTime > 500) {
184
+ criteria.keys = [];
185
+ criteria.repeating = true;
186
+ criteria.previousKeyMatched = true;
187
+ } else if (criteria.repeating && lowerKey !== criteria.keys[0]) {
188
+ criteria.repeating = false;
189
+ }
190
+ }
191
+ criteria.lastTime = currTime;
192
+ criteria.keys.push(lowerKey);
193
+ const currentFocus = getActiveElement(ownerDocument(listRef.current));
194
+ const keepFocusOnCurrent = currentFocus && !criteria.repeating && textCriteriaMatches(currentFocus, criteria);
195
+ if (criteria.previousKeyMatched && (keepFocusOnCurrent || focusNext(element => shouldFocusWithTextCriteria(element, criteria, disabledItemsFocusable)) !== -1)) {
196
+ event.preventDefault();
197
+ } else {
198
+ criteria.previousKeyMatched = false;
199
+ }
200
+ }
201
+ if (onKeyDown) {
202
+ onKeyDown(event);
203
+ }
204
+ };
236
205
  return /*#__PURE__*/_jsx(List, {
237
206
  role: "menu",
238
207
  ref: handleRef,
239
208
  className: className,
240
209
  onKeyDown: handleKeyDown,
241
- tabIndex: autoFocus ? 0 : -1,
210
+ onFocus: rovingTabIndexContainerProps.onFocus,
211
+ tabIndex: -1,
242
212
  ...other,
243
213
  children: items
244
214
  });
package/Paper/Paper.d.mts CHANGED
@@ -45,6 +45,7 @@ export interface PaperTypeMap<AdditionalProps = {}, RootComponent extends React.
45
45
  * Demos:
46
46
  *
47
47
  * - [Card](https://next.mui.com/material-ui/react-card/)
48
+ * - [Menubar](https://next.mui.com/material-ui/react-menubar/)
48
49
  * - [Paper](https://next.mui.com/material-ui/react-paper/)
49
50
  *
50
51
  * API:
package/Paper/Paper.d.ts CHANGED
@@ -45,6 +45,7 @@ export interface PaperTypeMap<AdditionalProps = {}, RootComponent extends React.
45
45
  * Demos:
46
46
  *
47
47
  * - [Card](https://next.mui.com/material-ui/react-card/)
48
+ * - [Menubar](https://next.mui.com/material-ui/react-menubar/)
48
49
  * - [Paper](https://next.mui.com/material-ui/react-paper/)
49
50
  *
50
51
  * API:
@@ -73,6 +73,10 @@ const SpeedDialIconRoot = (0, _zeroStyled.styled)('span', {
73
73
  style: {
74
74
  [`& .${_speedDialIconClasses.default.icon}`]: {
75
75
  transform: 'rotate(45deg)'
76
+ },
77
+ [`& .${_speedDialIconClasses.default.openIcon}`]: {
78
+ transform: 'rotate(0deg)',
79
+ opacity: 1
76
80
  }
77
81
  }
78
82
  }, {
@@ -84,16 +88,6 @@ const SpeedDialIconRoot = (0, _zeroStyled.styled)('span', {
84
88
  opacity: 0
85
89
  }
86
90
  }
87
- }, {
88
- props: ({
89
- ownerState
90
- }) => ownerState.open,
91
- style: {
92
- [`& .${_speedDialIconClasses.default.openIcon}`]: {
93
- transform: 'rotate(0deg)',
94
- opacity: 1
95
- }
96
- }
97
91
  }]
98
92
  })));
99
93
  const SpeedDialIcon = /*#__PURE__*/React.forwardRef(function SpeedDialIcon(inProps, ref) {
@@ -66,6 +66,10 @@ const SpeedDialIconRoot = styled('span', {
66
66
  style: {
67
67
  [`& .${speedDialIconClasses.icon}`]: {
68
68
  transform: 'rotate(45deg)'
69
+ },
70
+ [`& .${speedDialIconClasses.openIcon}`]: {
71
+ transform: 'rotate(0deg)',
72
+ opacity: 1
69
73
  }
70
74
  }
71
75
  }, {
@@ -77,16 +81,6 @@ const SpeedDialIconRoot = styled('span', {
77
81
  opacity: 0
78
82
  }
79
83
  }
80
- }, {
81
- props: ({
82
- ownerState
83
- }) => ownerState.open,
84
- style: {
85
- [`& .${speedDialIconClasses.openIcon}`]: {
86
- transform: 'rotate(0deg)',
87
- opacity: 1
88
- }
89
- }
90
84
  }]
91
85
  })));
92
86
  const SpeedDialIcon = /*#__PURE__*/React.forwardRef(function SpeedDialIcon(inProps, ref) {
package/Step/Step.js CHANGED
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _integerPropType = _interopRequireDefault(require("@mui/utils/integerPropType"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
- var _StepperContext = _interopRequireDefault(require("../Stepper/StepperContext"));
15
+ var _StepperContext = require("../Stepper/StepperContext");
16
16
  var _StepContext = _interopRequireDefault(require("./StepContext"));
17
17
  var _zeroStyled = require("../zero-styled");
18
18
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
@@ -30,7 +30,7 @@ const useUtilityClasses = ownerState => {
30
30
  };
31
31
  return (0, _composeClasses.default)(slots, _stepClasses.getStepUtilityClass, classes);
32
32
  };
33
- const StepRoot = (0, _zeroStyled.styled)('div', {
33
+ const StepRoot = (0, _zeroStyled.styled)('li', {
34
34
  name: 'MuiStep',
35
35
  slot: 'Root',
36
36
  overridesResolver: (props, styles) => {
@@ -67,7 +67,7 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
67
67
  active: activeProp,
68
68
  children,
69
69
  className,
70
- component = 'div',
70
+ component = 'li',
71
71
  completed: completedProp,
72
72
  disabled: disabledProp,
73
73
  expanded = false,
@@ -80,8 +80,9 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
80
80
  connector,
81
81
  alternativeLabel,
82
82
  orientation,
83
- nonLinear
84
- } = React.useContext(_StepperContext.default);
83
+ nonLinear,
84
+ isTabList
85
+ } = (0, _StepperContext.useStepperContext)();
85
86
  let [active = false, completed = false, disabled = false] = [activeProp, completedProp, disabledProp];
86
87
  if (activeStep === index) {
87
88
  active = activeProp !== undefined ? activeProp : true;
@@ -115,6 +116,7 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
115
116
  className: (0, _clsx.default)(classes.root, className),
116
117
  ref: ref,
117
118
  ownerState: ownerState,
119
+ role: isTabList ? 'presentation' : undefined,
118
120
  ...other,
119
121
  children: [connector && alternativeLabel && index !== 0 ? connector : null, children]
120
122
  });
package/Step/Step.mjs CHANGED
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import integerPropType from '@mui/utils/integerPropType';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
- import StepperContext from "../Stepper/StepperContext.mjs";
8
+ import { useStepperContext } from "../Stepper/StepperContext.mjs";
9
9
  import StepContext from "./StepContext.mjs";
10
10
  import { styled } from "../zero-styled/index.mjs";
11
11
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
@@ -23,7 +23,7 @@ const useUtilityClasses = ownerState => {
23
23
  };
24
24
  return composeClasses(slots, getStepUtilityClass, classes);
25
25
  };
26
- const StepRoot = styled('div', {
26
+ const StepRoot = styled('li', {
27
27
  name: 'MuiStep',
28
28
  slot: 'Root',
29
29
  overridesResolver: (props, styles) => {
@@ -60,7 +60,7 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
60
60
  active: activeProp,
61
61
  children,
62
62
  className,
63
- component = 'div',
63
+ component = 'li',
64
64
  completed: completedProp,
65
65
  disabled: disabledProp,
66
66
  expanded = false,
@@ -73,8 +73,9 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
73
73
  connector,
74
74
  alternativeLabel,
75
75
  orientation,
76
- nonLinear
77
- } = React.useContext(StepperContext);
76
+ nonLinear,
77
+ isTabList
78
+ } = useStepperContext();
78
79
  let [active = false, completed = false, disabled = false] = [activeProp, completedProp, disabledProp];
79
80
  if (activeStep === index) {
80
81
  active = activeProp !== undefined ? activeProp : true;
@@ -108,6 +109,7 @@ const Step = /*#__PURE__*/React.forwardRef(function Step(inProps, ref) {
108
109
  className: clsx(classes.root, className),
109
110
  ref: ref,
110
111
  ownerState: ownerState,
112
+ role: isTabList ? 'presentation' : undefined,
111
113
  ...other,
112
114
  children: [connector && alternativeLabel && index !== 0 ? connector : null, children]
113
115
  });
@@ -16,7 +16,7 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
16
16
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
17
17
  var _StepLabel = _interopRequireDefault(require("../StepLabel"));
18
18
  var _isMuiElement = _interopRequireDefault(require("../utils/isMuiElement"));
19
- var _StepperContext = _interopRequireDefault(require("../Stepper/StepperContext"));
19
+ var _StepperContext = require("../Stepper/StepperContext");
20
20
  var _StepContext = _interopRequireDefault(require("../Step/StepContext"));
21
21
  var _stepButtonClasses = _interopRequireWildcard(require("./stepButtonClasses"));
22
22
  var _jsxRuntime = require("react/jsx-runtime");
@@ -75,11 +75,14 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
75
75
  } = props;
76
76
  const {
77
77
  disabled,
78
- active
78
+ active,
79
+ index
79
80
  } = React.useContext(_StepContext.default);
80
81
  const {
81
- orientation
82
- } = React.useContext(_StepperContext.default);
82
+ orientation,
83
+ totalSteps,
84
+ getRovingTabIndexProps
85
+ } = (0, _StepperContext.useStepperContext)();
83
86
  const ownerState = {
84
87
  ...props,
85
88
  orientation
@@ -93,6 +96,10 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
93
96
  ...childProps,
94
97
  children: children
95
98
  });
99
+ const rovingTabIndexItemProps = getRovingTabIndexProps?.(index, ref) ?? {
100
+ ref,
101
+ tabIndex: active ? 0 : -1
102
+ };
96
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StepButtonRoot, {
97
104
  focusRipple: true,
98
105
  disabled: disabled,
@@ -100,9 +107,12 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
100
107
  className: classes.touchRipple
101
108
  },
102
109
  className: (0, _clsx.default)(classes.root, className),
103
- ref: ref,
104
110
  ownerState: ownerState,
105
- "aria-current": active ? 'step' : undefined,
111
+ "aria-selected": active,
112
+ "aria-posinset": index + 1,
113
+ "aria-setsize": totalSteps,
114
+ role: "tab",
115
+ ...rovingTabIndexItemProps,
106
116
  ...other,
107
117
  children: child
108
118
  });