@react-aria/overlays 3.15.0 → 3.16.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 +8 -6
- package/dist/main.js +8 -6
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -6
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/Overlay.tsx +8 -3
- package/src/calculatePosition.ts +2 -2
- package/src/useOverlayPosition.ts +3 -1
- package/src/usePreventScroll.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/overlays",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "^3.
|
|
26
|
-
"@react-aria/i18n": "^3.8.
|
|
27
|
-
"@react-aria/interactions": "^3.
|
|
28
|
-
"@react-aria/ssr": "^3.7.
|
|
29
|
-
"@react-aria/utils": "^3.
|
|
30
|
-
"@react-aria/visually-hidden": "^3.8.
|
|
31
|
-
"@react-stately/overlays": "^3.6.
|
|
32
|
-
"@react-types/button": "^3.7.
|
|
33
|
-
"@react-types/overlays": "^3.8.
|
|
34
|
-
"@react-types/shared": "^3.
|
|
25
|
+
"@react-aria/focus": "^3.14.0",
|
|
26
|
+
"@react-aria/i18n": "^3.8.1",
|
|
27
|
+
"@react-aria/interactions": "^3.17.0",
|
|
28
|
+
"@react-aria/ssr": "^3.7.1",
|
|
29
|
+
"@react-aria/utils": "^3.19.0",
|
|
30
|
+
"@react-aria/visually-hidden": "^3.8.3",
|
|
31
|
+
"@react-stately/overlays": "^3.6.1",
|
|
32
|
+
"@react-types/button": "^3.7.4",
|
|
33
|
+
"@react-types/overlays": "^3.8.1",
|
|
34
|
+
"@react-types/shared": "^3.19.0",
|
|
35
35
|
"@swc/helpers": "^0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d4dfe4bb842a914f10045ee63fc6b92f034c5b30"
|
|
45
45
|
}
|
package/src/Overlay.tsx
CHANGED
|
@@ -29,7 +29,12 @@ export interface OverlayProps {
|
|
|
29
29
|
* This option should be used very carefully. When focus management is disabled, you must
|
|
30
30
|
* implement focus containment and restoration to ensure the overlay is keyboard accessible.
|
|
31
31
|
*/
|
|
32
|
-
disableFocusManagement?: boolean
|
|
32
|
+
disableFocusManagement?: boolean,
|
|
33
|
+
/**
|
|
34
|
+
* Whether the overlay is currently performing an exit animation. When true,
|
|
35
|
+
* focus is allowed to move outside.
|
|
36
|
+
*/
|
|
37
|
+
isExiting?: boolean
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
export const OverlayContext = React.createContext(null);
|
|
@@ -40,7 +45,7 @@ export const OverlayContext = React.createContext(null);
|
|
|
40
45
|
*/
|
|
41
46
|
export function Overlay(props: OverlayProps) {
|
|
42
47
|
let isSSR = useIsSSR();
|
|
43
|
-
let {portalContainer = isSSR ? null : document.body} = props;
|
|
48
|
+
let {portalContainer = isSSR ? null : document.body, isExiting} = props;
|
|
44
49
|
let [contain, setContain] = useState(false);
|
|
45
50
|
let contextValue = useMemo(() => ({contain, setContain}), [contain, setContain]);
|
|
46
51
|
|
|
@@ -52,7 +57,7 @@ export function Overlay(props: OverlayProps) {
|
|
|
52
57
|
if (!props.disableFocusManagement) {
|
|
53
58
|
contents = (
|
|
54
59
|
<OverlayContext.Provider value={contextValue}>
|
|
55
|
-
<FocusScope restoreFocus contain={contain}>
|
|
60
|
+
<FocusScope restoreFocus contain={contain && !isExiting}>
|
|
56
61
|
{props.children}
|
|
57
62
|
</FocusScope>
|
|
58
63
|
</OverlayContext.Provider>
|
package/src/calculatePosition.ts
CHANGED
|
@@ -101,7 +101,7 @@ const TOTAL_SIZE = {
|
|
|
101
101
|
const PARSED_PLACEMENT_CACHE = {};
|
|
102
102
|
|
|
103
103
|
// @ts-ignore
|
|
104
|
-
let visualViewport = typeof
|
|
104
|
+
let visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
105
105
|
|
|
106
106
|
function getContainerDimensions(containerNode: Element): Dimensions {
|
|
107
107
|
let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
|
|
@@ -393,7 +393,7 @@ export function calculatePosition(opts: PositionOpts): PositionResult {
|
|
|
393
393
|
offset,
|
|
394
394
|
crossOffset,
|
|
395
395
|
maxHeight,
|
|
396
|
-
arrowSize,
|
|
396
|
+
arrowSize = 0,
|
|
397
397
|
arrowBoundaryOffset = 0
|
|
398
398
|
} = opts;
|
|
399
399
|
|
|
@@ -73,7 +73,7 @@ export interface PositionAria {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// @ts-ignore
|
|
76
|
-
let visualViewport = typeof
|
|
76
|
+
let visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Handles positioning overlays like popovers and menus relative to a trigger
|
|
@@ -217,6 +217,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
|
|
|
217
217
|
},
|
|
218
218
|
placement: position.placement,
|
|
219
219
|
arrowProps: {
|
|
220
|
+
'aria-hidden': 'true',
|
|
221
|
+
role: 'presentation',
|
|
220
222
|
style: {
|
|
221
223
|
left: position.arrowOffsetLeft,
|
|
222
224
|
top: position.arrowOffsetTop
|
package/src/usePreventScroll.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface PreventScrollOptions {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// @ts-ignore
|
|
21
|
-
const visualViewport = typeof
|
|
21
|
+
const visualViewport = typeof document !== 'undefined' && window.visualViewport;
|
|
22
22
|
|
|
23
23
|
// HTML input types that do not cause the software keyboard to appear.
|
|
24
24
|
const nonTextInputTypes = new Set([
|