@mui/material 7.3.5 → 7.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/Accordion/Accordion.d.ts +56 -55
  2. package/AppBar/AppBar.d.ts +13 -2
  3. package/AppBar/AppBar.js +12 -1
  4. package/Button/Button.d.ts +1 -0
  5. package/ButtonBase/ButtonBase.js +8 -1
  6. package/ButtonBase/TouchRipple.js +1 -1
  7. package/CHANGELOG.md +87 -0
  8. package/Chip/Chip.js +1 -1
  9. package/CssBaseline/CssBaseline.d.ts +1 -1
  10. package/CssBaseline/CssBaseline.js +1 -1
  11. package/FormControl/FormControl.d.ts +1 -0
  12. package/FormHelperText/FormHelperText.d.ts +1 -0
  13. package/FormLabel/FormLabel.d.ts +1 -0
  14. package/IconButton/IconButton.d.ts +1 -0
  15. package/InputLabel/InputLabel.d.ts +1 -0
  16. package/ListItem/ListItem.d.ts +5 -0
  17. package/ListItem/ListItem.js +19 -4
  18. package/MenuList/MenuList.js +2 -1
  19. package/OutlinedInput/OutlinedInput.d.ts +1 -0
  20. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
  21. package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
  22. package/Select/SelectInput.d.ts +2 -0
  23. package/Select/SelectInput.js +6 -0
  24. package/Slider/Slider.d.ts +1 -1
  25. package/Slider/useSlider.types.d.ts +1 -1
  26. package/Snackbar/Snackbar.js +1 -3
  27. package/Tabs/Tabs.js +3 -2
  28. package/TextField/TextField.d.ts +10 -5
  29. package/Unstable_TrapFocus/FocusTrap.js +13 -8
  30. package/esm/Accordion/Accordion.d.ts +56 -55
  31. package/esm/AppBar/AppBar.d.ts +13 -2
  32. package/esm/AppBar/AppBar.js +12 -1
  33. package/esm/Button/Button.d.ts +1 -0
  34. package/esm/ButtonBase/ButtonBase.js +8 -1
  35. package/esm/ButtonBase/TouchRipple.js +1 -1
  36. package/esm/Chip/Chip.js +1 -1
  37. package/esm/CssBaseline/CssBaseline.d.ts +1 -1
  38. package/esm/CssBaseline/CssBaseline.js +1 -1
  39. package/esm/FormControl/FormControl.d.ts +1 -0
  40. package/esm/FormHelperText/FormHelperText.d.ts +1 -0
  41. package/esm/FormLabel/FormLabel.d.ts +1 -0
  42. package/esm/IconButton/IconButton.d.ts +1 -0
  43. package/esm/InputLabel/InputLabel.d.ts +1 -0
  44. package/esm/ListItem/ListItem.d.ts +5 -0
  45. package/esm/ListItem/ListItem.js +19 -4
  46. package/esm/MenuList/MenuList.js +2 -1
  47. package/esm/OutlinedInput/OutlinedInput.d.ts +1 -0
  48. package/esm/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
  49. package/esm/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
  50. package/esm/Select/SelectInput.d.ts +2 -0
  51. package/esm/Select/SelectInput.js +6 -0
  52. package/esm/Slider/Slider.d.ts +1 -1
  53. package/esm/Slider/useSlider.types.d.ts +1 -1
  54. package/esm/Snackbar/Snackbar.js +1 -3
  55. package/esm/Tabs/Tabs.js +3 -2
  56. package/esm/TextField/TextField.d.ts +10 -5
  57. package/esm/Unstable_TrapFocus/FocusTrap.js +13 -8
  58. package/esm/index.js +1 -1
  59. package/esm/styles/createThemeNoVars.d.ts +4 -3
  60. package/esm/styles/createThemeWithVars.d.ts +2 -2
  61. package/esm/useAutocomplete/useAutocomplete.js +15 -2
  62. package/esm/utils/getActiveElement.d.ts +2 -0
  63. package/esm/utils/getActiveElement.js +2 -0
  64. package/esm/version/index.js +2 -2
  65. package/index.js +1 -1
  66. package/package.json +6 -6
  67. package/styles/createThemeNoVars.d.ts +4 -3
  68. package/styles/createThemeWithVars.d.ts +2 -2
  69. package/useAutocomplete/useAutocomplete.js +15 -2
  70. package/utils/getActiveElement.d.ts +2 -0
  71. package/utils/getActiveElement.js +9 -0
  72. package/version/index.js +2 -2
@@ -157,9 +157,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
157
157
  const {
158
158
  getRootProps,
159
159
  onClickAway
160
- } = useSnackbar({
161
- ...ownerState
162
- });
160
+ } = useSnackbar(ownerState);
163
161
  const [exited, setExited] = React.useState(true);
164
162
  const handleExited = node => {
165
163
  setExited(true);
package/esm/Tabs/Tabs.js CHANGED
@@ -19,6 +19,7 @@ import useEventCallback from "../utils/useEventCallback.js";
19
19
  import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.js";
20
20
  import ownerDocument from "../utils/ownerDocument.js";
21
21
  import ownerWindow from "../utils/ownerWindow.js";
22
+ import getActiveElement from "../utils/getActiveElement.js";
22
23
  import useSlot from "../utils/useSlot.js";
23
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
25
  const nextItem = (list, item) => {
@@ -697,11 +698,11 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
697
698
  return;
698
699
  }
699
700
  const list = tabListRef.current;
700
- const currentFocus = ownerDocument(list).activeElement;
701
+ const currentFocus = getActiveElement(ownerDocument(list));
701
702
  // Keyboard navigation assumes that [role="tab"] are siblings
702
703
  // though we might warn in the future about nested, interactive elements
703
704
  // as a a11y violation
704
- const role = currentFocus.getAttribute('role');
705
+ const role = currentFocus?.getAttribute('role');
705
706
  if (role !== 'tab') {
706
707
  return;
707
708
  }
@@ -47,22 +47,27 @@ export interface TextFieldSlots {
47
47
  */
48
48
  select: React.ElementType;
49
49
  }
50
+ export interface TextFieldRootSlotPropsOverrides {}
51
+ export interface TextFieldInputSlotPropsOverrides {}
52
+ export interface TextFieldInputLabelSlotPropsOverrides {}
53
+ export interface TextFieldFormHelperTextSlotPropsOverrides {}
54
+ export interface TextFieldSelectSlotPropsOverrides {}
50
55
  export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps<TextFieldSlots, {
51
56
  /**
52
57
  * Props forwarded to the root slot.
53
58
  * By default, the available props are based on the [FormControl](https://mui.com/material-ui/api/form-control/#props) component.
54
59
  */
55
- root: SlotProps<React.ElementType<FormControlProps>, {}, TextFieldOwnerState>;
60
+ root: SlotProps<React.ElementType<FormControlProps>, TextFieldRootSlotPropsOverrides, TextFieldOwnerState>;
56
61
  /**
57
62
  * Props forwarded to the input slot.
58
63
  * By default, the available props are based on the [Input](https://mui.com/material-ui/api/input/#props) component.
59
64
  */
60
- input: SlotProps<React.ElementType<InputPropsType>, {}, TextFieldOwnerState>;
65
+ input: SlotProps<React.ElementType<InputPropsType>, TextFieldInputSlotPropsOverrides, TextFieldOwnerState>;
61
66
  /**
62
67
  * Props forwarded to the input label slot.
63
68
  * By default, the available props are based on the [InputLabel](https://mui.com/material-ui/api/input-label/#props) component.
64
69
  */
65
- inputLabel: SlotProps<React.ElementType<InputLabelProps>, {}, TextFieldOwnerState>;
70
+ inputLabel: SlotProps<React.ElementType<InputLabelProps>, TextFieldInputLabelSlotPropsOverrides, TextFieldOwnerState>;
66
71
  /**
67
72
  * Props forwarded to the html input slot.
68
73
  * By default, the available props are based on the html input element.
@@ -72,12 +77,12 @@ export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps
72
77
  * Props forwarded to the form helper text slot.
73
78
  * By default, the available props are based on the [FormHelperText](https://mui.com/material-ui/api/form-helper-text/#props) component.
74
79
  */
75
- formHelperText: SlotProps<React.ElementType<FormHelperTextProps>, {}, TextFieldOwnerState>;
80
+ formHelperText: SlotProps<React.ElementType<FormHelperTextProps>, TextFieldFormHelperTextSlotPropsOverrides, TextFieldOwnerState>;
76
81
  /**
77
82
  * Props forwarded to the select slot.
78
83
  * By default, the available props are based on the [Select](https://mui.com/material-ui/api/select/#props) component.
79
84
  */
80
- select: SlotProps<React.ElementType<SelectProps>, {}, TextFieldOwnerState>;
85
+ select: SlotProps<React.ElementType<SelectProps>, TextFieldSelectSlotPropsOverrides, TextFieldOwnerState>;
81
86
  }>;
82
87
  export interface BaseTextFieldProps extends StandardProps<FormControlProps,
83
88
  // event handlers are declared on derived interfaces
@@ -8,6 +8,7 @@ import ownerDocument from '@mui/utils/ownerDocument';
8
8
  import getReactElementRef from '@mui/utils/getReactElementRef';
9
9
  import exactProp from '@mui/utils/exactProp';
10
10
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
11
+ import getActiveElement from "../utils/getActiveElement.js";
11
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  // Inspired by https://github.com/focus-trap/tabbable
13
14
  const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
@@ -111,7 +112,8 @@ function FocusTrap(props) {
111
112
  return;
112
113
  }
113
114
  const doc = ownerDocument(rootRef.current);
114
- if (!rootRef.current.contains(doc.activeElement)) {
115
+ const activeElement = getActiveElement(doc);
116
+ if (!rootRef.current.contains(activeElement)) {
115
117
  if (!rootRef.current.hasAttribute('tabIndex')) {
116
118
  if (process.env.NODE_ENV !== 'production') {
117
119
  console.error(['MUI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to "-1".'].join('\n'));
@@ -146,6 +148,7 @@ function FocusTrap(props) {
146
148
  return;
147
149
  }
148
150
  const doc = ownerDocument(rootRef.current);
151
+ const activeElement = getActiveElement(doc);
149
152
  const loopFocus = nativeEvent => {
150
153
  lastKeydown.current = nativeEvent;
151
154
  if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
@@ -153,8 +156,8 @@ function FocusTrap(props) {
153
156
  }
154
157
 
155
158
  // Make sure the next tab starts from the right place.
156
- // doc.activeElement refers to the origin.
157
- if (doc.activeElement === rootRef.current && nativeEvent.shiftKey) {
159
+ // activeElement refers to the origin.
160
+ if (activeElement === rootRef.current && nativeEvent.shiftKey) {
158
161
  // We need to ignore the next contain as
159
162
  // it will try to move the focus back to the rootRef element.
160
163
  ignoreNextEnforceFocus.current = true;
@@ -171,23 +174,24 @@ function FocusTrap(props) {
171
174
  if (rootElement === null) {
172
175
  return;
173
176
  }
177
+ const activeEl = getActiveElement(doc);
174
178
  if (!doc.hasFocus() || !isEnabled() || ignoreNextEnforceFocus.current) {
175
179
  ignoreNextEnforceFocus.current = false;
176
180
  return;
177
181
  }
178
182
 
179
183
  // The focus is already inside
180
- if (rootElement.contains(doc.activeElement)) {
184
+ if (rootElement.contains(activeEl)) {
181
185
  return;
182
186
  }
183
187
 
184
188
  // The disableEnforceFocus is set and the focus is outside of the focus trap (and sentinel nodes)
185
- if (disableEnforceFocus && doc.activeElement !== sentinelStart.current && doc.activeElement !== sentinelEnd.current) {
189
+ if (disableEnforceFocus && activeEl !== sentinelStart.current && activeEl !== sentinelEnd.current) {
186
190
  return;
187
191
  }
188
192
 
189
193
  // if the focus event is not coming from inside the children's react tree, reset the refs
190
- if (doc.activeElement !== reactFocusEventTarget.current) {
194
+ if (activeEl !== reactFocusEventTarget.current) {
191
195
  reactFocusEventTarget.current = null;
192
196
  } else if (reactFocusEventTarget.current !== null) {
193
197
  return;
@@ -196,7 +200,7 @@ function FocusTrap(props) {
196
200
  return;
197
201
  }
198
202
  let tabbable = [];
199
- if (doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current) {
203
+ if (activeEl === sentinelStart.current || activeEl === sentinelEnd.current) {
200
204
  tabbable = getTabbable(rootRef.current);
201
205
  }
202
206
 
@@ -228,7 +232,8 @@ function FocusTrap(props) {
228
232
  // The whatwg spec defines how the browser should behave but does not explicitly mention any events:
229
233
  // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
230
234
  const interval = setInterval(() => {
231
- if (doc.activeElement && doc.activeElement.tagName === 'BODY') {
235
+ const activeEl = getActiveElement(doc);
236
+ if (activeEl && activeEl.tagName === 'BODY') {
232
237
  contain();
233
238
  }
234
239
  }, 50);
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v7.3.5
2
+ * @mui/material v7.3.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,4 @@
1
- import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme, SxProps, CSSObject, SxConfig } from '@mui/system';
1
+ import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme, SxProps, CSSObject, SxConfig, ApplyStyles } from '@mui/system';
2
2
  import { Mixins, MixinsOptions } from "./createMixins.js";
3
3
  import { Palette, PaletteOptions } from "./createPalette.js";
4
4
  import { TypographyVariants, TypographyVariantsOptions } from "./createTypography.js";
@@ -6,7 +6,7 @@ import { Shadows } from "./shadows.js";
6
6
  import { Transitions, TransitionsOptions } from "./createTransitions.js";
7
7
  import { ZIndex, ZIndexOptions } from "./zIndex.js";
8
8
  import { Components } from "./components.js";
9
- import { CssVarsTheme, CssVarsPalette, ColorSystemOptions, Shape, ShapeOptions } from "./createThemeFoundation.js";
9
+ import { CssVarsTheme, CssVarsPalette, ColorSystemOptions, Shape, ShapeOptions, SupportedColorScheme } from "./createThemeFoundation.js";
10
10
 
11
11
  /**
12
12
  * To disable custom properties, use module augmentation
@@ -46,13 +46,14 @@ export interface BaseTheme extends SystemTheme {
46
46
  typography: TypographyVariants;
47
47
  zIndex: ZIndex;
48
48
  unstable_strictMode?: boolean;
49
+ applyStyles: ApplyStyles<SupportedColorScheme>;
49
50
  }
50
51
 
51
52
  // shut off automatic exporting for the `BaseTheme` above
52
53
  export {};
53
54
  type CssVarsProperties = CssThemeVariables extends {
54
55
  enabled: true;
55
- } ? Pick<CssVarsTheme, 'applyStyles' | 'colorSchemes' | 'colorSchemeSelector' | 'rootSelector' | 'cssVarPrefix' | 'defaultColorScheme' | 'getCssVar' | 'getColorSchemeSelector' | 'generateThemeVars' | 'generateStyleSheets' | 'generateSpacing' | 'shouldSkipGeneratingVar' | 'vars'> : Partial<Pick<CssVarsTheme, 'vars'>>;
56
+ } ? Pick<CssVarsTheme, 'colorSchemes' | 'colorSchemeSelector' | 'rootSelector' | 'cssVarPrefix' | 'defaultColorScheme' | 'getCssVar' | 'getColorSchemeSelector' | 'generateThemeVars' | 'generateStyleSheets' | 'generateSpacing' | 'shouldSkipGeneratingVar' | 'vars'> : Partial<Pick<CssVarsTheme, 'vars'>>;
56
57
 
57
58
  /**
58
59
  * Our [TypeScript guide on theme customization](https://mui.com/material-ui/guides/typescript/#customization-of-theme) explains in detail how you would add custom properties.
@@ -9,7 +9,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
9
9
  * The strategy to generate CSS variables
10
10
  *
11
11
  * @example 'media'
12
- * Generate CSS variables using [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
12
+ * Generate CSS variables using [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme)
13
13
  *
14
14
  * @example '.mode-%s'
15
15
  * Generate CSS variables within a class .mode-light, .mode-dark
@@ -25,7 +25,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
25
25
  cssVarPrefix?: string;
26
26
  /**
27
27
  * If `true`, the CSS color-scheme will not be set.
28
- * https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
28
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
29
29
  * @default false
30
30
  */
31
31
  disableCssColorScheme?: boolean;
@@ -465,7 +465,7 @@ function useAutocomplete(props) {
465
465
  filteredOptions.length,
466
466
  // Don't sync the highlighted index with the value when multiple
467
467
  // eslint-disable-next-line react-hooks/exhaustive-deps
468
- multiple ? false : value, filterSelectedOptions, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
468
+ multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
469
469
  const handleListboxRef = useEventCallback(node => {
470
470
  setRef(listboxRef, node);
471
471
  if (!node) {
@@ -693,7 +693,8 @@ function useAutocomplete(props) {
693
693
  handleOpen(event);
694
694
  break;
695
695
  case 'ArrowLeft':
696
- if (!multiple && renderValue) {
696
+ if (!multiple && renderValue && value != null) {
697
+ setFocusedItem(0);
697
698
  focusItem(0);
698
699
  } else {
699
700
  handleFocusItem(event, 'previous');
@@ -701,6 +702,7 @@ function useAutocomplete(props) {
701
702
  break;
702
703
  case 'ArrowRight':
703
704
  if (!multiple && renderValue) {
705
+ setFocusedItem(-1);
704
706
  focusItem(-1);
705
707
  } else {
706
708
  handleFocusItem(event, 'next');
@@ -757,6 +759,7 @@ function useAutocomplete(props) {
757
759
  }
758
760
  if (!multiple && renderValue && !readOnly) {
759
761
  setValueState(null);
762
+ setFocusedItem(-1);
760
763
  focusItem(-1);
761
764
  }
762
765
  break;
@@ -772,6 +775,7 @@ function useAutocomplete(props) {
772
775
  }
773
776
  if (!multiple && renderValue && !readOnly) {
774
777
  setValueState(null);
778
+ setFocusedItem(-1);
775
779
  focusItem(-1);
776
780
  }
777
781
  break;
@@ -781,6 +785,15 @@ function useAutocomplete(props) {
781
785
  };
782
786
  const handleFocus = event => {
783
787
  setFocused(true);
788
+
789
+ // When focusing the input, ensure any previously focused item (chip)
790
+ // is cleared so the input receives the visible caret and the
791
+ // input-focused styling is applied.
792
+ if (focusedItem !== -1) {
793
+ setFocusedItem(-1);
794
+ // Ensure DOM focus lands on the input
795
+ focusItem(-1);
796
+ }
784
797
  if (openOnFocus && !ignoreFocus.current) {
785
798
  handleOpen(event);
786
799
  }
@@ -0,0 +1,2 @@
1
+ import getActiveElement from '@mui/utils/getActiveElement';
2
+ export default getActiveElement;
@@ -0,0 +1,2 @@
1
+ import getActiveElement from '@mui/utils/getActiveElement';
2
+ export default getActiveElement;
@@ -1,6 +1,6 @@
1
- export const version = "7.3.5";
1
+ export const version = "7.3.6";
2
2
  export const major = Number("7");
3
3
  export const minor = Number("3");
4
- export const patch = Number("5");
4
+ export const patch = Number("6");
5
5
  export const prerelease = undefined;
6
6
  export default version;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v7.3.5
2
+ * @mui/material v7.3.6
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": "7.3.5",
3
+ "version": "7.3.6",
4
4
  "author": "MUI Team",
5
5
  "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.",
6
6
  "keywords": [
@@ -33,10 +33,10 @@
33
33
  "prop-types": "^15.8.1",
34
34
  "react-is": "^19.2.0",
35
35
  "react-transition-group": "^4.4.5",
36
- "@mui/core-downloads-tracker": "^7.3.5",
37
- "@mui/system": "^7.3.5",
38
- "@mui/types": "^7.4.8",
39
- "@mui/utils": "^7.3.5"
36
+ "@mui/core-downloads-tracker": "^7.3.6",
37
+ "@mui/system": "^7.3.6",
38
+ "@mui/types": "^7.4.9",
39
+ "@mui/utils": "^7.3.6"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.5.0",
@@ -44,7 +44,7 @@
44
44
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
45
45
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
46
46
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
47
- "@mui/material-pigment-css": "^7.3.5"
47
+ "@mui/material-pigment-css": "^7.3.6"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@types/react": {
@@ -1,4 +1,4 @@
1
- import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme, SxProps, CSSObject, SxConfig } from '@mui/system';
1
+ import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme, SxProps, CSSObject, SxConfig, ApplyStyles } from '@mui/system';
2
2
  import { Mixins, MixinsOptions } from "./createMixins.js";
3
3
  import { Palette, PaletteOptions } from "./createPalette.js";
4
4
  import { TypographyVariants, TypographyVariantsOptions } from "./createTypography.js";
@@ -6,7 +6,7 @@ import { Shadows } from "./shadows.js";
6
6
  import { Transitions, TransitionsOptions } from "./createTransitions.js";
7
7
  import { ZIndex, ZIndexOptions } from "./zIndex.js";
8
8
  import { Components } from "./components.js";
9
- import { CssVarsTheme, CssVarsPalette, ColorSystemOptions, Shape, ShapeOptions } from "./createThemeFoundation.js";
9
+ import { CssVarsTheme, CssVarsPalette, ColorSystemOptions, Shape, ShapeOptions, SupportedColorScheme } from "./createThemeFoundation.js";
10
10
 
11
11
  /**
12
12
  * To disable custom properties, use module augmentation
@@ -46,13 +46,14 @@ export interface BaseTheme extends SystemTheme {
46
46
  typography: TypographyVariants;
47
47
  zIndex: ZIndex;
48
48
  unstable_strictMode?: boolean;
49
+ applyStyles: ApplyStyles<SupportedColorScheme>;
49
50
  }
50
51
 
51
52
  // shut off automatic exporting for the `BaseTheme` above
52
53
  export {};
53
54
  type CssVarsProperties = CssThemeVariables extends {
54
55
  enabled: true;
55
- } ? Pick<CssVarsTheme, 'applyStyles' | 'colorSchemes' | 'colorSchemeSelector' | 'rootSelector' | 'cssVarPrefix' | 'defaultColorScheme' | 'getCssVar' | 'getColorSchemeSelector' | 'generateThemeVars' | 'generateStyleSheets' | 'generateSpacing' | 'shouldSkipGeneratingVar' | 'vars'> : Partial<Pick<CssVarsTheme, 'vars'>>;
56
+ } ? Pick<CssVarsTheme, 'colorSchemes' | 'colorSchemeSelector' | 'rootSelector' | 'cssVarPrefix' | 'defaultColorScheme' | 'getCssVar' | 'getColorSchemeSelector' | 'generateThemeVars' | 'generateStyleSheets' | 'generateSpacing' | 'shouldSkipGeneratingVar' | 'vars'> : Partial<Pick<CssVarsTheme, 'vars'>>;
56
57
 
57
58
  /**
58
59
  * Our [TypeScript guide on theme customization](https://mui.com/material-ui/guides/typescript/#customization-of-theme) explains in detail how you would add custom properties.
@@ -9,7 +9,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
9
9
  * The strategy to generate CSS variables
10
10
  *
11
11
  * @example 'media'
12
- * Generate CSS variables using [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
12
+ * Generate CSS variables using [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme)
13
13
  *
14
14
  * @example '.mode-%s'
15
15
  * Generate CSS variables within a class .mode-light, .mode-dark
@@ -25,7 +25,7 @@ export interface CssVarsThemeOptions extends Omit<ThemeOptions, 'palette' | 'com
25
25
  cssVarPrefix?: string;
26
26
  /**
27
27
  * If `true`, the CSS color-scheme will not be set.
28
- * https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
28
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
29
29
  * @default false
30
30
  */
31
31
  disableCssColorScheme?: boolean;
@@ -473,7 +473,7 @@ function useAutocomplete(props) {
473
473
  filteredOptions.length,
474
474
  // Don't sync the highlighted index with the value when multiple
475
475
  // eslint-disable-next-line react-hooks/exhaustive-deps
476
- multiple ? false : value, filterSelectedOptions, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
476
+ multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
477
477
  const handleListboxRef = (0, _useEventCallback.default)(node => {
478
478
  (0, _setRef.default)(listboxRef, node);
479
479
  if (!node) {
@@ -701,7 +701,8 @@ function useAutocomplete(props) {
701
701
  handleOpen(event);
702
702
  break;
703
703
  case 'ArrowLeft':
704
- if (!multiple && renderValue) {
704
+ if (!multiple && renderValue && value != null) {
705
+ setFocusedItem(0);
705
706
  focusItem(0);
706
707
  } else {
707
708
  handleFocusItem(event, 'previous');
@@ -709,6 +710,7 @@ function useAutocomplete(props) {
709
710
  break;
710
711
  case 'ArrowRight':
711
712
  if (!multiple && renderValue) {
713
+ setFocusedItem(-1);
712
714
  focusItem(-1);
713
715
  } else {
714
716
  handleFocusItem(event, 'next');
@@ -765,6 +767,7 @@ function useAutocomplete(props) {
765
767
  }
766
768
  if (!multiple && renderValue && !readOnly) {
767
769
  setValueState(null);
770
+ setFocusedItem(-1);
768
771
  focusItem(-1);
769
772
  }
770
773
  break;
@@ -780,6 +783,7 @@ function useAutocomplete(props) {
780
783
  }
781
784
  if (!multiple && renderValue && !readOnly) {
782
785
  setValueState(null);
786
+ setFocusedItem(-1);
783
787
  focusItem(-1);
784
788
  }
785
789
  break;
@@ -789,6 +793,15 @@ function useAutocomplete(props) {
789
793
  };
790
794
  const handleFocus = event => {
791
795
  setFocused(true);
796
+
797
+ // When focusing the input, ensure any previously focused item (chip)
798
+ // is cleared so the input receives the visible caret and the
799
+ // input-focused styling is applied.
800
+ if (focusedItem !== -1) {
801
+ setFocusedItem(-1);
802
+ // Ensure DOM focus lands on the input
803
+ focusItem(-1);
804
+ }
792
805
  if (openOnFocus && !ignoreFocus.current) {
793
806
  handleOpen(event);
794
807
  }
@@ -0,0 +1,2 @@
1
+ import getActiveElement from '@mui/utils/getActiveElement';
2
+ export default getActiveElement;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _getActiveElement = _interopRequireDefault(require("@mui/utils/getActiveElement"));
9
+ var _default = exports.default = _getActiveElement.default;
package/version/index.js CHANGED
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
7
- const version = exports.version = "7.3.5";
7
+ const version = exports.version = "7.3.6";
8
8
  const major = exports.major = Number("7");
9
9
  const minor = exports.minor = Number("3");
10
- const patch = exports.patch = Number("5");
10
+ const patch = exports.patch = Number("6");
11
11
  const prerelease = exports.prerelease = undefined;
12
12
  var _default = exports.default = version;