@react-aria/focus 3.0.0-nightly-641446f65-240905
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/README.md +3 -0
- package/dist/FocusRing.main.js +44 -0
- package/dist/FocusRing.main.js.map +1 -0
- package/dist/FocusRing.mjs +35 -0
- package/dist/FocusRing.module.js +35 -0
- package/dist/FocusRing.module.js.map +1 -0
- package/dist/FocusScope.main.js +748 -0
- package/dist/FocusScope.main.js.map +1 -0
- package/dist/FocusScope.mjs +734 -0
- package/dist/FocusScope.module.js +734 -0
- package/dist/FocusScope.module.js.map +1 -0
- package/dist/focusSafely.main.js +39 -0
- package/dist/focusSafely.main.js.map +1 -0
- package/dist/focusSafely.mjs +34 -0
- package/dist/focusSafely.module.js +34 -0
- package/dist/focusSafely.module.js.map +1 -0
- package/dist/import.mjs +27 -0
- package/dist/isElementVisible.main.js +41 -0
- package/dist/isElementVisible.main.js.map +1 -0
- package/dist/isElementVisible.mjs +36 -0
- package/dist/isElementVisible.module.js +36 -0
- package/dist/isElementVisible.module.js.map +1 -0
- package/dist/main.js +43 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +27 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +148 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useFocusRing.main.js +50 -0
- package/dist/useFocusRing.main.js.map +1 -0
- package/dist/useFocusRing.mjs +45 -0
- package/dist/useFocusRing.module.js +45 -0
- package/dist/useFocusRing.module.js.map +1 -0
- package/dist/useFocusable.main.js +75 -0
- package/dist/useFocusable.main.js.map +1 -0
- package/dist/useFocusable.mjs +65 -0
- package/dist/useFocusable.module.js +65 -0
- package/dist/useFocusable.module.js.map +1 -0
- package/dist/useHasTabbableChild.main.js +62 -0
- package/dist/useHasTabbableChild.main.js.map +1 -0
- package/dist/useHasTabbableChild.mjs +57 -0
- package/dist/useHasTabbableChild.module.js +57 -0
- package/dist/useHasTabbableChild.module.js.map +1 -0
- package/package.json +38 -0
- package/src/FocusRing.tsx +55 -0
- package/src/FocusScope.tsx +988 -0
- package/src/focusSafely.ts +39 -0
- package/src/index.ts +23 -0
- package/src/isElementVisible.ts +69 -0
- package/src/useFocusRing.ts +78 -0
- package/src/useFocusable.tsx +97 -0
- package/src/useHasTabbableChild.ts +66 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { FocusableElement, RefObject, DOMAttributes, FocusableDOMProps, FocusableProps } from "@react-types/shared";
|
|
2
|
+
import React, { ReactNode, ReactElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A utility function that focuses an element while avoiding undesired side effects such
|
|
5
|
+
* as page scrolling and screen reader issues with CSS transitions.
|
|
6
|
+
*/
|
|
7
|
+
export function focusSafely(element: FocusableElement): void;
|
|
8
|
+
export interface FocusScopeProps {
|
|
9
|
+
/** The contents of the focus scope. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to contain focus inside the scope, so users cannot
|
|
13
|
+
* move focus outside, for example in a modal dialog.
|
|
14
|
+
*/
|
|
15
|
+
contain?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to restore focus back to the element that was focused
|
|
18
|
+
* when the focus scope mounted, after the focus scope unmounts.
|
|
19
|
+
*/
|
|
20
|
+
restoreFocus?: boolean;
|
|
21
|
+
/** Whether to auto focus the first focusable element in the focus scope on mount. */
|
|
22
|
+
autoFocus?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface FocusManagerOptions {
|
|
25
|
+
/** The element to start searching from. The currently focused element by default. */
|
|
26
|
+
from?: Element;
|
|
27
|
+
/** Whether to only include tabbable elements, or all focusable elements. */
|
|
28
|
+
tabbable?: boolean;
|
|
29
|
+
/** Whether focus should wrap around when it reaches the end of the scope. */
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
/** A callback that determines whether the given element is focused. */
|
|
32
|
+
accept?: (node: Element) => boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface FocusManager {
|
|
35
|
+
/** Moves focus to the next focusable or tabbable element in the focus scope. */
|
|
36
|
+
focusNext(opts?: FocusManagerOptions): FocusableElement | null;
|
|
37
|
+
/** Moves focus to the previous focusable or tabbable element in the focus scope. */
|
|
38
|
+
focusPrevious(opts?: FocusManagerOptions): FocusableElement | null;
|
|
39
|
+
/** Moves focus to the first focusable or tabbable element in the focus scope. */
|
|
40
|
+
focusFirst(opts?: FocusManagerOptions): FocusableElement | null;
|
|
41
|
+
/** Moves focus to the last focusable or tabbable element in the focus scope. */
|
|
42
|
+
focusLast(opts?: FocusManagerOptions): FocusableElement | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A FocusScope manages focus for its descendants. It supports containing focus inside
|
|
46
|
+
* the scope, restoring focus to the previously focused element on unmount, and auto
|
|
47
|
+
* focusing children on mount. It also acts as a container for a programmatic focus
|
|
48
|
+
* management interface that can be used to move focus forward and back in response
|
|
49
|
+
* to user events.
|
|
50
|
+
*/
|
|
51
|
+
export function FocusScope(props: FocusScopeProps): React.JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a FocusManager interface for the parent FocusScope.
|
|
54
|
+
* A FocusManager can be used to programmatically move focus within
|
|
55
|
+
* a FocusScope, e.g. in response to user events like keyboard navigation.
|
|
56
|
+
*/
|
|
57
|
+
export function useFocusManager(): FocusManager | undefined;
|
|
58
|
+
export function isFocusable(element: HTMLElement): boolean;
|
|
59
|
+
/** @private */
|
|
60
|
+
export function isElementInChildOfActiveScope(element: Element): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}
|
|
63
|
+
* that matches all focusable/tabbable elements.
|
|
64
|
+
*/
|
|
65
|
+
export function getFocusableTreeWalker(root: Element, opts?: FocusManagerOptions, scope?: Element[]): TreeWalker;
|
|
66
|
+
/**
|
|
67
|
+
* Creates a FocusManager object that can be used to move focus within an element.
|
|
68
|
+
*/
|
|
69
|
+
export function createFocusManager(ref: RefObject<Element | null>, defaultOptions?: FocusManagerOptions): FocusManager;
|
|
70
|
+
export interface AriaFocusRingProps {
|
|
71
|
+
/**
|
|
72
|
+
* Whether to show the focus ring when something
|
|
73
|
+
* inside the container element has focus (true), or
|
|
74
|
+
* only if the container itself has focus (false).
|
|
75
|
+
* @default 'false'
|
|
76
|
+
*/
|
|
77
|
+
within?: boolean;
|
|
78
|
+
/** Whether the element is a text input. */
|
|
79
|
+
isTextInput?: boolean;
|
|
80
|
+
/** Whether the element will be auto focused. */
|
|
81
|
+
autoFocus?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface FocusRingAria {
|
|
84
|
+
/** Whether the element is currently focused. */
|
|
85
|
+
isFocused: boolean;
|
|
86
|
+
/** Whether keyboard focus should be visible. */
|
|
87
|
+
isFocusVisible: boolean;
|
|
88
|
+
/** Props to apply to the container element with the focus ring. */
|
|
89
|
+
focusProps: DOMAttributes;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Determines whether a focus ring should be shown to indicate keyboard focus.
|
|
93
|
+
* Focus rings are visible only when the user is interacting with a keyboard,
|
|
94
|
+
* not with a mouse, touch, or other input methods.
|
|
95
|
+
*/
|
|
96
|
+
export function useFocusRing(props?: AriaFocusRingProps): FocusRingAria;
|
|
97
|
+
export interface FocusRingProps {
|
|
98
|
+
/** Child element to apply CSS classes to. */
|
|
99
|
+
children: ReactElement;
|
|
100
|
+
/** CSS class to apply when the element is focused. */
|
|
101
|
+
focusClass?: string;
|
|
102
|
+
/** CSS class to apply when the element has keyboard focus. */
|
|
103
|
+
focusRingClass?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to show the focus ring when something
|
|
106
|
+
* inside the container element has focus (true), or
|
|
107
|
+
* only if the container itself has focus (false).
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
within?: boolean;
|
|
111
|
+
/** Whether the element is a text input. */
|
|
112
|
+
isTextInput?: boolean;
|
|
113
|
+
/** Whether the element will be auto focused. */
|
|
114
|
+
autoFocus?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A utility component that applies a CSS class when an element has keyboard focus.
|
|
118
|
+
* Focus rings are visible only when the user is interacting with a keyboard,
|
|
119
|
+
* not with a mouse, touch, or other input methods.
|
|
120
|
+
*/
|
|
121
|
+
export function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
122
|
+
export interface FocusableOptions extends FocusableProps, FocusableDOMProps {
|
|
123
|
+
/** Whether focus should be disabled. */
|
|
124
|
+
isDisabled?: boolean;
|
|
125
|
+
}
|
|
126
|
+
export interface FocusableProviderProps extends DOMAttributes {
|
|
127
|
+
/** The child element to provide DOM props to. */
|
|
128
|
+
children?: ReactNode;
|
|
129
|
+
}
|
|
130
|
+
export let FocusableProvider: React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>>;
|
|
131
|
+
export interface FocusableAria {
|
|
132
|
+
/** Props for the focusable element. */
|
|
133
|
+
focusableProps: DOMAttributes;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Used to make an element focusable and capable of auto focus.
|
|
137
|
+
*/
|
|
138
|
+
export function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement | null>): FocusableAria;
|
|
139
|
+
interface AriaHasTabbableChildOptions {
|
|
140
|
+
isDisabled?: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Returns whether an element has a tabbable child, and updates as children change.
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
export function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean;
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["packages/@react-aria/focus/src/packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useFocusable.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useHasTabbableChild.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope, isFocusable} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {FocusableProvider, useFocusable} from './useFocusable';\nexport {useFocusRing} from './useFocusRing';\nexport {focusSafely} from './focusSafely';\nexport {useHasTabbableChild} from './useHasTabbableChild';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var $7eRoM$reactariainteractions = require("@react-aria/interactions");
|
|
2
|
+
var $7eRoM$react = require("react");
|
|
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, "useFocusRing", () => $581a96d6eb128c1b$export$4e328f61c538687f);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $581a96d6eb128c1b$export$4e328f61c538687f(props = {}) {
|
|
13
|
+
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
|
14
|
+
let state = (0, $7eRoM$react.useRef)({
|
|
15
|
+
isFocused: false,
|
|
16
|
+
isFocusVisible: autoFocus || (0, $7eRoM$reactariainteractions.isFocusVisible)()
|
|
17
|
+
});
|
|
18
|
+
let [isFocused, setFocused] = (0, $7eRoM$react.useState)(false);
|
|
19
|
+
let [isFocusVisibleState, setFocusVisible] = (0, $7eRoM$react.useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
|
20
|
+
let updateState = (0, $7eRoM$react.useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
21
|
+
let onFocusChange = (0, $7eRoM$react.useCallback)((isFocused)=>{
|
|
22
|
+
state.current.isFocused = isFocused;
|
|
23
|
+
setFocused(isFocused);
|
|
24
|
+
updateState();
|
|
25
|
+
}, [
|
|
26
|
+
updateState
|
|
27
|
+
]);
|
|
28
|
+
(0, $7eRoM$reactariainteractions.useFocusVisibleListener)((isFocusVisible)=>{
|
|
29
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
30
|
+
updateState();
|
|
31
|
+
}, [], {
|
|
32
|
+
isTextInput: isTextInput
|
|
33
|
+
});
|
|
34
|
+
let { focusProps: focusProps } = (0, $7eRoM$reactariainteractions.useFocus)({
|
|
35
|
+
isDisabled: within,
|
|
36
|
+
onFocusChange: onFocusChange
|
|
37
|
+
});
|
|
38
|
+
let { focusWithinProps: focusWithinProps } = (0, $7eRoM$reactariainteractions.useFocusWithin)({
|
|
39
|
+
isDisabled: !within,
|
|
40
|
+
onFocusWithinChange: onFocusChange
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
isFocused: isFocused,
|
|
44
|
+
isFocusVisible: isFocusVisibleState,
|
|
45
|
+
focusProps: within ? focusWithinProps : focusProps
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=useFocusRing.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAoCO,SAAS,0CAAa,QAA4B,CAAC,CAAC;IACzD,IAAI,aACF,YAAY,oBACZ,WAAW,UACX,MAAM,EACP,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,mBAAK,EAAE;QACjB,WAAW;QACX,gBAAgB,aAAa,CAAA,GAAA,2CAAa;IAC5C;IACA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,qBAAO,EAAE,IAAM,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc;IAEnH,IAAI,cAAc,CAAA,GAAA,wBAAU,EAAE,IAAM,gBAAgB,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc,GAAG,EAAE;IAEhH,IAAI,gBAAgB,CAAA,GAAA,wBAAU,EAAE,CAAA;QAC9B,MAAM,OAAO,CAAC,SAAS,GAAG;QAC1B,WAAW;QACX;IACF,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,oDAAsB,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,cAAc,GAAG;QAC/B;IACF,GAAG,EAAE,EAAE;qBAAC;IAAW;IAEnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,YAAY;uBACZ;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB;IACvB;IAEA,OAAO;mBACL;QACA,gBAAgB;QAChB,YAAY,SAAS,mBAAmB;IAC1C;AACF","sources":["packages/@react-aria/focus/src/useFocusRing.ts"],"sourcesContent":["import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n"],"names":[],"version":3,"file":"useFocusRing.main.js.map"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {isFocusVisible as $isWE5$isFocusVisible, useFocusVisibleListener as $isWE5$useFocusVisibleListener, useFocus as $isWE5$useFocus, useFocusWithin as $isWE5$useFocusWithin} from "@react-aria/interactions";
|
|
2
|
+
import {useRef as $isWE5$useRef, useState as $isWE5$useState, useCallback as $isWE5$useCallback} from "react";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
|
7
|
+
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
|
8
|
+
let state = (0, $isWE5$useRef)({
|
|
9
|
+
isFocused: false,
|
|
10
|
+
isFocusVisible: autoFocus || (0, $isWE5$isFocusVisible)()
|
|
11
|
+
});
|
|
12
|
+
let [isFocused, setFocused] = (0, $isWE5$useState)(false);
|
|
13
|
+
let [isFocusVisibleState, setFocusVisible] = (0, $isWE5$useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
|
14
|
+
let updateState = (0, $isWE5$useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
15
|
+
let onFocusChange = (0, $isWE5$useCallback)((isFocused)=>{
|
|
16
|
+
state.current.isFocused = isFocused;
|
|
17
|
+
setFocused(isFocused);
|
|
18
|
+
updateState();
|
|
19
|
+
}, [
|
|
20
|
+
updateState
|
|
21
|
+
]);
|
|
22
|
+
(0, $isWE5$useFocusVisibleListener)((isFocusVisible)=>{
|
|
23
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
24
|
+
updateState();
|
|
25
|
+
}, [], {
|
|
26
|
+
isTextInput: isTextInput
|
|
27
|
+
});
|
|
28
|
+
let { focusProps: focusProps } = (0, $isWE5$useFocus)({
|
|
29
|
+
isDisabled: within,
|
|
30
|
+
onFocusChange: onFocusChange
|
|
31
|
+
});
|
|
32
|
+
let { focusWithinProps: focusWithinProps } = (0, $isWE5$useFocusWithin)({
|
|
33
|
+
isDisabled: !within,
|
|
34
|
+
onFocusWithinChange: onFocusChange
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
isFocused: isFocused,
|
|
38
|
+
isFocusVisible: isFocusVisibleState,
|
|
39
|
+
focusProps: within ? focusWithinProps : focusProps
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export {$f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing};
|
|
45
|
+
//# sourceMappingURL=useFocusRing.module.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {isFocusVisible as $isWE5$isFocusVisible, useFocusVisibleListener as $isWE5$useFocusVisibleListener, useFocus as $isWE5$useFocus, useFocusWithin as $isWE5$useFocusWithin} from "@react-aria/interactions";
|
|
2
|
+
import {useRef as $isWE5$useRef, useState as $isWE5$useState, useCallback as $isWE5$useCallback} from "react";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
|
7
|
+
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
|
8
|
+
let state = (0, $isWE5$useRef)({
|
|
9
|
+
isFocused: false,
|
|
10
|
+
isFocusVisible: autoFocus || (0, $isWE5$isFocusVisible)()
|
|
11
|
+
});
|
|
12
|
+
let [isFocused, setFocused] = (0, $isWE5$useState)(false);
|
|
13
|
+
let [isFocusVisibleState, setFocusVisible] = (0, $isWE5$useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
|
14
|
+
let updateState = (0, $isWE5$useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
15
|
+
let onFocusChange = (0, $isWE5$useCallback)((isFocused)=>{
|
|
16
|
+
state.current.isFocused = isFocused;
|
|
17
|
+
setFocused(isFocused);
|
|
18
|
+
updateState();
|
|
19
|
+
}, [
|
|
20
|
+
updateState
|
|
21
|
+
]);
|
|
22
|
+
(0, $isWE5$useFocusVisibleListener)((isFocusVisible)=>{
|
|
23
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
24
|
+
updateState();
|
|
25
|
+
}, [], {
|
|
26
|
+
isTextInput: isTextInput
|
|
27
|
+
});
|
|
28
|
+
let { focusProps: focusProps } = (0, $isWE5$useFocus)({
|
|
29
|
+
isDisabled: within,
|
|
30
|
+
onFocusChange: onFocusChange
|
|
31
|
+
});
|
|
32
|
+
let { focusWithinProps: focusWithinProps } = (0, $isWE5$useFocusWithin)({
|
|
33
|
+
isDisabled: !within,
|
|
34
|
+
onFocusWithinChange: onFocusChange
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
isFocused: isFocused,
|
|
38
|
+
isFocusVisible: isFocusVisibleState,
|
|
39
|
+
focusProps: within ? focusWithinProps : focusProps
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export {$f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing};
|
|
45
|
+
//# sourceMappingURL=useFocusRing.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAoCO,SAAS,0CAAa,QAA4B,CAAC,CAAC;IACzD,IAAI,aACF,YAAY,oBACZ,WAAW,UACX,MAAM,EACP,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,WAAW;QACX,gBAAgB,aAAa,CAAA,GAAA,qBAAa;IAC5C;IACA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,eAAO,EAAE,IAAM,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc;IAEnH,IAAI,cAAc,CAAA,GAAA,kBAAU,EAAE,IAAM,gBAAgB,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc,GAAG,EAAE;IAEhH,IAAI,gBAAgB,CAAA,GAAA,kBAAU,EAAE,CAAA;QAC9B,MAAM,OAAO,CAAC,SAAS,GAAG;QAC1B,WAAW;QACX;IACF,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,8BAAsB,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,cAAc,GAAG;QAC/B;IACF,GAAG,EAAE,EAAE;qBAAC;IAAW;IAEnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,YAAY;uBACZ;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB;IACvB;IAEA,OAAO;mBACL;QACA,gBAAgB;QAChB,YAAY,SAAS,mBAAmB;IAC1C;AACF","sources":["packages/@react-aria/focus/src/useFocusRing.ts"],"sourcesContent":["import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n"],"names":[],"version":3,"file":"useFocusRing.module.js.map"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var $1c7f9157d722357d$exports = require("./focusSafely.main.js");
|
|
2
|
+
var $ggOO2$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $ggOO2$react = require("react");
|
|
4
|
+
var $ggOO2$reactariainteractions = require("@react-aria/interactions");
|
|
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, "FocusableProvider", () => $fb504d83237fd6ac$export$13f3202a3e5ddd5);
|
|
16
|
+
$parcel$export(module.exports, "useFocusable", () => $fb504d83237fd6ac$export$4c014de7c8940b4c);
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
let $fb504d83237fd6ac$var$FocusableContext = /*#__PURE__*/ (0, ($parcel$interopDefault($ggOO2$react))).createContext(null);
|
|
32
|
+
function $fb504d83237fd6ac$var$useFocusableContext(ref) {
|
|
33
|
+
let context = (0, $ggOO2$react.useContext)($fb504d83237fd6ac$var$FocusableContext) || {};
|
|
34
|
+
(0, $ggOO2$reactariautils.useSyncRef)(context, ref);
|
|
35
|
+
// eslint-disable-next-line
|
|
36
|
+
let { ref: _, ...otherProps } = context;
|
|
37
|
+
return otherProps;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provides DOM props to the nearest focusable child.
|
|
41
|
+
*/ function $fb504d83237fd6ac$var$FocusableProvider(props, ref) {
|
|
42
|
+
let { children: children, ...otherProps } = props;
|
|
43
|
+
let objRef = (0, $ggOO2$reactariautils.useObjectRef)(ref);
|
|
44
|
+
let context = {
|
|
45
|
+
...otherProps,
|
|
46
|
+
ref: objRef
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($ggOO2$react))).createElement($fb504d83237fd6ac$var$FocusableContext.Provider, {
|
|
49
|
+
value: context
|
|
50
|
+
}, children);
|
|
51
|
+
}
|
|
52
|
+
let $fb504d83237fd6ac$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, ($parcel$interopDefault($ggOO2$react))).forwardRef($fb504d83237fd6ac$var$FocusableProvider);
|
|
53
|
+
function $fb504d83237fd6ac$export$4c014de7c8940b4c(props, domRef) {
|
|
54
|
+
let { focusProps: focusProps } = (0, $ggOO2$reactariainteractions.useFocus)(props);
|
|
55
|
+
let { keyboardProps: keyboardProps } = (0, $ggOO2$reactariainteractions.useKeyboard)(props);
|
|
56
|
+
let interactions = (0, $ggOO2$reactariautils.mergeProps)(focusProps, keyboardProps);
|
|
57
|
+
let domProps = $fb504d83237fd6ac$var$useFocusableContext(domRef);
|
|
58
|
+
let interactionProps = props.isDisabled ? {} : domProps;
|
|
59
|
+
let autoFocusRef = (0, $ggOO2$react.useRef)(props.autoFocus);
|
|
60
|
+
(0, $ggOO2$react.useEffect)(()=>{
|
|
61
|
+
if (autoFocusRef.current && domRef.current) (0, $1c7f9157d722357d$exports.focusSafely)(domRef.current);
|
|
62
|
+
autoFocusRef.current = false;
|
|
63
|
+
}, [
|
|
64
|
+
domRef
|
|
65
|
+
]);
|
|
66
|
+
return {
|
|
67
|
+
focusableProps: (0, $ggOO2$reactariautils.mergeProps)({
|
|
68
|
+
...interactions,
|
|
69
|
+
tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined
|
|
70
|
+
}, interactionProps)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=useFocusable.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAsBD,IAAI,uDAAmB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA+B;AAEzE,SAAS,0CAAoB,GAAuC;IAClE,IAAI,UAAU,CAAA,GAAA,uBAAS,EAAE,2CAAqB,CAAC;IAC/C,CAAA,GAAA,gCAAS,EAAE,SAAS;IAEpB,2BAA2B;IAC3B,IAAI,EAAC,KAAK,CAAC,EAAE,GAAG,YAAW,GAAG;IAC9B,OAAO;AACT;AAEA;;CAEC,GACD,SAAS,wCAAkB,KAA6B,EAAE,GAAmC;IAC3F,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAChC,IAAI,SAAS,CAAA,GAAA,kCAAW,EAAE;IAC1B,IAAI,UAAU;QACZ,GAAG,UAAU;QACb,KAAK;IACP;IAEA,qBACE,0DAAC,uCAAiB,QAAQ;QAAC,OAAO;OAC/B;AAGP;AAEA,IAAI,yDAAqB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAWnC,SAAS,0CAAa,KAAuB,EAAE,MAA0C;IAC9F,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;IAC5B,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,wCAAU,EAAE;IAClC,IAAI,eAAe,CAAA,GAAA,gCAAS,EAAE,YAAY;IAC1C,IAAI,WAAW,0CAAoB;IACnC,IAAI,mBAAmB,MAAM,UAAU,GAAG,CAAC,IAAI;IAC/C,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE,MAAM,SAAS;IAEzC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,CAAA,GAAA,qCAAU,EAAE,OAAO,OAAO;QAE5B,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,OAAO;QACL,gBAAgB,CAAA,GAAA,gCAAS,EACvB;YACE,GAAG,YAAY;YACf,UAAU,MAAM,mBAAmB,IAAI,CAAC,MAAM,UAAU,GAAG,KAAK;QAClE,GACA;IAEJ;AACF","sources":["packages/@react-aria/focus/src/useFocusable.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, FocusableDOMProps, FocusableElement, FocusableProps, RefObject} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport React, {ForwardedRef, MutableRefObject, ReactNode, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement | null>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let {children, ...otherProps} = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement | null>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"useFocusable.main.js.map"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {focusSafely as $6a99195332edec8b$export$80f3e147d781571c} from "./focusSafely.mjs";
|
|
2
|
+
import {useSyncRef as $h8xso$useSyncRef, useObjectRef as $h8xso$useObjectRef, mergeProps as $h8xso$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import $h8xso$react, {useContext as $h8xso$useContext, useRef as $h8xso$useRef, useEffect as $h8xso$useEffect} from "react";
|
|
4
|
+
import {useFocus as $h8xso$useFocus, useKeyboard as $h8xso$useKeyboard} from "@react-aria/interactions";
|
|
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
|
+
let $e6afbd83fe6ebbd2$var$FocusableContext = /*#__PURE__*/ (0, $h8xso$react).createContext(null);
|
|
21
|
+
function $e6afbd83fe6ebbd2$var$useFocusableContext(ref) {
|
|
22
|
+
let context = (0, $h8xso$useContext)($e6afbd83fe6ebbd2$var$FocusableContext) || {};
|
|
23
|
+
(0, $h8xso$useSyncRef)(context, ref);
|
|
24
|
+
// eslint-disable-next-line
|
|
25
|
+
let { ref: _, ...otherProps } = context;
|
|
26
|
+
return otherProps;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Provides DOM props to the nearest focusable child.
|
|
30
|
+
*/ function $e6afbd83fe6ebbd2$var$FocusableProvider(props, ref) {
|
|
31
|
+
let { children: children, ...otherProps } = props;
|
|
32
|
+
let objRef = (0, $h8xso$useObjectRef)(ref);
|
|
33
|
+
let context = {
|
|
34
|
+
...otherProps,
|
|
35
|
+
ref: objRef
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/ (0, $h8xso$react).createElement($e6afbd83fe6ebbd2$var$FocusableContext.Provider, {
|
|
38
|
+
value: context
|
|
39
|
+
}, children);
|
|
40
|
+
}
|
|
41
|
+
let $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, $h8xso$react).forwardRef($e6afbd83fe6ebbd2$var$FocusableProvider);
|
|
42
|
+
function $e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, domRef) {
|
|
43
|
+
let { focusProps: focusProps } = (0, $h8xso$useFocus)(props);
|
|
44
|
+
let { keyboardProps: keyboardProps } = (0, $h8xso$useKeyboard)(props);
|
|
45
|
+
let interactions = (0, $h8xso$mergeProps)(focusProps, keyboardProps);
|
|
46
|
+
let domProps = $e6afbd83fe6ebbd2$var$useFocusableContext(domRef);
|
|
47
|
+
let interactionProps = props.isDisabled ? {} : domProps;
|
|
48
|
+
let autoFocusRef = (0, $h8xso$useRef)(props.autoFocus);
|
|
49
|
+
(0, $h8xso$useEffect)(()=>{
|
|
50
|
+
if (autoFocusRef.current && domRef.current) (0, $6a99195332edec8b$export$80f3e147d781571c)(domRef.current);
|
|
51
|
+
autoFocusRef.current = false;
|
|
52
|
+
}, [
|
|
53
|
+
domRef
|
|
54
|
+
]);
|
|
55
|
+
return {
|
|
56
|
+
focusableProps: (0, $h8xso$mergeProps)({
|
|
57
|
+
...interactions,
|
|
58
|
+
tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined
|
|
59
|
+
}, interactionProps)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export {$e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 as FocusableProvider, $e6afbd83fe6ebbd2$export$4c014de7c8940b4c as useFocusable};
|
|
65
|
+
//# sourceMappingURL=useFocusable.module.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {focusSafely as $6a99195332edec8b$export$80f3e147d781571c} from "./focusSafely.module.js";
|
|
2
|
+
import {useSyncRef as $h8xso$useSyncRef, useObjectRef as $h8xso$useObjectRef, mergeProps as $h8xso$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import $h8xso$react, {useContext as $h8xso$useContext, useRef as $h8xso$useRef, useEffect as $h8xso$useEffect} from "react";
|
|
4
|
+
import {useFocus as $h8xso$useFocus, useKeyboard as $h8xso$useKeyboard} from "@react-aria/interactions";
|
|
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
|
+
let $e6afbd83fe6ebbd2$var$FocusableContext = /*#__PURE__*/ (0, $h8xso$react).createContext(null);
|
|
21
|
+
function $e6afbd83fe6ebbd2$var$useFocusableContext(ref) {
|
|
22
|
+
let context = (0, $h8xso$useContext)($e6afbd83fe6ebbd2$var$FocusableContext) || {};
|
|
23
|
+
(0, $h8xso$useSyncRef)(context, ref);
|
|
24
|
+
// eslint-disable-next-line
|
|
25
|
+
let { ref: _, ...otherProps } = context;
|
|
26
|
+
return otherProps;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Provides DOM props to the nearest focusable child.
|
|
30
|
+
*/ function $e6afbd83fe6ebbd2$var$FocusableProvider(props, ref) {
|
|
31
|
+
let { children: children, ...otherProps } = props;
|
|
32
|
+
let objRef = (0, $h8xso$useObjectRef)(ref);
|
|
33
|
+
let context = {
|
|
34
|
+
...otherProps,
|
|
35
|
+
ref: objRef
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/ (0, $h8xso$react).createElement($e6afbd83fe6ebbd2$var$FocusableContext.Provider, {
|
|
38
|
+
value: context
|
|
39
|
+
}, children);
|
|
40
|
+
}
|
|
41
|
+
let $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, $h8xso$react).forwardRef($e6afbd83fe6ebbd2$var$FocusableProvider);
|
|
42
|
+
function $e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, domRef) {
|
|
43
|
+
let { focusProps: focusProps } = (0, $h8xso$useFocus)(props);
|
|
44
|
+
let { keyboardProps: keyboardProps } = (0, $h8xso$useKeyboard)(props);
|
|
45
|
+
let interactions = (0, $h8xso$mergeProps)(focusProps, keyboardProps);
|
|
46
|
+
let domProps = $e6afbd83fe6ebbd2$var$useFocusableContext(domRef);
|
|
47
|
+
let interactionProps = props.isDisabled ? {} : domProps;
|
|
48
|
+
let autoFocusRef = (0, $h8xso$useRef)(props.autoFocus);
|
|
49
|
+
(0, $h8xso$useEffect)(()=>{
|
|
50
|
+
if (autoFocusRef.current && domRef.current) (0, $6a99195332edec8b$export$80f3e147d781571c)(domRef.current);
|
|
51
|
+
autoFocusRef.current = false;
|
|
52
|
+
}, [
|
|
53
|
+
domRef
|
|
54
|
+
]);
|
|
55
|
+
return {
|
|
56
|
+
focusableProps: (0, $h8xso$mergeProps)({
|
|
57
|
+
...interactions,
|
|
58
|
+
tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined
|
|
59
|
+
}, interactionProps)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export {$e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 as FocusableProvider, $e6afbd83fe6ebbd2$export$4c014de7c8940b4c as useFocusable};
|
|
65
|
+
//# sourceMappingURL=useFocusable.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAsBD,IAAI,uDAAmB,CAAA,GAAA,YAAI,EAAE,aAAa,CAA+B;AAEzE,SAAS,0CAAoB,GAAuC;IAClE,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE,2CAAqB,CAAC;IAC/C,CAAA,GAAA,iBAAS,EAAE,SAAS;IAEpB,2BAA2B;IAC3B,IAAI,EAAC,KAAK,CAAC,EAAE,GAAG,YAAW,GAAG;IAC9B,OAAO;AACT;AAEA;;CAEC,GACD,SAAS,wCAAkB,KAA6B,EAAE,GAAmC;IAC3F,IAAI,YAAC,QAAQ,EAAE,GAAG,YAAW,GAAG;IAChC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE;IAC1B,IAAI,UAAU;QACZ,GAAG,UAAU;QACb,KAAK;IACP;IAEA,qBACE,gCAAC,uCAAiB,QAAQ;QAAC,OAAO;OAC/B;AAGP;AAEA,IAAI,yDAAqB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAWnC,SAAS,0CAAa,KAAuB,EAAE,MAA0C;IAC9F,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IAC5B,IAAI,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,kBAAU,EAAE;IAClC,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,YAAY;IAC1C,IAAI,WAAW,0CAAoB;IACnC,IAAI,mBAAmB,MAAM,UAAU,GAAG,CAAC,IAAI;IAC/C,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE,MAAM,SAAS;IAEzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,aAAa,OAAO,IAAI,OAAO,OAAO,EACxC,CAAA,GAAA,yCAAU,EAAE,OAAO,OAAO;QAE5B,aAAa,OAAO,GAAG;IACzB,GAAG;QAAC;KAAO;IAEX,OAAO;QACL,gBAAgB,CAAA,GAAA,iBAAS,EACvB;YACE,GAAG,YAAY;YACf,UAAU,MAAM,mBAAmB,IAAI,CAAC,MAAM,UAAU,GAAG,KAAK;QAClE,GACA;IAEJ;AACF","sources":["packages/@react-aria/focus/src/useFocusable.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, FocusableDOMProps, FocusableElement, FocusableProps, RefObject} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport React, {ForwardedRef, MutableRefObject, ReactNode, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement | null>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue | null>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement | null>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {\n let {children, ...otherProps} = props;\n let objRef = useObjectRef(ref);\n let context = {\n ...otherProps,\n ref: objRef\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement | null>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"useFocusable.module.js.map"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var $a7a032acae3ddda9$exports = require("./FocusScope.main.js");
|
|
2
|
+
var $6RLDH$reactariautils = require("@react-aria/utils");
|
|
3
|
+
var $6RLDH$react = require("react");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$export(e, n, v, s) {
|
|
7
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$parcel$export(module.exports, "useHasTabbableChild", () => $259c6413a286f2e6$export$eac1895992b9f3d6);
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $259c6413a286f2e6$export$eac1895992b9f3d6(ref, options) {
|
|
25
|
+
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
|
26
|
+
let [hasTabbableChild, setHasTabbableChild] = (0, $6RLDH$react.useState)(false);
|
|
27
|
+
(0, $6RLDH$reactariautils.useLayoutEffect)(()=>{
|
|
28
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
|
29
|
+
let update = ()=>{
|
|
30
|
+
if (ref.current) {
|
|
31
|
+
let walker = (0, $a7a032acae3ddda9$exports.getFocusableTreeWalker)(ref.current, {
|
|
32
|
+
tabbable: true
|
|
33
|
+
});
|
|
34
|
+
setHasTabbableChild(!!walker.nextNode());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
update();
|
|
38
|
+
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
|
39
|
+
let observer = new MutationObserver(update);
|
|
40
|
+
observer.observe(ref.current, {
|
|
41
|
+
subtree: true,
|
|
42
|
+
childList: true,
|
|
43
|
+
attributes: true,
|
|
44
|
+
attributeFilter: [
|
|
45
|
+
'tabIndex',
|
|
46
|
+
'disabled'
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
return ()=>{
|
|
50
|
+
// Disconnect mutation observer when a React update occurs on the top-level component
|
|
51
|
+
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
|
52
|
+
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
|
53
|
+
// so we also update if a child component re-renders and adds/removes something tabbable.
|
|
54
|
+
observer.disconnect();
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return isDisabled ? false : hasTabbableChild;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=useHasTabbableChild.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAoB,GAA8B,EAAE,OAAqC;IACvG,IAAI,aAAa,oBAAA,8BAAA,QAAS,UAAU;IACpC,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAAI,CAAC,YAAY;YAC/B,IAAI,SAAS;gBACX,IAAI,IAAI,OAAO,EAAE;oBACf,IAAI,SAAS,CAAA,GAAA,gDAAqB,EAAE,IAAI,OAAO,EAAE;wBAAC,UAAU;oBAAI;oBAChE,oBAAoB,CAAC,CAAC,OAAO,QAAQ;gBACvC;YACF;YAEA;YAEA,qFAAqF;YACrF,IAAI,WAAW,IAAI,iBAAiB;YACpC,SAAS,OAAO,CAAC,IAAI,OAAO,EAAE;gBAC5B,SAAS;gBACT,WAAW;gBACX,YAAY;gBACZ,iBAAiB;oBAAC;oBAAY;iBAAW;YAC3C;YAEA,OAAO;gBACL,qFAAqF;gBACrF,wFAAwF;gBACxF,4FAA4F;gBAC5F,yFAAyF;gBACzF,SAAS,UAAU;YACrB;QACF;IACF;IAEA,OAAO,aAAa,QAAQ;AAC9B","sources":["packages/@react-aria/focus/src/useHasTabbableChild.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {getFocusableTreeWalker} from './FocusScope';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\ninterface AriaHasTabbableChildOptions {\n isDisabled?: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */\nexport function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useLayoutEffect(() => {\n if (ref?.current && !isDisabled) {\n let update = () => {\n if (ref.current) {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n\n return isDisabled ? false : hasTabbableChild;\n}\n"],"names":[],"version":3,"file":"useHasTabbableChild.main.js.map"}
|