@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 CHANGED
@@ -5,6 +5,7 @@ var $6Zb2x$reactariainteractions = require("@react-aria/interactions");
5
5
  var $6Zb2x$reactdom = require("react-dom");
6
6
  var $6Zb2x$reactariassr = require("@react-aria/ssr");
7
7
  var $6Zb2x$reactariavisuallyhidden = require("@react-aria/visually-hidden");
8
+ var $6Zb2x$reactariafocus = require("@react-aria/focus");
8
9
 
9
10
  function $parcel$export(e, n, v, s) {
10
11
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -24,6 +25,10 @@ $parcel$export(module.exports, "OverlayContainer", () => $0775ea8ea6a0565e$expor
24
25
  $parcel$export(module.exports, "useModal", () => $0775ea8ea6a0565e$export$33ffd74ebf07f060);
25
26
  $parcel$export(module.exports, "DismissButton", () => $f69bb3e6457495cc$export$2317d149ed6f78c4);
26
27
  $parcel$export(module.exports, "ariaHideOutside", () => $08ef1685902b6011$export$1c3ebcada18427bf);
28
+ $parcel$export(module.exports, "usePopover", () => $6c2dfcdee3e15e20$export$542a6fd13ac93354);
29
+ $parcel$export(module.exports, "useModalOverlay", () => $11b7e0b04b421e95$export$dbc0f175b25fb0fb);
30
+ $parcel$export(module.exports, "Overlay", () => $745edbb83ab4296f$export$c6fdb837b070b4ff);
31
+ $parcel$export(module.exports, "useOverlayFocusContain", () => $745edbb83ab4296f$export$14c98a7594375490);
27
32
  const $5935ba4d7da2c103$var$AXIS = {
28
33
  top: 'top',
29
34
  bottom: 'top',
@@ -1064,11 +1069,10 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
1064
1069
  // If this node is a live announcer, add it to the set of nodes to keep visible.
1065
1070
  if ((node instanceof HTMLElement || node instanceof SVGElement) && node.dataset.liveAnnouncer === 'true') visibleNodes.add(node);
1066
1071
  // Skip this node and its children if it is one of the target nodes, or a live announcer.
1067
- // Also skip children of already hidden nodes, as aria-hidden is recursive.
1068
- if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement)) return NodeFilter.FILTER_REJECT;
1069
- // VoiceOver on iOS has issues hiding elements with role="row". Hide the cells inside instead.
1070
- // https://bugs.webkit.org/show_bug.cgi?id=222623
1071
- if (node instanceof Element && node.getAttribute('role') === 'row') return NodeFilter.FILTER_SKIP;
1072
+ // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
1073
+ // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
1074
+ // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
1075
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
1072
1076
  // Skip this node but continue to children if one of the targets is inside the node.
1073
1077
  if (targets.some((target)=>node.contains(target)
1074
1078
  )) return NodeFilter.FILTER_SKIP;
@@ -1124,4 +1128,99 @@ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body
1124
1128
 
1125
1129
 
1126
1130
 
1131
+
1132
+
1133
+
1134
+ function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
1135
+ let { triggerRef: triggerRef , popoverRef: popoverRef , isNonModal: isNonModal , ...otherProps } = props;
1136
+ let { overlayProps: overlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
1137
+ isOpen: state.isOpen,
1138
+ onClose: state.close,
1139
+ shouldCloseOnBlur: true,
1140
+ isDismissable: true
1141
+ }, popoverRef);
1142
+ let { overlayProps: positionProps , arrowProps: arrowProps } = $cd94b4896dd97759$export$d39e1813b3bdd0e1({
1143
+ ...otherProps,
1144
+ targetRef: triggerRef,
1145
+ overlayRef: popoverRef,
1146
+ isOpen: state.isOpen
1147
+ });
1148
+ $6Zb2x$react.useEffect(()=>{
1149
+ if (state.isOpen && !isNonModal) return $08ef1685902b6011$export$1c3ebcada18427bf([
1150
+ popoverRef.current
1151
+ ]);
1152
+ }, [
1153
+ isNonModal,
1154
+ state.isOpen,
1155
+ popoverRef
1156
+ ]);
1157
+ return {
1158
+ popoverProps: $6Zb2x$reactariautils.mergeProps(overlayProps, positionProps),
1159
+ arrowProps: arrowProps
1160
+ };
1161
+ }
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+ const $745edbb83ab4296f$var$OverlayContext = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createContext(null);
1174
+ function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
1175
+ let isSSR = $6Zb2x$reactariassr.useIsSSR();
1176
+ let { portalContainer: portalContainer = isSSR ? null : document.body } = props;
1177
+ let [contain, setContain] = $6Zb2x$react.useState(false);
1178
+ if (!portalContainer) return null;
1179
+ let contents = /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($745edbb83ab4296f$var$OverlayContext.Provider, {
1180
+ value: setContain
1181
+ }, /*#__PURE__*/ ($parcel$interopDefault($6Zb2x$react)).createElement($6Zb2x$reactariafocus.FocusScope, {
1182
+ restoreFocus: true,
1183
+ contain: contain
1184
+ }, props.children));
1185
+ return(/*#__PURE__*/ ($parcel$interopDefault($6Zb2x$reactdom)).createPortal(contents, portalContainer));
1186
+ }
1187
+ function $745edbb83ab4296f$export$14c98a7594375490() {
1188
+ let setContain = $6Zb2x$react.useContext($745edbb83ab4296f$var$OverlayContext);
1189
+ $6Zb2x$reactariautils.useLayoutEffect(()=>{
1190
+ setContain === null || setContain === void 0 ? void 0 : setContain(true);
1191
+ }, [
1192
+ setContain
1193
+ ]);
1194
+ }
1195
+
1196
+
1197
+
1198
+ function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
1199
+ let { overlayProps: overlayProps , underlayProps: underlayProps } = $82711f9cb668ecdb$export$ea8f71083e90600f({
1200
+ ...props,
1201
+ isOpen: state.isOpen,
1202
+ onClose: state.close
1203
+ }, ref);
1204
+ $5c2f5cd01815d369$export$ee0f7cc6afcd1c18({
1205
+ isDisabled: !state.isOpen
1206
+ });
1207
+ $745edbb83ab4296f$export$14c98a7594375490();
1208
+ $6Zb2x$react.useEffect(()=>{
1209
+ if (state.isOpen) return $08ef1685902b6011$export$1c3ebcada18427bf([
1210
+ ref.current
1211
+ ]);
1212
+ }, [
1213
+ state.isOpen,
1214
+ ref
1215
+ ]);
1216
+ return {
1217
+ modalProps: $6Zb2x$reactariautils.mergeProps(overlayProps),
1218
+ underlayProps: underlayProps
1219
+ };
1220
+ }
1221
+
1222
+
1223
+
1224
+
1225
+
1127
1226
  //# sourceMappingURL=main.js.map