@mui/utils 9.0.0-beta.1 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +160 -1245
- package/contains/contains.d.mts +14 -0
- package/contains/contains.d.ts +14 -0
- package/contains/contains.js +42 -0
- package/contains/contains.mjs +36 -0
- package/contains/index.d.mts +1 -0
- package/contains/index.d.ts +1 -0
- package/contains/index.js +13 -0
- package/contains/index.mjs +1 -0
- package/elementTypeAcceptingRef/elementTypeAcceptingRef.js +1 -0
- package/elementTypeAcceptingRef/elementTypeAcceptingRef.mjs +1 -0
- package/extractEventHandlers/extractEventHandlers.d.mts +1 -2
- package/extractEventHandlers/extractEventHandlers.d.ts +1 -2
- package/extractEventHandlers/extractEventHandlers.js +8 -5
- package/extractEventHandlers/extractEventHandlers.mjs +7 -5
- package/getEventTarget/getEventTarget.d.mts +14 -0
- package/getEventTarget/getEventTarget.d.ts +14 -0
- package/getEventTarget/getEventTarget.js +22 -0
- package/getEventTarget/getEventTarget.mjs +16 -0
- package/getEventTarget/index.d.mts +1 -0
- package/getEventTarget/index.d.ts +1 -0
- package/getEventTarget/index.js +13 -0
- package/getEventTarget/index.mjs +1 -0
- package/index.d.mts +4 -0
- package/index.d.ts +4 -0
- package/index.js +34 -2
- package/index.mjs +5 -1
- package/isEventHandler/index.d.mts +1 -0
- package/isEventHandler/index.d.ts +1 -0
- package/isEventHandler/index.js +13 -0
- package/isEventHandler/index.mjs +1 -0
- package/isEventHandler/isEventHandler.d.mts +1 -0
- package/isEventHandler/isEventHandler.d.ts +1 -0
- package/isEventHandler/isEventHandler.js +13 -0
- package/isEventHandler/isEventHandler.mjs +7 -0
- package/package.json +59 -3
- package/resolveProps/resolveProps.js +1 -1
- package/resolveProps/resolveProps.mjs +1 -1
- package/useForcedRerendering/index.d.mts +1 -0
- package/useForcedRerendering/index.d.ts +1 -0
- package/useForcedRerendering/index.js +13 -0
- package/useForcedRerendering/index.mjs +1 -0
- package/useForcedRerendering/useForcedRerendering.d.mts +6 -0
- package/useForcedRerendering/useForcedRerendering.d.ts +6 -0
- package/useForcedRerendering/useForcedRerendering.js +20 -0
- package/useForcedRerendering/useForcedRerendering.mjs +15 -0
- package/useIsFocusVisible/useIsFocusVisible.js +1 -1
- package/useIsFocusVisible/useIsFocusVisible.mjs +1 -1
- package/visuallyHidden/visuallyHidden.d.mts +2 -1
- package/visuallyHidden/visuallyHidden.d.ts +2 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Shadow DOM-aware containment check.
|
|
5
|
+
*
|
|
6
|
+
* Native `parent.contains(child)` returns `false` when the child is inside a
|
|
7
|
+
* shadow root that is a descendant of the parent. This function handles that
|
|
8
|
+
* case by traversing up through shadow root hosts.
|
|
9
|
+
*
|
|
10
|
+
* @param parent - The potential ancestor element.
|
|
11
|
+
* @param child - The potential descendant element.
|
|
12
|
+
* @returns Whether `parent` contains `child`, even across shadow root boundaries.
|
|
13
|
+
*/
|
|
14
|
+
export default function contains(parent: Element | null | undefined, child: Element | null | undefined): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Shadow DOM-aware containment check.
|
|
5
|
+
*
|
|
6
|
+
* Native `parent.contains(child)` returns `false` when the child is inside a
|
|
7
|
+
* shadow root that is a descendant of the parent. This function handles that
|
|
8
|
+
* case by traversing up through shadow root hosts.
|
|
9
|
+
*
|
|
10
|
+
* @param parent - The potential ancestor element.
|
|
11
|
+
* @param child - The potential descendant element.
|
|
12
|
+
* @returns Whether `parent` contains `child`, even across shadow root boundaries.
|
|
13
|
+
*/
|
|
14
|
+
export default function contains(parent: Element | null | undefined, child: Element | null | undefined): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = contains;
|
|
7
|
+
/**
|
|
8
|
+
* Copied from @base-ui/utils
|
|
9
|
+
*
|
|
10
|
+
* Shadow DOM-aware containment check.
|
|
11
|
+
*
|
|
12
|
+
* Native `parent.contains(child)` returns `false` when the child is inside a
|
|
13
|
+
* shadow root that is a descendant of the parent. This function handles that
|
|
14
|
+
* case by traversing up through shadow root hosts.
|
|
15
|
+
*
|
|
16
|
+
* @param parent - The potential ancestor element.
|
|
17
|
+
* @param child - The potential descendant element.
|
|
18
|
+
* @returns Whether `parent` contains `child`, even across shadow root boundaries.
|
|
19
|
+
*/
|
|
20
|
+
function contains(parent, child) {
|
|
21
|
+
if (!parent || !child) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// First, attempt with the faster native method.
|
|
26
|
+
if (parent.contains(child)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Then fall back to traversing out of shadow roots when needed.
|
|
31
|
+
const rootNode = child.getRootNode?.();
|
|
32
|
+
if (rootNode && rootNode instanceof ShadowRoot) {
|
|
33
|
+
let next = child;
|
|
34
|
+
while (next) {
|
|
35
|
+
if (parent === next) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
next = next.parentNode ?? next.host ?? null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Shadow DOM-aware containment check.
|
|
5
|
+
*
|
|
6
|
+
* Native `parent.contains(child)` returns `false` when the child is inside a
|
|
7
|
+
* shadow root that is a descendant of the parent. This function handles that
|
|
8
|
+
* case by traversing up through shadow root hosts.
|
|
9
|
+
*
|
|
10
|
+
* @param parent - The potential ancestor element.
|
|
11
|
+
* @param child - The potential descendant element.
|
|
12
|
+
* @returns Whether `parent` contains `child`, even across shadow root boundaries.
|
|
13
|
+
*/
|
|
14
|
+
export default function contains(parent, child) {
|
|
15
|
+
if (!parent || !child) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// First, attempt with the faster native method.
|
|
20
|
+
if (parent.contains(child)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Then fall back to traversing out of shadow roots when needed.
|
|
25
|
+
const rootNode = child.getRootNode?.();
|
|
26
|
+
if (rootNode && rootNode instanceof ShadowRoot) {
|
|
27
|
+
let next = child;
|
|
28
|
+
while (next) {
|
|
29
|
+
if (parent === next) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
next = next.parentNode ?? next.host ?? null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./contains.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./contains.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _contains.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _contains = _interopRequireDefault(require("./contains"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./contains.mjs";
|
|
@@ -45,6 +45,7 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
|
|
|
45
45
|
warningHint = 'Did you accidentally provide a React.Fragment instead?';
|
|
46
46
|
}
|
|
47
47
|
if (warningHint !== undefined) {
|
|
48
|
+
// #host-reference
|
|
48
49
|
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
49
50
|
}
|
|
50
51
|
return null;
|
|
@@ -37,6 +37,7 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
|
|
|
37
37
|
warningHint = 'Did you accidentally provide a React.Fragment instead?';
|
|
38
38
|
}
|
|
39
39
|
if (warningHint !== undefined) {
|
|
40
|
+
// #host-reference
|
|
40
41
|
return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
|
|
41
42
|
}
|
|
42
43
|
return null;
|
|
@@ -4,7 +4,6 @@ import { EventHandlers } from "../types/index.mjs";
|
|
|
4
4
|
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
5
5
|
*
|
|
6
6
|
* @param object An object to extract event handlers from.
|
|
7
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
8
7
|
*/
|
|
9
|
-
declare function extractEventHandlers(object: Record<string, any> | undefined
|
|
8
|
+
declare function extractEventHandlers(object: Record<string, any> | undefined): EventHandlers;
|
|
10
9
|
export default extractEventHandlers;
|
|
@@ -4,7 +4,6 @@ import { EventHandlers } from "../types/index.js";
|
|
|
4
4
|
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
5
5
|
*
|
|
6
6
|
* @param object An object to extract event handlers from.
|
|
7
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
8
7
|
*/
|
|
9
|
-
declare function extractEventHandlers(object: Record<string, any> | undefined
|
|
8
|
+
declare function extractEventHandlers(object: Record<string, any> | undefined): EventHandlers;
|
|
10
9
|
export default extractEventHandlers;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _isEventHandler = _interopRequireDefault(require("@mui/utils/isEventHandler"));
|
|
7
9
|
/**
|
|
8
10
|
* Extracts event handlers from a given object.
|
|
9
11
|
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
10
12
|
*
|
|
11
13
|
* @param object An object to extract event handlers from.
|
|
12
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
13
14
|
*/
|
|
14
|
-
function extractEventHandlers(object
|
|
15
|
+
function extractEventHandlers(object) {
|
|
15
16
|
if (object === undefined) {
|
|
16
17
|
return {};
|
|
17
18
|
}
|
|
18
19
|
const result = {};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
for (const prop of Object.keys(object)) {
|
|
21
|
+
if ((0, _isEventHandler.default)(prop, object[prop])) {
|
|
22
|
+
result[prop] = object[prop];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
22
25
|
return result;
|
|
23
26
|
}
|
|
24
27
|
var _default = exports.default = extractEventHandlers;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
+
import isEventHandler from '@mui/utils/isEventHandler';
|
|
1
2
|
/**
|
|
2
3
|
* Extracts event handlers from a given object.
|
|
3
4
|
* A prop is considered an event handler if it is a function and its name starts with `on`.
|
|
4
5
|
*
|
|
5
6
|
* @param object An object to extract event handlers from.
|
|
6
|
-
* @param excludeKeys An array of keys to exclude from the returned object.
|
|
7
7
|
*/
|
|
8
|
-
function extractEventHandlers(object
|
|
8
|
+
function extractEventHandlers(object) {
|
|
9
9
|
if (object === undefined) {
|
|
10
10
|
return {};
|
|
11
11
|
}
|
|
12
12
|
const result = {};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
for (const prop of Object.keys(object)) {
|
|
14
|
+
if (isEventHandler(prop, object[prop])) {
|
|
15
|
+
result[prop] = object[prop];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
16
18
|
return result;
|
|
17
19
|
}
|
|
18
20
|
export default extractEventHandlers;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Gets the actual target of an event, using `composedPath()` to traverse
|
|
5
|
+
* shadow DOM boundaries.
|
|
6
|
+
*
|
|
7
|
+
* In shadow DOM, `event.target` may return the shadow host rather than the
|
|
8
|
+
* actual element that triggered the event. `composedPath()[0]` returns the
|
|
9
|
+
* true originating element.
|
|
10
|
+
*
|
|
11
|
+
* @param event - The event to get the target from.
|
|
12
|
+
* @returns The actual event target, or `null` if not available.
|
|
13
|
+
*/
|
|
14
|
+
export default function getEventTarget(event: Event): EventTarget | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Gets the actual target of an event, using `composedPath()` to traverse
|
|
5
|
+
* shadow DOM boundaries.
|
|
6
|
+
*
|
|
7
|
+
* In shadow DOM, `event.target` may return the shadow host rather than the
|
|
8
|
+
* actual element that triggered the event. `composedPath()[0]` returns the
|
|
9
|
+
* true originating element.
|
|
10
|
+
*
|
|
11
|
+
* @param event - The event to get the target from.
|
|
12
|
+
* @returns The actual event target, or `null` if not available.
|
|
13
|
+
*/
|
|
14
|
+
export default function getEventTarget(event: Event): EventTarget | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getEventTarget;
|
|
7
|
+
/**
|
|
8
|
+
* Copied from @base-ui/utils
|
|
9
|
+
*
|
|
10
|
+
* Gets the actual target of an event, using `composedPath()` to traverse
|
|
11
|
+
* shadow DOM boundaries.
|
|
12
|
+
*
|
|
13
|
+
* In shadow DOM, `event.target` may return the shadow host rather than the
|
|
14
|
+
* actual element that triggered the event. `composedPath()[0]` returns the
|
|
15
|
+
* true originating element.
|
|
16
|
+
*
|
|
17
|
+
* @param event - The event to get the target from.
|
|
18
|
+
* @returns The actual event target, or `null` if not available.
|
|
19
|
+
*/
|
|
20
|
+
function getEventTarget(event) {
|
|
21
|
+
return event.composedPath?.()[0] ?? event.target;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from @base-ui/utils
|
|
3
|
+
*
|
|
4
|
+
* Gets the actual target of an event, using `composedPath()` to traverse
|
|
5
|
+
* shadow DOM boundaries.
|
|
6
|
+
*
|
|
7
|
+
* In shadow DOM, `event.target` may return the shadow host rather than the
|
|
8
|
+
* actual element that triggered the event. `composedPath()[0]` returns the
|
|
9
|
+
* true originating element.
|
|
10
|
+
*
|
|
11
|
+
* @param event - The event to get the target from.
|
|
12
|
+
* @returns The actual event target, or `null` if not available.
|
|
13
|
+
*/
|
|
14
|
+
export default function getEventTarget(event) {
|
|
15
|
+
return event.composedPath?.()[0] ?? event.target;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getEventTarget.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getEventTarget.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _getEventTarget.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _getEventTarget = _interopRequireDefault(require("./getEventTarget"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./getEventTarget.mjs";
|
package/index.d.mts
CHANGED
|
@@ -5,7 +5,9 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.mjs"
|
|
|
5
5
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.mjs";
|
|
6
6
|
export { default as exactProp } from "./exactProp/index.mjs";
|
|
7
7
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.mjs";
|
|
8
|
+
export { default as unstable_contains } from "./contains/index.mjs";
|
|
8
9
|
export { default as unstable_getActiveElement } from "./getActiveElement/index.mjs";
|
|
10
|
+
export { default as unstable_getEventTarget } from "./getEventTarget/index.mjs";
|
|
9
11
|
export { default as getDisplayName } from "./getDisplayName/index.mjs";
|
|
10
12
|
export { default as HTMLElementType } from "./HTMLElementType/index.mjs";
|
|
11
13
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.mjs";
|
|
@@ -32,6 +34,7 @@ export { default as unstable_useLazyRef } from "./useLazyRef/index.mjs";
|
|
|
32
34
|
export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./useTimeout/index.mjs";
|
|
33
35
|
export { default as unstable_useOnMount } from "./useOnMount/index.mjs";
|
|
34
36
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.mjs";
|
|
37
|
+
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.mjs";
|
|
35
38
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
36
39
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
37
40
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
|
@@ -52,4 +55,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
52
55
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
|
|
53
56
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
|
|
54
57
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
|
|
58
|
+
export { default as isEventHandler } from "./isEventHandler/index.mjs";
|
|
55
59
|
export * from "./types/index.mjs";
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.js";
|
|
|
5
5
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.js";
|
|
6
6
|
export { default as exactProp } from "./exactProp/index.js";
|
|
7
7
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.js";
|
|
8
|
+
export { default as unstable_contains } from "./contains/index.js";
|
|
8
9
|
export { default as unstable_getActiveElement } from "./getActiveElement/index.js";
|
|
10
|
+
export { default as unstable_getEventTarget } from "./getEventTarget/index.js";
|
|
9
11
|
export { default as getDisplayName } from "./getDisplayName/index.js";
|
|
10
12
|
export { default as HTMLElementType } from "./HTMLElementType/index.js";
|
|
11
13
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.js";
|
|
@@ -32,6 +34,7 @@ export { default as unstable_useLazyRef } from "./useLazyRef/index.js";
|
|
|
32
34
|
export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./useTimeout/index.js";
|
|
33
35
|
export { default as unstable_useOnMount } from "./useOnMount/index.js";
|
|
34
36
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.js";
|
|
37
|
+
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.js";
|
|
35
38
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.js";
|
|
36
39
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.js";
|
|
37
40
|
export { default as usePreviousProps } from "./usePreviousProps/index.js";
|
|
@@ -52,4 +55,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
52
55
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.js";
|
|
53
56
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.js";
|
|
54
57
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.js";
|
|
58
|
+
export { default as isEventHandler } from "./isEventHandler/index.js";
|
|
55
59
|
export * from "./types/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.0.
|
|
2
|
+
* @mui/utils v9.0.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -20,7 +20,9 @@ var _exportNames = {
|
|
|
20
20
|
elementTypeAcceptingRef: true,
|
|
21
21
|
exactProp: true,
|
|
22
22
|
formatMuiErrorMessage: true,
|
|
23
|
+
unstable_contains: true,
|
|
23
24
|
unstable_getActiveElement: true,
|
|
25
|
+
unstable_getEventTarget: true,
|
|
24
26
|
getDisplayName: true,
|
|
25
27
|
HTMLElementType: true,
|
|
26
28
|
ponyfillGlobal: true,
|
|
@@ -48,6 +50,7 @@ var _exportNames = {
|
|
|
48
50
|
unstable_Timeout: true,
|
|
49
51
|
unstable_useOnMount: true,
|
|
50
52
|
unstable_useIsFocusVisible: true,
|
|
53
|
+
unstable_useForcedRerendering: true,
|
|
51
54
|
unstable_isFocusVisible: true,
|
|
52
55
|
unstable_getScrollbarSize: true,
|
|
53
56
|
usePreviousProps: true,
|
|
@@ -65,7 +68,8 @@ var _exportNames = {
|
|
|
65
68
|
unstable_resolveComponentProps: true,
|
|
66
69
|
unstable_extractEventHandlers: true,
|
|
67
70
|
unstable_getReactNodeRef: true,
|
|
68
|
-
unstable_getReactElementRef: true
|
|
71
|
+
unstable_getReactElementRef: true,
|
|
72
|
+
isEventHandler: true
|
|
69
73
|
};
|
|
70
74
|
Object.defineProperty(exports, "HTMLElementType", {
|
|
71
75
|
enumerable: true,
|
|
@@ -139,6 +143,12 @@ Object.defineProperty(exports, "internal_resolveProps", {
|
|
|
139
143
|
return _resolveProps.default;
|
|
140
144
|
}
|
|
141
145
|
});
|
|
146
|
+
Object.defineProperty(exports, "isEventHandler", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return _isEventHandler.default;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
142
152
|
Object.defineProperty(exports, "isPlainObject", {
|
|
143
153
|
enumerable: true,
|
|
144
154
|
get: function () {
|
|
@@ -181,6 +191,12 @@ Object.defineProperty(exports, "unstable_composeClasses", {
|
|
|
181
191
|
return _composeClasses.default;
|
|
182
192
|
}
|
|
183
193
|
});
|
|
194
|
+
Object.defineProperty(exports, "unstable_contains", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () {
|
|
197
|
+
return _contains.default;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
184
200
|
Object.defineProperty(exports, "unstable_createChainedFunction", {
|
|
185
201
|
enumerable: true,
|
|
186
202
|
get: function () {
|
|
@@ -235,6 +251,12 @@ Object.defineProperty(exports, "unstable_getActiveElement", {
|
|
|
235
251
|
return _getActiveElement.default;
|
|
236
252
|
}
|
|
237
253
|
});
|
|
254
|
+
Object.defineProperty(exports, "unstable_getEventTarget", {
|
|
255
|
+
enumerable: true,
|
|
256
|
+
get: function () {
|
|
257
|
+
return _getEventTarget.default;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
238
260
|
Object.defineProperty(exports, "unstable_getReactElementRef", {
|
|
239
261
|
enumerable: true,
|
|
240
262
|
get: function () {
|
|
@@ -331,6 +353,12 @@ Object.defineProperty(exports, "unstable_useEventCallback", {
|
|
|
331
353
|
return _useEventCallback.default;
|
|
332
354
|
}
|
|
333
355
|
});
|
|
356
|
+
Object.defineProperty(exports, "unstable_useForcedRerendering", {
|
|
357
|
+
enumerable: true,
|
|
358
|
+
get: function () {
|
|
359
|
+
return _useForcedRerendering.default;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
334
362
|
Object.defineProperty(exports, "unstable_useForkRef", {
|
|
335
363
|
enumerable: true,
|
|
336
364
|
get: function () {
|
|
@@ -391,7 +419,9 @@ var _elementAcceptingRef = _interopRequireDefault(require("./elementAcceptingRef
|
|
|
391
419
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("./elementTypeAcceptingRef"));
|
|
392
420
|
var _exactProp = _interopRequireDefault(require("./exactProp"));
|
|
393
421
|
var _formatMuiErrorMessage = _interopRequireDefault(require("./formatMuiErrorMessage"));
|
|
422
|
+
var _contains = _interopRequireDefault(require("./contains"));
|
|
394
423
|
var _getActiveElement = _interopRequireDefault(require("./getActiveElement"));
|
|
424
|
+
var _getEventTarget = _interopRequireDefault(require("./getEventTarget"));
|
|
395
425
|
var _getDisplayName = _interopRequireDefault(require("./getDisplayName"));
|
|
396
426
|
var _HTMLElementType = _interopRequireDefault(require("./HTMLElementType"));
|
|
397
427
|
var _ponyfillGlobal = _interopRequireDefault(require("./ponyfillGlobal"));
|
|
@@ -418,6 +448,7 @@ var _useLazyRef = _interopRequireDefault(require("./useLazyRef"));
|
|
|
418
448
|
var _useTimeout = _interopRequireWildcard(require("./useTimeout"));
|
|
419
449
|
var _useOnMount = _interopRequireDefault(require("./useOnMount"));
|
|
420
450
|
var _useIsFocusVisible = _interopRequireDefault(require("./useIsFocusVisible"));
|
|
451
|
+
var _useForcedRerendering = _interopRequireDefault(require("./useForcedRerendering"));
|
|
421
452
|
var _isFocusVisible = _interopRequireDefault(require("./isFocusVisible"));
|
|
422
453
|
var _getScrollbarSize = _interopRequireDefault(require("./getScrollbarSize"));
|
|
423
454
|
var _usePreviousProps = _interopRequireDefault(require("./usePreviousProps"));
|
|
@@ -446,6 +477,7 @@ var _resolveComponentProps = _interopRequireDefault(require("./resolveComponentP
|
|
|
446
477
|
var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
|
|
447
478
|
var _getReactNodeRef = _interopRequireDefault(require("./getReactNodeRef"));
|
|
448
479
|
var _getReactElementRef = _interopRequireDefault(require("./getReactElementRef"));
|
|
480
|
+
var _isEventHandler = _interopRequireDefault(require("./isEventHandler"));
|
|
449
481
|
var _types = require("./types");
|
|
450
482
|
Object.keys(_types).forEach(function (key) {
|
|
451
483
|
if (key === "default" || key === "__esModule") return;
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.0.
|
|
2
|
+
* @mui/utils v9.0.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -12,7 +12,9 @@ export { default as elementAcceptingRef } from "./elementAcceptingRef/index.mjs"
|
|
|
12
12
|
export { default as elementTypeAcceptingRef } from "./elementTypeAcceptingRef/index.mjs";
|
|
13
13
|
export { default as exactProp } from "./exactProp/index.mjs";
|
|
14
14
|
export { default as formatMuiErrorMessage } from "./formatMuiErrorMessage/index.mjs";
|
|
15
|
+
export { default as unstable_contains } from "./contains/index.mjs";
|
|
15
16
|
export { default as unstable_getActiveElement } from "./getActiveElement/index.mjs";
|
|
17
|
+
export { default as unstable_getEventTarget } from "./getEventTarget/index.mjs";
|
|
16
18
|
export { default as getDisplayName } from "./getDisplayName/index.mjs";
|
|
17
19
|
export { default as HTMLElementType } from "./HTMLElementType/index.mjs";
|
|
18
20
|
export { default as ponyfillGlobal } from "./ponyfillGlobal/index.mjs";
|
|
@@ -39,6 +41,7 @@ export { default as unstable_useLazyRef } from "./useLazyRef/index.mjs";
|
|
|
39
41
|
export { default as unstable_useTimeout, Timeout as unstable_Timeout } from "./useTimeout/index.mjs";
|
|
40
42
|
export { default as unstable_useOnMount } from "./useOnMount/index.mjs";
|
|
41
43
|
export { default as unstable_useIsFocusVisible } from "./useIsFocusVisible/index.mjs";
|
|
44
|
+
export { default as unstable_useForcedRerendering } from "./useForcedRerendering/index.mjs";
|
|
42
45
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
43
46
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
44
47
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
|
@@ -58,4 +61,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
58
61
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
|
|
59
62
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
|
|
60
63
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
|
|
64
|
+
export { default as isEventHandler } from "./isEventHandler/index.mjs";
|
|
61
65
|
export * from "./types/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./isEventHandler.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./isEventHandler.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "default", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _isEventHandler.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _isEventHandler = _interopRequireDefault(require("./isEventHandler"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./isEventHandler.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isEventHandler(key: string, value: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isEventHandler(key: string, value: unknown): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = isEventHandler;
|
|
7
|
+
// Brought from [Base UI](https://github.com/mui/base-ui/blob/master/packages/react/src/merge-props/mergeProps.ts#L119)
|
|
8
|
+
// Use it directly from Base UI once it's a package dependency.
|
|
9
|
+
function isEventHandler(key, value) {
|
|
10
|
+
// This approach is more efficient than using a regex.
|
|
11
|
+
const thirdCharCode = key.charCodeAt(2);
|
|
12
|
+
return key[0] === 'o' && key[1] === 'n' && thirdCharCode >= 65 /* A */ && thirdCharCode <= 90 /* Z */ && typeof value === 'function';
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Brought from [Base UI](https://github.com/mui/base-ui/blob/master/packages/react/src/merge-props/mergeProps.ts#L119)
|
|
2
|
+
// Use it directly from Base UI once it's a package dependency.
|
|
3
|
+
export default function isEventHandler(key, value) {
|
|
4
|
+
// This approach is more efficient than using a regex.
|
|
5
|
+
const thirdCharCode = key.charCodeAt(2);
|
|
6
|
+
return key[0] === 'o' && key[1] === 'n' && thirdCharCode >= 65 /* A */ && thirdCharCode <= 90 /* Z */ && typeof value === 'function';
|
|
7
|
+
}
|