@contentful/f36-utils
Advanced tools
Comparing version 4.0.1-next-v4-8904.2363 to 4.0.1-next-v4-8942.2365
@@ -1,2 +0,2 @@ | ||
import e,{useRef as r,useEffect as t,useState as n,useCallback as o}from"react";import{createPortal as a}from"react-dom";import c from"@babel/runtime/helpers/esm/extends";import{cx as s,css as u}from"emotion";function i(e,r,t,n){Object.defineProperty(e,r,{get:t,set:n,enumerable:!0,configurable:!0})}var l={};function m({children:e,container:n}){const o=r(n),c=r(document.createElement("div"));return t((()=>{o.current||(o.current=document.body);const e=c.current;return e.setAttribute("data-cf-ui-portal",""),o.current.appendChild(e),()=>{o.current&&o.current.removeChild(e)}}),[]),c.current?a(e,c.current):null}function p({className:r,children:t,...n}){return e.createElement("span",c({tabIndex:-1,className:s(u({name:"t8ljbi",styles:"display:inherit;outline:0;"}),r)},n),t)}i(l,"Portal",(()=>m)),i(l,"TabFocusTrap",(()=>p)),i(l,"useArrowKeyNavigation",(()=>d));const f={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},d=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical"})=>{const[a,c]=n(0),s=o((n=>{const o=e.current;if(!o)return;const s=o.querySelectorAll(r);if(0===s.length)return;const u=s.length-1,i={[f[t].next]:()=>{c(a===u?0:a+1)},[f[t].prev]:()=>{c(0===a?u:a-1)}}[n.key];i&&(n.preventDefault(),i())}),[a,r,e,t]);return{focusedIndex:a,handleArrowsKeyDown:s}};export{m as Portal,p as TabFocusTrap,d as useArrowKeyNavigation}; | ||
import e,{useRef as r,useEffect as t,useCallback as n,useState as o}from"react";import{createPortal as a}from"react-dom";import c from"@babel/runtime/helpers/esm/extends";import{css as s,cx as u}from"emotion";function i(e,r,t,n){Object.defineProperty(e,r,{get:t,set:n,enumerable:!0,configurable:!0})}var l={};function m({children:e,container:n}){const o=r(n),c=r(document.createElement("div"));return t((()=>{o.current||(o.current=document.body);const e=c.current;return e.setAttribute("data-cf-ui-portal",""),o.current.appendChild(e),()=>{o.current&&o.current.removeChild(e)}}),[]),c.current?a(e,c.current):null}function p({className:r,children:t,...n}){return e.createElement("span",c({tabIndex:-1,className:u(s({name:"t8ljbi",styles:"display:inherit;outline:0;"}),r)},n),t)}i(l,"Portal",(()=>m)),i(l,"TabFocusTrap",(()=>p)),i(l,"useArrowKeyNavigation",(()=>d));const f={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},d=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical"})=>{const[a,c]=o(0),s=n((n=>{const o=e.current;if(!o)return;const s=o.querySelectorAll(r);if(0===s.length)return;const u=s.length-1,i={[f[t].next]:()=>{c(a===u?0:a+1)},[f[t].prev]:()=>{c(0===a?u:a-1)}}[n.key];i&&(n.preventDefault(),i())}),[a,r,e,t]);return{focusedIndex:a,handleArrowsKeyDown:s}};export{m as Portal,p as TabFocusTrap,d as useArrowKeyNavigation}; | ||
//# sourceMappingURL=module.js.map |
{ | ||
"name": "@contentful/f36-utils", | ||
"version": "4.0.1-next-v4-8904.2363+6c461df0", | ||
"version": "4.0.1-next-v4-8942.2365+161f2c3b", | ||
"description": "Forma 36: utils React Component", | ||
@@ -34,3 +34,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "6c461df0e9a2d6ef0053b1d4b489e5ab3947bc92" | ||
"gitHead": "161f2c3b2d3539a6a3309d2116a1e43e44469cb1" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package