@mui/material 5.12.0 → 5.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Autocomplete/Autocomplete.js +2 -2
- package/Badge/Badge.d.ts +3 -6
- package/Button/Button.js +4 -2
- package/CHANGELOG.md +142 -0
- package/FilledInput/filledInputClasses.d.ts +2 -0
- package/FormControl/FormControl.js +1 -1
- package/FormControlLabel/FormControlLabel.d.ts +4 -0
- package/FormControlLabel/FormControlLabel.js +34 -14
- package/FormControlLabel/formControlLabelClasses.d.ts +4 -0
- package/FormControlLabel/formControlLabelClasses.js +1 -1
- package/Modal/Modal.d.ts +6 -3
- package/Modal/Modal.js +11 -3
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +1 -1
- package/OutlinedInput/outlinedInputClasses.d.ts +2 -0
- package/OverridableComponent.d.ts +1 -1
- package/Popper/Popper.d.ts +5 -5
- package/Popper/Popper.js +28 -4
- package/Popper/index.d.ts +1 -1
- package/Stack/Stack.d.ts +1 -1
- package/Stack/Stack.js +1 -1
- package/Tabs/ScrollbarSize.js +2 -2
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +2 -2
- package/legacy/Button/Button.js +4 -2
- package/legacy/FormControl/FormControl.js +1 -1
- package/legacy/FormControlLabel/FormControlLabel.js +35 -14
- package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
- package/legacy/Modal/Modal.js +11 -3
- package/legacy/Modal/index.js +1 -1
- package/legacy/Popper/Popper.js +29 -5
- package/legacy/Stack/Stack.js +1 -1
- package/legacy/Tabs/ScrollbarSize.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/styles/ThemeProvider.js +8 -1
- package/legacy/styles/experimental_extendTheme.js +5 -1
- package/modern/Autocomplete/Autocomplete.js +2 -2
- package/modern/Button/Button.js +100 -96
- package/modern/FormControl/FormControl.js +1 -1
- package/modern/FormControlLabel/FormControlLabel.js +33 -13
- package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
- package/modern/Modal/Modal.js +11 -3
- package/modern/Modal/index.js +1 -1
- package/modern/Popper/Popper.js +28 -4
- package/modern/Stack/Stack.js +1 -1
- package/modern/Tabs/ScrollbarSize.js +2 -2
- package/modern/index.js +1 -1
- package/modern/styles/ThemeProvider.js +8 -1
- package/modern/styles/experimental_extendTheme.js +5 -1
- package/node/Autocomplete/Autocomplete.js +2 -2
- package/node/Button/Button.js +4 -2
- package/node/FormControl/FormControl.js +1 -1
- package/node/FormControlLabel/FormControlLabel.js +35 -15
- package/node/FormControlLabel/formControlLabelClasses.js +1 -1
- package/node/Modal/Modal.js +13 -5
- package/node/Modal/index.js +15 -18
- package/node/Popper/Popper.js +28 -4
- package/node/Stack/Stack.js +1 -1
- package/node/Tabs/ScrollbarSize.js +1 -1
- package/node/index.js +1 -1
- package/node/styles/ThemeProvider.js +8 -1
- package/node/styles/experimental_extendTheme.js +5 -1
- package/package.json +4 -4
- package/styles/ThemeProvider.js +8 -1
- package/styles/experimental_extendTheme.d.ts +7 -0
- package/styles/experimental_extendTheme.js +5 -1
- package/umd/material-ui.development.js +170 -82
- package/umd/material-ui.production.min.js +21 -21
package/index.js
CHANGED
|
@@ -105,7 +105,7 @@ var AutocompleteRoot = styled('div', {
|
|
|
105
105
|
}), _defineProperty(_$concat2, ".".concat(autocompleteClasses.hasPopupIcon, ".").concat(autocompleteClasses.hasClearIcon, "&"), {
|
|
106
106
|
paddingRight: 52 + 4 + 9
|
|
107
107
|
}), _defineProperty(_$concat2, "& .".concat(autocompleteClasses.input), {
|
|
108
|
-
padding: '7.5px 4px 7.5px
|
|
108
|
+
padding: '7.5px 4px 7.5px 5px'
|
|
109
109
|
}), _defineProperty(_$concat2, "& .".concat(autocompleteClasses.endAdornment), {
|
|
110
110
|
right: 9
|
|
111
111
|
}), _$concat2)), _defineProperty(_extends3, "& .".concat(outlinedInputClasses.root, ".").concat(inputBaseClasses.sizeSmall), _defineProperty({
|
|
@@ -115,7 +115,7 @@ var AutocompleteRoot = styled('div', {
|
|
|
115
115
|
paddingBottom: 6,
|
|
116
116
|
paddingLeft: 6
|
|
117
117
|
}, "& .".concat(autocompleteClasses.input), {
|
|
118
|
-
padding: '2.5px 4px 2.5px
|
|
118
|
+
padding: '2.5px 4px 2.5px 8px'
|
|
119
119
|
})), _defineProperty(_extends3, "& .".concat(filledInputClasses.root), (_$concat3 = {
|
|
120
120
|
paddingTop: 19,
|
|
121
121
|
paddingLeft: 8
|
package/legacy/Button/Button.js
CHANGED
|
@@ -60,6 +60,8 @@ var ButtonRoot = styled(ButtonBase, {
|
|
|
60
60
|
var _extends2, _theme$palette$getCon, _theme$palette;
|
|
61
61
|
var theme = _ref.theme,
|
|
62
62
|
ownerState = _ref.ownerState;
|
|
63
|
+
var inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
|
|
64
|
+
var inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
|
|
63
65
|
return _extends({}, theme.typography.button, (_extends2 = {
|
|
64
66
|
minWidth: 64,
|
|
65
67
|
padding: '6px 16px',
|
|
@@ -88,7 +90,7 @@ var ButtonRoot = styled(ButtonBase, {
|
|
|
88
90
|
backgroundColor: 'transparent'
|
|
89
91
|
}
|
|
90
92
|
}, ownerState.variant === 'contained' && {
|
|
91
|
-
backgroundColor:
|
|
93
|
+
backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
|
|
92
94
|
boxShadow: (theme.vars || theme).shadows[4],
|
|
93
95
|
// Reset on touch devices, it doesn't add specificity
|
|
94
96
|
'@media (hover: none)': {
|
|
@@ -129,7 +131,7 @@ var ButtonRoot = styled(ButtonBase, {
|
|
|
129
131
|
color: theme.vars ?
|
|
130
132
|
// this is safe because grey does not change between default light/dark mode
|
|
131
133
|
theme.vars.palette.text.primary : (_theme$palette$getCon = (_theme$palette = theme.palette).getContrastText) == null ? void 0 : _theme$palette$getCon.call(_theme$palette, theme.palette.grey[300]),
|
|
132
|
-
backgroundColor:
|
|
134
|
+
backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
|
|
133
135
|
boxShadow: (theme.vars || theme).shadows[2]
|
|
134
136
|
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
135
137
|
color: (theme.vars || theme).palette[ownerState.color].contrastText,
|
|
@@ -145,7 +145,7 @@ var FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, re
|
|
|
145
145
|
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
if (isFilled(child.props, true)) {
|
|
148
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
149
149
|
initialFilled = true;
|
|
150
150
|
}
|
|
151
151
|
});
|
|
@@ -19,10 +19,12 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
19
19
|
var classes = ownerState.classes,
|
|
20
20
|
disabled = ownerState.disabled,
|
|
21
21
|
labelPlacement = ownerState.labelPlacement,
|
|
22
|
-
error = ownerState.error
|
|
22
|
+
error = ownerState.error,
|
|
23
|
+
required = ownerState.required;
|
|
23
24
|
var slots = {
|
|
24
|
-
root: ['root', disabled && 'disabled', "labelPlacement".concat(capitalize(labelPlacement)), error && 'error'],
|
|
25
|
-
label: ['label', disabled && 'disabled']
|
|
25
|
+
root: ['root', disabled && 'disabled', "labelPlacement".concat(capitalize(labelPlacement)), error && 'error', required && 'required'],
|
|
26
|
+
label: ['label', disabled && 'disabled'],
|
|
27
|
+
asterisk: ['asterisk', error && 'error']
|
|
26
28
|
};
|
|
27
29
|
return composeClasses(slots, getFormControlLabelUtilityClasses, classes);
|
|
28
30
|
};
|
|
@@ -62,13 +64,25 @@ export var FormControlLabelRoot = styled('label', {
|
|
|
62
64
|
color: (theme.vars || theme).palette.text.disabled
|
|
63
65
|
})));
|
|
64
66
|
});
|
|
67
|
+
var AsteriskComponent = styled('span', {
|
|
68
|
+
name: 'MuiFormControlLabel',
|
|
69
|
+
slot: 'Asterisk',
|
|
70
|
+
overridesResolver: function overridesResolver(props, styles) {
|
|
71
|
+
return styles.asterisk;
|
|
72
|
+
}
|
|
73
|
+
})(function (_ref3) {
|
|
74
|
+
var theme = _ref3.theme;
|
|
75
|
+
return _defineProperty({}, "&.".concat(formControlLabelClasses.error), {
|
|
76
|
+
color: (theme.vars || theme).palette.error.main
|
|
77
|
+
});
|
|
78
|
+
});
|
|
65
79
|
|
|
66
80
|
/**
|
|
67
81
|
* Drop-in replacement of the `Radio`, `Switch` and `Checkbox` component.
|
|
68
82
|
* Use this component if you want to display an extra label.
|
|
69
83
|
*/
|
|
70
84
|
var FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel(inProps, ref) {
|
|
71
|
-
var _slotProps$typography;
|
|
85
|
+
var _ref5, _slotProps$typography;
|
|
72
86
|
var props = useThemeProps({
|
|
73
87
|
props: inProps,
|
|
74
88
|
name: 'MuiFormControlLabel'
|
|
@@ -86,20 +100,17 @@ var FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel(i
|
|
|
86
100
|
labelPlacement = _props$labelPlacement === void 0 ? 'end' : _props$labelPlacement,
|
|
87
101
|
name = props.name,
|
|
88
102
|
onChange = props.onChange,
|
|
103
|
+
requiredProp = props.required,
|
|
89
104
|
_props$slotProps = props.slotProps,
|
|
90
105
|
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
91
106
|
value = props.value,
|
|
92
|
-
other = _objectWithoutProperties(props, ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "slotProps", "value"]);
|
|
107
|
+
other = _objectWithoutProperties(props, ["checked", "className", "componentsProps", "control", "disabled", "disableTypography", "inputRef", "label", "labelPlacement", "name", "onChange", "required", "slotProps", "value"]);
|
|
93
108
|
var muiFormControl = useFormControl();
|
|
94
|
-
var disabled = disabledProp;
|
|
95
|
-
|
|
96
|
-
disabled = control.props.disabled;
|
|
97
|
-
}
|
|
98
|
-
if (typeof disabled === 'undefined' && muiFormControl) {
|
|
99
|
-
disabled = muiFormControl.disabled;
|
|
100
|
-
}
|
|
109
|
+
var disabled = (_ref5 = disabledProp != null ? disabledProp : control.props.disabled) != null ? _ref5 : muiFormControl == null ? void 0 : muiFormControl.disabled;
|
|
110
|
+
var required = requiredProp != null ? requiredProp : control.props.required;
|
|
101
111
|
var controlProps = {
|
|
102
|
-
disabled: disabled
|
|
112
|
+
disabled: disabled,
|
|
113
|
+
required: required
|
|
103
114
|
};
|
|
104
115
|
['checked', 'name', 'onChange', 'value', 'inputRef'].forEach(function (key) {
|
|
105
116
|
if (typeof control.props[key] === 'undefined' && typeof props[key] !== 'undefined') {
|
|
@@ -114,6 +125,7 @@ var FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel(i
|
|
|
114
125
|
var ownerState = _extends({}, props, {
|
|
115
126
|
disabled: disabled,
|
|
116
127
|
labelPlacement: labelPlacement,
|
|
128
|
+
required: required,
|
|
117
129
|
error: fcs.error
|
|
118
130
|
});
|
|
119
131
|
var classes = useUtilityClasses(ownerState);
|
|
@@ -132,7 +144,12 @@ var FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel(i
|
|
|
132
144
|
ownerState: ownerState,
|
|
133
145
|
ref: ref
|
|
134
146
|
}, other, {
|
|
135
|
-
children: [/*#__PURE__*/React.cloneElement(control, controlProps), label
|
|
147
|
+
children: [/*#__PURE__*/React.cloneElement(control, controlProps), label, required && /*#__PURE__*/_jsxs(AsteriskComponent, {
|
|
148
|
+
ownerState: ownerState,
|
|
149
|
+
"aria-hidden": true,
|
|
150
|
+
className: classes.asterisk,
|
|
151
|
+
children: ["\u2009", '*']
|
|
152
|
+
})]
|
|
136
153
|
}));
|
|
137
154
|
});
|
|
138
155
|
process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-proptypes */ = {
|
|
@@ -195,6 +212,10 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes /* remove-pro
|
|
|
195
212
|
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
196
213
|
*/
|
|
197
214
|
onChange: PropTypes.func,
|
|
215
|
+
/**
|
|
216
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
217
|
+
*/
|
|
218
|
+
required: PropTypes.bool,
|
|
198
219
|
/**
|
|
199
220
|
* The props used for each slot inside.
|
|
200
221
|
* @default {}
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getFormControlLabelUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiFormControlLabel', slot);
|
|
5
5
|
}
|
|
6
|
-
var formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label', 'error']);
|
|
6
|
+
var formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label', 'error', 'required', 'asterisk']);
|
|
7
7
|
export default formControlLabelClasses;
|
package/legacy/Modal/Modal.js
CHANGED
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import ModalUnstyled, { modalUnstyledClasses } from '@mui/base/
|
|
6
|
+
import ModalUnstyled, { modalClasses as modalUnstyledClasses } from '@mui/base/Modal';
|
|
7
7
|
import { isHostComponent, resolveComponentProps } from '@mui/base/utils';
|
|
8
8
|
import { elementAcceptingRef, HTMLElementType } from '@mui/utils';
|
|
9
9
|
import styled from '../styles/styled';
|
|
@@ -69,6 +69,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
69
69
|
_props$closeAfterTran = props.closeAfterTransition,
|
|
70
70
|
closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,
|
|
71
71
|
children = props.children,
|
|
72
|
+
container = props.container,
|
|
72
73
|
component = props.component,
|
|
73
74
|
_props$components = props.components,
|
|
74
75
|
components = _props$components === void 0 ? {} : _props$components,
|
|
@@ -90,14 +91,18 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
90
91
|
hideBackdrop = _props$hideBackdrop === void 0 ? false : _props$hideBackdrop,
|
|
91
92
|
_props$keepMounted = props.keepMounted,
|
|
92
93
|
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
|
|
94
|
+
onBackdropClick = props.onBackdropClick,
|
|
95
|
+
onClose = props.onClose,
|
|
96
|
+
open = props.open,
|
|
93
97
|
slotProps = props.slotProps,
|
|
94
98
|
slots = props.slots,
|
|
95
99
|
theme = props.theme,
|
|
96
|
-
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "theme"]);
|
|
100
|
+
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "container", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "onBackdropClick", "onClose", "open", "slotProps", "slots", "theme"]);
|
|
97
101
|
var _React$useState = React.useState(true),
|
|
98
102
|
exited = _React$useState[0],
|
|
99
103
|
setExited = _React$useState[1];
|
|
100
104
|
var commonProps = {
|
|
105
|
+
container: container,
|
|
101
106
|
closeAfterTransition: closeAfterTransition,
|
|
102
107
|
disableAutoFocus: disableAutoFocus,
|
|
103
108
|
disableEnforceFocus: disableEnforceFocus,
|
|
@@ -106,7 +111,10 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
106
111
|
disableRestoreFocus: disableRestoreFocus,
|
|
107
112
|
disableScrollLock: disableScrollLock,
|
|
108
113
|
hideBackdrop: hideBackdrop,
|
|
109
|
-
keepMounted: keepMounted
|
|
114
|
+
keepMounted: keepMounted,
|
|
115
|
+
onBackdropClick: onBackdropClick,
|
|
116
|
+
onClose: onClose,
|
|
117
|
+
open: open
|
|
110
118
|
};
|
|
111
119
|
var ownerState = _extends({}, props, commonProps, {
|
|
112
120
|
exited: exited
|
package/legacy/Modal/index.js
CHANGED
package/legacy/Popper/Popper.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import
|
|
3
|
+
import BasePopper from '@mui/base/Popper';
|
|
4
4
|
import { useThemeWithoutDefault as useTheme } from '@mui/system';
|
|
5
5
|
import { HTMLElementType, refType } from '@mui/utils';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { styled, useThemeProps } from '../styles';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
var PopperRoot = styled(
|
|
10
|
+
var PopperRoot = styled(BasePopper, {
|
|
11
11
|
name: 'MuiPopper',
|
|
12
12
|
slot: 'Root',
|
|
13
13
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -34,19 +34,43 @@ var Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
|
|
|
34
34
|
props: inProps,
|
|
35
35
|
name: 'MuiPopper'
|
|
36
36
|
});
|
|
37
|
-
var
|
|
37
|
+
var anchorEl = props.anchorEl,
|
|
38
|
+
component = props.component,
|
|
39
|
+
components = props.components,
|
|
38
40
|
componentsProps = props.componentsProps,
|
|
41
|
+
container = props.container,
|
|
42
|
+
disablePortal = props.disablePortal,
|
|
43
|
+
keepMounted = props.keepMounted,
|
|
44
|
+
modifiers = props.modifiers,
|
|
45
|
+
open = props.open,
|
|
46
|
+
placement = props.placement,
|
|
47
|
+
popperOptions = props.popperOptions,
|
|
48
|
+
popperRef = props.popperRef,
|
|
49
|
+
transition = props.transition,
|
|
39
50
|
slots = props.slots,
|
|
40
51
|
slotProps = props.slotProps,
|
|
41
|
-
other = _objectWithoutProperties(props, ["components", "componentsProps", "slots", "slotProps"]);
|
|
52
|
+
other = _objectWithoutProperties(props, ["anchorEl", "component", "components", "componentsProps", "container", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "transition", "slots", "slotProps"]);
|
|
42
53
|
var RootComponent = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components == null ? void 0 : components.Root;
|
|
54
|
+
var otherProps = _extends({
|
|
55
|
+
anchorEl: anchorEl,
|
|
56
|
+
component: component,
|
|
57
|
+
container: container,
|
|
58
|
+
disablePortal: disablePortal,
|
|
59
|
+
keepMounted: keepMounted,
|
|
60
|
+
modifiers: modifiers,
|
|
61
|
+
open: open,
|
|
62
|
+
placement: placement,
|
|
63
|
+
popperOptions: popperOptions,
|
|
64
|
+
popperRef: popperRef,
|
|
65
|
+
transition: transition
|
|
66
|
+
}, other);
|
|
43
67
|
return /*#__PURE__*/_jsx(PopperRoot, _extends({
|
|
44
68
|
direction: theme == null ? void 0 : theme.direction,
|
|
45
69
|
slots: {
|
|
46
70
|
root: RootComponent
|
|
47
71
|
},
|
|
48
72
|
slotProps: slotProps != null ? slotProps : componentsProps
|
|
49
|
-
},
|
|
73
|
+
}, otherProps, {
|
|
50
74
|
ref: ref
|
|
51
75
|
}));
|
|
52
76
|
});
|
package/legacy/Stack/Stack.js
CHANGED
|
@@ -53,7 +53,7 @@ process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ =
|
|
|
53
53
|
/**
|
|
54
54
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
55
55
|
*
|
|
56
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
56
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
57
57
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
58
58
|
*
|
|
59
59
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import debounce from '../utils/debounce';
|
|
6
|
-
import { ownerWindow } from '../utils';
|
|
6
|
+
import { ownerWindow, unstable_useEnhancedEffect as useEnhancedEffect } from '../utils';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
var styles = {
|
|
9
9
|
width: 99,
|
|
@@ -26,7 +26,7 @@ export default function ScrollbarSize(props) {
|
|
|
26
26
|
var setMeasurements = function setMeasurements() {
|
|
27
27
|
scrollbarHeight.current = nodeRef.current.offsetHeight - nodeRef.current.clientHeight;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
useEnhancedEffect(function () {
|
|
30
30
|
var handleResize = debounce(function () {
|
|
31
31
|
var prevHeight = scrollbarHeight.current;
|
|
32
32
|
setMeasurements();
|
package/legacy/index.js
CHANGED
|
@@ -15,5 +15,12 @@ export default function ThemeProvider(_ref) {
|
|
|
15
15
|
}));
|
|
16
16
|
}
|
|
17
17
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Your component tree.
|
|
20
|
+
*/
|
|
21
|
+
children: PropTypes.node,
|
|
22
|
+
/**
|
|
23
|
+
* A theme object. You can provide a function to extend the outer theme.
|
|
24
|
+
*/
|
|
25
|
+
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).isRequired
|
|
19
26
|
} : void 0;
|
|
@@ -112,7 +112,7 @@ export default function extendTheme() {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
// assign component variables
|
|
115
|
-
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
115
|
+
assignNode(palette, ['Alert', 'AppBar', 'Avatar', 'Button', 'Chip', 'FilledInput', 'LinearProgress', 'Skeleton', 'Slider', 'SnackbarContent', 'SpeedDialAction', 'StepConnector', 'StepContent', 'Switch', 'TableCell', 'Tooltip']);
|
|
116
116
|
if (key === 'light') {
|
|
117
117
|
setColor(palette.Alert, 'errorColor', safeDarken(palette.error.light, 0.6));
|
|
118
118
|
setColor(palette.Alert, 'infoColor', safeDarken(palette.info.light, 0.6));
|
|
@@ -144,6 +144,8 @@ export default function extendTheme() {
|
|
|
144
144
|
setColor(palette.Alert, 'warningIconColor', setCssVarColor('palette-warning-main'));
|
|
145
145
|
setColor(palette.AppBar, 'defaultBg', setCssVarColor('palette-grey-100'));
|
|
146
146
|
setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-400'));
|
|
147
|
+
setColor(palette.Button, 'inheritContainedBg', setCssVarColor('palette-grey-300'));
|
|
148
|
+
setColor(palette.Button, 'inheritContainedHoverBg', setCssVarColor('palette-grey-A100'));
|
|
147
149
|
setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-400'));
|
|
148
150
|
setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-700'));
|
|
149
151
|
setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-700'));
|
|
@@ -214,6 +216,8 @@ export default function extendTheme() {
|
|
|
214
216
|
setColor(palette.AppBar, 'darkBg', setCssVarColor('palette-background-paper')); // specific for dark mode
|
|
215
217
|
setColor(palette.AppBar, 'darkColor', setCssVarColor('palette-text-primary')); // specific for dark mode
|
|
216
218
|
setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-600'));
|
|
219
|
+
setColor(palette.Button, 'inheritContainedBg', setCssVarColor('palette-grey-800'));
|
|
220
|
+
setColor(palette.Button, 'inheritContainedHoverBg', setCssVarColor('palette-grey-700'));
|
|
217
221
|
setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-700'));
|
|
218
222
|
setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-300'));
|
|
219
223
|
setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-300'));
|
|
@@ -138,7 +138,7 @@ const AutocompleteRoot = styled('div', {
|
|
|
138
138
|
paddingRight: 52 + 4 + 9
|
|
139
139
|
},
|
|
140
140
|
[`& .${autocompleteClasses.input}`]: {
|
|
141
|
-
padding: '7.5px 4px 7.5px
|
|
141
|
+
padding: '7.5px 4px 7.5px 5px'
|
|
142
142
|
},
|
|
143
143
|
[`& .${autocompleteClasses.endAdornment}`]: {
|
|
144
144
|
right: 9
|
|
@@ -151,7 +151,7 @@ const AutocompleteRoot = styled('div', {
|
|
|
151
151
|
paddingBottom: 6,
|
|
152
152
|
paddingLeft: 6,
|
|
153
153
|
[`& .${autocompleteClasses.input}`]: {
|
|
154
|
-
padding: '2.5px 4px 2.5px
|
|
154
|
+
padding: '2.5px 4px 2.5px 8px'
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
[`& .${filledInputClasses.root}`]: {
|
package/modern/Button/Button.js
CHANGED
|
@@ -59,106 +59,110 @@ const ButtonRoot = styled(ButtonBase, {
|
|
|
59
59
|
})(({
|
|
60
60
|
theme,
|
|
61
61
|
ownerState
|
|
62
|
-
}) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
backgroundColor:
|
|
75
|
-
|
|
62
|
+
}) => {
|
|
63
|
+
const inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
|
|
64
|
+
const inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
|
|
65
|
+
return _extends({}, theme.typography.button, {
|
|
66
|
+
minWidth: 64,
|
|
67
|
+
padding: '6px 16px',
|
|
68
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
69
|
+
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
|
|
70
|
+
duration: theme.transitions.duration.short
|
|
71
|
+
}),
|
|
72
|
+
'&:hover': _extends({
|
|
73
|
+
textDecoration: 'none',
|
|
74
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
|
|
75
|
+
// Reset on touch devices, it doesn't add specificity
|
|
76
|
+
'@media (hover: none)': {
|
|
77
|
+
backgroundColor: 'transparent'
|
|
78
|
+
}
|
|
79
|
+
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
80
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
|
|
81
|
+
// Reset on touch devices, it doesn't add specificity
|
|
82
|
+
'@media (hover: none)': {
|
|
83
|
+
backgroundColor: 'transparent'
|
|
84
|
+
}
|
|
85
|
+
}, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
|
|
86
|
+
border: `1px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
|
|
87
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
|
|
88
|
+
// Reset on touch devices, it doesn't add specificity
|
|
89
|
+
'@media (hover: none)': {
|
|
90
|
+
backgroundColor: 'transparent'
|
|
91
|
+
}
|
|
92
|
+
}, ownerState.variant === 'contained' && {
|
|
93
|
+
backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
|
|
94
|
+
boxShadow: (theme.vars || theme).shadows[4],
|
|
95
|
+
// Reset on touch devices, it doesn't add specificity
|
|
96
|
+
'@media (hover: none)': {
|
|
97
|
+
boxShadow: (theme.vars || theme).shadows[2],
|
|
98
|
+
backgroundColor: (theme.vars || theme).palette.grey[300]
|
|
99
|
+
}
|
|
100
|
+
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
101
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].dark,
|
|
102
|
+
// Reset on touch devices, it doesn't add specificity
|
|
103
|
+
'@media (hover: none)': {
|
|
104
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
'&:active': _extends({}, ownerState.variant === 'contained' && {
|
|
108
|
+
boxShadow: (theme.vars || theme).shadows[8]
|
|
109
|
+
}),
|
|
110
|
+
[`&.${buttonClasses.focusVisible}`]: _extends({}, ownerState.variant === 'contained' && {
|
|
111
|
+
boxShadow: (theme.vars || theme).shadows[6]
|
|
112
|
+
}),
|
|
113
|
+
[`&.${buttonClasses.disabled}`]: _extends({
|
|
114
|
+
color: (theme.vars || theme).palette.action.disabled
|
|
115
|
+
}, ownerState.variant === 'outlined' && {
|
|
116
|
+
border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
|
|
117
|
+
}, ownerState.variant === 'contained' && {
|
|
118
|
+
color: (theme.vars || theme).palette.action.disabled,
|
|
119
|
+
boxShadow: (theme.vars || theme).shadows[0],
|
|
120
|
+
backgroundColor: (theme.vars || theme).palette.action.disabledBackground
|
|
121
|
+
})
|
|
122
|
+
}, ownerState.variant === 'text' && {
|
|
123
|
+
padding: '6px 8px'
|
|
76
124
|
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
125
|
+
color: (theme.vars || theme).palette[ownerState.color].main
|
|
126
|
+
}, ownerState.variant === 'outlined' && {
|
|
127
|
+
padding: '5px 15px',
|
|
128
|
+
border: '1px solid currentColor'
|
|
82
129
|
}, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// Reset on touch devices, it doesn't add specificity
|
|
86
|
-
'@media (hover: none)': {
|
|
87
|
-
backgroundColor: 'transparent'
|
|
88
|
-
}
|
|
130
|
+
color: (theme.vars || theme).palette[ownerState.color].main,
|
|
131
|
+
border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha(theme.palette[ownerState.color].main, 0.5)}`
|
|
89
132
|
}, ownerState.variant === 'contained' && {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
backgroundColor: (theme.vars || theme).palette.grey[300]
|
|
96
|
-
}
|
|
133
|
+
color: theme.vars ?
|
|
134
|
+
// this is safe because grey does not change between default light/dark mode
|
|
135
|
+
theme.vars.palette.text.primary : theme.palette.getContrastText?.(theme.palette.grey[300]),
|
|
136
|
+
backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
|
|
137
|
+
boxShadow: (theme.vars || theme).shadows[2]
|
|
97
138
|
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}, ownerState.variant === 'outlined' && {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}, ownerState.
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
border: '1px solid currentColor'
|
|
126
|
-
}, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
|
|
127
|
-
color: (theme.vars || theme).palette[ownerState.color].main,
|
|
128
|
-
border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha(theme.palette[ownerState.color].main, 0.5)}`
|
|
129
|
-
}, ownerState.variant === 'contained' && {
|
|
130
|
-
color: theme.vars ?
|
|
131
|
-
// this is safe because grey does not change between default light/dark mode
|
|
132
|
-
theme.vars.palette.text.primary : theme.palette.getContrastText?.(theme.palette.grey[300]),
|
|
133
|
-
backgroundColor: (theme.vars || theme).palette.grey[300],
|
|
134
|
-
boxShadow: (theme.vars || theme).shadows[2]
|
|
135
|
-
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
136
|
-
color: (theme.vars || theme).palette[ownerState.color].contrastText,
|
|
137
|
-
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
138
|
-
}, ownerState.color === 'inherit' && {
|
|
139
|
-
color: 'inherit',
|
|
140
|
-
borderColor: 'currentColor'
|
|
141
|
-
}, ownerState.size === 'small' && ownerState.variant === 'text' && {
|
|
142
|
-
padding: '4px 5px',
|
|
143
|
-
fontSize: theme.typography.pxToRem(13)
|
|
144
|
-
}, ownerState.size === 'large' && ownerState.variant === 'text' && {
|
|
145
|
-
padding: '8px 11px',
|
|
146
|
-
fontSize: theme.typography.pxToRem(15)
|
|
147
|
-
}, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
|
|
148
|
-
padding: '3px 9px',
|
|
149
|
-
fontSize: theme.typography.pxToRem(13)
|
|
150
|
-
}, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
|
|
151
|
-
padding: '7px 21px',
|
|
152
|
-
fontSize: theme.typography.pxToRem(15)
|
|
153
|
-
}, ownerState.size === 'small' && ownerState.variant === 'contained' && {
|
|
154
|
-
padding: '4px 10px',
|
|
155
|
-
fontSize: theme.typography.pxToRem(13)
|
|
156
|
-
}, ownerState.size === 'large' && ownerState.variant === 'contained' && {
|
|
157
|
-
padding: '8px 22px',
|
|
158
|
-
fontSize: theme.typography.pxToRem(15)
|
|
159
|
-
}, ownerState.fullWidth && {
|
|
160
|
-
width: '100%'
|
|
161
|
-
}), ({
|
|
139
|
+
color: (theme.vars || theme).palette[ownerState.color].contrastText,
|
|
140
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
141
|
+
}, ownerState.color === 'inherit' && {
|
|
142
|
+
color: 'inherit',
|
|
143
|
+
borderColor: 'currentColor'
|
|
144
|
+
}, ownerState.size === 'small' && ownerState.variant === 'text' && {
|
|
145
|
+
padding: '4px 5px',
|
|
146
|
+
fontSize: theme.typography.pxToRem(13)
|
|
147
|
+
}, ownerState.size === 'large' && ownerState.variant === 'text' && {
|
|
148
|
+
padding: '8px 11px',
|
|
149
|
+
fontSize: theme.typography.pxToRem(15)
|
|
150
|
+
}, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
|
|
151
|
+
padding: '3px 9px',
|
|
152
|
+
fontSize: theme.typography.pxToRem(13)
|
|
153
|
+
}, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
|
|
154
|
+
padding: '7px 21px',
|
|
155
|
+
fontSize: theme.typography.pxToRem(15)
|
|
156
|
+
}, ownerState.size === 'small' && ownerState.variant === 'contained' && {
|
|
157
|
+
padding: '4px 10px',
|
|
158
|
+
fontSize: theme.typography.pxToRem(13)
|
|
159
|
+
}, ownerState.size === 'large' && ownerState.variant === 'contained' && {
|
|
160
|
+
padding: '8px 22px',
|
|
161
|
+
fontSize: theme.typography.pxToRem(15)
|
|
162
|
+
}, ownerState.fullWidth && {
|
|
163
|
+
width: '100%'
|
|
164
|
+
});
|
|
165
|
+
}, ({
|
|
162
166
|
ownerState
|
|
163
167
|
}) => ownerState.disableElevation && {
|
|
164
168
|
boxShadow: 'none',
|
|
@@ -138,7 +138,7 @@ const FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps,
|
|
|
138
138
|
if (!isMuiElement(child, ['Input', 'Select'])) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
-
if (isFilled(child.props, true)) {
|
|
141
|
+
if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {
|
|
142
142
|
initialFilled = true;
|
|
143
143
|
}
|
|
144
144
|
});
|