@mui/material 5.14.5 → 5.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +163 -3
- package/Drawer/Drawer.d.ts +2 -0
- package/Drawer/Drawer.js +2 -0
- package/InputBase/InputBase.js +1 -1
- package/Modal/Modal.d.ts +117 -12
- package/Modal/Modal.js +97 -36
- package/Modal/index.d.ts +3 -0
- package/Modal/index.js +2 -1
- package/Modal/modalClasses.d.ts +12 -0
- package/Modal/modalClasses.js +7 -0
- package/Popover/Popover.d.ts +2 -1
- package/Popover/Popover.js +20 -6
- package/README.md +2 -3
- package/Select/Select.js +5 -3
- package/Select/selectClasses.d.ts +2 -0
- package/Select/selectClasses.js +1 -1
- package/Skeleton/Skeleton.js +2 -2
- package/Snackbar/Snackbar.d.ts +4 -4
- package/Snackbar/Snackbar.js +4 -4
- package/TextField/TextField.d.ts +0 -4
- package/TextField/TextField.js +2 -17
- package/index.js +1 -1
- package/legacy/Drawer/Drawer.js +2 -0
- package/legacy/InputBase/InputBase.js +1 -1
- package/legacy/Modal/Modal.js +93 -43
- package/legacy/Modal/index.js +2 -1
- package/legacy/Modal/modalClasses.js +7 -0
- package/legacy/Popover/Popover.js +22 -5
- package/legacy/Select/Select.js +4 -2
- package/legacy/Select/selectClasses.js +1 -1
- package/legacy/Skeleton/Skeleton.js +2 -2
- package/legacy/Snackbar/Snackbar.js +4 -4
- package/legacy/TextField/TextField.js +2 -17
- package/legacy/index.js +1 -1
- package/modern/Drawer/Drawer.js +2 -0
- package/modern/InputBase/InputBase.js +1 -1
- package/modern/Modal/Modal.js +97 -36
- package/modern/Modal/index.js +2 -1
- package/modern/Modal/modalClasses.js +7 -0
- package/modern/Popover/Popover.js +20 -6
- package/modern/Select/Select.js +5 -3
- package/modern/Select/selectClasses.js +1 -1
- package/modern/Skeleton/Skeleton.js +2 -2
- package/modern/Snackbar/Snackbar.js +4 -4
- package/modern/TextField/TextField.js +2 -17
- package/modern/index.js +1 -1
- package/node/Drawer/Drawer.js +2 -0
- package/node/InputBase/InputBase.js +1 -1
- package/node/Modal/Modal.js +100 -41
- package/node/Modal/index.js +14 -5
- package/node/Modal/modalClasses.js +16 -0
- package/node/Popover/Popover.js +20 -6
- package/node/Select/Select.js +5 -3
- package/node/Select/selectClasses.js +1 -1
- package/node/Skeleton/Skeleton.js +2 -2
- package/node/Snackbar/Snackbar.js +4 -4
- package/node/TextField/TextField.js +2 -17
- package/node/index.js +1 -1
- package/package.json +6 -6
- package/umd/material-ui.development.js +456 -657
- package/umd/material-ui.production.min.js +23 -23
package/Popover/Popover.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["onEntering"],
|
|
6
|
-
_excluded2 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"],
|
|
6
|
+
_excluded2 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps", "disableScrollLock"],
|
|
7
7
|
_excluded3 = ["slotProps"];
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
@@ -113,7 +113,8 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
113
113
|
transitionDuration: transitionDurationProp = 'auto',
|
|
114
114
|
TransitionProps: {
|
|
115
115
|
onEntering
|
|
116
|
-
} = {}
|
|
116
|
+
} = {},
|
|
117
|
+
disableScrollLock = false
|
|
117
118
|
} = props,
|
|
118
119
|
TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
|
|
119
120
|
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
@@ -201,11 +202,11 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
201
202
|
const widthThreshold = containerWindow.innerWidth - marginThreshold;
|
|
202
203
|
|
|
203
204
|
// Check if the vertical axis needs shifting
|
|
204
|
-
if (top < marginThreshold) {
|
|
205
|
+
if (marginThreshold !== null && top < marginThreshold) {
|
|
205
206
|
const diff = top - marginThreshold;
|
|
206
207
|
top -= diff;
|
|
207
208
|
elemTransformOrigin.vertical += diff;
|
|
208
|
-
} else if (bottom > heightThreshold) {
|
|
209
|
+
} else if (marginThreshold !== null && bottom > heightThreshold) {
|
|
209
210
|
const diff = bottom - heightThreshold;
|
|
210
211
|
top -= diff;
|
|
211
212
|
elemTransformOrigin.vertical += diff;
|
|
@@ -217,7 +218,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
// Check if the horizontal axis needs shifting
|
|
220
|
-
if (left < marginThreshold) {
|
|
221
|
+
if (marginThreshold !== null && left < marginThreshold) {
|
|
221
222
|
const diff = left - marginThreshold;
|
|
222
223
|
left -= diff;
|
|
223
224
|
elemTransformOrigin.horizontal += diff;
|
|
@@ -248,6 +249,12 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
248
249
|
element.style.transformOrigin = positioning.transformOrigin;
|
|
249
250
|
setIsPositioned(true);
|
|
250
251
|
}, [getPositioningStyle]);
|
|
252
|
+
React.useEffect(() => {
|
|
253
|
+
if (disableScrollLock) {
|
|
254
|
+
window.addEventListener('scroll', setPositioningStyles);
|
|
255
|
+
}
|
|
256
|
+
return () => window.removeEventListener('scroll', setPositioningStyles);
|
|
257
|
+
}, [anchorEl, disableScrollLock, setPositioningStyles]);
|
|
251
258
|
const handleEntering = (element, isAppearing) => {
|
|
252
259
|
if (onEntering) {
|
|
253
260
|
onEntering(element, isAppearing);
|
|
@@ -328,7 +335,8 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
328
335
|
} = _useSlotProps,
|
|
329
336
|
rootProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded3);
|
|
330
337
|
return /*#__PURE__*/_jsx(RootSlot, _extends({}, rootProps, !isHostComponent(RootSlot) && {
|
|
331
|
-
slotProps: rootSlotPropsProp
|
|
338
|
+
slotProps: rootSlotPropsProp,
|
|
339
|
+
disableScrollLock
|
|
332
340
|
}, {
|
|
333
341
|
children: /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
334
342
|
appear: true,
|
|
@@ -423,6 +431,11 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
423
431
|
* so it's simply `document.body` most of the time.
|
|
424
432
|
*/
|
|
425
433
|
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
434
|
+
/**
|
|
435
|
+
* Disable the scroll lock behavior.
|
|
436
|
+
* @default false
|
|
437
|
+
*/
|
|
438
|
+
disableScrollLock: PropTypes.bool,
|
|
426
439
|
/**
|
|
427
440
|
* The elevation of the popover.
|
|
428
441
|
* @default 8
|
|
@@ -430,6 +443,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
430
443
|
elevation: integerPropType,
|
|
431
444
|
/**
|
|
432
445
|
* Specifies how close to the edge of the window the popover can appear.
|
|
446
|
+
* If null, the popover will not be constrained by the window.
|
|
433
447
|
* @default 16
|
|
434
448
|
*/
|
|
435
449
|
marginThreshold: PropTypes.number,
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
[](https://twitter.com/MUI_hq)
|
|
29
29
|
[](https://github.com/mui/material-ui/issues/27062)
|
|
30
30
|
[](https://isitmaintained.com/project/mui/material-ui 'Average time to resolve an issue')
|
|
31
|
-
[](https://opencollective.com/mui)
|
|
32
32
|
[](https://bestpractices.coreinfrastructure.org/projects/1320)
|
|
33
33
|
|
|
34
34
|
</div>
|
|
@@ -121,14 +121,13 @@ Visit our [`styled-engine` guide](https://mui.com/material-ui/guides/styled-engi
|
|
|
121
121
|
<p>
|
|
122
122
|
<a href="https://octopus.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="128" width="128" src="https://i.ibb.co/w0HF0Nz/Logo-Blue-140px-rgb.png" alt="octopus" title="Repeatable, reliable deployments" loading="lazy" /></a>
|
|
123
123
|
<a href="https://www.doit.com/flexsave/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="128" width="128" src="https://avatars.githubusercontent.com/u/8424863?s=256" alt="doit" title="Management Platform for Google Cloud and AWS" loading="lazy" /></a>
|
|
124
|
-
<a href="https://www.zesty.io/integrations/mui-nextjs/?utm_source=mui&utm_medium=referral&utm_campaign=sponsor" rel="noopener sponsored" target="_blank"><img height="90" width="90" src="https://brand.zesty.io/zesty-io-logo.svg" alt="zesty.io" title="The only Next.js CMS you need" loading="lazy" /></a>
|
|
125
124
|
</p>
|
|
126
125
|
|
|
127
126
|
Diamond Sponsors are those who have pledged \$1,500/month or more to MUI.
|
|
128
127
|
|
|
129
128
|
### Gold 🏆
|
|
130
129
|
|
|
131
|
-
via [
|
|
130
|
+
via [Open Collective](https://opencollective.com/mui) or via [Patreon](https://www.patreon.com/oliviertassinari)
|
|
132
131
|
|
|
133
132
|
<p>
|
|
134
133
|
<a href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://avatars.githubusercontent.com/u/30204434?s=192" alt="tidelift.com" title="Enterprise-ready open-source software" loading="lazy" /></a>
|
package/Select/Select.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]
|
|
5
|
+
const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"],
|
|
6
|
+
_excluded2 = ["root"];
|
|
6
7
|
import * as React from 'react';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import clsx from 'clsx';
|
|
@@ -76,6 +77,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
76
77
|
classes: classesProp
|
|
77
78
|
});
|
|
78
79
|
const classes = useUtilityClasses(ownerState);
|
|
80
|
+
const restOfClasses = _objectWithoutPropertiesLoose(classes, _excluded2);
|
|
79
81
|
const InputComponent = input || {
|
|
80
82
|
standard: /*#__PURE__*/_jsx(StyledInput, {
|
|
81
83
|
ownerState: ownerState
|
|
@@ -118,13 +120,13 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
118
120
|
id
|
|
119
121
|
}, SelectDisplayProps)
|
|
120
122
|
}, inputProps, {
|
|
121
|
-
classes: inputProps ? deepmerge(
|
|
123
|
+
classes: inputProps ? deepmerge(restOfClasses, inputProps.classes) : restOfClasses
|
|
122
124
|
}, input ? input.props.inputProps : {})
|
|
123
125
|
}, multiple && native && variant === 'outlined' ? {
|
|
124
126
|
notched: true
|
|
125
127
|
} : {}, {
|
|
126
128
|
ref: inputComponentRef,
|
|
127
|
-
className: clsx(InputComponent.props.className, className)
|
|
129
|
+
className: clsx(InputComponent.props.className, className, classes.root)
|
|
128
130
|
}, !input && {
|
|
129
131
|
variant
|
|
130
132
|
}, other))
|
package/Select/selectClasses.js
CHANGED
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
const selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
6
|
+
const selectClasses = generateUtilityClasses('MuiSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default selectClasses;
|
package/Skeleton/Skeleton.js
CHANGED
|
@@ -105,7 +105,7 @@ const SkeletonRoot = styled('span', {
|
|
|
105
105
|
}, ({
|
|
106
106
|
ownerState
|
|
107
107
|
}) => ownerState.animation === 'pulse' && css(_t3 || (_t3 = _`
|
|
108
|
-
animation: ${0}
|
|
108
|
+
animation: ${0} 2s ease-in-out 0.5s infinite;
|
|
109
109
|
`), pulseKeyframe), ({
|
|
110
110
|
ownerState,
|
|
111
111
|
theme
|
|
@@ -117,7 +117,7 @@ const SkeletonRoot = styled('span', {
|
|
|
117
117
|
-webkit-mask-image: -webkit-radial-gradient(white, black);
|
|
118
118
|
|
|
119
119
|
&::after {
|
|
120
|
-
animation: ${0}
|
|
120
|
+
animation: ${0} 2s linear 0.5s infinite;
|
|
121
121
|
background: linear-gradient(
|
|
122
122
|
90deg,
|
|
123
123
|
transparent,
|
package/Snackbar/Snackbar.d.ts
CHANGED
|
@@ -56,10 +56,10 @@ export interface SnackbarProps extends StandardProps<React.HTMLAttributes<HTMLDi
|
|
|
56
56
|
*/
|
|
57
57
|
disableWindowBlurListener?: boolean;
|
|
58
58
|
/**
|
|
59
|
-
* When displaying multiple consecutive
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* features
|
|
59
|
+
* When displaying multiple consecutive snackbars using a single parent-rendered
|
|
60
|
+
* `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
|
|
61
|
+
* For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
|
|
62
|
+
* in place, and features like `autoHideDuration` could be affected.
|
|
63
63
|
*/
|
|
64
64
|
key?: any;
|
|
65
65
|
/**
|
package/Snackbar/Snackbar.js
CHANGED
|
@@ -227,10 +227,10 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes /* remove-proptypes *
|
|
|
227
227
|
*/
|
|
228
228
|
disableWindowBlurListener: PropTypes.bool,
|
|
229
229
|
/**
|
|
230
|
-
* When displaying multiple consecutive
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* features
|
|
230
|
+
* When displaying multiple consecutive snackbars using a single parent-rendered
|
|
231
|
+
* `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
|
|
232
|
+
* For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
|
|
233
|
+
* in place, and features like `autoHideDuration` could be affected.
|
|
234
234
|
*/
|
|
235
235
|
key: () => null,
|
|
236
236
|
/**
|
package/TextField/TextField.d.ts
CHANGED
|
@@ -111,10 +111,6 @@ export interface BaseTextFieldProps
|
|
|
111
111
|
name?: string;
|
|
112
112
|
onBlur?: InputBaseProps['onBlur'];
|
|
113
113
|
onFocus?: StandardInputProps['onFocus'];
|
|
114
|
-
/**
|
|
115
|
-
* @ignore
|
|
116
|
-
*/
|
|
117
|
-
onClick?: InputBaseProps['onClick'];
|
|
118
114
|
/**
|
|
119
115
|
* The short hint displayed in the `input` before the user enters a value.
|
|
120
116
|
*/
|
package/TextField/TextField.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["autoComplete", "autoFocus", "children", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "
|
|
5
|
+
const _excluded = ["autoComplete", "autoFocus", "children", "className", "color", "defaultValue", "disabled", "error", "FormHelperTextProps", "fullWidth", "helperText", "id", "InputLabelProps", "inputProps", "InputProps", "inputRef", "label", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onFocus", "placeholder", "required", "rows", "select", "SelectProps", "type", "value", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -101,7 +101,6 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
101
101
|
name,
|
|
102
102
|
onBlur,
|
|
103
103
|
onChange,
|
|
104
|
-
onClick,
|
|
105
104
|
onFocus,
|
|
106
105
|
placeholder,
|
|
107
106
|
required = false,
|
|
@@ -144,14 +143,6 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
144
143
|
}
|
|
145
144
|
InputMore['aria-describedby'] = undefined;
|
|
146
145
|
}
|
|
147
|
-
const handleClick = event => {
|
|
148
|
-
if (!disabled && onClick) {
|
|
149
|
-
// The `onClick` is registered both on the root and the input elements.
|
|
150
|
-
// Without stopping the propagation, the event could be triggered twice.
|
|
151
|
-
event.stopPropagation();
|
|
152
|
-
onClick(event);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
146
|
const id = useId(idOverride);
|
|
156
147
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
157
148
|
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
@@ -174,7 +165,6 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
174
165
|
onBlur: onBlur,
|
|
175
166
|
onChange: onChange,
|
|
176
167
|
onFocus: onFocus,
|
|
177
|
-
onClick: handleClick,
|
|
178
168
|
placeholder: placeholder,
|
|
179
169
|
inputProps: inputProps
|
|
180
170
|
}, InputMore, InputProps));
|
|
@@ -187,8 +177,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
187
177
|
required: required,
|
|
188
178
|
color: color,
|
|
189
179
|
variant: variant,
|
|
190
|
-
ownerState: ownerState
|
|
191
|
-
onClick: handleClick
|
|
180
|
+
ownerState: ownerState
|
|
192
181
|
}, other, {
|
|
193
182
|
children: [label != null && label !== '' && /*#__PURE__*/_jsx(InputLabel, _extends({
|
|
194
183
|
htmlFor: id,
|
|
@@ -334,10 +323,6 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
334
323
|
* You can pull out the new value by accessing `event.target.value` (string).
|
|
335
324
|
*/
|
|
336
325
|
onChange: PropTypes.func,
|
|
337
|
-
/**
|
|
338
|
-
* @ignore
|
|
339
|
-
*/
|
|
340
|
-
onClick: PropTypes.func,
|
|
341
326
|
/**
|
|
342
327
|
* @ignore
|
|
343
328
|
*/
|
package/index.js
CHANGED
package/legacy/Drawer/Drawer.js
CHANGED
|
@@ -265,8 +265,10 @@ process.env.NODE_ENV !== "production" ? Drawer.propTypes /* remove-proptypes */
|
|
|
265
265
|
ModalProps: PropTypes.object,
|
|
266
266
|
/**
|
|
267
267
|
* Callback fired when the component requests to be closed.
|
|
268
|
+
* The `reason` parameter can optionally be used to control the response to `onClose`.
|
|
268
269
|
*
|
|
269
270
|
* @param {object} event The event source of the callback.
|
|
271
|
+
* @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
|
|
270
272
|
*/
|
|
271
273
|
onClose: PropTypes.func,
|
|
272
274
|
/**
|
|
@@ -377,7 +377,7 @@ var InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref) {
|
|
|
377
377
|
if (inputRef.current && event.currentTarget === event.target) {
|
|
378
378
|
inputRef.current.focus();
|
|
379
379
|
}
|
|
380
|
-
if (onClick
|
|
380
|
+
if (onClick) {
|
|
381
381
|
onClick(event);
|
|
382
382
|
}
|
|
383
383
|
};
|
package/legacy/Modal/Modal.js
CHANGED
|
@@ -5,14 +5,28 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import { Modal as ModalUnstyled, modalClasses as modalUnstyledClasses } from '@mui/base/Modal';
|
|
9
|
-
import { isHostComponent, resolveComponentProps } from '@mui/base/utils';
|
|
10
8
|
import { elementAcceptingRef, HTMLElementType } from '@mui/utils';
|
|
9
|
+
import { useSlotProps } from '@mui/base';
|
|
10
|
+
import { unstable_useModal as useModal } from '@mui/base/unstable_useModal';
|
|
11
|
+
import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
|
|
12
|
+
import FocusTrap from '../Unstable_TrapFocus';
|
|
13
|
+
import Portal from '../Portal';
|
|
11
14
|
import styled from '../styles/styled';
|
|
12
15
|
import useThemeProps from '../styles/useThemeProps';
|
|
13
16
|
import Backdrop from '../Backdrop';
|
|
17
|
+
import { getModalUtilityClass } from './modalClasses';
|
|
14
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
21
|
+
var open = ownerState.open,
|
|
22
|
+
exited = ownerState.exited,
|
|
23
|
+
classes = ownerState.classes;
|
|
24
|
+
var slots = {
|
|
25
|
+
root: ['root', !open && exited && 'hidden'],
|
|
26
|
+
backdrop: ['backdrop']
|
|
27
|
+
};
|
|
28
|
+
return composeClasses(slots, getModalUtilityClass, classes);
|
|
29
|
+
};
|
|
16
30
|
var ModalRoot = styled('div', {
|
|
17
31
|
name: 'MuiModal',
|
|
18
32
|
slot: 'Root',
|
|
@@ -66,7 +80,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
66
80
|
var _props$BackdropCompon = props.BackdropComponent,
|
|
67
81
|
BackdropComponent = _props$BackdropCompon === void 0 ? ModalBackdrop : _props$BackdropCompon,
|
|
68
82
|
BackdropProps = props.BackdropProps,
|
|
69
|
-
|
|
83
|
+
classesProp = props.classes,
|
|
70
84
|
className = props.className,
|
|
71
85
|
_props$closeAfterTran = props.closeAfterTransition,
|
|
72
86
|
closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,
|
|
@@ -100,11 +114,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
100
114
|
slots = props.slots,
|
|
101
115
|
theme = props.theme,
|
|
102
116
|
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "open", "slotProps", "slots", "theme"]);
|
|
103
|
-
var
|
|
104
|
-
exited = _React$useState[0],
|
|
105
|
-
setExited = _React$useState[1];
|
|
106
|
-
var commonProps = {
|
|
107
|
-
container: container,
|
|
117
|
+
var propsWithDefaults = _extends({}, props, {
|
|
108
118
|
closeAfterTransition: closeAfterTransition,
|
|
109
119
|
disableAutoFocus: disableAutoFocus,
|
|
110
120
|
disableEnforceFocus: disableEnforceFocus,
|
|
@@ -113,48 +123,88 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
113
123
|
disableRestoreFocus: disableRestoreFocus,
|
|
114
124
|
disableScrollLock: disableScrollLock,
|
|
115
125
|
hideBackdrop: hideBackdrop,
|
|
116
|
-
keepMounted: keepMounted
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
keepMounted: keepMounted
|
|
127
|
+
});
|
|
128
|
+
var _useModal = useModal(_extends({}, propsWithDefaults, {
|
|
129
|
+
rootRef: ref
|
|
130
|
+
})),
|
|
131
|
+
getRootProps = _useModal.getRootProps,
|
|
132
|
+
getBackdropProps = _useModal.getBackdropProps,
|
|
133
|
+
getTransitionProps = _useModal.getTransitionProps,
|
|
134
|
+
portalRef = _useModal.portalRef,
|
|
135
|
+
isTopModal = _useModal.isTopModal,
|
|
136
|
+
exited = _useModal.exited,
|
|
137
|
+
hasTransition = _useModal.hasTransition;
|
|
138
|
+
var ownerState = _extends({}, propsWithDefaults, {
|
|
122
139
|
exited: exited
|
|
123
140
|
});
|
|
141
|
+
var classes = useUtilityClasses(ownerState);
|
|
142
|
+
var childProps = {};
|
|
143
|
+
if (children.props.tabIndex === undefined) {
|
|
144
|
+
childProps.tabIndex = '-1';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// It's a Transition like component
|
|
148
|
+
if (hasTransition) {
|
|
149
|
+
var _getTransitionProps = getTransitionProps(),
|
|
150
|
+
onEnter = _getTransitionProps.onEnter,
|
|
151
|
+
onExited = _getTransitionProps.onExited;
|
|
152
|
+
childProps.onEnter = onEnter;
|
|
153
|
+
childProps.onExited = onExited;
|
|
154
|
+
}
|
|
124
155
|
var RootSlot = (_ref2 = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref2 : ModalRoot;
|
|
125
156
|
var BackdropSlot = (_ref3 = (_slots$backdrop = slots == null ? void 0 : slots.backdrop) != null ? _slots$backdrop : components.Backdrop) != null ? _ref3 : BackdropComponent;
|
|
126
157
|
var rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
127
158
|
var backdropSlotProps = (_slotProps$backdrop = slotProps == null ? void 0 : slotProps.backdrop) != null ? _slotProps$backdrop : componentsProps.backdrop;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
as: component,
|
|
137
|
-
theme: theme
|
|
138
|
-
}, {
|
|
139
|
-
className: clsx(className, rootSlotProps == null ? void 0 : rootSlotProps.className, classes == null ? void 0 : classes.root, !ownerState.open && ownerState.exited && (classes == null ? void 0 : classes.hidden))
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
backdrop: function backdrop() {
|
|
143
|
-
return _extends({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState), {
|
|
144
|
-
className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, BackdropProps == null ? void 0 : BackdropProps.className, classes == null ? void 0 : classes.backdrop)
|
|
145
|
-
});
|
|
146
|
-
}
|
|
159
|
+
var rootProps = useSlotProps({
|
|
160
|
+
elementType: RootSlot,
|
|
161
|
+
externalSlotProps: rootSlotProps,
|
|
162
|
+
externalForwardedProps: other,
|
|
163
|
+
getSlotProps: getRootProps,
|
|
164
|
+
additionalProps: {
|
|
165
|
+
ref: ref,
|
|
166
|
+
as: component
|
|
147
167
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
168
|
+
ownerState: ownerState,
|
|
169
|
+
className: clsx(className, rootSlotProps == null ? void 0 : rootSlotProps.className, classes == null ? void 0 : classes.root, !ownerState.open && ownerState.exited && (classes == null ? void 0 : classes.hidden))
|
|
170
|
+
});
|
|
171
|
+
var backdropProps = useSlotProps({
|
|
172
|
+
elementType: BackdropSlot,
|
|
173
|
+
externalSlotProps: backdropSlotProps,
|
|
174
|
+
additionalProps: BackdropProps,
|
|
175
|
+
getSlotProps: function getSlotProps(otherHandlers) {
|
|
176
|
+
return getBackdropProps(_extends({}, otherHandlers, {
|
|
177
|
+
onClick: function onClick(e) {
|
|
178
|
+
if (onBackdropClick) {
|
|
179
|
+
onBackdropClick(e);
|
|
180
|
+
}
|
|
181
|
+
if (otherHandlers != null && otherHandlers.onClick) {
|
|
182
|
+
otherHandlers.onClick(e);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}));
|
|
153
186
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
187
|
+
className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, BackdropProps == null ? void 0 : BackdropProps.className, classes == null ? void 0 : classes.backdrop),
|
|
188
|
+
ownerState: ownerState
|
|
189
|
+
});
|
|
190
|
+
if (!keepMounted && !open && (!hasTransition || exited)) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
return /*#__PURE__*/_jsx(Portal, {
|
|
194
|
+
ref: portalRef,
|
|
195
|
+
container: container,
|
|
196
|
+
disablePortal: disablePortal,
|
|
197
|
+
children: /*#__PURE__*/_jsxs(RootSlot, _extends({}, rootProps, {
|
|
198
|
+
children: [!hideBackdrop && BackdropComponent ? /*#__PURE__*/_jsx(BackdropSlot, _extends({}, backdropProps)) : null, /*#__PURE__*/_jsx(FocusTrap, {
|
|
199
|
+
disableEnforceFocus: disableEnforceFocus,
|
|
200
|
+
disableAutoFocus: disableAutoFocus,
|
|
201
|
+
disableRestoreFocus: disableRestoreFocus,
|
|
202
|
+
isEnabled: isTopModal,
|
|
203
|
+
open: open,
|
|
204
|
+
children: /*#__PURE__*/React.cloneElement(children, childProps)
|
|
205
|
+
})]
|
|
206
|
+
}))
|
|
207
|
+
});
|
|
158
208
|
});
|
|
159
209
|
process.env.NODE_ENV !== "production" ? Modal.propTypes /* remove-proptypes */ = {
|
|
160
210
|
// ----------------------------- Warning --------------------------------
|
package/legacy/Modal/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
import generateUtilityClass from '../generateUtilityClass';
|
|
3
|
+
export function getModalUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiModal', slot);
|
|
5
|
+
}
|
|
6
|
+
var modalClasses = generateUtilityClasses('MuiModal', ['root', 'hidden', 'backdrop']);
|
|
7
|
+
export default modalClasses;
|
|
@@ -123,7 +123,9 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
123
123
|
_props$TransitionProp2 = _props$TransitionProp === void 0 ? {} : _props$TransitionProp,
|
|
124
124
|
onEntering = _props$TransitionProp2.onEntering,
|
|
125
125
|
TransitionProps = _objectWithoutProperties(_props$TransitionProp2, ["onEntering"]),
|
|
126
|
-
|
|
126
|
+
_props$disableScrollL = props.disableScrollLock,
|
|
127
|
+
disableScrollLock = _props$disableScrollL === void 0 ? false : _props$disableScrollL,
|
|
128
|
+
other = _objectWithoutProperties(props, ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps", "disableScrollLock"]);
|
|
127
129
|
var externalPaperSlotProps = (_slotProps$paper = slotProps == null ? void 0 : slotProps.paper) != null ? _slotProps$paper : PaperPropsProp;
|
|
128
130
|
var paperRef = React.useRef();
|
|
129
131
|
var handlePaperRef = useForkRef(paperRef, externalPaperSlotProps.ref);
|
|
@@ -208,11 +210,11 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
208
210
|
var widthThreshold = containerWindow.innerWidth - marginThreshold;
|
|
209
211
|
|
|
210
212
|
// Check if the vertical axis needs shifting
|
|
211
|
-
if (top < marginThreshold) {
|
|
213
|
+
if (marginThreshold !== null && top < marginThreshold) {
|
|
212
214
|
var diff = top - marginThreshold;
|
|
213
215
|
top -= diff;
|
|
214
216
|
elemTransformOrigin.vertical += diff;
|
|
215
|
-
} else if (bottom > heightThreshold) {
|
|
217
|
+
} else if (marginThreshold !== null && bottom > heightThreshold) {
|
|
216
218
|
var _diff = bottom - heightThreshold;
|
|
217
219
|
top -= _diff;
|
|
218
220
|
elemTransformOrigin.vertical += _diff;
|
|
@@ -224,7 +226,7 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
// Check if the horizontal axis needs shifting
|
|
227
|
-
if (left < marginThreshold) {
|
|
229
|
+
if (marginThreshold !== null && left < marginThreshold) {
|
|
228
230
|
var _diff2 = left - marginThreshold;
|
|
229
231
|
left -= _diff2;
|
|
230
232
|
elemTransformOrigin.horizontal += _diff2;
|
|
@@ -257,6 +259,14 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
257
259
|
element.style.transformOrigin = positioning.transformOrigin;
|
|
258
260
|
setIsPositioned(true);
|
|
259
261
|
}, [getPositioningStyle]);
|
|
262
|
+
React.useEffect(function () {
|
|
263
|
+
if (disableScrollLock) {
|
|
264
|
+
window.addEventListener('scroll', setPositioningStyles);
|
|
265
|
+
}
|
|
266
|
+
return function () {
|
|
267
|
+
return window.removeEventListener('scroll', setPositioningStyles);
|
|
268
|
+
};
|
|
269
|
+
}, [anchorEl, disableScrollLock, setPositioningStyles]);
|
|
260
270
|
var handleEntering = function handleEntering(element, isAppearing) {
|
|
261
271
|
if (onEntering) {
|
|
262
272
|
onEntering(element, isAppearing);
|
|
@@ -337,7 +347,8 @@ var Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
337
347
|
rootSlotPropsProp = _useSlotProps.slotProps,
|
|
338
348
|
rootProps = _objectWithoutProperties(_useSlotProps, ["slotProps"]);
|
|
339
349
|
return /*#__PURE__*/_jsx(RootSlot, _extends({}, rootProps, !isHostComponent(RootSlot) && {
|
|
340
|
-
slotProps: rootSlotPropsProp
|
|
350
|
+
slotProps: rootSlotPropsProp,
|
|
351
|
+
disableScrollLock: disableScrollLock
|
|
341
352
|
}, {
|
|
342
353
|
children: /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
343
354
|
appear: true,
|
|
@@ -432,6 +443,11 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
432
443
|
* so it's simply `document.body` most of the time.
|
|
433
444
|
*/
|
|
434
445
|
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
446
|
+
/**
|
|
447
|
+
* Disable the scroll lock behavior.
|
|
448
|
+
* @default false
|
|
449
|
+
*/
|
|
450
|
+
disableScrollLock: PropTypes.bool,
|
|
435
451
|
/**
|
|
436
452
|
* The elevation of the popover.
|
|
437
453
|
* @default 8
|
|
@@ -439,6 +455,7 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
439
455
|
elevation: integerPropType,
|
|
440
456
|
/**
|
|
441
457
|
* Specifies how close to the edge of the window the popover can appear.
|
|
458
|
+
* If null, the popover will not be constrained by the window.
|
|
442
459
|
* @default 16
|
|
443
460
|
*/
|
|
444
461
|
marginThreshold: PropTypes.number,
|
package/legacy/Select/Select.js
CHANGED
|
@@ -83,6 +83,8 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
83
83
|
classes: classesProp
|
|
84
84
|
});
|
|
85
85
|
var classes = useUtilityClasses(ownerState);
|
|
86
|
+
var root = classes.root,
|
|
87
|
+
restOfClasses = _objectWithoutProperties(classes, ["root"]);
|
|
86
88
|
var InputComponent = input || {
|
|
87
89
|
standard: /*#__PURE__*/_jsx(StyledInput, {
|
|
88
90
|
ownerState: ownerState
|
|
@@ -125,13 +127,13 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
125
127
|
id: id
|
|
126
128
|
}, SelectDisplayProps)
|
|
127
129
|
}, inputProps, {
|
|
128
|
-
classes: inputProps ? deepmerge(
|
|
130
|
+
classes: inputProps ? deepmerge(restOfClasses, inputProps.classes) : restOfClasses
|
|
129
131
|
}, input ? input.props.inputProps : {})
|
|
130
132
|
}, multiple && native && variant === 'outlined' ? {
|
|
131
133
|
notched: true
|
|
132
134
|
} : {}, {
|
|
133
135
|
ref: inputComponentRef,
|
|
134
|
-
className: clsx(InputComponent.props.className, className)
|
|
136
|
+
className: clsx(InputComponent.props.className, className, classes.root)
|
|
135
137
|
}, !input && {
|
|
136
138
|
variant: variant
|
|
137
139
|
}, other))
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
var selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
6
|
+
var selectClasses = generateUtilityClasses('MuiSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default selectClasses;
|
|
@@ -70,11 +70,11 @@ var SkeletonRoot = styled('span', {
|
|
|
70
70
|
});
|
|
71
71
|
}, function (_ref2) {
|
|
72
72
|
var ownerState = _ref2.ownerState;
|
|
73
|
-
return ownerState.animation === 'pulse' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", "
|
|
73
|
+
return ownerState.animation === 'pulse' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " 2s ease-in-out 0.5s infinite;\n "])), pulseKeyframe);
|
|
74
74
|
}, function (_ref3) {
|
|
75
75
|
var ownerState = _ref3.ownerState,
|
|
76
76
|
theme = _ref3.theme;
|
|
77
|
-
return ownerState.animation === 'wave' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n\n /* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n\n &::after {\n animation: ", "
|
|
77
|
+
return ownerState.animation === 'wave' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n\n /* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n\n &::after {\n animation: ", " 2s linear 0.5s infinite;\n background: linear-gradient(\n 90deg,\n transparent,\n ", ",\n transparent\n );\n content: '';\n position: absolute;\n transform: translateX(-100%); /* Avoid flash during server-side hydration */\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n }\n "])), waveKeyframe, (theme.vars || theme).palette.action.hover);
|
|
78
78
|
});
|
|
79
79
|
var Skeleton = /*#__PURE__*/React.forwardRef(function Skeleton(inProps, ref) {
|
|
80
80
|
var props = useThemeProps({
|