@mui/material 5.8.3 → 5.8.6

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 (158) hide show
  1. package/Alert/Alert.js +19 -11
  2. package/AppBar/AppBar.js +22 -5
  3. package/Autocomplete/autocompleteClasses.d.ts +1 -1
  4. package/Avatar/Avatar.js +7 -4
  5. package/Badge/Badge.js +2 -2
  6. package/Button/buttonClasses.d.ts +24 -0
  7. package/Button/buttonClasses.js +1 -1
  8. package/CHANGELOG.md +224 -14
  9. package/Chip/Chip.js +31 -30
  10. package/Dialog/Dialog.js +11 -6
  11. package/FilledInput/FilledInput.js +28 -13
  12. package/Grid/Grid.d.ts +73 -52
  13. package/Grid/Grid.js +94 -40
  14. package/Grow/Grow.js +1 -2
  15. package/Hidden/withWidth.js +0 -2
  16. package/Input/Input.js +1 -1
  17. package/InputBase/InputBase.js +2 -2
  18. package/LinearProgress/LinearProgress.js +6 -2
  19. package/Link/Link.js +10 -17
  20. package/Link/getTextDecoration.d.ts +15 -0
  21. package/Link/getTextDecoration.js +29 -0
  22. package/Modal/Modal.d.ts +2 -0
  23. package/Modal/Modal.js +25 -8
  24. package/OutlinedInput/OutlinedInput.js +40 -10
  25. package/Popover/Popover.d.ts +7 -0
  26. package/Popover/index.js +1 -0
  27. package/README.md +6 -9
  28. package/Skeleton/Skeleton.js +8 -3
  29. package/Slider/Slider.d.ts +3 -1
  30. package/Slider/Slider.js +24 -22
  31. package/Snackbar/Snackbar.js +6 -20
  32. package/SnackbarContent/SnackbarContent.js +3 -3
  33. package/SpeedDialAction/SpeedDialAction.js +7 -7
  34. package/Stack/Stack.js +1 -1
  35. package/StepConnector/StepConnector.js +14 -11
  36. package/StepContent/StepContent.js +1 -1
  37. package/StepIcon/StepIcon.js +2 -1
  38. package/Switch/Switch.js +11 -11
  39. package/Tab/Tab.d.ts +0 -1
  40. package/TableCell/TableCell.js +5 -5
  41. package/Tabs/Tabs.js +16 -2
  42. package/Tooltip/Tooltip.js +1 -1
  43. package/index.js +1 -1
  44. package/legacy/Alert/Alert.js +19 -11
  45. package/legacy/AppBar/AppBar.js +23 -4
  46. package/legacy/Avatar/Avatar.js +7 -4
  47. package/legacy/Badge/Badge.js +2 -2
  48. package/legacy/Button/buttonClasses.js +1 -1
  49. package/legacy/Chip/Chip.js +31 -30
  50. package/legacy/Dialog/Dialog.js +11 -6
  51. package/legacy/FilledInput/FilledInput.js +28 -14
  52. package/legacy/Grid/Grid.js +97 -48
  53. package/legacy/Grow/Grow.js +1 -2
  54. package/legacy/Hidden/withWidth.js +0 -2
  55. package/legacy/Input/Input.js +1 -1
  56. package/legacy/InputBase/InputBase.js +2 -2
  57. package/legacy/LinearProgress/LinearProgress.js +6 -2
  58. package/legacy/Link/Link.js +10 -17
  59. package/legacy/Link/getTextDecoration.js +28 -0
  60. package/legacy/Modal/Modal.js +23 -7
  61. package/legacy/OutlinedInput/OutlinedInput.js +36 -9
  62. package/legacy/Popover/index.js +1 -0
  63. package/legacy/Skeleton/Skeleton.js +2 -2
  64. package/legacy/Slider/Slider.js +24 -22
  65. package/legacy/Snackbar/Snackbar.js +6 -21
  66. package/legacy/SnackbarContent/SnackbarContent.js +3 -3
  67. package/legacy/SpeedDialAction/SpeedDialAction.js +7 -7
  68. package/legacy/Stack/Stack.js +2 -1
  69. package/legacy/StepConnector/StepConnector.js +2 -1
  70. package/legacy/StepContent/StepContent.js +1 -1
  71. package/legacy/StepIcon/StepIcon.js +2 -1
  72. package/legacy/Switch/Switch.js +11 -11
  73. package/legacy/TableCell/TableCell.js +5 -5
  74. package/legacy/Tabs/Tabs.js +16 -2
  75. package/legacy/Tooltip/Tooltip.js +1 -1
  76. package/legacy/index.js +1 -1
  77. package/legacy/styles/CssVarsProvider.js +4 -2
  78. package/legacy/styles/experimental_extendTheme.js +153 -18
  79. package/modern/Alert/Alert.js +19 -11
  80. package/modern/AppBar/AppBar.js +22 -5
  81. package/modern/Avatar/Avatar.js +7 -4
  82. package/modern/Badge/Badge.js +2 -2
  83. package/modern/Button/buttonClasses.js +1 -1
  84. package/modern/Chip/Chip.js +31 -30
  85. package/modern/Dialog/Dialog.js +11 -6
  86. package/modern/FilledInput/FilledInput.js +27 -12
  87. package/modern/Grid/Grid.js +94 -40
  88. package/modern/Grow/Grow.js +1 -2
  89. package/modern/Hidden/withWidth.js +0 -2
  90. package/modern/Input/Input.js +1 -1
  91. package/modern/InputBase/InputBase.js +2 -2
  92. package/modern/LinearProgress/LinearProgress.js +6 -2
  93. package/modern/Link/Link.js +10 -17
  94. package/modern/Link/getTextDecoration.js +29 -0
  95. package/modern/Modal/Modal.js +24 -7
  96. package/modern/OutlinedInput/OutlinedInput.js +40 -10
  97. package/modern/Popover/index.js +1 -0
  98. package/modern/Skeleton/Skeleton.js +7 -2
  99. package/modern/Slider/Slider.js +24 -22
  100. package/modern/Snackbar/Snackbar.js +6 -20
  101. package/modern/SnackbarContent/SnackbarContent.js +3 -3
  102. package/modern/SpeedDialAction/SpeedDialAction.js +7 -7
  103. package/modern/Stack/Stack.js +1 -1
  104. package/modern/StepConnector/StepConnector.js +14 -11
  105. package/modern/StepContent/StepContent.js +1 -1
  106. package/modern/StepIcon/StepIcon.js +2 -1
  107. package/modern/Switch/Switch.js +11 -11
  108. package/modern/TableCell/TableCell.js +5 -5
  109. package/modern/Tabs/Tabs.js +16 -2
  110. package/modern/Tooltip/Tooltip.js +1 -1
  111. package/modern/index.js +1 -1
  112. package/modern/styles/CssVarsProvider.js +2 -2
  113. package/modern/styles/experimental_extendTheme.js +154 -18
  114. package/node/Alert/Alert.js +19 -11
  115. package/node/AppBar/AppBar.js +22 -5
  116. package/node/Avatar/Avatar.js +7 -4
  117. package/node/Badge/Badge.js +2 -2
  118. package/node/Button/buttonClasses.js +1 -1
  119. package/node/Chip/Chip.js +31 -30
  120. package/node/Dialog/Dialog.js +11 -6
  121. package/node/FilledInput/FilledInput.js +28 -13
  122. package/node/Grid/Grid.js +95 -40
  123. package/node/Grow/Grow.js +1 -2
  124. package/node/Hidden/withWidth.js +0 -3
  125. package/node/Input/Input.js +1 -1
  126. package/node/InputBase/InputBase.js +2 -2
  127. package/node/LinearProgress/LinearProgress.js +6 -2
  128. package/node/Link/Link.js +12 -20
  129. package/node/Link/getTextDecoration.js +39 -0
  130. package/node/Modal/Modal.js +25 -8
  131. package/node/OutlinedInput/OutlinedInput.js +38 -10
  132. package/node/Popover/index.js +13 -3
  133. package/node/Skeleton/Skeleton.js +7 -2
  134. package/node/Slider/Slider.js +24 -22
  135. package/node/Snackbar/Snackbar.js +6 -18
  136. package/node/SnackbarContent/SnackbarContent.js +3 -3
  137. package/node/SpeedDialAction/SpeedDialAction.js +7 -7
  138. package/node/Stack/Stack.js +1 -1
  139. package/node/StepConnector/StepConnector.js +14 -11
  140. package/node/StepContent/StepContent.js +1 -1
  141. package/node/StepIcon/StepIcon.js +2 -1
  142. package/node/Switch/Switch.js +11 -11
  143. package/node/TableCell/TableCell.js +5 -5
  144. package/node/Tabs/Tabs.js +16 -2
  145. package/node/Tooltip/Tooltip.js +1 -1
  146. package/node/index.js +1 -1
  147. package/node/styles/CssVarsProvider.js +6 -2
  148. package/node/styles/experimental_extendTheme.js +152 -17
  149. package/package.json +6 -7
  150. package/styles/CssVarsProvider.d.ts +10 -28
  151. package/styles/CssVarsProvider.js +6 -2
  152. package/styles/createPalette.d.ts +0 -26
  153. package/styles/experimental_extendTheme.d.ts +225 -37
  154. package/styles/experimental_extendTheme.js +154 -18
  155. package/styles/index.d.ts +24 -1
  156. package/themeCssVarsAugmentation/index.d.ts +61 -0
  157. package/umd/material-ui.development.js +1048 -541
  158. package/umd/material-ui.production.min.js +27 -22
package/Grid/Grid.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["className", "columns", "columnSpacing", "component", "container", "direction", "item", "lg", "md", "rowSpacing", "sm", "spacing", "wrap", "xl", "xs", "zeroMinWidth"];
3
+ const _excluded = ["className", "columns", "columnSpacing", "component", "container", "direction", "item", "rowSpacing", "spacing", "wrap", "zeroMinWidth"];
4
4
  // A grid component using the following libs as inspiration.
5
5
  //
6
6
  // For the implementation:
@@ -19,6 +19,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/base';
19
19
  import requirePropFactory from '../utils/requirePropFactory';
20
20
  import styled from '../styles/styled';
21
21
  import useThemeProps from '../styles/useThemeProps';
22
+ import useTheme from '../styles/useTheme';
22
23
  import GridContext from './GridContext';
23
24
  import gridClasses, { getGridUtilityClass } from './gridClasses';
24
25
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -201,26 +202,27 @@ export function generateColumnGap({
201
202
 
202
203
  return styles;
203
204
  }
204
- export function resolveSpacingClasses(spacing, container, styles = {}) {
205
- // in case of grid item or undefined/null or `spacing` <= 0
206
- if (!container || !spacing || spacing <= 0) {
205
+ export function resolveSpacingStyles(spacing, breakpoints, styles = {}) {
206
+ // undefined/null or `spacing` <= 0
207
+ if (!spacing || spacing <= 0) {
207
208
  return [];
208
209
  } // in case of string/number `spacing`
209
210
 
210
211
 
211
212
  if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
212
- return [styles[`spacing-xs-${String(spacing)}`] || `spacing-xs-${String(spacing)}`];
213
+ return [styles[`spacing-xs-${String(spacing)}`]];
213
214
  } // in case of object `spacing`
214
215
 
215
216
 
216
- const {
217
- xs,
218
- sm,
219
- md,
220
- lg,
221
- xl
222
- } = spacing;
223
- return [Number(xs) > 0 && (styles[`spacing-xs-${String(xs)}`] || `spacing-xs-${String(xs)}`), Number(sm) > 0 && (styles[`spacing-sm-${String(sm)}`] || `spacing-sm-${String(sm)}`), Number(md) > 0 && (styles[`spacing-md-${String(md)}`] || `spacing-md-${String(md)}`), Number(lg) > 0 && (styles[`spacing-lg-${String(lg)}`] || `spacing-lg-${String(lg)}`), Number(xl) > 0 && (styles[`spacing-xl-${String(xl)}`] || `spacing-xl-${String(xl)}`)];
217
+ const spacingStyles = [];
218
+ breakpoints.forEach(breakpoint => {
219
+ const value = spacing[breakpoint];
220
+
221
+ if (Number(value) > 0) {
222
+ spacingStyles.push(styles[`spacing-${breakpoint}-${String(value)}`]);
223
+ }
224
+ });
225
+ return spacingStyles;
224
226
  } // Default CSS values
225
227
  // flex: '0 1 auto',
226
228
  // flexDirection: 'row',
@@ -232,20 +234,33 @@ const GridRoot = styled('div', {
232
234
  name: 'MuiGrid',
233
235
  slot: 'Root',
234
236
  overridesResolver: (props, styles) => {
237
+ const {
238
+ ownerState
239
+ } = props;
235
240
  const {
236
241
  container,
237
242
  direction,
238
243
  item,
239
- lg,
240
- md,
241
- sm,
242
244
  spacing,
243
245
  wrap,
244
- xl,
245
- xs,
246
- zeroMinWidth
247
- } = props.ownerState;
248
- return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth, ...resolveSpacingClasses(spacing, container, styles), direction !== 'row' && styles[`direction-xs-${String(direction)}`], wrap !== 'wrap' && styles[`wrap-xs-${String(wrap)}`], xs !== false && styles[`grid-xs-${String(xs)}`], sm !== false && styles[`grid-sm-${String(sm)}`], md !== false && styles[`grid-md-${String(md)}`], lg !== false && styles[`grid-lg-${String(lg)}`], xl !== false && styles[`grid-xl-${String(xl)}`]];
246
+ zeroMinWidth,
247
+ breakpoints
248
+ } = ownerState;
249
+ let spacingStyles = []; // in case of grid item
250
+
251
+ if (container) {
252
+ spacingStyles = resolveSpacingStyles(spacing, breakpoints, styles);
253
+ }
254
+
255
+ const breakpointsStyles = [];
256
+ breakpoints.forEach(breakpoint => {
257
+ const value = ownerState[breakpoint];
258
+
259
+ if (value) {
260
+ breakpointsStyles.push(styles[`grid-${breakpoint}-${String(value)}`]);
261
+ }
262
+ });
263
+ return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth, ...spacingStyles, direction !== 'row' && styles[`direction-xs-${String(direction)}`], wrap !== 'wrap' && styles[`wrap-xs-${String(wrap)}`], ...breakpointsStyles];
249
264
  }
250
265
  })(({
251
266
  ownerState
@@ -263,6 +278,29 @@ const GridRoot = styled('div', {
263
278
  }, ownerState.wrap !== 'wrap' && {
264
279
  flexWrap: ownerState.wrap
265
280
  }), generateDirection, generateRowGap, generateColumnGap, generateGrid);
281
+ export function resolveSpacingClasses(spacing, breakpoints) {
282
+ // undefined/null or `spacing` <= 0
283
+ if (!spacing || spacing <= 0) {
284
+ return [];
285
+ } // in case of string/number `spacing`
286
+
287
+
288
+ if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
289
+ return [`spacing-xs-${String(spacing)}`];
290
+ } // in case of object `spacing`
291
+
292
+
293
+ const classes = [];
294
+ breakpoints.forEach(breakpoint => {
295
+ const value = spacing[breakpoint];
296
+
297
+ if (Number(value) > 0) {
298
+ const className = `spacing-${breakpoint}-${String(value)}`;
299
+ classes.push(className);
300
+ }
301
+ });
302
+ return classes;
303
+ }
266
304
 
267
305
  const useUtilityClasses = ownerState => {
268
306
  const {
@@ -270,17 +308,27 @@ const useUtilityClasses = ownerState => {
270
308
  container,
271
309
  direction,
272
310
  item,
273
- lg,
274
- md,
275
- sm,
276
311
  spacing,
277
312
  wrap,
278
- xl,
279
- xs,
280
- zeroMinWidth
313
+ zeroMinWidth,
314
+ breakpoints
281
315
  } = ownerState;
316
+ let spacingClasses = []; // in case of grid item
317
+
318
+ if (container) {
319
+ spacingClasses = resolveSpacingClasses(spacing, breakpoints);
320
+ }
321
+
322
+ const breakpointsClasses = [];
323
+ breakpoints.forEach(breakpoint => {
324
+ const value = ownerState[breakpoint];
325
+
326
+ if (value) {
327
+ breakpointsClasses.push(`grid-${breakpoint}-${String(value)}`);
328
+ }
329
+ });
282
330
  const slots = {
283
- root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth', ...resolveSpacingClasses(spacing, container), direction !== 'row' && `direction-xs-${String(direction)}`, wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, xs !== false && `grid-xs-${String(xs)}`, sm !== false && `grid-sm-${String(sm)}`, md !== false && `grid-md-${String(md)}`, lg !== false && `grid-lg-${String(lg)}`, xl !== false && `grid-xl-${String(xl)}`]
331
+ root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth', ...spacingClasses, direction !== 'row' && `direction-xs-${String(direction)}`, wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...breakpointsClasses]
284
332
  };
285
333
  return composeClasses(slots, getGridUtilityClass, classes);
286
334
  };
@@ -290,6 +338,9 @@ const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
290
338
  props: inProps,
291
339
  name: 'MuiGrid'
292
340
  });
341
+ const {
342
+ breakpoints
343
+ } = useTheme();
293
344
  const props = extendSxProp(themeProps);
294
345
 
295
346
  const {
@@ -300,14 +351,9 @@ const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
300
351
  container = false,
301
352
  direction = 'row',
302
353
  item = false,
303
- lg = false,
304
- md = false,
305
354
  rowSpacing: rowSpacingProp,
306
- sm = false,
307
355
  spacing = 0,
308
356
  wrap = 'wrap',
309
- xl = false,
310
- xs = false,
311
357
  zeroMinWidth = false
312
358
  } = props,
313
359
  other = _objectWithoutPropertiesLoose(props, _excluded);
@@ -317,21 +363,29 @@ const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
317
363
  const columnsContext = React.useContext(GridContext); // columns set with default breakpoint unit of 12
318
364
 
319
365
  const columns = container ? columnsProp || 12 : columnsContext;
366
+ const breakpointsValues = {};
367
+
368
+ const otherFiltered = _extends({}, other);
369
+
370
+ breakpoints.keys.forEach(breakpoint => {
371
+ if (other[breakpoint] != null) {
372
+ breakpointsValues[breakpoint] = other[breakpoint];
373
+ delete otherFiltered[breakpoint];
374
+ }
375
+ });
320
376
 
321
377
  const ownerState = _extends({}, props, {
322
378
  columns,
323
379
  container,
324
380
  direction,
325
381
  item,
326
- lg,
327
- md,
328
- sm,
329
382
  rowSpacing,
330
383
  columnSpacing,
331
384
  wrap,
332
- xl,
333
- xs,
334
- zeroMinWidth
385
+ zeroMinWidth,
386
+ spacing
387
+ }, breakpointsValues, {
388
+ breakpoints: breakpoints.keys
335
389
  });
336
390
 
337
391
  const classes = useUtilityClasses(ownerState);
@@ -342,7 +396,7 @@ const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
342
396
  className: clsx(classes.root, className),
343
397
  as: component,
344
398
  ref: ref
345
- }, other))
399
+ }, otherFiltered))
346
400
  });
347
401
  });
348
402
  process.env.NODE_ENV !== "production" ? Grid.propTypes
package/Grow/Grow.js CHANGED
@@ -27,10 +27,9 @@ const styles = {
27
27
  /*
28
28
  TODO v6: remove
29
29
  Conditionally apply a workaround for the CSS transition bug in Safari 15.4 / WebKit browsers.
30
- Remove this workaround once the WebKit bug fix is released.
31
30
  */
32
31
 
33
- const isWebKit154 = typeof navigator !== 'undefined' && /^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) && /(os |version\/)15(.|_)[4-9]/i.test(navigator.userAgent);
32
+ const isWebKit154 = typeof navigator !== 'undefined' && /^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent) && /(os |version\/)15(.|_)4/i.test(navigator.userAgent);
34
33
  /**
35
34
  * The Grow transition is used by the [Tooltip](/material-ui/react-tooltip/) and
36
35
  * [Popover](/material-ui/react-popover/) components.
@@ -5,7 +5,6 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { getDisplayName } from '@mui/utils';
7
7
  import { getThemeProps } from '@mui/system';
8
- import hoistNonReactStatics from 'hoist-non-react-statics';
9
8
  import useTheme from '../styles/useTheme';
10
9
  import useEnhancedEffect from '../utils/useEnhancedEffect';
11
10
  import useMediaQuery from '../useMediaQuery';
@@ -113,7 +112,6 @@ const withWidth = (options = {}) => Component => {
113
112
  WithWidth.displayName = `WithWidth(${getDisplayName(Component)})`;
114
113
  }
115
114
 
116
- hoistNonReactStatics(WithWidth, Component);
117
115
  return WithWidth;
118
116
  };
119
117
 
package/Input/Input.js CHANGED
@@ -43,7 +43,7 @@ const InputRoot = styled(InputBaseRoot, {
43
43
  let bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
44
44
 
45
45
  if (theme.vars) {
46
- bottomLineColor = `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputTouchBottomLine})`;
46
+ bottomLineColor = `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})`;
47
47
  }
48
48
 
49
49
  return _extends({
@@ -97,7 +97,7 @@ export const InputBaseComponent = styled('input', {
97
97
  const placeholder = _extends({
98
98
  color: 'currentColor'
99
99
  }, theme.vars ? {
100
- opacity: theme.vars.opacity.placeholder
100
+ opacity: theme.vars.opacity.inputPlaceholder
101
101
  } : {
102
102
  opacity: light ? 0.42 : 0.5
103
103
  }, {
@@ -110,7 +110,7 @@ export const InputBaseComponent = styled('input', {
110
110
  opacity: '0 !important'
111
111
  };
112
112
  const placeholderVisible = theme.vars ? {
113
- opacity: theme.vars.opacity.placeholder
113
+ opacity: theme.vars.opacity.inputPlaceholder
114
114
  } : {
115
115
  opacity: light ? 0.42 : 0.5
116
116
  };
@@ -93,6 +93,10 @@ const getColorShade = (theme, color) => {
93
93
  return 'currentColor';
94
94
  }
95
95
 
96
+ if (theme.vars) {
97
+ return theme.vars.palette.LinearProgress[`${color}Bg`];
98
+ }
99
+
96
100
  return theme.palette.mode === 'light' ? lighten(theme.palette[color].main, 0.62) : darken(theme.palette[color].main, 0.5);
97
101
  };
98
102
 
@@ -185,7 +189,7 @@ const LinearProgressBar1 = styled('span', {
185
189
  top: 0,
186
190
  transition: 'transform 0.2s linear',
187
191
  transformOrigin: 'left',
188
- backgroundColor: ownerState.color === 'inherit' ? 'currentColor' : theme.palette[ownerState.color].main
192
+ backgroundColor: ownerState.color === 'inherit' ? 'currentColor' : (theme.vars || theme).palette[ownerState.color].main
189
193
  }, ownerState.variant === 'determinate' && {
190
194
  transition: `transform .${TRANSITION_DURATION}s linear`
191
195
  }, ownerState.variant === 'buffer' && {
@@ -218,7 +222,7 @@ const LinearProgressBar2 = styled('span', {
218
222
  transition: 'transform 0.2s linear',
219
223
  transformOrigin: 'left'
220
224
  }, ownerState.variant !== 'buffer' && {
221
- backgroundColor: ownerState.color === 'inherit' ? 'currentColor' : theme.palette[ownerState.color].main
225
+ backgroundColor: ownerState.color === 'inherit' ? 'currentColor' : (theme.vars || theme).palette[ownerState.color].main
222
226
  }, ownerState.color === 'inherit' && {
223
227
  opacity: 0.3
224
228
  }, ownerState.variant === 'buffer' && {
package/Link/Link.js CHANGED
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { elementTypeAcceptingRef } from '@mui/utils';
8
8
  import { unstable_composeClasses as composeClasses } from '@mui/base';
9
- import { alpha, getPath } from '@mui/system';
10
9
  import capitalize from '../utils/capitalize';
11
10
  import styled from '../styles/styled';
12
11
  import useThemeProps from '../styles/useThemeProps';
@@ -14,18 +13,8 @@ import useIsFocusVisible from '../utils/useIsFocusVisible';
14
13
  import useForkRef from '../utils/useForkRef';
15
14
  import Typography from '../Typography';
16
15
  import linkClasses, { getLinkUtilityClass } from './linkClasses';
16
+ import getTextDecoration, { colorTransformations } from './getTextDecoration';
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
18
- const colorTransformations = {
19
- primary: 'primary.main',
20
- textPrimary: 'text.primary',
21
- secondary: 'secondary.main',
22
- textSecondary: 'text.secondary',
23
- error: 'error.main'
24
- };
25
-
26
- const transformDeprecatedColors = color => {
27
- return colorTransformations[color] || color;
28
- };
29
18
 
30
19
  const useUtilityClasses = ownerState => {
31
20
  const {
@@ -53,7 +42,6 @@ const LinkRoot = styled(Typography, {
53
42
  theme,
54
43
  ownerState
55
44
  }) => {
56
- const color = getPath(theme, `palette.${transformDeprecatedColors(ownerState.color)}`) || ownerState.color;
57
45
  return _extends({}, ownerState.underline === 'none' && {
58
46
  textDecoration: 'none'
59
47
  }, ownerState.underline === 'hover' && {
@@ -61,13 +49,18 @@ const LinkRoot = styled(Typography, {
61
49
  '&:hover': {
62
50
  textDecoration: 'underline'
63
51
  }
64
- }, ownerState.underline === 'always' && {
65
- textDecoration: 'underline',
66
- textDecorationColor: color !== 'inherit' ? alpha(color, 0.4) : undefined,
52
+ }, ownerState.underline === 'always' && _extends({
53
+ textDecoration: 'underline'
54
+ }, ownerState.color !== 'inherit' && {
55
+ textDecorationColor: getTextDecoration({
56
+ theme,
57
+ ownerState
58
+ })
59
+ }, {
67
60
  '&:hover': {
68
61
  textDecorationColor: 'inherit'
69
62
  }
70
- }, ownerState.component === 'button' && {
63
+ }), ownerState.component === 'button' && {
71
64
  position: 'relative',
72
65
  WebkitTapHighlightColor: 'transparent',
73
66
  backgroundColor: 'transparent',
@@ -0,0 +1,15 @@
1
+ import type { Theme } from '../styles';
2
+ export declare const colorTransformations: {
3
+ primary: string;
4
+ textPrimary: string;
5
+ secondary: string;
6
+ textSecondary: string;
7
+ error: string;
8
+ };
9
+ declare const getTextDecoration: <T extends Theme>({ theme, ownerState, }: {
10
+ theme: T;
11
+ ownerState: {
12
+ color: string;
13
+ };
14
+ }) => string;
15
+ export default getTextDecoration;
@@ -0,0 +1,29 @@
1
+ import { alpha, getPath } from '@mui/system';
2
+ export const colorTransformations = {
3
+ primary: 'primary.main',
4
+ textPrimary: 'text.primary',
5
+ secondary: 'secondary.main',
6
+ textSecondary: 'text.secondary',
7
+ error: 'error.main'
8
+ };
9
+
10
+ const transformDeprecatedColors = color => {
11
+ return colorTransformations[color] || color;
12
+ };
13
+
14
+ const getTextDecoration = ({
15
+ theme,
16
+ ownerState
17
+ }) => {
18
+ const transformedColor = transformDeprecatedColors(ownerState.color);
19
+ const color = getPath(theme, `palette.${transformedColor}`, false) || ownerState.color;
20
+ const channelColor = getPath(theme, `palette.${transformedColor}Channel`);
21
+
22
+ if ('vars' in theme && channelColor) {
23
+ return `rgba(${channelColor} / 0.4)`;
24
+ }
25
+
26
+ return alpha(color, 0.4);
27
+ };
28
+
29
+ export default getTextDecoration;
package/Modal/Modal.d.ts CHANGED
@@ -9,6 +9,7 @@ export type ModalTypeMap<D extends React.ElementType = 'div', P = {}> = ExtendMo
9
9
  props: P & {
10
10
  /**
11
11
  * A backdrop component. This prop enables custom backdrop rendering.
12
+ * @deprecated Use `components.Backdrop` instead.
12
13
  * @default styled(Backdrop, {
13
14
  * name: 'MuiModal',
14
15
  * slot: 'Backdrop',
@@ -22,6 +23,7 @@ export type ModalTypeMap<D extends React.ElementType = 'div', P = {}> = ExtendMo
22
23
  BackdropComponent?: React.ElementType<BackdropProps>;
23
24
  /**
24
25
  * Props applied to the [`Backdrop`](/material-ui/api/backdrop/) element.
26
+ * @deprecated Use `componentsProps.backdrop` instead.
25
27
  */
26
28
  BackdropProps?: Partial<BackdropProps>;
27
29
  /**
package/Modal/Modal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["BackdropComponent", "closeAfterTransition", "children", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted"];
3
+ const _excluded = ["BackdropComponent", "BackdropProps", "closeAfterTransition", "children", "component", "components", "componentsProps", "disableAutoFocus", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "theme"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { isHostComponent } from '@mui/base';
@@ -62,7 +62,7 @@ const ModalBackdrop = styled(Backdrop, {
62
62
  */
63
63
 
64
64
  const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
65
- var _componentsProps$root;
65
+ var _ref, _components$Root;
66
66
 
67
67
  const props = useThemeProps({
68
68
  name: 'MuiModal',
@@ -71,8 +71,10 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
71
71
 
72
72
  const {
73
73
  BackdropComponent = ModalBackdrop,
74
+ BackdropProps,
74
75
  closeAfterTransition = false,
75
76
  children,
77
+ component,
76
78
  components = {},
77
79
  componentsProps = {},
78
80
  disableAutoFocus = false,
@@ -82,7 +84,9 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
82
84
  disableRestoreFocus = false,
83
85
  disableScrollLock = false,
84
86
  hideBackdrop = false,
85
- keepMounted = false
87
+ keepMounted = false,
88
+ // eslint-disable-next-line react/prop-types
89
+ theme
86
90
  } = props,
87
91
  other = _objectWithoutPropertiesLoose(props, _excluded);
88
92
 
@@ -104,16 +108,19 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
104
108
  });
105
109
 
106
110
  const classes = extendUtilityClasses(ownerState);
111
+ const Root = (_ref = (_components$Root = components.Root) != null ? _components$Root : component) != null ? _ref : ModalRoot;
107
112
  return /*#__PURE__*/_jsx(ModalUnstyled, _extends({
108
113
  components: _extends({
109
- Root: ModalRoot
114
+ Root,
115
+ Backdrop: BackdropComponent
110
116
  }, components),
111
117
  componentsProps: {
112
- root: _extends({}, componentsProps.root, (!components.Root || !isHostComponent(components.Root)) && {
113
- ownerState: _extends({}, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.ownerState)
114
- })
118
+ root: _extends({}, componentsProps.root, !isHostComponent(Root) && {
119
+ as: component,
120
+ theme
121
+ }),
122
+ backdrop: _extends({}, BackdropProps, componentsProps.backdrop)
115
123
  },
116
- BackdropComponent: BackdropComponent,
117
124
  onTransitionEnter: () => setExited(false),
118
125
  onTransitionExited: () => setExited(true),
119
126
  ref: ref
@@ -133,6 +140,7 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
133
140
 
134
141
  /**
135
142
  * A backdrop component. This prop enables custom backdrop rendering.
143
+ * @deprecated Use `components.Backdrop` instead.
136
144
  * @default styled(Backdrop, {
137
145
  * name: 'MuiModal',
138
146
  * slot: 'Backdrop',
@@ -147,6 +155,7 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
147
155
 
148
156
  /**
149
157
  * Props applied to the [`Backdrop`](/material-ui/api/backdrop/) element.
158
+ * @deprecated Use `componentsProps.backdrop` instead.
150
159
  */
151
160
  BackdropProps: PropTypes.object,
152
161
 
@@ -166,12 +175,19 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
166
175
  */
167
176
  closeAfterTransition: PropTypes.bool,
168
177
 
178
+ /**
179
+ * The component used for the root node.
180
+ * Either a string to use a HTML element or a component.
181
+ */
182
+ component: PropTypes.elementType,
183
+
169
184
  /**
170
185
  * The components used for each slot inside the Modal.
171
186
  * Either a string to use a HTML element or a component.
172
187
  * @default {}
173
188
  */
174
189
  components: PropTypes.shape({
190
+ Backdrop: PropTypes.elementType,
175
191
  Root: PropTypes.elementType
176
192
  }),
177
193
 
@@ -180,6 +196,7 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
180
196
  * @default {}
181
197
  */
182
198
  componentsProps: PropTypes.shape({
199
+ backdrop: PropTypes.object,
183
200
  root: PropTypes.object
184
201
  }),
185
202
 
@@ -40,25 +40,25 @@ const OutlinedInputRoot = styled(InputBaseRoot, {
40
40
  const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
41
41
  return _extends({
42
42
  position: 'relative',
43
- borderRadius: theme.shape.borderRadius,
43
+ borderRadius: (theme.vars || theme).shape.borderRadius,
44
44
  [`&:hover .${outlinedInputClasses.notchedOutline}`]: {
45
- borderColor: theme.palette.text.primary
45
+ borderColor: (theme.vars || theme).palette.text.primary
46
46
  },
47
47
  // Reset on touch devices, it doesn't add specificity
48
48
  '@media (hover: none)': {
49
49
  [`&:hover .${outlinedInputClasses.notchedOutline}`]: {
50
- borderColor
50
+ borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
51
51
  }
52
52
  },
53
53
  [`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]: {
54
- borderColor: theme.palette[ownerState.color].main,
54
+ borderColor: (theme.vars || theme).palette[ownerState.color].main,
55
55
  borderWidth: 2
56
56
  },
57
57
  [`&.${outlinedInputClasses.error} .${outlinedInputClasses.notchedOutline}`]: {
58
- borderColor: theme.palette.error.main
58
+ borderColor: (theme.vars || theme).palette.error.main
59
59
  },
60
60
  [`&.${outlinedInputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]: {
61
- borderColor: theme.palette.action.disabled
61
+ borderColor: (theme.vars || theme).palette.action.disabled
62
62
  }
63
63
  }, ownerState.startAdornment && {
64
64
  paddingLeft: 14
@@ -76,9 +76,12 @@ const NotchedOutlineRoot = styled(NotchedOutline, {
76
76
  overridesResolver: (props, styles) => styles.notchedOutline
77
77
  })(({
78
78
  theme
79
- }) => ({
80
- borderColor: theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'
81
- }));
79
+ }) => {
80
+ const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
81
+ return {
82
+ borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
83
+ };
84
+ });
82
85
  const OutlinedInputInput = styled(InputBaseInput, {
83
86
  name: 'MuiOutlinedInput',
84
87
  slot: 'Input',
@@ -87,13 +90,25 @@ const OutlinedInputInput = styled(InputBaseInput, {
87
90
  theme,
88
91
  ownerState
89
92
  }) => _extends({
90
- padding: '16.5px 14px',
93
+ padding: '16.5px 14px'
94
+ }, !theme.vars && {
91
95
  '&:-webkit-autofill': {
92
96
  WebkitBoxShadow: theme.palette.mode === 'light' ? null : '0 0 0 100px #266798 inset',
93
97
  WebkitTextFillColor: theme.palette.mode === 'light' ? null : '#fff',
94
98
  caretColor: theme.palette.mode === 'light' ? null : '#fff',
95
99
  borderRadius: 'inherit'
96
100
  }
101
+ }, theme.vars && {
102
+ '&:-webkit-autofill': {
103
+ borderRadius: 'inherit'
104
+ },
105
+ [theme.getColorSchemeSelector('dark')]: {
106
+ '&:-webkit-autofill': {
107
+ WebkitBoxShadow: '0 0 0 100px #266798 inset',
108
+ WebkitTextFillColor: '#fff',
109
+ caretColor: '#fff'
110
+ }
111
+ }
97
112
  }, ownerState.size === 'small' && {
98
113
  padding: '8.5px 14px'
99
114
  }, ownerState.multiline && {
@@ -129,12 +144,27 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
129
144
  muiFormControl,
130
145
  states: ['required']
131
146
  });
147
+
148
+ const ownerState = _extends({}, props, {
149
+ color: fcs.color || 'primary',
150
+ disabled: fcs.disabled,
151
+ error: fcs.error,
152
+ focused: fcs.focused,
153
+ formControl: muiFormControl,
154
+ fullWidth,
155
+ hiddenLabel: fcs.hiddenLabel,
156
+ multiline,
157
+ size: fcs.size,
158
+ type
159
+ });
160
+
132
161
  return /*#__PURE__*/_jsx(InputBase, _extends({
133
162
  components: _extends({
134
163
  Root: OutlinedInputRoot,
135
164
  Input: OutlinedInputInput
136
165
  }, components),
137
166
  renderSuffix: state => /*#__PURE__*/_jsx(NotchedOutlineRoot, {
167
+ ownerState: ownerState,
138
168
  className: classes.notchedOutline,
139
169
  label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
140
170
  children: [label, "\xA0", '*']
@@ -133,6 +133,13 @@ export interface PopoverActions {
133
133
  updatePosition(): void;
134
134
  }
135
135
 
136
+ export function getOffsetTop(rect: DOMRect, vertical: number | 'center' | 'bottom' | 'top'): number;
137
+
138
+ export function getOffsetLeft(
139
+ rect: DOMRect,
140
+ horizontal: number | 'center' | 'right' | 'left',
141
+ ): number;
142
+
136
143
  /**
137
144
  *
138
145
  * Demos:
package/Popover/index.js CHANGED
@@ -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';