@react-spectrum/card 3.0.0-alpha.19 → 3.0.0-alpha.20
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 +56 -56
- package/dist/main.js +56 -56
- package/dist/main.js.map +1 -1
- package/dist/module.js +56 -56
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/CardBase.tsx +1 -2
- package/src/CardView.tsx +7 -4
package/dist/module.js
CHANGED
|
@@ -13,7 +13,6 @@ import {Checkbox as $8EWFi$Checkbox} from "@react-spectrum/checkbox";
|
|
|
13
13
|
import {getFocusableTreeWalker as $8EWFi$getFocusableTreeWalker, FocusRing as $8EWFi$FocusRing} from "@react-aria/focus";
|
|
14
14
|
import {useHover as $8EWFi$useHover, useFocusWithin as $8EWFi$useFocusWithin} from "@react-aria/interactions";
|
|
15
15
|
import {Size as $8EWFi$Size, Rect as $8EWFi$Rect, LayoutInfo as $8EWFi$LayoutInfo, Layout as $8EWFi$Layout} from "@react-stately/virtualizer";
|
|
16
|
-
import $8EWFi$swchelperssrc_define_propertymjs from "@swc/helpers/src/_define_property.mjs";
|
|
17
16
|
import {getFirstItem as $8EWFi$getFirstItem, getChildNodes as $8EWFi$getChildNodes} from "@react-stately/collections";
|
|
18
17
|
|
|
19
18
|
function $parcel$interopDefault(a) {
|
|
@@ -58,7 +57,6 @@ function $parcel$export(e, n, v, s) {
|
|
|
58
57
|
|
|
59
58
|
|
|
60
59
|
|
|
61
|
-
|
|
62
60
|
var $408a78e5068502c2$exports = {};
|
|
63
61
|
|
|
64
62
|
$parcel$export($408a78e5068502c2$exports, "spectrum-Card", () => $408a78e5068502c2$export$4e5e9f191b1edb8, (v) => $408a78e5068502c2$export$4e5e9f191b1edb8 = v);
|
|
@@ -332,7 +330,7 @@ function $643dd8fa80926f94$var$useCard(props) {
|
|
|
332
330
|
|
|
333
331
|
|
|
334
332
|
|
|
335
|
-
var $
|
|
333
|
+
var $49aba923a95704ba$exports = {};
|
|
336
334
|
var $6cb102354c06de53$exports = {};
|
|
337
335
|
$6cb102354c06de53$exports = {
|
|
338
336
|
"loading": `جارٍ التحميل...`,
|
|
@@ -571,7 +569,7 @@ $b7e2865acb74a940$exports = {
|
|
|
571
569
|
};
|
|
572
570
|
|
|
573
571
|
|
|
574
|
-
$
|
|
572
|
+
$49aba923a95704ba$exports = {
|
|
575
573
|
"ar-AE": $6cb102354c06de53$exports,
|
|
576
574
|
"bg-BG": $17b8c838d83f13fc$exports,
|
|
577
575
|
"cs-CZ": $1ddb4e1a3e8b15a5$exports,
|
|
@@ -639,7 +637,7 @@ function $81a52da995c19652$var$CardView(props, ref) {
|
|
|
639
637
|
scale
|
|
640
638
|
]);
|
|
641
639
|
let layoutType = cardViewLayout.layoutType;
|
|
642
|
-
let stringFormatter = (0, $8EWFi$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($
|
|
640
|
+
let stringFormatter = (0, $8EWFi$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($49aba923a95704ba$exports))));
|
|
643
641
|
let { direction: direction } = (0, $8EWFi$useLocale)();
|
|
644
642
|
let { collection: collection } = (0, $8EWFi$useListState)(props);
|
|
645
643
|
let gridCollection = (0, $8EWFi$useMemo)(()=>new (0, $8EWFi$GridCollection)({
|
|
@@ -681,11 +679,14 @@ function $81a52da995c19652$var$CardView(props, ref) {
|
|
|
681
679
|
isVirtualized: true,
|
|
682
680
|
keyboardDelegate: cardViewLayout
|
|
683
681
|
}, state, domRef);
|
|
684
|
-
let renderWrapper = (parent, reusableView)
|
|
682
|
+
let renderWrapper = (parent, reusableView)=>{
|
|
683
|
+
/*#__PURE__*/ return (0, $8EWFi$react).createElement((0, $8EWFi$VirtualizerItem), {
|
|
685
684
|
key: reusableView.key,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
685
|
+
layoutInfo: reusableView.layoutInfo,
|
|
686
|
+
virtualizer: reusableView.virtualizer,
|
|
687
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
688
|
+
}, reusableView.rendered);
|
|
689
|
+
};
|
|
689
690
|
let focusedKey = state.selectionManager.focusedKey;
|
|
690
691
|
let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
|
|
691
692
|
if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
|
|
@@ -820,7 +821,6 @@ function $81a52da995c19652$var$InternalCard(props) {
|
|
|
820
821
|
* governing permissions and limitations under the License.
|
|
821
822
|
*/
|
|
822
823
|
|
|
823
|
-
|
|
824
824
|
class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
|
|
825
825
|
validate(invalidationContext) {
|
|
826
826
|
this.collection = this.virtualizer.collection;
|
|
@@ -950,13 +950,13 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
|
|
|
950
950
|
if (layoutInfo && layoutInfo.rect.y > pageY) while(layoutInfo && layoutInfo.rect.y > pageY){
|
|
951
951
|
var _getFirstItem, _this_collection_getItem1;
|
|
952
952
|
let childKey = (_getFirstItem = (0, $8EWFi$getFirstItem)((0, $8EWFi$getChildNodes)(this.collection.getItem(layoutInfo.key), this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key;
|
|
953
|
-
let
|
|
954
|
-
layoutInfo = this.getLayoutInfo(
|
|
953
|
+
let keyAbove = (_this_collection_getItem1 = this.collection.getItem(this.getKeyAbove(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
|
|
954
|
+
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
955
955
|
}
|
|
956
956
|
if (layoutInfo) {
|
|
957
957
|
var _getFirstItem1;
|
|
958
|
-
let
|
|
959
|
-
return
|
|
958
|
+
let childKey = (_getFirstItem1 = (0, $8EWFi$getFirstItem)((0, $8EWFi$getChildNodes)(this.collection.getItem(layoutInfo.key), this.collection))) === null || _getFirstItem1 === void 0 ? void 0 : _getFirstItem1.key;
|
|
959
|
+
return childKey;
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
return this.getFirstKey();
|
|
@@ -977,13 +977,13 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
|
|
|
977
977
|
if (layoutInfo && layoutInfo.rect.y < pageY) while(layoutInfo && layoutInfo.rect.y < pageY){
|
|
978
978
|
var _getFirstItem, _this_collection_getItem1;
|
|
979
979
|
let childKey = (_getFirstItem = (0, $8EWFi$getFirstItem)((0, $8EWFi$getChildNodes)(this.collection.getItem(layoutInfo.key), this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key;
|
|
980
|
-
let
|
|
981
|
-
layoutInfo = this.getLayoutInfo(
|
|
980
|
+
let keyBelow = (_this_collection_getItem1 = this.collection.getItem(this.getKeyBelow(childKey))) === null || _this_collection_getItem1 === void 0 ? void 0 : _this_collection_getItem1.parentKey;
|
|
981
|
+
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
982
982
|
}
|
|
983
983
|
if (layoutInfo) {
|
|
984
984
|
var _getFirstItem1;
|
|
985
|
-
let
|
|
986
|
-
return
|
|
985
|
+
let childKey = (_getFirstItem1 = (0, $8EWFi$getFirstItem)((0, $8EWFi$getChildNodes)(this.collection.getItem(layoutInfo.key), this.collection))) === null || _getFirstItem1 === void 0 ? void 0 : _getFirstItem1.key;
|
|
986
|
+
return childKey;
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
return this.getLastKey();
|
|
@@ -1007,7 +1007,7 @@ class $3d424c147206bac9$export$64943d2e59d72a29 extends (0, $8EWFi$Layout) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
constructor(options = {}){
|
|
1009
1009
|
super();
|
|
1010
|
-
|
|
1010
|
+
this.disabledKeys = new Set();
|
|
1011
1011
|
this.layoutInfos = new Map();
|
|
1012
1012
|
this.collator = options.collator;
|
|
1013
1013
|
this.lastCollection = null;
|
|
@@ -1122,23 +1122,23 @@ class $c0ba81539c443916$export$8e52095834484b61 extends (0, $3d424c147206bac9$ex
|
|
|
1122
1122
|
let x = this.margin;
|
|
1123
1123
|
// if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
|
|
1124
1124
|
let widths = [];
|
|
1125
|
-
for(let
|
|
1126
|
-
let width = Math.round(bestRowHeight * ratios[
|
|
1125
|
+
for(let j = index; j < index + row.length; j++){
|
|
1126
|
+
let width = Math.round(bestRowHeight * ratios[j]);
|
|
1127
1127
|
widths.push([
|
|
1128
|
-
|
|
1128
|
+
j - index,
|
|
1129
1129
|
width
|
|
1130
1130
|
]);
|
|
1131
1131
|
}
|
|
1132
1132
|
this._distributeWidths(widths);
|
|
1133
1133
|
// Create items for this row.
|
|
1134
|
-
for(let
|
|
1135
|
-
let
|
|
1136
|
-
let
|
|
1137
|
-
let rect = new (0, $8EWFi$Rect)(x, y,
|
|
1138
|
-
let layoutInfo = new (0, $8EWFi$LayoutInfo)(
|
|
1134
|
+
for(let j = index; j < index + row.length; j++){
|
|
1135
|
+
let node = this.collection.rows[j];
|
|
1136
|
+
let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
|
|
1137
|
+
let rect = new (0, $8EWFi$Rect)(x, y, itemWidth, itemHeight);
|
|
1138
|
+
let layoutInfo = new (0, $8EWFi$LayoutInfo)(node.type, node.key, rect);
|
|
1139
1139
|
layoutInfo.allowOverflow = true;
|
|
1140
|
-
this.layoutInfos.set(
|
|
1141
|
-
x +=
|
|
1140
|
+
this.layoutInfos.set(node.key, layoutInfo);
|
|
1141
|
+
x += itemWidth + this.itemSpacing.width;
|
|
1142
1142
|
}
|
|
1143
1143
|
y += itemHeight + this.itemSpacing.height;
|
|
1144
1144
|
index += row.length;
|
|
@@ -1152,14 +1152,14 @@ class $c0ba81539c443916$export$8e52095834484b61 extends (0, $3d424c147206bac9$ex
|
|
|
1152
1152
|
loaderY = 0;
|
|
1153
1153
|
loaderHeight = visibleHeight || 60;
|
|
1154
1154
|
}
|
|
1155
|
-
let
|
|
1156
|
-
let loader = new (0, $8EWFi$LayoutInfo)("loader", "loader",
|
|
1155
|
+
let rect = new (0, $8EWFi$Rect)(0, loaderY, visibleWidth, loaderHeight);
|
|
1156
|
+
let loader = new (0, $8EWFi$LayoutInfo)("loader", "loader", rect);
|
|
1157
1157
|
this.layoutInfos.set("loader", loader);
|
|
1158
1158
|
y = loader.rect.maxY;
|
|
1159
1159
|
}
|
|
1160
1160
|
if (this.collection.size === 0 && !this.isLoading) {
|
|
1161
|
-
let
|
|
1162
|
-
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder",
|
|
1161
|
+
let rect = new (0, $8EWFi$Rect)(0, 0, visibleWidth, visibleHeight);
|
|
1162
|
+
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder", rect);
|
|
1163
1163
|
this.layoutInfos.set("placeholder", placeholder);
|
|
1164
1164
|
y = placeholder.rect.maxY;
|
|
1165
1165
|
}
|
|
@@ -1190,21 +1190,21 @@ function $c0ba81539c443916$var$linearPartition(seq, k) {
|
|
|
1190
1190
|
let table = Array(n).fill(0).map(()=>Array(k).fill(0));
|
|
1191
1191
|
let solution = Array(n - 1).fill(0).map(()=>Array(k - 1).fill(0));
|
|
1192
1192
|
for(let i = 0; i < n; i++)table[i][0] = seq[i] + (i > 0 ? table[i - 1][0] : 0);
|
|
1193
|
-
for(let
|
|
1194
|
-
for(let
|
|
1193
|
+
for(let i = 0; i < k; i++)table[0][i] = seq[0];
|
|
1194
|
+
for(let i = 1; i < n; i++)for(let j = 1; j < k; j++){
|
|
1195
1195
|
let currentMin = 0;
|
|
1196
1196
|
let minX = Infinity;
|
|
1197
|
-
for(let x = 0; x <
|
|
1197
|
+
for(let x = 0; x < i; x++){
|
|
1198
1198
|
let c1 = table[x][j - 1];
|
|
1199
|
-
let c2 = table[
|
|
1199
|
+
let c2 = table[i][0] - table[x][0];
|
|
1200
1200
|
let cost = Math.max(c1, c2);
|
|
1201
1201
|
if (!x || cost < currentMin) {
|
|
1202
1202
|
currentMin = cost;
|
|
1203
1203
|
minX = x;
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
|
-
table[
|
|
1207
|
-
solution[
|
|
1206
|
+
table[i][j] = currentMin;
|
|
1207
|
+
solution[i - 1][j - 1] = minX;
|
|
1208
1208
|
}
|
|
1209
1209
|
n = n - 1;
|
|
1210
1210
|
k = k - 2;
|
|
@@ -1212,15 +1212,15 @@ function $c0ba81539c443916$var$linearPartition(seq, k) {
|
|
|
1212
1212
|
while(k >= 0){
|
|
1213
1213
|
if (n >= 1) {
|
|
1214
1214
|
let row = [];
|
|
1215
|
-
for(let
|
|
1215
|
+
for(let i = solution[n - 1][k] + 1; i < n + 1; i++)row.push(seq[i]);
|
|
1216
1216
|
result.unshift(row);
|
|
1217
1217
|
n = solution[n - 1][k];
|
|
1218
1218
|
}
|
|
1219
1219
|
k--;
|
|
1220
1220
|
}
|
|
1221
|
-
let
|
|
1222
|
-
for(let
|
|
1223
|
-
result.unshift(
|
|
1221
|
+
let row = [];
|
|
1222
|
+
for(let i = 0; i < n + 1; i++)row.push(seq[i]);
|
|
1223
|
+
result.unshift(row);
|
|
1224
1224
|
return result;
|
|
1225
1225
|
}
|
|
1226
1226
|
|
|
@@ -1296,8 +1296,8 @@ class $ed42fd44b9b9b664$export$7d2b12578154a735 extends (0, $3d424c147206bac9$ex
|
|
|
1296
1296
|
let lastVisibleItem = this.getIndexAtPoint(rect.maxX, rect.maxY);
|
|
1297
1297
|
for(let index = firstVisibleItem; index <= lastVisibleItem; index++){
|
|
1298
1298
|
let keyFromIndex = this.collection.rows[index].key;
|
|
1299
|
-
let
|
|
1300
|
-
if (
|
|
1299
|
+
let layoutInfo = this.layoutInfos.get(keyFromIndex);
|
|
1300
|
+
if (layoutInfo && this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
|
|
1301
1301
|
}
|
|
1302
1302
|
// Check if loader is in view and add to res if so
|
|
1303
1303
|
let loader = this.layoutInfos.get("loader");
|
|
@@ -1350,8 +1350,8 @@ class $ed42fd44b9b9b664$export$7d2b12578154a735 extends (0, $3d424c147206bac9$ex
|
|
|
1350
1350
|
y = loader.rect.maxY;
|
|
1351
1351
|
}
|
|
1352
1352
|
if (this.collection.size === 0 && !this.isLoading) {
|
|
1353
|
-
let
|
|
1354
|
-
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder",
|
|
1353
|
+
let rect = new (0, $8EWFi$Rect)(0, 0, visibleWidth, visibleHeight);
|
|
1354
|
+
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder", rect);
|
|
1355
1355
|
this.layoutInfos.set("placeholder", placeholder);
|
|
1356
1356
|
y = placeholder.rect.maxY;
|
|
1357
1357
|
}
|
|
@@ -1482,9 +1482,9 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
|
|
|
1482
1482
|
// Reset all columns to the maximum for the next section
|
|
1483
1483
|
let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;
|
|
1484
1484
|
columnHeights.fill(maxHeight);
|
|
1485
|
-
let
|
|
1485
|
+
let y = columnHeights[0];
|
|
1486
1486
|
if (this.isLoading) {
|
|
1487
|
-
let loaderY =
|
|
1487
|
+
let loaderY = y;
|
|
1488
1488
|
let loaderHeight = 60;
|
|
1489
1489
|
// If there aren't any items, make loader take all avaliable room and remove margin from y calculation
|
|
1490
1490
|
// so it doesn't scroll
|
|
@@ -1492,18 +1492,18 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
|
|
|
1492
1492
|
loaderY = 0;
|
|
1493
1493
|
loaderHeight = this.virtualizer.visibleRect.height || 60;
|
|
1494
1494
|
}
|
|
1495
|
-
let
|
|
1496
|
-
let loader = new (0, $8EWFi$LayoutInfo)("loader", "loader",
|
|
1495
|
+
let rect = new (0, $8EWFi$Rect)(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
|
|
1496
|
+
let loader = new (0, $8EWFi$LayoutInfo)("loader", "loader", rect);
|
|
1497
1497
|
this.layoutInfos.set("loader", loader);
|
|
1498
|
-
|
|
1498
|
+
y = loader.rect.maxY;
|
|
1499
1499
|
}
|
|
1500
1500
|
if (this.collection.size === 0 && !this.isLoading) {
|
|
1501
|
-
let
|
|
1502
|
-
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder",
|
|
1501
|
+
let rect = new (0, $8EWFi$Rect)(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
|
|
1502
|
+
let placeholder = new (0, $8EWFi$LayoutInfo)("placeholder", "placeholder", rect);
|
|
1503
1503
|
this.layoutInfos.set("placeholder", placeholder);
|
|
1504
|
-
|
|
1504
|
+
y = placeholder.rect.maxY;
|
|
1505
1505
|
}
|
|
1506
|
-
this.contentSize = new (0, $8EWFi$Size)(this.virtualizer.visibleRect.width,
|
|
1506
|
+
this.contentSize = new (0, $8EWFi$Size)(this.virtualizer.visibleRect.width, y);
|
|
1507
1507
|
}
|
|
1508
1508
|
updateItemSize(key, size) {
|
|
1509
1509
|
let layoutInfo = this.layoutInfos.get(key);
|