@mui/utils 6.0.0-alpha.1 → 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.
Files changed (101) hide show
  1. package/CHANGELOG.md +114 -2
  2. package/getDisplayName/getDisplayName.d.ts +0 -1
  3. package/getDisplayName/getDisplayName.js +1 -10
  4. package/getDisplayName/index.d.ts +0 -1
  5. package/getDisplayName/index.js +1 -2
  6. package/index.js +1 -1
  7. package/integerPropType/integerPropType.js +1 -8
  8. package/modern/getDisplayName/getDisplayName.js +1 -10
  9. package/modern/getDisplayName/index.js +1 -2
  10. package/modern/index.js +1 -1
  11. package/modern/integerPropType/integerPropType.js +1 -8
  12. package/node/getDisplayName/getDisplayName.js +1 -10
  13. package/node/getDisplayName/index.js +2 -15
  14. package/node/index.js +1 -1
  15. package/node/integerPropType/integerPropType.js +1 -8
  16. package/package.json +1 -1
  17. package/legacy/ClassNameGenerator/ClassNameGenerator.js +0 -19
  18. package/legacy/ClassNameGenerator/index.js +0 -1
  19. package/legacy/HTMLElementType/HTMLElementType.js +0 -14
  20. package/legacy/HTMLElementType/index.js +0 -1
  21. package/legacy/capitalize/capitalize.js +0 -11
  22. package/legacy/capitalize/index.js +0 -1
  23. package/legacy/chainPropTypes/chainPropTypes.js +0 -10
  24. package/legacy/chainPropTypes/index.js +0 -1
  25. package/legacy/clamp/clamp.js +0 -6
  26. package/legacy/clamp/index.js +0 -1
  27. package/legacy/composeClasses/composeClasses.js +0 -22
  28. package/legacy/composeClasses/index.js +0 -1
  29. package/legacy/createChainedFunction/createChainedFunction.js +0 -23
  30. package/legacy/createChainedFunction/index.js +0 -1
  31. package/legacy/debounce/debounce.js +0 -22
  32. package/legacy/debounce/index.js +0 -2
  33. package/legacy/deepmerge/deepmerge.js +0 -43
  34. package/legacy/deepmerge/index.js +0 -2
  35. package/legacy/deprecatedPropType/deprecatedPropType.js +0 -15
  36. package/legacy/deprecatedPropType/index.js +0 -1
  37. package/legacy/elementAcceptingRef/elementAcceptingRef.js +0 -41
  38. package/legacy/elementAcceptingRef/index.js +0 -1
  39. package/legacy/elementTypeAcceptingRef/elementTypeAcceptingRef.js +0 -39
  40. package/legacy/elementTypeAcceptingRef/index.js +0 -1
  41. package/legacy/exactProp/exactProp.js +0 -23
  42. package/legacy/exactProp/index.js +0 -1
  43. package/legacy/formatMuiErrorMessage/formatMuiErrorMessage.js +0 -19
  44. package/legacy/formatMuiErrorMessage/index.js +0 -1
  45. package/legacy/generateUtilityClass/generateUtilityClass.js +0 -23
  46. package/legacy/generateUtilityClass/index.js +0 -2
  47. package/legacy/generateUtilityClasses/generateUtilityClasses.js +0 -9
  48. package/legacy/generateUtilityClasses/index.js +0 -1
  49. package/legacy/getDisplayName/getDisplayName.js +0 -49
  50. package/legacy/getDisplayName/index.js +0 -2
  51. package/legacy/getScrollbarSize/getScrollbarSize.js +0 -7
  52. package/legacy/getScrollbarSize/index.js +0 -1
  53. package/legacy/getValidReactChildren/getValidReactChildren.js +0 -13
  54. package/legacy/getValidReactChildren/index.js +0 -1
  55. package/legacy/index.js +0 -51
  56. package/legacy/integerPropType/index.js +0 -2
  57. package/legacy/integerPropType/integerPropType.js +0 -55
  58. package/legacy/isMuiElement/index.js +0 -1
  59. package/legacy/isMuiElement/isMuiElement.js +0 -8
  60. package/legacy/ownerDocument/index.js +0 -1
  61. package/legacy/ownerDocument/ownerDocument.js +0 -3
  62. package/legacy/ownerWindow/index.js +0 -1
  63. package/legacy/ownerWindow/ownerWindow.js +0 -5
  64. package/legacy/ponyfillGlobal/index.js +0 -1
  65. package/legacy/ponyfillGlobal/ponyfillGlobal.js +0 -3
  66. package/legacy/refType/index.js +0 -1
  67. package/legacy/refType/refType.js +0 -3
  68. package/legacy/requirePropFactory/index.js +0 -1
  69. package/legacy/requirePropFactory/requirePropFactory.js +0 -31
  70. package/legacy/resolveProps/index.js +0 -1
  71. package/legacy/resolveProps/resolveProps.js +0 -34
  72. package/legacy/scrollLeft/index.js +0 -1
  73. package/legacy/scrollLeft/scrollLeft.js +0 -70
  74. package/legacy/setRef/index.js +0 -1
  75. package/legacy/setRef/setRef.js +0 -20
  76. package/legacy/unsupportedProp/index.js +0 -1
  77. package/legacy/unsupportedProp/unsupportedProp.js +0 -10
  78. package/legacy/useControlled/index.js +0 -1
  79. package/legacy/useControlled/useControlled.js +0 -38
  80. package/legacy/useEnhancedEffect/index.js +0 -1
  81. package/legacy/useEnhancedEffect/useEnhancedEffect.js +0 -13
  82. package/legacy/useEventCallback/index.js +0 -1
  83. package/legacy/useEventCallback/useEventCallback.js +0 -23
  84. package/legacy/useForkRef/index.js +0 -1
  85. package/legacy/useForkRef/useForkRef.js +0 -27
  86. package/legacy/useId/index.js +0 -1
  87. package/legacy/useId/useId.js +0 -38
  88. package/legacy/useIsFocusVisible/index.js +0 -2
  89. package/legacy/useIsFocusVisible/useIsFocusVisible.js +0 -160
  90. package/legacy/useLazyRef/index.js +0 -1
  91. package/legacy/useLazyRef/useLazyRef.js +0 -19
  92. package/legacy/useLocalStorageState/index.js +0 -1
  93. package/legacy/useLocalStorageState/useLocalStorageState.js +0 -121
  94. package/legacy/useOnMount/index.js +0 -1
  95. package/legacy/useOnMount/useOnMount.js +0 -13
  96. package/legacy/usePreviousProps/index.js +0 -1
  97. package/legacy/usePreviousProps/usePreviousProps.js +0 -11
  98. package/legacy/useTimeout/index.js +0 -2
  99. package/legacy/useTimeout/useTimeout.js +0 -47
  100. package/legacy/visuallyHidden/index.js +0 -1
  101. package/legacy/visuallyHidden/visuallyHidden.js +0 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,117 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## v6.0.0-alpha.3
4
+
5
+ <!-- generated comparing v6.0.0-alpha.2..next -->
6
+
7
+ _Apr 17, 2024_
8
+
9
+ A big thanks to the 24 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🔥 Converted 5 more Material UI components to use Pigment CSS.
12
+ - 🚀 Added container queries utility to the `@mui/system` package (#41674) @siriwatknp.
13
+
14
+ ### `@mui/material@6.0.0-alpha.3`
15
+
16
+ - Convert `LinearProgress` to support Pigment CSS (#41816) @siriwatknp
17
+ - [Dialog] Prevent onClick on the root element from being overwritten (#41881) @ryanburr
18
+ - [FloatingActionButton] Convert to support CSS extraction (#41851) @gijsbotje
19
+ - Convert `CircularProgress` to support Pigment CSS (#41776) @siriwatknp
20
+ - [PaginationItem] Convert to support CSS extraction (#41848) @gijsbotje
21
+ - [StepConnector] deprecate composed classes (#41740) @sai6855
22
+ - [StepLabel] Deprecate `StepIconComponent`, `StepIconProps` (#41835) @sai6855
23
+ - [ToggleButton] Convert to support CSS extraction (#41782) @lhilgert9
24
+ - [ToggleButtonGroup] Deprecate composed classes (#41288) @sai6855
25
+ - [Typography] Fix Typography inherit variant styles (#41308) @kealjones-wk
26
+
27
+ ### `@mui/system@6.0.0-alpha.3`
28
+
29
+ - Add container queries utility (#41674) @siriwatknp
30
+
31
+ ### `@mui/codemod@6.0.0-alpha.3`
32
+
33
+ - Add styled v6 transformation (#41743) @siriwatknp
34
+
35
+ ### `@mui/joy@5.0.0-beta.36`
36
+
37
+ - [Button] Disable text highlighting (#41902) @mithun522
38
+
39
+ ### `@pigment-css/react@0.0.7`
40
+
41
+ - Patch WyW's WeakRef usage (#41909) @DiegoAndai
42
+ - Implement sx transform for system components (#41861) @brijeshb42
43
+
44
+ ### Docs
45
+
46
+ - [material-ui] Add Connect-related content (#40848) @danilo-leal
47
+ - [material-ui] Fix credit comment typo (#41872) @aarongarciah
48
+ - [material-ui] Remove Data Grid v7 beta callout (#41839) @cherniavskii
49
+ - [material-ui] Add stray design tweaks to free templates (#41696) @zanivan
50
+ - [material-ui] Simplify components styling on templates (#41845) @zanivan
51
+ - [material-ui][Button] Add `onChange` event handler to file upload example (#41863) @aarongarciah
52
+ - [material-ui] Fix import statement in migration guide (#41852) @sai6855
53
+ - Fix 301 redirection @oliviertassinari
54
+ - Fix format git diff regression (#41882) @oliviertassinari
55
+ - Fix small SEO issues @oliviertassinari
56
+ - [pigment-css] Fix README typos (#41870) @MohammadShehadeh
57
+
58
+ ### Core
59
+
60
+ - Begin removing IE 11-related code (#41709) @iammminzzy
61
+ - [blog] Add post to introduce the Connect plugin (#41763) @danilo-leal
62
+ - [code-infra] Fix require.context with aliases (#41682) @Janpot
63
+ - [code-infra] Allow customizing hooks imports in API docs generator (#41828) @michaldudak
64
+ - [codemod] Add utils for `*Component` and `*Props` props deprecations (#41685) @DiegoAndai
65
+ - Replace bundle size reporter filter (#38979) @Janpot
66
+ - [docs-infra] Make the whole header clickable (#39603) @MoazMirza-13
67
+ - [docs-infra] Improve demo container and related components design (#41827) @danilo-leal
68
+ - [docs-infra] Use edge function for card generation (#41188) (#41836) @alexfauquette
69
+ - [docs-infra] Fix code block layout shift (#41917) @oliviertassinari
70
+ - [docs-infra] Fine-tune the OG card image design (#41862) @danilo-leal
71
+ - [docs-infra] Fix markdown version for material (#41908) @alexfauquette
72
+ - [docs-infra] Support multiple tabs in demos (#40901) @bharatkashyap
73
+
74
+ All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @bharatkashyap, @brijeshb42, @cherniavskii, @danilo-leal, @DiegoAndai, @EyaOuenniche, @gijsbotje, @iammminzzy, @Janpot, @kealjones-wk, @lhilgert9, @magnimarels, @michaldudak, @mithun522, @mnajdova, @MoazMirza-13, @MohammadShehadeh, @oliviertassinari, @ryanburr, @sai6855, @siriwatknp, @zanivan
75
+
76
+ ## v6.0.0-alpha.2
77
+
78
+ <!-- generated comparing v6.0.0-alpha.1..next -->
79
+
80
+ _Apr 9, 2024_
81
+
82
+ A big thanks to the 5 contributors who made this release possible.
83
+ This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
84
+
85
+ ### `@mui/material@6.0.0-alpha.2`
86
+
87
+ - &#8203;<!-- 03 -->[typescript][Select] Fix `muiName` property TypeScript error (#41726) @EyaOuenniche
88
+ - &#8203;<!-- 04 -->[l10n] Fix typo in is-IS locale (#41810) @magnimarels
89
+
90
+ ### `@pigment-css/react@0.0.6`
91
+
92
+ - &#8203;<!-- 12 -->[core] Remove `muiName` during eval phase (#41811) @brijeshb42
93
+
94
+ ### `@pigment-css/nextjs-plugin@0.0.6`
95
+
96
+ - &#8203;<!-- 02 -->[nextjs] Handle file references passed through imports (#41817) @brijeshb42
97
+ - &#8203;<!-- 01 -->[nextjs] Allow usage of url() CSS function (#41758) @brijeshb42
98
+
99
+ ### Docs
100
+
101
+ - &#8203;<!-- 11 -->[docs] Fix 301 links @oliviertassinari
102
+ - &#8203;<!-- 06 -->[pigment-css][docs] Fix README typo (#41808) @aarongarciah
103
+ - &#8203;<!-- 05 -->[pigment-css][docs] Fix output on dynamic styles example (#41805) @aarongarciah
104
+ - &#8203;<!-- 07 -->[material-ui][docs] Fix Material 3 message typo (#41821) @aarongarciah
105
+ - &#8203;<!-- 08 -->[material-ui][docs] Add stray design tweaks to free templates (#41696) @zanivan
106
+
107
+ ### Core
108
+
109
+ - &#8203;<!-- 13 -->[core] Remove unused files (#41818) @mnajdova
110
+ - &#8203;<!-- 10 -->[docs-infra] Fix analytics about inline ads (#41474) (#41819) @alexfauquette
111
+ - &#8203;<!-- 08 -->[docs-infra] Fix drawer performances (#41807) @alexfauquette
112
+
113
+ All contributors of this release in alphabetical order: @aarongarciah, @alexfauquette, @brijeshb42, @EyaOuenniche, @oliviertassinari
114
+
3
115
  ## v6.0.0-alpha.1
4
116
 
5
117
  <!-- generated comparing v6.0.0-alpha.0..next -->
@@ -8128,7 +8240,7 @@ A big thanks to the 25 contributors who made this release possible. Here are som
8128
8240
 
8129
8241
  <a href="https://mui.com/components/tables/#unstyled-table"><img width="800" alt="unstyled table" src="https://user-images.githubusercontent.com/4512430/144862194-584356ef-7d9d-462c-a631-186a7e716193.png"></a>
8130
8242
 
8131
- You can follow our progress with unstyled components at https://github.com/mui/material-ui/issues/27170.
8243
+ You can follow our progress with unstyled components at https://github.com/mui/base-ui/issues/10.
8132
8244
 
8133
8245
  - 🎉 We have added an example of how to use MUI with [Remix](https://remix.run/) (#29952) @mnajdova
8134
8246
 
@@ -9598,7 +9710,7 @@ A big thanks to the 17 contributors who made this release possible. Here are som
9598
9710
 
9599
9711
  <a href="https://mui.com/components/switches/#unstyled"><img width="832" alt="switch" src="https://user-images.githubusercontent.com/3165635/125192249-236f8a80-e247-11eb-9df9-17d476379a32.png"></a>
9600
9712
 
9601
- You can follow our progress at https://github.com/mui/material-ui/issues/27170.
9713
+ You can follow our progress at https://github.com/mui/base-ui/issues/10.
9602
9714
 
9603
9715
  - 💄 We have updated the default `info` `success` `warning` color to be more accessible (#26817) @siriwatknp.
9604
9716
  You can find the new [default values](https://mui.com/material-ui/customization/palette/#default-values) in the documentation.
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- export declare function getFunctionName(fn: Function): string;
3
2
  /**
4
3
  * cherry-pick from
5
4
  * https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js
@@ -1,15 +1,6 @@
1
1
  import { ForwardRef, Memo } from 'react-is';
2
-
3
- // Simplified polyfill for IE11 support
4
- // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
5
- const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
6
- export function getFunctionName(fn) {
7
- const match = `${fn}`.match(fnNameMatchRegex);
8
- const name = match && match[1];
9
- return name || '';
10
- }
11
2
  function getFunctionComponentName(Component, fallback = '') {
12
- return Component.displayName || Component.name || getFunctionName(Component) || fallback;
3
+ return Component.displayName || Component.name || fallback;
13
4
  }
14
5
  function getWrappedName(outerType, innerType, wrapperName) {
15
6
  const functionName = getFunctionComponentName(innerType);
@@ -1,2 +1 @@
1
1
  export { default } from './getDisplayName';
2
- export * from './getDisplayName';
@@ -1,2 +1 @@
1
- export { default } from './getDisplayName';
2
- export * from './getDisplayName';
1
+ export { default } from './getDisplayName';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.0.0-alpha.1
2
+ * @mui/utils v6.0.0-alpha.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -21,16 +21,9 @@ export function getTypeByValue(value) {
21
21
  return valueType;
22
22
  }
23
23
  }
24
-
25
- // IE 11 support
26
- function ponyfillIsInteger(x) {
27
- // eslint-disable-next-line no-restricted-globals
28
- return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
29
- }
30
- const isInteger = Number.isInteger || ponyfillIsInteger;
31
24
  function requiredInteger(props, propName, componentName, location) {
32
25
  const propValue = props[propName];
33
- if (propValue == null || !isInteger(propValue)) {
26
+ if (propValue == null || !Number.isInteger(propValue)) {
34
27
  const propType = getTypeByValue(propValue);
35
28
  return new RangeError(`Invalid ${location} \`${propName}\` of type \`${propType}\` supplied to \`${componentName}\`, expected \`integer\`.`);
36
29
  }
@@ -1,15 +1,6 @@
1
1
  import { ForwardRef, Memo } from 'react-is';
2
-
3
- // Simplified polyfill for IE11 support
4
- // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
5
- const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
6
- export function getFunctionName(fn) {
7
- const match = `${fn}`.match(fnNameMatchRegex);
8
- const name = match && match[1];
9
- return name || '';
10
- }
11
2
  function getFunctionComponentName(Component, fallback = '') {
12
- return Component.displayName || Component.name || getFunctionName(Component) || fallback;
3
+ return Component.displayName || Component.name || fallback;
13
4
  }
14
5
  function getWrappedName(outerType, innerType, wrapperName) {
15
6
  const functionName = getFunctionComponentName(innerType);
@@ -1,2 +1 @@
1
- export { default } from './getDisplayName';
2
- export * from './getDisplayName';
1
+ export { default } from './getDisplayName';
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.0.0-alpha.1
2
+ * @mui/utils v6.0.0-alpha.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -21,16 +21,9 @@ export function getTypeByValue(value) {
21
21
  return valueType;
22
22
  }
23
23
  }
24
-
25
- // IE 11 support
26
- function ponyfillIsInteger(x) {
27
- // eslint-disable-next-line no-restricted-globals
28
- return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
29
- }
30
- const isInteger = Number.isInteger || ponyfillIsInteger;
31
24
  function requiredInteger(props, propName, componentName, location) {
32
25
  const propValue = props[propName];
33
- if (propValue == null || !isInteger(propValue)) {
26
+ if (propValue == null || !Number.isInteger(propValue)) {
34
27
  const propType = getTypeByValue(propValue);
35
28
  return new RangeError(`Invalid ${location} \`${propName}\` of type \`${propType}\` supplied to \`${componentName}\`, expected \`integer\`.`);
36
29
  }
@@ -4,18 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getDisplayName;
7
- exports.getFunctionName = getFunctionName;
8
7
  var _reactIs = require("react-is");
9
- // Simplified polyfill for IE11 support
10
- // https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
11
- const fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
12
- function getFunctionName(fn) {
13
- const match = `${fn}`.match(fnNameMatchRegex);
14
- const name = match && match[1];
15
- return name || '';
16
- }
17
8
  function getFunctionComponentName(Component, fallback = '') {
18
- return Component.displayName || Component.name || getFunctionName(Component) || fallback;
9
+ return Component.displayName || Component.name || fallback;
19
10
  }
20
11
  function getWrappedName(outerType, innerType, wrapperName) {
21
12
  const functionName = getFunctionComponentName(innerType);
@@ -1,26 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- var _exportNames = {};
7
7
  Object.defineProperty(exports, "default", {
8
8
  enumerable: true,
9
9
  get: function () {
10
10
  return _getDisplayName.default;
11
11
  }
12
12
  });
13
- var _getDisplayName = _interopRequireWildcard(require("./getDisplayName"));
14
- Object.keys(_getDisplayName).forEach(function (key) {
15
- if (key === "default" || key === "__esModule") return;
16
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
- if (key in exports && exports[key] === _getDisplayName[key]) return;
18
- Object.defineProperty(exports, key, {
19
- enumerable: true,
20
- get: function () {
21
- return _getDisplayName[key];
22
- }
23
- });
24
- });
25
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ var _getDisplayName = _interopRequireDefault(require("./getDisplayName"));
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/utils v6.0.0-alpha.1
2
+ * @mui/utils v6.0.0-alpha.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -28,16 +28,9 @@ function getTypeByValue(value) {
28
28
  return valueType;
29
29
  }
30
30
  }
31
-
32
- // IE 11 support
33
- function ponyfillIsInteger(x) {
34
- // eslint-disable-next-line no-restricted-globals
35
- return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
36
- }
37
- const isInteger = Number.isInteger || ponyfillIsInteger;
38
31
  function requiredInteger(props, propName, componentName, location) {
39
32
  const propValue = props[propName];
40
- if (propValue == null || !isInteger(propValue)) {
33
+ if (propValue == null || !Number.isInteger(propValue)) {
41
34
  const propType = getTypeByValue(propValue);
42
35
  return new RangeError(`Invalid ${location} \`${propName}\` of type \`${propType}\` supplied to \`${componentName}\`, expected \`integer\`.`);
43
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/utils",
3
- "version": "6.0.0-alpha.1",
3
+ "version": "6.0.0-alpha.3",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Utility functions for React components.",
@@ -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';