Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-focus-guards

Package Overview
Dependencies
Maintainers
6
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-focus-guards - npm Package Compare versions

Comparing version 0.1.1-rc.2 to 0.1.1-rc.3

63

dist/index.js

@@ -1,2 +0,63 @@

var e,t,n=(e={},t=require("react"),Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e);let o=0;function r(e){return u(),e.children}function u(){n.useEffect((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:c()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:c()),o++,()=>{1===o&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),o--}}),[])}function c(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}exports.FocusGuards=r,exports.useFocusGuards=u;const d=r;exports.Root=d;
var $cnctE$react = require("react");
function $parcel$exportWildcard(dest, source) {
Object.keys(source).forEach(function(key) {
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
return;
}
Object.defineProperty(dest, key, {
enumerable: true,
get: function get() {
return source[key];
}
});
});
return dest;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $71476a6ed7dbbaf3$exports = {};
$parcel$export($71476a6ed7dbbaf3$exports, "FocusGuards", () => $71476a6ed7dbbaf3$export$ac5b58043b79449b);
$parcel$export($71476a6ed7dbbaf3$exports, "useFocusGuards", () => $71476a6ed7dbbaf3$export$b7ece24a22aeda8c);
$parcel$export($71476a6ed7dbbaf3$exports, "Root", () => $71476a6ed7dbbaf3$export$be92b6f5f03c0fe9);
/** 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;
$parcel$exportWildcard(module.exports, $71476a6ed7dbbaf3$exports);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,47 @@

import*as e from"react";let t=0;export function FocusGuards(e){return useFocusGuards(),e.children}export function useFocusGuards(){e.useEffect((()=>{var e,n;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=r[0])&&void 0!==e?e:o()),document.body.insertAdjacentElement("beforeend",null!==(n=r[1])&&void 0!==n?n:o()),t++,()=>{1===t&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),t--}}),[])}function o(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}export const Root=FocusGuards;
import {useEffect as $1wErz$useEffect} from "react";
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $3db38b7d1fb3fe6a$exports = {};
$parcel$export($3db38b7d1fb3fe6a$exports, "FocusGuards", () => $3db38b7d1fb3fe6a$export$ac5b58043b79449b);
$parcel$export($3db38b7d1fb3fe6a$exports, "useFocusGuards", () => $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c);
$parcel$export($3db38b7d1fb3fe6a$exports, "Root", () => $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9);
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
function $3db38b7d1fb3fe6a$export$ac5b58043b79449b(props) {
$3db38b7d1fb3fe6a$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 $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
$1wErz$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$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
$3db38b7d1fb3fe6a$var$count++;
return ()=>{
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
);
$3db38b7d1fb3fe6a$var$count--;
};
}, []);
}
function $3db38b7d1fb3fe6a$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 $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 = $3db38b7d1fb3fe6a$export$ac5b58043b79449b;
export {$3db38b7d1fb3fe6a$export$ac5b58043b79449b as FocusGuards, $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c as useFocusGuards, $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 as Root};
//# sourceMappingURL=index.module.js.map

2

package.json
{
"name": "@radix-ui/react-focus-guards",
"version": "0.1.1-rc.2",
"version": "0.1.1-rc.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc