New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-roving-tabindex

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-roving-tabindex - npm Package Compare versions

Comparing version

to
3.1.1

38

dist/index.es.js

@@ -148,4 +148,4 @@ import React, { createContext, useReducer, useEffect, useMemo, useRef, useContext, useCallback } from 'react';

var isGrid = currentTabStop.rowIndex !== null;
var isFirst = index === 0;
var isLast = index === state.tabStops.length - 1;
var isFirst = index === findIndexOfVeryFirstActiveTabStop(state.tabStops);
var isLast = index === findIndexOfVeryLastActiveTabStop(state.tabStops);
var navigation = getNavigationValue(key, ctrlKey, isGrid, state.direction, state.loopAround, isFirst, isLast);

@@ -184,7 +184,5 @@ if (!navigation) {

{
for (var i = 0; i < state.tabStops.length; ++i) {
var tabStop = state.tabStops[i];
if (!tabStop.disabled) {
return selectTabStop(state, tabStop);
}
var index_1 = findIndexOfVeryFirstActiveTabStop(state.tabStops);
if (index_1 > -1) {
return selectTabStop(state, state.tabStops[index_1]);
}

@@ -195,7 +193,5 @@ }

{
for (var i = state.tabStops.length - 1; i >= 0; --i) {
var tabStop = state.tabStops[i];
if (!tabStop.disabled) {
return selectTabStop(state, tabStop);
}
var index_2 = findIndexOfVeryLastActiveTabStop(state.tabStops);
if (index_2 > -1) {
return selectTabStop(state, state.tabStops[index_2]);
}

@@ -312,2 +308,3 @@ }

return __assign(__assign({}, state), action.payload);
/* istanbul ignore next */
default:

@@ -317,2 +314,14 @@ return state;

}
function findIndexOfVeryFirstActiveTabStop(tabStops) {
return tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
}
function findIndexOfVeryLastActiveTabStop(tabStops) {
for (var i = tabStops.length - 1; i >= 0; --i) {
var tabStop = tabStops[i];
if (!tabStop.disabled) {
return i;
}
}
return -1;
}
// Determine the updated value for selectedId:

@@ -324,4 +333,4 @@ function getUpdatedSelectedId(tabStops, currentSelectedId) {

// its id, otherwise return null.
var index_1 = tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
return index_1 === -1 ? null : tabStops[index_1].id;
var index_3 = tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
return index_3 === -1 ? null : tabStops[index_3].id;
}

@@ -379,2 +388,3 @@ var index = tabStops.findIndex(function (tabStop) { return tabStop.id === currentSelectedId; });

return !isGrid || ctrlKey ? Navigation.VERY_LAST : Navigation.LAST_IN_ROW;
/* istanbul ignore next */
default:

@@ -381,0 +391,0 @@ return null;

@@ -157,4 +157,4 @@ 'use strict';

var isGrid = currentTabStop.rowIndex !== null;
var isFirst = index === 0;
var isLast = index === state.tabStops.length - 1;
var isFirst = index === findIndexOfVeryFirstActiveTabStop(state.tabStops);
var isLast = index === findIndexOfVeryLastActiveTabStop(state.tabStops);
var navigation = getNavigationValue(key, ctrlKey, isGrid, state.direction, state.loopAround, isFirst, isLast);

@@ -193,7 +193,5 @@ if (!navigation) {

{
for (var i = 0; i < state.tabStops.length; ++i) {
var tabStop = state.tabStops[i];
if (!tabStop.disabled) {
return selectTabStop(state, tabStop);
}
var index_1 = findIndexOfVeryFirstActiveTabStop(state.tabStops);
if (index_1 > -1) {
return selectTabStop(state, state.tabStops[index_1]);
}

@@ -204,7 +202,5 @@ }

{
for (var i = state.tabStops.length - 1; i >= 0; --i) {
var tabStop = state.tabStops[i];
if (!tabStop.disabled) {
return selectTabStop(state, tabStop);
}
var index_2 = findIndexOfVeryLastActiveTabStop(state.tabStops);
if (index_2 > -1) {
return selectTabStop(state, state.tabStops[index_2]);
}

@@ -321,2 +317,3 @@ }

return __assign(__assign({}, state), action.payload);
/* istanbul ignore next */
default:

@@ -326,2 +323,14 @@ return state;

}
function findIndexOfVeryFirstActiveTabStop(tabStops) {
return tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
}
function findIndexOfVeryLastActiveTabStop(tabStops) {
for (var i = tabStops.length - 1; i >= 0; --i) {
var tabStop = tabStops[i];
if (!tabStop.disabled) {
return i;
}
}
return -1;
}
// Determine the updated value for selectedId:

@@ -333,4 +342,4 @@ function getUpdatedSelectedId(tabStops, currentSelectedId) {

// its id, otherwise return null.
var index_1 = tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
return index_1 === -1 ? null : tabStops[index_1].id;
var index_3 = tabStops.findIndex(function (tabStop) { return !tabStop.disabled; });
return index_3 === -1 ? null : tabStops[index_3].id;
}

@@ -388,2 +397,3 @@ var index = tabStops.findIndex(function (tabStop) { return tabStop.id === currentSelectedId; });

return !isGrid || ctrlKey ? exports.Navigation.VERY_LAST : exports.Navigation.LAST_IN_ROW;
/* istanbul ignore next */
default:

@@ -390,0 +400,0 @@ return null;

{
"name": "react-roving-tabindex",
"version": "3.1.0",
"version": "3.1.1",
"description": "React implementation of a roving tabindex, now with grid support",

@@ -57,55 +57,55 @@ "author": "stevejay",

"devDependencies": {
"@babel/core": "^7.14.2",
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-url": "^6.0.0",
"@storybook/addon-essentials": "^6.2.9",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^6.1.0",
"@storybook/addon-essentials": "^6.3.7",
"@storybook/preset-typescript": "^3.0.0",
"@storybook/react": "^6.2.9",
"@storybook/storybook-deployer": "^2.8.8",
"@storybook/react": "^6.3.7",
"@storybook/storybook-deployer": "^2.8.10",
"@svgr/rollup": "^5.4.0",
"@testing-library/react": "^11.2.7",
"@testing-library/react-hooks": "^5.1.2",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^7.0.1",
"@types/array-find-index": "^1.0.0",
"@types/jest": "^26.0.23",
"@types/jsdom": "^16.2.10",
"@types/jest": "^27.0.0",
"@types/jsdom": "^16.2.13",
"@types/lodash.uniqueid": "^4.0.6",
"@types/react-dom": "^17.0.5",
"@types/react-dom": "^17.0.9",
"@types/storybook__react": "^5.2.1",
"@types/styled-components": "^5.1.9",
"@types/styled-components": "^5.1.12",
"@types/warning": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"babel-jest": "^26.6.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"babel-jest": "^27.0.6",
"babel-loader": "^8.1.0",
"coveralls": "^3.1.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.2",
"eslint": "^7.26.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"fork-ts-checker-webpack-plugin": "^6.2.9",
"gh-pages": "^3.1.0",
"husky": "6.0.0",
"jest": "^26.6.1",
"jsdom": "^16.5.3",
"eslint-plugin-react": "^7.24.0",
"fork-ts-checker-webpack-plugin": "^6.3.2",
"gh-pages": "^3.2.3",
"husky": "7.0.1",
"jest": "^27.0.6",
"jsdom": "^16.7.0",
"jspolyfill-array.prototype.findIndex": "^0.1.0",
"lint-staged": "^11.0.0",
"lint-staged": "^11.1.2",
"lodash": "^4.17.21",
"pinst": "^2.1.6",
"prettier": "^2.3.0",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
"rollup": "^2.48.0",
"rollup": "^2.56.2",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-typescript2": "^0.30.0",
"styled-components": "^5.3.0",
"ts-loader": "^9.1.2",
"typescript": "^4.2.4"
"ts-loader": "^9.2.5",
"typescript": "^4.3.5"
},

@@ -112,0 +112,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet