@mui/material 6.0.0-beta.5 → 6.0.0-beta.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/Autocomplete/Autocomplete.js +1 -1
- package/Breadcrumbs/Breadcrumbs.js +1 -1
- package/CHANGELOG.md +69 -0
- package/CardHeader/CardHeader.js +9 -5
- package/DialogContentText/DialogContentText.js +1 -1
- package/Divider/Divider.js +3 -2
- package/FormControlLabel/FormControlLabel.js +1 -3
- package/IconButton/IconButton.js +3 -0
- package/InputAdornment/InputAdornment.js +1 -1
- package/Link/Link.js +39 -4
- package/Link/getTextDecoration.d.ts +1 -2
- package/Link/getTextDecoration.js +1 -19
- package/ListItemText/ListItemText.js +8 -4
- package/Slider/useSlider.js +3 -3
- package/Typography/Typography.d.ts +21 -2
- package/Typography/Typography.js +28 -16
- package/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +1 -1
- package/modern/Breadcrumbs/Breadcrumbs.js +1 -1
- package/modern/CardHeader/CardHeader.js +9 -5
- package/modern/DialogContentText/DialogContentText.js +1 -1
- package/modern/Divider/Divider.js +3 -2
- package/modern/FormControlLabel/FormControlLabel.js +1 -3
- package/modern/IconButton/IconButton.js +3 -0
- package/modern/InputAdornment/InputAdornment.js +1 -1
- package/modern/Link/Link.js +39 -4
- package/modern/Link/getTextDecoration.js +1 -19
- package/modern/ListItemText/ListItemText.js +8 -4
- package/modern/Slider/useSlider.js +3 -3
- package/modern/Typography/Typography.js +28 -16
- package/modern/index.js +1 -1
- package/modern/styles/createGetSelector.js +8 -2
- package/modern/useAutocomplete/useAutocomplete.js +0 -8
- package/modern/version/index.js +2 -2
- package/node/AppBar/AppBar.js +10 -13
- package/node/Autocomplete/Autocomplete.js +4 -7
- package/node/AvatarGroup/AvatarGroup.js +1 -2
- package/node/Badge/Badge.js +6 -7
- package/node/Breadcrumbs/Breadcrumbs.js +1 -1
- package/node/Button/Button.js +1 -2
- package/node/ButtonBase/TouchRipple.js +4 -4
- package/node/CardHeader/CardHeader.js +9 -5
- package/node/Checkbox/Checkbox.js +2 -3
- package/node/CssBaseline/CssBaseline.js +5 -10
- package/node/DialogContentText/DialogContentText.js +1 -1
- package/node/DialogTitle/DialogTitle.js +1 -1
- package/node/Divider/Divider.js +3 -2
- package/node/Fab/Fab.js +87 -90
- package/node/FilledInput/FilledInput.js +13 -17
- package/node/FormControlLabel/FormControlLabel.js +4 -7
- package/node/Grid/Grid.js +2 -4
- package/node/IconButton/IconButton.js +3 -0
- package/node/Input/Input.js +3 -4
- package/node/InputAdornment/InputAdornment.js +1 -1
- package/node/InputBase/InputBase.js +1 -2
- package/node/Link/Link.js +39 -4
- package/node/Link/getTextDecoration.js +2 -20
- package/node/ListItemText/ListItemText.js +9 -5
- package/node/Menu/Menu.js +2 -3
- package/node/Modal/Modal.js +4 -4
- package/node/Modal/ModalManager.js +1 -1
- package/node/Modal/useModal.js +4 -6
- package/node/OutlinedInput/OutlinedInput.js +3 -3
- package/node/PaginationItem/PaginationItem.js +4 -5
- package/node/Paper/Paper.js +1 -2
- package/node/Popover/Popover.js +2 -3
- package/node/Popper/BasePopper.js +1 -2
- package/node/Popper/Popper.js +2 -3
- package/node/Radio/Radio.js +2 -3
- package/node/ScopedCssBaseline/ScopedCssBaseline.js +2 -4
- package/node/Select/SelectInput.js +2 -3
- package/node/Slider/Slider.js +20 -21
- package/node/Slider/useSlider.js +17 -29
- package/node/Snackbar/useSnackbar.js +7 -7
- package/node/StepLabel/StepLabel.js +1 -1
- package/node/SvgIcon/SvgIcon.js +75 -81
- package/node/SwipeableDrawer/SwipeableDrawer.js +1 -2
- package/node/TabScrollButton/TabScrollButton.js +2 -3
- package/node/TablePagination/TablePagination.js +1 -2
- package/node/TablePagination/TablePaginationActions.js +10 -11
- package/node/Tabs/Tabs.js +5 -8
- package/node/Tooltip/Tooltip.js +13 -15
- package/node/Typography/Typography.js +28 -16
- package/node/Unstable_TrapFocus/FocusTrap.js +1 -2
- package/node/index.js +1 -1
- package/node/styles/createGetSelector.js +9 -3
- package/node/styles/createTheme.js +2 -2
- package/node/styles/createThemeNoVars.js +1 -1
- package/node/styles/createThemeWithVars.js +5 -7
- package/node/styles/shouldSkipGeneratingVar.js +1 -2
- package/node/transitions/utils.js +2 -3
- package/node/useAutocomplete/useAutocomplete.js +3 -18
- package/node/useLazyRipple/useLazyRipple.js +3 -12
- package/node/utils/useSlot.js +1 -1
- package/node/version/index.js +2 -2
- package/package.json +11 -11
- package/styles/createGetSelector.d.ts +5 -3
- package/styles/createGetSelector.js +8 -2
- package/useAutocomplete/useAutocomplete.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +0 -8
- package/version/index.js +2 -2
package/node/Menu/Menu.js
CHANGED
|
@@ -69,7 +69,6 @@ const MenuMenuList = (0, _zeroStyled.styled)(_MenuList.default, {
|
|
|
69
69
|
outline: 0
|
|
70
70
|
});
|
|
71
71
|
const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
72
|
-
var _slots$paper, _slotProps$paper;
|
|
73
72
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
74
73
|
props: inProps,
|
|
75
74
|
name: 'MuiMenu'
|
|
@@ -154,8 +153,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
});
|
|
157
|
-
const PaperSlot =
|
|
158
|
-
const paperExternalSlotProps =
|
|
156
|
+
const PaperSlot = slots.paper ?? MenuPaper;
|
|
157
|
+
const paperExternalSlotProps = slotProps.paper ?? PaperProps;
|
|
159
158
|
const rootSlotProps = (0, _useSlotProps.default)({
|
|
160
159
|
elementType: slots.root,
|
|
161
160
|
externalSlotProps: slotProps.root,
|
package/node/Modal/Modal.js
CHANGED
|
@@ -184,7 +184,7 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
184
184
|
as: component
|
|
185
185
|
},
|
|
186
186
|
ownerState,
|
|
187
|
-
className: (0, _clsx.default)(className, classes
|
|
187
|
+
className: (0, _clsx.default)(className, classes?.root, !ownerState.open && ownerState.exited && classes?.hidden)
|
|
188
188
|
});
|
|
189
189
|
const [BackdropSlot, backdropProps] = (0, _useSlot.default)('backdrop', {
|
|
190
190
|
elementType: BackdropComponent,
|
|
@@ -197,16 +197,16 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
197
197
|
if (onBackdropClick) {
|
|
198
198
|
onBackdropClick(e);
|
|
199
199
|
}
|
|
200
|
-
if (otherHandlers
|
|
200
|
+
if (otherHandlers?.onClick) {
|
|
201
201
|
otherHandlers.onClick(e);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
},
|
|
206
|
-
className: (0, _clsx.default)(BackdropProps
|
|
206
|
+
className: (0, _clsx.default)(BackdropProps?.className, classes?.backdrop),
|
|
207
207
|
ownerState
|
|
208
208
|
});
|
|
209
|
-
const backdropRef = (0, _utils.useForkRef)(BackdropProps
|
|
209
|
+
const backdropRef = (0, _utils.useForkRef)(BackdropProps?.ref, backdropProps.ref);
|
|
210
210
|
if (!keepMounted && !open && (!hasTransition || exited)) {
|
|
211
211
|
return null;
|
|
212
212
|
}
|
|
@@ -88,7 +88,7 @@ function handleContainer(containerInfo, props) {
|
|
|
88
88
|
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
|
89
89
|
const parent = container.parentElement;
|
|
90
90
|
const containerWindow = (0, _utils.unstable_ownerWindow)(container);
|
|
91
|
-
scrollContainer =
|
|
91
|
+
scrollContainer = parent?.nodeName === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// Block the scroll even if no scrollbar is visible to account for mobile keyboard
|
package/node/Modal/useModal.js
CHANGED
|
@@ -112,8 +112,7 @@ function useModal(parameters) {
|
|
|
112
112
|
}
|
|
113
113
|
}, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
|
|
114
114
|
const createHandleKeyDown = otherHandlers => event => {
|
|
115
|
-
|
|
116
|
-
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);
|
|
115
|
+
otherHandlers.onKeyDown?.(event);
|
|
117
116
|
|
|
118
117
|
// The handler doesn't take event.defaultPrevented into account:
|
|
119
118
|
//
|
|
@@ -135,8 +134,7 @@ function useModal(parameters) {
|
|
|
135
134
|
}
|
|
136
135
|
};
|
|
137
136
|
const createHandleBackdropClick = otherHandlers => event => {
|
|
138
|
-
|
|
139
|
-
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event);
|
|
137
|
+
otherHandlers.onClick?.(event);
|
|
140
138
|
if (event.target !== event.currentTarget) {
|
|
141
139
|
return;
|
|
142
140
|
}
|
|
@@ -187,8 +185,8 @@ function useModal(parameters) {
|
|
|
187
185
|
}
|
|
188
186
|
};
|
|
189
187
|
return {
|
|
190
|
-
onEnter: (0, _utils.unstable_createChainedFunction)(handleEnter, children
|
|
191
|
-
onExited: (0, _utils.unstable_createChainedFunction)(handleExited, children
|
|
188
|
+
onEnter: (0, _utils.unstable_createChainedFunction)(handleEnter, children?.props.onEnter),
|
|
189
|
+
onExited: (0, _utils.unstable_createChainedFunction)(handleExited, children?.props.onExited)
|
|
192
190
|
};
|
|
193
191
|
};
|
|
194
192
|
return {
|
|
@@ -184,7 +184,7 @@ const OutlinedInputInput = (0, _zeroStyled.styled)(_InputBase.InputBaseInput, {
|
|
|
184
184
|
}]
|
|
185
185
|
}));
|
|
186
186
|
const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps, ref) {
|
|
187
|
-
var
|
|
187
|
+
var _React$Fragment;
|
|
188
188
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
189
189
|
props: inProps,
|
|
190
190
|
name: 'MuiOutlinedInput'
|
|
@@ -220,8 +220,8 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
|
|
|
220
220
|
size: fcs.size,
|
|
221
221
|
type
|
|
222
222
|
};
|
|
223
|
-
const RootSlot =
|
|
224
|
-
const InputSlot =
|
|
223
|
+
const RootSlot = slots.root ?? components.Root ?? OutlinedInputRoot;
|
|
224
|
+
const InputSlot = slots.input ?? components.Input ?? OutlinedInputInput;
|
|
225
225
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputBase.default, {
|
|
226
226
|
slots: {
|
|
227
227
|
root: RootSlot,
|
|
@@ -274,7 +274,6 @@ const PaginationItemPageIcon = (0, _zeroStyled.styled)('div', {
|
|
|
274
274
|
}]
|
|
275
275
|
}));
|
|
276
276
|
const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inProps, ref) {
|
|
277
|
-
var _slots$previous, _slots$next, _slots$first, _slots$last;
|
|
278
277
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
279
278
|
props: inProps,
|
|
280
279
|
name: 'MuiPaginationItem'
|
|
@@ -309,10 +308,10 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
|
|
|
309
308
|
const classes = useUtilityClasses(ownerState);
|
|
310
309
|
const externalForwardedProps = {
|
|
311
310
|
slots: {
|
|
312
|
-
previous:
|
|
313
|
-
next:
|
|
314
|
-
first:
|
|
315
|
-
last:
|
|
311
|
+
previous: slots.previous ?? components.previous,
|
|
312
|
+
next: slots.next ?? components.next,
|
|
313
|
+
first: slots.first ?? components.first,
|
|
314
|
+
last: slots.last ?? components.last
|
|
316
315
|
},
|
|
317
316
|
slotProps
|
|
318
317
|
};
|
package/node/Paper/Paper.js
CHANGED
|
@@ -72,7 +72,6 @@ const PaperRoot = (0, _zeroStyled.styled)('div', {
|
|
|
72
72
|
}]
|
|
73
73
|
}));
|
|
74
74
|
const Paper = /*#__PURE__*/React.forwardRef(function Paper(inProps, ref) {
|
|
75
|
-
var _theme$vars$overlays;
|
|
76
75
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
77
76
|
props: inProps,
|
|
78
77
|
name: 'MuiPaper'
|
|
@@ -109,7 +108,7 @@ const Paper = /*#__PURE__*/React.forwardRef(function Paper(inProps, ref) {
|
|
|
109
108
|
...(variant === 'elevation' && {
|
|
110
109
|
'--Paper-shadow': (theme.vars || theme).shadows[elevation],
|
|
111
110
|
...(theme.vars && {
|
|
112
|
-
'--Paper-overlay':
|
|
111
|
+
'--Paper-overlay': theme.vars.overlays?.[elevation]
|
|
113
112
|
}),
|
|
114
113
|
...(!theme.vars && theme.palette.mode === 'dark' && {
|
|
115
114
|
'--Paper-overlay': `linear-gradient(${(0, _colorManipulator.alpha)('#fff', (0, _getOverlayAlpha.default)(elevation))}, ${(0, _colorManipulator.alpha)('#fff', (0, _getOverlayAlpha.default)(elevation))})`
|
package/node/Popover/Popover.js
CHANGED
|
@@ -93,7 +93,6 @@ const PopoverPaper = exports.PopoverPaper = (0, _zeroStyled.styled)(_Paper.defau
|
|
|
93
93
|
outline: 0
|
|
94
94
|
});
|
|
95
95
|
const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
96
|
-
var _slotProps$paper;
|
|
97
96
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
98
97
|
props: inProps,
|
|
99
98
|
name: 'MuiPopover'
|
|
@@ -129,7 +128,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
129
128
|
disableScrollLock = false,
|
|
130
129
|
...other
|
|
131
130
|
} = props;
|
|
132
|
-
const externalPaperSlotProps =
|
|
131
|
+
const externalPaperSlotProps = slotProps?.paper ?? PaperPropsProp;
|
|
133
132
|
const paperRef = React.useRef();
|
|
134
133
|
const ownerState = {
|
|
135
134
|
...props,
|
|
@@ -320,7 +319,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
320
319
|
externalForwardedProps,
|
|
321
320
|
additionalProps: {
|
|
322
321
|
elevation,
|
|
323
|
-
className: (0, _clsx.default)(classes.paper, externalPaperSlotProps
|
|
322
|
+
className: (0, _clsx.default)(classes.paper, externalPaperSlotProps?.className),
|
|
324
323
|
style: isPositioned ? externalPaperSlotProps.style : {
|
|
325
324
|
...externalPaperSlotProps.style,
|
|
326
325
|
opacity: 0
|
|
@@ -54,7 +54,6 @@ const useUtilityClasses = ownerState => {
|
|
|
54
54
|
};
|
|
55
55
|
const defaultPopperOptions = {};
|
|
56
56
|
const PopperTooltip = /*#__PURE__*/React.forwardRef(function PopperTooltip(props, forwardedRef) {
|
|
57
|
-
var _slots$root;
|
|
58
57
|
const {
|
|
59
58
|
anchorEl,
|
|
60
59
|
children,
|
|
@@ -158,7 +157,7 @@ const PopperTooltip = /*#__PURE__*/React.forwardRef(function PopperTooltip(props
|
|
|
158
157
|
childProps.TransitionProps = TransitionProps;
|
|
159
158
|
}
|
|
160
159
|
const classes = useUtilityClasses(props);
|
|
161
|
-
const Root =
|
|
160
|
+
const Root = slots.root ?? 'div';
|
|
162
161
|
const rootProps = (0, _useSlotProps.default)({
|
|
163
162
|
elementType: Root,
|
|
164
163
|
externalSlotProps: slotProps.root,
|
package/node/Popper/Popper.js
CHANGED
|
@@ -36,7 +36,6 @@ const PopperRoot = (0, _zeroStyled.styled)(_BasePopper.default, {
|
|
|
36
36
|
* - [Popper API](https://next.mui.com/material-ui/api/popper/)
|
|
37
37
|
*/
|
|
38
38
|
const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
|
|
39
|
-
var _slots$root;
|
|
40
39
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
41
40
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
42
41
|
props: inProps,
|
|
@@ -60,7 +59,7 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
|
|
|
60
59
|
slotProps,
|
|
61
60
|
...other
|
|
62
61
|
} = props;
|
|
63
|
-
const RootComponent =
|
|
62
|
+
const RootComponent = slots?.root ?? components?.Root;
|
|
64
63
|
const otherProps = {
|
|
65
64
|
anchorEl,
|
|
66
65
|
container,
|
|
@@ -80,7 +79,7 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
|
|
|
80
79
|
slots: {
|
|
81
80
|
root: RootComponent
|
|
82
81
|
},
|
|
83
|
-
slotProps: slotProps
|
|
82
|
+
slotProps: slotProps ?? componentsProps,
|
|
84
83
|
...otherProps,
|
|
85
84
|
ref: ref
|
|
86
85
|
});
|
package/node/Radio/Radio.js
CHANGED
|
@@ -112,7 +112,6 @@ const defaultCheckedIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtonIcon.de
|
|
|
112
112
|
});
|
|
113
113
|
const defaultIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtonIcon.default, {});
|
|
114
114
|
const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
115
|
-
var _defaultIcon$props$fo, _defaultCheckedIcon$p;
|
|
116
115
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
117
116
|
props: inProps,
|
|
118
117
|
name: 'MuiRadio'
|
|
@@ -151,10 +150,10 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
151
150
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RadioRoot, {
|
|
152
151
|
type: "radio",
|
|
153
152
|
icon: /*#__PURE__*/React.cloneElement(icon, {
|
|
154
|
-
fontSize:
|
|
153
|
+
fontSize: defaultIcon.props.fontSize ?? size
|
|
155
154
|
}),
|
|
156
155
|
checkedIcon: /*#__PURE__*/React.cloneElement(checkedIcon, {
|
|
157
|
-
fontSize:
|
|
156
|
+
fontSize: defaultCheckedIcon.props.fontSize ?? size
|
|
158
157
|
}),
|
|
159
158
|
ownerState: ownerState,
|
|
160
159
|
classes: classes,
|
|
@@ -38,14 +38,12 @@ const ScopedCssBaselineRoot = (0, _zeroStyled.styled)('div', {
|
|
|
38
38
|
Object.entries(theme.colorSchemes).forEach(([key, scheme]) => {
|
|
39
39
|
const selector = theme.getColorSchemeSelector(key);
|
|
40
40
|
if (selector.startsWith('@')) {
|
|
41
|
-
var _scheme$palette;
|
|
42
41
|
colorSchemeStyles[selector] = {
|
|
43
|
-
colorScheme:
|
|
42
|
+
colorScheme: scheme.palette?.mode
|
|
44
43
|
};
|
|
45
44
|
} else {
|
|
46
|
-
var _scheme$palette2;
|
|
47
45
|
colorSchemeStyles[`&${selector.replace(/\s*&/, '')}`] = {
|
|
48
|
-
colorScheme:
|
|
46
|
+
colorScheme: scheme.palette?.mode
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
49
|
});
|
|
@@ -115,7 +115,6 @@ const useUtilityClasses = ownerState => {
|
|
|
115
115
|
* @ignore - internal component.
|
|
116
116
|
*/
|
|
117
117
|
const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {
|
|
118
|
-
var _MenuProps$slotProps;
|
|
119
118
|
const {
|
|
120
119
|
'aria-describedby': ariaDescribedby,
|
|
121
120
|
'aria-label': ariaLabel,
|
|
@@ -174,7 +173,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
174
173
|
setDisplayNode(node);
|
|
175
174
|
}
|
|
176
175
|
}, []);
|
|
177
|
-
const anchorElement = displayNode
|
|
176
|
+
const anchorElement = displayNode?.parentNode;
|
|
178
177
|
React.useImperativeHandle(handleRef, () => ({
|
|
179
178
|
focus: () => {
|
|
180
179
|
displayRef.current.focus();
|
|
@@ -440,7 +439,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
440
439
|
const classes = useUtilityClasses(ownerState);
|
|
441
440
|
const paperProps = {
|
|
442
441
|
...MenuProps.PaperProps,
|
|
443
|
-
...
|
|
442
|
+
...MenuProps.slotProps?.paper
|
|
444
443
|
};
|
|
445
444
|
const listboxId = (0, _useId.default)();
|
|
446
445
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
package/node/Slider/Slider.js
CHANGED
|
@@ -544,7 +544,6 @@ const Forward = ({
|
|
|
544
544
|
children
|
|
545
545
|
}) => children;
|
|
546
546
|
const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
547
|
-
var _ref, _slots$root, _ref2, _slots$rail, _ref3, _slots$track, _ref4, _slots$thumb, _ref5, _slots$valueLabel, _ref6, _slots$mark, _ref7, _slots$markLabel, _ref8, _slots$input, _slotProps$root, _slotProps$rail, _slotProps$track, _slotProps$thumb, _slotProps$valueLabel, _slotProps$mark, _slotProps$markLabel, _slotProps$input;
|
|
548
547
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
549
548
|
props: inputProps,
|
|
550
549
|
name: 'MuiSlider'
|
|
@@ -630,22 +629,22 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
630
629
|
const classes = useUtilityClasses(ownerState);
|
|
631
630
|
|
|
632
631
|
// support both `slots` and `components` for backward compatibility
|
|
633
|
-
const RootSlot =
|
|
634
|
-
const RailSlot =
|
|
635
|
-
const TrackSlot =
|
|
636
|
-
const ThumbSlot =
|
|
637
|
-
const ValueLabelSlot =
|
|
638
|
-
const MarkSlot =
|
|
639
|
-
const MarkLabelSlot =
|
|
640
|
-
const InputSlot =
|
|
641
|
-
const rootSlotProps =
|
|
642
|
-
const railSlotProps =
|
|
643
|
-
const trackSlotProps =
|
|
644
|
-
const thumbSlotProps =
|
|
645
|
-
const valueLabelSlotProps =
|
|
646
|
-
const markSlotProps =
|
|
647
|
-
const markLabelSlotProps =
|
|
648
|
-
const inputSlotProps =
|
|
632
|
+
const RootSlot = slots?.root ?? components.Root ?? SliderRoot;
|
|
633
|
+
const RailSlot = slots?.rail ?? components.Rail ?? SliderRail;
|
|
634
|
+
const TrackSlot = slots?.track ?? components.Track ?? SliderTrack;
|
|
635
|
+
const ThumbSlot = slots?.thumb ?? components.Thumb ?? SliderThumb;
|
|
636
|
+
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ?? SliderValueLabel;
|
|
637
|
+
const MarkSlot = slots?.mark ?? components.Mark ?? SliderMark;
|
|
638
|
+
const MarkLabelSlot = slots?.markLabel ?? components.MarkLabel ?? SliderMarkLabel;
|
|
639
|
+
const InputSlot = slots?.input ?? components.Input ?? 'input';
|
|
640
|
+
const rootSlotProps = slotProps?.root ?? componentsProps.root;
|
|
641
|
+
const railSlotProps = slotProps?.rail ?? componentsProps.rail;
|
|
642
|
+
const trackSlotProps = slotProps?.track ?? componentsProps.track;
|
|
643
|
+
const thumbSlotProps = slotProps?.thumb ?? componentsProps.thumb;
|
|
644
|
+
const valueLabelSlotProps = slotProps?.valueLabel ?? componentsProps.valueLabel;
|
|
645
|
+
const markSlotProps = slotProps?.mark ?? componentsProps.mark;
|
|
646
|
+
const markLabelSlotProps = slotProps?.markLabel ?? componentsProps.markLabel;
|
|
647
|
+
const inputSlotProps = slotProps?.input ?? componentsProps.input;
|
|
649
648
|
const rootProps = (0, _useSlotProps.default)({
|
|
650
649
|
elementType: RootSlot,
|
|
651
650
|
getSlotProps: getRootProps,
|
|
@@ -658,7 +657,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
658
657
|
},
|
|
659
658
|
ownerState: {
|
|
660
659
|
...ownerState,
|
|
661
|
-
...
|
|
660
|
+
...rootSlotProps?.ownerState
|
|
662
661
|
},
|
|
663
662
|
className: [classes.root, className]
|
|
664
663
|
});
|
|
@@ -679,7 +678,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
679
678
|
},
|
|
680
679
|
ownerState: {
|
|
681
680
|
...ownerState,
|
|
682
|
-
...
|
|
681
|
+
...trackSlotProps?.ownerState
|
|
683
682
|
},
|
|
684
683
|
className: classes.track
|
|
685
684
|
});
|
|
@@ -689,7 +688,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
689
688
|
externalSlotProps: thumbSlotProps,
|
|
690
689
|
ownerState: {
|
|
691
690
|
...ownerState,
|
|
692
|
-
...
|
|
691
|
+
...thumbSlotProps?.ownerState
|
|
693
692
|
},
|
|
694
693
|
className: classes.thumb
|
|
695
694
|
});
|
|
@@ -698,7 +697,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
698
697
|
externalSlotProps: valueLabelSlotProps,
|
|
699
698
|
ownerState: {
|
|
700
699
|
...ownerState,
|
|
701
|
-
...
|
|
700
|
+
...valueLabelSlotProps?.ownerState
|
|
702
701
|
},
|
|
703
702
|
className: classes.valueLabel
|
|
704
703
|
});
|
package/node/Slider/useSlider.js
CHANGED
|
@@ -19,10 +19,9 @@ function asc(a, b) {
|
|
|
19
19
|
return a - b;
|
|
20
20
|
}
|
|
21
21
|
function findClosest(values, currentValue) {
|
|
22
|
-
var _values$reduce;
|
|
23
22
|
const {
|
|
24
23
|
index: closestIndex
|
|
25
|
-
} =
|
|
24
|
+
} = values.reduce((acc, value, index) => {
|
|
26
25
|
const distance = Math.abs(currentValue - value);
|
|
27
26
|
if (acc === null || distance < acc.distance || distance === acc.distance) {
|
|
28
27
|
return {
|
|
@@ -31,7 +30,7 @@ function findClosest(values, currentValue) {
|
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
return acc;
|
|
34
|
-
}, null)
|
|
33
|
+
}, null) ?? {};
|
|
35
34
|
return closestIndex;
|
|
36
35
|
}
|
|
37
36
|
function trackFinger(event, touchId) {
|
|
@@ -91,11 +90,9 @@ function focusThumb({
|
|
|
91
90
|
activeIndex,
|
|
92
91
|
setActive
|
|
93
92
|
}) {
|
|
94
|
-
var _sliderRef$current, _doc$activeElement;
|
|
95
93
|
const doc = (0, _utils.unstable_ownerDocument)(sliderRef.current);
|
|
96
|
-
if (!
|
|
97
|
-
|
|
98
|
-
(_sliderRef$current2 = sliderRef.current) == null || _sliderRef$current2.querySelector(`[type="range"][data-index="${activeIndex}"]`).focus();
|
|
94
|
+
if (!sliderRef.current?.contains(doc.activeElement) || Number(doc?.activeElement?.getAttribute('data-index')) !== activeIndex) {
|
|
95
|
+
sliderRef.current?.querySelector(`[type="range"][data-index="${activeIndex}"]`).focus();
|
|
99
96
|
}
|
|
100
97
|
if (setActive) {
|
|
101
98
|
setActive(activeIndex);
|
|
@@ -191,7 +188,7 @@ function useSlider(parameters) {
|
|
|
191
188
|
tabIndex,
|
|
192
189
|
value: valueProp
|
|
193
190
|
} = parameters;
|
|
194
|
-
const touchId = React.useRef();
|
|
191
|
+
const touchId = React.useRef(undefined);
|
|
195
192
|
// We can't use the :active browser pseudo-classes.
|
|
196
193
|
// - The active state isn't triggered when clicking on the rail.
|
|
197
194
|
// - The active state isn't transferred when inversing a range slider.
|
|
@@ -201,7 +198,7 @@ function useSlider(parameters) {
|
|
|
201
198
|
const moveCount = React.useRef(0);
|
|
202
199
|
const [valueDerived, setValueState] = (0, _utils.unstable_useControlled)({
|
|
203
200
|
controlled: valueProp,
|
|
204
|
-
default: defaultValue
|
|
201
|
+
default: defaultValue ?? min,
|
|
205
202
|
name: 'Slider'
|
|
206
203
|
});
|
|
207
204
|
const handleChange = onChange && ((event, value, thumbIndex) => {
|
|
@@ -229,24 +226,22 @@ function useSlider(parameters) {
|
|
|
229
226
|
})) : marksProp || [];
|
|
230
227
|
const marksValues = marks.map(mark => mark.value);
|
|
231
228
|
const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1);
|
|
232
|
-
const sliderRef = React.useRef();
|
|
229
|
+
const sliderRef = React.useRef(null);
|
|
233
230
|
const handleRef = (0, _utils.unstable_useForkRef)(ref, sliderRef);
|
|
234
231
|
const createHandleHiddenInputFocus = otherHandlers => event => {
|
|
235
|
-
var _otherHandlers$onFocu;
|
|
236
232
|
const index = Number(event.currentTarget.getAttribute('data-index'));
|
|
237
233
|
if ((0, _utils.unstable_isFocusVisible)(event.target)) {
|
|
238
234
|
setFocusedThumbIndex(index);
|
|
239
235
|
}
|
|
240
236
|
setOpen(index);
|
|
241
|
-
otherHandlers
|
|
237
|
+
otherHandlers?.onFocus?.(event);
|
|
242
238
|
};
|
|
243
239
|
const createHandleHiddenInputBlur = otherHandlers => event => {
|
|
244
|
-
var _otherHandlers$onBlur;
|
|
245
240
|
if (!(0, _utils.unstable_isFocusVisible)(event.target)) {
|
|
246
241
|
setFocusedThumbIndex(-1);
|
|
247
242
|
}
|
|
248
243
|
setOpen(-1);
|
|
249
|
-
otherHandlers
|
|
244
|
+
otherHandlers?.onBlur?.(event);
|
|
250
245
|
};
|
|
251
246
|
const changeValue = (event, valueInput) => {
|
|
252
247
|
const index = Number(event.currentTarget.getAttribute('data-index'));
|
|
@@ -296,7 +291,6 @@ function useSlider(parameters) {
|
|
|
296
291
|
}
|
|
297
292
|
};
|
|
298
293
|
const createHandleHiddenInputKeyDown = otherHandlers => event => {
|
|
299
|
-
var _otherHandlers$onKeyD;
|
|
300
294
|
// The Shift + Up/Down keyboard shortcuts for moving the slider makes sense to be supported
|
|
301
295
|
// only if the step is defined. If the step is null, this means tha the marks are used for specifying the valid values.
|
|
302
296
|
if (step !== null) {
|
|
@@ -313,16 +307,15 @@ function useSlider(parameters) {
|
|
|
313
307
|
event.preventDefault();
|
|
314
308
|
}
|
|
315
309
|
}
|
|
316
|
-
otherHandlers
|
|
310
|
+
otherHandlers?.onKeyDown?.(event);
|
|
317
311
|
};
|
|
318
312
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
319
313
|
if (disabled && sliderRef.current.contains(document.activeElement)) {
|
|
320
|
-
var _document$activeEleme;
|
|
321
314
|
// This is necessary because Firefox and Safari will keep focus
|
|
322
315
|
// on a disabled element:
|
|
323
316
|
// https://codesandbox.io/p/sandbox/mui-pr-22247-forked-h151h?file=/src/App.js
|
|
324
317
|
// @ts-ignore
|
|
325
|
-
|
|
318
|
+
document.activeElement?.blur();
|
|
326
319
|
}
|
|
327
320
|
}, [disabled]);
|
|
328
321
|
if (disabled && active !== -1) {
|
|
@@ -332,12 +325,11 @@ function useSlider(parameters) {
|
|
|
332
325
|
setFocusedThumbIndex(-1);
|
|
333
326
|
}
|
|
334
327
|
const createHandleHiddenInputChange = otherHandlers => event => {
|
|
335
|
-
|
|
336
|
-
(_otherHandlers$onChan = otherHandlers.onChange) == null || _otherHandlers$onChan.call(otherHandlers, event);
|
|
328
|
+
otherHandlers.onChange?.(event);
|
|
337
329
|
// @ts-ignore
|
|
338
330
|
changeValue(event, event.target.valueAsNumber);
|
|
339
331
|
};
|
|
340
|
-
const previousIndex = React.useRef();
|
|
332
|
+
const previousIndex = React.useRef(undefined);
|
|
341
333
|
let axis = orientation;
|
|
342
334
|
if (isRtl && orientation === 'horizontal') {
|
|
343
335
|
axis += '-reverse';
|
|
@@ -526,8 +518,7 @@ function useSlider(parameters) {
|
|
|
526
518
|
}
|
|
527
519
|
}, [disabled, stopListening]);
|
|
528
520
|
const createHandleMouseDown = otherHandlers => event => {
|
|
529
|
-
|
|
530
|
-
(_otherHandlers$onMous = otherHandlers.onMouseDown) == null || _otherHandlers$onMous.call(otherHandlers, event);
|
|
521
|
+
otherHandlers.onMouseDown?.(event);
|
|
531
522
|
if (disabled) {
|
|
532
523
|
return;
|
|
533
524
|
}
|
|
@@ -585,14 +576,12 @@ function useSlider(parameters) {
|
|
|
585
576
|
};
|
|
586
577
|
};
|
|
587
578
|
const createHandleMouseOver = otherHandlers => event => {
|
|
588
|
-
|
|
589
|
-
(_otherHandlers$onMous2 = otherHandlers.onMouseOver) == null || _otherHandlers$onMous2.call(otherHandlers, event);
|
|
579
|
+
otherHandlers.onMouseOver?.(event);
|
|
590
580
|
const index = Number(event.currentTarget.getAttribute('data-index'));
|
|
591
581
|
setOpen(index);
|
|
592
582
|
};
|
|
593
583
|
const createHandleMouseLeave = otherHandlers => event => {
|
|
594
|
-
|
|
595
|
-
(_otherHandlers$onMous3 = otherHandlers.onMouseLeave) == null || _otherHandlers$onMous3.call(otherHandlers, event);
|
|
584
|
+
otherHandlers.onMouseLeave?.(event);
|
|
596
585
|
setOpen(-1);
|
|
597
586
|
};
|
|
598
587
|
const getThumbProps = (externalProps = {}) => {
|
|
@@ -614,7 +603,6 @@ function useSlider(parameters) {
|
|
|
614
603
|
};
|
|
615
604
|
};
|
|
616
605
|
const getHiddenInputProps = (externalProps = {}) => {
|
|
617
|
-
var _parameters$step;
|
|
618
606
|
const externalHandlers = (0, _extractEventHandlers.default)(externalProps);
|
|
619
607
|
const ownEventHandlers = {
|
|
620
608
|
onChange: createHandleHiddenInputChange(externalHandlers || {}),
|
|
@@ -636,7 +624,7 @@ function useSlider(parameters) {
|
|
|
636
624
|
type: 'range',
|
|
637
625
|
min: parameters.min,
|
|
638
626
|
max: parameters.max,
|
|
639
|
-
step: parameters.step === null && parameters.marks ? 'any' :
|
|
627
|
+
step: parameters.step === null && parameters.marks ? 'any' : parameters.step ?? undefined,
|
|
640
628
|
disabled,
|
|
641
629
|
...externalProps,
|
|
642
630
|
...mergedEventHandlers,
|
|
@@ -43,7 +43,7 @@ function useSnackbar(parameters = {}) {
|
|
|
43
43
|
if (!nativeEvent.defaultPrevented) {
|
|
44
44
|
if (nativeEvent.key === 'Escape') {
|
|
45
45
|
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
|
46
|
-
onClose
|
|
46
|
+
onClose?.(nativeEvent, 'escapeKeyDown');
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ function useSnackbar(parameters = {}) {
|
|
|
53
53
|
};
|
|
54
54
|
}, [open, onClose]);
|
|
55
55
|
const handleClose = (0, _utils.unstable_useEventCallback)((event, reason) => {
|
|
56
|
-
onClose
|
|
56
|
+
onClose?.(event, reason);
|
|
57
57
|
});
|
|
58
58
|
const setAutoHideTimer = (0, _utils.unstable_useEventCallback)(autoHideDurationParam => {
|
|
59
59
|
if (!onClose || autoHideDurationParam == null) {
|
|
@@ -70,7 +70,7 @@ function useSnackbar(parameters = {}) {
|
|
|
70
70
|
return timerAutoHide.clear;
|
|
71
71
|
}, [open, autoHideDuration, setAutoHideTimer, timerAutoHide]);
|
|
72
72
|
const handleClickAway = event => {
|
|
73
|
-
onClose
|
|
73
|
+
onClose?.(event, 'clickaway');
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
// Pause the timer when the user is interacting with the Snackbar
|
|
@@ -86,22 +86,22 @@ function useSnackbar(parameters = {}) {
|
|
|
86
86
|
}, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
|
|
87
87
|
const createHandleBlur = otherHandlers => event => {
|
|
88
88
|
const onBlurCallback = otherHandlers.onBlur;
|
|
89
|
-
onBlurCallback
|
|
89
|
+
onBlurCallback?.(event);
|
|
90
90
|
handleResume();
|
|
91
91
|
};
|
|
92
92
|
const createHandleFocus = otherHandlers => event => {
|
|
93
93
|
const onFocusCallback = otherHandlers.onFocus;
|
|
94
|
-
onFocusCallback
|
|
94
|
+
onFocusCallback?.(event);
|
|
95
95
|
handlePause();
|
|
96
96
|
};
|
|
97
97
|
const createMouseEnter = otherHandlers => event => {
|
|
98
98
|
const onMouseEnterCallback = otherHandlers.onMouseEnter;
|
|
99
|
-
onMouseEnterCallback
|
|
99
|
+
onMouseEnterCallback?.(event);
|
|
100
100
|
handlePause();
|
|
101
101
|
};
|
|
102
102
|
const createMouseLeave = otherHandlers => event => {
|
|
103
103
|
const onMouseLeaveCallback = otherHandlers.onMouseLeave;
|
|
104
|
-
onMouseLeaveCallback
|
|
104
|
+
onMouseLeaveCallback?.(event);
|
|
105
105
|
handleResume();
|
|
106
106
|
};
|
|
107
107
|
React.useEffect(() => {
|
|
@@ -198,7 +198,7 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
|
|
|
198
198
|
ownerState: ownerState,
|
|
199
199
|
children: [children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelSlot, {
|
|
200
200
|
...labelProps,
|
|
201
|
-
className: (0, _clsx.default)(classes.label, labelProps
|
|
201
|
+
className: (0, _clsx.default)(classes.label, labelProps?.className),
|
|
202
202
|
children: children
|
|
203
203
|
}) : null, optional]
|
|
204
204
|
})]
|