@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.
- package/Autocomplete/Autocomplete.js +65 -11
- package/Autocomplete/Autocomplete.mjs +65 -11
- package/Avatar/Avatar.js +4 -0
- package/Avatar/Avatar.mjs +4 -0
- package/Badge/Badge.js +3 -0
- package/Badge/Badge.mjs +3 -0
- package/Button/Button.js +19 -2
- package/Button/Button.mjs +19 -2
- package/ButtonBase/ButtonBase.d.mts +7 -0
- package/ButtonBase/ButtonBase.d.ts +7 -0
- package/ButtonBase/ButtonBase.js +5 -2
- package/ButtonBase/ButtonBase.mjs +5 -2
- package/CHANGELOG.md +132 -1245
- package/Checkbox/Checkbox.js +2 -1
- package/Checkbox/Checkbox.mjs +2 -1
- package/CircularProgress/CircularProgress.d.mts +12 -2
- package/CircularProgress/CircularProgress.d.ts +12 -2
- package/CircularProgress/CircularProgress.js +33 -6
- package/CircularProgress/CircularProgress.mjs +33 -6
- package/ClickAwayListener/ClickAwayListener.js +3 -6
- package/ClickAwayListener/ClickAwayListener.mjs +3 -6
- package/Dialog/Dialog.js +11 -6
- package/Dialog/Dialog.mjs +11 -6
- package/Drawer/Drawer.js +18 -4
- package/Drawer/Drawer.mjs +18 -4
- package/Fab/Fab.js +7 -1
- package/Fab/Fab.mjs +7 -1
- package/FilledInput/FilledInput.d.mts +4 -0
- package/FilledInput/FilledInput.d.ts +4 -0
- package/FilledInput/FilledInput.js +18 -20
- package/FilledInput/FilledInput.mjs +18 -20
- package/FormControl/useFormControl.d.mts +12 -2
- package/FormControl/useFormControl.d.ts +12 -2
- package/FormControl/useFormControl.js +13 -0
- package/FormControl/useFormControl.mjs +12 -0
- package/FormControlLabel/FormControlLabel.js +5 -8
- package/FormControlLabel/FormControlLabel.mjs +5 -8
- package/FormGroup/FormGroup.js +2 -5
- package/FormGroup/FormGroup.mjs +2 -5
- package/FormHelperText/FormHelperText.js +2 -5
- package/FormHelperText/FormHelperText.mjs +2 -5
- package/FormLabel/FormLabel.js +2 -5
- package/FormLabel/FormLabel.mjs +2 -5
- package/IconButton/IconButton.js +1 -8
- package/IconButton/IconButton.mjs +1 -8
- package/Input/Input.d.mts +4 -0
- package/Input/Input.d.ts +4 -0
- package/Input/Input.js +6 -0
- package/Input/Input.mjs +6 -0
- package/InputBase/InputBase.d.mts +2 -1
- package/InputBase/InputBase.d.ts +2 -1
- package/InputBase/InputBase.js +50 -15
- package/InputBase/InputBase.mjs +50 -15
- package/InputLabel/InputLabel.js +5 -8
- package/InputLabel/InputLabel.mjs +5 -8
- package/LinearProgress/LinearProgress.d.mts +12 -2
- package/LinearProgress/LinearProgress.d.ts +12 -2
- package/LinearProgress/LinearProgress.js +42 -10
- package/LinearProgress/LinearProgress.mjs +42 -10
- package/List/List.js +2 -1
- package/List/List.mjs +2 -1
- package/ListItemButton/ListItemButton.js +7 -1
- package/ListItemButton/ListItemButton.mjs +7 -1
- package/MenuItem/MenuItem.js +7 -1
- package/MenuItem/MenuItem.mjs +7 -1
- package/MenuList/MenuList.js +2 -1
- package/MenuList/MenuList.mjs +2 -1
- package/NativeSelect/NativeSelect.js +2 -5
- package/NativeSelect/NativeSelect.mjs +2 -5
- package/OutlinedInput/OutlinedInput.js +13 -23
- package/OutlinedInput/OutlinedInput.mjs +13 -23
- package/PigmentContainer/PigmentContainer.js +0 -1
- package/PigmentContainer/PigmentContainer.mjs +0 -1
- package/Popper/BasePopper.js +23 -1
- package/Popper/BasePopper.mjs +23 -1
- package/Select/Select.js +2 -5
- package/Select/Select.mjs +2 -5
- package/Select/SelectInput.js +164 -2
- package/Select/SelectInput.mjs +164 -2
- package/Slide/Slide.js +48 -26
- package/Slide/Slide.mjs +49 -27
- package/Slider/Slider.js +10 -1
- package/Slider/Slider.mjs +10 -1
- package/Slider/useSlider.js +3 -2
- package/Slider/useSlider.mjs +3 -2
- package/SwipeableDrawer/SwipeableDrawer.js +7 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +7 -3
- package/Switch/Switch.js +7 -6
- package/Switch/Switch.mjs +7 -6
- package/Tabs/ScrollbarSize.js +2 -1
- package/Tabs/ScrollbarSize.mjs +2 -1
- package/Tabs/Tabs.js +2 -1
- package/Tabs/Tabs.mjs +2 -1
- package/Tooltip/Tooltip.js +26 -108
- package/Tooltip/Tooltip.mjs +26 -108
- package/Unstable_TrapFocus/FocusTrap.js +18 -14
- package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +49 -49
- package/styles/responsiveFontSizes.js +19 -8
- package/styles/responsiveFontSizes.mjs +19 -8
- package/styles/useThemeProps.d.mts +3 -3
- package/styles/useThemeProps.d.ts +3 -3
- package/transitions/utils.d.mts +17 -0
- package/transitions/utils.d.ts +17 -0
- package/transitions/utils.js +64 -0
- package/transitions/utils.mjs +63 -0
- package/useAutocomplete/useAutocomplete.d.mts +4 -5
- package/useAutocomplete/useAutocomplete.d.ts +4 -5
- package/useAutocomplete/useAutocomplete.js +166 -53
- package/useAutocomplete/useAutocomplete.mjs +166 -53
- package/utils/contains.d.mts +2 -0
- package/utils/contains.d.ts +2 -0
- package/utils/contains.js +9 -0
- package/utils/contains.mjs +2 -0
- package/utils/focusable.d.mts +7 -0
- package/utils/focusable.d.ts +7 -0
- package/utils/focusable.js +20 -0
- package/utils/focusable.mjs +13 -0
- package/utils/getEventTarget.d.mts +2 -0
- package/utils/getEventTarget.d.ts +2 -0
- package/utils/getEventTarget.js +9 -0
- package/utils/getEventTarget.mjs +2 -0
- package/utils/mergeSlotProps.js +2 -8
- package/utils/mergeSlotProps.mjs +1 -8
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
- package/FormControl/formControlState.js +0 -21
- 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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
42
|
+
}): Props & ThemedProps<ThemeInput, Name>;
|
package/transitions/utils.d.mts
CHANGED
|
@@ -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
|
/**
|
package/transitions/utils.d.ts
CHANGED
|
@@ -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
|
/**
|
package/transitions/utils.js
CHANGED
|
@@ -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) {
|
package/transitions/utils.mjs
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
55
|
-
*
|
|
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
|
|
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
|
-
*
|
|
55
|
-
*
|
|
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;
|