@mui/material 5.14.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.14.0",
3
+ "version": "5.14.2",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "React components that implement Google's Material Design.",
@@ -45,12 +45,12 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@babel/runtime": "^7.22.5",
49
- "@mui/base": "5.0.0-beta.7",
50
- "@mui/core-downloads-tracker": "^5.14.0",
51
- "@mui/system": "^5.14.0",
48
+ "@babel/runtime": "^7.22.6",
49
+ "@mui/base": "5.0.0-beta.8",
50
+ "@mui/core-downloads-tracker": "^5.14.2",
51
+ "@mui/system": "^5.14.1",
52
52
  "@mui/types": "^7.2.4",
53
- "@mui/utils": "^5.13.7",
53
+ "@mui/utils": "^5.14.1",
54
54
  "@types/react-transition-group": "^4.4.6",
55
55
  "clsx": "^1.2.1",
56
56
  "csstype": "^3.1.2",
@@ -338,6 +338,11 @@ export interface Components<Theme = unknown> {
338
338
  styleOverrides?: ComponentsOverrides<Theme>['MuiMenuItem'];
339
339
  variants?: ComponentsVariants['MuiMenuItem'];
340
340
  };
341
+ MuiMenuList?: {
342
+ defaultProps?: ComponentsProps['MuiMenuList'];
343
+ styleOverrides?: ComponentsOverrides<Theme>['MuiMenuList'];
344
+ variants?: ComponentsVariants['MuiMenuList'];
345
+ };
341
346
  MuiMobileStepper?: {
342
347
  defaultProps?: ComponentsProps['MuiMobileStepper'];
343
348
  styleOverrides?: ComponentsOverrides<Theme>['MuiMobileStepper'];
@@ -66,6 +66,7 @@ import { ListItemTextClassKey } from '../ListItemText';
66
66
  import { ListSubheaderClassKey } from '../ListSubheader';
67
67
  import { MenuClassKey } from '../Menu';
68
68
  import { MenuItemClassKey } from '../MenuItem';
69
+ import { MenuListClassKey } from '../MenuList';
69
70
  import { MobileStepperClassKey } from '../MobileStepper';
70
71
  import { ModalClassKey } from '../Modal';
71
72
  import { NativeSelectClassKey } from '../NativeSelect';
@@ -204,6 +205,7 @@ export interface ComponentNameToClassKey {
204
205
  MuiListSubheader: ListSubheaderClassKey;
205
206
  MuiMenu: MenuClassKey;
206
207
  MuiMenuItem: MenuItemClassKey;
208
+ MuiMenuList: MenuListClassKey;
207
209
  MuiMobileStepper: MobileStepperClassKey;
208
210
  MuiModal: ModalClassKey;
209
211
  MuiNativeSelect: NativeSelectClassKey;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.0
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
@@ -2131,6 +2131,7 @@
2131
2131
  /**
2132
2132
  * https://github.com/facebook/react/issues/14099#issuecomment-440013892
2133
2133
  */
2134
+
2134
2135
  function useEventCallback(fn) {
2135
2136
  const ref = React__namespace.useRef(fn);
2136
2137
  useEnhancedEffect$1(() => {
@@ -6957,8 +6958,8 @@
6957
6958
  const maxWidth = props => {
6958
6959
  if (props.maxWidth !== undefined && props.maxWidth !== null) {
6959
6960
  const styleFromPropValue = propValue => {
6960
- var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
6961
- const breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || values$1[propValue];
6961
+ var _props$theme;
6962
+ const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values$1[propValue];
6962
6963
  return {
6963
6964
  maxWidth: breakpoint || sizingTransform(propValue)
6964
6965
  };
@@ -7484,7 +7485,7 @@
7484
7485
  systemProps: {},
7485
7486
  otherProps: {}
7486
7487
  };
7487
- const config = (_props$theme$unstable = props == null ? void 0 : (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig$1;
7488
+ const config = (_props$theme$unstable = props == null || (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig$1;
7488
7489
  Object.keys(props).forEach(prop => {
7489
7490
  if (config[prop]) {
7490
7491
  result.systemProps[prop] = props[prop];
@@ -7611,12 +7612,12 @@
7611
7612
  return variantsStyles;
7612
7613
  };
7613
7614
  const variantsResolver = (props, styles, theme, name) => {
7614
- var _theme$components, _theme$components$nam;
7615
+ var _theme$components;
7615
7616
  const {
7616
7617
  ownerState = {}
7617
7618
  } = props;
7618
7619
  const variantsStyles = [];
7619
- const themeVariants = theme == null ? void 0 : (_theme$components = theme.components) == null ? void 0 : (_theme$components$nam = _theme$components[name]) == null ? void 0 : _theme$components$nam.variants;
7620
+ const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
7620
7621
  if (themeVariants) {
7621
7622
  themeVariants.forEach(themeVariant => {
7622
7623
  let isMatch = true;
@@ -14805,7 +14806,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
14805
14806
  }) {
14806
14807
  var _sliderRef$current, _doc$activeElement;
14807
14808
  const doc = ownerDocument(sliderRef.current);
14808
- if (!((_sliderRef$current = sliderRef.current) != null && _sliderRef$current.contains(doc.activeElement)) || Number(doc == null ? void 0 : (_doc$activeElement = doc.activeElement) == null ? void 0 : _doc$activeElement.getAttribute('data-index')) !== activeIndex) {
14809
+ if (!((_sliderRef$current = sliderRef.current) != null && _sliderRef$current.contains(doc.activeElement)) || Number(doc == null || (_doc$activeElement = doc.activeElement) == null ? void 0 : _doc$activeElement.getAttribute('data-index')) !== activeIndex) {
14809
14810
  var _sliderRef$current2;
14810
14811
  (_sliderRef$current2 = sliderRef.current) == null ? void 0 : _sliderRef$current2.querySelector(`[type="range"][data-index="${activeIndex}"]`).focus();
14811
14812
  }
@@ -14956,7 +14957,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
14956
14957
  setFocusedThumbIndex(index);
14957
14958
  }
14958
14959
  setOpen(index);
14959
- otherHandlers == null ? void 0 : (_otherHandlers$onFocu = otherHandlers.onFocus) == null ? void 0 : _otherHandlers$onFocu.call(otherHandlers, event);
14960
+ otherHandlers == null || (_otherHandlers$onFocu = otherHandlers.onFocus) == null ? void 0 : _otherHandlers$onFocu.call(otherHandlers, event);
14960
14961
  };
14961
14962
  const createHandleHiddenInputBlur = otherHandlers => event => {
14962
14963
  var _otherHandlers$onBlur;
@@ -14965,7 +14966,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
14965
14966
  setFocusedThumbIndex(-1);
14966
14967
  }
14967
14968
  setOpen(-1);
14968
- otherHandlers == null ? void 0 : (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event);
14969
+ otherHandlers == null || (_otherHandlers$onBlur = otherHandlers.onBlur) == null ? void 0 : _otherHandlers$onBlur.call(otherHandlers, event);
14969
14970
  };
14970
14971
  useEnhancedEffect$1(() => {
14971
14972
  if (disabled && sliderRef.current.contains(document.activeElement)) {
@@ -16021,10 +16022,10 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
16021
16022
 
16022
16023
  // Scroll active descendant into view.
16023
16024
  // Logic copied from https://www.w3.org/WAI/content-assets/wai-aria-practices/patterns/combobox/examples/js/select-only.js
16024
- //
16025
+ // In case of mouse clicks and touch (in mobile devices) we avoid scrolling the element and keep both behaviors same.
16025
16026
  // Consider this API instead once it has a better browser support:
16026
16027
  // .scrollIntoView({ scrollMode: 'if-needed', block: 'nearest' });
16027
- if (listboxNode.scrollHeight > listboxNode.clientHeight && reason !== 'mouse') {
16028
+ if (listboxNode.scrollHeight > listboxNode.clientHeight && reason !== 'mouse' && reason !== 'touch') {
16028
16029
  const element = option;
16029
16030
  const scrollBottom = listboxNode.clientHeight + listboxNode.scrollTop;
16030
16031
  const elementBottom = element.offsetTop + element.offsetHeight;
@@ -16736,7 +16737,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
16736
16737
  theme,
16737
16738
  ownerState
16738
16739
  }) => {
16739
- var _theme$transitions, _theme$transitions$cr, _theme$transitions2, _theme$transitions2$d, _theme$typography, _theme$typography$pxT, _theme$typography2, _theme$typography2$px, _theme$typography3, _theme$typography3$px, _palette$ownerState$c, _palette, _palette$ownerState$c2, _palette2, _palette2$action, _palette3, _palette3$action;
16740
+ var _theme$transitions, _theme$transitions$cr, _theme$transitions2, _theme$typography, _theme$typography$pxT, _theme$typography2, _theme$typography2$px, _theme$typography3, _theme$typography3$px, _palette$ownerState$c, _palette, _palette2, _palette3;
16740
16741
  return {
16741
16742
  userSelect: 'none',
16742
16743
  width: '1em',
@@ -16746,19 +16747,19 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
16746
16747
  // e.g. heroicons uses fill="none" and stroke="currentColor"
16747
16748
  fill: ownerState.hasSvgAsChild ? undefined : 'currentColor',
16748
16749
  flexShrink: 0,
16749
- transition: (_theme$transitions = theme.transitions) == null ? void 0 : (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', {
16750
- duration: (_theme$transitions2 = theme.transitions) == null ? void 0 : (_theme$transitions2$d = _theme$transitions2.duration) == null ? void 0 : _theme$transitions2$d.shorter
16750
+ transition: (_theme$transitions = theme.transitions) == null || (_theme$transitions$cr = _theme$transitions.create) == null ? void 0 : _theme$transitions$cr.call(_theme$transitions, 'fill', {
16751
+ duration: (_theme$transitions2 = theme.transitions) == null || (_theme$transitions2 = _theme$transitions2.duration) == null ? void 0 : _theme$transitions2.shorter
16751
16752
  }),
16752
16753
  fontSize: {
16753
16754
  inherit: 'inherit',
16754
- small: ((_theme$typography = theme.typography) == null ? void 0 : (_theme$typography$pxT = _theme$typography.pxToRem) == null ? void 0 : _theme$typography$pxT.call(_theme$typography, 20)) || '1.25rem',
16755
- medium: ((_theme$typography2 = theme.typography) == null ? void 0 : (_theme$typography2$px = _theme$typography2.pxToRem) == null ? void 0 : _theme$typography2$px.call(_theme$typography2, 24)) || '1.5rem',
16756
- large: ((_theme$typography3 = theme.typography) == null ? void 0 : (_theme$typography3$px = _theme$typography3.pxToRem) == null ? void 0 : _theme$typography3$px.call(_theme$typography3, 35)) || '2.1875rem'
16755
+ small: ((_theme$typography = theme.typography) == null || (_theme$typography$pxT = _theme$typography.pxToRem) == null ? void 0 : _theme$typography$pxT.call(_theme$typography, 20)) || '1.25rem',
16756
+ medium: ((_theme$typography2 = theme.typography) == null || (_theme$typography2$px = _theme$typography2.pxToRem) == null ? void 0 : _theme$typography2$px.call(_theme$typography2, 24)) || '1.5rem',
16757
+ large: ((_theme$typography3 = theme.typography) == null || (_theme$typography3$px = _theme$typography3.pxToRem) == null ? void 0 : _theme$typography3$px.call(_theme$typography3, 35)) || '2.1875rem'
16757
16758
  }[ownerState.fontSize],
16758
16759
  // TODO v5 deprecate, v6 remove for sx
16759
- color: (_palette$ownerState$c = (_palette = (theme.vars || theme).palette) == null ? void 0 : (_palette$ownerState$c2 = _palette[ownerState.color]) == null ? void 0 : _palette$ownerState$c2.main) != null ? _palette$ownerState$c : {
16760
- action: (_palette2 = (theme.vars || theme).palette) == null ? void 0 : (_palette2$action = _palette2.action) == null ? void 0 : _palette2$action.active,
16761
- disabled: (_palette3 = (theme.vars || theme).palette) == null ? void 0 : (_palette3$action = _palette3.action) == null ? void 0 : _palette3$action.disabled,
16760
+ color: (_palette$ownerState$c = (_palette = (theme.vars || theme).palette) == null || (_palette = _palette[ownerState.color]) == null ? void 0 : _palette.main) != null ? _palette$ownerState$c : {
16761
+ action: (_palette2 = (theme.vars || theme).palette) == null || (_palette2 = _palette2.action) == null ? void 0 : _palette2.active,
16762
+ disabled: (_palette3 = (theme.vars || theme).palette) == null || (_palette3 = _palette3.action) == null ? void 0 : _palette3.disabled,
16762
16763
  inherit: undefined
16763
16764
  }[ownerState.color]
16764
16765
  };
@@ -21263,8 +21264,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
21263
21264
  borderRadius: 32 / 2,
21264
21265
  whiteSpace: 'nowrap',
21265
21266
  transition: theme.transitions.create(['background-color', 'box-shadow']),
21266
- // label will inherit this from root, then `clickable` class overrides this for both
21267
- cursor: 'default',
21268
21267
  // We disable the focus ring for mouse, touch and keyboard users.
21269
21268
  outline: 0,
21270
21269
  textDecoration: 'none',
@@ -27416,7 +27415,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
27416
27415
  }
27417
27416
  });
27418
27417
  const styles$3 = (theme, enableColorScheme = false) => {
27419
- var _theme$components, _theme$components$Mui;
27418
+ var _theme$components;
27420
27419
  const colorSchemeStyles = {};
27421
27420
  if (enableColorScheme && theme.colorSchemes) {
27422
27421
  Object.entries(theme.colorSchemes).forEach(([key, scheme]) => {
@@ -27444,7 +27443,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
27444
27443
  }
27445
27444
  })
27446
27445
  }, colorSchemeStyles);
27447
- const themeOverrides = (_theme$components = theme.components) == null ? void 0 : (_theme$components$Mui = _theme$components.MuiCssBaseline) == null ? void 0 : _theme$components$Mui.styleOverrides;
27446
+ const themeOverrides = (_theme$components = theme.components) == null || (_theme$components = _theme$components.MuiCssBaseline) == null ? void 0 : _theme$components.styleOverrides;
27448
27447
  if (themeOverrides) {
27449
27448
  defaultStyles = [defaultStyles, themeOverrides];
27450
27449
  }
@@ -30305,6 +30304,66 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
30305
30304
  } ;
30306
30305
  var FormControl$1 = FormControl;
30307
30306
 
30307
+ const Stack = createStack({
30308
+ createStyledComponent: styled$1('div', {
30309
+ name: 'MuiStack',
30310
+ slot: 'Root',
30311
+ overridesResolver: (props, styles) => styles.root
30312
+ }),
30313
+ useThemeProps: inProps => useThemeProps({
30314
+ props: inProps,
30315
+ name: 'MuiStack'
30316
+ })
30317
+ });
30318
+ Stack.propTypes /* remove-proptypes */ = {
30319
+ // ----------------------------- Warning --------------------------------
30320
+ // | These PropTypes are generated from the TypeScript type definitions |
30321
+ // | To update them edit the d.ts file and run "yarn proptypes" |
30322
+ // ----------------------------------------------------------------------
30323
+ /**
30324
+ * The content of the component.
30325
+ */
30326
+ children: PropTypes.node,
30327
+ /**
30328
+ * The component used for the root node.
30329
+ * Either a string to use a HTML element or a component.
30330
+ */
30331
+ component: PropTypes.elementType,
30332
+ /**
30333
+ * Defines the `flex-direction` style property.
30334
+ * It is applied for all screen sizes.
30335
+ * @default 'column'
30336
+ */
30337
+ direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
30338
+ /**
30339
+ * Add an element between each child.
30340
+ */
30341
+ divider: PropTypes.node,
30342
+ /**
30343
+ * Defines the space between immediate children.
30344
+ * @default 0
30345
+ */
30346
+ spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
30347
+ /**
30348
+ * The system prop, which allows defining system overrides as well as additional CSS styles.
30349
+ */
30350
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
30351
+ /**
30352
+ * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
30353
+ *
30354
+ * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
30355
+ * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
30356
+ *
30357
+ * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
30358
+ * @default false
30359
+ */
30360
+ useFlexGap: PropTypes.bool
30361
+ } ;
30362
+ var Stack$1 = Stack;
30363
+
30364
+ const stackClasses = generateUtilityClasses('MuiStack', ['root']);
30365
+ var stackClasses$1 = stackClasses;
30366
+
30308
30367
  function getFormControlLabelUtilityClasses(slot) {
30309
30368
  return generateUtilityClass('MuiFormControlLabel', slot);
30310
30369
  }
@@ -30445,12 +30504,16 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
30445
30504
  ownerState: ownerState,
30446
30505
  ref: ref
30447
30506
  }, other, {
30448
- children: [/*#__PURE__*/React__namespace.cloneElement(control, controlProps), label, required && /*#__PURE__*/jsxRuntime_2(AsteriskComponent$1, {
30449
- ownerState: ownerState,
30450
- "aria-hidden": true,
30451
- className: classes.asterisk,
30452
- children: ["\u2009", '*']
30453
- })]
30507
+ children: [/*#__PURE__*/React__namespace.cloneElement(control, controlProps), required ? /*#__PURE__*/jsxRuntime_2(Stack$1, {
30508
+ direction: "row",
30509
+ alignItems: "center",
30510
+ children: [label, /*#__PURE__*/jsxRuntime_2(AsteriskComponent$1, {
30511
+ ownerState: ownerState,
30512
+ "aria-hidden": true,
30513
+ className: classes.asterisk,
30514
+ children: ["\u2009", '*']
30515
+ })]
30516
+ }) : label]
30454
30517
  }));
30455
30518
  });
30456
30519
  FormControlLabel.propTypes /* remove-proptypes */ = {
@@ -43979,66 +44042,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
43979
44042
  SpeedDialIcon.muiName = 'SpeedDialIcon';
43980
44043
  var SpeedDialIcon$1 = SpeedDialIcon;
43981
44044
 
43982
- const Stack = createStack({
43983
- createStyledComponent: styled$1('div', {
43984
- name: 'MuiStack',
43985
- slot: 'Root',
43986
- overridesResolver: (props, styles) => styles.root
43987
- }),
43988
- useThemeProps: inProps => useThemeProps({
43989
- props: inProps,
43990
- name: 'MuiStack'
43991
- })
43992
- });
43993
- Stack.propTypes /* remove-proptypes */ = {
43994
- // ----------------------------- Warning --------------------------------
43995
- // | These PropTypes are generated from the TypeScript type definitions |
43996
- // | To update them edit the d.ts file and run "yarn proptypes" |
43997
- // ----------------------------------------------------------------------
43998
- /**
43999
- * The content of the component.
44000
- */
44001
- children: PropTypes.node,
44002
- /**
44003
- * The component used for the root node.
44004
- * Either a string to use a HTML element or a component.
44005
- */
44006
- component: PropTypes.elementType,
44007
- /**
44008
- * Defines the `flex-direction` style property.
44009
- * It is applied for all screen sizes.
44010
- * @default 'column'
44011
- */
44012
- direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
44013
- /**
44014
- * Add an element between each child.
44015
- */
44016
- divider: PropTypes.node,
44017
- /**
44018
- * Defines the space between immediate children.
44019
- * @default 0
44020
- */
44021
- spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
44022
- /**
44023
- * The system prop, which allows defining system overrides as well as additional CSS styles.
44024
- */
44025
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
44026
- /**
44027
- * If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
44028
- *
44029
- * While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
44030
- * it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
44031
- *
44032
- * To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
44033
- * @default false
44034
- */
44035
- useFlexGap: PropTypes.bool
44036
- } ;
44037
- var Stack$1 = Stack;
44038
-
44039
- const stackClasses = generateUtilityClasses('MuiStack', ['root']);
44040
- var stackClasses$1 = stackClasses;
44041
-
44042
44045
  /**
44043
44046
  * Provides information about the current step in Stepper.
44044
44047
  */
@@ -48426,10 +48429,9 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48426
48429
  }
48427
48430
  const [mounted, setMounted] = React__namespace.useState(false);
48428
48431
  const [indicatorStyle, setIndicatorStyle] = React__namespace.useState(defaultIndicatorStyle);
48429
- const [displayScroll, setDisplayScroll] = React__namespace.useState({
48430
- start: false,
48431
- end: false
48432
- });
48432
+ const [displayStartScroll, setDisplayStartScroll] = React__namespace.useState(false);
48433
+ const [displayEndScroll, setDisplayEndScroll] = React__namespace.useState(false);
48434
+ const [updateScrollObserver, setUpdateScrollObserver] = React__namespace.useState(false);
48433
48435
  const [scrollerStyle, setScrollerStyle] = React__namespace.useState({
48434
48436
  overflow: 'hidden',
48435
48437
  scrollbarWidth: 0
@@ -48580,7 +48582,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48580
48582
  onChange: handleScrollbarSizeChange,
48581
48583
  className: clsx(classes.scrollableX, classes.hideScrollbar)
48582
48584
  }) : null;
48583
- const scrollButtonsActive = displayScroll.start || displayScroll.end;
48585
+ const scrollButtonsActive = displayStartScroll || displayEndScroll;
48584
48586
  const showScrollButtons = scrollable && (scrollButtons === 'auto' && scrollButtonsActive || scrollButtons === true);
48585
48587
  conditionalElements.scrollButtonStart = showScrollButtons ? /*#__PURE__*/jsxRuntime_1(ScrollButtonComponent, _extends({
48586
48588
  slots: {
@@ -48592,7 +48594,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48592
48594
  orientation: orientation,
48593
48595
  direction: isRtl ? 'right' : 'left',
48594
48596
  onClick: handleStartScrollClick,
48595
- disabled: !displayScroll.start
48597
+ disabled: !displayStartScroll
48596
48598
  }, TabScrollButtonProps, {
48597
48599
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
48598
48600
  })) : null;
@@ -48606,7 +48608,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48606
48608
  orientation: orientation,
48607
48609
  direction: isRtl ? 'left' : 'right',
48608
48610
  onClick: handleEndScrollClick,
48609
- disabled: !displayScroll.end
48611
+ disabled: !displayEndScroll
48610
48612
  }, TabScrollButtonProps, {
48611
48613
  className: clsx(classes.scrollButtons, TabScrollButtonProps.className)
48612
48614
  })) : null;
@@ -48636,30 +48638,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48636
48638
  });
48637
48639
  const updateScrollButtonState = useEventCallback(() => {
48638
48640
  if (scrollable && scrollButtons !== false) {
48639
- const {
48640
- scrollTop,
48641
- scrollHeight,
48642
- clientHeight,
48643
- scrollWidth,
48644
- clientWidth
48645
- } = tabsRef.current;
48646
- let showStartScroll;
48647
- let showEndScroll;
48648
- if (vertical) {
48649
- showStartScroll = scrollTop > 1;
48650
- showEndScroll = scrollTop < scrollHeight - clientHeight - 1;
48651
- } else {
48652
- const scrollLeft = getNormalizedScrollLeft(tabsRef.current, theme.direction);
48653
- // use 1 for the potential rounding error with browser zooms.
48654
- showStartScroll = isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
48655
- showEndScroll = !isRtl ? scrollLeft < scrollWidth - clientWidth - 1 : scrollLeft > 1;
48656
- }
48657
- if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
48658
- setDisplayScroll({
48659
- start: showStartScroll,
48660
- end: showEndScroll
48661
- });
48662
- }
48641
+ setUpdateScrollObserver(!updateScrollObserver);
48663
48642
  }
48664
48643
  });
48665
48644
  React__namespace.useEffect(() => {
@@ -48672,7 +48651,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48672
48651
  // replaced by Suspense with a fallback, once React is updated to version 18
48673
48652
  if (tabsRef.current) {
48674
48653
  updateIndicatorState();
48675
- updateScrollButtonState();
48676
48654
  }
48677
48655
  });
48678
48656
  const win = ownerWindow(tabsRef.current);
@@ -48691,21 +48669,44 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48691
48669
  resizeObserver.disconnect();
48692
48670
  }
48693
48671
  };
48694
- }, [updateIndicatorState, updateScrollButtonState]);
48695
- const handleTabsScroll = React__namespace.useMemo(() => debounce$1(() => {
48696
- updateScrollButtonState();
48697
- }), [updateScrollButtonState]);
48672
+ }, [updateIndicatorState]);
48673
+
48674
+ /**
48675
+ * Toggle visibility of start and end scroll buttons
48676
+ * Using IntersectionObserver on first and last Tabs.
48677
+ */
48698
48678
  React__namespace.useEffect(() => {
48699
- return () => {
48700
- handleTabsScroll.clear();
48701
- };
48702
- }, [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]);
48703
48705
  React__namespace.useEffect(() => {
48704
48706
  setMounted(true);
48705
48707
  }, []);
48706
48708
  React__namespace.useEffect(() => {
48707
48709
  updateIndicatorState();
48708
- updateScrollButtonState();
48709
48710
  });
48710
48711
  React__namespace.useEffect(() => {
48711
48712
  // Don't animate on the first render.
@@ -48797,7 +48798,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48797
48798
  [vertical ? `margin${isRtl ? 'Left' : 'Right'}` : 'marginBottom']: visibleScrollbar ? undefined : -scrollerStyle.scrollbarWidth
48798
48799
  },
48799
48800
  ref: tabsRef,
48800
- onScroll: handleTabsScroll,
48801
48801
  children: [/*#__PURE__*/jsxRuntime_1(FlexContainer, {
48802
48802
  "aria-label": ariaLabel,
48803
48803
  "aria-labelledby": ariaLabelledBy,