@mui/utils 7.0.1 → 7.1.0
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 +157 -0
- package/deprecatedPropType/deprecatedPropType.d.ts +2 -1
- package/esm/deprecatedPropType/deprecatedPropType.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/integerPropType/integerPropType.d.ts +1 -0
- package/esm/integerPropType/integerPropType.js +4 -3
- package/esm/requirePropFactory/requirePropFactory.d.ts +2 -1
- package/esm/requirePropFactory/requirePropFactory.js +1 -1
- package/esm/useControlled/index.js +2 -1
- package/esm/useControlled/useControlled.d.ts +2 -1
- package/esm/useControlled/useControlled.js +12 -6
- package/esm/useForkRef/useForkRef.d.ts +1 -2
- package/esm/useForkRef/useForkRef.js +32 -12
- package/index.js +1 -1
- package/integerPropType/integerPropType.d.ts +1 -0
- package/integerPropType/integerPropType.js +4 -3
- package/package.json +5 -13
- package/requirePropFactory/requirePropFactory.d.ts +2 -1
- package/requirePropFactory/requirePropFactory.js +1 -1
- package/useControlled/index.js +14 -2
- package/useControlled/useControlled.d.ts +2 -1
- package/useControlled/useControlled.js +12 -6
- package/useForkRef/useForkRef.d.ts +1 -2
- package/useForkRef/useForkRef.js +32 -13
- package/modern/ClassNameGenerator/ClassNameGenerator.d.ts +0 -6
- package/modern/ClassNameGenerator/ClassNameGenerator.js +0 -17
- package/modern/ClassNameGenerator/index.d.ts +0 -1
- package/modern/ClassNameGenerator/index.js +0 -1
- package/modern/HTMLElementType/HTMLElementType.d.ts +0 -3
- package/modern/HTMLElementType/HTMLElementType.js +0 -14
- package/modern/HTMLElementType/index.d.ts +0 -1
- package/modern/HTMLElementType/index.js +0 -1
- package/modern/appendOwnerState/appendOwnerState.d.ts +0 -20
- package/modern/appendOwnerState/appendOwnerState.js +0 -28
- package/modern/appendOwnerState/index.d.ts +0 -2
- package/modern/appendOwnerState/index.js +0 -1
- package/modern/capitalize/capitalize.d.ts +0 -1
- package/modern/capitalize/capitalize.js +0 -11
- package/modern/capitalize/index.d.ts +0 -1
- package/modern/capitalize/index.js +0 -1
- package/modern/chainPropTypes/chainPropTypes.d.ts +0 -2
- package/modern/chainPropTypes/chainPropTypes.js +0 -8
- package/modern/chainPropTypes/index.d.ts +0 -1
- package/modern/chainPropTypes/index.js +0 -1
- package/modern/clamp/clamp.d.ts +0 -2
- package/modern/clamp/clamp.js +0 -4
- package/modern/clamp/index.d.ts +0 -1
- package/modern/clamp/index.js +0 -1
- package/modern/composeClasses/composeClasses.d.ts +0 -29
- package/modern/composeClasses/composeClasses.js +0 -53
- package/modern/composeClasses/index.d.ts +0 -1
- package/modern/composeClasses/index.js +0 -1
- package/modern/createChainedFunction/createChainedFunction.d.ts +0 -7
- package/modern/createChainedFunction/createChainedFunction.js +0 -17
- package/modern/createChainedFunction/index.d.ts +0 -1
- package/modern/createChainedFunction/index.js +0 -1
- package/modern/debounce/debounce.d.ts +0 -4
- package/modern/debounce/debounce.js +0 -17
- package/modern/debounce/index.d.ts +0 -2
- package/modern/debounce/index.js +0 -2
- package/modern/deepmerge/deepmerge.d.ts +0 -23
- package/modern/deepmerge/deepmerge.js +0 -64
- package/modern/deepmerge/index.d.ts +0 -2
- package/modern/deepmerge/index.js +0 -2
- package/modern/deprecatedPropType/deprecatedPropType.d.ts +0 -1
- package/modern/deprecatedPropType/deprecatedPropType.js +0 -13
- package/modern/deprecatedPropType/index.d.ts +0 -1
- package/modern/deprecatedPropType/index.js +0 -1
- package/modern/elementAcceptingRef/elementAcceptingRef.d.ts +0 -3
- package/modern/elementAcceptingRef/elementAcceptingRef.js +0 -42
- package/modern/elementAcceptingRef/index.d.ts +0 -1
- package/modern/elementAcceptingRef/index.js +0 -1
- package/modern/elementTypeAcceptingRef/elementTypeAcceptingRef.d.ts +0 -3
- package/modern/elementTypeAcceptingRef/elementTypeAcceptingRef.js +0 -40
- package/modern/elementTypeAcceptingRef/index.d.ts +0 -1
- package/modern/elementTypeAcceptingRef/index.js +0 -1
- package/modern/exactProp/exactProp.d.ts +0 -2
- package/modern/exactProp/exactProp.js +0 -20
- package/modern/exactProp/index.d.ts +0 -1
- package/modern/exactProp/index.js +0 -1
- package/modern/extractEventHandlers/extractEventHandlers.d.ts +0 -10
- package/modern/extractEventHandlers/extractEventHandlers.js +0 -18
- package/modern/extractEventHandlers/index.d.ts +0 -1
- package/modern/extractEventHandlers/index.js +0 -1
- package/modern/formatMuiErrorMessage/formatMuiErrorMessage.d.ts +0 -11
- package/modern/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -15
- package/modern/formatMuiErrorMessage/index.d.ts +0 -1
- package/modern/formatMuiErrorMessage/index.js +0 -1
- package/modern/generateUtilityClass/generateUtilityClass.d.ts +0 -17
- package/modern/generateUtilityClass/generateUtilityClass.js +0 -22
- package/modern/generateUtilityClass/index.d.ts +0 -2
- package/modern/generateUtilityClass/index.js +0 -2
- package/modern/generateUtilityClasses/generateUtilityClasses.d.ts +0 -1
- package/modern/generateUtilityClasses/generateUtilityClasses.js +0 -8
- package/modern/generateUtilityClasses/index.d.ts +0 -1
- package/modern/generateUtilityClasses/index.js +0 -1
- package/modern/getDisplayName/getDisplayName.d.ts +0 -7
- package/modern/getDisplayName/getDisplayName.js +0 -38
- package/modern/getDisplayName/index.d.ts +0 -1
- package/modern/getDisplayName/index.js +0 -1
- package/modern/getReactElementRef/getReactElementRef.d.ts +0 -9
- package/modern/getReactElementRef/getReactElementRef.js +0 -18
- package/modern/getReactElementRef/index.d.ts +0 -1
- package/modern/getReactElementRef/index.js +0 -1
- package/modern/getReactNodeRef/getReactNodeRef.d.ts +0 -11
- package/modern/getReactNodeRef/getReactNodeRef.js +0 -23
- package/modern/getReactNodeRef/index.d.ts +0 -1
- package/modern/getReactNodeRef/index.js +0 -1
- package/modern/getScrollbarSize/getScrollbarSize.d.ts +0 -1
- package/modern/getScrollbarSize/getScrollbarSize.js +0 -7
- package/modern/getScrollbarSize/index.d.ts +0 -1
- package/modern/getScrollbarSize/index.js +0 -1
- package/modern/getValidReactChildren/getValidReactChildren.d.ts +0 -8
- package/modern/getValidReactChildren/getValidReactChildren.js +0 -11
- package/modern/getValidReactChildren/index.d.ts +0 -1
- package/modern/getValidReactChildren/index.js +0 -1
- package/modern/index.d.ts +0 -51
- package/modern/index.js +0 -57
- package/modern/integerPropType/index.d.ts +0 -2
- package/modern/integerPropType/index.js +0 -2
- package/modern/integerPropType/integerPropType.d.ts +0 -3
- package/modern/integerPropType/integerPropType.js +0 -44
- package/modern/isFocusVisible/index.d.ts +0 -1
- package/modern/isFocusVisible/index.js +0 -1
- package/modern/isFocusVisible/isFocusVisible.d.ts +0 -4
- package/modern/isFocusVisible/isFocusVisible.js +0 -15
- package/modern/isHostComponent/index.d.ts +0 -1
- package/modern/isHostComponent/index.js +0 -1
- package/modern/isHostComponent/isHostComponent.d.ts +0 -6
- package/modern/isHostComponent/isHostComponent.js +0 -7
- package/modern/isMuiElement/index.d.ts +0 -1
- package/modern/isMuiElement/index.js +0 -1
- package/modern/isMuiElement/isMuiElement.d.ts +0 -1
- package/modern/isMuiElement/isMuiElement.js +0 -8
- package/modern/mergeSlotProps/index.d.ts +0 -2
- package/modern/mergeSlotProps/index.js +0 -1
- package/modern/mergeSlotProps/mergeSlotProps.d.ts +0 -56
- package/modern/mergeSlotProps/mergeSlotProps.js +0 -90
- package/modern/omitEventHandlers/index.d.ts +0 -1
- package/modern/omitEventHandlers/index.js +0 -1
- package/modern/omitEventHandlers/omitEventHandlers.d.ts +0 -9
- package/modern/omitEventHandlers/omitEventHandlers.js +0 -18
- package/modern/ownerDocument/index.d.ts +0 -1
- package/modern/ownerDocument/index.js +0 -1
- package/modern/ownerDocument/ownerDocument.d.ts +0 -1
- package/modern/ownerDocument/ownerDocument.js +0 -3
- package/modern/ownerWindow/index.d.ts +0 -1
- package/modern/ownerWindow/index.js +0 -1
- package/modern/ownerWindow/ownerWindow.d.ts +0 -1
- package/modern/ownerWindow/ownerWindow.js +0 -5
- package/modern/package.json +0 -1
- package/modern/ponyfillGlobal/index.d.ts +0 -1
- package/modern/ponyfillGlobal/index.js +0 -1
- package/modern/ponyfillGlobal/ponyfillGlobal.d.ts +0 -6
- package/modern/ponyfillGlobal/ponyfillGlobal.js +0 -6
- package/modern/refType/index.d.ts +0 -1
- package/modern/refType/index.js +0 -1
- package/modern/refType/refType.d.ts +0 -3
- package/modern/refType/refType.js +0 -3
- package/modern/requirePropFactory/index.d.ts +0 -1
- package/modern/requirePropFactory/index.js +0 -1
- package/modern/requirePropFactory/requirePropFactory.d.ts +0 -2
- package/modern/requirePropFactory/requirePropFactory.js +0 -25
- package/modern/resolveComponentProps/index.d.ts +0 -1
- package/modern/resolveComponentProps/index.js +0 -1
- package/modern/resolveComponentProps/resolveComponentProps.d.ts +0 -6
- package/modern/resolveComponentProps/resolveComponentProps.js +0 -11
- package/modern/resolveProps/index.d.ts +0 -1
- package/modern/resolveProps/index.js +0 -1
- package/modern/resolveProps/resolveProps.d.ts +0 -12
- package/modern/resolveProps/resolveProps.js +0 -43
- package/modern/setRef/index.d.ts +0 -1
- package/modern/setRef/index.js +0 -1
- package/modern/setRef/setRef.d.ts +0 -15
- package/modern/setRef/setRef.js +0 -20
- package/modern/types/index.d.ts +0 -7
- package/modern/types/index.js +0 -1
- package/modern/unsupportedProp/index.d.ts +0 -1
- package/modern/unsupportedProp/index.js +0 -1
- package/modern/unsupportedProp/unsupportedProp.d.ts +0 -3
- package/modern/unsupportedProp/unsupportedProp.js +0 -10
- package/modern/useControlled/index.d.ts +0 -2
- package/modern/useControlled/index.js +0 -1
- package/modern/useControlled/useControlled.d.ts +0 -19
- package/modern/useControlled/useControlled.js +0 -41
- package/modern/useEnhancedEffect/index.d.ts +0 -1
- package/modern/useEnhancedEffect/index.js +0 -1
- package/modern/useEnhancedEffect/useEnhancedEffect.d.ts +0 -10
- package/modern/useEnhancedEffect/useEnhancedEffect.js +0 -13
- package/modern/useEventCallback/index.d.ts +0 -1
- package/modern/useEventCallback/index.js +0 -1
- package/modern/useEventCallback/useEventCallback.d.ts +0 -7
- package/modern/useEventCallback/useEventCallback.js +0 -20
- package/modern/useForkRef/index.d.ts +0 -1
- package/modern/useForkRef/index.js +0 -1
- package/modern/useForkRef/useForkRef.d.ts +0 -18
- package/modern/useForkRef/useForkRef.js +0 -40
- package/modern/useId/index.d.ts +0 -1
- package/modern/useId/index.js +0 -1
- package/modern/useId/useId.d.ts +0 -7
- package/modern/useId/useId.js +0 -45
- package/modern/useIsFocusVisible/index.d.ts +0 -2
- package/modern/useIsFocusVisible/index.js +0 -2
- package/modern/useIsFocusVisible/useIsFocusVisible.d.ts +0 -9
- package/modern/useIsFocusVisible/useIsFocusVisible.js +0 -163
- package/modern/useLazyRef/index.d.ts +0 -1
- package/modern/useLazyRef/index.js +0 -1
- package/modern/useLazyRef/useLazyRef.d.ts +0 -9
- package/modern/useLazyRef/useLazyRef.js +0 -19
- package/modern/useLocalStorageState/index.d.ts +0 -1
- package/modern/useLocalStorageState/index.js +0 -1
- package/modern/useLocalStorageState/useLocalStorageState.d.ts +0 -14
- package/modern/useLocalStorageState/useLocalStorageState.js +0 -108
- package/modern/useOnMount/index.d.ts +0 -1
- package/modern/useOnMount/index.js +0 -1
- package/modern/useOnMount/useOnMount.d.ts +0 -5
- package/modern/useOnMount/useOnMount.js +0 -14
- package/modern/usePreviousProps/index.d.ts +0 -1
- package/modern/usePreviousProps/index.js +0 -1
- package/modern/usePreviousProps/usePreviousProps.d.ts +0 -2
- package/modern/usePreviousProps/usePreviousProps.js +0 -11
- package/modern/useSlotProps/index.d.ts +0 -2
- package/modern/useSlotProps/index.js +0 -1
- package/modern/useSlotProps/useSlotProps.d.ts +0 -41
- package/modern/useSlotProps/useSlotProps.js +0 -38
- package/modern/useTimeout/index.d.ts +0 -2
- package/modern/useTimeout/index.js +0 -2
- package/modern/useTimeout/useTimeout.d.ts +0 -11
- package/modern/useTimeout/useTimeout.js +0 -35
- package/modern/visuallyHidden/index.d.ts +0 -1
- package/modern/visuallyHidden/index.js +0 -1
- package/modern/visuallyHidden/visuallyHidden.d.ts +0 -2
- package/modern/visuallyHidden/visuallyHidden.js +0 -12
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default function HTMLElementType(props, propName, componentName, location, propFullName) {
|
|
2
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
const propValue = props[propName];
|
|
6
|
-
const safePropName = propFullName || propName;
|
|
7
|
-
if (propValue == null) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
if (propValue && propValue.nodeType !== 1) {
|
|
11
|
-
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an HTMLElement.`);
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./HTMLElementType.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./HTMLElementType.js";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Simplify } from '@mui/types';
|
|
3
|
-
/**
|
|
4
|
-
* Type of the ownerState based on the type of an element it applies to.
|
|
5
|
-
* This resolves to the provided OwnerState for React components and `undefined` for host components.
|
|
6
|
-
* Falls back to `OwnerState | undefined` when the exact type can't be determined in development time.
|
|
7
|
-
*/
|
|
8
|
-
type OwnerStateWhenApplicable<ElementType extends React.ElementType, OwnerState> = ElementType extends React.ComponentType<any> ? OwnerState : ElementType extends keyof React.JSX.IntrinsicElements ? undefined : OwnerState | undefined;
|
|
9
|
-
export type AppendOwnerStateReturnType<ElementType extends React.ElementType, OtherProps, OwnerState> = Simplify<OtherProps & {
|
|
10
|
-
ownerState: OwnerStateWhenApplicable<ElementType, OwnerState>;
|
|
11
|
-
}>;
|
|
12
|
-
/**
|
|
13
|
-
* Appends the ownerState object to the props, merging with the existing one if necessary.
|
|
14
|
-
*
|
|
15
|
-
* @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied.
|
|
16
|
-
* @param otherProps Props of the element.
|
|
17
|
-
* @param ownerState
|
|
18
|
-
*/
|
|
19
|
-
declare function appendOwnerState<ElementType extends React.ElementType, OtherProps extends Record<string, any>, OwnerState>(elementType: ElementType | undefined, otherProps: OtherProps, ownerState: OwnerState): AppendOwnerStateReturnType<ElementType, OtherProps, OwnerState>;
|
|
20
|
-
export default appendOwnerState;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import isHostComponent from "../isHostComponent/index.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Type of the ownerState based on the type of an element it applies to.
|
|
5
|
-
* This resolves to the provided OwnerState for React components and `undefined` for host components.
|
|
6
|
-
* Falls back to `OwnerState | undefined` when the exact type can't be determined in development time.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Appends the ownerState object to the props, merging with the existing one if necessary.
|
|
11
|
-
*
|
|
12
|
-
* @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied.
|
|
13
|
-
* @param otherProps Props of the element.
|
|
14
|
-
* @param ownerState
|
|
15
|
-
*/
|
|
16
|
-
function appendOwnerState(elementType, otherProps, ownerState) {
|
|
17
|
-
if (elementType === undefined || isHostComponent(elementType)) {
|
|
18
|
-
return otherProps;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
...otherProps,
|
|
22
|
-
ownerState: {
|
|
23
|
-
...otherProps.ownerState,
|
|
24
|
-
...ownerState
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export default appendOwnerState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./appendOwnerState.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function capitalize(string: string): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
|
-
// It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
|
|
3
|
-
//
|
|
4
|
-
// A strict capitalization should uppercase the first letter of each word in the sentence.
|
|
5
|
-
// We only handle the first word.
|
|
6
|
-
export default function capitalize(string) {
|
|
7
|
-
if (typeof string !== 'string') {
|
|
8
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `capitalize(string)` expects a string argument.' : _formatErrorMessage(7));
|
|
9
|
-
}
|
|
10
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./capitalize.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./capitalize.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./chainPropTypes.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./chainPropTypes.js";
|
package/modern/clamp/clamp.d.ts
DELETED
package/modern/clamp/clamp.js
DELETED
package/modern/clamp/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./clamp.js";
|
package/modern/clamp/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./clamp.js";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compose classes from multiple sources.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```tsx
|
|
6
|
-
* const slots = {
|
|
7
|
-
* root: ['root', 'primary'],
|
|
8
|
-
* label: ['label'],
|
|
9
|
-
* };
|
|
10
|
-
*
|
|
11
|
-
* const getUtilityClass = (slot) => `MuiButton-${slot}`;
|
|
12
|
-
*
|
|
13
|
-
* const classes = {
|
|
14
|
-
* root: 'my-root-class',
|
|
15
|
-
* };
|
|
16
|
-
*
|
|
17
|
-
* const output = composeClasses(slots, getUtilityClass, classes);
|
|
18
|
-
* // {
|
|
19
|
-
* // root: 'MuiButton-root MuiButton-primary my-root-class',
|
|
20
|
-
* // label: 'MuiButton-label',
|
|
21
|
-
* // }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param slots a list of classes for each possible slot
|
|
25
|
-
* @param getUtilityClass a function to resolve the class based on the slot name
|
|
26
|
-
* @param classes the input classes from props
|
|
27
|
-
* @returns the resolved classes for all slots
|
|
28
|
-
*/
|
|
29
|
-
export default function composeClasses<ClassKey extends string>(slots: Record<ClassKey, ReadonlyArray<string | false | undefined | null>>, getUtilityClass: (slot: string) => string, classes?: Record<string, string> | undefined): Record<ClassKey, string>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* eslint no-restricted-syntax: 0, prefer-template: 0, guard-for-in: 0
|
|
2
|
-
---
|
|
3
|
-
These rules are preventing the performance optimizations below.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Compose classes from multiple sources.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* const slots = {
|
|
12
|
-
* root: ['root', 'primary'],
|
|
13
|
-
* label: ['label'],
|
|
14
|
-
* };
|
|
15
|
-
*
|
|
16
|
-
* const getUtilityClass = (slot) => `MuiButton-${slot}`;
|
|
17
|
-
*
|
|
18
|
-
* const classes = {
|
|
19
|
-
* root: 'my-root-class',
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* const output = composeClasses(slots, getUtilityClass, classes);
|
|
23
|
-
* // {
|
|
24
|
-
* // root: 'MuiButton-root MuiButton-primary my-root-class',
|
|
25
|
-
* // label: 'MuiButton-label',
|
|
26
|
-
* // }
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @param slots a list of classes for each possible slot
|
|
30
|
-
* @param getUtilityClass a function to resolve the class based on the slot name
|
|
31
|
-
* @param classes the input classes from props
|
|
32
|
-
* @returns the resolved classes for all slots
|
|
33
|
-
*/
|
|
34
|
-
export default function composeClasses(slots, getUtilityClass, classes = undefined) {
|
|
35
|
-
const output = {};
|
|
36
|
-
for (const slotName in slots) {
|
|
37
|
-
const slot = slots[slotName];
|
|
38
|
-
let buffer = '';
|
|
39
|
-
let start = true;
|
|
40
|
-
for (let i = 0; i < slot.length; i += 1) {
|
|
41
|
-
const value = slot[i];
|
|
42
|
-
if (value) {
|
|
43
|
-
buffer += (start === true ? '' : ' ') + getUtilityClass(value);
|
|
44
|
-
start = false;
|
|
45
|
-
if (classes && classes[value]) {
|
|
46
|
-
buffer += ' ' + classes[value];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
output[slotName] = buffer;
|
|
51
|
-
}
|
|
52
|
-
return output;
|
|
53
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./composeClasses.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./composeClasses.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safe chained function.
|
|
3
|
-
*
|
|
4
|
-
* Will only create a new function if needed,
|
|
5
|
-
* otherwise will pass back existing functions or null.
|
|
6
|
-
*/
|
|
7
|
-
export default function createChainedFunction<Args extends any[], This>(...funcs: Array<(this: This, ...args: Args) => any>): (this: This, ...args: Args) => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safe chained function.
|
|
3
|
-
*
|
|
4
|
-
* Will only create a new function if needed,
|
|
5
|
-
* otherwise will pass back existing functions or null.
|
|
6
|
-
*/
|
|
7
|
-
export default function createChainedFunction(...funcs) {
|
|
8
|
-
return funcs.reduce((acc, func) => {
|
|
9
|
-
if (func == null) {
|
|
10
|
-
return acc;
|
|
11
|
-
}
|
|
12
|
-
return function chainedFunction(...args) {
|
|
13
|
-
acc.apply(this, args);
|
|
14
|
-
func.apply(this, args);
|
|
15
|
-
};
|
|
16
|
-
}, () => {});
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./createChainedFunction.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./createChainedFunction.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Corresponds to 10 frames at 60 Hz.
|
|
2
|
-
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
|
|
3
|
-
export default function debounce(func, wait = 166) {
|
|
4
|
-
let timeout;
|
|
5
|
-
function debounced(...args) {
|
|
6
|
-
const later = () => {
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
func.apply(this, args);
|
|
9
|
-
};
|
|
10
|
-
clearTimeout(timeout);
|
|
11
|
-
timeout = setTimeout(later, wait);
|
|
12
|
-
}
|
|
13
|
-
debounced.clear = () => {
|
|
14
|
-
clearTimeout(timeout);
|
|
15
|
-
};
|
|
16
|
-
return debounced;
|
|
17
|
-
}
|
package/modern/debounce/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function isPlainObject(item: unknown): item is Record<keyof any, unknown>;
|
|
2
|
-
export interface DeepmergeOptions {
|
|
3
|
-
clone?: boolean;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Merge objects deeply.
|
|
7
|
-
* It will shallow copy React elements.
|
|
8
|
-
*
|
|
9
|
-
* If `options.clone` is set to `false` the source object will be merged directly into the target object.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 });
|
|
14
|
-
* // => { a: { b: 1, c: 2 }, d: 4 }
|
|
15
|
-
* ````
|
|
16
|
-
*
|
|
17
|
-
* @param target The target object.
|
|
18
|
-
* @param source The source object.
|
|
19
|
-
* @param options The merge options.
|
|
20
|
-
* @param options.clone Set to `false` to merge the source object directly into the target object.
|
|
21
|
-
* @returns The merged object.
|
|
22
|
-
*/
|
|
23
|
-
export default function deepmerge<T>(target: T, source: unknown, options?: DeepmergeOptions): T;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { isValidElementType } from 'react-is';
|
|
3
|
-
|
|
4
|
-
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
5
|
-
export function isPlainObject(item) {
|
|
6
|
-
if (typeof item !== 'object' || item === null) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
const prototype = Object.getPrototypeOf(item);
|
|
10
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
11
|
-
}
|
|
12
|
-
function deepClone(source) {
|
|
13
|
-
if (/*#__PURE__*/React.isValidElement(source) || isValidElementType(source) || !isPlainObject(source)) {
|
|
14
|
-
return source;
|
|
15
|
-
}
|
|
16
|
-
const output = {};
|
|
17
|
-
Object.keys(source).forEach(key => {
|
|
18
|
-
output[key] = deepClone(source[key]);
|
|
19
|
-
});
|
|
20
|
-
return output;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Merge objects deeply.
|
|
25
|
-
* It will shallow copy React elements.
|
|
26
|
-
*
|
|
27
|
-
* If `options.clone` is set to `false` the source object will be merged directly into the target object.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* deepmerge({ a: { b: 1 }, d: 2 }, { a: { c: 2 }, d: 4 });
|
|
32
|
-
* // => { a: { b: 1, c: 2 }, d: 4 }
|
|
33
|
-
* ````
|
|
34
|
-
*
|
|
35
|
-
* @param target The target object.
|
|
36
|
-
* @param source The source object.
|
|
37
|
-
* @param options The merge options.
|
|
38
|
-
* @param options.clone Set to `false` to merge the source object directly into the target object.
|
|
39
|
-
* @returns The merged object.
|
|
40
|
-
*/
|
|
41
|
-
export default function deepmerge(target, source, options = {
|
|
42
|
-
clone: true
|
|
43
|
-
}) {
|
|
44
|
-
const output = options.clone ? {
|
|
45
|
-
...target
|
|
46
|
-
} : target;
|
|
47
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
48
|
-
Object.keys(source).forEach(key => {
|
|
49
|
-
if (/*#__PURE__*/React.isValidElement(source[key]) || isValidElementType(source[key])) {
|
|
50
|
-
output[key] = source[key];
|
|
51
|
-
} else if (isPlainObject(source[key]) &&
|
|
52
|
-
// Avoid prototype pollution
|
|
53
|
-
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
54
|
-
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
55
|
-
output[key] = deepmerge(target[key], source[key], options);
|
|
56
|
-
} else if (options.clone) {
|
|
57
|
-
output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];
|
|
58
|
-
} else {
|
|
59
|
-
output[key] = source[key];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return output;
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function deprecatedPropType<T>(validator: T, reason: string): T;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default function deprecatedPropType(validator, reason) {
|
|
2
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3
|
-
return () => null;
|
|
4
|
-
}
|
|
5
|
-
return (props, propName, componentName, location, propFullName) => {
|
|
6
|
-
const componentNameSafe = componentName || '<<anonymous>>';
|
|
7
|
-
const propFullNameSafe = propFullName || propName;
|
|
8
|
-
if (typeof props[propName] !== 'undefined') {
|
|
9
|
-
return new Error(`The ${location} \`${propFullNameSafe}\` of ` + `\`${componentNameSafe}\` is deprecated. ${reason}`);
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./deprecatedPropType.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./deprecatedPropType.js";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import chainPropTypes from "../chainPropTypes/index.js";
|
|
3
|
-
function isClassComponent(elementType) {
|
|
4
|
-
// elementType.prototype?.isReactComponent
|
|
5
|
-
const {
|
|
6
|
-
prototype = {}
|
|
7
|
-
} = elementType;
|
|
8
|
-
return Boolean(prototype.isReactComponent);
|
|
9
|
-
}
|
|
10
|
-
function acceptingRef(props, propName, componentName, location, propFullName) {
|
|
11
|
-
const element = props[propName];
|
|
12
|
-
const safePropName = propFullName || propName;
|
|
13
|
-
if (element == null ||
|
|
14
|
-
// When server-side rendering React doesn't warn either.
|
|
15
|
-
// This is not an accurate check for SSR.
|
|
16
|
-
// This is only in place for Emotion compat.
|
|
17
|
-
// TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
|
|
18
|
-
typeof window === 'undefined') {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
let warningHint;
|
|
22
|
-
const elementType = element.type;
|
|
23
|
-
/**
|
|
24
|
-
* Blacklisting instead of whitelisting
|
|
25
|
-
*
|
|
26
|
-
* Blacklisting will miss some components, such as React.Fragment. Those will at least
|
|
27
|
-
* trigger a warning in React.
|
|
28
|
-
* We can't whitelist because there is no safe way to detect React.forwardRef
|
|
29
|
-
* or class components. "Safe" means there's no public API.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
if (typeof elementType === 'function' && !isClassComponent(elementType)) {
|
|
33
|
-
warningHint = 'Did you accidentally use a plain function component for an element instead?';
|
|
34
|
-
}
|
|
35
|
-
if (warningHint !== undefined) {
|
|
36
|
-
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const elementAcceptingRef = chainPropTypes(PropTypes.element, acceptingRef);
|
|
41
|
-
elementAcceptingRef.isRequired = chainPropTypes(PropTypes.element.isRequired, acceptingRef);
|
|
42
|
-
export default elementAcceptingRef;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementAcceptingRef.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementAcceptingRef.js";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import chainPropTypes from "../chainPropTypes/index.js";
|
|
3
|
-
function isClassComponent(elementType) {
|
|
4
|
-
// elementType.prototype?.isReactComponent
|
|
5
|
-
const {
|
|
6
|
-
prototype = {}
|
|
7
|
-
} = elementType;
|
|
8
|
-
return Boolean(prototype.isReactComponent);
|
|
9
|
-
}
|
|
10
|
-
function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
|
|
11
|
-
const propValue = props[propName];
|
|
12
|
-
const safePropName = propFullName || propName;
|
|
13
|
-
if (propValue == null ||
|
|
14
|
-
// When server-side rendering React doesn't warn either.
|
|
15
|
-
// This is not an accurate check for SSR.
|
|
16
|
-
// This is only in place for emotion compat.
|
|
17
|
-
// TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
|
|
18
|
-
typeof window === 'undefined') {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
let warningHint;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Blacklisting instead of whitelisting
|
|
25
|
-
*
|
|
26
|
-
* Blacklisting will miss some components, such as React.Fragment. Those will at least
|
|
27
|
-
* trigger a warning in React.
|
|
28
|
-
* We can't whitelist because there is no safe way to detect React.forwardRef
|
|
29
|
-
* or class components. "Safe" means there's no public API.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
if (typeof propValue === 'function' && !isClassComponent(propValue)) {
|
|
33
|
-
warningHint = 'Did you accidentally provide a plain function component instead?';
|
|
34
|
-
}
|
|
35
|
-
if (warningHint !== undefined) {
|
|
36
|
-
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
export default chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementTypeAcceptingRef.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./elementTypeAcceptingRef.js";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
2
|
-
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
3
|
-
// the module was forked.
|
|
4
|
-
|
|
5
|
-
const specialProperty = 'exact-prop: \u200b';
|
|
6
|
-
export default function exactProp(propTypes) {
|
|
7
|
-
if (process.env.NODE_ENV === 'production') {
|
|
8
|
-
return propTypes;
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
...propTypes,
|
|
12
|
-
[specialProperty]: props => {
|
|
13
|
-
const unsupportedProps = Object.keys(props).filter(prop => !propTypes.hasOwnProperty(prop));
|
|
14
|
-
if (unsupportedProps.length > 0) {
|
|
15
|
-
return new Error(`The following props are not supported: ${unsupportedProps.map(prop => `\`${prop}\``).join(', ')}. Please remove them.`);
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./exactProp.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./exactProp.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { EventHandlers } from "../types/index.js";
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts event handlers from a given object.
|
|
3
|
-
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
4
|
-
*
|
|
5
|
-
* @param object An object to extract event handlers from.
|
|
6
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
7
|
-
*/
|
|
8
|
-
function extractEventHandlers(object, excludeKeys = []) {
|
|
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' && !excludeKeys.includes(prop)).forEach(prop => {
|
|
14
|
-
result[prop] = object[prop];
|
|
15
|
-
});
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
export default extractEventHandlers;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./extractEventHandlers.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./extractEventHandlers.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING: Don't import this directly. It's imported by the code generated by
|
|
3
|
-
* `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
|
|
4
|
-
* constructors to ensure the plugin works as expected. Supported patterns include:
|
|
5
|
-
* throw new Error('My message');
|
|
6
|
-
* throw new Error(`My message: ${foo}`);
|
|
7
|
-
* throw new Error(`My message: ${foo}` + 'another string');
|
|
8
|
-
* ...
|
|
9
|
-
* @param {number} code
|
|
10
|
-
*/
|
|
11
|
-
export default function formatMuiErrorMessage(code: number, ...args: string[]): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING: Don't import this directly. It's imported by the code generated by
|
|
3
|
-
* `@mui/interal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`
|
|
4
|
-
* constructors to ensure the plugin works as expected. Supported patterns include:
|
|
5
|
-
* throw new Error('My message');
|
|
6
|
-
* throw new Error(`My message: ${foo}`);
|
|
7
|
-
* throw new Error(`My message: ${foo}` + 'another string');
|
|
8
|
-
* ...
|
|
9
|
-
* @param {number} code
|
|
10
|
-
*/
|
|
11
|
-
export default function formatMuiErrorMessage(code, ...args) {
|
|
12
|
-
const url = new URL(`https://mui.com/production-error/?code=${code}`);
|
|
13
|
-
args.forEach(arg => url.searchParams.append('args[]', arg));
|
|
14
|
-
return `Minified MUI error #${code}; visit ${url} for the full message.`;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./formatMuiErrorMessage.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "./formatMuiErrorMessage.js";
|