@mui/utils 6.0.0-beta.0 → 6.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/CHANGELOG.md +473 -31
  2. package/ClassNameGenerator/ClassNameGenerator.js +7 -1
  3. package/ClassNameGenerator/index.js +13 -1
  4. package/ClassNameGenerator/package.json +2 -2
  5. package/HTMLElementType/HTMLElementType.js +7 -1
  6. package/HTMLElementType/index.js +13 -1
  7. package/HTMLElementType/package.json +2 -2
  8. package/appendOwnerState/appendOwnerState.d.ts +20 -0
  9. package/appendOwnerState/appendOwnerState.js +34 -0
  10. package/appendOwnerState/index.d.ts +2 -0
  11. package/{node/capitalize → appendOwnerState}/index.js +2 -2
  12. package/appendOwnerState/package.json +6 -0
  13. package/capitalize/capitalize.js +10 -3
  14. package/capitalize/index.js +13 -1
  15. package/capitalize/package.json +2 -2
  16. package/chainPropTypes/chainPropTypes.js +7 -1
  17. package/chainPropTypes/index.js +13 -1
  18. package/chainPropTypes/package.json +2 -2
  19. package/clamp/clamp.js +7 -1
  20. package/clamp/index.js +13 -1
  21. package/clamp/package.json +2 -2
  22. package/composeClasses/composeClasses.js +7 -1
  23. package/composeClasses/index.js +13 -1
  24. package/composeClasses/package.json +2 -2
  25. package/createChainedFunction/createChainedFunction.js +7 -1
  26. package/createChainedFunction/index.js +13 -1
  27. package/createChainedFunction/package.json +2 -2
  28. package/debounce/debounce.js +7 -1
  29. package/debounce/index.js +26 -2
  30. package/debounce/package.json +2 -2
  31. package/deepmerge/deepmerge.js +9 -2
  32. package/deepmerge/index.js +26 -2
  33. package/deepmerge/package.json +2 -2
  34. package/deprecatedPropType/deprecatedPropType.js +7 -1
  35. package/deprecatedPropType/index.js +13 -1
  36. package/deprecatedPropType/package.json +2 -2
  37. package/elementAcceptingRef/elementAcceptingRef.js +12 -5
  38. package/elementAcceptingRef/index.js +13 -1
  39. package/elementAcceptingRef/package.json +2 -2
  40. package/elementTypeAcceptingRef/elementTypeAcceptingRef.js +10 -3
  41. package/elementTypeAcceptingRef/index.js +13 -1
  42. package/elementTypeAcceptingRef/package.json +2 -2
  43. package/{node → esm}/ClassNameGenerator/ClassNameGenerator.js +1 -7
  44. package/esm/ClassNameGenerator/index.js +1 -0
  45. package/{node → esm}/HTMLElementType/HTMLElementType.js +1 -7
  46. package/esm/HTMLElementType/index.js +1 -0
  47. package/esm/appendOwnerState/appendOwnerState.js +28 -0
  48. package/esm/appendOwnerState/index.js +1 -0
  49. package/esm/capitalize/capitalize.js +11 -0
  50. package/esm/capitalize/index.js +1 -0
  51. package/{node → esm}/chainPropTypes/chainPropTypes.js +1 -7
  52. package/esm/chainPropTypes/index.js +1 -0
  53. package/esm/clamp/clamp.js +4 -0
  54. package/esm/clamp/index.js +1 -0
  55. package/{node → esm}/composeClasses/composeClasses.js +1 -7
  56. package/esm/composeClasses/index.js +1 -0
  57. package/{node → esm}/createChainedFunction/createChainedFunction.js +1 -7
  58. package/esm/createChainedFunction/index.js +1 -0
  59. package/{node → esm}/debounce/debounce.js +1 -7
  60. package/esm/debounce/index.js +2 -0
  61. package/{node → esm}/deepmerge/deepmerge.js +2 -9
  62. package/esm/deepmerge/index.js +2 -0
  63. package/{node → esm}/deprecatedPropType/deprecatedPropType.js +1 -7
  64. package/esm/deprecatedPropType/index.js +1 -0
  65. package/{node → esm}/elementAcceptingRef/elementAcceptingRef.js +5 -12
  66. package/esm/elementAcceptingRef/index.js +1 -0
  67. package/{node → esm}/elementTypeAcceptingRef/elementTypeAcceptingRef.js +3 -10
  68. package/esm/elementTypeAcceptingRef/index.js +1 -0
  69. package/{node → esm}/exactProp/exactProp.js +1 -7
  70. package/esm/exactProp/index.js +1 -0
  71. package/esm/extractEventHandlers/extractEventHandlers.js +18 -0
  72. package/esm/extractEventHandlers/index.js +1 -0
  73. package/{node → esm}/formatMuiErrorMessage/formatMuiErrorMessage.js +1 -7
  74. package/esm/formatMuiErrorMessage/index.js +1 -0
  75. package/esm/generateUtilityClass/generateUtilityClass.js +22 -0
  76. package/esm/generateUtilityClass/index.js +2 -0
  77. package/esm/generateUtilityClasses/generateUtilityClasses.js +8 -0
  78. package/esm/generateUtilityClasses/index.js +1 -0
  79. package/{node → esm}/getDisplayName/getDisplayName.js +4 -10
  80. package/esm/getDisplayName/index.js +1 -0
  81. package/{node → esm}/getScrollbarSize/getScrollbarSize.js +1 -7
  82. package/esm/getScrollbarSize/index.js +1 -0
  83. package/esm/getValidReactChildren/getValidReactChildren.js +11 -0
  84. package/esm/getValidReactChildren/index.js +1 -0
  85. package/esm/index.js +47 -0
  86. package/esm/integerPropType/index.js +2 -0
  87. package/{node → esm}/integerPropType/integerPropType.js +2 -9
  88. package/esm/isFocusVisible/index.js +1 -0
  89. package/{node → esm}/isFocusVisible/isFocusVisible.js +1 -7
  90. package/esm/isHostComponent/index.js +1 -0
  91. package/esm/isHostComponent/isHostComponent.js +7 -0
  92. package/esm/isMuiElement/index.js +1 -0
  93. package/esm/isMuiElement/isMuiElement.js +8 -0
  94. package/esm/mergeSlotProps/index.js +1 -0
  95. package/esm/mergeSlotProps/mergeSlotProps.js +90 -0
  96. package/esm/omitEventHandlers/index.js +1 -0
  97. package/esm/omitEventHandlers/omitEventHandlers.js +18 -0
  98. package/esm/ownerDocument/index.js +1 -0
  99. package/esm/ownerDocument/ownerDocument.js +3 -0
  100. package/esm/ownerWindow/index.js +1 -0
  101. package/esm/ownerWindow/ownerWindow.js +5 -0
  102. package/esm/ponyfillGlobal/index.js +1 -0
  103. package/esm/ponyfillGlobal/ponyfillGlobal.js +3 -0
  104. package/esm/refType/index.js +1 -0
  105. package/esm/refType/refType.js +3 -0
  106. package/esm/requirePropFactory/index.js +1 -0
  107. package/{node → esm}/requirePropFactory/requirePropFactory.js +2 -8
  108. package/esm/resolveComponentProps/index.js +1 -0
  109. package/esm/resolveComponentProps/resolveComponentProps.js +11 -0
  110. package/esm/resolveProps/index.js +1 -0
  111. package/{node → esm}/resolveProps/resolveProps.js +1 -7
  112. package/esm/setRef/index.js +1 -0
  113. package/{node → esm}/setRef/setRef.js +1 -7
  114. package/esm/types.js +1 -0
  115. package/esm/unsupportedProp/index.js +1 -0
  116. package/{node → esm}/unsupportedProp/unsupportedProp.js +1 -7
  117. package/esm/useControlled/index.js +1 -0
  118. package/{node → esm}/useControlled/useControlled.js +2 -9
  119. package/esm/useEnhancedEffect/index.js +1 -0
  120. package/esm/useEnhancedEffect/useEnhancedEffect.js +13 -0
  121. package/esm/useEventCallback/index.js +1 -0
  122. package/esm/useEventCallback/useEventCallback.js +20 -0
  123. package/esm/useForkRef/index.js +1 -0
  124. package/esm/useForkRef/useForkRef.js +22 -0
  125. package/esm/useId/index.js +1 -0
  126. package/{node → esm}/useId/useId.js +3 -10
  127. package/esm/useLazyRef/index.js +1 -0
  128. package/esm/useLazyRef/useLazyRef.js +19 -0
  129. package/esm/useLocalStorageState/index.js +1 -0
  130. package/{node → esm}/useLocalStorageState/useLocalStorageState.js +4 -13
  131. package/esm/useOnMount/index.js +1 -0
  132. package/esm/useOnMount/useOnMount.js +13 -0
  133. package/esm/usePreviousProps/index.js +1 -0
  134. package/esm/usePreviousProps/usePreviousProps.js +11 -0
  135. package/esm/useSlotProps/index.js +1 -0
  136. package/esm/useSlotProps/useSlotProps.js +38 -0
  137. package/esm/useTimeout/index.js +2 -0
  138. package/esm/useTimeout/useTimeout.js +35 -0
  139. package/esm/visuallyHidden/index.js +1 -0
  140. package/{node → esm}/visuallyHidden/visuallyHidden.js +1 -7
  141. package/exactProp/exactProp.js +7 -1
  142. package/exactProp/index.js +13 -1
  143. package/exactProp/package.json +2 -2
  144. package/extractEventHandlers/extractEventHandlers.d.ts +10 -0
  145. package/extractEventHandlers/extractEventHandlers.js +24 -0
  146. package/extractEventHandlers/index.d.ts +1 -0
  147. package/{node/ClassNameGenerator → extractEventHandlers}/index.js +2 -2
  148. package/extractEventHandlers/package.json +6 -0
  149. package/formatMuiErrorMessage/formatMuiErrorMessage.js +7 -1
  150. package/formatMuiErrorMessage/index.js +13 -1
  151. package/formatMuiErrorMessage/package.json +2 -2
  152. package/generateUtilityClass/generateUtilityClass.js +14 -5
  153. package/generateUtilityClass/index.js +26 -2
  154. package/generateUtilityClass/package.json +2 -2
  155. package/generateUtilityClasses/generateUtilityClasses.js +10 -3
  156. package/generateUtilityClasses/index.js +13 -1
  157. package/generateUtilityClasses/package.json +2 -2
  158. package/getDisplayName/getDisplayName.js +10 -4
  159. package/getDisplayName/index.js +13 -1
  160. package/getDisplayName/package.json +2 -2
  161. package/getScrollbarSize/getScrollbarSize.js +7 -1
  162. package/getScrollbarSize/index.js +13 -1
  163. package/getScrollbarSize/package.json +2 -2
  164. package/getValidReactChildren/getValidReactChildren.js +9 -2
  165. package/getValidReactChildren/index.js +13 -1
  166. package/getValidReactChildren/package.json +2 -2
  167. package/index.d.ts +5 -0
  168. package/index.js +399 -44
  169. package/integerPropType/index.js +26 -2
  170. package/integerPropType/integerPropType.js +9 -2
  171. package/integerPropType/package.json +2 -2
  172. package/isFocusVisible/index.js +13 -1
  173. package/isFocusVisible/isFocusVisible.js +7 -1
  174. package/isFocusVisible/package.json +2 -2
  175. package/isHostComponent/index.d.ts +1 -0
  176. package/{node/clamp → isHostComponent}/index.js +2 -2
  177. package/isHostComponent/isHostComponent.d.ts +6 -0
  178. package/isHostComponent/isHostComponent.js +13 -0
  179. package/isHostComponent/package.json +6 -0
  180. package/isMuiElement/index.js +13 -1
  181. package/isMuiElement/isMuiElement.js +13 -5
  182. package/isMuiElement/package.json +2 -2
  183. package/mergeSlotProps/index.d.ts +2 -0
  184. package/{node/chainPropTypes → mergeSlotProps}/index.js +2 -2
  185. package/mergeSlotProps/mergeSlotProps.d.ts +56 -0
  186. package/mergeSlotProps/mergeSlotProps.js +97 -0
  187. package/mergeSlotProps/package.json +6 -0
  188. package/modern/appendOwnerState/appendOwnerState.js +28 -0
  189. package/modern/appendOwnerState/index.js +1 -0
  190. package/modern/extractEventHandlers/extractEventHandlers.js +18 -0
  191. package/modern/extractEventHandlers/index.js +1 -0
  192. package/modern/index.js +6 -2
  193. package/modern/isHostComponent/index.js +1 -0
  194. package/modern/isHostComponent/isHostComponent.js +7 -0
  195. package/modern/mergeSlotProps/index.js +1 -0
  196. package/modern/mergeSlotProps/mergeSlotProps.js +90 -0
  197. package/modern/omitEventHandlers/index.js +1 -0
  198. package/modern/omitEventHandlers/omitEventHandlers.js +18 -0
  199. package/modern/resolveComponentProps/index.js +1 -0
  200. package/modern/resolveComponentProps/resolveComponentProps.js +11 -0
  201. package/modern/types.js +1 -0
  202. package/modern/useSlotProps/index.js +1 -0
  203. package/modern/useSlotProps/useSlotProps.js +38 -0
  204. package/omitEventHandlers/index.d.ts +1 -0
  205. package/{node/HTMLElementType → omitEventHandlers}/index.js +2 -2
  206. package/omitEventHandlers/omitEventHandlers.d.ts +9 -0
  207. package/omitEventHandlers/omitEventHandlers.js +24 -0
  208. package/omitEventHandlers/package.json +6 -0
  209. package/ownerDocument/index.js +13 -1
  210. package/ownerDocument/ownerDocument.js +7 -1
  211. package/ownerDocument/package.json +2 -2
  212. package/ownerWindow/index.js +13 -1
  213. package/ownerWindow/ownerWindow.js +10 -3
  214. package/ownerWindow/package.json +2 -2
  215. package/package.json +7 -5
  216. package/ponyfillGlobal/index.js +13 -1
  217. package/ponyfillGlobal/package.json +2 -2
  218. package/ponyfillGlobal/ponyfillGlobal.js +7 -1
  219. package/refType/index.js +13 -1
  220. package/refType/package.json +2 -2
  221. package/refType/refType.js +10 -3
  222. package/requirePropFactory/index.js +13 -1
  223. package/requirePropFactory/package.json +2 -2
  224. package/requirePropFactory/requirePropFactory.js +8 -2
  225. package/resolveComponentProps/index.d.ts +1 -0
  226. package/resolveComponentProps/index.js +13 -0
  227. package/resolveComponentProps/package.json +6 -0
  228. package/resolveComponentProps/resolveComponentProps.d.ts +6 -0
  229. package/resolveComponentProps/resolveComponentProps.js +17 -0
  230. package/resolveProps/index.js +13 -1
  231. package/resolveProps/package.json +2 -2
  232. package/resolveProps/resolveProps.js +7 -1
  233. package/setRef/index.js +13 -1
  234. package/setRef/package.json +2 -2
  235. package/setRef/setRef.js +7 -1
  236. package/types.d.ts +7 -0
  237. package/types.js +5 -0
  238. package/unsupportedProp/index.js +13 -1
  239. package/unsupportedProp/package.json +2 -2
  240. package/unsupportedProp/unsupportedProp.js +7 -1
  241. package/useControlled/index.js +13 -1
  242. package/useControlled/package.json +2 -2
  243. package/useControlled/useControlled.js +9 -2
  244. package/useEnhancedEffect/index.js +13 -1
  245. package/useEnhancedEffect/package.json +2 -2
  246. package/useEnhancedEffect/useEnhancedEffect.js +9 -3
  247. package/useEventCallback/index.js +13 -1
  248. package/useEventCallback/package.json +2 -2
  249. package/useEventCallback/useEventCallback.js +12 -5
  250. package/useForkRef/index.js +13 -1
  251. package/useForkRef/package.json +2 -2
  252. package/useForkRef/useForkRef.js +12 -4
  253. package/useId/index.js +13 -1
  254. package/useId/package.json +2 -2
  255. package/useId/useId.js +10 -3
  256. package/useLazyRef/index.js +13 -1
  257. package/useLazyRef/package.json +2 -2
  258. package/useLazyRef/useLazyRef.js +9 -2
  259. package/useLocalStorageState/index.js +13 -1
  260. package/useLocalStorageState/package.json +2 -2
  261. package/useLocalStorageState/useLocalStorageState.js +13 -4
  262. package/useOnMount/index.js +13 -1
  263. package/useOnMount/package.json +2 -2
  264. package/useOnMount/useOnMount.js +9 -2
  265. package/usePreviousProps/index.js +13 -1
  266. package/usePreviousProps/package.json +2 -2
  267. package/usePreviousProps/usePreviousProps.js +9 -2
  268. package/useSlotProps/index.d.ts +2 -0
  269. package/{node/exactProp → useSlotProps}/index.js +2 -2
  270. package/useSlotProps/package.json +6 -0
  271. package/useSlotProps/useSlotProps.d.ts +41 -0
  272. package/useSlotProps/useSlotProps.js +45 -0
  273. package/useTimeout/index.js +20 -2
  274. package/useTimeout/package.json +2 -2
  275. package/useTimeout/useTimeout.js +14 -6
  276. package/visuallyHidden/index.js +13 -1
  277. package/visuallyHidden/package.json +2 -2
  278. package/visuallyHidden/visuallyHidden.js +7 -1
  279. package/node/capitalize/capitalize.js +0 -18
  280. package/node/clamp/clamp.js +0 -10
  281. package/node/composeClasses/index.js +0 -13
  282. package/node/createChainedFunction/index.js +0 -13
  283. package/node/debounce/index.js +0 -26
  284. package/node/deepmerge/index.js +0 -26
  285. package/node/deprecatedPropType/index.js +0 -13
  286. package/node/elementAcceptingRef/index.js +0 -13
  287. package/node/elementTypeAcceptingRef/index.js +0 -13
  288. package/node/formatMuiErrorMessage/index.js +0 -13
  289. package/node/generateUtilityClass/generateUtilityClass.js +0 -31
  290. package/node/generateUtilityClass/index.js +0 -26
  291. package/node/generateUtilityClasses/generateUtilityClasses.js +0 -15
  292. package/node/generateUtilityClasses/index.js +0 -13
  293. package/node/getDisplayName/index.js +0 -13
  294. package/node/getScrollbarSize/index.js +0 -13
  295. package/node/getValidReactChildren/getValidReactChildren.js +0 -18
  296. package/node/getValidReactChildren/index.js +0 -13
  297. package/node/index.js +0 -369
  298. package/node/integerPropType/index.js +0 -26
  299. package/node/isFocusVisible/index.js +0 -13
  300. package/node/isMuiElement/index.js +0 -13
  301. package/node/isMuiElement/isMuiElement.js +0 -16
  302. package/node/ownerDocument/index.js +0 -13
  303. package/node/ownerDocument/ownerDocument.js +0 -9
  304. package/node/ownerWindow/index.js +0 -13
  305. package/node/ownerWindow/ownerWindow.js +0 -12
  306. package/node/ponyfillGlobal/index.js +0 -13
  307. package/node/ponyfillGlobal/ponyfillGlobal.js +0 -9
  308. package/node/refType/index.js +0 -13
  309. package/node/refType/refType.js +0 -10
  310. package/node/requirePropFactory/index.js +0 -13
  311. package/node/resolveProps/index.js +0 -13
  312. package/node/setRef/index.js +0 -13
  313. package/node/unsupportedProp/index.js +0 -13
  314. package/node/useControlled/index.js +0 -13
  315. package/node/useEnhancedEffect/index.js +0 -13
  316. package/node/useEnhancedEffect/useEnhancedEffect.js +0 -19
  317. package/node/useEventCallback/index.js +0 -13
  318. package/node/useEventCallback/useEventCallback.js +0 -27
  319. package/node/useForkRef/index.js +0 -13
  320. package/node/useForkRef/useForkRef.js +0 -30
  321. package/node/useId/index.js +0 -13
  322. package/node/useLazyRef/index.js +0 -13
  323. package/node/useLazyRef/useLazyRef.js +0 -26
  324. package/node/useLocalStorageState/index.js +0 -13
  325. package/node/useOnMount/index.js +0 -13
  326. package/node/useOnMount/useOnMount.js +0 -20
  327. package/node/usePreviousProps/index.js +0 -13
  328. package/node/usePreviousProps/usePreviousProps.js +0 -18
  329. package/node/useTimeout/index.js +0 -20
  330. package/node/useTimeout/useTimeout.js +0 -43
  331. package/node/visuallyHidden/index.js +0 -13
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Removes event handlers from the given object.
3
+ * A field is considered an event handler if it is a function with a name beginning with `on`.
4
+ *
5
+ * @param object Object to remove event handlers from.
6
+ * @returns Object with event handlers removed.
7
+ */
8
+ function omitEventHandlers(object) {
9
+ if (object === undefined) {
10
+ return {};
11
+ }
12
+ const result = {};
13
+ Object.keys(object).filter(prop => !(prop.match(/^on[A-Z]/) && typeof object[prop] === 'function')).forEach(prop => {
14
+ result[prop] = object[prop];
15
+ });
16
+ return result;
17
+ }
18
+ export default omitEventHandlers;
@@ -0,0 +1 @@
1
+ export { default } from './ownerDocument';
@@ -0,0 +1,3 @@
1
+ export default function ownerDocument(node) {
2
+ return node && node.ownerDocument || document;
3
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ownerWindow';
@@ -0,0 +1,5 @@
1
+ import ownerDocument from '../ownerDocument';
2
+ export default function ownerWindow(node) {
3
+ const doc = ownerDocument(node);
4
+ return doc.defaultView || window;
5
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ponyfillGlobal';
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
3
+ export default typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
@@ -0,0 +1 @@
1
+ export { default } from './refType';
@@ -0,0 +1,3 @@
1
+ import PropTypes from 'prop-types';
2
+ const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
3
+ export default refType;
@@ -0,0 +1 @@
1
+ export { default } from './requirePropFactory';
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = requirePropFactory;
7
- function requirePropFactory(componentNameInError, Component) {
1
+ export default function requirePropFactory(componentNameInError, Component) {
8
2
  if (process.env.NODE_ENV === 'production') {
9
3
  return () => null;
10
4
  }
@@ -15,7 +9,7 @@ function requirePropFactory(componentNameInError, Component) {
15
9
  } : null;
16
10
  const requireProp = requiredProp => (props, propName, componentName, location, propFullName, ...args) => {
17
11
  const propFullNameSafe = propFullName || propName;
18
- const defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
12
+ const defaultTypeChecker = prevPropTypes?.[propFullNameSafe];
19
13
  if (defaultTypeChecker) {
20
14
  const typeCheckerResult = defaultTypeChecker(props, propName, componentName, location, propFullName, ...args);
21
15
  if (typeCheckerResult) {
@@ -0,0 +1 @@
1
+ export { default } from './resolveComponentProps';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * If `componentProps` is a function, calls it with the provided `ownerState`.
3
+ * Otherwise, just returns `componentProps`.
4
+ */
5
+ function resolveComponentProps(componentProps, ownerState, slotState) {
6
+ if (typeof componentProps === 'function') {
7
+ return componentProps(ownerState, slotState);
8
+ }
9
+ return componentProps;
10
+ }
11
+ export default resolveComponentProps;
@@ -0,0 +1 @@
1
+ export { default } from './resolveProps';
@@ -1,16 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = resolveProps;
7
1
  /**
8
2
  * Add keys, values of `defaultProps` that does not exist in `props`
9
3
  * @param {object} defaultProps
10
4
  * @param {object} props
11
5
  * @returns {object} resolved props
12
6
  */
13
- function resolveProps(defaultProps, props) {
7
+ export default function resolveProps(defaultProps, props) {
14
8
  const output = {
15
9
  ...props
16
10
  };
@@ -0,0 +1 @@
1
+ export { default } from './setRef';
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = setRef;
7
1
  /**
8
2
  * TODO v5: consider making it private
9
3
  *
@@ -17,7 +11,7 @@ exports.default = setRef;
17
11
  * while still using it inside the component.
18
12
  * @param ref A ref callback or ref object. If anything falsy, this is a no-op.
19
13
  */
20
- function setRef(ref, value) {
14
+ export default function setRef(ref, value) {
21
15
  if (typeof ref === 'function') {
22
16
  ref(value);
23
17
  } else if (ref) {
package/esm/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './unsupportedProp';
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = unsupportedProp;
7
- function unsupportedProp(props, propName, componentName, location, propFullName) {
1
+ export default function unsupportedProp(props, propName, componentName, location, propFullName) {
8
2
  if (process.env.NODE_ENV === 'production') {
9
3
  return null;
10
4
  }
@@ -0,0 +1 @@
1
+ export { default } from './useControlled';
@@ -1,15 +1,8 @@
1
- "use strict";
2
1
  'use client';
3
2
 
4
3
  /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = useControlled;
9
- var React = _interopRequireWildcard(require("react"));
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
- function useControlled({
4
+ import * as React from 'react';
5
+ export default function useControlled({
13
6
  controlled,
14
7
  default: defaultProp,
15
8
  name,
@@ -0,0 +1 @@
1
+ export { default } from './useEnhancedEffect';
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+
5
+ /**
6
+ * A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
7
+ * This is useful for effects that are only needed for client-side rendering but not for SSR.
8
+ *
9
+ * Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
10
+ * and confirm it doesn't apply to your use-case.
11
+ */
12
+ const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
13
+ export default useEnhancedEffect;
@@ -0,0 +1 @@
1
+ export { default } from './useEventCallback';
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import useEnhancedEffect from '../useEnhancedEffect';
5
+
6
+ /**
7
+ * Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
8
+ * See RFC in https://github.com/reactjs/rfcs/pull/220
9
+ */
10
+
11
+ function useEventCallback(fn) {
12
+ const ref = React.useRef(fn);
13
+ useEnhancedEffect(() => {
14
+ ref.current = fn;
15
+ });
16
+ return React.useRef((...args) =>
17
+ // @ts-expect-error hide `this`
18
+ (0, ref.current)(...args)).current;
19
+ }
20
+ export default useEventCallback;
@@ -0,0 +1 @@
1
+ export { default } from './useForkRef';
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import setRef from '../setRef';
5
+ export default function useForkRef(...refs) {
6
+ /**
7
+ * This will create a new function if the refs passed to this hook change and are all defined.
8
+ * This means react will call the old forkRef with `null` and the new forkRef
9
+ * with the ref. Cleanup naturally emerges from this behavior.
10
+ */
11
+ return React.useMemo(() => {
12
+ if (refs.every(ref => ref == null)) {
13
+ return null;
14
+ }
15
+ return instance => {
16
+ refs.forEach(ref => {
17
+ setRef(ref, instance);
18
+ });
19
+ };
20
+ // eslint-disable-next-line react-hooks/exhaustive-deps
21
+ }, refs);
22
+ }
@@ -0,0 +1 @@
1
+ export { default } from './useId';
@@ -1,13 +1,6 @@
1
- "use strict";
2
1
  'use client';
3
2
 
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = useId;
8
- var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
3
+ import * as React from 'react';
11
4
  let globalId = 0;
12
5
  function useGlobalId(idOverride) {
13
6
  const [defaultId, setDefaultId] = React.useState(idOverride);
@@ -33,10 +26,10 @@ const maybeReactUseId = React['useId'.toString()];
33
26
  * @param idOverride
34
27
  * @returns {string}
35
28
  */
36
- function useId(idOverride) {
29
+ export default function useId(idOverride) {
37
30
  if (maybeReactUseId !== undefined) {
38
31
  const reactId = maybeReactUseId();
39
- return idOverride != null ? idOverride : reactId;
32
+ return idOverride ?? reactId;
40
33
  }
41
34
  // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
42
35
  return useGlobalId(idOverride);
@@ -0,0 +1 @@
1
+ export { default } from './useLazyRef';
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ const UNINITIALIZED = {};
5
+
6
+ /**
7
+ * A React.useRef() that is initialized lazily with a function. Note that it accepts an optional
8
+ * initialization argument, so the initialization function doesn't need to be an inline closure.
9
+ *
10
+ * @usage
11
+ * const ref = useLazyRef(sortColumns, columns)
12
+ */
13
+ export default function useLazyRef(init, initArg) {
14
+ const ref = React.useRef(UNINITIALIZED);
15
+ if (ref.current === UNINITIALIZED) {
16
+ ref.current = init(initArg);
17
+ }
18
+ return ref;
19
+ }
@@ -0,0 +1 @@
1
+ export { default } from './useLocalStorageState';
@@ -1,13 +1,7 @@
1
- "use strict";
2
1
  'use client';
3
2
 
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
3
+ import * as React from 'react';
4
+
11
5
  // storage events only work across tabs, we'll use an event emitter to announce within the current tab
12
6
  const currentTabChangeListeners = new Map();
13
7
  function onCurrentTabStorageChange(key, handler) {
@@ -96,10 +90,7 @@ function useLocalStorageStateBrowser(key, initializer = null) {
96
90
  const [initialValue] = React.useState(initializer);
97
91
  const area = window.localStorage;
98
92
  const subscribeKey = React.useCallback(callbark => subscribe(area, key, callbark), [area, key]);
99
- const getKeySnapshot = React.useCallback(() => {
100
- var _getSnapshot;
101
- return (_getSnapshot = getSnapshot(area, key)) != null ? _getSnapshot : initialValue;
102
- }, [area, initialValue, key]);
93
+ const getKeySnapshot = React.useCallback(() => getSnapshot(area, key) ?? initialValue, [area, initialValue, key]);
103
94
 
104
95
  // Start with null for the hydration, and then switch to the actual value.
105
96
  const getKeyServerSnapshot = () => null;
@@ -114,4 +105,4 @@ function useLocalStorageStateBrowser(key, initializer = null) {
114
105
  }
115
106
  return [storedValue, setStoredValue];
116
107
  }
117
- var _default = exports.default = typeof window === 'undefined' ? useLocalStorageStateServer : useLocalStorageStateBrowser;
108
+ export default typeof window === 'undefined' ? useLocalStorageStateServer : useLocalStorageStateBrowser;
@@ -0,0 +1 @@
1
+ export { default } from './useOnMount';
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ const EMPTY = [];
5
+
6
+ /**
7
+ * A React.useEffect equivalent that runs once, when the component is mounted.
8
+ */
9
+ export default function useOnMount(fn) {
10
+ /* eslint-disable react-hooks/exhaustive-deps */
11
+ React.useEffect(fn, EMPTY);
12
+ /* eslint-enable react-hooks/exhaustive-deps */
13
+ }
@@ -0,0 +1 @@
1
+ export { default } from './usePreviousProps';
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ const usePreviousProps = value => {
5
+ const ref = React.useRef({});
6
+ React.useEffect(() => {
7
+ ref.current = value;
8
+ });
9
+ return ref.current;
10
+ };
11
+ export default usePreviousProps;
@@ -0,0 +1 @@
1
+ export { default } from './useSlotProps';
@@ -0,0 +1,38 @@
1
+ 'use client';
2
+
3
+ import useForkRef from '../useForkRef';
4
+ import appendOwnerState from '../appendOwnerState';
5
+ import mergeSlotProps from '../mergeSlotProps';
6
+ import resolveComponentProps from '../resolveComponentProps';
7
+ /**
8
+ * @ignore - do not document.
9
+ * Builds the props to be passed into the slot of an unstyled component.
10
+ * It merges the internal props of the component with the ones supplied by the user, allowing to customize the behavior.
11
+ * If the slot component is not a host component, it also merges in the `ownerState`.
12
+ *
13
+ * @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
14
+ */
15
+ function useSlotProps(parameters) {
16
+ const {
17
+ elementType,
18
+ externalSlotProps,
19
+ ownerState,
20
+ skipResolvingSlotProps = false,
21
+ ...other
22
+ } = parameters;
23
+ const resolvedComponentsProps = skipResolvingSlotProps ? {} : resolveComponentProps(externalSlotProps, ownerState);
24
+ const {
25
+ props: mergedProps,
26
+ internalRef
27
+ } = mergeSlotProps({
28
+ ...other,
29
+ externalSlotProps: resolvedComponentsProps
30
+ });
31
+ const ref = useForkRef(internalRef, resolvedComponentsProps?.ref, parameters.additionalProps?.ref);
32
+ const props = appendOwnerState(elementType, {
33
+ ...mergedProps,
34
+ ref
35
+ }, ownerState);
36
+ return props;
37
+ }
38
+ export default useSlotProps;
@@ -0,0 +1,2 @@
1
+ export { default } from './useTimeout';
2
+ export { Timeout } from './useTimeout';
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+
3
+ import useLazyRef from '../useLazyRef/useLazyRef';
4
+ import useOnMount from '../useOnMount/useOnMount';
5
+ export class Timeout {
6
+ static create() {
7
+ return new Timeout();
8
+ }
9
+ currentId = null;
10
+
11
+ /**
12
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
13
+ */
14
+ start(delay, fn) {
15
+ this.clear();
16
+ this.currentId = setTimeout(() => {
17
+ this.currentId = null;
18
+ fn();
19
+ }, delay);
20
+ }
21
+ clear = () => {
22
+ if (this.currentId !== null) {
23
+ clearTimeout(this.currentId);
24
+ this.currentId = null;
25
+ }
26
+ };
27
+ disposeEffect = () => {
28
+ return this.clear;
29
+ };
30
+ }
31
+ export default function useTimeout() {
32
+ const timeout = useLazyRef(Timeout.create).current;
33
+ useOnMount(timeout.disposeEffect);
34
+ return timeout;
35
+ }
@@ -0,0 +1 @@
1
+ export { default } from './visuallyHidden';
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  const visuallyHidden = {
8
2
  border: 0,
9
3
  clip: 'rect(0 0 0 0)',
@@ -15,4 +9,4 @@ const visuallyHidden = {
15
9
  whiteSpace: 'nowrap',
16
10
  width: '1px'
17
11
  };
18
- var _default = exports.default = visuallyHidden;
12
+ export default visuallyHidden;
@@ -1,9 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exactProp;
1
7
  // This module is based on https://github.com/airbnb/prop-types-exact repository.
2
8
  // However, in order to reduce the number of dependencies and to remove some extra safe checks
3
9
  // the module was forked.
4
10
 
5
11
  const specialProperty = 'exact-prop: \u200b';
6
- export default function exactProp(propTypes) {
12
+ function exactProp(propTypes) {
7
13
  if (process.env.NODE_ENV === 'production') {
8
14
  return propTypes;
9
15
  }
@@ -1 +1,13 @@
1
- export { default } from './exactProp';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _exactProp.default;
11
+ }
12
+ });
13
+ var _exactProp = _interopRequireDefault(require("./exactProp"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/exactProp/index.js",
3
+ "module": "../esm/exactProp/index.js",
4
+ "main": "./index.js",
5
5
  "types": "./index.d.ts"
6
6
  }
@@ -0,0 +1,10 @@
1
+ import { EventHandlers } from '../types';
2
+ /**
3
+ * Extracts event handlers from a given object.
4
+ * A prop is considered an event handler if it is a function and its name starts with `on`.
5
+ *
6
+ * @param object An object to extract event handlers from.
7
+ * @param excludeKeys An array of keys to exclude from the returned object.
8
+ */
9
+ declare function extractEventHandlers(object: Record<string, any> | undefined, excludeKeys?: string[]): EventHandlers;
10
+ export default extractEventHandlers;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Extracts event handlers from a given object.
9
+ * A prop is considered an event handler if it is a function and its name starts with `on`.
10
+ *
11
+ * @param object An object to extract event handlers from.
12
+ * @param excludeKeys An array of keys to exclude from the returned object.
13
+ */
14
+ function extractEventHandlers(object, excludeKeys = []) {
15
+ if (object === undefined) {
16
+ return {};
17
+ }
18
+ const result = {};
19
+ Object.keys(object).filter(prop => prop.match(/^on[A-Z]/) && typeof object[prop] === 'function' && !excludeKeys.includes(prop)).forEach(prop => {
20
+ result[prop] = object[prop];
21
+ });
22
+ return result;
23
+ }
24
+ var _default = exports.default = extractEventHandlers;
@@ -0,0 +1 @@
1
+ export { default } from './extractEventHandlers';
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  Object.defineProperty(exports, "default", {
8
8
  enumerable: true,
9
9
  get: function () {
10
- return _ClassNameGenerator.default;
10
+ return _extractEventHandlers.default;
11
11
  }
12
12
  });
13
- var _ClassNameGenerator = _interopRequireDefault(require("./ClassNameGenerator"));
13
+ var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../esm/extractEventHandlers/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -1,9 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = formatMuiErrorMessage;
1
7
  /**
2
8
  * WARNING: Don't import this directly.
3
9
  * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
4
10
  * @param {number} code
5
11
  */
6
- export default function formatMuiErrorMessage(code) {
12
+ function formatMuiErrorMessage(code) {
7
13
  // Apply babel-plugin-transform-template-literals in loose mode
8
14
  // loose mode is safe if we're concatenating primitives
9
15
  // see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
@@ -1 +1,13 @@
1
- export { default } from './formatMuiErrorMessage';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _formatMuiErrorMessage.default;
11
+ }
12
+ });
13
+ var _formatMuiErrorMessage = _interopRequireDefault(require("./formatMuiErrorMessage"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sideEffects": false,
3
- "module": "./index.js",
4
- "main": "../node/formatMuiErrorMessage/index.js",
3
+ "module": "../esm/formatMuiErrorMessage/index.js",
4
+ "main": "./index.js",
5
5
  "types": "./index.d.ts"
6
6
  }