@mui/material 7.3.5 → 7.3.6
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/AppBar/AppBar.d.ts +13 -2
- package/AppBar/AppBar.js +12 -1
- package/Button/Button.d.ts +1 -0
- package/ButtonBase/ButtonBase.js +8 -1
- package/ButtonBase/TouchRipple.js +1 -1
- package/CHANGELOG.md +87 -0
- package/Chip/Chip.js +1 -1
- package/CssBaseline/CssBaseline.d.ts +1 -1
- package/CssBaseline/CssBaseline.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/OutlinedInput/OutlinedInput.d.ts +1 -0
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
- package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/Select/SelectInput.d.ts +2 -0
- package/Select/SelectInput.js +6 -0
- package/Slider/Slider.d.ts +1 -1
- package/Slider/useSlider.types.d.ts +1 -1
- package/Snackbar/Snackbar.js +1 -3
- package/Tabs/Tabs.js +3 -2
- package/TextField/TextField.d.ts +10 -5
- package/Unstable_TrapFocus/FocusTrap.js +13 -8
- package/esm/Accordion/Accordion.d.ts +56 -55
- package/esm/AppBar/AppBar.d.ts +13 -2
- package/esm/AppBar/AppBar.js +12 -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/Chip/Chip.js +1 -1
- package/esm/CssBaseline/CssBaseline.d.ts +1 -1
- package/esm/CssBaseline/CssBaseline.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/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 +6 -0
- 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.js +3 -2
- package/esm/TextField/TextField.d.ts +10 -5
- package/esm/Unstable_TrapFocus/FocusTrap.js +13 -8
- package/esm/index.js +1 -1
- package/esm/styles/createThemeNoVars.d.ts +4 -3
- package/esm/styles/createThemeWithVars.d.ts +2 -2
- package/esm/useAutocomplete/useAutocomplete.js +15 -2
- 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/package.json +6 -6
- package/styles/createThemeNoVars.d.ts +4 -3
- package/styles/createThemeWithVars.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +15 -2
- package/utils/getActiveElement.d.ts +2 -0
- package/utils/getActiveElement.js +9 -0
- package/version/index.js +2 -2
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'));
|
|
@@ -153,6 +155,7 @@ function FocusTrap(props) {
|
|
|
153
155
|
return;
|
|
154
156
|
}
|
|
155
157
|
const doc = (0, _ownerDocument.default)(rootRef.current);
|
|
158
|
+
const activeElement = (0, _getActiveElement.default)(doc);
|
|
156
159
|
const loopFocus = nativeEvent => {
|
|
157
160
|
lastKeydown.current = nativeEvent;
|
|
158
161
|
if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
|
|
@@ -160,8 +163,8 @@ function FocusTrap(props) {
|
|
|
160
163
|
}
|
|
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 the increase of height.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
disableGutters?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* If `true`, expands the accordion, otherwise collapse 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
|
|
package/esm/AppBar/AppBar.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export interface AppBarOwnProps {
|
|
|
18
18
|
* @default 'primary'
|
|
19
19
|
*/
|
|
20
20
|
color?: OverridableStringUnion<PropTypes.Color | 'transparent' | 'error' | 'info' | 'success' | 'warning', AppBarPropsColorOverrides>;
|
|
21
|
+
/**
|
|
22
|
+
* Shadow depth, corresponds to `dp` in the spec.
|
|
23
|
+
* It accepts values between 0 and 24 inclusive.
|
|
24
|
+
* @default 4
|
|
25
|
+
*/
|
|
26
|
+
elevation?: number;
|
|
21
27
|
/**
|
|
22
28
|
* If true, the `color` prop is applied in dark mode.
|
|
23
29
|
* @default false
|
|
@@ -25,11 +31,16 @@ export interface AppBarOwnProps {
|
|
|
25
31
|
enableColorOnDark?: boolean;
|
|
26
32
|
/**
|
|
27
33
|
* The positioning type. The behavior of the different options is described
|
|
28
|
-
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
|
|
34
|
+
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position).
|
|
29
35
|
* Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
|
|
30
36
|
* @default 'fixed'
|
|
31
37
|
*/
|
|
32
38
|
position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative';
|
|
39
|
+
/**
|
|
40
|
+
* If `false`, rounded corners are enabled.
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
square?: boolean;
|
|
33
44
|
/**
|
|
34
45
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
35
46
|
*/
|
|
@@ -38,7 +49,7 @@ export interface AppBarOwnProps {
|
|
|
38
49
|
export type AppBarTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'header'> = ExtendPaperTypeMap<{
|
|
39
50
|
props: AdditionalProps & AppBarOwnProps;
|
|
40
51
|
defaultComponent: RootComponent;
|
|
41
|
-
}, 'position' | 'color' | 'classes'>;
|
|
52
|
+
}, 'position' | 'color' | 'classes' | 'elevation' | 'square'>;
|
|
42
53
|
|
|
43
54
|
/**
|
|
44
55
|
*
|
package/esm/AppBar/AppBar.js
CHANGED
|
@@ -207,6 +207,12 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
207
207
|
* @default 'primary'
|
|
208
208
|
*/
|
|
209
209
|
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
210
|
+
/**
|
|
211
|
+
* Shadow depth, corresponds to `dp` in the spec.
|
|
212
|
+
* It accepts values between 0 and 24 inclusive.
|
|
213
|
+
* @default 4
|
|
214
|
+
*/
|
|
215
|
+
elevation: PropTypes.number,
|
|
210
216
|
/**
|
|
211
217
|
* If true, the `color` prop is applied in dark mode.
|
|
212
218
|
* @default false
|
|
@@ -214,11 +220,16 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
214
220
|
enableColorOnDark: PropTypes.bool,
|
|
215
221
|
/**
|
|
216
222
|
* The positioning type. The behavior of the different options is described
|
|
217
|
-
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
|
|
223
|
+
* [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position).
|
|
218
224
|
* Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
|
|
219
225
|
* @default 'fixed'
|
|
220
226
|
*/
|
|
221
227
|
position: PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'sticky']),
|
|
228
|
+
/**
|
|
229
|
+
* If `false`, rounded corners are enabled.
|
|
230
|
+
* @default true
|
|
231
|
+
*/
|
|
232
|
+
square: PropTypes.bool,
|
|
222
233
|
/**
|
|
223
234
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
224
235
|
*/
|
package/esm/Button/Button.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export type ExtendButton<TypeMap extends OverridableTypeMap> = ((props: {
|
|
|
117
117
|
*
|
|
118
118
|
* - [Button Group](https://mui.com/material-ui/react-button-group/)
|
|
119
119
|
* - [Button](https://mui.com/material-ui/react-button/)
|
|
120
|
+
* - [Number Field](https://mui.com/material-ui/react-number-field/)
|
|
120
121
|
*
|
|
121
122
|
* API:
|
|
122
123
|
*
|
|
@@ -222,7 +222,10 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
|
|
|
222
222
|
}
|
|
223
223
|
const buttonProps = {};
|
|
224
224
|
if (ComponentProp === 'button') {
|
|
225
|
-
|
|
225
|
+
const hasFormAttributes = !!other.formAction;
|
|
226
|
+
// ButtonBase was defaulting to type="button" when no type prop was provided, which prevented form submission and broke formAction functionality.
|
|
227
|
+
// The fix checks for form-related attributes and skips the default type to allow the browser's natural submit behavior (type="submit").
|
|
228
|
+
buttonProps.type = type === undefined && !hasFormAttributes ? 'button' : type;
|
|
226
229
|
buttonProps.disabled = disabled;
|
|
227
230
|
} else {
|
|
228
231
|
if (!other.href && !other.to) {
|
|
@@ -350,6 +353,10 @@ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes
|
|
|
350
353
|
* if needed.
|
|
351
354
|
*/
|
|
352
355
|
focusVisibleClassName: PropTypes.string,
|
|
356
|
+
/**
|
|
357
|
+
* @ignore
|
|
358
|
+
*/
|
|
359
|
+
formAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
353
360
|
/**
|
|
354
361
|
* @ignore
|
|
355
362
|
*/
|
|
@@ -228,7 +228,7 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
|
|
|
228
228
|
rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
//
|
|
231
|
+
// Touch devices
|
|
232
232
|
if (event?.touches) {
|
|
233
233
|
// check that this isn't another touchstart due to multitouch
|
|
234
234
|
// otherwise we will only clear a single timer when unmounting while two
|
package/esm/Chip/Chip.js
CHANGED
|
@@ -71,7 +71,7 @@ const ChipRoot = styled('div', {
|
|
|
71
71
|
[`& .${chipClasses.deleteIcon}`]: styles[`deleteIconColor${capitalize(color)}`]
|
|
72
72
|
}, {
|
|
73
73
|
[`& .${chipClasses.deleteIcon}`]: styles[`deleteIcon${capitalize(variant)}Color${capitalize(color)}`]
|
|
74
|
-
}, styles.root, styles[`size${capitalize(size)}`], styles[`color${capitalize(color)}`], clickable && styles.clickable, clickable && color !== 'default' && styles[`clickableColor${capitalize(color)}
|
|
74
|
+
}, styles.root, styles[`size${capitalize(size)}`], styles[`color${capitalize(color)}`], clickable && styles.clickable, clickable && color !== 'default' && styles[`clickableColor${capitalize(color)}`], onDelete && styles.deletable, onDelete && color !== 'default' && styles[`deletableColor${capitalize(color)}`], styles[variant], styles[`${variant}${capitalize(color)}`]];
|
|
75
75
|
}
|
|
76
76
|
})(memoTheme(({
|
|
77
77
|
theme
|
|
@@ -7,7 +7,7 @@ export interface CssBaselineProps extends StyledComponentProps<never> {
|
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
10
|
-
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
10
|
+
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
|
|
11
11
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
12
12
|
* @default false
|
|
13
13
|
*/
|
|
@@ -152,7 +152,7 @@ process.env.NODE_ENV !== "production" ? CssBaseline.propTypes /* remove-proptype
|
|
|
152
152
|
children: PropTypes.node,
|
|
153
153
|
/**
|
|
154
154
|
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
155
|
-
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
155
|
+
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
|
|
156
156
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
157
157
|
* @default false
|
|
158
158
|
*/
|
|
@@ -105,6 +105,7 @@ export interface FormControlTypeMap<AdditionalProps = {}, RootComponent extends
|
|
|
105
105
|
* Demos:
|
|
106
106
|
*
|
|
107
107
|
* - [Checkbox](https://mui.com/material-ui/react-checkbox/)
|
|
108
|
+
* - [Number Field](https://mui.com/material-ui/react-number-field/)
|
|
108
109
|
* - [Radio Group](https://mui.com/material-ui/react-radio-button/)
|
|
109
110
|
* - [Switch](https://mui.com/material-ui/react-switch/)
|
|
110
111
|
* - [Text Field](https://mui.com/material-ui/react-text-field/)
|
|
@@ -60,6 +60,7 @@ export interface FormLabelTypeMap<AdditionalProps = {}, RootComponent extends Re
|
|
|
60
60
|
* Demos:
|
|
61
61
|
*
|
|
62
62
|
* - [Checkbox](https://mui.com/material-ui/react-checkbox/)
|
|
63
|
+
* - [Number Field](https://mui.com/material-ui/react-number-field/)
|
|
63
64
|
* - [Radio Group](https://mui.com/material-ui/react-radio-button/)
|
|
64
65
|
* - [Switch](https://mui.com/material-ui/react-switch/)
|
|
65
66
|
*
|
|
@@ -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/esm/ListItem/ListItem.js
CHANGED
|
@@ -12,6 +12,7 @@ import memoTheme from "../utils/memoTheme.js";
|
|
|
12
12
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
13
13
|
import isMuiElement from "../utils/isMuiElement.js";
|
|
14
14
|
import useForkRef from "../utils/useForkRef.js";
|
|
15
|
+
import useSlot from "../utils/useSlot.js";
|
|
15
16
|
import ListContext from "../List/ListContext.js";
|
|
16
17
|
import { getListItemUtilityClass } from "./listItemClasses.js";
|
|
17
18
|
import { listItemButtonClasses } from "../ListItemButton/index.js";
|
|
@@ -35,7 +36,8 @@ const useUtilityClasses = ownerState => {
|
|
|
35
36
|
} = ownerState;
|
|
36
37
|
const slots = {
|
|
37
38
|
root: ['root', dense && 'dense', !disableGutters && 'gutters', !disablePadding && 'padding', divider && 'divider', alignItems === 'flex-start' && 'alignItemsFlexStart', hasSecondaryAction && 'secondaryAction'],
|
|
38
|
-
container: ['container']
|
|
39
|
+
container: ['container'],
|
|
40
|
+
secondaryAction: ['secondaryAction']
|
|
39
41
|
};
|
|
40
42
|
return composeClasses(slots, getListItemUtilityClass, classes);
|
|
41
43
|
};
|
|
@@ -197,6 +199,16 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
|
|
|
197
199
|
};
|
|
198
200
|
const classes = useUtilityClasses(ownerState);
|
|
199
201
|
const handleRef = useForkRef(listItemRef, ref);
|
|
202
|
+
const externalForwardedProps = {
|
|
203
|
+
slots,
|
|
204
|
+
slotProps
|
|
205
|
+
};
|
|
206
|
+
const [SecondaryActionSlot, secondaryActionSlotProps] = useSlot('secondaryAction', {
|
|
207
|
+
elementType: ListItemSecondaryAction,
|
|
208
|
+
externalForwardedProps,
|
|
209
|
+
ownerState,
|
|
210
|
+
className: classes.secondaryAction
|
|
211
|
+
});
|
|
200
212
|
const Root = slots.root || components.Root || ListItemRoot;
|
|
201
213
|
const rootProps = slotProps.root || componentsProps.root || {};
|
|
202
214
|
const componentProps = {
|
|
@@ -254,7 +266,8 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
|
|
|
254
266
|
}
|
|
255
267
|
}),
|
|
256
268
|
...componentProps,
|
|
257
|
-
children: [children, secondaryAction && /*#__PURE__*/_jsx(
|
|
269
|
+
children: [children, secondaryAction && /*#__PURE__*/_jsx(SecondaryActionSlot, {
|
|
270
|
+
...secondaryActionSlotProps,
|
|
258
271
|
children: secondaryAction
|
|
259
272
|
})]
|
|
260
273
|
})
|
|
@@ -369,7 +382,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
|
|
|
369
382
|
* @default {}
|
|
370
383
|
*/
|
|
371
384
|
slotProps: PropTypes.shape({
|
|
372
|
-
root: PropTypes.object
|
|
385
|
+
root: PropTypes.object,
|
|
386
|
+
secondaryAction: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
373
387
|
}),
|
|
374
388
|
/**
|
|
375
389
|
* The components used for each slot inside.
|
|
@@ -377,7 +391,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
|
|
|
377
391
|
* @default {}
|
|
378
392
|
*/
|
|
379
393
|
slots: PropTypes.shape({
|
|
380
|
-
root: PropTypes.elementType
|
|
394
|
+
root: PropTypes.elementType,
|
|
395
|
+
secondaryAction: PropTypes.elementType
|
|
381
396
|
}),
|
|
382
397
|
/**
|
|
383
398
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
package/esm/MenuList/MenuList.js
CHANGED
|
@@ -5,6 +5,7 @@ import { isFragment } from 'react-is';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import ownerDocument from "../utils/ownerDocument.js";
|
|
7
7
|
import List from "../List/index.js";
|
|
8
|
+
import getActiveElement from "../utils/getActiveElement.js";
|
|
8
9
|
import getScrollbarSize from "../utils/getScrollbarSize.js";
|
|
9
10
|
import useForkRef from "../utils/useForkRef.js";
|
|
10
11
|
import useEnhancedEffect from "../utils/useEnhancedEffect.js";
|
|
@@ -136,7 +137,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
136
137
|
* or document.body or document.documentElement. Only the first case will
|
|
137
138
|
* trigger this specific handler.
|
|
138
139
|
*/
|
|
139
|
-
const currentFocus = ownerDocument(list)
|
|
140
|
+
const currentFocus = getActiveElement(ownerDocument(list));
|
|
140
141
|
if (key === 'ArrowDown') {
|
|
141
142
|
// Prevent scroll of the page
|
|
142
143
|
event.preventDefault();
|
|
@@ -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;
|
|
@@ -107,7 +107,7 @@ process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes /* remove-pr
|
|
|
107
107
|
component: PropTypes.elementType,
|
|
108
108
|
/**
|
|
109
109
|
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
110
|
-
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
110
|
+
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
|
|
111
111
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
112
112
|
*/
|
|
113
113
|
enableColorScheme: PropTypes.bool,
|
|
@@ -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;
|
|
@@ -128,6 +128,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
128
128
|
onChange,
|
|
129
129
|
onClose,
|
|
130
130
|
onFocus,
|
|
131
|
+
// eslint-disable-next-line react/prop-types
|
|
132
|
+
onKeyDown,
|
|
133
|
+
// eslint-disable-next-line react/prop-types
|
|
134
|
+
onMouseDown,
|
|
131
135
|
onOpen,
|
|
132
136
|
open: openProp,
|
|
133
137
|
readOnly,
|
|
@@ -222,6 +226,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
222
226
|
}
|
|
223
227
|
};
|
|
224
228
|
const handleMouseDown = event => {
|
|
229
|
+
onMouseDown?.(event);
|
|
225
230
|
// Ignore everything but left-click
|
|
226
231
|
if (event.button !== 0) {
|
|
227
232
|
return;
|
|
@@ -301,6 +306,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
301
306
|
event.preventDefault();
|
|
302
307
|
update(true, event);
|
|
303
308
|
}
|
|
309
|
+
onKeyDown?.(event);
|
|
304
310
|
}
|
|
305
311
|
};
|
|
306
312
|
const open = displayNode !== null && openState;
|
package/esm/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
|
*/
|