@mui/material 6.1.1 → 6.1.3
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 -5
- package/Badge/Badge.d.ts +2 -2
- package/Badge/Badge.js +12 -8
- package/Button/Button.js +3 -4
- package/CHANGELOG.md +136 -0
- package/ClickAwayListener/ClickAwayListener.js +2 -2
- package/Fade/Fade.js +2 -2
- package/Grid2/Grid2.d.ts +16 -11
- package/Grid2/Grid2.js +29 -11
- package/Grow/Grow.js +2 -2
- package/Icon/Icon.js +1 -1
- package/InputBase/InputBase.js +1 -1
- package/LinearProgress/LinearProgress.js +7 -0
- package/MenuList/MenuList.js +2 -1
- package/Modal/Modal.js +3 -3
- package/Modal/ModalManager.d.ts +1 -1
- package/Modal/ModalManager.js +5 -5
- package/Modal/useModal.js +9 -5
- package/OutlinedInput/OutlinedInput.js +6 -6
- package/PigmentGrid/PigmentGrid.d.ts +0 -23
- package/PigmentGrid/PigmentGrid.js +0 -23
- package/Portal/Portal.js +2 -2
- package/Rating/Rating.d.ts +1 -1
- package/Rating/Rating.js +7 -2
- package/Select/Select.js +2 -2
- package/Select/SelectInput.js +1 -1
- package/Slide/Slide.js +2 -2
- package/SwipeableDrawer/SwipeableDrawer.d.ts +1 -1
- package/Tooltip/Tooltip.js +2 -2
- package/Unstable_TrapFocus/FocusTrap.js +3 -3
- package/Zoom/Zoom.js +2 -2
- package/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +1 -5
- package/modern/Badge/Badge.js +12 -8
- package/modern/Button/Button.js +3 -4
- package/modern/ClickAwayListener/ClickAwayListener.js +2 -2
- package/modern/Fade/Fade.js +2 -2
- package/modern/Grid2/Grid2.js +29 -11
- package/modern/Grow/Grow.js +2 -2
- package/modern/Icon/Icon.js +1 -1
- package/modern/InputBase/InputBase.js +1 -1
- package/modern/LinearProgress/LinearProgress.js +7 -0
- package/modern/MenuList/MenuList.js +2 -1
- package/modern/Modal/Modal.js +3 -3
- package/modern/Modal/ModalManager.js +5 -5
- package/modern/Modal/useModal.js +9 -5
- package/modern/OutlinedInput/OutlinedInput.js +6 -6
- package/modern/PigmentGrid/PigmentGrid.js +0 -23
- package/modern/Portal/Portal.js +2 -2
- package/modern/Rating/Rating.js +7 -2
- package/modern/Select/Select.js +2 -2
- package/modern/Select/SelectInput.js +1 -1
- package/modern/Slide/Slide.js +2 -2
- package/modern/Tooltip/Tooltip.js +2 -2
- package/modern/Unstable_TrapFocus/FocusTrap.js +3 -3
- package/modern/Zoom/Zoom.js +2 -2
- package/modern/index.js +1 -1
- package/modern/styles/createGetSelector.js +8 -7
- package/modern/styles/createPalette.js +2 -16
- package/modern/styles/createThemeNoVars.js +1 -2
- package/modern/styles/createThemeWithVars.js +2 -0
- package/modern/styles/index.js +1 -1
- package/modern/styles/makeStyles.js +1 -3
- package/modern/styles/responsiveFontSizes.js +1 -2
- package/modern/styles/shouldSkipGeneratingVar.js +1 -1
- package/modern/styles/withStyles.js +1 -3
- package/modern/styles/withTheme.js +1 -3
- package/modern/useAutocomplete/useAutocomplete.js +3 -1
- package/modern/utils/memoTheme.js +3 -24
- package/modern/version/index.js +2 -2
- package/node/Autocomplete/Autocomplete.js +1 -5
- package/node/Badge/Badge.js +12 -8
- package/node/Button/Button.js +3 -4
- package/node/ClickAwayListener/ClickAwayListener.js +2 -2
- package/node/Fade/Fade.js +2 -2
- package/node/Grid2/Grid2.js +29 -11
- package/node/Grow/Grow.js +2 -2
- package/node/Icon/Icon.js +1 -1
- package/node/InputBase/InputBase.js +1 -1
- package/node/LinearProgress/LinearProgress.js +7 -0
- package/node/MenuList/MenuList.js +2 -1
- package/node/Modal/Modal.js +3 -3
- package/node/Modal/ModalManager.js +5 -5
- package/node/Modal/useModal.js +9 -5
- package/node/OutlinedInput/OutlinedInput.js +6 -6
- package/node/PigmentGrid/PigmentGrid.js +0 -23
- package/node/Portal/Portal.js +1 -1
- package/node/Rating/Rating.js +7 -2
- package/node/Select/Select.js +2 -2
- package/node/Select/SelectInput.js +1 -1
- package/node/Slide/Slide.js +2 -2
- package/node/Tooltip/Tooltip.js +2 -2
- package/node/Unstable_TrapFocus/FocusTrap.js +2 -2
- package/node/Zoom/Zoom.js +2 -2
- package/node/index.js +1 -1
- package/node/styles/createGetSelector.js +8 -7
- package/node/styles/createPalette.js +2 -16
- package/node/styles/createThemeNoVars.js +1 -2
- package/node/styles/createThemeWithVars.js +2 -0
- package/node/styles/index.js +1 -1
- package/node/styles/makeStyles.js +1 -3
- package/node/styles/responsiveFontSizes.js +1 -2
- package/node/styles/shouldSkipGeneratingVar.js +1 -1
- package/node/styles/withStyles.js +1 -3
- package/node/styles/withTheme.js +1 -3
- package/node/useAutocomplete/useAutocomplete.js +3 -1
- package/node/utils/memoTheme.js +4 -25
- package/node/version/index.js +2 -2
- package/package.json +6 -6
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProviderWithVars.d.ts +2 -1
- package/styles/createGetSelector.d.ts +3 -8
- package/styles/createGetSelector.js +8 -7
- package/styles/createPalette.js +2 -16
- package/styles/createTheme.d.ts +1 -1
- package/styles/createThemeNoVars.d.ts +1 -0
- package/styles/createThemeNoVars.js +1 -2
- package/styles/createThemeWithVars.d.ts +8 -0
- package/styles/createThemeWithVars.js +2 -0
- package/styles/index.js +1 -1
- package/styles/makeStyles.js +1 -3
- package/styles/responsiveFontSizes.js +1 -2
- package/styles/shouldSkipGeneratingVar.js +1 -1
- package/styles/withStyles.js +1 -3
- package/styles/withTheme.js +1 -3
- package/useAutocomplete/useAutocomplete.js +3 -1
- package/utils/memoTheme.d.ts +4 -10
- package/utils/memoTheme.js +3 -24
- package/version/index.js +2 -2
package/modern/Portal/Portal.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef,
|
|
6
|
+
import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
function getContainer(container) {
|
|
9
9
|
return typeof container === 'function' ? container() : container;
|
|
@@ -28,7 +28,7 @@ const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef
|
|
|
28
28
|
disablePortal = false
|
|
29
29
|
} = props;
|
|
30
30
|
const [mountNode, setMountNode] = React.useState(null);
|
|
31
|
-
const handleRef = useForkRef(
|
|
31
|
+
const handleRef = useForkRef(/*#__PURE__*/React.isValidElement(children) ? getReactElementRef(children) : null, forwardedRef);
|
|
32
32
|
useEnhancedEffect(() => {
|
|
33
33
|
if (!disablePortal) {
|
|
34
34
|
setMountNode(getContainer(container) || document.body);
|
package/modern/Rating/Rating.js
CHANGED
|
@@ -226,7 +226,12 @@ function RatingItem(props) {
|
|
|
226
226
|
const isHovered = itemValue <= hover;
|
|
227
227
|
const isFocused = itemValue <= focus;
|
|
228
228
|
const isChecked = itemValue === ratingValueRounded;
|
|
229
|
-
|
|
229
|
+
|
|
230
|
+
// "name" ensures unique IDs across different Rating components in React 17,
|
|
231
|
+
// preventing one component from affecting another. React 18's useId already handles this.
|
|
232
|
+
// Update to const id = useId(); when React 17 support is dropped.
|
|
233
|
+
// More details: https://github.com/mui/material-ui/issues/40997
|
|
234
|
+
const id = `${name}-${useId()}`;
|
|
230
235
|
const container = /*#__PURE__*/_jsx(RatingIcon, {
|
|
231
236
|
as: IconContainerComponent,
|
|
232
237
|
value: itemValue,
|
|
@@ -619,7 +624,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
619
624
|
/**
|
|
620
625
|
* The name attribute of the radio `input` elements.
|
|
621
626
|
* This input `name` should be unique within the page.
|
|
622
|
-
* Being unique within a form is insufficient since the `name` is used to
|
|
627
|
+
* Being unique within a form is insufficient since the `name` is used to generate IDs.
|
|
623
628
|
*/
|
|
624
629
|
name: PropTypes.string,
|
|
625
630
|
/**
|
package/modern/Select/Select.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import deepmerge from '@mui/utils/deepmerge';
|
|
7
|
-
import
|
|
7
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
8
8
|
import SelectInput from "./SelectInput.js";
|
|
9
9
|
import formControlState from "../FormControl/formControlState.js";
|
|
10
10
|
import useFormControl from "../FormControl/useFormControl.js";
|
|
@@ -92,7 +92,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
92
92
|
ownerState: ownerState
|
|
93
93
|
})
|
|
94
94
|
}[variant];
|
|
95
|
-
const inputComponentRef = useForkRef(ref,
|
|
95
|
+
const inputComponentRef = useForkRef(ref, getReactElementRef(InputComponent));
|
|
96
96
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
97
97
|
children: /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
98
98
|
// Most of the logic is implemented in `SelectInput`.
|
|
@@ -347,7 +347,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
347
347
|
let selected;
|
|
348
348
|
if (multiple) {
|
|
349
349
|
if (!Array.isArray(value)) {
|
|
350
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
350
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : _formatMuiErrorMessage(2));
|
|
351
351
|
}
|
|
352
352
|
selected = value.some(v => areEqualValues(v, child.props.value));
|
|
353
353
|
if (selected && computeDisplay) {
|
package/modern/Slide/Slide.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Transition } from 'react-transition-group';
|
|
|
6
6
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
7
7
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
8
8
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
9
|
-
import
|
|
9
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
10
10
|
import debounce from "../utils/debounce.js";
|
|
11
11
|
import useForkRef from "../utils/useForkRef.js";
|
|
12
12
|
import { useTheme } from "../zero-styled/index.js";
|
|
@@ -106,7 +106,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
106
106
|
...other
|
|
107
107
|
} = props;
|
|
108
108
|
const childrenRef = React.useRef(null);
|
|
109
|
-
const handleRef = useForkRef(
|
|
109
|
+
const handleRef = useForkRef(getReactElementRef(children), childrenRef, ref);
|
|
110
110
|
const normalizedTransitionCallback = callback => isAppearing => {
|
|
111
111
|
if (callback) {
|
|
112
112
|
// onEnterXxx and onExitXxx callbacks have a different arguments.length value.
|
|
@@ -10,7 +10,7 @@ import { alpha } from '@mui/system/colorManipulator';
|
|
|
10
10
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
11
11
|
import isFocusVisible from '@mui/utils/isFocusVisible';
|
|
12
12
|
import appendOwnerState from '@mui/utils/appendOwnerState';
|
|
13
|
-
import
|
|
13
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
14
14
|
import { styled, useTheme } from "../zero-styled/index.js";
|
|
15
15
|
import memoTheme from "../utils/memoTheme.js";
|
|
16
16
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
@@ -514,7 +514,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
514
514
|
document.removeEventListener('keydown', handleKeyDown);
|
|
515
515
|
};
|
|
516
516
|
}, [handleClose, open]);
|
|
517
|
-
const handleRef = useForkRef(
|
|
517
|
+
const handleRef = useForkRef(getReactElementRef(children), setChildNode, ref);
|
|
518
518
|
|
|
519
519
|
// There is no point in displaying an empty tooltip.
|
|
520
520
|
// So we exclude all falsy values, except 0, which is valid.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument,
|
|
6
|
+
import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
// Inspired by https://github.com/focus-trap/tabbable
|
|
9
9
|
const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
|
|
@@ -14,7 +14,7 @@ function getTabIndex(node) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// Browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
17
|
-
// https://
|
|
17
|
+
// https://issues.chromium.org/issues/41283952
|
|
18
18
|
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
19
19
|
// in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
20
20
|
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
@@ -92,7 +92,7 @@ function FocusTrap(props) {
|
|
|
92
92
|
// It waits for the active element to move into the component to activate.
|
|
93
93
|
const activated = React.useRef(false);
|
|
94
94
|
const rootRef = React.useRef(null);
|
|
95
|
-
const handleRef = useForkRef(
|
|
95
|
+
const handleRef = useForkRef(getReactElementRef(children), rootRef);
|
|
96
96
|
const lastKeydown = React.useRef(null);
|
|
97
97
|
React.useEffect(() => {
|
|
98
98
|
// We might render an empty child.
|
package/modern/Zoom/Zoom.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Transition } from 'react-transition-group';
|
|
6
6
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
7
|
-
import
|
|
7
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
8
8
|
import { useTheme } from "../zero-styled/index.js";
|
|
9
9
|
import { reflow, getTransitionProps } from "../transitions/utils.js";
|
|
10
10
|
import useForkRef from "../utils/useForkRef.js";
|
|
@@ -48,7 +48,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
|
|
|
48
48
|
...other
|
|
49
49
|
} = props;
|
|
50
50
|
const nodeRef = React.useRef(null);
|
|
51
|
-
const handleRef = useForkRef(nodeRef,
|
|
51
|
+
const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
|
|
52
52
|
const normalizedTransitionCallback = callback => maybeIsAppearing => {
|
|
53
53
|
if (callback) {
|
|
54
54
|
const node = nodeRef.current;
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import excludeVariablesFromRoot from "./excludeVariablesFromRoot.js";
|
|
2
2
|
export default theme => (colorScheme, css) => {
|
|
3
|
+
const root = theme.rootSelector || ':root';
|
|
3
4
|
const selector = theme.colorSchemeSelector;
|
|
4
5
|
let rule = selector;
|
|
5
6
|
if (selector === 'class') {
|
|
@@ -21,33 +22,33 @@ export default theme => (colorScheme, css) => {
|
|
|
21
22
|
});
|
|
22
23
|
if (rule === 'media') {
|
|
23
24
|
return {
|
|
24
|
-
|
|
25
|
+
[root]: css,
|
|
25
26
|
[`@media (prefers-color-scheme: dark)`]: {
|
|
26
|
-
|
|
27
|
+
[root]: excludedVariables
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
if (rule) {
|
|
31
32
|
return {
|
|
32
33
|
[rule.replace('%s', colorScheme)]: excludedVariables,
|
|
33
|
-
[
|
|
34
|
+
[`${root}, ${rule.replace('%s', colorScheme)}`]: css
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
return {
|
|
37
|
-
|
|
38
|
+
[root]: {
|
|
38
39
|
...css,
|
|
39
40
|
...excludedVariables
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
if (rule && rule !== 'media') {
|
|
44
|
-
return
|
|
45
|
+
return `${root}, ${rule.replace('%s', String(colorScheme))}`;
|
|
45
46
|
}
|
|
46
47
|
} else if (colorScheme) {
|
|
47
48
|
if (rule === 'media') {
|
|
48
49
|
return {
|
|
49
50
|
[`@media (prefers-color-scheme: ${String(colorScheme)})`]: {
|
|
50
|
-
|
|
51
|
+
[root]: css
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
}
|
|
@@ -55,5 +56,5 @@ export default theme => (colorScheme, css) => {
|
|
|
55
56
|
return rule.replace('%s', String(colorScheme));
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
|
-
return
|
|
59
|
+
return root;
|
|
59
60
|
};
|
|
@@ -212,24 +212,10 @@ export default function createPalette(palette) {
|
|
|
212
212
|
color.main = color[mainShade];
|
|
213
213
|
}
|
|
214
214
|
if (!color.hasOwnProperty('main')) {
|
|
215
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid
|
|
216
|
-
The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
|
|
215
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
|
|
217
216
|
}
|
|
218
217
|
if (typeof color.main !== 'string') {
|
|
219
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.
|
|
220
|
-
\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.
|
|
221
|
-
|
|
222
|
-
Did you intend to use one of the following approaches?
|
|
223
|
-
|
|
224
|
-
import { green } from "@mui/material/colors";
|
|
225
|
-
|
|
226
|
-
const theme1 = createTheme({ palette: {
|
|
227
|
-
primary: green,
|
|
228
|
-
} });
|
|
229
|
-
|
|
230
|
-
const theme2 = createTheme({ palette: {
|
|
231
|
-
primary: { main: green[500] },
|
|
232
|
-
} });` : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
218
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
233
219
|
}
|
|
234
220
|
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
235
221
|
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
@@ -21,8 +21,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
21
21
|
...other
|
|
22
22
|
} = options;
|
|
23
23
|
if (options.vars) {
|
|
24
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
25
|
-
Please use another name.` : _formatMuiErrorMessage(20));
|
|
24
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' + 'Please use another name.' : _formatMuiErrorMessage(20));
|
|
26
25
|
}
|
|
27
26
|
const palette = createPalette(paletteInput);
|
|
28
27
|
const systemTheme = systemCreateTheme(options);
|
|
@@ -109,6 +109,7 @@ export default function createThemeWithVars(options = {}, ...args) {
|
|
|
109
109
|
cssVarPrefix = 'mui',
|
|
110
110
|
shouldSkipGeneratingVar = defaultShouldSkipGeneratingVar,
|
|
111
111
|
colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? 'media' : undefined,
|
|
112
|
+
rootSelector = ':root',
|
|
112
113
|
...input
|
|
113
114
|
} = options;
|
|
114
115
|
const firstColorScheme = Object.keys(colorSchemesInput)[0];
|
|
@@ -146,6 +147,7 @@ export default function createThemeWithVars(options = {}, ...args) {
|
|
|
146
147
|
...muiTheme,
|
|
147
148
|
cssVarPrefix,
|
|
148
149
|
colorSchemeSelector: selector,
|
|
150
|
+
rootSelector,
|
|
149
151
|
getCssVar,
|
|
150
152
|
colorSchemes,
|
|
151
153
|
font: {
|
package/modern/styles/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { unstable_createBreakpoints } from '@mui/system/createBreakpoints';
|
|
|
6
6
|
// TODO: Remove this function in v6.
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
8
|
export function experimental_sx() {
|
|
9
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
9
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatMuiErrorMessage(19));
|
|
10
10
|
}
|
|
11
11
|
export { default as createTheme, createMuiTheme } from "./createTheme.js";
|
|
12
12
|
export { default as unstable_createMuiStrictModeTheme } from "./createMuiStrictModeTheme.js";
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function makeStyles() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
4
|
-
You have to import it from @mui/styles.
|
|
5
|
-
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(14));
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(14));
|
|
6
4
|
}
|
|
@@ -34,8 +34,7 @@ export default function responsiveFontSizes(themeInput, options = {}) {
|
|
|
34
34
|
lineHeight
|
|
35
35
|
} = style;
|
|
36
36
|
if (!isUnitless(lineHeight) && !disableAlign) {
|
|
37
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
38
|
-
Use unitless line heights instead.` : _formatMuiErrorMessage(6));
|
|
37
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : _formatMuiErrorMessage(6));
|
|
39
38
|
}
|
|
40
39
|
if (!isUnitless(lineHeight)) {
|
|
41
40
|
// make it unitless
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function shouldSkipGeneratingVar(keys) {
|
|
2
|
-
return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
|
|
2
|
+
return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
|
|
3
3
|
// ends with sxConfig
|
|
4
4
|
keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
|
|
5
5
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function withStyles() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
4
|
-
You have to import it from @mui/styles.
|
|
5
|
-
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(15));
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(15));
|
|
6
4
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function withTheme() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
4
|
-
You have to import it from @mui/styles.
|
|
5
|
-
See https://mui.com/r/migration-v4/#mui-material-styles for more details.` : _formatMuiErrorMessage(16));
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(16));
|
|
6
4
|
}
|
|
@@ -838,6 +838,7 @@ function useAutocomplete(props) {
|
|
|
838
838
|
const handleInputMouseDown = event => {
|
|
839
839
|
if (!disabledProp && (inputValue === '' || !open)) {
|
|
840
840
|
handlePopupIndicator(event);
|
|
841
|
+
event.stopPropagation();
|
|
841
842
|
}
|
|
842
843
|
};
|
|
843
844
|
let dirty = freeSolo && inputValue.length > 0;
|
|
@@ -914,7 +915,8 @@ function useAutocomplete(props) {
|
|
|
914
915
|
getPopupIndicatorProps: () => ({
|
|
915
916
|
tabIndex: -1,
|
|
916
917
|
type: 'button',
|
|
917
|
-
onClick: handlePopupIndicator
|
|
918
|
+
onClick: handlePopupIndicator,
|
|
919
|
+
onMouseDown: event => event.stopPropagation()
|
|
918
920
|
}),
|
|
919
921
|
getTagProps: ({
|
|
920
922
|
index
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
theme: undefined
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Memoize style function on theme.
|
|
9
|
-
* Intended to be used in styled() calls that only need access to the theme.
|
|
10
|
-
*/
|
|
11
|
-
export default function memoTheme(styleFn) {
|
|
12
|
-
let lastValue;
|
|
13
|
-
let lastTheme;
|
|
14
|
-
return props => {
|
|
15
|
-
let value = lastValue;
|
|
16
|
-
if (value === undefined || props.theme !== lastTheme) {
|
|
17
|
-
arg.theme = props.theme;
|
|
18
|
-
value = styleFn(arg);
|
|
19
|
-
lastValue = value;
|
|
20
|
-
lastTheme = props.theme;
|
|
21
|
-
}
|
|
22
|
-
return value;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
1
|
+
import { unstable_memoTheme } from '@mui/system';
|
|
2
|
+
const memoTheme = unstable_memoTheme;
|
|
3
|
+
export default memoTheme;
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.3";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("3");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
|
@@ -722,11 +722,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
722
722
|
ref: setAnchorEl,
|
|
723
723
|
className: classes.inputRoot,
|
|
724
724
|
startAdornment,
|
|
725
|
-
|
|
726
|
-
if (event.target === event.currentTarget) {
|
|
727
|
-
handleInputMouseDown(event);
|
|
728
|
-
}
|
|
729
|
-
},
|
|
725
|
+
onMouseDown: event => handleInputMouseDown(event),
|
|
730
726
|
...((hasClearIcon || hasPopupIcon) && {
|
|
731
727
|
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompleteEndAdornment, {
|
|
732
728
|
className: classes.endAdornment,
|
package/node/Badge/Badge.js
CHANGED
|
@@ -217,16 +217,19 @@ const BadgeBadge = (0, _zeroStyled.styled)('span', {
|
|
|
217
217
|
}
|
|
218
218
|
}]
|
|
219
219
|
})));
|
|
220
|
+
function getAnchorOrigin(anchorOrigin) {
|
|
221
|
+
return {
|
|
222
|
+
vertical: anchorOrigin?.vertical ?? 'top',
|
|
223
|
+
horizontal: anchorOrigin?.horizontal ?? 'right'
|
|
224
|
+
};
|
|
225
|
+
}
|
|
220
226
|
const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
221
227
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
222
228
|
props: inProps,
|
|
223
229
|
name: 'MuiBadge'
|
|
224
230
|
});
|
|
225
231
|
const {
|
|
226
|
-
anchorOrigin: anchorOriginProp
|
|
227
|
-
vertical: 'top',
|
|
228
|
-
horizontal: 'right'
|
|
229
|
-
},
|
|
232
|
+
anchorOrigin: anchorOriginProp,
|
|
230
233
|
className,
|
|
231
234
|
classes: classesProp,
|
|
232
235
|
component,
|
|
@@ -256,7 +259,7 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
256
259
|
showZero
|
|
257
260
|
});
|
|
258
261
|
const prevProps = (0, _usePreviousProps.default)({
|
|
259
|
-
anchorOrigin: anchorOriginProp,
|
|
262
|
+
anchorOrigin: getAnchorOrigin(anchorOriginProp),
|
|
260
263
|
color: colorProp,
|
|
261
264
|
overlap: overlapProp,
|
|
262
265
|
variant: variantProp,
|
|
@@ -266,9 +269,10 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
266
269
|
const {
|
|
267
270
|
color = colorProp,
|
|
268
271
|
overlap = overlapProp,
|
|
269
|
-
anchorOrigin
|
|
272
|
+
anchorOrigin: anchorOriginPropProp,
|
|
270
273
|
variant = variantProp
|
|
271
274
|
} = invisible ? prevProps : props;
|
|
275
|
+
const anchorOrigin = getAnchorOrigin(anchorOriginPropProp);
|
|
272
276
|
const displayValue = variant !== 'dot' ? displayValueFromHook : undefined;
|
|
273
277
|
const ownerState = {
|
|
274
278
|
...props,
|
|
@@ -327,8 +331,8 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
|
|
|
327
331
|
* }
|
|
328
332
|
*/
|
|
329
333
|
anchorOrigin: _propTypes.default.shape({
|
|
330
|
-
horizontal: _propTypes.default.oneOf(['left', 'right'])
|
|
331
|
-
vertical: _propTypes.default.oneOf(['bottom', 'top'])
|
|
334
|
+
horizontal: _propTypes.default.oneOf(['left', 'right']),
|
|
335
|
+
vertical: _propTypes.default.oneOf(['bottom', 'top'])
|
|
332
336
|
}),
|
|
333
337
|
/**
|
|
334
338
|
* The content rendered within the badge.
|
package/node/Button/Button.js
CHANGED
|
@@ -154,7 +154,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
|
|
|
154
154
|
color: `var(--variant-textColor)`,
|
|
155
155
|
backgroundColor: `var(--variant-textBg)`
|
|
156
156
|
}
|
|
157
|
-
}, ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)(
|
|
157
|
+
}, ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()).map(([color]) => ({
|
|
158
158
|
props: {
|
|
159
159
|
color
|
|
160
160
|
},
|
|
@@ -178,9 +178,8 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
|
|
|
178
178
|
color: 'inherit'
|
|
179
179
|
},
|
|
180
180
|
style: {
|
|
181
|
-
'
|
|
182
|
-
|
|
183
|
-
theme.vars.palette.text.primary : theme.palette.getContrastText?.(inheritContainedBackgroundColor),
|
|
181
|
+
color: 'inherit',
|
|
182
|
+
borderColor: 'currentColor',
|
|
184
183
|
'--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
|
|
185
184
|
'@media (hover: hover)': {
|
|
186
185
|
'&:hover': {
|
|
@@ -10,7 +10,7 @@ exports.ClickAwayListener = ClickAwayListener;
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _utils = require("@mui/utils");
|
|
13
|
-
var
|
|
13
|
+
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
// TODO: return `EventHandlerName extends `on${infer EventName}` ? Lowercase<EventName> : never` once generatePropTypes runs with TS 4.1
|
|
16
16
|
function mapEventPropToEvent(eventProp) {
|
|
@@ -54,7 +54,7 @@ function ClickAwayListener(props) {
|
|
|
54
54
|
activatedRef.current = false;
|
|
55
55
|
};
|
|
56
56
|
}, []);
|
|
57
|
-
const handleRef = (0, _utils.unstable_useForkRef)((0,
|
|
57
|
+
const handleRef = (0, _utils.unstable_useForkRef)((0, _getReactElementRef.default)(children), nodeRef);
|
|
58
58
|
|
|
59
59
|
// The handler doesn't take event.defaultPrevented into account:
|
|
60
60
|
//
|
package/node/Fade/Fade.js
CHANGED
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _reactTransitionGroup = require("react-transition-group");
|
|
13
13
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
14
|
-
var
|
|
14
|
+
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
15
15
|
var _zeroStyled = require("../zero-styled");
|
|
16
16
|
var _utils = require("../transitions/utils");
|
|
17
17
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
@@ -55,7 +55,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
|
|
|
55
55
|
} = props;
|
|
56
56
|
const enableStrictModeCompat = true;
|
|
57
57
|
const nodeRef = React.useRef(null);
|
|
58
|
-
const handleRef = (0, _useForkRef.default)(nodeRef, (0,
|
|
58
|
+
const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactElementRef.default)(children), ref);
|
|
59
59
|
const normalizedTransitionCallback = callback => maybeIsAppearing => {
|
|
60
60
|
if (callback) {
|
|
61
61
|
const node = nodeRef.current;
|
package/node/Grid2/Grid2.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _Grid = require("@mui/system/Grid");
|
|
11
|
+
var _requirePropFactory = _interopRequireDefault(require("../utils/requirePropFactory"));
|
|
11
12
|
var _styles = require("../styles");
|
|
12
13
|
/**
|
|
13
14
|
*
|
|
@@ -87,24 +88,29 @@ process.env.NODE_ENV !== "production" ? Grid2.propTypes /* remove-proptypes */ =
|
|
|
87
88
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
88
89
|
/**
|
|
89
90
|
* @internal
|
|
90
|
-
* The level of the grid starts from `0`
|
|
91
|
-
*
|
|
91
|
+
* The level of the grid starts from `0` and increases when the grid nests
|
|
92
|
+
* inside another grid. Nesting is defined as a container Grid being a direct
|
|
93
|
+
* child of a container Grid.
|
|
92
94
|
*
|
|
93
95
|
* ```js
|
|
94
|
-
* <Grid> // level 0
|
|
95
|
-
* <Grid> // level 1
|
|
96
|
-
* <Grid> // level 2
|
|
97
|
-
* <Grid> // level 1
|
|
96
|
+
* <Grid container> // level 0
|
|
97
|
+
* <Grid container> // level 1
|
|
98
|
+
* <Grid container> // level 2
|
|
98
99
|
* ```
|
|
99
100
|
*
|
|
100
|
-
* Only consecutive grid is considered nesting.
|
|
101
|
-
*
|
|
101
|
+
* Only consecutive grid is considered nesting. A grid container will start at
|
|
102
|
+
* `0` if there are non-Grid container element above it.
|
|
102
103
|
*
|
|
103
104
|
* ```js
|
|
104
|
-
* <Grid> // level 0
|
|
105
|
+
* <Grid container> // level 0
|
|
105
106
|
* <div>
|
|
106
|
-
* <Grid> // level 0
|
|
107
|
-
*
|
|
107
|
+
* <Grid container> // level 0
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* ```js
|
|
111
|
+
* <Grid container> // level 0
|
|
112
|
+
* <Grid>
|
|
113
|
+
* <Grid container> // level 0
|
|
108
114
|
* ```
|
|
109
115
|
*/
|
|
110
116
|
unstable_level: _propTypes.default.number,
|
|
@@ -115,4 +121,16 @@ process.env.NODE_ENV !== "production" ? Grid2.propTypes /* remove-proptypes */ =
|
|
|
115
121
|
*/
|
|
116
122
|
wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
117
123
|
} : void 0;
|
|
124
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
125
|
+
const Component = Grid2;
|
|
126
|
+
const requireProp = (0, _requirePropFactory.default)('Grid2', Component);
|
|
127
|
+
// eslint-disable-next-line no-useless-concat
|
|
128
|
+
Component['propTypes' + ''] = {
|
|
129
|
+
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
130
|
+
...Component.propTypes,
|
|
131
|
+
direction: requireProp('container'),
|
|
132
|
+
spacing: requireProp('container'),
|
|
133
|
+
wrap: requireProp('container')
|
|
134
|
+
};
|
|
135
|
+
}
|
|
118
136
|
var _default = exports.default = Grid2;
|
package/node/Grow/Grow.js
CHANGED
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
|
|
13
13
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
14
|
-
var
|
|
14
|
+
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
15
15
|
var _reactTransitionGroup = require("react-transition-group");
|
|
16
16
|
var _zeroStyled = require("../zero-styled");
|
|
17
17
|
var _utils = require("../transitions/utils");
|
|
@@ -65,7 +65,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
|
|
|
65
65
|
const autoTimeout = React.useRef();
|
|
66
66
|
const theme = (0, _zeroStyled.useTheme)();
|
|
67
67
|
const nodeRef = React.useRef(null);
|
|
68
|
-
const handleRef = (0, _useForkRef.default)(nodeRef, (0,
|
|
68
|
+
const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactElementRef.default)(children), ref);
|
|
69
69
|
const normalizedTransitionCallback = callback => maybeIsAppearing => {
|
|
70
70
|
if (callback) {
|
|
71
71
|
const node = nodeRef.current;
|
package/node/Icon/Icon.js
CHANGED
|
@@ -44,7 +44,7 @@ const IconRoot = (0, _zeroStyled.styled)('span', {
|
|
|
44
44
|
userSelect: 'none',
|
|
45
45
|
width: '1em',
|
|
46
46
|
height: '1em',
|
|
47
|
-
// Chrome fix for https://
|
|
47
|
+
// Chrome fix for https://issues.chromium.org/issues/41375697
|
|
48
48
|
// To remove at some point.
|
|
49
49
|
overflow: 'hidden',
|
|
50
50
|
display: 'inline-block',
|
|
@@ -381,7 +381,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
381
381
|
if (!isControlled) {
|
|
382
382
|
const element = event.target || inputRef.current;
|
|
383
383
|
if (element == null) {
|
|
384
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
384
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Expected valid input target. ' + 'Did you use a custom `inputComponent` and forget to forward refs? ' + 'See https://mui.com/r/input-component-ref-interface for more info.' : (0, _formatMuiErrorMessage2.default)(1));
|
|
385
385
|
}
|
|
386
386
|
checkDirty({
|
|
387
387
|
value: element.value
|