@mui/material 5.14.13 → 5.14.14

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.
@@ -19,7 +19,7 @@ var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
19
19
  var _Avatar = _interopRequireWildcard(require("../Avatar"));
20
20
  var _avatarGroupClasses = _interopRequireWildcard(require("./avatarGroupClasses"));
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
- const _excluded = ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"];
22
+ const _excluded = ["children", "className", "component", "componentsProps", "max", "renderSurplus", "slotProps", "spacing", "total", "variant"];
23
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
  const SPACINGS = {
@@ -82,6 +82,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
82
82
  component = 'div',
83
83
  componentsProps = {},
84
84
  max = 5,
85
+ renderSurplus,
85
86
  slotProps = {},
86
87
  spacing = 'medium',
87
88
  total,
@@ -111,6 +112,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
111
112
  clampedMax = Math.min(totalAvatars + 1, clampedMax);
112
113
  const maxAvatars = Math.min(children.length, clampedMax - 1);
113
114
  const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
115
+ const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
114
116
  const marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
115
117
  const additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
116
118
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(AvatarGroupRoot, (0, _extends2.default)({
@@ -119,7 +121,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
119
121
  className: (0, _clsx.default)(classes.root, className),
120
122
  ref: ref
121
123
  }, other, {
122
- children: [extraAvatars ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(AvatarGroupAvatar, (0, _extends2.default)({
124
+ children: [extraAvatars ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarGroupAvatar, (0, _extends2.default)({
123
125
  ownerState: ownerState,
124
126
  variant: variant
125
127
  }, additionalAvatarSlotProps, {
@@ -127,7 +129,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
127
129
  style: (0, _extends2.default)({
128
130
  marginLeft
129
131
  }, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
130
- children: ["+", extraAvatars]
132
+ children: extraAvatarsElement
131
133
  })) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
132
134
  return /*#__PURE__*/React.cloneElement(child, {
133
135
  className: (0, _clsx.default)(child.props.className, classes.avatar),
@@ -185,6 +187,12 @@ process.env.NODE_ENV !== "production" ? AvatarGroup.propTypes /* remove-proptype
185
187
  }
186
188
  return null;
187
189
  }),
190
+ /**
191
+ * custom renderer of extraAvatars
192
+ * @param {number} surplus number of extra avatars
193
+ * @returns {React.ReactNode} custom element to display
194
+ */
195
+ renderSurplus: _propTypes.default.func,
188
196
  /**
189
197
  * The extra props for the slot components.
190
198
  * You can override the existing props or add new ones.
@@ -177,7 +177,7 @@ process.env.NODE_ENV !== "production" ? Pagination.propTypes /* remove-proptypes
177
177
  * This is important for screen reader users.
178
178
  *
179
179
  * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
180
- * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
180
+ * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
181
181
  * @param {number} page The page number to format.
182
182
  * @param {bool} selected If true, the current page is selected.
183
183
  * @returns {string}
package/node/Tabs/Tabs.js CHANGED
@@ -508,23 +508,48 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
508
508
  updateIndicatorState();
509
509
  }
510
510
  });
511
+ let resizeObserver;
512
+
513
+ /**
514
+ * @type {MutationCallback}
515
+ */
516
+ const handleMutation = records => {
517
+ records.forEach(record => {
518
+ record.removedNodes.forEach(item => {
519
+ var _resizeObserver;
520
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
521
+ });
522
+ record.addedNodes.forEach(item => {
523
+ var _resizeObserver2;
524
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
525
+ });
526
+ });
527
+ handleResize();
528
+ updateScrollButtonState();
529
+ };
511
530
  const win = (0, _ownerWindow.default)(tabsRef.current);
512
531
  win.addEventListener('resize', handleResize);
513
- let resizeObserver;
532
+ let mutationObserver;
514
533
  if (typeof ResizeObserver !== 'undefined') {
515
534
  resizeObserver = new ResizeObserver(handleResize);
516
535
  Array.from(tabListRef.current.children).forEach(child => {
517
536
  resizeObserver.observe(child);
518
537
  });
519
538
  }
539
+ if (typeof MutationObserver !== 'undefined') {
540
+ mutationObserver = new MutationObserver(handleMutation);
541
+ mutationObserver.observe(tabListRef.current, {
542
+ childList: true
543
+ });
544
+ }
520
545
  return () => {
546
+ var _mutationObserver, _resizeObserver3;
521
547
  handleResize.clear();
522
548
  win.removeEventListener('resize', handleResize);
523
- if (resizeObserver) {
524
- resizeObserver.disconnect();
525
- }
549
+ (_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
550
+ (_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
526
551
  };
527
- }, [updateIndicatorState]);
552
+ }, [updateIndicatorState, updateScrollButtonState]);
528
553
 
529
554
  /**
530
555
  * Toggle visibility of start and end scroll buttons
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.13
2
+ * @mui/material v5.14.14
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.14.13",
3
+ "version": "5.14.14",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "React components that implement Google's Material Design.",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.23.1",
31
- "@mui/base": "5.0.0-beta.19",
32
- "@mui/core-downloads-tracker": "^5.14.13",
33
- "@mui/system": "^5.14.13",
31
+ "@mui/base": "5.0.0-beta.20",
32
+ "@mui/core-downloads-tracker": "^5.14.14",
33
+ "@mui/system": "^5.14.14",
34
34
  "@mui/types": "^7.2.6",
35
35
  "@mui/utils": "^5.14.13",
36
36
  "@types/react-transition-group": "^4.4.7",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.14.13
2
+ * @mui/material v5.14.14
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -6542,11 +6542,6 @@
6542
6542
  } else {
6543
6543
  value = getPath(themeMapping, propValueFinal) || userValue;
6544
6544
  }
6545
- if (typeof value === 'object') {
6546
- {
6547
- console.warn(`MUI: The value found in theme for prop: "${propValueFinal}" is an [Object] instead of string or number. Check if you forgot to add the correct dotted notation, eg, "background.paper" instead of "background".`);
6548
- }
6549
- }
6550
6545
  if (transform) {
6551
6546
  value = transform(value, userValue, themeMapping);
6552
6547
  }
@@ -15193,7 +15188,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
15193
15188
  function getAppBarUtilityClass(slot) {
15194
15189
  return generateUtilityClass('MuiAppBar', slot);
15195
15190
  }
15196
- const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent']);
15191
+ const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);
15197
15192
  var appBarClasses$1 = appBarClasses;
15198
15193
 
15199
15194
  const _excluded$1V = ["className", "color", "enableColorOnDark", "position"];
@@ -15341,7 +15336,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
15341
15336
  * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
15342
15337
  * @default 'primary'
15343
15338
  */
15344
- color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), PropTypes.string]),
15339
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
15345
15340
  /**
15346
15341
  * If true, the `color` prop is applied in dark mode.
15347
15342
  * @default false
@@ -23701,7 +23696,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23701
23696
  const avatarGroupClasses = generateUtilityClasses('MuiAvatarGroup', ['root', 'avatar']);
23702
23697
  var avatarGroupClasses$1 = avatarGroupClasses;
23703
23698
 
23704
- const _excluded$1L = ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"];
23699
+ const _excluded$1L = ["children", "className", "component", "componentsProps", "max", "renderSurplus", "slotProps", "spacing", "total", "variant"];
23705
23700
  const SPACINGS$2 = {
23706
23701
  small: -16,
23707
23702
  medium: null
@@ -23762,6 +23757,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23762
23757
  component = 'div',
23763
23758
  componentsProps = {},
23764
23759
  max = 5,
23760
+ renderSurplus,
23765
23761
  slotProps = {},
23766
23762
  spacing = 'medium',
23767
23763
  total,
@@ -23791,6 +23787,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23791
23787
  clampedMax = Math.min(totalAvatars + 1, clampedMax);
23792
23788
  const maxAvatars = Math.min(children.length, clampedMax - 1);
23793
23789
  const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
23790
+ const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
23794
23791
  const marginLeft = spacing && SPACINGS$2[spacing] !== undefined ? SPACINGS$2[spacing] : -spacing;
23795
23792
  const additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
23796
23793
  return /*#__PURE__*/jsxRuntime_2(AvatarGroupRoot, _extends({
@@ -23799,7 +23796,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23799
23796
  className: clsx(classes.root, className),
23800
23797
  ref: ref
23801
23798
  }, other, {
23802
- children: [extraAvatars ? /*#__PURE__*/jsxRuntime_2(AvatarGroupAvatar, _extends({
23799
+ children: [extraAvatars ? /*#__PURE__*/jsxRuntime_1(AvatarGroupAvatar, _extends({
23803
23800
  ownerState: ownerState,
23804
23801
  variant: variant
23805
23802
  }, additionalAvatarSlotProps, {
@@ -23807,7 +23804,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23807
23804
  style: _extends({
23808
23805
  marginLeft
23809
23806
  }, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
23810
- children: ["+", extraAvatars]
23807
+ children: extraAvatarsElement
23811
23808
  })) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
23812
23809
  return /*#__PURE__*/React__namespace.cloneElement(child, {
23813
23810
  className: clsx(child.props.className, classes.avatar),
@@ -23865,6 +23862,12 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
23865
23862
  }
23866
23863
  return null;
23867
23864
  }),
23865
+ /**
23866
+ * custom renderer of extraAvatars
23867
+ * @param {number} surplus number of extra avatars
23868
+ * @returns {React.ReactNode} custom element to display
23869
+ */
23870
+ renderSurplus: PropTypes.func,
23868
23871
  /**
23869
23872
  * The extra props for the slot components.
23870
23873
  * You can override the existing props or add new ones.
@@ -38656,7 +38659,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
38656
38659
  * This is important for screen reader users.
38657
38660
  *
38658
38661
  * For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
38659
- * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
38662
+ * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
38660
38663
  * @param {number} page The page number to format.
38661
38664
  * @param {bool} selected If true, the current page is selected.
38662
38665
  * @returns {string}
@@ -48711,23 +48714,48 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
48711
48714
  updateIndicatorState();
48712
48715
  }
48713
48716
  });
48717
+ let resizeObserver;
48718
+
48719
+ /**
48720
+ * @type {MutationCallback}
48721
+ */
48722
+ const handleMutation = records => {
48723
+ records.forEach(record => {
48724
+ record.removedNodes.forEach(item => {
48725
+ var _resizeObserver;
48726
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
48727
+ });
48728
+ record.addedNodes.forEach(item => {
48729
+ var _resizeObserver2;
48730
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
48731
+ });
48732
+ });
48733
+ handleResize();
48734
+ updateScrollButtonState();
48735
+ };
48714
48736
  const win = ownerWindow(tabsRef.current);
48715
48737
  win.addEventListener('resize', handleResize);
48716
- let resizeObserver;
48738
+ let mutationObserver;
48717
48739
  if (typeof ResizeObserver !== 'undefined') {
48718
48740
  resizeObserver = new ResizeObserver(handleResize);
48719
48741
  Array.from(tabListRef.current.children).forEach(child => {
48720
48742
  resizeObserver.observe(child);
48721
48743
  });
48722
48744
  }
48745
+ if (typeof MutationObserver !== 'undefined') {
48746
+ mutationObserver = new MutationObserver(handleMutation);
48747
+ mutationObserver.observe(tabListRef.current, {
48748
+ childList: true
48749
+ });
48750
+ }
48723
48751
  return () => {
48752
+ var _mutationObserver, _resizeObserver3;
48724
48753
  handleResize.clear();
48725
48754
  win.removeEventListener('resize', handleResize);
48726
- if (resizeObserver) {
48727
- resizeObserver.disconnect();
48728
- }
48755
+ (_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
48756
+ (_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
48729
48757
  };
48730
- }, [updateIndicatorState]);
48758
+ }, [updateIndicatorState, updateScrollButtonState]);
48731
48759
 
48732
48760
  /**
48733
48761
  * Toggle visibility of start and end scroll buttons