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
792
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-4980928d3-240906 to 3.0.0-nightly-6193c40ee-240920

46

dist/ListKeyboardDelegate.main.js

@@ -27,19 +27,17 @@ var $2ac4508142683dcb$exports = require("./DOMLayoutDelegate.main.js");

}
getNextKey(key) {
key = this.collection.getKeyAfter(key);
findNextNonDisabled(key, getNext) {
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyAfter(key);
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key;
key = getNext(key);
}
return null;
}
getNextKey(key) {
key = this.collection.getKeyAfter(key);
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key));
}
getPreviousKey(key) {
key = this.collection.getKeyBefore(key);
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key));
}

@@ -75,2 +73,9 @@ findKey(key, nextKey, shouldSkip) {

getKeyRightOf(key) {
// This is a temporary solution for CardView until we refactor useSelectableCollection.
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -83,2 +88,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'rtl');

getKeyLeftOf(key) {
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -92,17 +102,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'ltr');

let key = this.collection.getFirstKey();
while(key != null){
let item = this.collection.getItem(key);
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyAfter(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key));
}
getLastKey() {
let key = this.collection.getLastKey();
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key));
}

@@ -157,3 +157,3 @@ getKeyPageAbove(key) {

if (item.textValue && this.collator.compare(substring, search) === 0) return key;
key = this.getKeyBelow(key);
key = this.getNextKey(key);
}

@@ -160,0 +160,0 @@ return null;

@@ -21,19 +21,17 @@ import {DOMLayoutDelegate as $657e4dc4a6e88df0$export$8f5ed9ff9f511381} from "./DOMLayoutDelegate.module.js";

}
getNextKey(key) {
key = this.collection.getKeyAfter(key);
findNextNonDisabled(key, getNext) {
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyAfter(key);
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key;
key = getNext(key);
}
return null;
}
getNextKey(key) {
key = this.collection.getKeyAfter(key);
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key));
}
getPreviousKey(key) {
key = this.collection.getKeyBefore(key);
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key));
}

@@ -69,2 +67,9 @@ findKey(key, nextKey, shouldSkip) {

getKeyRightOf(key) {
// This is a temporary solution for CardView until we refactor useSelectableCollection.
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -77,2 +82,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'rtl');

getKeyLeftOf(key) {
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -86,17 +96,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'ltr');

let key = this.collection.getFirstKey();
while(key != null){
let item = this.collection.getItem(key);
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyAfter(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key));
}
getLastKey() {
let key = this.collection.getLastKey();
while(key != null){
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) return key;
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key));
}

@@ -151,3 +151,3 @@ getKeyPageAbove(key) {

if (item.textValue && this.collator.compare(substring, search) === 0) return key;
key = this.getKeyBelow(key);
key = this.getNextKey(key);
}

@@ -154,0 +154,0 @@ return null;

{
"name": "@react-aria/selection",
"version": "3.0.0-nightly-4980928d3-240906",
"version": "3.0.0-nightly-6193c40ee-240920",
"description": "Spectrum UI components in React",

@@ -25,8 +25,8 @@ "license": "Apache-2.0",

"dependencies": {
"@react-aria/focus": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/i18n": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/interactions": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/utils": "^3.0.0-nightly-4980928d3-240906",
"@react-stately/selection": "^3.0.0-nightly-4980928d3-240906",
"@react-types/shared": "^3.0.0-nightly-4980928d3-240906",
"@react-aria/focus": "^3.0.0-nightly-6193c40ee-240920",
"@react-aria/i18n": "^3.0.0-nightly-6193c40ee-240920",
"@react-aria/interactions": "^3.0.0-nightly-6193c40ee-240920",
"@react-aria/utils": "^3.0.0-nightly-6193c40ee-240920",
"@react-stately/selection": "^3.0.0-nightly-6193c40ee-240920",
"@react-types/shared": "^3.0.0-nightly-6193c40ee-240920",
"@swc/helpers": "^0.5.0"

@@ -33,0 +33,0 @@ },

@@ -77,11 +77,10 @@ /*

getNextKey(key: Key) {
key = this.collection.getKeyAfter(key);
private findNextNonDisabled(key: Key, getNext: (key: Key) => Key | null): Key | null {
while (key != null) {
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) {
if (item?.type === 'item' && !this.isDisabled(item)) {
return key;
}
key = this.collection.getKeyAfter(key);
key = getNext(key);
}

@@ -92,14 +91,10 @@

getNextKey(key: Key) {
key = this.collection.getKeyAfter(key);
return this.findNextNonDisabled(key, key => this.collection.getKeyAfter(key));
}
getPreviousKey(key: Key) {
key = this.collection.getKeyBefore(key);
while (key != null) {
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) {
return key;
}
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, key => this.collection.getKeyBefore(key));
}

@@ -156,2 +151,10 @@

getKeyRightOf(key: Key) {
// This is a temporary solution for CardView until we refactor useSelectableCollection.
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, key => this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -171,2 +174,8 @@ if (this.orientation === 'vertical') {

getKeyLeftOf(key: Key) {
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf';
if (this.layoutDelegate[layoutDelegateMethod]) {
key = this.layoutDelegate[layoutDelegateMethod](key);
return this.findNextNonDisabled(key, key => this.layoutDelegate[layoutDelegateMethod](key));
}
if (this.layout === 'grid') {

@@ -187,12 +196,3 @@ if (this.orientation === 'vertical') {

let key = this.collection.getFirstKey();
while (key != null) {
let item = this.collection.getItem(key);
if (item?.type === 'item' && !this.isDisabled(item)) {
return key;
}
key = this.collection.getKeyAfter(key);
}
return null;
return this.findNextNonDisabled(key, key => this.collection.getKeyAfter(key));
}

@@ -202,12 +202,3 @@

let key = this.collection.getLastKey();
while (key != null) {
let item = this.collection.getItem(key);
if (item.type === 'item' && !this.isDisabled(item)) {
return key;
}
key = this.collection.getKeyBefore(key);
}
return null;
return this.findNextNonDisabled(key, key => this.collection.getKeyBefore(key));
}

@@ -289,3 +280,3 @@

key = this.getKeyBelow(key);
key = this.getNextKey(key);
}

@@ -292,0 +283,0 @@

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

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