@react-aria/dnd 3.1.1-nightly.3787 → 3.1.1-nightly.3804

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/import.mjs CHANGED
@@ -3116,6 +3116,9 @@ function $4b52e4eff84e5217$export$f4e2f423c21f7b04(props, state, ref) {
3116
3116
  // is some indication that items were added.
3117
3117
  if (state.selectionManager.focusedKey === droppingState.current.focusedKey) {
3118
3118
  let first = newKeys.keys().next().value;
3119
+ let item = state.collection.getItem(first);
3120
+ // If this is a cell, focus the parent row.
3121
+ if ((item === null || item === void 0 ? void 0 : item.type) === "cell") first = item.parentKey;
3119
3122
  state.selectionManager.setFocusedKey(first);
3120
3123
  if (state.selectionManager.selectionMode === "none") (0, $fP8tg$setInteractionModality)("keyboard");
3121
3124
  }
@@ -3503,9 +3506,10 @@ function $ddf25448c71fc93a$export$8d0e41d2815afac5(props, state, ref) {
3503
3506
  let dragSession = $67560de7c78cb232$export$418e185dd3f1b968();
3504
3507
  let { dropProps: dropProps } = (0, $bfaab576ce1c580e$export$f7b0c5d28b66b6a5)(props, state, ref);
3505
3508
  let id = (0, $fP8tg$useId)();
3509
+ var _collection_getTextValue;
3506
3510
  let getText = (key)=>{
3507
- var _collection_getItem;
3508
- return (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
3511
+ var _collection_getTextValue1, _collection_getItem;
3512
+ return (_collection_getTextValue = (_collection_getTextValue1 = collection.getTextValue) === null || _collection_getTextValue1 === void 0 ? void 0 : _collection_getTextValue1.call(collection, key)) !== null && _collection_getTextValue !== void 0 ? _collection_getTextValue : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
3509
3513
  };
3510
3514
  let label = "";
3511
3515
  let labelledBy;
@@ -3620,7 +3624,6 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
3620
3624
  let description;
3621
3625
  // Override description to include selected item count.
3622
3626
  let modality = (0, $7252cd45fc48c07c$export$49bac5d6d4b352ea)();
3623
- var _item_textValue;
3624
3627
  if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
3625
3628
  let msg = $fd98cf7cbf233429$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
3626
3629
  if (props.hasAction && modality === "keyboard") msg += "Alt";
@@ -3634,9 +3637,14 @@ function $fd98cf7cbf233429$export$b35afafff42da2d9(props, state) {
3634
3637
  } else if (isSelected) dragButtonLabel = stringFormatter.format("dragSelectedItems", {
3635
3638
  count: numKeysForDrag
3636
3639
  });
3637
- else dragButtonLabel = stringFormatter.format("dragItem", {
3638
- itemText: (_item_textValue = item === null || item === void 0 ? void 0 : item.textValue) !== null && _item_textValue !== void 0 ? _item_textValue : ""
3639
- });
3640
+ else {
3641
+ var _state_collection, _state_collection_getTextValue;
3642
+ var _state_collection_getTextValue1, _ref;
3643
+ let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : "";
3644
+ dragButtonLabel = stringFormatter.format("dragItem", {
3645
+ itemText: itemText
3646
+ });
3647
+ }
3640
3648
  let descriptionProps = (0, $fP8tg$useDescription)(description);
3641
3649
  if (description) Object.assign(dragProps, descriptionProps);
3642
3650
  if (!props.hasDragButton && props.hasAction) {
package/dist/main.js CHANGED
@@ -3135,6 +3135,9 @@ function $7f93a158ac20b90a$export$f4e2f423c21f7b04(props, state, ref) {
3135
3135
  // is some indication that items were added.
3136
3136
  if (state.selectionManager.focusedKey === droppingState.current.focusedKey) {
3137
3137
  let first = newKeys.keys().next().value;
3138
+ let item = state.collection.getItem(first);
3139
+ // If this is a cell, focus the parent row.
3140
+ if ((item === null || item === void 0 ? void 0 : item.type) === "cell") first = item.parentKey;
3138
3141
  state.selectionManager.setFocusedKey(first);
3139
3142
  if (state.selectionManager.selectionMode === "none") (0, $4vY0V$reactariainteractions.setInteractionModality)("keyboard");
3140
3143
  }
@@ -3522,9 +3525,10 @@ function $c5557edbed563ebf$export$8d0e41d2815afac5(props, state, ref) {
3522
3525
  let dragSession = $28e10663603f5ea1$export$418e185dd3f1b968();
3523
3526
  let { dropProps: dropProps } = (0, $fc1876157e07bcec$export$f7b0c5d28b66b6a5)(props, state, ref);
3524
3527
  let id = (0, $4vY0V$reactariautils.useId)();
3528
+ var _collection_getTextValue;
3525
3529
  let getText = (key)=>{
3526
- var _collection_getItem;
3527
- return (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
3530
+ var _collection_getTextValue1, _collection_getItem;
3531
+ return (_collection_getTextValue = (_collection_getTextValue1 = collection.getTextValue) === null || _collection_getTextValue1 === void 0 ? void 0 : _collection_getTextValue1.call(collection, key)) !== null && _collection_getTextValue !== void 0 ? _collection_getTextValue : (_collection_getItem = collection.getItem(key)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue;
3528
3532
  };
3529
3533
  let label = "";
3530
3534
  let labelledBy;
@@ -3639,7 +3643,6 @@ function $0cbbd00cda972c67$export$b35afafff42da2d9(props, state) {
3639
3643
  let description;
3640
3644
  // Override description to include selected item count.
3641
3645
  let modality = (0, $4620ae0dc40f0031$export$49bac5d6d4b352ea)();
3642
- var _item_textValue;
3643
3646
  if (!props.hasDragButton && state.selectionManager.selectionMode !== "none") {
3644
3647
  let msg = $0cbbd00cda972c67$var$MESSAGES[modality][isSelected ? "selected" : "notSelected"];
3645
3648
  if (props.hasAction && modality === "keyboard") msg += "Alt";
@@ -3653,9 +3656,14 @@ function $0cbbd00cda972c67$export$b35afafff42da2d9(props, state) {
3653
3656
  } else if (isSelected) dragButtonLabel = stringFormatter.format("dragSelectedItems", {
3654
3657
  count: numKeysForDrag
3655
3658
  });
3656
- else dragButtonLabel = stringFormatter.format("dragItem", {
3657
- itemText: (_item_textValue = item === null || item === void 0 ? void 0 : item.textValue) !== null && _item_textValue !== void 0 ? _item_textValue : ""
3658
- });
3659
+ else {
3660
+ var _state_collection, _state_collection_getTextValue;
3661
+ var _state_collection_getTextValue1, _ref;
3662
+ let itemText = (_ref = (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, props.key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : item === null || item === void 0 ? void 0 : item.textValue) !== null && _ref !== void 0 ? _ref : "";
3663
+ dragButtonLabel = stringFormatter.format("dragItem", {
3664
+ itemText: itemText
3665
+ });
3666
+ }
3659
3667
  let descriptionProps = (0, $4vY0V$reactariautils.useDescription)(description);
3660
3668
  if (description) Object.assign(dragProps, descriptionProps);
3661
3669
  if (!props.hasDragButton && props.hasAction) {