@mui/material 6.0.0-alpha.6 → 6.0.0-alpha.7

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.
@@ -37,11 +37,12 @@ var _ArrowDropDown = _interopRequireDefault(require("../internal/svg-icons/Arrow
37
37
  var _zeroStyled = require("../zero-styled");
38
38
  var _autocompleteClasses = _interopRequireWildcard(require("./autocompleteClasses"));
39
39
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
40
- var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
40
+ var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
41
41
  var _jsxRuntime = require("react/jsx-runtime");
42
42
  var _ClearIcon, _ArrowDropDownIcon;
43
- const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionKey", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "slotProps", "value"],
44
- _excluded2 = ["ref"];
43
+ const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionKey", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "slots", "slotProps", "value"],
44
+ _excluded2 = ["ref"],
45
+ _excluded3 = ["key"];
45
46
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
46
47
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
47
48
  const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiAutocomplete');
@@ -104,21 +105,11 @@ const AutocompleteRoot = (0, _zeroStyled.styled)('div', {
104
105
  }, styles.root, fullWidth && styles.fullWidth, hasPopupIcon && styles.hasPopupIcon, hasClearIcon && styles.hasClearIcon];
105
106
  }
106
107
  })({
107
- [`&.${_autocompleteClasses.default.focused} .${_autocompleteClasses.default.clearIndicator}`]: {
108
- visibility: 'visible'
109
- },
110
- /* Avoid double tap issue on iOS */
111
- '@media (pointer: fine)': {
112
- [`&:hover .${_autocompleteClasses.default.clearIndicator}`]: {
113
- visibility: 'visible'
114
- }
115
- },
116
108
  [`& .${_autocompleteClasses.default.tag}`]: {
117
109
  margin: 3,
118
110
  maxWidth: 'calc(100% - 6px)'
119
111
  },
120
112
  [`& .${_autocompleteClasses.default.inputRoot}`]: {
121
- flexWrap: 'wrap',
122
113
  [`.${_autocompleteClasses.default.hasPopupIcon}&, .${_autocompleteClasses.default.hasClearIcon}&`]: {
123
114
  paddingRight: 26 + 4
124
115
  },
@@ -130,6 +121,23 @@ const AutocompleteRoot = (0, _zeroStyled.styled)('div', {
130
121
  minWidth: 30
131
122
  }
132
123
  },
124
+ [`&.${_autocompleteClasses.default.focused}`]: {
125
+ [`& .${_autocompleteClasses.default.clearIndicator}`]: {
126
+ visibility: 'visible'
127
+ },
128
+ [`& .${_autocompleteClasses.default.input}`]: {
129
+ minWidth: 0
130
+ }
131
+ },
132
+ /* Avoid double tap issue on iOS */
133
+ '@media (pointer: fine)': {
134
+ [`&:hover .${_autocompleteClasses.default.clearIndicator}`]: {
135
+ visibility: 'visible'
136
+ },
137
+ [`&:hover .${_autocompleteClasses.default.input}`]: {
138
+ minWidth: 0
139
+ }
140
+ },
133
141
  [`& .${_inputClasses.default.root}`]: {
134
142
  paddingBottom: 1,
135
143
  '& .MuiInput-input': {
@@ -236,6 +244,15 @@ const AutocompleteRoot = (0, _zeroStyled.styled)('div', {
236
244
  opacity: 1
237
245
  }
238
246
  }
247
+ }, {
248
+ props: {
249
+ multiple: true
250
+ },
251
+ style: {
252
+ [`& .${_autocompleteClasses.default.inputRoot}`]: {
253
+ flexWrap: 'wrap'
254
+ }
255
+ }
239
256
  }]
240
257
  });
241
258
  const AutocompleteEndAdornment = (0, _zeroStyled.styled)('div', {
@@ -409,7 +426,6 @@ const AutocompleteGroupUl = (0, _zeroStyled.styled)('ul', {
409
426
  }
410
427
  });
411
428
  const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps, ref) {
412
- var _slotProps$clearIndic, _slotProps$paper, _slotProps$popper, _slotProps$popupIndic;
413
429
  const props = useThemeProps({
414
430
  props: inProps,
415
431
  name: 'MuiAutocomplete'
@@ -421,7 +437,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
421
437
  autoHighlight = false,
422
438
  autoSelect = false,
423
439
  blurOnSelect = false,
424
- ChipProps,
440
+ ChipProps: ChipPropsProp,
425
441
  className,
426
442
  clearIcon = _ClearIcon || (_ClearIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
427
443
  fontSize: "small"
@@ -430,7 +446,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
430
446
  clearOnEscape = false,
431
447
  clearText = 'Clear',
432
448
  closeText = 'Close',
433
- componentsProps = {},
449
+ componentsProps,
434
450
  defaultValue = props.multiple ? [] : null,
435
451
  disableClearable = false,
436
452
  disableCloseOnSelect = false,
@@ -448,16 +464,16 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
448
464
  handleHomeEndKeys = !props.freeSolo,
449
465
  includeInputInList = false,
450
466
  limitTags = -1,
451
- ListboxComponent = 'ul',
452
- ListboxProps,
467
+ ListboxComponent: ListboxComponentProp,
468
+ ListboxProps: ListboxPropsProp,
453
469
  loading = false,
454
470
  loadingText = 'Loading…',
455
471
  multiple = false,
456
472
  noOptionsText = 'No options',
457
473
  openOnFocus = false,
458
474
  openText = 'Open',
459
- PaperComponent = _Paper.default,
460
- PopperComponent = _Popper.default,
475
+ PaperComponent: PaperComponentProp,
476
+ PopperComponent: PopperComponentProp,
461
477
  popupIcon = _ArrowDropDownIcon || (_ArrowDropDownIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {})),
462
478
  readOnly = false,
463
479
  renderGroup: renderGroupProp,
@@ -466,6 +482,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
466
482
  renderTags,
467
483
  selectOnFocus = !props.freeSolo,
468
484
  size = 'medium',
485
+ slots = {},
469
486
  slotProps = {}
470
487
  } = props,
471
488
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
@@ -499,15 +516,11 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
499
516
  const {
500
517
  onMouseDown: handleInputMouseDown
501
518
  } = getInputProps();
502
- const {
503
- ref: externalListboxRef
504
- } = ListboxProps != null ? ListboxProps : {};
505
519
  const _getListboxProps = getListboxProps(),
506
520
  {
507
521
  ref: listboxRef
508
522
  } = _getListboxProps,
509
523
  otherListboxProps = (0, _objectWithoutPropertiesLoose2.default)(_getListboxProps, _excluded2);
510
- const combinedListboxRef = (0, _useForkRef.default)(listboxRef, externalListboxRef);
511
524
  const defaultGetOptionLabel = option => {
512
525
  var _option$label;
513
526
  return (_option$label = option.label) != null ? _option$label : option;
@@ -528,6 +541,46 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
528
541
  size
529
542
  });
530
543
  const classes = useUtilityClasses(ownerState);
544
+ const externalForwardedProps = {
545
+ slots: (0, _extends2.default)({
546
+ listbox: ListboxComponentProp,
547
+ paper: PaperComponentProp,
548
+ popper: PopperComponentProp
549
+ }, slots),
550
+ slotProps: (0, _extends2.default)({
551
+ chip: ChipPropsProp,
552
+ listbox: ListboxPropsProp
553
+ }, componentsProps, slotProps)
554
+ };
555
+ const [ListboxSlot, listboxProps] = (0, _useSlot.default)('listbox', {
556
+ elementType: 'ul',
557
+ externalForwardedProps,
558
+ ownerState,
559
+ className: classes.listbox,
560
+ additionalProps: otherListboxProps,
561
+ ref: listboxRef
562
+ });
563
+ const [PaperSlot, paperProps] = (0, _useSlot.default)('paper', {
564
+ elementType: _Paper.default,
565
+ externalForwardedProps,
566
+ ownerState,
567
+ className: classes.paper
568
+ });
569
+ const [PopperSlot, popperProps] = (0, _useSlot.default)('popper', {
570
+ elementType: _Popper.default,
571
+ externalForwardedProps,
572
+ ownerState,
573
+ className: classes.popper,
574
+ additionalProps: {
575
+ disablePortal,
576
+ style: {
577
+ width: anchorEl ? anchorEl.clientWidth : null
578
+ },
579
+ role: 'presentation',
580
+ anchorEl,
581
+ open: popupOpen
582
+ }
583
+ });
531
584
  let startAdornment;
532
585
  if (multiple && value.length > 0) {
533
586
  const getCustomizedTagProps = params => (0, _extends2.default)({
@@ -537,12 +590,19 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
537
590
  if (renderTags) {
538
591
  startAdornment = renderTags(value, getCustomizedTagProps, ownerState);
539
592
  } else {
540
- startAdornment = value.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, (0, _extends2.default)({
541
- label: getOptionLabel(option),
542
- size: size
543
- }, getCustomizedTagProps({
544
- index
545
- }), ChipProps)));
593
+ startAdornment = value.map((option, index) => {
594
+ const _getCustomizedTagProp = getCustomizedTagProps({
595
+ index
596
+ }),
597
+ {
598
+ key
599
+ } = _getCustomizedTagProp,
600
+ customTagProps = (0, _objectWithoutPropertiesLoose2.default)(_getCustomizedTagProp, _excluded3);
601
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, (0, _extends2.default)({
602
+ label: getOptionLabel(option),
603
+ size: size
604
+ }, customTagProps, externalForwardedProps.slotProps.chip), key);
605
+ });
546
606
  }
547
607
  }
548
608
  if (limitTags > -1 && Array.isArray(startAdornment)) {
@@ -588,38 +648,22 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
588
648
  inputValue
589
649
  }, ownerState);
590
650
  };
591
- const clearIndicatorSlotProps = (_slotProps$clearIndic = slotProps.clearIndicator) != null ? _slotProps$clearIndic : componentsProps.clearIndicator;
592
- const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;
593
- const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;
594
- const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;
651
+ const clearIndicatorSlotProps = externalForwardedProps.slotProps.clearIndicator;
652
+ const popupIndicatorSlotProps = externalForwardedProps.slotProps.popupIndicator;
595
653
  const renderAutocompletePopperChildren = children => /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, (0, _extends2.default)({
596
- as: PopperComponent,
597
- disablePortal: disablePortal,
598
- style: {
599
- width: anchorEl ? anchorEl.clientWidth : null
600
- },
601
- ownerState: ownerState,
602
- role: "presentation",
603
- anchorEl: anchorEl,
604
- open: popupOpen
605
- }, popperSlotProps, {
606
- className: (0, _clsx.default)(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
654
+ as: PopperSlot
655
+ }, popperProps, {
607
656
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePaper, (0, _extends2.default)({
608
- ownerState: ownerState,
609
- as: PaperComponent
610
- }, paperSlotProps, {
611
- className: (0, _clsx.default)(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
657
+ as: PaperSlot
658
+ }, paperProps, {
612
659
  children: children
613
660
  }))
614
661
  }));
615
662
  let autocompletePopper = null;
616
663
  if (groupedOptions.length > 0) {
617
664
  autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteListbox, (0, _extends2.default)({
618
- as: ListboxComponent,
619
- className: classes.listbox,
620
- ownerState: ownerState
621
- }, otherListboxProps, ListboxProps, {
622
- ref: combinedListboxRef,
665
+ as: ListboxSlot
666
+ }, listboxProps, {
623
667
  children: groupedOptions.map((option, index) => {
624
668
  if (groupBy) {
625
669
  return renderGroup({
@@ -740,6 +784,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
740
784
  blurOnSelect: _propTypes.default.oneOfType([_propTypes.default.oneOf(['mouse', 'touch']), _propTypes.default.bool]),
741
785
  /**
742
786
  * Props applied to the [`Chip`](/material-ui/api/chip/) element.
787
+ * @deprecated Use `slotProps.chip` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
743
788
  */
744
789
  ChipProps: _propTypes.default.object,
745
790
  /**
@@ -784,7 +829,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
784
829
  closeText: _propTypes.default.string,
785
830
  /**
786
831
  * The props used for each slot inside.
787
- * @default {}
832
+ * @deprecated Use the `slotProps` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
788
833
  */
789
834
  componentsProps: _propTypes.default.shape({
790
835
  clearIndicator: _propTypes.default.object,
@@ -942,10 +987,12 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
942
987
  /**
943
988
  * The component used to render the listbox.
944
989
  * @default 'ul'
990
+ * @deprecated Use `slots.listbox` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
945
991
  */
946
992
  ListboxComponent: _propTypes.default.elementType,
947
993
  /**
948
994
  * Props applied to the Listbox element.
995
+ * @deprecated Use `slotProps.listbox` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
949
996
  */
950
997
  ListboxProps: _propTypes.default.object,
951
998
  /**
@@ -1040,11 +1087,13 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1040
1087
  /**
1041
1088
  * The component used to render the body of the popup.
1042
1089
  * @default Paper
1090
+ * @deprecated Use `slots.paper` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
1043
1091
  */
1044
1092
  PaperComponent: _propTypes.default.elementType,
1045
1093
  /**
1046
1094
  * The component used to position the popup.
1047
1095
  * @default Popper
1096
+ * @deprecated Use `slots.popper` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
1048
1097
  */
1049
1098
  PopperComponent: _propTypes.default.elementType,
1050
1099
  /**
@@ -1105,11 +1154,22 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
1105
1154
  * The props used for each slot inside.
1106
1155
  * @default {}
1107
1156
  */
1108
- slotProps: _propTypes.default.shape({
1109
- clearIndicator: _propTypes.default.object,
1110
- paper: _propTypes.default.object,
1111
- popper: _propTypes.default.object,
1112
- popupIndicator: _propTypes.default.object
1157
+ slotProps: _propTypes.default /* @typescript-to-proptypes-ignore */.shape({
1158
+ chip: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
1159
+ clearIndicator: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
1160
+ listbox: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
1161
+ paper: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
1162
+ popper: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
1163
+ popupIndicator: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
1164
+ }),
1165
+ /**
1166
+ * The components used for each slot inside.
1167
+ * @default {}
1168
+ */
1169
+ slots: _propTypes.default.shape({
1170
+ listbox: _propTypes.default.elementType,
1171
+ paper: _propTypes.default.elementType,
1172
+ popper: _propTypes.default.elementType
1113
1173
  }),
1114
1174
  /**
1115
1175
  * The system prop that allows defining system overrides as well as additional CSS styles.
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-alpha.6
2
+ * @mui/material v6.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.0.0-alpha.6",
3
+ "version": "6.0.0-alpha.7",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -27,18 +27,18 @@
27
27
  "url": "https://opencollective.com/mui-org"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.24.4",
30
+ "@babel/runtime": "^7.24.5",
31
31
  "@types/react-transition-group": "^4.4.10",
32
32
  "clsx": "^2.1.1",
33
33
  "csstype": "^3.1.3",
34
34
  "prop-types": "^15.8.1",
35
35
  "react-is": "^18.2.0",
36
36
  "react-transition-group": "^4.4.5",
37
- "@mui/base": "5.0.0-beta.44",
38
- "@mui/core-downloads-tracker": "^6.0.0-alpha.6",
39
37
  "@mui/types": "^7.2.14",
40
- "@mui/utils": "^6.0.0-alpha.5",
41
- "@mui/system": "^6.0.0-alpha.5"
38
+ "@mui/system": "^6.0.0-alpha.6",
39
+ "@mui/base": "5.0.0-beta.45",
40
+ "@mui/core-downloads-tracker": "^6.0.0-alpha.7",
41
+ "@mui/utils": "^6.0.0-alpha.6"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",