@mui/utils 5.15.14 → 6.0.0-alpha.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 +323 -5
- package/getDisplayName/getDisplayName.d.ts +0 -1
- package/getDisplayName/getDisplayName.js +1 -10
- package/getDisplayName/index.d.ts +0 -1
- package/getDisplayName/index.js +1 -2
- package/index.js +1 -1
- package/integerPropType/integerPropType.js +1 -8
- package/isMuiElement/isMuiElement.js +3 -3
- package/modern/getDisplayName/getDisplayName.js +1 -10
- package/modern/getDisplayName/index.js +1 -2
- package/modern/index.js +1 -1
- package/modern/integerPropType/integerPropType.js +1 -8
- package/node/debounce/index.js +1 -1
- package/node/deepmerge/index.js +1 -1
- package/node/generateUtilityClass/index.js +1 -1
- package/node/getDisplayName/getDisplayName.js +1 -10
- package/node/getDisplayName/index.js +2 -15
- package/node/getValidReactChildren/getValidReactChildren.js +1 -1
- package/node/index.js +2 -2
- package/node/integerPropType/index.js +1 -1
- package/node/integerPropType/integerPropType.js +1 -8
- package/node/isMuiElement/isMuiElement.js +1 -1
- package/node/useControlled/useControlled.js +1 -1
- package/node/useEnhancedEffect/useEnhancedEffect.js +1 -1
- package/node/useEventCallback/useEventCallback.js +1 -1
- package/node/useForkRef/useForkRef.js +1 -1
- package/node/useId/useId.js +1 -1
- package/node/useIsFocusVisible/index.js +1 -1
- package/node/useIsFocusVisible/useIsFocusVisible.js +1 -1
- package/node/useLazyRef/useLazyRef.js +1 -1
- package/node/useLocalStorageState/useLocalStorageState.js +1 -1
- package/node/useOnMount/useOnMount.js +1 -1
- package/node/usePreviousProps/usePreviousProps.js +1 -1
- package/node/useTimeout/index.js +1 -1
- package/package.json +3 -3
- package/requirePropFactory/requirePropFactory.js +1 -1
- package/useId/useId.js +1 -1
- package/useLocalStorageState/useLocalStorageState.js +1 -4
- package/legacy/ClassNameGenerator/ClassNameGenerator.js +0 -19
- package/legacy/ClassNameGenerator/index.js +0 -1
- package/legacy/HTMLElementType/HTMLElementType.js +0 -14
- package/legacy/HTMLElementType/index.js +0 -1
- package/legacy/capitalize/capitalize.js +0 -11
- package/legacy/capitalize/index.js +0 -1
- package/legacy/chainPropTypes/chainPropTypes.js +0 -10
- package/legacy/chainPropTypes/index.js +0 -1
- package/legacy/clamp/clamp.js +0 -6
- package/legacy/clamp/index.js +0 -1
- package/legacy/composeClasses/composeClasses.js +0 -22
- package/legacy/composeClasses/index.js +0 -1
- package/legacy/createChainedFunction/createChainedFunction.js +0 -23
- package/legacy/createChainedFunction/index.js +0 -1
- package/legacy/debounce/debounce.js +0 -22
- package/legacy/debounce/index.js +0 -2
- package/legacy/deepmerge/deepmerge.js +0 -43
- package/legacy/deepmerge/index.js +0 -2
- package/legacy/deprecatedPropType/deprecatedPropType.js +0 -15
- package/legacy/deprecatedPropType/index.js +0 -1
- package/legacy/elementAcceptingRef/elementAcceptingRef.js +0 -41
- package/legacy/elementAcceptingRef/index.js +0 -1
- package/legacy/elementTypeAcceptingRef/elementTypeAcceptingRef.js +0 -39
- package/legacy/elementTypeAcceptingRef/index.js +0 -1
- package/legacy/exactProp/exactProp.js +0 -23
- package/legacy/exactProp/index.js +0 -1
- package/legacy/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -19
- package/legacy/formatMuiErrorMessage/index.js +0 -1
- package/legacy/generateUtilityClass/generateUtilityClass.js +0 -23
- package/legacy/generateUtilityClass/index.js +0 -2
- package/legacy/generateUtilityClasses/generateUtilityClasses.js +0 -9
- package/legacy/generateUtilityClasses/index.js +0 -1
- package/legacy/getDisplayName/getDisplayName.js +0 -49
- package/legacy/getDisplayName/index.js +0 -2
- package/legacy/getScrollbarSize/getScrollbarSize.js +0 -7
- package/legacy/getScrollbarSize/index.js +0 -1
- package/legacy/getValidReactChildren/getValidReactChildren.js +0 -13
- package/legacy/getValidReactChildren/index.js +0 -1
- package/legacy/index.js +0 -51
- package/legacy/integerPropType/index.js +0 -2
- package/legacy/integerPropType/integerPropType.js +0 -55
- package/legacy/isMuiElement/index.js +0 -1
- package/legacy/isMuiElement/isMuiElement.js +0 -8
- package/legacy/ownerDocument/index.js +0 -1
- package/legacy/ownerDocument/ownerDocument.js +0 -3
- package/legacy/ownerWindow/index.js +0 -1
- package/legacy/ownerWindow/ownerWindow.js +0 -5
- package/legacy/ponyfillGlobal/index.js +0 -1
- package/legacy/ponyfillGlobal/ponyfillGlobal.js +0 -3
- package/legacy/refType/index.js +0 -1
- package/legacy/refType/refType.js +0 -3
- package/legacy/requirePropFactory/index.js +0 -1
- package/legacy/requirePropFactory/requirePropFactory.js +0 -31
- package/legacy/resolveProps/index.js +0 -1
- package/legacy/resolveProps/resolveProps.js +0 -34
- package/legacy/scrollLeft/index.js +0 -1
- package/legacy/scrollLeft/scrollLeft.js +0 -70
- package/legacy/setRef/index.js +0 -1
- package/legacy/setRef/setRef.js +0 -20
- package/legacy/unsupportedProp/index.js +0 -1
- package/legacy/unsupportedProp/unsupportedProp.js +0 -10
- package/legacy/useControlled/index.js +0 -1
- package/legacy/useControlled/useControlled.js +0 -38
- package/legacy/useEnhancedEffect/index.js +0 -1
- package/legacy/useEnhancedEffect/useEnhancedEffect.js +0 -13
- package/legacy/useEventCallback/index.js +0 -1
- package/legacy/useEventCallback/useEventCallback.js +0 -23
- package/legacy/useForkRef/index.js +0 -1
- package/legacy/useForkRef/useForkRef.js +0 -27
- package/legacy/useId/index.js +0 -1
- package/legacy/useId/useId.js +0 -38
- package/legacy/useIsFocusVisible/index.js +0 -2
- package/legacy/useIsFocusVisible/useIsFocusVisible.js +0 -160
- package/legacy/useLazyRef/index.js +0 -1
- package/legacy/useLazyRef/useLazyRef.js +0 -19
- package/legacy/useLocalStorageState/index.js +0 -1
- package/legacy/useLocalStorageState/useLocalStorageState.js +0 -121
- package/legacy/useOnMount/index.js +0 -1
- package/legacy/useOnMount/useOnMount.js +0 -13
- package/legacy/usePreviousProps/index.js +0 -1
- package/legacy/usePreviousProps/usePreviousProps.js +0 -11
- package/legacy/useTimeout/index.js +0 -2
- package/legacy/useTimeout/useTimeout.js +0 -48
- package/legacy/visuallyHidden/index.js +0 -1
- package/legacy/visuallyHidden/visuallyHidden.js +0 -12
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import { ForwardRef, Memo } from 'react-is';
|
|
3
|
-
|
|
4
|
-
// Simplified polyfill for IE11 support
|
|
5
|
-
// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
|
|
6
|
-
var fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
|
|
7
|
-
export function getFunctionName(fn) {
|
|
8
|
-
var match = "".concat(fn).match(fnNameMatchRegex);
|
|
9
|
-
var name = match && match[1];
|
|
10
|
-
return name || '';
|
|
11
|
-
}
|
|
12
|
-
function getFunctionComponentName(Component) {
|
|
13
|
-
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
14
|
-
return Component.displayName || Component.name || getFunctionName(Component) || fallback;
|
|
15
|
-
}
|
|
16
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
|
17
|
-
var functionName = getFunctionComponentName(innerType);
|
|
18
|
-
return outerType.displayName || (functionName !== '' ? "".concat(wrapperName, "(").concat(functionName, ")") : wrapperName);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* cherry-pick from
|
|
23
|
-
* https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js
|
|
24
|
-
* originally forked from recompose/getDisplayName with added IE11 support
|
|
25
|
-
*/
|
|
26
|
-
export default function getDisplayName(Component) {
|
|
27
|
-
if (Component == null) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
if (typeof Component === 'string') {
|
|
31
|
-
return Component;
|
|
32
|
-
}
|
|
33
|
-
if (typeof Component === 'function') {
|
|
34
|
-
return getFunctionComponentName(Component, 'Component');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// TypeScript can't have components as objects but they exist in the form of `memo` or `Suspense`
|
|
38
|
-
if (_typeof(Component) === 'object') {
|
|
39
|
-
switch (Component.$$typeof) {
|
|
40
|
-
case ForwardRef:
|
|
41
|
-
return getWrappedName(Component, Component.render, 'ForwardRef');
|
|
42
|
-
case Memo:
|
|
43
|
-
return getWrappedName(Component, Component.type, 'memo');
|
|
44
|
-
default:
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// A change of the browser zoom change the scrollbar size.
|
|
2
|
-
// Credit https://github.com/twbs/bootstrap/blob/488fd8afc535ca3a6ad4dc581f5e89217b6a36ac/js/src/util/scrollbar.js#L14-L18
|
|
3
|
-
export default function getScrollbarSize(doc) {
|
|
4
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
5
|
-
var documentWidth = doc.documentElement.clientWidth;
|
|
6
|
-
return Math.abs(window.innerWidth - documentWidth);
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './getScrollbarSize';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Gets only the valid children of a component,
|
|
5
|
-
* and ignores any nullish or falsy child.
|
|
6
|
-
*
|
|
7
|
-
* @param children the children
|
|
8
|
-
*/
|
|
9
|
-
export default function getValidReactChildren(children) {
|
|
10
|
-
return React.Children.toArray(children).filter(function (child) {
|
|
11
|
-
return /*#__PURE__*/React.isValidElement(child);
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './getValidReactChildren';
|
package/legacy/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mui/utils v5.15.14
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
export { default as chainPropTypes } from './chainPropTypes';
|
|
9
|
-
export { default as deepmerge } from './deepmerge';
|
|
10
|
-
export { isPlainObject } from './deepmerge';
|
|
11
|
-
export { default as elementAcceptingRef } from './elementAcceptingRef';
|
|
12
|
-
export { default as elementTypeAcceptingRef } from './elementTypeAcceptingRef';
|
|
13
|
-
export { default as exactProp } from './exactProp';
|
|
14
|
-
export { default as formatMuiErrorMessage } from './formatMuiErrorMessage';
|
|
15
|
-
export { default as getDisplayName } from './getDisplayName';
|
|
16
|
-
export { default as HTMLElementType } from './HTMLElementType';
|
|
17
|
-
export { default as ponyfillGlobal } from './ponyfillGlobal';
|
|
18
|
-
export { default as refType } from './refType';
|
|
19
|
-
export { default as unstable_capitalize } from './capitalize';
|
|
20
|
-
export { default as unstable_createChainedFunction } from './createChainedFunction';
|
|
21
|
-
export { default as unstable_debounce } from './debounce';
|
|
22
|
-
export { default as unstable_deprecatedPropType } from './deprecatedPropType';
|
|
23
|
-
export { default as unstable_isMuiElement } from './isMuiElement';
|
|
24
|
-
export { default as unstable_ownerDocument } from './ownerDocument';
|
|
25
|
-
export { default as unstable_ownerWindow } from './ownerWindow';
|
|
26
|
-
export { default as unstable_requirePropFactory } from './requirePropFactory';
|
|
27
|
-
export { default as unstable_setRef } from './setRef';
|
|
28
|
-
export { default as unstable_useEnhancedEffect } from './useEnhancedEffect';
|
|
29
|
-
export { default as unstable_useId } from './useId';
|
|
30
|
-
export { default as unstable_unsupportedProp } from './unsupportedProp';
|
|
31
|
-
export { default as unstable_useControlled } from './useControlled';
|
|
32
|
-
export { default as unstable_useEventCallback } from './useEventCallback';
|
|
33
|
-
export { default as unstable_useForkRef } from './useForkRef';
|
|
34
|
-
export { default as unstable_useLazyRef } from './useLazyRef';
|
|
35
|
-
export { default as unstable_useTimeout, Timeout as unstable_Timeout } from './useTimeout';
|
|
36
|
-
export { default as unstable_useOnMount } from './useOnMount';
|
|
37
|
-
export { default as unstable_useIsFocusVisible } from './useIsFocusVisible';
|
|
38
|
-
export { default as unstable_getScrollbarSize } from './getScrollbarSize';
|
|
39
|
-
export { detectScrollType as unstable_detectScrollType, getNormalizedScrollLeft as unstable_getNormalizedScrollLeft } from './scrollLeft';
|
|
40
|
-
export { default as usePreviousProps } from './usePreviousProps';
|
|
41
|
-
export { default as getValidReactChildren } from './getValidReactChildren';
|
|
42
|
-
export { default as visuallyHidden } from './visuallyHidden';
|
|
43
|
-
export { default as integerPropType } from './integerPropType';
|
|
44
|
-
export { default as internal_resolveProps } from './resolveProps';
|
|
45
|
-
export { default as unstable_composeClasses } from './composeClasses';
|
|
46
|
-
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
|
|
47
|
-
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
|
|
48
|
-
export * from './generateUtilityClass';
|
|
49
|
-
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
|
|
50
|
-
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
|
|
51
|
-
export { default as clamp } from './clamp';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
export function getTypeByValue(value) {
|
|
3
|
-
var valueType = _typeof(value);
|
|
4
|
-
switch (valueType) {
|
|
5
|
-
case 'number':
|
|
6
|
-
if (Number.isNaN(value)) {
|
|
7
|
-
return 'NaN';
|
|
8
|
-
}
|
|
9
|
-
if (!Number.isFinite(value)) {
|
|
10
|
-
return 'Infinity';
|
|
11
|
-
}
|
|
12
|
-
if (value !== Math.floor(value)) {
|
|
13
|
-
return 'float';
|
|
14
|
-
}
|
|
15
|
-
return 'number';
|
|
16
|
-
case 'object':
|
|
17
|
-
if (value === null) {
|
|
18
|
-
return 'null';
|
|
19
|
-
}
|
|
20
|
-
return value.constructor.name;
|
|
21
|
-
default:
|
|
22
|
-
return valueType;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// IE 11 support
|
|
27
|
-
function ponyfillIsInteger(x) {
|
|
28
|
-
// eslint-disable-next-line no-restricted-globals
|
|
29
|
-
return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
|
|
30
|
-
}
|
|
31
|
-
var isInteger = Number.isInteger || ponyfillIsInteger;
|
|
32
|
-
function requiredInteger(props, propName, componentName, location) {
|
|
33
|
-
var propValue = props[propName];
|
|
34
|
-
if (propValue == null || !isInteger(propValue)) {
|
|
35
|
-
var propType = getTypeByValue(propValue);
|
|
36
|
-
return new RangeError("Invalid ".concat(location, " `").concat(propName, "` of type `").concat(propType, "` supplied to `").concat(componentName, "`, expected `integer`."));
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
function validator(props, propName) {
|
|
41
|
-
var propValue = props[propName];
|
|
42
|
-
if (propValue === undefined) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
for (var _len = arguments.length, other = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
46
|
-
other[_key - 2] = arguments[_key];
|
|
47
|
-
}
|
|
48
|
-
return requiredInteger.apply(void 0, [props, propName].concat(other));
|
|
49
|
-
}
|
|
50
|
-
function validatorNoop() {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
validator.isRequired = requiredInteger;
|
|
54
|
-
validatorNoop.isRequired = validatorNoop;
|
|
55
|
-
export default process.env.NODE_ENV === 'production' ? validatorNoop : validator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './isMuiElement';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export default function isMuiElement(element, muiNames) {
|
|
3
|
-
var _muiName, _element$type;
|
|
4
|
-
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
5
|
-
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
6
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
7
|
-
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ownerDocument';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ownerWindow';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ponyfillGlobal';
|
package/legacy/refType/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './refType';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './requirePropFactory';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
export default function requirePropFactory(componentNameInError, Component) {
|
|
3
|
-
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
return function () {
|
|
5
|
-
return null;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// eslint-disable-next-line react/forbid-foreign-prop-types
|
|
10
|
-
var prevPropTypes = Component ? _extends({}, Component.propTypes) : null;
|
|
11
|
-
var requireProp = function requireProp(requiredProp) {
|
|
12
|
-
return function (props, propName, componentName, location, propFullName) {
|
|
13
|
-
var propFullNameSafe = propFullName || propName;
|
|
14
|
-
var defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
|
|
15
|
-
if (defaultTypeChecker) {
|
|
16
|
-
for (var _len = arguments.length, args = new Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
|
|
17
|
-
args[_key - 5] = arguments[_key];
|
|
18
|
-
}
|
|
19
|
-
var typeCheckerResult = defaultTypeChecker.apply(void 0, [props, propName, componentName, location, propFullName].concat(args));
|
|
20
|
-
if (typeCheckerResult) {
|
|
21
|
-
return typeCheckerResult;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
|
|
25
|
-
return new Error("The prop `".concat(propFullNameSafe, "` of ") + "`".concat(componentNameInError, "` can only be used together with the `").concat(requiredProp, "` prop."));
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
return requireProp;
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './resolveProps';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
/**
|
|
3
|
-
* Add keys, values of `defaultProps` that does not exist in `props`
|
|
4
|
-
* @param {object} defaultProps
|
|
5
|
-
* @param {object} props
|
|
6
|
-
* @returns {object} resolved props
|
|
7
|
-
*/
|
|
8
|
-
export default function resolveProps(defaultProps, props) {
|
|
9
|
-
var output = _extends({}, props);
|
|
10
|
-
Object.keys(defaultProps).forEach(function (propName) {
|
|
11
|
-
if (propName.toString().match(/^(components|slots)$/)) {
|
|
12
|
-
output[propName] = _extends({}, defaultProps[propName], output[propName]);
|
|
13
|
-
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
14
|
-
var defaultSlotProps = defaultProps[propName] || {};
|
|
15
|
-
var slotProps = props[propName];
|
|
16
|
-
output[propName] = {};
|
|
17
|
-
if (!slotProps || !Object.keys(slotProps)) {
|
|
18
|
-
// Reduce the iteration if the slot props is empty
|
|
19
|
-
output[propName] = defaultSlotProps;
|
|
20
|
-
} else if (!defaultSlotProps || !Object.keys(defaultSlotProps)) {
|
|
21
|
-
// Reduce the iteration if the default slot props is empty
|
|
22
|
-
output[propName] = slotProps;
|
|
23
|
-
} else {
|
|
24
|
-
output[propName] = _extends({}, slotProps);
|
|
25
|
-
Object.keys(defaultSlotProps).forEach(function (slotPropName) {
|
|
26
|
-
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
} else if (output[propName] === undefined) {
|
|
30
|
-
output[propName] = defaultProps[propName];
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return output;
|
|
34
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './scrollLeft';
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Source from https://github.com/alitaheri/normalize-scroll-left
|
|
2
|
-
var cachedType;
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Based on the jquery plugin https://github.com/othree/jquery.rtl-scroll-type
|
|
6
|
-
*
|
|
7
|
-
* Types of scrollLeft, assuming scrollWidth=100 and direction is rtl.
|
|
8
|
-
*
|
|
9
|
-
* Type | <- Most Left | Most Right -> | Initial
|
|
10
|
-
* ---------------- | ------------ | ------------- | -------
|
|
11
|
-
* default | 0 | 100 | 100
|
|
12
|
-
* negative (spec*) | -100 | 0 | 0
|
|
13
|
-
* reverse | 100 | 0 | 0
|
|
14
|
-
*
|
|
15
|
-
* Edge 85: default
|
|
16
|
-
* Safari 14: negative
|
|
17
|
-
* Chrome 85: negative
|
|
18
|
-
* Firefox 81: negative
|
|
19
|
-
* IE11: reverse
|
|
20
|
-
*
|
|
21
|
-
* spec* https://drafts.csswg.org/cssom-view/#dom-window-scroll
|
|
22
|
-
*/
|
|
23
|
-
export function detectScrollType() {
|
|
24
|
-
if (cachedType) {
|
|
25
|
-
return cachedType;
|
|
26
|
-
}
|
|
27
|
-
var dummy = document.createElement('div');
|
|
28
|
-
var container = document.createElement('div');
|
|
29
|
-
container.style.width = '10px';
|
|
30
|
-
container.style.height = '1px';
|
|
31
|
-
dummy.appendChild(container);
|
|
32
|
-
dummy.dir = 'rtl';
|
|
33
|
-
dummy.style.fontSize = '14px';
|
|
34
|
-
dummy.style.width = '4px';
|
|
35
|
-
dummy.style.height = '1px';
|
|
36
|
-
dummy.style.position = 'absolute';
|
|
37
|
-
dummy.style.top = '-1000px';
|
|
38
|
-
dummy.style.overflow = 'scroll';
|
|
39
|
-
document.body.appendChild(dummy);
|
|
40
|
-
cachedType = 'reverse';
|
|
41
|
-
if (dummy.scrollLeft > 0) {
|
|
42
|
-
cachedType = 'default';
|
|
43
|
-
} else {
|
|
44
|
-
dummy.scrollLeft = 1;
|
|
45
|
-
if (dummy.scrollLeft === 0) {
|
|
46
|
-
cachedType = 'negative';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
document.body.removeChild(dummy);
|
|
50
|
-
return cachedType;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Based on https://stackoverflow.com/a/24394376
|
|
54
|
-
export function getNormalizedScrollLeft(element, direction) {
|
|
55
|
-
var scrollLeft = element.scrollLeft;
|
|
56
|
-
|
|
57
|
-
// Perform the calculations only when direction is rtl to avoid messing up the ltr behavior
|
|
58
|
-
if (direction !== 'rtl') {
|
|
59
|
-
return scrollLeft;
|
|
60
|
-
}
|
|
61
|
-
var type = detectScrollType();
|
|
62
|
-
switch (type) {
|
|
63
|
-
case 'negative':
|
|
64
|
-
return element.scrollWidth - element.clientWidth + scrollLeft;
|
|
65
|
-
case 'reverse':
|
|
66
|
-
return element.scrollWidth - element.clientWidth - scrollLeft;
|
|
67
|
-
default:
|
|
68
|
-
return scrollLeft;
|
|
69
|
-
}
|
|
70
|
-
}
|
package/legacy/setRef/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './setRef';
|
package/legacy/setRef/setRef.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODO v5: consider making it private
|
|
3
|
-
*
|
|
4
|
-
* passes {value} to {ref}
|
|
5
|
-
*
|
|
6
|
-
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
|
7
|
-
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
|
|
8
|
-
* https://github.com/mui/material-ui/issues/13539
|
|
9
|
-
*
|
|
10
|
-
* Useful if you want to expose the ref of an inner component to the public API
|
|
11
|
-
* while still using it inside the component.
|
|
12
|
-
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
13
|
-
*/
|
|
14
|
-
export default function setRef(ref, value) {
|
|
15
|
-
if (typeof ref === 'function') {
|
|
16
|
-
ref(value);
|
|
17
|
-
} else if (ref) {
|
|
18
|
-
ref.current = value;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './unsupportedProp';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default function unsupportedProp(props, propName, componentName, location, propFullName) {
|
|
2
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
var propFullNameSafe = propFullName || propName;
|
|
6
|
-
if (typeof props[propName] !== 'undefined') {
|
|
7
|
-
return new Error("The prop `".concat(propFullNameSafe, "` is not supported. Please remove it."));
|
|
8
|
-
}
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './useControlled';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
export default function useControlled(_ref) {
|
|
6
|
-
var controlled = _ref.controlled,
|
|
7
|
-
defaultProp = _ref.default,
|
|
8
|
-
name = _ref.name,
|
|
9
|
-
_ref$state = _ref.state,
|
|
10
|
-
state = _ref$state === void 0 ? 'value' : _ref$state;
|
|
11
|
-
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
12
|
-
var _React$useRef = React.useRef(controlled !== undefined),
|
|
13
|
-
isControlled = _React$useRef.current;
|
|
14
|
-
var _React$useState = React.useState(defaultProp),
|
|
15
|
-
valueState = _React$useState[0],
|
|
16
|
-
setValue = _React$useState[1];
|
|
17
|
-
var value = isControlled ? controlled : valueState;
|
|
18
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
19
|
-
React.useEffect(function () {
|
|
20
|
-
if (isControlled !== (controlled !== undefined)) {
|
|
21
|
-
console.error(["MUI: A component is changing the ".concat(isControlled ? '' : 'un', "controlled ").concat(state, " state of ").concat(name, " to be ").concat(isControlled ? 'un' : '', "controlled."), 'Elements should not switch from uncontrolled to controlled (or vice versa).', "Decide between using a controlled or uncontrolled ".concat(name, " ") + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
22
|
-
}
|
|
23
|
-
}, [state, name, controlled]);
|
|
24
|
-
var _React$useRef2 = React.useRef(defaultProp),
|
|
25
|
-
defaultValue = _React$useRef2.current;
|
|
26
|
-
React.useEffect(function () {
|
|
27
|
-
if (!isControlled && defaultValue !== defaultProp) {
|
|
28
|
-
console.error(["MUI: A component is changing the default ".concat(state, " state of an uncontrolled ").concat(name, " after being initialized. ") + "To suppress this warning opt to use a controlled ".concat(name, ".")].join('\n'));
|
|
29
|
-
}
|
|
30
|
-
}, [JSON.stringify(defaultProp)]);
|
|
31
|
-
}
|
|
32
|
-
var setValueIfUncontrolled = React.useCallback(function (newValue) {
|
|
33
|
-
if (!isControlled) {
|
|
34
|
-
setValue(newValue);
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
return [value, setValueIfUncontrolled];
|
|
38
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './useEnhancedEffect';
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
var useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
13
|
-
export default useEnhancedEffect;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './useEventCallback';
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
var ref = React.useRef(fn);
|
|
13
|
-
useEnhancedEffect(function () {
|
|
14
|
-
ref.current = fn;
|
|
15
|
-
});
|
|
16
|
-
return React.useRef(function () {
|
|
17
|
-
return (
|
|
18
|
-
// @ts-expect-error hide `this`
|
|
19
|
-
(0, ref.current).apply(void 0, arguments)
|
|
20
|
-
);
|
|
21
|
-
}).current;
|
|
22
|
-
}
|
|
23
|
-
export default useEventCallback;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './useForkRef';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import setRef from '../setRef';
|
|
5
|
-
export default function useForkRef() {
|
|
6
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7
|
-
refs[_key] = arguments[_key];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
11
|
-
* This means react will call the old forkRef with `null` and the new forkRef
|
|
12
|
-
* with the ref. Cleanup naturally emerges from this behavior.
|
|
13
|
-
*/
|
|
14
|
-
return React.useMemo(function () {
|
|
15
|
-
if (refs.every(function (ref) {
|
|
16
|
-
return ref == null;
|
|
17
|
-
})) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return function (instance) {
|
|
21
|
-
refs.forEach(function (ref) {
|
|
22
|
-
setRef(ref, instance);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, refs);
|
|
27
|
-
}
|
package/legacy/useId/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './useId';
|
package/legacy/useId/useId.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
var globalId = 0;
|
|
5
|
-
function useGlobalId(idOverride) {
|
|
6
|
-
var _React$useState = React.useState(idOverride),
|
|
7
|
-
defaultId = _React$useState[0],
|
|
8
|
-
setDefaultId = _React$useState[1];
|
|
9
|
-
var id = idOverride || defaultId;
|
|
10
|
-
React.useEffect(function () {
|
|
11
|
-
if (defaultId == null) {
|
|
12
|
-
// Fallback to this default id when possible.
|
|
13
|
-
// Use the incrementing value for client-side rendering only.
|
|
14
|
-
// We can't use it server-side.
|
|
15
|
-
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
16
|
-
globalId += 1;
|
|
17
|
-
setDefaultId("mui-".concat(globalId));
|
|
18
|
-
}
|
|
19
|
-
}, [defaultId]);
|
|
20
|
-
return id;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
24
|
-
var maybeReactUseId = React['useId'.toString()];
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @example <div id={useId()} />
|
|
28
|
-
* @param idOverride
|
|
29
|
-
* @returns {string}
|
|
30
|
-
*/
|
|
31
|
-
export default function useId(idOverride) {
|
|
32
|
-
if (maybeReactUseId !== undefined) {
|
|
33
|
-
var reactId = maybeReactUseId();
|
|
34
|
-
return idOverride != null ? idOverride : reactId;
|
|
35
|
-
}
|
|
36
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
37
|
-
return useGlobalId(idOverride);
|
|
38
|
-
}
|