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

@react-aria/selection

Package Overview
Dependencies
Maintainers
2
Versions
873
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/selection - npm Package Compare versions

Comparing version 3.0.0-nightly.1051 to 3.0.0-nightly.1057

110

dist/main.js

@@ -144,2 +144,14 @@ var {

const navigateToKey = (key, childFocus) => {
if (key != null) {
manager.setFocusedKey(key, childFocus);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(key);
} else if (selectOnFocus) {
manager.replaceSelection(key);
}
}
};
switch (e.key) {

@@ -150,22 +162,9 @@ case 'ArrowDown':

e.preventDefault();
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : delegate.getFirstKey();
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : delegate.getFirstKey == null ? void 0 : delegate.getFirstKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getFirstKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getFirstKey == null ? void 0 : delegate.getFirstKey(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -180,22 +179,9 @@

e.preventDefault();
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : delegate.getLastKey();
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : delegate.getLastKey == null ? void 0 : delegate.getLastKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getLastKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getLastKey == null ? void 0 : delegate.getLastKey(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -211,14 +197,3 @@

let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'first' : 'last');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
}

@@ -234,14 +209,3 @@

let nextKey = delegate.getKeyRightOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'last' : 'first');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
}

@@ -258,8 +222,6 @@

if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(firstKey);
}
if ($f791fefd7189e0e4d903034fb2925$var$isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(firstKey);
} else if (selectOnFocus) {
manager.replaceSelection(firstKey);
}

@@ -276,8 +238,6 @@ }

if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(lastKey);
}
if ($f791fefd7189e0e4d903034fb2925$var$isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(lastKey);
} else if (selectOnFocus) {
manager.replaceSelection(lastKey);
}

@@ -292,10 +252,3 @@ }

let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -309,10 +262,3 @@

let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -319,0 +265,0 @@

@@ -121,2 +121,14 @@ import { useLocale, useCollator } from "@react-aria/i18n";

const navigateToKey = (key, childFocus) => {
if (key != null) {
manager.setFocusedKey(key, childFocus);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(key);
} else if (selectOnFocus) {
manager.replaceSelection(key);
}
}
};
switch (e.key) {

@@ -127,22 +139,9 @@ case 'ArrowDown':

e.preventDefault();
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : delegate.getFirstKey();
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : delegate.getFirstKey == null ? void 0 : delegate.getFirstKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getFirstKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getFirstKey == null ? void 0 : delegate.getFirstKey(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -157,22 +156,9 @@

e.preventDefault();
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : delegate.getLastKey();
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : delegate.getLastKey == null ? void 0 : delegate.getLastKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getLastKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getLastKey == null ? void 0 : delegate.getLastKey(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -188,14 +174,3 @@

let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'first' : 'last');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
}

@@ -211,14 +186,3 @@

let nextKey = delegate.getKeyRightOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'last' : 'first');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
}

@@ -235,8 +199,6 @@

if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(firstKey);
}
if ($a9b9aa71af07c56ab1d89ca45381f4b$var$isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(firstKey);
} else if (selectOnFocus) {
manager.replaceSelection(firstKey);
}

@@ -253,8 +215,6 @@ }

if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(lastKey);
}
if ($a9b9aa71af07c56ab1d89ca45381f4b$var$isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(lastKey);
} else if (selectOnFocus) {
manager.replaceSelection(lastKey);
}

@@ -269,10 +229,3 @@ }

let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -286,10 +239,3 @@

let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -296,0 +242,0 @@

{
"name": "@react-aria/selection",
"version": "3.0.0-nightly.1051+f7fb3724f",
"version": "3.0.0-nightly.1057+800604a94",
"description": "Spectrum UI components in React",

@@ -21,9 +21,9 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/focus": "3.0.0-nightly.1051+f7fb3724f",
"@react-aria/i18n": "3.0.0-nightly.1051+f7fb3724f",
"@react-aria/interactions": "3.0.0-nightly.1051+f7fb3724f",
"@react-aria/utils": "3.0.0-nightly.1051+f7fb3724f",
"@react-stately/collections": "3.0.0-nightly.1051+f7fb3724f",
"@react-stately/selection": "3.0.0-nightly.1051+f7fb3724f",
"@react-types/shared": "3.0.0-nightly.1051+f7fb3724f"
"@react-aria/focus": "3.0.0-nightly.1057+800604a94",
"@react-aria/i18n": "3.0.0-nightly.1057+800604a94",
"@react-aria/interactions": "3.0.0-nightly.1057+800604a94",
"@react-aria/utils": "3.0.0-nightly.1057+800604a94",
"@react-stately/collections": "3.0.0-nightly.1057+800604a94",
"@react-stately/selection": "3.0.0-nightly.1057+800604a94",
"@react-types/shared": "3.0.0-nightly.1057+800604a94"
},

@@ -36,3 +36,3 @@ "peerDependencies": {

},
"gitHead": "f7fb3724f134d43f99753273c7fa202ad27e0c11"
"gitHead": "800604a94920fd1c6d6b329b9cd7efd0c2a31144"
}

@@ -13,3 +13,3 @@ /*

import {FocusEvent, HTMLAttributes, KeyboardEvent, RefObject, useEffect} from 'react';
import {FocusEvent, HTMLAttributes, Key, KeyboardEvent, RefObject, useEffect} from 'react';
import {focusSafely, getFocusableTreeWalker} from '@react-aria/focus';

@@ -115,2 +115,14 @@ import {FocusStrategy, KeyboardDelegate} from '@react-types/shared';

const navigateToKey = (key: Key | undefined, childFocus?: FocusStrategy) => {
if (key != null) {
manager.setFocusedKey(key, childFocus);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(key);
} else if (selectOnFocus) {
manager.replaceSelection(key);
}
}
};
switch (e.key) {

@@ -121,21 +133,8 @@ case 'ArrowDown': {

let nextKey = manager.focusedKey != null
? delegate.getKeyBelow(manager.focusedKey)
: delegate.getFirstKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getFirstKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
? delegate.getKeyBelow(manager.focusedKey)
: delegate.getFirstKey?.();
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getFirstKey?.(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -148,21 +147,8 @@ break;

let nextKey = manager.focusedKey != null
? delegate.getKeyAbove(manager.focusedKey)
: delegate.getLastKey();
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
} else if (shouldFocusWrap) {
let wrapKey = delegate.getLastKey(manager.focusedKey);
manager.setFocusedKey(wrapKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(wrapKey);
}
? delegate.getKeyAbove(manager.focusedKey)
: delegate.getLastKey?.();
if (nextKey == null && shouldFocusWrap) {
nextKey = delegate.getLastKey?.(manager.focusedKey);
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey);
}

@@ -175,11 +161,3 @@ break;

let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'first' : 'last');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'first' : 'last');
}

@@ -192,11 +170,3 @@ break;

let nextKey = delegate.getKeyRightOf(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey, direction === 'rtl' ? 'last' : 'first');
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(nextKey);
}
}
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
navigateToKey(nextKey, direction === 'rtl' ? 'last' : 'first');
}

@@ -210,7 +180,6 @@ break;

manager.setFocusedKey(firstKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(firstKey);
}
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(firstKey);
} else if (selectOnFocus) {
manager.replaceSelection(firstKey);
}

@@ -224,7 +193,6 @@ }

manager.setFocusedKey(lastKey);
if (manager.selectionMode === 'single' && selectOnFocus) {
manager.replaceSelection(lastKey);
}
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(lastKey);
} else if (selectOnFocus) {
manager.replaceSelection(lastKey);
}

@@ -237,8 +205,3 @@ }

let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -250,8 +213,3 @@ break;

let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
if (nextKey != null) {
manager.setFocusedKey(nextKey);
if (e.shiftKey && manager.selectionMode === 'multiple') {
manager.extendSelection(nextKey);
}
}
navigateToKey(nextKey);
}

@@ -258,0 +216,0 @@ break;

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