@mui/material 5.14.1 → 5.14.2

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 (47) hide show
  1. package/Button/Button.js +1 -1
  2. package/CHANGELOG.md +61 -0
  3. package/Card/Card.d.ts +2 -2
  4. package/Chip/Chip.js +0 -2
  5. package/Dialog/Dialog.d.ts +1 -1
  6. package/Drawer/Drawer.d.ts +1 -1
  7. package/Fab/Fab.js +1 -1
  8. package/Link/Link.d.ts +7 -9
  9. package/ListItem/ListItem.js +1 -1
  10. package/ListItemButton/ListItemButton.js +1 -1
  11. package/MenuItem/MenuItem.js +1 -1
  12. package/OverridableComponent.d.ts +0 -7
  13. package/Paper/Paper.d.ts +30 -32
  14. package/Paper/index.d.ts +1 -1
  15. package/Popover/Popover.d.ts +1 -1
  16. package/README.md +1 -1
  17. package/Tabs/Tabs.js +39 -42
  18. package/Typography/Typography.d.ts +65 -66
  19. package/index.js +1 -1
  20. package/legacy/Button/Button.js +1 -1
  21. package/legacy/Chip/Chip.js +0 -2
  22. package/legacy/Fab/Fab.js +1 -1
  23. package/legacy/ListItem/ListItem.js +1 -1
  24. package/legacy/ListItemButton/ListItemButton.js +1 -1
  25. package/legacy/MenuItem/MenuItem.js +1 -1
  26. package/legacy/Tabs/Tabs.js +48 -48
  27. package/legacy/index.js +1 -1
  28. package/modern/Button/Button.js +1 -1
  29. package/modern/Chip/Chip.js +0 -2
  30. package/modern/Fab/Fab.js +1 -1
  31. package/modern/ListItem/ListItem.js +1 -1
  32. package/modern/ListItemButton/ListItemButton.js +1 -1
  33. package/modern/MenuItem/MenuItem.js +1 -1
  34. package/modern/Tabs/Tabs.js +39 -42
  35. package/modern/index.js +1 -1
  36. package/node/Button/Button.js +1 -1
  37. package/node/Chip/Chip.js +0 -2
  38. package/node/Fab/Fab.js +1 -1
  39. package/node/ListItem/ListItem.js +1 -1
  40. package/node/ListItemButton/ListItemButton.js +1 -1
  41. package/node/MenuItem/MenuItem.js +1 -1
  42. package/node/Tabs/Tabs.js +39 -42
  43. package/node/index.js +1 -1
  44. package/package.json +2 -2
  45. package/styles/props.d.ts +1 -1
  46. package/umd/material-ui.development.js +45 -50
  47. package/umd/material-ui.production.min.js +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.1
2
+ * @mui/material v5.14.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -21264,8 +21264,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
21264
21264
  borderRadius: 32 / 2,
21265
21265
  whiteSpace: 'nowrap',
21266
21266
  transition: theme.transitions.create(['background-color', 'box-shadow']),
21267
- // label will inherit this from root, then `clickable` class overrides this for both
21268
- cursor: 'default',
21269
21267
  // We disable the focus ring for mouse, touch and keyboard users.
21270
21268
  outline: 0,
21271
21269
  textDecoration: 'none',
@@ -25612,7 +25610,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
25612
25610
  * The component used for the root node.
25613
25611
  * Either a string to use a HTML element or a component.
25614
25612
  */
25615
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
25613
+ component: PropTypes.elementType,
25616
25614
  /**
25617
25615
  * If `true`, the component is disabled.
25618
25616
  * @default false
@@ -29569,7 +29567,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
29569
29567
  * The component used for the root node.
29570
29568
  * Either a string to use a HTML element or a component.
29571
29569
  */
29572
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
29570
+ component: PropTypes.elementType,
29573
29571
  /**
29574
29572
  * If `true`, the component is disabled.
29575
29573
  * @default false
@@ -34769,7 +34767,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
34769
34767
  * The component used for the root node.
34770
34768
  * Either a string to use a HTML element or a component.
34771
34769
  */
34772
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
34770
+ component: PropTypes.elementType,
34773
34771
  /**
34774
34772
  * If `true`, compact vertical padding designed for keyboard and mouse input is used.
34775
34773
  * The prop defaults to the value inherited from the parent List component.
@@ -35195,7 +35193,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
35195
35193
  * The component used for the root node.
35196
35194
  * Either a string to use a HTML element or a component.
35197
35195
  */
35198
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
35196
+ component: PropTypes.elementType,
35199
35197
  /**
35200
35198
  * The components used for each slot inside.
35201
35199
  *
@@ -36857,7 +36855,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
36857
36855
  * The component used for the root node.
36858
36856
  * Either a string to use a HTML element or a component.
36859
36857
  */
36860
- component: PropTypes /* @typescript-to-proptypes-ignore */.elementType,
36858
+ component: PropTypes.elementType,
36861
36859
  /**
36862
36860
  * If `true`, compact vertical padding designed for keyboard and mouse input is used.
36863
36861
  * The prop defaults to the value inherited from the parent Menu component.
@@ -48431,10 +48429,9 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48431
48429
  }
48432
48430
  const [mounted, setMounted] = React__namespace.useState(false);
48433
48431
  const [indicatorStyle, setIndicatorStyle] = React__namespace.useState(defaultIndicatorStyle);
48434
- const [displayScroll, setDisplayScroll] = React__namespace.useState({
48435
- start: false,
48436
- end: false
48437
- });
48432
+ const [displayStartScroll, setDisplayStartScroll] = React__namespace.useState(false);
48433
+ const [displayEndScroll, setDisplayEndScroll] = React__namespace.useState(false);
48434
+ const [updateScrollObserver, setUpdateScrollObserver] = React__namespace.useState(false);
48438
48435
  const [scrollerStyle, setScrollerStyle] = React__namespace.useState({
48439
48436
  overflow: 'hidden',
48440
48437
  scrollbarWidth: 0
@@ -48585,7 +48582,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48585
48582
  onChange: handleScrollbarSizeChange,
48586
48583
  className: clsx(classes.scrollableX, classes.hideScrollbar)
48587
48584
  }) : null;
48588
- const scrollButtonsActive = displayScroll.start || displayScroll.end;
48585
+ const scrollButtonsActive = displayStartScroll || displayEndScroll;
48589
48586
  const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
48590
48587
  conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/jsxRuntime_1(ScrollButtonComponent, _extends({
48591
48588
  slots: {
@@ -48597,7 +48594,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48597
48594
  orientation: orientation,
48598
48595
  direction: isRtl ? 'right' : 'left',
48599
48596
  onClick: handleStartScrollClick,
48600
- disabled: !displayScroll.start
48597
+ disabled: !displayStartScroll
48601
48598
  }, TabScrollButtonProps, {
48602
48599
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
48603
48600
  })) : null;
@@ -48611,7 +48608,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48611
48608
  orientation: orientation,
48612
48609
  direction: isRtl ? 'left' : 'right',
48613
48610
  onClick: handleEndScrollClick,
48614
- disabled: !displayScroll.end
48611
+ disabled: !displayEndScroll
48615
48612
  }, TabScrollButtonProps, {
48616
48613
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
48617
48614
  })) : null;
@@ -48641,30 +48638,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48641
48638
  });
48642
48639
  const updateScrollButtonState = useEventCallback(() => {
48643
48640
  if (scrollable && scrollButtons !== false) {
48644
- const {
48645
- scrollTop,
48646
- scrollHeight,
48647
- clientHeight,
48648
- scrollWidth,
48649
- clientWidth
48650
- } = tabsRef.current;
48651
- let showStartScroll;
48652
- let showEndScroll;
48653
- if (vertical) {
48654
- showStartScroll = scrollTop > 1;
48655
- showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
48656
- } else {
48657
- const scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
48658
- // use 1 for the potential rounding error with browser zooms.
48659
- showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
48660
- showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
48661
- }
48662
- if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
48663
- setDisplayScroll({
48664
- start: showStartScroll,
48665
- end: showEndScroll
48666
- });
48667
- }
48641
+ setUpdateScrollObserver(!updateScrollObserver);
48668
48642
  }
48669
48643
  });
48670
48644
  React__namespace.useEffect(() => {
@@ -48677,7 +48651,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48677
48651
  // replaced by Suspense with a fallback, once React is updated to version 18
48678
48652
  if (tabsRef.current) {
48679
48653
  updateIndicatorState();
48680
- updateScrollButtonState();
48681
48654
  }
48682
48655
  });
48683
48656
  const win = ownerWindow(tabsRef.current);
@@ -48696,21 +48669,44 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48696
48669
  resizeObserver.disconnect();
48697
48670
  }
48698
48671
  };
48699
- }, [updateIndicatorState, updateScrollButtonState]);
48700
- const handleTabsScroll = React__namespace.useMemo(() => debounce$1(() => {
48701
- updateScrollButtonState();
48702
- }), [updateScrollButtonState]);
48672
+ }, [updateIndicatorState]);
48673
+
48674
+ /**
48675
+ * Toggle visibility of start and end scroll buttons
48676
+ * Using IntersectionObserver on first and last Tabs.
48677
+ */
48703
48678
  React__namespace.useEffect(() => {
48704
- return () => {
48705
- handleTabsScroll.clear();
48706
- };
48707
- }, [handleTabsScroll]);
48679
+ const tabListChildren = Array.from(tabListRef.current.children);
48680
+ const length = tabListChildren.length;
48681
+ if (typeof IntersectionObserver !== 'undefined' && length > 0 && scrollable && scrollButtons !== false) {
48682
+ const firstTab = tabListChildren[0];
48683
+ const lastTab = tabListChildren[length - 1];
48684
+ const observerOptions = {
48685
+ root: tabsRef.current,
48686
+ threshold: 0.99
48687
+ };
48688
+ const handleScrollButtonStart = entries => {
48689
+ setDisplayStartScroll(!entries[0].isIntersecting);
48690
+ };
48691
+ const firstObserver = new IntersectionObserver(handleScrollButtonStart, observerOptions);
48692
+ firstObserver.observe(firstTab);
48693
+ const handleScrollButtonEnd = entries => {
48694
+ setDisplayEndScroll(!entries[0].isIntersecting);
48695
+ };
48696
+ const lastObserver = new IntersectionObserver(handleScrollButtonEnd, observerOptions);
48697
+ lastObserver.observe(lastTab);
48698
+ return () => {
48699
+ firstObserver.disconnect();
48700
+ lastObserver.disconnect();
48701
+ };
48702
+ }
48703
+ return undefined;
48704
+ }, [scrollable, scrollButtons, updateScrollObserver, childrenProp == null ? void 0 : childrenProp.length]);
48708
48705
  React__namespace.useEffect(() => {
48709
48706
  setMounted(true);
48710
48707
  }, []);
48711
48708
  React__namespace.useEffect(() => {
48712
48709
  updateIndicatorState();
48713
- updateScrollButtonState();
48714
48710
  });
48715
48711
  React__namespace.useEffect(() => {
48716
48712
  // Don't animate on the first render.
@@ -48802,7 +48798,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48802
48798
  [vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
48803
48799
  },
48804
48800
  ref: tabsRef,
48805
- onScroll: handleTabsScroll,
48806
48801
  children: [/*#__PURE__*/jsxRuntime_1(FlexContainer, {
48807
48802
  "aria-label": ariaLabel,
48808
48803
  "aria-labelledby": ariaLabelledBy,