@mui/material 6.1.1 → 6.1.2
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/Button/Button.js +3 -4
- package/CHANGELOG.md +62 -0
- package/ClickAwayListener/ClickAwayListener.js +2 -2
- package/Fade/Fade.js +2 -2
- package/Grow/Grow.js +2 -2
- package/Icon/Icon.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 +3 -5
- 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/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/Button/Button.js +3 -4
- package/modern/ClickAwayListener/ClickAwayListener.js +2 -2
- package/modern/Fade/Fade.js +2 -2
- package/modern/Grow/Grow.js +2 -2
- package/modern/Icon/Icon.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 +3 -5
- package/modern/Portal/Portal.js +2 -2
- package/modern/Rating/Rating.js +7 -2
- package/modern/Select/Select.js +2 -2
- 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/createThemeWithVars.js +2 -0
- package/modern/styles/shouldSkipGeneratingVar.js +1 -1
- package/modern/useAutocomplete/useAutocomplete.js +3 -1
- package/modern/version/index.js +2 -2
- package/node/Autocomplete/Autocomplete.js +1 -5
- package/node/Button/Button.js +3 -4
- package/node/ClickAwayListener/ClickAwayListener.js +2 -2
- package/node/Fade/Fade.js +2 -2
- package/node/Grow/Grow.js +2 -2
- package/node/Icon/Icon.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 +3 -5
- package/node/Portal/Portal.js +1 -1
- package/node/Rating/Rating.js +7 -2
- package/node/Select/Select.js +2 -2
- 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/createThemeWithVars.js +2 -0
- package/node/styles/shouldSkipGeneratingVar.js +1 -1
- package/node/useAutocomplete/useAutocomplete.js +3 -1
- package/node/version/index.js +2 -2
- package/package.json +6 -6
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/createGetSelector.d.ts +3 -8
- package/styles/createGetSelector.js +8 -7
- package/styles/createTheme.d.ts +1 -1
- package/styles/createThemeNoVars.d.ts +1 -0
- package/styles/createThemeWithVars.d.ts +8 -0
- package/styles/createThemeWithVars.js +2 -0
- package/styles/shouldSkipGeneratingVar.js +1 -1
- package/useAutocomplete/useAutocomplete.js +3 -1
- package/version/index.js +2 -2
|
@@ -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();
|
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`.
|
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
|
};
|
|
@@ -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: {
|
|
@@ -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
|
}
|
|
@@ -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
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.1.
|
|
1
|
+
export const version = "6.1.2";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("1");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("2");
|
|
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/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/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',
|
|
@@ -300,6 +300,13 @@ const LinearProgressBar2 = (0, _zeroStyled.styled)('span', {
|
|
|
300
300
|
style: {
|
|
301
301
|
backgroundColor: 'var(--LinearProgressBar2-barColor, currentColor)'
|
|
302
302
|
}
|
|
303
|
+
}, {
|
|
304
|
+
props: ({
|
|
305
|
+
ownerState
|
|
306
|
+
}) => ownerState.variant !== 'buffer' && ownerState.color === 'inherit',
|
|
307
|
+
style: {
|
|
308
|
+
backgroundColor: 'currentColor'
|
|
309
|
+
}
|
|
303
310
|
}, {
|
|
304
311
|
props: {
|
|
305
312
|
color: 'inherit'
|
|
@@ -15,6 +15,7 @@ var _List = _interopRequireDefault(require("../List"));
|
|
|
15
15
|
var _getScrollbarSize = _interopRequireDefault(require("../utils/getScrollbarSize"));
|
|
16
16
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
17
17
|
var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
|
|
18
|
+
var _utils = require("../utils");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
function nextItem(list, item, disableListWrap) {
|
|
20
21
|
if (list === item) {
|
|
@@ -118,7 +119,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
118
119
|
// of the menu.
|
|
119
120
|
const noExplicitWidth = !listRef.current.style.width;
|
|
120
121
|
if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
|
|
121
|
-
const scrollbarSize = `${(0, _getScrollbarSize.default)((0,
|
|
122
|
+
const scrollbarSize = `${(0, _getScrollbarSize.default)((0, _utils.ownerWindow)(containerElement))}px`;
|
|
122
123
|
listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
|
|
123
124
|
listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
|
|
124
125
|
}
|
package/node/Modal/Modal.js
CHANGED
|
@@ -194,12 +194,12 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
194
194
|
getSlotProps: otherHandlers => {
|
|
195
195
|
return getBackdropProps({
|
|
196
196
|
...otherHandlers,
|
|
197
|
-
onClick:
|
|
197
|
+
onClick: event => {
|
|
198
198
|
if (onBackdropClick) {
|
|
199
|
-
onBackdropClick(
|
|
199
|
+
onBackdropClick(event);
|
|
200
200
|
}
|
|
201
201
|
if (otherHandlers?.onClick) {
|
|
202
|
-
otherHandlers.onClick(
|
|
202
|
+
otherHandlers.onClick(event);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
});
|
|
@@ -14,8 +14,8 @@ function isOverflowing(container) {
|
|
|
14
14
|
}
|
|
15
15
|
return container.scrollHeight > container.clientHeight;
|
|
16
16
|
}
|
|
17
|
-
function ariaHidden(element,
|
|
18
|
-
if (
|
|
17
|
+
function ariaHidden(element, hide) {
|
|
18
|
+
if (hide) {
|
|
19
19
|
element.setAttribute('aria-hidden', 'true');
|
|
20
20
|
} else {
|
|
21
21
|
element.removeAttribute('aria-hidden');
|
|
@@ -33,13 +33,13 @@ function isAriaHiddenForbiddenOnElement(element) {
|
|
|
33
33
|
const isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
|
|
34
34
|
return isForbiddenTagName || isInputHidden;
|
|
35
35
|
}
|
|
36
|
-
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude,
|
|
36
|
+
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, hide) {
|
|
37
37
|
const blacklist = [mountElement, currentElement, ...elementsToExclude];
|
|
38
38
|
[].forEach.call(container.children, element => {
|
|
39
39
|
const isNotExcludedElement = !blacklist.includes(element);
|
|
40
40
|
const isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
41
41
|
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
42
|
-
ariaHidden(element,
|
|
42
|
+
ariaHidden(element, hide);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -60,7 +60,7 @@ function handleContainer(containerInfo, props) {
|
|
|
60
60
|
if (!props.disableScrollLock) {
|
|
61
61
|
if (isOverflowing(container)) {
|
|
62
62
|
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
|
63
|
-
const scrollbarSize = (0, _utils.unstable_getScrollbarSize)((0, _utils.
|
|
63
|
+
const scrollbarSize = (0, _utils.unstable_getScrollbarSize)((0, _utils.unstable_ownerWindow)(container));
|
|
64
64
|
restoreStyle.push({
|
|
65
65
|
value: container.style.paddingRight,
|
|
66
66
|
property: 'padding-right',
|
package/node/Modal/useModal.js
CHANGED
|
@@ -20,7 +20,7 @@ function getHasTransition(children) {
|
|
|
20
20
|
|
|
21
21
|
// A modal manager used to track and manage the state of open Modals.
|
|
22
22
|
// Modals don't open on the server so this won't conflict with concurrent requests.
|
|
23
|
-
const
|
|
23
|
+
const manager = new _ModalManager.ModalManager();
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* Demos:
|
|
@@ -36,8 +36,6 @@ function useModal(parameters) {
|
|
|
36
36
|
container,
|
|
37
37
|
disableEscapeKeyDown = false,
|
|
38
38
|
disableScrollLock = false,
|
|
39
|
-
// @ts-ignore internal logic - Base UI supports the manager as a prop too
|
|
40
|
-
manager = defaultManager,
|
|
41
39
|
closeAfterTransition = false,
|
|
42
40
|
onTransitionEnter,
|
|
43
41
|
onTransitionExited,
|
|
@@ -83,7 +81,7 @@ function useModal(parameters) {
|
|
|
83
81
|
handleMounted();
|
|
84
82
|
}
|
|
85
83
|
});
|
|
86
|
-
const isTopModal =
|
|
84
|
+
const isTopModal = () => manager.isTopModal(getModal());
|
|
87
85
|
const handlePortalRef = (0, _utils.unstable_useEventCallback)(node => {
|
|
88
86
|
mountNodeRef.current = node;
|
|
89
87
|
if (!node) {
|
|
@@ -97,7 +95,7 @@ function useModal(parameters) {
|
|
|
97
95
|
});
|
|
98
96
|
const handleClose = React.useCallback(() => {
|
|
99
97
|
manager.remove(getModal(), ariaHiddenProp);
|
|
100
|
-
}, [ariaHiddenProp
|
|
98
|
+
}, [ariaHiddenProp]);
|
|
101
99
|
React.useEffect(() => {
|
|
102
100
|
return () => {
|
|
103
101
|
handleClose();
|
package/node/Portal/Portal.js
CHANGED
|
@@ -35,7 +35,7 @@ const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef
|
|
|
35
35
|
disablePortal = false
|
|
36
36
|
} = props;
|
|
37
37
|
const [mountNode, setMountNode] = React.useState(null);
|
|
38
|
-
const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.
|
|
38
|
+
const handleRef = (0, _utils.unstable_useForkRef)(/*#__PURE__*/React.isValidElement(children) ? (0, _utils.unstable_getReactElementRef)(children) : null, forwardedRef);
|
|
39
39
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
40
40
|
if (!disablePortal) {
|
|
41
41
|
setMountNode(getContainer(container) || document.body);
|
package/node/Rating/Rating.js
CHANGED
|
@@ -233,7 +233,12 @@ function RatingItem(props) {
|
|
|
233
233
|
const isHovered = itemValue <= hover;
|
|
234
234
|
const isFocused = itemValue <= focus;
|
|
235
235
|
const isChecked = itemValue === ratingValueRounded;
|
|
236
|
-
|
|
236
|
+
|
|
237
|
+
// "name" ensures unique IDs across different Rating components in React 17,
|
|
238
|
+
// preventing one component from affecting another. React 18's useId already handles this.
|
|
239
|
+
// Update to const id = useId(); when React 17 support is dropped.
|
|
240
|
+
// More details: https://github.com/mui/material-ui/issues/40997
|
|
241
|
+
const id = `${name}-${(0, _utils.unstable_useId)()}`;
|
|
237
242
|
const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingIcon, {
|
|
238
243
|
as: IconContainerComponent,
|
|
239
244
|
value: itemValue,
|
|
@@ -626,7 +631,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
626
631
|
/**
|
|
627
632
|
* The name attribute of the radio `input` elements.
|
|
628
633
|
* This input `name` should be unique within the page.
|
|
629
|
-
* Being unique within a form is insufficient since the `name` is used to
|
|
634
|
+
* Being unique within a form is insufficient since the `name` is used to generate IDs.
|
|
630
635
|
*/
|
|
631
636
|
name: _propTypes.default.string,
|
|
632
637
|
/**
|
package/node/Select/Select.js
CHANGED
|
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
14
|
-
var
|
|
14
|
+
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
15
15
|
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
16
16
|
var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
|
|
17
17
|
var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
|
|
@@ -99,7 +99,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
99
99
|
ownerState: ownerState
|
|
100
100
|
})
|
|
101
101
|
}[variant];
|
|
102
|
-
const inputComponentRef = (0, _useForkRef.default)(ref, (0,
|
|
102
|
+
const inputComponentRef = (0, _useForkRef.default)(ref, (0, _getReactElementRef.default)(InputComponent));
|
|
103
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
104
104
|
children: /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
105
105
|
// Most of the logic is implemented in `SelectInput`.
|
package/node/Slide/Slide.js
CHANGED
|
@@ -14,7 +14,7 @@ var _reactTransitionGroup = require("react-transition-group");
|
|
|
14
14
|
var _chainPropTypes = _interopRequireDefault(require("@mui/utils/chainPropTypes"));
|
|
15
15
|
var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
|
|
16
16
|
var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
|
|
17
|
-
var
|
|
17
|
+
var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
|
|
18
18
|
var _debounce = _interopRequireDefault(require("../utils/debounce"));
|
|
19
19
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
20
20
|
var _zeroStyled = require("../zero-styled");
|
|
@@ -113,7 +113,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
|
|
|
113
113
|
...other
|
|
114
114
|
} = props;
|
|
115
115
|
const childrenRef = React.useRef(null);
|
|
116
|
-
const handleRef = (0, _useForkRef.default)((0,
|
|
116
|
+
const handleRef = (0, _useForkRef.default)((0, _getReactElementRef.default)(children), childrenRef, ref);
|
|
117
117
|
const normalizedTransitionCallback = callback => isAppearing => {
|
|
118
118
|
if (callback) {
|
|
119
119
|
// onEnterXxx and onExitXxx callbacks have a different arguments.length value.
|