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

@react-aria/dnd

Package Overview
Dependencies
Maintainers
2
Versions
729
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/dnd - npm Package Compare versions

Comparing version 3.0.0-nightly.2661 to 3.0.0-nightly.2665

24

package.json
{
"name": "@react-aria/dnd",
"version": "3.0.0-nightly.2661+e066b675",
"version": "3.0.0-nightly.2665+887fff79",
"description": "Spectrum UI components in React",

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

"@babel/runtime": "^7.6.2",
"@react-aria/i18n": "3.0.0-nightly.981+e066b675",
"@react-aria/interactions": "3.0.0-nightly.981+e066b675",
"@react-aria/live-announcer": "3.0.0-nightly.981+e066b675",
"@react-aria/overlays": "3.0.0-nightly.981+e066b675",
"@react-aria/utils": "3.0.0-nightly.981+e066b675",
"@react-aria/visually-hidden": "3.0.0-nightly.981+e066b675",
"@react-stately/dnd": "3.0.0-nightly.2661+e066b675",
"@react-stately/selection": "3.0.0-nightly.981+e066b675",
"@react-types/button": "3.3.2-nightly.2661+e066b675",
"@react-types/shared": "3.0.0-nightly.981+e066b675"
"@react-aria/i18n": "3.0.0-nightly.985+887fff79",
"@react-aria/interactions": "3.0.0-nightly.985+887fff79",
"@react-aria/live-announcer": "3.0.0-nightly.985+887fff79",
"@react-aria/overlays": "3.0.0-nightly.985+887fff79",
"@react-aria/utils": "3.0.0-nightly.985+887fff79",
"@react-aria/visually-hidden": "3.0.0-nightly.985+887fff79",
"@react-stately/dnd": "3.0.0-nightly.2665+887fff79",
"@react-stately/selection": "3.0.0-nightly.985+887fff79",
"@react-types/button": "3.3.2-nightly.2665+887fff79",
"@react-types/shared": "3.0.0-nightly.985+887fff79"
},

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

},
"gitHead": "e066b675c123776d4cac96595143b6d3a96f8fc6"
"gitHead": "887fff79e8f33c0f8953dc38955419feddd56b6a"
}

@@ -122,3 +122,5 @@ /*

'touchend',
'keyup'
'keyup',
'focusin',
'focusout'
];

@@ -125,0 +127,0 @@

@@ -123,2 +123,3 @@ /*

: keyboardDelegate.getFirstKey();
let dropPosition: DropPosition = 'before';

@@ -135,2 +136,8 @@ if (target.type === 'item') {

}
// If the last drop position was 'after', then 'before' on the next key is equivalent.
// Switch to 'on' instead.
if (target.dropPosition === 'after') {
dropPosition = 'on';
}
}

@@ -151,3 +158,3 @@

key: nextKey,
dropPosition: DROP_POSITIONS[0]
dropPosition
};

@@ -161,2 +168,3 @@ };

: keyboardDelegate.getLastKey();
let dropPosition: DropPosition = !target || target.type === 'root' ? 'after' : 'on';

@@ -173,2 +181,8 @@ if (target?.type === 'item') {

}
// If the last drop position was 'before', then 'after' on the previous key is equivalent.
// Switch to 'on' instead.
if (target.dropPosition === 'before') {
dropPosition = 'on';
}
}

@@ -189,3 +203,3 @@

key: nextKey,
dropPosition: !target || target.type === 'root' ? 'after' : 'on'
dropPosition
};

@@ -240,3 +254,48 @@ };

let types = getTypes(drag.items);
let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
let selectionManager = localState.state.selectionManager;
let target: DropTarget;
// When entering the droppable collection for the first time, the default drop target
// is after the focused key.
let key = selectionManager.focusedKey;
let dropPosition: DropPosition = 'after';
// If the focused key is a cell, get the parent item instead.
// For now, we assume that individual cells cannot be dropped on.
let item = localState.state.collection.getItem(key);
if (item?.type === 'cell') {
key = item.parentKey;
}
// If the focused item is also selected, the default drop target is after the last selected item.
// But if the focused key is the first selected item, then default to before the first selected item.
// This is to make reordering lists slightly easier. If you select top down, we assume you want to
// move the items down. If you select bottom up, we assume you want to move the items up.
if (selectionManager.isSelected(key)) {
if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) {
dropPosition = 'before';
} else {
key = selectionManager.lastSelectedKey;
}
}
if (key != null) {
target = {
type: 'item',
key,
dropPosition
};
// If the default target is not valid, find the next one that is.
if (localState.state.getDropOperation(target, types, drag.allowedDropOperations) === 'cancel') {
target = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)
?? nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
}
}
// If no focused key, then start from the root.
if (!target) {
target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
}
localState.state.setTarget(target);

@@ -243,0 +302,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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