v1.0 with SW PWA enabled
This commit is contained in:
39
frontend/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
generated
vendored
Normal file
39
frontend/node_modules/@radix-ui/react-focus-guards/dist/index.mjs
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
// src/focus-guards.tsx
|
||||
import * as React from "react";
|
||||
var count = 0;
|
||||
function FocusGuards(props) {
|
||||
useFocusGuards();
|
||||
return props.children;
|
||||
}
|
||||
function useFocusGuards() {
|
||||
React.useEffect(() => {
|
||||
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
||||
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
||||
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
||||
count++;
|
||||
return () => {
|
||||
if (count === 1) {
|
||||
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
||||
}
|
||||
count--;
|
||||
};
|
||||
}, []);
|
||||
}
|
||||
function createFocusGuard() {
|
||||
const element = document.createElement("span");
|
||||
element.setAttribute("data-radix-focus-guard", "");
|
||||
element.tabIndex = 0;
|
||||
element.style.outline = "none";
|
||||
element.style.opacity = "0";
|
||||
element.style.position = "fixed";
|
||||
element.style.pointerEvents = "none";
|
||||
return element;
|
||||
}
|
||||
export {
|
||||
FocusGuards,
|
||||
FocusGuards as Root,
|
||||
useFocusGuards
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
Reference in New Issue
Block a user