@mui/material 5.2.1 → 5.2.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/CHANGELOG.md +65 -1
- package/CssBaseline/CssBaseline.d.ts +1 -1
- package/CssBaseline/CssBaseline.js +1 -1
- package/List/List.d.ts +12 -2
- package/MenuList/MenuList.d.ts +47 -36
- package/README.md +2 -0
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
- package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/Snackbar/Snackbar.d.ts +4 -4
- package/Snackbar/Snackbar.js +60 -4
- package/TextField/TextField.js +3 -2
- package/index.js +1 -1
- package/legacy/CssBaseline/CssBaseline.js +1 -1
- package/legacy/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/legacy/Snackbar/Snackbar.js +60 -4
- package/legacy/TextField/TextField.js +3 -2
- package/legacy/index.js +1 -1
- package/legacy/styles/adaptV4Theme.js +1 -1
- package/legacy/styles/responsiveFontSizes.js +1 -1
- package/modern/CssBaseline/CssBaseline.js +1 -1
- package/modern/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/modern/Snackbar/Snackbar.js +60 -4
- package/modern/TextField/TextField.js +3 -2
- package/modern/index.js +1 -1
- package/modern/styles/adaptV4Theme.js +1 -1
- package/modern/styles/responsiveFontSizes.js +1 -1
- package/node/CssBaseline/CssBaseline.js +1 -1
- package/node/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/node/Snackbar/Snackbar.js +60 -4
- package/node/TextField/TextField.js +2 -1
- package/node/index.js +1 -1
- package/node/styles/adaptV4Theme.js +1 -1
- package/node/styles/responsiveFontSizes.js +1 -1
- package/package.json +4 -4
- package/styles/adaptV4Theme.js +1 -1
- package/styles/index.d.ts +2 -1
- package/styles/responsiveFontSizes.js +1 -1
- package/umd/material-ui.development.js +74 -14
- package/umd/material-ui.production.min.js +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
### [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.2.2
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.2.1..master -->
|
|
6
|
+
|
|
7
|
+
_Nov 29, 2021_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- ♿️ Improved accessibility of `Snackbar` and `TextField` in `@mui/material` (#29782) (#29850) (#29852) @eps1lon.
|
|
12
|
+
- 🎉 Added support for `sx` syntax inside `styled()` utility (#29833) @mnajdova.
|
|
13
|
+
- 🎉 Added support for more options for `createCssVarsProvider` in `@mui/system` (#29845) (#29857) @hbjORbj.
|
|
14
|
+
- And many more 🐛 bug fixes and 📚 improvements.
|
|
15
|
+
|
|
16
|
+
### `@mui/material@5.2.2`
|
|
17
|
+
|
|
18
|
+
- ​<!-- 14 -->[MenuList] Add component prop (#29882) @Harshikerfuffle
|
|
19
|
+
- ​<!-- 13 -->[Snackbar] Interrupt auto-hide on keyboard interaction (#29852) @eps1lon
|
|
20
|
+
- ​<!-- 12 -->[Snackbar] Dismiss on Escape press (#29850) @eps1lon
|
|
21
|
+
- ​<!-- 06 -->[TextField] Associate accessible name and description by default (#29782) @eps1lon
|
|
22
|
+
|
|
23
|
+
### `@mui/joy@5.0.0-alpha.4`
|
|
24
|
+
|
|
25
|
+
- ​<!-- 15 -->[Joy] Add `Button` - 1st iteration (#29464) @siriwatknp
|
|
26
|
+
|
|
27
|
+
### `@mui/codemod@5.2.1`
|
|
28
|
+
|
|
29
|
+
- ​<!-- 28 -->[codemod] Fix alias import for box-sx-prop (#29902) @siriwatknp
|
|
30
|
+
|
|
31
|
+
### `@mui/system@5.2.2`
|
|
32
|
+
|
|
33
|
+
- ​<!-- 11 -->[system] CSSVarsProvider cleans up `html[style]` when unmounting (#29946) @eps1lon
|
|
34
|
+
- ​<!-- 10 -->[system] Add support for `disableTransitionOnChange` in `createCssVarsProvider` (#29857) @hbjORbj
|
|
35
|
+
- ​<!-- 09 -->[system] Add support for `enableColorScheme` in `createCssVarsProvider` (#29845) @hbjORbj
|
|
36
|
+
|
|
37
|
+
### `@mui/utils@5.2.2`
|
|
38
|
+
|
|
39
|
+
- ​<!-- 05 -->[useId] Trade random collisions for collisions on overflow (#29781) @eps1lon
|
|
40
|
+
- ​<!-- 04 -->[useIsFocusVisible] Convert to TypeScript (#29779) @eps1lon
|
|
41
|
+
|
|
42
|
+
### Docs
|
|
43
|
+
|
|
44
|
+
- ​<!-- 24 -->[docs] Fix v5-beta confusing example description (#29932) @oliviertassinari
|
|
45
|
+
- ​<!-- 23 -->[docs] Apply the z-index on the right DOM element (#29934) @oliviertassinari
|
|
46
|
+
- ​<!-- 22 -->[docs] Improve git diff format (#29935) @oliviertassinari
|
|
47
|
+
- ​<!-- 21 -->[docs] Fix typo (#29866) @sinclairity
|
|
48
|
+
- ​<!-- 20 -->[docs] Fix key display (#29933) @oliviertassinari
|
|
49
|
+
- ​<!-- 19 -->[docs] Fix outdated link to next/link docs (#29937) @radlinskii
|
|
50
|
+
- ​<!-- 18 -->[docs] Add how to pass `sx` prop (#29905) @siriwatknp
|
|
51
|
+
- ​<!-- 17 -->[docs] Fix typo in notifications @mbrookes
|
|
52
|
+
- ​<!-- 16 -->[docs] Black Friday sale notification @mbrookes
|
|
53
|
+
- ​<!-- 03 -->[website] Fix canonical links (#29938) @oliviertassinari
|
|
54
|
+
- ​<!-- 02 -->[website] Fix SEO issues (#29939) @oliviertassinari
|
|
55
|
+
- ​<!-- 01 -->[website] Improvements to the /x product page (#28964) @danilo-leal
|
|
56
|
+
|
|
57
|
+
### Core
|
|
58
|
+
|
|
59
|
+
- ​<!-- 27 -->[core] Remove dead code (#29940) @oliviertassinari
|
|
60
|
+
- ​<!-- 26 -->[core] Move benchmark CI job from AZP to CircleCI (#29894) @eps1lon
|
|
61
|
+
- ​<!-- 25 -->[core] Fix PR detection pattern in test_bundle_size_monitor (#29895) @eps1lon
|
|
62
|
+
- ​<!-- 08 -->[test] Fix browser tests (#29929) @eps1lon
|
|
63
|
+
- ​<!-- 07 -->[test] Reject shorthand properties in style matchers (#29893) @eps1lon
|
|
64
|
+
|
|
65
|
+
All contributors of this release in alphabetical order: @danilo-leal, @eps1lon, @Harshikerfuffle, @hbjORbj, @mbrookes, @oliviertassinari, @radlinskii, @sinclairity, @siriwatknp
|
|
66
|
+
|
|
3
67
|
## 5.2.1
|
|
4
68
|
|
|
5
69
|
<!-- generated comparing v5.2.0..master -->
|
|
@@ -2004,7 +2068,7 @@ _May 31, 2021_
|
|
|
2004
2068
|
A big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
2005
2069
|
|
|
2006
2070
|
- 👩🎤 We have completed the migration to emotion of all the components (`@material-ui/core` and `@material-ui/lab`) @siriwatknp, @mnajdova.
|
|
2007
|
-
- 📦 Save [10 kB gzipped](https://bundlephobia.com/
|
|
2071
|
+
- 📦 Save [10 kB gzipped](https://bundlephobia.com/package/@material-ui/core@5.0.0-alpha.34) by removing the dependency on `@material-ui/styles` (JSS) from the core and the lab (#26377, #26382, #26376) @mnajdova.
|
|
2008
2072
|
- ⚒️ Add many new [codemods](https://github.com/mui-org/material-ui/blob/HEAD/packages/mui-codemod/README.md) to automate the migration from v4 to v5 (#24867) @mbrookes.
|
|
2009
2073
|
- And many more 🐛 bug fixes and 📚 improvements.
|
|
2010
2074
|
|
|
@@ -7,7 +7,7 @@ export interface CssBaselineProps extends StyledComponentProps<never> {
|
|
|
7
7
|
*/
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
/**
|
|
10
|
-
* Enable `color-scheme`
|
|
10
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
11
11
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
12
12
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
13
13
|
* @default false
|
|
@@ -90,7 +90,7 @@ process.env.NODE_ENV !== "production" ? CssBaseline.propTypes
|
|
|
90
90
|
children: PropTypes.node,
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Enable `color-scheme`
|
|
93
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
94
94
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
95
95
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
96
96
|
* @default false
|
package/List/List.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { Theme } from '..';
|
|
4
|
-
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
4
|
+
import { OverridableComponent, OverridableTypeMap, OverrideProps } from '../OverridableComponent';
|
|
5
5
|
import { ListClasses } from './listClasses';
|
|
6
6
|
|
|
7
7
|
export interface ListTypeMap<P = {}, D extends React.ElementType = 'ul'> {
|
|
@@ -38,6 +38,16 @@ export interface ListTypeMap<P = {}, D extends React.ElementType = 'ul'> {
|
|
|
38
38
|
defaultComponent: D;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* utility to create component types that inherit props from List.
|
|
43
|
+
*/
|
|
44
|
+
export interface ExtendListTypeMap<M extends OverridableTypeMap> {
|
|
45
|
+
props: M['props'] & ListTypeMap['props'];
|
|
46
|
+
defaultComponent: M['defaultComponent'];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type ExtendList<M extends OverridableTypeMap> = OverridableComponent<ExtendListTypeMap<M>>;
|
|
50
|
+
|
|
41
51
|
/**
|
|
42
52
|
*
|
|
43
53
|
* Demos:
|
|
@@ -49,7 +59,7 @@ export interface ListTypeMap<P = {}, D extends React.ElementType = 'ul'> {
|
|
|
49
59
|
*
|
|
50
60
|
* - [List API](https://mui.com/api/list/)
|
|
51
61
|
*/
|
|
52
|
-
declare const List:
|
|
62
|
+
declare const List: ExtendList<ListTypeMap>;
|
|
53
63
|
|
|
54
64
|
export type ListProps<
|
|
55
65
|
D extends React.ElementType = ListTypeMap['defaultComponent'],
|
package/MenuList/MenuList.d.ts
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ExtendList, ExtendListTypeMap } from '../List';
|
|
3
|
+
import { OverrideProps } from '../OverridableComponent';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
5
|
+
export type MenuListTypeMap<P = {}, D extends React.ElementType = 'ul'> = ExtendListTypeMap<{
|
|
6
|
+
props: P & {
|
|
7
|
+
/**
|
|
8
|
+
* If `true`, will focus the `[role="menu"]` container and move into tab order.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* If `true`, will focus the first menuitem if `variant="menu"` or selected item
|
|
14
|
+
* if `variant="selectedMenu"`.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
autoFocusItem?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* MenuList contents, normally `MenuItem`s.
|
|
20
|
+
*/
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, will allow focus on disabled items.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
disabledItemsFocusable?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the menu items will not wrap focus.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disableListWrap?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The variant to use. Use `menu` to prevent selected items from impacting the initial focus
|
|
34
|
+
* and the vertical alignment relative to the anchor element.
|
|
35
|
+
* @default 'selectedMenu'
|
|
36
|
+
*/
|
|
37
|
+
variant?: 'menu' | 'selectedMenu';
|
|
38
|
+
};
|
|
39
|
+
defaultComponent: D;
|
|
40
|
+
}>;
|
|
37
41
|
|
|
38
|
-
export type MenuListClassKey = keyof NonNullable<
|
|
42
|
+
export type MenuListClassKey = keyof NonNullable<MenuListTypeMap['props']['classes']>;
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* A permanently displayed menu following https://www.w3.org/TR/wai-aria-practices/#menubutton.
|
|
@@ -52,4 +56,11 @@ export type MenuListClassKey = keyof NonNullable<MenuListProps['classes']>;
|
|
|
52
56
|
* - [MenuList API](https://mui.com/api/menu-list/)
|
|
53
57
|
* - inherits [List API](https://mui.com/api/list/)
|
|
54
58
|
*/
|
|
55
|
-
|
|
59
|
+
declare const MenuList: ExtendList<MenuListTypeMap>;
|
|
60
|
+
|
|
61
|
+
export type MenuListProps<
|
|
62
|
+
D extends React.ElementType = MenuListTypeMap['defaultComponent'],
|
|
63
|
+
P = {},
|
|
64
|
+
> = OverrideProps<MenuListTypeMap<P, D>, D>;
|
|
65
|
+
|
|
66
|
+
export default MenuList;
|
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ via [OpenCollective](https://opencollective.com/material-ui)
|
|
|
75
75
|
<a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="textemall" href="https://www.text-em-all.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img src="https://images.opencollective.com/callemall/a6946da/logo/192.png" alt="call-em-all" title="Mass Text Messaging & Automated Calling" height="96" width="96" loading="lazy"></a>
|
|
76
76
|
<a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="hoodiebees" href="https://hoodiebees.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/hoodiebees1/617b451/logo/192.png" alt="hoodiebees" loading="lazy" /></a>
|
|
77
77
|
<a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="movavi" href="https://www.movavi.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/movavi-software/a1d0167/logo/192.png" alt="Screen recorder for Mac" loading="lazy" /></a>
|
|
78
|
+
<a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="sunmatosoft" href="https://sumatosoft.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/sumatosoft_company/0b78570/avatar/192.png" alt="We help companies to digitalize their businesses" loading="lazy" /></a>
|
|
79
|
+
<a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="topaussiecasinos.com" href="https://topaussiecasinos.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/aussiecasinohex/923df37/logo/192.png" alt="Aussie Gambling Guide" loading="lazy" /></a>
|
|
78
80
|
</p>
|
|
79
81
|
|
|
80
82
|
Direct
|
|
@@ -13,7 +13,7 @@ export interface ScopedCssBaselineTypeMap<P = {}, D extends React.ElementType =
|
|
|
13
13
|
*/
|
|
14
14
|
classes?: Partial<ScopedCssBaselineClasses>;
|
|
15
15
|
/**
|
|
16
|
-
* Enable `color-scheme`
|
|
16
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
17
17
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
18
18
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
19
19
|
*/
|
|
@@ -92,7 +92,7 @@ process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes
|
|
|
92
92
|
component: PropTypes.elementType,
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* Enable `color-scheme`
|
|
95
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
96
96
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
97
97
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
98
98
|
*/
|
package/Snackbar/Snackbar.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface SnackbarOrigin {
|
|
|
12
12
|
horizontal: 'left' | 'center' | 'right';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type SnackbarCloseReason = 'timeout' | 'clickaway';
|
|
15
|
+
export type SnackbarCloseReason = 'timeout' | 'clickaway' | 'escapeKeyDown';
|
|
16
16
|
|
|
17
17
|
export interface SnackbarProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>> {
|
|
18
18
|
/**
|
|
@@ -73,10 +73,10 @@ export interface SnackbarProps extends StandardProps<React.HTMLAttributes<HTMLDi
|
|
|
73
73
|
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
|
74
74
|
* for example ignoring `clickaway`.
|
|
75
75
|
*
|
|
76
|
-
* @param {React.SyntheticEvent<any>} event The event source of the callback.
|
|
77
|
-
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`.
|
|
76
|
+
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
|
77
|
+
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
|
78
78
|
*/
|
|
79
|
-
onClose?: (event: React.SyntheticEvent<any
|
|
79
|
+
onClose?: (event: React.SyntheticEvent<any> | Event, reason: SnackbarCloseReason) => void;
|
|
80
80
|
/**
|
|
81
81
|
* If `true`, the component is shown.
|
|
82
82
|
*/
|
package/Snackbar/Snackbar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["onEnter", "onExited"],
|
|
4
|
-
_excluded2 = ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onClose", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"];
|
|
4
|
+
_excluded2 = ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
@@ -110,7 +110,9 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
110
110
|
ContentProps,
|
|
111
111
|
disableWindowBlurListener = false,
|
|
112
112
|
message,
|
|
113
|
+
onBlur,
|
|
113
114
|
onClose,
|
|
115
|
+
onFocus,
|
|
114
116
|
onMouseEnter,
|
|
115
117
|
onMouseLeave,
|
|
116
118
|
open,
|
|
@@ -180,6 +182,14 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
180
182
|
}
|
|
181
183
|
}, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
|
|
182
184
|
|
|
185
|
+
const handleFocus = event => {
|
|
186
|
+
if (onFocus) {
|
|
187
|
+
onFocus(event);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
handlePause();
|
|
191
|
+
};
|
|
192
|
+
|
|
183
193
|
const handleMouseEnter = event => {
|
|
184
194
|
if (onMouseEnter) {
|
|
185
195
|
onMouseEnter(event);
|
|
@@ -188,6 +198,14 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
188
198
|
handlePause();
|
|
189
199
|
};
|
|
190
200
|
|
|
201
|
+
const handleBlur = event => {
|
|
202
|
+
if (onBlur) {
|
|
203
|
+
onBlur(event);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
handleResume();
|
|
207
|
+
};
|
|
208
|
+
|
|
191
209
|
const handleMouseLeave = event => {
|
|
192
210
|
if (onMouseLeave) {
|
|
193
211
|
onMouseLeave(event);
|
|
@@ -230,7 +248,33 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
230
248
|
}
|
|
231
249
|
|
|
232
250
|
return undefined;
|
|
233
|
-
}, [disableWindowBlurListener, handleResume, open]);
|
|
251
|
+
}, [disableWindowBlurListener, handleResume, open]);
|
|
252
|
+
React.useEffect(() => {
|
|
253
|
+
if (!open) {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @param {KeyboardEvent} nativeEvent
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
function handleKeyDown(nativeEvent) {
|
|
262
|
+
if (!nativeEvent.defaultPrevented) {
|
|
263
|
+
// IE11, Edge (prior to using Bink?) use 'Esc'
|
|
264
|
+
if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
|
|
265
|
+
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
|
266
|
+
if (onClose) {
|
|
267
|
+
onClose(nativeEvent, 'escapeKeyDown');
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
274
|
+
return () => {
|
|
275
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
276
|
+
};
|
|
277
|
+
}, [exited, open, onClose]); // So we only render active snackbars.
|
|
234
278
|
|
|
235
279
|
if (!open && exited) {
|
|
236
280
|
return null;
|
|
@@ -241,6 +285,8 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
241
285
|
}, ClickAwayListenerProps, {
|
|
242
286
|
children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({
|
|
243
287
|
className: clsx(classes.root, className),
|
|
288
|
+
onBlur: handleBlur,
|
|
289
|
+
onFocus: handleFocus,
|
|
244
290
|
onMouseEnter: handleMouseEnter,
|
|
245
291
|
onMouseLeave: handleMouseLeave,
|
|
246
292
|
ownerState: ownerState,
|
|
@@ -339,6 +385,11 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes
|
|
|
339
385
|
*/
|
|
340
386
|
message: PropTypes.node,
|
|
341
387
|
|
|
388
|
+
/**
|
|
389
|
+
* @ignore
|
|
390
|
+
*/
|
|
391
|
+
onBlur: PropTypes.func,
|
|
392
|
+
|
|
342
393
|
/**
|
|
343
394
|
* Callback fired when the component requests to be closed.
|
|
344
395
|
* Typically `onClose` is used to set state in the parent component,
|
|
@@ -346,11 +397,16 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes
|
|
|
346
397
|
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
|
347
398
|
* for example ignoring `clickaway`.
|
|
348
399
|
*
|
|
349
|
-
* @param {React.SyntheticEvent<any>} event The event source of the callback.
|
|
350
|
-
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`.
|
|
400
|
+
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
|
401
|
+
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
|
351
402
|
*/
|
|
352
403
|
onClose: PropTypes.func,
|
|
353
404
|
|
|
405
|
+
/**
|
|
406
|
+
* @ignore
|
|
407
|
+
*/
|
|
408
|
+
onFocus: PropTypes.func,
|
|
409
|
+
|
|
354
410
|
/**
|
|
355
411
|
* @ignore
|
|
356
412
|
*/
|
package/TextField/TextField.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
8
|
-
import { refType } from '@mui/utils';
|
|
8
|
+
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
9
9
|
import styled from '../styles/styled';
|
|
10
10
|
import useThemeProps from '../styles/useThemeProps';
|
|
11
11
|
import Input from '../Input';
|
|
@@ -90,7 +90,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
90
90
|
FormHelperTextProps,
|
|
91
91
|
fullWidth = false,
|
|
92
92
|
helperText,
|
|
93
|
-
id,
|
|
93
|
+
id: idOverride,
|
|
94
94
|
InputLabelProps,
|
|
95
95
|
inputProps,
|
|
96
96
|
InputProps,
|
|
@@ -160,6 +160,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
160
160
|
InputMore['aria-describedby'] = undefined;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
const id = useId(idOverride);
|
|
163
164
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
164
165
|
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
165
166
|
const InputComponent = variantComponent[variant];
|
package/index.js
CHANGED
|
@@ -100,7 +100,7 @@ process.env.NODE_ENV !== "production" ? CssBaseline.propTypes
|
|
|
100
100
|
children: PropTypes.node,
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Enable `color-scheme`
|
|
103
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
104
104
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
105
105
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
106
106
|
* @default false
|
|
@@ -90,7 +90,7 @@ process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes
|
|
|
90
90
|
component: PropTypes.elementType,
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* Enable `color-scheme`
|
|
93
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
94
94
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
95
95
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
96
96
|
*/
|
|
@@ -103,7 +103,9 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
103
103
|
_props$disableWindowB = props.disableWindowBlurListener,
|
|
104
104
|
disableWindowBlurListener = _props$disableWindowB === void 0 ? false : _props$disableWindowB,
|
|
105
105
|
message = props.message,
|
|
106
|
+
onBlur = props.onBlur,
|
|
106
107
|
onClose = props.onClose,
|
|
108
|
+
onFocus = props.onFocus,
|
|
107
109
|
onMouseEnter = props.onMouseEnter,
|
|
108
110
|
onMouseLeave = props.onMouseLeave,
|
|
109
111
|
open = props.open,
|
|
@@ -121,7 +123,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
121
123
|
var onEnter = _props$TransitionProp.onEnter,
|
|
122
124
|
onExited = _props$TransitionProp.onExited,
|
|
123
125
|
TransitionProps = _objectWithoutProperties(_props$TransitionProp, ["onEnter", "onExited"]),
|
|
124
|
-
other = _objectWithoutProperties(props, ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onClose", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"]);
|
|
126
|
+
other = _objectWithoutProperties(props, ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"]);
|
|
125
127
|
|
|
126
128
|
var theme = useTheme();
|
|
127
129
|
var isRtl = theme.direction === 'rtl';
|
|
@@ -179,6 +181,14 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
179
181
|
}
|
|
180
182
|
}, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
|
|
181
183
|
|
|
184
|
+
var handleFocus = function handleFocus(event) {
|
|
185
|
+
if (onFocus) {
|
|
186
|
+
onFocus(event);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
handlePause();
|
|
190
|
+
};
|
|
191
|
+
|
|
182
192
|
var handleMouseEnter = function handleMouseEnter(event) {
|
|
183
193
|
if (onMouseEnter) {
|
|
184
194
|
onMouseEnter(event);
|
|
@@ -187,6 +197,14 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
187
197
|
handlePause();
|
|
188
198
|
};
|
|
189
199
|
|
|
200
|
+
var handleBlur = function handleBlur(event) {
|
|
201
|
+
if (onBlur) {
|
|
202
|
+
onBlur(event);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
handleResume();
|
|
206
|
+
};
|
|
207
|
+
|
|
190
208
|
var handleMouseLeave = function handleMouseLeave(event) {
|
|
191
209
|
if (onMouseLeave) {
|
|
192
210
|
onMouseLeave(event);
|
|
@@ -229,7 +247,33 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
229
247
|
}
|
|
230
248
|
|
|
231
249
|
return undefined;
|
|
232
|
-
}, [disableWindowBlurListener, handleResume, open]);
|
|
250
|
+
}, [disableWindowBlurListener, handleResume, open]);
|
|
251
|
+
React.useEffect(function () {
|
|
252
|
+
if (!open) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @param {KeyboardEvent} nativeEvent
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
function handleKeyDown(nativeEvent) {
|
|
261
|
+
if (!nativeEvent.defaultPrevented) {
|
|
262
|
+
// IE11, Edge (prior to using Bink?) use 'Esc'
|
|
263
|
+
if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
|
|
264
|
+
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
|
265
|
+
if (onClose) {
|
|
266
|
+
onClose(nativeEvent, 'escapeKeyDown');
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
273
|
+
return function () {
|
|
274
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
275
|
+
};
|
|
276
|
+
}, [exited, open, onClose]); // So we only render active snackbars.
|
|
233
277
|
|
|
234
278
|
if (!open && exited) {
|
|
235
279
|
return null;
|
|
@@ -240,6 +284,8 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
240
284
|
}, ClickAwayListenerProps, {
|
|
241
285
|
children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({
|
|
242
286
|
className: clsx(classes.root, className),
|
|
287
|
+
onBlur: handleBlur,
|
|
288
|
+
onFocus: handleFocus,
|
|
243
289
|
onMouseEnter: handleMouseEnter,
|
|
244
290
|
onMouseLeave: handleMouseLeave,
|
|
245
291
|
ownerState: ownerState,
|
|
@@ -340,6 +386,11 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes
|
|
|
340
386
|
*/
|
|
341
387
|
message: PropTypes.node,
|
|
342
388
|
|
|
389
|
+
/**
|
|
390
|
+
* @ignore
|
|
391
|
+
*/
|
|
392
|
+
onBlur: PropTypes.func,
|
|
393
|
+
|
|
343
394
|
/**
|
|
344
395
|
* Callback fired when the component requests to be closed.
|
|
345
396
|
* Typically `onClose` is used to set state in the parent component,
|
|
@@ -347,11 +398,16 @@ process.env.NODE_ENV !== "production" ? Snackbar.propTypes
|
|
|
347
398
|
* The `reason` parameter can optionally be used to control the response to `onClose`,
|
|
348
399
|
* for example ignoring `clickaway`.
|
|
349
400
|
*
|
|
350
|
-
* @param {React.SyntheticEvent<any>} event The event source of the callback.
|
|
351
|
-
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`.
|
|
401
|
+
* @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
|
|
402
|
+
* @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
|
|
352
403
|
*/
|
|
353
404
|
onClose: PropTypes.func,
|
|
354
405
|
|
|
406
|
+
/**
|
|
407
|
+
* @ignore
|
|
408
|
+
*/
|
|
409
|
+
onFocus: PropTypes.func,
|
|
410
|
+
|
|
355
411
|
/**
|
|
356
412
|
* @ignore
|
|
357
413
|
*/
|
|
@@ -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 { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
7
|
-
import { refType } from '@mui/utils';
|
|
7
|
+
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
8
|
import styled from '../styles/styled';
|
|
9
9
|
import useThemeProps from '../styles/useThemeProps';
|
|
10
10
|
import Input from '../Input';
|
|
@@ -93,7 +93,7 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
|
93
93
|
_props$fullWidth = props.fullWidth,
|
|
94
94
|
fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
|
|
95
95
|
helperText = props.helperText,
|
|
96
|
-
|
|
96
|
+
idOverride = props.id,
|
|
97
97
|
InputLabelProps = props.InputLabelProps,
|
|
98
98
|
inputProps = props.inputProps,
|
|
99
99
|
InputProps = props.InputProps,
|
|
@@ -166,6 +166,7 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
|
|
|
166
166
|
InputMore['aria-describedby'] = undefined;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
var id = useId(idOverride);
|
|
169
170
|
var helperTextId = helperText && id ? "".concat(id, "-helper-text") : undefined;
|
|
170
171
|
var inputLabelId = label && id ? "".concat(id, "-label") : undefined;
|
|
171
172
|
var InputComponent = variantComponent[variant];
|
package/legacy/index.js
CHANGED
|
@@ -35,7 +35,7 @@ export default function adaptV4Theme(inputTheme) {
|
|
|
35
35
|
var componentValue = theme.components[component] || {};
|
|
36
36
|
componentValue.defaultProps = props[component];
|
|
37
37
|
theme.components[component] = componentValue;
|
|
38
|
-
}); //
|
|
38
|
+
}); // CSS overrides
|
|
39
39
|
|
|
40
40
|
Object.keys(styleOverrides).forEach(function (component) {
|
|
41
41
|
var componentValue = theme.components[component] || {};
|
|
@@ -15,7 +15,7 @@ export default function responsiveFontSizes(themeInput) {
|
|
|
15
15
|
var theme = _extends({}, themeInput);
|
|
16
16
|
|
|
17
17
|
theme.typography = _extends({}, theme.typography);
|
|
18
|
-
var typography = theme.typography; // Convert between
|
|
18
|
+
var typography = theme.typography; // Convert between CSS lengths e.g. em->px or px->rem
|
|
19
19
|
// Set the baseFontSize for your project. Defaults to 16px (also the browser default).
|
|
20
20
|
|
|
21
21
|
var convert = convertLength(typography.htmlFontSize);
|
|
@@ -88,7 +88,7 @@ process.env.NODE_ENV !== "production" ? CssBaseline.propTypes
|
|
|
88
88
|
children: PropTypes.node,
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* Enable `color-scheme`
|
|
91
|
+
* Enable `color-scheme` CSS property to use `theme.palette.mode`.
|
|
92
92
|
* For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
|
|
93
93
|
* For browser support, check out https://caniuse.com/?search=color-scheme
|
|
94
94
|
* @default false
|