@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/legacy/Modal/Modal.js
CHANGED
|
@@ -2,6 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import ModalUnstyled, { modalUnstyledClasses } from '@mui/base/ModalUnstyled';
|
|
6
7
|
import { isHostComponent, resolveComponentProps } from '@mui/base/utils';
|
|
7
8
|
import { elementAcceptingRef, HTMLElementType } from '@mui/utils';
|
|
@@ -10,9 +11,6 @@ import useThemeProps from '../styles/useThemeProps';
|
|
|
10
11
|
import Backdrop from '../Backdrop';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
export var modalClasses = modalUnstyledClasses;
|
|
13
|
-
var extendUtilityClasses = function extendUtilityClasses(ownerState) {
|
|
14
|
-
return ownerState.classes;
|
|
15
|
-
};
|
|
16
14
|
var ModalRoot = styled('div', {
|
|
17
15
|
name: 'MuiModal',
|
|
18
16
|
slot: 'Root',
|
|
@@ -66,6 +64,8 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
66
64
|
var _props$BackdropCompon = props.BackdropComponent,
|
|
67
65
|
BackdropComponent = _props$BackdropCompon === void 0 ? ModalBackdrop : _props$BackdropCompon,
|
|
68
66
|
BackdropProps = props.BackdropProps,
|
|
67
|
+
classes = props.classes,
|
|
68
|
+
className = props.className,
|
|
69
69
|
_props$closeAfterTran = props.closeAfterTransition,
|
|
70
70
|
closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,
|
|
71
71
|
children = props.children,
|
|
@@ -93,7 +93,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
93
93
|
slotProps = props.slotProps,
|
|
94
94
|
slots = props.slots,
|
|
95
95
|
theme = props.theme,
|
|
96
|
-
other = _objectWithoutProperties(props, ["BackdropComponent", "BackdropProps", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "slotProps", "slots", "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"]);
|
|
97
97
|
var _React$useState = React.useState(true),
|
|
98
98
|
exited = _React$useState[0],
|
|
99
99
|
setExited = _React$useState[1];
|
|
@@ -111,7 +111,6 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
111
111
|
var ownerState = _extends({}, props, commonProps, {
|
|
112
112
|
exited: exited
|
|
113
113
|
});
|
|
114
|
-
var classes = extendUtilityClasses(ownerState);
|
|
115
114
|
var RootSlot = (_ref2 = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref2 : ModalRoot;
|
|
116
115
|
var BackdropSlot = (_ref3 = (_slots$backdrop = slots == null ? void 0 : slots.backdrop) != null ? _slots$backdrop : components.Backdrop) != null ? _ref3 : BackdropComponent;
|
|
117
116
|
var rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
@@ -126,10 +125,14 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
126
125
|
return _extends({}, resolveComponentProps(rootSlotProps, ownerState), !isHostComponent(RootSlot) && {
|
|
127
126
|
as: component,
|
|
128
127
|
theme: theme
|
|
128
|
+
}, {
|
|
129
|
+
className: clsx(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
131
|
},
|
|
131
132
|
backdrop: function backdrop() {
|
|
132
|
-
return _extends({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState)
|
|
133
|
+
return _extends({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState), {
|
|
134
|
+
className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, classes == null ? void 0 : classes.backdrop)
|
|
135
|
+
});
|
|
133
136
|
}
|
|
134
137
|
},
|
|
135
138
|
onTransitionEnter: function onTransitionEnter() {
|
|
@@ -139,9 +142,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
|
|
139
142
|
return setExited(true);
|
|
140
143
|
},
|
|
141
144
|
ref: ref
|
|
142
|
-
}, other, {
|
|
143
|
-
classes: classes
|
|
144
|
-
}, commonProps, {
|
|
145
|
+
}, other, commonProps, {
|
|
145
146
|
children: children
|
|
146
147
|
}));
|
|
147
148
|
});
|
|
@@ -178,6 +179,10 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes /* remove-proptypes */ =
|
|
|
178
179
|
* Override or extend the styles applied to the component.
|
|
179
180
|
*/
|
|
180
181
|
classes: PropTypes.object,
|
|
182
|
+
/**
|
|
183
|
+
* @ignore
|
|
184
|
+
*/
|
|
185
|
+
className: PropTypes.string,
|
|
181
186
|
/**
|
|
182
187
|
* When set to true the Modal waits until a nested Transition is completed before closing.
|
|
183
188
|
* @default false
|
|
@@ -161,7 +161,7 @@ var OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps
|
|
|
161
161
|
ownerState: ownerState,
|
|
162
162
|
className: classes.notchedOutline,
|
|
163
163
|
label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
164
|
-
children: [label, "\
|
|
164
|
+
children: [label, "\u2009", '*']
|
|
165
165
|
})) : label,
|
|
166
166
|
notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
|
|
167
167
|
});
|
package/legacy/Rating/Rating.js
CHANGED
|
@@ -44,7 +44,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
44
44
|
emptyValueFocused = ownerState.emptyValueFocused,
|
|
45
45
|
focusVisible = ownerState.focusVisible;
|
|
46
46
|
var slots = {
|
|
47
|
-
root: ['root', "size".concat(capitalize(size)), disabled && 'disabled', focusVisible && 'focusVisible', readOnly && '
|
|
47
|
+
root: ['root', "size".concat(capitalize(size)), disabled && 'disabled', focusVisible && 'focusVisible', readOnly && 'readOnly'],
|
|
48
48
|
label: ['label', 'pristine'],
|
|
49
49
|
labelEmptyValue: [emptyValueFocused && 'labelEmptyValueActive'],
|
|
50
50
|
icon: ['icon'],
|
|
@@ -459,7 +459,7 @@ var Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
459
459
|
ref: handleRef,
|
|
460
460
|
onMouseMove: handleMouseMove,
|
|
461
461
|
onMouseLeave: handleMouseLeave,
|
|
462
|
-
className: clsx(classes.root, className),
|
|
462
|
+
className: clsx(classes.root, className, readOnly && 'MuiRating-readOnly'),
|
|
463
463
|
ownerState: ownerState,
|
|
464
464
|
role: readOnly ? 'img' : null,
|
|
465
465
|
"aria-label": readOnly ? getLabelText(value) : null
|
|
@@ -336,8 +336,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
336
336
|
computeDisplay = true;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
var items = childrenArray.map(function (child
|
|
340
|
-
var _arr$, _arr$$props, _arr$2, _arr$2$props;
|
|
339
|
+
var items = childrenArray.map(function (child) {
|
|
341
340
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
342
341
|
return null;
|
|
343
342
|
}
|
|
@@ -366,25 +365,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
366
365
|
if (selected) {
|
|
367
366
|
foundMatch = true;
|
|
368
367
|
}
|
|
369
|
-
if (child.props.value === undefined) {
|
|
370
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
371
|
-
'aria-readonly': true,
|
|
372
|
-
role: 'option'
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
var isFirstSelectableElement = function isFirstSelectableElement() {
|
|
376
|
-
if (value) {
|
|
377
|
-
return selected;
|
|
378
|
-
}
|
|
379
|
-
var firstSelectableElement = arr.find(function (item) {
|
|
380
|
-
var _item$props;
|
|
381
|
-
return (item == null ? void 0 : (_item$props = item.props) == null ? void 0 : _item$props.value) !== undefined && item.props.disabled !== true;
|
|
382
|
-
});
|
|
383
|
-
if (child === firstSelectableElement) {
|
|
384
|
-
return true;
|
|
385
|
-
}
|
|
386
|
-
return selected;
|
|
387
|
-
};
|
|
388
368
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
389
369
|
'aria-selected': selected ? 'true' : 'false',
|
|
390
370
|
onClick: handleItemClick(child),
|
|
@@ -400,7 +380,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
400
380
|
}
|
|
401
381
|
},
|
|
402
382
|
role: 'option',
|
|
403
|
-
selected:
|
|
383
|
+
selected: selected,
|
|
404
384
|
value: undefined,
|
|
405
385
|
// The value is most likely not a valid HTML attribute.
|
|
406
386
|
'data-value': child.props.value // Instead, we provide it as a data attribute.
|
package/legacy/Slider/Slider.js
CHANGED
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { chainPropTypes } from '@mui/utils';
|
|
8
8
|
import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
|
-
import {
|
|
9
|
+
import useSlider, { valueToPercent } from '@mui/base/useSlider';
|
|
10
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
@@ -17,9 +17,6 @@ import SliderValueLabel from './SliderValueLabel';
|
|
|
17
17
|
import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
var valueToPercent = function valueToPercent(value, min, max) {
|
|
21
|
-
return (value - min) * 100 / (max - min);
|
|
22
|
-
};
|
|
23
20
|
function Identity(x) {
|
|
24
21
|
return x;
|
|
25
22
|
}
|
|
@@ -587,7 +584,8 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
587
584
|
elementType: ThumbSlot,
|
|
588
585
|
getSlotProps: getThumbProps,
|
|
589
586
|
externalSlotProps: thumbSlotProps,
|
|
590
|
-
ownerState: _extends({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState)
|
|
587
|
+
ownerState: _extends({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState),
|
|
588
|
+
className: classes.thumb
|
|
591
589
|
});
|
|
592
590
|
var valueLabelProps = useSlotProps({
|
|
593
591
|
elementType: ValueLabelSlot,
|
|
@@ -604,7 +602,8 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
604
602
|
var markLabelProps = useSlotProps({
|
|
605
603
|
elementType: MarkLabelSlot,
|
|
606
604
|
externalSlotProps: markLabelSlotProps,
|
|
607
|
-
ownerState: ownerState
|
|
605
|
+
ownerState: ownerState,
|
|
606
|
+
className: classes.markLabel
|
|
608
607
|
});
|
|
609
608
|
var inputSliderProps = useSlotProps({
|
|
610
609
|
elementType: InputSlot,
|
|
@@ -647,8 +646,10 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
647
646
|
var percent = valueToPercent(value, min, max);
|
|
648
647
|
var style = axisProps[axis].offset(percent);
|
|
649
648
|
var ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
|
|
650
|
-
return
|
|
651
|
-
|
|
649
|
+
return (
|
|
650
|
+
/*#__PURE__*/
|
|
651
|
+
/* 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. */
|
|
652
|
+
_jsx(ValueLabelComponent, _extends({}, !isHostComponent(ValueLabelComponent) && {
|
|
652
653
|
valueLabelFormat: valueLabelFormat,
|
|
653
654
|
valueLabelDisplay: valueLabelDisplay,
|
|
654
655
|
value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
|
|
@@ -657,8 +658,7 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
657
658
|
disabled: disabled
|
|
658
659
|
}, valueLabelProps, {
|
|
659
660
|
children: /*#__PURE__*/_jsx(ThumbSlot, _extends({
|
|
660
|
-
"data-index": index
|
|
661
|
-
"data-focusvisible": focusedThumbIndex === index
|
|
661
|
+
"data-index": index
|
|
662
662
|
}, thumbProps, {
|
|
663
663
|
className: clsx(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
|
|
664
664
|
style: _extends({}, style, {
|
|
@@ -673,8 +673,8 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
673
673
|
value: values[index]
|
|
674
674
|
}, inputSliderProps))
|
|
675
675
|
}))
|
|
676
|
-
}))
|
|
677
|
-
|
|
676
|
+
}), index)
|
|
677
|
+
);
|
|
678
678
|
})]
|
|
679
679
|
}));
|
|
680
680
|
});
|
|
@@ -715,6 +715,10 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
715
715
|
* Override or extend the styles applied to the component.
|
|
716
716
|
*/
|
|
717
717
|
classes: PropTypes.object,
|
|
718
|
+
/**
|
|
719
|
+
* @ignore
|
|
720
|
+
*/
|
|
721
|
+
className: PropTypes.string,
|
|
718
722
|
/**
|
|
719
723
|
* The color of the component.
|
|
720
724
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -3,13 +3,12 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
6
|
+
import { unstable_composeClasses as composeClasses, useSlotProps } from '@mui/base';
|
|
8
7
|
import ClickAwayListener from '@mui/base/ClickAwayListener';
|
|
8
|
+
import useSnackbar from '@mui/base/useSnackbar';
|
|
9
9
|
import styled from '../styles/styled';
|
|
10
10
|
import useTheme from '../styles/useTheme';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
|
-
import useEventCallback from '../utils/useEventCallback';
|
|
13
12
|
import capitalize from '../utils/capitalize';
|
|
14
13
|
import Grow from '../Grow';
|
|
15
14
|
import SnackbarContent from '../SnackbarContent';
|
|
@@ -114,78 +113,28 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
114
113
|
anchorOrigin: {
|
|
115
114
|
vertical: vertical,
|
|
116
115
|
horizontal: horizontal
|
|
117
|
-
}
|
|
116
|
+
},
|
|
117
|
+
autoHideDuration: autoHideDuration,
|
|
118
|
+
disableWindowBlurListener: disableWindowBlurListener,
|
|
119
|
+
TransitionComponent: TransitionComponent,
|
|
120
|
+
transitionDuration: transitionDuration
|
|
118
121
|
});
|
|
119
122
|
var classes = useUtilityClasses(ownerState);
|
|
120
|
-
var
|
|
123
|
+
var _useSnackbar = useSnackbar(_extends({}, ownerState, {
|
|
124
|
+
ref: ref
|
|
125
|
+
})),
|
|
126
|
+
getRootProps = _useSnackbar.getRootProps,
|
|
127
|
+
onClickAway = _useSnackbar.onClickAway;
|
|
121
128
|
var _React$useState = React.useState(true),
|
|
122
129
|
exited = _React$useState[0],
|
|
123
130
|
setExited = _React$useState[1];
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
var rootProps = useSlotProps({
|
|
132
|
+
elementType: SnackbarRoot,
|
|
133
|
+
getSlotProps: getRootProps,
|
|
134
|
+
externalForwardedProps: other,
|
|
135
|
+
ownerState: ownerState,
|
|
136
|
+
className: [classes.root, className]
|
|
128
137
|
});
|
|
129
|
-
var setAutoHideTimer = useEventCallback(function (autoHideDurationParam) {
|
|
130
|
-
if (!onClose || autoHideDurationParam == null) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
clearTimeout(timerAutoHide.current);
|
|
134
|
-
timerAutoHide.current = setTimeout(function () {
|
|
135
|
-
handleClose(null, 'timeout');
|
|
136
|
-
}, autoHideDurationParam);
|
|
137
|
-
});
|
|
138
|
-
React.useEffect(function () {
|
|
139
|
-
if (open) {
|
|
140
|
-
setAutoHideTimer(autoHideDuration);
|
|
141
|
-
}
|
|
142
|
-
return function () {
|
|
143
|
-
clearTimeout(timerAutoHide.current);
|
|
144
|
-
};
|
|
145
|
-
}, [open, autoHideDuration, setAutoHideTimer]);
|
|
146
|
-
|
|
147
|
-
// Pause the timer when the user is interacting with the Snackbar
|
|
148
|
-
// or when the user hide the window.
|
|
149
|
-
var handlePause = function handlePause() {
|
|
150
|
-
clearTimeout(timerAutoHide.current);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// Restart the timer when the user is no longer interacting with the Snackbar
|
|
154
|
-
// or when the window is shown back.
|
|
155
|
-
var handleResume = React.useCallback(function () {
|
|
156
|
-
if (autoHideDuration != null) {
|
|
157
|
-
setAutoHideTimer(resumeHideDuration != null ? resumeHideDuration : autoHideDuration * 0.5);
|
|
158
|
-
}
|
|
159
|
-
}, [autoHideDuration, resumeHideDuration, setAutoHideTimer]);
|
|
160
|
-
var handleFocus = function handleFocus(event) {
|
|
161
|
-
if (onFocus) {
|
|
162
|
-
onFocus(event);
|
|
163
|
-
}
|
|
164
|
-
handlePause();
|
|
165
|
-
};
|
|
166
|
-
var handleMouseEnter = function handleMouseEnter(event) {
|
|
167
|
-
if (onMouseEnter) {
|
|
168
|
-
onMouseEnter(event);
|
|
169
|
-
}
|
|
170
|
-
handlePause();
|
|
171
|
-
};
|
|
172
|
-
var handleBlur = function handleBlur(event) {
|
|
173
|
-
if (onBlur) {
|
|
174
|
-
onBlur(event);
|
|
175
|
-
}
|
|
176
|
-
handleResume();
|
|
177
|
-
};
|
|
178
|
-
var handleMouseLeave = function handleMouseLeave(event) {
|
|
179
|
-
if (onMouseLeave) {
|
|
180
|
-
onMouseLeave(event);
|
|
181
|
-
}
|
|
182
|
-
handleResume();
|
|
183
|
-
};
|
|
184
|
-
var handleClickAway = function handleClickAway(event) {
|
|
185
|
-
if (onClose) {
|
|
186
|
-
onClose(event, 'clickaway');
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
138
|
var handleExited = function handleExited(node) {
|
|
190
139
|
setExited(true);
|
|
191
140
|
if (onExited) {
|
|
@@ -198,63 +147,15 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
|
|
|
198
147
|
onEnter(node, isAppearing);
|
|
199
148
|
}
|
|
200
149
|
};
|
|
201
|
-
React.useEffect(function () {
|
|
202
|
-
// TODO: window global should be refactored here
|
|
203
|
-
if (!disableWindowBlurListener && open) {
|
|
204
|
-
window.addEventListener('focus', handleResume);
|
|
205
|
-
window.addEventListener('blur', handlePause);
|
|
206
|
-
return function () {
|
|
207
|
-
window.removeEventListener('focus', handleResume);
|
|
208
|
-
window.removeEventListener('blur', handlePause);
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
return undefined;
|
|
212
|
-
}, [disableWindowBlurListener, handleResume, open]);
|
|
213
|
-
React.useEffect(function () {
|
|
214
|
-
if (!open) {
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @param {KeyboardEvent} nativeEvent
|
|
220
|
-
*/
|
|
221
|
-
function handleKeyDown(nativeEvent) {
|
|
222
|
-
if (!nativeEvent.defaultPrevented) {
|
|
223
|
-
// IE11, Edge (prior to using Bink?) use 'Esc'
|
|
224
|
-
if (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc') {
|
|
225
|
-
// not calling `preventDefault` since we don't know if people may ignore this event e.g. a permanently open snackbar
|
|
226
|
-
if (onClose) {
|
|
227
|
-
onClose(nativeEvent, 'escapeKeyDown');
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
233
|
-
return function () {
|
|
234
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
235
|
-
};
|
|
236
|
-
}, [exited, open, onClose]);
|
|
237
150
|
|
|
238
151
|
// So we only render active snackbars.
|
|
239
152
|
if (!open && exited) {
|
|
240
153
|
return null;
|
|
241
154
|
}
|
|
242
155
|
return /*#__PURE__*/_jsx(ClickAwayListener, _extends({
|
|
243
|
-
onClickAway:
|
|
156
|
+
onClickAway: onClickAway
|
|
244
157
|
}, ClickAwayListenerProps, {
|
|
245
|
-
children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({
|
|
246
|
-
className: clsx(classes.root, className),
|
|
247
|
-
onBlur: handleBlur,
|
|
248
|
-
onFocus: handleFocus,
|
|
249
|
-
onMouseEnter: handleMouseEnter,
|
|
250
|
-
onMouseLeave: handleMouseLeave,
|
|
251
|
-
ownerState: ownerState,
|
|
252
|
-
ref: ref
|
|
253
|
-
// ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
|
|
254
|
-
// See https://github.com/mui/material-ui/issues/29080
|
|
255
|
-
,
|
|
256
|
-
role: "presentation"
|
|
257
|
-
}, other, {
|
|
158
|
+
children: /*#__PURE__*/_jsx(SnackbarRoot, _extends({}, rootProps, {
|
|
258
159
|
children: /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
259
160
|
appear: true,
|
|
260
161
|
in: open,
|
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 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
|
@@ -3,12 +3,6 @@ import { unstable_createCssVarsProvider as createCssVarsProvider, unstable_style
|
|
|
3
3
|
import experimental_extendTheme from './experimental_extendTheme';
|
|
4
4
|
import createTypography from './createTypography';
|
|
5
5
|
import excludeVariablesFromRoot from './excludeVariablesFromRoot';
|
|
6
|
-
var shouldSkipGeneratingVar = function shouldSkipGeneratingVar(keys) {
|
|
7
|
-
var _keys$;
|
|
8
|
-
return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
|
|
9
|
-
// ends with sxConfig
|
|
10
|
-
keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
|
|
11
|
-
};
|
|
12
6
|
var defaultTheme = experimental_extendTheme();
|
|
13
7
|
var _createCssVarsProvide = createCssVarsProvider({
|
|
14
8
|
theme: defaultTheme,
|
|
@@ -31,10 +25,9 @@ var _createCssVarsProvide = createCssVarsProvider({
|
|
|
31
25
|
};
|
|
32
26
|
return newTheme;
|
|
33
27
|
},
|
|
34
|
-
shouldSkipGeneratingVar: shouldSkipGeneratingVar,
|
|
35
28
|
excludeVariablesFromRoot: excludeVariablesFromRoot
|
|
36
29
|
}),
|
|
37
30
|
CssVarsProvider = _createCssVarsProvide.CssVarsProvider,
|
|
38
31
|
useColorScheme = _createCssVarsProvide.useColorScheme,
|
|
39
32
|
getInitColorSchemeScript = _createCssVarsProvide.getInitColorSchemeScript;
|
|
40
|
-
export { useColorScheme, getInitColorSchemeScript,
|
|
33
|
+
export { useColorScheme, getInitColorSchemeScript, CssVarsProvider as Experimental_CssVarsProvider };
|
|
@@ -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;
|