@react-aria/dnd 3.0.1-nightly.3608 → 3.0.1-nightly.3617
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +22 -22
- package/dist/main.js.map +1 -1
- package/dist/module.js +22 -22
- package/dist/module.js.map +1 -1
- package/package.json +12 -12
package/dist/main.js
CHANGED
|
@@ -460,7 +460,7 @@ class $28e10663603f5ea1$var$DragSession {
|
|
|
460
460
|
this.restoreAriaHidden();
|
|
461
461
|
}
|
|
462
462
|
onKeyDown(e) {
|
|
463
|
-
var
|
|
463
|
+
var _this_currentDropTarget;
|
|
464
464
|
this.cancelEvent(e);
|
|
465
465
|
if (e.key === "Escape") {
|
|
466
466
|
this.cancel();
|
|
@@ -470,7 +470,7 @@ class $28e10663603f5ea1$var$DragSession {
|
|
|
470
470
|
if (e.shiftKey) this.previous();
|
|
471
471
|
else this.next();
|
|
472
472
|
}
|
|
473
|
-
if (typeof ((
|
|
473
|
+
if (typeof ((_this_currentDropTarget = this.currentDropTarget) === null || _this_currentDropTarget === void 0 ? void 0 : _this_currentDropTarget.onKeyDown) === "function") this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
474
474
|
}
|
|
475
475
|
onKeyUp(e) {
|
|
476
476
|
this.cancelEvent(e);
|
|
@@ -524,9 +524,9 @@ class $28e10663603f5ea1$var$DragSession {
|
|
|
524
524
|
this.isVirtualClick = (0, $4vY0V$reactariautils.isVirtualPointerEvent)(e);
|
|
525
525
|
}
|
|
526
526
|
cancelEvent(e) {
|
|
527
|
-
var
|
|
527
|
+
var _this_dragTarget;
|
|
528
528
|
// Allow focusin and focusout on the drag target so focus ring works properly.
|
|
529
|
-
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((
|
|
529
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((_this_dragTarget = this.dragTarget) === null || _this_dragTarget === void 0 ? void 0 : _this_dragTarget.element)) return;
|
|
530
530
|
// Allow default for events that might cancel a click event
|
|
531
531
|
if (!$28e10663603f5ea1$var$CLICK_EVENTS.includes(e.type)) e.preventDefault();
|
|
532
532
|
e.stopPropagation();
|
|
@@ -2334,7 +2334,7 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
|
|
|
2334
2334
|
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = (0, $4vY0V$reactariautils.useGlobalListeners)();
|
|
2335
2335
|
let modalityOnPointerDown = (0, $4vY0V$react.useRef)(null);
|
|
2336
2336
|
let onDragStart = (e)=>{
|
|
2337
|
-
var
|
|
2337
|
+
var _options_preview;
|
|
2338
2338
|
if (e.defaultPrevented) return;
|
|
2339
2339
|
// If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.
|
|
2340
2340
|
if (modalityOnPointerDown.current === "virtual") {
|
|
@@ -2360,7 +2360,7 @@ function $dc204e8ec58447a6$export$7941f8aafa4b6021(options) {
|
|
|
2360
2360
|
e.dataTransfer.effectAllowed = (0, $76b1e110a27b1ccd$export$dd0165308d8bff45)[allowed] || "none";
|
|
2361
2361
|
// If there is a preview option, use it to render a custom preview image that will
|
|
2362
2362
|
// appear under the pointer while dragging. If not, the element itself is dragged by the browser.
|
|
2363
|
-
if (typeof ((
|
|
2363
|
+
if (typeof ((_options_preview = options.preview) === null || _options_preview === void 0 ? void 0 : _options_preview.current) === "function") options.preview.current(items, (node)=>{
|
|
2364
2364
|
// Compute the offset that the preview will appear under the mouse.
|
|
2365
2365
|
// If possible, this is based on the point the user clicked on the target.
|
|
2366
2366
|
// If the preview is much smaller, then just use the center point of the preview.
|
|
@@ -3039,8 +3039,8 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3039
3039
|
autoScroll.stop();
|
|
3040
3040
|
},
|
|
3041
3041
|
onDropActivate (e) {
|
|
3042
|
-
var
|
|
3043
|
-
if (((
|
|
3042
|
+
var _state_target, _state_target1;
|
|
3043
|
+
if (((_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.type) === "item" && ((_state_target1 = state.target) === null || _state_target1 === void 0 ? void 0 : _state_target1.dropPosition) === "on" && typeof props.onDropActivate === "function") props.onDropActivate({
|
|
3044
3044
|
type: "dropactivate",
|
|
3045
3045
|
x: e.x,
|
|
3046
3046
|
y: e.y,
|
|
@@ -3253,7 +3253,7 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3253
3253
|
};
|
|
3254
3254
|
let { draggingKeys: draggingKeys } = (0, $4620ae0dc40f0031$export$6ca6700462636d0b);
|
|
3255
3255
|
let isInternal = (0, $4620ae0dc40f0031$export$78bf638634500fa5)(ref);
|
|
3256
|
-
var
|
|
3256
|
+
var _nextValidTarget;
|
|
3257
3257
|
// If the default target is not valid, find the next one that is.
|
|
3258
3258
|
if (localState.state.getDropOperation({
|
|
3259
3259
|
target: target,
|
|
@@ -3261,7 +3261,7 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3261
3261
|
allowedOperations: drag.allowedDropOperations,
|
|
3262
3262
|
isInternal: isInternal,
|
|
3263
3263
|
draggingKeys: draggingKeys
|
|
3264
|
-
}) === "cancel") target = (
|
|
3264
|
+
}) === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3265
3265
|
}
|
|
3266
3266
|
// If no focused key, then start from the root.
|
|
3267
3267
|
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
@@ -3275,8 +3275,8 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3275
3275
|
localState.state.setTarget(target);
|
|
3276
3276
|
},
|
|
3277
3277
|
onDropActivate (e) {
|
|
3278
|
-
var
|
|
3279
|
-
if (((
|
|
3278
|
+
var _localState_state_target, _localState_state_target1;
|
|
3279
|
+
if (((_localState_state_target = localState.state.target) === null || _localState_state_target === void 0 ? void 0 : _localState_state_target.type) === "item" && ((_localState_state_target1 = localState.state.target) === null || _localState_state_target1 === void 0 ? void 0 : _localState_state_target1.dropPosition) === "on" && typeof localState.props.onDropActivate === "function") localState.props.onDropActivate({
|
|
3280
3280
|
type: "dropactivate",
|
|
3281
3281
|
x: e.x,
|
|
3282
3282
|
y: e.y,
|
|
@@ -3344,8 +3344,8 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3344
3344
|
isInternal: isInternal,
|
|
3345
3345
|
draggingKeys: draggingKeys
|
|
3346
3346
|
});
|
|
3347
|
-
var
|
|
3348
|
-
if (operation === "cancel") target4 = (
|
|
3347
|
+
var _nextValidTarget;
|
|
3348
|
+
if (operation === "cancel") target4 = (_nextValidTarget = nextValidTarget(target4, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target4, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3349
3349
|
}
|
|
3350
3350
|
localState.state.setTarget(target4 !== null && target4 !== void 0 ? target4 : localState.state.target);
|
|
3351
3351
|
}
|
|
@@ -3384,8 +3384,8 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3384
3384
|
isInternal: isInternal1,
|
|
3385
3385
|
draggingKeys: draggingKeys1
|
|
3386
3386
|
});
|
|
3387
|
-
var
|
|
3388
|
-
if (operation1 === "cancel") target5 = (
|
|
3387
|
+
var _nextValidTarget1;
|
|
3388
|
+
if (operation1 === "cancel") target5 = (_nextValidTarget1 = nextValidTarget(target5, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target5, types, drag.allowedDropOperations, getNextTarget, false);
|
|
3389
3389
|
}
|
|
3390
3390
|
localState.state.setTarget(target5 !== null && target5 !== void 0 ? target5 : localState.state.target);
|
|
3391
3391
|
break;
|
|
@@ -3505,8 +3505,8 @@ function $c5557edbed563ebf$export$8d0e41d2815afac5(props, state, ref) {
|
|
|
3505
3505
|
let { dropProps: dropProps } = (0, $fc1876157e07bcec$export$f7b0c5d28b66b6a5)(props, state, ref);
|
|
3506
3506
|
let id = (0, $4vY0V$reactariautils.useId)();
|
|
3507
3507
|
let getText = (key)=>{
|
|
3508
|
-
var
|
|
3509
|
-
return (
|
|
3508
|
+
var _collection_getItem;
|
|
3509
|
+
return (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
|
|
3510
3510
|
};
|
|
3511
3511
|
let label = "";
|
|
3512
3512
|
let labelledBy;
|
|
@@ -3617,7 +3617,7 @@ function $0cbbd00cda972c67$export$b35afafff42da2d9(props, state) {
|
|
|
3617
3617
|
let description;
|
|
3618
3618
|
// Override description to include selected item count.
|
|
3619
3619
|
let modality = (0, $4620ae0dc40f0031$export$49bac5d6d4b352ea)();
|
|
3620
|
-
var
|
|
3620
|
+
var _item_textValue;
|
|
3621
3621
|
if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
|
|
3622
3622
|
let msg = $0cbbd00cda972c67$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
|
|
3623
3623
|
if (props.hasAction && modality === "keyboard") msg += "Alt";
|
|
@@ -3632,7 +3632,7 @@ function $0cbbd00cda972c67$export$b35afafff42da2d9(props, state) {
|
|
|
3632
3632
|
count: numKeysForDrag
|
|
3633
3633
|
});
|
|
3634
3634
|
else dragButtonLabel = stringFormatter.format("dragItem", {
|
|
3635
|
-
itemText: (
|
|
3635
|
+
itemText: (_item_textValue = item === null || item === void 0 ? void 0 : item.textValue) !== null && _item_textValue !== void 0 ? _item_textValue : ""
|
|
3636
3636
|
});
|
|
3637
3637
|
let descriptionProps = (0, $4vY0V$reactariautils.useDescription)(description);
|
|
3638
3638
|
if (description) Object.assign(dragProps, descriptionProps);
|
|
@@ -3731,12 +3731,12 @@ function $74f3dedaa4d234b4$export$2314ca2a3e892862(options) {
|
|
|
3731
3731
|
if (isFocusedRef.current && options.getItems) e.preventDefault();
|
|
3732
3732
|
};
|
|
3733
3733
|
let onCopy = (e)=>{
|
|
3734
|
-
var
|
|
3734
|
+
var _options_onCopy;
|
|
3735
3735
|
let options = ref.current;
|
|
3736
3736
|
if (!isFocusedRef.current || !options.getItems) return;
|
|
3737
3737
|
e.preventDefault();
|
|
3738
3738
|
(0, $4620ae0dc40f0031$export$f9c1490890ddd063)(e.clipboardData, options.getItems());
|
|
3739
|
-
(
|
|
3739
|
+
(_options_onCopy = options.onCopy) === null || _options_onCopy === void 0 ? void 0 : _options_onCopy.call(options);
|
|
3740
3740
|
};
|
|
3741
3741
|
let onBeforeCut = (e)=>{
|
|
3742
3742
|
let options = ref.current;
|