@mui/utils 6.0.0-alpha.1 → 6.0.0-alpha.12

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +607 -4
  2. package/deepmerge/deepmerge.js +5 -6
  3. package/exactProp/exactProp.js +3 -3
  4. package/getDisplayName/getDisplayName.d.ts +0 -1
  5. package/getDisplayName/getDisplayName.js +1 -10
  6. package/getDisplayName/index.d.ts +0 -1
  7. package/getDisplayName/index.js +1 -2
  8. package/index.js +1 -1
  9. package/integerPropType/integerPropType.js +1 -8
  10. package/modern/deepmerge/deepmerge.js +5 -6
  11. package/modern/exactProp/exactProp.js +3 -3
  12. package/modern/getDisplayName/getDisplayName.js +1 -10
  13. package/modern/getDisplayName/index.js +1 -2
  14. package/modern/index.js +1 -1
  15. package/modern/integerPropType/integerPropType.js +1 -8
  16. package/modern/requirePropFactory/requirePropFactory.js +3 -2
  17. package/modern/resolveProps/resolveProps.js +10 -4
  18. package/modern/useControlled/useControlled.js +3 -1
  19. package/modern/useTimeout/useTimeout.js +11 -12
  20. package/node/deepmerge/deepmerge.js +5 -7
  21. package/node/exactProp/exactProp.js +3 -4
  22. package/node/getDisplayName/getDisplayName.js +1 -10
  23. package/node/getDisplayName/index.js +2 -15
  24. package/node/index.js +1 -1
  25. package/node/integerPropType/integerPropType.js +1 -8
  26. package/node/requirePropFactory/requirePropFactory.js +3 -3
  27. package/node/resolveProps/resolveProps.js +10 -5
  28. package/node/useControlled/useControlled.js +3 -1
  29. package/node/useTimeout/useTimeout.js +11 -12
  30. package/package.json +2 -2
  31. package/requirePropFactory/requirePropFactory.js +3 -2
  32. package/resolveProps/resolveProps.js +10 -4
  33. package/useControlled/useControlled.js +3 -1
  34. package/useTimeout/useTimeout.js +11 -12
  35. package/legacy/ClassNameGenerator/ClassNameGenerator.js +0 -19
  36. package/legacy/ClassNameGenerator/index.js +0 -1
  37. package/legacy/HTMLElementType/HTMLElementType.js +0 -14
  38. package/legacy/HTMLElementType/index.js +0 -1
  39. package/legacy/capitalize/capitalize.js +0 -11
  40. package/legacy/capitalize/index.js +0 -1
  41. package/legacy/chainPropTypes/chainPropTypes.js +0 -10
  42. package/legacy/chainPropTypes/index.js +0 -1
  43. package/legacy/clamp/clamp.js +0 -6
  44. package/legacy/clamp/index.js +0 -1
  45. package/legacy/composeClasses/composeClasses.js +0 -22
  46. package/legacy/composeClasses/index.js +0 -1
  47. package/legacy/createChainedFunction/createChainedFunction.js +0 -23
  48. package/legacy/createChainedFunction/index.js +0 -1
  49. package/legacy/debounce/debounce.js +0 -22
  50. package/legacy/debounce/index.js +0 -2
  51. package/legacy/deepmerge/deepmerge.js +0 -43
  52. package/legacy/deepmerge/index.js +0 -2
  53. package/legacy/deprecatedPropType/deprecatedPropType.js +0 -15
  54. package/legacy/deprecatedPropType/index.js +0 -1
  55. package/legacy/elementAcceptingRef/elementAcceptingRef.js +0 -41
  56. package/legacy/elementAcceptingRef/index.js +0 -1
  57. package/legacy/elementTypeAcceptingRef/elementTypeAcceptingRef.js +0 -39
  58. package/legacy/elementTypeAcceptingRef/index.js +0 -1
  59. package/legacy/exactProp/exactProp.js +0 -23
  60. package/legacy/exactProp/index.js +0 -1
  61. package/legacy/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -19
  62. package/legacy/formatMuiErrorMessage/index.js +0 -1
  63. package/legacy/generateUtilityClass/generateUtilityClass.js +0 -23
  64. package/legacy/generateUtilityClass/index.js +0 -2
  65. package/legacy/generateUtilityClasses/generateUtilityClasses.js +0 -9
  66. package/legacy/generateUtilityClasses/index.js +0 -1
  67. package/legacy/getDisplayName/getDisplayName.js +0 -49
  68. package/legacy/getDisplayName/index.js +0 -2
  69. package/legacy/getScrollbarSize/getScrollbarSize.js +0 -7
  70. package/legacy/getScrollbarSize/index.js +0 -1
  71. package/legacy/getValidReactChildren/getValidReactChildren.js +0 -13
  72. package/legacy/getValidReactChildren/index.js +0 -1
  73. package/legacy/index.js +0 -51
  74. package/legacy/integerPropType/index.js +0 -2
  75. package/legacy/integerPropType/integerPropType.js +0 -55
  76. package/legacy/isMuiElement/index.js +0 -1
  77. package/legacy/isMuiElement/isMuiElement.js +0 -8
  78. package/legacy/ownerDocument/index.js +0 -1
  79. package/legacy/ownerDocument/ownerDocument.js +0 -3
  80. package/legacy/ownerWindow/index.js +0 -1
  81. package/legacy/ownerWindow/ownerWindow.js +0 -5
  82. package/legacy/ponyfillGlobal/index.js +0 -1
  83. package/legacy/ponyfillGlobal/ponyfillGlobal.js +0 -3
  84. package/legacy/refType/index.js +0 -1
  85. package/legacy/refType/refType.js +0 -3
  86. package/legacy/requirePropFactory/index.js +0 -1
  87. package/legacy/requirePropFactory/requirePropFactory.js +0 -31
  88. package/legacy/resolveProps/index.js +0 -1
  89. package/legacy/resolveProps/resolveProps.js +0 -34
  90. package/legacy/scrollLeft/index.js +0 -1
  91. package/legacy/scrollLeft/scrollLeft.js +0 -70
  92. package/legacy/setRef/index.js +0 -1
  93. package/legacy/setRef/setRef.js +0 -20
  94. package/legacy/unsupportedProp/index.js +0 -1
  95. package/legacy/unsupportedProp/unsupportedProp.js +0 -10
  96. package/legacy/useControlled/index.js +0 -1
  97. package/legacy/useControlled/useControlled.js +0 -38
  98. package/legacy/useEnhancedEffect/index.js +0 -1
  99. package/legacy/useEnhancedEffect/useEnhancedEffect.js +0 -13
  100. package/legacy/useEventCallback/index.js +0 -1
  101. package/legacy/useEventCallback/useEventCallback.js +0 -23
  102. package/legacy/useForkRef/index.js +0 -1
  103. package/legacy/useForkRef/useForkRef.js +0 -27
  104. package/legacy/useId/index.js +0 -1
  105. package/legacy/useId/useId.js +0 -38
  106. package/legacy/useIsFocusVisible/index.js +0 -2
  107. package/legacy/useIsFocusVisible/useIsFocusVisible.js +0 -160
  108. package/legacy/useLazyRef/index.js +0 -1
  109. package/legacy/useLazyRef/useLazyRef.js +0 -19
  110. package/legacy/useLocalStorageState/index.js +0 -1
  111. package/legacy/useLocalStorageState/useLocalStorageState.js +0 -121
  112. package/legacy/useOnMount/index.js +0 -1
  113. package/legacy/useOnMount/useOnMount.js +0 -13
  114. package/legacy/usePreviousProps/index.js +0 -1
  115. package/legacy/usePreviousProps/usePreviousProps.js +0 -11
  116. package/legacy/useTimeout/index.js +0 -2
  117. package/legacy/useTimeout/useTimeout.js +0 -47
  118. package/legacy/visuallyHidden/index.js +0 -1
  119. package/legacy/visuallyHidden/visuallyHidden.js +0 -12
@@ -3,21 +3,11 @@
3
3
  import useLazyRef from '../useLazyRef/useLazyRef';
4
4
  import useOnMount from '../useOnMount/useOnMount';
5
5
  export class Timeout {
6
- constructor() {
7
- this.currentId = null;
8
- this.clear = () => {
9
- if (this.currentId !== null) {
10
- clearTimeout(this.currentId);
11
- this.currentId = null;
12
- }
13
- };
14
- this.disposeEffect = () => {
15
- return this.clear;
16
- };
17
- }
18
6
  static create() {
19
7
  return new Timeout();
20
8
  }
9
+ currentId = null;
10
+
21
11
  /**
22
12
  * Executes `fn` after `delay`, clearing any previously scheduled call.
23
13
  */
@@ -28,6 +18,15 @@ export class Timeout {
28
18
  fn();
29
19
  }, delay);
30
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
+ };
31
30
  }
32
31
  export default function useTimeout() {
33
32
  const timeout = useLazyRef(Timeout.create).current;
@@ -1,19 +0,0 @@
1
- var defaultGenerator = function defaultGenerator(componentName) {
2
- return componentName;
3
- };
4
- var createClassNameGenerator = function createClassNameGenerator() {
5
- var _generate = defaultGenerator;
6
- return {
7
- configure: function configure(generator) {
8
- _generate = generator;
9
- },
10
- generate: function generate(componentName) {
11
- return _generate(componentName);
12
- },
13
- reset: function reset() {
14
- _generate = defaultGenerator;
15
- }
16
- };
17
- };
18
- var ClassNameGenerator = createClassNameGenerator();
19
- export default ClassNameGenerator;
@@ -1 +0,0 @@
1
- export { default } from './ClassNameGenerator';
@@ -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
- var propValue = props[propName];
6
- var safePropName = propFullName || propName;
7
- if (propValue == null) {
8
- return null;
9
- }
10
- if (propValue && propValue.nodeType !== 1) {
11
- return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an HTMLElement.");
12
- }
13
- return null;
14
- }
@@ -1 +0,0 @@
1
- export { default } from './HTMLElementType';
@@ -1,11 +0,0 @@
1
- import _formatMuiErrorMessage 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." : _formatMuiErrorMessage(7));
9
- }
10
- return string.charAt(0).toUpperCase() + string.slice(1);
11
- }
@@ -1 +0,0 @@
1
- export { default } from './capitalize';
@@ -1,10 +0,0 @@
1
- export default function chainPropTypes(propType1, propType2) {
2
- if (process.env.NODE_ENV === 'production') {
3
- return function () {
4
- return null;
5
- };
6
- }
7
- return function validate() {
8
- return propType1.apply(void 0, arguments) || propType2.apply(void 0, arguments);
9
- };
10
- }
@@ -1 +0,0 @@
1
- export { default } from './chainPropTypes';
@@ -1,6 +0,0 @@
1
- function clamp(val) {
2
- var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MIN_SAFE_INTEGER;
3
- var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.MAX_SAFE_INTEGER;
4
- return Math.max(min, Math.min(val, max));
5
- }
6
- export default clamp;
@@ -1 +0,0 @@
1
- export { default } from './clamp';
@@ -1,22 +0,0 @@
1
- export default function composeClasses(slots, getUtilityClass) {
2
- var classes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3
- var output = {};
4
- Object.keys(slots).forEach(
5
- // `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
6
- // @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208
7
- function (slot) {
8
- output[slot] = slots[slot].reduce(function (acc, key) {
9
- if (key) {
10
- var utilityClass = getUtilityClass(key);
11
- if (utilityClass !== '') {
12
- acc.push(utilityClass);
13
- }
14
- if (classes && classes[key]) {
15
- acc.push(classes[key]);
16
- }
17
- }
18
- return acc;
19
- }, []).join(' ');
20
- });
21
- return output;
22
- }
@@ -1 +0,0 @@
1
- export { default } from './composeClasses';
@@ -1,23 +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() {
8
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
9
- funcs[_key] = arguments[_key];
10
- }
11
- return funcs.reduce(function (acc, func) {
12
- if (func == null) {
13
- return acc;
14
- }
15
- return function chainedFunction() {
16
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
17
- args[_key2] = arguments[_key2];
18
- }
19
- acc.apply(this, args);
20
- func.apply(this, args);
21
- };
22
- }, function () {});
23
- }
@@ -1 +0,0 @@
1
- export { default } from './createChainedFunction';
@@ -1,22 +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) {
4
- var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
5
- var timeout;
6
- function debounced() {
7
- var _this = this;
8
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9
- args[_key] = arguments[_key];
10
- }
11
- var later = function later() {
12
- // @ts-ignore
13
- func.apply(_this, args);
14
- };
15
- clearTimeout(timeout);
16
- timeout = setTimeout(later, wait);
17
- }
18
- debounced.clear = function () {
19
- clearTimeout(timeout);
20
- };
21
- return debounced;
22
- }
@@ -1,2 +0,0 @@
1
- export { default } from './debounce';
2
- export * from './debounce';
@@ -1,43 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _typeof from "@babel/runtime/helpers/esm/typeof";
3
- // https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
4
- export function isPlainObject(item) {
5
- if (_typeof(item) !== 'object' || item === null) {
6
- return false;
7
- }
8
- var prototype = Object.getPrototypeOf(item);
9
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
10
- }
11
- function deepClone(source) {
12
- if (!isPlainObject(source)) {
13
- return source;
14
- }
15
- var output = {};
16
- Object.keys(source).forEach(function (key) {
17
- output[key] = deepClone(source[key]);
18
- });
19
- return output;
20
- }
21
- export default function deepmerge(target, source) {
22
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
23
- clone: true
24
- };
25
- var output = options.clone ? _extends({}, target) : target;
26
- if (isPlainObject(target) && isPlainObject(source)) {
27
- Object.keys(source).forEach(function (key) {
28
- // Avoid prototype pollution
29
- if (key === '__proto__') {
30
- return;
31
- }
32
- if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
33
- // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
34
- output[key] = deepmerge(target[key], source[key], options);
35
- } else if (options.clone) {
36
- output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];
37
- } else {
38
- output[key] = source[key];
39
- }
40
- });
41
- }
42
- return output;
43
- }
@@ -1,2 +0,0 @@
1
- export { default } from './deepmerge';
2
- export * from './deepmerge';
@@ -1,15 +0,0 @@
1
- export default function deprecatedPropType(validator, reason) {
2
- if (process.env.NODE_ENV === 'production') {
3
- return function () {
4
- return null;
5
- };
6
- }
7
- return function (props, propName, componentName, location, propFullName) {
8
- var componentNameSafe = componentName || '<<anonymous>>';
9
- var propFullNameSafe = propFullName || propName;
10
- if (typeof props[propName] !== 'undefined') {
11
- return new Error("The ".concat(location, " `").concat(propFullNameSafe, "` of ") + "`".concat(componentNameSafe, "` is deprecated. ").concat(reason));
12
- }
13
- return null;
14
- };
15
- }
@@ -1 +0,0 @@
1
- export { default } from './deprecatedPropType';
@@ -1,41 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import chainPropTypes from '../chainPropTypes';
3
- function isClassComponent(elementType) {
4
- // elementType.prototype?.isReactComponent
5
- var _elementType$prototyp = elementType.prototype,
6
- prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;
7
- return Boolean(prototype.isReactComponent);
8
- }
9
- function acceptingRef(props, propName, componentName, location, propFullName) {
10
- var element = props[propName];
11
- var safePropName = propFullName || propName;
12
- if (element == null ||
13
- // When server-side rendering React doesn't warn either.
14
- // This is not an accurate check for SSR.
15
- // This is only in place for Emotion compat.
16
- // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
17
- typeof window === 'undefined') {
18
- return null;
19
- }
20
- var warningHint;
21
- var elementType = element.type;
22
- /**
23
- * Blacklisting instead of whitelisting
24
- *
25
- * Blacklisting will miss some components, such as React.Fragment. Those will at least
26
- * trigger a warning in React.
27
- * We can't whitelist because there is no safe way to detect React.forwardRef
28
- * or class components. "Safe" means there's no public API.
29
- *
30
- */
31
- if (typeof elementType === 'function' && !isClassComponent(elementType)) {
32
- warningHint = 'Did you accidentally use a plain function component for an element instead?';
33
- }
34
- if (warningHint !== undefined) {
35
- return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an element that can hold a ref. ".concat(warningHint, " ") + 'For more information see https://mui.com/r/caveat-with-refs-guide');
36
- }
37
- return null;
38
- }
39
- var elementAcceptingRef = chainPropTypes(PropTypes.element, acceptingRef);
40
- elementAcceptingRef.isRequired = chainPropTypes(PropTypes.element.isRequired, acceptingRef);
41
- export default elementAcceptingRef;
@@ -1 +0,0 @@
1
- export { default } from './elementAcceptingRef';
@@ -1,39 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import chainPropTypes from '../chainPropTypes';
3
- function isClassComponent(elementType) {
4
- // elementType.prototype?.isReactComponent
5
- var _elementType$prototyp = elementType.prototype,
6
- prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;
7
- return Boolean(prototype.isReactComponent);
8
- }
9
- function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
10
- var propValue = props[propName];
11
- var safePropName = propFullName || propName;
12
- if (propValue == null ||
13
- // When server-side rendering React doesn't warn either.
14
- // This is not an accurate check for SSR.
15
- // This is only in place for emotion compat.
16
- // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
17
- typeof window === 'undefined') {
18
- return null;
19
- }
20
- var warningHint;
21
-
22
- /**
23
- * Blacklisting instead of whitelisting
24
- *
25
- * Blacklisting will miss some components, such as React.Fragment. Those will at least
26
- * trigger a warning in React.
27
- * We can't whitelist because there is no safe way to detect React.forwardRef
28
- * or class components. "Safe" means there's no public API.
29
- *
30
- */
31
- if (typeof propValue === 'function' && !isClassComponent(propValue)) {
32
- warningHint = 'Did you accidentally provide a plain function component instead?';
33
- }
34
- if (warningHint !== undefined) {
35
- return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an element type that can hold a ref. ".concat(warningHint, " ") + 'For more information see https://mui.com/r/caveat-with-refs-guide');
36
- }
37
- return null;
38
- }
39
- export default chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
@@ -1 +0,0 @@
1
- export { default } from './elementTypeAcceptingRef';
@@ -1,23 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- // This module is based on https://github.com/airbnb/prop-types-exact repository.
4
- // However, in order to reduce the number of dependencies and to remove some extra safe checks
5
- // the module was forked.
6
-
7
- var specialProperty = "exact-prop: \u200B";
8
- export default function exactProp(propTypes) {
9
- if (process.env.NODE_ENV === 'production') {
10
- return propTypes;
11
- }
12
- return _extends({}, propTypes, _defineProperty({}, specialProperty, function (props) {
13
- var unsupportedProps = Object.keys(props).filter(function (prop) {
14
- return !propTypes.hasOwnProperty(prop);
15
- });
16
- if (unsupportedProps.length > 0) {
17
- return new Error("The following props are not supported: ".concat(unsupportedProps.map(function (prop) {
18
- return "`".concat(prop, "`");
19
- }).join(', '), ". Please remove them."));
20
- }
21
- return null;
22
- }));
23
- }
@@ -1 +0,0 @@
1
- export { default } from './exactProp';
@@ -1,19 +0,0 @@
1
- /**
2
- * WARNING: Don't import this directly.
3
- * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
4
- * @param {number} code
5
- */
6
- export default function formatMuiErrorMessage(code) {
7
- // Apply babel-plugin-transform-template-literals in loose mode
8
- // loose mode is safe if we're concatenating primitives
9
- // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
10
- /* eslint-disable prefer-template */
11
- var url = 'https://mui.com/production-error/?code=' + code;
12
- for (var i = 1; i < arguments.length; i += 1) {
13
- // rest params over-transpile for this case
14
- // eslint-disable-next-line prefer-rest-params
15
- url += '&args[]=' + encodeURIComponent(arguments[i]);
16
- }
17
- return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
18
- /* eslint-enable prefer-template */
19
- }
@@ -1 +0,0 @@
1
- export { default } from './formatMuiErrorMessage';
@@ -1,23 +0,0 @@
1
- import ClassNameGenerator from '../ClassNameGenerator';
2
- export var globalStateClasses = {
3
- active: 'active',
4
- checked: 'checked',
5
- completed: 'completed',
6
- disabled: 'disabled',
7
- error: 'error',
8
- expanded: 'expanded',
9
- focused: 'focused',
10
- focusVisible: 'focusVisible',
11
- open: 'open',
12
- readOnly: 'readOnly',
13
- required: 'required',
14
- selected: 'selected'
15
- };
16
- export default function generateUtilityClass(componentName, slot) {
17
- var globalStatePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Mui';
18
- var globalStateClass = globalStateClasses[slot];
19
- return globalStateClass ? "".concat(globalStatePrefix, "-").concat(globalStateClass) : "".concat(ClassNameGenerator.generate(componentName), "-").concat(slot);
20
- }
21
- export function isGlobalState(slot) {
22
- return globalStateClasses[slot] !== undefined;
23
- }
@@ -1,2 +0,0 @@
1
- export { default } from './generateUtilityClass';
2
- export * from './generateUtilityClass';
@@ -1,9 +0,0 @@
1
- import generateUtilityClass from '../generateUtilityClass';
2
- export default function generateUtilityClasses(componentName, slots) {
3
- var globalStatePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Mui';
4
- var result = {};
5
- slots.forEach(function (slot) {
6
- result[slot] = generateUtilityClass(componentName, slot, globalStatePrefix);
7
- });
8
- return result;
9
- }
@@ -1 +0,0 @@
1
- export { default } from './generateUtilityClasses';
@@ -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,2 +0,0 @@
1
- export { default } from './getDisplayName';
2
- export * from './getDisplayName';
@@ -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 v6.0.0-alpha.1
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,2 +0,0 @@
1
- export { default } from './integerPropType';
2
- export * from './integerPropType';