@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
@@ -662,53 +662,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
662
662
  };
663
663
  const clearIndicatorSlotProps = externalForwardedProps.slotProps.clearIndicator;
664
664
  const popupIndicatorSlotProps = externalForwardedProps.slotProps.popupIndicator;
665
- const renderAutocompletePopperChildren = children => /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, {
666
- as: PopperSlot,
667
- ...popperProps,
668
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePaper, {
669
- as: PaperSlot,
670
- ...paperProps,
671
- children: children
672
- })
673
- });
674
- let autocompletePopper = null;
675
- if (groupedOptions.length > 0) {
676
- autocompletePopper = renderAutocompletePopperChildren(
677
- /*#__PURE__*/
678
- // TODO v7: remove `as` prop and move ListboxComponentProp to externalForwardedProps or remove ListboxComponentProp entirely
679
- // https://github.com/mui/material-ui/pull/43994#issuecomment-2401945800
680
- (0, _jsxRuntime.jsx)(ListboxSlot, {
681
- as: ListboxComponentProp,
682
- ...listboxProps,
683
- children: groupedOptions.map((option, index) => {
684
- if (groupBy) {
685
- return renderGroup({
686
- key: option.key,
687
- group: option.group,
688
- children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
689
- });
690
- }
691
- return renderListOption(option, index);
692
- })
693
- }));
694
- } else if (loading && groupedOptions.length === 0) {
695
- autocompletePopper = renderAutocompletePopperChildren(/*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
696
- className: classes.loading,
697
- ownerState: ownerState,
698
- children: loadingText
699
- }));
700
- } else if (groupedOptions.length === 0 && !freeSolo && !loading) {
701
- autocompletePopper = renderAutocompletePopperChildren(/*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
702
- className: classes.noOptions,
703
- ownerState: ownerState,
704
- role: "presentation",
705
- onMouseDown: event => {
706
- // Prevent input blur when interacting with the "no options" content
707
- event.preventDefault();
708
- },
709
- children: noOptionsText
710
- }));
711
- }
712
665
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
713
666
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteRoot, {
714
667
  ref: ref,
@@ -762,7 +715,41 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
762
715
  ...getInputProps()
763
716
  }
764
717
  })
765
- }), anchorEl ? autocompletePopper : null]
718
+ }), anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, {
719
+ as: PopperSlot,
720
+ ...popperProps,
721
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompletePaper, {
722
+ as: PaperSlot,
723
+ ...paperProps,
724
+ children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
725
+ className: classes.loading,
726
+ ownerState: ownerState,
727
+ children: loadingText
728
+ }) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
729
+ className: classes.noOptions,
730
+ ownerState: ownerState,
731
+ role: "presentation",
732
+ onMouseDown: event => {
733
+ // Prevent input blur when interacting with the "no options" content
734
+ event.preventDefault();
735
+ },
736
+ children: noOptionsText
737
+ }) : null, groupedOptions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ListboxSlot, {
738
+ as: ListboxComponentProp,
739
+ ...listboxProps,
740
+ children: groupedOptions.map((option, index) => {
741
+ if (groupBy) {
742
+ return renderGroup({
743
+ key: option.key,
744
+ group: option.group,
745
+ children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
746
+ });
747
+ }
748
+ return renderListOption(option, index);
749
+ })
750
+ }) : null]
751
+ })
752
+ }) : null]
766
753
  });
767
754
  });
768
755
  process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
@@ -13,11 +13,13 @@ var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _resolveProps = _interopRequireDefault(require("@mui/utils/resolveProps"));
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
15
  var _colorManipulator = require("@mui/system/colorManipulator");
16
+ var _utils = require("@mui/material/utils");
16
17
  var _rootShouldForwardProp = _interopRequireDefault(require("../styles/rootShouldForwardProp"));
17
18
  var _zeroStyled = require("../zero-styled");
18
19
  var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
19
20
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
20
21
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
22
+ var _CircularProgress = _interopRequireDefault(require("../CircularProgress"));
21
23
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
22
24
  var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
23
25
  var _buttonClasses = _interopRequireWildcard(require("./buttonClasses"));
@@ -31,13 +33,16 @@ const useUtilityClasses = ownerState => {
31
33
  fullWidth,
32
34
  size,
33
35
  variant,
36
+ loading,
37
+ loadingPosition,
34
38
  classes
35
39
  } = ownerState;
36
40
  const slots = {
37
- root: ['root', variant, `${variant}${(0, _capitalize.default)(color)}`, `size${(0, _capitalize.default)(size)}`, `${variant}Size${(0, _capitalize.default)(size)}`, `color${(0, _capitalize.default)(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth'],
38
- label: ['label'],
41
+ root: ['root', loading && 'loading', variant, `${variant}${(0, _capitalize.default)(color)}`, `size${(0, _capitalize.default)(size)}`, `${variant}Size${(0, _capitalize.default)(size)}`, `color${(0, _capitalize.default)(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth', loading && `loadingPosition${(0, _capitalize.default)(loadingPosition)}`],
39
42
  startIcon: ['icon', 'startIcon', `iconSize${(0, _capitalize.default)(size)}`],
40
- endIcon: ['icon', 'endIcon', `iconSize${(0, _capitalize.default)(size)}`]
43
+ endIcon: ['icon', 'endIcon', `iconSize${(0, _capitalize.default)(size)}`],
44
+ loadingIndicator: ['loadingIndicator'],
45
+ loadingWrapper: ['loadingWrapper']
41
46
  };
42
47
  const composedClasses = (0, _composeClasses.default)(slots, _buttonClasses.getButtonUtilityClass, classes);
43
48
  return {
@@ -82,7 +87,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
82
87
  const {
83
88
  ownerState
84
89
  } = props;
85
- return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${(0, _capitalize.default)(ownerState.color)}`], styles[`size${(0, _capitalize.default)(ownerState.size)}`], styles[`${ownerState.variant}Size${(0, _capitalize.default)(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
90
+ return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${(0, _capitalize.default)(ownerState.color)}`], styles[`size${(0, _capitalize.default)(ownerState.size)}`], styles[`${ownerState.variant}Size${(0, _capitalize.default)(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth, ownerState.loading && styles.loading];
86
91
  }
87
92
  })((0, _memoTheme.default)(({
88
93
  theme
@@ -269,6 +274,18 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
269
274
  style: {
270
275
  width: '100%'
271
276
  }
277
+ }, {
278
+ props: {
279
+ loadingPosition: 'center'
280
+ },
281
+ style: {
282
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
283
+ duration: theme.transitions.duration.short
284
+ }),
285
+ [`&.${_buttonClasses.default.loading}`]: {
286
+ color: 'transparent'
287
+ }
288
+ }
272
289
  }]
273
290
  };
274
291
  }));
@@ -279,9 +296,11 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
279
296
  const {
280
297
  ownerState
281
298
  } = props;
282
- return [styles.startIcon, styles[`iconSize${(0, _capitalize.default)(ownerState.size)}`]];
299
+ return [styles.startIcon, ownerState.loading && styles.startIconLoadingStart, styles[`iconSize${(0, _capitalize.default)(ownerState.size)}`]];
283
300
  }
284
- })({
301
+ })(({
302
+ theme
303
+ }) => ({
285
304
  display: 'inherit',
286
305
  marginRight: 8,
287
306
  marginLeft: -4,
@@ -292,8 +311,28 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
292
311
  style: {
293
312
  marginLeft: -2
294
313
  }
314
+ }, {
315
+ props: {
316
+ loadingPosition: 'start',
317
+ loading: true
318
+ },
319
+ style: {
320
+ transition: theme.transitions.create(['opacity'], {
321
+ duration: theme.transitions.duration.short
322
+ }),
323
+ opacity: 0
324
+ }
325
+ }, {
326
+ props: {
327
+ loadingPosition: 'start',
328
+ loading: true,
329
+ fullWidth: true
330
+ },
331
+ style: {
332
+ marginRight: -8
333
+ }
295
334
  }, ...commonIconStyles]
296
- });
335
+ }));
297
336
  const ButtonEndIcon = (0, _zeroStyled.styled)('span', {
298
337
  name: 'MuiButton',
299
338
  slot: 'EndIcon',
@@ -301,9 +340,11 @@ const ButtonEndIcon = (0, _zeroStyled.styled)('span', {
301
340
  const {
302
341
  ownerState
303
342
  } = props;
304
- return [styles.endIcon, styles[`iconSize${(0, _capitalize.default)(ownerState.size)}`]];
343
+ return [styles.endIcon, ownerState.loading && styles.endIconLoadingEnd, styles[`iconSize${(0, _capitalize.default)(ownerState.size)}`]];
305
344
  }
306
- })({
345
+ })(({
346
+ theme
347
+ }) => ({
307
348
  display: 'inherit',
308
349
  marginRight: -4,
309
350
  marginLeft: 8,
@@ -314,7 +355,128 @@ const ButtonEndIcon = (0, _zeroStyled.styled)('span', {
314
355
  style: {
315
356
  marginRight: -2
316
357
  }
358
+ }, {
359
+ props: {
360
+ loadingPosition: 'end',
361
+ loading: true
362
+ },
363
+ style: {
364
+ transition: theme.transitions.create(['opacity'], {
365
+ duration: theme.transitions.duration.short
366
+ }),
367
+ opacity: 0
368
+ }
369
+ }, {
370
+ props: {
371
+ loadingPosition: 'end',
372
+ loading: true,
373
+ fullWidth: true
374
+ },
375
+ style: {
376
+ marginLeft: -8
377
+ }
317
378
  }, ...commonIconStyles]
379
+ }));
380
+ const ButtonLoadingIndicator = (0, _zeroStyled.styled)('span', {
381
+ name: 'MuiButton',
382
+ slot: 'LoadingIndicator',
383
+ overridesResolver: (props, styles) => styles.loadingIndicator
384
+ })(({
385
+ theme
386
+ }) => ({
387
+ display: 'none',
388
+ position: 'absolute',
389
+ visibility: 'visible',
390
+ variants: [{
391
+ props: {
392
+ loading: true
393
+ },
394
+ style: {
395
+ display: 'flex'
396
+ }
397
+ }, {
398
+ props: {
399
+ loadingPosition: 'start'
400
+ },
401
+ style: {
402
+ left: 14
403
+ }
404
+ }, {
405
+ props: {
406
+ loadingPosition: 'start',
407
+ size: 'small'
408
+ },
409
+ style: {
410
+ left: 10
411
+ }
412
+ }, {
413
+ props: {
414
+ variant: 'text',
415
+ loadingPosition: 'start'
416
+ },
417
+ style: {
418
+ left: 6
419
+ }
420
+ }, {
421
+ props: {
422
+ loadingPosition: 'center'
423
+ },
424
+ style: {
425
+ left: '50%',
426
+ transform: 'translate(-50%)',
427
+ color: (theme.vars || theme).palette.action.disabled
428
+ }
429
+ }, {
430
+ props: {
431
+ loadingPosition: 'end'
432
+ },
433
+ style: {
434
+ right: 14
435
+ }
436
+ }, {
437
+ props: {
438
+ loadingPosition: 'end',
439
+ size: 'small'
440
+ },
441
+ style: {
442
+ right: 10
443
+ }
444
+ }, {
445
+ props: {
446
+ variant: 'text',
447
+ loadingPosition: 'end'
448
+ },
449
+ style: {
450
+ right: 6
451
+ }
452
+ }, {
453
+ props: {
454
+ loadingPosition: 'start',
455
+ fullWidth: true
456
+ },
457
+ style: {
458
+ position: 'relative',
459
+ left: -10
460
+ }
461
+ }, {
462
+ props: {
463
+ loadingPosition: 'end',
464
+ fullWidth: true
465
+ },
466
+ style: {
467
+ position: 'relative',
468
+ right: -10
469
+ }
470
+ }]
471
+ }));
472
+ const ButtonLoadingIconPlaceholder = (0, _zeroStyled.styled)('span', {
473
+ name: 'MuiButton',
474
+ slot: 'LoadingIconPlaceholder',
475
+ overridesResolver: (props, styles) => styles.loadingIconPlaceholder
476
+ })({
477
+ display: 'inline-block',
478
+ width: '1em',
479
+ height: '1em'
318
480
  });
319
481
  const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
320
482
  // props priority: `inProps` > `contextProps` > `themeDefaultProps`
@@ -336,12 +498,22 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
336
498
  endIcon: endIconProp,
337
499
  focusVisibleClassName,
338
500
  fullWidth = false,
501
+ id: idProp,
502
+ loading = null,
503
+ loadingIndicator: loadingIndicatorProp,
504
+ loadingPosition = 'center',
339
505
  size = 'medium',
340
506
  startIcon: startIconProp,
341
507
  type,
342
508
  variant = 'text',
343
509
  ...other
344
510
  } = props;
511
+ const id = (0, _utils.unstable_useId)(idProp);
512
+ const loadingIndicator = loadingIndicatorProp ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
513
+ "aria-labelledby": id,
514
+ color: "inherit",
515
+ size: 16
516
+ });
345
517
  const ownerState = {
346
518
  ...props,
347
519
  color,
@@ -350,34 +522,58 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
350
522
  disableElevation,
351
523
  disableFocusRipple,
352
524
  fullWidth,
525
+ loading,
526
+ loadingIndicator,
527
+ loadingPosition,
353
528
  size,
354
529
  type,
355
530
  variant
356
531
  };
357
532
  const classes = useUtilityClasses(ownerState);
358
- const startIcon = startIconProp && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonStartIcon, {
533
+ const startIcon = (startIconProp || loading && loadingPosition === 'start') && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonStartIcon, {
359
534
  className: classes.startIcon,
360
535
  ownerState: ownerState,
361
- children: startIconProp
536
+ children: startIconProp || /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonLoadingIconPlaceholder, {
537
+ className: classes.loadingIconPlaceholder,
538
+ ownerState: ownerState
539
+ })
362
540
  });
363
- const endIcon = endIconProp && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonEndIcon, {
541
+ const endIcon = (endIconProp || loading && loadingPosition === 'end') && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonEndIcon, {
364
542
  className: classes.endIcon,
365
543
  ownerState: ownerState,
366
- children: endIconProp
544
+ children: endIconProp || /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonLoadingIconPlaceholder, {
545
+ className: classes.loadingIconPlaceholder,
546
+ ownerState: ownerState
547
+ })
367
548
  });
368
549
  const positionClassName = buttonGroupButtonContextPositionClassName || '';
550
+ const loader = typeof loading === 'boolean' ?
551
+ /*#__PURE__*/
552
+ // use plain HTML span to minimize the runtime overhead
553
+ (0, _jsxRuntime.jsx)("span", {
554
+ className: classes.loadingWrapper,
555
+ style: {
556
+ display: 'contents'
557
+ },
558
+ children: loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(ButtonLoadingIndicator, {
559
+ className: classes.loadingIndicator,
560
+ ownerState: ownerState,
561
+ children: loadingIndicator
562
+ })
563
+ }) : null;
369
564
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonRoot, {
370
565
  ownerState: ownerState,
371
566
  className: (0, _clsx.default)(contextProps.className, classes.root, className, positionClassName),
372
567
  component: component,
373
- disabled: disabled,
568
+ disabled: disabled || loading,
374
569
  focusRipple: !disableFocusRipple,
375
570
  focusVisibleClassName: (0, _clsx.default)(classes.focusVisible, focusVisibleClassName),
376
571
  ref: ref,
377
572
  type: type,
573
+ id: id,
378
574
  ...other,
379
575
  classes: classes,
380
- children: [startIcon, children, endIcon]
576
+ children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
381
577
  });
382
578
  });
383
579
  process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */ = {
@@ -450,6 +646,28 @@ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */
450
646
  * If defined, an `a` element will be used as the root node.
451
647
  */
452
648
  href: _propTypes.default.string,
649
+ /**
650
+ * @ignore
651
+ */
652
+ id: _propTypes.default.string,
653
+ /**
654
+ * If `true`, the loading indicator is visible and the button is disabled.
655
+ * 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).
656
+ * @default null
657
+ */
658
+ loading: _propTypes.default.bool,
659
+ /**
660
+ * Element placed before the children if the button is in loading state.
661
+ * The node should contain an element with `role="progressbar"` with an accessible name.
662
+ * By default, it renders a `CircularProgress` that is labeled by the button itself.
663
+ * @default <CircularProgress color="inherit" size={16} />
664
+ */
665
+ loadingIndicator: _propTypes.default.node,
666
+ /**
667
+ * The loading indicator can be positioned on the start, end, or the center of the button.
668
+ * @default 'center'
669
+ */
670
+ loadingPosition: _propTypes.default.oneOf(['center', 'end', 'start']),
453
671
  /**
454
672
  * The size of the component.
455
673
  * `small` is equivalent to the dense button styling.
@@ -11,5 +11,5 @@ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateU
11
11
  function getButtonUtilityClass(slot) {
12
12
  return (0, _generateUtilityClass.default)('MuiButton', slot);
13
13
  }
14
- const buttonClasses = (0, _generateUtilityClasses.default)('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']);
14
+ const buttonClasses = (0, _generateUtilityClasses.default)('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']);
15
15
  var _default = exports.default = buttonClasses;
@@ -9,12 +9,12 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _clsx = _interopRequireDefault(require("clsx"));
13
12
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
13
  var _Typography = _interopRequireWildcard(require("../Typography"));
15
14
  var _zeroStyled = require("../zero-styled");
16
15
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
17
16
  var _cardHeaderClasses = _interopRequireWildcard(require("./cardHeaderClasses"));
17
+ var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  const useUtilityClasses = ownerState => {
20
20
  const {
@@ -86,13 +86,14 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
86
86
  const {
87
87
  action,
88
88
  avatar,
89
- className,
90
89
  component = 'div',
91
90
  disableTypography = false,
92
91
  subheader: subheaderProp,
93
92
  subheaderTypographyProps,
94
93
  title: titleProp,
95
94
  titleTypographyProps,
95
+ slots = {},
96
+ slotProps = {},
96
97
  ...other
97
98
  } = props;
98
99
  const ownerState = {
@@ -101,44 +102,88 @@ const CardHeader = /*#__PURE__*/React.forwardRef(function CardHeader(inProps, re
101
102
  disableTypography
102
103
  };
103
104
  const classes = useUtilityClasses(ownerState);
105
+ const externalForwardedProps = {
106
+ slots,
107
+ slotProps: {
108
+ title: titleTypographyProps,
109
+ subheader: subheaderTypographyProps,
110
+ ...slotProps
111
+ }
112
+ };
104
113
  let title = titleProp;
105
- if (title != null && title.type !== _Typography.default && !disableTypography) {
106
- title = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
114
+ const [TitleSlot, titleSlotProps] = (0, _useSlot.default)('title', {
115
+ className: classes.title,
116
+ elementType: _Typography.default,
117
+ externalForwardedProps,
118
+ ownerState,
119
+ additionalProps: {
107
120
  variant: avatar ? 'body2' : 'h5',
108
- className: classes.title,
109
- component: "span",
110
- ...titleTypographyProps,
121
+ component: 'span'
122
+ }
123
+ });
124
+ if (title != null && title.type !== _Typography.default && !disableTypography) {
125
+ title = /*#__PURE__*/(0, _jsxRuntime.jsx)(TitleSlot, {
126
+ ...titleSlotProps,
111
127
  children: title
112
128
  });
113
129
  }
114
130
  let subheader = subheaderProp;
115
- if (subheader != null && subheader.type !== _Typography.default && !disableTypography) {
116
- subheader = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
131
+ const [SubheaderSlot, subheaderSlotProps] = (0, _useSlot.default)('subheader', {
132
+ className: classes.subheader,
133
+ elementType: _Typography.default,
134
+ externalForwardedProps,
135
+ ownerState,
136
+ additionalProps: {
117
137
  variant: avatar ? 'body2' : 'body1',
118
- className: classes.subheader,
119
- color: "textSecondary",
120
- component: "span",
121
- ...subheaderTypographyProps,
138
+ color: 'textSecondary',
139
+ component: 'span'
140
+ }
141
+ });
142
+ if (subheader != null && subheader.type !== _Typography.default && !disableTypography) {
143
+ subheader = /*#__PURE__*/(0, _jsxRuntime.jsx)(SubheaderSlot, {
144
+ ...subheaderSlotProps,
122
145
  children: subheader
123
146
  });
124
147
  }
125
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardHeaderRoot, {
126
- className: (0, _clsx.default)(classes.root, className),
127
- as: component,
128
- ref: ref,
129
- ownerState: ownerState,
130
- ...other,
131
- children: [avatar && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardHeaderAvatar, {
132
- className: classes.avatar,
133
- ownerState: ownerState,
148
+ const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
149
+ ref,
150
+ className: classes.root,
151
+ elementType: CardHeaderRoot,
152
+ externalForwardedProps: {
153
+ ...externalForwardedProps,
154
+ ...other,
155
+ component
156
+ },
157
+ ownerState
158
+ });
159
+ const [AvatarSlot, avatarSlotProps] = (0, _useSlot.default)('avatar', {
160
+ className: classes.avatar,
161
+ elementType: CardHeaderAvatar,
162
+ externalForwardedProps,
163
+ ownerState
164
+ });
165
+ const [ContentSlot, contentSlotProps] = (0, _useSlot.default)('content', {
166
+ className: classes.content,
167
+ elementType: CardHeaderContent,
168
+ externalForwardedProps,
169
+ ownerState
170
+ });
171
+ const [ActionSlot, actionSlotProps] = (0, _useSlot.default)('action', {
172
+ className: classes.action,
173
+ elementType: CardHeaderAction,
174
+ externalForwardedProps,
175
+ ownerState
176
+ });
177
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
178
+ ...rootSlotProps,
179
+ children: [avatar && /*#__PURE__*/(0, _jsxRuntime.jsx)(AvatarSlot, {
180
+ ...avatarSlotProps,
134
181
  children: avatar
135
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(CardHeaderContent, {
136
- className: classes.content,
137
- ownerState: ownerState,
182
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentSlot, {
183
+ ...contentSlotProps,
138
184
  children: [title, subheader]
139
- }), action && /*#__PURE__*/(0, _jsxRuntime.jsx)(CardHeaderAction, {
140
- className: classes.action,
141
- ownerState: ownerState,
185
+ }), action && /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionSlot, {
186
+ ...actionSlotProps,
142
187
  children: action
143
188
  })]
144
189
  });
@@ -164,10 +209,6 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
164
209
  * Override or extend the styles applied to the component.
165
210
  */
166
211
  classes: _propTypes.default.object,
167
- /**
168
- * @ignore
169
- */
170
- className: _propTypes.default.string,
171
212
  /**
172
213
  * The component used for the root node.
173
214
  * Either a string to use a HTML element or a component.
@@ -181,6 +222,30 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
181
222
  * @default false
182
223
  */
183
224
  disableTypography: _propTypes.default.bool,
225
+ /**
226
+ * The props used for each slot inside.
227
+ * @default {}
228
+ */
229
+ slotProps: _propTypes.default.shape({
230
+ action: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
231
+ avatar: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
232
+ content: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
233
+ root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
234
+ subheader: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
235
+ title: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
236
+ }),
237
+ /**
238
+ * The components used for each slot inside.
239
+ * @default {}
240
+ */
241
+ slots: _propTypes.default.shape({
242
+ action: _propTypes.default.elementType,
243
+ avatar: _propTypes.default.elementType,
244
+ content: _propTypes.default.elementType,
245
+ root: _propTypes.default.elementType,
246
+ subheader: _propTypes.default.elementType,
247
+ title: _propTypes.default.elementType
248
+ }),
184
249
  /**
185
250
  * The content of the component.
186
251
  */
@@ -188,6 +253,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
188
253
  /**
189
254
  * These props will be forwarded to the subheader
190
255
  * (as long as disableTypography is not `true`).
256
+ * @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.
191
257
  */
192
258
  subheaderTypographyProps: _propTypes.default.object,
193
259
  /**
@@ -201,6 +267,7 @@ process.env.NODE_ENV !== "production" ? CardHeader.propTypes /* remove-proptypes
201
267
  /**
202
268
  * These props will be forwarded to the title
203
269
  * (as long as disableTypography is not `true`).
270
+ * @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.
204
271
  */
205
272
  titleTypographyProps: _propTypes.default.object
206
273
  } : void 0;
@@ -41,8 +41,8 @@ const circularDashKeyframe = (0, _zeroStyled.keyframes)`
41
41
  }
42
42
 
43
43
  100% {
44
- stroke-dasharray: 100px, 200px;
45
- stroke-dashoffset: -125px;
44
+ stroke-dasharray: 1px, 200px;
45
+ stroke-dashoffset: -126px;
46
46
  }
47
47
  `;
48
48