@react-aria/interactions 3.27.0 → 3.28.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/import.mjs +21 -15
- package/dist/main.js +45 -39
- package/dist/main.js.map +1 -1
- package/dist/module.js +21 -15
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +31 -0
- package/package.json +16 -15
- package/src/index.ts +31 -35
- package/dist/PressResponder.main.js +0 -61
- package/dist/PressResponder.main.js.map +0 -1
- package/dist/PressResponder.mjs +0 -51
- package/dist/PressResponder.module.js +0 -51
- package/dist/PressResponder.module.js.map +0 -1
- package/dist/Pressable.main.js +0 -69
- package/dist/Pressable.main.js.map +0 -1
- package/dist/Pressable.mjs +0 -60
- package/dist/Pressable.module.js +0 -60
- package/dist/Pressable.module.js.map +0 -1
- package/dist/context.main.js +0 -30
- package/dist/context.main.js.map +0 -1
- package/dist/context.mjs +0 -21
- package/dist/context.module.js +0 -21
- package/dist/context.module.js.map +0 -1
- package/dist/createEventHandler.main.js +0 -46
- package/dist/createEventHandler.main.js.map +0 -1
- package/dist/createEventHandler.mjs +0 -41
- package/dist/createEventHandler.module.js +0 -41
- package/dist/createEventHandler.module.js.map +0 -1
- package/dist/focusSafely.main.js +0 -40
- package/dist/focusSafely.main.js.map +0 -1
- package/dist/focusSafely.mjs +0 -35
- package/dist/focusSafely.module.js +0 -35
- package/dist/focusSafely.module.js.map +0 -1
- package/dist/textSelection.main.js +0 -77
- package/dist/textSelection.main.js.map +0 -1
- package/dist/textSelection.mjs +0 -71
- package/dist/textSelection.module.js +0 -71
- package/dist/textSelection.module.js.map +0 -1
- package/dist/types.d.ts +0 -255
- package/dist/types.d.ts.map +0 -1
- package/dist/useFocus.main.js +0 -65
- package/dist/useFocus.main.js.map +0 -1
- package/dist/useFocus.mjs +0 -60
- package/dist/useFocus.module.js +0 -60
- package/dist/useFocus.module.js.map +0 -1
- package/dist/useFocusVisible.main.js +0 -265
- package/dist/useFocusVisible.main.js.map +0 -1
- package/dist/useFocusVisible.mjs +0 -253
- package/dist/useFocusVisible.module.js +0 -253
- package/dist/useFocusVisible.module.js.map +0 -1
- package/dist/useFocusWithin.main.js +0 -105
- package/dist/useFocusWithin.main.js.map +0 -1
- package/dist/useFocusWithin.mjs +0 -100
- package/dist/useFocusWithin.module.js +0 -100
- package/dist/useFocusWithin.module.js.map +0 -1
- package/dist/useFocusable.main.js +0 -113
- package/dist/useFocusable.main.js.map +0 -1
- package/dist/useFocusable.mjs +0 -101
- package/dist/useFocusable.module.js +0 -101
- package/dist/useFocusable.module.js.map +0 -1
- package/dist/useHover.main.js +0 -159
- package/dist/useHover.main.js.map +0 -1
- package/dist/useHover.mjs +0 -154
- package/dist/useHover.module.js +0 -154
- package/dist/useHover.module.js.map +0 -1
- package/dist/useInteractOutside.main.js +0 -106
- package/dist/useInteractOutside.main.js.map +0 -1
- package/dist/useInteractOutside.mjs +0 -101
- package/dist/useInteractOutside.module.js +0 -101
- package/dist/useInteractOutside.module.js.map +0 -1
- package/dist/useKeyboard.main.js +0 -30
- package/dist/useKeyboard.main.js.map +0 -1
- package/dist/useKeyboard.mjs +0 -25
- package/dist/useKeyboard.module.js +0 -25
- package/dist/useKeyboard.module.js.map +0 -1
- package/dist/useLongPress.main.js +0 -86
- package/dist/useLongPress.main.js.map +0 -1
- package/dist/useLongPress.mjs +0 -81
- package/dist/useLongPress.module.js +0 -81
- package/dist/useLongPress.module.js.map +0 -1
- package/dist/useMove.main.js +0 -272
- package/dist/useMove.main.js.map +0 -1
- package/dist/useMove.mjs +0 -267
- package/dist/useMove.module.js +0 -267
- package/dist/useMove.module.js.map +0 -1
- package/dist/usePress.main.js +0 -763
- package/dist/usePress.main.js.map +0 -1
- package/dist/usePress.mjs +0 -758
- package/dist/usePress.module.js +0 -758
- package/dist/usePress.module.js.map +0 -1
- package/dist/useScrollWheel.main.js +0 -41
- package/dist/useScrollWheel.main.js.map +0 -1
- package/dist/useScrollWheel.mjs +0 -36
- package/dist/useScrollWheel.module.js +0 -36
- package/dist/useScrollWheel.module.js.map +0 -1
- package/dist/utils.main.js +0 -163
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -154
- package/dist/utils.module.js +0 -154
- package/dist/utils.module.js.map +0 -1
- package/src/PressResponder.tsx +0 -67
- package/src/Pressable.tsx +0 -97
- package/src/context.ts +0 -23
- package/src/createEventHandler.ts +0 -55
- package/src/focusSafely.ts +0 -45
- package/src/textSelection.ts +0 -101
- package/src/useFocus.ts +0 -87
- package/src/useFocusVisible.ts +0 -357
- package/src/useFocusWithin.ts +0 -132
- package/src/useFocusable.tsx +0 -191
- package/src/useHover.ts +0 -222
- package/src/useInteractOutside.ts +0 -142
- package/src/useKeyboard.ts +0 -36
- package/src/useLongPress.ts +0 -135
- package/src/useMove.ts +0 -259
- package/src/usePress.ts +0 -1093
- package/src/useScrollWheel.ts +0 -41
- package/src/utils.ts +0 -174
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAEb,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IAC3D,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,IAAI,UAAe,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC/C,GAAG,KAAK;QACR;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,QAAQ,GAAG,GAAG,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAClD,CAAA,GAAA,iBAAS,EAAE,aAAa,QAAQ,GAAG;IAEnC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;YAIJ,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, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder:\n React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n let context: any = mergeProps(prevContext || {}, {\n ...props,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n context.ref = useObjectRef(ref || prevContext?.ref);\n useSyncRef(prevContext, context.ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n if (process.env.NODE_ENV !== 'production') {\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 }\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}): JSX.Element {\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"}
|
package/dist/Pressable.main.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var $0294ea432cd92340$exports = require("./usePress.main.js");
|
|
2
|
-
var $15f8fd80892557ff$exports = require("./useFocusable.main.js");
|
|
3
|
-
var $ev4bP$reactariautils = require("@react-aria/utils");
|
|
4
|
-
var $ev4bP$react = require("react");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function $parcel$interopDefault(a) {
|
|
8
|
-
return a && a.__esModule ? a.default : a;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function $parcel$export(e, n, v, s) {
|
|
12
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
$parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$export$27c701ed9e449e99);
|
|
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
|
-
|
|
30
|
-
const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).forwardRef(({ children: children, ...props }, ref)=>{
|
|
31
|
-
ref = (0, $ev4bP$reactariautils.useObjectRef)(ref);
|
|
32
|
-
let { pressProps: pressProps } = (0, $0294ea432cd92340$exports.usePress)({
|
|
33
|
-
...props,
|
|
34
|
-
ref: ref
|
|
35
|
-
});
|
|
36
|
-
let { focusableProps: focusableProps } = (0, $15f8fd80892557ff$exports.useFocusable)(props, ref);
|
|
37
|
-
let child = (0, ($parcel$interopDefault($ev4bP$react))).Children.only(children);
|
|
38
|
-
(0, $ev4bP$react.useEffect)(()=>{
|
|
39
|
-
if (process.env.NODE_ENV === 'production') return;
|
|
40
|
-
let el = ref.current;
|
|
41
|
-
if (!el || !(el instanceof (0, $ev4bP$reactariautils.getOwnerWindow)(el).Element)) {
|
|
42
|
-
console.error('<Pressable> child must forward its ref to a DOM element.');
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (!props.isDisabled && !(0, $ev4bP$reactariautils.isFocusable)(el)) {
|
|
46
|
-
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
|
50
|
-
let role = el.getAttribute('role');
|
|
51
|
-
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
|
52
|
-
else if (// https://w3c.github.io/aria/#widget_roles
|
|
53
|
-
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
|
54
|
-
}
|
|
55
|
-
}, [
|
|
56
|
-
ref,
|
|
57
|
-
props.isDisabled
|
|
58
|
-
]);
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
let childRef = parseInt((0, ($parcel$interopDefault($ev4bP$react))).version, 10) < 19 ? child.ref : child.props.ref;
|
|
61
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).cloneElement(child, {
|
|
62
|
-
...(0, $ev4bP$reactariautils.mergeProps)(pressProps, focusableProps, child.props),
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
ref: (0, $ev4bP$reactariautils.mergeRefs)(childRef, ref)
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=Pressable.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAEb,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IACtD,MAAM,CAAA,GAAA,kCAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,oCAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,CAAA,GAAA,iCAAU,EAAE,KAAK;YACzC,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;QAAK,MAAM,UAAU;KAAC;IAE1B,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,sCAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,+BAAQ,EAAE,UAAU;IAC3B;AAEJ","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, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable:\n React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!props.isDisabled && !isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref, props.isDisabled]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.main.js.map"}
|
package/dist/Pressable.mjs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.mjs";
|
|
2
|
-
import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.mjs";
|
|
3
|
-
import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
|
|
4
|
-
import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
-
* governing permissions and limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
21
|
-
ref = (0, $hhDyF$useObjectRef)(ref);
|
|
22
|
-
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
23
|
-
...props,
|
|
24
|
-
ref: ref
|
|
25
|
-
});
|
|
26
|
-
let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
|
|
27
|
-
let child = (0, $hhDyF$react).Children.only(children);
|
|
28
|
-
(0, $hhDyF$useEffect)(()=>{
|
|
29
|
-
if (process.env.NODE_ENV === 'production') return;
|
|
30
|
-
let el = ref.current;
|
|
31
|
-
if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
|
|
32
|
-
console.error('<Pressable> child must forward its ref to a DOM element.');
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (!props.isDisabled && !(0, $hhDyF$isFocusable)(el)) {
|
|
36
|
-
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
|
40
|
-
let role = el.getAttribute('role');
|
|
41
|
-
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
|
42
|
-
else if (// https://w3c.github.io/aria/#widget_roles
|
|
43
|
-
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
|
44
|
-
}
|
|
45
|
-
}, [
|
|
46
|
-
ref,
|
|
47
|
-
props.isDisabled
|
|
48
|
-
]);
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
|
|
51
|
-
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
|
|
52
|
-
...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
ref: (0, $hhDyF$mergeRefs)(childRef, ref)
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
|
60
|
-
//# sourceMappingURL=Pressable.module.js.map
|
package/dist/Pressable.module.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
|
|
2
|
-
import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.module.js";
|
|
3
|
-
import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
|
|
4
|
-
import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
-
* governing permissions and limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
|
21
|
-
ref = (0, $hhDyF$useObjectRef)(ref);
|
|
22
|
-
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
|
23
|
-
...props,
|
|
24
|
-
ref: ref
|
|
25
|
-
});
|
|
26
|
-
let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
|
|
27
|
-
let child = (0, $hhDyF$react).Children.only(children);
|
|
28
|
-
(0, $hhDyF$useEffect)(()=>{
|
|
29
|
-
if (process.env.NODE_ENV === 'production') return;
|
|
30
|
-
let el = ref.current;
|
|
31
|
-
if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
|
|
32
|
-
console.error('<Pressable> child must forward its ref to a DOM element.');
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (!props.isDisabled && !(0, $hhDyF$isFocusable)(el)) {
|
|
36
|
-
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
|
40
|
-
let role = el.getAttribute('role');
|
|
41
|
-
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
|
42
|
-
else if (// https://w3c.github.io/aria/#widget_roles
|
|
43
|
-
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
|
44
|
-
}
|
|
45
|
-
}, [
|
|
46
|
-
ref,
|
|
47
|
-
props.isDisabled
|
|
48
|
-
]);
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
|
|
51
|
-
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
|
|
52
|
-
...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
ref: (0, $hhDyF$mergeRefs)(childRef, ref)
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
|
60
|
-
//# sourceMappingURL=Pressable.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAEb,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IACtD,MAAM,CAAA,GAAA,mBAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,qBAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,CAAA,GAAA,kBAAU,EAAE,KAAK;YACzC,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;QAAK,MAAM,UAAU;KAAC;IAE1B,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,gBAAQ,EAAE,UAAU;IAC3B;AAEJ","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, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable:\n React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<FocusableElement>> =\nReact.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!props.isDisabled && !isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref, props.isDisabled]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.module.js.map"}
|
package/dist/context.main.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
package/dist/context.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAA+D,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AAC3I,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.Context<IPressResponderContext> = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.main.js.map"}
|
package/dist/context.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
package/dist/context.module.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAA+D,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AAC3I,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.Context<IPressResponderContext> = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.module.js.map"}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
31
|
-
else shouldStopPropagation = true;
|
|
32
|
-
},
|
|
33
|
-
continuePropagation () {
|
|
34
|
-
shouldStopPropagation = false;
|
|
35
|
-
},
|
|
36
|
-
isPropagationStopped () {
|
|
37
|
-
return shouldStopPropagation;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
handler(event);
|
|
41
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=createEventHandler.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;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 if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\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"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
25
|
-
else shouldStopPropagation = true;
|
|
26
|
-
},
|
|
27
|
-
continuePropagation () {
|
|
28
|
-
shouldStopPropagation = false;
|
|
29
|
-
},
|
|
30
|
-
isPropagationStopped () {
|
|
31
|
-
return shouldStopPropagation;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
handler(event);
|
|
35
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
|
41
|
-
//# sourceMappingURL=createEventHandler.module.js.map
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
|
25
|
-
else shouldStopPropagation = true;
|
|
26
|
-
},
|
|
27
|
-
continuePropagation () {
|
|
28
|
-
shouldStopPropagation = false;
|
|
29
|
-
},
|
|
30
|
-
isPropagationStopped () {
|
|
31
|
-
return shouldStopPropagation;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
handler(event);
|
|
35
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
|
41
|
-
//# sourceMappingURL=createEventHandler.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;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 if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\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"}
|
package/dist/focusSafely.main.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
|
|
2
|
-
var $fCG8z$reactariautils = require("@react-aria/utils");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$parcel$export(module.exports, "focusSafely", () => $2833058fcd3993f5$export$80f3e147d781571c);
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
13
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
* governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
function $2833058fcd3993f5$export$80f3e147d781571c(element) {
|
|
23
|
-
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
|
24
|
-
// wait until after any animated transitions that are currently occurring on
|
|
25
|
-
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
|
26
|
-
// causing the page to scroll when moving focus if the element is transitioning
|
|
27
|
-
// from off the screen.
|
|
28
|
-
const ownerDocument = (0, $fCG8z$reactariautils.getOwnerDocument)(element);
|
|
29
|
-
if ((0, $e77252a287ef94ab$exports.getInteractionModality)() === 'virtual') {
|
|
30
|
-
let lastFocusedElement = (0, $fCG8z$reactariautils.getActiveElement)(ownerDocument);
|
|
31
|
-
(0, $fCG8z$reactariautils.runAfterTransition)(()=>{
|
|
32
|
-
const activeElement = (0, $fCG8z$reactariautils.getActiveElement)(ownerDocument);
|
|
33
|
-
// If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
|
|
34
|
-
if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
|
|
35
|
-
});
|
|
36
|
-
} else (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=focusSafely.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,gDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,CAAA,GAAA,sCAAe,EAAE;QAC1C,CAAA,GAAA,wCAAiB,EAAE;YACjB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;YACvC,2GAA2G;YAC3G,IAAI,AAAC,CAAA,kBAAkB,sBAAsB,kBAAkB,cAAc,IAAI,AAAD,KAAM,QAAQ,WAAW,EACvG,CAAA,GAAA,2CAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,2CAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = getActiveElement(ownerDocument);\n runAfterTransition(() => {\n const activeElement = getActiveElement(ownerDocument);\n // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.\n if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
|
package/dist/focusSafely.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.mjs";
|
|
2
|
-
import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
|
|
17
|
-
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
|
18
|
-
// wait until after any animated transitions that are currently occurring on
|
|
19
|
-
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
|
20
|
-
// causing the page to scroll when moving focus if the element is transitioning
|
|
21
|
-
// from off the screen.
|
|
22
|
-
const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
|
|
23
|
-
if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
|
|
24
|
-
let lastFocusedElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
|
25
|
-
(0, $k50bp$runAfterTransition)(()=>{
|
|
26
|
-
const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
|
27
|
-
// If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
|
|
28
|
-
if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
|
|
29
|
-
});
|
|
30
|
-
} else (0, $k50bp$focusWithoutScrolling)(element);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
|
35
|
-
//# sourceMappingURL=focusSafely.module.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.module.js";
|
|
2
|
-
import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
6
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
7
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
* governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
|
|
17
|
-
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
|
18
|
-
// wait until after any animated transitions that are currently occurring on
|
|
19
|
-
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
|
20
|
-
// causing the page to scroll when moving focus if the element is transitioning
|
|
21
|
-
// from off the screen.
|
|
22
|
-
const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
|
|
23
|
-
if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
|
|
24
|
-
let lastFocusedElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
|
25
|
-
(0, $k50bp$runAfterTransition)(()=>{
|
|
26
|
-
const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
|
27
|
-
// If focus did not move or focus was lost to the body, and the element is still in the document, focus it.
|
|
28
|
-
if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
|
|
29
|
-
});
|
|
30
|
-
} else (0, $k50bp$focusWithoutScrolling)(element);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
|
35
|
-
//# sourceMappingURL=focusSafely.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,yCAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,CAAA,GAAA,uBAAe,EAAE;QAC1C,CAAA,GAAA,yBAAiB,EAAE;YACjB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;YACvC,2GAA2G;YAC3G,IAAI,AAAC,CAAA,kBAAkB,sBAAsB,kBAAkB,cAAc,IAAI,AAAD,KAAM,QAAQ,WAAW,EACvG,CAAA,GAAA,4BAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,4BAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = getActiveElement(ownerDocument);\n runAfterTransition(() => {\n const activeElement = getActiveElement(ownerDocument);\n // If focus did not move or focus was lost to the body, and the element is still in the document, focus it.\n if ((activeElement === lastFocusedElement || activeElement === ownerDocument.body) && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}
|