@mui/material 6.4.5 → 6.4.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 +14 -12
- package/Alert/Alert.d.ts +3 -15
- package/Backdrop/Backdrop.d.ts +14 -12
- package/CHANGELOG.md +38 -0
- package/CardHeader/CardHeader.d.ts +4 -20
- package/Checkbox/Checkbox.d.ts +45 -9
- package/Checkbox/Checkbox.js +51 -21
- package/Dialog/Dialog.d.ts +4 -4
- package/Drawer/Drawer.d.ts +92 -1
- package/Drawer/Drawer.js +108 -36
- package/InputBase/inputBaseClasses.d.ts +15 -6
- package/Menu/Menu.d.ts +88 -1
- package/Menu/Menu.js +58 -19
- package/Modal/Modal.js +9 -10
- package/Popover/Popover.d.ts +60 -6
- package/Popover/Popover.js +78 -51
- package/Radio/Radio.d.ts +45 -1
- package/Radio/Radio.js +59 -16
- package/Select/SelectInput.js +8 -8
- package/Snackbar/Snackbar.d.ts +79 -2
- package/Snackbar/Snackbar.js +110 -32
- package/SpeedDial/SpeedDial.d.ts +8 -6
- package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
- package/SpeedDialAction/SpeedDialAction.js +108 -30
- package/StepContent/StepContent.d.ts +2 -2
- package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
- package/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/Switch/Switch.js +2 -0
- package/Tabs/Tabs.d.ts +129 -29
- package/Tabs/Tabs.js +120 -52
- package/Tabs/tabsClasses.d.ts +4 -0
- package/Tabs/tabsClasses.js +1 -1
- package/Tooltip/Tooltip.d.ts +20 -12
- package/index.js +1 -1
- package/internal/SwitchBase.d.ts +35 -1
- package/internal/SwitchBase.js +84 -30
- package/modern/Checkbox/Checkbox.js +51 -21
- package/modern/Drawer/Drawer.js +108 -36
- package/modern/Menu/Menu.js +58 -19
- package/modern/Modal/Modal.js +9 -10
- package/modern/Popover/Popover.js +78 -51
- package/modern/Radio/Radio.js +59 -16
- package/modern/Select/SelectInput.js +8 -8
- package/modern/Snackbar/Snackbar.js +110 -32
- package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
- package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/modern/Switch/Switch.js +2 -0
- package/modern/Tabs/Tabs.js +120 -52
- package/modern/Tabs/tabsClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +84 -30
- package/modern/styles/createThemeNoVars.js +7 -2
- package/modern/version/index.js +2 -2
- package/node/Checkbox/Checkbox.js +51 -21
- package/node/Drawer/Drawer.js +108 -36
- package/node/Menu/Menu.js +58 -19
- package/node/Modal/Modal.js +9 -10
- package/node/Popover/Popover.js +78 -51
- package/node/Radio/Radio.js +59 -16
- package/node/Select/SelectInput.js +8 -8
- package/node/Snackbar/Snackbar.js +110 -32
- package/node/SpeedDialAction/SpeedDialAction.js +108 -30
- package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
- package/node/Switch/Switch.js +2 -0
- package/node/Tabs/Tabs.js +120 -52
- package/node/Tabs/tabsClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +84 -30
- package/node/styles/createThemeNoVars.js +7 -2
- package/node/version/index.js +2 -2
- package/package.json +6 -6
- package/styles/createThemeNoVars.js +7 -2
- package/version/index.js +2 -2
package/modern/Menu/Menu.js
CHANGED
|
@@ -14,6 +14,7 @@ import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
|
|
|
14
14
|
import { styled } from "../zero-styled/index.js";
|
|
15
15
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
16
16
|
import { getMenuUtilityClass } from "./menuClasses.js";
|
|
17
|
+
import useSlot from "../utils/useSlot.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const RTL_ORIGIN = {
|
|
19
20
|
vertical: 'top',
|
|
@@ -145,20 +146,43 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
});
|
|
148
|
-
const
|
|
149
|
-
|
|
149
|
+
const externalForwardedProps = {
|
|
150
|
+
slots,
|
|
151
|
+
slotProps: {
|
|
152
|
+
list: MenuListProps,
|
|
153
|
+
transition: TransitionProps,
|
|
154
|
+
paper: PaperProps,
|
|
155
|
+
...slotProps
|
|
156
|
+
}
|
|
157
|
+
};
|
|
150
158
|
const rootSlotProps = useSlotProps({
|
|
151
159
|
elementType: slots.root,
|
|
152
160
|
externalSlotProps: slotProps.root,
|
|
153
161
|
ownerState,
|
|
154
162
|
className: [classes.root, className]
|
|
155
163
|
});
|
|
156
|
-
const paperSlotProps =
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
const [PaperSlot, paperSlotProps] = useSlot('paper', {
|
|
165
|
+
className: classes.paper,
|
|
166
|
+
elementType: MenuPaper,
|
|
167
|
+
externalForwardedProps,
|
|
168
|
+
shouldForwardComponentProp: true,
|
|
169
|
+
ownerState
|
|
170
|
+
});
|
|
171
|
+
const [ListSlot, listSlotProps] = useSlot('list', {
|
|
172
|
+
className: clsx(classes.list, MenuListProps.className),
|
|
173
|
+
elementType: MenuMenuList,
|
|
174
|
+
shouldForwardComponentProp: true,
|
|
175
|
+
externalForwardedProps,
|
|
176
|
+
getSlotProps: handlers => ({
|
|
177
|
+
...handlers,
|
|
178
|
+
onKeyDown: event => {
|
|
179
|
+
handleListKeyDown(event);
|
|
180
|
+
handlers.onKeyDown?.(event);
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
ownerState
|
|
161
184
|
});
|
|
185
|
+
const resolvedTransitionProps = typeof externalForwardedProps.slotProps.transition === 'function' ? externalForwardedProps.slotProps.transition(ownerState) : externalForwardedProps.slotProps.transition;
|
|
162
186
|
return /*#__PURE__*/_jsx(MenuRoot, {
|
|
163
187
|
onClose: onClose,
|
|
164
188
|
anchorOrigin: {
|
|
@@ -167,31 +191,38 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
167
191
|
},
|
|
168
192
|
transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
|
|
169
193
|
slots: {
|
|
194
|
+
root: slots.root,
|
|
170
195
|
paper: PaperSlot,
|
|
171
|
-
|
|
196
|
+
backdrop: slots.backdrop,
|
|
197
|
+
...(slots.transition && {
|
|
198
|
+
// TODO: pass `slots.transition` directly once `TransitionComponent` is removed from Popover
|
|
199
|
+
transition: slots.transition
|
|
200
|
+
})
|
|
172
201
|
},
|
|
173
202
|
slotProps: {
|
|
174
203
|
root: rootSlotProps,
|
|
175
|
-
paper: paperSlotProps
|
|
204
|
+
paper: paperSlotProps,
|
|
205
|
+
backdrop: typeof slotProps.backdrop === 'function' ? slotProps.backdrop(ownerState) : slotProps.backdrop,
|
|
206
|
+
transition: {
|
|
207
|
+
...resolvedTransitionProps,
|
|
208
|
+
onEntering: (...args) => {
|
|
209
|
+
handleEntering(...args);
|
|
210
|
+
resolvedTransitionProps?.onEntering?.(...args);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
176
213
|
},
|
|
177
214
|
open: open,
|
|
178
215
|
ref: ref,
|
|
179
216
|
transitionDuration: transitionDuration,
|
|
180
|
-
TransitionProps: {
|
|
181
|
-
onEntering: handleEntering,
|
|
182
|
-
...TransitionProps
|
|
183
|
-
},
|
|
184
217
|
ownerState: ownerState,
|
|
185
218
|
...other,
|
|
186
219
|
classes: PopoverClasses,
|
|
187
|
-
children: /*#__PURE__*/_jsx(
|
|
188
|
-
onKeyDown: handleListKeyDown,
|
|
220
|
+
children: /*#__PURE__*/_jsx(ListSlot, {
|
|
189
221
|
actions: menuListActionsRef,
|
|
190
222
|
autoFocus: autoFocus && (activeItemIndex === -1 || disableAutoFocusItem),
|
|
191
223
|
autoFocusItem: autoFocusItem,
|
|
192
224
|
variant: variant,
|
|
193
|
-
...
|
|
194
|
-
className: clsx(classes.list, MenuListProps.className),
|
|
225
|
+
...listSlotProps,
|
|
195
226
|
children: children
|
|
196
227
|
})
|
|
197
228
|
});
|
|
@@ -236,6 +267,7 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
|
|
|
236
267
|
disableAutoFocusItem: PropTypes.bool,
|
|
237
268
|
/**
|
|
238
269
|
* Props applied to the [`MenuList`](https://mui.com/material-ui/api/menu-list/) element.
|
|
270
|
+
* @deprecated use the `slotProps.list` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
239
271
|
* @default {}
|
|
240
272
|
*/
|
|
241
273
|
MenuListProps: PropTypes.object,
|
|
@@ -263,16 +295,22 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
|
|
|
263
295
|
* @default {}
|
|
264
296
|
*/
|
|
265
297
|
slotProps: PropTypes.shape({
|
|
298
|
+
backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
299
|
+
list: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
266
300
|
paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
267
|
-
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
301
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
302
|
+
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
268
303
|
}),
|
|
269
304
|
/**
|
|
270
305
|
* The components used for each slot inside.
|
|
271
306
|
* @default {}
|
|
272
307
|
*/
|
|
273
308
|
slots: PropTypes.shape({
|
|
309
|
+
backdrop: PropTypes.elementType,
|
|
310
|
+
list: PropTypes.elementType,
|
|
274
311
|
paper: PropTypes.elementType,
|
|
275
|
-
root: PropTypes.elementType
|
|
312
|
+
root: PropTypes.elementType,
|
|
313
|
+
transition: PropTypes.elementType
|
|
276
314
|
}),
|
|
277
315
|
/**
|
|
278
316
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -290,6 +328,7 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
|
|
|
290
328
|
/**
|
|
291
329
|
* Props applied to the transition element.
|
|
292
330
|
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
331
|
+
* @deprecated use the `slotProps.transition` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
293
332
|
* @default {}
|
|
294
333
|
*/
|
|
295
334
|
TransitionProps: PropTypes.object,
|
package/modern/Modal/Modal.js
CHANGED
|
@@ -15,7 +15,6 @@ import Backdrop from "../Backdrop/index.js";
|
|
|
15
15
|
import useModal from "./useModal.js";
|
|
16
16
|
import { getModalUtilityClass } from "./modalClasses.js";
|
|
17
17
|
import useSlot from "../utils/useSlot.js";
|
|
18
|
-
import { useForkRef } from "../utils/index.js";
|
|
19
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
const useUtilityClasses = ownerState => {
|
|
21
20
|
const {
|
|
@@ -158,7 +157,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
158
157
|
childProps.onExited = onExited;
|
|
159
158
|
}
|
|
160
159
|
const externalForwardedProps = {
|
|
161
|
-
...other,
|
|
162
160
|
slots: {
|
|
163
161
|
root: components.Root,
|
|
164
162
|
backdrop: components.Backdrop,
|
|
@@ -170,19 +168,22 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
170
168
|
}
|
|
171
169
|
};
|
|
172
170
|
const [RootSlot, rootProps] = useSlot('root', {
|
|
171
|
+
ref,
|
|
173
172
|
elementType: ModalRoot,
|
|
174
|
-
externalForwardedProps
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
as: component
|
|
173
|
+
externalForwardedProps: {
|
|
174
|
+
...externalForwardedProps,
|
|
175
|
+
...other,
|
|
176
|
+
component
|
|
179
177
|
},
|
|
178
|
+
getSlotProps: getRootProps,
|
|
180
179
|
ownerState,
|
|
181
180
|
className: clsx(className, classes?.root, !ownerState.open && ownerState.exited && classes?.hidden)
|
|
182
181
|
});
|
|
183
182
|
const [BackdropSlot, backdropProps] = useSlot('backdrop', {
|
|
183
|
+
ref: BackdropProps?.ref,
|
|
184
184
|
elementType: BackdropComponent,
|
|
185
185
|
externalForwardedProps,
|
|
186
|
+
shouldForwardComponentProp: true,
|
|
186
187
|
additionalProps: BackdropProps,
|
|
187
188
|
getSlotProps: otherHandlers => {
|
|
188
189
|
return getBackdropProps({
|
|
@@ -200,7 +201,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
200
201
|
className: clsx(BackdropProps?.className, classes?.backdrop),
|
|
201
202
|
ownerState
|
|
202
203
|
});
|
|
203
|
-
const backdropRef = useForkRef(BackdropProps?.ref, backdropProps.ref);
|
|
204
204
|
if (!keepMounted && !open && (!hasTransition || exited)) {
|
|
205
205
|
return null;
|
|
206
206
|
}
|
|
@@ -211,8 +211,7 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
211
211
|
children: /*#__PURE__*/_jsxs(RootSlot, {
|
|
212
212
|
...rootProps,
|
|
213
213
|
children: [!hideBackdrop && BackdropComponent ? /*#__PURE__*/_jsx(BackdropSlot, {
|
|
214
|
-
...backdropProps
|
|
215
|
-
ref: backdropRef
|
|
214
|
+
...backdropProps
|
|
216
215
|
}) : null, /*#__PURE__*/_jsx(FocusTrap, {
|
|
217
216
|
disableEnforceFocus: disableEnforceFocus,
|
|
218
217
|
disableAutoFocus: disableAutoFocus,
|
|
@@ -15,12 +15,12 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
|
15
15
|
import debounce from "../utils/debounce.js";
|
|
16
16
|
import ownerDocument from "../utils/ownerDocument.js";
|
|
17
17
|
import ownerWindow from "../utils/ownerWindow.js";
|
|
18
|
-
import useForkRef from "../utils/useForkRef.js";
|
|
19
18
|
import Grow from "../Grow/index.js";
|
|
20
19
|
import Modal from "../Modal/index.js";
|
|
21
20
|
import PaperBase from "../Paper/index.js";
|
|
22
21
|
import { getPopoverUtilityClass } from "./popoverClasses.js";
|
|
23
22
|
import useSlot from "../utils/useSlot.js";
|
|
23
|
+
import { mergeSlotProps } from "../utils/index.js";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
25
|
export function getOffsetTop(rect, vertical) {
|
|
26
26
|
let offset = 0;
|
|
@@ -103,22 +103,21 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
103
103
|
marginThreshold = 16,
|
|
104
104
|
open,
|
|
105
105
|
PaperProps: PaperPropsProp = {},
|
|
106
|
+
// TODO: remove in v7
|
|
106
107
|
slots = {},
|
|
107
108
|
slotProps = {},
|
|
108
109
|
transformOrigin = {
|
|
109
110
|
vertical: 'top',
|
|
110
111
|
horizontal: 'left'
|
|
111
112
|
},
|
|
112
|
-
TransitionComponent
|
|
113
|
+
TransitionComponent,
|
|
114
|
+
// TODO: remove in v7
|
|
113
115
|
transitionDuration: transitionDurationProp = 'auto',
|
|
114
|
-
TransitionProps
|
|
115
|
-
|
|
116
|
-
...TransitionProps
|
|
117
|
-
} = {},
|
|
116
|
+
TransitionProps = {},
|
|
117
|
+
// TODO: remove in v7
|
|
118
118
|
disableScrollLock = false,
|
|
119
119
|
...other
|
|
120
120
|
} = props;
|
|
121
|
-
const externalPaperSlotProps = slotProps?.paper ?? PaperPropsProp;
|
|
122
121
|
const paperRef = React.useRef();
|
|
123
122
|
const ownerState = {
|
|
124
123
|
...props,
|
|
@@ -126,7 +125,6 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
126
125
|
anchorReference,
|
|
127
126
|
elevation,
|
|
128
127
|
marginThreshold,
|
|
129
|
-
externalPaperSlotProps,
|
|
130
128
|
transformOrigin,
|
|
131
129
|
TransitionComponent,
|
|
132
130
|
transitionDuration: transitionDurationProp,
|
|
@@ -255,10 +253,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
255
253
|
}
|
|
256
254
|
return () => window.removeEventListener('scroll', setPositioningStyles);
|
|
257
255
|
}, [anchorEl, disableScrollLock, setPositioningStyles]);
|
|
258
|
-
const handleEntering = (
|
|
259
|
-
if (onEntering) {
|
|
260
|
-
onEntering(element, isAppearing);
|
|
261
|
-
}
|
|
256
|
+
const handleEntering = () => {
|
|
262
257
|
setPositioningStyles();
|
|
263
258
|
};
|
|
264
259
|
const handleExited = () => {
|
|
@@ -289,45 +284,65 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
289
284
|
};
|
|
290
285
|
}, [anchorEl, open, setPositioningStyles]);
|
|
291
286
|
let transitionDuration = transitionDurationProp;
|
|
292
|
-
if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) {
|
|
293
|
-
transitionDuration = undefined;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// If the container prop is provided, use that
|
|
297
|
-
// If the anchorEl prop is provided, use its parent body element as the container
|
|
298
|
-
// If neither are provided let the Modal take care of choosing the container
|
|
299
|
-
const container = containerProp || (anchorEl ? ownerDocument(resolveAnchorEl(anchorEl)).body : undefined);
|
|
300
287
|
const externalForwardedProps = {
|
|
301
|
-
slots
|
|
288
|
+
slots: {
|
|
289
|
+
transition: TransitionComponent,
|
|
290
|
+
...slots
|
|
291
|
+
},
|
|
302
292
|
slotProps: {
|
|
303
|
-
|
|
304
|
-
paper:
|
|
293
|
+
transition: TransitionProps,
|
|
294
|
+
paper: PaperPropsProp,
|
|
295
|
+
...slotProps
|
|
305
296
|
}
|
|
306
297
|
};
|
|
307
|
-
const [
|
|
308
|
-
elementType:
|
|
298
|
+
const [TransitionSlot, transitionSlotProps] = useSlot('transition', {
|
|
299
|
+
elementType: Grow,
|
|
309
300
|
externalForwardedProps,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
301
|
+
ownerState,
|
|
302
|
+
getSlotProps: handlers => ({
|
|
303
|
+
...handlers,
|
|
304
|
+
onEntering: (element, isAppearing) => {
|
|
305
|
+
handlers.onEntering?.(element, isAppearing);
|
|
306
|
+
handleEntering();
|
|
307
|
+
},
|
|
308
|
+
onExited: element => {
|
|
309
|
+
handlers.onExited?.(element);
|
|
310
|
+
handleExited();
|
|
316
311
|
}
|
|
317
|
-
},
|
|
318
|
-
|
|
312
|
+
}),
|
|
313
|
+
additionalProps: {
|
|
314
|
+
appear: true,
|
|
315
|
+
in: open
|
|
316
|
+
}
|
|
319
317
|
});
|
|
318
|
+
if (transitionDurationProp === 'auto' && !TransitionSlot.muiSupportAuto) {
|
|
319
|
+
transitionDuration = undefined;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// If the container prop is provided, use that
|
|
323
|
+
// If the anchorEl prop is provided, use its parent body element as the container
|
|
324
|
+
// If neither are provided let the Modal take care of choosing the container
|
|
325
|
+
const container = containerProp || (anchorEl ? ownerDocument(resolveAnchorEl(anchorEl)).body : undefined);
|
|
320
326
|
const [RootSlot, {
|
|
327
|
+
slots: rootSlotsProp,
|
|
321
328
|
slotProps: rootSlotPropsProp,
|
|
322
329
|
...rootProps
|
|
323
330
|
}] = useSlot('root', {
|
|
331
|
+
ref,
|
|
324
332
|
elementType: PopoverRoot,
|
|
325
|
-
externalForwardedProps
|
|
333
|
+
externalForwardedProps: {
|
|
334
|
+
...externalForwardedProps,
|
|
335
|
+
...other
|
|
336
|
+
},
|
|
337
|
+
shouldForwardComponentProp: true,
|
|
326
338
|
additionalProps: {
|
|
339
|
+
slots: {
|
|
340
|
+
backdrop: slots.backdrop
|
|
341
|
+
},
|
|
327
342
|
slotProps: {
|
|
328
|
-
backdrop: {
|
|
343
|
+
backdrop: mergeSlotProps(typeof slotProps.backdrop === 'function' ? slotProps.backdrop(ownerState) : slotProps.backdrop, {
|
|
329
344
|
invisible: true
|
|
330
|
-
}
|
|
345
|
+
})
|
|
331
346
|
},
|
|
332
347
|
container,
|
|
333
348
|
open
|
|
@@ -335,25 +350,32 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
335
350
|
ownerState,
|
|
336
351
|
className: clsx(classes.root, className)
|
|
337
352
|
});
|
|
338
|
-
const
|
|
353
|
+
const [PaperSlot, paperProps] = useSlot('paper', {
|
|
354
|
+
ref: paperRef,
|
|
355
|
+
className: classes.paper,
|
|
356
|
+
elementType: PopoverPaper,
|
|
357
|
+
externalForwardedProps,
|
|
358
|
+
shouldForwardComponentProp: true,
|
|
359
|
+
additionalProps: {
|
|
360
|
+
elevation,
|
|
361
|
+
style: isPositioned ? undefined : {
|
|
362
|
+
opacity: 0
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
ownerState
|
|
366
|
+
});
|
|
339
367
|
return /*#__PURE__*/_jsx(RootSlot, {
|
|
340
368
|
...rootProps,
|
|
341
369
|
...(!isHostComponent(RootSlot) && {
|
|
370
|
+
slots: rootSlotsProp,
|
|
342
371
|
slotProps: rootSlotPropsProp,
|
|
343
372
|
disableScrollLock
|
|
344
373
|
}),
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
children: /*#__PURE__*/_jsx(TransitionComponent, {
|
|
348
|
-
appear: true,
|
|
349
|
-
in: open,
|
|
350
|
-
onEntering: handleEntering,
|
|
351
|
-
onExited: handleExited,
|
|
374
|
+
children: /*#__PURE__*/_jsx(TransitionSlot, {
|
|
375
|
+
...transitionSlotProps,
|
|
352
376
|
timeout: transitionDuration,
|
|
353
|
-
...TransitionProps,
|
|
354
377
|
children: /*#__PURE__*/_jsx(PaperSlot, {
|
|
355
378
|
...paperProps,
|
|
356
|
-
ref: handlePaperRef,
|
|
357
379
|
children: children
|
|
358
380
|
})
|
|
359
381
|
})
|
|
@@ -421,8 +443,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
421
443
|
anchorReference: PropTypes.oneOf(['anchorEl', 'anchorPosition', 'none']),
|
|
422
444
|
/**
|
|
423
445
|
* A backdrop component. This prop enables custom backdrop rendering.
|
|
424
|
-
* @deprecated Use `
|
|
425
|
-
* Use the `slotProps.root.slots.backdrop` prop to make your application ready for the next version of Material UI.
|
|
446
|
+
* @deprecated Use `slots.backdrop` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
426
447
|
* @default styled(Backdrop, {
|
|
427
448
|
* name: 'MuiModal',
|
|
428
449
|
* slot: 'Backdrop',
|
|
@@ -436,7 +457,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
436
457
|
BackdropComponent: PropTypes.elementType,
|
|
437
458
|
/**
|
|
438
459
|
* Props applied to the [`Backdrop`](/material-ui/api/backdrop/) element.
|
|
439
|
-
* @deprecated Use `slotProps.
|
|
460
|
+
* @deprecated Use `slotProps.backdrop` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
440
461
|
*/
|
|
441
462
|
BackdropProps: PropTypes.object,
|
|
442
463
|
/**
|
|
@@ -500,16 +521,20 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
500
521
|
* @default {}
|
|
501
522
|
*/
|
|
502
523
|
slotProps: PropTypes.shape({
|
|
524
|
+
backdrop: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
503
525
|
paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
504
|
-
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
526
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
527
|
+
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
505
528
|
}),
|
|
506
529
|
/**
|
|
507
530
|
* The components used for each slot inside.
|
|
508
531
|
* @default {}
|
|
509
532
|
*/
|
|
510
533
|
slots: PropTypes.shape({
|
|
534
|
+
backdrop: PropTypes.elementType,
|
|
511
535
|
paper: PropTypes.elementType,
|
|
512
|
-
root: PropTypes.elementType
|
|
536
|
+
root: PropTypes.elementType,
|
|
537
|
+
transition: PropTypes.elementType
|
|
513
538
|
}),
|
|
514
539
|
/**
|
|
515
540
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -534,6 +559,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
534
559
|
/**
|
|
535
560
|
* The component used for the transition.
|
|
536
561
|
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
562
|
+
* @deprecated use the `slots.transition` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
537
563
|
* @default Grow
|
|
538
564
|
*/
|
|
539
565
|
TransitionComponent: PropTypes.elementType,
|
|
@@ -549,6 +575,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
549
575
|
/**
|
|
550
576
|
* Props applied to the transition element.
|
|
551
577
|
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
|
|
578
|
+
* @deprecated use the `slotProps.transition` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
552
579
|
* @default {}
|
|
553
580
|
*/
|
|
554
581
|
TransitionProps: PropTypes.object
|
package/modern/Radio/Radio.js
CHANGED
|
@@ -17,6 +17,7 @@ import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
|
|
|
17
17
|
import { styled } from "../zero-styled/index.js";
|
|
18
18
|
import memoTheme from "../utils/memoTheme.js";
|
|
19
19
|
import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.js";
|
|
20
|
+
import useSlot from "../utils/useSlot.js";
|
|
20
21
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
const useUtilityClasses = ownerState => {
|
|
@@ -125,6 +126,8 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
125
126
|
className,
|
|
126
127
|
disabled: disabledProp,
|
|
127
128
|
disableRipple = false,
|
|
129
|
+
slots = {},
|
|
130
|
+
slotProps = {},
|
|
128
131
|
...other
|
|
129
132
|
} = props;
|
|
130
133
|
const muiFormControl = useFormControl();
|
|
@@ -155,23 +158,45 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
155
158
|
name = radioGroup.name;
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
fontSize: defaultIcon.props.fontSize ?? size
|
|
162
|
-
}),
|
|
163
|
-
checkedIcon: /*#__PURE__*/React.cloneElement(checkedIcon, {
|
|
164
|
-
fontSize: defaultCheckedIcon.props.fontSize ?? size
|
|
165
|
-
}),
|
|
166
|
-
disabled: disabled,
|
|
167
|
-
ownerState: ownerState,
|
|
168
|
-
classes: classes,
|
|
169
|
-
name: name,
|
|
170
|
-
checked: checked,
|
|
171
|
-
onChange: onChange,
|
|
172
|
-
ref: ref,
|
|
161
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
162
|
+
ref,
|
|
163
|
+
elementType: RadioRoot,
|
|
173
164
|
className: clsx(classes.root, className),
|
|
174
|
-
|
|
165
|
+
shouldForwardComponentProp: true,
|
|
166
|
+
externalForwardedProps: {
|
|
167
|
+
slots,
|
|
168
|
+
slotProps,
|
|
169
|
+
...other
|
|
170
|
+
},
|
|
171
|
+
getSlotProps: handlers => ({
|
|
172
|
+
...handlers,
|
|
173
|
+
onChange: (event, ...args) => {
|
|
174
|
+
handlers.onChange?.(event, ...args);
|
|
175
|
+
onChange(event, ...args);
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
ownerState,
|
|
179
|
+
additionalProps: {
|
|
180
|
+
type: 'radio',
|
|
181
|
+
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
182
|
+
fontSize: icon.props.fontSize ?? size
|
|
183
|
+
}),
|
|
184
|
+
checkedIcon: /*#__PURE__*/React.cloneElement(checkedIcon, {
|
|
185
|
+
fontSize: checkedIcon.props.fontSize ?? size
|
|
186
|
+
}),
|
|
187
|
+
disabled,
|
|
188
|
+
name,
|
|
189
|
+
checked,
|
|
190
|
+
slots,
|
|
191
|
+
slotProps: {
|
|
192
|
+
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
193
|
+
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return /*#__PURE__*/_jsx(RootSlot, {
|
|
198
|
+
...rootSlotProps,
|
|
199
|
+
classes: classes
|
|
175
200
|
});
|
|
176
201
|
});
|
|
177
202
|
process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ = {
|
|
@@ -223,10 +248,12 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
223
248
|
id: PropTypes.string,
|
|
224
249
|
/**
|
|
225
250
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
251
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
226
252
|
*/
|
|
227
253
|
inputProps: PropTypes.object,
|
|
228
254
|
/**
|
|
229
255
|
* Pass a ref to the `input` element.
|
|
256
|
+
* @deprecated Use `slotProps.input.ref` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
230
257
|
*/
|
|
231
258
|
inputRef: refType,
|
|
232
259
|
/**
|
|
@@ -252,6 +279,22 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
252
279
|
* @default 'medium'
|
|
253
280
|
*/
|
|
254
281
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
282
|
+
/**
|
|
283
|
+
* The props used for each slot inside.
|
|
284
|
+
* @default {}
|
|
285
|
+
*/
|
|
286
|
+
slotProps: PropTypes.shape({
|
|
287
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
288
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
289
|
+
}),
|
|
290
|
+
/**
|
|
291
|
+
* The components used for each slot inside.
|
|
292
|
+
* @default {}
|
|
293
|
+
*/
|
|
294
|
+
slots: PropTypes.shape({
|
|
295
|
+
input: PropTypes.elementType,
|
|
296
|
+
root: PropTypes.elementType
|
|
297
|
+
}),
|
|
255
298
|
/**
|
|
256
299
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
257
300
|
*/
|
|
@@ -500,16 +500,16 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
500
500
|
horizontal: 'center'
|
|
501
501
|
},
|
|
502
502
|
...MenuProps,
|
|
503
|
-
MenuListProps: {
|
|
504
|
-
'aria-labelledby': labelId,
|
|
505
|
-
role: 'listbox',
|
|
506
|
-
'aria-multiselectable': multiple ? 'true' : undefined,
|
|
507
|
-
disableListWrap: true,
|
|
508
|
-
id: listboxId,
|
|
509
|
-
...MenuProps.MenuListProps
|
|
510
|
-
},
|
|
511
503
|
slotProps: {
|
|
512
504
|
...MenuProps.slotProps,
|
|
505
|
+
list: {
|
|
506
|
+
'aria-labelledby': labelId,
|
|
507
|
+
role: 'listbox',
|
|
508
|
+
'aria-multiselectable': multiple ? 'true' : undefined,
|
|
509
|
+
disableListWrap: true,
|
|
510
|
+
id: listboxId,
|
|
511
|
+
...MenuProps.MenuListProps
|
|
512
|
+
},
|
|
513
513
|
paper: {
|
|
514
514
|
...paperProps,
|
|
515
515
|
style: {
|