@radix-ui/react-focus-guards 0.1.0-rc.1 → 0.1.1-rc.1
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/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.module.js +2 -0
- package/dist/index.module.js.map +1 -0
- package/package.json +3 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function FocusGuards(props: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
4
|
+
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
5
|
+
*/
|
|
6
|
+
export function useFocusGuards(): void;
|
|
7
|
+
export const Root: typeof FocusGuards;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAKA,4BAAqB,KAAK,EAAE,GAAG,OAG9B;AAED;A;A;GAGG;AACH,uCAcC;AAUD,OAAA,MAAM,wBAAkB,CAAC","sources":["./packages/react/focus-guards/src/packages/react/focus-guards/src/FocusGuards.tsx","./packages/react/focus-guards/src/packages/react/focus-guards/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"IAYgCA,EAAMC,KAAND,KAAMC,mBACpCC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,GCvBT,IAAIS,EAAQ,EAEZ,SAASC,EAAYC,GAEnB,OADAC,IACOD,EAAME,SAOf,SAASD,IACPE,EAAMC,WAAU,KAAM,IAAAC,EAAAC,EACpB,MAAMC,EAAaC,SAASC,iBAAiB,4BAK7C,OAJAD,SAASE,KAAKC,sBAAsB,aAApC,QAAAN,EAAkDE,EAAW,UAA7D,IAAAF,EAAAA,EAAmEO,KACnEJ,SAASE,KAAKC,sBAAsB,YAApC,QAAAL,EAAiDC,EAAW,UAA5D,IAAAD,EAAAA,EAAkEM,KAClEd,IAEO,KACS,IAAVA,GACFU,SAASC,iBAAiB,4BAA4BhB,SAASoB,GAASA,EAAKC,WAE/EhB,OAED,IAGL,SAASc,IACP,MAAMG,EAAUP,SAASQ,cAAc,QAIvC,OAHAD,EAAQE,aAAa,yBAA0B,IAC/CF,EAAQG,SAAW,EACnBH,EAAQI,MAAMC,QAAU,mEACjBL,iDAGT,MAAMM,EAAOtB","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/focus-guards/src/FocusGuards.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\n\n/** Number of components which have requested interest to have focus guards */\nlet count = 0;\n\nfunction FocusGuards(props: any) {\n useFocusGuards();\n return props.children;\n}\n\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */\nfunction useFocusGuards() {\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? createFocusGuard());\n count++;\n\n return () => {\n if (count === 1) {\n document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n}\n\nfunction createFocusGuard() {\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';\n return element;\n}\n\nconst Root = FocusGuards;\n\nexport {\n FocusGuards,\n //\n Root,\n //\n useFocusGuards,\n};\n"],"names":["dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","count","FocusGuards","props","useFocusGuards","children","React","useEffect","_edgeGuards$","_edgeGuards$2","edgeGuards","document","querySelectorAll","body","insertAdjacentElement","createFocusGuard","node","remove","element","createElement","setAttribute","tabIndex","style","cssText","Root"],"version":3,"file":"index.js.map"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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;
|
|
2
|
+
//# sourceMappingURL=index.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"wBAGA,IAAIA,EAAQ,SAEZ,SAASC,YAAYC,GAEnB,OADAC,iBACOD,EAAME,gBAOf,SAASD,iBACPE,EAAMC,WAAU,KAAM,IAAAC,EAAAC,EACpB,MAAMC,EAAaC,SAASC,iBAAiB,4BAK7C,OAJAD,SAASE,KAAKC,sBAAsB,aAApC,QAAAN,EAAkDE,EAAW,UAA7D,IAAAF,EAAAA,EAAmEO,KACnEJ,SAASE,KAAKC,sBAAsB,YAApC,QAAAL,EAAiDC,EAAW,UAA5D,IAAAD,EAAAA,EAAkEM,KAClEd,IAEO,KACS,IAAVA,GACFU,SAASC,iBAAiB,4BAA4BI,SAASC,GAASA,EAAKC,WAE/EjB,OAED,IAGL,SAASc,IACP,MAAMI,EAAUR,SAASS,cAAc,QAIvC,OAHAD,EAAQE,aAAa,yBAA0B,IAC/CF,EAAQG,SAAW,EACnBH,EAAQI,MAAMC,QAAU,mEACjBL,SAGT,MAAMM,KAAOvB","sources":["./packages/react/focus-guards/src/FocusGuards.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** Number of components which have requested interest to have focus guards */\nlet count = 0;\n\nfunction FocusGuards(props: any) {\n useFocusGuards();\n return props.children;\n}\n\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */\nfunction useFocusGuards() {\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? createFocusGuard());\n count++;\n\n return () => {\n if (count === 1) {\n document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n}\n\nfunction createFocusGuard() {\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';\n return element;\n}\n\nconst Root = FocusGuards;\n\nexport {\n FocusGuards,\n //\n Root,\n //\n useFocusGuards,\n};\n"],"names":["count","FocusGuards","props","useFocusGuards","children","React","useEffect","_edgeGuards$","_edgeGuards$2","edgeGuards","document","querySelectorAll","body","insertAdjacentElement","createFocusGuard","forEach","node","remove","element","createElement","setAttribute","tabIndex","style","cssText","Root"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-focus-guards",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean": "rm -rf dist",
|
|
16
|
-
"prepublish": "yarn clean",
|
|
17
16
|
"version": "yarn version"
|
|
18
17
|
},
|
|
19
18
|
"peerDependencies": {
|
|
20
|
-
"react": "^16.8 || ^17.0"
|
|
19
|
+
"react": "^16.8 || ^17.0 || ^18.0"
|
|
21
20
|
},
|
|
22
21
|
"homepage": "https://radix-ui.com/primitives",
|
|
23
22
|
"repository": {
|
|
@@ -30,5 +29,5 @@
|
|
|
30
29
|
"dependencies": {
|
|
31
30
|
"@babel/runtime": "^7.13.10"
|
|
32
31
|
},
|
|
33
|
-
"stableVersion": "0.0
|
|
32
|
+
"stableVersion": "0.1.0"
|
|
34
33
|
}
|