@mui/material 6.3.0 → 6.4.0

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 (84) hide show
  1. package/Alert/Alert.d.ts +69 -0
  2. package/Alert/Alert.js +53 -21
  3. package/AppBar/AppBar.d.ts +1 -1
  4. package/AppBar/AppBar.js +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/Autocomplete/Autocomplete.js +35 -48
  7. package/Button/Button.d.ts +18 -0
  8. package/Button/Button.js +233 -15
  9. package/Button/buttonClasses.d.ts +14 -0
  10. package/Button/buttonClasses.js +1 -1
  11. package/CHANGELOG.md +85 -0
  12. package/CardHeader/CardHeader.d.ts +114 -1
  13. package/CardHeader/CardHeader.js +99 -32
  14. package/CircularProgress/CircularProgress.js +2 -2
  15. package/IconButton/IconButton.d.ts +12 -0
  16. package/IconButton/IconButton.js +69 -7
  17. package/IconButton/iconButtonClasses.d.ts +4 -0
  18. package/IconButton/iconButtonClasses.js +1 -1
  19. package/LinearProgress/LinearProgress.js +4 -4
  20. package/LinearProgress/linearProgressClasses.d.ts +31 -9
  21. package/LinearProgress/linearProgressClasses.js +1 -1
  22. package/Link/getTextDecoration.js +3 -2
  23. package/Select/Select.js +10 -1
  24. package/Select/SelectInput.js +1 -1
  25. package/Select/selectClasses.d.ts +9 -3
  26. package/Slider/useSlider.js +5 -2
  27. package/StepLabel/StepLabel.d.ts +1 -1
  28. package/TableSortLabel/TableSortLabel.d.ts +43 -1
  29. package/TableSortLabel/TableSortLabel.js +40 -7
  30. package/Tooltip/Tooltip.d.ts +1 -1
  31. package/Tooltip/Tooltip.js +1 -1
  32. package/index.js +1 -1
  33. package/modern/Alert/Alert.js +53 -21
  34. package/modern/AppBar/AppBar.js +1 -1
  35. package/modern/Autocomplete/Autocomplete.js +35 -48
  36. package/modern/Button/Button.js +233 -15
  37. package/modern/Button/buttonClasses.js +1 -1
  38. package/modern/CardHeader/CardHeader.js +99 -32
  39. package/modern/CircularProgress/CircularProgress.js +2 -2
  40. package/modern/IconButton/IconButton.js +69 -7
  41. package/modern/IconButton/iconButtonClasses.js +1 -1
  42. package/modern/LinearProgress/LinearProgress.js +4 -4
  43. package/modern/LinearProgress/linearProgressClasses.js +1 -1
  44. package/modern/Link/getTextDecoration.js +3 -2
  45. package/modern/Select/Select.js +10 -1
  46. package/modern/Select/SelectInput.js +1 -1
  47. package/modern/Slider/useSlider.js +5 -2
  48. package/modern/TableSortLabel/TableSortLabel.js +40 -7
  49. package/modern/Tooltip/Tooltip.js +1 -1
  50. package/modern/index.js +1 -1
  51. package/modern/utils/index.js +1 -0
  52. package/modern/utils/mergeSlotProps.js +43 -0
  53. package/modern/utils/useSlot.js +5 -1
  54. package/modern/version/index.js +2 -2
  55. package/node/Alert/Alert.js +53 -21
  56. package/node/AppBar/AppBar.js +1 -1
  57. package/node/Autocomplete/Autocomplete.js +35 -48
  58. package/node/Button/Button.js +233 -15
  59. package/node/Button/buttonClasses.js +1 -1
  60. package/node/CardHeader/CardHeader.js +99 -32
  61. package/node/CircularProgress/CircularProgress.js +2 -2
  62. package/node/IconButton/IconButton.js +68 -6
  63. package/node/IconButton/iconButtonClasses.js +1 -1
  64. package/node/LinearProgress/LinearProgress.js +4 -4
  65. package/node/LinearProgress/linearProgressClasses.js +1 -1
  66. package/node/Link/getTextDecoration.js +3 -2
  67. package/node/Select/Select.js +10 -1
  68. package/node/Select/SelectInput.js +1 -1
  69. package/node/Slider/useSlider.js +5 -2
  70. package/node/TableSortLabel/TableSortLabel.js +40 -7
  71. package/node/Tooltip/Tooltip.js +1 -1
  72. package/node/index.js +1 -1
  73. package/node/utils/index.js +7 -0
  74. package/node/utils/mergeSlotProps.js +50 -0
  75. package/node/utils/useSlot.js +5 -1
  76. package/node/version/index.js +2 -2
  77. package/package.json +6 -6
  78. package/utils/index.d.ts +1 -0
  79. package/utils/index.js +1 -0
  80. package/utils/mergeSlotProps.d.ts +2 -0
  81. package/utils/mergeSlotProps.js +43 -0
  82. package/utils/useSlot.d.ts +8 -0
  83. package/utils/useSlot.js +5 -1
  84. package/version/index.js +2 -2
@@ -6,11 +6,13 @@ import clsx from 'clsx';
6
6
  import resolveProps from '@mui/utils/resolveProps';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { alpha } from '@mui/system/colorManipulator';
9
+ import { unstable_useId as useId } from '@mui/material/utils';
9
10
  import rootShouldForwardProp from "../styles/rootShouldForwardProp.js";
10
11
  import { styled } from "../zero-styled/index.js";
11
12
  import memoTheme from "../utils/memoTheme.js";
12
13
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
13
14
  import ButtonBase from "../ButtonBase/index.js";
15
+ import CircularProgress from "../CircularProgress/index.js";
14
16
  import capitalize from "../utils/capitalize.js";
15
17
  import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.js";
16
18
  import buttonClasses, { getButtonUtilityClass } from "./buttonClasses.js";
@@ -24,13 +26,16 @@ const useUtilityClasses = ownerState => {
24
26
  fullWidth,
25
27
  size,
26
28
  variant,
29
+ loading,
30
+ loadingPosition,
27
31
  classes
28
32
  } = ownerState;
29
33
  const slots = {
30
- root: ['root', variant, `${variant}${capitalize(color)}`, `size${capitalize(size)}`, `${variant}Size${capitalize(size)}`, `color${capitalize(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth'],
31
- label: ['label'],
34
+ root: ['root', loading && 'loading', variant, `${variant}${capitalize(color)}`, `size${capitalize(size)}`, `${variant}Size${capitalize(size)}`, `color${capitalize(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth', loading && `loadingPosition${capitalize(loadingPosition)}`],
32
35
  startIcon: ['icon', 'startIcon', `iconSize${capitalize(size)}`],
33
- endIcon: ['icon', 'endIcon', `iconSize${capitalize(size)}`]
36
+ endIcon: ['icon', 'endIcon', `iconSize${capitalize(size)}`],
37
+ loadingIndicator: ['loadingIndicator'],
38
+ loadingWrapper: ['loadingWrapper']
34
39
  };
35
40
  const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
36
41
  return {
@@ -75,7 +80,7 @@ const ButtonRoot = styled(ButtonBase, {
75
80
  const {
76
81
  ownerState
77
82
  } = props;
78
- return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
83
+ return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth, ownerState.loading && styles.loading];
79
84
  }
80
85
  })(memoTheme(({
81
86
  theme
@@ -262,6 +267,18 @@ const ButtonRoot = styled(ButtonBase, {
262
267
  style: {
263
268
  width: '100%'
264
269
  }
270
+ }, {
271
+ props: {
272
+ loadingPosition: 'center'
273
+ },
274
+ style: {
275
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
276
+ duration: theme.transitions.duration.short
277
+ }),
278
+ [`&.${buttonClasses.loading}`]: {
279
+ color: 'transparent'
280
+ }
281
+ }
265
282
  }]
266
283
  };
267
284
  }));
@@ -272,9 +289,11 @@ const ButtonStartIcon = styled('span', {
272
289
  const {
273
290
  ownerState
274
291
  } = props;
275
- return [styles.startIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
292
+ return [styles.startIcon, ownerState.loading && styles.startIconLoadingStart, styles[`iconSize${capitalize(ownerState.size)}`]];
276
293
  }
277
- })({
294
+ })(({
295
+ theme
296
+ }) => ({
278
297
  display: 'inherit',
279
298
  marginRight: 8,
280
299
  marginLeft: -4,
@@ -285,8 +304,28 @@ const ButtonStartIcon = styled('span', {
285
304
  style: {
286
305
  marginLeft: -2
287
306
  }
307
+ }, {
308
+ props: {
309
+ loadingPosition: 'start',
310
+ loading: true
311
+ },
312
+ style: {
313
+ transition: theme.transitions.create(['opacity'], {
314
+ duration: theme.transitions.duration.short
315
+ }),
316
+ opacity: 0
317
+ }
318
+ }, {
319
+ props: {
320
+ loadingPosition: 'start',
321
+ loading: true,
322
+ fullWidth: true
323
+ },
324
+ style: {
325
+ marginRight: -8
326
+ }
288
327
  }, ...commonIconStyles]
289
- });
328
+ }));
290
329
  const ButtonEndIcon = styled('span', {
291
330
  name: 'MuiButton',
292
331
  slot: 'EndIcon',
@@ -294,9 +333,11 @@ const ButtonEndIcon = styled('span', {
294
333
  const {
295
334
  ownerState
296
335
  } = props;
297
- return [styles.endIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
336
+ return [styles.endIcon, ownerState.loading && styles.endIconLoadingEnd, styles[`iconSize${capitalize(ownerState.size)}`]];
298
337
  }
299
- })({
338
+ })(({
339
+ theme
340
+ }) => ({
300
341
  display: 'inherit',
301
342
  marginRight: -4,
302
343
  marginLeft: 8,
@@ -307,7 +348,128 @@ const ButtonEndIcon = styled('span', {
307
348
  style: {
308
349
  marginRight: -2
309
350
  }
351
+ }, {
352
+ props: {
353
+ loadingPosition: 'end',
354
+ loading: true
355
+ },
356
+ style: {
357
+ transition: theme.transitions.create(['opacity'], {
358
+ duration: theme.transitions.duration.short
359
+ }),
360
+ opacity: 0
361
+ }
362
+ }, {
363
+ props: {
364
+ loadingPosition: 'end',
365
+ loading: true,
366
+ fullWidth: true
367
+ },
368
+ style: {
369
+ marginLeft: -8
370
+ }
310
371
  }, ...commonIconStyles]
372
+ }));
373
+ const ButtonLoadingIndicator = styled('span', {
374
+ name: 'MuiButton',
375
+ slot: 'LoadingIndicator',
376
+ overridesResolver: (props, styles) => styles.loadingIndicator
377
+ })(({
378
+ theme
379
+ }) => ({
380
+ display: 'none',
381
+ position: 'absolute',
382
+ visibility: 'visible',
383
+ variants: [{
384
+ props: {
385
+ loading: true
386
+ },
387
+ style: {
388
+ display: 'flex'
389
+ }
390
+ }, {
391
+ props: {
392
+ loadingPosition: 'start'
393
+ },
394
+ style: {
395
+ left: 14
396
+ }
397
+ }, {
398
+ props: {
399
+ loadingPosition: 'start',
400
+ size: 'small'
401
+ },
402
+ style: {
403
+ left: 10
404
+ }
405
+ }, {
406
+ props: {
407
+ variant: 'text',
408
+ loadingPosition: 'start'
409
+ },
410
+ style: {
411
+ left: 6
412
+ }
413
+ }, {
414
+ props: {
415
+ loadingPosition: 'center'
416
+ },
417
+ style: {
418
+ left: '50%',
419
+ transform: 'translate(-50%)',
420
+ color: (theme.vars || theme).palette.action.disabled
421
+ }
422
+ }, {
423
+ props: {
424
+ loadingPosition: 'end'
425
+ },
426
+ style: {
427
+ right: 14
428
+ }
429
+ }, {
430
+ props: {
431
+ loadingPosition: 'end',
432
+ size: 'small'
433
+ },
434
+ style: {
435
+ right: 10
436
+ }
437
+ }, {
438
+ props: {
439
+ variant: 'text',
440
+ loadingPosition: 'end'
441
+ },
442
+ style: {
443
+ right: 6
444
+ }
445
+ }, {
446
+ props: {
447
+ loadingPosition: 'start',
448
+ fullWidth: true
449
+ },
450
+ style: {
451
+ position: 'relative',
452
+ left: -10
453
+ }
454
+ }, {
455
+ props: {
456
+ loadingPosition: 'end',
457
+ fullWidth: true
458
+ },
459
+ style: {
460
+ position: 'relative',
461
+ right: -10
462
+ }
463
+ }]
464
+ }));
465
+ const ButtonLoadingIconPlaceholder = styled('span', {
466
+ name: 'MuiButton',
467
+ slot: 'LoadingIconPlaceholder',
468
+ overridesResolver: (props, styles) => styles.loadingIconPlaceholder
469
+ })({
470
+ display: 'inline-block',
471
+ width: '1em',
472
+ height: '1em'
311
473
  });
312
474
  const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
313
475
  // props priority: `inProps` > `contextProps` > `themeDefaultProps`
@@ -329,12 +491,22 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
329
491
  endIcon: endIconProp,
330
492
  focusVisibleClassName,
331
493
  fullWidth = false,
494
+ id: idProp,
495
+ loading = null,
496
+ loadingIndicator: loadingIndicatorProp,
497
+ loadingPosition = 'center',
332
498
  size = 'medium',
333
499
  startIcon: startIconProp,
334
500
  type,
335
501
  variant = 'text',
336
502
  ...other
337
503
  } = props;
504
+ const id = useId(idProp);
505
+ const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/_jsx(CircularProgress, {
506
+ "aria-labelledby": id,
507
+ color: "inherit",
508
+ size: 16
509
+ });
338
510
  const ownerState = {
339
511
  ...props,
340
512
  color,
@@ -343,34 +515,58 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
343
515
  disableElevation,
344
516
  disableFocusRipple,
345
517
  fullWidth,
518
+ loading,
519
+ loadingIndicator,
520
+ loadingPosition,
346
521
  size,
347
522
  type,
348
523
  variant
349
524
  };
350
525
  const classes = useUtilityClasses(ownerState);
351
- const startIcon = startIconProp && /*#__PURE__*/_jsx(ButtonStartIcon, {
526
+ const startIcon = (startIconProp || loading && loadingPosition === 'start') && /*#__PURE__*/_jsx(ButtonStartIcon, {
352
527
  className: classes.startIcon,
353
528
  ownerState: ownerState,
354
- children: startIconProp
529
+ children: startIconProp || /*#__PURE__*/_jsx(ButtonLoadingIconPlaceholder, {
530
+ className: classes.loadingIconPlaceholder,
531
+ ownerState: ownerState
532
+ })
355
533
  });
356
- const endIcon = endIconProp && /*#__PURE__*/_jsx(ButtonEndIcon, {
534
+ const endIcon = (endIconProp || loading && loadingPosition === 'end') && /*#__PURE__*/_jsx(ButtonEndIcon, {
357
535
  className: classes.endIcon,
358
536
  ownerState: ownerState,
359
- children: endIconProp
537
+ children: endIconProp || /*#__PURE__*/_jsx(ButtonLoadingIconPlaceholder, {
538
+ className: classes.loadingIconPlaceholder,
539
+ ownerState: ownerState
540
+ })
360
541
  });
361
542
  const positionClassName = buttonGroupButtonContextPositionClassName || '';
543
+ const loader = typeof loading === 'boolean' ?
544
+ /*#__PURE__*/
545
+ // use plain HTML span to minimize the runtime overhead
546
+ _jsx("span", {
547
+ className: classes.loadingWrapper,
548
+ style: {
549
+ display: 'contents'
550
+ },
551
+ children: loading && /*#__PURE__*/_jsx(ButtonLoadingIndicator, {
552
+ className: classes.loadingIndicator,
553
+ ownerState: ownerState,
554
+ children: loadingIndicator
555
+ })
556
+ }) : null;
362
557
  return /*#__PURE__*/_jsxs(ButtonRoot, {
363
558
  ownerState: ownerState,
364
559
  className: clsx(contextProps.className, classes.root, className, positionClassName),
365
560
  component: component,
366
- disabled: disabled,
561
+ disabled: disabled || loading,
367
562
  focusRipple: !disableFocusRipple,
368
563
  focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
369
564
  ref: ref,
370
565
  type: type,
566
+ id: id,
371
567
  ...other,
372
568
  classes: classes,
373
- children: [startIcon, children, endIcon]
569
+ children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
374
570
  });
375
571
  });
376
572
  process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */ = {
@@ -443,6 +639,28 @@ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */
443
639
  * If defined, an `a` element will be used as the root node.
444
640
  */
445
641
  href: PropTypes.string,
642
+ /**
643
+ * @ignore
644
+ */
645
+ id: PropTypes.string,
646
+ /**
647
+ * If `true`, the loading indicator is visible and the button is disabled.
648
+ * If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
649
+ * @default null
650
+ */
651
+ loading: PropTypes.bool,
652
+ /**
653
+ * Element placed before the children if the button is in loading state.
654
+ * The node should contain an element with `role="progressbar"` with an accessible name.
655
+ * By default, it renders a `CircularProgress` that is labeled by the button itself.
656
+ * @default <CircularProgress color="inherit" size={16} />
657
+ */
658
+ loadingIndicator: PropTypes.node,
659
+ /**
660
+ * The loading indicator can be positioned on the start, end, or the center of the button.
661
+ * @default 'center'
662
+ */
663
+ loadingPosition: PropTypes.oneOf(['center', 'end', 'start']),
446
664
  /**
447
665
  * The size of the component.
448
666
  * `small` is equivalent to the dense button styling.
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
3
  export function getButtonUtilityClass(slot) {
4
4
  return generateUtilityClass('MuiButton', slot);
5
5
  }
6
- const 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', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorError', 'colorInfo', 'colorWarning', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'icon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
6
+ const 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', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorError', 'colorInfo', 'colorWarning', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'icon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge', 'loading', 'loadingWrapper', 'loadingIconPlaceholder', 'loadingIndicator', 'loadingPositionCenter', 'loadingPositionStart', 'loadingPositionEnd']);
7
7
  export default buttonClasses;
@@ -2,12 +2,12 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import clsx from 'clsx';
6
5
  import composeClasses from '@mui/utils/composeClasses';
7
6
  import Typography, { typographyClasses } from "../Typography/index.js";
8
7
  import { styled } from "../zero-styled/index.js";
9
8
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
10
9
  import cardHeaderClasses, { getCardHeaderUtilityClass } from "./cardHeaderClasses.js";
10
+ import useSlot from "../utils/useSlot.js";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const useUtilityClasses = ownerState => {
13
13
  const {
@@ -79,13 +79,14 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
79
79
  const {
80
80
  action,
81
81
  avatar,
82
- className,
83
82
  component = 'div',
84
83
  disableTypography = false,
85
84
  subheader: subheaderProp,
86
85
  subheaderTypographyProps,
87
86
  title: titleProp,
88
87
  titleTypographyProps,
88
+ slots = {},
89
+ slotProps = {},
89
90
  ...other
90
91
  } = props;
91
92
  const ownerState = {
@@ -94,44 +95,88 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
94
95
  disableTypography
95
96
  };
96
97
  const classes = useUtilityClasses(ownerState);
98
+ const externalForwardedProps = {
99
+ slots,
100
+ slotProps: {
101
+ title: titleTypographyProps,
102
+ subheader: subheaderTypographyProps,
103
+ ...slotProps
104
+ }
105
+ };
97
106
  let title = titleProp;
98
- if (title != null && title.type !== Typography && !disableTypography) {
99
- title = /*#__PURE__*/_jsx(Typography, {
107
+ const [TitleSlot, titleSlotProps] = useSlot('title', {
108
+ className: classes.title,
109
+ elementType: Typography,
110
+ externalForwardedProps,
111
+ ownerState,
112
+ additionalProps: {
100
113
  variant: avatar ? 'body2' : 'h5',
101
- className: classes.title,
102
- component: "span",
103
- ...titleTypographyProps,
114
+ component: 'span'
115
+ }
116
+ });
117
+ if (title != null && title.type !== Typography && !disableTypography) {
118
+ title = /*#__PURE__*/_jsx(TitleSlot, {
119
+ ...titleSlotProps,
104
120
  children: title
105
121
  });
106
122
  }
107
123
  let subheader = subheaderProp;
108
- if (subheader != null && subheader.type !== Typography && !disableTypography) {
109
- subheader = /*#__PURE__*/_jsx(Typography, {
124
+ const [SubheaderSlot, subheaderSlotProps] = useSlot('subheader', {
125
+ className: classes.subheader,
126
+ elementType: Typography,
127
+ externalForwardedProps,
128
+ ownerState,
129
+ additionalProps: {
110
130
  variant: avatar ? 'body2' : 'body1',
111
- className: classes.subheader,
112
- color: "textSecondary",
113
- component: "span",
114
- ...subheaderTypographyProps,
131
+ color: 'textSecondary',
132
+ component: 'span'
133
+ }
134
+ });
135
+ if (subheader != null && subheader.type !== Typography && !disableTypography) {
136
+ subheader = /*#__PURE__*/_jsx(SubheaderSlot, {
137
+ ...subheaderSlotProps,
115
138
  children: subheader
116
139
  });
117
140
  }
118
- return /*#__PURE__*/_jsxs(CardHeaderRoot, {
119
- className: clsx(classes.root, className),
120
- as: component,
121
- ref: ref,
122
- ownerState: ownerState,
123
- ...other,
124
- children: [avatar && /*#__PURE__*/_jsx(CardHeaderAvatar, {
125
- className: classes.avatar,
126
- ownerState: ownerState,
141
+ const [RootSlot, rootSlotProps] = useSlot('root', {
142
+ ref,
143
+ className: classes.root,
144
+ elementType: CardHeaderRoot,
145
+ externalForwardedProps: {
146
+ ...externalForwardedProps,
147
+ ...other,
148
+ component
149
+ },
150
+ ownerState
151
+ });
152
+ const [AvatarSlot, avatarSlotProps] = useSlot('avatar', {
153
+ className: classes.avatar,
154
+ elementType: CardHeaderAvatar,
155
+ externalForwardedProps,
156
+ ownerState
157
+ });
158
+ const [ContentSlot, contentSlotProps] = useSlot('content', {
159
+ className: classes.content,
160
+ elementType: CardHeaderContent,
161
+ externalForwardedProps,
162
+ ownerState
163
+ });
164
+ const [ActionSlot, actionSlotProps] = useSlot('action', {
165
+ className: classes.action,
166
+ elementType: CardHeaderAction,
167
+ externalForwardedProps,
168
+ ownerState
169
+ });
170
+ return /*#__PURE__*/_jsxs(RootSlot, {
171
+ ...rootSlotProps,
172
+ children: [avatar && /*#__PURE__*/_jsx(AvatarSlot, {
173
+ ...avatarSlotProps,
127
174
  children: avatar
128
- }), /*#__PURE__*/_jsxs(CardHeaderContent, {
129
- className: classes.content,
130
- ownerState: ownerState,
175
+ }), /*#__PURE__*/_jsxs(ContentSlot, {
176
+ ...contentSlotProps,
131
177
  children: [title, subheader]
132
- }), action && /*#__PURE__*/_jsx(CardHeaderAction, {
133
- className: classes.action,
134
- ownerState: ownerState,
178
+ }), action && /*#__PURE__*/_jsx(ActionSlot, {
179
+ ...actionSlotProps,
135
180
  children: action
136
181
  })]
137
182
  });
@@ -157,10 +202,6 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
157
202
  * Override or extend the styles applied to the component.
158
203
  */
159
204
  classes: PropTypes.object,
160
- /**
161
- * @ignore
162
- */
163
- className: PropTypes.string,
164
205
  /**
165
206
  * The component used for the root node.
166
207
  * Either a string to use a HTML element or a component.
@@ -174,6 +215,30 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
174
215
  * @default false
175
216
  */
176
217
  disableTypography: PropTypes.bool,
218
+ /**
219
+ * The props used for each slot inside.
220
+ * @default {}
221
+ */
222
+ slotProps: PropTypes.shape({
223
+ action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
224
+ avatar: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
225
+ content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
226
+ root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
227
+ subheader: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
228
+ title: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
229
+ }),
230
+ /**
231
+ * The components used for each slot inside.
232
+ * @default {}
233
+ */
234
+ slots: PropTypes.shape({
235
+ action: PropTypes.elementType,
236
+ avatar: PropTypes.elementType,
237
+ content: PropTypes.elementType,
238
+ root: PropTypes.elementType,
239
+ subheader: PropTypes.elementType,
240
+ title: PropTypes.elementType
241
+ }),
177
242
  /**
178
243
  * The content of the component.
179
244
  */
@@ -181,6 +246,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
181
246
  /**
182
247
  * These props will be forwarded to the subheader
183
248
  * (as long as disableTypography is not `true`).
249
+ * @deprecated Use `slotProps.subheader` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
184
250
  */
185
251
  subheaderTypographyProps: PropTypes.object,
186
252
  /**
@@ -194,6 +260,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
194
260
  /**
195
261
  * These props will be forwarded to the title
196
262
  * (as long as disableTypography is not `true`).
263
+ * @deprecated Use `slotProps.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
197
264
  */
198
265
  titleTypographyProps: PropTypes.object
199
266
  } : void 0;
@@ -34,8 +34,8 @@ const circularDashKeyframe = keyframes`
34
34
  }
35
35
 
36
36
  100% {
37
- stroke-dasharray: 100px, 200px;
38
- stroke-dashoffset: -125px;
37
+ stroke-dasharray: 1px, 200px;
38
+ stroke-dashoffset: -126px;
39
39
  }
40
40
  `;
41
41