@mui/utils 6.0.0-beta.0 → 6.0.0-beta.3
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 +473 -31
- package/ClassNameGenerator/ClassNameGenerator.js +7 -1
- package/ClassNameGenerator/index.js +13 -1
- package/ClassNameGenerator/package.json +2 -2
- package/HTMLElementType/HTMLElementType.js +7 -1
- package/HTMLElementType/index.js +13 -1
- package/HTMLElementType/package.json +2 -2
- package/appendOwnerState/appendOwnerState.d.ts +20 -0
- package/appendOwnerState/appendOwnerState.js +34 -0
- package/appendOwnerState/index.d.ts +2 -0
- package/{node/capitalize → appendOwnerState}/index.js +2 -2
- package/appendOwnerState/package.json +6 -0
- package/capitalize/capitalize.js +10 -3
- package/capitalize/index.js +13 -1
- package/capitalize/package.json +2 -2
- package/chainPropTypes/chainPropTypes.js +7 -1
- package/chainPropTypes/index.js +13 -1
- package/chainPropTypes/package.json +2 -2
- package/clamp/clamp.js +7 -1
- package/clamp/index.js +13 -1
- package/clamp/package.json +2 -2
- package/composeClasses/composeClasses.js +7 -1
- package/composeClasses/index.js +13 -1
- package/composeClasses/package.json +2 -2
- package/createChainedFunction/createChainedFunction.js +7 -1
- package/createChainedFunction/index.js +13 -1
- package/createChainedFunction/package.json +2 -2
- package/debounce/debounce.js +7 -1
- package/debounce/index.js +26 -2
- package/debounce/package.json +2 -2
- package/deepmerge/deepmerge.js +9 -2
- package/deepmerge/index.js +26 -2
- package/deepmerge/package.json +2 -2
- package/deprecatedPropType/deprecatedPropType.js +7 -1
- package/deprecatedPropType/index.js +13 -1
- package/deprecatedPropType/package.json +2 -2
- package/elementAcceptingRef/elementAcceptingRef.js +12 -5
- package/elementAcceptingRef/index.js +13 -1
- package/elementAcceptingRef/package.json +2 -2
- package/elementTypeAcceptingRef/elementTypeAcceptingRef.js +10 -3
- package/elementTypeAcceptingRef/index.js +13 -1
- package/elementTypeAcceptingRef/package.json +2 -2
- package/{node → esm}/ClassNameGenerator/ClassNameGenerator.js +1 -7
- package/esm/ClassNameGenerator/index.js +1 -0
- package/{node → esm}/HTMLElementType/HTMLElementType.js +1 -7
- package/esm/HTMLElementType/index.js +1 -0
- package/esm/appendOwnerState/appendOwnerState.js +28 -0
- package/esm/appendOwnerState/index.js +1 -0
- package/esm/capitalize/capitalize.js +11 -0
- package/esm/capitalize/index.js +1 -0
- package/{node → esm}/chainPropTypes/chainPropTypes.js +1 -7
- package/esm/chainPropTypes/index.js +1 -0
- package/esm/clamp/clamp.js +4 -0
- package/esm/clamp/index.js +1 -0
- package/{node → esm}/composeClasses/composeClasses.js +1 -7
- package/esm/composeClasses/index.js +1 -0
- package/{node → esm}/createChainedFunction/createChainedFunction.js +1 -7
- package/esm/createChainedFunction/index.js +1 -0
- package/{node → esm}/debounce/debounce.js +1 -7
- package/esm/debounce/index.js +2 -0
- package/{node → esm}/deepmerge/deepmerge.js +2 -9
- package/esm/deepmerge/index.js +2 -0
- package/{node → esm}/deprecatedPropType/deprecatedPropType.js +1 -7
- package/esm/deprecatedPropType/index.js +1 -0
- package/{node → esm}/elementAcceptingRef/elementAcceptingRef.js +5 -12
- package/esm/elementAcceptingRef/index.js +1 -0
- package/{node → esm}/elementTypeAcceptingRef/elementTypeAcceptingRef.js +3 -10
- package/esm/elementTypeAcceptingRef/index.js +1 -0
- package/{node → esm}/exactProp/exactProp.js +1 -7
- package/esm/exactProp/index.js +1 -0
- package/esm/extractEventHandlers/extractEventHandlers.js +18 -0
- package/esm/extractEventHandlers/index.js +1 -0
- package/{node → esm}/formatMuiErrorMessage/formatMuiErrorMessage.js +1 -7
- package/esm/formatMuiErrorMessage/index.js +1 -0
- package/esm/generateUtilityClass/generateUtilityClass.js +22 -0
- package/esm/generateUtilityClass/index.js +2 -0
- package/esm/generateUtilityClasses/generateUtilityClasses.js +8 -0
- package/esm/generateUtilityClasses/index.js +1 -0
- package/{node → esm}/getDisplayName/getDisplayName.js +4 -10
- package/esm/getDisplayName/index.js +1 -0
- package/{node → esm}/getScrollbarSize/getScrollbarSize.js +1 -7
- package/esm/getScrollbarSize/index.js +1 -0
- package/esm/getValidReactChildren/getValidReactChildren.js +11 -0
- package/esm/getValidReactChildren/index.js +1 -0
- package/esm/index.js +47 -0
- package/esm/integerPropType/index.js +2 -0
- package/{node → esm}/integerPropType/integerPropType.js +2 -9
- package/esm/isFocusVisible/index.js +1 -0
- package/{node → esm}/isFocusVisible/isFocusVisible.js +1 -7
- package/esm/isHostComponent/index.js +1 -0
- package/esm/isHostComponent/isHostComponent.js +7 -0
- package/esm/isMuiElement/index.js +1 -0
- package/esm/isMuiElement/isMuiElement.js +8 -0
- package/esm/mergeSlotProps/index.js +1 -0
- package/esm/mergeSlotProps/mergeSlotProps.js +90 -0
- package/esm/omitEventHandlers/index.js +1 -0
- package/esm/omitEventHandlers/omitEventHandlers.js +18 -0
- package/esm/ownerDocument/index.js +1 -0
- package/esm/ownerDocument/ownerDocument.js +3 -0
- package/esm/ownerWindow/index.js +1 -0
- package/esm/ownerWindow/ownerWindow.js +5 -0
- package/esm/ponyfillGlobal/index.js +1 -0
- package/esm/ponyfillGlobal/ponyfillGlobal.js +3 -0
- package/esm/refType/index.js +1 -0
- package/esm/refType/refType.js +3 -0
- package/esm/requirePropFactory/index.js +1 -0
- package/{node → esm}/requirePropFactory/requirePropFactory.js +2 -8
- package/esm/resolveComponentProps/index.js +1 -0
- package/esm/resolveComponentProps/resolveComponentProps.js +11 -0
- package/esm/resolveProps/index.js +1 -0
- package/{node → esm}/resolveProps/resolveProps.js +1 -7
- package/esm/setRef/index.js +1 -0
- package/{node → esm}/setRef/setRef.js +1 -7
- package/esm/types.js +1 -0
- package/esm/unsupportedProp/index.js +1 -0
- package/{node → esm}/unsupportedProp/unsupportedProp.js +1 -7
- package/esm/useControlled/index.js +1 -0
- package/{node → esm}/useControlled/useControlled.js +2 -9
- package/esm/useEnhancedEffect/index.js +1 -0
- package/esm/useEnhancedEffect/useEnhancedEffect.js +13 -0
- package/esm/useEventCallback/index.js +1 -0
- package/esm/useEventCallback/useEventCallback.js +20 -0
- package/esm/useForkRef/index.js +1 -0
- package/esm/useForkRef/useForkRef.js +22 -0
- package/esm/useId/index.js +1 -0
- package/{node → esm}/useId/useId.js +3 -10
- package/esm/useLazyRef/index.js +1 -0
- package/esm/useLazyRef/useLazyRef.js +19 -0
- package/esm/useLocalStorageState/index.js +1 -0
- package/{node → esm}/useLocalStorageState/useLocalStorageState.js +4 -13
- package/esm/useOnMount/index.js +1 -0
- package/esm/useOnMount/useOnMount.js +13 -0
- package/esm/usePreviousProps/index.js +1 -0
- package/esm/usePreviousProps/usePreviousProps.js +11 -0
- package/esm/useSlotProps/index.js +1 -0
- package/esm/useSlotProps/useSlotProps.js +38 -0
- package/esm/useTimeout/index.js +2 -0
- package/esm/useTimeout/useTimeout.js +35 -0
- package/esm/visuallyHidden/index.js +1 -0
- package/{node → esm}/visuallyHidden/visuallyHidden.js +1 -7
- package/exactProp/exactProp.js +7 -1
- package/exactProp/index.js +13 -1
- package/exactProp/package.json +2 -2
- package/extractEventHandlers/extractEventHandlers.d.ts +10 -0
- package/extractEventHandlers/extractEventHandlers.js +24 -0
- package/extractEventHandlers/index.d.ts +1 -0
- package/{node/ClassNameGenerator → extractEventHandlers}/index.js +2 -2
- package/extractEventHandlers/package.json +6 -0
- package/formatMuiErrorMessage/formatMuiErrorMessage.js +7 -1
- package/formatMuiErrorMessage/index.js +13 -1
- package/formatMuiErrorMessage/package.json +2 -2
- package/generateUtilityClass/generateUtilityClass.js +14 -5
- package/generateUtilityClass/index.js +26 -2
- package/generateUtilityClass/package.json +2 -2
- package/generateUtilityClasses/generateUtilityClasses.js +10 -3
- package/generateUtilityClasses/index.js +13 -1
- package/generateUtilityClasses/package.json +2 -2
- package/getDisplayName/getDisplayName.js +10 -4
- package/getDisplayName/index.js +13 -1
- package/getDisplayName/package.json +2 -2
- package/getScrollbarSize/getScrollbarSize.js +7 -1
- package/getScrollbarSize/index.js +13 -1
- package/getScrollbarSize/package.json +2 -2
- package/getValidReactChildren/getValidReactChildren.js +9 -2
- package/getValidReactChildren/index.js +13 -1
- package/getValidReactChildren/package.json +2 -2
- package/index.d.ts +5 -0
- package/index.js +399 -44
- package/integerPropType/index.js +26 -2
- package/integerPropType/integerPropType.js +9 -2
- package/integerPropType/package.json +2 -2
- package/isFocusVisible/index.js +13 -1
- package/isFocusVisible/isFocusVisible.js +7 -1
- package/isFocusVisible/package.json +2 -2
- package/isHostComponent/index.d.ts +1 -0
- package/{node/clamp → isHostComponent}/index.js +2 -2
- package/isHostComponent/isHostComponent.d.ts +6 -0
- package/isHostComponent/isHostComponent.js +13 -0
- package/isHostComponent/package.json +6 -0
- package/isMuiElement/index.js +13 -1
- package/isMuiElement/isMuiElement.js +13 -5
- package/isMuiElement/package.json +2 -2
- package/mergeSlotProps/index.d.ts +2 -0
- package/{node/chainPropTypes → mergeSlotProps}/index.js +2 -2
- package/mergeSlotProps/mergeSlotProps.d.ts +56 -0
- package/mergeSlotProps/mergeSlotProps.js +97 -0
- package/mergeSlotProps/package.json +6 -0
- package/modern/appendOwnerState/appendOwnerState.js +28 -0
- package/modern/appendOwnerState/index.js +1 -0
- package/modern/extractEventHandlers/extractEventHandlers.js +18 -0
- package/modern/extractEventHandlers/index.js +1 -0
- package/modern/index.js +6 -2
- package/modern/isHostComponent/index.js +1 -0
- package/modern/isHostComponent/isHostComponent.js +7 -0
- package/modern/mergeSlotProps/index.js +1 -0
- package/modern/mergeSlotProps/mergeSlotProps.js +90 -0
- package/modern/omitEventHandlers/index.js +1 -0
- package/modern/omitEventHandlers/omitEventHandlers.js +18 -0
- package/modern/resolveComponentProps/index.js +1 -0
- package/modern/resolveComponentProps/resolveComponentProps.js +11 -0
- package/modern/types.js +1 -0
- package/modern/useSlotProps/index.js +1 -0
- package/modern/useSlotProps/useSlotProps.js +38 -0
- package/omitEventHandlers/index.d.ts +1 -0
- package/{node/HTMLElementType → omitEventHandlers}/index.js +2 -2
- package/omitEventHandlers/omitEventHandlers.d.ts +9 -0
- package/omitEventHandlers/omitEventHandlers.js +24 -0
- package/omitEventHandlers/package.json +6 -0
- package/ownerDocument/index.js +13 -1
- package/ownerDocument/ownerDocument.js +7 -1
- package/ownerDocument/package.json +2 -2
- package/ownerWindow/index.js +13 -1
- package/ownerWindow/ownerWindow.js +10 -3
- package/ownerWindow/package.json +2 -2
- package/package.json +7 -5
- package/ponyfillGlobal/index.js +13 -1
- package/ponyfillGlobal/package.json +2 -2
- package/ponyfillGlobal/ponyfillGlobal.js +7 -1
- package/refType/index.js +13 -1
- package/refType/package.json +2 -2
- package/refType/refType.js +10 -3
- package/requirePropFactory/index.js +13 -1
- package/requirePropFactory/package.json +2 -2
- package/requirePropFactory/requirePropFactory.js +8 -2
- package/resolveComponentProps/index.d.ts +1 -0
- package/resolveComponentProps/index.js +13 -0
- package/resolveComponentProps/package.json +6 -0
- package/resolveComponentProps/resolveComponentProps.d.ts +6 -0
- package/resolveComponentProps/resolveComponentProps.js +17 -0
- package/resolveProps/index.js +13 -1
- package/resolveProps/package.json +2 -2
- package/resolveProps/resolveProps.js +7 -1
- package/setRef/index.js +13 -1
- package/setRef/package.json +2 -2
- package/setRef/setRef.js +7 -1
- package/types.d.ts +7 -0
- package/types.js +5 -0
- package/unsupportedProp/index.js +13 -1
- package/unsupportedProp/package.json +2 -2
- package/unsupportedProp/unsupportedProp.js +7 -1
- package/useControlled/index.js +13 -1
- package/useControlled/package.json +2 -2
- package/useControlled/useControlled.js +9 -2
- package/useEnhancedEffect/index.js +13 -1
- package/useEnhancedEffect/package.json +2 -2
- package/useEnhancedEffect/useEnhancedEffect.js +9 -3
- package/useEventCallback/index.js +13 -1
- package/useEventCallback/package.json +2 -2
- package/useEventCallback/useEventCallback.js +12 -5
- package/useForkRef/index.js +13 -1
- package/useForkRef/package.json +2 -2
- package/useForkRef/useForkRef.js +12 -4
- package/useId/index.js +13 -1
- package/useId/package.json +2 -2
- package/useId/useId.js +10 -3
- package/useLazyRef/index.js +13 -1
- package/useLazyRef/package.json +2 -2
- package/useLazyRef/useLazyRef.js +9 -2
- package/useLocalStorageState/index.js +13 -1
- package/useLocalStorageState/package.json +2 -2
- package/useLocalStorageState/useLocalStorageState.js +13 -4
- package/useOnMount/index.js +13 -1
- package/useOnMount/package.json +2 -2
- package/useOnMount/useOnMount.js +9 -2
- package/usePreviousProps/index.js +13 -1
- package/usePreviousProps/package.json +2 -2
- package/usePreviousProps/usePreviousProps.js +9 -2
- package/useSlotProps/index.d.ts +2 -0
- package/{node/exactProp → useSlotProps}/index.js +2 -2
- package/useSlotProps/package.json +6 -0
- package/useSlotProps/useSlotProps.d.ts +41 -0
- package/useSlotProps/useSlotProps.js +45 -0
- package/useTimeout/index.js +20 -2
- package/useTimeout/package.json +2 -2
- package/useTimeout/useTimeout.js +14 -6
- package/visuallyHidden/index.js +13 -1
- package/visuallyHidden/package.json +2 -2
- package/visuallyHidden/visuallyHidden.js +7 -1
- package/node/capitalize/capitalize.js +0 -18
- package/node/clamp/clamp.js +0 -10
- package/node/composeClasses/index.js +0 -13
- package/node/createChainedFunction/index.js +0 -13
- package/node/debounce/index.js +0 -26
- package/node/deepmerge/index.js +0 -26
- package/node/deprecatedPropType/index.js +0 -13
- package/node/elementAcceptingRef/index.js +0 -13
- package/node/elementTypeAcceptingRef/index.js +0 -13
- package/node/formatMuiErrorMessage/index.js +0 -13
- package/node/generateUtilityClass/generateUtilityClass.js +0 -31
- package/node/generateUtilityClass/index.js +0 -26
- package/node/generateUtilityClasses/generateUtilityClasses.js +0 -15
- package/node/generateUtilityClasses/index.js +0 -13
- package/node/getDisplayName/index.js +0 -13
- package/node/getScrollbarSize/index.js +0 -13
- package/node/getValidReactChildren/getValidReactChildren.js +0 -18
- package/node/getValidReactChildren/index.js +0 -13
- package/node/index.js +0 -369
- package/node/integerPropType/index.js +0 -26
- package/node/isFocusVisible/index.js +0 -13
- package/node/isMuiElement/index.js +0 -13
- package/node/isMuiElement/isMuiElement.js +0 -16
- package/node/ownerDocument/index.js +0 -13
- package/node/ownerDocument/ownerDocument.js +0 -9
- package/node/ownerWindow/index.js +0 -13
- package/node/ownerWindow/ownerWindow.js +0 -12
- package/node/ponyfillGlobal/index.js +0 -13
- package/node/ponyfillGlobal/ponyfillGlobal.js +0 -9
- package/node/refType/index.js +0 -13
- package/node/refType/refType.js +0 -10
- package/node/requirePropFactory/index.js +0 -13
- package/node/resolveProps/index.js +0 -13
- package/node/setRef/index.js +0 -13
- package/node/unsupportedProp/index.js +0 -13
- package/node/useControlled/index.js +0 -13
- package/node/useEnhancedEffect/index.js +0 -13
- package/node/useEnhancedEffect/useEnhancedEffect.js +0 -19
- package/node/useEventCallback/index.js +0 -13
- package/node/useEventCallback/useEventCallback.js +0 -27
- package/node/useForkRef/index.js +0 -13
- package/node/useForkRef/useForkRef.js +0 -30
- package/node/useId/index.js +0 -13
- package/node/useLazyRef/index.js +0 -13
- package/node/useLazyRef/useLazyRef.js +0 -26
- package/node/useLocalStorageState/index.js +0 -13
- package/node/useOnMount/index.js +0 -13
- package/node/useOnMount/useOnMount.js +0 -20
- package/node/usePreviousProps/index.js +0 -13
- package/node/usePreviousProps/usePreviousProps.js +0 -18
- package/node/useTimeout/index.js +0 -20
- package/node/useTimeout/useTimeout.js +0 -43
- package/node/visuallyHidden/index.js +0 -13
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes event handlers from the given object.
|
|
3
|
+
* A field is considered an event handler if it is a function with a name beginning with `on`.
|
|
4
|
+
*
|
|
5
|
+
* @param object Object to remove event handlers from.
|
|
6
|
+
* @returns Object with event handlers removed.
|
|
7
|
+
*/
|
|
8
|
+
function omitEventHandlers(object) {
|
|
9
|
+
if (object === undefined) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
const result = {};
|
|
13
|
+
Object.keys(object).filter(prop => !(prop.match(/^on[A-Z]/) && typeof object[prop] === 'function')).forEach(prop => {
|
|
14
|
+
result[prop] = object[prop];
|
|
15
|
+
});
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
export default omitEventHandlers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ownerDocument';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ownerWindow';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ponyfillGlobal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './refType';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './requirePropFactory';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = requirePropFactory;
|
|
7
|
-
function requirePropFactory(componentNameInError, Component) {
|
|
1
|
+
export default function requirePropFactory(componentNameInError, Component) {
|
|
8
2
|
if (process.env.NODE_ENV === 'production') {
|
|
9
3
|
return () => null;
|
|
10
4
|
}
|
|
@@ -15,7 +9,7 @@ function requirePropFactory(componentNameInError, Component) {
|
|
|
15
9
|
} : null;
|
|
16
10
|
const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
|
|
17
11
|
const propFullNameSafe = propFullName || propName;
|
|
18
|
-
const defaultTypeChecker = prevPropTypes
|
|
12
|
+
const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
|
|
19
13
|
if (defaultTypeChecker) {
|
|
20
14
|
const typeCheckerResult = defaultTypeChecker(props, propName, componentName, location, propFullName, ...args);
|
|
21
15
|
if (typeCheckerResult) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './resolveComponentProps';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If `componentProps` is a function, calls it with the provided `ownerState`.
|
|
3
|
+
* Otherwise, just returns `componentProps`.
|
|
4
|
+
*/
|
|
5
|
+
function resolveComponentProps(componentProps, ownerState, slotState) {
|
|
6
|
+
if (typeof componentProps === 'function') {
|
|
7
|
+
return componentProps(ownerState, slotState);
|
|
8
|
+
}
|
|
9
|
+
return componentProps;
|
|
10
|
+
}
|
|
11
|
+
export default resolveComponentProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './resolveProps';
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = resolveProps;
|
|
7
1
|
/**
|
|
8
2
|
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
9
3
|
* @param {object} defaultProps
|
|
10
4
|
* @param {object} props
|
|
11
5
|
* @returns {object} resolved props
|
|
12
6
|
*/
|
|
13
|
-
function resolveProps(defaultProps, props) {
|
|
7
|
+
export default function resolveProps(defaultProps, props) {
|
|
14
8
|
const output = {
|
|
15
9
|
...props
|
|
16
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './setRef';
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = setRef;
|
|
7
1
|
/**
|
|
8
2
|
* TODO v5: consider making it private
|
|
9
3
|
*
|
|
@@ -17,7 +11,7 @@ exports.default = setRef;
|
|
|
17
11
|
* while still using it inside the component.
|
|
18
12
|
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
19
13
|
*/
|
|
20
|
-
function setRef(ref, value) {
|
|
14
|
+
export default function setRef(ref, value) {
|
|
21
15
|
if (typeof ref === 'function') {
|
|
22
16
|
ref(value);
|
|
23
17
|
} else if (ref) {
|
package/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './unsupportedProp';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = unsupportedProp;
|
|
7
|
-
function unsupportedProp(props, propName, componentName, location, propFullName) {
|
|
1
|
+
export default function unsupportedProp(props, propName, componentName, location, propFullName) {
|
|
8
2
|
if (process.env.NODE_ENV === 'production') {
|
|
9
3
|
return null;
|
|
10
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useControlled';
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
3
|
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports.default = useControlled;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
function useControlled({
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
export default function useControlled({
|
|
13
6
|
controlled,
|
|
14
7
|
default: defaultProp,
|
|
15
8
|
name,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useEnhancedEffect';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
7
|
+
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
8
|
+
*
|
|
9
|
+
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
10
|
+
* and confirm it doesn't apply to your use-case.
|
|
11
|
+
*/
|
|
12
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
13
|
+
export default useEnhancedEffect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useEventCallback';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useEnhancedEffect from '../useEnhancedEffect';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
8
|
+
* See RFC in https://github.com/reactjs/rfcs/pull/220
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function useEventCallback(fn) {
|
|
12
|
+
const ref = React.useRef(fn);
|
|
13
|
+
useEnhancedEffect(() => {
|
|
14
|
+
ref.current = fn;
|
|
15
|
+
});
|
|
16
|
+
return React.useRef((...args) =>
|
|
17
|
+
// @ts-expect-error hide `this`
|
|
18
|
+
(0, ref.current)(...args)).current;
|
|
19
|
+
}
|
|
20
|
+
export default useEventCallback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useForkRef';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import setRef from '../setRef';
|
|
5
|
+
export default function useForkRef(...refs) {
|
|
6
|
+
/**
|
|
7
|
+
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
8
|
+
* This means react will call the old forkRef with `null` and the new forkRef
|
|
9
|
+
* with the ref. Cleanup naturally emerges from this behavior.
|
|
10
|
+
*/
|
|
11
|
+
return React.useMemo(() => {
|
|
12
|
+
if (refs.every(ref => ref == null)) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return instance => {
|
|
16
|
+
refs.forEach(ref => {
|
|
17
|
+
setRef(ref, instance);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
}, refs);
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useId';
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = useId;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
3
|
+
import * as React from 'react';
|
|
11
4
|
let globalId = 0;
|
|
12
5
|
function useGlobalId(idOverride) {
|
|
13
6
|
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
@@ -33,10 +26,10 @@ const maybeReactUseId = React['useId'.toString()];
|
|
|
33
26
|
* @param idOverride
|
|
34
27
|
* @returns {string}
|
|
35
28
|
*/
|
|
36
|
-
function useId(idOverride) {
|
|
29
|
+
export default function useId(idOverride) {
|
|
37
30
|
if (maybeReactUseId !== undefined) {
|
|
38
31
|
const reactId = maybeReactUseId();
|
|
39
|
-
return idOverride
|
|
32
|
+
return idOverride ?? reactId;
|
|
40
33
|
}
|
|
41
34
|
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
42
35
|
return useGlobalId(idOverride);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useLazyRef';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
const UNINITIALIZED = {};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A React.useRef() that is initialized lazily with a function. Note that it accepts an optional
|
|
8
|
+
* initialization argument, so the initialization function doesn't need to be an inline closure.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* const ref = useLazyRef(sortColumns, columns)
|
|
12
|
+
*/
|
|
13
|
+
export default function useLazyRef(init, initArg) {
|
|
14
|
+
const ref = React.useRef(UNINITIALIZED);
|
|
15
|
+
if (ref.current === UNINITIALIZED) {
|
|
16
|
+
ref.current = init(initArg);
|
|
17
|
+
}
|
|
18
|
+
return ref;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useLocalStorageState';
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
11
5
|
// storage events only work across tabs, we'll use an event emitter to announce within the current tab
|
|
12
6
|
const currentTabChangeListeners = new Map();
|
|
13
7
|
function onCurrentTabStorageChange(key, handler) {
|
|
@@ -96,10 +90,7 @@ function useLocalStorageStateBrowser(key, initializer = null) {
|
|
|
96
90
|
const [initialValue] = React.useState(initializer);
|
|
97
91
|
const area = window.localStorage;
|
|
98
92
|
const subscribeKey = React.useCallback(callbark => subscribe(area, key, callbark), [area, key]);
|
|
99
|
-
const getKeySnapshot = React.useCallback(() =>
|
|
100
|
-
var _getSnapshot;
|
|
101
|
-
return (_getSnapshot = getSnapshot(area, key)) != null ? _getSnapshot : initialValue;
|
|
102
|
-
}, [area, initialValue, key]);
|
|
93
|
+
const getKeySnapshot = React.useCallback(() => getSnapshot(area, key) ?? initialValue, [area, initialValue, key]);
|
|
103
94
|
|
|
104
95
|
// Start with null for the hydration, and then switch to the actual value.
|
|
105
96
|
const getKeyServerSnapshot = () => null;
|
|
@@ -114,4 +105,4 @@ function useLocalStorageStateBrowser(key, initializer = null) {
|
|
|
114
105
|
}
|
|
115
106
|
return [storedValue, setStoredValue];
|
|
116
107
|
}
|
|
117
|
-
|
|
108
|
+
export default typeof window === 'undefined' ? useLocalStorageStateServer : useLocalStorageStateBrowser;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useOnMount';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
const EMPTY = [];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A React.useEffect equivalent that runs once, when the component is mounted.
|
|
8
|
+
*/
|
|
9
|
+
export default function useOnMount(fn) {
|
|
10
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
11
|
+
React.useEffect(fn, EMPTY);
|
|
12
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './usePreviousProps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './useSlotProps';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import useForkRef from '../useForkRef';
|
|
4
|
+
import appendOwnerState from '../appendOwnerState';
|
|
5
|
+
import mergeSlotProps from '../mergeSlotProps';
|
|
6
|
+
import resolveComponentProps from '../resolveComponentProps';
|
|
7
|
+
/**
|
|
8
|
+
* @ignore - do not document.
|
|
9
|
+
* Builds the props to be passed into the slot of an unstyled component.
|
|
10
|
+
* It merges the internal props of the component with the ones supplied by the user, allowing to customize the behavior.
|
|
11
|
+
* If the slot component is not a host component, it also merges in the `ownerState`.
|
|
12
|
+
*
|
|
13
|
+
* @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
|
|
14
|
+
*/
|
|
15
|
+
function useSlotProps(parameters) {
|
|
16
|
+
const {
|
|
17
|
+
elementType,
|
|
18
|
+
externalSlotProps,
|
|
19
|
+
ownerState,
|
|
20
|
+
skipResolvingSlotProps = false,
|
|
21
|
+
...other
|
|
22
|
+
} = parameters;
|
|
23
|
+
const resolvedComponentsProps = skipResolvingSlotProps ? {} : resolveComponentProps(externalSlotProps, ownerState);
|
|
24
|
+
const {
|
|
25
|
+
props: mergedProps,
|
|
26
|
+
internalRef
|
|
27
|
+
} = mergeSlotProps({
|
|
28
|
+
...other,
|
|
29
|
+
externalSlotProps: resolvedComponentsProps
|
|
30
|
+
});
|
|
31
|
+
const ref = useForkRef(internalRef, resolvedComponentsProps?.ref, parameters.additionalProps?.ref);
|
|
32
|
+
const props = appendOwnerState(elementType, {
|
|
33
|
+
...mergedProps,
|
|
34
|
+
ref
|
|
35
|
+
}, ownerState);
|
|
36
|
+
return props;
|
|
37
|
+
}
|
|
38
|
+
export default useSlotProps;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import useLazyRef from '../useLazyRef/useLazyRef';
|
|
4
|
+
import useOnMount from '../useOnMount/useOnMount';
|
|
5
|
+
export class Timeout {
|
|
6
|
+
static create() {
|
|
7
|
+
return new Timeout();
|
|
8
|
+
}
|
|
9
|
+
currentId = null;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
13
|
+
*/
|
|
14
|
+
start(delay, fn) {
|
|
15
|
+
this.clear();
|
|
16
|
+
this.currentId = setTimeout(() => {
|
|
17
|
+
this.currentId = null;
|
|
18
|
+
fn();
|
|
19
|
+
}, delay);
|
|
20
|
+
}
|
|
21
|
+
clear = () => {
|
|
22
|
+
if (this.currentId !== null) {
|
|
23
|
+
clearTimeout(this.currentId);
|
|
24
|
+
this.currentId = null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
disposeEffect = () => {
|
|
28
|
+
return this.clear;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export default function useTimeout() {
|
|
32
|
+
const timeout = useLazyRef(Timeout.create).current;
|
|
33
|
+
useOnMount(timeout.disposeEffect);
|
|
34
|
+
return timeout;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './visuallyHidden';
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
const visuallyHidden = {
|
|
8
2
|
border: 0,
|
|
9
3
|
clip: 'rect(0 0 0 0)',
|
|
@@ -15,4 +9,4 @@ const visuallyHidden = {
|
|
|
15
9
|
whiteSpace: 'nowrap',
|
|
16
10
|
width: '1px'
|
|
17
11
|
};
|
|
18
|
-
|
|
12
|
+
export default visuallyHidden;
|
package/exactProp/exactProp.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exactProp;
|
|
1
7
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
2
8
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
3
9
|
// the module was forked.
|
|
4
10
|
|
|
5
11
|
const specialProperty = 'exact-prop: \u200b';
|
|
6
|
-
|
|
12
|
+
function exactProp(propTypes) {
|
|
7
13
|
if (process.env.NODE_ENV === 'production') {
|
|
8
14
|
return propTypes;
|
|
9
15
|
}
|
package/exactProp/index.js
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _exactProp.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _exactProp = _interopRequireDefault(require("./exactProp"));
|
package/exactProp/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventHandlers } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts event handlers from a given object.
|
|
4
|
+
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
5
|
+
*
|
|
6
|
+
* @param object An object to extract event handlers from.
|
|
7
|
+
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
8
|
+
*/
|
|
9
|
+
declare function extractEventHandlers(object: Record<string, any> | undefined, excludeKeys?: string[]): EventHandlers;
|
|
10
|
+
export default extractEventHandlers;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Extracts event handlers from a given object.
|
|
9
|
+
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
10
|
+
*
|
|
11
|
+
* @param object An object to extract event handlers from.
|
|
12
|
+
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
13
|
+
*/
|
|
14
|
+
function extractEventHandlers(object, excludeKeys = []) {
|
|
15
|
+
if (object === undefined) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const result = {};
|
|
19
|
+
Object.keys(object).filter(prop => prop.match(/^on[A-Z]/) && typeof object[prop] === 'function' && !excludeKeys.includes(prop)).forEach(prop => {
|
|
20
|
+
result[prop] = object[prop];
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
var _default = exports.default = extractEventHandlers;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './extractEventHandlers';
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
Object.defineProperty(exports, "default", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function () {
|
|
10
|
-
return
|
|
10
|
+
return _extractEventHandlers.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var
|
|
13
|
+
var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = formatMuiErrorMessage;
|
|
1
7
|
/**
|
|
2
8
|
* WARNING: Don't import this directly.
|
|
3
9
|
* Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
|
|
4
10
|
* @param {number} code
|
|
5
11
|
*/
|
|
6
|
-
|
|
12
|
+
function formatMuiErrorMessage(code) {
|
|
7
13
|
// Apply babel-plugin-transform-template-literals in loose mode
|
|
8
14
|
// loose mode is safe if we're concatenating primitives
|
|
9
15
|
// see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _formatMuiErrorMessage.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("./formatMuiErrorMessage"));
|