@react-aria/overlays 3.10.0 → 3.11.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/main.js +104 -5
- package/dist/main.js.map +1 -1
- package/dist/module.js +102 -7
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +69 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -10
- package/src/Overlay.tsx +61 -0
- package/src/ariaHideOutside.ts +4 -8
- package/src/index.ts +6 -0
- package/src/useModalOverlay.ts +69 -0
- package/src/usePopover.ts +88 -0
package/dist/module.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import $k7QOs$react, {useState as $k7QOs$useState, useCallback as $k7QOs$useCallback, useRef as $k7QOs$useRef, useEffect as $k7QOs$useEffect, useContext as $k7QOs$useContext, useMemo as $k7QOs$useMemo} from "react";
|
|
2
|
-
import {useLayoutEffect as $k7QOs$useLayoutEffect, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels} from "@react-aria/utils";
|
|
2
|
+
import {useLayoutEffect as $k7QOs$useLayoutEffect, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels, mergeProps as $k7QOs$mergeProps} from "@react-aria/utils";
|
|
3
3
|
import {useLocale as $k7QOs$useLocale, useLocalizedStringFormatter as $k7QOs$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
4
4
|
import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin} from "@react-aria/interactions";
|
|
5
5
|
import $k7QOs$reactdom from "react-dom";
|
|
6
6
|
import {useIsSSR as $k7QOs$useIsSSR} from "@react-aria/ssr";
|
|
7
7
|
import {VisuallyHidden as $k7QOs$VisuallyHidden} from "@react-aria/visually-hidden";
|
|
8
|
+
import {FocusScope as $k7QOs$FocusScope} from "@react-aria/focus";
|
|
8
9
|
|
|
9
10
|
function $parcel$interopDefault(a) {
|
|
10
11
|
return a && a.__esModule ? a.default : a;
|
|
@@ -1049,11 +1050,10 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1049
1050
|
// If this node is a live announcer, add it to the set of nodes to keep visible.
|
|
1050
1051
|
if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer === 'true') visibleNodes.add(node);
|
|
1051
1052
|
// Skip this node and its children if it is one of the target nodes, or a live announcer.
|
|
1052
|
-
// Also skip children of already hidden nodes, as aria-hidden is recursive.
|
|
1053
|
-
|
|
1054
|
-
//
|
|
1055
|
-
|
|
1056
|
-
if (node instanceof Element && node.getAttribute('role') === 'row') return NodeFilter.FILTER_SKIP;
|
|
1053
|
+
// Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
|
|
1054
|
+
// made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
|
|
1055
|
+
// For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
|
|
1056
|
+
if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
|
|
1057
1057
|
// Skip this node but continue to children if one of the targets is inside the node.
|
|
1058
1058
|
if (targets.some((target)=>node.contains(target)
|
|
1059
1059
|
)) return NodeFilter.FILTER_SKIP;
|
|
@@ -1109,5 +1109,100 @@ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body
|
|
|
1109
1109
|
|
|
1110
1110
|
|
|
1111
1111
|
|
|
1112
|
-
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
function $f2f8a6077418541e$export$542a6fd13ac93354(props, state) {
|
|
1116
|
+
let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , ...otherProps } = props;
|
|
1117
|
+
let { overlayProps: overlayProps } = $a11501f3d1d39e6c$export$ea8f71083e90600f({
|
|
1118
|
+
isOpen: state.isOpen,
|
|
1119
|
+
onClose: state.close,
|
|
1120
|
+
shouldCloseOnBlur: true,
|
|
1121
|
+
isDismissable: true
|
|
1122
|
+
}, popoverRef);
|
|
1123
|
+
let { overlayProps: positionProps , arrowProps: arrowProps } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
|
|
1124
|
+
...otherProps,
|
|
1125
|
+
targetRef: triggerRef,
|
|
1126
|
+
overlayRef: popoverRef,
|
|
1127
|
+
isOpen: state.isOpen
|
|
1128
|
+
});
|
|
1129
|
+
$k7QOs$useEffect(()=>{
|
|
1130
|
+
if (state.isOpen && !isNonModal) return $5e3802645cc19319$export$1c3ebcada18427bf([
|
|
1131
|
+
popoverRef.current
|
|
1132
|
+
]);
|
|
1133
|
+
}, [
|
|
1134
|
+
isNonModal,
|
|
1135
|
+
state.isOpen,
|
|
1136
|
+
popoverRef
|
|
1137
|
+
]);
|
|
1138
|
+
return {
|
|
1139
|
+
popoverProps: $k7QOs$mergeProps(overlayProps, positionProps),
|
|
1140
|
+
arrowProps: arrowProps
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
const $337b884510726a0d$var$OverlayContext = /*#__PURE__*/ $k7QOs$react.createContext(null);
|
|
1155
|
+
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
|
|
1156
|
+
let isSSR = $k7QOs$useIsSSR();
|
|
1157
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
|
|
1158
|
+
let [contain, setContain] = $k7QOs$useState(false);
|
|
1159
|
+
if (!portalContainer) return null;
|
|
1160
|
+
let contents = /*#__PURE__*/ $k7QOs$react.createElement($337b884510726a0d$var$OverlayContext.Provider, {
|
|
1161
|
+
value: setContain
|
|
1162
|
+
}, /*#__PURE__*/ $k7QOs$react.createElement($k7QOs$FocusScope, {
|
|
1163
|
+
restoreFocus: true,
|
|
1164
|
+
contain: contain
|
|
1165
|
+
}, props.children));
|
|
1166
|
+
return(/*#__PURE__*/ $k7QOs$reactdom.createPortal(contents, portalContainer));
|
|
1167
|
+
}
|
|
1168
|
+
function $337b884510726a0d$export$14c98a7594375490() {
|
|
1169
|
+
let setContain = $k7QOs$useContext($337b884510726a0d$var$OverlayContext);
|
|
1170
|
+
$k7QOs$useLayoutEffect(()=>{
|
|
1171
|
+
setContain === null || setContain === void 0 ? void 0 : setContain(true);
|
|
1172
|
+
}, [
|
|
1173
|
+
setContain
|
|
1174
|
+
]);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
|
|
1180
|
+
let { overlayProps: overlayProps , underlayProps: underlayProps } = $a11501f3d1d39e6c$export$ea8f71083e90600f({
|
|
1181
|
+
...props,
|
|
1182
|
+
isOpen: state.isOpen,
|
|
1183
|
+
onClose: state.close
|
|
1184
|
+
}, ref);
|
|
1185
|
+
$49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
|
|
1186
|
+
isDisabled: !state.isOpen
|
|
1187
|
+
});
|
|
1188
|
+
$337b884510726a0d$export$14c98a7594375490();
|
|
1189
|
+
$k7QOs$useEffect(()=>{
|
|
1190
|
+
if (state.isOpen) return $5e3802645cc19319$export$1c3ebcada18427bf([
|
|
1191
|
+
ref.current
|
|
1192
|
+
]);
|
|
1193
|
+
}, [
|
|
1194
|
+
state.isOpen,
|
|
1195
|
+
ref
|
|
1196
|
+
]);
|
|
1197
|
+
return {
|
|
1198
|
+
modalProps: $k7QOs$mergeProps(overlayProps),
|
|
1199
|
+
underlayProps: underlayProps
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
export {$2a41e45df1593e64$export$d39e1813b3bdd0e1 as useOverlayPosition, $a11501f3d1d39e6c$export$ea8f71083e90600f as useOverlay, $628037886ba31236$export$f9d5c8beee7d008d as useOverlayTrigger, $49c51c25361d4cd2$export$ee0f7cc6afcd1c18 as usePreventScroll, $f57aed4a881a3485$export$178405afcd8c5eb as ModalProvider, $f57aed4a881a3485$export$d9aaed4c3ece1bc0 as useModalProvider, $f57aed4a881a3485$export$bf688221f59024e5 as OverlayProvider, $f57aed4a881a3485$export$b47c3594eab58386 as OverlayContainer, $f57aed4a881a3485$export$33ffd74ebf07f060 as useModal, $86ea4cb521eb2e37$export$2317d149ed6f78c4 as DismissButton, $5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside, $f2f8a6077418541e$export$542a6fd13ac93354 as usePopover, $8ac8429251c45e4b$export$dbc0f175b25fb0fb as useModalOverlay, $337b884510726a0d$export$c6fdb837b070b4ff as Overlay, $337b884510726a0d$export$14c98a7594375490 as useOverlayFocusContain};
|
|
1113
1208
|
//# sourceMappingURL=module.js.map
|