@react-spectrum/card 3.0.0-nightly.3608 → 3.0.0-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/module.js CHANGED
@@ -881,22 +881,22 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
881
881
  return best || null;
882
882
  }
883
883
  getKeyBelow(key) {
884
- var ref, ref1;
884
+ var _this__findClosest, _closestRow_childNodes_;
885
885
  // Expected key is the currently focused cell so we need the parent row key
886
886
  let parentRowKey = this.collection.getItem(key).parentKey;
887
887
  let layoutInfo = this.getLayoutInfo(parentRowKey);
888
888
  let rect = new (0, $8EWFi$Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
889
- let closestRow = this.collection.getItem((ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key);
890
- return (ref1 = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || ref1 === void 0 ? void 0 : ref1.key;
889
+ let closestRow = this.collection.getItem((_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key);
890
+ return (_closestRow_childNodes_ = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || _closestRow_childNodes_ === void 0 ? void 0 : _closestRow_childNodes_.key;
891
891
  }
892
892
  getKeyAbove(key) {
893
- var ref, ref1;
893
+ var _this__findClosest, _closestRow_childNodes_;
894
894
  // Expected key is the currently focused cell so we need the parent row key
895
895
  let parentRowKey = this.collection.getItem(key).parentKey;
896
896
  let layoutInfo = this.getLayoutInfo(parentRowKey);
897
897
  let rect = new (0, $8EWFi$Rect)(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
898
- let closestRow = this.collection.getItem((ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key);
899
- return (ref1 = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || ref1 === void 0 ? void 0 : ref1.key;
898
+ let closestRow = this.collection.getItem((_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key);
899
+ return (_closestRow_childNodes_ = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || _closestRow_childNodes_ === void 0 ? void 0 : _closestRow_childNodes_.key;
900
900
  }
901
901
  getKeyRightOf(key) {
902
902
  // Expected key is the currently focused cell so we need the parent row key
@@ -935,16 +935,16 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
935
935
  let parentRowKey = this.collection.getItem(key).parentKey;
936
936
  let layoutInfo = this.getLayoutInfo(parentRowKey);
937
937
  if (layoutInfo) {
938
- var ref;
938
+ var _this_collection_getItem;
939
939
  let pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.virtualizer.visibleRect.height);
940
940
  // If the node is so large that it spans multiple page heights, return the key of the item immediately above
941
941
  // Otherwise keep going up until we exceed a single page height worth of nodes
942
- let keyAbove = (ref = this.collection.getItem(this.getKeyAbove(key))) === null || ref === void 0 ? void 0 : ref.parentKey;
942
+ let keyAbove = (_this_collection_getItem = this.collection.getItem(this.getKeyAbove(key))) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.parentKey;
943
943
  layoutInfo = this.getLayoutInfo(keyAbove);
944
944
  if (layoutInfo && layoutInfo.rect.y > pageY) while(layoutInfo && layoutInfo.rect.y > pageY){
945
- var ref1;
945
+ var _this_collection_getItem1;
946
946
  let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
947
- let keyAbove1 = (ref1 = this.collection.getItem(this.getKeyAbove(childKey))) === null || ref1 === void 0 ? void 0 : ref1.parentKey;
947
+ let keyAbove1 = (_this_collection_getItem1 = this.collection.getItem(this.getKeyAbove(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
948
948
  layoutInfo = this.getLayoutInfo(keyAbove1);
949
949
  }
950
950
  if (layoutInfo) {
@@ -961,16 +961,16 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
961
961
  let parentRowKey = this.collection.getItem(key).parentKey;
962
962
  let layoutInfo = this.getLayoutInfo(parentRowKey);
963
963
  if (layoutInfo) {
964
- var ref;
964
+ var _this_collection_getItem;
965
965
  let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height);
966
966
  // If the node is so large that it spans multiple page heights, return the key of the item immediately below
967
967
  // Otherwise keep going up until we exceed a single page height worth of nodes
968
- let keyBelow = (ref = this.collection.getItem(this.getKeyBelow(key))) === null || ref === void 0 ? void 0 : ref.parentKey;
968
+ let keyBelow = (_this_collection_getItem = this.collection.getItem(this.getKeyBelow(key))) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.parentKey;
969
969
  layoutInfo = this.getLayoutInfo(keyBelow);
970
970
  if (layoutInfo && layoutInfo.rect.y < pageY) while(layoutInfo && layoutInfo.rect.y < pageY){
971
- var ref1;
971
+ var _this_collection_getItem1;
972
972
  let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
973
- let keyBelow1 = (ref1 = this.collection.getItem(this.getKeyBelow(childKey))) === null || ref1 === void 0 ? void 0 : ref1.parentKey;
973
+ let keyBelow1 = (_this_collection_getItem1 = this.collection.getItem(this.getKeyBelow(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
974
974
  layoutInfo = this.getLayoutInfo(keyBelow1);
975
975
  }
976
976
  if (layoutInfo) {
@@ -1365,24 +1365,24 @@ class $ed42fd44b9b9b664$export$7d2b12578154a735 extends (0, $3d424c147206bac9$ex
1365
1365
  // then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the
1366
1366
  // collection contents by that number (which will give us the row distribution)
1367
1367
  getKeyBelow(key) {
1368
- var ref;
1368
+ var _this_collection_rows_indexRowBelow;
1369
1369
  // Expected key is the currently focused cell so we need the parent row key
1370
1370
  let parentRowKey = this.collection.getItem(key).parentKey;
1371
1371
  let indexRowBelow;
1372
1372
  let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey);
1373
1373
  if (index !== -1) indexRowBelow = index + this.numColumns;
1374
1374
  else return null;
1375
- return ((ref = this.collection.rows[indexRowBelow]) === null || ref === void 0 ? void 0 : ref.childNodes[0].key) || null;
1375
+ return ((_this_collection_rows_indexRowBelow = this.collection.rows[indexRowBelow]) === null || _this_collection_rows_indexRowBelow === void 0 ? void 0 : _this_collection_rows_indexRowBelow.childNodes[0].key) || null;
1376
1376
  }
1377
1377
  getKeyAbove(key) {
1378
- var ref;
1378
+ var _this_collection_rows_indexRowAbove;
1379
1379
  // Expected key is the currently focused cell so we need the parent row key
1380
1380
  let parentRowKey = this.collection.getItem(key).parentKey;
1381
1381
  let indexRowAbove;
1382
1382
  let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey);
1383
1383
  if (index !== -1) indexRowAbove = index - this.numColumns;
1384
1384
  else return null;
1385
- return ((ref = this.collection.rows[indexRowAbove]) === null || ref === void 0 ? void 0 : ref.childNodes[0].key) || null;
1385
+ return ((_this_collection_rows_indexRowAbove = this.collection.rows[indexRowAbove]) === null || _this_collection_rows_indexRowAbove === void 0 ? void 0 : _this_collection_rows_indexRowAbove.childNodes[0].key) || null;
1386
1386
  }
1387
1387
  constructor(options = {}){
1388
1388
  super(options);
@@ -1514,33 +1514,33 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
1514
1514
  return minIndex;
1515
1515
  }
1516
1516
  getClosestRight(key) {
1517
- var ref, ref1, ref2;
1517
+ var _this__findClosest, _this_collection_getItem_childNodes_, _this_collection_getItem;
1518
1518
  let layoutInfo = this.getLayoutInfo(key);
1519
1519
  // Refactored from v2. Current strategy is to find the closest card in the adjacent column.
1520
1520
  // This prevent the issue where it was possible that the closest layoutInfo would be two columns over due to the middle card being exceptionally tall
1521
1521
  // and thus the top corner to top corner distance was massive.
1522
1522
  // First look for a card to the immediate right of the current card. If we can't find any, look for the nearest card in the entire column to the right of the card
1523
1523
  let rect = new (0, $8EWFi$Rect)(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1524
- key = (ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key;
1524
+ key = (_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key;
1525
1525
  if (!key) {
1526
- var ref3;
1526
+ var _this__findClosest1;
1527
1527
  rect = new (0, $8EWFi$Rect)(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1528
- key = (ref3 = this._findClosest(layoutInfo.rect, rect)) === null || ref3 === void 0 ? void 0 : ref3.key;
1528
+ key = (_this__findClosest1 = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest1 === void 0 ? void 0 : _this__findClosest1.key;
1529
1529
  }
1530
- return (ref2 = (ref1 = this.collection.getItem(key)) === null || ref1 === void 0 ? void 0 : ref1.childNodes[0]) === null || ref2 === void 0 ? void 0 : ref2.key;
1530
+ return (_this_collection_getItem_childNodes_ = (_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.childNodes[0]) === null || _this_collection_getItem_childNodes_ === void 0 ? void 0 : _this_collection_getItem_childNodes_.key;
1531
1531
  }
1532
1532
  getClosestLeft(key) {
1533
- var ref, ref1, ref2;
1533
+ var _this__findClosest, _this_collection_getItem_childNodes_, _this_collection_getItem;
1534
1534
  let layoutInfo = this.getLayoutInfo(key);
1535
1535
  // First look for a card to the immediate left of the current card. If we can't find any, look for the nearest card in the entire column to the left of the card
1536
1536
  let rect = new (0, $8EWFi$Rect)(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1537
- key = (ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key;
1537
+ key = (_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key;
1538
1538
  if (!key) {
1539
- var ref3;
1539
+ var _this__findClosest1;
1540
1540
  rect = new (0, $8EWFi$Rect)(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1541
- key = (ref3 = this._findClosest(layoutInfo.rect, rect)) === null || ref3 === void 0 ? void 0 : ref3.key;
1541
+ key = (_this__findClosest1 = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest1 === void 0 ? void 0 : _this__findClosest1.key;
1542
1542
  }
1543
- return (ref2 = (ref1 = this.collection.getItem(key)) === null || ref1 === void 0 ? void 0 : ref1.childNodes[0]) === null || ref2 === void 0 ? void 0 : ref2.key;
1543
+ return (_this_collection_getItem_childNodes_ = (_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.childNodes[0]) === null || _this_collection_getItem_childNodes_ === void 0 ? void 0 : _this_collection_getItem_childNodes_.key;
1544
1544
  }
1545
1545
  getKeyRightOf(key) {
1546
1546
  // Expected key is the currently focused cell so we need the parent row key