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

@contentful/f36-utils

Package Overview
Dependencies
Maintainers
105
Versions
282
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/f36-utils - npm Package Compare versions

Comparing version 4.0.1-next-v4-9200.2414 to 4.0.1-next-v4-9225.2415

2

dist/main.js

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

var e=require("react"),r=d(e),{useRef:t,useEffect:n,useCallback:o,useState:c}=e,{createPortal:u}=require("react-dom"),a=d(require("@babel/runtime/helpers/extends")),{css:l,cx:s}=require("emotion");function i(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 p({children:e,container:r}){const o=t(r),c=t(document.createElement("div"));return n((()=>{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?u(e,c.current):null}function y({className:e,children:t,...n}){return r.createElement("span",a({tabIndex:-1,className:s(l({name:"t8ljbi",styles:"display:inherit;outline:0;"}),e)},n),t)}i(f,"Portal",(()=>p)),i(f,"TabFocusTrap",(()=>y)),i(f,"useArrowKeyNavigation",(()=>b)),i(f,"useKeyboard",(()=>v));const m={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},b=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical"})=>{const[n,u]=c(0),a=o((o=>{const c=e.current;if(!c)return;const a=c.querySelectorAll(r);if(0===a.length)return;const l=a.length-1,s={[m[t].next]:()=>{u(n===l?0:n+1)},[m[t].prev]:()=>{u(0===n?l:n-1)}}[o.key];s&&(o.preventDefault(),s())}),[n,r,e,t]);return{focusedIndex:n,handleArrowsKeyDown:a}},v=e=>{const{ref:r,keys:t,event:c="keydown"}=e;let u=document;const a=o((e=>{Object.prototype.hasOwnProperty.call(t,e.key)&&t[e.key](e)}),[t]);n((()=>(r&&r.current&&(u=r.current),u.addEventListener(c,a),()=>{u.removeEventListener(c,a)})),[c,a])};var h,w;h=module.exports,w=f,Object.keys(w).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(h,e,{enumerable:!0,get:function(){return w[e]}})}));
var e=require("react"),r=d(e),{useRef:t,useEffect:n,useState:o,useCallback:c}=e,{createPortal:u}=require("react-dom"),a=d(require("@babel/runtime/helpers/extends")),{css:i,cx:l}=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 p({children:e,container:r}){const o=t(r),c=t(document.createElement("div"));return n((()=>{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?u(e,c.current):null}function y({className:e,children:t,...n}){return r.createElement("span",a({tabIndex:-1,className:l(i({name:"t8ljbi",styles:"display:inherit;outline:0;"}),e)},n),t)}s(f,"Portal",(()=>p)),s(f,"TabFocusTrap",(()=>y)),s(f,"useArrowKeyNavigation",(()=>b)),s(f,"useKeyboard",(()=>v));const m={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},b=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical",initialFocusedIndex:n=0})=>{const[u,a]=o(n),i=c((n=>{const o=e.current;if(!o)return;const c=o.querySelectorAll(r);if(0===c.length)return;const i=c.length-1,l={[m[t].next]:()=>{a(u===i?0:u+1)},[m[t].prev]:()=>{a(0===u?i:u-1)}}[n.key];l&&(n.preventDefault(),l())}),[u,r,e,t]);return{focusedIndex:u,handleArrowsKeyDown:i}},v=e=>{const{ref:r,keys:t,event:o="keydown"}=e;let u=document;const a=c((e=>{Object.prototype.hasOwnProperty.call(t,e.key)&&t[e.key](e)}),[t]);n((()=>(r&&r.current&&(u=r.current),u.addEventListener(o,a),()=>{u.removeEventListener(o,a)})),[o,a])};var h,w;h=module.exports,w=f,Object.keys(w).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(h,e,{enumerable:!0,get:function(){return w[e]}})}));
//# sourceMappingURL=main.js.map

@@ -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 s from"@babel/runtime/helpers/esm/extends";import{cx as c,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),s=r(document.createElement("div"));return t((()=>{o.current||(o.current=document.body);const e=s.current;return e.setAttribute("data-cf-ui-portal",""),o.current.appendChild(e),()=>{o.current&&o.current.removeChild(e)}}),[]),s.current?a(e,s.current):null}function d({className:r,children:t,...n}){return e.createElement("span",s({tabIndex:-1,className:c(u({name:"t8ljbi",styles:"display:inherit;outline:0;"}),r)},n),t)}i(l,"Portal",(()=>m)),i(l,"TabFocusTrap",(()=>d)),i(l,"useArrowKeyNavigation",(()=>f)),i(l,"useKeyboard",(()=>y));const p={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},f=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical"})=>{const[a,s]=n(0),c=o((n=>{const o=e.current;if(!o)return;const c=o.querySelectorAll(r);if(0===c.length)return;const u=c.length-1,i={[p[t].next]:()=>{s(a===u?0:a+1)},[p[t].prev]:()=>{s(0===a?u:a-1)}}[n.key];i&&(n.preventDefault(),i())}),[a,r,e,t]);return{focusedIndex:a,handleArrowsKeyDown:c}},y=e=>{const{ref:r,keys:n,event:a="keydown"}=e;let s=document;const c=o((e=>{Object.prototype.hasOwnProperty.call(n,e.key)&&n[e.key](e)}),[n]);t((()=>(r&&r.current&&(s=r.current),s.addEventListener(a,c),()=>{s.removeEventListener(a,c)})),[a,c])};export{m as Portal,d as TabFocusTrap,f as useArrowKeyNavigation,y as useKeyboard};
import e,{useEffect as r,useRef as t,useState as n,useCallback as o}from"react";import{createPortal as a}from"react-dom";import s from"@babel/runtime/helpers/esm/extends";import{css as c,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 d({children:e,container:n}){const o=t(n),s=t(document.createElement("div"));return r((()=>{o.current||(o.current=document.body);const e=s.current;return e.setAttribute("data-cf-ui-portal",""),o.current.appendChild(e),()=>{o.current&&o.current.removeChild(e)}}),[]),s.current?a(e,s.current):null}function m({className:r,children:t,...n}){return e.createElement("span",s({tabIndex:-1,className:u(c({name:"t8ljbi",styles:"display:inherit;outline:0;"}),r)},n),t)}i(l,"Portal",(()=>d)),i(l,"TabFocusTrap",(()=>m)),i(l,"useArrowKeyNavigation",(()=>f)),i(l,"useKeyboard",(()=>y));const p={vertical:{prev:"ArrowUp",next:"ArrowDown"},horizontal:{prev:"ArrowLeft",next:"ArrowRight"}},f=({itemsContainerRef:e,itemsSelector:r,keyType:t="vertical",initialFocusedIndex:a=0})=>{const[s,c]=n(a),u=o((n=>{const o=e.current;if(!o)return;const a=o.querySelectorAll(r);if(0===a.length)return;const u=a.length-1,i={[p[t].next]:()=>{c(s===u?0:s+1)},[p[t].prev]:()=>{c(0===s?u:s-1)}}[n.key];i&&(n.preventDefault(),i())}),[s,r,e,t]);return{focusedIndex:s,handleArrowsKeyDown:u}},y=e=>{const{ref:t,keys:n,event:a="keydown"}=e;let s=document;const c=o((e=>{Object.prototype.hasOwnProperty.call(n,e.key)&&n[e.key](e)}),[n]);r((()=>(t&&t.current&&(s=t.current),s.addEventListener(a,c),()=>{s.removeEventListener(a,c)})),[a,c])};export{d as Portal,m as TabFocusTrap,f as useArrowKeyNavigation,y as useKeyboard};
//# sourceMappingURL=module.js.map

@@ -16,4 +16,5 @@ import React, { MutableRefObject } from "react";

keyType?: 'vertical' | 'horizontal';
initialFocusedIndex?: number;
}
export const useArrowKeyNavigation: ({ itemsContainerRef, itemsSelector, keyType, }: UseArrowKeyNavigationProps) => {
export const useArrowKeyNavigation: ({ itemsContainerRef, itemsSelector, keyType, initialFocusedIndex, }: UseArrowKeyNavigationProps) => {
focusedIndex: number;

@@ -20,0 +21,0 @@ handleArrowsKeyDown: (event: React.KeyboardEvent) => void;

{
"name": "@contentful/f36-utils",
"version": "4.0.1-next-v4-9200.2414+81e68a76",
"version": "4.0.1-next-v4-9225.2415+af2aee94",
"description": "Forma 36: utils React Component",

@@ -34,3 +34,3 @@ "license": "MIT",

},
"gitHead": "81e68a76b954a42bdfc5dd32ac252fa4e941df0d"
"gitHead": "af2aee943c25112c4a2439c2da792f37ecff291b"
}

@@ -7,2 +7,3 @@ import { useState, useCallback } from 'react';

keyType?: 'vertical' | 'horizontal';
initialFocusedIndex?: number;
}

@@ -25,4 +26,5 @@

keyType = 'vertical',
initialFocusedIndex = 0,
}: UseArrowKeyNavigationProps) => {
const [focusedIndex, setFocusedIndex] = useState(0);
const [focusedIndex, setFocusedIndex] = useState<number>(initialFocusedIndex);

@@ -29,0 +31,0 @@ const handleArrowsKeyDown = useCallback(

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