@mui/material 5.14.1 → 5.14.3

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 (131) hide show
  1. package/Accordion/Accordion.d.ts +11 -6
  2. package/AccordionSummary/AccordionSummary.d.ts +9 -7
  3. package/AppBar/AppBar.d.ts +11 -6
  4. package/Autocomplete/Autocomplete.d.ts +20 -16
  5. package/Autocomplete/Autocomplete.js +19 -15
  6. package/Avatar/Avatar.d.ts +11 -6
  7. package/AvatarGroup/AvatarGroup.d.ts +1 -1
  8. package/Backdrop/Backdrop.d.ts +11 -6
  9. package/Badge/Badge.d.ts +11 -6
  10. package/BottomNavigation/BottomNavigation.d.ts +11 -6
  11. package/BottomNavigationAction/BottomNavigationAction.d.ts +9 -7
  12. package/Box/Box.d.ts +3 -3
  13. package/Breadcrumbs/Breadcrumbs.d.ts +11 -6
  14. package/Button/Button.d.ts +16 -14
  15. package/Button/Button.js +1 -1
  16. package/ButtonBase/ButtonBase.d.ts +17 -12
  17. package/ButtonGroup/ButtonGroup.d.ts +11 -6
  18. package/CHANGELOG.md +152 -1
  19. package/Card/Card.d.ts +11 -6
  20. package/CardActionArea/CardActionArea.d.ts +11 -6
  21. package/CardContent/CardContent.d.ts +11 -6
  22. package/CardMedia/CardMedia.d.ts +9 -7
  23. package/Chip/Chip.d.ts +11 -6
  24. package/Chip/Chip.js +0 -2
  25. package/Container/Container.d.ts +11 -6
  26. package/DialogContentText/DialogContentText.d.ts +9 -7
  27. package/DialogTitle/DialogTitle.d.ts +9 -7
  28. package/Divider/Divider.d.ts +11 -6
  29. package/Divider/Divider.js +6 -0
  30. package/Fab/Fab.d.ts +11 -6
  31. package/Fab/Fab.js +1 -1
  32. package/FormControl/FormControl.d.ts +11 -6
  33. package/FormHelperText/FormHelperText.d.ts +11 -6
  34. package/FormLabel/FormLabel.d.ts +14 -9
  35. package/Grid/Grid.d.ts +11 -6
  36. package/Icon/Icon.d.ts +11 -6
  37. package/IconButton/IconButton.d.ts +9 -7
  38. package/ImageList/ImageList.d.ts +11 -6
  39. package/ImageListItem/ImageListItem.d.ts +11 -6
  40. package/InputAdornment/InputAdornment.d.ts +11 -6
  41. package/InputLabel/InputLabel.d.ts +9 -7
  42. package/Link/Link.d.ts +11 -6
  43. package/List/List.d.ts +17 -10
  44. package/ListItem/ListItem.d.ts +9 -7
  45. package/ListItem/ListItem.js +1 -1
  46. package/ListItemButton/ListItemButton.d.ts +9 -7
  47. package/ListItemButton/ListItemButton.js +1 -1
  48. package/ListSubheader/ListSubheader.d.ts +11 -6
  49. package/Menu/Menu.d.ts +23 -2
  50. package/Menu/Menu.js +48 -10
  51. package/MenuItem/MenuItem.d.ts +11 -6
  52. package/MenuItem/MenuItem.js +1 -1
  53. package/MenuList/MenuList.d.ts +11 -6
  54. package/Modal/Modal.d.ts +11 -6
  55. package/OverridableComponent.d.ts +14 -21
  56. package/PaginationItem/PaginationItem.d.ts +12 -7
  57. package/Paper/Paper.d.ts +14 -9
  58. package/Paper/index.d.ts +1 -1
  59. package/README.md +1 -1
  60. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +11 -6
  61. package/Select/Select.d.ts +8 -8
  62. package/Select/Select.js +1 -1
  63. package/Select/SelectInput.d.ts +7 -7
  64. package/Skeleton/Skeleton.d.ts +11 -6
  65. package/Slider/Slider.d.ts +11 -6
  66. package/Stack/Stack.d.ts +11 -6
  67. package/Step/Step.d.ts +11 -6
  68. package/StepButton/StepButton.d.ts +11 -6
  69. package/Stepper/Stepper.d.ts +11 -6
  70. package/SvgIcon/SvgIcon.d.ts +11 -6
  71. package/Tab/Tab.d.ts +11 -6
  72. package/Table/Table.d.ts +11 -6
  73. package/TableBody/TableBody.d.ts +11 -6
  74. package/TableContainer/TableContainer.d.ts +11 -6
  75. package/TableFooter/TableFooter.d.ts +11 -6
  76. package/TableHead/TableHead.d.ts +11 -6
  77. package/TablePagination/TablePagination.d.ts +11 -6
  78. package/TableRow/TableRow.d.ts +11 -6
  79. package/TableSortLabel/TableSortLabel.d.ts +9 -7
  80. package/Tabs/Tabs.d.ts +11 -6
  81. package/Tabs/Tabs.js +39 -42
  82. package/ToggleButton/ToggleButton.d.ts +9 -7
  83. package/Toolbar/Toolbar.d.ts +11 -6
  84. package/Typography/Typography.d.ts +11 -6
  85. package/index.d.ts +9 -9
  86. package/index.js +1 -1
  87. package/legacy/Autocomplete/Autocomplete.js +19 -16
  88. package/legacy/Button/Button.js +1 -1
  89. package/legacy/Chip/Chip.js +0 -2
  90. package/legacy/Divider/Divider.js +6 -0
  91. package/legacy/Fab/Fab.js +1 -1
  92. package/legacy/ListItem/ListItem.js +1 -1
  93. package/legacy/ListItemButton/ListItemButton.js +1 -1
  94. package/legacy/Menu/Menu.js +49 -9
  95. package/legacy/MenuItem/MenuItem.js +1 -1
  96. package/legacy/Select/Select.js +1 -1
  97. package/legacy/Tabs/Tabs.js +48 -48
  98. package/legacy/index.js +1 -1
  99. package/modern/Autocomplete/Autocomplete.js +16 -12
  100. package/modern/Button/Button.js +1 -1
  101. package/modern/Chip/Chip.js +0 -2
  102. package/modern/Divider/Divider.js +6 -0
  103. package/modern/Fab/Fab.js +1 -1
  104. package/modern/ListItem/ListItem.js +1 -1
  105. package/modern/ListItemButton/ListItemButton.js +1 -1
  106. package/modern/Menu/Menu.js +47 -10
  107. package/modern/MenuItem/MenuItem.js +1 -1
  108. package/modern/Select/Select.js +1 -1
  109. package/modern/Tabs/Tabs.js +39 -42
  110. package/modern/index.js +1 -1
  111. package/node/Autocomplete/Autocomplete.js +19 -15
  112. package/node/Button/Button.js +1 -1
  113. package/node/Chip/Chip.js +0 -2
  114. package/node/Divider/Divider.js +6 -0
  115. package/node/Fab/Fab.js +1 -1
  116. package/node/ListItem/ListItem.js +1 -1
  117. package/node/ListItemButton/ListItemButton.js +1 -1
  118. package/node/Menu/Menu.js +47 -9
  119. package/node/MenuItem/MenuItem.js +1 -1
  120. package/node/Select/Select.js +1 -1
  121. package/node/Tabs/Tabs.js +39 -42
  122. package/node/index.js +1 -1
  123. package/package.json +6 -6
  124. package/styles/ThemeProvider.d.ts +3 -3
  125. package/styles/components.d.ts +1 -0
  126. package/styles/createTypography.d.ts +9 -10
  127. package/styles/overrides.d.ts +2 -0
  128. package/styles/props.d.ts +1 -1
  129. package/types/OverridableComponentAugmentation.d.ts +7 -7
  130. package/umd/material-ui.development.js +362 -324
  131. package/umd/material-ui.production.min.js +21 -21
@@ -286,18 +286,21 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
286
286
  var _React$useState2 = React.useState(defaultIndicatorStyle),
287
287
  indicatorStyle = _React$useState2[0],
288
288
  setIndicatorStyle = _React$useState2[1];
289
- var _React$useState3 = React.useState({
290
- start: false,
291
- end: false
292
- }),
293
- displayScroll = _React$useState3[0],
294
- setDisplayScroll = _React$useState3[1];
295
- var _React$useState4 = React.useState({
289
+ var _React$useState3 = React.useState(false),
290
+ displayStartScroll = _React$useState3[0],
291
+ setDisplayStartScroll = _React$useState3[1];
292
+ var _React$useState4 = React.useState(false),
293
+ displayEndScroll = _React$useState4[0],
294
+ setDisplayEndScroll = _React$useState4[1];
295
+ var _React$useState5 = React.useState(false),
296
+ updateScrollObserver = _React$useState5[0],
297
+ setUpdateScrollObserver = _React$useState5[1];
298
+ var _React$useState6 = React.useState({
296
299
  overflow: 'hidden',
297
300
  scrollbarWidth: 0
298
301
  }),
299
- scrollerStyle = _React$useState4[0],
300
- setScrollerStyle = _React$useState4[1];
302
+ scrollerStyle = _React$useState6[0],
303
+ setScrollerStyle = _React$useState6[1];
301
304
  var valueToIndex = new Map();
302
305
  var tabsRef = React.useRef(null);
303
306
  var tabListRef = React.useRef(null);
@@ -441,7 +444,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
441
444
  onChange: handleScrollbarSizeChange,
442
445
  className: clsx(classes.scrollableX, classes.hideScrollbar)
443
446
  }) : null;
444
- var scrollButtonsActive = displayScroll.start || displayScroll.end;
447
+ var scrollButtonsActive = displayStartScroll || displayEndScroll;
445
448
  var showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
446
449
  conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, _extends({
447
450
  slots: {
@@ -453,7 +456,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
453
456
  orientation: orientation,
454
457
  direction: isRtl ? 'right' : 'left',
455
458
  onClick: handleStartScrollClick,
456
- disabled: !displayScroll.start
459
+ disabled: !displayStartScroll
457
460
  }, TabScrollButtonProps, {
458
461
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
459
462
  })) : null;
@@ -467,7 +470,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
467
470
  orientation: orientation,
468
471
  direction: isRtl ? 'left' : 'right',
469
472
  onClick: handleEndScrollClick,
470
- disabled: !displayScroll.end
473
+ disabled: !displayEndScroll
471
474
  }, TabScrollButtonProps, {
472
475
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
473
476
  })) : null;
@@ -496,29 +499,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
496
499
  });
497
500
  var updateScrollButtonState = useEventCallback(function () {
498
501
  if (scrollable && scrollButtons !== false) {
499
- var _tabsRef$current = tabsRef.current,
500
- scrollTop = _tabsRef$current.scrollTop,
501
- scrollHeight = _tabsRef$current.scrollHeight,
502
- clientHeight = _tabsRef$current.clientHeight,
503
- scrollWidth = _tabsRef$current.scrollWidth,
504
- clientWidth = _tabsRef$current.clientWidth;
505
- var showStartScroll;
506
- var showEndScroll;
507
- if (vertical) {
508
- showStartScroll = scrollTop > 1;
509
- showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
510
- } else {
511
- var scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
512
- // use 1 for the potential rounding error with browser zooms.
513
- showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
514
- showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
515
- }
516
- if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
517
- setDisplayScroll({
518
- start: showStartScroll,
519
- end: showEndScroll
520
- });
521
- }
502
+ setUpdateScrollObserver(!updateScrollObserver);
522
503
  }
523
504
  });
524
505
  React.useEffect(function () {
@@ -531,7 +512,6 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
531
512
  // replaced by Suspense with a fallback, once React is updated to version 18
532
513
  if (tabsRef.current) {
533
514
  updateIndicatorState();
534
- updateScrollButtonState();
535
515
  }
536
516
  });
537
517
  var win = ownerWindow(tabsRef.current);
@@ -550,23 +530,44 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
550
530
  resizeObserver.disconnect();
551
531
  }
552
532
  };
553
- }, [updateIndicatorState, updateScrollButtonState]);
554
- var handleTabsScroll = React.useMemo(function () {
555
- return debounce(function () {
556
- updateScrollButtonState();
557
- });
558
- }, [updateScrollButtonState]);
533
+ }, [updateIndicatorState]);
534
+
535
+ /**
536
+ * Toggle visibility of start and end scroll buttons
537
+ * Using IntersectionObserver on first and last Tabs.
538
+ */
559
539
  React.useEffect(function () {
560
- return function () {
561
- handleTabsScroll.clear();
562
- };
563
- }, [handleTabsScroll]);
540
+ var tabListChildren = Array.from(tabListRef.current.children);
541
+ var length = tabListChildren.length;
542
+ if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
543
+ var firstTab = tabListChildren[0];
544
+ var lastTab = tabListChildren[length - 1];
545
+ var observerOptions = {
546
+ root: tabsRef.current,
547
+ threshold: 0.99
548
+ };
549
+ var handleScrollButtonStart = function handleScrollButtonStart(entries) {
550
+ setDisplayStartScroll(!entries[0].isIntersecting);
551
+ };
552
+ var firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
553
+ firstObserver.observe(firstTab);
554
+ var handleScrollButtonEnd = function handleScrollButtonEnd(entries) {
555
+ setDisplayEndScroll(!entries[0].isIntersecting);
556
+ };
557
+ var lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
558
+ lastObserver.observe(lastTab);
559
+ return function () {
560
+ firstObserver.disconnect();
561
+ lastObserver.disconnect();
562
+ };
563
+ }
564
+ return undefined;
565
+ }, [scrollable, scrollButtons, updateScrollObserver, childrenProp == null ? void 0 : childrenProp.length]);
564
566
  React.useEffect(function () {
565
567
  setMounted(true);
566
568
  }, []);
567
569
  React.useEffect(function () {
568
570
  updateIndicatorState();
569
- updateScrollButtonState();
570
571
  });
571
572
  React.useEffect(function () {
572
573
  // Don't animate on the first render.
@@ -661,7 +662,6 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
661
662
  overflow: scrollerStyle.overflow
662
663
  }, vertical ? "margin".concat(isRtl ? 'Left' : 'Right') : 'marginBottom', visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth),
663
664
  ref: tabsRef,
664
- onScroll: handleTabsScroll,
665
665
  children: [/*#__PURE__*/_jsx(FlexContainer, {
666
666
  "aria-label": ariaLabel,
667
667
  "aria-labelledby": ariaLabelledBy,
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.1
2
+ * @mui/material v5.14.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -372,6 +372,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
372
372
  props: inProps,
373
373
  name: 'MuiAutocomplete'
374
374
  });
375
+
375
376
  /* eslint-disable @typescript-eslint/no-unused-vars */
376
377
  const {
377
378
  autoComplete = false,
@@ -400,7 +401,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
400
401
  freeSolo = false,
401
402
  fullWidth = false,
402
403
  getLimitTagsText = more => `+${more}`,
403
- getOptionLabel = option => option.label ?? option,
404
+ getOptionLabel: getOptionLabelProp,
404
405
  groupBy,
405
406
  handleHomeEndKeys = !props.freeSolo,
406
407
  includeInputInList = false,
@@ -465,6 +466,8 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
465
466
  } = _getListboxProps,
466
467
  otherListboxProps = _objectWithoutPropertiesLoose(_getListboxProps, _excluded2);
467
468
  const combinedListboxRef = useForkRef(listboxRef, externalListboxRef);
469
+ const defaultGetOptionLabel = option => option.label ?? option;
470
+ const getOptionLabel = getOptionLabelProp || defaultGetOptionLabel;
468
471
 
469
472
  // If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.
470
473
  const ownerState = _extends({}, props, {
@@ -472,6 +475,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
472
475
  expanded,
473
476
  focused,
474
477
  fullWidth,
478
+ getOptionLabel,
475
479
  hasClearIcon,
476
480
  hasPopupIcon,
477
481
  inputFocused: focusedTag === -1,
@@ -775,9 +779,9 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
775
779
  * A function that determines the filtered options to be rendered on search.
776
780
  *
777
781
  * @default createFilterOptions()
778
- * @param {T[]} options The options to render.
782
+ * @param {Value[]} options The options to render.
779
783
  * @param {object} state The state of the component.
780
- * @returns {T[]}
784
+ * @returns {Value[]}
781
785
  */
782
786
  filterOptions: PropTypes.func,
783
787
  /**
@@ -811,7 +815,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
811
815
  /**
812
816
  * Used to determine the disabled state for a given option.
813
817
  *
814
- * @param {T} option The option to test.
818
+ * @param {Value} option The option to test.
815
819
  * @returns {boolean}
816
820
  */
817
821
  getOptionDisabled: PropTypes.func,
@@ -821,7 +825,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
821
825
  *
822
826
  * If used in free solo mode, it must accept both the type of the options and a string.
823
827
  *
824
- * @param {T} option
828
+ * @param {Value} option
825
829
  * @returns {string}
826
830
  * @default (option) => option.label ?? option
827
831
  */
@@ -830,7 +834,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
830
834
  * If provided, the options will be grouped under the returned string.
831
835
  * The groupBy value is also used as the text for group headings when `renderGroup` is not provided.
832
836
  *
833
- * @param {T} options The options to group.
837
+ * @param {Value} options The options to group.
834
838
  * @returns {string}
835
839
  */
836
840
  groupBy: PropTypes.func,
@@ -859,8 +863,8 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
859
863
  * Uses strict equality by default.
860
864
  * ⚠️ Both arguments need to be handled, an option can only match with one value.
861
865
  *
862
- * @param {T} option The option to test.
863
- * @param {T} value The value to test against.
866
+ * @param {Value} option The option to test.
867
+ * @param {Value} value The value to test against.
864
868
  * @returns {boolean}
865
869
  */
866
870
  isOptionEqualToValue: PropTypes.func,
@@ -908,7 +912,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
908
912
  * Callback fired when the value changes.
909
913
  *
910
914
  * @param {React.SyntheticEvent} event The event source of the callback.
911
- * @param {T|T[]} value The new value of the component.
915
+ * @param {Value|Value[]} value The new value of the component.
912
916
  * @param {string} reason One of "createOption", "selectOption", "removeOption", "blur" or "clear".
913
917
  * @param {string} [details]
914
918
  */
@@ -925,7 +929,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
925
929
  * Callback fired when the highlight option changes.
926
930
  *
927
931
  * @param {React.SyntheticEvent} event The event source of the callback.
928
- * @param {T} option The highlighted option.
932
+ * @param {Value} option The highlighted option.
929
933
  * @param {string} reason Can be: `"keyboard"`, `"auto"`, `"mouse"`, `"touch"`.
930
934
  */
931
935
  onHighlightChange: PropTypes.func,
@@ -1002,7 +1006,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1002
1006
  * Render the option, use `getOptionLabel` by default.
1003
1007
  *
1004
1008
  * @param {object} props The props to apply on the li element.
1005
- * @param {T} option The option to render.
1009
+ * @param {Value} option The option to render.
1006
1010
  * @param {object} state The state of each option.
1007
1011
  * @param {object} ownerState The state of the Autocomplete component.
1008
1012
  * @returns {ReactNode}
@@ -1011,7 +1015,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1011
1015
  /**
1012
1016
  * Render the selected value.
1013
1017
  *
1014
- * @param {T[]} value The `value` provided to the component.
1018
+ * @param {Value[]} value The `value` provided to the component.
1015
1019
  * @param {function} getTagProps A tag props getter.
1016
1020
  * @param {object} ownerState The state of the Autocomplete component.
1017
1021
  * @returns {ReactNode}
@@ -306,7 +306,7 @@ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */
306
306
  * The component used for the root node.
307
307
  * Either a string to use a HTML element or a component.
308
308
  */
309
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
309
+ component: PropTypes.elementType,
310
310
  /**
311
311
  * If `true`, the component is disabled.
312
312
  * @default false
@@ -93,8 +93,6 @@ const ChipRoot = styled('div', {
93
93
  borderRadius: 32 / 2,
94
94
  whiteSpace: 'nowrap',
95
95
  transition: theme.transitions.create(['background-color', 'box-shadow']),
96
- // label will inherit this from root, then `clickable` class overrides this for both
97
- cursor: 'default',
98
96
  // We disable the focus ring for mouse, touch and keyboard users.
99
97
  outline: 0,
100
98
  textDecoration: 'none',
@@ -179,6 +179,12 @@ const Divider = /*#__PURE__*/React.forwardRef(function Divider(inProps, ref) {
179
179
  }) : null
180
180
  }));
181
181
  });
182
+
183
+ /**
184
+ * The following flag is used to ensure that this component isn't tabbable i.e.
185
+ * does not get highlight/focus inside of MUI List.
186
+ */
187
+ Divider.muiSkipListHighlight = true;
182
188
  process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */ = {
183
189
  // ----------------------------- Warning --------------------------------
184
190
  // | These PropTypes are generated from the TypeScript type definitions |
package/modern/Fab/Fab.js CHANGED
@@ -183,7 +183,7 @@ process.env.NODE_ENV !== "production" ? Fab.propTypes /* remove-proptypes */ = {
183
183
  * The component used for the root node.
184
184
  * Either a string to use a HTML element or a component.
185
185
  */
186
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
186
+ component: PropTypes.elementType,
187
187
  /**
188
188
  * If `true`, the component is disabled.
189
189
  * @default false
@@ -314,7 +314,7 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
314
314
  * The component used for the root node.
315
315
  * Either a string to use a HTML element or a component.
316
316
  */
317
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
317
+ component: PropTypes.elementType,
318
318
  /**
319
319
  * The components used for each slot inside.
320
320
  *
@@ -193,7 +193,7 @@ process.env.NODE_ENV !== "production" ? ListItemButton.propTypes /* remove-propt
193
193
  * The component used for the root node.
194
194
  * Either a string to use a HTML element or a component.
195
195
  */
196
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
196
+ component: PropTypes.elementType,
197
197
  /**
198
198
  * If `true`, compact vertical padding designed for keyboard and mouse input is used.
199
199
  * The prop defaults to the value inherited from the parent List component.
@@ -3,12 +3,12 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["onEntering"],
6
- _excluded2 = ["autoFocus", "children", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant"];
6
+ _excluded2 = ["autoFocus", "children", "className", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant", "slots", "slotProps"];
7
7
  import * as React from 'react';
8
8
  import { isFragment } from 'react-is';
9
9
  import PropTypes from 'prop-types';
10
10
  import clsx from 'clsx';
11
- import { unstable_composeClasses as composeClasses } from '@mui/base';
11
+ import { unstable_composeClasses as composeClasses, useSlotProps } from '@mui/base';
12
12
  import { HTMLElementType } from '@mui/utils';
13
13
  import MenuList from '../MenuList';
14
14
  import Popover, { PopoverPaper } from '../Popover';
@@ -70,6 +70,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
70
70
  const {
71
71
  autoFocus = true,
72
72
  children,
73
+ className,
73
74
  disableAutoFocusItem = false,
74
75
  MenuListProps = {},
75
76
  onClose,
@@ -80,7 +81,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
80
81
  TransitionProps: {
81
82
  onEntering
82
83
  } = {},
83
- variant = 'selectedMenu'
84
+ variant = 'selectedMenu',
85
+ slots = {},
86
+ slotProps = {}
84
87
  } = props,
85
88
  TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
86
89
  other = _objectWithoutPropertiesLoose(props, _excluded2);
@@ -142,6 +145,20 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
142
145
  }
143
146
  }
144
147
  });
148
+ const PaperSlot = slots.paper ?? MenuPaper;
149
+ const paperExternalSlotProps = slotProps.paper ?? PaperProps;
150
+ const rootSlotProps = useSlotProps({
151
+ elementType: slots.root,
152
+ externalSlotProps: slotProps.root,
153
+ ownerState,
154
+ className: [classes.root, className]
155
+ });
156
+ const paperSlotProps = useSlotProps({
157
+ elementType: PaperSlot,
158
+ externalSlotProps: paperExternalSlotProps,
159
+ ownerState,
160
+ className: classes.paper
161
+ });
145
162
  return /*#__PURE__*/_jsx(MenuRoot, _extends({
146
163
  onClose: onClose,
147
164
  anchorOrigin: {
@@ -150,16 +167,13 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
150
167
  },
151
168
  transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
152
169
  slots: {
153
- paper: MenuPaper
170
+ paper: PaperSlot,
171
+ root: slots.root
154
172
  },
155
173
  slotProps: {
156
- paper: _extends({}, PaperProps, {
157
- classes: _extends({}, PaperProps.classes, {
158
- root: classes.paper
159
- })
160
- })
174
+ root: rootSlotProps,
175
+ paper: paperSlotProps
161
176
  },
162
- className: classes.root,
163
177
  open: open,
164
178
  ref: ref,
165
179
  transitionDuration: transitionDuration,
@@ -207,6 +221,10 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
207
221
  * Override or extend the styles applied to the component.
208
222
  */
209
223
  classes: PropTypes.object,
224
+ /**
225
+ * @ignore
226
+ */
227
+ className: PropTypes.string,
210
228
  /**
211
229
  * When opening the menu will not focus the active item but the `[role="menu"]`
212
230
  * unless `autoFocus` is also set to `false`. Not using the default means not
@@ -239,6 +257,25 @@ process.env.NODE_ENV !== "production" ? Menu.propTypes /* remove-proptypes */ =
239
257
  * `classes` prop applied to the [`Popover`](/material-ui/api/popover/) element.
240
258
  */
241
259
  PopoverClasses: PropTypes.object,
260
+ /**
261
+ * The extra props for the slot components.
262
+ * You can override the existing props or add new ones.
263
+ *
264
+ * @default {}
265
+ */
266
+ slotProps: PropTypes.shape({
267
+ paper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
268
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
269
+ }),
270
+ /**
271
+ * The components used for each slot inside.
272
+ *
273
+ * @default {}
274
+ */
275
+ slots: PropTypes.shape({
276
+ paper: PropTypes.elementType,
277
+ root: PropTypes.elementType
278
+ }),
242
279
  /**
243
280
  * The system prop that allows defining system overrides as well as additional CSS styles.
244
281
  */
@@ -209,7 +209,7 @@ process.env.NODE_ENV !== "production" ? MenuItem.propTypes /* remove-proptypes *
209
209
  * The component used for the root node.
210
210
  * Either a string to use a HTML element or a component.
211
211
  */
212
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
212
+ component: PropTypes.elementType,
213
213
  /**
214
214
  * If `true`, compact vertical padding designed for keyboard and mouse input is used.
215
215
  * The prop defaults to the value inherited from the parent Menu component.
@@ -222,7 +222,7 @@ process.env.NODE_ENV !== "production" ? Select.propTypes /* remove-proptypes */
222
222
  /**
223
223
  * Callback fired when a menu item is selected.
224
224
  *
225
- * @param {SelectChangeEvent<T>} event The event source of the callback.
225
+ * @param {SelectChangeEvent<Value>} event The event source of the callback.
226
226
  * You can pull out the new value by accessing `event.target.value` (any).
227
227
  * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
228
228
  * @param {object} [child] The react element that was selected when `native` is `false` (default).
@@ -280,10 +280,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
280
280
  }
281
281
  const [mounted, setMounted] = React.useState(false);
282
282
  const [indicatorStyle, setIndicatorStyle] = React.useState(defaultIndicatorStyle);
283
- const [displayScroll, setDisplayScroll] = React.useState({
284
- start: false,
285
- end: false
286
- });
283
+ const [displayStartScroll, setDisplayStartScroll] = React.useState(false);
284
+ const [displayEndScroll, setDisplayEndScroll] = React.useState(false);
285
+ const [updateScrollObserver, setUpdateScrollObserver] = React.useState(false);
287
286
  const [scrollerStyle, setScrollerStyle] = React.useState({
288
287
  overflow: 'hidden',
289
288
  scrollbarWidth: 0
@@ -434,7 +433,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
434
433
  onChange: handleScrollbarSizeChange,
435
434
  className: clsx(classes.scrollableX, classes.hideScrollbar)
436
435
  }) : null;
437
- const scrollButtonsActive = displayScroll.start || displayScroll.end;
436
+ const scrollButtonsActive = displayStartScroll || displayEndScroll;
438
437
  const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
439
438
  conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/_jsx(ScrollButtonComponent, _extends({
440
439
  slots: {
@@ -446,7 +445,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
446
445
  orientation: orientation,
447
446
  direction: isRtl ? 'right' : 'left',
448
447
  onClick: handleStartScrollClick,
449
- disabled: !displayScroll.start
448
+ disabled: !displayStartScroll
450
449
  }, TabScrollButtonProps, {
451
450
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
452
451
  })) : null;
@@ -460,7 +459,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
460
459
  orientation: orientation,
461
460
  direction: isRtl ? 'left' : 'right',
462
461
  onClick: handleEndScrollClick,
463
- disabled: !displayScroll.end
462
+ disabled: !displayEndScroll
464
463
  }, TabScrollButtonProps, {
465
464
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
466
465
  })) : null;
@@ -490,30 +489,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
490
489
  });
491
490
  const updateScrollButtonState = useEventCallback(() => {
492
491
  if (scrollable && scrollButtons !== false) {
493
- const {
494
- scrollTop,
495
- scrollHeight,
496
- clientHeight,
497
- scrollWidth,
498
- clientWidth
499
- } = tabsRef.current;
500
- let showStartScroll;
501
- let showEndScroll;
502
- if (vertical) {
503
- showStartScroll = scrollTop > 1;
504
- showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
505
- } else {
506
- const scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
507
- // use 1 for the potential rounding error with browser zooms.
508
- showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
509
- showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
510
- }
511
- if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
512
- setDisplayScroll({
513
- start: showStartScroll,
514
- end: showEndScroll
515
- });
516
- }
492
+ setUpdateScrollObserver(!updateScrollObserver);
517
493
  }
518
494
  });
519
495
  React.useEffect(() => {
@@ -526,7 +502,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
526
502
  // replaced by Suspense with a fallback, once React is updated to version 18
527
503
  if (tabsRef.current) {
528
504
  updateIndicatorState();
529
- updateScrollButtonState();
530
505
  }
531
506
  });
532
507
  const win = ownerWindow(tabsRef.current);
@@ -545,21 +520,44 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
545
520
  resizeObserver.disconnect();
546
521
  }
547
522
  };
548
- }, [updateIndicatorState, updateScrollButtonState]);
549
- const handleTabsScroll = React.useMemo(() => debounce(() => {
550
- updateScrollButtonState();
551
- }), [updateScrollButtonState]);
523
+ }, [updateIndicatorState]);
524
+
525
+ /**
526
+ * Toggle visibility of start and end scroll buttons
527
+ * Using IntersectionObserver on first and last Tabs.
528
+ */
552
529
  React.useEffect(() => {
553
- return () => {
554
- handleTabsScroll.clear();
555
- };
556
- }, [handleTabsScroll]);
530
+ const tabListChildren = Array.from(tabListRef.current.children);
531
+ const length = tabListChildren.length;
532
+ if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
533
+ const firstTab = tabListChildren[0];
534
+ const lastTab = tabListChildren[length - 1];
535
+ const observerOptions = {
536
+ root: tabsRef.current,
537
+ threshold: 0.99
538
+ };
539
+ const handleScrollButtonStart = entries => {
540
+ setDisplayStartScroll(!entries[0].isIntersecting);
541
+ };
542
+ const firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
543
+ firstObserver.observe(firstTab);
544
+ const handleScrollButtonEnd = entries => {
545
+ setDisplayEndScroll(!entries[0].isIntersecting);
546
+ };
547
+ const lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
548
+ lastObserver.observe(lastTab);
549
+ return () => {
550
+ firstObserver.disconnect();
551
+ lastObserver.disconnect();
552
+ };
553
+ }
554
+ return undefined;
555
+ }, [scrollable, scrollButtons, updateScrollObserver, childrenProp?.length]);
557
556
  React.useEffect(() => {
558
557
  setMounted(true);
559
558
  }, []);
560
559
  React.useEffect(() => {
561
560
  updateIndicatorState();
562
- updateScrollButtonState();
563
561
  });
564
562
  React.useEffect(() => {
565
563
  // Don't animate on the first render.
@@ -653,7 +651,6 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
653
651
  [vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
654
652
  },
655
653
  ref: tabsRef,
656
- onScroll: handleTabsScroll,
657
654
  children: [/*#__PURE__*/_jsx(FlexContainer, {
658
655
  "aria-label": ariaLabel,
659
656
  "aria-labelledby": ariaLabelledBy,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.1
2
+ * @mui/material v5.14.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the