@mui/utils 9.0.0 → 9.1.0
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 +216 -1245
- package/LICENSE +1 -1
- 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/fastDeepAssign/fastDeepAssign.js +6 -1
- package/fastDeepAssign/fastDeepAssign.mjs +6 -1
- 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 +5 -0
- package/index.d.ts +5 -0
- package/index.js +42 -2
- package/index.mjs +6 -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/isHostComponent/isHostComponent.d.mts +1 -1
- package/isHostComponent/isHostComponent.d.ts +1 -1
- package/package.json +72 -2
- 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/useRovingTabIndex/useRovingTabIndex.js +3 -3
- package/useRovingTabIndex/useRovingTabIndex.mjs +3 -3
- package/useValueAsRef/index.d.mts +1 -0
- package/useValueAsRef/index.d.ts +1 -0
- package/useValueAsRef/index.js +13 -0
- package/useValueAsRef/index.mjs +1 -0
- package/useValueAsRef/useValueAsRef.d.mts +14 -0
- package/useValueAsRef/useValueAsRef.d.ts +14 -0
- package/useValueAsRef/useValueAsRef.js +35 -0
- package/useValueAsRef/useValueAsRef.mjs +29 -0
- package/visuallyHidden/visuallyHidden.d.mts +2 -1
- package/visuallyHidden/visuallyHidden.d.ts +2 -1
package/LICENSE
CHANGED
|
@@ -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;
|
|
@@ -9,7 +9,6 @@ exports.default = fastDeepAssign;
|
|
|
9
9
|
// MIT License
|
|
10
10
|
// Copyright (c) 2012 - 2022 James Halliday, Josh Duff, and other contributors of deepmerge
|
|
11
11
|
|
|
12
|
-
/* eslint-disable guard-for-in */
|
|
13
12
|
/* eslint-disable no-else-return */
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -43,6 +42,9 @@ function cloneArray(value) {
|
|
|
43
42
|
function cloneObject(target) {
|
|
44
43
|
const result = {};
|
|
45
44
|
for (const key in target) {
|
|
45
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
46
48
|
result[key] = clone(target[key]);
|
|
47
49
|
}
|
|
48
50
|
return result;
|
|
@@ -69,6 +71,9 @@ function clone(entry) {
|
|
|
69
71
|
}
|
|
70
72
|
function mergeObject(target, source) {
|
|
71
73
|
for (const key in source) {
|
|
74
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
72
77
|
if (key in target) {
|
|
73
78
|
target[key] = fastDeepAssign(target[key], source[key]);
|
|
74
79
|
} else {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// MIT License
|
|
4
4
|
// Copyright (c) 2012 - 2022 James Halliday, Josh Duff, and other contributors of deepmerge
|
|
5
5
|
|
|
6
|
-
/* eslint-disable guard-for-in */
|
|
7
6
|
/* eslint-disable no-else-return */
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -37,6 +36,9 @@ function cloneArray(value) {
|
|
|
37
36
|
function cloneObject(target) {
|
|
38
37
|
const result = {};
|
|
39
38
|
for (const key in target) {
|
|
39
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
40
42
|
result[key] = clone(target[key]);
|
|
41
43
|
}
|
|
42
44
|
return result;
|
|
@@ -63,6 +65,9 @@ function clone(entry) {
|
|
|
63
65
|
}
|
|
64
66
|
function mergeObject(target, source) {
|
|
65
67
|
for (const key in source) {
|
|
68
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
66
71
|
if (key in target) {
|
|
67
72
|
target[key] = fastDeepAssign(target[key], source[key]);
|
|
68
73
|
} else {
|
|
@@ -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,8 @@ 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";
|
|
38
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.mjs";
|
|
35
39
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
36
40
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
37
41
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
|
@@ -52,4 +56,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
52
56
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
|
|
53
57
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
|
|
54
58
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
|
|
59
|
+
export { default as isEventHandler } from "./isEventHandler/index.mjs";
|
|
55
60
|
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,8 @@ 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";
|
|
38
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.js";
|
|
35
39
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.js";
|
|
36
40
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.js";
|
|
37
41
|
export { default as usePreviousProps } from "./usePreviousProps/index.js";
|
|
@@ -52,4 +56,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
52
56
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.js";
|
|
53
57
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.js";
|
|
54
58
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.js";
|
|
59
|
+
export { default as isEventHandler } from "./isEventHandler/index.js";
|
|
55
60
|
export * from "./types/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.
|
|
2
|
+
* @mui/utils v9.1.0
|
|
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,8 @@ var _exportNames = {
|
|
|
48
50
|
unstable_Timeout: true,
|
|
49
51
|
unstable_useOnMount: true,
|
|
50
52
|
unstable_useIsFocusVisible: true,
|
|
53
|
+
unstable_useForcedRerendering: true,
|
|
54
|
+
unstable_useValueAsRef: true,
|
|
51
55
|
unstable_isFocusVisible: true,
|
|
52
56
|
unstable_getScrollbarSize: true,
|
|
53
57
|
usePreviousProps: true,
|
|
@@ -65,7 +69,8 @@ var _exportNames = {
|
|
|
65
69
|
unstable_resolveComponentProps: true,
|
|
66
70
|
unstable_extractEventHandlers: true,
|
|
67
71
|
unstable_getReactNodeRef: true,
|
|
68
|
-
unstable_getReactElementRef: true
|
|
72
|
+
unstable_getReactElementRef: true,
|
|
73
|
+
isEventHandler: true
|
|
69
74
|
};
|
|
70
75
|
Object.defineProperty(exports, "HTMLElementType", {
|
|
71
76
|
enumerable: true,
|
|
@@ -139,6 +144,12 @@ Object.defineProperty(exports, "internal_resolveProps", {
|
|
|
139
144
|
return _resolveProps.default;
|
|
140
145
|
}
|
|
141
146
|
});
|
|
147
|
+
Object.defineProperty(exports, "isEventHandler", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return _isEventHandler.default;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
142
153
|
Object.defineProperty(exports, "isPlainObject", {
|
|
143
154
|
enumerable: true,
|
|
144
155
|
get: function () {
|
|
@@ -181,6 +192,12 @@ Object.defineProperty(exports, "unstable_composeClasses", {
|
|
|
181
192
|
return _composeClasses.default;
|
|
182
193
|
}
|
|
183
194
|
});
|
|
195
|
+
Object.defineProperty(exports, "unstable_contains", {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
get: function () {
|
|
198
|
+
return _contains.default;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
184
201
|
Object.defineProperty(exports, "unstable_createChainedFunction", {
|
|
185
202
|
enumerable: true,
|
|
186
203
|
get: function () {
|
|
@@ -235,6 +252,12 @@ Object.defineProperty(exports, "unstable_getActiveElement", {
|
|
|
235
252
|
return _getActiveElement.default;
|
|
236
253
|
}
|
|
237
254
|
});
|
|
255
|
+
Object.defineProperty(exports, "unstable_getEventTarget", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
get: function () {
|
|
258
|
+
return _getEventTarget.default;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
238
261
|
Object.defineProperty(exports, "unstable_getReactElementRef", {
|
|
239
262
|
enumerable: true,
|
|
240
263
|
get: function () {
|
|
@@ -331,6 +354,12 @@ Object.defineProperty(exports, "unstable_useEventCallback", {
|
|
|
331
354
|
return _useEventCallback.default;
|
|
332
355
|
}
|
|
333
356
|
});
|
|
357
|
+
Object.defineProperty(exports, "unstable_useForcedRerendering", {
|
|
358
|
+
enumerable: true,
|
|
359
|
+
get: function () {
|
|
360
|
+
return _useForcedRerendering.default;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
334
363
|
Object.defineProperty(exports, "unstable_useForkRef", {
|
|
335
364
|
enumerable: true,
|
|
336
365
|
get: function () {
|
|
@@ -373,6 +402,12 @@ Object.defineProperty(exports, "unstable_useTimeout", {
|
|
|
373
402
|
return _useTimeout.default;
|
|
374
403
|
}
|
|
375
404
|
});
|
|
405
|
+
Object.defineProperty(exports, "unstable_useValueAsRef", {
|
|
406
|
+
enumerable: true,
|
|
407
|
+
get: function () {
|
|
408
|
+
return _useValueAsRef.default;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
376
411
|
Object.defineProperty(exports, "usePreviousProps", {
|
|
377
412
|
enumerable: true,
|
|
378
413
|
get: function () {
|
|
@@ -391,7 +426,9 @@ var _elementAcceptingRef = _interopRequireDefault(require("./elementAcceptingRef
|
|
|
391
426
|
var _elementTypeAcceptingRef = _interopRequireDefault(require("./elementTypeAcceptingRef"));
|
|
392
427
|
var _exactProp = _interopRequireDefault(require("./exactProp"));
|
|
393
428
|
var _formatMuiErrorMessage = _interopRequireDefault(require("./formatMuiErrorMessage"));
|
|
429
|
+
var _contains = _interopRequireDefault(require("./contains"));
|
|
394
430
|
var _getActiveElement = _interopRequireDefault(require("./getActiveElement"));
|
|
431
|
+
var _getEventTarget = _interopRequireDefault(require("./getEventTarget"));
|
|
395
432
|
var _getDisplayName = _interopRequireDefault(require("./getDisplayName"));
|
|
396
433
|
var _HTMLElementType = _interopRequireDefault(require("./HTMLElementType"));
|
|
397
434
|
var _ponyfillGlobal = _interopRequireDefault(require("./ponyfillGlobal"));
|
|
@@ -418,6 +455,8 @@ var _useLazyRef = _interopRequireDefault(require("./useLazyRef"));
|
|
|
418
455
|
var _useTimeout = _interopRequireWildcard(require("./useTimeout"));
|
|
419
456
|
var _useOnMount = _interopRequireDefault(require("./useOnMount"));
|
|
420
457
|
var _useIsFocusVisible = _interopRequireDefault(require("./useIsFocusVisible"));
|
|
458
|
+
var _useForcedRerendering = _interopRequireDefault(require("./useForcedRerendering"));
|
|
459
|
+
var _useValueAsRef = _interopRequireDefault(require("./useValueAsRef"));
|
|
421
460
|
var _isFocusVisible = _interopRequireDefault(require("./isFocusVisible"));
|
|
422
461
|
var _getScrollbarSize = _interopRequireDefault(require("./getScrollbarSize"));
|
|
423
462
|
var _usePreviousProps = _interopRequireDefault(require("./usePreviousProps"));
|
|
@@ -446,6 +485,7 @@ var _resolveComponentProps = _interopRequireDefault(require("./resolveComponentP
|
|
|
446
485
|
var _extractEventHandlers = _interopRequireDefault(require("./extractEventHandlers"));
|
|
447
486
|
var _getReactNodeRef = _interopRequireDefault(require("./getReactNodeRef"));
|
|
448
487
|
var _getReactElementRef = _interopRequireDefault(require("./getReactElementRef"));
|
|
488
|
+
var _isEventHandler = _interopRequireDefault(require("./isEventHandler"));
|
|
449
489
|
var _types = require("./types");
|
|
450
490
|
Object.keys(_types).forEach(function (key) {
|
|
451
491
|
if (key === "default" || key === "__esModule") return;
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/utils v9.
|
|
2
|
+
* @mui/utils v9.1.0
|
|
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,8 @@ 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";
|
|
45
|
+
export { default as unstable_useValueAsRef } from "./useValueAsRef/index.mjs";
|
|
42
46
|
export { default as unstable_isFocusVisible } from "./isFocusVisible/index.mjs";
|
|
43
47
|
export { default as unstable_getScrollbarSize } from "./getScrollbarSize/index.mjs";
|
|
44
48
|
export { default as usePreviousProps } from "./usePreviousProps/index.mjs";
|
|
@@ -58,4 +62,5 @@ export { default as unstable_resolveComponentProps } from "./resolveComponentPro
|
|
|
58
62
|
export { default as unstable_extractEventHandlers } from "./extractEventHandlers/index.mjs";
|
|
59
63
|
export { default as unstable_getReactNodeRef } from "./getReactNodeRef/index.mjs";
|
|
60
64
|
export { default as unstable_getReactElementRef } from "./getReactElementRef/index.mjs";
|
|
65
|
+
export { default as isEventHandler } from "./isEventHandler/index.mjs";
|
|
61
66
|
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
|
+
}
|