@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/main.js +30 -30
- package/dist/main.js.map +1 -1
- package/dist/module.js +28 -28
- package/dist/module.js.map +1 -1
- package/package.json +22 -22
package/dist/main.js
CHANGED
|
@@ -13,7 +13,7 @@ var $jpY3B$reactspectrumcheckbox = require("@react-spectrum/checkbox");
|
|
|
13
13
|
var $jpY3B$reactariafocus = require("@react-aria/focus");
|
|
14
14
|
var $jpY3B$reactariainteractions = require("@react-aria/interactions");
|
|
15
15
|
var $jpY3B$reactstatelyvirtualizer = require("@react-stately/virtualizer");
|
|
16
|
-
require("@swc/helpers/lib/_define_property.js");
|
|
16
|
+
var $jpY3B$swchelperslib_define_propertyjs = require("@swc/helpers/lib/_define_property.js");
|
|
17
17
|
|
|
18
18
|
function $parcel$export(e, n, v, s) {
|
|
19
19
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -887,22 +887,22 @@ class $5ee605f09afaa4de$export$64943d2e59d72a29 extends (0, $jpY3B$reactstatelyv
|
|
|
887
887
|
return best || null;
|
|
888
888
|
}
|
|
889
889
|
getKeyBelow(key) {
|
|
890
|
-
var
|
|
890
|
+
var _this__findClosest, _closestRow_childNodes_;
|
|
891
891
|
// Expected key is the currently focused cell so we need the parent row key
|
|
892
892
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
893
893
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
894
894
|
let rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
|
|
895
|
-
let closestRow = this.collection.getItem((
|
|
896
|
-
return (
|
|
895
|
+
let closestRow = this.collection.getItem((_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key);
|
|
896
|
+
return (_closestRow_childNodes_ = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || _closestRow_childNodes_ === void 0 ? void 0 : _closestRow_childNodes_.key;
|
|
897
897
|
}
|
|
898
898
|
getKeyAbove(key) {
|
|
899
|
-
var
|
|
899
|
+
var _this__findClosest, _closestRow_childNodes_;
|
|
900
900
|
// Expected key is the currently focused cell so we need the parent row key
|
|
901
901
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
902
902
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
903
903
|
let rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
|
|
904
|
-
let closestRow = this.collection.getItem((
|
|
905
|
-
return (
|
|
904
|
+
let closestRow = this.collection.getItem((_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key);
|
|
905
|
+
return (_closestRow_childNodes_ = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || _closestRow_childNodes_ === void 0 ? void 0 : _closestRow_childNodes_.key;
|
|
906
906
|
}
|
|
907
907
|
getKeyRightOf(key) {
|
|
908
908
|
// Expected key is the currently focused cell so we need the parent row key
|
|
@@ -941,16 +941,16 @@ class $5ee605f09afaa4de$export$64943d2e59d72a29 extends (0, $jpY3B$reactstatelyv
|
|
|
941
941
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
942
942
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
943
943
|
if (layoutInfo) {
|
|
944
|
-
var
|
|
944
|
+
var _this_collection_getItem;
|
|
945
945
|
let pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.virtualizer.visibleRect.height);
|
|
946
946
|
// If the node is so large that it spans multiple page heights, return the key of the item immediately above
|
|
947
947
|
// Otherwise keep going up until we exceed a single page height worth of nodes
|
|
948
|
-
let keyAbove = (
|
|
948
|
+
let keyAbove = (_this_collection_getItem = this.collection.getItem(this.getKeyAbove(key))) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.parentKey;
|
|
949
949
|
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
950
950
|
if (layoutInfo && layoutInfo.rect.y > pageY) while(layoutInfo && layoutInfo.rect.y > pageY){
|
|
951
|
-
var
|
|
951
|
+
var _this_collection_getItem1;
|
|
952
952
|
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
953
|
-
let keyAbove1 = (
|
|
953
|
+
let keyAbove1 = (_this_collection_getItem1 = this.collection.getItem(this.getKeyAbove(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
|
|
954
954
|
layoutInfo = this.getLayoutInfo(keyAbove1);
|
|
955
955
|
}
|
|
956
956
|
if (layoutInfo) {
|
|
@@ -967,16 +967,16 @@ class $5ee605f09afaa4de$export$64943d2e59d72a29 extends (0, $jpY3B$reactstatelyv
|
|
|
967
967
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
968
968
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
969
969
|
if (layoutInfo) {
|
|
970
|
-
var
|
|
970
|
+
var _this_collection_getItem;
|
|
971
971
|
let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height);
|
|
972
972
|
// If the node is so large that it spans multiple page heights, return the key of the item immediately below
|
|
973
973
|
// Otherwise keep going up until we exceed a single page height worth of nodes
|
|
974
|
-
let keyBelow = (
|
|
974
|
+
let keyBelow = (_this_collection_getItem = this.collection.getItem(this.getKeyBelow(key))) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.parentKey;
|
|
975
975
|
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
976
976
|
if (layoutInfo && layoutInfo.rect.y < pageY) while(layoutInfo && layoutInfo.rect.y < pageY){
|
|
977
|
-
var
|
|
977
|
+
var _this_collection_getItem1;
|
|
978
978
|
let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
|
|
979
|
-
let keyBelow1 = (
|
|
979
|
+
let keyBelow1 = (_this_collection_getItem1 = this.collection.getItem(this.getKeyBelow(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
|
|
980
980
|
layoutInfo = this.getLayoutInfo(keyBelow1);
|
|
981
981
|
}
|
|
982
982
|
if (layoutInfo) {
|
|
@@ -1006,7 +1006,7 @@ class $5ee605f09afaa4de$export$64943d2e59d72a29 extends (0, $jpY3B$reactstatelyv
|
|
|
1006
1006
|
}
|
|
1007
1007
|
constructor(options = {}){
|
|
1008
1008
|
super();
|
|
1009
|
-
(0, $
|
|
1009
|
+
(0, ($parcel$interopDefault($jpY3B$swchelperslib_define_propertyjs)))(this, "disabledKeys", new Set());
|
|
1010
1010
|
this.layoutInfos = new Map();
|
|
1011
1011
|
this.collator = options.collator;
|
|
1012
1012
|
this.lastCollection = null;
|
|
@@ -1371,24 +1371,24 @@ class $71b727f94b595b1a$export$7d2b12578154a735 extends (0, $5ee605f09afaa4de$ex
|
|
|
1371
1371
|
// 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
|
|
1372
1372
|
// collection contents by that number (which will give us the row distribution)
|
|
1373
1373
|
getKeyBelow(key) {
|
|
1374
|
-
var
|
|
1374
|
+
var _this_collection_rows_indexRowBelow;
|
|
1375
1375
|
// Expected key is the currently focused cell so we need the parent row key
|
|
1376
1376
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1377
1377
|
let indexRowBelow;
|
|
1378
1378
|
let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey);
|
|
1379
1379
|
if (index !== -1) indexRowBelow = index + this.numColumns;
|
|
1380
1380
|
else return null;
|
|
1381
|
-
return ((
|
|
1381
|
+
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;
|
|
1382
1382
|
}
|
|
1383
1383
|
getKeyAbove(key) {
|
|
1384
|
-
var
|
|
1384
|
+
var _this_collection_rows_indexRowAbove;
|
|
1385
1385
|
// Expected key is the currently focused cell so we need the parent row key
|
|
1386
1386
|
let parentRowKey = this.collection.getItem(key).parentKey;
|
|
1387
1387
|
let indexRowAbove;
|
|
1388
1388
|
let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey);
|
|
1389
1389
|
if (index !== -1) indexRowAbove = index - this.numColumns;
|
|
1390
1390
|
else return null;
|
|
1391
|
-
return ((
|
|
1391
|
+
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;
|
|
1392
1392
|
}
|
|
1393
1393
|
constructor(options = {}){
|
|
1394
1394
|
super(options);
|
|
@@ -1520,33 +1520,33 @@ class $632abf8fbf0ad57b$export$e9f7cda058ba8df8 extends (0, $5ee605f09afaa4de$ex
|
|
|
1520
1520
|
return minIndex;
|
|
1521
1521
|
}
|
|
1522
1522
|
getClosestRight(key) {
|
|
1523
|
-
var
|
|
1523
|
+
var _this__findClosest, _this_collection_getItem_childNodes_, _this_collection_getItem;
|
|
1524
1524
|
let layoutInfo = this.getLayoutInfo(key);
|
|
1525
1525
|
// Refactored from v2. Current strategy is to find the closest card in the adjacent column.
|
|
1526
1526
|
// 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
|
|
1527
1527
|
// and thus the top corner to top corner distance was massive.
|
|
1528
1528
|
// 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
|
|
1529
1529
|
let rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
|
|
1530
|
-
key = (
|
|
1530
|
+
key = (_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key;
|
|
1531
1531
|
if (!key) {
|
|
1532
|
-
var
|
|
1532
|
+
var _this__findClosest1;
|
|
1533
1533
|
rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
|
|
1534
|
-
key = (
|
|
1534
|
+
key = (_this__findClosest1 = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest1 === void 0 ? void 0 : _this__findClosest1.key;
|
|
1535
1535
|
}
|
|
1536
|
-
return (
|
|
1536
|
+
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;
|
|
1537
1537
|
}
|
|
1538
1538
|
getClosestLeft(key) {
|
|
1539
|
-
var
|
|
1539
|
+
var _this__findClosest, _this_collection_getItem_childNodes_, _this_collection_getItem;
|
|
1540
1540
|
let layoutInfo = this.getLayoutInfo(key);
|
|
1541
1541
|
// 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
|
|
1542
1542
|
let rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
|
|
1543
|
-
key = (
|
|
1543
|
+
key = (_this__findClosest = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest === void 0 ? void 0 : _this__findClosest.key;
|
|
1544
1544
|
if (!key) {
|
|
1545
|
-
var
|
|
1545
|
+
var _this__findClosest1;
|
|
1546
1546
|
rect = new (0, $jpY3B$reactstatelyvirtualizer.Rect)(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
|
|
1547
|
-
key = (
|
|
1547
|
+
key = (_this__findClosest1 = this._findClosest(layoutInfo.rect, rect)) === null || _this__findClosest1 === void 0 ? void 0 : _this__findClosest1.key;
|
|
1548
1548
|
}
|
|
1549
|
-
return (
|
|
1549
|
+
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;
|
|
1550
1550
|
}
|
|
1551
1551
|
getKeyRightOf(key) {
|
|
1552
1552
|
// Expected key is the currently focused cell so we need the parent row key
|