@mui/material 5.11.10 → 5.11.12
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 +4 -1
- package/Autocomplete/Autocomplete.js +5 -2
- package/Autocomplete/autocompleteClasses.d.ts +2 -0
- package/Autocomplete/autocompleteClasses.js +1 -1
- package/Badge/Badge.js +1 -1
- package/CHANGELOG.md +233 -0
- package/Container/Container.js +0 -1
- package/DialogTitle/DialogTitle.js +2 -2
- package/InputBase/InputBase.js +2 -2
- package/InputLabel/InputLabel.js +3 -1
- package/ListSubheader/ListSubheader.js +1 -0
- package/Menu/Menu.js +1 -1
- 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/Unstable_Grid2/Grid2.js +2 -3
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +5 -2
- package/legacy/Autocomplete/autocompleteClasses.js +1 -1
- package/legacy/Badge/Badge.js +1 -1
- package/legacy/Container/Container.js +0 -1
- package/legacy/DialogTitle/DialogTitle.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/Menu/Menu.js +1 -1
- 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/Unstable_Grid2/Grid2.js +2 -3
- package/legacy/index.js +1 -1
- package/legacy/styles/CssVarsProvider.js +1 -8
- package/legacy/styles/createTheme.js +1 -0
- package/legacy/styles/experimental_extendTheme.js +64 -40
- package/legacy/useAutocomplete/useAutocomplete.js +2 -2
- package/modern/Autocomplete/Autocomplete.js +5 -2
- package/modern/Autocomplete/autocompleteClasses.js +1 -1
- package/modern/Badge/Badge.js +1 -1
- package/modern/Container/Container.js +0 -1
- package/modern/DialogTitle/DialogTitle.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/Menu/Menu.js +1 -1
- 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/Unstable_Grid2/Grid2.js +2 -3
- package/modern/index.js +1 -1
- package/modern/styles/CssVarsProvider.js +1 -5
- package/modern/styles/createTheme.js +1 -0
- package/modern/styles/experimental_extendTheme.js +62 -41
- package/modern/useAutocomplete/useAutocomplete.js +2 -2
- package/node/Autocomplete/Autocomplete.js +5 -2
- package/node/Autocomplete/autocompleteClasses.js +1 -1
- package/node/Badge/Badge.js +2 -2
- package/node/Container/Container.js +0 -2
- package/node/DialogTitle/DialogTitle.js +2 -2
- package/node/InputBase/InputBase.js +2 -2
- package/node/InputLabel/InputLabel.js +3 -1
- package/node/ListSubheader/ListSubheader.js +1 -0
- package/node/Menu/Menu.js +1 -1
- 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/Unstable_Grid2/Grid2.js +0 -1
- package/node/index.js +1 -1
- package/node/styles/CssVarsProvider.js +1 -9
- package/node/styles/createTheme.js +1 -0
- package/node/styles/experimental_extendTheme.js +66 -40
- package/node/useAutocomplete/useAutocomplete.js +8 -6
- package/package.json +6 -6
- package/styles/CssVarsProvider.d.ts +1 -2
- package/styles/CssVarsProvider.js +1 -8
- package/styles/createTheme.js +1 -0
- package/styles/experimental_extendTheme.d.ts +16 -0
- package/styles/experimental_extendTheme.js +65 -41
- package/umd/material-ui.development.js +3958 -3813
- package/umd/material-ui.production.min.js +21 -21
- package/useAutocomplete/useAutocomplete.d.ts +2 -2
- package/useAutocomplete/useAutocomplete.js +2 -2
package/node/Badge/Badge.js
CHANGED
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/base/composeClasses"));
|
|
15
|
-
var
|
|
15
|
+
var _useBadge = _interopRequireDefault(require("@mui/base/useBadge"));
|
|
16
16
|
var _base = require("@mui/base");
|
|
17
17
|
var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
18
18
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
@@ -195,7 +195,7 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
195
195
|
invisible: invisibleFromHook,
|
|
196
196
|
max,
|
|
197
197
|
displayValue: displayValueFromHook
|
|
198
|
-
} = (0,
|
|
198
|
+
} = (0, _useBadge.default)({
|
|
199
199
|
max: maxProp,
|
|
200
200
|
invisible: invisibleProp,
|
|
201
201
|
badgeContent: badgeContentProp,
|
|
@@ -10,8 +10,6 @@ var _system = require("@mui/system");
|
|
|
10
10
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
11
11
|
var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
12
12
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
13
|
-
/* eslint-disable material-ui/mui-name-matches-component-name */
|
|
14
|
-
|
|
15
13
|
const Container = (0, _system.createContainer)({
|
|
16
14
|
createStyledComponent: (0, _styled.default)('div', {
|
|
17
15
|
name: 'MuiContainer',
|
|
@@ -50,7 +50,7 @@ const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(inProps,
|
|
|
50
50
|
const ownerState = props;
|
|
51
51
|
const classes = useUtilityClasses(ownerState);
|
|
52
52
|
const {
|
|
53
|
-
titleId
|
|
53
|
+
titleId = idProp
|
|
54
54
|
} = React.useContext(_DialogContext.default);
|
|
55
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DialogTitleRoot, (0, _extends2.default)({
|
|
56
56
|
component: "h2",
|
|
@@ -58,7 +58,7 @@ const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(inProps,
|
|
|
58
58
|
ownerState: ownerState,
|
|
59
59
|
ref: ref,
|
|
60
60
|
variant: "h6",
|
|
61
|
-
id:
|
|
61
|
+
id: idProp != null ? idProp : titleId
|
|
62
62
|
}, other));
|
|
63
63
|
});
|
|
64
64
|
process.env.NODE_ENV !== "production" ? DialogTitle.propTypes /* remove-proptypes */ = {
|
|
@@ -447,7 +447,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
447
447
|
ref: ref,
|
|
448
448
|
onClick: handleClick
|
|
449
449
|
}, other, {
|
|
450
|
-
className: (0, _clsx.default)(classes.root, rootProps.className, className),
|
|
450
|
+
className: (0, _clsx.default)(classes.root, rootProps.className, className, readOnly && 'MuiInputBase-readOnly'),
|
|
451
451
|
children: [startAdornment, /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlContext.default.Provider, {
|
|
452
452
|
value: null,
|
|
453
453
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, (0, _extends2.default)({
|
|
@@ -474,7 +474,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
474
474
|
ownerState: (0, _extends2.default)({}, ownerState, inputProps.ownerState)
|
|
475
475
|
}, {
|
|
476
476
|
ref: handleInputRef,
|
|
477
|
-
className: (0, _clsx.default)(classes.input, inputProps.className),
|
|
477
|
+
className: (0, _clsx.default)(classes.input, inputProps.className, readOnly && 'MuiInputBase-readOnly'),
|
|
478
478
|
onBlur: handleBlur,
|
|
479
479
|
onChange: handleChange,
|
|
480
480
|
onFocus: handleFocus
|
|
@@ -107,7 +107,9 @@ const InputLabelRoot = (0, _styled.default)(_FormLabel.default, {
|
|
|
107
107
|
}, ownerState.shrink && {
|
|
108
108
|
userSelect: 'none',
|
|
109
109
|
pointerEvents: 'auto',
|
|
110
|
-
|
|
110
|
+
// Theoretically, we should have (8+5)*2/0.75 = 34px
|
|
111
|
+
// but it feels a better when it bleeds a bit on the left, so 32px.
|
|
112
|
+
maxWidth: 'calc(133% - 32px)',
|
|
111
113
|
transform: 'translate(14px, -9px) scale(0.75)'
|
|
112
114
|
})));
|
|
113
115
|
const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, ref) {
|
|
@@ -96,6 +96,7 @@ const ListSubheader = /*#__PURE__*/React.forwardRef(function ListSubheader(inPro
|
|
|
96
96
|
ownerState: ownerState
|
|
97
97
|
}, other));
|
|
98
98
|
});
|
|
99
|
+
ListSubheader.muiSkipListHighlight = true;
|
|
99
100
|
process.env.NODE_ENV !== "production" ? ListSubheader.propTypes /* remove-proptypes */ = {
|
|
100
101
|
// ----------------------------- Warning --------------------------------
|
|
101
102
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/node/Menu/Menu.js
CHANGED
|
@@ -158,7 +158,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
158
158
|
},
|
|
159
159
|
transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
|
|
160
160
|
PaperProps: (0, _extends2.default)({
|
|
161
|
-
|
|
161
|
+
as: MenuPaper
|
|
162
162
|
}, PaperProps, {
|
|
163
163
|
classes: (0, _extends2.default)({}, PaperProps.classes, {
|
|
164
164
|
root: classes.paper
|
|
@@ -203,6 +203,13 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
|
|
|
203
203
|
activeItemIndex = index;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
+
if (activeItemIndex === index && (child.props.disabled || child.props.muiSkipListHighlight || child.type.muiSkipListHighlight)) {
|
|
207
|
+
activeItemIndex += 1;
|
|
208
|
+
if (activeItemIndex >= children.length) {
|
|
209
|
+
// there are no focusable items within the list.
|
|
210
|
+
activeItemIndex = -1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
206
213
|
});
|
|
207
214
|
const items = React.Children.map(children, (child, index) => {
|
|
208
215
|
if (index === activeItemIndex) {
|
package/node/Modal/Modal.js
CHANGED
|
@@ -9,6 +9,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
13
|
var _ModalUnstyled = _interopRequireWildcard(require("@mui/base/ModalUnstyled"));
|
|
13
14
|
var _utils = require("@mui/base/utils");
|
|
14
15
|
var _utils2 = require("@mui/utils");
|
|
@@ -16,14 +17,11 @@ var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
|
16
17
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
17
18
|
var _Backdrop = _interopRequireDefault(require("../Backdrop"));
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["BackdropComponent", "BackdropProps", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "theme"];
|
|
20
|
+
const _excluded = ["BackdropComponent", "BackdropProps", "classes", "className", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "theme"];
|
|
20
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
23
|
const modalClasses = _ModalUnstyled.modalUnstyledClasses;
|
|
23
24
|
exports.modalClasses = modalClasses;
|
|
24
|
-
const extendUtilityClasses = ownerState => {
|
|
25
|
-
return ownerState.classes;
|
|
26
|
-
};
|
|
27
25
|
const ModalRoot = (0, _styled.default)('div', {
|
|
28
26
|
name: 'MuiModal',
|
|
29
27
|
slot: 'Root',
|
|
@@ -78,6 +76,8 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
78
76
|
const {
|
|
79
77
|
BackdropComponent = ModalBackdrop,
|
|
80
78
|
BackdropProps,
|
|
79
|
+
classes,
|
|
80
|
+
className,
|
|
81
81
|
closeAfterTransition = false,
|
|
82
82
|
children,
|
|
83
83
|
component,
|
|
@@ -112,7 +112,6 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
112
112
|
const ownerState = (0, _extends2.default)({}, props, commonProps, {
|
|
113
113
|
exited
|
|
114
114
|
});
|
|
115
|
-
const classes = extendUtilityClasses(ownerState);
|
|
116
115
|
const RootSlot = (_ref = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref : ModalRoot;
|
|
117
116
|
const BackdropSlot = (_ref2 = (_slots$backdrop = slots == null ? void 0 : slots.backdrop) != null ? _slots$backdrop : components.Backdrop) != null ? _ref2 : BackdropComponent;
|
|
118
117
|
const rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
@@ -126,15 +125,17 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
126
125
|
root: () => (0, _extends2.default)({}, (0, _utils.resolveComponentProps)(rootSlotProps, ownerState), !(0, _utils.isHostComponent)(RootSlot) && {
|
|
127
126
|
as: component,
|
|
128
127
|
theme
|
|
128
|
+
}, {
|
|
129
|
+
className: (0, _clsx.default)(className, rootSlotProps == null ? void 0 : rootSlotProps.className, classes == null ? void 0 : classes.root, !ownerState.open && ownerState.exited && (classes == null ? void 0 : classes.hidden))
|
|
129
130
|
}),
|
|
130
|
-
backdrop: () => (0, _extends2.default)({}, BackdropProps, (0, _utils.resolveComponentProps)(backdropSlotProps, ownerState)
|
|
131
|
+
backdrop: () => (0, _extends2.default)({}, BackdropProps, (0, _utils.resolveComponentProps)(backdropSlotProps, ownerState), {
|
|
132
|
+
className: (0, _clsx.default)(backdropSlotProps == null ? void 0 : backdropSlotProps.className, classes == null ? void 0 : classes.backdrop)
|
|
133
|
+
})
|
|
131
134
|
},
|
|
132
135
|
onTransitionEnter: () => setExited(false),
|
|
133
136
|
onTransitionExited: () => setExited(true),
|
|
134
137
|
ref: ref
|
|
135
|
-
}, other, {
|
|
136
|
-
classes: classes
|
|
137
|
-
}, commonProps, {
|
|
138
|
+
}, other, commonProps, {
|
|
138
139
|
children: children
|
|
139
140
|
}));
|
|
140
141
|
});
|
|
@@ -171,6 +172,10 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes /* remove-proptypes */ =
|
|
|
171
172
|
* Override or extend the styles applied to the component.
|
|
172
173
|
*/
|
|
173
174
|
classes: _propTypes.default.object,
|
|
175
|
+
/**
|
|
176
|
+
* @ignore
|
|
177
|
+
*/
|
|
178
|
+
className: _propTypes.default.string,
|
|
174
179
|
/**
|
|
175
180
|
* When set to true the Modal waits until a nested Transition is completed before closing.
|
|
176
181
|
* @default false
|
|
@@ -171,7 +171,7 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
|
|
|
171
171
|
ownerState: ownerState,
|
|
172
172
|
className: classes.notchedOutline,
|
|
173
173
|
label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
174
|
-
children: [label, "\
|
|
174
|
+
children: [label, "\u2009", '*']
|
|
175
175
|
})) : label,
|
|
176
176
|
notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
|
|
177
177
|
}),
|
package/node/Rating/Rating.js
CHANGED
|
@@ -54,7 +54,7 @@ const useUtilityClasses = ownerState => {
|
|
|
54
54
|
focusVisible
|
|
55
55
|
} = ownerState;
|
|
56
56
|
const slots = {
|
|
57
|
-
root: ['root', `size${(0, _utils2.capitalize)(size)}`, disabled && 'disabled', focusVisible && 'focusVisible', readOnly && '
|
|
57
|
+
root: ['root', `size${(0, _utils2.capitalize)(size)}`, disabled && 'disabled', focusVisible && 'focusVisible', readOnly && 'readOnly'],
|
|
58
58
|
label: ['label', 'pristine'],
|
|
59
59
|
labelEmptyValue: [emptyValueFocused && 'labelEmptyValueActive'],
|
|
60
60
|
icon: ['icon'],
|
|
@@ -452,7 +452,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
452
452
|
ref: handleRef,
|
|
453
453
|
onMouseMove: handleMouseMove,
|
|
454
454
|
onMouseLeave: handleMouseLeave,
|
|
455
|
-
className: (0, _clsx.default)(classes.root, className),
|
|
455
|
+
className: (0, _clsx.default)(classes.root, className, readOnly && 'MuiRating-readOnly'),
|
|
456
456
|
ownerState: ownerState,
|
|
457
457
|
role: readOnly ? 'img' : null,
|
|
458
458
|
"aria-label": readOnly ? getLabelText(value) : null
|
|
@@ -336,8 +336,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
336
336
|
computeDisplay = true;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
const items = childrenArray.map(
|
|
340
|
-
var _arr$, _arr$$props, _arr$2, _arr$2$props;
|
|
339
|
+
const items = childrenArray.map(child => {
|
|
341
340
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
342
341
|
return null;
|
|
343
342
|
}
|
|
@@ -364,25 +363,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
364
363
|
if (selected) {
|
|
365
364
|
foundMatch = true;
|
|
366
365
|
}
|
|
367
|
-
if (child.props.value === undefined) {
|
|
368
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
369
|
-
'aria-readonly': true,
|
|
370
|
-
role: 'option'
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
const isFirstSelectableElement = () => {
|
|
374
|
-
if (value) {
|
|
375
|
-
return selected;
|
|
376
|
-
}
|
|
377
|
-
const firstSelectableElement = arr.find(item => {
|
|
378
|
-
var _item$props;
|
|
379
|
-
return (item == null ? void 0 : (_item$props = item.props) == null ? void 0 : _item$props.value) !== undefined && item.props.disabled !== true;
|
|
380
|
-
});
|
|
381
|
-
if (child === firstSelectableElement) {
|
|
382
|
-
return true;
|
|
383
|
-
}
|
|
384
|
-
return selected;
|
|
385
|
-
};
|
|
386
366
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
387
367
|
'aria-selected': selected ? 'true' : 'false',
|
|
388
368
|
onClick: handleItemClick(child),
|
|
@@ -398,7 +378,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
398
378
|
}
|
|
399
379
|
},
|
|
400
380
|
role: 'option',
|
|
401
|
-
selected
|
|
381
|
+
selected,
|
|
402
382
|
value: undefined,
|
|
403
383
|
// The value is most likely not a valid HTML attribute.
|
|
404
384
|
'data-value': child.props.value // Instead, we provide it as a data attribute.
|
package/node/Slider/Slider.js
CHANGED
|
@@ -12,7 +12,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _base = require("@mui/base");
|
|
15
|
-
var
|
|
15
|
+
var _useSlider = _interopRequireWildcard(require("@mui/base/useSlider"));
|
|
16
16
|
var _system = require("@mui/system");
|
|
17
17
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
18
18
|
var _styled = _interopRequireWildcard(require("../styles/styled"));
|
|
@@ -25,7 +25,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
const _excluded = ["aria-label", "aria-valuetext", "aria-labelledby", "component", "components", "componentsProps", "color", "classes", "className", "disableSwap", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "orientation", "size", "step", "scale", "slotProps", "slots", "tabIndex", "track", "value", "valueLabelDisplay", "valueLabelFormat"];
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
|
-
const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
|
|
29
28
|
function Identity(x) {
|
|
30
29
|
return x;
|
|
31
30
|
}
|
|
@@ -466,7 +465,6 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
466
465
|
componentsProps = {},
|
|
467
466
|
color = 'primary',
|
|
468
467
|
classes: classesProp,
|
|
469
|
-
// eslint-disable-next-line react/prop-types
|
|
470
468
|
className,
|
|
471
469
|
disableSwap = false,
|
|
472
470
|
disabled = false,
|
|
@@ -518,7 +516,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
518
516
|
values,
|
|
519
517
|
trackOffset,
|
|
520
518
|
trackLeap
|
|
521
|
-
} = (0,
|
|
519
|
+
} = (0, _useSlider.default)((0, _extends2.default)({}, ownerState, {
|
|
522
520
|
ref
|
|
523
521
|
}));
|
|
524
522
|
ownerState.marked = marks.length > 0 && marks.some(mark => mark.label);
|
|
@@ -573,7 +571,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
573
571
|
elementType: ThumbSlot,
|
|
574
572
|
getSlotProps: getThumbProps,
|
|
575
573
|
externalSlotProps: thumbSlotProps,
|
|
576
|
-
ownerState: (0, _extends2.default)({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState)
|
|
574
|
+
ownerState: (0, _extends2.default)({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState),
|
|
575
|
+
className: classes.thumb
|
|
577
576
|
});
|
|
578
577
|
const valueLabelProps = (0, _base.useSlotProps)({
|
|
579
578
|
elementType: ValueLabelSlot,
|
|
@@ -590,7 +589,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
590
589
|
const markLabelProps = (0, _base.useSlotProps)({
|
|
591
590
|
elementType: MarkLabelSlot,
|
|
592
591
|
externalSlotProps: markLabelSlotProps,
|
|
593
|
-
ownerState
|
|
592
|
+
ownerState,
|
|
593
|
+
className: classes.markLabel
|
|
594
594
|
});
|
|
595
595
|
const inputSliderProps = (0, _base.useSlotProps)({
|
|
596
596
|
elementType: InputSlot,
|
|
@@ -600,7 +600,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
600
600
|
});
|
|
601
601
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, (0, _extends2.default)({}, rootProps, {
|
|
602
602
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(RailSlot, (0, _extends2.default)({}, railProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TrackSlot, (0, _extends2.default)({}, trackProps)), marks.filter(mark => mark.value >= min && mark.value <= max).map((mark, index) => {
|
|
603
|
-
const percent = valueToPercent(mark.value, min, max);
|
|
603
|
+
const percent = (0, _useSlider.valueToPercent)(mark.value, min, max);
|
|
604
604
|
const style = axisProps[axis].offset(percent);
|
|
605
605
|
let markActive;
|
|
606
606
|
if (track === false) {
|
|
@@ -628,11 +628,13 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
628
628
|
})) : null]
|
|
629
629
|
}, index);
|
|
630
630
|
}), values.map((value, index) => {
|
|
631
|
-
const percent = valueToPercent(value, min, max);
|
|
631
|
+
const percent = (0, _useSlider.valueToPercent)(value, min, max);
|
|
632
632
|
const style = axisProps[axis].offset(percent);
|
|
633
633
|
const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
|
|
634
|
-
return
|
|
635
|
-
|
|
634
|
+
return (
|
|
635
|
+
/*#__PURE__*/
|
|
636
|
+
/* TODO v6: Change component structure. It will help in avoiding the complicated React.cloneElement API added in SliderValueLabel component. Should be: Thumb -> Input, ValueLabel. Follow Joy UI's Slider structure. */
|
|
637
|
+
(0, _jsxRuntime.jsx)(ValueLabelComponent, (0, _extends2.default)({}, !(0, _base.isHostComponent)(ValueLabelComponent) && {
|
|
636
638
|
valueLabelFormat,
|
|
637
639
|
valueLabelDisplay,
|
|
638
640
|
value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
|
|
@@ -641,8 +643,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
641
643
|
disabled
|
|
642
644
|
}, valueLabelProps, {
|
|
643
645
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThumbSlot, (0, _extends2.default)({
|
|
644
|
-
"data-index": index
|
|
645
|
-
"data-focusvisible": focusedThumbIndex === index
|
|
646
|
+
"data-index": index
|
|
646
647
|
}, thumbProps, {
|
|
647
648
|
className: (0, _clsx.default)(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
|
|
648
649
|
style: (0, _extends2.default)({}, style, {
|
|
@@ -657,8 +658,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
657
658
|
value: values[index]
|
|
658
659
|
}, inputSliderProps))
|
|
659
660
|
}))
|
|
660
|
-
}))
|
|
661
|
-
|
|
661
|
+
}), index)
|
|
662
|
+
);
|
|
662
663
|
})]
|
|
663
664
|
}));
|
|
664
665
|
});
|
|
@@ -699,6 +700,10 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
699
700
|
* Override or extend the styles applied to the component.
|
|
700
701
|
*/
|
|
701
702
|
classes: _propTypes.default.object,
|
|
703
|
+
/**
|
|
704
|
+
* @ignore
|
|
705
|
+
*/
|
|
706
|
+
className: _propTypes.default.string,
|
|
702
707
|
/**
|
|
703
708
|
* The color of the component.
|
|
704
709
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -9,13 +9,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
12
|
var _base = require("@mui/base");
|
|
14
13
|
var _ClickAwayListener = _interopRequireDefault(require("@mui/base/ClickAwayListener"));
|
|
14
|
+
var _useSnackbar = _interopRequireDefault(require("@mui/base/useSnackbar"));
|
|
15
15
|
var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
16
16
|
var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
|
|
17
17
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
18
|
-
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
|
19
18
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
20
19
|
var _Grow = _interopRequireDefault(require("../Grow"));
|
|
21
20
|
var _SnackbarContent = _interopRequireDefault(require("../SnackbarContent"));
|
|
@@ -109,13 +108,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
109
108
|
ContentProps,
|
|
110
109
|
disableWindowBlurListener = false,
|
|
111
110
|
message,
|
|
112
|
-
onBlur,
|
|
113
|
-
onClose,
|
|
114
|
-
onFocus,
|
|
115
|
-
onMouseEnter,
|
|
116
|
-
onMouseLeave,
|
|
117
111
|
open,
|
|
118
|
-
resumeHideDuration,
|
|
119
112
|
TransitionComponent = _Grow.default,
|
|
120
113
|
transitionDuration = defaultTransitionDuration,
|
|
121
114
|
TransitionProps: {
|
|
@@ -129,76 +122,27 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
129
122
|
anchorOrigin: {
|
|
130
123
|
vertical,
|
|
131
124
|
horizontal
|
|
132
|
-
}
|
|
125
|
+
},
|
|
126
|
+
autoHideDuration,
|
|
127
|
+
disableWindowBlurListener,
|
|
128
|
+
TransitionComponent,
|
|
129
|
+
transitionDuration
|
|
133
130
|
});
|
|
134
131
|
const classes = useUtilityClasses(ownerState);
|
|
135
|
-
const
|
|
132
|
+
const {
|
|
133
|
+
getRootProps,
|
|
134
|
+
onClickAway
|
|
135
|
+
} = (0, _useSnackbar.default)((0, _extends2.default)({}, ownerState, {
|
|
136
|
+
ref
|
|
137
|
+
}));
|
|
136
138
|
const [exited, setExited] = React.useState(true);
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
const rootProps = (0, _base.useSlotProps)({
|
|
140
|
+
elementType: SnackbarRoot,
|
|
141
|
+
getSlotProps: getRootProps,
|
|
142
|
+
externalForwardedProps: other,
|
|
143
|
+
ownerState,
|
|
144
|
+
className: [classes.root, className]
|
|
141
145
|
});
|
|
142
|
-
const setAutoHideTimer = (0, _useEventCallback.default)(autoHideDurationParam => {
|
|
143
|
-
if (!onClose || autoHideDurationParam == null) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
clearTimeout(timerAutoHide.current);
|
|
147
|
-
timerAutoHide.current = setTimeout(() => {
|
|
148
|
-
handleClose(null, 'timeout');
|
|
149
|
-
}, autoHideDurationParam);
|
|
150
|
-
});
|
|
151
|
-
React.useEffect(() => {
|
|
152
|
-
if (open) {
|
|
153
|
-
setAutoHideTimer(autoHideDuration);
|
|
154
|
-
}
|
|
155
|
-
return () => {
|
|
156
|
-
clearTimeout(timerAutoHide.current);
|
|
157
|
-
};
|
|
158
|
-
}, [open, autoHideDuration, setAutoHideTimer]);
|
|
159
|
-
|
|
160
|
-
// Pause the timer when the user is interacting with the Snackbar
|
|
161
|
-
// or when the user hide the window.
|
|
162
|
-
const handlePause = () => {
|
|
163
|
-
clearTimeout(timerAutoHide.current);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// Restart the timer when the user is no longer interacting with the Snackbar
|
|
167
|
-
// or when the window is shown back.
|
|
168
|
-
const handleResume = React.useCallback(() => {
|
|
169
|
-
if (autoHideDuration != null) {
|
|
170
|
-
setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5);
|
|
171
|
-
}
|
|
172
|
-
}, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
|
|
173
|
-
const handleFocus = event => {
|
|
174
|
-
if (onFocus) {
|
|
175
|
-
onFocus(event);
|
|
176
|
-
}
|
|
177
|
-
handlePause();
|
|
178
|
-
};
|
|
179
|
-
const handleMouseEnter = event => {
|
|
180
|
-
if (onMouseEnter) {
|
|
181
|
-
onMouseEnter(event);
|
|
182
|
-
}
|
|
183
|
-
handlePause();
|
|
184
|
-
};
|
|
185
|
-
const handleBlur = event => {
|
|
186
|
-
if (onBlur) {
|
|
187
|
-
onBlur(event);
|
|
188
|
-
}
|
|
189
|
-
handleResume();
|
|
190
|
-
};
|
|
191
|
-
const handleMouseLeave = event => {
|
|
192
|
-
if (onMouseLeave) {
|
|
193
|
-
onMouseLeave(event);
|
|
194
|
-
}
|
|
195
|
-
handleResume();
|
|
196
|
-
};
|
|
197
|
-
const handleClickAway = event => {
|
|
198
|
-
if (onClose) {
|
|
199
|
-
onClose(event, 'clickaway');
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
146
|
const handleExited = node => {
|
|
203
147
|
setExited(true);
|
|
204
148
|
if (onExited) {
|
|
@@ -211,63 +155,15 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
211
155
|
onEnter(node, isAppearing);
|
|
212
156
|
}
|
|
213
157
|
};
|
|
214
|
-
React.useEffect(() => {
|
|
215
|
-
// TODO: window global should be refactored here
|
|
216
|
-
if (!disableWindowBlurListener && open) {
|
|
217
|
-
window.addEventListener('focus', handleResume);
|
|
218
|
-
window.addEventListener('blur', handlePause);
|
|
219
|
-
return () => {
|
|
220
|
-
window.removeEventListener('focus', handleResume);
|
|
221
|
-
window.removeEventListener('blur', handlePause);
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
return undefined;
|
|
225
|
-
}, [disableWindowBlurListener, handleResume, open]);
|
|
226
|
-
React.useEffect(() => {
|
|
227
|
-
if (!open) {
|
|
228
|
-
return undefined;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @param {KeyboardEvent} nativeEvent
|
|
233
|
-
*/
|
|
234
|
-
function handleKeyDown(nativeEvent) {
|
|
235
|
-
if (!nativeEvent.defaultPrevented) {
|
|
236
|
-
// IE11, Edge (prior to using Bink?) use 'Esc'
|
|
237
|
-
if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
|
|
238
|
-
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
|
239
|
-
if (onClose) {
|
|
240
|
-
onClose(nativeEvent, 'escapeKeyDown');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
246
|
-
return () => {
|
|
247
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
248
|
-
};
|
|
249
|
-
}, [exited, open, onClose]);
|
|
250
158
|
|
|
251
159
|
// So we only render active snackbars.
|
|
252
160
|
if (!open && exited) {
|
|
253
161
|
return null;
|
|
254
162
|
}
|
|
255
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayListener.default, (0, _extends2.default)({
|
|
256
|
-
onClickAway:
|
|
164
|
+
onClickAway: onClickAway
|
|
257
165
|
}, ClickAwayListenerProps, {
|
|
258
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SnackbarRoot, (0, _extends2.default)({
|
|
259
|
-
className: (0, _clsx.default)(classes.root, className),
|
|
260
|
-
onBlur: handleBlur,
|
|
261
|
-
onFocus: handleFocus,
|
|
262
|
-
onMouseEnter: handleMouseEnter,
|
|
263
|
-
onMouseLeave: handleMouseLeave,
|
|
264
|
-
ownerState: ownerState,
|
|
265
|
-
ref: ref
|
|
266
|
-
// ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
|
|
267
|
-
// See https://github.com/mui/material-ui/issues/29080
|
|
268
|
-
,
|
|
269
|
-
role: "presentation"
|
|
270
|
-
}, other, {
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SnackbarRoot, (0, _extends2.default)({}, rootProps, {
|
|
271
167
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionComponent, (0, _extends2.default)({
|
|
272
168
|
appear: true,
|
|
273
169
|
in: open,
|