@mui/material 5.11.9 → 5.11.11
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.d.ts +3 -1
- package/Avatar/Avatar.js +1 -0
- package/Backdrop/Backdrop.d.ts +8 -0
- package/Backdrop/Backdrop.js +10 -5
- package/Badge/Badge.d.ts +0 -1
- package/Badge/Badge.js +47 -47
- package/CHANGELOG.md +135 -1
- package/Container/Container.js +0 -1
- package/Dialog/DialogContext.d.ts +2 -2
- package/Dialog/DialogContext.js +2 -2
- package/InputBase/InputBase.js +2 -2
- package/InputLabel/InputLabel.js +3 -1
- package/ListSubheader/ListSubheader.js +1 -0
- package/MenuList/MenuList.js +7 -0
- package/Modal/Modal.d.ts +9 -1
- package/Modal/Modal.js +14 -9
- package/OutlinedInput/OutlinedInput.js +1 -1
- package/README.md +0 -2
- package/Rating/Rating.js +2 -2
- package/Select/SelectInput.js +2 -22
- package/Slider/Slider.d.ts +5 -1
- package/Slider/Slider.js +16 -11
- package/Snackbar/Snackbar.js +21 -125
- package/Stack/Stack.d.ts +0 -1
- package/Stack/Stack.js +9 -120
- package/Stack/index.d.ts +3 -0
- package/Stack/index.js +2 -1
- package/Stack/stackClasses.d.ts +6 -0
- package/Stack/stackClasses.js +7 -0
- package/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/Unstable_Grid2/Grid2.js +2 -3
- package/index.js +1 -1
- package/internal/SwitchBase.js +1 -1
- package/legacy/Avatar/Avatar.js +1 -0
- package/legacy/Backdrop/Backdrop.js +9 -3
- package/legacy/Badge/Badge.js +48 -48
- package/legacy/Container/Container.js +0 -1
- package/legacy/Dialog/DialogContext.js +2 -2
- package/legacy/InputBase/InputBase.js +2 -2
- package/legacy/InputLabel/InputLabel.js +3 -1
- package/legacy/ListSubheader/ListSubheader.js +1 -0
- package/legacy/MenuList/MenuList.js +7 -0
- package/legacy/Modal/Modal.js +14 -9
- package/legacy/OutlinedInput/OutlinedInput.js +1 -1
- package/legacy/Rating/Rating.js +2 -2
- package/legacy/Select/SelectInput.js +2 -22
- package/legacy/Slider/Slider.js +16 -12
- package/legacy/Snackbar/Snackbar.js +20 -119
- package/legacy/Stack/Stack.js +13 -122
- package/legacy/Stack/index.js +2 -1
- package/legacy/Stack/stackClasses.js +7 -0
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/legacy/Unstable_Grid2/Grid2.js +2 -3
- package/legacy/index.js +1 -1
- package/legacy/internal/SwitchBase.js +1 -1
- package/legacy/styles/createTheme.js +1 -0
- package/legacy/useAutocomplete/useAutocomplete.js +2 -2
- package/legacy/useMediaQuery/useMediaQuery.js +12 -7
- package/modern/Avatar/Avatar.js +1 -0
- package/modern/Backdrop/Backdrop.js +10 -5
- package/modern/Badge/Badge.js +47 -47
- package/modern/Container/Container.js +0 -1
- package/modern/Dialog/DialogContext.js +2 -2
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/InputLabel/InputLabel.js +3 -1
- package/modern/ListSubheader/ListSubheader.js +1 -0
- package/modern/MenuList/MenuList.js +7 -0
- package/modern/Modal/Modal.js +14 -9
- package/modern/OutlinedInput/OutlinedInput.js +1 -1
- package/modern/Rating/Rating.js +2 -2
- package/modern/Select/SelectInput.js +2 -18
- package/modern/Slider/Slider.js +16 -11
- package/modern/Snackbar/Snackbar.js +21 -125
- package/modern/Stack/Stack.js +9 -120
- package/modern/Stack/index.js +2 -1
- package/modern/Stack/stackClasses.js +7 -0
- package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/modern/Unstable_Grid2/Grid2.js +2 -3
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +1 -1
- package/modern/styles/createTheme.js +1 -0
- package/modern/useAutocomplete/useAutocomplete.js +2 -2
- package/modern/useMediaQuery/useMediaQuery.js +9 -7
- package/node/Avatar/Avatar.js +1 -0
- package/node/Backdrop/Backdrop.js +10 -5
- package/node/Badge/Badge.js +46 -47
- package/node/Container/Container.js +0 -2
- package/node/Dialog/DialogContext.js +4 -2
- package/node/InputBase/InputBase.js +2 -2
- package/node/InputLabel/InputLabel.js +3 -1
- package/node/ListSubheader/ListSubheader.js +1 -0
- package/node/MenuList/MenuList.js +7 -0
- package/node/Modal/Modal.js +14 -9
- package/node/OutlinedInput/OutlinedInput.js +1 -1
- package/node/Rating/Rating.js +2 -2
- package/node/Select/SelectInput.js +2 -22
- package/node/Slider/Slider.js +19 -14
- package/node/Snackbar/Snackbar.js +20 -124
- package/node/Stack/Stack.js +9 -122
- package/node/Stack/index.js +8 -1
- package/node/Stack/stackClasses.js +16 -0
- package/node/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/node/Unstable_Grid2/Grid2.js +0 -1
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +1 -1
- package/node/styles/createTheme.js +1 -0
- package/node/useAutocomplete/useAutocomplete.js +8 -6
- package/node/useMediaQuery/useMediaQuery.js +9 -7
- package/package.json +6 -6
- package/styles/createTheme.js +1 -0
- package/styles/props.d.ts +2 -2
- package/umd/material-ui.development.js +4209 -4241
- package/umd/material-ui.production.min.js +21 -21
- package/useAutocomplete/useAutocomplete.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +2 -2
- package/useMediaQuery/useMediaQuery.d.ts +19 -4
- package/useMediaQuery/useMediaQuery.js +9 -7
package/legacy/Stack/Stack.js
CHANGED
|
@@ -1,130 +1,21 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
import * as React from 'react';
|
|
6
1
|
import PropTypes from 'prop-types';
|
|
7
|
-
import {
|
|
8
|
-
import { deepmerge } from '@mui/utils';
|
|
2
|
+
import { createStack } from '@mui/system';
|
|
9
3
|
import styled from '../styles/styled';
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* [1,0,2,0,3]
|
|
18
|
-
*/
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
function joinChildren(children, separator) {
|
|
21
|
-
var childrenArray = React.Children.toArray(children).filter(Boolean);
|
|
22
|
-
return childrenArray.reduce(function (output, child, index) {
|
|
23
|
-
output.push(child);
|
|
24
|
-
if (index < childrenArray.length - 1) {
|
|
25
|
-
output.push( /*#__PURE__*/React.cloneElement(separator, {
|
|
26
|
-
key: "separator-".concat(index)
|
|
27
|
-
}));
|
|
4
|
+
import _useThemeProps from '../styles/useThemeProps';
|
|
5
|
+
var Stack = createStack({
|
|
6
|
+
createStyledComponent: styled('div', {
|
|
7
|
+
name: 'MuiStack',
|
|
8
|
+
slot: 'Root',
|
|
9
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
10
|
+
return styles.root;
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
row: 'Left',
|
|
35
|
-
'row-reverse': 'Right',
|
|
36
|
-
column: 'Top',
|
|
37
|
-
'column-reverse': 'Bottom'
|
|
38
|
-
}[direction];
|
|
39
|
-
};
|
|
40
|
-
export var style = function style(_ref) {
|
|
41
|
-
var ownerState = _ref.ownerState,
|
|
42
|
-
theme = _ref.theme;
|
|
43
|
-
var styles = _extends({
|
|
44
|
-
display: 'flex',
|
|
45
|
-
flexDirection: 'column'
|
|
46
|
-
}, handleBreakpoints({
|
|
47
|
-
theme: theme
|
|
48
|
-
}, resolveBreakpointValues({
|
|
49
|
-
values: ownerState.direction,
|
|
50
|
-
breakpoints: theme.breakpoints.values
|
|
51
|
-
}), function (propValue) {
|
|
52
|
-
return {
|
|
53
|
-
flexDirection: propValue
|
|
54
|
-
};
|
|
55
|
-
}));
|
|
56
|
-
if (ownerState.spacing) {
|
|
57
|
-
var transformer = createUnarySpacing(theme);
|
|
58
|
-
var base = Object.keys(theme.breakpoints.values).reduce(function (acc, breakpoint) {
|
|
59
|
-
if (_typeof(ownerState.spacing) === 'object' && ownerState.spacing[breakpoint] != null || _typeof(ownerState.direction) === 'object' && ownerState.direction[breakpoint] != null) {
|
|
60
|
-
acc[breakpoint] = true;
|
|
61
|
-
}
|
|
62
|
-
return acc;
|
|
63
|
-
}, {});
|
|
64
|
-
var directionValues = resolveBreakpointValues({
|
|
65
|
-
values: ownerState.direction,
|
|
66
|
-
base: base
|
|
12
|
+
}),
|
|
13
|
+
useThemeProps: function useThemeProps(inProps) {
|
|
14
|
+
return _useThemeProps({
|
|
15
|
+
props: inProps,
|
|
16
|
+
name: 'MuiStack'
|
|
67
17
|
});
|
|
68
|
-
var spacingValues = resolveBreakpointValues({
|
|
69
|
-
values: ownerState.spacing,
|
|
70
|
-
base: base
|
|
71
|
-
});
|
|
72
|
-
if (_typeof(directionValues) === 'object') {
|
|
73
|
-
Object.keys(directionValues).forEach(function (breakpoint, index, breakpoints) {
|
|
74
|
-
var directionValue = directionValues[breakpoint];
|
|
75
|
-
if (!directionValue) {
|
|
76
|
-
var previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
|
|
77
|
-
directionValues[breakpoint] = previousDirectionValue;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
var styleFromPropValue = function styleFromPropValue(propValue, breakpoint) {
|
|
82
|
-
return {
|
|
83
|
-
'& > :not(style) + :not(style)': _defineProperty({
|
|
84
|
-
margin: 0
|
|
85
|
-
}, "margin".concat(getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)), getValue(transformer, propValue))
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
styles = deepmerge(styles, handleBreakpoints({
|
|
89
|
-
theme: theme
|
|
90
|
-
}, spacingValues, styleFromPropValue));
|
|
91
|
-
}
|
|
92
|
-
styles = mergeBreakpointsInOrder(theme.breakpoints, styles);
|
|
93
|
-
return styles;
|
|
94
|
-
};
|
|
95
|
-
var StackRoot = styled('div', {
|
|
96
|
-
name: 'MuiStack',
|
|
97
|
-
slot: 'Root',
|
|
98
|
-
overridesResolver: function overridesResolver(props, styles) {
|
|
99
|
-
return [styles.root];
|
|
100
18
|
}
|
|
101
|
-
})(style);
|
|
102
|
-
var Stack = /*#__PURE__*/React.forwardRef(function Stack(inProps, ref) {
|
|
103
|
-
var themeProps = useThemeProps({
|
|
104
|
-
props: inProps,
|
|
105
|
-
name: 'MuiStack'
|
|
106
|
-
});
|
|
107
|
-
var props = extendSxProp(themeProps);
|
|
108
|
-
var _props$component = props.component,
|
|
109
|
-
component = _props$component === void 0 ? 'div' : _props$component,
|
|
110
|
-
_props$direction = props.direction,
|
|
111
|
-
direction = _props$direction === void 0 ? 'column' : _props$direction,
|
|
112
|
-
_props$spacing = props.spacing,
|
|
113
|
-
spacing = _props$spacing === void 0 ? 0 : _props$spacing,
|
|
114
|
-
divider = props.divider,
|
|
115
|
-
children = props.children,
|
|
116
|
-
other = _objectWithoutProperties(props, ["component", "direction", "spacing", "divider", "children"]);
|
|
117
|
-
var ownerState = {
|
|
118
|
-
direction: direction,
|
|
119
|
-
spacing: spacing
|
|
120
|
-
};
|
|
121
|
-
return /*#__PURE__*/_jsx(StackRoot, _extends({
|
|
122
|
-
as: component,
|
|
123
|
-
ownerState: ownerState,
|
|
124
|
-
ref: ref
|
|
125
|
-
}, other, {
|
|
126
|
-
children: divider ? joinChildren(children, divider) : children
|
|
127
|
-
}));
|
|
128
19
|
});
|
|
129
20
|
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
|
130
21
|
// ----------------------------- Warning --------------------------------
|
package/legacy/Stack/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from './Stack';
|
|
1
|
+
export { default } from './Stack';
|
|
2
|
+
export { default as stackClasses } from './stackClasses';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
import generateUtilityClass from '../generateUtilityClass';
|
|
3
|
+
export function getStackUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiStack', slot);
|
|
5
|
+
}
|
|
6
|
+
var stackClasses = generateUtilityClasses('MuiStack', ['root']);
|
|
7
|
+
export default stackClasses;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { elementTypeAcceptingRef } from '@mui/utils';
|
|
7
7
|
import { useThemeProps } from '@mui/system';
|
|
@@ -217,7 +217,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
217
217
|
}
|
|
218
218
|
claimedSwipeInstance = null;
|
|
219
219
|
touchDetected.current = false;
|
|
220
|
-
flushSync(function () {
|
|
220
|
+
ReactDOM.flushSync(function () {
|
|
221
221
|
setMaybeSwiping(false);
|
|
222
222
|
});
|
|
223
223
|
|
|
@@ -270,7 +270,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
270
270
|
// this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
|
|
271
271
|
// so do this change on first touchmove instead of touchstart
|
|
272
272
|
if (force || !(disableDiscovery && allowSwipeInChildren)) {
|
|
273
|
-
flushSync(function () {
|
|
273
|
+
ReactDOM.flushSync(function () {
|
|
274
274
|
setMaybeSwiping(true);
|
|
275
275
|
});
|
|
276
276
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { createGrid } from '@mui/system/Unstable_Grid';
|
|
2
|
+
import { createGrid as createGrid2 } from '@mui/system/Unstable_Grid';
|
|
3
3
|
import { styled, useThemeProps as _useThemeProps } from '../styles';
|
|
4
|
-
var Grid2 =
|
|
4
|
+
var Grid2 = createGrid2({
|
|
5
5
|
createStyledComponent: styled('div', {
|
|
6
6
|
name: 'MuiGrid2',
|
|
7
7
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -9,7 +9,6 @@ var Grid2 = createGrid({
|
|
|
9
9
|
}
|
|
10
10
|
}),
|
|
11
11
|
componentName: 'MuiGrid2',
|
|
12
|
-
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
13
12
|
useThemeProps: function useThemeProps(inProps) {
|
|
14
13
|
return _useThemeProps({
|
|
15
14
|
props: inProps,
|
package/legacy/index.js
CHANGED
|
@@ -149,7 +149,7 @@ var SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref) {
|
|
|
149
149
|
defaultChecked: defaultChecked,
|
|
150
150
|
className: classes.input,
|
|
151
151
|
disabled: disabled,
|
|
152
|
-
id: hasLabelFor
|
|
152
|
+
id: hasLabelFor ? id : undefined,
|
|
153
153
|
name: name,
|
|
154
154
|
onChange: handleInputChange,
|
|
155
155
|
readOnly: readOnly,
|
|
@@ -47,6 +47,7 @@ function createTheme() {
|
|
|
47
47
|
return deepmerge(acc, argument);
|
|
48
48
|
}, muiTheme);
|
|
49
49
|
if (process.env.NODE_ENV !== 'production') {
|
|
50
|
+
// TODO v6: Refactor to use globalStateClassesMapping from @mui/utils once `readOnly` state class is used in Rating component.
|
|
50
51
|
var stateClasses = ['active', 'checked', 'completed', 'disabled', 'error', 'expanded', 'focused', 'focusVisible', 'required', 'selected'];
|
|
51
52
|
var traverse = function traverse(node, component) {
|
|
52
53
|
var key;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export * from '@mui/base/
|
|
1
|
+
export { default } from '@mui/base/useAutocomplete';
|
|
2
|
+
export * from '@mui/base/useAutocomplete';
|
|
@@ -8,9 +8,8 @@ import useEnhancedEffect from '../utils/useEnhancedEffect';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
11
|
-
var supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
12
11
|
var _React$useState = React.useState(function () {
|
|
13
|
-
if (noSsr &&
|
|
12
|
+
if (noSsr && matchMedia) {
|
|
14
13
|
return matchMedia(query).matches;
|
|
15
14
|
}
|
|
16
15
|
if (ssrMatchMedia) {
|
|
@@ -25,7 +24,7 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
25
24
|
setMatch = _React$useState[1];
|
|
26
25
|
useEnhancedEffect(function () {
|
|
27
26
|
var active = true;
|
|
28
|
-
if (!
|
|
27
|
+
if (!matchMedia) {
|
|
29
28
|
return undefined;
|
|
30
29
|
}
|
|
31
30
|
var queryList = matchMedia(query);
|
|
@@ -44,17 +43,22 @@ function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSs
|
|
|
44
43
|
active = false;
|
|
45
44
|
queryList.removeListener(updateMatch);
|
|
46
45
|
};
|
|
47
|
-
}, [query, matchMedia
|
|
46
|
+
}, [query, matchMedia]);
|
|
48
47
|
return match;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
52
51
|
var maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
|
53
|
-
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
|
|
52
|
+
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
54
53
|
var getDefaultSnapshot = React.useCallback(function () {
|
|
55
54
|
return defaultMatches;
|
|
56
55
|
}, [defaultMatches]);
|
|
57
56
|
var getServerSnapshot = React.useMemo(function () {
|
|
57
|
+
if (noSsr && matchMedia) {
|
|
58
|
+
return function () {
|
|
59
|
+
return matchMedia(query).matches;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
58
62
|
if (ssrMatchMedia !== null) {
|
|
59
63
|
var _ssrMatchMedia = ssrMatchMedia(query),
|
|
60
64
|
matches = _ssrMatchMedia.matches;
|
|
@@ -63,7 +67,7 @@ function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia) {
|
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
69
|
return getDefaultSnapshot;
|
|
66
|
-
}, [getDefaultSnapshot, query, ssrMatchMedia]);
|
|
70
|
+
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
|
67
71
|
var _React$useMemo = React.useMemo(function () {
|
|
68
72
|
if (matchMedia === null) {
|
|
69
73
|
return [getDefaultSnapshot, function () {
|
|
@@ -106,7 +110,8 @@ export default function useMediaQuery(queryInput) {
|
|
|
106
110
|
matchMedia = _getThemeProps$matchM === void 0 ? supportMatchMedia ? window.matchMedia : null : _getThemeProps$matchM,
|
|
107
111
|
_getThemeProps$ssrMat = _getThemeProps.ssrMatchMedia,
|
|
108
112
|
ssrMatchMedia = _getThemeProps$ssrMat === void 0 ? null : _getThemeProps$ssrMat,
|
|
109
|
-
noSsr = _getThemeProps.noSsr
|
|
113
|
+
_getThemeProps$noSsr = _getThemeProps.noSsr,
|
|
114
|
+
noSsr = _getThemeProps$noSsr === void 0 ? false : _getThemeProps$noSsr;
|
|
110
115
|
if (process.env.NODE_ENV !== 'production') {
|
|
111
116
|
if (typeof queryInput === 'function' && theme === null) {
|
|
112
117
|
console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
package/modern/Avatar/Avatar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["children", "
|
|
3
|
+
const _excluded = ["children", "className", "component", "components", "componentsProps", "invisible", "open", "slotProps", "slots", "TransitionComponent", "transitionDuration"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -52,17 +52,16 @@ const Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(inProps, ref) {
|
|
|
52
52
|
});
|
|
53
53
|
const {
|
|
54
54
|
children,
|
|
55
|
+
className,
|
|
55
56
|
component = 'div',
|
|
56
57
|
components = {},
|
|
57
58
|
componentsProps = {},
|
|
58
|
-
className,
|
|
59
59
|
invisible = false,
|
|
60
60
|
open,
|
|
61
61
|
slotProps = {},
|
|
62
62
|
slots = {},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
TransitionComponent = Fade
|
|
63
|
+
TransitionComponent = Fade,
|
|
64
|
+
transitionDuration
|
|
66
65
|
} = props,
|
|
67
66
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
68
67
|
const ownerState = _extends({}, props, {
|
|
@@ -167,6 +166,12 @@ process.env.NODE_ENV !== "production" ? Backdrop.propTypes /* remove-proptypes *
|
|
|
167
166
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
168
167
|
*/
|
|
169
168
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
169
|
+
/**
|
|
170
|
+
* The component used for the transition.
|
|
171
|
+
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
172
|
+
* @default Fade
|
|
173
|
+
*/
|
|
174
|
+
TransitionComponent: PropTypes.elementType,
|
|
170
175
|
/**
|
|
171
176
|
* The duration for the transition, in milliseconds.
|
|
172
177
|
* You may specify a single timeout for all transitions, or individually with an object.
|
package/modern/Badge/Badge.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["anchorOrigin", "className", "component", "components", "componentsProps", "overlap", "color", "invisible", "max", "badgeContent", "slots", "slotProps", "showZero", "variant"];
|
|
3
|
+
const _excluded = ["anchorOrigin", "className", "classes", "component", "components", "componentsProps", "children", "overlap", "color", "invisible", "max", "badgeContent", "slots", "slotProps", "showZero", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { usePreviousProps } from '@mui/utils';
|
|
8
8
|
import composeClasses from '@mui/base/composeClasses';
|
|
9
|
-
import
|
|
9
|
+
import useBadge from '@mui/base/useBadge';
|
|
10
|
+
import { useSlotProps } from '@mui/base';
|
|
10
11
|
import styled from '../styles/styled';
|
|
11
12
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
|
-
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
13
13
|
import capitalize from '../utils/capitalize';
|
|
14
14
|
import badgeClasses, { getBadgeUtilityClass } from './badgeClasses';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const RADIUS_STANDARD = 10;
|
|
17
18
|
const RADIUS_DOT = 4;
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
@@ -165,13 +166,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
165
166
|
horizontal: 'right'
|
|
166
167
|
},
|
|
167
168
|
className,
|
|
168
|
-
component
|
|
169
|
+
component,
|
|
169
170
|
components = {},
|
|
170
171
|
componentsProps = {},
|
|
172
|
+
children,
|
|
171
173
|
overlap: overlapProp = 'rectangular',
|
|
172
174
|
color: colorProp = 'default',
|
|
173
175
|
invisible: invisibleProp = false,
|
|
174
|
-
max,
|
|
176
|
+
max: maxProp = 99,
|
|
175
177
|
badgeContent: badgeContentProp,
|
|
176
178
|
slots,
|
|
177
179
|
slotProps,
|
|
@@ -179,73 +181,71 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
179
181
|
variant: variantProp = 'standard'
|
|
180
182
|
} = props,
|
|
181
183
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
184
|
+
const {
|
|
185
|
+
badgeContent,
|
|
186
|
+
invisible: invisibleFromHook,
|
|
187
|
+
max,
|
|
188
|
+
displayValue: displayValueFromHook
|
|
189
|
+
} = useBadge({
|
|
190
|
+
max: maxProp,
|
|
191
|
+
invisible: invisibleProp,
|
|
192
|
+
badgeContent: badgeContentProp,
|
|
193
|
+
showZero
|
|
194
|
+
});
|
|
182
195
|
const prevProps = usePreviousProps({
|
|
183
196
|
anchorOrigin: anchorOriginProp,
|
|
184
197
|
color: colorProp,
|
|
185
198
|
overlap: overlapProp,
|
|
186
|
-
variant: variantProp
|
|
199
|
+
variant: variantProp,
|
|
200
|
+
badgeContent: badgeContentProp
|
|
187
201
|
});
|
|
188
|
-
|
|
189
|
-
if (invisibleProp === false && (badgeContentProp === 0 && !showZero || badgeContentProp == null && variantProp !== 'dot')) {
|
|
190
|
-
invisible = true;
|
|
191
|
-
}
|
|
202
|
+
const invisible = invisibleFromHook || badgeContent == null && variantProp !== 'dot';
|
|
192
203
|
const {
|
|
193
204
|
color = colorProp,
|
|
194
205
|
overlap = overlapProp,
|
|
195
206
|
anchorOrigin = anchorOriginProp,
|
|
196
207
|
variant = variantProp
|
|
197
208
|
} = invisible ? prevProps : props;
|
|
209
|
+
const displayValue = variant !== 'dot' ? displayValueFromHook : undefined;
|
|
198
210
|
const ownerState = _extends({}, props, {
|
|
199
|
-
|
|
211
|
+
badgeContent,
|
|
200
212
|
invisible,
|
|
213
|
+
max,
|
|
214
|
+
displayValue,
|
|
215
|
+
showZero,
|
|
216
|
+
anchorOrigin,
|
|
201
217
|
color,
|
|
202
218
|
overlap,
|
|
203
219
|
variant
|
|
204
220
|
});
|
|
205
221
|
const classes = useUtilityClasses(ownerState);
|
|
206
|
-
let displayValue;
|
|
207
|
-
if (variant !== 'dot') {
|
|
208
|
-
displayValue = badgeContentProp && Number(badgeContentProp) > max ? `${max}+` : badgeContentProp;
|
|
209
|
-
}
|
|
210
222
|
|
|
211
223
|
// support both `slots` and `components` for backward compatibility
|
|
212
224
|
const RootSlot = slots?.root ?? components.Root ?? BadgeRoot;
|
|
213
225
|
const BadgeSlot = slots?.badge ?? components.Badge ?? BadgeBadge;
|
|
214
226
|
const rootSlotProps = slotProps?.root ?? componentsProps.root;
|
|
215
227
|
const badgeSlotProps = slotProps?.badge ?? componentsProps.badge;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
root: RootSlot,
|
|
224
|
-
badge: BadgeSlot
|
|
225
|
-
},
|
|
226
|
-
className: clsx(rootSlotProps?.className, classes.root, className),
|
|
227
|
-
slotProps: {
|
|
228
|
-
root: _extends({}, rootSlotProps, shouldSpreadAdditionalProps(RootSlot) && {
|
|
229
|
-
as: component,
|
|
230
|
-
ownerState: _extends({}, rootSlotProps?.ownerState, {
|
|
231
|
-
anchorOrigin,
|
|
232
|
-
color,
|
|
233
|
-
overlap,
|
|
234
|
-
variant
|
|
235
|
-
})
|
|
236
|
-
}),
|
|
237
|
-
badge: _extends({}, badgeSlotProps, {
|
|
238
|
-
className: clsx(classes.badge, badgeSlotProps?.className)
|
|
239
|
-
}, shouldSpreadAdditionalProps(BadgeSlot) && {
|
|
240
|
-
ownerState: _extends({}, badgeSlotProps?.ownerState, {
|
|
241
|
-
anchorOrigin,
|
|
242
|
-
color,
|
|
243
|
-
overlap,
|
|
244
|
-
variant
|
|
245
|
-
})
|
|
246
|
-
})
|
|
228
|
+
const rootProps = useSlotProps({
|
|
229
|
+
elementType: RootSlot,
|
|
230
|
+
externalSlotProps: rootSlotProps,
|
|
231
|
+
externalForwardedProps: other,
|
|
232
|
+
additionalProps: {
|
|
233
|
+
ref,
|
|
234
|
+
as: component
|
|
247
235
|
},
|
|
248
|
-
|
|
236
|
+
ownerState,
|
|
237
|
+
className: clsx(rootSlotProps?.className, classes.root, className)
|
|
238
|
+
});
|
|
239
|
+
const badgeProps = useSlotProps({
|
|
240
|
+
elementType: BadgeSlot,
|
|
241
|
+
externalSlotProps: badgeSlotProps,
|
|
242
|
+
ownerState,
|
|
243
|
+
className: clsx(classes.badge, badgeSlotProps?.className)
|
|
244
|
+
});
|
|
245
|
+
return /*#__PURE__*/_jsxs(RootSlot, _extends({}, rootProps, {
|
|
246
|
+
children: [children, /*#__PURE__*/_jsx(BadgeSlot, _extends({}, badgeProps, {
|
|
247
|
+
children: displayValue
|
|
248
|
+
}))]
|
|
249
249
|
}));
|
|
250
250
|
});
|
|
251
251
|
process.env.NODE_ENV !== "production" ? Badge.propTypes /* remove-proptypes */ = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
const DialogContext = /*#__PURE__*/createContext({});
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const DialogContext = /*#__PURE__*/React.createContext({});
|
|
3
3
|
if (process.env.NODE_ENV !== 'production') {
|
|
4
4
|
DialogContext.displayName = 'DialogContext';
|
|
5
5
|
}
|
|
@@ -435,7 +435,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
435
435
|
ref: ref,
|
|
436
436
|
onClick: handleClick
|
|
437
437
|
}, other, {
|
|
438
|
-
className: clsx(classes.root, rootProps.className, className),
|
|
438
|
+
className: clsx(classes.root, rootProps.className, className, readOnly && 'MuiInputBase-readOnly'),
|
|
439
439
|
children: [startAdornment, /*#__PURE__*/_jsx(FormControlContext.Provider, {
|
|
440
440
|
value: null,
|
|
441
441
|
children: /*#__PURE__*/_jsx(Input, _extends({
|
|
@@ -462,7 +462,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
462
462
|
ownerState: _extends({}, ownerState, inputProps.ownerState)
|
|
463
463
|
}, {
|
|
464
464
|
ref: handleInputRef,
|
|
465
|
-
className: clsx(classes.input, inputProps.className),
|
|
465
|
+
className: clsx(classes.input, inputProps.className, readOnly && 'MuiInputBase-readOnly'),
|
|
466
466
|
onBlur: handleBlur,
|
|
467
467
|
onChange: handleChange,
|
|
468
468
|
onFocus: handleFocus
|
|
@@ -98,7 +98,9 @@ const InputLabelRoot = styled(FormLabel, {
|
|
|
98
98
|
}, ownerState.shrink && {
|
|
99
99
|
userSelect: 'none',
|
|
100
100
|
pointerEvents: 'auto',
|
|
101
|
-
|
|
101
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
102
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
103
|
+
maxWidth: 'calc(133% - 32px)',
|
|
102
104
|
transform: 'translate(14px, -9px) scale(0.75)'
|
|
103
105
|
})));
|
|
104
106
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
@@ -87,6 +87,7 @@ const ListSubheader = /*#__PURE__*/React.forwardRef(function ListSubheader(inPro
|
|
|
87
87
|
ownerState: ownerState
|
|
88
88
|
}, other));
|
|
89
89
|
});
|
|
90
|
+
ListSubheader.muiSkipListHighlight = true;
|
|
90
91
|
process.env.NODE_ENV !== "production" ? ListSubheader.propTypes /* remove-proptypes */ = {
|
|
91
92
|
// ----------------------------- Warning --------------------------------
|
|
92
93
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -194,6 +194,13 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
194
194
|
activeItemIndex = index;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
+
if (activeItemIndex === index && (child.props.disabled || child.props.muiSkipListHighlight || child.type.muiSkipListHighlight)) {
|
|
198
|
+
activeItemIndex += 1;
|
|
199
|
+
if (activeItemIndex >= children.length) {
|
|
200
|
+
// there are no focusable items within the list.
|
|
201
|
+
activeItemIndex = -1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
197
204
|
});
|
|
198
205
|
const items = React.Children.map(children, (child, index) => {
|
|
199
206
|
if (index === activeItemIndex) {
|
package/modern/Modal/Modal.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["BackdropComponent", "BackdropProps", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "theme"];
|
|
3
|
+
const _excluded = ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "theme"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import ModalUnstyled, { modalUnstyledClasses } from '@mui/base/ModalUnstyled';
|
|
7
8
|
import { isHostComponent, resolveComponentProps } from '@mui/base/utils';
|
|
8
9
|
import { elementAcceptingRef, HTMLElementType } from '@mui/utils';
|
|
@@ -11,9 +12,6 @@ import useThemeProps from '../styles/useThemeProps';
|
|
|
11
12
|
import Backdrop from '../Backdrop';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
export const modalClasses = modalUnstyledClasses;
|
|
14
|
-
const extendUtilityClasses = ownerState => {
|
|
15
|
-
return ownerState.classes;
|
|
16
|
-
};
|
|
17
15
|
const ModalRoot = styled('div', {
|
|
18
16
|
name: 'MuiModal',
|
|
19
17
|
slot: 'Root',
|
|
@@ -67,6 +65,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
67
65
|
const {
|
|
68
66
|
BackdropComponent = ModalBackdrop,
|
|
69
67
|
BackdropProps,
|
|
68
|
+
classes,
|
|
69
|
+
className,
|
|
70
70
|
closeAfterTransition = false,
|
|
71
71
|
children,
|
|
72
72
|
component,
|
|
@@ -101,7 +101,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
101
101
|
const ownerState = _extends({}, props, commonProps, {
|
|
102
102
|
exited
|
|
103
103
|
});
|
|
104
|
-
const classes = extendUtilityClasses(ownerState);
|
|
105
104
|
const RootSlot = slots?.root ?? components.Root ?? ModalRoot;
|
|
106
105
|
const BackdropSlot = slots?.backdrop ?? components.Backdrop ?? BackdropComponent;
|
|
107
106
|
const rootSlotProps = slotProps?.root ?? componentsProps.root;
|
|
@@ -115,15 +114,17 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
115
114
|
root: () => _extends({}, resolveComponentProps(rootSlotProps, ownerState), !isHostComponent(RootSlot) && {
|
|
116
115
|
as: component,
|
|
117
116
|
theme
|
|
117
|
+
}, {
|
|
118
|
+
className: clsx(className, rootSlotProps?.className, classes?.root, !ownerState.open && ownerState.exited && classes?.hidden)
|
|
118
119
|
}),
|
|
119
|
-
backdrop: () => _extends({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState)
|
|
120
|
+
backdrop: () => _extends({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState), {
|
|
121
|
+
className: clsx(backdropSlotProps?.className, classes?.backdrop)
|
|
122
|
+
})
|
|
120
123
|
},
|
|
121
124
|
onTransitionEnter: () => setExited(false),
|
|
122
125
|
onTransitionExited: () => setExited(true),
|
|
123
126
|
ref: ref
|
|
124
|
-
}, other, {
|
|
125
|
-
classes: classes
|
|
126
|
-
}, commonProps, {
|
|
127
|
+
}, other, commonProps, {
|
|
127
128
|
children: children
|
|
128
129
|
}));
|
|
129
130
|
});
|
|
@@ -160,6 +161,10 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes /* remove-proptypes */ =
|
|
|
160
161
|
* Override or extend the styles applied to the component.
|
|
161
162
|
*/
|
|
162
163
|
classes: PropTypes.object,
|
|
164
|
+
/**
|
|
165
|
+
* @ignore
|
|
166
|
+
*/
|
|
167
|
+
className: PropTypes.string,
|
|
163
168
|
/**
|
|
164
169
|
* When set to true the Modal waits until a nested Transition is completed before closing.
|
|
165
170
|
* @default false
|
|
@@ -163,7 +163,7 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
|
|
|
163
163
|
ownerState: ownerState,
|
|
164
164
|
className: classes.notchedOutline,
|
|
165
165
|
label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
166
|
-
children: [label, "\
|
|
166
|
+
children: [label, "\u2009", '*']
|
|
167
167
|
})) : label,
|
|
168
168
|
notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
|
|
169
169
|
}),
|