@react-spectrum/card 3.0.0-alpha.0 → 3.0.0-alpha.1

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
@@ -7,9 +7,9 @@ import { ProgressCircle } from "@react-spectrum/progress";
7
7
  import { GridCollection, useGridState } from "@react-stately/grid";
8
8
  import { useProviderProps, useProvider } from "@react-spectrum/provider";
9
9
  import { useFocusWithin, useHover } from "@react-aria/interactions";
10
- import _react, { useMemo, useRef, useState, useContext, forwardRef } from "react";
10
+ import _react, { useCallback, useMemo, useRef, useState, useContext, forwardRef } from "react";
11
11
  import { FocusRing } from "@react-aria/focus";
12
- import { filterDOMProps, mergeProps, useLayoutEffect, useSlotId } from "@react-aria/utils";
12
+ import { filterDOMProps, mergeProps, useLayoutEffect, useResizeObserver, useSlotId } from "@react-aria/utils";
13
13
  import { Divider } from "@react-spectrum/divider";
14
14
  import { classNames, SlotProvider, useDOMRef, useHasChild, useStyleProps, useUnwrapDOMRef } from "@react-spectrum/utils";
15
15
  import { Checkbox } from "@react-spectrum/checkbox";
@@ -51,6 +51,9 @@ $a8414e711d6ad206767a67f293235d49$exports = {
51
51
  "spectrum-Card--gallery": "_spectrum-Card--gallery_dd040",
52
52
  "spectrum-Card--closeToSquare": "_spectrum-Card--closeToSquare_dd040",
53
53
  "spectrum-Card--horizontal": "_spectrum-Card--horizontal_dd040",
54
+ "spectrum-CardView": "_spectrum-CardView_dd040",
55
+ "spectrum-CardView-centeredWrapper": "_spectrum-CardView-centeredWrapper_dd040",
56
+ "spectrum-CardView-row": "_spectrum-CardView-row_dd040",
54
57
  "is-drop-target": "_is-drop-target_dd040"
55
58
  };
56
59
 
@@ -63,8 +66,7 @@ function $f9069c2077073c56c9fbb170659475$export$useCardViewContext() {
63
66
  var $a8414e711d6ad206767a67f293235d49$$interop$default = $parcel$interopDefault($a8414e711d6ad206767a67f293235d49$exports);
64
67
 
65
68
  function $c6a745aa43479b6f54b3654a7597126$var$CardBase(props, ref) {
66
- props = useProviderProps(props); // TODO: Don't send in articleProps via context (unless we want to make another context for InternalCard)? Pass it in via props since it will only be provided via CardView's InternalCard
67
-
69
+ props = useProviderProps(props);
68
70
  let context = $f9069c2077073c56c9fbb170659475$export$useCardViewContext() || {}; // we can call again here, won't change from Card.tsx
69
71
 
70
72
  let {
@@ -115,14 +117,18 @@ function $c6a745aa43479b6f54b3654a7597126$var$CardBase(props, ref) {
115
117
  let hasPreview = hasPreviewImage || hasPreviewIllustration; // this is for horizontal cards
116
118
 
117
119
  let [height, setHeight] = useState(NaN);
118
- useLayoutEffect(() => {
120
+ let updateHeight = useCallback(() => {
119
121
  if (orientation !== 'horizontal') {
120
122
  return;
121
123
  }
122
124
 
123
125
  let cardHeight = gridRef.current.getBoundingClientRect().height;
124
126
  setHeight(cardHeight);
125
- }, [gridRef, setHeight, orientation]);
127
+ }, [orientation, gridRef, setHeight]);
128
+ useResizeObserver({
129
+ ref: gridRef,
130
+ onResize: updateHeight
131
+ });
126
132
  let aspectRatioEnforce = undefined;
127
133
 
128
134
  if (orientation === 'horizontal' && !isNaN(height)) {
@@ -288,13 +294,6 @@ function $c6a745aa43479b6f54b3654a7597126$var$useCard(props) {
288
294
 
289
295
  const $c6a745aa43479b6f54b3654a7597126$export$CardBase = /*#__PURE__*/_react.forwardRef($c6a745aa43479b6f54b3654a7597126$var$CardBase);
290
296
 
291
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/src/cardview.css
292
- var $b608036255d92f62fb59a1e995c612b$exports = {};
293
- $b608036255d92f62fb59a1e995c612b$exports = {
294
- "react-spectrum-CardView-centeredWrapper": "_react-spectrum-CardView-centeredWrapper_0cd7c",
295
- "react-spectrum-CardView-CardWrapper": "_react-spectrum-CardView-CardWrapper_0cd7c",
296
- "react-spectrum-CardView": "_react-spectrum-CardView_0cd7c"
297
- };
298
297
  // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ar-AE.json
299
298
  var $a48fff6baafc14357869c7ba184ba3$exports = {};
300
299
  $a48fff6baafc14357869c7ba184ba3$exports = JSON.parse("{\"loading\":\"جارٍ التحميل...\",\"loadingMore\":\"جارٍ تحميل المزيد...\"}");
@@ -434,7 +433,6 @@ const $e295579aca996ab66b8081d2bb9$var$intlMessages = {
434
433
  "zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($b747d69bc7146092b42e6b9d8758$exports).default,
435
434
  "zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($ea3eb1b4589dd69e29e4f55504e$exports).default
436
435
  };
437
- var $b608036255d92f62fb59a1e995c612b$$interop$default = $parcel$interopDefault($b608036255d92f62fb59a1e995c612b$exports);
438
436
 
439
437
  function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
440
438
  let {
@@ -449,7 +447,8 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
449
447
  renderEmptyState,
450
448
  layout,
451
449
  loadingState,
452
- onLoadMore
450
+ onLoadMore,
451
+ cardOrientation = 'vertical'
453
452
  } = props;
454
453
  let collator = useCollator({
455
454
  usage: 'search',
@@ -457,18 +456,11 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
457
456
  });
458
457
  let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
459
458
  let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({
460
- collator
461
- }) : layout, [layout, collator]);
459
+ collator,
460
+ cardOrientation,
461
+ scale
462
+ }) : layout, [layout, collator, cardOrientation, scale]);
462
463
  let layoutType = cardViewLayout.layoutType;
463
-
464
- if (typeof layout === 'function') {
465
- if (layoutType === 'grid') {
466
- cardViewLayout.itemPadding = scale === 'large' ? 116 : 95;
467
- } else if (layoutType === 'gallery') {
468
- cardViewLayout.itemPadding = scale === 'large' ? 143 : 114;
469
- }
470
- }
471
-
472
464
  let formatMessage = useMessageFormatter($e295579aca996ab66b8081d2bb9$var$intlMessages);
473
465
  let {
474
466
  direction
@@ -493,7 +485,9 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
493
485
  }))
494
486
  }), [collection]);
495
487
  let state = useGridState(_babelRuntimeHelpersEsmExtends({}, props, {
496
- collection: gridCollection
488
+ selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
489
+ collection: gridCollection,
490
+ focusMode: 'cell'
497
491
  }));
498
492
  cardViewLayout.collection = gridCollection;
499
493
  cardViewLayout.disabledKeys = state.disabledKeys;
@@ -507,7 +501,6 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
507
501
  }), state, domRef);
508
502
 
509
503
  let renderWrapper = (parent, reusableView) => /*#__PURE__*/_react.createElement(VirtualizerItem, {
510
- className: classNames($b608036255d92f62fb59a1e995c612b$$interop$default, 'react-spectrum-CardView-CardWrapper'),
511
504
  key: reusableView.key,
512
505
  reusableView: reusableView,
513
506
  parent: parent
@@ -518,17 +511,26 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
518
511
 
519
512
  if ((focusedItem == null ? void 0 : focusedItem.parentKey) != null) {
520
513
  focusedKey = focusedItem.parentKey;
521
- } // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
514
+ }
522
515
 
516
+ let margin = cardViewLayout.margin || 0;
517
+ let virtualizer = cardViewLayout.virtualizer;
518
+ let scrollToItem = useCallback(key => {
519
+ virtualizer && virtualizer.scrollToItem(key, {
520
+ duration: 0,
521
+ offsetY: margin
522
+ });
523
+ }, [margin, virtualizer]); // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
523
524
 
524
525
  return /*#__PURE__*/_react.createElement($f9069c2077073c56c9fbb170659475$export$CardViewContext.Provider, {
525
526
  value: {
526
527
  state,
527
528
  isQuiet,
528
- layout: cardViewLayout
529
+ layout: cardViewLayout,
530
+ cardOrientation
529
531
  }
530
532
  }, /*#__PURE__*/_react.createElement(Virtualizer, _babelRuntimeHelpersEsmExtends({}, gridProps, styleProps, {
531
- className: classNames($b608036255d92f62fb59a1e995c612b$$interop$default, 'react-spectrum-CardView'),
533
+ className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView'),
532
534
  ref: domRef,
533
535
  focusedKey: focusedKey,
534
536
  scrollDirection: "vertical",
@@ -536,7 +538,9 @@ function $e295579aca996ab66b8081d2bb9$var$CardView(props, ref) {
536
538
  collection: gridCollection,
537
539
  isLoading: isLoading,
538
540
  onLoadMore: onLoadMore,
539
- renderWrapper: renderWrapper
541
+ renderWrapper: renderWrapper,
542
+ transitionDuration: isLoading ? 160 : 220,
543
+ scrollToItem: scrollToItem
540
544
  }), (type, item) => {
541
545
  if (type === 'item') {
542
546
  return /*#__PURE__*/_react.createElement($e295579aca996ab66b8081d2bb9$var$InternalCard, {
@@ -569,7 +573,7 @@ function $e295579aca996ab66b8081d2bb9$var$CenteredWrapper(_ref) {
569
573
  return /*#__PURE__*/_react.createElement("div", {
570
574
  role: "row",
571
575
  "aria-rowindex": state.collection.size + 1,
572
- className: classNames($b608036255d92f62fb59a1e995c612b$$interop$default, 'react-spectrum-CardView-centeredWrapper')
576
+ className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView-centeredWrapper')
573
577
  }, /*#__PURE__*/_react.createElement("div", {
574
578
  role: "gridcell"
575
579
  }, children));
@@ -607,11 +611,13 @@ function $e295579aca996ab66b8081d2bb9$var$InternalCard(props) {
607
611
  isQuiet = true;
608
612
  }
609
613
 
614
+ if (layoutType !== 'grid') {
615
+ cardOrientation = 'vertical';
616
+ }
617
+
610
618
  return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, rowProps, {
611
619
  ref: rowRef,
612
- style: {
613
- height: '100%'
614
- }
620
+ className: classNames($a8414e711d6ad206767a67f293235d49$$interop$default, 'spectrum-CardView-row')
615
621
  }), /*#__PURE__*/_react.createElement($c6a745aa43479b6f54b3654a7597126$export$CardBase, {
616
622
  ref: cellRef,
617
623
  articleProps: gridCellProps,
@@ -643,9 +649,13 @@ class $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLayout extends Layout {
643
649
  this.isLoading = void 0;
644
650
  this.disabledKeys = new Set();
645
651
  this.direction = void 0;
652
+ this.scale = void 0;
653
+ this.margin = void 0;
646
654
  this.layoutInfos = new Map();
647
655
  this.collator = options.collator;
648
656
  this.lastCollection = null;
657
+ this.scale = options.scale || 'medium';
658
+ this.margin = options.margin || 24;
649
659
  }
650
660
 
651
661
  validate(invalidationContext) {
@@ -903,14 +913,11 @@ class $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLayout extends Layout {
903
913
 
904
914
  }
905
915
 
906
- // TODO: copied from V2, update this with the proper spectrum values
907
- // Should these be affected by Scale as well?
908
916
  const $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS = {
909
917
  S: {
910
918
  idealRowHeight: 112,
911
919
  minItemSize: new Size(96, 96),
912
920
  itemSpacing: new Size(8, 16),
913
- // TODO: will need to update as well
914
921
  itemPadding: 24,
915
922
  dropSpacing: 50,
916
923
  margin: 8
@@ -919,8 +926,10 @@ const $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS = {
919
926
  idealRowHeight: 208,
920
927
  minItemSize: new Size(136, 136),
921
928
  itemSpacing: new Size(18, 18),
922
- // TODO: updated to work with new v3 cards (there is additional space required for the descriptions if there is a description)
923
- itemPadding: 114,
929
+ itemPadding: {
930
+ 'medium': 114,
931
+ 'large': 143
932
+ },
924
933
  dropSpacing: 100,
925
934
  margin: 24
926
935
  }
@@ -931,10 +940,8 @@ export class GalleryLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Base
931
940
  options = {};
932
941
  }
933
942
 
934
- super(options); // TODO: restore cardSize option when we support different size cards
935
-
943
+ super(options);
936
944
  this.idealRowHeight = void 0;
937
- this.margin = void 0;
938
945
  this.itemSpacing = void 0;
939
946
  this.itemPadding = void 0;
940
947
  this.minItemSize = void 0;
@@ -942,7 +949,7 @@ export class GalleryLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Base
942
949
  let cardSize = 'L';
943
950
  this.idealRowHeight = options.idealRowHeight || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].idealRowHeight;
944
951
  this.itemSpacing = options.itemSpacing || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].itemSpacing;
945
- this.itemPadding = options.itemPadding != null ? options.itemPadding : $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].itemPadding;
952
+ this.itemPadding = options.itemPadding != null ? options.itemPadding : $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.scale];
946
953
  this.minItemSize = options.minItemSize || $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].minItemSize;
947
954
  this.threshold = options.threshold || 1;
948
955
  this.margin = options.margin != null ? options.margin : $e9ed5e9ac7fa3fdf4332ceb63dd0$var$DEFAULT_OPTIONS[cardSize].margin;
@@ -1074,6 +1081,7 @@ export class GalleryLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Base
1074
1081
  let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
1075
1082
  let rect = new Rect(x, y, itemWidth, itemHeight);
1076
1083
  let layoutInfo = new LayoutInfo(node.type, node.key, rect);
1084
+ layoutInfo.allowOverflow = true;
1077
1085
  this.layoutInfos.set(node.key, layoutInfo);
1078
1086
  x += itemWidth + this.itemSpacing.width;
1079
1087
  }
@@ -1186,12 +1194,12 @@ function $e9ed5e9ac7fa3fdf4332ceb63dd0$var$linearPartition(seq, k) {
1186
1194
  return result;
1187
1195
  }
1188
1196
 
1189
- // TODO: copied from V2, update this with the proper spectrum values
1190
- // Should these be affected by Scale as well?
1191
1197
  const $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS = {
1192
1198
  S: {
1193
1199
  itemPadding: 20,
1194
- minItemSize: new Size(96, 96),
1200
+ minItemSize: {
1201
+ 'vertical': new Size(96, 96)
1202
+ },
1195
1203
  maxItemSize: new Size(Infinity, Infinity),
1196
1204
  margin: 8,
1197
1205
  minSpace: new Size(6, 6),
@@ -1199,10 +1207,20 @@ const $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS = {
1199
1207
  dropSpacing: 50
1200
1208
  },
1201
1209
  L: {
1202
- // TODO: for now bumping this higher since the new cards have more stuff in the content area.
1203
- // Will need to ask Spectrum what these values should be. Used to be 52. Do the same for S above
1204
- itemPadding: 95,
1205
- minItemSize: new Size(208, 208),
1210
+ itemPadding: {
1211
+ 'vertical': {
1212
+ 'medium': 78,
1213
+ 'large': 98
1214
+ },
1215
+ 'horizontal': {
1216
+ 'medium': 150,
1217
+ 'large': 170
1218
+ }
1219
+ },
1220
+ minItemSize: {
1221
+ 'vertical': new Size(208, 208),
1222
+ 'horizontal': new Size(102, 102)
1223
+ },
1206
1224
  maxItemSize: new Size(Infinity, Infinity),
1207
1225
  margin: 24,
1208
1226
  minSpace: new Size(18, 18),
@@ -1216,25 +1234,25 @@ export class GridLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLay
1216
1234
  options = {};
1217
1235
  }
1218
1236
 
1219
- super(options); // TODO: restore cardSize option when we support different size cards
1220
-
1237
+ super(options);
1221
1238
  this.minItemSize = void 0;
1222
1239
  this.maxItemSize = void 0;
1223
- this.margin = void 0;
1224
1240
  this.minSpace = void 0;
1225
1241
  this.maxColumns = void 0;
1226
1242
  this.itemPadding = void 0;
1243
+ this.cardOrientation = void 0;
1227
1244
  this.itemSize = void 0;
1228
1245
  this.numColumns = void 0;
1229
1246
  this.numRows = void 0;
1230
1247
  this.horizontalSpacing = void 0;
1231
1248
  let cardSize = 'L';
1232
- this.minItemSize = options.minItemSize || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].minItemSize;
1249
+ this.cardOrientation = options.cardOrientation || 'vertical';
1250
+ this.minItemSize = options.minItemSize || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];
1233
1251
  this.maxItemSize = options.maxItemSize || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].maxItemSize;
1234
1252
  this.margin = options.margin != null ? options.margin : $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].margin;
1235
1253
  this.minSpace = options.minSpace || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].minSpace;
1236
1254
  this.maxColumns = options.maxColumns || $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].maxColumns;
1237
- this.itemPadding = options.itemPadding != null ? options.itemPadding : $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].itemPadding;
1255
+ this.itemPadding = options.itemPadding != null ? options.itemPadding : $e001599dfc5221c58c4d9b2f5f1b9bd$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];
1238
1256
  this.itemSize = null;
1239
1257
  this.numColumns = 0;
1240
1258
  this.numRows = 0;
@@ -1243,8 +1261,7 @@ export class GridLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLay
1243
1261
 
1244
1262
  get layoutType() {
1245
1263
  return 'grid';
1246
- } // TODO: Below functions From V2 Maybe don't need this? Might be a short cut for getting all visible rects since otherwise we'd have to iterate across all nodes
1247
-
1264
+ }
1248
1265
 
1249
1266
  getIndexAtPoint(x, y, allowInsertingAtEnd) {
1250
1267
  if (allowInsertingAtEnd === void 0) {
@@ -1279,7 +1296,7 @@ export class GridLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLay
1279
1296
  let keyFromIndex = this.collection.rows[index].key;
1280
1297
  let layoutInfo = this.layoutInfos.get(keyFromIndex);
1281
1298
 
1282
- if (this.isVisible(layoutInfo, rect)) {
1299
+ if (layoutInfo && this.isVisible(layoutInfo, rect)) {
1283
1300
  res.push(layoutInfo);
1284
1301
  }
1285
1302
  } // Check if loader is in view and add to res if so
@@ -1297,21 +1314,24 @@ export class GridLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLay
1297
1314
 
1298
1315
  buildCollection() {
1299
1316
  let visibleWidth = this.virtualizer.visibleRect.width;
1300
- let visibleHeight = this.virtualizer.visibleRect.height; // Compute the number of rows and columns needed to display the content
1317
+ let visibleHeight = this.virtualizer.visibleRect.height;
1318
+ let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;
1319
+ let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;
1320
+ let minCardWidth = this.minItemSize.width + horizontalItemPadding; // Compute the number of rows and columns needed to display the content
1301
1321
 
1302
1322
  let availableWidth = visibleWidth - this.margin * 2;
1303
- let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));
1323
+ let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));
1304
1324
  this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
1305
1325
  this.numRows = Math.ceil(this.collection.size / this.numColumns); // Compute the available width (minus the space between items)
1306
1326
 
1307
1327
  let width = availableWidth - this.minSpace.width * Math.max(0, this.numColumns - 1); // Compute the item width based on the space available
1308
1328
 
1309
1329
  let itemWidth = Math.floor(width / this.numColumns);
1310
- itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth)); // Compute the item height, which is proportional to the item width
1330
+ itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth)); // Compute the item height, which is proportional to the item width
1311
1331
 
1312
- let t = (itemWidth - this.minItemSize.width) / this.minItemSize.width;
1313
- let itemHeight = this.minItemSize.height + this.minItemSize.height * t;
1314
- itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + this.itemPadding;
1332
+ let t = (itemWidth - minCardWidth) / minCardWidth;
1333
+ let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);
1334
+ itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;
1315
1335
  this.itemSize = new Size(itemWidth, itemHeight); // Compute the horizontal spacing and content height
1316
1336
 
1317
1337
  this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));
@@ -1358,6 +1378,7 @@ export class GridLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$BaseLay
1358
1378
  let rect = new Rect(x, y, this.itemSize.width, this.itemSize.height); // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?
1359
1379
 
1360
1380
  let layoutInfo = new LayoutInfo(node.type, node.key, rect);
1381
+ layoutInfo.allowOverflow = true;
1361
1382
  this.layoutInfos.set(node.key, layoutInfo);
1362
1383
  return layoutInfo;
1363
1384
  } // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,
@@ -1412,7 +1433,6 @@ export class WaterfallLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Ba
1412
1433
  super(options);
1413
1434
  this.minItemSize = void 0;
1414
1435
  this.maxItemSize = void 0;
1415
- this.margin = void 0;
1416
1436
  this.minSpace = void 0;
1417
1437
  this.maxColumns = void 0;
1418
1438
  this.itemPadding = void 0;
@@ -1482,6 +1502,7 @@ export class WaterfallLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Ba
1482
1502
  let rect = new Rect(x, y, itemWidth, height);
1483
1503
  let layoutInfo = new LayoutInfo(node.type, key, rect);
1484
1504
  layoutInfo.estimatedSize = estimatedSize;
1505
+ layoutInfo.allowOverflow = true;
1485
1506
  this.layoutInfos.set(key, layoutInfo); // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?
1486
1507
  // Removing it from v2 doesn't seem to do anything?
1487
1508
  // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {
@@ -1489,8 +1510,7 @@ export class WaterfallLayout extends $aae6c2773b778a15b92f7e7612b9cfc5$export$Ba
1489
1510
  // }
1490
1511
 
1491
1512
  columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;
1492
- } // Reset all columns to the maximum for the next section
1493
-
1513
+ }
1494
1514
 
1495
1515
  let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;
1496
1516
  columnHeights.fill(maxHeight);