@mui/material 7.0.0-alpha.2 → 7.0.0-beta.1

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 (146) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/Dialog/Dialog.d.ts +0 -5
  3. package/Dialog/Dialog.js +0 -9
  4. package/Grid/Grid.d.ts +51 -100
  5. package/Grid/Grid.js +68 -515
  6. package/Grid/gridClasses.d.ts +0 -38
  7. package/Grid/gridClasses.js +1 -1
  8. package/Grid/index.js +12 -2
  9. package/GridLegacy/GridLegacy.d.ts +160 -0
  10. package/GridLegacy/GridLegacy.js +601 -0
  11. package/{Grid/GridContext.js → GridLegacy/GridLegacyContext.js} +3 -3
  12. package/GridLegacy/gridLegacyClasses.d.ts +48 -0
  13. package/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +5 -5
  14. package/GridLegacy/index.d.ts +4 -0
  15. package/GridLegacy/index.js +35 -0
  16. package/Menu/Menu.d.ts +68 -1
  17. package/Menu/Menu.js +52 -17
  18. package/Modal/Modal.d.ts +0 -5
  19. package/Modal/Modal.js +0 -9
  20. package/PigmentGrid/PigmentGrid.d.ts +1 -1
  21. package/PigmentGrid/PigmentGrid.js +2 -2
  22. package/PigmentGrid/index.d.ts +1 -1
  23. package/PigmentGrid/index.js +4 -4
  24. package/Rating/Rating.d.ts +52 -1
  25. package/Rating/Rating.js +132 -46
  26. package/Select/SelectInput.js +8 -8
  27. package/StepButton/StepButton.d.ts +0 -5
  28. package/esm/Dialog/Dialog.d.ts +0 -5
  29. package/esm/Dialog/Dialog.js +0 -9
  30. package/esm/Grid/Grid.d.ts +51 -100
  31. package/esm/Grid/Grid.js +68 -508
  32. package/esm/Grid/gridClasses.d.ts +0 -38
  33. package/esm/Grid/gridClasses.js +1 -1
  34. package/esm/Grid/index.js +1 -0
  35. package/esm/GridLegacy/GridLegacy.d.ts +160 -0
  36. package/esm/GridLegacy/GridLegacy.js +588 -0
  37. package/esm/GridLegacy/GridLegacyContext.js +12 -0
  38. package/esm/GridLegacy/gridLegacyClasses.d.ts +48 -0
  39. package/esm/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +4 -4
  40. package/esm/GridLegacy/index.d.ts +4 -0
  41. package/esm/GridLegacy/index.js +3 -0
  42. package/esm/Menu/Menu.d.ts +68 -1
  43. package/esm/Menu/Menu.js +52 -17
  44. package/esm/Modal/Modal.d.ts +0 -5
  45. package/esm/Modal/Modal.js +0 -9
  46. package/esm/PigmentGrid/PigmentGrid.d.ts +1 -1
  47. package/esm/PigmentGrid/PigmentGrid.js +2 -2
  48. package/esm/PigmentGrid/index.d.ts +1 -1
  49. package/esm/PigmentGrid/index.js +1 -1
  50. package/esm/Rating/Rating.d.ts +52 -1
  51. package/esm/Rating/Rating.js +131 -45
  52. package/esm/Select/SelectInput.js +8 -8
  53. package/esm/StepButton/StepButton.d.ts +0 -5
  54. package/esm/index.d.ts +3 -8
  55. package/esm/index.js +3 -3
  56. package/esm/styles/components.d.ts +5 -5
  57. package/esm/styles/createTheme.d.ts +0 -1
  58. package/esm/styles/createTheme.js +0 -1
  59. package/esm/styles/createThemeNoVars.d.ts +0 -6
  60. package/esm/styles/createThemeNoVars.js +7 -12
  61. package/esm/styles/index.d.ts +1 -5
  62. package/esm/styles/index.js +1 -2
  63. package/esm/styles/overrides.d.ts +2 -2
  64. package/esm/styles/props.d.ts +2 -2
  65. package/esm/utils/createSvgIcon.d.ts +1 -1
  66. package/esm/utils/createSvgIcon.js +1 -1
  67. package/esm/version/index.js +2 -2
  68. package/index.d.ts +3 -8
  69. package/index.js +9 -9
  70. package/modern/Dialog/Dialog.d.ts +0 -5
  71. package/modern/Dialog/Dialog.js +0 -9
  72. package/modern/Grid/Grid.d.ts +51 -100
  73. package/modern/Grid/Grid.js +68 -508
  74. package/modern/Grid/gridClasses.d.ts +0 -38
  75. package/modern/Grid/gridClasses.js +1 -1
  76. package/modern/Grid/index.js +1 -0
  77. package/modern/GridLegacy/GridLegacy.d.ts +160 -0
  78. package/modern/GridLegacy/GridLegacy.js +588 -0
  79. package/modern/GridLegacy/GridLegacyContext.js +12 -0
  80. package/modern/GridLegacy/gridLegacyClasses.d.ts +48 -0
  81. package/modern/{Grid2/grid2Classes.js → GridLegacy/gridLegacyClasses.js} +4 -4
  82. package/modern/GridLegacy/index.d.ts +4 -0
  83. package/modern/GridLegacy/index.js +3 -0
  84. package/modern/Menu/Menu.d.ts +68 -1
  85. package/modern/Menu/Menu.js +52 -17
  86. package/modern/Modal/Modal.d.ts +0 -5
  87. package/modern/Modal/Modal.js +0 -9
  88. package/modern/PigmentGrid/PigmentGrid.d.ts +1 -1
  89. package/modern/PigmentGrid/PigmentGrid.js +2 -2
  90. package/modern/PigmentGrid/index.d.ts +1 -1
  91. package/modern/PigmentGrid/index.js +1 -1
  92. package/modern/Rating/Rating.d.ts +52 -1
  93. package/modern/Rating/Rating.js +131 -45
  94. package/modern/Select/SelectInput.js +8 -8
  95. package/modern/StepButton/StepButton.d.ts +0 -5
  96. package/modern/index.d.ts +3 -8
  97. package/modern/index.js +3 -3
  98. package/modern/styles/components.d.ts +5 -5
  99. package/modern/styles/createTheme.d.ts +0 -1
  100. package/modern/styles/createTheme.js +0 -1
  101. package/modern/styles/createThemeNoVars.d.ts +0 -6
  102. package/modern/styles/createThemeNoVars.js +7 -12
  103. package/modern/styles/index.d.ts +1 -5
  104. package/modern/styles/index.js +1 -2
  105. package/modern/styles/overrides.d.ts +2 -2
  106. package/modern/styles/props.d.ts +2 -2
  107. package/modern/utils/createSvgIcon.d.ts +1 -1
  108. package/modern/utils/createSvgIcon.js +1 -1
  109. package/modern/version/index.js +2 -2
  110. package/package.json +4 -4
  111. package/styles/components.d.ts +5 -5
  112. package/styles/createTheme.d.ts +0 -1
  113. package/styles/createTheme.js +1 -8
  114. package/styles/createThemeNoVars.d.ts +0 -6
  115. package/styles/createThemeNoVars.js +7 -13
  116. package/styles/index.d.ts +1 -5
  117. package/styles/index.js +1 -15
  118. package/styles/overrides.d.ts +2 -2
  119. package/styles/props.d.ts +2 -2
  120. package/tsconfig.build.tsbuildinfo +1 -1
  121. package/utils/createSvgIcon.d.ts +1 -1
  122. package/utils/createSvgIcon.js +1 -1
  123. package/version/index.js +2 -2
  124. package/Grid2/Grid2.d.ts +0 -111
  125. package/Grid2/Grid2.js +0 -144
  126. package/Grid2/grid2Classes.d.ts +0 -10
  127. package/Grid2/index.d.ts +0 -4
  128. package/Grid2/index.js +0 -45
  129. package/StyledEngineProvider/index.d.ts +0 -4
  130. package/StyledEngineProvider/index.js +0 -12
  131. package/esm/Grid/GridContext.js +0 -12
  132. package/esm/Grid2/Grid2.d.ts +0 -111
  133. package/esm/Grid2/Grid2.js +0 -138
  134. package/esm/Grid2/grid2Classes.d.ts +0 -10
  135. package/esm/Grid2/index.d.ts +0 -4
  136. package/esm/Grid2/index.js +0 -4
  137. package/esm/StyledEngineProvider/index.d.ts +0 -4
  138. package/esm/StyledEngineProvider/index.js +0 -1
  139. package/modern/Grid/GridContext.js +0 -12
  140. package/modern/Grid2/Grid2.d.ts +0 -111
  141. package/modern/Grid2/Grid2.js +0 -138
  142. package/modern/Grid2/grid2Classes.d.ts +0 -10
  143. package/modern/Grid2/index.d.ts +0 -4
  144. package/modern/Grid2/index.js +0 -4
  145. package/modern/StyledEngineProvider/index.d.ts +0 -4
  146. package/modern/StyledEngineProvider/index.js +0 -1
package/Rating/Rating.js CHANGED
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.default = void 0;
10
- var React = _interopRequireWildcard(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var React = _react;
11
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
13
  var _clsx = _interopRequireDefault(require("clsx"));
13
14
  var _clamp = _interopRequireDefault(require("@mui/utils/clamp"));
@@ -24,6 +25,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
24
25
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
25
26
  var _slotShouldForwardProp = _interopRequireDefault(require("../styles/slotShouldForwardProp"));
26
27
  var _ratingClasses = _interopRequireWildcard(require("./ratingClasses"));
28
+ var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
27
29
  var _jsxRuntime = require("react/jsx-runtime");
28
30
  function getDecimalPrecision(num) {
29
31
  const decimalPart = num.toString().split('.')[1];
@@ -227,7 +229,9 @@ function RatingItem(props) {
227
229
  readOnly,
228
230
  ownerState,
229
231
  ratingValue,
230
- ratingValueRounded
232
+ ratingValueRounded,
233
+ slots = {},
234
+ slotProps = {}
231
235
  } = props;
232
236
  const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
233
237
  const isHovered = itemValue <= hover;
@@ -239,10 +243,14 @@ function RatingItem(props) {
239
243
  // Update to const id = useId(); when React 17 support is dropped.
240
244
  // More details: https://github.com/mui/material-ui/issues/40997
241
245
  const id = `${name}-${(0, _utils.unstable_useId)()}`;
242
- const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingIcon, {
243
- as: IconContainerComponent,
244
- value: itemValue,
246
+ const externalForwardedProps = {
247
+ slots,
248
+ slotProps
249
+ };
250
+ const [IconSlot, iconSlotProps] = (0, _useSlot.default)('icon', {
251
+ elementType: RatingIcon,
245
252
  className: (0, _clsx.default)(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
253
+ externalForwardedProps,
246
254
  ownerState: {
247
255
  ...ownerState,
248
256
  iconEmpty: !isFilled,
@@ -251,6 +259,29 @@ function RatingItem(props) {
251
259
  iconFocus: isFocused,
252
260
  iconActive: isActive
253
261
  },
262
+ additionalProps: {
263
+ value: itemValue
264
+ },
265
+ internalForwardedProps: {
266
+ // TODO: remove this in v7 because `IconContainerComponent` is deprecated
267
+ // only forward if `slots.icon` is NOT provided
268
+ as: IconContainerComponent
269
+ }
270
+ });
271
+ const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
272
+ elementType: RatingLabel,
273
+ externalForwardedProps,
274
+ ownerState: {
275
+ ...ownerState,
276
+ emptyValueFocused: undefined
277
+ },
278
+ additionalProps: {
279
+ style: labelProps?.style,
280
+ htmlFor: id
281
+ }
282
+ });
283
+ const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSlot, {
284
+ ...iconSlotProps,
254
285
  children: emptyIcon && !isFilled ? emptyIcon : icon
255
286
  });
256
287
  if (readOnly) {
@@ -260,13 +291,8 @@ function RatingItem(props) {
260
291
  });
261
292
  }
262
293
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
263
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RatingLabel, {
264
- ownerState: {
265
- ...ownerState,
266
- emptyValueFocused: undefined
267
- },
268
- htmlFor: id,
269
- ...labelProps,
294
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
295
+ ...labelSlotProps,
270
296
  children: [container, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
271
297
  className: classes.visuallyHidden,
272
298
  children: getLabelText(itemValue)
@@ -307,7 +333,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
307
333
  ownerState: _propTypes.default.object.isRequired,
308
334
  ratingValue: _propTypes.default.number,
309
335
  ratingValueRounded: _propTypes.default.number,
310
- readOnly: _propTypes.default.bool.isRequired
336
+ readOnly: _propTypes.default.bool.isRequired,
337
+ slotProps: _propTypes.default.object,
338
+ slots: _propTypes.default.object
311
339
  } : void 0;
312
340
  const defaultIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Star.default, {
313
341
  fontSize: "inherit"
@@ -344,6 +372,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
344
372
  readOnly = false,
345
373
  size = 'medium',
346
374
  value: valueProp,
375
+ slots = {},
376
+ slotProps = {},
347
377
  ...other
348
378
  } = props;
349
379
  const name = (0, _utils.unstable_useId)(nameProp);
@@ -481,16 +511,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
481
511
  size
482
512
  };
483
513
  const classes = useUtilityClasses(ownerState);
484
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RatingRoot, {
485
- as: component,
514
+ const externalForwardedProps = {
515
+ slots,
516
+ slotProps
517
+ };
518
+ const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
486
519
  ref: handleRef,
487
- onMouseMove: handleMouseMove,
488
- onMouseLeave: handleMouseLeave,
489
- className: (0, _clsx.default)(classes.root, className, readOnly && 'MuiRating-readOnly'),
490
- ownerState: ownerState,
491
- role: readOnly ? 'img' : null,
492
- "aria-label": readOnly ? getLabelText(value) : null,
493
- ...other,
520
+ className: (0, _clsx.default)(classes.root, className),
521
+ elementType: RatingRoot,
522
+ externalForwardedProps: {
523
+ ...externalForwardedProps,
524
+ ...other,
525
+ component
526
+ },
527
+ getSlotProps: handlers => ({
528
+ ...handlers,
529
+ onMouseMove: event => {
530
+ handleMouseMove(event);
531
+ handlers.onMouseMove?.(event);
532
+ },
533
+ onMouseLeave: event => {
534
+ handleMouseLeave(event);
535
+ handlers.onMouseLeave?.(event);
536
+ }
537
+ }),
538
+ ownerState,
539
+ additionalProps: {
540
+ role: readOnly ? 'img' : null,
541
+ 'aria-label': readOnly ? getLabelText(value) : null
542
+ }
543
+ });
544
+ const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
545
+ className: (0, _clsx.default)(classes.label, classes.labelEmptyValue),
546
+ elementType: RatingLabel,
547
+ externalForwardedProps,
548
+ ownerState
549
+ });
550
+ const [DecimalSlot, decimalSlotProps] = (0, _useSlot.default)('decimal', {
551
+ className: classes.decimal,
552
+ elementType: RatingDecimal,
553
+ externalForwardedProps,
554
+ ownerState
555
+ });
556
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
557
+ ...rootSlotProps,
494
558
  children: [Array.from(new Array(max)).map((_, index) => {
495
559
  const itemValue = index + 1;
496
560
  const ratingItemProps = {
@@ -511,41 +575,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
511
575
  ratingValue: value,
512
576
  ratingValueRounded: valueRounded,
513
577
  readOnly,
514
- ownerState
578
+ ownerState,
579
+ slots,
580
+ slotProps
515
581
  };
516
582
  const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
517
583
  if (precision < 1) {
518
584
  const items = Array.from(new Array(1 / precision));
519
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingDecimal, {
520
- className: (0, _clsx.default)(classes.decimal, isActive && classes.iconActive),
521
- ownerState: ownerState,
522
- iconActive: isActive,
523
- children: items.map(($, indexDecimal) => {
524
- const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
525
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
526
- ...ratingItemProps,
527
- // The icon is already displayed as active
528
- isActive: false,
529
- itemValue: itemDecimalValue,
530
- labelProps: {
531
- style: items.length - 1 === indexDecimal ? {} : {
532
- width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
533
- overflow: 'hidden',
534
- position: 'absolute'
535
- }
585
+ return /*#__PURE__*/(0, _react.createElement)(DecimalSlot, {
586
+ ...decimalSlotProps,
587
+ key: itemValue,
588
+ className: (0, _clsx.default)(decimalSlotProps.className, isActive && classes.iconActive),
589
+ iconActive: isActive
590
+ }, items.map(($, indexDecimal) => {
591
+ const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
592
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
593
+ ...ratingItemProps,
594
+ // The icon is already displayed as active
595
+ isActive: false,
596
+ itemValue: itemDecimalValue,
597
+ labelProps: {
598
+ style: items.length - 1 === indexDecimal ? {} : {
599
+ width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
600
+ overflow: 'hidden',
601
+ position: 'absolute'
536
602
  }
537
- }, itemDecimalValue);
538
- })
539
- }, itemValue);
603
+ }
604
+ }, itemDecimalValue);
605
+ }));
540
606
  }
541
607
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
542
608
  ...ratingItemProps,
543
609
  isActive: isActive,
544
610
  itemValue: itemValue
545
611
  }, itemValue);
546
- }), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(RatingLabel, {
547
- className: (0, _clsx.default)(classes.label, classes.labelEmptyValue),
548
- ownerState: ownerState,
612
+ }), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
613
+ ...labelSlotProps,
549
614
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
550
615
  className: classes.visuallyHidden,
551
616
  value: "",
@@ -629,6 +694,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
629
694
  icon: _propTypes.default.node,
630
695
  /**
631
696
  * The component containing the icon.
697
+ * @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
632
698
  * @default function IconContainer(props) {
633
699
  * const { value, ...other } = props;
634
700
  * return <span {...other} />;
@@ -686,6 +752,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
686
752
  * @default 'medium'
687
753
  */
688
754
  size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['small', 'medium', 'large']), _propTypes.default.string]),
755
+ /**
756
+ * The props used for each slot inside.
757
+ * @default {}
758
+ */
759
+ slotProps: _propTypes.default.shape({
760
+ decimal: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
761
+ icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
762
+ label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
763
+ root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
764
+ }),
765
+ /**
766
+ * The components used for each slot inside.
767
+ * @default {}
768
+ */
769
+ slots: _propTypes.default.shape({
770
+ decimal: _propTypes.default.elementType,
771
+ icon: _propTypes.default.elementType,
772
+ label: _propTypes.default.elementType,
773
+ root: _propTypes.default.elementType
774
+ }),
689
775
  /**
690
776
  * The system prop that allows defining system overrides as well as additional CSS styles.
691
777
  */
@@ -507,16 +507,16 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
507
507
  horizontal: 'center'
508
508
  },
509
509
  ...MenuProps,
510
- MenuListProps: {
511
- 'aria-labelledby': labelId,
512
- role: 'listbox',
513
- 'aria-multiselectable': multiple ? 'true' : undefined,
514
- disableListWrap: true,
515
- id: listboxId,
516
- ...MenuProps.MenuListProps
517
- },
518
510
  slotProps: {
519
511
  ...MenuProps.slotProps,
512
+ list: {
513
+ 'aria-labelledby': labelId,
514
+ role: 'listbox',
515
+ 'aria-multiselectable': multiple ? 'true' : undefined,
516
+ disableListWrap: true,
517
+ id: listboxId,
518
+ ...MenuProps.MenuListProps
519
+ },
520
520
  paper: {
521
521
  ...paperProps,
522
522
  style: {
@@ -4,11 +4,6 @@ import { ButtonBaseTypeMap, ExtendButtonBase, ExtendButtonBaseTypeMap } from "..
4
4
  import { OverrideProps } from "../OverridableComponent/index.js";
5
5
  import { Theme } from "../styles/index.js";
6
6
  import { StepButtonClasses } from "./stepButtonClasses.js";
7
-
8
- /**
9
- * @deprecated use `StepButtonProps['icon']` instead.
10
- */
11
- export type StepButtonIcon = React.ReactNode;
12
7
  export interface StepButtonOwnProps {
13
8
  /**
14
9
  * Can be a `StepLabel` or a node to place inside `StepLabel` as children.
@@ -111,11 +111,6 @@ export interface DialogProps extends Omit<StandardProps<ModalProps, 'children'>,
111
111
  * @default 'sm'
112
112
  */
113
113
  maxWidth?: Breakpoint | false;
114
- /**
115
- * Callback fired when the backdrop is clicked.
116
- * @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events.
117
- */
118
- onBackdropClick?: ModalProps['onBackdropClick'];
119
114
  /**
120
115
  * Callback fired when the component requests to be closed.
121
116
  *
@@ -212,7 +212,6 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
212
212
  fullScreen = false,
213
213
  fullWidth = false,
214
214
  maxWidth = 'sm',
215
- onBackdropClick,
216
215
  onClick,
217
216
  onClose,
218
217
  open,
@@ -251,9 +250,6 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
251
250
  return;
252
251
  }
253
252
  backdropClick.current = null;
254
- if (onBackdropClick) {
255
- onBackdropClick(event);
256
- }
257
253
  if (onClose) {
258
254
  onClose(event, 'backdropClick');
259
255
  }
@@ -430,11 +426,6 @@ process.env.NODE_ENV !== "production" ? Dialog.propTypes /* remove-proptypes */
430
426
  * @default 'sm'
431
427
  */
432
428
  maxWidth: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
433
- /**
434
- * Callback fired when the backdrop is clicked.
435
- * @deprecated Use the `onClose` prop with the `reason` argument to handle the `backdropClick` events.
436
- */
437
- onBackdropClick: PropTypes.func,
438
429
  /**
439
430
  * @ignore
440
431
  */
@@ -1,77 +1,17 @@
1
- import * as React from 'react';
2
- import { ResponsiveStyleValue, SxProps, SystemProps, Breakpoint, BreakpointOverrides } from '@mui/system';
3
- import { IfEquals } from '@mui/types';
4
- import { Theme } from "../styles/index.js";
5
- import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
6
- import { GridClasses } from "./gridClasses.js";
1
+ import { SxProps, SystemProps } from '@mui/system';
2
+ import { OverridableComponent, OverrideProps } from '@mui/types';
3
+ import { Theme, Breakpoint } from "../styles/index.js";
4
+ type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
7
5
  export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
8
6
  export type GridSpacing = number | string;
9
7
  export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
10
- export type GridSize = 'auto' | number;
11
- export interface RegularBreakpoints {
12
- /**
13
- * If a number, it sets the number of columns the grid item uses.
14
- * It can't be greater than the total number of columns of the container (12 by default).
15
- * If 'auto', the grid item's width matches its content.
16
- * If false, the prop is ignored.
17
- * If true, the grid item's width grows to use the space available in the grid container.
18
- * The value is applied for the `lg` breakpoint and wider screens if not overridden.
19
- * @default false
20
- */
21
- lg?: boolean | GridSize;
22
- /**
23
- * If a number, it sets the number of columns the grid item uses.
24
- * It can't be greater than the total number of columns of the container (12 by default).
25
- * If 'auto', the grid item's width matches its content.
26
- * If false, the prop is ignored.
27
- * If true, the grid item's width grows to use the space available in the grid container.
28
- * The value is applied for the `md` breakpoint and wider screens if not overridden.
29
- * @default false
30
- */
31
- md?: boolean | GridSize;
32
- /**
33
- * If a number, it sets the number of columns the grid item uses.
34
- * It can't be greater than the total number of columns of the container (12 by default).
35
- * If 'auto', the grid item's width matches its content.
36
- * If false, the prop is ignored.
37
- * If true, the grid item's width grows to use the space available in the grid container.
38
- * The value is applied for the `sm` breakpoint and wider screens if not overridden.
39
- * @default false
40
- */
41
- sm?: boolean | GridSize;
42
- /**
43
- * If a number, it sets the number of columns the grid item uses.
44
- * It can't be greater than the total number of columns of the container (12 by default).
45
- * If 'auto', the grid item's width matches its content.
46
- * If false, the prop is ignored.
47
- * If true, the grid item's width grows to use the space available in the grid container.
48
- * The value is applied for the `xl` breakpoint and wider screens if not overridden.
49
- * @default false
50
- */
51
- xl?: boolean | GridSize;
52
- /**
53
- * If a number, it sets the number of columns the grid item uses.
54
- * It can't be greater than the total number of columns of the container (12 by default).
55
- * If 'auto', the grid item's width matches its content.
56
- * If false, the prop is ignored.
57
- * If true, the grid item's width grows to use the space available in the grid container.
58
- * The value is applied for all the screen sizes with the lowest priority.
59
- * @default false
60
- */
61
- xs?: boolean | GridSize;
62
- }
63
- type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize>>;
64
- interface BreakpointOverridesEmpty {}
65
- type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, RegularBreakpoints, CustomBreakpoints>;
66
- export interface GridOwnProps extends SystemProps<Theme>, Breakpoints {
8
+ export type GridSize = 'auto' | 'grow' | number | false;
9
+ export type GridOffset = 'auto' | number;
10
+ export interface GridBaseProps {
67
11
  /**
68
12
  * The content of the component.
69
13
  */
70
14
  children?: React.ReactNode;
71
- /**
72
- * Override or extend the styles applied to the component.
73
- */
74
- classes?: Partial<GridClasses>;
75
15
  /**
76
16
  * The number of columns.
77
17
  * @default 12
@@ -95,48 +35,68 @@ export interface GridOwnProps extends SystemProps<Theme>, Breakpoints {
95
35
  */
96
36
  direction?: ResponsiveStyleValue<GridDirection>;
97
37
  /**
98
- * If `true`, the component will have the flex *item* behavior.
99
- * You should be wrapping *items* with a *container*.
100
- * @default false
101
- */
102
- item?: boolean;
38
+ * Defines the offset value for the type `item` components.
39
+ */
40
+ offset?: ResponsiveStyleValue<GridOffset>;
41
+ /**
42
+ * @internal
43
+ * The level of the grid starts from `0` and increases when the grid nests
44
+ * inside another grid. Nesting is defined as a container Grid being a direct
45
+ * child of a container Grid.
46
+ *
47
+ * ```js
48
+ * <Grid container> // level 0
49
+ * <Grid container> // level 1
50
+ * <Grid container> // level 2
51
+ * ```
52
+ *
53
+ * Only consecutive grid is considered nesting. A grid container will start at
54
+ * `0` if there are non-Grid container element above it.
55
+ *
56
+ * ```js
57
+ * <Grid container> // level 0
58
+ * <div>
59
+ * <Grid container> // level 0
60
+ * ```
61
+ *
62
+ * ```js
63
+ * <Grid container> // level 0
64
+ * <Grid>
65
+ * <Grid container> // level 0
66
+ * ```
67
+ */
68
+ unstable_level?: number;
103
69
  /**
104
70
  * Defines the vertical space between the type `item` components.
105
71
  * It overrides the value of the `spacing` prop.
106
72
  */
107
73
  rowSpacing?: ResponsiveStyleValue<GridSpacing>;
74
+ /**
75
+ * Defines the size of the the type `item` components.
76
+ */
77
+ size?: ResponsiveStyleValue<GridSize>;
108
78
  /**
109
79
  * Defines the space between the type `item` components.
110
80
  * It can only be used on a type `container` component.
111
81
  * @default 0
112
82
  */
113
- spacing?: ResponsiveStyleValue<GridSpacing>;
114
- /**
115
- * The system prop that allows defining system overrides as well as additional CSS styles.
116
- */
117
- sx?: SxProps<Theme>;
83
+ spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
118
84
  /**
119
85
  * Defines the `flex-wrap` style property.
120
86
  * It's applied for all screen sizes.
121
87
  * @default 'wrap'
122
88
  */
123
89
  wrap?: GridWrap;
124
- /**
125
- * If `true`, it sets `min-width: 0` on the item.
126
- * Refer to the limitations section of the documentation to better understand the use case.
127
- * @default false
128
- */
129
- zeroMinWidth?: boolean;
130
90
  }
131
-
132
- /**
133
- * @deprecated Use the [`Grid2`](https://mui.com/material-ui/react-grid2/) component instead.
134
- */
135
- export interface GridTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div'> {
136
- props: AdditionalProps & GridOwnProps;
137
- defaultComponent: RootComponent;
91
+ export interface GridTypeMap<P = {}, D extends React.ElementType = 'div'> {
92
+ props: P & GridBaseProps & {
93
+ sx?: SxProps<Theme>;
94
+ } & SystemProps<Theme>;
95
+ defaultComponent: D;
138
96
  }
139
-
97
+ export type GridProps<D extends React.ElementType = GridTypeMap['defaultComponent'], P = {
98
+ component?: React.ElementType;
99
+ }> = OverrideProps<GridTypeMap<P, D>, D>;
140
100
  /**
141
101
  *
142
102
  * Demos:
@@ -146,15 +106,6 @@ export interface GridTypeMap<AdditionalProps = {}, RootComponent extends React.E
146
106
  * API:
147
107
  *
148
108
  * - [Grid API](https://next.mui.com/material-ui/api/grid/)
149
- *
150
- * @deprecated Use the [`Grid2`](https://mui.com/material-ui/react-grid2/) component instead.
151
109
  */
152
110
  declare const Grid: OverridableComponent<GridTypeMap>;
153
-
154
- /**
155
- * @deprecated Use the [`Grid2`](https://mui.com/material-ui/react-grid2/) component instead.
156
- */
157
- export type GridProps<RootComponent extends React.ElementType = GridTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<GridTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
158
- component?: React.ElementType;
159
- };
160
111
  export default Grid;