@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.
Files changed (89) hide show
  1. package/Accordion/index.js +0 -2
  2. package/AccordionActions/index.js +0 -2
  3. package/AccordionDetails/index.js +0 -2
  4. package/AccordionSummary/index.js +0 -2
  5. package/Avatar/Avatar.js +33 -16
  6. package/AvatarGroup/AvatarGroup.js +19 -39
  7. package/Badge/Badge.js +2 -2
  8. package/ButtonBase/TouchRipple.js +9 -14
  9. package/CHANGELOG.md +401 -249
  10. package/Collapse/Collapse.js +3 -8
  11. package/Grow/Grow.js +3 -8
  12. package/PaginationItem/PaginationItem.js +1 -1
  13. package/PaginationItem/paginationItemClasses.d.ts +20 -4
  14. package/PaginationItem/paginationItemClasses.js +1 -1
  15. package/README.md +5 -5
  16. package/Rating/Rating.js +1 -0
  17. package/Rating/index.js +0 -2
  18. package/Select/Select.js +1 -1
  19. package/SpeedDial/SpeedDial.js +7 -12
  20. package/TablePagination/TablePagination.d.ts +1 -1
  21. package/Toolbar/index.js +0 -2
  22. package/Tooltip/Tooltip.js +29 -40
  23. package/index.js +1 -3
  24. package/legacy/Accordion/index.js +0 -2
  25. package/legacy/AccordionActions/index.js +0 -2
  26. package/legacy/AccordionDetails/index.js +0 -2
  27. package/legacy/AccordionSummary/index.js +0 -2
  28. package/legacy/Avatar/Avatar.js +33 -16
  29. package/legacy/AvatarGroup/AvatarGroup.js +6 -31
  30. package/legacy/Badge/Badge.js +2 -2
  31. package/legacy/ButtonBase/TouchRipple.js +9 -14
  32. package/legacy/Collapse/Collapse.js +3 -8
  33. package/legacy/Grow/Grow.js +3 -8
  34. package/legacy/PaginationItem/PaginationItem.js +1 -1
  35. package/legacy/PaginationItem/paginationItemClasses.js +1 -1
  36. package/legacy/Rating/Rating.js +1 -0
  37. package/legacy/Rating/index.js +0 -2
  38. package/legacy/Select/Select.js +1 -1
  39. package/legacy/SpeedDial/SpeedDial.js +7 -12
  40. package/legacy/Toolbar/index.js +0 -2
  41. package/legacy/Tooltip/Tooltip.js +29 -38
  42. package/legacy/index.js +1 -3
  43. package/legacy/zero-styled/index.js +7 -2
  44. package/modern/Accordion/index.js +0 -2
  45. package/modern/AccordionActions/index.js +0 -2
  46. package/modern/AccordionDetails/index.js +0 -2
  47. package/modern/AccordionSummary/index.js +0 -2
  48. package/modern/Avatar/Avatar.js +33 -16
  49. package/modern/AvatarGroup/AvatarGroup.js +19 -39
  50. package/modern/Badge/Badge.js +2 -2
  51. package/modern/ButtonBase/TouchRipple.js +9 -14
  52. package/modern/Collapse/Collapse.js +3 -8
  53. package/modern/Grow/Grow.js +3 -8
  54. package/modern/PaginationItem/PaginationItem.js +1 -1
  55. package/modern/PaginationItem/paginationItemClasses.js +1 -1
  56. package/modern/Rating/Rating.js +1 -0
  57. package/modern/Rating/index.js +0 -2
  58. package/modern/Select/Select.js +1 -1
  59. package/modern/SpeedDial/SpeedDial.js +7 -12
  60. package/modern/Toolbar/index.js +0 -2
  61. package/modern/Tooltip/Tooltip.js +29 -40
  62. package/modern/index.js +1 -3
  63. package/modern/zero-styled/index.js +7 -2
  64. package/node/Accordion/index.js +0 -1
  65. package/node/AccordionActions/index.js +0 -1
  66. package/node/AccordionDetails/index.js +0 -1
  67. package/node/AccordionSummary/index.js +0 -1
  68. package/node/Avatar/Avatar.js +33 -16
  69. package/node/AvatarGroup/AvatarGroup.js +19 -39
  70. package/node/Badge/Badge.js +2 -2
  71. package/node/ButtonBase/TouchRipple.js +9 -14
  72. package/node/Collapse/Collapse.js +2 -7
  73. package/node/Grow/Grow.js +2 -7
  74. package/node/PaginationItem/PaginationItem.js +1 -1
  75. package/node/PaginationItem/paginationItemClasses.js +1 -1
  76. package/node/Rating/Rating.js +1 -0
  77. package/node/Rating/index.js +0 -1
  78. package/node/Select/Select.js +1 -1
  79. package/node/SpeedDial/SpeedDial.js +6 -11
  80. package/node/Toolbar/index.js +0 -1
  81. package/node/Tooltip/Tooltip.js +28 -39
  82. package/node/index.js +1 -3
  83. package/node/zero-styled/index.js +7 -1
  84. package/package.json +7 -7
  85. package/styles/experimental_extendTheme.d.ts +3 -2
  86. package/umd/material-ui.development.js +400 -292
  87. package/umd/material-ui.production.min.js +4 -4
  88. package/zero-styled/index.d.ts +2 -1
  89. package/zero-styled/index.js +7 -2
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
8
8
  import { TransitionGroup } from 'react-transition-group';
9
9
  import clsx from 'clsx';
10
10
  import { keyframes } from '@mui/system';
11
+ import { unstable_useTimeout as useTimeout } from '@mui/utils';
11
12
  import styled from '../styles/styled';
12
13
  import useThemeProps from '../styles/useThemeProps';
13
14
  import Ripple from './Ripple';
@@ -151,18 +152,11 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
151
152
  const ignoringMouseDown = React.useRef(false);
152
153
  // We use a timer in order to only show the ripples for touch "click" like events.
153
154
  // We don't want to display the ripple for touch scroll events.
154
- const startTimer = React.useRef(0);
155
+ const startTimer = useTimeout();
155
156
 
156
157
  // This is the hook called once the previous timeout is ready.
157
158
  const startTimerCommit = React.useRef(null);
158
159
  const container = React.useRef(null);
159
- React.useEffect(() => {
160
- return () => {
161
- if (startTimer.current) {
162
- clearTimeout(startTimer.current);
163
- }
164
- };
165
- }, []);
166
160
  const startCommit = React.useCallback(params => {
167
161
  const {
168
162
  pulsate,
@@ -255,12 +249,13 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
255
249
  });
256
250
  };
257
251
  // Delay the execution of the ripple effect.
258
- startTimer.current = setTimeout(() => {
252
+ // We have to make a tradeoff with this delay value.
253
+ startTimer.start(DELAY_RIPPLE, () => {
259
254
  if (startTimerCommit.current) {
260
255
  startTimerCommit.current();
261
256
  startTimerCommit.current = null;
262
257
  }
263
- }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
258
+ });
264
259
  }
265
260
  } else {
266
261
  startCommit({
@@ -271,21 +266,21 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
271
266
  cb
272
267
  });
273
268
  }
274
- }, [centerProp, startCommit]);
269
+ }, [centerProp, startCommit, startTimer]);
275
270
  const pulsate = React.useCallback(() => {
276
271
  start({}, {
277
272
  pulsate: true
278
273
  });
279
274
  }, [start]);
280
275
  const stop = React.useCallback((event, cb) => {
281
- clearTimeout(startTimer.current);
276
+ startTimer.clear();
282
277
 
283
278
  // The touch interaction occurs too quickly.
284
279
  // We still want to show ripple effect.
285
280
  if (event?.type === 'touchend' && startTimerCommit.current) {
286
281
  startTimerCommit.current();
287
282
  startTimerCommit.current = null;
288
- startTimer.current = setTimeout(() => {
283
+ startTimer.start(0, () => {
289
284
  stop(event, cb);
290
285
  });
291
286
  return;
@@ -298,7 +293,7 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
298
293
  return oldRipples;
299
294
  });
300
295
  rippleCallback.current = cb;
301
- }, []);
296
+ }, [startTimer]);
302
297
  React.useImperativeHandle(ref, () => ({
303
298
  pulsate,
304
299
  start,
@@ -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 = React.useRef();
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.current = setTimeout(next, autoTransitionDuration.current || 0);
228
+ timer.start(autoTransitionDuration.current || 0, next);
234
229
  }
235
230
  if (addEndListener) {
236
231
  // Old call signature before `react-transition-group` implemented `nodeRef`
@@ -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 = React.useRef();
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.current = setTimeout(next, autoTimeout.current || 0);
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',
@@ -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;
@@ -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,
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './Rating';
4
2
  export { default as ratingClasses } from './ratingClasses';
5
3
  export * from './ratingClasses';
@@ -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,
@@ -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 = React.useRef();
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
- clearTimeout(eventTimer.current);
250
+ eventTimer.clear();
256
251
  if (event.type === 'blur') {
257
- eventTimer.current = setTimeout(() => {
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
- clearTimeout(eventTimer.current);
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
- clearTimeout(eventTimer.current);
293
+ eventTimer.clear();
299
294
  if (!open) {
300
295
  // Wait for a future focus or click event
301
- eventTimer.current = setTimeout(() => {
296
+ eventTimer.start(0, () => {
302
297
  setOpenState(true);
303
298
  if (onOpen) {
304
299
  const eventMap = {
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './Toolbar';
4
2
  export { default as toolbarClasses } from './toolbarClasses';
5
3
  export * from './toolbarClasses';
@@ -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
- let hystersisTimer = null;
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
- clearTimeout(hystersisTimer);
204
+ hystersisTimer.clear();
205
205
  }
206
206
  function composeEventHandler(handler, eventHandler) {
207
207
  return event => {
@@ -259,10 +259,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
259
259
  const [arrowRef, setArrowRef] = React.useState(null);
260
260
  const ignoreNonTouchEvents = React.useRef(false);
261
261
  const disableInteractive = disableInteractiveProp || followCursor;
262
- const closeTimer = React.useRef();
263
- const enterTimer = React.useRef();
264
- const leaveTimer = React.useRef();
265
- const touchTimer = React.useRef();
262
+ const closeTimer = useTimeout();
263
+ const enterTimer = useTimeout();
264
+ const leaveTimer = useTimeout();
265
+ const touchTimer = useTimeout();
266
266
  const [openState, setOpenState] = useControlled({
267
267
  controlled: openProp,
268
268
  default: false,
@@ -285,23 +285,16 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
285
285
  }
286
286
  const id = useId(idProp);
287
287
  const prevUserSelect = React.useRef();
288
- const stopTouchInteraction = React.useCallback(() => {
288
+ const stopTouchInteraction = useEventCallback(() => {
289
289
  if (prevUserSelect.current !== undefined) {
290
290
  document.body.style.WebkitUserSelect = prevUserSelect.current;
291
291
  prevUserSelect.current = undefined;
292
292
  }
293
- clearTimeout(touchTimer.current);
294
- }, []);
295
- React.useEffect(() => {
296
- return () => {
297
- clearTimeout(closeTimer.current);
298
- clearTimeout(enterTimer.current);
299
- clearTimeout(leaveTimer.current);
300
- stopTouchInteraction();
301
- };
302
- }, [stopTouchInteraction]);
293
+ touchTimer.clear();
294
+ });
295
+ React.useEffect(() => stopTouchInteraction, [stopTouchInteraction]);
303
296
  const handleOpen = event => {
304
- clearTimeout(hystersisTimer);
297
+ hystersisTimer.clear();
305
298
  hystersisOpen = true;
306
299
 
307
300
  // The mouseover event will trigger for every nested element in the tooltip.
@@ -317,18 +310,16 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
317
310
  * @param {React.SyntheticEvent | Event} event
318
311
  */
319
312
  event => {
320
- clearTimeout(hystersisTimer);
321
- hystersisTimer = setTimeout(() => {
313
+ hystersisTimer.start(800 + leaveDelay, () => {
322
314
  hystersisOpen = false;
323
- }, 800 + leaveDelay);
315
+ });
324
316
  setOpenState(false);
325
317
  if (onClose && open) {
326
318
  onClose(event);
327
319
  }
328
- clearTimeout(closeTimer.current);
329
- closeTimer.current = setTimeout(() => {
320
+ closeTimer.start(theme.transitions.duration.shortest, () => {
330
321
  ignoreNonTouchEvents.current = false;
331
- }, theme.transitions.duration.shortest);
322
+ });
332
323
  });
333
324
  const handleEnter = event => {
334
325
  if (ignoreNonTouchEvents.current && event.type !== 'touchstart') {
@@ -341,22 +332,21 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
341
332
  if (childNode) {
342
333
  childNode.removeAttribute('title');
343
334
  }
344
- clearTimeout(enterTimer.current);
345
- clearTimeout(leaveTimer.current);
335
+ enterTimer.clear();
336
+ leaveTimer.clear();
346
337
  if (enterDelay || hystersisOpen && enterNextDelay) {
347
- enterTimer.current = setTimeout(() => {
338
+ enterTimer.start(hystersisOpen ? enterNextDelay : enterDelay, () => {
348
339
  handleOpen(event);
349
- }, hystersisOpen ? enterNextDelay : enterDelay);
340
+ });
350
341
  } else {
351
342
  handleOpen(event);
352
343
  }
353
344
  };
354
345
  const handleLeave = event => {
355
- clearTimeout(enterTimer.current);
356
- clearTimeout(leaveTimer.current);
357
- leaveTimer.current = setTimeout(() => {
346
+ enterTimer.clear();
347
+ leaveTimer.start(leaveDelay, () => {
358
348
  handleClose(event);
359
- }, leaveDelay);
349
+ });
360
350
  };
361
351
  const {
362
352
  isFocusVisibleRef,
@@ -398,26 +388,25 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
398
388
  const handleMouseLeave = handleLeave;
399
389
  const handleTouchStart = event => {
400
390
  detectTouchStart(event);
401
- clearTimeout(leaveTimer.current);
402
- clearTimeout(closeTimer.current);
391
+ leaveTimer.clear();
392
+ closeTimer.clear();
403
393
  stopTouchInteraction();
404
394
  prevUserSelect.current = document.body.style.WebkitUserSelect;
405
395
  // Prevent iOS text selection on long-tap.
406
396
  document.body.style.WebkitUserSelect = 'none';
407
- touchTimer.current = setTimeout(() => {
397
+ touchTimer.start(enterTouchDelay, () => {
408
398
  document.body.style.WebkitUserSelect = prevUserSelect.current;
409
399
  handleEnter(event);
410
- }, enterTouchDelay);
400
+ });
411
401
  };
412
402
  const handleTouchEnd = event => {
413
403
  if (children.props.onTouchEnd) {
414
404
  children.props.onTouchEnd(event);
415
405
  }
416
406
  stopTouchInteraction();
417
- clearTimeout(leaveTimer.current);
418
- leaveTimer.current = setTimeout(() => {
407
+ leaveTimer.start(leaveTouchDelay, () => {
419
408
  handleClose(event);
420
- }, leaveTouchDelay);
409
+ });
421
410
  };
422
411
  React.useEffect(() => {
423
412
  if (!open) {
package/modern/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  /**
2
- * @mui/material v5.15.5
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 };
@@ -1,2 +1,7 @@
1
- // eslint-disable-next-line import/prefer-default-export
2
- export { default as styled } from '../styles/styled';
1
+ import useThemeProps from '../styles/useThemeProps';
2
+ export { default as styled } from '../styles/styled';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
+ export function createUseThemeProps(name) {
6
+ return useThemeProps;
7
+ }
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- 'use client';
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- 'use client';
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- 'use client';
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- 'use client';
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
@@ -43,9 +43,8 @@ const AvatarRoot = (0, _styled.default)('div', {
43
43
  return [styles.root, styles[ownerState.variant], ownerState.colorDefault && styles.colorDefault];
44
44
  }
45
45
  })(({
46
- theme,
47
- ownerState
48
- }) => (0, _extends2.default)({
46
+ theme
47
+ }) => ({
49
48
  position: 'relative',
50
49
  display: 'flex',
51
50
  alignItems: 'center',
@@ -58,18 +57,36 @@ const AvatarRoot = (0, _styled.default)('div', {
58
57
  lineHeight: 1,
59
58
  borderRadius: '50%',
60
59
  overflow: 'hidden',
61
- userSelect: 'none'
62
- }, ownerState.variant === 'rounded' && {
63
- borderRadius: (theme.vars || theme).shape.borderRadius
64
- }, ownerState.variant === 'square' && {
65
- borderRadius: 0
66
- }, ownerState.colorDefault && (0, _extends2.default)({
67
- color: (theme.vars || theme).palette.background.default
68
- }, theme.vars ? {
69
- backgroundColor: theme.vars.palette.Avatar.defaultBg
70
- } : {
71
- backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
72
- })));
60
+ userSelect: 'none',
61
+ variants: [{
62
+ props: {
63
+ variant: 'rounded'
64
+ },
65
+ style: {
66
+ borderRadius: (theme.vars || theme).shape.borderRadius
67
+ }
68
+ }, {
69
+ props: {
70
+ variant: 'square'
71
+ },
72
+ style: {
73
+ borderRadius: 0
74
+ }
75
+ }, {
76
+ props: {
77
+ colorDefault: true
78
+ },
79
+ style: (0, _extends2.default)({
80
+ color: (theme.vars || theme).palette.background.default
81
+ }, theme.vars ? {
82
+ backgroundColor: theme.vars.palette.Avatar.defaultBg
83
+ } : (0, _extends2.default)({
84
+ backgroundColor: theme.palette.grey[400]
85
+ }, theme.applyStyles('dark', {
86
+ backgroundColor: theme.palette.grey[600]
87
+ })))
88
+ }]
89
+ }));
73
90
  const AvatarImg = (0, _styled.default)('img', {
74
91
  name: 'MuiAvatar',
75
92
  slot: 'Img',
@@ -172,7 +189,7 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
172
189
  ownerState: ownerState,
173
190
  className: classes.img
174
191
  }, imgProps));
175
- } else if (childrenProp != null) {
192
+ } else if (childrenProp != null && childrenProp !== '' && typeof childrenProp !== 'boolean') {
176
193
  children = childrenProp;
177
194
  } else if (hasImg && alt) {
178
195
  children = alt[0];
@@ -43,33 +43,23 @@ const AvatarGroupRoot = (0, _styled.default)('div', {
43
43
  [`& .${_avatarGroupClasses.default.avatar}`]: styles.avatar
44
44
  }, styles.root)
45
45
  })(({
46
- theme
47
- }) => ({
48
- [`& .${_Avatar.avatarClasses.root}`]: {
49
- border: `2px solid ${(theme.vars || theme).palette.background.default}`,
50
- boxSizing: 'content-box',
51
- marginLeft: -8,
52
- '&:last-child': {
53
- marginLeft: 0
54
- }
55
- },
56
- display: 'flex',
57
- flexDirection: 'row-reverse'
58
- }));
59
- const AvatarGroupAvatar = (0, _styled.default)(_Avatar.default, {
60
- name: 'MuiAvatarGroup',
61
- slot: 'Avatar',
62
- overridesResolver: (props, styles) => styles.avatar
63
- })(({
64
- theme
65
- }) => ({
66
- border: `2px solid ${(theme.vars || theme).palette.background.default}`,
67
- boxSizing: 'content-box',
68
- marginLeft: -8,
69
- '&:last-child': {
70
- marginLeft: 0
71
- }
72
- }));
46
+ theme,
47
+ ownerState
48
+ }) => {
49
+ const marginValue = ownerState.spacing && SPACINGS[ownerState.spacing] !== undefined ? SPACINGS[ownerState.spacing] : -ownerState.spacing;
50
+ return {
51
+ [`& .${_Avatar.avatarClasses.root}`]: {
52
+ border: `2px solid ${(theme.vars || theme).palette.background.default}`,
53
+ boxSizing: 'content-box',
54
+ marginLeft: marginValue != null ? marginValue : -8,
55
+ '&:last-child': {
56
+ marginLeft: 0
57
+ }
58
+ },
59
+ display: 'flex',
60
+ flexDirection: 'row-reverse'
61
+ };
62
+ });
73
63
  const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, ref) {
74
64
  var _slotProps$additional;
75
65
  const props = (0, _useThemeProps.default)({
@@ -113,7 +103,6 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
113
103
  const maxAvatars = Math.min(children.length, clampedMax - 1);
114
104
  const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
115
105
  const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
116
- const marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
117
106
  const additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
118
107
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(AvatarGroupRoot, (0, _extends2.default)({
119
108
  as: component,
@@ -121,23 +110,14 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
121
110
  className: (0, _clsx.default)(classes.root, className),
122
111
  ref: ref
123
112
  }, other, {
124
- children: [extraAvatars ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarGroupAvatar, (0, _extends2.default)({
125
- ownerState: ownerState,
113
+ children: [extraAvatars ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, (0, _extends2.default)({
126
114
  variant: variant
127
115
  }, additionalAvatarSlotProps, {
128
116
  className: (0, _clsx.default)(classes.avatar, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.className),
129
- style: (0, _extends2.default)({
130
- marginLeft
131
- }, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
132
117
  children: extraAvatarsElement
133
- })) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
118
+ })) : null, children.slice(0, maxAvatars).reverse().map(child => {
134
119
  return /*#__PURE__*/React.cloneElement(child, {
135
120
  className: (0, _clsx.default)(child.props.className, classes.avatar),
136
- style: (0, _extends2.default)({
137
- // Consistent with "&:last-child" styling for the default spacing,
138
- // we do not apply custom marginLeft spacing on the last child
139
- marginLeft: index === maxAvatars - 1 ? undefined : marginLeft
140
- }, child.props.style),
141
121
  variant: child.props.variant || variant
142
122
  });
143
123
  })]
@@ -16,7 +16,6 @@ var _composeClasses = require("@mui/base/composeClasses");
16
16
  var _useBadge = require("@mui/base/useBadge");
17
17
  var _base = require("@mui/base");
18
18
  var _zeroStyled = require("../zero-styled");
19
- var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
20
19
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
21
20
  var _badgeClasses = _interopRequireWildcard(require("./badgeClasses"));
22
21
  var _jsxRuntime = require("react/jsx-runtime");
@@ -25,6 +24,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
25
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
25
  const RADIUS_STANDARD = 10;
27
26
  const RADIUS_DOT = 4;
27
+ const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiBadge');
28
28
  const useUtilityClasses = ownerState => {
29
29
  const {
30
30
  color,
@@ -227,7 +227,7 @@ const BadgeBadge = (0, _zeroStyled.styled)('span', {
227
227
  });
228
228
  const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
229
229
  var _ref, _slots$root, _ref2, _slots$badge, _slotProps$root, _slotProps$badge;
230
- const props = (0, _useThemeProps.default)({
230
+ const props = useThemeProps({
231
231
  props: inProps,
232
232
  name: 'MuiBadge'
233
233
  });