@react-aria/interactions 3.21.0 → 3.21.2
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.main.js +62 -0
- package/dist/PressResponder.main.js.map +1 -0
- package/dist/PressResponder.mjs +52 -0
- package/dist/PressResponder.module.js +52 -0
- package/dist/PressResponder.module.js.map +1 -0
- package/dist/Pressable.main.js +43 -0
- package/dist/Pressable.main.js.map +1 -0
- package/dist/Pressable.mjs +34 -0
- package/dist/Pressable.module.js +34 -0
- package/dist/Pressable.module.js.map +1 -0
- package/dist/context.main.js +30 -0
- package/dist/context.main.js.map +1 -0
- package/dist/context.mjs +21 -0
- package/dist/context.module.js +21 -0
- package/dist/context.module.js.map +1 -0
- package/dist/createEventHandler.main.js +42 -0
- package/dist/createEventHandler.main.js.map +1 -0
- package/dist/createEventHandler.mjs +37 -0
- package/dist/createEventHandler.module.js +37 -0
- package/dist/createEventHandler.module.js.map +1 -0
- package/dist/import.mjs +12 -1771
- package/dist/main.js +31 -1794
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -1771
- package/dist/module.js.map +1 -1
- package/dist/textSelection.main.js +77 -0
- package/dist/textSelection.main.js.map +1 -0
- package/dist/textSelection.mjs +71 -0
- package/dist/textSelection.module.js +71 -0
- package/dist/textSelection.module.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/useFocus.main.js +64 -0
- package/dist/useFocus.main.js.map +1 -0
- package/dist/useFocus.mjs +59 -0
- package/dist/useFocus.module.js +59 -0
- package/dist/useFocus.module.js.map +1 -0
- package/dist/useFocusVisible.main.js +248 -0
- package/dist/useFocusVisible.main.js.map +1 -0
- package/dist/useFocusVisible.mjs +237 -0
- package/dist/useFocusVisible.module.js +237 -0
- package/dist/useFocusVisible.module.js.map +1 -0
- package/dist/useFocusWithin.main.js +76 -0
- package/dist/useFocusWithin.main.js.map +1 -0
- package/dist/useFocusWithin.mjs +71 -0
- package/dist/useFocusWithin.module.js +71 -0
- package/dist/useFocusWithin.module.js.map +1 -0
- package/dist/useHover.main.js +142 -0
- package/dist/useHover.main.js.map +1 -0
- package/dist/useHover.mjs +137 -0
- package/dist/useHover.module.js +137 -0
- package/dist/useHover.module.js.map +1 -0
- package/dist/useInteractOutside.main.js +101 -0
- package/dist/useInteractOutside.main.js.map +1 -0
- package/dist/useInteractOutside.mjs +96 -0
- package/dist/useInteractOutside.module.js +96 -0
- package/dist/useInteractOutside.module.js.map +1 -0
- package/dist/useKeyboard.main.js +30 -0
- package/dist/useKeyboard.main.js.map +1 -0
- package/dist/useKeyboard.mjs +25 -0
- package/dist/useKeyboard.module.js +25 -0
- package/dist/useKeyboard.module.js.map +1 -0
- package/dist/useLongPress.main.js +84 -0
- package/dist/useLongPress.main.js.map +1 -0
- package/dist/useLongPress.mjs +79 -0
- package/dist/useLongPress.module.js +79 -0
- package/dist/useLongPress.module.js.map +1 -0
- package/dist/useMove.main.js +236 -0
- package/dist/useMove.main.js.map +1 -0
- package/dist/useMove.mjs +231 -0
- package/dist/useMove.module.js +231 -0
- package/dist/useMove.module.js.map +1 -0
- package/dist/usePress.main.js +571 -0
- package/dist/usePress.main.js.map +1 -0
- package/dist/usePress.mjs +566 -0
- package/dist/usePress.module.js +566 -0
- package/dist/usePress.module.js.map +1 -0
- package/dist/useScrollWheel.main.js +41 -0
- package/dist/useScrollWheel.main.js.map +1 -0
- package/dist/useScrollWheel.mjs +36 -0
- package/dist/useScrollWheel.module.js +36 -0
- package/dist/useScrollWheel.module.js.map +1 -0
- package/dist/utils.main.js +120 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +115 -0
- package/dist/utils.module.js +115 -0
- package/dist/utils.module.js.map +1 -0
- package/package.json +5 -5
- package/src/useFocus.ts +5 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var $01d3f539e91688c8$exports = require("./context.main.js");
|
|
2
|
+
var $3maub$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $3maub$react = require("react");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$parcel$export(module.exports, "PressResponder", () => $3596bae48579386f$export$3351871ee4b288b8);
|
|
15
|
+
$parcel$export(module.exports, "ClearPressResponder", () => $3596bae48579386f$export$cf75428e0b9ed1ea);
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const $3596bae48579386f$export$3351871ee4b288b8 = /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).forwardRef(({ children: children, ...props }, ref)=>{
|
|
30
|
+
let isRegistered = (0, $3maub$react.useRef)(false);
|
|
31
|
+
let prevContext = (0, $3maub$react.useContext)((0, $01d3f539e91688c8$exports.PressResponderContext));
|
|
32
|
+
ref = (0, $3maub$reactariautils.useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
|
33
|
+
let context = (0, $3maub$reactariautils.mergeProps)(prevContext || {}, {
|
|
34
|
+
...props,
|
|
35
|
+
ref: ref,
|
|
36
|
+
register () {
|
|
37
|
+
isRegistered.current = true;
|
|
38
|
+
if (prevContext) prevContext.register();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
(0, $3maub$reactariautils.useSyncRef)(prevContext, ref);
|
|
42
|
+
(0, $3maub$react.useEffect)(()=>{
|
|
43
|
+
if (!isRegistered.current) {
|
|
44
|
+
console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
45
|
+
isRegistered.current = true; // only warn once in strict mode.
|
|
46
|
+
}
|
|
47
|
+
}, []);
|
|
48
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).createElement((0, $01d3f539e91688c8$exports.PressResponderContext).Provider, {
|
|
49
|
+
value: context
|
|
50
|
+
}, children);
|
|
51
|
+
});
|
|
52
|
+
function $3596bae48579386f$export$cf75428e0b9ed1ea({ children: children }) {
|
|
53
|
+
let context = (0, $3maub$react.useMemo)(()=>({
|
|
54
|
+
register: ()=>{}
|
|
55
|
+
}), []);
|
|
56
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).createElement((0, $01d3f539e91688c8$exports.PressResponderContext).Provider, {
|
|
57
|
+
value: context
|
|
58
|
+
}, children);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=PressResponder.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,+CAAoB;IACjD,MAAM,CAAA,GAAA,kCAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,gCAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,gCAAS,EAAE,aAAa;IAExB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,QAAQ,IAAI,CACV;YAGF,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP","sources":["packages/@react-aria/interactions/src/PressResponder.tsx"],"sourcesContent":["/*\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\nimport {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ForwardedRef, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n isRegistered.current = true; // only warn once in strict mode.\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n\nexport function ClearPressResponder({children}: {children: ReactNode}) {\n let context = useMemo(() => ({register: () => {}}), []);\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"PressResponder.main.js.map"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {PressResponderContext as $ae1eeba8b9eafd08$export$5165eccb35aaadb5} from "./context.mjs";
|
|
2
|
+
import {useObjectRef as $87RPk$useObjectRef, mergeProps as $87RPk$mergeProps, useSyncRef as $87RPk$useSyncRef} from "@react-aria/utils";
|
|
3
|
+
import $87RPk$react, {useRef as $87RPk$useRef, useContext as $87RPk$useContext, useEffect as $87RPk$useEffect, useMemo as $87RPk$useMemo} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
19
|
+
let isRegistered = (0, $87RPk$useRef)(false);
|
|
20
|
+
let prevContext = (0, $87RPk$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
21
|
+
ref = (0, $87RPk$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
|
22
|
+
let context = (0, $87RPk$mergeProps)(prevContext || {}, {
|
|
23
|
+
...props,
|
|
24
|
+
ref: ref,
|
|
25
|
+
register () {
|
|
26
|
+
isRegistered.current = true;
|
|
27
|
+
if (prevContext) prevContext.register();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
(0, $87RPk$useSyncRef)(prevContext, ref);
|
|
31
|
+
(0, $87RPk$useEffect)(()=>{
|
|
32
|
+
if (!isRegistered.current) {
|
|
33
|
+
console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
34
|
+
isRegistered.current = true; // only warn once in strict mode.
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
38
|
+
value: context
|
|
39
|
+
}, children);
|
|
40
|
+
});
|
|
41
|
+
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
|
42
|
+
let context = (0, $87RPk$useMemo)(()=>({
|
|
43
|
+
register: ()=>{}
|
|
44
|
+
}), []);
|
|
45
|
+
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
46
|
+
value: context
|
|
47
|
+
}, children);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export {$f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder};
|
|
52
|
+
//# sourceMappingURL=PressResponder.mjs.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {PressResponderContext as $ae1eeba8b9eafd08$export$5165eccb35aaadb5} from "./context.module.js";
|
|
2
|
+
import {useObjectRef as $87RPk$useObjectRef, mergeProps as $87RPk$mergeProps, useSyncRef as $87RPk$useSyncRef} from "@react-aria/utils";
|
|
3
|
+
import $87RPk$react, {useRef as $87RPk$useRef, useContext as $87RPk$useContext, useEffect as $87RPk$useEffect, useMemo as $87RPk$useMemo} from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
19
|
+
let isRegistered = (0, $87RPk$useRef)(false);
|
|
20
|
+
let prevContext = (0, $87RPk$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
|
21
|
+
ref = (0, $87RPk$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
|
22
|
+
let context = (0, $87RPk$mergeProps)(prevContext || {}, {
|
|
23
|
+
...props,
|
|
24
|
+
ref: ref,
|
|
25
|
+
register () {
|
|
26
|
+
isRegistered.current = true;
|
|
27
|
+
if (prevContext) prevContext.register();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
(0, $87RPk$useSyncRef)(prevContext, ref);
|
|
31
|
+
(0, $87RPk$useEffect)(()=>{
|
|
32
|
+
if (!isRegistered.current) {
|
|
33
|
+
console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
|
34
|
+
isRegistered.current = true; // only warn once in strict mode.
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
38
|
+
value: context
|
|
39
|
+
}, children);
|
|
40
|
+
});
|
|
41
|
+
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
|
42
|
+
let context = (0, $87RPk$useMemo)(()=>({
|
|
43
|
+
register: ()=>{}
|
|
44
|
+
}), []);
|
|
45
|
+
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
|
46
|
+
value: context
|
|
47
|
+
}, children);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export {$f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder};
|
|
52
|
+
//# sourceMappingURL=PressResponder.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,MAAM,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,iBAAS,EAAE,aAAa;IAExB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,QAAQ,IAAI,CACV;YAGF,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP","sources":["packages/@react-aria/interactions/src/PressResponder.tsx"],"sourcesContent":["/*\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\nimport {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ForwardedRef, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n isRegistered.current = true; // only warn once in strict mode.\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n\nexport function ClearPressResponder({children}: {children: ReactNode}) {\n let context = useMemo(() => ({register: () => {}}), []);\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"PressResponder.module.js.map"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var $0294ea432cd92340$exports = require("./usePress.main.js");
|
|
2
|
+
var $ev4bP$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $ev4bP$react = require("react");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$export$27c701ed9e449e99);
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).forwardRef(({ children: children, ...props }, ref)=>{
|
|
29
|
+
ref = (0, $ev4bP$reactariautils.useObjectRef)(ref);
|
|
30
|
+
let { pressProps: pressProps } = (0, $0294ea432cd92340$exports.usePress)({
|
|
31
|
+
...props,
|
|
32
|
+
ref: ref
|
|
33
|
+
});
|
|
34
|
+
let child = (0, ($parcel$interopDefault($ev4bP$react))).Children.only(children);
|
|
35
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).cloneElement(child, // @ts-ignore
|
|
36
|
+
{
|
|
37
|
+
ref: ref,
|
|
38
|
+
...(0, $ev4bP$reactariautils.mergeProps)(child.props, pressProps)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=Pressable.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAWM,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,MAAM,CAAA,GAAA,kCAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,QAAQ,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAChC,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CACvB,OACA,aAAa;IACb;aAAC;QAAK,GAAG,CAAA,GAAA,gCAAS,EAAE,MAAM,KAAK,EAAE,WAAW;IAAA;AAEhD","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"sourcesContent":["/*\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\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement} from 'react';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<HTMLElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let child = React.Children.only(children);\n return React.cloneElement(\n child,\n // @ts-ignore\n {ref, ...mergeProps(child.props, pressProps)}\n );\n});\n"],"names":[],"version":3,"file":"Pressable.main.js.map"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.mjs";
|
|
2
|
+
import {useObjectRef as $hhDyF$useObjectRef, mergeProps as $hhDyF$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import $hhDyF$react from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
19
|
+
ref = (0, $hhDyF$useObjectRef)(ref);
|
|
20
|
+
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
21
|
+
...props,
|
|
22
|
+
ref: ref
|
|
23
|
+
});
|
|
24
|
+
let child = (0, $hhDyF$react).Children.only(children);
|
|
25
|
+
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, // @ts-ignore
|
|
26
|
+
{
|
|
27
|
+
ref: ref,
|
|
28
|
+
...(0, $hhDyF$mergeProps)(child.props, pressProps)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
|
34
|
+
//# sourceMappingURL=Pressable.mjs.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
|
|
2
|
+
import {useObjectRef as $hhDyF$useObjectRef, mergeProps as $hhDyF$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import $hhDyF$react from "react";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
19
|
+
ref = (0, $hhDyF$useObjectRef)(ref);
|
|
20
|
+
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
21
|
+
...props,
|
|
22
|
+
ref: ref
|
|
23
|
+
});
|
|
24
|
+
let child = (0, $hhDyF$react).Children.only(children);
|
|
25
|
+
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, // @ts-ignore
|
|
26
|
+
{
|
|
27
|
+
ref: ref,
|
|
28
|
+
...(0, $hhDyF$mergeProps)(child.props, pressProps)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
|
34
|
+
//# sourceMappingURL=Pressable.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAWM,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,MAAM,CAAA,GAAA,mBAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,QAAQ,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAChC,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CACvB,OACA,aAAa;IACb;aAAC;QAAK,GAAG,CAAA,GAAA,iBAAS,EAAE,MAAM,KAAK,EAAE,WAAW;IAAA;AAEhD","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"sourcesContent":["/*\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\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement} from 'react';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<HTMLElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let child = React.Children.only(children);\n return React.cloneElement(\n child,\n // @ts-ignore\n {ref, ...mergeProps(child.props, pressProps)}\n );\n});\n"],"names":[],"version":3,"file":"Pressable.module.js.map"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var $bNpOp$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$interopDefault(a) {
|
|
5
|
+
return a && a.__esModule ? a.default : a;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
$parcel$export(module.exports, "PressResponderContext", () => $01d3f539e91688c8$export$5165eccb35aaadb5);
|
|
13
|
+
/*
|
|
14
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
15
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
*
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
+
* governing permissions and limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
const $01d3f539e91688c8$export$5165eccb35aaadb5 = (0, ($parcel$interopDefault($bNpOp$react))).createContext({
|
|
25
|
+
register: ()=>{}
|
|
26
|
+
});
|
|
27
|
+
$01d3f539e91688c8$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=context.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAAwB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AACpG,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.ts"],"sourcesContent":["/*\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\nimport {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.main.js.map"}
|
package/dist/context.mjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import $3aeG1$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
|
15
|
+
register: ()=>{}
|
|
16
|
+
});
|
|
17
|
+
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
|
21
|
+
//# sourceMappingURL=context.mjs.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import $3aeG1$react from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
|
15
|
+
register: ()=>{}
|
|
16
|
+
});
|
|
17
|
+
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
|
21
|
+
//# sourceMappingURL=context.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAAwB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AACpG,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.ts"],"sourcesContent":["/*\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\nimport {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.module.js.map"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "createEventHandler", () => $951fbcbbca8db6ce$export$48d1ea6320830260);
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ function $951fbcbbca8db6ce$export$48d1ea6320830260(handler) {
|
|
18
|
+
if (!handler) return undefined;
|
|
19
|
+
let shouldStopPropagation = true;
|
|
20
|
+
return (e)=>{
|
|
21
|
+
let event = {
|
|
22
|
+
...e,
|
|
23
|
+
preventDefault () {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
},
|
|
26
|
+
isDefaultPrevented () {
|
|
27
|
+
return e.isDefaultPrevented();
|
|
28
|
+
},
|
|
29
|
+
stopPropagation () {
|
|
30
|
+
console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
|
31
|
+
},
|
|
32
|
+
continuePropagation () {
|
|
33
|
+
shouldStopPropagation = false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
handler(event);
|
|
37
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=createEventHandler.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,QAAQ,KAAK,CAAC;YAChB;YACA;gBACE,wBAAwB;YAC1B;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.ts"],"sourcesContent":["/*\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\nimport {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n },\n continuePropagation() {\n shouldStopPropagation = false;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.main.js.map"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
|
12
|
+
if (!handler) return undefined;
|
|
13
|
+
let shouldStopPropagation = true;
|
|
14
|
+
return (e)=>{
|
|
15
|
+
let event = {
|
|
16
|
+
...e,
|
|
17
|
+
preventDefault () {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
},
|
|
20
|
+
isDefaultPrevented () {
|
|
21
|
+
return e.isDefaultPrevented();
|
|
22
|
+
},
|
|
23
|
+
stopPropagation () {
|
|
24
|
+
console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
|
25
|
+
},
|
|
26
|
+
continuePropagation () {
|
|
27
|
+
shouldStopPropagation = false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
handler(event);
|
|
31
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
|
37
|
+
//# sourceMappingURL=createEventHandler.mjs.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
|
12
|
+
if (!handler) return undefined;
|
|
13
|
+
let shouldStopPropagation = true;
|
|
14
|
+
return (e)=>{
|
|
15
|
+
let event = {
|
|
16
|
+
...e,
|
|
17
|
+
preventDefault () {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
},
|
|
20
|
+
isDefaultPrevented () {
|
|
21
|
+
return e.isDefaultPrevented();
|
|
22
|
+
},
|
|
23
|
+
stopPropagation () {
|
|
24
|
+
console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
|
25
|
+
},
|
|
26
|
+
continuePropagation () {
|
|
27
|
+
shouldStopPropagation = false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
handler(event);
|
|
31
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
|
37
|
+
//# sourceMappingURL=createEventHandler.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,QAAQ,KAAK,CAAC;YAChB;YACA;gBACE,wBAAwB;YAC1B;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.ts"],"sourcesContent":["/*\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\nimport {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n },\n continuePropagation() {\n shouldStopPropagation = false;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.module.js.map"}
|