@radix-ui/react-focus-guards
Advanced tools
Comparing version 1.0.1 to 1.1.0-rc.1
@@ -1,2 +0,2 @@ | ||
export function FocusGuards(props: any): any; | ||
declare function FocusGuards(props: any): any; | ||
/** | ||
@@ -6,5 +6,5 @@ * Injects a pair of focus guards at the edges of the whole DOM tree | ||
*/ | ||
export function useFocusGuards(): void; | ||
export const Root: typeof FocusGuards; | ||
declare function useFocusGuards(): void; | ||
declare const Root: typeof FocusGuards; | ||
//# sourceMappingURL=index.d.ts.map | ||
export { FocusGuards, Root, useFocusGuards }; |
@@ -1,45 +0,62 @@ | ||
var $cnctE$react = require("react"); | ||
"use strict"; | ||
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}) : x)(function(x) { | ||
if (typeof require !== "undefined") return require.apply(this, arguments); | ||
throw Error('Dynamic require of "' + x + '" is not supported'); | ||
}); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
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(); | ||
// packages/react/focus-guards/src/FocusGuards.tsx | ||
var React = __toESM(__require("react")); | ||
var count = 0; | ||
function FocusGuards(props) { | ||
useFocusGuards(); | ||
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 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 $71476a6ed7dbbaf3$var$createFocusGuard() { | ||
const element = document.createElement('span'); | ||
element.setAttribute('data-radix-focus-guard', ''); | ||
} | ||
function 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'; | ||
element.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none"; | ||
return element; | ||
} | ||
const $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9 = $71476a6ed7dbbaf3$export$ac5b58043b79449b; | ||
} | ||
var Root = FocusGuards; | ||
})(); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@radix-ui/react-focus-guards", | ||
"version": "1.0.1", | ||
"version": "1.1.0-rc.1", | ||
"license": "MIT", | ||
@@ -47,5 +47,3 @@ "exports": { | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.13.10" | ||
} | ||
"stableVersion": "1.0.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2
104
9636
8
1
3
- Removed@babel/runtime@^7.13.10
- Removed@babel/runtime@7.25.6(transitive)
- Removedregenerator-runtime@0.14.1(transitive)