@mui/material 5.15.5 → 5.15.7
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/Accordion/index.js +0 -2
- package/AccordionActions/index.js +0 -2
- package/AccordionDetails/index.js +0 -2
- package/AccordionSummary/index.js +0 -2
- package/Avatar/Avatar.js +33 -16
- package/AvatarGroup/AvatarGroup.js +19 -39
- package/Badge/Badge.js +2 -2
- package/ButtonBase/TouchRipple.js +9 -14
- package/CHANGELOG.md +401 -249
- package/Collapse/Collapse.js +3 -8
- package/Grow/Grow.js +3 -8
- package/PaginationItem/PaginationItem.js +1 -1
- package/PaginationItem/paginationItemClasses.d.ts +20 -4
- package/PaginationItem/paginationItemClasses.js +1 -1
- package/README.md +5 -5
- package/Rating/Rating.js +1 -0
- package/Rating/index.js +0 -2
- package/Select/Select.js +1 -1
- package/SpeedDial/SpeedDial.js +7 -12
- package/TablePagination/TablePagination.d.ts +1 -1
- package/Toolbar/index.js +0 -2
- package/Tooltip/Tooltip.js +29 -40
- package/index.js +1 -3
- package/legacy/Accordion/index.js +0 -2
- package/legacy/AccordionActions/index.js +0 -2
- package/legacy/AccordionDetails/index.js +0 -2
- package/legacy/AccordionSummary/index.js +0 -2
- package/legacy/Avatar/Avatar.js +33 -16
- package/legacy/AvatarGroup/AvatarGroup.js +6 -31
- package/legacy/Badge/Badge.js +2 -2
- package/legacy/ButtonBase/TouchRipple.js +9 -14
- package/legacy/Collapse/Collapse.js +3 -8
- package/legacy/Grow/Grow.js +3 -8
- package/legacy/PaginationItem/PaginationItem.js +1 -1
- package/legacy/PaginationItem/paginationItemClasses.js +1 -1
- package/legacy/Rating/Rating.js +1 -0
- package/legacy/Rating/index.js +0 -2
- package/legacy/Select/Select.js +1 -1
- package/legacy/SpeedDial/SpeedDial.js +7 -12
- package/legacy/Toolbar/index.js +0 -2
- package/legacy/Tooltip/Tooltip.js +29 -38
- package/legacy/index.js +1 -3
- package/legacy/zero-styled/index.js +7 -2
- package/modern/Accordion/index.js +0 -2
- package/modern/AccordionActions/index.js +0 -2
- package/modern/AccordionDetails/index.js +0 -2
- package/modern/AccordionSummary/index.js +0 -2
- package/modern/Avatar/Avatar.js +33 -16
- package/modern/AvatarGroup/AvatarGroup.js +19 -39
- package/modern/Badge/Badge.js +2 -2
- package/modern/ButtonBase/TouchRipple.js +9 -14
- package/modern/Collapse/Collapse.js +3 -8
- package/modern/Grow/Grow.js +3 -8
- package/modern/PaginationItem/PaginationItem.js +1 -1
- package/modern/PaginationItem/paginationItemClasses.js +1 -1
- package/modern/Rating/Rating.js +1 -0
- package/modern/Rating/index.js +0 -2
- package/modern/Select/Select.js +1 -1
- package/modern/SpeedDial/SpeedDial.js +7 -12
- package/modern/Toolbar/index.js +0 -2
- package/modern/Tooltip/Tooltip.js +29 -40
- package/modern/index.js +1 -3
- package/modern/zero-styled/index.js +7 -2
- package/node/Accordion/index.js +0 -1
- package/node/AccordionActions/index.js +0 -1
- package/node/AccordionDetails/index.js +0 -1
- package/node/AccordionSummary/index.js +0 -1
- package/node/Avatar/Avatar.js +33 -16
- package/node/AvatarGroup/AvatarGroup.js +19 -39
- package/node/Badge/Badge.js +2 -2
- package/node/ButtonBase/TouchRipple.js +9 -14
- package/node/Collapse/Collapse.js +2 -7
- package/node/Grow/Grow.js +2 -7
- package/node/PaginationItem/PaginationItem.js +1 -1
- package/node/PaginationItem/paginationItemClasses.js +1 -1
- package/node/Rating/Rating.js +1 -0
- package/node/Rating/index.js +0 -1
- package/node/Select/Select.js +1 -1
- package/node/SpeedDial/SpeedDial.js +6 -11
- package/node/Toolbar/index.js +0 -1
- package/node/Tooltip/Tooltip.js +28 -39
- package/node/index.js +1 -3
- package/node/zero-styled/index.js +7 -1
- package/package.json +7 -7
- package/styles/experimental_extendTheme.d.ts +3 -2
- package/umd/material-ui.development.js +400 -292
- package/umd/material-ui.production.min.js +4 -4
- package/zero-styled/index.d.ts +2 -1
- package/zero-styled/index.js +7 -2
package/Collapse/Collapse.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { Transition } from 'react-transition-group';
|
|
10
|
-
import { elementTypeAcceptingRef } from '@mui/utils';
|
|
10
|
+
import { elementTypeAcceptingRef, unstable_useTimeout as useTimeout } from '@mui/utils';
|
|
11
11
|
import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
|
|
12
12
|
import styled from '../styles/styled';
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
@@ -123,17 +123,12 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
123
123
|
});
|
|
124
124
|
const classes = useUtilityClasses(ownerState);
|
|
125
125
|
const theme = useTheme();
|
|
126
|
-
const timer =
|
|
126
|
+
const timer = useTimeout();
|
|
127
127
|
const wrapperRef = React.useRef(null);
|
|
128
128
|
const autoTransitionDuration = React.useRef();
|
|
129
129
|
const collapsedSize = typeof collapsedSizeProp === 'number' ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
130
130
|
const isHorizontal = orientation === 'horizontal';
|
|
131
131
|
const size = isHorizontal ? 'width' : 'height';
|
|
132
|
-
React.useEffect(() => {
|
|
133
|
-
return () => {
|
|
134
|
-
clearTimeout(timer.current);
|
|
135
|
-
};
|
|
136
|
-
}, []);
|
|
137
132
|
const nodeRef = React.useRef(null);
|
|
138
133
|
const handleRef = useForkRef(ref, nodeRef);
|
|
139
134
|
const normalizedTransitionCallback = callback => maybeIsAppearing => {
|
|
@@ -230,7 +225,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
|
|
|
230
225
|
});
|
|
231
226
|
const handleAddEndListener = next => {
|
|
232
227
|
if (timeout === 'auto') {
|
|
233
|
-
timer.
|
|
228
|
+
timer.start(autoTransitionDuration.current || 0, next);
|
|
234
229
|
}
|
|
235
230
|
if (addEndListener) {
|
|
236
231
|
// Old call signature before `react-transition-group` implemented `nodeRef`
|
package/Grow/Grow.js
CHANGED
|
@@ -5,7 +5,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["addEndListener", "appear", "children", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { elementAcceptingRef } from '@mui/utils';
|
|
8
|
+
import { elementAcceptingRef, unstable_useTimeout as useTimeout } from '@mui/utils';
|
|
9
9
|
import { Transition } from 'react-transition-group';
|
|
10
10
|
import useTheme from '../styles/useTheme';
|
|
11
11
|
import { getTransitionProps, reflow } from '../transitions/utils';
|
|
@@ -55,7 +55,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
|
|
|
55
55
|
TransitionComponent = Transition
|
|
56
56
|
} = props,
|
|
57
57
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
-
const timer =
|
|
58
|
+
const timer = useTimeout();
|
|
59
59
|
const autoTimeout = React.useRef();
|
|
60
60
|
const theme = useTheme();
|
|
61
61
|
const nodeRef = React.useRef(null);
|
|
@@ -144,18 +144,13 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
|
|
|
144
144
|
const handleExited = normalizedTransitionCallback(onExited);
|
|
145
145
|
const handleAddEndListener = next => {
|
|
146
146
|
if (timeout === 'auto') {
|
|
147
|
-
timer.
|
|
147
|
+
timer.start(autoTimeout.current || 0, next);
|
|
148
148
|
}
|
|
149
149
|
if (addEndListener) {
|
|
150
150
|
// Old call signature before `react-transition-group` implemented `nodeRef`
|
|
151
151
|
addEndListener(nodeRef.current, next);
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
React.useEffect(() => {
|
|
155
|
-
return () => {
|
|
156
|
-
clearTimeout(timer.current);
|
|
157
|
-
};
|
|
158
|
-
}, []);
|
|
159
154
|
return /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
160
155
|
appear: appear,
|
|
161
156
|
in: inProp,
|
|
@@ -38,7 +38,7 @@ const useUtilityClasses = ownerState => {
|
|
|
38
38
|
variant
|
|
39
39
|
} = ownerState;
|
|
40
40
|
const slots = {
|
|
41
|
-
root: ['root', `size${capitalize(size)}`, variant, shape, color !== 'standard' && `${variant}${capitalize(color)}`, disabled && 'disabled', selected && 'selected', {
|
|
41
|
+
root: ['root', `size${capitalize(size)}`, variant, shape, color !== 'standard' && `color${capitalize(color)}`, color !== 'standard' && `${variant}${capitalize(color)}`, disabled && 'disabled', selected && 'selected', {
|
|
42
42
|
page: 'page',
|
|
43
43
|
first: 'firstLast',
|
|
44
44
|
last: 'firstLast',
|
|
@@ -9,15 +9,27 @@ export interface PaginationItemClasses {
|
|
|
9
9
|
sizeLarge: string;
|
|
10
10
|
/** Styles applied to the root element if `variant="text"`. */
|
|
11
11
|
text: string;
|
|
12
|
-
/** Styles applied to the root element if `variant="text"` and `color="primary"`.
|
|
12
|
+
/** Styles applied to the root element if `variant="text"` and `color="primary"`.
|
|
13
|
+
* @deprecated Combine the [.MuiPaginationItem-text](/material-ui/api/pagination-item/#pagination-item-classes-text)
|
|
14
|
+
* and [.MuiPaginationItem-colorPrimary](/material-ui/api/pagination-item/#pagination-item-classes-colorPrimary) classes instead.
|
|
15
|
+
*/
|
|
13
16
|
textPrimary: string;
|
|
14
|
-
/** Styles applied to the root element if `variant="text"` and `color="secondary"`.
|
|
17
|
+
/** Styles applied to the root element if `variant="text"` and `color="secondary"`.
|
|
18
|
+
* @deprecated Combine the [.MuiPaginationItem-text](/material-ui/api/pagination-item/#pagination-item-classes-text)
|
|
19
|
+
* and [.MuiPaginationItem-colorSecondary](/material-ui/api/pagination-item/#pagination-item-classes-colorSecondary) classes instead.
|
|
20
|
+
*/
|
|
15
21
|
textSecondary: string;
|
|
16
22
|
/** Styles applied to the root element if `variant="outlined"`. */
|
|
17
23
|
outlined: string;
|
|
18
|
-
/** Styles applied to the root element if `variant="outlined"` and `color="primary"`.
|
|
24
|
+
/** Styles applied to the root element if `variant="outlined"` and `color="primary"`.
|
|
25
|
+
* @deprecated Combine the [.MuiPaginationItem-outlined](/material-ui/api/pagination-item/#pagination-item-classes-outlined)
|
|
26
|
+
* and [.MuiPaginationItem-colorPrimary](/material-ui/api/pagination-item/#pagination-item-classes-colorPrimary) classes instead.
|
|
27
|
+
*/
|
|
19
28
|
outlinedPrimary: string;
|
|
20
|
-
/** Styles applied to the root element if `variant="outlined"` and `color="secondary"`.
|
|
29
|
+
/** Styles applied to the root element if `variant="outlined"` and `color="secondary"`.
|
|
30
|
+
* @deprecated Combine the [.MuiPaginationItem-outlined](/material-ui/api/pagination-item/#pagination-item-classes-outlined)
|
|
31
|
+
* and [.MuiPaginationItem-colorSecondary](/material-ui/api/pagination-item/#pagination-item-classes-colorSecondary) classes instead.
|
|
32
|
+
*/
|
|
21
33
|
outlinedSecondary: string;
|
|
22
34
|
/** Styles applied to the root element if `rounded="true"`. */
|
|
23
35
|
rounded: string;
|
|
@@ -35,6 +47,10 @@ export interface PaginationItemClasses {
|
|
|
35
47
|
selected: string;
|
|
36
48
|
/** Styles applied to the icon to display. */
|
|
37
49
|
icon: string;
|
|
50
|
+
/** Styles applied to the root element if `color="primary"`. */
|
|
51
|
+
colorPrimary: string;
|
|
52
|
+
/** Styles applied to the root element if `color="secondary"`. */
|
|
53
|
+
colorSecondary: string;
|
|
38
54
|
}
|
|
39
55
|
export type PaginationItemClassKey = keyof PaginationItemClasses;
|
|
40
56
|
export declare function getPaginationItemUtilityClass(slot: string): string;
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
3
3
|
export function getPaginationItemUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiPaginationItem', slot);
|
|
5
5
|
}
|
|
6
|
-
const paginationItemClasses = generateUtilityClasses('MuiPaginationItem', ['root', 'page', 'sizeSmall', 'sizeLarge', 'text', 'textPrimary', 'textSecondary', 'outlined', 'outlinedPrimary', 'outlinedSecondary', 'rounded', 'ellipsis', 'firstLast', 'previousNext', 'focusVisible', 'disabled', 'selected', 'icon']);
|
|
6
|
+
const paginationItemClasses = generateUtilityClasses('MuiPaginationItem', ['root', 'page', 'sizeSmall', 'sizeLarge', 'text', 'textPrimary', 'textSecondary', 'outlined', 'outlinedPrimary', 'outlinedSecondary', 'rounded', 'ellipsis', 'firstLast', 'previousNext', 'focusVisible', 'disabled', 'selected', 'icon', 'colorPrimary', 'colorSecondary']);
|
|
7
7
|
export default paginationItemClasses;
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- markdownlint-disable-next-line -->
|
|
2
2
|
<p align="center">
|
|
3
|
-
<a href="https://mui.com/material-ui/" rel="noopener" target="_blank"><img width="150" height="133" src="https://mui.com/static/logo.svg" alt="Material
|
|
3
|
+
<a href="https://mui.com/material-ui/" rel="noopener" target="_blank"><img width="150" height="133" src="https://mui.com/static/logo.svg" alt="Material UI logo"></a>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
|
-
<h1 align="center">Material
|
|
6
|
+
<h1 align="center">Material UI</h1>
|
|
7
7
|
|
|
8
|
-
Material
|
|
8
|
+
Material UI is an open-source React component library that implements Google's [Material Design](https://m2.material.io/design/introduction/). It's comprehensive and can be used in production out of the box.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -26,13 +26,13 @@ Use the "material-ui" tag on Stack Overflow to make it easier for the community
|
|
|
26
26
|
|
|
27
27
|
## Examples
|
|
28
28
|
|
|
29
|
-
Our documentation features [a collection of example projects using Material
|
|
29
|
+
Our documentation features [a collection of example projects using Material UI](https://mui.com/material-ui/getting-started/example-projects/).
|
|
30
30
|
|
|
31
31
|
## Contributing
|
|
32
32
|
|
|
33
33
|
Read the [contributing guide](/CONTRIBUTING.md) to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.
|
|
34
34
|
|
|
35
|
-
Contributing to Material
|
|
35
|
+
Contributing to Material UI is about more than just issues and pull requests!
|
|
36
36
|
There are many other ways to [support MUI](https://mui.com/material-ui/getting-started/faq/#mui-is-awesome-how-can-i-support-the-project) beyond contributing to the code base.
|
|
37
37
|
|
|
38
38
|
## Changelog
|
package/Rating/Rating.js
CHANGED
|
@@ -75,6 +75,7 @@ const RatingRoot = styled('span', {
|
|
|
75
75
|
color: '#faaf00',
|
|
76
76
|
cursor: 'pointer',
|
|
77
77
|
textAlign: 'left',
|
|
78
|
+
width: 'min-content',
|
|
78
79
|
WebkitTapHighlightColor: 'transparent',
|
|
79
80
|
[`&.${ratingClasses.disabled}`]: {
|
|
80
81
|
opacity: (theme.vars || theme).palette.action.disabledOpacity,
|
package/Rating/index.js
CHANGED
package/Select/Select.js
CHANGED
|
@@ -122,7 +122,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
122
122
|
}, inputProps, {
|
|
123
123
|
classes: inputProps ? deepmerge(restOfClasses, inputProps.classes) : restOfClasses
|
|
124
124
|
}, input ? input.props.inputProps : {})
|
|
125
|
-
}, multiple && native && variant === 'outlined' ? {
|
|
125
|
+
}, (multiple && native || displayEmpty) && variant === 'outlined' ? {
|
|
126
126
|
notched: true
|
|
127
127
|
} : {}, {
|
|
128
128
|
ref: inputComponentRef,
|
package/SpeedDial/SpeedDial.js
CHANGED
|
@@ -10,7 +10,7 @@ import { isFragment } from 'react-is';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import clsx from 'clsx';
|
|
12
12
|
import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
|
|
13
|
-
import { clamp } from '@mui/utils';
|
|
13
|
+
import { clamp, unstable_useTimeout as useTimeout } from '@mui/utils';
|
|
14
14
|
import styled from '../styles/styled';
|
|
15
15
|
import useThemeProps from '../styles/useThemeProps';
|
|
16
16
|
import useTheme from '../styles/useTheme';
|
|
@@ -163,12 +163,7 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
|
|
|
163
163
|
direction
|
|
164
164
|
});
|
|
165
165
|
const classes = useUtilityClasses(ownerState);
|
|
166
|
-
const eventTimer =
|
|
167
|
-
React.useEffect(() => {
|
|
168
|
-
return () => {
|
|
169
|
-
clearTimeout(eventTimer.current);
|
|
170
|
-
};
|
|
171
|
-
}, []);
|
|
166
|
+
const eventTimer = useTimeout();
|
|
172
167
|
|
|
173
168
|
/**
|
|
174
169
|
* an index in actions.current
|
|
@@ -252,9 +247,9 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
|
|
|
252
247
|
if (event.type === 'blur' && onBlur) {
|
|
253
248
|
onBlur(event);
|
|
254
249
|
}
|
|
255
|
-
|
|
250
|
+
eventTimer.clear();
|
|
256
251
|
if (event.type === 'blur') {
|
|
257
|
-
eventTimer.
|
|
252
|
+
eventTimer.start(0, () => {
|
|
258
253
|
setOpenState(false);
|
|
259
254
|
if (onClose) {
|
|
260
255
|
onClose(event, 'blur');
|
|
@@ -271,7 +266,7 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
|
|
|
271
266
|
if (FabProps.onClick) {
|
|
272
267
|
FabProps.onClick(event);
|
|
273
268
|
}
|
|
274
|
-
|
|
269
|
+
eventTimer.clear();
|
|
275
270
|
if (open) {
|
|
276
271
|
setOpenState(false);
|
|
277
272
|
if (onClose) {
|
|
@@ -295,10 +290,10 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
|
|
|
295
290
|
// When moving the focus between two items,
|
|
296
291
|
// a chain if blur and focus event is triggered.
|
|
297
292
|
// We only handle the last event.
|
|
298
|
-
|
|
293
|
+
eventTimer.clear();
|
|
299
294
|
if (!open) {
|
|
300
295
|
// Wait for a future focus or click event
|
|
301
|
-
eventTimer.
|
|
296
|
+
eventTimer.start(0, () => {
|
|
302
297
|
setOpenState(true);
|
|
303
298
|
if (onOpen) {
|
|
304
299
|
const eventMap = {
|
|
@@ -114,7 +114,7 @@ export interface TablePaginationOwnProps extends TablePaginationBaseProps {
|
|
|
114
114
|
* Use -1 for the value with a custom label to show all the rows.
|
|
115
115
|
* @default [10, 25, 50, 100]
|
|
116
116
|
*/
|
|
117
|
-
rowsPerPageOptions?:
|
|
117
|
+
rowsPerPageOptions?: ReadonlyArray<number | { value: number; label: string }>;
|
|
118
118
|
/**
|
|
119
119
|
* Props applied to the rows per page [`Select`](/material-ui/api/select/) element.
|
|
120
120
|
*
|
package/Toolbar/index.js
CHANGED
package/Tooltip/Tooltip.js
CHANGED
|
@@ -6,7 +6,7 @@ const _excluded = ["arrow", "children", "classes", "components", "componentsProp
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import { elementAcceptingRef } from '@mui/utils';
|
|
9
|
+
import { elementAcceptingRef, unstable_useTimeout as useTimeout, unstable_Timeout as Timeout } from '@mui/utils';
|
|
10
10
|
import { unstable_composeClasses as composeClasses, appendOwnerState } from '@mui/base';
|
|
11
11
|
import { alpha } from '@mui/system';
|
|
12
12
|
import styled from '../styles/styled';
|
|
@@ -194,14 +194,14 @@ const TooltipArrow = styled('span', {
|
|
|
194
194
|
}
|
|
195
195
|
}));
|
|
196
196
|
let hystersisOpen = false;
|
|
197
|
-
|
|
197
|
+
const hystersisTimer = new Timeout();
|
|
198
198
|
let cursorPosition = {
|
|
199
199
|
x: 0,
|
|
200
200
|
y: 0
|
|
201
201
|
};
|
|
202
202
|
export function testReset() {
|
|
203
203
|
hystersisOpen = false;
|
|
204
|
-
|
|
204
|
+
hystersisTimer.clear();
|
|
205
205
|
}
|
|
206
206
|
function composeEventHandler(handler, eventHandler) {
|
|
207
207
|
return event => {
|
|
@@ -260,10 +260,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
260
260
|
const [arrowRef, setArrowRef] = React.useState(null);
|
|
261
261
|
const ignoreNonTouchEvents = React.useRef(false);
|
|
262
262
|
const disableInteractive = disableInteractiveProp || followCursor;
|
|
263
|
-
const closeTimer =
|
|
264
|
-
const enterTimer =
|
|
265
|
-
const leaveTimer =
|
|
266
|
-
const touchTimer =
|
|
263
|
+
const closeTimer = useTimeout();
|
|
264
|
+
const enterTimer = useTimeout();
|
|
265
|
+
const leaveTimer = useTimeout();
|
|
266
|
+
const touchTimer = useTimeout();
|
|
267
267
|
const [openState, setOpenState] = useControlled({
|
|
268
268
|
controlled: openProp,
|
|
269
269
|
default: false,
|
|
@@ -286,23 +286,16 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
286
286
|
}
|
|
287
287
|
const id = useId(idProp);
|
|
288
288
|
const prevUserSelect = React.useRef();
|
|
289
|
-
const stopTouchInteraction =
|
|
289
|
+
const stopTouchInteraction = useEventCallback(() => {
|
|
290
290
|
if (prevUserSelect.current !== undefined) {
|
|
291
291
|
document.body.style.WebkitUserSelect = prevUserSelect.current;
|
|
292
292
|
prevUserSelect.current = undefined;
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
React.useEffect(() =>
|
|
297
|
-
return () => {
|
|
298
|
-
clearTimeout(closeTimer.current);
|
|
299
|
-
clearTimeout(enterTimer.current);
|
|
300
|
-
clearTimeout(leaveTimer.current);
|
|
301
|
-
stopTouchInteraction();
|
|
302
|
-
};
|
|
303
|
-
}, [stopTouchInteraction]);
|
|
294
|
+
touchTimer.clear();
|
|
295
|
+
});
|
|
296
|
+
React.useEffect(() => stopTouchInteraction, [stopTouchInteraction]);
|
|
304
297
|
const handleOpen = event => {
|
|
305
|
-
|
|
298
|
+
hystersisTimer.clear();
|
|
306
299
|
hystersisOpen = true;
|
|
307
300
|
|
|
308
301
|
// The mouseover event will trigger for every nested element in the tooltip.
|
|
@@ -318,18 +311,16 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
318
311
|
* @param {React.SyntheticEvent | Event} event
|
|
319
312
|
*/
|
|
320
313
|
event => {
|
|
321
|
-
|
|
322
|
-
hystersisTimer = setTimeout(() => {
|
|
314
|
+
hystersisTimer.start(800 + leaveDelay, () => {
|
|
323
315
|
hystersisOpen = false;
|
|
324
|
-
}
|
|
316
|
+
});
|
|
325
317
|
setOpenState(false);
|
|
326
318
|
if (onClose && open) {
|
|
327
319
|
onClose(event);
|
|
328
320
|
}
|
|
329
|
-
|
|
330
|
-
closeTimer.current = setTimeout(() => {
|
|
321
|
+
closeTimer.start(theme.transitions.duration.shortest, () => {
|
|
331
322
|
ignoreNonTouchEvents.current = false;
|
|
332
|
-
}
|
|
323
|
+
});
|
|
333
324
|
});
|
|
334
325
|
const handleEnter = event => {
|
|
335
326
|
if (ignoreNonTouchEvents.current && event.type !== 'touchstart') {
|
|
@@ -342,22 +333,21 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
342
333
|
if (childNode) {
|
|
343
334
|
childNode.removeAttribute('title');
|
|
344
335
|
}
|
|
345
|
-
|
|
346
|
-
|
|
336
|
+
enterTimer.clear();
|
|
337
|
+
leaveTimer.clear();
|
|
347
338
|
if (enterDelay || hystersisOpen && enterNextDelay) {
|
|
348
|
-
enterTimer.
|
|
339
|
+
enterTimer.start(hystersisOpen ? enterNextDelay : enterDelay, () => {
|
|
349
340
|
handleOpen(event);
|
|
350
|
-
}
|
|
341
|
+
});
|
|
351
342
|
} else {
|
|
352
343
|
handleOpen(event);
|
|
353
344
|
}
|
|
354
345
|
};
|
|
355
346
|
const handleLeave = event => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
leaveTimer.current = setTimeout(() => {
|
|
347
|
+
enterTimer.clear();
|
|
348
|
+
leaveTimer.start(leaveDelay, () => {
|
|
359
349
|
handleClose(event);
|
|
360
|
-
}
|
|
350
|
+
});
|
|
361
351
|
};
|
|
362
352
|
const {
|
|
363
353
|
isFocusVisibleRef,
|
|
@@ -399,26 +389,25 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
399
389
|
const handleMouseLeave = handleLeave;
|
|
400
390
|
const handleTouchStart = event => {
|
|
401
391
|
detectTouchStart(event);
|
|
402
|
-
|
|
403
|
-
|
|
392
|
+
leaveTimer.clear();
|
|
393
|
+
closeTimer.clear();
|
|
404
394
|
stopTouchInteraction();
|
|
405
395
|
prevUserSelect.current = document.body.style.WebkitUserSelect;
|
|
406
396
|
// Prevent iOS text selection on long-tap.
|
|
407
397
|
document.body.style.WebkitUserSelect = 'none';
|
|
408
|
-
touchTimer.
|
|
398
|
+
touchTimer.start(enterTouchDelay, () => {
|
|
409
399
|
document.body.style.WebkitUserSelect = prevUserSelect.current;
|
|
410
400
|
handleEnter(event);
|
|
411
|
-
}
|
|
401
|
+
});
|
|
412
402
|
};
|
|
413
403
|
const handleTouchEnd = event => {
|
|
414
404
|
if (children.props.onTouchEnd) {
|
|
415
405
|
children.props.onTouchEnd(event);
|
|
416
406
|
}
|
|
417
407
|
stopTouchInteraction();
|
|
418
|
-
|
|
419
|
-
leaveTimer.current = setTimeout(() => {
|
|
408
|
+
leaveTimer.start(leaveTouchDelay, () => {
|
|
420
409
|
handleClose(event);
|
|
421
|
-
}
|
|
410
|
+
});
|
|
422
411
|
};
|
|
423
412
|
React.useEffect(() => {
|
|
424
413
|
if (!open) {
|
package/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/material v5.15.
|
|
2
|
+
* @mui/material v5.15.7
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
'use client';
|
|
9
|
-
|
|
10
8
|
/* eslint-disable import/export */
|
|
11
9
|
import * as colors from './colors';
|
|
12
10
|
export { colors };
|
package/legacy/Avatar/Avatar.js
CHANGED
|
@@ -30,9 +30,8 @@ var AvatarRoot = styled('div', {
|
|
|
30
30
|
return [styles.root, styles[ownerState.variant], ownerState.colorDefault && styles.colorDefault];
|
|
31
31
|
}
|
|
32
32
|
})(function (_ref) {
|
|
33
|
-
var theme = _ref.theme
|
|
34
|
-
|
|
35
|
-
return _extends({
|
|
33
|
+
var theme = _ref.theme;
|
|
34
|
+
return {
|
|
36
35
|
position: 'relative',
|
|
37
36
|
display: 'flex',
|
|
38
37
|
alignItems: 'center',
|
|
@@ -45,18 +44,36 @@ var AvatarRoot = styled('div', {
|
|
|
45
44
|
lineHeight: 1,
|
|
46
45
|
borderRadius: '50%',
|
|
47
46
|
overflow: 'hidden',
|
|
48
|
-
userSelect: 'none'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
userSelect: 'none',
|
|
48
|
+
variants: [{
|
|
49
|
+
props: {
|
|
50
|
+
variant: 'rounded'
|
|
51
|
+
},
|
|
52
|
+
style: {
|
|
53
|
+
borderRadius: (theme.vars || theme).shape.borderRadius
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
props: {
|
|
57
|
+
variant: 'square'
|
|
58
|
+
},
|
|
59
|
+
style: {
|
|
60
|
+
borderRadius: 0
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
props: {
|
|
64
|
+
colorDefault: true
|
|
65
|
+
},
|
|
66
|
+
style: _extends({
|
|
67
|
+
color: (theme.vars || theme).palette.background.default
|
|
68
|
+
}, theme.vars ? {
|
|
69
|
+
backgroundColor: theme.vars.palette.Avatar.defaultBg
|
|
70
|
+
} : _extends({
|
|
71
|
+
backgroundColor: theme.palette.grey[400]
|
|
72
|
+
}, theme.applyStyles('dark', {
|
|
73
|
+
backgroundColor: theme.palette.grey[600]
|
|
74
|
+
})))
|
|
75
|
+
}]
|
|
76
|
+
};
|
|
60
77
|
});
|
|
61
78
|
var AvatarImg = styled('img', {
|
|
62
79
|
name: 'MuiAvatar',
|
|
@@ -165,7 +182,7 @@ var Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
|
|
|
165
182
|
ownerState: ownerState,
|
|
166
183
|
className: classes.img
|
|
167
184
|
}, imgProps));
|
|
168
|
-
} else if (childrenProp != null) {
|
|
185
|
+
} else if (childrenProp != null && childrenProp !== '' && typeof childrenProp !== 'boolean') {
|
|
169
186
|
children = childrenProp;
|
|
170
187
|
} else if (hasImg && alt) {
|
|
171
188
|
children = alt[0];
|
|
@@ -34,33 +34,18 @@ var AvatarGroupRoot = styled('div', {
|
|
|
34
34
|
return _extends(_defineProperty({}, "& .".concat(avatarGroupClasses.avatar), styles.avatar), styles.root);
|
|
35
35
|
}
|
|
36
36
|
})(function (_ref) {
|
|
37
|
-
var theme = _ref.theme
|
|
37
|
+
var theme = _ref.theme,
|
|
38
|
+
ownerState = _ref.ownerState;
|
|
39
|
+
var marginValue = ownerState.spacing && SPACINGS[ownerState.spacing] !== undefined ? SPACINGS[ownerState.spacing] : -ownerState.spacing;
|
|
38
40
|
return _defineProperty(_defineProperty(_defineProperty({}, "& .".concat(avatarClasses.root), {
|
|
39
41
|
border: "2px solid ".concat((theme.vars || theme).palette.background.default),
|
|
40
42
|
boxSizing: 'content-box',
|
|
41
|
-
marginLeft: -8,
|
|
43
|
+
marginLeft: marginValue != null ? marginValue : -8,
|
|
42
44
|
'&:last-child': {
|
|
43
45
|
marginLeft: 0
|
|
44
46
|
}
|
|
45
47
|
}), "display", 'flex'), "flexDirection", 'row-reverse');
|
|
46
48
|
});
|
|
47
|
-
var AvatarGroupAvatar = styled(Avatar, {
|
|
48
|
-
name: 'MuiAvatarGroup',
|
|
49
|
-
slot: 'Avatar',
|
|
50
|
-
overridesResolver: function overridesResolver(props, styles) {
|
|
51
|
-
return styles.avatar;
|
|
52
|
-
}
|
|
53
|
-
})(function (_ref3) {
|
|
54
|
-
var theme = _ref3.theme;
|
|
55
|
-
return {
|
|
56
|
-
border: "2px solid ".concat((theme.vars || theme).palette.background.default),
|
|
57
|
-
boxSizing: 'content-box',
|
|
58
|
-
marginLeft: -8,
|
|
59
|
-
'&:last-child': {
|
|
60
|
-
marginLeft: 0
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
49
|
var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, ref) {
|
|
65
50
|
var _slotProps$additional;
|
|
66
51
|
var props = useThemeProps({
|
|
@@ -108,7 +93,6 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
108
93
|
var maxAvatars = Math.min(children.length, clampedMax - 1);
|
|
109
94
|
var extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
|
|
110
95
|
var extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : "+".concat(extraAvatars);
|
|
111
|
-
var marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
|
|
112
96
|
var additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
|
|
113
97
|
return /*#__PURE__*/_jsxs(AvatarGroupRoot, _extends({
|
|
114
98
|
as: component,
|
|
@@ -116,23 +100,14 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
116
100
|
className: clsx(classes.root, className),
|
|
117
101
|
ref: ref
|
|
118
102
|
}, other, {
|
|
119
|
-
children: [extraAvatars ? /*#__PURE__*/_jsx(
|
|
120
|
-
ownerState: ownerState,
|
|
103
|
+
children: [extraAvatars ? /*#__PURE__*/_jsx(Avatar, _extends({
|
|
121
104
|
variant: variant
|
|
122
105
|
}, additionalAvatarSlotProps, {
|
|
123
106
|
className: clsx(classes.avatar, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.className),
|
|
124
|
-
style: _extends({
|
|
125
|
-
marginLeft: marginLeft
|
|
126
|
-
}, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
|
|
127
107
|
children: extraAvatarsElement
|
|
128
|
-
})) : null, children.slice(0, maxAvatars).reverse().map(function (child
|
|
108
|
+
})) : null, children.slice(0, maxAvatars).reverse().map(function (child) {
|
|
129
109
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
130
110
|
className: clsx(child.props.className, classes.avatar),
|
|
131
|
-
style: _extends({
|
|
132
|
-
// Consistent with "&:last-child" styling for the default spacing,
|
|
133
|
-
// we do not apply custom marginLeft spacing on the last child
|
|
134
|
-
marginLeft: index === maxAvatars - 1 ? undefined : marginLeft
|
|
135
|
-
}, child.props.style),
|
|
136
111
|
variant: child.props.variant || variant
|
|
137
112
|
});
|
|
138
113
|
})]
|
package/legacy/Badge/Badge.js
CHANGED
|
@@ -11,14 +11,14 @@ import { usePreviousProps } from '@mui/utils';
|
|
|
11
11
|
import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
|
|
12
12
|
import { useBadge } from '@mui/base/useBadge';
|
|
13
13
|
import { useSlotProps } from '@mui/base';
|
|
14
|
-
import { styled } from '../zero-styled';
|
|
15
|
-
import useThemeProps from '../styles/useThemeProps';
|
|
14
|
+
import { styled, createUseThemeProps } from '../zero-styled';
|
|
16
15
|
import capitalize from '../utils/capitalize';
|
|
17
16
|
import badgeClasses, { getBadgeUtilityClass } from './badgeClasses';
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
var RADIUS_STANDARD = 10;
|
|
21
20
|
var RADIUS_DOT = 4;
|
|
21
|
+
var useThemeProps = createUseThemeProps('MuiBadge');
|
|
22
22
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
23
23
|
var color = ownerState.color,
|
|
24
24
|
anchorOrigin = ownerState.anchorOrigin,
|