@mui/material 5.8.1 → 5.8.4

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 (81) hide show
  1. package/Alert/Alert.js +3 -1
  2. package/Autocomplete/autocompleteClasses.d.ts +1 -1
  3. package/Button/buttonClasses.d.ts +24 -0
  4. package/Button/buttonClasses.js +1 -1
  5. package/CHANGELOG.md +217 -8
  6. package/Checkbox/Checkbox.js +4 -4
  7. package/Grid/Grid.d.ts +73 -52
  8. package/Grid/Grid.js +94 -40
  9. package/Grow/Grow.js +4 -4
  10. package/Hidden/withWidth.js +0 -2
  11. package/InputLabel/InputLabel.d.ts +5 -0
  12. package/InputLabel/InputLabel.js +6 -0
  13. package/Link/Link.js +10 -17
  14. package/Link/getTextDecoration.d.ts +15 -0
  15. package/Link/getTextDecoration.js +29 -0
  16. package/Popover/Popover.d.ts +7 -0
  17. package/Popover/index.js +1 -0
  18. package/README.md +13 -12
  19. package/Slider/Slider.d.ts +3 -1
  20. package/Slider/Slider.js +23 -8
  21. package/Snackbar/Snackbar.js +6 -20
  22. package/Stack/Stack.js +1 -1
  23. package/StepIcon/StepIcon.js +2 -1
  24. package/Tab/Tab.d.ts +0 -1
  25. package/Tabs/Tabs.js +16 -0
  26. package/index.js +1 -1
  27. package/legacy/Alert/Alert.js +3 -1
  28. package/legacy/Button/buttonClasses.js +1 -1
  29. package/legacy/Checkbox/Checkbox.js +4 -4
  30. package/legacy/Grid/Grid.js +97 -48
  31. package/legacy/Grow/Grow.js +4 -4
  32. package/legacy/Hidden/withWidth.js +0 -2
  33. package/legacy/InputLabel/InputLabel.js +6 -0
  34. package/legacy/Link/Link.js +10 -17
  35. package/legacy/Link/getTextDecoration.js +28 -0
  36. package/legacy/Popover/index.js +1 -0
  37. package/legacy/Slider/Slider.js +23 -8
  38. package/legacy/Snackbar/Snackbar.js +6 -21
  39. package/legacy/Stack/Stack.js +2 -1
  40. package/legacy/StepIcon/StepIcon.js +2 -1
  41. package/legacy/Tabs/Tabs.js +16 -0
  42. package/legacy/index.js +1 -1
  43. package/legacy/styles/CssVarsProvider.js +3 -0
  44. package/modern/Alert/Alert.js +3 -1
  45. package/modern/Button/buttonClasses.js +1 -1
  46. package/modern/Checkbox/Checkbox.js +4 -4
  47. package/modern/Grid/Grid.js +94 -40
  48. package/modern/Grow/Grow.js +4 -4
  49. package/modern/Hidden/withWidth.js +0 -2
  50. package/modern/InputLabel/InputLabel.js +6 -0
  51. package/modern/Link/Link.js +10 -17
  52. package/modern/Link/getTextDecoration.js +29 -0
  53. package/modern/Popover/index.js +1 -0
  54. package/modern/Slider/Slider.js +23 -8
  55. package/modern/Snackbar/Snackbar.js +6 -20
  56. package/modern/Stack/Stack.js +1 -1
  57. package/modern/StepIcon/StepIcon.js +2 -1
  58. package/modern/Tabs/Tabs.js +16 -0
  59. package/modern/index.js +1 -1
  60. package/modern/styles/CssVarsProvider.js +3 -0
  61. package/node/Alert/Alert.js +3 -1
  62. package/node/Button/buttonClasses.js +1 -1
  63. package/node/Checkbox/Checkbox.js +4 -4
  64. package/node/Grid/Grid.js +95 -40
  65. package/node/Grow/Grow.js +4 -4
  66. package/node/Hidden/withWidth.js +0 -3
  67. package/node/InputLabel/InputLabel.js +6 -0
  68. package/node/Link/Link.js +12 -20
  69. package/node/Link/getTextDecoration.js +39 -0
  70. package/node/Popover/index.js +13 -3
  71. package/node/Slider/Slider.js +23 -8
  72. package/node/Snackbar/Snackbar.js +6 -18
  73. package/node/Stack/Stack.js +1 -1
  74. package/node/StepIcon/StepIcon.js +2 -1
  75. package/node/Tabs/Tabs.js +16 -0
  76. package/node/index.js +1 -1
  77. package/node/styles/CssVarsProvider.js +3 -0
  78. package/package.json +6 -7
  79. package/styles/CssVarsProvider.js +3 -0
  80. package/umd/material-ui.development.js +291 -227
  81. package/umd/material-ui.production.min.js +21 -21
package/Tabs/Tabs.js CHANGED
@@ -417,10 +417,26 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
417
417
  scroll(scrollValue);
418
418
  };
419
419
 
420
+ const getFirstVisibleTab = tabs => {
421
+ const containerSize = tabsRef.current[clientSize];
422
+ const containerStartBound = Math.round(tabsRef.current[scrollStart]);
423
+ const containerEndBound = Math.round(containerStartBound + containerSize);
424
+ const offset = vertical ? 'offsetTop' : 'offsetLeft';
425
+ return tabs.find(tab => {
426
+ const centerPoint = tab[offset] + tab[clientSize] / 2;
427
+ return centerPoint >= containerStartBound && centerPoint <= containerEndBound;
428
+ });
429
+ };
430
+
420
431
  const getScrollSize = () => {
421
432
  const containerSize = tabsRef.current[clientSize];
422
433
  let totalSize = 0;
423
434
  const children = Array.from(tabListRef.current.children);
435
+ const firstVisibleTab = getFirstVisibleTab(children);
436
+
437
+ if (firstVisibleTab && firstVisibleTab[clientSize] > containerSize) {
438
+ return firstVisibleTab[clientSize];
439
+ }
424
440
 
425
441
  for (let i = 0; i < children.length; i += 1) {
426
442
  const tab = children[i];
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.1
1
+ /** @license MUI v5.8.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -90,7 +90,9 @@ var AlertMessage = styled('div', {
90
90
  return styles.message;
91
91
  }
92
92
  })({
93
- padding: '8px 0'
93
+ padding: '8px 0',
94
+ minWidth: 0,
95
+ overflow: 'auto'
94
96
  });
95
97
  var AlertAction = styled('div', {
96
98
  name: 'MuiAlert',
@@ -2,5 +2,5 @@ import { generateUtilityClass, generateUtilityClasses } from '@mui/base';
2
2
  export function getButtonUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiButton', slot);
4
4
  }
5
- var buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
5
+ var buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'textSuccess', 'textError', 'textInfo', 'textWarning', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'outlinedSuccess', 'outlinedError', 'outlinedInfo', 'outlinedWarning', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'containedSuccess', 'containedError', 'containedInfo', 'containedWarning', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
6
6
  export default buttonClasses;
@@ -43,19 +43,19 @@ var CheckboxRoot = styled(SwitchBase, {
43
43
  var theme = _ref.theme,
44
44
  ownerState = _ref.ownerState;
45
45
  return _extends({
46
- color: theme.palette.text.secondary
46
+ color: (theme.vars || theme).palette.text.secondary
47
47
  }, !ownerState.disableRipple && {
48
48
  '&:hover': {
49
- backgroundColor: alpha(ownerState.color === 'default' ? theme.palette.action.active : theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
49
+ backgroundColor: theme.vars ? "rgba(".concat(ownerState.color === 'default' ? theme.vars.palette.action.activeChannel : theme.vars.palette.primary.mainChannel, " / ").concat(theme.vars.palette.action.hoverOpacity, ")") : alpha(ownerState.color === 'default' ? theme.palette.action.active : theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
50
50
  // Reset on touch devices, it doesn't add specificity
51
51
  '@media (hover: none)': {
52
52
  backgroundColor: 'transparent'
53
53
  }
54
54
  }
55
55
  }, ownerState.color !== 'default' && (_ref2 = {}, _defineProperty(_ref2, "&.".concat(checkboxClasses.checked, ", &.").concat(checkboxClasses.indeterminate), {
56
- color: theme.palette[ownerState.color].main
56
+ color: (theme.vars || theme).palette[ownerState.color].main
57
57
  }), _defineProperty(_ref2, "&.".concat(checkboxClasses.disabled), {
58
- color: theme.palette.action.disabled
58
+ color: (theme.vars || theme).palette.action.disabled
59
59
  }), _ref2));
60
60
  });
61
61
 
@@ -21,6 +21,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/base';
21
21
  import requirePropFactory from '../utils/requirePropFactory';
22
22
  import styled from '../styles/styled';
23
23
  import useThemeProps from '../styles/useThemeProps';
24
+ import useTheme from '../styles/useTheme';
24
25
  import GridContext from './GridContext';
25
26
  import gridClasses, { getGridUtilityClass } from './gridClasses';
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -193,26 +194,29 @@ export function generateColumnGap(_ref5) {
193
194
 
194
195
  return styles;
195
196
  }
196
- export function resolveSpacingClasses(spacing, container) {
197
+ export function resolveSpacingStyles(spacing, breakpoints) {
197
198
  var styles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
198
199
 
199
- // in case of grid item or undefined/null or `spacing` <= 0
200
- if (!container || !spacing || spacing <= 0) {
200
+ // undefined/null or `spacing` <= 0
201
+ if (!spacing || spacing <= 0) {
201
202
  return [];
202
203
  } // in case of string/number `spacing`
203
204
 
204
205
 
205
206
  if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
206
- return [styles["spacing-xs-".concat(String(spacing))] || "spacing-xs-".concat(String(spacing))];
207
+ return [styles["spacing-xs-".concat(String(spacing))]];
207
208
  } // in case of object `spacing`
208
209
 
209
210
 
210
- var xs = spacing.xs,
211
- sm = spacing.sm,
212
- md = spacing.md,
213
- lg = spacing.lg,
214
- xl = spacing.xl;
215
- return [Number(xs) > 0 && (styles["spacing-xs-".concat(String(xs))] || "spacing-xs-".concat(String(xs))), Number(sm) > 0 && (styles["spacing-sm-".concat(String(sm))] || "spacing-sm-".concat(String(sm))), Number(md) > 0 && (styles["spacing-md-".concat(String(md))] || "spacing-md-".concat(String(md))), Number(lg) > 0 && (styles["spacing-lg-".concat(String(lg))] || "spacing-lg-".concat(String(lg))), Number(xl) > 0 && (styles["spacing-xl-".concat(String(xl))] || "spacing-xl-".concat(String(xl)))];
211
+ var spacingStyles = [];
212
+ breakpoints.forEach(function (breakpoint) {
213
+ var value = spacing[breakpoint];
214
+
215
+ if (Number(value) > 0) {
216
+ spacingStyles.push(styles["spacing-".concat(breakpoint, "-").concat(String(value))]);
217
+ }
218
+ });
219
+ return spacingStyles;
216
220
  } // Default CSS values
217
221
  // flex: '0 1 auto',
218
222
  // flexDirection: 'row',
@@ -224,19 +228,29 @@ var GridRoot = styled('div', {
224
228
  name: 'MuiGrid',
225
229
  slot: 'Root',
226
230
  overridesResolver: function overridesResolver(props, styles) {
227
- var _props$ownerState = props.ownerState,
228
- container = _props$ownerState.container,
229
- direction = _props$ownerState.direction,
230
- item = _props$ownerState.item,
231
- lg = _props$ownerState.lg,
232
- md = _props$ownerState.md,
233
- sm = _props$ownerState.sm,
234
- spacing = _props$ownerState.spacing,
235
- wrap = _props$ownerState.wrap,
236
- xl = _props$ownerState.xl,
237
- xs = _props$ownerState.xs,
238
- zeroMinWidth = _props$ownerState.zeroMinWidth;
239
- return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth].concat(_toConsumableArray(resolveSpacingClasses(spacing, container, styles)), [direction !== 'row' && styles["direction-xs-".concat(String(direction))], wrap !== 'wrap' && styles["wrap-xs-".concat(String(wrap))], xs !== false && styles["grid-xs-".concat(String(xs))], sm !== false && styles["grid-sm-".concat(String(sm))], md !== false && styles["grid-md-".concat(String(md))], lg !== false && styles["grid-lg-".concat(String(lg))], xl !== false && styles["grid-xl-".concat(String(xl))]]);
231
+ var ownerState = props.ownerState;
232
+ var container = ownerState.container,
233
+ direction = ownerState.direction,
234
+ item = ownerState.item,
235
+ spacing = ownerState.spacing,
236
+ wrap = ownerState.wrap,
237
+ zeroMinWidth = ownerState.zeroMinWidth,
238
+ breakpoints = ownerState.breakpoints;
239
+ var spacingStyles = []; // in case of grid item
240
+
241
+ if (container) {
242
+ spacingStyles = resolveSpacingStyles(spacing, breakpoints, styles);
243
+ }
244
+
245
+ var breakpointsStyles = [];
246
+ breakpoints.forEach(function (breakpoint) {
247
+ var value = ownerState[breakpoint];
248
+
249
+ if (value) {
250
+ breakpointsStyles.push(styles["grid-".concat(breakpoint, "-").concat(String(value))]);
251
+ }
252
+ });
253
+ return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth].concat(_toConsumableArray(spacingStyles), [direction !== 'row' && styles["direction-xs-".concat(String(direction))], wrap !== 'wrap' && styles["wrap-xs-".concat(String(wrap))]], breakpointsStyles);
240
254
  }
241
255
  })(function (_ref7) {
242
256
  var ownerState = _ref7.ownerState;
@@ -255,22 +269,55 @@ var GridRoot = styled('div', {
255
269
  flexWrap: ownerState.wrap
256
270
  });
257
271
  }, generateDirection, generateRowGap, generateColumnGap, generateGrid);
272
+ export function resolveSpacingClasses(spacing, breakpoints) {
273
+ // undefined/null or `spacing` <= 0
274
+ if (!spacing || spacing <= 0) {
275
+ return [];
276
+ } // in case of string/number `spacing`
277
+
278
+
279
+ if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
280
+ return ["spacing-xs-".concat(String(spacing))];
281
+ } // in case of object `spacing`
282
+
283
+
284
+ var classes = [];
285
+ breakpoints.forEach(function (breakpoint) {
286
+ var value = spacing[breakpoint];
287
+
288
+ if (Number(value) > 0) {
289
+ var className = "spacing-".concat(breakpoint, "-").concat(String(value));
290
+ classes.push(className);
291
+ }
292
+ });
293
+ return classes;
294
+ }
258
295
 
259
296
  var useUtilityClasses = function useUtilityClasses(ownerState) {
260
297
  var classes = ownerState.classes,
261
298
  container = ownerState.container,
262
299
  direction = ownerState.direction,
263
300
  item = ownerState.item,
264
- lg = ownerState.lg,
265
- md = ownerState.md,
266
- sm = ownerState.sm,
267
301
  spacing = ownerState.spacing,
268
302
  wrap = ownerState.wrap,
269
- xl = ownerState.xl,
270
- xs = ownerState.xs,
271
- zeroMinWidth = ownerState.zeroMinWidth;
303
+ zeroMinWidth = ownerState.zeroMinWidth,
304
+ breakpoints = ownerState.breakpoints;
305
+ var spacingClasses = []; // in case of grid item
306
+
307
+ if (container) {
308
+ spacingClasses = resolveSpacingClasses(spacing, breakpoints);
309
+ }
310
+
311
+ var breakpointsClasses = [];
312
+ breakpoints.forEach(function (breakpoint) {
313
+ var value = ownerState[breakpoint];
314
+
315
+ if (value) {
316
+ breakpointsClasses.push("grid-".concat(breakpoint, "-").concat(String(value)));
317
+ }
318
+ });
272
319
  var slots = {
273
- root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth'].concat(_toConsumableArray(resolveSpacingClasses(spacing, container)), [direction !== 'row' && "direction-xs-".concat(String(direction)), wrap !== 'wrap' && "wrap-xs-".concat(String(wrap)), xs !== false && "grid-xs-".concat(String(xs)), sm !== false && "grid-sm-".concat(String(sm)), md !== false && "grid-md-".concat(String(md)), lg !== false && "grid-lg-".concat(String(lg)), xl !== false && "grid-xl-".concat(String(xl))])
320
+ root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth'].concat(_toConsumableArray(spacingClasses), [direction !== 'row' && "direction-xs-".concat(String(direction)), wrap !== 'wrap' && "wrap-xs-".concat(String(wrap))], breakpointsClasses)
274
321
  };
275
322
  return composeClasses(slots, getGridUtilityClass, classes);
276
323
  };
@@ -280,6 +327,10 @@ var Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
280
327
  props: inProps,
281
328
  name: 'MuiGrid'
282
329
  });
330
+
331
+ var _useTheme = useTheme(),
332
+ breakpoints = _useTheme.breakpoints;
333
+
283
334
  var props = extendSxProp(themeProps);
284
335
 
285
336
  var className = props.className,
@@ -293,45 +344,43 @@ var Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
293
344
  direction = _props$direction === void 0 ? 'row' : _props$direction,
294
345
  _props$item = props.item,
295
346
  item = _props$item === void 0 ? false : _props$item,
296
- _props$lg = props.lg,
297
- lg = _props$lg === void 0 ? false : _props$lg,
298
- _props$md = props.md,
299
- md = _props$md === void 0 ? false : _props$md,
300
347
  rowSpacingProp = props.rowSpacing,
301
- _props$sm = props.sm,
302
- sm = _props$sm === void 0 ? false : _props$sm,
303
348
  _props$spacing = props.spacing,
304
349
  spacing = _props$spacing === void 0 ? 0 : _props$spacing,
305
350
  _props$wrap = props.wrap,
306
351
  wrap = _props$wrap === void 0 ? 'wrap' : _props$wrap,
307
- _props$xl = props.xl,
308
- xl = _props$xl === void 0 ? false : _props$xl,
309
- _props$xs = props.xs,
310
- xs = _props$xs === void 0 ? false : _props$xs,
311
352
  _props$zeroMinWidth = props.zeroMinWidth,
312
353
  zeroMinWidth = _props$zeroMinWidth === void 0 ? false : _props$zeroMinWidth,
313
- other = _objectWithoutProperties(props, ["className", "columns", "columnSpacing", "component", "container", "direction", "item", "lg", "md", "rowSpacing", "sm", "spacing", "wrap", "xl", "xs", "zeroMinWidth"]);
354
+ other = _objectWithoutProperties(props, ["className", "columns", "columnSpacing", "component", "container", "direction", "item", "rowSpacing", "spacing", "wrap", "zeroMinWidth"]);
314
355
 
315
356
  var rowSpacing = rowSpacingProp || spacing;
316
357
  var columnSpacing = columnSpacingProp || spacing;
317
358
  var columnsContext = React.useContext(GridContext); // columns set with default breakpoint unit of 12
318
359
 
319
360
  var columns = container ? columnsProp || 12 : columnsContext;
361
+ var breakpointsValues = {};
362
+
363
+ var otherFiltered = _extends({}, other);
364
+
365
+ breakpoints.keys.forEach(function (breakpoint) {
366
+ if (other[breakpoint] != null) {
367
+ breakpointsValues[breakpoint] = other[breakpoint];
368
+ delete otherFiltered[breakpoint];
369
+ }
370
+ });
320
371
 
321
372
  var ownerState = _extends({}, props, {
322
373
  columns: columns,
323
374
  container: container,
324
375
  direction: direction,
325
376
  item: item,
326
- lg: lg,
327
- md: md,
328
- sm: sm,
329
377
  rowSpacing: rowSpacing,
330
378
  columnSpacing: columnSpacing,
331
379
  wrap: wrap,
332
- xl: xl,
333
- xs: xs,
334
- zeroMinWidth: zeroMinWidth
380
+ zeroMinWidth: zeroMinWidth,
381
+ spacing: spacing
382
+ }, breakpointsValues, {
383
+ breakpoints: breakpoints.keys
335
384
  });
336
385
 
337
386
  var classes = useUtilityClasses(ownerState);
@@ -342,7 +391,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
342
391
  className: clsx(classes.root, className),
343
392
  as: component,
344
393
  ref: ref
345
- }, other))
394
+ }, otherFiltered))
346
395
  });
347
396
  });
348
397
  process.env.NODE_ENV !== "production" ? Grid.propTypes
@@ -23,12 +23,12 @@ var styles = {
23
23
  transform: 'none'
24
24
  }
25
25
  };
26
- /**
27
- * Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
28
- * Remove this workaround once the WebKit bug fix is released.
26
+ /*
27
+ TODO v6: remove
28
+ Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
29
29
  */
30
30
 
31
- var isWebKit154 = typeof navigator !== 'undefined' && /^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) && /(os |version\/)15(.|_)[4-9]/i.test(navigator.userAgent);
31
+ var isWebKit154 = typeof navigator !== 'undefined' && /^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) && /(os |version\/)15(.|_)4/i.test(navigator.userAgent);
32
32
  /**
33
33
  * The Grow transition is used by the [Tooltip](/material-ui/react-tooltip/) and
34
34
  * [Popover](/material-ui/react-popover/) components.
@@ -4,7 +4,6 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { getDisplayName } from '@mui/utils';
6
6
  import { getThemeProps } from '@mui/system';
7
- import hoistNonReactStatics from 'hoist-non-react-statics';
8
7
  import useTheme from '../styles/useTheme';
9
8
  import useEnhancedEffect from '../utils/useEnhancedEffect';
10
9
  import useMediaQuery from '../useMediaQuery';
@@ -119,7 +118,6 @@ var withWidth = function withWidth() {
119
118
  WithWidth.displayName = "WithWidth(".concat(getDisplayName(Component), ")");
120
119
  }
121
120
 
122
- hoistNonReactStatics(WithWidth, Component);
123
121
  return WithWidth;
124
122
  };
125
123
  };
@@ -207,6 +207,12 @@ process.env.NODE_ENV !== "production" ? InputLabel.propTypes
207
207
  */
208
208
  shrink: PropTypes.bool,
209
209
 
210
+ /**
211
+ * The size of the component.
212
+ * @default 'normal'
213
+ */
214
+ size: PropTypes.oneOf(['normal', 'small']),
215
+
210
216
  /**
211
217
  * The system prop that allows defining system overrides as well as additional CSS styles.
212
218
  */
@@ -7,7 +7,6 @@ import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
8
8
  import { elementTypeAcceptingRef } from '@mui/utils';
9
9
  import { unstable_composeClasses as composeClasses } from '@mui/base';
10
- import { alpha, getPath } from '@mui/system';
11
10
  import capitalize from '../utils/capitalize';
12
11
  import styled from '../styles/styled';
13
12
  import useThemeProps from '../styles/useThemeProps';
@@ -15,18 +14,8 @@ import useIsFocusVisible from '../utils/useIsFocusVisible';
15
14
  import useForkRef from '../utils/useForkRef';
16
15
  import Typography from '../Typography';
17
16
  import linkClasses, { getLinkUtilityClass } from './linkClasses';
17
+ import getTextDecoration, { colorTransformations } from './getTextDecoration';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
- var colorTransformations = {
20
- primary: 'primary.main',
21
- textPrimary: 'text.primary',
22
- secondary: 'secondary.main',
23
- textSecondary: 'text.secondary',
24
- error: 'error.main'
25
- };
26
-
27
- var transformDeprecatedColors = function transformDeprecatedColors(color) {
28
- return colorTransformations[color] || color;
29
- };
30
19
 
31
20
  var useUtilityClasses = function useUtilityClasses(ownerState) {
32
21
  var classes = ownerState.classes,
@@ -49,7 +38,6 @@ var LinkRoot = styled(Typography, {
49
38
  })(function (_ref) {
50
39
  var theme = _ref.theme,
51
40
  ownerState = _ref.ownerState;
52
- var color = getPath(theme, "palette.".concat(transformDeprecatedColors(ownerState.color))) || ownerState.color;
53
41
  return _extends({}, ownerState.underline === 'none' && {
54
42
  textDecoration: 'none'
55
43
  }, ownerState.underline === 'hover' && {
@@ -57,13 +45,18 @@ var LinkRoot = styled(Typography, {
57
45
  '&:hover': {
58
46
  textDecoration: 'underline'
59
47
  }
60
- }, ownerState.underline === 'always' && {
61
- textDecoration: 'underline',
62
- textDecorationColor: color !== 'inherit' ? alpha(color, 0.4) : undefined,
48
+ }, ownerState.underline === 'always' && _extends({
49
+ textDecoration: 'underline'
50
+ }, ownerState.color !== 'inherit' && {
51
+ textDecorationColor: getTextDecoration({
52
+ theme: theme,
53
+ ownerState: ownerState
54
+ })
55
+ }, {
63
56
  '&:hover': {
64
57
  textDecorationColor: 'inherit'
65
58
  }
66
- }, ownerState.component === 'button' && _defineProperty({
59
+ }), ownerState.component === 'button' && _defineProperty({
67
60
  position: 'relative',
68
61
  WebkitTapHighlightColor: 'transparent',
69
62
  backgroundColor: 'transparent',
@@ -0,0 +1,28 @@
1
+ import { alpha, getPath } from '@mui/system';
2
+ export var colorTransformations = {
3
+ primary: 'primary.main',
4
+ textPrimary: 'text.primary',
5
+ secondary: 'secondary.main',
6
+ textSecondary: 'text.secondary',
7
+ error: 'error.main'
8
+ };
9
+
10
+ var transformDeprecatedColors = function transformDeprecatedColors(color) {
11
+ return colorTransformations[color] || color;
12
+ };
13
+
14
+ var getTextDecoration = function getTextDecoration(_ref) {
15
+ var theme = _ref.theme,
16
+ ownerState = _ref.ownerState;
17
+ var transformedColor = transformDeprecatedColors(ownerState.color);
18
+ var color = getPath(theme, "palette.".concat(transformedColor), false) || ownerState.color;
19
+ var channelColor = getPath(theme, "palette.".concat(transformedColor, "Channel"));
20
+
21
+ if ('vars' in theme && channelColor) {
22
+ return "rgba(".concat(channelColor, " / 0.4)");
23
+ }
24
+
25
+ return alpha(color, 0.4);
26
+ };
27
+
28
+ export default getTextDecoration;
@@ -1,3 +1,4 @@
1
1
  export { default } from './Popover';
2
+ export * from './Popover';
2
3
  export { default as popoverClasses } from './popoverClasses';
3
4
  export * from './popoverClasses';
@@ -283,7 +283,6 @@ var SliderValueLabel = styled(SliderValueLabelUnstyled, {
283
283
  transition: theme.transitions.create(['transform'], {
284
284
  duration: theme.transitions.duration.shortest
285
285
  }),
286
- top: -10,
287
286
  transformOrigin: 'bottom center',
288
287
  transform: 'translateY(-100%) scale(0)',
289
288
  position: 'absolute',
@@ -294,20 +293,34 @@ var SliderValueLabel = styled(SliderValueLabelUnstyled, {
294
293
  alignItems: 'center',
295
294
  justifyContent: 'center',
296
295
  padding: '0.25rem 0.75rem'
297
- }, ownerState.size === 'small' && {
298
- fontSize: theme.typography.pxToRem(12),
299
- padding: '0.25rem 0.5rem'
300
- }, {
296
+ }, ownerState.orientation === 'horizontal' && {
297
+ top: '-10px',
301
298
  '&:before': {
302
299
  position: 'absolute',
303
300
  content: '""',
304
301
  width: 8,
305
302
  height: 8,
303
+ transform: 'translate(-50%, 50%) rotate(45deg)',
304
+ backgroundColor: 'inherit',
306
305
  bottom: 0,
307
- left: '50%',
306
+ left: '50%'
307
+ }
308
+ }, ownerState.orientation === 'vertical' && {
309
+ right: '30px',
310
+ top: '25px',
311
+ '&:before': {
312
+ position: 'absolute',
313
+ content: '""',
314
+ width: 8,
315
+ height: 8,
308
316
  transform: 'translate(-50%, 50%) rotate(45deg)',
309
- backgroundColor: 'inherit'
317
+ backgroundColor: 'inherit',
318
+ right: '-20%',
319
+ top: '25%'
310
320
  }
321
+ }, ownerState.size === 'small' && {
322
+ fontSize: theme.typography.pxToRem(12),
323
+ padding: '0.25rem 0.5rem'
311
324
  });
312
325
  });
313
326
  process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes
@@ -585,12 +598,14 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
585
598
  thumb: PropTypes.object,
586
599
  track: PropTypes.object,
587
600
  valueLabel: PropTypes.shape({
601
+ children: PropTypes.element,
588
602
  className: PropTypes.string,
589
603
  components: PropTypes.shape({
590
604
  Root: PropTypes.elementType
591
605
  }),
606
+ open: PropTypes.bool,
592
607
  style: PropTypes.object,
593
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
608
+ value: PropTypes.number,
594
609
  valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on'])
595
610
  })
596
611
  }),
@@ -35,17 +35,11 @@ var SnackbarRoot = styled('div', {
35
35
  })(function (_ref) {
36
36
  var theme = _ref.theme,
37
37
  ownerState = _ref.ownerState;
38
-
39
- var center = _extends({}, !ownerState.isRtl && {
38
+ var center = {
40
39
  left: '50%',
41
40
  right: 'auto',
42
41
  transform: 'translateX(-50%)'
43
- }, ownerState.isRtl && {
44
- right: '50%',
45
- left: 'auto',
46
- transform: 'translateX(50%)'
47
- });
48
-
42
+ };
49
43
  return _extends({
50
44
  zIndex: (theme.vars || theme).zIndex.snackbar,
51
45
  position: 'fixed',
@@ -66,19 +60,13 @@ var SnackbarRoot = styled('div', {
66
60
  top: 24
67
61
  } : {
68
62
  bottom: 24
69
- }, ownerState.anchorOrigin.horizontal === 'center' && center, ownerState.anchorOrigin.horizontal === 'left' && _extends({}, !ownerState.isRtl && {
63
+ }, ownerState.anchorOrigin.horizontal === 'center' && center, ownerState.anchorOrigin.horizontal === 'left' && {
70
64
  left: 24,
71
65
  right: 'auto'
72
- }, ownerState.isRtl && {
73
- right: 24,
74
- left: 'auto'
75
- }), ownerState.anchorOrigin.horizontal === 'right' && _extends({}, !ownerState.isRtl && {
66
+ }, ownerState.anchorOrigin.horizontal === 'right' && {
76
67
  right: 24,
77
68
  left: 'auto'
78
- }, ownerState.isRtl && {
79
- left: 24,
80
- right: 'auto'
81
- }))));
69
+ })));
82
70
  });
83
71
  var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
84
72
  var props = useThemeProps({
@@ -126,14 +114,11 @@ var Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
126
114
  TransitionProps = _objectWithoutProperties(_props$TransitionProp, ["onEnter", "onExited"]),
127
115
  other = _objectWithoutProperties(props, ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"]);
128
116
 
129
- var isRtl = theme.direction === 'rtl';
130
-
131
117
  var ownerState = _extends({}, props, {
132
118
  anchorOrigin: {
133
119
  vertical: vertical,
134
120
  horizontal: horizontal
135
- },
136
- isRtl: isRtl
121
+ }
137
122
  });
138
123
 
139
124
  var classes = useUtilityClasses(ownerState);
@@ -1,5 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
3
4
  import _extends from "@babel/runtime/helpers/esm/extends";
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
@@ -61,7 +62,7 @@ export var style = function style(_ref) {
61
62
  if (ownerState.spacing) {
62
63
  var transformer = createUnarySpacing(theme);
63
64
  var base = Object.keys(theme.breakpoints.values).reduce(function (acc, breakpoint) {
64
- if (ownerState.spacing[breakpoint] != null || ownerState.direction[breakpoint] != null) {
65
+ if (_typeof(ownerState.spacing) === 'object' && ownerState.spacing[breakpoint] != null || _typeof(ownerState.direction) === 'object' && ownerState.direction[breakpoint] != null) {
65
66
  acc[breakpoint] = true;
66
67
  }
67
68
 
@@ -124,8 +124,9 @@ var StepIcon = /*#__PURE__*/React.forwardRef(function StepIcon(inProps, ref) {
124
124
  })), /*#__PURE__*/_jsx(StepIconText, {
125
125
  className: classes.text,
126
126
  x: "12",
127
- y: "16",
127
+ y: "12",
128
128
  textAnchor: "middle",
129
+ dominantBaseline: "central",
129
130
  ownerState: ownerState,
130
131
  children: icon
131
132
  })]
@@ -429,10 +429,26 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
429
429
  scroll(scrollValue);
430
430
  };
431
431
 
432
+ var getFirstVisibleTab = function getFirstVisibleTab(tabs) {
433
+ var containerSize = tabsRef.current[clientSize];
434
+ var containerStartBound = Math.round(tabsRef.current[scrollStart]);
435
+ var containerEndBound = Math.round(containerStartBound + containerSize);
436
+ var offset = vertical ? 'offsetTop' : 'offsetLeft';
437
+ return tabs.find(function (tab) {
438
+ var centerPoint = tab[offset] + tab[clientSize] / 2;
439
+ return centerPoint >= containerStartBound && centerPoint <= containerEndBound;
440
+ });
441
+ };
442
+
432
443
  var getScrollSize = function getScrollSize() {
433
444
  var containerSize = tabsRef.current[clientSize];
434
445
  var totalSize = 0;
435
446
  var children = Array.from(tabListRef.current.children);
447
+ var firstVisibleTab = getFirstVisibleTab(children);
448
+
449
+ if (firstVisibleTab && firstVisibleTab[clientSize] > containerSize) {
450
+ return firstVisibleTab[clientSize];
451
+ }
436
452
 
437
453
  for (var i = 0; i < children.length; i += 1) {
438
454
  var tab = children[i];
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.8.1
1
+ /** @license MUI v5.8.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.