@contentful/f36-utils
Advanced tools
Comparing version 4.0.1-next-v4-8377.2344 to 4.0.1-next-v4-8455.2348
@@ -1,2 +0,2 @@ | ||
var e=require("react"),r=l(e),{useEffect:t,useRef:n}=e,{createPortal:u}=require("react-dom"),c=l(require("@babel/runtime/helpers/extends")),{cx:a,css:o}=require("emotion");function i(e,r,t,n){Object.defineProperty(e,r,{get:t,set:n,enumerable:!0,configurable:!0})}function l(e){return e&&e.__esModule?e.default:e}var s,d,f={};function m({children:e,container:r}){const c=n(r),a=n(document.createElement("div"));return t((()=>{c.current||(c.current=document.body);const e=a.current;return e.setAttribute("data-cf-ui-portal",""),c.current.appendChild(e),()=>{c.current&&c.current.removeChild(e)}}),[]),a.current?u(e,a.current):null}function b({className:e,children:t,...n}){return r.createElement("span",c({tabIndex:-1,className:a(o({name:"t8ljbi",styles:"display:inherit;outline:0;"}),e)},n),t)}i(f,"Portal",(()=>m)),i(f,"TabFocusTrap",(()=>b)),s=module.exports,d=f,Object.keys(d).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(s,e,{enumerable:!0,get:function(){return d[e]}})})); | ||
var e=require("react"),r=d(e),{useEffect:t,useRef:n,useState:u,useCallback:c}=e,{createPortal:o}=require("react-dom"),a=d(require("@babel/runtime/helpers/extends")),{css:l,cx:i}=require("emotion");function s(e,r,t,n){Object.defineProperty(e,r,{get:t,set:n,enumerable:!0,configurable:!0})}function d(e){return e&&e.__esModule?e.default:e}var f={};function m({children:e,container:r}){const u=n(r),c=n(document.createElement("div"));return t((()=>{u.current||(u.current=document.body);const e=c.current;return e.setAttribute("data-cf-ui-portal",""),u.current.appendChild(e),()=>{u.current&&u.current.removeChild(e)}}),[]),c.current?o(e,c.current):null}function p({className:e,children:t,...n}){return r.createElement("span",a({tabIndex:-1,className:i(l({name:"t8ljbi",styles:"display:inherit;outline:0;"}),e)},n),t)}s(f,"Portal",(()=>m)),s(f,"TabFocusTrap",(()=>p)),s(f,"useArrowKeyNavigation",(()=>h));const b={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},h=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical"})=>{const[n,o]=u(0),a=c((u=>{const c=e.current;if(!c)return;const a=c.querySelectorAll(r);if(0===a.length)return;const l=a.length-1,i={[b[t].next]:()=>{o(n===l?0:n+1)},[b[t].prev]:()=>{o(0===n?l:n-1)}}[u.key];i&&(u.preventDefault(),i())}),[n,r,e,t]);return{focusedIndex:n,handleArrowsKeyDown:a}};var v,y;v=module.exports,y=f,Object.keys(y).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(v,e,{enumerable:!0,get:function(){return y[e]}})})); | ||
//# sourceMappingURL=main.js.map |
@@ -1,2 +0,2 @@ | ||
import e,{useEffect as r,useRef as t}from"react";import{createPortal as n}from"react-dom";import a from"@babel/runtime/helpers/esm/extends";import{cx as c,css as o}from"emotion";function s(e,r,t,n){Object.defineProperty(e,r,{get:t,set:n,enumerable:!0,configurable:!0})}var u={};function i({children:e,container:a}){const c=t(a),o=t(document.createElement("div"));return r((()=>{c.current||(c.current=document.body);const e=o.current;return e.setAttribute("data-cf-ui-portal",""),c.current.appendChild(e),()=>{c.current&&c.current.removeChild(e)}}),[]),o.current?n(e,o.current):null}function l({className:r,children:t,...n}){return e.createElement("span",a({tabIndex:-1,className:c(o({name:"t8ljbi",styles:"display:inherit;outline:0;"}),r)},n),t)}s(u,"Portal",(()=>i)),s(u,"TabFocusTrap",(()=>l));export{i as Portal,l as TabFocusTrap}; | ||
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{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]=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 |
@@ -12,3 +12,12 @@ import React from "react"; | ||
export function TabFocusTrap({ className, children, ...otherProps }: TabFocusTrapProps): React.ReactElement; | ||
interface UseArrowKeyNavigationProps { | ||
itemsContainerRef: React.MutableRefObject<HTMLElement>; | ||
itemsSelector: string; | ||
keyType?: 'vertical' | 'horizontal'; | ||
} | ||
export const useArrowKeyNavigation: ({ itemsContainerRef, itemsSelector, keyType, }: UseArrowKeyNavigationProps) => { | ||
focusedIndex: number; | ||
handleArrowsKeyDown: (event: React.KeyboardEvent) => void; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@contentful/f36-utils", | ||
"version": "4.0.1-next-v4-8377.2344+34888bc6", | ||
"version": "4.0.1-next-v4-8455.2348+839d9049", | ||
"description": "Forma 36: utils React Component", | ||
@@ -34,3 +34,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "34888bc67ea8ca6538e86cf9066b3fc28cf70d9f" | ||
"gitHead": "839d9049e81b4e3816af95725a488d8848464300" | ||
} |
@@ -5,1 +5,2 @@ export { Portal } from './Portal/Portal'; | ||
export type { TabFocusTrapProps } from './TabFocusTrap/TabFocusTrap'; | ||
export { useArrowKeyNavigation } from './ArrowKeyNavigation/useArrowKeyNavigation'; |
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
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
28452
15
201