@react-aria/dnd 3.0.1-nightly.3611 → 3.0.1-nightly.3621
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/module.js
CHANGED
|
@@ -444,7 +444,7 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
444
444
|
this.restoreAriaHidden();
|
|
445
445
|
}
|
|
446
446
|
onKeyDown(e) {
|
|
447
|
-
var
|
|
447
|
+
var _this_currentDropTarget;
|
|
448
448
|
this.cancelEvent(e);
|
|
449
449
|
if (e.key === "Escape") {
|
|
450
450
|
this.cancel();
|
|
@@ -454,7 +454,7 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
454
454
|
if (e.shiftKey) this.previous();
|
|
455
455
|
else this.next();
|
|
456
456
|
}
|
|
457
|
-
if (typeof ((
|
|
457
|
+
if (typeof ((_this_currentDropTarget = this.currentDropTarget) === null || _this_currentDropTarget === void 0 ? void 0 : _this_currentDropTarget.onKeyDown) === "function") this.currentDropTarget.onKeyDown(e, this.dragTarget);
|
|
458
458
|
}
|
|
459
459
|
onKeyUp(e) {
|
|
460
460
|
this.cancelEvent(e);
|
|
@@ -508,9 +508,9 @@ class $67560de7c78cb232$var$DragSession {
|
|
|
508
508
|
this.isVirtualClick = (0, $fP8tg$isVirtualPointerEvent)(e);
|
|
509
509
|
}
|
|
510
510
|
cancelEvent(e) {
|
|
511
|
-
var
|
|
511
|
+
var _this_dragTarget;
|
|
512
512
|
// Allow focusin and focusout on the drag target so focus ring works properly.
|
|
513
|
-
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((
|
|
513
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target === ((_this_dragTarget = this.dragTarget) === null || _this_dragTarget === void 0 ? void 0 : _this_dragTarget.element)) return;
|
|
514
514
|
// Allow default for events that might cancel a click event
|
|
515
515
|
if (!$67560de7c78cb232$var$CLICK_EVENTS.includes(e.type)) e.preventDefault();
|
|
516
516
|
e.stopPropagation();
|
|
@@ -2318,7 +2318,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2318
2318
|
let { addGlobalListener: addGlobalListener , removeAllGlobalListeners: removeAllGlobalListeners } = (0, $fP8tg$useGlobalListeners)();
|
|
2319
2319
|
let modalityOnPointerDown = (0, $fP8tg$useRef)(null);
|
|
2320
2320
|
let onDragStart = (e)=>{
|
|
2321
|
-
var
|
|
2321
|
+
var _options_preview;
|
|
2322
2322
|
if (e.defaultPrevented) return;
|
|
2323
2323
|
// If this drag was initiated by a mobile screen reader (e.g. VoiceOver or TalkBack), enter virtual dragging mode.
|
|
2324
2324
|
if (modalityOnPointerDown.current === "virtual") {
|
|
@@ -2344,7 +2344,7 @@ function $8253ed7ece74b463$export$7941f8aafa4b6021(options) {
|
|
|
2344
2344
|
e.dataTransfer.effectAllowed = (0, $103790afe9474d1c$export$dd0165308d8bff45)[allowed] || "none";
|
|
2345
2345
|
// If there is a preview option, use it to render a custom preview image that will
|
|
2346
2346
|
// appear under the pointer while dragging. If not, the element itself is dragged by the browser.
|
|
2347
|
-
if (typeof ((
|
|
2347
|
+
if (typeof ((_options_preview = options.preview) === null || _options_preview === void 0 ? void 0 : _options_preview.current) === "function") options.preview.current(items, (node)=>{
|
|
2348
2348
|
// Compute the offset that the preview will appear under the mouse.
|
|
2349
2349
|
// If possible, this is based on the point the user clicked on the target.
|
|
2350
2350
|
// If the preview is much smaller, then just use the center point of the preview.
|
|
@@ -3023,8 +3023,8 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3023
3023
|
autoScroll.stop();
|
|
3024
3024
|
},
|
|
3025
3025
|
onDropActivate (e) {
|
|
3026
|
-
var
|
|
3027
|
-
if (((
|
|
3026
|
+
var _state_target, _state_target1;
|
|
3027
|
+
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({
|
|
3028
3028
|
type: "dropactivate",
|
|
3029
3029
|
x: e.x,
|
|
3030
3030
|
y: e.y,
|
|
@@ -3237,7 +3237,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3237
3237
|
};
|
|
3238
3238
|
let { draggingKeys: draggingKeys } = (0, $7252cd45fc48c07c$export$6ca6700462636d0b);
|
|
3239
3239
|
let isInternal = (0, $7252cd45fc48c07c$export$78bf638634500fa5)(ref);
|
|
3240
|
-
var
|
|
3240
|
+
var _nextValidTarget;
|
|
3241
3241
|
// If the default target is not valid, find the next one that is.
|
|
3242
3242
|
if (localState.state.getDropOperation({
|
|
3243
3243
|
target: target,
|
|
@@ -3245,7 +3245,7 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3245
3245
|
allowedOperations: drag.allowedDropOperations,
|
|
3246
3246
|
isInternal: isInternal,
|
|
3247
3247
|
draggingKeys: draggingKeys
|
|
3248
|
-
}) === "cancel") target = (
|
|
3248
|
+
}) === "cancel") target = (_nextValidTarget = nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3249
3249
|
}
|
|
3250
3250
|
// If no focused key, then start from the root.
|
|
3251
3251
|
if (!target) target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);
|
|
@@ -3259,8 +3259,8 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3259
3259
|
localState.state.setTarget(target);
|
|
3260
3260
|
},
|
|
3261
3261
|
onDropActivate (e) {
|
|
3262
|
-
var
|
|
3263
|
-
if (((
|
|
3262
|
+
var _localState_state_target, _localState_state_target1;
|
|
3263
|
+
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({
|
|
3264
3264
|
type: "dropactivate",
|
|
3265
3265
|
x: e.x,
|
|
3266
3266
|
y: e.y,
|
|
@@ -3328,8 +3328,8 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3328
3328
|
isInternal: isInternal,
|
|
3329
3329
|
draggingKeys: draggingKeys
|
|
3330
3330
|
});
|
|
3331
|
-
var
|
|
3332
|
-
if (operation === "cancel") target4 = (
|
|
3331
|
+
var _nextValidTarget;
|
|
3332
|
+
if (operation === "cancel") target4 = (_nextValidTarget = nextValidTarget(target4, types, drag.allowedDropOperations, getNextTarget, false)) !== null && _nextValidTarget !== void 0 ? _nextValidTarget : nextValidTarget(target4, types, drag.allowedDropOperations, getPreviousTarget, false);
|
|
3333
3333
|
}
|
|
3334
3334
|
localState.state.setTarget(target4 !== null && target4 !== void 0 ? target4 : localState.state.target);
|
|
3335
3335
|
}
|
|
@@ -3368,8 +3368,8 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
|
|
|
3368
3368
|
isInternal: isInternal1,
|
|
3369
3369
|
draggingKeys: draggingKeys1
|
|
3370
3370
|
});
|
|
3371
|
-
var
|
|
3372
|
-
if (operation1 === "cancel") target5 = (
|
|
3371
|
+
var _nextValidTarget1;
|
|
3372
|
+
if (operation1 === "cancel") target5 = (_nextValidTarget1 = nextValidTarget(target5, types, drag.allowedDropOperations, getPreviousTarget, false)) !== null && _nextValidTarget1 !== void 0 ? _nextValidTarget1 : nextValidTarget(target5, types, drag.allowedDropOperations, getNextTarget, false);
|
|
3373
3373
|
}
|
|
3374
3374
|
localState.state.setTarget(target5 !== null && target5 !== void 0 ? target5 : localState.state.target);
|
|
3375
3375
|
break;
|
|
@@ -3489,8 +3489,8 @@ function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
|
|
|
3489
3489
|
let { dropProps: dropProps } = (0, $bfaab576ce1c580e$export$f7b0c5d28b66b6a5)(props, state, ref);
|
|
3490
3490
|
let id = (0, $fP8tg$useId)();
|
|
3491
3491
|
let getText = (key)=>{
|
|
3492
|
-
var
|
|
3493
|
-
return (
|
|
3492
|
+
var _collection_getItem;
|
|
3493
|
+
return (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
|
|
3494
3494
|
};
|
|
3495
3495
|
let label = "";
|
|
3496
3496
|
let labelledBy;
|
|
@@ -3601,7 +3601,7 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
|
|
|
3601
3601
|
let description;
|
|
3602
3602
|
// Override description to include selected item count.
|
|
3603
3603
|
let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
|
|
3604
|
-
var
|
|
3604
|
+
var _item_textValue;
|
|
3605
3605
|
if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
|
|
3606
3606
|
let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
|
|
3607
3607
|
if (props.hasAction && modality === "keyboard") msg += "Alt";
|
|
@@ -3616,7 +3616,7 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
|
|
|
3616
3616
|
count: numKeysForDrag
|
|
3617
3617
|
});
|
|
3618
3618
|
else dragButtonLabel = stringFormatter.format("dragItem", {
|
|
3619
|
-
itemText: (
|
|
3619
|
+
itemText: (_item_textValue = item === null || item === void 0 ? void 0 : item.textValue) !== null && _item_textValue !== void 0 ? _item_textValue : ""
|
|
3620
3620
|
});
|
|
3621
3621
|
let descriptionProps = (0, $fP8tg$useDescription)(description);
|
|
3622
3622
|
if (description) Object.assign(dragProps, descriptionProps);
|
|
@@ -3715,12 +3715,12 @@ function $9fcc7f0d70d084ee$export$2314ca2a3e892862(options) {
|
|
|
3715
3715
|
if (isFocusedRef.current && options.getItems) e.preventDefault();
|
|
3716
3716
|
};
|
|
3717
3717
|
let onCopy = (e)=>{
|
|
3718
|
-
var
|
|
3718
|
+
var _options_onCopy;
|
|
3719
3719
|
let options = ref.current;
|
|
3720
3720
|
if (!isFocusedRef.current || !options.getItems) return;
|
|
3721
3721
|
e.preventDefault();
|
|
3722
3722
|
(0, $7252cd45fc48c07c$export$f9c1490890ddd063)(e.clipboardData, options.getItems());
|
|
3723
|
-
(
|
|
3723
|
+
(_options_onCopy = options.onCopy) === null || _options_onCopy === void 0 ? void 0 : _options_onCopy.call(options);
|
|
3724
3724
|
};
|
|
3725
3725
|
let onBeforeCut = (e)=>{
|
|
3726
3726
|
let options = ref.current;
|