var $cnctE$react = require("react"); function $parcel$export(e, n, v, s) { Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); } $parcel$export(module.exports, "FocusGuards", () => $71476a6ed7dbbaf3$export$ac5b58043b79449b); $parcel$export(module.exports, "Root", () => $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9); $parcel$export(module.exports, "useFocusGuards", () => $71476a6ed7dbbaf3$export$b7ece24a22aeda8c); /** Number of components which have requested interest to have focus guards */ let $71476a6ed7dbbaf3$var$count = 0; function $71476a6ed7dbbaf3$export$ac5b58043b79449b(props) { $71476a6ed7dbbaf3$export$b7ece24a22aeda8c(); return props.children; } /** * Injects a pair of focus guards at the edges of the whole DOM tree * to ensure `focusin` & `focusout` events can be caught consistently. */ function $71476a6ed7dbbaf3$export$b7ece24a22aeda8c() { $cnctE$react.useEffect(()=>{ var _edgeGuards$, _edgeGuards$2; const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]'); document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $71476a6ed7dbbaf3$var$createFocusGuard()); document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $71476a6ed7dbbaf3$var$createFocusGuard()); $71476a6ed7dbbaf3$var$count++; return ()=>{ if ($71476a6ed7dbbaf3$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove() ); $71476a6ed7dbbaf3$var$count--; }; }, []); } function $71476a6ed7dbbaf3$var$createFocusGuard() { const element = document.createElement('span'); element.setAttribute('data-radix-focus-guard', ''); element.tabIndex = 0; element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none'; return element; } const $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9 = $71476a6ed7dbbaf3$export$ac5b58043b79449b; //# sourceMappingURL=index.js.map