@react-aria/interactions 3.21.2 → 3.22.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/dist/PressResponder.mjs +1 -1
- package/dist/Pressable.mjs +1 -1
- package/dist/context.main.js +1 -1
- package/dist/context.mjs +2 -2
- package/dist/context.module.js +1 -1
- package/dist/createEventHandler.main.js +1 -1
- package/dist/createEventHandler.mjs +2 -2
- package/dist/createEventHandler.module.js +1 -1
- package/dist/textSelection.main.js +14 -14
- package/dist/textSelection.mjs +15 -15
- package/dist/textSelection.module.js +14 -14
- package/dist/types.d.ts +5 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/useFocus.mjs +1 -1
- package/dist/useFocusVisible.main.js +54 -54
- package/dist/useFocusVisible.mjs +55 -55
- package/dist/useFocusVisible.module.js +54 -54
- package/dist/useFocusWithin.mjs +1 -1
- package/dist/useHover.main.js +16 -16
- package/dist/useHover.main.js.map +1 -1
- package/dist/useHover.mjs +17 -17
- package/dist/useHover.module.js +16 -16
- package/dist/useHover.module.js.map +1 -1
- package/dist/useInteractOutside.main.js +14 -14
- package/dist/useInteractOutside.main.js.map +1 -1
- package/dist/useInteractOutside.mjs +15 -15
- package/dist/useInteractOutside.module.js +14 -14
- package/dist/useInteractOutside.module.js.map +1 -1
- package/dist/useKeyboard.mjs +1 -1
- package/dist/useLongPress.main.js +11 -11
- package/dist/useLongPress.main.js.map +1 -1
- package/dist/useLongPress.mjs +12 -12
- package/dist/useLongPress.module.js +11 -11
- package/dist/useLongPress.module.js.map +1 -1
- package/dist/useMove.main.js +36 -36
- package/dist/useMove.mjs +37 -37
- package/dist/useMove.module.js +36 -36
- package/dist/usePress.main.js +95 -54
- package/dist/usePress.main.js.map +1 -1
- package/dist/usePress.mjs +96 -55
- package/dist/usePress.module.js +95 -54
- package/dist/usePress.module.js.map +1 -1
- package/dist/useScrollWheel.main.js +1 -1
- package/dist/useScrollWheel.main.js.map +1 -1
- package/dist/useScrollWheel.mjs +2 -2
- package/dist/useScrollWheel.module.js +1 -1
- package/dist/useScrollWheel.module.js.map +1 -1
- package/dist/utils.main.js +5 -5
- package/dist/utils.mjs +6 -6
- package/dist/utils.module.js +5 -5
- package/package.json +6 -6
- package/src/DOMPropsContext.ts +3 -3
- package/src/useDOMPropsResponder.ts +2 -2
- package/src/useHover.ts +0 -1
- package/src/useInteractOutside.ts +3 -2
- package/src/useLongPress.ts +1 -1
- package/src/usePress.ts +60 -14
- package/src/useScrollWheel.ts +3 -3
package/dist/PressResponder.mjs
CHANGED
|
@@ -49,4 +49,4 @@ function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
export {$f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder};
|
|
52
|
-
//# sourceMappingURL=PressResponder.
|
|
52
|
+
//# sourceMappingURL=PressResponder.module.js.map
|
package/dist/Pressable.mjs
CHANGED
package/dist/context.main.js
CHANGED
|
@@ -24,7 +24,7 @@ $parcel$export(module.exports, "PressResponderContext", () => $01d3f539e91688c8$
|
|
|
24
24
|
const $01d3f539e91688c8$export$5165eccb35aaadb5 = (0, ($parcel$interopDefault($bNpOp$react))).createContext({
|
|
25
25
|
register: ()=>{}
|
|
26
26
|
});
|
|
27
|
-
$01d3f539e91688c8$export$5165eccb35aaadb5.displayName =
|
|
27
|
+
$01d3f539e91688c8$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
//# sourceMappingURL=context.main.js.map
|
package/dist/context.mjs
CHANGED
|
@@ -14,8 +14,8 @@ import $3aeG1$react from "react";
|
|
|
14
14
|
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
|
15
15
|
register: ()=>{}
|
|
16
16
|
});
|
|
17
|
-
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName =
|
|
17
|
+
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
|
21
|
-
//# sourceMappingURL=context.
|
|
21
|
+
//# sourceMappingURL=context.module.js.map
|
package/dist/context.module.js
CHANGED
|
@@ -14,7 +14,7 @@ import $3aeG1$react from "react";
|
|
|
14
14
|
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
|
15
15
|
register: ()=>{}
|
|
16
16
|
});
|
|
17
|
-
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName =
|
|
17
|
+
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
|
@@ -27,7 +27,7 @@ $parcel$export(module.exports, "createEventHandler", () => $951fbcbbca8db6ce$exp
|
|
|
27
27
|
return e.isDefaultPrevented();
|
|
28
28
|
},
|
|
29
29
|
stopPropagation () {
|
|
30
|
-
console.error(
|
|
30
|
+
console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
31
31
|
},
|
|
32
32
|
continuePropagation () {
|
|
33
33
|
shouldStopPropagation = false;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
return e.isDefaultPrevented();
|
|
22
22
|
},
|
|
23
23
|
stopPropagation () {
|
|
24
|
-
console.error(
|
|
24
|
+
console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
25
25
|
},
|
|
26
26
|
continuePropagation () {
|
|
27
27
|
shouldStopPropagation = false;
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
|
37
|
-
//# sourceMappingURL=createEventHandler.
|
|
37
|
+
//# sourceMappingURL=createEventHandler.module.js.map
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
return e.isDefaultPrevented();
|
|
22
22
|
},
|
|
23
23
|
stopPropagation () {
|
|
24
|
-
console.error(
|
|
24
|
+
console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
25
25
|
},
|
|
26
26
|
continuePropagation () {
|
|
27
27
|
shouldStopPropagation = false;
|
|
@@ -20,31 +20,31 @@ $parcel$export(module.exports, "restoreTextSelection", () => $f7e14e656343df57$e
|
|
|
20
20
|
*/
|
|
21
21
|
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
|
22
22
|
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
|
23
|
-
let $f7e14e656343df57$var$state =
|
|
24
|
-
let $f7e14e656343df57$var$savedUserSelect =
|
|
23
|
+
let $f7e14e656343df57$var$state = 'default';
|
|
24
|
+
let $f7e14e656343df57$var$savedUserSelect = '';
|
|
25
25
|
let $f7e14e656343df57$var$modifiedElementMap = new WeakMap();
|
|
26
26
|
function $f7e14e656343df57$export$16a4697467175487(target) {
|
|
27
27
|
if ((0, $20aJV$reactariautils.isIOS)()) {
|
|
28
|
-
if ($f7e14e656343df57$var$state ===
|
|
28
|
+
if ($f7e14e656343df57$var$state === 'default') {
|
|
29
29
|
// eslint-disable-next-line no-restricted-globals
|
|
30
30
|
const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
|
|
31
31
|
$f7e14e656343df57$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
32
|
-
documentObject.documentElement.style.webkitUserSelect =
|
|
32
|
+
documentObject.documentElement.style.webkitUserSelect = 'none';
|
|
33
33
|
}
|
|
34
|
-
$f7e14e656343df57$var$state =
|
|
34
|
+
$f7e14e656343df57$var$state = 'disabled';
|
|
35
35
|
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
36
36
|
// If not iOS, store the target's original user-select and change to user-select: none
|
|
37
37
|
// Ignore state since it doesn't apply for non iOS
|
|
38
38
|
$f7e14e656343df57$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
39
|
-
target.style.userSelect =
|
|
39
|
+
target.style.userSelect = 'none';
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
|
|
43
43
|
if ((0, $20aJV$reactariautils.isIOS)()) {
|
|
44
44
|
// If the state is already default, there's nothing to do.
|
|
45
45
|
// If it is restoring, then there's no need to queue a second restore.
|
|
46
|
-
if ($f7e14e656343df57$var$state !==
|
|
47
|
-
$f7e14e656343df57$var$state =
|
|
46
|
+
if ($f7e14e656343df57$var$state !== 'disabled') return;
|
|
47
|
+
$f7e14e656343df57$var$state = 'restoring';
|
|
48
48
|
// There appears to be a delay on iOS where selection still might occur
|
|
49
49
|
// after pointer up, so wait a bit before removing user-select.
|
|
50
50
|
setTimeout(()=>{
|
|
@@ -52,12 +52,12 @@ function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
|
|
|
52
52
|
// for the whole page in the middle of the animation and cause jank.
|
|
53
53
|
(0, $20aJV$reactariautils.runAfterTransition)(()=>{
|
|
54
54
|
// Avoid race conditions
|
|
55
|
-
if ($f7e14e656343df57$var$state ===
|
|
55
|
+
if ($f7e14e656343df57$var$state === 'restoring') {
|
|
56
56
|
// eslint-disable-next-line no-restricted-globals
|
|
57
57
|
const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
|
|
58
|
-
if (documentObject.documentElement.style.webkitUserSelect ===
|
|
59
|
-
$f7e14e656343df57$var$savedUserSelect =
|
|
60
|
-
$f7e14e656343df57$var$state =
|
|
58
|
+
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $f7e14e656343df57$var$savedUserSelect || '';
|
|
59
|
+
$f7e14e656343df57$var$savedUserSelect = '';
|
|
60
|
+
$f7e14e656343df57$var$state = 'default';
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}, 300);
|
|
@@ -66,8 +66,8 @@ function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
|
|
|
66
66
|
{
|
|
67
67
|
if (target && $f7e14e656343df57$var$modifiedElementMap.has(target)) {
|
|
68
68
|
let targetOldUserSelect = $f7e14e656343df57$var$modifiedElementMap.get(target);
|
|
69
|
-
if (target.style.userSelect ===
|
|
70
|
-
if (target.getAttribute(
|
|
69
|
+
if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
|
|
70
|
+
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
|
71
71
|
$f7e14e656343df57$var$modifiedElementMap.delete(target);
|
|
72
72
|
}
|
|
73
73
|
}
|
package/dist/textSelection.mjs
CHANGED
|
@@ -13,31 +13,31 @@ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runA
|
|
|
13
13
|
*/
|
|
14
14
|
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
|
15
15
|
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
|
16
|
-
let $14c0b72509d70225$var$state =
|
|
17
|
-
let $14c0b72509d70225$var$savedUserSelect =
|
|
16
|
+
let $14c0b72509d70225$var$state = 'default';
|
|
17
|
+
let $14c0b72509d70225$var$savedUserSelect = '';
|
|
18
18
|
let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
|
19
19
|
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
20
20
|
if ((0, $7R18e$isIOS)()) {
|
|
21
|
-
if ($14c0b72509d70225$var$state ===
|
|
21
|
+
if ($14c0b72509d70225$var$state === 'default') {
|
|
22
22
|
// eslint-disable-next-line no-restricted-globals
|
|
23
23
|
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
|
24
24
|
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
25
|
-
documentObject.documentElement.style.webkitUserSelect =
|
|
25
|
+
documentObject.documentElement.style.webkitUserSelect = 'none';
|
|
26
26
|
}
|
|
27
|
-
$14c0b72509d70225$var$state =
|
|
27
|
+
$14c0b72509d70225$var$state = 'disabled';
|
|
28
28
|
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
29
29
|
// If not iOS, store the target's original user-select and change to user-select: none
|
|
30
30
|
// Ignore state since it doesn't apply for non iOS
|
|
31
31
|
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
32
|
-
target.style.userSelect =
|
|
32
|
+
target.style.userSelect = 'none';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
36
36
|
if ((0, $7R18e$isIOS)()) {
|
|
37
37
|
// If the state is already default, there's nothing to do.
|
|
38
38
|
// If it is restoring, then there's no need to queue a second restore.
|
|
39
|
-
if ($14c0b72509d70225$var$state !==
|
|
40
|
-
$14c0b72509d70225$var$state =
|
|
39
|
+
if ($14c0b72509d70225$var$state !== 'disabled') return;
|
|
40
|
+
$14c0b72509d70225$var$state = 'restoring';
|
|
41
41
|
// There appears to be a delay on iOS where selection still might occur
|
|
42
42
|
// after pointer up, so wait a bit before removing user-select.
|
|
43
43
|
setTimeout(()=>{
|
|
@@ -45,12 +45,12 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
45
45
|
// for the whole page in the middle of the animation and cause jank.
|
|
46
46
|
(0, $7R18e$runAfterTransition)(()=>{
|
|
47
47
|
// Avoid race conditions
|
|
48
|
-
if ($14c0b72509d70225$var$state ===
|
|
48
|
+
if ($14c0b72509d70225$var$state === 'restoring') {
|
|
49
49
|
// eslint-disable-next-line no-restricted-globals
|
|
50
50
|
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
|
51
|
-
if (documentObject.documentElement.style.webkitUserSelect ===
|
|
52
|
-
$14c0b72509d70225$var$savedUserSelect =
|
|
53
|
-
$14c0b72509d70225$var$state =
|
|
51
|
+
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
|
52
|
+
$14c0b72509d70225$var$savedUserSelect = '';
|
|
53
|
+
$14c0b72509d70225$var$state = 'default';
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}, 300);
|
|
@@ -59,8 +59,8 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
59
59
|
{
|
|
60
60
|
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
|
61
61
|
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
|
62
|
-
if (target.style.userSelect ===
|
|
63
|
-
if (target.getAttribute(
|
|
62
|
+
if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
|
|
63
|
+
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
|
64
64
|
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -68,4 +68,4 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
|
|
71
|
-
//# sourceMappingURL=textSelection.
|
|
71
|
+
//# sourceMappingURL=textSelection.module.js.map
|
|
@@ -13,31 +13,31 @@ import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runA
|
|
|
13
13
|
*/
|
|
14
14
|
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
|
15
15
|
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
|
16
|
-
let $14c0b72509d70225$var$state =
|
|
17
|
-
let $14c0b72509d70225$var$savedUserSelect =
|
|
16
|
+
let $14c0b72509d70225$var$state = 'default';
|
|
17
|
+
let $14c0b72509d70225$var$savedUserSelect = '';
|
|
18
18
|
let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
|
19
19
|
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
20
20
|
if ((0, $7R18e$isIOS)()) {
|
|
21
|
-
if ($14c0b72509d70225$var$state ===
|
|
21
|
+
if ($14c0b72509d70225$var$state === 'default') {
|
|
22
22
|
// eslint-disable-next-line no-restricted-globals
|
|
23
23
|
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
|
24
24
|
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
25
|
-
documentObject.documentElement.style.webkitUserSelect =
|
|
25
|
+
documentObject.documentElement.style.webkitUserSelect = 'none';
|
|
26
26
|
}
|
|
27
|
-
$14c0b72509d70225$var$state =
|
|
27
|
+
$14c0b72509d70225$var$state = 'disabled';
|
|
28
28
|
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
29
29
|
// If not iOS, store the target's original user-select and change to user-select: none
|
|
30
30
|
// Ignore state since it doesn't apply for non iOS
|
|
31
31
|
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
32
|
-
target.style.userSelect =
|
|
32
|
+
target.style.userSelect = 'none';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
36
36
|
if ((0, $7R18e$isIOS)()) {
|
|
37
37
|
// If the state is already default, there's nothing to do.
|
|
38
38
|
// If it is restoring, then there's no need to queue a second restore.
|
|
39
|
-
if ($14c0b72509d70225$var$state !==
|
|
40
|
-
$14c0b72509d70225$var$state =
|
|
39
|
+
if ($14c0b72509d70225$var$state !== 'disabled') return;
|
|
40
|
+
$14c0b72509d70225$var$state = 'restoring';
|
|
41
41
|
// There appears to be a delay on iOS where selection still might occur
|
|
42
42
|
// after pointer up, so wait a bit before removing user-select.
|
|
43
43
|
setTimeout(()=>{
|
|
@@ -45,12 +45,12 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
45
45
|
// for the whole page in the middle of the animation and cause jank.
|
|
46
46
|
(0, $7R18e$runAfterTransition)(()=>{
|
|
47
47
|
// Avoid race conditions
|
|
48
|
-
if ($14c0b72509d70225$var$state ===
|
|
48
|
+
if ($14c0b72509d70225$var$state === 'restoring') {
|
|
49
49
|
// eslint-disable-next-line no-restricted-globals
|
|
50
50
|
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
|
51
|
-
if (documentObject.documentElement.style.webkitUserSelect ===
|
|
52
|
-
$14c0b72509d70225$var$savedUserSelect =
|
|
53
|
-
$14c0b72509d70225$var$state =
|
|
51
|
+
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
|
52
|
+
$14c0b72509d70225$var$savedUserSelect = '';
|
|
53
|
+
$14c0b72509d70225$var$state = 'default';
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}, 300);
|
|
@@ -59,8 +59,8 @@ function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
|
59
59
|
{
|
|
60
60
|
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
|
61
61
|
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
|
62
|
-
if (target.style.userSelect ===
|
|
63
|
-
if (target.getAttribute(
|
|
62
|
+
if (target.style.userSelect === 'none') target.style.userSelect = targetOldUserSelect;
|
|
63
|
+
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
|
64
64
|
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
|
65
65
|
}
|
|
66
66
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DOMAttributes, PressEvents, FocusableElement, FocusEvents, HoverEvents, KeyboardEvents, MoveEvents, ScrollEvents, LongPressEvent } from "@react-types/shared";
|
|
2
|
-
import React, {
|
|
1
|
+
import { DOMAttributes, PressEvents, RefObject, FocusableElement, FocusEvents, HoverEvents, KeyboardEvents, MoveEvents, ScrollEvents, LongPressEvent } from "@react-types/shared";
|
|
2
|
+
import React, { ReactElement, ReactNode, FocusEvent } from "react";
|
|
3
3
|
export interface PressProps extends PressEvents {
|
|
4
4
|
/** Whether the target is in a controlled press state (e.g. an overlay it triggers is open). */
|
|
5
5
|
isPressed?: boolean;
|
|
@@ -19,7 +19,7 @@ export interface PressProps extends PressEvents {
|
|
|
19
19
|
}
|
|
20
20
|
export interface PressHookProps extends PressProps {
|
|
21
21
|
/** A ref to the target element. */
|
|
22
|
-
ref?: RefObject<Element>;
|
|
22
|
+
ref?: RefObject<Element | null>;
|
|
23
23
|
}
|
|
24
24
|
export interface PressResult {
|
|
25
25
|
/** Whether the target is currently pressed. */
|
|
@@ -140,7 +140,7 @@ export interface HoverResult {
|
|
|
140
140
|
*/
|
|
141
141
|
export function useHover(props: HoverProps): HoverResult;
|
|
142
142
|
export interface InteractOutsideProps {
|
|
143
|
-
ref: RefObject<Element>;
|
|
143
|
+
ref: RefObject<Element | null>;
|
|
144
144
|
onInteractOutside?: (e: PointerEvent) => void;
|
|
145
145
|
onInteractOutsideStart?: (e: PointerEvent) => void;
|
|
146
146
|
/** Whether the interact outside events should be disabled. */
|
|
@@ -177,7 +177,7 @@ export interface ScrollWheelProps extends ScrollEvents {
|
|
|
177
177
|
/** Whether the scroll listener should be disabled. */
|
|
178
178
|
isDisabled?: boolean;
|
|
179
179
|
}
|
|
180
|
-
export function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement>): void;
|
|
180
|
+
export function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement | null>): void;
|
|
181
181
|
export interface LongPressProps {
|
|
182
182
|
/** Whether long press events should be disabled. */
|
|
183
183
|
isDisabled?: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;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GAIG;AACH,wBAAwB,KAAK,EAAE,UAAU,GAAG,UAAU,CAoMrD;ACtND,iCAAkC,SAAQ,YAAY;IACpD,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAGD,+BAA+B,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,CAkBhG;ACvBD;IACE,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED;IACE,6CAA6C;IAC7C,cAAc,EAAE,aAAa,CAAA;CAC9B;AAID;;;GAGG;AACH,6BAA6B,KAAK,EAAE,cAAc,GAAG,eAAe,CAyEnE;ACxFD,YAAY,EAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/textSelection.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/context.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/usePress.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/Pressable.tsx","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/PressResponder.tsx","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/utils.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocus.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocusVisible.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useFocusWithin.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useHover.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useInteractOutside.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/createEventHandler.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useKeyboard.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useMove.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useScrollWheel.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/useLongPress.ts","packages/@react-aria/interactions/src/packages/@react-aria/interactions/src/index.ts","packages/@react-aria/interactions/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/useFocus.mjs
CHANGED
|
@@ -48,26 +48,26 @@ function $e77252a287ef94ab$var$triggerChangeHandlers(modality, e) {
|
|
|
48
48
|
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
|
|
49
49
|
*/ function $e77252a287ef94ab$var$isValidKey(e) {
|
|
50
50
|
// Control and Shift keys trigger when navigating back to the tab with keyboard.
|
|
51
|
-
return !(e.metaKey || !(0, $cR3F8$reactariautils.isMac)() && e.altKey || e.ctrlKey || e.key ===
|
|
51
|
+
return !(e.metaKey || !(0, $cR3F8$reactariautils.isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
|
|
52
52
|
}
|
|
53
53
|
function $e77252a287ef94ab$var$handleKeyboardEvent(e) {
|
|
54
54
|
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
55
55
|
if ($e77252a287ef94ab$var$isValidKey(e)) {
|
|
56
|
-
$e77252a287ef94ab$var$currentModality =
|
|
57
|
-
$e77252a287ef94ab$var$triggerChangeHandlers(
|
|
56
|
+
$e77252a287ef94ab$var$currentModality = 'keyboard';
|
|
57
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('keyboard', e);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function $e77252a287ef94ab$var$handlePointerEvent(e) {
|
|
61
|
-
$e77252a287ef94ab$var$currentModality =
|
|
62
|
-
if (e.type ===
|
|
61
|
+
$e77252a287ef94ab$var$currentModality = 'pointer';
|
|
62
|
+
if (e.type === 'mousedown' || e.type === 'pointerdown') {
|
|
63
63
|
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
64
|
-
$e77252a287ef94ab$var$triggerChangeHandlers(
|
|
64
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('pointer', e);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
function $e77252a287ef94ab$var$handleClickEvent(e) {
|
|
68
68
|
if ((0, $cR3F8$reactariautils.isVirtualClick)(e)) {
|
|
69
69
|
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
70
|
-
$e77252a287ef94ab$var$currentModality =
|
|
70
|
+
$e77252a287ef94ab$var$currentModality = 'virtual';
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
function $e77252a287ef94ab$var$handleFocusEvent(e) {
|
|
@@ -78,8 +78,8 @@ function $e77252a287ef94ab$var$handleFocusEvent(e) {
|
|
|
78
78
|
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
|
|
79
79
|
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
|
|
80
80
|
if (!$e77252a287ef94ab$var$hasEventBeforeFocus && !$e77252a287ef94ab$var$hasBlurredWindowRecently) {
|
|
81
|
-
$e77252a287ef94ab$var$currentModality =
|
|
82
|
-
$e77252a287ef94ab$var$triggerChangeHandlers(
|
|
81
|
+
$e77252a287ef94ab$var$currentModality = 'virtual';
|
|
82
|
+
$e77252a287ef94ab$var$triggerChangeHandlers('virtual', e);
|
|
83
83
|
}
|
|
84
84
|
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
|
85
85
|
$e77252a287ef94ab$var$hasBlurredWindowRecently = false;
|
|
@@ -93,7 +93,7 @@ function $e77252a287ef94ab$var$handleWindowBlur() {
|
|
|
93
93
|
/**
|
|
94
94
|
* Setup global event listeners to control when keyboard focus style should be visible.
|
|
95
95
|
*/ function $e77252a287ef94ab$var$setupGlobalFocusEvents(element) {
|
|
96
|
-
if (typeof window ===
|
|
96
|
+
if (typeof window === 'undefined' || $e77252a287ef94ab$export$d90243b58daecda7.get((0, $cR3F8$reactariautils.getOwnerWindow)(element))) return;
|
|
97
97
|
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
|
|
98
98
|
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
|
99
99
|
// Programmatic focus() calls shouldn't affect the current input modality.
|
|
@@ -105,24 +105,24 @@ function $e77252a287ef94ab$var$handleWindowBlur() {
|
|
|
105
105
|
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
|
106
106
|
focus.apply(this, arguments);
|
|
107
107
|
};
|
|
108
|
-
documentObject.addEventListener(
|
|
109
|
-
documentObject.addEventListener(
|
|
110
|
-
documentObject.addEventListener(
|
|
108
|
+
documentObject.addEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
109
|
+
documentObject.addEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
110
|
+
documentObject.addEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
|
|
111
111
|
// Register focus events on the window so they are sure to happen
|
|
112
112
|
// before React's event listeners (registered on the document).
|
|
113
|
-
windowObject.addEventListener(
|
|
114
|
-
windowObject.addEventListener(
|
|
115
|
-
if (typeof PointerEvent !==
|
|
116
|
-
documentObject.addEventListener(
|
|
117
|
-
documentObject.addEventListener(
|
|
118
|
-
documentObject.addEventListener(
|
|
113
|
+
windowObject.addEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
|
|
114
|
+
windowObject.addEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
|
|
115
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
116
|
+
documentObject.addEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
117
|
+
documentObject.addEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
118
|
+
documentObject.addEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
119
119
|
} else {
|
|
120
|
-
documentObject.addEventListener(
|
|
121
|
-
documentObject.addEventListener(
|
|
122
|
-
documentObject.addEventListener(
|
|
120
|
+
documentObject.addEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
121
|
+
documentObject.addEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
122
|
+
documentObject.addEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
123
123
|
}
|
|
124
124
|
// Add unmount handler
|
|
125
|
-
windowObject.addEventListener(
|
|
125
|
+
windowObject.addEventListener('beforeunload', ()=>{
|
|
126
126
|
$e77252a287ef94ab$var$tearDownWindowFocusTracking(element);
|
|
127
127
|
}, {
|
|
128
128
|
once: true
|
|
@@ -134,42 +134,42 @@ function $e77252a287ef94ab$var$handleWindowBlur() {
|
|
|
134
134
|
const $e77252a287ef94ab$var$tearDownWindowFocusTracking = (element, loadListener)=>{
|
|
135
135
|
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
|
|
136
136
|
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
|
137
|
-
if (loadListener) documentObject.removeEventListener(
|
|
137
|
+
if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
|
|
138
138
|
if (!$e77252a287ef94ab$export$d90243b58daecda7.has(windowObject)) return;
|
|
139
139
|
windowObject.HTMLElement.prototype.focus = $e77252a287ef94ab$export$d90243b58daecda7.get(windowObject).focus;
|
|
140
|
-
documentObject.removeEventListener(
|
|
141
|
-
documentObject.removeEventListener(
|
|
142
|
-
documentObject.removeEventListener(
|
|
143
|
-
windowObject.removeEventListener(
|
|
144
|
-
windowObject.removeEventListener(
|
|
145
|
-
if (typeof PointerEvent !==
|
|
146
|
-
documentObject.removeEventListener(
|
|
147
|
-
documentObject.removeEventListener(
|
|
148
|
-
documentObject.removeEventListener(
|
|
140
|
+
documentObject.removeEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
141
|
+
documentObject.removeEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
|
142
|
+
documentObject.removeEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
|
|
143
|
+
windowObject.removeEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
|
|
144
|
+
windowObject.removeEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
|
|
145
|
+
if (typeof PointerEvent !== 'undefined') {
|
|
146
|
+
documentObject.removeEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
147
|
+
documentObject.removeEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
148
|
+
documentObject.removeEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
149
149
|
} else {
|
|
150
|
-
documentObject.removeEventListener(
|
|
151
|
-
documentObject.removeEventListener(
|
|
152
|
-
documentObject.removeEventListener(
|
|
150
|
+
documentObject.removeEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
151
|
+
documentObject.removeEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
152
|
+
documentObject.removeEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
|
153
153
|
}
|
|
154
154
|
$e77252a287ef94ab$export$d90243b58daecda7.delete(windowObject);
|
|
155
155
|
};
|
|
156
156
|
function $e77252a287ef94ab$export$2f1888112f558a7d(element) {
|
|
157
157
|
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
|
158
158
|
let loadListener;
|
|
159
|
-
if (documentObject.readyState !==
|
|
159
|
+
if (documentObject.readyState !== 'loading') $e77252a287ef94ab$var$setupGlobalFocusEvents(element);
|
|
160
160
|
else {
|
|
161
161
|
loadListener = ()=>{
|
|
162
162
|
$e77252a287ef94ab$var$setupGlobalFocusEvents(element);
|
|
163
163
|
};
|
|
164
|
-
documentObject.addEventListener(
|
|
164
|
+
documentObject.addEventListener('DOMContentLoaded', loadListener);
|
|
165
165
|
}
|
|
166
166
|
return ()=>$e77252a287ef94ab$var$tearDownWindowFocusTracking(element, loadListener);
|
|
167
167
|
}
|
|
168
168
|
// Server-side rendering does not have the document object defined
|
|
169
169
|
// eslint-disable-next-line no-restricted-globals
|
|
170
|
-
if (typeof document !==
|
|
170
|
+
if (typeof document !== 'undefined') $e77252a287ef94ab$export$2f1888112f558a7d();
|
|
171
171
|
function $e77252a287ef94ab$export$b9b3dfddab17db27() {
|
|
172
|
-
return $e77252a287ef94ab$var$currentModality !==
|
|
172
|
+
return $e77252a287ef94ab$var$currentModality !== 'pointer';
|
|
173
173
|
}
|
|
174
174
|
function $e77252a287ef94ab$export$630ff653c5ada6a9() {
|
|
175
175
|
return $e77252a287ef94ab$var$currentModality;
|
|
@@ -193,27 +193,27 @@ function $e77252a287ef94ab$export$98e20ec92f614cfe() {
|
|
|
193
193
|
return (0, $cR3F8$reactariassr.useIsSSR)() ? null : modality;
|
|
194
194
|
}
|
|
195
195
|
const $e77252a287ef94ab$var$nonTextInputTypes = new Set([
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
196
|
+
'checkbox',
|
|
197
|
+
'radio',
|
|
198
|
+
'range',
|
|
199
|
+
'color',
|
|
200
|
+
'file',
|
|
201
|
+
'image',
|
|
202
|
+
'button',
|
|
203
|
+
'submit',
|
|
204
|
+
'reset'
|
|
205
205
|
]);
|
|
206
206
|
/**
|
|
207
207
|
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
|
208
208
|
* focus visible style can be properly set.
|
|
209
209
|
*/ function $e77252a287ef94ab$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
|
210
210
|
var _e_target;
|
|
211
|
-
const IHTMLInputElement = typeof window !==
|
|
212
|
-
const IHTMLTextAreaElement = typeof window !==
|
|
213
|
-
const IHTMLElement = typeof window !==
|
|
214
|
-
const IKeyboardEvent = typeof window !==
|
|
211
|
+
const IHTMLInputElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
|
212
|
+
const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
|
213
|
+
const IHTMLElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
|
214
|
+
const IKeyboardEvent = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
|
215
215
|
isTextInput = isTextInput || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLInputElement && !$e77252a287ef94ab$var$nonTextInputTypes.has(e === null || e === void 0 ? void 0 : (_e_target = e.target) === null || _e_target === void 0 ? void 0 : _e_target.type) || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLTextAreaElement || (e === null || e === void 0 ? void 0 : e.target) instanceof IHTMLElement && (e === null || e === void 0 ? void 0 : e.target.isContentEditable);
|
|
216
|
-
return !(isTextInput && modality ===
|
|
216
|
+
return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
|
217
217
|
}
|
|
218
218
|
function $e77252a287ef94ab$export$ffd9e5021c1fb2d6(props = {}) {
|
|
219
219
|
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|