@mui/material 6.4.6 → 6.4.8

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 (54) hide show
  1. package/Accordion/Accordion.d.ts +17 -2
  2. package/Accordion/Accordion.js +18 -6
  3. package/AccordionSummary/AccordionSummary.d.ts +59 -4
  4. package/AccordionSummary/AccordionSummary.js +67 -16
  5. package/CHANGELOG.md +67 -4
  6. package/ListItemText/ListItemText.d.ts +10 -0
  7. package/ListItemText/ListItemText.js +14 -5
  8. package/Radio/Radio.js +3 -1
  9. package/Rating/Rating.d.ts +59 -1
  10. package/Rating/Rating.js +131 -45
  11. package/Snackbar/Snackbar.js +7 -1
  12. package/SpeedDial/SpeedDial.d.ts +10 -0
  13. package/SpeedDial/SpeedDial.js +40 -11
  14. package/SpeedDialAction/SpeedDialAction.js +1 -1
  15. package/TextareaAutosize/TextareaAutosize.js +26 -15
  16. package/Tooltip/Tooltip.d.ts +1 -13
  17. package/Tooltip/Tooltip.js +1 -1
  18. package/index.js +1 -1
  19. package/modern/Accordion/Accordion.js +18 -6
  20. package/modern/AccordionSummary/AccordionSummary.js +67 -16
  21. package/modern/ListItemText/ListItemText.js +14 -5
  22. package/modern/Radio/Radio.js +3 -1
  23. package/modern/Rating/Rating.js +131 -45
  24. package/modern/Snackbar/Snackbar.js +7 -1
  25. package/modern/SpeedDial/SpeedDial.js +40 -11
  26. package/modern/SpeedDialAction/SpeedDialAction.js +1 -1
  27. package/modern/TextareaAutosize/TextareaAutosize.js +26 -15
  28. package/modern/Tooltip/Tooltip.js +1 -1
  29. package/modern/index.js +1 -1
  30. package/modern/styles/ThemeProvider.js +11 -0
  31. package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
  32. package/modern/version/index.js +2 -2
  33. package/node/Accordion/Accordion.js +18 -6
  34. package/node/AccordionSummary/AccordionSummary.js +67 -16
  35. package/node/ListItemText/ListItemText.js +14 -5
  36. package/node/Radio/Radio.js +3 -1
  37. package/node/Rating/Rating.js +132 -46
  38. package/node/Snackbar/Snackbar.js +7 -1
  39. package/node/SpeedDial/SpeedDial.js +40 -11
  40. package/node/SpeedDialAction/SpeedDialAction.js +1 -1
  41. package/node/TextareaAutosize/TextareaAutosize.js +25 -14
  42. package/node/Tooltip/Tooltip.js +1 -1
  43. package/node/index.js +1 -1
  44. package/node/styles/ThemeProvider.js +11 -0
  45. package/node/useScrollTrigger/useScrollTrigger.js +3 -0
  46. package/node/version/index.js +2 -2
  47. package/package.json +6 -6
  48. package/styles/ThemeProvider.d.ts +6 -0
  49. package/styles/ThemeProvider.js +11 -0
  50. package/styles/ThemeProviderWithVars.d.ts +1 -0
  51. package/styles/index.d.ts +1 -0
  52. package/useScrollTrigger/useScrollTrigger.d.ts +1 -1
  53. package/useScrollTrigger/useScrollTrigger.js +3 -0
  54. package/version/index.js +2 -2
package/Rating/Rating.js CHANGED
@@ -17,7 +17,9 @@ import memoTheme from "../utils/memoTheme.js";
17
17
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
18
18
  import slotShouldForwardProp from "../styles/slotShouldForwardProp.js";
19
19
  import ratingClasses, { getRatingUtilityClass } from "./ratingClasses.js";
20
+ import useSlot from "../utils/useSlot.js";
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import { createElement as _createElement } from "react";
21
23
  function getDecimalPrecision(num) {
22
24
  const decimalPart = num.toString().split('.')[1];
23
25
  return decimalPart ? decimalPart.length : 0;
@@ -220,7 +222,9 @@ function RatingItem(props) {
220
222
  readOnly,
221
223
  ownerState,
222
224
  ratingValue,
223
- ratingValueRounded
225
+ ratingValueRounded,
226
+ slots = {},
227
+ slotProps = {}
224
228
  } = props;
225
229
  const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
226
230
  const isHovered = itemValue <= hover;
@@ -232,10 +236,14 @@ function RatingItem(props) {
232
236
  // Update to const id = useId(); when React 17 support is dropped.
233
237
  // More details: https://github.com/mui/material-ui/issues/40997
234
238
  const id = `${name}-${useId()}`;
235
- const container = /*#__PURE__*/_jsx(RatingIcon, {
236
- as: IconContainerComponent,
237
- value: itemValue,
239
+ const externalForwardedProps = {
240
+ slots,
241
+ slotProps
242
+ };
243
+ const [IconSlot, iconSlotProps] = useSlot('icon', {
244
+ elementType: RatingIcon,
238
245
  className: clsx(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
246
+ externalForwardedProps,
239
247
  ownerState: {
240
248
  ...ownerState,
241
249
  iconEmpty: !isFilled,
@@ -244,6 +252,29 @@ function RatingItem(props) {
244
252
  iconFocus: isFocused,
245
253
  iconActive: isActive
246
254
  },
255
+ additionalProps: {
256
+ value: itemValue
257
+ },
258
+ internalForwardedProps: {
259
+ // TODO: remove this in v7 because `IconContainerComponent` is deprecated
260
+ // only forward if `slots.icon` is NOT provided
261
+ as: IconContainerComponent
262
+ }
263
+ });
264
+ const [LabelSlot, labelSlotProps] = useSlot('label', {
265
+ elementType: RatingLabel,
266
+ externalForwardedProps,
267
+ ownerState: {
268
+ ...ownerState,
269
+ emptyValueFocused: undefined
270
+ },
271
+ additionalProps: {
272
+ style: labelProps?.style,
273
+ htmlFor: id
274
+ }
275
+ });
276
+ const container = /*#__PURE__*/_jsx(IconSlot, {
277
+ ...iconSlotProps,
247
278
  children: emptyIcon && !isFilled ? emptyIcon : icon
248
279
  });
249
280
  if (readOnly) {
@@ -253,13 +284,8 @@ function RatingItem(props) {
253
284
  });
254
285
  }
255
286
  return /*#__PURE__*/_jsxs(React.Fragment, {
256
- children: [/*#__PURE__*/_jsxs(RatingLabel, {
257
- ownerState: {
258
- ...ownerState,
259
- emptyValueFocused: undefined
260
- },
261
- htmlFor: id,
262
- ...labelProps,
287
+ children: [/*#__PURE__*/_jsxs(LabelSlot, {
288
+ ...labelSlotProps,
263
289
  children: [container, /*#__PURE__*/_jsx("span", {
264
290
  className: classes.visuallyHidden,
265
291
  children: getLabelText(itemValue)
@@ -300,7 +326,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
300
326
  ownerState: PropTypes.object.isRequired,
301
327
  ratingValue: PropTypes.number,
302
328
  ratingValueRounded: PropTypes.number,
303
- readOnly: PropTypes.bool.isRequired
329
+ readOnly: PropTypes.bool.isRequired,
330
+ slotProps: PropTypes.object,
331
+ slots: PropTypes.object
304
332
  } : void 0;
305
333
  const defaultIcon = /*#__PURE__*/_jsx(Star, {
306
334
  fontSize: "inherit"
@@ -337,6 +365,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
337
365
  readOnly = false,
338
366
  size = 'medium',
339
367
  value: valueProp,
368
+ slots = {},
369
+ slotProps = {},
340
370
  ...other
341
371
  } = props;
342
372
  const name = useId(nameProp);
@@ -474,16 +504,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
474
504
  size
475
505
  };
476
506
  const classes = useUtilityClasses(ownerState);
477
- return /*#__PURE__*/_jsxs(RatingRoot, {
478
- as: component,
507
+ const externalForwardedProps = {
508
+ slots,
509
+ slotProps
510
+ };
511
+ const [RootSlot, rootSlotProps] = useSlot('root', {
479
512
  ref: handleRef,
480
- onMouseMove: handleMouseMove,
481
- onMouseLeave: handleMouseLeave,
482
- className: clsx(classes.root, className, readOnly && 'MuiRating-readOnly'),
483
- ownerState: ownerState,
484
- role: readOnly ? 'img' : null,
485
- "aria-label": readOnly ? getLabelText(value) : null,
486
- ...other,
513
+ className: clsx(classes.root, className),
514
+ elementType: RatingRoot,
515
+ externalForwardedProps: {
516
+ ...externalForwardedProps,
517
+ ...other,
518
+ component
519
+ },
520
+ getSlotProps: handlers => ({
521
+ ...handlers,
522
+ onMouseMove: event => {
523
+ handleMouseMove(event);
524
+ handlers.onMouseMove?.(event);
525
+ },
526
+ onMouseLeave: event => {
527
+ handleMouseLeave(event);
528
+ handlers.onMouseLeave?.(event);
529
+ }
530
+ }),
531
+ ownerState,
532
+ additionalProps: {
533
+ role: readOnly ? 'img' : null,
534
+ 'aria-label': readOnly ? getLabelText(value) : null
535
+ }
536
+ });
537
+ const [LabelSlot, labelSlotProps] = useSlot('label', {
538
+ className: clsx(classes.label, classes.labelEmptyValue),
539
+ elementType: RatingLabel,
540
+ externalForwardedProps,
541
+ ownerState
542
+ });
543
+ const [DecimalSlot, decimalSlotProps] = useSlot('decimal', {
544
+ className: classes.decimal,
545
+ elementType: RatingDecimal,
546
+ externalForwardedProps,
547
+ ownerState
548
+ });
549
+ return /*#__PURE__*/_jsxs(RootSlot, {
550
+ ...rootSlotProps,
487
551
  children: [Array.from(new Array(max)).map((_, index) => {
488
552
  const itemValue = index + 1;
489
553
  const ratingItemProps = {
@@ -504,41 +568,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
504
568
  ratingValue: value,
505
569
  ratingValueRounded: valueRounded,
506
570
  readOnly,
507
- ownerState
571
+ ownerState,
572
+ slots,
573
+ slotProps
508
574
  };
509
575
  const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
510
576
  if (precision < 1) {
511
577
  const items = Array.from(new Array(1 / precision));
512
- return /*#__PURE__*/_jsx(RatingDecimal, {
513
- className: clsx(classes.decimal, isActive && classes.iconActive),
514
- ownerState: ownerState,
515
- iconActive: isActive,
516
- children: items.map(($, indexDecimal) => {
517
- const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
518
- return /*#__PURE__*/_jsx(RatingItem, {
519
- ...ratingItemProps,
520
- // The icon is already displayed as active
521
- isActive: false,
522
- itemValue: itemDecimalValue,
523
- labelProps: {
524
- style: items.length - 1 === indexDecimal ? {} : {
525
- width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
526
- overflow: 'hidden',
527
- position: 'absolute'
528
- }
578
+ return /*#__PURE__*/_createElement(DecimalSlot, {
579
+ ...decimalSlotProps,
580
+ key: itemValue,
581
+ className: clsx(decimalSlotProps.className, isActive && classes.iconActive),
582
+ iconActive: isActive
583
+ }, items.map(($, indexDecimal) => {
584
+ const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
585
+ return /*#__PURE__*/_jsx(RatingItem, {
586
+ ...ratingItemProps,
587
+ // The icon is already displayed as active
588
+ isActive: false,
589
+ itemValue: itemDecimalValue,
590
+ labelProps: {
591
+ style: items.length - 1 === indexDecimal ? {} : {
592
+ width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
593
+ overflow: 'hidden',
594
+ position: 'absolute'
529
595
  }
530
- }, itemDecimalValue);
531
- })
532
- }, itemValue);
596
+ }
597
+ }, itemDecimalValue);
598
+ }));
533
599
  }
534
600
  return /*#__PURE__*/_jsx(RatingItem, {
535
601
  ...ratingItemProps,
536
602
  isActive: isActive,
537
603
  itemValue: itemValue
538
604
  }, itemValue);
539
- }), !readOnly && !disabled && /*#__PURE__*/_jsxs(RatingLabel, {
540
- className: clsx(classes.label, classes.labelEmptyValue),
541
- ownerState: ownerState,
605
+ }), !readOnly && !disabled && /*#__PURE__*/_jsxs(LabelSlot, {
606
+ ...labelSlotProps,
542
607
  children: [/*#__PURE__*/_jsx("input", {
543
608
  className: classes.visuallyHidden,
544
609
  value: "",
@@ -622,6 +687,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
622
687
  icon: PropTypes.node,
623
688
  /**
624
689
  * The component containing the icon.
690
+ * @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
625
691
  * @default function IconContainer(props) {
626
692
  * const { value, ...other } = props;
627
693
  * return <span {...other} />;
@@ -679,6 +745,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
679
745
  * @default 'medium'
680
746
  */
681
747
  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
748
+ /**
749
+ * The props used for each slot inside.
750
+ * @default {}
751
+ */
752
+ slotProps: PropTypes.shape({
753
+ decimal: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
754
+ icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
755
+ label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
756
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
757
+ }),
758
+ /**
759
+ * The components used for each slot inside.
760
+ * @default {}
761
+ */
762
+ slots: PropTypes.shape({
763
+ decimal: PropTypes.elementType,
764
+ icon: PropTypes.elementType,
765
+ label: PropTypes.elementType,
766
+ root: PropTypes.elementType
767
+ }),
682
768
  /**
683
769
  * The system prop that allows defining system overrides as well as additional CSS styles.
684
770
  */
@@ -196,7 +196,10 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
196
196
  },
197
197
  ownerState
198
198
  });
199
- const [ClickAwaySlot, clickAwayListenerProps] = useSlot('clickAwayListener', {
199
+ const [ClickAwaySlot, {
200
+ ownerState: clickAwayOwnerStateProp,
201
+ ...clickAwayListenerProps
202
+ }] = useSlot('clickAwayListener', {
200
203
  elementType: ClickAwayListener,
201
204
  externalForwardedProps,
202
205
  getSlotProps: handlers => ({
@@ -245,6 +248,9 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
245
248
  }
246
249
  return /*#__PURE__*/_jsx(ClickAwaySlot, {
247
250
  ...clickAwayListenerProps,
251
+ ...(slots.clickAwayListener && {
252
+ ownerState: clickAwayOwnerStateProp
253
+ }),
248
254
  children: /*#__PURE__*/_jsx(Root, {
249
255
  ...rootProps,
250
256
  children: /*#__PURE__*/_jsx(TransitionSlot, {
@@ -11,6 +11,11 @@ export type CloseReason = 'toggle' | 'blur' | 'mouseLeave' | 'escapeKeyDown';
11
11
  export type OpenReason = 'toggle' | 'focus' | 'mouseEnter';
12
12
 
13
13
  export interface SpeedDialSlots {
14
+ /**
15
+ * The component that renders the root slot.
16
+ * @default 'div'
17
+ */
18
+ root: React.ElementType;
14
19
  /**
15
20
  * The component that renders the transition.
16
21
  * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
@@ -22,6 +27,11 @@ export interface SpeedDialSlots {
22
27
  export type SpeedDialSlotsAndSlotProps = CreateSlotsAndSlotProps<
23
28
  SpeedDialSlots,
24
29
  {
30
+ /**
31
+ * Props forwarded to the root slot.
32
+ * By default, the avaible props are based on div element.
33
+ */
34
+ root: SlotComponentProps<'div', React.HTMLAttributes<HTMLDivElement>, SpeedDialOwnerState>;
25
35
  /**
26
36
  * Props forwarded to the transition slot.
27
37
  * By default, the avaible props are based on the [Zoom](https://mui.com/material-ui/api/zoom/#props) component.
@@ -372,22 +372,49 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
372
372
  slots: backwardCompatibleSlots,
373
373
  slotProps: backwardCompatibleSlotProps
374
374
  };
375
+ const [RootSlot, rootSlotProps] = useSlot('root', {
376
+ elementType: SpeedDialRoot,
377
+ externalForwardedProps: {
378
+ ...externalForwardedProps,
379
+ ...other
380
+ },
381
+ ownerState,
382
+ ref,
383
+ className: clsx(classes.root, className),
384
+ additionalProps: {
385
+ role: 'presentation'
386
+ },
387
+ getSlotProps: handlers => ({
388
+ ...handlers,
389
+ onKeyDown: event => {
390
+ handlers.onKeyDown?.(event);
391
+ handleKeyDown(event);
392
+ },
393
+ onBlur: event => {
394
+ handlers.onBlur?.(event);
395
+ handleClose(event);
396
+ },
397
+ onFocus: event => {
398
+ handlers.onFocus?.(event);
399
+ handleOpen(event);
400
+ },
401
+ onMouseEnter: event => {
402
+ handlers.onMouseEnter?.(event);
403
+ handleOpen(event);
404
+ },
405
+ onMouseLeave: event => {
406
+ handlers.onMouseLeave?.(event);
407
+ handleClose(event);
408
+ }
409
+ })
410
+ });
375
411
  const [TransitionSlot, transitionProps] = useSlot('transition', {
376
412
  elementType: Zoom,
377
413
  externalForwardedProps,
378
414
  ownerState
379
415
  });
380
- return /*#__PURE__*/_jsxs(SpeedDialRoot, {
381
- className: clsx(classes.root, className),
382
- ref: ref,
383
- role: "presentation",
384
- onKeyDown: handleKeyDown,
385
- onBlur: handleClose,
386
- onFocus: handleOpen,
387
- onMouseEnter: handleOpen,
388
- onMouseLeave: handleClose,
389
- ownerState: ownerState,
390
- ...other,
416
+ return /*#__PURE__*/_jsxs(RootSlot, {
417
+ ...rootSlotProps,
391
418
  children: [/*#__PURE__*/_jsx(TransitionSlot, {
392
419
  in: !hidden,
393
420
  timeout: transitionDuration,
@@ -507,6 +534,7 @@ process.env.NODE_ENV !== "production" ? SpeedDial.propTypes /* remove-proptypes
507
534
  * @default {}
508
535
  */
509
536
  slotProps: PropTypes.shape({
537
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
510
538
  transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
511
539
  }),
512
540
  /**
@@ -514,6 +542,7 @@ process.env.NODE_ENV !== "production" ? SpeedDial.propTypes /* remove-proptypes
514
542
  * @default {}
515
543
  */
516
544
  slots: PropTypes.shape({
545
+ root: PropTypes.elementType,
517
546
  transition: PropTypes.elementType
518
547
  }),
519
548
  /**
@@ -341,7 +341,7 @@ process.env.NODE_ENV !== "production" ? SpeedDialAction.propTypes /* remove-prop
341
341
  * @default 'left'
342
342
  * @deprecated Use `slotProps.tooltip.placement` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
343
343
  */
344
- tooltipPlacement: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
344
+ tooltipPlacement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
345
345
  /**
346
346
  * Label to display in the tooltip.
347
347
  * @deprecated Use `slotProps.tooltip.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import { unstable_debounce as debounce, unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_ownerWindow as ownerWindow } from '@mui/utils';
5
+ import { unstable_debounce as debounce, unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback, unstable_ownerWindow as ownerWindow } from '@mui/utils';
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  function getStyleValue(value) {
8
8
  return parseInt(value, 10) || 0;
@@ -112,6 +112,15 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
112
112
  overflowing
113
113
  };
114
114
  }, [maxRows, minRows, props.placeholder]);
115
+ const didHeightChange = useEventCallback(() => {
116
+ const textarea = textareaRef.current;
117
+ const textareaStyles = calculateTextareaStyles();
118
+ if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
119
+ return false;
120
+ }
121
+ const outerHeightStyle = textareaStyles.outerHeightStyle;
122
+ return heightRef.current != null && heightRef.current !== outerHeightStyle;
123
+ });
115
124
  const syncHeight = React.useCallback(() => {
116
125
  const textarea = textareaRef.current;
117
126
  const textareaStyles = calculateTextareaStyles();
@@ -127,37 +136,39 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
127
136
  }, [calculateTextareaStyles]);
128
137
  const frameRef = React.useRef(-1);
129
138
  useEnhancedEffect(() => {
130
- const debounceHandleResize = debounce(() => syncHeight());
139
+ const debouncedHandleResize = debounce(syncHeight);
131
140
  const textarea = textareaRef?.current;
132
141
  if (!textarea) {
133
142
  return undefined;
134
143
  }
135
144
  const containerWindow = ownerWindow(textarea);
136
- containerWindow.addEventListener('resize', debounceHandleResize);
145
+ containerWindow.addEventListener('resize', debouncedHandleResize);
137
146
  let resizeObserver;
138
147
  if (typeof ResizeObserver !== 'undefined') {
139
148
  resizeObserver = new ResizeObserver(() => {
140
- // avoid "ResizeObserver loop completed with undelivered notifications" error
141
- // by temporarily unobserving the textarea element while manipulating the height
142
- // and reobserving one frame later
143
- resizeObserver.unobserve(textarea);
144
- cancelAnimationFrame(frameRef.current);
145
- syncHeight();
146
- frameRef.current = requestAnimationFrame(() => {
147
- resizeObserver.observe(textarea);
148
- });
149
+ if (didHeightChange()) {
150
+ // avoid "ResizeObserver loop completed with undelivered notifications" error
151
+ // by temporarily unobserving the textarea element while manipulating the height
152
+ // and reobserving one frame later
153
+ resizeObserver.unobserve(textarea);
154
+ cancelAnimationFrame(frameRef.current);
155
+ syncHeight();
156
+ frameRef.current = requestAnimationFrame(() => {
157
+ resizeObserver.observe(textarea);
158
+ });
159
+ }
149
160
  });
150
161
  resizeObserver.observe(textarea);
151
162
  }
152
163
  return () => {
153
- debounceHandleResize.clear();
164
+ debouncedHandleResize.clear();
154
165
  cancelAnimationFrame(frameRef.current);
155
- containerWindow.removeEventListener('resize', debounceHandleResize);
166
+ containerWindow.removeEventListener('resize', debouncedHandleResize);
156
167
  if (resizeObserver) {
157
168
  resizeObserver.disconnect();
158
169
  }
159
170
  };
160
- }, [calculateTextareaStyles, syncHeight]);
171
+ }, [calculateTextareaStyles, syncHeight, didHeightChange]);
161
172
  useEnhancedEffect(() => {
162
173
  syncHeight();
163
174
  });
@@ -203,19 +203,7 @@ export interface TooltipProps
203
203
  * Tooltip placement.
204
204
  * @default 'bottom'
205
205
  */
206
- placement?:
207
- | 'bottom-end'
208
- | 'bottom-start'
209
- | 'bottom'
210
- | 'left-end'
211
- | 'left-start'
212
- | 'left'
213
- | 'right-end'
214
- | 'right-start'
215
- | 'right'
216
- | 'top-end'
217
- | 'top-start'
218
- | 'top';
206
+ placement?: PopperProps['placement'];
219
207
  /**
220
208
  * The component used for the popper.
221
209
  * @deprecated use the `slots.popper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
@@ -841,7 +841,7 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes /* remove-proptypes */
841
841
  * Tooltip placement.
842
842
  * @default 'bottom'
843
843
  */
844
- placement: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
844
+ placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
845
845
  /**
846
846
  * The component used for the popper.
847
847
  * @deprecated use the `slots.popper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.4.6
2
+ * @mui/material v6.4.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -185,6 +185,20 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
185
185
  slots: backwardCompatibleSlots,
186
186
  slotProps: backwardCompatibleSlotProps
187
187
  };
188
+ const [RootSlot, rootProps] = useSlot('root', {
189
+ elementType: AccordionRoot,
190
+ externalForwardedProps: {
191
+ ...externalForwardedProps,
192
+ ...other
193
+ },
194
+ className: clsx(classes.root, className),
195
+ shouldForwardComponentProp: true,
196
+ ownerState,
197
+ ref,
198
+ additionalProps: {
199
+ square
200
+ }
201
+ });
188
202
  const [AccordionHeadingSlot, accordionProps] = useSlot('heading', {
189
203
  elementType: AccordionHeading,
190
204
  externalForwardedProps,
@@ -196,12 +210,8 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
196
210
  externalForwardedProps,
197
211
  ownerState
198
212
  });
199
- return /*#__PURE__*/_jsxs(AccordionRoot, {
200
- className: clsx(classes.root, className),
201
- ref: ref,
202
- ownerState: ownerState,
203
- square: square,
204
- ...other,
213
+ return /*#__PURE__*/_jsxs(RootSlot, {
214
+ ...rootProps,
205
215
  children: [/*#__PURE__*/_jsx(AccordionHeadingSlot, {
206
216
  ...accordionProps,
207
217
  children: /*#__PURE__*/_jsx(AccordionContext.Provider, {
@@ -281,6 +291,7 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
281
291
  */
282
292
  slotProps: PropTypes.shape({
283
293
  heading: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
294
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
284
295
  transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
285
296
  }),
286
297
  /**
@@ -289,6 +300,7 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
289
300
  */
290
301
  slots: PropTypes.shape({
291
302
  heading: PropTypes.elementType,
303
+ root: PropTypes.elementType,
292
304
  transition: PropTypes.elementType
293
305
  }),
294
306
  /**