@mui/utils 5.2.2 → 5.4.2
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/CHANGELOG.md +758 -59
- package/HTMLElementType.d.ts +3 -3
- package/chainPropTypes.d.ts +2 -2
- package/createChainedFunction.d.ts +7 -7
- package/deepmerge.d.ts +5 -5
- package/elementAcceptingRef.d.ts +3 -3
- package/elementTypeAcceptingRef.d.ts +3 -3
- package/esm/index.js +2 -1
- package/esm/resolveProps.js +18 -0
- package/esm/setRef.js +1 -1
- package/esm/useId.js +21 -1
- package/exactProp.d.ts +2 -2
- package/formatMuiErrorMessage.d.ts +6 -6
- package/getDisplayName.d.ts +8 -8
- package/getScrollbarSize.d.ts +1 -1
- package/index.d.ts +33 -32
- package/index.js +9 -1
- package/integerPropType.d.ts +7 -7
- package/isMuiElement.d.ts +1 -1
- package/legacy/index.js +3 -2
- package/legacy/resolveProps.js +18 -0
- package/legacy/setRef.js +1 -1
- package/legacy/useId.js +21 -1
- package/modern/index.js +3 -2
- package/modern/resolveProps.js +18 -0
- package/modern/setRef.js +1 -1
- package/modern/useId.js +21 -1
- package/ownerDocument.d.ts +1 -1
- package/ownerWindow.d.ts +1 -1
- package/package.json +10 -6
- package/ponyfillGlobal.d.ts +2 -2
- package/refType.d.ts +3 -3
- package/resolveProps.d.ts +9 -0
- package/resolveProps.js +26 -0
- package/setRef.d.ts +15 -15
- package/setRef.js +1 -1
- package/useEventCallback.d.ts +4 -4
- package/useEventCallback.spec.d.ts +1 -1
- package/useForkRef.d.ts +2 -2
- package/useId.d.ts +7 -1
- package/useId.js +20 -1
- package/useIsFocusVisible.d.ts +9 -9
- package/usePreviousProps.d.ts +2 -2
- package/visuallyHidden.d.ts +2 -2
package/useId.js
CHANGED
|
@@ -13,7 +13,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
13
13
|
|
|
14
14
|
let globalId = 0;
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
function useGlobalId(idOverride) {
|
|
17
17
|
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
18
18
|
const id = idOverride || defaultId;
|
|
19
19
|
React.useEffect(() => {
|
|
@@ -27,4 +27,23 @@ function useId(idOverride) {
|
|
|
27
27
|
}
|
|
28
28
|
}, [defaultId]);
|
|
29
29
|
return id;
|
|
30
|
+
} // eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const maybeReactUseId = React['useId' + ''];
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @example <div id={useId()} />
|
|
37
|
+
* @param idOverride
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
function useId(idOverride) {
|
|
42
|
+
if (maybeReactUseId !== undefined) {
|
|
43
|
+
const reactId = maybeReactUseId();
|
|
44
|
+
return idOverride != null ? idOverride : reactId;
|
|
45
|
+
} // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return useGlobalId(idOverride);
|
|
30
49
|
}
|
package/useIsFocusVisible.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare function teardown(doc: Document): void;
|
|
3
|
-
export interface UseIsFocusVisibleResult {
|
|
4
|
-
isFocusVisibleRef: React.MutableRefObject<boolean>;
|
|
5
|
-
onBlur: (event: React.FocusEvent<any>) => void;
|
|
6
|
-
onFocus: (event: React.FocusEvent<any>) => void;
|
|
7
|
-
ref: React.Ref<unknown>;
|
|
8
|
-
}
|
|
9
|
-
export default function useIsFocusVisible(): UseIsFocusVisibleResult;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function teardown(doc: Document): void;
|
|
3
|
+
export interface UseIsFocusVisibleResult {
|
|
4
|
+
isFocusVisibleRef: React.MutableRefObject<boolean>;
|
|
5
|
+
onBlur: (event: React.FocusEvent<any>) => void;
|
|
6
|
+
onFocus: (event: React.FocusEvent<any>) => void;
|
|
7
|
+
ref: React.Ref<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export default function useIsFocusVisible(): UseIsFocusVisibleResult;
|
package/usePreviousProps.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const usePreviousProps: (value: object) => object;
|
|
2
|
-
export default usePreviousProps;
|
|
1
|
+
declare const usePreviousProps: (value: object) => object;
|
|
2
|
+
export default usePreviousProps;
|
package/visuallyHidden.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const visuallyHidden: import('react').CSSProperties;
|
|
2
|
-
export default visuallyHidden;
|
|
1
|
+
declare const visuallyHidden: import('react').CSSProperties;
|
|
2
|
+
export default visuallyHidden;
|