@mui/material 9.0.0 → 9.0.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 (130) hide show
  1. package/Autocomplete/Autocomplete.js +65 -11
  2. package/Autocomplete/Autocomplete.mjs +65 -11
  3. package/Avatar/Avatar.js +4 -0
  4. package/Avatar/Avatar.mjs +4 -0
  5. package/Badge/Badge.js +3 -0
  6. package/Badge/Badge.mjs +3 -0
  7. package/Button/Button.js +19 -2
  8. package/Button/Button.mjs +19 -2
  9. package/ButtonBase/ButtonBase.d.mts +7 -0
  10. package/ButtonBase/ButtonBase.d.ts +7 -0
  11. package/ButtonBase/ButtonBase.js +5 -2
  12. package/ButtonBase/ButtonBase.mjs +5 -2
  13. package/CHANGELOG.md +132 -1245
  14. package/Checkbox/Checkbox.js +2 -1
  15. package/Checkbox/Checkbox.mjs +2 -1
  16. package/CircularProgress/CircularProgress.d.mts +12 -2
  17. package/CircularProgress/CircularProgress.d.ts +12 -2
  18. package/CircularProgress/CircularProgress.js +33 -6
  19. package/CircularProgress/CircularProgress.mjs +33 -6
  20. package/ClickAwayListener/ClickAwayListener.js +3 -6
  21. package/ClickAwayListener/ClickAwayListener.mjs +3 -6
  22. package/Dialog/Dialog.js +11 -6
  23. package/Dialog/Dialog.mjs +11 -6
  24. package/Drawer/Drawer.js +18 -4
  25. package/Drawer/Drawer.mjs +18 -4
  26. package/Fab/Fab.js +7 -1
  27. package/Fab/Fab.mjs +7 -1
  28. package/FilledInput/FilledInput.d.mts +4 -0
  29. package/FilledInput/FilledInput.d.ts +4 -0
  30. package/FilledInput/FilledInput.js +18 -20
  31. package/FilledInput/FilledInput.mjs +18 -20
  32. package/FormControl/useFormControl.d.mts +12 -2
  33. package/FormControl/useFormControl.d.ts +12 -2
  34. package/FormControl/useFormControl.js +13 -0
  35. package/FormControl/useFormControl.mjs +12 -0
  36. package/FormControlLabel/FormControlLabel.js +5 -8
  37. package/FormControlLabel/FormControlLabel.mjs +5 -8
  38. package/FormGroup/FormGroup.js +2 -5
  39. package/FormGroup/FormGroup.mjs +2 -5
  40. package/FormHelperText/FormHelperText.js +2 -5
  41. package/FormHelperText/FormHelperText.mjs +2 -5
  42. package/FormLabel/FormLabel.js +2 -5
  43. package/FormLabel/FormLabel.mjs +2 -5
  44. package/IconButton/IconButton.js +1 -8
  45. package/IconButton/IconButton.mjs +1 -8
  46. package/Input/Input.d.mts +4 -0
  47. package/Input/Input.d.ts +4 -0
  48. package/Input/Input.js +6 -0
  49. package/Input/Input.mjs +6 -0
  50. package/InputBase/InputBase.d.mts +2 -1
  51. package/InputBase/InputBase.d.ts +2 -1
  52. package/InputBase/InputBase.js +50 -15
  53. package/InputBase/InputBase.mjs +50 -15
  54. package/InputLabel/InputLabel.js +5 -8
  55. package/InputLabel/InputLabel.mjs +5 -8
  56. package/LinearProgress/LinearProgress.d.mts +12 -2
  57. package/LinearProgress/LinearProgress.d.ts +12 -2
  58. package/LinearProgress/LinearProgress.js +42 -10
  59. package/LinearProgress/LinearProgress.mjs +42 -10
  60. package/List/List.js +2 -1
  61. package/List/List.mjs +2 -1
  62. package/ListItemButton/ListItemButton.js +7 -1
  63. package/ListItemButton/ListItemButton.mjs +7 -1
  64. package/MenuItem/MenuItem.js +7 -1
  65. package/MenuItem/MenuItem.mjs +7 -1
  66. package/MenuList/MenuList.js +2 -1
  67. package/MenuList/MenuList.mjs +2 -1
  68. package/NativeSelect/NativeSelect.js +2 -5
  69. package/NativeSelect/NativeSelect.mjs +2 -5
  70. package/OutlinedInput/OutlinedInput.js +13 -23
  71. package/OutlinedInput/OutlinedInput.mjs +13 -23
  72. package/PigmentContainer/PigmentContainer.js +0 -1
  73. package/PigmentContainer/PigmentContainer.mjs +0 -1
  74. package/Popper/BasePopper.js +23 -1
  75. package/Popper/BasePopper.mjs +23 -1
  76. package/Select/Select.js +2 -5
  77. package/Select/Select.mjs +2 -5
  78. package/Select/SelectInput.js +164 -2
  79. package/Select/SelectInput.mjs +164 -2
  80. package/Slide/Slide.js +48 -26
  81. package/Slide/Slide.mjs +49 -27
  82. package/Slider/Slider.js +10 -1
  83. package/Slider/Slider.mjs +10 -1
  84. package/Slider/useSlider.js +3 -2
  85. package/Slider/useSlider.mjs +3 -2
  86. package/SwipeableDrawer/SwipeableDrawer.js +7 -3
  87. package/SwipeableDrawer/SwipeableDrawer.mjs +7 -3
  88. package/Switch/Switch.js +7 -6
  89. package/Switch/Switch.mjs +7 -6
  90. package/Tabs/ScrollbarSize.js +2 -1
  91. package/Tabs/ScrollbarSize.mjs +2 -1
  92. package/Tabs/Tabs.js +2 -1
  93. package/Tabs/Tabs.mjs +2 -1
  94. package/Tooltip/Tooltip.js +26 -108
  95. package/Tooltip/Tooltip.mjs +26 -108
  96. package/Unstable_TrapFocus/FocusTrap.js +18 -14
  97. package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
  98. package/index.js +1 -1
  99. package/index.mjs +1 -1
  100. package/package.json +49 -49
  101. package/styles/responsiveFontSizes.js +19 -8
  102. package/styles/responsiveFontSizes.mjs +19 -8
  103. package/styles/useThemeProps.d.mts +3 -3
  104. package/styles/useThemeProps.d.ts +3 -3
  105. package/transitions/utils.d.mts +17 -0
  106. package/transitions/utils.d.ts +17 -0
  107. package/transitions/utils.js +64 -0
  108. package/transitions/utils.mjs +63 -0
  109. package/useAutocomplete/useAutocomplete.d.mts +4 -5
  110. package/useAutocomplete/useAutocomplete.d.ts +4 -5
  111. package/useAutocomplete/useAutocomplete.js +166 -53
  112. package/useAutocomplete/useAutocomplete.mjs +166 -53
  113. package/utils/contains.d.mts +2 -0
  114. package/utils/contains.d.ts +2 -0
  115. package/utils/contains.js +9 -0
  116. package/utils/contains.mjs +2 -0
  117. package/utils/focusable.d.mts +7 -0
  118. package/utils/focusable.d.ts +7 -0
  119. package/utils/focusable.js +20 -0
  120. package/utils/focusable.mjs +13 -0
  121. package/utils/getEventTarget.d.mts +2 -0
  122. package/utils/getEventTarget.d.ts +2 -0
  123. package/utils/getEventTarget.js +9 -0
  124. package/utils/getEventTarget.mjs +2 -0
  125. package/utils/mergeSlotProps.js +2 -8
  126. package/utils/mergeSlotProps.mjs +1 -8
  127. package/version/index.js +2 -2
  128. package/version/index.mjs +2 -2
  129. package/FormControl/formControlState.js +0 -21
  130. package/FormControl/formControlState.mjs +0 -15
@@ -3,7 +3,7 @@ import { Components } from "./components.mjs";
3
3
  export interface ThemeWithProps {
4
4
  components?: Components<Omit<Theme, 'components'>> | undefined;
5
5
  }
6
- export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
6
+ export type ThemedProps<ThemeInput, Name extends keyof any> = ThemeInput extends {
7
7
  components: Record<Name, {
8
8
  defaultProps: infer Props;
9
9
  }>;
@@ -36,7 +36,7 @@ export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
36
36
  * @param params.props The input props
37
37
  * @param params.name The name of the component as defined in the theme
38
38
  */
39
- export default function useThemeProps<Theme extends ThemeWithProps, Props, Name extends keyof any>(params: {
39
+ export default function useThemeProps<ThemeInput extends ThemeWithProps, Props, Name extends keyof any>(params: {
40
40
  props: Props;
41
41
  name: Name;
42
- }): Props & ThemedProps<Theme, Name>;
42
+ }): Props & ThemedProps<ThemeInput, Name>;
@@ -3,7 +3,7 @@ import { Components } from "./components.js";
3
3
  export interface ThemeWithProps {
4
4
  components?: Components<Omit<Theme, 'components'>> | undefined;
5
5
  }
6
- export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
6
+ export type ThemedProps<ThemeInput, Name extends keyof any> = ThemeInput extends {
7
7
  components: Record<Name, {
8
8
  defaultProps: infer Props;
9
9
  }>;
@@ -36,7 +36,7 @@ export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
36
36
  * @param params.props The input props
37
37
  * @param params.name The name of the component as defined in the theme
38
38
  */
39
- export default function useThemeProps<Theme extends ThemeWithProps, Props, Name extends keyof any>(params: {
39
+ export default function useThemeProps<ThemeInput extends ThemeWithProps, Props, Name extends keyof any>(params: {
40
40
  props: Props;
41
41
  name: Name;
42
- }): Props & ThemedProps<Theme, Name>;
42
+ }): Props & ThemedProps<ThemeInput, Name>;
@@ -19,6 +19,23 @@ interface TransitionProps {
19
19
  easing: string | undefined;
20
20
  delay: string | undefined;
21
21
  }
22
+ interface TranslateOffset {
23
+ offsetX: number;
24
+ offsetY: number;
25
+ }
26
+ /**
27
+ * Extracts the x/y translation from a CSS transform string.
28
+ *
29
+ * Transition components use these offsets when calculating off-screen positions:
30
+ * if an element is already translated, the distance needed to hide it must start
31
+ * from that visual position instead of its untransformed layout position.
32
+ *
33
+ * CSSOM commonly serializes translations as matrix() or matrix3d(), while inline
34
+ * gesture styles may use translate(), translate3d(), translateX(), or
35
+ * translateY(). This helper normalizes those supported forms into numeric pixel
36
+ * offsets and returns zero offsets for empty, none, or unsupported transforms.
37
+ */
38
+ export declare function getTranslateOffsets(transform: string | undefined): TranslateOffset;
22
39
  export declare function normalizedTransitionCallback(nodeRef: React.RefObject<HTMLElement | null>, callback: ((node: HTMLElement, isAppearing?: boolean) => void) | undefined): (maybeIsAppearing?: boolean) => void;
23
40
  type TransitionState = 'entering' | 'entered' | 'exiting' | 'exited';
24
41
  /**
@@ -19,6 +19,23 @@ interface TransitionProps {
19
19
  easing: string | undefined;
20
20
  delay: string | undefined;
21
21
  }
22
+ interface TranslateOffset {
23
+ offsetX: number;
24
+ offsetY: number;
25
+ }
26
+ /**
27
+ * Extracts the x/y translation from a CSS transform string.
28
+ *
29
+ * Transition components use these offsets when calculating off-screen positions:
30
+ * if an element is already translated, the distance needed to hide it must start
31
+ * from that visual position instead of its untransformed layout position.
32
+ *
33
+ * CSSOM commonly serializes translations as matrix() or matrix3d(), while inline
34
+ * gesture styles may use translate(), translate3d(), translateX(), or
35
+ * translateY(). This helper normalizes those supported forms into numeric pixel
36
+ * offsets and returns zero offsets for empty, none, or unsupported transforms.
37
+ */
38
+ export declare function getTranslateOffsets(transform: string | undefined): TranslateOffset;
22
39
  export declare function normalizedTransitionCallback(nodeRef: React.RefObject<HTMLElement | null>, callback: ((node: HTMLElement, isAppearing?: boolean) => void) | undefined): (maybeIsAppearing?: boolean) => void;
23
40
  type TransitionState = 'entering' | 'entered' | 'exiting' | 'exited';
24
41
  /**
@@ -5,10 +5,74 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getTransitionChildStyle = getTransitionChildStyle;
7
7
  exports.getTransitionProps = getTransitionProps;
8
+ exports.getTranslateOffsets = getTranslateOffsets;
8
9
  exports.normalizedTransitionCallback = normalizedTransitionCallback;
9
10
  exports.reflow = void 0;
10
11
  const reflow = node => node.scrollTop;
11
12
  exports.reflow = reflow;
13
+ const DEFAULT_TRANSLATE_OFFSET = {
14
+ offsetX: 0,
15
+ offsetY: 0
16
+ };
17
+ const transformOffsetIndexes = {
18
+ matrix: [4, 5],
19
+ matrix3d: [12, 13],
20
+ translate: [0, 1],
21
+ translate3d: [0, 1],
22
+ translateX: [0, null],
23
+ translateY: [null, 0]
24
+ };
25
+ function parseTranslateValue(value) {
26
+ const parsedValue = parseFloat(value ?? '');
27
+ return Number.isNaN(parsedValue) ? 0 : parsedValue;
28
+ }
29
+ function parseTransform(transform) {
30
+ const match = transform.match(/^(matrix|matrix3d|translate|translate3d|translateX|translateY)\((.+)\)$/);
31
+ if (!match) {
32
+ return null;
33
+ }
34
+ return {
35
+ type: match[1],
36
+ values: match[2].split(',').map(parseTranslateValue)
37
+ };
38
+ }
39
+ function getTranslateOffsetValue(values, index) {
40
+ return index === null ? 0 : values[index] || 0;
41
+ }
42
+
43
+ /**
44
+ * Extracts the x/y translation from a CSS transform string.
45
+ *
46
+ * Transition components use these offsets when calculating off-screen positions:
47
+ * if an element is already translated, the distance needed to hide it must start
48
+ * from that visual position instead of its untransformed layout position.
49
+ *
50
+ * CSSOM commonly serializes translations as matrix() or matrix3d(), while inline
51
+ * gesture styles may use translate(), translate3d(), translateX(), or
52
+ * translateY(). This helper normalizes those supported forms into numeric pixel
53
+ * offsets and returns zero offsets for empty, none, or unsupported transforms.
54
+ */
55
+ function getTranslateOffsets(transform) {
56
+ if (!transform || transform === 'none') {
57
+ return DEFAULT_TRANSLATE_OFFSET;
58
+ }
59
+ const parsedTransform = parseTransform(transform);
60
+ if (!parsedTransform) {
61
+ return DEFAULT_TRANSLATE_OFFSET;
62
+ }
63
+ const {
64
+ type,
65
+ values
66
+ } = parsedTransform;
67
+ const offsetIndexes = transformOffsetIndexes[type];
68
+ if (!offsetIndexes) {
69
+ return DEFAULT_TRANSLATE_OFFSET;
70
+ }
71
+ return {
72
+ offsetX: getTranslateOffsetValue(values, offsetIndexes[0]),
73
+ offsetY: getTranslateOffsetValue(values, offsetIndexes[1])
74
+ };
75
+ }
12
76
  function normalizedTransitionCallback(nodeRef, callback) {
13
77
  return maybeIsAppearing => {
14
78
  if (callback) {
@@ -1,4 +1,67 @@
1
1
  export const reflow = node => node.scrollTop;
2
+ const DEFAULT_TRANSLATE_OFFSET = {
3
+ offsetX: 0,
4
+ offsetY: 0
5
+ };
6
+ const transformOffsetIndexes = {
7
+ matrix: [4, 5],
8
+ matrix3d: [12, 13],
9
+ translate: [0, 1],
10
+ translate3d: [0, 1],
11
+ translateX: [0, null],
12
+ translateY: [null, 0]
13
+ };
14
+ function parseTranslateValue(value) {
15
+ const parsedValue = parseFloat(value ?? '');
16
+ return Number.isNaN(parsedValue) ? 0 : parsedValue;
17
+ }
18
+ function parseTransform(transform) {
19
+ const match = transform.match(/^(matrix|matrix3d|translate|translate3d|translateX|translateY)\((.+)\)$/);
20
+ if (!match) {
21
+ return null;
22
+ }
23
+ return {
24
+ type: match[1],
25
+ values: match[2].split(',').map(parseTranslateValue)
26
+ };
27
+ }
28
+ function getTranslateOffsetValue(values, index) {
29
+ return index === null ? 0 : values[index] || 0;
30
+ }
31
+
32
+ /**
33
+ * Extracts the x/y translation from a CSS transform string.
34
+ *
35
+ * Transition components use these offsets when calculating off-screen positions:
36
+ * if an element is already translated, the distance needed to hide it must start
37
+ * from that visual position instead of its untransformed layout position.
38
+ *
39
+ * CSSOM commonly serializes translations as matrix() or matrix3d(), while inline
40
+ * gesture styles may use translate(), translate3d(), translateX(), or
41
+ * translateY(). This helper normalizes those supported forms into numeric pixel
42
+ * offsets and returns zero offsets for empty, none, or unsupported transforms.
43
+ */
44
+ export function getTranslateOffsets(transform) {
45
+ if (!transform || transform === 'none') {
46
+ return DEFAULT_TRANSLATE_OFFSET;
47
+ }
48
+ const parsedTransform = parseTransform(transform);
49
+ if (!parsedTransform) {
50
+ return DEFAULT_TRANSLATE_OFFSET;
51
+ }
52
+ const {
53
+ type,
54
+ values
55
+ } = parsedTransform;
56
+ const offsetIndexes = transformOffsetIndexes[type];
57
+ if (!offsetIndexes) {
58
+ return DEFAULT_TRANSLATE_OFFSET;
59
+ }
60
+ return {
61
+ offsetX: getTranslateOffsetValue(values, offsetIndexes[0]),
62
+ offsetY: getTranslateOffsetValue(values, offsetIndexes[1])
63
+ };
64
+ }
2
65
  export function normalizedTransitionCallback(nodeRef, callback) {
3
66
  return maybeIsAppearing => {
4
67
  if (callback) {
@@ -47,12 +47,11 @@ export interface UseAutocompleteProps<Value, Multiple extends boolean | undefine
47
47
  */
48
48
  autoHighlight?: boolean | undefined;
49
49
  /**
50
- * If `true`, the selected option becomes the value of the input
51
- * when the Autocomplete loses focus unless the user chooses
52
- * a different option or changes the character string in the input.
50
+ * If `true`, the value is updated when the input loses focus under one of these conditions:
53
51
  *
54
- * When using the `freeSolo` mode, the typed value will be the input value
55
- * if the Autocomplete loses focus without highlighting an option.
52
+ * - An option highlighted via keyboard navigation or `autoHighlight` is selected.
53
+ * Hover and touch highlights are ignored.
54
+ * - Otherwise, in `freeSolo` mode, the typed text becomes the value.
56
55
  * @default false
57
56
  */
58
57
  autoSelect?: boolean | undefined;
@@ -47,12 +47,11 @@ export interface UseAutocompleteProps<Value, Multiple extends boolean | undefine
47
47
  */
48
48
  autoHighlight?: boolean | undefined;
49
49
  /**
50
- * If `true`, the selected option becomes the value of the input
51
- * when the Autocomplete loses focus unless the user chooses
52
- * a different option or changes the character string in the input.
50
+ * If `true`, the value is updated when the input loses focus under one of these conditions:
53
51
  *
54
- * When using the `freeSolo` mode, the typed value will be the input value
55
- * if the Autocomplete loses focus without highlighting an option.
52
+ * - An option highlighted via keyboard navigation or `autoHighlight` is selected.
53
+ * Hover and touch highlights are ignored.
54
+ * - Otherwise, in `freeSolo` mode, the typed text becomes the value.
56
55
  * @default false
57
56
  */
58
57
  autoSelect?: boolean | undefined;