@mui/material 5.16.0 → 5.16.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/AppBar/AppBar.js +2 -1
- package/Autocomplete/Autocomplete.d.ts +6 -7
- package/Autocomplete/Autocomplete.js +1 -1
- package/Badge/Badge.d.ts +1 -1
- package/Badge/Badge.js +2 -2
- package/Badge/useBadge.d.ts +13 -0
- package/Badge/useBadge.js +41 -0
- package/Badge/useBadge.types.d.ts +40 -0
- package/Badge/useBadge.types.js +1 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/Breadcrumbs/Breadcrumbs.js +1 -1
- package/CHANGELOG.md +53 -0
- package/ClickAwayListener/ClickAwayListener.d.ts +47 -0
- package/ClickAwayListener/ClickAwayListener.js +178 -0
- package/ClickAwayListener/index.d.ts +2 -2
- package/ClickAwayListener/index.js +1 -1
- package/InputBase/InputBase.js +2 -2
- package/ListItem/ListItem.js +1 -1
- package/Menu/Menu.js +1 -1
- package/Modal/Modal.d.ts +1 -1
- package/Modal/Modal.js +2 -2
- package/Modal/ModalManager.d.ts +25 -0
- package/Modal/ModalManager.js +213 -0
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +1 -1
- package/Modal/useModal.d.ts +13 -0
- package/Modal/useModal.js +195 -0
- package/Modal/useModal.types.d.ts +115 -0
- package/Modal/useModal.types.js +1 -0
- package/NoSsr/NoSsr.d.ts +25 -0
- package/NoSsr/NoSsr.js +73 -0
- package/NoSsr/NoSsr.types.d.ts +18 -0
- package/NoSsr/NoSsr.types.js +1 -0
- package/NoSsr/index.d.ts +3 -2
- package/NoSsr/index.js +1 -1
- package/Popover/Popover.js +2 -1
- package/Popper/BasePopper.d.ts +7 -0
- package/Popper/BasePopper.js +372 -0
- package/Popper/BasePopper.types.d.ts +130 -0
- package/Popper/BasePopper.types.js +1 -0
- package/Popper/Popper.d.ts +1 -1
- package/Popper/Popper.js +1 -1
- package/Popper/index.d.ts +2 -1
- package/Popper/index.js +2 -1
- package/Popper/popperClasses.d.ts +8 -0
- package/Popper/popperClasses.js +7 -0
- package/Portal/Portal.d.ts +16 -0
- package/Portal/Portal.js +92 -0
- package/Portal/Portal.types.d.ts +23 -0
- package/Portal/Portal.types.js +1 -0
- package/Portal/index.d.ts +3 -2
- package/Portal/index.js +1 -1
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +3 -2
- package/Slider/useSlider.d.ts +14 -0
- package/Slider/useSlider.js +655 -0
- package/Slider/useSlider.types.d.ts +228 -0
- package/Slider/useSlider.types.js +1 -0
- package/Snackbar/Snackbar.d.ts +1 -1
- package/Snackbar/Snackbar.js +4 -5
- package/Snackbar/useSnackbar.d.ts +14 -0
- package/Snackbar/useSnackbar.js +131 -0
- package/Snackbar/useSnackbar.types.d.ts +60 -0
- package/Snackbar/useSnackbar.types.js +1 -0
- package/SwipeableDrawer/SwipeableDrawer.js +1 -1
- package/TabScrollButton/TabScrollButton.d.ts +1 -1
- package/TabScrollButton/TabScrollButton.js +1 -1
- package/TablePagination/TablePagination.js +1 -1
- package/Tabs/Tabs.d.ts +1 -1
- package/Tabs/Tabs.js +1 -1
- package/TextareaAutosize/TextareaAutosize.d.ts +14 -0
- package/TextareaAutosize/TextareaAutosize.js +223 -0
- package/TextareaAutosize/TextareaAutosize.types.d.ts +13 -0
- package/TextareaAutosize/TextareaAutosize.types.js +1 -0
- package/TextareaAutosize/index.d.ts +3 -2
- package/TextareaAutosize/index.js +1 -1
- package/Tooltip/Tooltip.js +2 -3
- package/Unstable_TrapFocus/FocusTrap.d.ts +10 -0
- package/Unstable_TrapFocus/FocusTrap.js +332 -0
- package/Unstable_TrapFocus/FocusTrap.types.d.ts +51 -0
- package/Unstable_TrapFocus/FocusTrap.types.js +1 -0
- package/Unstable_TrapFocus/index.d.ts +2 -2
- package/Unstable_TrapFocus/index.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/legacy/AppBar/AppBar.js +2 -1
- package/legacy/Autocomplete/Autocomplete.js +1 -1
- package/legacy/Badge/Badge.js +2 -2
- package/legacy/Badge/useBadge.js +42 -0
- package/legacy/Badge/useBadge.types.js +1 -0
- package/legacy/Breadcrumbs/Breadcrumbs.js +1 -1
- package/legacy/ClickAwayListener/ClickAwayListener.js +181 -0
- package/legacy/ClickAwayListener/index.js +1 -1
- package/legacy/InputBase/InputBase.js +2 -2
- package/legacy/ListItem/ListItem.js +1 -1
- package/legacy/Menu/Menu.js +1 -1
- package/legacy/Modal/Modal.js +2 -2
- package/legacy/Modal/ModalManager.js +233 -0
- package/legacy/Modal/index.js +1 -1
- package/legacy/Modal/useModal.js +206 -0
- package/legacy/Modal/useModal.types.js +1 -0
- package/legacy/NoSsr/NoSsr.js +75 -0
- package/legacy/NoSsr/NoSsr.types.js +1 -0
- package/legacy/NoSsr/index.js +1 -1
- package/legacy/Popover/Popover.js +2 -1
- package/legacy/Popper/BasePopper.js +380 -0
- package/legacy/Popper/BasePopper.types.js +1 -0
- package/legacy/Popper/Popper.js +1 -1
- package/legacy/Popper/index.js +2 -1
- package/legacy/Popper/popperClasses.js +7 -0
- package/legacy/Portal/Portal.js +92 -0
- package/legacy/Portal/Portal.types.js +1 -0
- package/legacy/Portal/index.js +1 -1
- package/legacy/Slider/Slider.js +3 -2
- package/legacy/Slider/useSlider.js +701 -0
- package/legacy/Slider/useSlider.types.js +1 -0
- package/legacy/Snackbar/Snackbar.js +4 -5
- package/legacy/Snackbar/useSnackbar.js +141 -0
- package/legacy/Snackbar/useSnackbar.types.js +1 -0
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +1 -1
- package/legacy/TabScrollButton/TabScrollButton.js +1 -1
- package/legacy/TablePagination/TablePagination.js +1 -1
- package/legacy/Tabs/Tabs.js +1 -1
- package/legacy/TextareaAutosize/TextareaAutosize.js +220 -0
- package/legacy/TextareaAutosize/TextareaAutosize.types.js +1 -0
- package/legacy/TextareaAutosize/index.js +1 -1
- package/legacy/Tooltip/Tooltip.js +2 -3
- package/legacy/Unstable_TrapFocus/FocusTrap.js +341 -0
- package/legacy/Unstable_TrapFocus/FocusTrap.types.js +1 -0
- package/legacy/Unstable_TrapFocus/index.js +1 -1
- package/legacy/index.js +2 -2
- package/legacy/useAutocomplete/useAutocomplete.js +1078 -2
- package/legacy/utils/PolymorphicComponent.js +1 -0
- package/legacy/utils/areArraysEqual.js +9 -0
- package/legacy/utils/index.js +1 -1
- package/legacy/utils/shouldSpreadAdditionalProps.js +1 -1
- package/legacy/utils/useSlot.js +3 -1
- package/modern/AppBar/AppBar.js +2 -1
- package/modern/Autocomplete/Autocomplete.js +1 -1
- package/modern/Badge/Badge.js +2 -2
- package/modern/Badge/useBadge.js +41 -0
- package/modern/Badge/useBadge.types.js +1 -0
- package/modern/Breadcrumbs/Breadcrumbs.js +1 -1
- package/modern/ClickAwayListener/ClickAwayListener.js +178 -0
- package/modern/ClickAwayListener/index.js +1 -1
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/ListItem/ListItem.js +1 -1
- package/modern/Menu/Menu.js +1 -1
- package/modern/Modal/Modal.js +2 -2
- package/modern/Modal/ModalManager.js +213 -0
- package/modern/Modal/index.js +1 -1
- package/modern/Modal/useModal.js +193 -0
- package/modern/Modal/useModal.types.js +1 -0
- package/modern/NoSsr/NoSsr.js +73 -0
- package/modern/NoSsr/NoSsr.types.js +1 -0
- package/modern/NoSsr/index.js +1 -1
- package/modern/Popover/Popover.js +2 -1
- package/modern/Popper/BasePopper.js +371 -0
- package/modern/Popper/BasePopper.types.js +1 -0
- package/modern/Popper/Popper.js +1 -1
- package/modern/Popper/index.js +2 -1
- package/modern/Popper/popperClasses.js +7 -0
- package/modern/Portal/Portal.js +92 -0
- package/modern/Portal/Portal.types.js +1 -0
- package/modern/Portal/index.js +1 -1
- package/modern/Slider/Slider.js +3 -2
- package/modern/Slider/useSlider.js +643 -0
- package/modern/Slider/useSlider.types.js +1 -0
- package/modern/Snackbar/Snackbar.js +4 -5
- package/modern/Snackbar/useSnackbar.js +131 -0
- package/modern/Snackbar/useSnackbar.types.js +1 -0
- package/modern/SwipeableDrawer/SwipeableDrawer.js +1 -1
- package/modern/TabScrollButton/TabScrollButton.js +1 -1
- package/modern/TablePagination/TablePagination.js +1 -1
- package/modern/Tabs/Tabs.js +1 -1
- package/modern/TextareaAutosize/TextareaAutosize.js +223 -0
- package/modern/TextareaAutosize/TextareaAutosize.types.js +1 -0
- package/modern/TextareaAutosize/index.js +1 -1
- package/modern/Tooltip/Tooltip.js +2 -3
- package/modern/Unstable_TrapFocus/FocusTrap.js +331 -0
- package/modern/Unstable_TrapFocus/FocusTrap.types.js +1 -0
- package/modern/Unstable_TrapFocus/index.js +1 -1
- package/modern/index.js +2 -2
- package/modern/useAutocomplete/useAutocomplete.js +987 -2
- package/modern/utils/PolymorphicComponent.js +1 -0
- package/modern/utils/areArraysEqual.js +4 -0
- package/modern/utils/index.js +1 -1
- package/modern/utils/shouldSpreadAdditionalProps.js +1 -1
- package/modern/utils/useSlot.js +3 -1
- package/node/AppBar/AppBar.js +2 -1
- package/node/Autocomplete/Autocomplete.js +3 -3
- package/node/Badge/Badge.js +5 -5
- package/node/Badge/useBadge.js +46 -0
- package/node/Badge/useBadge.types.js +5 -0
- package/node/Breadcrumbs/Breadcrumbs.js +2 -2
- package/node/ClickAwayListener/ClickAwayListener.js +184 -0
- package/node/ClickAwayListener/index.js +1 -1
- package/node/InputBase/InputBase.js +7 -7
- package/node/ListItem/ListItem.js +3 -3
- package/node/Menu/Menu.js +3 -3
- package/node/Modal/Modal.js +5 -5
- package/node/Modal/ModalManager.js +221 -0
- package/node/Modal/index.js +2 -2
- package/node/Modal/useModal.js +203 -0
- package/node/Modal/useModal.types.js +5 -0
- package/node/NoSsr/NoSsr.js +81 -0
- package/node/NoSsr/NoSsr.types.js +5 -0
- package/node/NoSsr/index.js +3 -2
- package/node/Popover/Popover.js +5 -4
- package/node/Popper/BasePopper.js +380 -0
- package/node/Popper/BasePopper.types.js +5 -0
- package/node/Popper/Popper.js +2 -2
- package/node/Popper/index.js +14 -1
- package/node/Popper/popperClasses.js +15 -0
- package/node/Portal/Portal.js +100 -0
- package/node/Portal/Portal.types.js +5 -0
- package/node/Portal/index.js +3 -2
- package/node/Slider/Slider.js +14 -13
- package/node/Slider/useSlider.js +666 -0
- package/node/Slider/useSlider.types.js +5 -0
- package/node/Snackbar/Snackbar.js +9 -10
- package/node/Snackbar/useSnackbar.js +139 -0
- package/node/Snackbar/useSnackbar.types.js +5 -0
- package/node/SwipeableDrawer/SwipeableDrawer.js +2 -2
- package/node/TabScrollButton/TabScrollButton.js +3 -3
- package/node/TablePagination/TablePagination.js +2 -2
- package/node/Tabs/Tabs.js +3 -3
- package/node/TextareaAutosize/TextareaAutosize.js +230 -0
- package/node/TextareaAutosize/TextareaAutosize.types.js +5 -0
- package/node/TextareaAutosize/index.js +3 -2
- package/node/Tooltip/Tooltip.js +10 -11
- package/node/Unstable_TrapFocus/FocusTrap.js +339 -0
- package/node/Unstable_TrapFocus/FocusTrap.types.js +5 -0
- package/node/Unstable_TrapFocus/index.js +3 -2
- package/node/index.js +3 -3
- package/node/useAutocomplete/useAutocomplete.js +997 -18
- package/node/utils/PolymorphicComponent.js +5 -0
- package/node/utils/areArraysEqual.js +10 -0
- package/node/utils/index.js +2 -2
- package/node/utils/shouldSpreadAdditionalProps.js +3 -2
- package/node/utils/useSlot.js +6 -4
- package/package.json +6 -7
- package/styles/overrides.d.ts +1 -1
- package/umd/material-ui.development.js +9211 -9249
- package/umd/material-ui.production.min.js +3 -3
- package/useAutocomplete/useAutocomplete.d.ts +460 -2
- package/useAutocomplete/useAutocomplete.js +994 -2
- package/utils/PolymorphicComponent.d.ts +17 -0
- package/utils/PolymorphicComponent.js +1 -0
- package/utils/areArraysEqual.d.ts +3 -0
- package/utils/areArraysEqual.js +4 -0
- package/utils/index.d.ts +2 -1
- package/utils/index.js +1 -1
- package/utils/shouldSpreadAdditionalProps.js +1 -1
- package/utils/types.d.ts +2 -1
- package/utils/useSlot.js +3 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/material v5.16.
|
|
2
|
+
* @mui/material v5.16.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -281,7 +281,7 @@ export * from './Zoom';
|
|
|
281
281
|
export { default as useAutocomplete } from './useAutocomplete';
|
|
282
282
|
export { default as GlobalStyles } from './GlobalStyles';
|
|
283
283
|
export * from './GlobalStyles';
|
|
284
|
-
export { unstable_composeClasses } from '@mui/
|
|
284
|
+
export { unstable_composeClasses } from '@mui/utils';
|
|
285
285
|
export { default as generateUtilityClass } from './generateUtilityClass';
|
|
286
286
|
export * from './generateUtilityClass';
|
|
287
287
|
export { default as generateUtilityClasses } from './generateUtilityClasses';
|
package/legacy/AppBar/AppBar.js
CHANGED
|
@@ -94,8 +94,9 @@ var AppBarRoot = styled(Paper, {
|
|
|
94
94
|
}, ownerState.color && !ownerState.color.match(/^(default|inherit|transparent)$/) && {
|
|
95
95
|
'--AppBar-background': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].main : joinVars(theme.vars.palette.AppBar.darkBg, theme.vars.palette[ownerState.color].main),
|
|
96
96
|
'--AppBar-color': ownerState.enableColorOnDark ? theme.vars.palette[ownerState.color].contrastText : joinVars(theme.vars.palette.AppBar.darkColor, theme.vars.palette[ownerState.color].contrastText)
|
|
97
|
+
}, !['inherit', 'transparent'].includes(ownerState.color) && {
|
|
98
|
+
backgroundColor: 'var(--AppBar-background)'
|
|
97
99
|
}, {
|
|
98
|
-
backgroundColor: 'var(--AppBar-background)',
|
|
99
100
|
color: ownerState.color === 'inherit' ? 'inherit' : 'var(--AppBar-color)'
|
|
100
101
|
}, ownerState.color === 'transparent' && {
|
|
101
102
|
backgroundImage: 'none',
|
|
@@ -9,9 +9,9 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import integerPropType from '@mui/utils/integerPropType';
|
|
11
11
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
12
|
-
import { useAutocomplete, createFilterOptions } from '@mui/base';
|
|
13
12
|
import composeClasses from '@mui/utils/composeClasses';
|
|
14
13
|
import { alpha } from '@mui/system/colorManipulator';
|
|
14
|
+
import useAutocomplete, { createFilterOptions } from '../useAutocomplete';
|
|
15
15
|
import Popper from '../Popper';
|
|
16
16
|
import ListSubheader from '../ListSubheader';
|
|
17
17
|
import Paper from '../Paper';
|
package/legacy/Badge/Badge.js
CHANGED
|
@@ -9,8 +9,8 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import usePreviousProps from '@mui/utils/usePreviousProps';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
13
|
+
import useBadge from './useBadge';
|
|
14
14
|
import { styled } from '../zero-styled';
|
|
15
15
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
16
16
|
import capitalize from '../utils/capitalize';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { usePreviousProps } from '@mui/utils';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Demos:
|
|
7
|
+
*
|
|
8
|
+
* - [Badge](https://next.mui.com/base-ui/react-badge/#hook)
|
|
9
|
+
*
|
|
10
|
+
* API:
|
|
11
|
+
*
|
|
12
|
+
* - [useBadge API](https://next.mui.com/base-ui/react-badge/hooks-api/#use-badge)
|
|
13
|
+
*/
|
|
14
|
+
function useBadge(parameters) {
|
|
15
|
+
var badgeContentProp = parameters.badgeContent,
|
|
16
|
+
_parameters$invisible = parameters.invisible,
|
|
17
|
+
invisibleProp = _parameters$invisible === void 0 ? false : _parameters$invisible,
|
|
18
|
+
_parameters$max = parameters.max,
|
|
19
|
+
maxProp = _parameters$max === void 0 ? 99 : _parameters$max,
|
|
20
|
+
_parameters$showZero = parameters.showZero,
|
|
21
|
+
showZero = _parameters$showZero === void 0 ? false : _parameters$showZero;
|
|
22
|
+
var prevProps = usePreviousProps({
|
|
23
|
+
badgeContent: badgeContentProp,
|
|
24
|
+
max: maxProp
|
|
25
|
+
});
|
|
26
|
+
var invisible = invisibleProp;
|
|
27
|
+
if (invisibleProp === false && badgeContentProp === 0 && !showZero) {
|
|
28
|
+
invisible = true;
|
|
29
|
+
}
|
|
30
|
+
var _ref = invisible ? prevProps : parameters,
|
|
31
|
+
badgeContent = _ref.badgeContent,
|
|
32
|
+
_ref$max = _ref.max,
|
|
33
|
+
max = _ref$max === void 0 ? maxProp : _ref$max;
|
|
34
|
+
var displayValue = badgeContent && Number(badgeContent) > max ? "".concat(max, "+") : badgeContent;
|
|
35
|
+
return {
|
|
36
|
+
badgeContent: badgeContent,
|
|
37
|
+
invisible: invisible,
|
|
38
|
+
max: max,
|
|
39
|
+
displayValue: displayValue
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export default useBadge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,8 +9,8 @@ import { isFragment } from 'react-is';
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import integerPropType from '@mui/utils/integerPropType';
|
|
12
|
-
import { useSlotProps } from '@mui/base/utils';
|
|
13
12
|
import composeClasses from '@mui/utils/composeClasses';
|
|
13
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
14
14
|
import styled from '../styles/styled';
|
|
15
15
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
16
16
|
import Typography from '../Typography';
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { elementAcceptingRef, exactProp, unstable_ownerDocument as ownerDocument, unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
6
|
+
|
|
7
|
+
// TODO: return `EventHandlerName extends `on${infer EventName}` ? Lowercase<EventName> : never` once generatePropTypes runs with TS 4.1
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
function mapEventPropToEvent(eventProp) {
|
|
10
|
+
return eventProp.substring(2).toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
function clickedRootScrollbar(event, doc) {
|
|
13
|
+
return doc.documentElement.clientWidth < event.clientX || doc.documentElement.clientHeight < event.clientY;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Listen for click events that occur somewhere in the document, outside of the element itself.
|
|
17
|
+
* For instance, if you need to hide a menu when people click anywhere else on your page.
|
|
18
|
+
*
|
|
19
|
+
* Demos:
|
|
20
|
+
*
|
|
21
|
+
* - [Click-Away Listener](https://mui.com/material-ui/react-click-away-listener/)
|
|
22
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [ClickAwayListener API](https://mui.com/material-ui/api/click-away-listener/)
|
|
27
|
+
*/
|
|
28
|
+
function ClickAwayListener(props) {
|
|
29
|
+
var children = props.children,
|
|
30
|
+
_props$disableReactTr = props.disableReactTree,
|
|
31
|
+
disableReactTree = _props$disableReactTr === void 0 ? false : _props$disableReactTr,
|
|
32
|
+
_props$mouseEvent = props.mouseEvent,
|
|
33
|
+
mouseEvent = _props$mouseEvent === void 0 ? 'onClick' : _props$mouseEvent,
|
|
34
|
+
onClickAway = props.onClickAway,
|
|
35
|
+
_props$touchEvent = props.touchEvent,
|
|
36
|
+
touchEvent = _props$touchEvent === void 0 ? 'onTouchEnd' : _props$touchEvent;
|
|
37
|
+
var movedRef = React.useRef(false);
|
|
38
|
+
var nodeRef = React.useRef(null);
|
|
39
|
+
var activatedRef = React.useRef(false);
|
|
40
|
+
var syntheticEventRef = React.useRef(false);
|
|
41
|
+
React.useEffect(function () {
|
|
42
|
+
// Ensure that this component is not "activated" synchronously.
|
|
43
|
+
// https://github.com/facebook/react/issues/20074
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
activatedRef.current = true;
|
|
46
|
+
}, 0);
|
|
47
|
+
return function () {
|
|
48
|
+
activatedRef.current = false;
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
var handleRef = useForkRef(
|
|
52
|
+
// @ts-expect-error TODO upstream fix
|
|
53
|
+
children.ref, nodeRef);
|
|
54
|
+
|
|
55
|
+
// The handler doesn't take event.defaultPrevented into account:
|
|
56
|
+
//
|
|
57
|
+
// event.preventDefault() is meant to stop default behaviors like
|
|
58
|
+
// clicking a checkbox to check it, hitting a button to submit a form,
|
|
59
|
+
// and hitting left arrow to move the cursor in a text input etc.
|
|
60
|
+
// Only special HTML elements have these default behaviors.
|
|
61
|
+
var handleClickAway = useEventCallback(function (event) {
|
|
62
|
+
// Given developers can stop the propagation of the synthetic event,
|
|
63
|
+
// we can only be confident with a positive value.
|
|
64
|
+
var insideReactTree = syntheticEventRef.current;
|
|
65
|
+
syntheticEventRef.current = false;
|
|
66
|
+
var doc = ownerDocument(nodeRef.current);
|
|
67
|
+
|
|
68
|
+
// 1. IE11 support, which trigger the handleClickAway even after the unbind
|
|
69
|
+
// 2. The child might render null.
|
|
70
|
+
// 3. Behave like a blur listener.
|
|
71
|
+
if (!activatedRef.current || !nodeRef.current || 'clientX' in event && clickedRootScrollbar(event, doc)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Do not act if user performed touchmove
|
|
76
|
+
if (movedRef.current) {
|
|
77
|
+
movedRef.current = false;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
var insideDOM;
|
|
81
|
+
|
|
82
|
+
// If not enough, can use https://github.com/DieterHolvoet/event-propagation-path/blob/master/propagationPath.js
|
|
83
|
+
if (event.composedPath) {
|
|
84
|
+
insideDOM = event.composedPath().indexOf(nodeRef.current) > -1;
|
|
85
|
+
} else {
|
|
86
|
+
insideDOM = !doc.documentElement.contains(
|
|
87
|
+
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
88
|
+
event.target) || nodeRef.current.contains(
|
|
89
|
+
// @ts-expect-error returns `false` as intended when not dispatched from a Node
|
|
90
|
+
event.target);
|
|
91
|
+
}
|
|
92
|
+
if (!insideDOM && (disableReactTree || !insideReactTree)) {
|
|
93
|
+
onClickAway(event);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Keep track of mouse/touch events that bubbled up through the portal.
|
|
98
|
+
var createHandleSynthetic = function createHandleSynthetic(handlerName) {
|
|
99
|
+
return function (event) {
|
|
100
|
+
syntheticEventRef.current = true;
|
|
101
|
+
var childrenPropsHandler = children.props[handlerName];
|
|
102
|
+
if (childrenPropsHandler) {
|
|
103
|
+
childrenPropsHandler(event);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
var childrenProps = {
|
|
108
|
+
ref: handleRef
|
|
109
|
+
};
|
|
110
|
+
if (touchEvent !== false) {
|
|
111
|
+
childrenProps[touchEvent] = createHandleSynthetic(touchEvent);
|
|
112
|
+
}
|
|
113
|
+
React.useEffect(function () {
|
|
114
|
+
if (touchEvent !== false) {
|
|
115
|
+
var mappedTouchEvent = mapEventPropToEvent(touchEvent);
|
|
116
|
+
var doc = ownerDocument(nodeRef.current);
|
|
117
|
+
var handleTouchMove = function handleTouchMove() {
|
|
118
|
+
movedRef.current = true;
|
|
119
|
+
};
|
|
120
|
+
doc.addEventListener(mappedTouchEvent, handleClickAway);
|
|
121
|
+
doc.addEventListener('touchmove', handleTouchMove);
|
|
122
|
+
return function () {
|
|
123
|
+
doc.removeEventListener(mappedTouchEvent, handleClickAway);
|
|
124
|
+
doc.removeEventListener('touchmove', handleTouchMove);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}, [handleClickAway, touchEvent]);
|
|
129
|
+
if (mouseEvent !== false) {
|
|
130
|
+
childrenProps[mouseEvent] = createHandleSynthetic(mouseEvent);
|
|
131
|
+
}
|
|
132
|
+
React.useEffect(function () {
|
|
133
|
+
if (mouseEvent !== false) {
|
|
134
|
+
var mappedMouseEvent = mapEventPropToEvent(mouseEvent);
|
|
135
|
+
var doc = ownerDocument(nodeRef.current);
|
|
136
|
+
doc.addEventListener(mappedMouseEvent, handleClickAway);
|
|
137
|
+
return function () {
|
|
138
|
+
doc.removeEventListener(mappedMouseEvent, handleClickAway);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return undefined;
|
|
142
|
+
}, [handleClickAway, mouseEvent]);
|
|
143
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
144
|
+
children: /*#__PURE__*/React.cloneElement(children, childrenProps)
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
process.env.NODE_ENV !== "production" ? ClickAwayListener.propTypes /* remove-proptypes */ = {
|
|
148
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
149
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
150
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
151
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
152
|
+
/**
|
|
153
|
+
* The wrapped element.
|
|
154
|
+
*/
|
|
155
|
+
children: elementAcceptingRef.isRequired,
|
|
156
|
+
/**
|
|
157
|
+
* If `true`, the React tree is ignored and only the DOM tree is considered.
|
|
158
|
+
* This prop changes how portaled elements are handled.
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
161
|
+
disableReactTree: PropTypes.bool,
|
|
162
|
+
/**
|
|
163
|
+
* The mouse event to listen to. You can disable the listener by providing `false`.
|
|
164
|
+
* @default 'onClick'
|
|
165
|
+
*/
|
|
166
|
+
mouseEvent: PropTypes.oneOf(['onClick', 'onMouseDown', 'onMouseUp', 'onPointerDown', 'onPointerUp', false]),
|
|
167
|
+
/**
|
|
168
|
+
* Callback fired when a "click away" event is detected.
|
|
169
|
+
*/
|
|
170
|
+
onClickAway: PropTypes.func.isRequired,
|
|
171
|
+
/**
|
|
172
|
+
* The touch event to listen to. You can disable the listener by providing `false`.
|
|
173
|
+
* @default 'onTouchEnd'
|
|
174
|
+
*/
|
|
175
|
+
touchEvent: PropTypes.oneOf(['onTouchEnd', 'onTouchStart', false])
|
|
176
|
+
} : void 0;
|
|
177
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
178
|
+
// eslint-disable-next-line
|
|
179
|
+
ClickAwayListener['propTypes' + ''] = exactProp(ClickAwayListener.propTypes);
|
|
180
|
+
}
|
|
181
|
+
export { ClickAwayListener };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ClickAwayListener as default } from '
|
|
1
|
+
export { ClickAwayListener as default } from './ClickAwayListener';
|
|
@@ -9,9 +9,9 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
11
11
|
import refType from '@mui/utils/refType';
|
|
12
|
-
import { TextareaAutosize } from '@mui/base';
|
|
13
|
-
import { isHostComponent } from '@mui/base/utils';
|
|
14
12
|
import composeClasses from '@mui/utils/composeClasses';
|
|
13
|
+
import isHostComponent from '@mui/utils/isHostComponent';
|
|
14
|
+
import TextareaAutosize from '../TextareaAutosize';
|
|
15
15
|
import formControlState from '../FormControl/formControlState';
|
|
16
16
|
import FormControlContext from '../FormControl/FormControlContext';
|
|
17
17
|
import useFormControl from '../FormControl/useFormControl';
|
|
@@ -6,11 +6,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import { isHostComponent } from '@mui/base/utils';
|
|
10
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
10
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
12
11
|
import chainPropTypes from '@mui/utils/chainPropTypes';
|
|
13
12
|
import { alpha } from '@mui/system/colorManipulator';
|
|
13
|
+
import isHostComponent from '@mui/utils/isHostComponent';
|
|
14
14
|
import styled from '../styles/styled';
|
|
15
15
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
16
16
|
import ButtonBase from '../ButtonBase';
|
package/legacy/Menu/Menu.js
CHANGED
|
@@ -7,9 +7,9 @@ import { isFragment } from 'react-is';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import { useSlotProps } from '@mui/base/utils';
|
|
11
10
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
12
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
13
13
|
import MenuList from '../MenuList';
|
|
14
14
|
import Popover, { PopoverPaper } from '../Popover';
|
|
15
15
|
import styled, { rootShouldForwardProp } from '../styles/styled';
|
package/legacy/Modal/Modal.js
CHANGED
|
@@ -7,14 +7,14 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
9
9
|
import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
|
|
10
|
-
import { useSlotProps } from '@mui/base/utils';
|
|
11
|
-
import { unstable_useModal as useModal } from '@mui/base/unstable_useModal';
|
|
12
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
13
12
|
import FocusTrap from '../Unstable_TrapFocus';
|
|
14
13
|
import Portal from '../Portal';
|
|
15
14
|
import styled from '../styles/styled';
|
|
16
15
|
import { useDefaultProps } from '../DefaultPropsProvider';
|
|
17
16
|
import Backdrop from '../Backdrop';
|
|
17
|
+
import useModal from './useModal';
|
|
18
18
|
import { getModalUtilityClass } from './modalClasses';
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import { unstable_ownerWindow as ownerWindow, unstable_ownerDocument as ownerDocument, unstable_getScrollbarSize as getScrollbarSize } from '@mui/utils';
|
|
5
|
+
// Is a vertical scrollbar displayed?
|
|
6
|
+
function isOverflowing(container) {
|
|
7
|
+
var doc = ownerDocument(container);
|
|
8
|
+
if (doc.body === container) {
|
|
9
|
+
return ownerWindow(container).innerWidth > doc.documentElement.clientWidth;
|
|
10
|
+
}
|
|
11
|
+
return container.scrollHeight > container.clientHeight;
|
|
12
|
+
}
|
|
13
|
+
export function ariaHidden(element, show) {
|
|
14
|
+
if (show) {
|
|
15
|
+
element.setAttribute('aria-hidden', 'true');
|
|
16
|
+
} else {
|
|
17
|
+
element.removeAttribute('aria-hidden');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getPaddingRight(element) {
|
|
21
|
+
return parseInt(ownerWindow(element).getComputedStyle(element).paddingRight, 10) || 0;
|
|
22
|
+
}
|
|
23
|
+
function isAriaHiddenForbiddenOnElement(element) {
|
|
24
|
+
// The forbidden HTML tags are the ones from ARIA specification that
|
|
25
|
+
// can be children of body and can't have aria-hidden attribute.
|
|
26
|
+
// cf. https://www.w3.org/TR/html-aria/#docconformance
|
|
27
|
+
var forbiddenTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE', 'LINK', 'MAP', 'META', 'NOSCRIPT', 'PICTURE', 'COL', 'COLGROUP', 'PARAM', 'SLOT', 'SOURCE', 'TRACK'];
|
|
28
|
+
var isForbiddenTagName = forbiddenTagNames.indexOf(element.tagName) !== -1;
|
|
29
|
+
var isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
|
|
30
|
+
return isForbiddenTagName || isInputHidden;
|
|
31
|
+
}
|
|
32
|
+
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, show) {
|
|
33
|
+
var blacklist = [mountElement, currentElement].concat(_toConsumableArray(elementsToExclude));
|
|
34
|
+
[].forEach.call(container.children, function (element) {
|
|
35
|
+
var isNotExcludedElement = blacklist.indexOf(element) === -1;
|
|
36
|
+
var isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
37
|
+
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
38
|
+
ariaHidden(element, show);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function findIndexOf(items, callback) {
|
|
43
|
+
var idx = -1;
|
|
44
|
+
items.some(function (item, index) {
|
|
45
|
+
if (callback(item)) {
|
|
46
|
+
idx = index;
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
});
|
|
51
|
+
return idx;
|
|
52
|
+
}
|
|
53
|
+
function handleContainer(containerInfo, props) {
|
|
54
|
+
var restoreStyle = [];
|
|
55
|
+
var container = containerInfo.container;
|
|
56
|
+
if (!props.disableScrollLock) {
|
|
57
|
+
if (isOverflowing(container)) {
|
|
58
|
+
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
|
59
|
+
var scrollbarSize = getScrollbarSize(ownerDocument(container));
|
|
60
|
+
restoreStyle.push({
|
|
61
|
+
value: container.style.paddingRight,
|
|
62
|
+
property: 'padding-right',
|
|
63
|
+
el: container
|
|
64
|
+
});
|
|
65
|
+
// Use computed style, here to get the real padding to add our scrollbar width.
|
|
66
|
+
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
67
|
+
|
|
68
|
+
// .mui-fixed is a global helper.
|
|
69
|
+
var fixedElements = ownerDocument(container).querySelectorAll('.mui-fixed');
|
|
70
|
+
[].forEach.call(fixedElements, function (element) {
|
|
71
|
+
restoreStyle.push({
|
|
72
|
+
value: element.style.paddingRight,
|
|
73
|
+
property: 'padding-right',
|
|
74
|
+
el: element
|
|
75
|
+
});
|
|
76
|
+
element.style.paddingRight = "".concat(getPaddingRight(element) + scrollbarSize, "px");
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
var scrollContainer;
|
|
80
|
+
if (container.parentNode instanceof DocumentFragment) {
|
|
81
|
+
scrollContainer = ownerDocument(container).body;
|
|
82
|
+
} else {
|
|
83
|
+
// Support html overflow-y: auto for scroll stability between pages
|
|
84
|
+
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
|
85
|
+
var parent = container.parentElement;
|
|
86
|
+
var containerWindow = ownerWindow(container);
|
|
87
|
+
scrollContainer = (parent == null ? void 0 : parent.nodeName) === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Block the scroll even if no scrollbar is visible to account for mobile keyboard
|
|
91
|
+
// screensize shrink.
|
|
92
|
+
restoreStyle.push({
|
|
93
|
+
value: scrollContainer.style.overflow,
|
|
94
|
+
property: 'overflow',
|
|
95
|
+
el: scrollContainer
|
|
96
|
+
}, {
|
|
97
|
+
value: scrollContainer.style.overflowX,
|
|
98
|
+
property: 'overflow-x',
|
|
99
|
+
el: scrollContainer
|
|
100
|
+
}, {
|
|
101
|
+
value: scrollContainer.style.overflowY,
|
|
102
|
+
property: 'overflow-y',
|
|
103
|
+
el: scrollContainer
|
|
104
|
+
});
|
|
105
|
+
scrollContainer.style.overflow = 'hidden';
|
|
106
|
+
}
|
|
107
|
+
var restore = function restore() {
|
|
108
|
+
restoreStyle.forEach(function (_ref) {
|
|
109
|
+
var value = _ref.value,
|
|
110
|
+
el = _ref.el,
|
|
111
|
+
property = _ref.property;
|
|
112
|
+
if (value) {
|
|
113
|
+
el.style.setProperty(property, value);
|
|
114
|
+
} else {
|
|
115
|
+
el.style.removeProperty(property);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return restore;
|
|
120
|
+
}
|
|
121
|
+
function getHiddenSiblings(container) {
|
|
122
|
+
var hiddenSiblings = [];
|
|
123
|
+
[].forEach.call(container.children, function (element) {
|
|
124
|
+
if (element.getAttribute('aria-hidden') === 'true') {
|
|
125
|
+
hiddenSiblings.push(element);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return hiddenSiblings;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @ignore - do not document.
|
|
132
|
+
*
|
|
133
|
+
* Proper state management for containers and the modals in those containers.
|
|
134
|
+
* Simplified, but inspired by react-overlay's ModalManager class.
|
|
135
|
+
* Used by the Modal to ensure proper styling of containers.
|
|
136
|
+
*/
|
|
137
|
+
export var ModalManager = /*#__PURE__*/function () {
|
|
138
|
+
function ModalManager() {
|
|
139
|
+
_classCallCheck(this, ModalManager);
|
|
140
|
+
this.containers = void 0;
|
|
141
|
+
this.modals = void 0;
|
|
142
|
+
this.modals = [];
|
|
143
|
+
this.containers = [];
|
|
144
|
+
}
|
|
145
|
+
_createClass(ModalManager, [{
|
|
146
|
+
key: "add",
|
|
147
|
+
value: function add(modal, container) {
|
|
148
|
+
var modalIndex = this.modals.indexOf(modal);
|
|
149
|
+
if (modalIndex !== -1) {
|
|
150
|
+
return modalIndex;
|
|
151
|
+
}
|
|
152
|
+
modalIndex = this.modals.length;
|
|
153
|
+
this.modals.push(modal);
|
|
154
|
+
|
|
155
|
+
// If the modal we are adding is already in the DOM.
|
|
156
|
+
if (modal.modalRef) {
|
|
157
|
+
ariaHidden(modal.modalRef, false);
|
|
158
|
+
}
|
|
159
|
+
var hiddenSiblings = getHiddenSiblings(container);
|
|
160
|
+
ariaHiddenSiblings(container, modal.mount, modal.modalRef, hiddenSiblings, true);
|
|
161
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
162
|
+
return item.container === container;
|
|
163
|
+
});
|
|
164
|
+
if (containerIndex !== -1) {
|
|
165
|
+
this.containers[containerIndex].modals.push(modal);
|
|
166
|
+
return modalIndex;
|
|
167
|
+
}
|
|
168
|
+
this.containers.push({
|
|
169
|
+
modals: [modal],
|
|
170
|
+
container: container,
|
|
171
|
+
restore: null,
|
|
172
|
+
hiddenSiblings: hiddenSiblings
|
|
173
|
+
});
|
|
174
|
+
return modalIndex;
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "mount",
|
|
178
|
+
value: function mount(modal, props) {
|
|
179
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
180
|
+
return item.modals.indexOf(modal) !== -1;
|
|
181
|
+
});
|
|
182
|
+
var containerInfo = this.containers[containerIndex];
|
|
183
|
+
if (!containerInfo.restore) {
|
|
184
|
+
containerInfo.restore = handleContainer(containerInfo, props);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
key: "remove",
|
|
189
|
+
value: function remove(modal) {
|
|
190
|
+
var ariaHiddenState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
191
|
+
var modalIndex = this.modals.indexOf(modal);
|
|
192
|
+
if (modalIndex === -1) {
|
|
193
|
+
return modalIndex;
|
|
194
|
+
}
|
|
195
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
196
|
+
return item.modals.indexOf(modal) !== -1;
|
|
197
|
+
});
|
|
198
|
+
var containerInfo = this.containers[containerIndex];
|
|
199
|
+
containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
|
|
200
|
+
this.modals.splice(modalIndex, 1);
|
|
201
|
+
|
|
202
|
+
// If that was the last modal in a container, clean up the container.
|
|
203
|
+
if (containerInfo.modals.length === 0) {
|
|
204
|
+
// The modal might be closed before it had the chance to be mounted in the DOM.
|
|
205
|
+
if (containerInfo.restore) {
|
|
206
|
+
containerInfo.restore();
|
|
207
|
+
}
|
|
208
|
+
if (modal.modalRef) {
|
|
209
|
+
// In case the modal wasn't in the DOM yet.
|
|
210
|
+
ariaHidden(modal.modalRef, ariaHiddenState);
|
|
211
|
+
}
|
|
212
|
+
ariaHiddenSiblings(containerInfo.container, modal.mount, modal.modalRef, containerInfo.hiddenSiblings, false);
|
|
213
|
+
this.containers.splice(containerIndex, 1);
|
|
214
|
+
} else {
|
|
215
|
+
// Otherwise make sure the next top modal is visible to a screen reader.
|
|
216
|
+
var nextTop = containerInfo.modals[containerInfo.modals.length - 1];
|
|
217
|
+
// as soon as a modal is adding its modalRef is undefined. it can't set
|
|
218
|
+
// aria-hidden because the dom element doesn't exist either
|
|
219
|
+
// when modal was unmounted before modalRef gets null
|
|
220
|
+
if (nextTop.modalRef) {
|
|
221
|
+
ariaHidden(nextTop.modalRef, false);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return modalIndex;
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "isTopModal",
|
|
228
|
+
value: function isTopModal(modal) {
|
|
229
|
+
return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
|
|
230
|
+
}
|
|
231
|
+
}]);
|
|
232
|
+
return ModalManager;
|
|
233
|
+
}();
|
package/legacy/Modal/index.js
CHANGED