@mui/material 7.3.5 → 7.3.7
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.
- package/Accordion/Accordion.d.ts +56 -55
- package/Accordion/Accordion.js +3 -13
- package/Alert/Alert.js +1 -1
- package/AppBar/AppBar.d.ts +13 -2
- package/AppBar/AppBar.js +14 -2
- package/Backdrop/Backdrop.js +0 -1
- package/Button/Button.d.ts +1 -0
- package/ButtonBase/ButtonBase.js +8 -1
- package/ButtonBase/TouchRipple.js +1 -1
- package/ButtonGroup/ButtonGroup.js +8 -11
- package/CHANGELOG.md +144 -1
- package/CardActionArea/CardActionArea.js +0 -1
- package/Chip/Chip.js +1 -1
- package/CssBaseline/CssBaseline.d.ts +1 -1
- package/CssBaseline/CssBaseline.js +1 -1
- package/Dialog/Dialog.js +4 -3
- package/Dialog/dialogClasses.d.ts +2 -0
- package/Dialog/dialogClasses.js +1 -1
- package/FormControl/FormControl.d.ts +1 -0
- package/FormHelperText/FormHelperText.d.ts +1 -0
- package/FormLabel/FormLabel.d.ts +1 -0
- package/IconButton/IconButton.d.ts +1 -0
- package/InputLabel/InputLabel.d.ts +1 -0
- package/ListItem/ListItem.d.ts +5 -0
- package/ListItem/ListItem.js +19 -4
- package/MenuList/MenuList.js +2 -1
- package/Modal/ModalManager.js +1 -1
- package/OutlinedInput/OutlinedInput.d.ts +1 -0
- package/README.md +2 -2
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
- package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/Select/SelectInput.d.ts +2 -0
- package/Select/SelectInput.js +25 -4
- package/Slider/Slider.d.ts +1 -1
- package/Slider/useSlider.types.d.ts +1 -1
- package/Snackbar/Snackbar.js +1 -3
- package/Tabs/Tabs.d.ts +1 -1
- package/Tabs/Tabs.js +4 -3
- package/TextField/TextField.d.ts +10 -5
- package/Unstable_TrapFocus/FocusTrap.js +13 -8
- package/esm/Accordion/Accordion.d.ts +56 -55
- package/esm/Accordion/Accordion.js +3 -13
- package/esm/Alert/Alert.js +1 -1
- package/esm/AppBar/AppBar.d.ts +13 -2
- package/esm/AppBar/AppBar.js +14 -2
- package/esm/Backdrop/Backdrop.js +0 -1
- package/esm/Button/Button.d.ts +1 -0
- package/esm/ButtonBase/ButtonBase.js +8 -1
- package/esm/ButtonBase/TouchRipple.js +1 -1
- package/esm/ButtonGroup/ButtonGroup.js +8 -11
- package/esm/CardActionArea/CardActionArea.js +0 -1
- package/esm/Chip/Chip.js +1 -1
- package/esm/CssBaseline/CssBaseline.d.ts +1 -1
- package/esm/CssBaseline/CssBaseline.js +1 -1
- package/esm/Dialog/Dialog.js +4 -3
- package/esm/Dialog/dialogClasses.d.ts +2 -0
- package/esm/Dialog/dialogClasses.js +1 -1
- package/esm/FormControl/FormControl.d.ts +1 -0
- package/esm/FormHelperText/FormHelperText.d.ts +1 -0
- package/esm/FormLabel/FormLabel.d.ts +1 -0
- package/esm/IconButton/IconButton.d.ts +1 -0
- package/esm/InputLabel/InputLabel.d.ts +1 -0
- package/esm/ListItem/ListItem.d.ts +5 -0
- package/esm/ListItem/ListItem.js +19 -4
- package/esm/MenuList/MenuList.js +2 -1
- package/esm/Modal/ModalManager.js +1 -1
- package/esm/OutlinedInput/OutlinedInput.d.ts +1 -0
- package/esm/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
- package/esm/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/esm/Select/SelectInput.d.ts +2 -0
- package/esm/Select/SelectInput.js +25 -4
- package/esm/Slider/Slider.d.ts +1 -1
- package/esm/Slider/useSlider.types.d.ts +1 -1
- package/esm/Snackbar/Snackbar.js +1 -3
- package/esm/Tabs/Tabs.d.ts +1 -1
- package/esm/Tabs/Tabs.js +4 -3
- package/esm/TextField/TextField.d.ts +10 -5
- package/esm/Unstable_TrapFocus/FocusTrap.js +13 -8
- package/esm/index.js +1 -1
- package/esm/internal/SwitchBase.js +1 -1
- package/esm/locale/arEG.js +1 -1
- package/esm/locale/arSA.js +1 -1
- package/esm/locale/arSD.js +1 -1
- package/esm/locale/kuCKB.js +1 -1
- package/esm/locale/neNP.js +1 -1
- package/esm/styles/createThemeNoVars.d.ts +4 -3
- package/esm/styles/createThemeWithVars.d.ts +2 -2
- package/esm/useAutocomplete/useAutocomplete.js +62 -16
- package/esm/utils/getActiveElement.d.ts +2 -0
- package/esm/utils/getActiveElement.js +2 -0
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/internal/SwitchBase.js +1 -1
- package/locale/arEG.js +1 -1
- package/locale/arSA.js +1 -1
- package/locale/arSD.js +1 -1
- package/locale/kuCKB.js +1 -1
- package/locale/neNP.js +1 -1
- package/package.json +8 -8
- package/styles/createThemeNoVars.d.ts +4 -3
- package/styles/createThemeWithVars.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +62 -16
- package/utils/getActiveElement.d.ts +2 -0
- package/utils/getActiveElement.js +9 -0
- package/version/index.js +2 -2
package/ListItem/ListItem.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { SxProps } from '@mui/system';
|
|
|
3
3
|
import { Theme } from "../styles/index.js";
|
|
4
4
|
import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
|
|
5
5
|
import { ListItemClasses } from "./listItemClasses.js";
|
|
6
|
+
import { SlotProps } from "../utils/types.js";
|
|
6
7
|
export interface ListItemComponentsPropsOverrides {}
|
|
8
|
+
export interface ListItemSecondaryActionSlotPropsOverrides {}
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* This type is kept for compatibility. Use `ListItemOwnProps` instead.
|
|
@@ -65,6 +67,7 @@ export interface ListItemBaseProps {
|
|
|
65
67
|
*/
|
|
66
68
|
sx?: SxProps<Theme>;
|
|
67
69
|
}
|
|
70
|
+
export interface ListItemOwnerState extends Omit<ListItemProps, 'slots' | 'slotProps'> {}
|
|
68
71
|
export interface ListItemOwnProps extends ListItemBaseProps {
|
|
69
72
|
/**
|
|
70
73
|
* The components used for each slot inside.
|
|
@@ -93,6 +96,7 @@ export interface ListItemOwnProps extends ListItemBaseProps {
|
|
|
93
96
|
*/
|
|
94
97
|
slotProps?: {
|
|
95
98
|
root?: React.HTMLAttributes<HTMLDivElement> & ListItemComponentsPropsOverrides;
|
|
99
|
+
secondaryAction?: SlotProps<React.ElementType<React.HTMLAttributes<HTMLDivElement>>, ListItemSecondaryActionSlotPropsOverrides, ListItemOwnerState>;
|
|
96
100
|
};
|
|
97
101
|
/**
|
|
98
102
|
* The components used for each slot inside.
|
|
@@ -101,6 +105,7 @@ export interface ListItemOwnProps extends ListItemBaseProps {
|
|
|
101
105
|
*/
|
|
102
106
|
slots?: {
|
|
103
107
|
root?: React.ElementType;
|
|
108
|
+
secondaryAction?: React.ElementType;
|
|
104
109
|
};
|
|
105
110
|
}
|
|
106
111
|
export interface ListItemTypeMap<AdditionalProps, RootComponent extends React.ElementType> {
|
package/ListItem/ListItem.js
CHANGED
|
@@ -19,6 +19,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
|
19
19
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
20
20
|
var _isMuiElement = _interopRequireDefault(require("../utils/isMuiElement"));
|
|
21
21
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
22
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
22
23
|
var _ListContext = _interopRequireDefault(require("../List/ListContext"));
|
|
23
24
|
var _listItemClasses = require("./listItemClasses");
|
|
24
25
|
var _ListItemButton = require("../ListItemButton");
|
|
@@ -43,7 +44,8 @@ const useUtilityClasses = ownerState => {
|
|
|
43
44
|
} = ownerState;
|
|
44
45
|
const slots = {
|
|
45
46
|
root: ['root', dense && 'dense', !disableGutters && 'gutters', !disablePadding && 'padding', divider && 'divider', alignItems === 'flex-start' && 'alignItemsFlexStart', hasSecondaryAction && 'secondaryAction'],
|
|
46
|
-
container: ['container']
|
|
47
|
+
container: ['container'],
|
|
48
|
+
secondaryAction: ['secondaryAction']
|
|
47
49
|
};
|
|
48
50
|
return (0, _composeClasses.default)(slots, _listItemClasses.getListItemUtilityClass, classes);
|
|
49
51
|
};
|
|
@@ -205,6 +207,16 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
|
|
|
205
207
|
};
|
|
206
208
|
const classes = useUtilityClasses(ownerState);
|
|
207
209
|
const handleRef = (0, _useForkRef.default)(listItemRef, ref);
|
|
210
|
+
const externalForwardedProps = {
|
|
211
|
+
slots,
|
|
212
|
+
slotProps
|
|
213
|
+
};
|
|
214
|
+
const [SecondaryActionSlot, secondaryActionSlotProps] = (0, _useSlot.default)('secondaryAction', {
|
|
215
|
+
elementType: _ListItemSecondaryAction.default,
|
|
216
|
+
externalForwardedProps,
|
|
217
|
+
ownerState,
|
|
218
|
+
className: classes.secondaryAction
|
|
219
|
+
});
|
|
208
220
|
const Root = slots.root || components.Root || ListItemRoot;
|
|
209
221
|
const rootProps = slotProps.root || componentsProps.root || {};
|
|
210
222
|
const componentProps = {
|
|
@@ -262,7 +274,8 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
|
|
|
262
274
|
}
|
|
263
275
|
}),
|
|
264
276
|
...componentProps,
|
|
265
|
-
children: [children, secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
277
|
+
children: [children, secondaryAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(SecondaryActionSlot, {
|
|
278
|
+
...secondaryActionSlotProps,
|
|
266
279
|
children: secondaryAction
|
|
267
280
|
})]
|
|
268
281
|
})
|
|
@@ -377,7 +390,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
|
|
|
377
390
|
* @default {}
|
|
378
391
|
*/
|
|
379
392
|
slotProps: _propTypes.default.shape({
|
|
380
|
-
root: _propTypes.default.object
|
|
393
|
+
root: _propTypes.default.object,
|
|
394
|
+
secondaryAction: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
381
395
|
}),
|
|
382
396
|
/**
|
|
383
397
|
* The components used for each slot inside.
|
|
@@ -385,7 +399,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
|
|
|
385
399
|
* @default {}
|
|
386
400
|
*/
|
|
387
401
|
slots: _propTypes.default.shape({
|
|
388
|
-
root: _propTypes.default.elementType
|
|
402
|
+
root: _propTypes.default.elementType,
|
|
403
|
+
secondaryAction: _propTypes.default.elementType
|
|
389
404
|
}),
|
|
390
405
|
/**
|
|
391
406
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
package/MenuList/MenuList.js
CHANGED
|
@@ -12,6 +12,7 @@ var _reactIs = require("react-is");
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
14
14
|
var _List = _interopRequireDefault(require("../List"));
|
|
15
|
+
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
15
16
|
var _getScrollbarSize = _interopRequireDefault(require("../utils/getScrollbarSize"));
|
|
16
17
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
17
18
|
var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
|
|
@@ -143,7 +144,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
143
144
|
* or document.body or document.documentElement. Only the first case will
|
|
144
145
|
* trigger this specific handler.
|
|
145
146
|
*/
|
|
146
|
-
const currentFocus = (0, _ownerDocument.default)(list)
|
|
147
|
+
const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(list));
|
|
147
148
|
if (key === 'ArrowDown') {
|
|
148
149
|
// Prevent scroll of the page
|
|
149
150
|
event.preventDefault();
|
package/Modal/ModalManager.js
CHANGED
|
@@ -25,7 +25,7 @@ function ariaHidden(element, hide) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function getPaddingRight(element) {
|
|
28
|
-
return
|
|
28
|
+
return parseFloat((0, _ownerWindow.default)(element).getComputedStyle(element).paddingRight) || 0;
|
|
29
29
|
}
|
|
30
30
|
function isAriaHiddenForbiddenOnElement(element) {
|
|
31
31
|
// The forbidden HTML tags are the ones from ARIA specification that
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Our documentation features [a collection of example projects using Material UI]
|
|
|
33
33
|
|
|
34
34
|
## Contributing
|
|
35
35
|
|
|
36
|
-
Read the [contributing guide](
|
|
36
|
+
Read the [contributing guide](../../CONTRIBUTING.md) to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.
|
|
37
37
|
|
|
38
38
|
Contributing to Material UI is about more than just issues and pull requests!
|
|
39
39
|
There are many other ways to [support Material UI](https://mui.com/material-ui/getting-started/faq/#mui-is-awesome-how-can-i-support-the-project) beyond contributing to the code base.
|
|
@@ -49,7 +49,7 @@ Future plans and high-priority features and enhancements can be found in the [ro
|
|
|
49
49
|
## License
|
|
50
50
|
|
|
51
51
|
This project is licensed under the terms of the
|
|
52
|
-
[MIT license](
|
|
52
|
+
[MIT license](../../LICENSE).
|
|
53
53
|
|
|
54
54
|
## Security
|
|
55
55
|
|
|
@@ -14,7 +14,7 @@ export interface ScopedCssBaselineOwnProps {
|
|
|
14
14
|
classes?: Partial<ScopedCssBaselineClasses>;
|
|
15
15
|
/**
|
|
16
16
|
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
17
|
-
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
17
|
+
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
|
|
18
18
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
19
19
|
*/
|
|
20
20
|
enableColorScheme?: boolean;
|
|
@@ -114,7 +114,7 @@ process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes /* remove-pr
|
|
|
114
114
|
component: _propTypes.default.elementType,
|
|
115
115
|
/**
|
|
116
116
|
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
117
|
-
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
117
|
+
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
|
|
118
118
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
119
119
|
*/
|
|
120
120
|
enableColorScheme: _propTypes.default.bool,
|
package/Select/SelectInput.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface SelectInputProps<Value = unknown> {
|
|
|
41
41
|
onChange?: (event: SelectChangeEvent<Value>, child: React.ReactNode) => void;
|
|
42
42
|
onClose?: (event: React.SyntheticEvent) => void;
|
|
43
43
|
onFocus?: React.FocusEventHandler<any>;
|
|
44
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
45
|
+
onMouseDown?: React.MouseEventHandler;
|
|
44
46
|
onOpen?: (event: React.SyntheticEvent) => void;
|
|
45
47
|
open?: boolean;
|
|
46
48
|
readOnly?: boolean;
|
package/Select/SelectInput.js
CHANGED
|
@@ -135,6 +135,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
135
135
|
onChange,
|
|
136
136
|
onClose,
|
|
137
137
|
onFocus,
|
|
138
|
+
// eslint-disable-next-line react/prop-types
|
|
139
|
+
onKeyDown,
|
|
140
|
+
// eslint-disable-next-line react/prop-types
|
|
141
|
+
onMouseDown,
|
|
138
142
|
onOpen,
|
|
139
143
|
open: openProp,
|
|
140
144
|
readOnly,
|
|
@@ -180,6 +184,22 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
180
184
|
node: inputRef.current,
|
|
181
185
|
value
|
|
182
186
|
}), [value]);
|
|
187
|
+
const open = displayNode !== null && openState;
|
|
188
|
+
React.useEffect(() => {
|
|
189
|
+
if (!open || !anchorElement || autoWidth) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
const observer = new ResizeObserver(() => {
|
|
196
|
+
setMenuMinWidthState(anchorElement.clientWidth);
|
|
197
|
+
});
|
|
198
|
+
observer.observe(anchorElement);
|
|
199
|
+
return () => {
|
|
200
|
+
observer.disconnect();
|
|
201
|
+
};
|
|
202
|
+
}, [open, anchorElement, autoWidth]);
|
|
183
203
|
|
|
184
204
|
// Resize menu on `defaultOpen` automatic toggle.
|
|
185
205
|
React.useEffect(() => {
|
|
@@ -215,8 +235,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
215
235
|
}
|
|
216
236
|
return undefined;
|
|
217
237
|
}, [labelId]);
|
|
218
|
-
const update = (
|
|
219
|
-
if (
|
|
238
|
+
const update = (openParam, event) => {
|
|
239
|
+
if (openParam) {
|
|
220
240
|
if (onOpen) {
|
|
221
241
|
onOpen(event);
|
|
222
242
|
}
|
|
@@ -225,10 +245,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
225
245
|
}
|
|
226
246
|
if (!isOpenControlled) {
|
|
227
247
|
setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
|
|
228
|
-
setOpenState(
|
|
248
|
+
setOpenState(openParam);
|
|
229
249
|
}
|
|
230
250
|
};
|
|
231
251
|
const handleMouseDown = event => {
|
|
252
|
+
onMouseDown?.(event);
|
|
232
253
|
// Ignore everything but left-click
|
|
233
254
|
if (event.button !== 0) {
|
|
234
255
|
return;
|
|
@@ -308,9 +329,9 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
308
329
|
event.preventDefault();
|
|
309
330
|
update(true, event);
|
|
310
331
|
}
|
|
332
|
+
onKeyDown?.(event);
|
|
311
333
|
}
|
|
312
334
|
};
|
|
313
|
-
const open = displayNode !== null && openState;
|
|
314
335
|
const handleBlur = event => {
|
|
315
336
|
// if open event.stopImmediatePropagation
|
|
316
337
|
if (!open && onBlur) {
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export interface SliderOwnProps<Value extends number | number[]> {
|
|
|
113
113
|
* If an array, it should contain objects with `value` and an optional `label` keys.
|
|
114
114
|
* @default false
|
|
115
115
|
*/
|
|
116
|
-
marks?: boolean | Mark[];
|
|
116
|
+
marks?: boolean | readonly Mark[];
|
|
117
117
|
/**
|
|
118
118
|
* The maximum allowed value of the slider.
|
|
119
119
|
* Should not be equal to min.
|
|
@@ -198,7 +198,7 @@ export interface UseSliderReturnValue {
|
|
|
198
198
|
/**
|
|
199
199
|
* The marks of the slider. Marks indicate predetermined values to which the user can move the slider.
|
|
200
200
|
*/
|
|
201
|
-
marks: Mark[];
|
|
201
|
+
marks: readonly Mark[];
|
|
202
202
|
/**
|
|
203
203
|
* The thumb index for the current value when in hover state.
|
|
204
204
|
*/
|
package/Snackbar/Snackbar.js
CHANGED
|
@@ -164,9 +164,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
164
164
|
const {
|
|
165
165
|
getRootProps,
|
|
166
166
|
onClickAway
|
|
167
|
-
} = (0, _useSnackbar.default)(
|
|
168
|
-
...ownerState
|
|
169
|
-
});
|
|
167
|
+
} = (0, _useSnackbar.default)(ownerState);
|
|
170
168
|
const [exited, setExited] = React.useState(true);
|
|
171
169
|
const handleExited = node => {
|
|
172
170
|
setExited(true);
|
package/Tabs/Tabs.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export type TabsSlotsAndSlotProps = CreateSlotsAndSlotProps<TabsSlots, {
|
|
|
87
87
|
*/
|
|
88
88
|
indicator: SlotProps<'span', TabsIndicatorSlotPropsOverrides, TabsOwnerState>;
|
|
89
89
|
/**
|
|
90
|
-
* Props forwarded to the
|
|
90
|
+
* Props forwarded to the scrollButtons slot.
|
|
91
91
|
* By default, the available props are based on the [TabScrollButton](https://mui.com/material-ui/api/tab-scroll-button/#props) component.
|
|
92
92
|
*/
|
|
93
93
|
scrollButtons: SlotProps<typeof TabScrollButton, TabsScrollButtonsSlotPropsOverrides, TabsOwnerState>;
|
package/Tabs/Tabs.js
CHANGED
|
@@ -26,6 +26,7 @@ var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallbac
|
|
|
26
26
|
var _tabsClasses = _interopRequireWildcard(require("./tabsClasses"));
|
|
27
27
|
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
28
28
|
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
|
29
|
+
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
29
30
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
const nextItem = (list, item) => {
|
|
@@ -351,7 +352,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
351
352
|
slots,
|
|
352
353
|
slotProps: {
|
|
353
354
|
indicator: TabIndicatorProps,
|
|
354
|
-
|
|
355
|
+
scrollButtons: TabScrollButtonProps,
|
|
355
356
|
...slotProps
|
|
356
357
|
}
|
|
357
358
|
};
|
|
@@ -704,11 +705,11 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
704
705
|
return;
|
|
705
706
|
}
|
|
706
707
|
const list = tabListRef.current;
|
|
707
|
-
const currentFocus = (0, _ownerDocument.default)(list)
|
|
708
|
+
const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(list));
|
|
708
709
|
// Keyboard navigation assumes that [role="tab"] are siblings
|
|
709
710
|
// though we might warn in the future about nested, interactive elements
|
|
710
711
|
// as a a11y violation
|
|
711
|
-
const role = currentFocus
|
|
712
|
+
const role = currentFocus?.getAttribute('role');
|
|
712
713
|
if (role !== 'tab') {
|
|
713
714
|
return;
|
|
714
715
|
}
|
package/TextField/TextField.d.ts
CHANGED
|
@@ -47,22 +47,27 @@ export interface TextFieldSlots {
|
|
|
47
47
|
*/
|
|
48
48
|
select: React.ElementType;
|
|
49
49
|
}
|
|
50
|
+
export interface TextFieldRootSlotPropsOverrides {}
|
|
51
|
+
export interface TextFieldInputSlotPropsOverrides {}
|
|
52
|
+
export interface TextFieldInputLabelSlotPropsOverrides {}
|
|
53
|
+
export interface TextFieldFormHelperTextSlotPropsOverrides {}
|
|
54
|
+
export interface TextFieldSelectSlotPropsOverrides {}
|
|
50
55
|
export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps<TextFieldSlots, {
|
|
51
56
|
/**
|
|
52
57
|
* Props forwarded to the root slot.
|
|
53
58
|
* By default, the available props are based on the [FormControl](https://mui.com/material-ui/api/form-control/#props) component.
|
|
54
59
|
*/
|
|
55
|
-
root: SlotProps<React.ElementType<FormControlProps>,
|
|
60
|
+
root: SlotProps<React.ElementType<FormControlProps>, TextFieldRootSlotPropsOverrides, TextFieldOwnerState>;
|
|
56
61
|
/**
|
|
57
62
|
* Props forwarded to the input slot.
|
|
58
63
|
* By default, the available props are based on the [Input](https://mui.com/material-ui/api/input/#props) component.
|
|
59
64
|
*/
|
|
60
|
-
input: SlotProps<React.ElementType<InputPropsType>,
|
|
65
|
+
input: SlotProps<React.ElementType<InputPropsType>, TextFieldInputSlotPropsOverrides, TextFieldOwnerState>;
|
|
61
66
|
/**
|
|
62
67
|
* Props forwarded to the input label slot.
|
|
63
68
|
* By default, the available props are based on the [InputLabel](https://mui.com/material-ui/api/input-label/#props) component.
|
|
64
69
|
*/
|
|
65
|
-
inputLabel: SlotProps<React.ElementType<InputLabelProps>,
|
|
70
|
+
inputLabel: SlotProps<React.ElementType<InputLabelProps>, TextFieldInputLabelSlotPropsOverrides, TextFieldOwnerState>;
|
|
66
71
|
/**
|
|
67
72
|
* Props forwarded to the html input slot.
|
|
68
73
|
* By default, the available props are based on the html input element.
|
|
@@ -72,12 +77,12 @@ export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps
|
|
|
72
77
|
* Props forwarded to the form helper text slot.
|
|
73
78
|
* By default, the available props are based on the [FormHelperText](https://mui.com/material-ui/api/form-helper-text/#props) component.
|
|
74
79
|
*/
|
|
75
|
-
formHelperText: SlotProps<React.ElementType<FormHelperTextProps>,
|
|
80
|
+
formHelperText: SlotProps<React.ElementType<FormHelperTextProps>, TextFieldFormHelperTextSlotPropsOverrides, TextFieldOwnerState>;
|
|
76
81
|
/**
|
|
77
82
|
* Props forwarded to the select slot.
|
|
78
83
|
* By default, the available props are based on the [Select](https://mui.com/material-ui/api/select/#props) component.
|
|
79
84
|
*/
|
|
80
|
-
select: SlotProps<React.ElementType<SelectProps>,
|
|
85
|
+
select: SlotProps<React.ElementType<SelectProps>, TextFieldSelectSlotPropsOverrides, TextFieldOwnerState>;
|
|
81
86
|
}>;
|
|
82
87
|
export interface BaseTextFieldProps extends StandardProps<FormControlProps,
|
|
83
88
|
// event handlers are declared on derived interfaces
|
|
@@ -15,6 +15,7 @@ var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"))
|
|
|
15
15
|
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
16
16
|
var _exactProp = _interopRequireDefault(require("@mui/utils/exactProp"));
|
|
17
17
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
18
|
+
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
// Inspired by https://github.com/focus-trap/tabbable
|
|
20
21
|
const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
|
|
@@ -118,7 +119,8 @@ function FocusTrap(props) {
|
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
121
|
const doc = (0, _ownerDocument.default)(rootRef.current);
|
|
121
|
-
|
|
122
|
+
const activeElement = (0, _getActiveElement.default)(doc);
|
|
123
|
+
if (!rootRef.current.contains(activeElement)) {
|
|
122
124
|
if (!rootRef.current.hasAttribute('tabIndex')) {
|
|
123
125
|
if (process.env.NODE_ENV !== 'production') {
|
|
124
126
|
console.error(['MUI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to "-1".'].join('\n'));
|
|
@@ -158,10 +160,11 @@ function FocusTrap(props) {
|
|
|
158
160
|
if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
|
|
159
161
|
return;
|
|
160
162
|
}
|
|
163
|
+
const activeElement = (0, _getActiveElement.default)(doc);
|
|
161
164
|
|
|
162
165
|
// Make sure the next tab starts from the right place.
|
|
163
|
-
//
|
|
164
|
-
if (
|
|
166
|
+
// activeElement refers to the origin.
|
|
167
|
+
if (activeElement === rootRef.current && nativeEvent.shiftKey) {
|
|
165
168
|
// We need to ignore the next contain as
|
|
166
169
|
// it will try to move the focus back to the rootRef element.
|
|
167
170
|
ignoreNextEnforceFocus.current = true;
|
|
@@ -178,23 +181,24 @@ function FocusTrap(props) {
|
|
|
178
181
|
if (rootElement === null) {
|
|
179
182
|
return;
|
|
180
183
|
}
|
|
184
|
+
const activeEl = (0, _getActiveElement.default)(doc);
|
|
181
185
|
if (!doc.hasFocus() || !isEnabled() || ignoreNextEnforceFocus.current) {
|
|
182
186
|
ignoreNextEnforceFocus.current = false;
|
|
183
187
|
return;
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
// The focus is already inside
|
|
187
|
-
if (rootElement.contains(
|
|
191
|
+
if (rootElement.contains(activeEl)) {
|
|
188
192
|
return;
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
// The disableEnforceFocus is set and the focus is outside of the focus trap (and sentinel nodes)
|
|
192
|
-
if (disableEnforceFocus &&
|
|
196
|
+
if (disableEnforceFocus && activeEl !== sentinelStart.current && activeEl !== sentinelEnd.current) {
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
// if the focus event is not coming from inside the children's react tree, reset the refs
|
|
197
|
-
if (
|
|
201
|
+
if (activeEl !== reactFocusEventTarget.current) {
|
|
198
202
|
reactFocusEventTarget.current = null;
|
|
199
203
|
} else if (reactFocusEventTarget.current !== null) {
|
|
200
204
|
return;
|
|
@@ -203,7 +207,7 @@ function FocusTrap(props) {
|
|
|
203
207
|
return;
|
|
204
208
|
}
|
|
205
209
|
let tabbable = [];
|
|
206
|
-
if (
|
|
210
|
+
if (activeEl === sentinelStart.current || activeEl === sentinelEnd.current) {
|
|
207
211
|
tabbable = getTabbable(rootRef.current);
|
|
208
212
|
}
|
|
209
213
|
|
|
@@ -235,7 +239,8 @@ function FocusTrap(props) {
|
|
|
235
239
|
// The whatwg spec defines how the browser should behave but does not explicitly mention any events:
|
|
236
240
|
// https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
|
|
237
241
|
const interval = setInterval(() => {
|
|
238
|
-
|
|
242
|
+
const activeEl = (0, _getActiveElement.default)(doc);
|
|
243
|
+
if (activeEl && activeEl.tagName === 'BODY') {
|
|
239
244
|
contain();
|
|
240
245
|
}
|
|
241
246
|
}, 50);
|
|
@@ -55,62 +55,63 @@ export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<AccordionSlots,
|
|
|
55
55
|
*/
|
|
56
56
|
region: SlotProps<'div', AccordionRegionSlotPropsOverrides, AccordionOwnerState>;
|
|
57
57
|
}>;
|
|
58
|
+
export interface AccordionOwnProps {
|
|
59
|
+
/**
|
|
60
|
+
* The content of the component.
|
|
61
|
+
*/
|
|
62
|
+
children: NonNullable<React.ReactNode>;
|
|
63
|
+
/**
|
|
64
|
+
* Override or extend the styles applied to the component.
|
|
65
|
+
*/
|
|
66
|
+
classes?: Partial<AccordionClasses>;
|
|
67
|
+
/**
|
|
68
|
+
* If `true`, expands the accordion by default.
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
defaultExpanded?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, the component is disabled.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* If `true`, it removes the margin between two expanded accordion items and prevents the increased height when expanded.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
disableGutters?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* If `true`, expands the accordion, otherwise collapses it.
|
|
84
|
+
* Setting this prop enables control over the accordion.
|
|
85
|
+
*/
|
|
86
|
+
expanded?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Callback fired when the expand/collapse state is changed.
|
|
89
|
+
*
|
|
90
|
+
* @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
|
|
91
|
+
* @param {boolean} expanded The `expanded` state of the accordion.
|
|
92
|
+
*/
|
|
93
|
+
onChange?: (event: React.SyntheticEvent, expanded: boolean) => void;
|
|
94
|
+
/**
|
|
95
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
96
|
+
*/
|
|
97
|
+
sx?: SxProps<Theme>;
|
|
98
|
+
/**
|
|
99
|
+
* The component used for the transition.
|
|
100
|
+
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
101
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
102
|
+
*/
|
|
103
|
+
TransitionComponent?: React.JSXElementConstructor<TransitionProps & {
|
|
104
|
+
children?: React.ReactElement<unknown, any>;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Props applied to the transition element.
|
|
108
|
+
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
109
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
110
|
+
*/
|
|
111
|
+
TransitionProps?: TransitionProps;
|
|
112
|
+
}
|
|
58
113
|
export type AccordionTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div'> = ExtendPaperTypeMap<{
|
|
59
|
-
props: AdditionalProps &
|
|
60
|
-
/**
|
|
61
|
-
* The content of the component.
|
|
62
|
-
*/
|
|
63
|
-
children: NonNullable<React.ReactNode>;
|
|
64
|
-
/**
|
|
65
|
-
* Override or extend the styles applied to the component.
|
|
66
|
-
*/
|
|
67
|
-
classes?: Partial<AccordionClasses>;
|
|
68
|
-
/**
|
|
69
|
-
* If `true`, expands the accordion by default.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
defaultExpanded?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* If `true`, the component is disabled.
|
|
75
|
-
* @default false
|
|
76
|
-
*/
|
|
77
|
-
disabled?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* If `true`, it removes the margin between two expanded accordion items and the increase of height.
|
|
80
|
-
* @default false
|
|
81
|
-
*/
|
|
82
|
-
disableGutters?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* If `true`, expands the accordion, otherwise collapse it.
|
|
85
|
-
* Setting this prop enables control over the accordion.
|
|
86
|
-
*/
|
|
87
|
-
expanded?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Callback fired when the expand/collapse state is changed.
|
|
90
|
-
*
|
|
91
|
-
* @param {React.SyntheticEvent} event The event source of the callback. **Warning**: This is a generic event not a change event.
|
|
92
|
-
* @param {boolean} expanded The `expanded` state of the accordion.
|
|
93
|
-
*/
|
|
94
|
-
onChange?: (event: React.SyntheticEvent, expanded: boolean) => void;
|
|
95
|
-
/**
|
|
96
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
97
|
-
*/
|
|
98
|
-
sx?: SxProps<Theme>;
|
|
99
|
-
/**
|
|
100
|
-
* The component used for the transition.
|
|
101
|
-
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
102
|
-
* @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
103
|
-
*/
|
|
104
|
-
TransitionComponent?: React.JSXElementConstructor<TransitionProps & {
|
|
105
|
-
children?: React.ReactElement<unknown, any>;
|
|
106
|
-
}>;
|
|
107
|
-
/**
|
|
108
|
-
* Props applied to the transition element.
|
|
109
|
-
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
110
|
-
* @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
111
|
-
*/
|
|
112
|
-
TransitionProps?: TransitionProps;
|
|
113
|
-
} & AccordionSlotsAndSlotProps;
|
|
114
|
+
props: AdditionalProps & AccordionOwnProps & AccordionSlotsAndSlotProps;
|
|
114
115
|
defaultComponent: RootComponent;
|
|
115
116
|
}, 'onChange' | 'classes'>;
|
|
116
117
|
|
|
@@ -142,7 +142,6 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
142
142
|
disableGutters = false,
|
|
143
143
|
expanded: expandedProp,
|
|
144
144
|
onChange,
|
|
145
|
-
square = false,
|
|
146
145
|
slots = {},
|
|
147
146
|
slotProps = {},
|
|
148
147
|
TransitionComponent: TransitionComponentProp,
|
|
@@ -170,7 +169,6 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
170
169
|
}), [expanded, disabled, disableGutters, handleChange]);
|
|
171
170
|
const ownerState = {
|
|
172
171
|
...props,
|
|
173
|
-
square,
|
|
174
172
|
disabled,
|
|
175
173
|
disableGutters,
|
|
176
174
|
expanded
|
|
@@ -197,10 +195,7 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
197
195
|
className: clsx(classes.root, className),
|
|
198
196
|
shouldForwardComponentProp: true,
|
|
199
197
|
ownerState,
|
|
200
|
-
ref
|
|
201
|
-
additionalProps: {
|
|
202
|
-
square
|
|
203
|
-
}
|
|
198
|
+
ref
|
|
204
199
|
});
|
|
205
200
|
const [AccordionHeadingSlot, accordionProps] = useSlot('heading', {
|
|
206
201
|
elementType: AccordionHeading,
|
|
@@ -280,12 +275,12 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
280
275
|
*/
|
|
281
276
|
disabled: PropTypes.bool,
|
|
282
277
|
/**
|
|
283
|
-
* If `true`, it removes the margin between two expanded accordion items and the
|
|
278
|
+
* If `true`, it removes the margin between two expanded accordion items and prevents the increased height when expanded.
|
|
284
279
|
* @default false
|
|
285
280
|
*/
|
|
286
281
|
disableGutters: PropTypes.bool,
|
|
287
282
|
/**
|
|
288
|
-
* If `true`, expands the accordion, otherwise
|
|
283
|
+
* If `true`, expands the accordion, otherwise collapses it.
|
|
289
284
|
* Setting this prop enables control over the accordion.
|
|
290
285
|
*/
|
|
291
286
|
expanded: PropTypes.bool,
|
|
@@ -316,11 +311,6 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
316
311
|
root: PropTypes.elementType,
|
|
317
312
|
transition: PropTypes.elementType
|
|
318
313
|
}),
|
|
319
|
-
/**
|
|
320
|
-
* If `true`, rounded corners are disabled.
|
|
321
|
-
* @default false
|
|
322
|
-
*/
|
|
323
|
-
square: PropTypes.bool,
|
|
324
314
|
/**
|
|
325
315
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
326
316
|
*/
|
package/esm/Alert/Alert.js
CHANGED
|
@@ -230,7 +230,7 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert(inProps, ref) {
|
|
|
230
230
|
...rootSlotProps,
|
|
231
231
|
children: [icon !== false ? /*#__PURE__*/_jsx(IconSlot, {
|
|
232
232
|
...iconSlotProps,
|
|
233
|
-
children: icon || iconMapping[severity]
|
|
233
|
+
children: icon || iconMapping[severity]
|
|
234
234
|
}) : null, /*#__PURE__*/_jsx(MessageSlot, {
|
|
235
235
|
...messageSlotProps,
|
|
236
236
|
children: children
|