@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
|
@@ -113,29 +113,6 @@ process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptype
|
|
|
113
113
|
* @ignore
|
|
114
114
|
*/
|
|
115
115
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
116
|
-
/**
|
|
117
|
-
* @internal
|
|
118
|
-
* The level of the grid starts from `0`
|
|
119
|
-
* and increases when the grid nests inside another grid regardless of container or item.
|
|
120
|
-
*
|
|
121
|
-
* ```js
|
|
122
|
-
* <Grid> // level 0
|
|
123
|
-
* <Grid> // level 1
|
|
124
|
-
* <Grid> // level 2
|
|
125
|
-
* <Grid> // level 1
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* Only consecutive grid is considered nesting.
|
|
129
|
-
* A grid container will start at `0` if there are non-Grid element above it.
|
|
130
|
-
*
|
|
131
|
-
* ```js
|
|
132
|
-
* <Grid> // level 0
|
|
133
|
-
* <div>
|
|
134
|
-
* <Grid> // level 0
|
|
135
|
-
* <Grid> // level 1
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
unstable_level: PropTypes.number,
|
|
139
116
|
/**
|
|
140
117
|
* Defines the `flex-wrap` style property.
|
|
141
118
|
* It's applied for all screen sizes.
|
package/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/Rating/Rating.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export interface RatingProps
|
|
|
74
74
|
/**
|
|
75
75
|
* The name attribute of the radio `input` elements.
|
|
76
76
|
* This input `name` should be unique within the page.
|
|
77
|
-
* Being unique within a form is insufficient since the `name` is used to
|
|
77
|
+
* Being unique within a form is insufficient since the `name` is used to generate IDs.
|
|
78
78
|
*/
|
|
79
79
|
name?: string;
|
|
80
80
|
/**
|
package/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/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`.
|
package/Select/SelectInput.js
CHANGED
|
@@ -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/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.
|
|
@@ -16,7 +16,7 @@ export interface SwipeableDrawerProps extends Omit<DrawerProps, 'onClose' | 'ope
|
|
|
16
16
|
*/
|
|
17
17
|
allowSwipeInChildren?:
|
|
18
18
|
| boolean
|
|
19
|
-
| ((
|
|
19
|
+
| ((event: TouchEvent, swipeArea: HTMLDivElement, paper: HTMLDivElement) => boolean);
|
|
20
20
|
/**
|
|
21
21
|
* Disable the backdrop transition.
|
|
22
22
|
* This can improve the FPS on low-end devices.
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -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/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/index.js
CHANGED
|
@@ -710,11 +710,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
710
710
|
ref: setAnchorEl,
|
|
711
711
|
className: classes.inputRoot,
|
|
712
712
|
startAdornment,
|
|
713
|
-
|
|
714
|
-
if (event.target === event.currentTarget) {
|
|
715
|
-
handleInputMouseDown(event);
|
|
716
|
-
}
|
|
717
|
-
},
|
|
713
|
+
onMouseDown: event => handleInputMouseDown(event),
|
|
718
714
|
...((hasClearIcon || hasPopupIcon) && {
|
|
719
715
|
endAdornment: /*#__PURE__*/_jsxs(AutocompleteEndAdornment, {
|
|
720
716
|
className: classes.endAdornment,
|
package/modern/Badge/Badge.js
CHANGED
|
@@ -210,16 +210,19 @@ const BadgeBadge = styled('span', {
|
|
|
210
210
|
}
|
|
211
211
|
}]
|
|
212
212
|
})));
|
|
213
|
+
function getAnchorOrigin(anchorOrigin) {
|
|
214
|
+
return {
|
|
215
|
+
vertical: anchorOrigin?.vertical ?? 'top',
|
|
216
|
+
horizontal: anchorOrigin?.horizontal ?? 'right'
|
|
217
|
+
};
|
|
218
|
+
}
|
|
213
219
|
const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
214
220
|
const props = useDefaultProps({
|
|
215
221
|
props: inProps,
|
|
216
222
|
name: 'MuiBadge'
|
|
217
223
|
});
|
|
218
224
|
const {
|
|
219
|
-
anchorOrigin: anchorOriginProp
|
|
220
|
-
vertical: 'top',
|
|
221
|
-
horizontal: 'right'
|
|
222
|
-
},
|
|
225
|
+
anchorOrigin: anchorOriginProp,
|
|
223
226
|
className,
|
|
224
227
|
classes: classesProp,
|
|
225
228
|
component,
|
|
@@ -249,7 +252,7 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
249
252
|
showZero
|
|
250
253
|
});
|
|
251
254
|
const prevProps = usePreviousProps({
|
|
252
|
-
anchorOrigin: anchorOriginProp,
|
|
255
|
+
anchorOrigin: getAnchorOrigin(anchorOriginProp),
|
|
253
256
|
color: colorProp,
|
|
254
257
|
overlap: overlapProp,
|
|
255
258
|
variant: variantProp,
|
|
@@ -259,9 +262,10 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
259
262
|
const {
|
|
260
263
|
color = colorProp,
|
|
261
264
|
overlap = overlapProp,
|
|
262
|
-
anchorOrigin
|
|
265
|
+
anchorOrigin: anchorOriginPropProp,
|
|
263
266
|
variant = variantProp
|
|
264
267
|
} = invisible ? prevProps : props;
|
|
268
|
+
const anchorOrigin = getAnchorOrigin(anchorOriginPropProp);
|
|
265
269
|
const displayValue = variant !== 'dot' ? displayValueFromHook : undefined;
|
|
266
270
|
const ownerState = {
|
|
267
271
|
...props,
|
|
@@ -320,8 +324,8 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ =
|
|
|
320
324
|
* }
|
|
321
325
|
*/
|
|
322
326
|
anchorOrigin: PropTypes.shape({
|
|
323
|
-
horizontal: PropTypes.oneOf(['left', 'right'])
|
|
324
|
-
vertical: PropTypes.oneOf(['bottom', 'top'])
|
|
327
|
+
horizontal: PropTypes.oneOf(['left', 'right']),
|
|
328
|
+
vertical: PropTypes.oneOf(['bottom', 'top'])
|
|
325
329
|
}),
|
|
326
330
|
/**
|
|
327
331
|
* The content rendered within the badge.
|
package/modern/Button/Button.js
CHANGED
|
@@ -147,7 +147,7 @@ const ButtonRoot = styled(ButtonBase, {
|
|
|
147
147
|
color: `var(--variant-textColor)`,
|
|
148
148
|
backgroundColor: `var(--variant-textBg)`
|
|
149
149
|
}
|
|
150
|
-
}, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter(
|
|
150
|
+
}, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color]) => ({
|
|
151
151
|
props: {
|
|
152
152
|
color
|
|
153
153
|
},
|
|
@@ -171,9 +171,8 @@ const ButtonRoot = styled(ButtonBase, {
|
|
|
171
171
|
color: 'inherit'
|
|
172
172
|
},
|
|
173
173
|
style: {
|
|
174
|
-
'
|
|
175
|
-
|
|
176
|
-
theme.vars.palette.text.primary : theme.palette.getContrastText?.(inheritContainedBackgroundColor),
|
|
174
|
+
color: 'inherit',
|
|
175
|
+
borderColor: 'currentColor',
|
|
177
176
|
'--variant-containedBg': theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
|
|
178
177
|
'@media (hover: hover)': {
|
|
179
178
|
'&:hover': {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { elementAcceptingRef, exactProp, unstable_ownerDocument as ownerDocument, unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
6
|
-
import
|
|
6
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
7
7
|
|
|
8
8
|
// TODO: return `EventHandlerName extends `on${infer EventName}` ? Lowercase<EventName> : never` once generatePropTypes runs with TS 4.1
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -48,7 +48,7 @@ function ClickAwayListener(props) {
|
|
|
48
48
|
activatedRef.current = false;
|
|
49
49
|
};
|
|
50
50
|
}, []);
|
|
51
|
-
const handleRef = useForkRef(
|
|
51
|
+
const handleRef = useForkRef(getReactElementRef(children), nodeRef);
|
|
52
52
|
|
|
53
53
|
// The handler doesn't take event.defaultPrevented into account:
|
|
54
54
|
//
|
package/modern/Fade/Fade.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 Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
|
|
|
48
48
|
} = props;
|
|
49
49
|
const enableStrictModeCompat = true;
|
|
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/Grid2/Grid2.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { createGrid as createGrid2 } from '@mui/system/Grid';
|
|
5
|
+
import requirePropFactory from "../utils/requirePropFactory.js";
|
|
5
6
|
import { styled, useThemeProps } from "../styles/index.js";
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -81,24 +82,29 @@ process.env.NODE_ENV !== "production" ? Grid2.propTypes /* remove-proptypes */ =
|
|
|
81
82
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
82
83
|
/**
|
|
83
84
|
* @internal
|
|
84
|
-
* The level of the grid starts from `0`
|
|
85
|
-
*
|
|
85
|
+
* The level of the grid starts from `0` and increases when the grid nests
|
|
86
|
+
* inside another grid. Nesting is defined as a container Grid being a direct
|
|
87
|
+
* child of a container Grid.
|
|
86
88
|
*
|
|
87
89
|
* ```js
|
|
88
|
-
* <Grid> // level 0
|
|
89
|
-
* <Grid> // level 1
|
|
90
|
-
* <Grid> // level 2
|
|
91
|
-
* <Grid> // level 1
|
|
90
|
+
* <Grid container> // level 0
|
|
91
|
+
* <Grid container> // level 1
|
|
92
|
+
* <Grid container> // level 2
|
|
92
93
|
* ```
|
|
93
94
|
*
|
|
94
|
-
* Only consecutive grid is considered nesting.
|
|
95
|
-
*
|
|
95
|
+
* Only consecutive grid is considered nesting. A grid container will start at
|
|
96
|
+
* `0` if there are non-Grid container element above it.
|
|
96
97
|
*
|
|
97
98
|
* ```js
|
|
98
|
-
* <Grid> // level 0
|
|
99
|
+
* <Grid container> // level 0
|
|
99
100
|
* <div>
|
|
100
|
-
* <Grid> // level 0
|
|
101
|
-
*
|
|
101
|
+
* <Grid container> // level 0
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* ```js
|
|
105
|
+
* <Grid container> // level 0
|
|
106
|
+
* <Grid>
|
|
107
|
+
* <Grid container> // level 0
|
|
102
108
|
* ```
|
|
103
109
|
*/
|
|
104
110
|
unstable_level: PropTypes.number,
|
|
@@ -109,4 +115,16 @@ process.env.NODE_ENV !== "production" ? Grid2.propTypes /* remove-proptypes */ =
|
|
|
109
115
|
*/
|
|
110
116
|
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
111
117
|
} : void 0;
|
|
118
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
119
|
+
const Component = Grid2;
|
|
120
|
+
const requireProp = requirePropFactory('Grid2', Component);
|
|
121
|
+
// eslint-disable-next-line no-useless-concat
|
|
122
|
+
Component['propTypes' + ''] = {
|
|
123
|
+
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
124
|
+
...Component.propTypes,
|
|
125
|
+
direction: requireProp('container'),
|
|
126
|
+
spacing: requireProp('container'),
|
|
127
|
+
wrap: requireProp('container')
|
|
128
|
+
};
|
|
129
|
+
}
|
|
112
130
|
export default Grid2;
|
package/modern/Grow/Grow.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import useTimeout from '@mui/utils/useTimeout';
|
|
6
6
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
7
|
-
import
|
|
7
|
+
import getReactElementRef from '@mui/utils/getReactElementRef';
|
|
8
8
|
import { Transition } from 'react-transition-group';
|
|
9
9
|
import { useTheme } from "../zero-styled/index.js";
|
|
10
10
|
import { getTransitionProps, reflow } from "../transitions/utils.js";
|
|
@@ -58,7 +58,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
|
|
|
58
58
|
const autoTimeout = React.useRef();
|
|
59
59
|
const theme = useTheme();
|
|
60
60
|
const nodeRef = React.useRef(null);
|
|
61
|
-
const handleRef = useForkRef(nodeRef,
|
|
61
|
+
const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
|
|
62
62
|
const normalizedTransitionCallback = callback => maybeIsAppearing => {
|
|
63
63
|
if (callback) {
|
|
64
64
|
const node = nodeRef.current;
|
package/modern/Icon/Icon.js
CHANGED
|
@@ -37,7 +37,7 @@ const IconRoot = styled('span', {
|
|
|
37
37
|
userSelect: 'none',
|
|
38
38
|
width: '1em',
|
|
39
39
|
height: '1em',
|
|
40
|
-
// Chrome fix for https://
|
|
40
|
+
// Chrome fix for https://issues.chromium.org/issues/41375697
|
|
41
41
|
// To remove at some point.
|
|
42
42
|
overflow: 'hidden',
|
|
43
43
|
display: 'inline-block',
|
|
@@ -372,7 +372,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
372
372
|
if (!isControlled) {
|
|
373
373
|
const element = event.target || inputRef.current;
|
|
374
374
|
if (element == null) {
|
|
375
|
-
throw new Error(process.env.NODE_ENV !== "production" ?
|
|
375
|
+
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.' : _formatMuiErrorMessage(1));
|
|
376
376
|
}
|
|
377
377
|
checkDirty({
|
|
378
378
|
value: element.value
|
|
@@ -293,6 +293,13 @@ const LinearProgressBar2 = styled('span', {
|
|
|
293
293
|
style: {
|
|
294
294
|
backgroundColor: 'var(--LinearProgressBar2-barColor, currentColor)'
|
|
295
295
|
}
|
|
296
|
+
}, {
|
|
297
|
+
props: ({
|
|
298
|
+
ownerState
|
|
299
|
+
}) => ownerState.variant !== 'buffer' && ownerState.color === 'inherit',
|
|
300
|
+
style: {
|
|
301
|
+
backgroundColor: 'currentColor'
|
|
302
|
+
}
|
|
296
303
|
}, {
|
|
297
304
|
props: {
|
|
298
305
|
color: 'inherit'
|
|
@@ -8,6 +8,7 @@ import List from "../List/index.js";
|
|
|
8
8
|
import getScrollbarSize from "../utils/getScrollbarSize.js";
|
|
9
9
|
import useForkRef from "../utils/useForkRef.js";
|
|
10
10
|
import useEnhancedEffect from "../utils/useEnhancedEffect.js";
|
|
11
|
+
import { ownerWindow } from "../utils/index.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
function nextItem(list, item, disableListWrap) {
|
|
13
14
|
if (list === item) {
|
|
@@ -111,7 +112,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
111
112
|
// of the menu.
|
|
112
113
|
const noExplicitWidth = !listRef.current.style.width;
|
|
113
114
|
if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
|
|
114
|
-
const scrollbarSize = `${getScrollbarSize(
|
|
115
|
+
const scrollbarSize = `${getScrollbarSize(ownerWindow(containerElement))}px`;
|
|
115
116
|
listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
|
|
116
117
|
listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
|
|
117
118
|
}
|
package/modern/Modal/Modal.js
CHANGED
|
@@ -187,12 +187,12 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
187
187
|
getSlotProps: otherHandlers => {
|
|
188
188
|
return getBackdropProps({
|
|
189
189
|
...otherHandlers,
|
|
190
|
-
onClick:
|
|
190
|
+
onClick: event => {
|
|
191
191
|
if (onBackdropClick) {
|
|
192
|
-
onBackdropClick(
|
|
192
|
+
onBackdropClick(event);
|
|
193
193
|
}
|
|
194
194
|
if (otherHandlers?.onClick) {
|
|
195
|
-
otherHandlers.onClick(
|
|
195
|
+
otherHandlers.onClick(event);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
});
|
|
@@ -7,8 +7,8 @@ function isOverflowing(container) {
|
|
|
7
7
|
}
|
|
8
8
|
return container.scrollHeight > container.clientHeight;
|
|
9
9
|
}
|
|
10
|
-
export function ariaHidden(element,
|
|
11
|
-
if (
|
|
10
|
+
export function ariaHidden(element, hide) {
|
|
11
|
+
if (hide) {
|
|
12
12
|
element.setAttribute('aria-hidden', 'true');
|
|
13
13
|
} else {
|
|
14
14
|
element.removeAttribute('aria-hidden');
|
|
@@ -26,13 +26,13 @@ function isAriaHiddenForbiddenOnElement(element) {
|
|
|
26
26
|
const isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
|
|
27
27
|
return isForbiddenTagName || isInputHidden;
|
|
28
28
|
}
|
|
29
|
-
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude,
|
|
29
|
+
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, hide) {
|
|
30
30
|
const blacklist = [mountElement, currentElement, ...elementsToExclude];
|
|
31
31
|
[].forEach.call(container.children, element => {
|
|
32
32
|
const isNotExcludedElement = !blacklist.includes(element);
|
|
33
33
|
const isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
34
34
|
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
35
|
-
ariaHidden(element,
|
|
35
|
+
ariaHidden(element, hide);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -53,7 +53,7 @@ function handleContainer(containerInfo, props) {
|
|
|
53
53
|
if (!props.disableScrollLock) {
|
|
54
54
|
if (isOverflowing(container)) {
|
|
55
55
|
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
|
56
|
-
const scrollbarSize = getScrollbarSize(
|
|
56
|
+
const scrollbarSize = getScrollbarSize(ownerWindow(container));
|
|
57
57
|
restoreStyle.push({
|
|
58
58
|
value: container.style.paddingRight,
|
|
59
59
|
property: 'padding-right',
|
package/modern/Modal/useModal.js
CHANGED
|
@@ -13,7 +13,7 @@ function getHasTransition(children) {
|
|
|
13
13
|
|
|
14
14
|
// A modal manager used to track and manage the state of open Modals.
|
|
15
15
|
// Modals don't open on the server so this won't conflict with concurrent requests.
|
|
16
|
-
const
|
|
16
|
+
const manager = new ModalManager();
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
* Demos:
|
|
@@ -29,8 +29,6 @@ function useModal(parameters) {
|
|
|
29
29
|
container,
|
|
30
30
|
disableEscapeKeyDown = false,
|
|
31
31
|
disableScrollLock = false,
|
|
32
|
-
// @ts-ignore internal logic - Base UI supports the manager as a prop too
|
|
33
|
-
manager = defaultManager,
|
|
34
32
|
closeAfterTransition = false,
|
|
35
33
|
onTransitionEnter,
|
|
36
34
|
onTransitionExited,
|
|
@@ -76,7 +74,7 @@ function useModal(parameters) {
|
|
|
76
74
|
handleMounted();
|
|
77
75
|
}
|
|
78
76
|
});
|
|
79
|
-
const isTopModal =
|
|
77
|
+
const isTopModal = () => manager.isTopModal(getModal());
|
|
80
78
|
const handlePortalRef = useEventCallback(node => {
|
|
81
79
|
mountNodeRef.current = node;
|
|
82
80
|
if (!node) {
|
|
@@ -90,7 +88,7 @@ function useModal(parameters) {
|
|
|
90
88
|
});
|
|
91
89
|
const handleClose = React.useCallback(() => {
|
|
92
90
|
manager.remove(getModal(), ariaHiddenProp);
|
|
93
|
-
}, [ariaHiddenProp
|
|
91
|
+
}, [ariaHiddenProp]);
|
|
94
92
|
React.useEffect(() => {
|
|
95
93
|
return () => {
|
|
96
94
|
handleClose();
|
|
@@ -145,6 +143,12 @@ function useModal(parameters) {
|
|
|
145
143
|
...otherHandlers
|
|
146
144
|
};
|
|
147
145
|
return {
|
|
146
|
+
/*
|
|
147
|
+
* Marking an element with the role presentation indicates to assistive technology
|
|
148
|
+
* that this element should be ignored; it exists to support the web application and
|
|
149
|
+
* is not meant for humans to interact with directly.
|
|
150
|
+
* https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
|
|
151
|
+
*/
|
|
148
152
|
role: 'presentation',
|
|
149
153
|
...externalEventHandlers,
|
|
150
154
|
onKeyDown: createHandleKeyDown(externalEventHandlers),
|
|
@@ -46,6 +46,12 @@ const OutlinedInputRoot = styled(InputBaseRoot, {
|
|
|
46
46
|
[`&:hover .${outlinedInputClasses.notchedOutline}`]: {
|
|
47
47
|
borderColor: (theme.vars || theme).palette.text.primary
|
|
48
48
|
},
|
|
49
|
+
// Reset on touch devices, it doesn't add specificity
|
|
50
|
+
'@media (hover: none)': {
|
|
51
|
+
[`&:hover .${outlinedInputClasses.notchedOutline}`]: {
|
|
52
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
53
|
+
}
|
|
54
|
+
},
|
|
49
55
|
[`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]: {
|
|
50
56
|
borderWidth: 2
|
|
51
57
|
},
|
|
@@ -62,12 +68,6 @@ const OutlinedInputRoot = styled(InputBaseRoot, {
|
|
|
62
68
|
props: {},
|
|
63
69
|
// to overide the above style
|
|
64
70
|
style: {
|
|
65
|
-
// Reset on touch devices, it doesn't add specificity
|
|
66
|
-
'@media (hover: none)': {
|
|
67
|
-
[`&:hover .${outlinedInputClasses.notchedOutline}`]: {
|
|
68
|
-
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
71
|
[`&.${outlinedInputClasses.error} .${outlinedInputClasses.notchedOutline}`]: {
|
|
72
72
|
borderColor: (theme.vars || theme).palette.error.main
|
|
73
73
|
},
|
|
@@ -113,29 +113,6 @@ process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptype
|
|
|
113
113
|
* @ignore
|
|
114
114
|
*/
|
|
115
115
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
116
|
-
/**
|
|
117
|
-
* @internal
|
|
118
|
-
* The level of the grid starts from `0`
|
|
119
|
-
* and increases when the grid nests inside another grid regardless of container or item.
|
|
120
|
-
*
|
|
121
|
-
* ```js
|
|
122
|
-
* <Grid> // level 0
|
|
123
|
-
* <Grid> // level 1
|
|
124
|
-
* <Grid> // level 2
|
|
125
|
-
* <Grid> // level 1
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* Only consecutive grid is considered nesting.
|
|
129
|
-
* A grid container will start at `0` if there are non-Grid element above it.
|
|
130
|
-
*
|
|
131
|
-
* ```js
|
|
132
|
-
* <Grid> // level 0
|
|
133
|
-
* <div>
|
|
134
|
-
* <Grid> // level 0
|
|
135
|
-
* <Grid> // level 1
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
unstable_level: PropTypes.number,
|
|
139
116
|
/**
|
|
140
117
|
* Defines the `flex-wrap` style property.
|
|
141
118
|
* It's applied for all screen sizes.
|