@react-spectrum/card 3.0.0-alpha.32 → 3.0.0-alpha.34

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.
Files changed (83) hide show
  1. package/dist/BaseLayout.main.js +21 -26
  2. package/dist/BaseLayout.main.js.map +1 -1
  3. package/dist/BaseLayout.mjs +22 -27
  4. package/dist/BaseLayout.module.js +21 -26
  5. package/dist/BaseLayout.module.js.map +1 -1
  6. package/dist/Card.main.js +2 -2
  7. package/dist/Card.mjs +3 -3
  8. package/dist/Card.module.js +2 -2
  9. package/dist/CardBase.main.js +37 -37
  10. package/dist/CardBase.main.js.map +1 -1
  11. package/dist/CardBase.mjs +38 -38
  12. package/dist/CardBase.module.js +37 -37
  13. package/dist/CardBase.module.js.map +1 -1
  14. package/dist/CardView.main.js +56 -48
  15. package/dist/CardView.main.js.map +1 -1
  16. package/dist/CardView.mjs +58 -50
  17. package/dist/CardView.module.js +57 -49
  18. package/dist/CardView.module.js.map +1 -1
  19. package/dist/CardViewContext.mjs +1 -1
  20. package/dist/GalleryLayout.main.js +10 -10
  21. package/dist/GalleryLayout.main.js.map +1 -1
  22. package/dist/GalleryLayout.mjs +11 -11
  23. package/dist/GalleryLayout.module.js +10 -10
  24. package/dist/GalleryLayout.module.js.map +1 -1
  25. package/dist/GridLayout.main.js +18 -42
  26. package/dist/GridLayout.main.js.map +1 -1
  27. package/dist/GridLayout.mjs +19 -43
  28. package/dist/GridLayout.module.js +18 -42
  29. package/dist/GridLayout.module.js.map +1 -1
  30. package/dist/WaterfallLayout.main.js +7 -7
  31. package/dist/WaterfallLayout.main.js.map +1 -1
  32. package/dist/WaterfallLayout.mjs +8 -8
  33. package/dist/WaterfallLayout.module.js +7 -7
  34. package/dist/WaterfallLayout.module.js.map +1 -1
  35. package/dist/ar-AE.mjs +1 -1
  36. package/dist/bg-BG.mjs +1 -1
  37. package/dist/card_vars_css.mjs +1 -1
  38. package/dist/cs-CZ.mjs +1 -1
  39. package/dist/da-DK.mjs +1 -1
  40. package/dist/de-DE.mjs +1 -1
  41. package/dist/el-GR.mjs +1 -1
  42. package/dist/en-US.mjs +1 -1
  43. package/dist/es-ES.mjs +1 -1
  44. package/dist/et-EE.mjs +1 -1
  45. package/dist/fi-FI.mjs +1 -1
  46. package/dist/fr-FR.mjs +1 -1
  47. package/dist/he-IL.mjs +1 -1
  48. package/dist/hr-HR.mjs +1 -1
  49. package/dist/hu-HU.mjs +1 -1
  50. package/dist/intlStrings.mjs +1 -1
  51. package/dist/it-IT.mjs +1 -1
  52. package/dist/ja-JP.mjs +1 -1
  53. package/dist/ko-KR.mjs +1 -1
  54. package/dist/lt-LT.mjs +1 -1
  55. package/dist/lv-LV.mjs +1 -1
  56. package/dist/nb-NO.mjs +1 -1
  57. package/dist/nl-NL.mjs +1 -1
  58. package/dist/pl-PL.mjs +1 -1
  59. package/dist/pt-BR.mjs +1 -1
  60. package/dist/pt-PT.mjs +1 -1
  61. package/dist/ro-RO.mjs +1 -1
  62. package/dist/ru-RU.mjs +1 -1
  63. package/dist/sk-SK.mjs +1 -1
  64. package/dist/sl-SI.mjs +1 -1
  65. package/dist/sr-SP.mjs +1 -1
  66. package/dist/sv-SE.mjs +1 -1
  67. package/dist/tr-TR.mjs +1 -1
  68. package/dist/types.d.ts +12 -11
  69. package/dist/types.d.ts.map +1 -1
  70. package/dist/uk-UA.mjs +1 -1
  71. package/dist/zh-CN.mjs +1 -1
  72. package/dist/zh-TW.main.js +1 -1
  73. package/dist/zh-TW.main.js.map +1 -1
  74. package/dist/zh-TW.mjs +2 -2
  75. package/dist/zh-TW.module.js +1 -1
  76. package/dist/zh-TW.module.js.map +1 -1
  77. package/package.json +20 -20
  78. package/src/BaseLayout.tsx +22 -19
  79. package/src/CardBase.tsx +1 -1
  80. package/src/CardView.tsx +42 -38
  81. package/src/GalleryLayout.tsx +2 -2
  82. package/src/GridLayout.tsx +0 -35
  83. package/src/WaterfallLayout.tsx +2 -2
@@ -23,7 +23,7 @@ $parcel$export(module.exports, "WaterfallLayout", () => $632abf8fbf0ad57b$export
23
23
 
24
24
  class $632abf8fbf0ad57b$export$e9f7cda058ba8df8 extends (0, $5ee605f09afaa4de$exports.BaseLayout) {
25
25
  get layoutType() {
26
- return "waterfall";
26
+ return 'waterfall';
27
27
  }
28
28
  buildCollection(invalidationContext) {
29
29
  // Compute the number of columns needed to display the content
@@ -89,14 +89,14 @@ class $632abf8fbf0ad57b$export$e9f7cda058ba8df8 extends (0, $5ee605f09afaa4de$ex
89
89
  loaderHeight = this.virtualizer.visibleRect.height || 60;
90
90
  }
91
91
  let rect = new (0, $eKgYB$reactstatelyvirtualizer.Rect)(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
92
- let loader = new (0, $eKgYB$reactstatelyvirtualizer.LayoutInfo)("loader", "loader", rect);
93
- this.layoutInfos.set("loader", loader);
92
+ let loader = new (0, $eKgYB$reactstatelyvirtualizer.LayoutInfo)('loader', 'loader', rect);
93
+ this.layoutInfos.set('loader', loader);
94
94
  y = loader.rect.maxY;
95
95
  }
96
96
  if (this.collection.size === 0 && !this.isLoading) {
97
97
  let rect = new (0, $eKgYB$reactstatelyvirtualizer.Rect)(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
98
- let placeholder = new (0, $eKgYB$reactstatelyvirtualizer.LayoutInfo)("placeholder", "placeholder", rect);
99
- this.layoutInfos.set("placeholder", placeholder);
98
+ let placeholder = new (0, $eKgYB$reactstatelyvirtualizer.LayoutInfo)('placeholder', 'placeholder', rect);
99
+ this.layoutInfos.set('placeholder', placeholder);
100
100
  y = placeholder.rect.maxY;
101
101
  }
102
102
  this.contentSize = new (0, $eKgYB$reactstatelyvirtualizer.Size)(this.virtualizer.visibleRect.width, y);
@@ -154,12 +154,12 @@ class $632abf8fbf0ad57b$export$e9f7cda058ba8df8 extends (0, $5ee605f09afaa4de$ex
154
154
  getKeyRightOf(key) {
155
155
  // Expected key is the currently focused cell so we need the parent row key
156
156
  let parentRowKey = this.collection.getItem(key).parentKey;
157
- return this.direction === "rtl" ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
157
+ return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
158
158
  }
159
159
  getKeyLeftOf(key) {
160
160
  // Expected key is the currently focused cell so we need the parent row key
161
161
  let parentRowKey = this.collection.getItem(key).parentKey;
162
- return this.direction === "rtl" ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
162
+ return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
163
163
  }
164
164
  constructor(options = {}){
165
165
  // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,MAAM,kDAA2B,CAAA,GAAA,oCAAS;IA0B/C,IAAI,aAAa;QACf,OAAO;IACT;IAEA,gBAAgB,mBAA0D,EAAE;QAC1E,8DAA8D;QAC9D,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK;QACrD,IAAI,iBAAiB,eAAe,IAAI,CAAC,MAAM,GAAG;QAClD,IAAI,UAAU,KAAK,KAAK,CAAC,AAAC,CAAA,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD,IAAM,CAAA,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD;QAC9G,IAAI,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE;QAGxD,8DAA8D;QAC9D,IAAI,QAAQ,iBAAkB,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAI,CAAA,IAAI,CAAC,UAAU,GAAG,CAAA;QAEvE,sDAAsD;QACtD,IAAI,YAAY,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC,UAAU;Q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AAM,GAAG,QAAQ,MAAM,IAAI,OAAO,QAAQ,MAAM,GAAG;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ,IAAI,IAAI,CAAA,GAAA,mCAAG,EAAE,IAAI;QACjD,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI;QAExC,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,UAAU,GAAG;QAElB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ;IAClC;AA8KF","sources":["packages/@react-spectrum/card/src/WaterfallLayout.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseLayout, BaseLayoutOptions} from './BaseLayout';\nimport {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {InvalidationContext, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\nimport {Key, KeyboardDelegate, Node} from '@react-types/shared';\n\nexport interface WaterfallLayoutOptions extends BaseLayoutOptions {\n /**\n * The minimum item size.\n * @default 240 x 136\n */\n minItemSize?: Size,\n /**\n * The maximum item size.\n * @default Infinity\n */\n maxItemSize?: Size,\n /**\n * The minimum space required between items.\n * @default 18 x 18\n */\n minSpace?: Size,\n /**\n * The maximum number of columns.\n * @default Infinity\n */\n maxColumns?: number\n}\n\n// TODO: this didn't have any options that varied with card size, should it have?\nexport class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegate {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n protected numColumns: number;\n protected itemWidth: number;\n protected horizontalSpacing: number;\n\n constructor(options: WaterfallLayoutOptions = {}) {\n // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify\n // minItemSize defaults or other things\n super(options);\n this.minItemSize = options.minItemSize || new Size(240, 136);\n this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);\n this.margin = options.margin != null ? options.margin : 24;\n this.minSpace = options.minSpace || new Size(18, 18);\n this.maxColumns = options.maxColumns || Infinity;\n\n this.itemWidth = 0;\n this.numColumns = 0;\n\n this.lastCollection = null;\n this.collator = options.collator;\n }\n\n get layoutType() {\n return 'waterfall';\n }\n\n buildCollection(invalidationContext: InvalidationContext<Node<T>, unknown>) {\n // Compute the number of columns needed to display the content\n let visibleWidth = this.virtualizer.visibleRect.width;\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * (this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.round(width / this.numColumns);\n itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));\n this.itemWidth = itemWidth;\n\n // Compute the horizontal spacing\n // if only one column, we cannot divide by zero, so set it to 1\n let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));\n this.horizontalSpacing = horizontalSpacing;\n\n // Setup an array of column heights\n let columnHeights = Array(this.numColumns).fill(this.margin);\n for (let node of this.collection) {\n let key = node.key;\n // Compute the height of the item. Use the existing height if available,\n // otherwise call the delegate to estimate the size.\n let oldLayoutInfo = this.layoutInfos.get(key);\n let height;\n let estimatedSize = true;\n if (oldLayoutInfo) {\n height = oldLayoutInfo.rect.height;\n estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;\n } else if (node.props.width && node.props.height) {\n let nodeWidth = node.props.width;\n let nodeHeight = node.props.height;\n let scaledHeight = Math.round(nodeHeight * ((itemWidth) / nodeWidth));\n height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));\n } else {\n height = itemWidth;\n }\n\n // Figure out which column to place the item in, and compute its position.\n let column = this.getNextColumnIndex(columnHeights);\n let x = this.margin + column * (itemWidth + horizontalSpacing);\n let y = columnHeights[column];\n\n let rect = new Rect(x, y, itemWidth, height);\n let layoutInfo = new LayoutInfo(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(key, layoutInfo);\n\n // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?\n // Removing it from v2 doesn't seem to do anything?\n // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {\n // this.updateItemSize(new IndexPath(section, i));\n // }\n\n columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;\n }\n\n // Reset all columns to the maximum for the next section\n let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;\n columnHeights.fill(maxHeight);\n let y = columnHeights[0];\n\n if (this.isLoading) {\n let loaderY = y;\n let loaderHeight = 60;\n // If there aren't any items, make loader take all avaliable room and remove margin from y calculation\n // so it doesn't scroll\n if (this.collection.size === 0) {\n loaderY = 0;\n loaderHeight = this.virtualizer.visibleRect.height || 60;\n }\n\n let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n this.layoutInfos.set('loader', loader);\n y = loader.rect.maxY;\n }\n\n if (this.collection.size === 0 && !this.isLoading) {\n let rect = new Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n this.layoutInfos.set('placeholder', placeholder);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize = new Size(this.virtualizer.visibleRect.width, y);\n }\n\n updateItemSize(key: Key, size: Size) {\n let layoutInfo = this.layoutInfos.get(key);\n if (!size || !layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below\n // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n return true;\n }\n\n return false;\n }\n\n getNextColumnIndex(columnHeights) {\n let minIndex = 0;\n for (let i = 0; i < columnHeights.length; i++) {\n if (columnHeights[i] < columnHeights[minIndex]) {\n minIndex = i;\n }\n }\n\n return minIndex;\n }\n\n getClosestRight(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // Refactored from v2. Current strategy is to find the closest card in the adjacent column.\n // 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\n // and thus the top corner to top corner distance was massive.\n\n // 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\n let rect = new Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getClosestLeft(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // 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\n let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getKeyRightOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);\n }\n\n getKeyLeftOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);\n }\n}\n"],"names":[],"version":3,"file":"WaterfallLayout.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,MAAM,kDAA2B,CAAA,GAAA,oCAAS;IA0B/C,IAAI,aAAa;QACf,OAAO;IACT;IAEA,gBAAgB,mBAAwC,EAAE;QACxD,8DAA8D;QAC9D,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK;QACrD,IAAI,iBAAiB,eAAe,IAAI,CAAC,MAAM,GAAG;QAClD,IAAI,UAAU,KAAK,KAAK,CAAC,AAAC,CAAA,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD,IAAM,CAAA,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD;QAC9G,IAAI,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE;QAGxD,8DAA8D;QAC9D,IAAI,QAAQ,iBAAkB,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAI,CAAA,IAAI,CAAC,UAAU,GAAG,C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GAAG,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,mCAAG,EAAE,UAAU;QAC7D,IAAI,CAAC,MAAM,GAAG,QAAQ,MAAM,IAAI,OAAO,QAAQ,MAAM,GAAG;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ,IAAI,IAAI,CAAA,GAAA,mCAAG,EAAE,IAAI;QACjD,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI;QAExC,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,UAAU,GAAG;QAElB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ;IAClC;AA8KF","sources":["packages/@react-spectrum/card/src/WaterfallLayout.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseLayout, BaseLayoutOptions} from './BaseLayout';\nimport {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {InvalidationContext, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\nimport {Key, KeyboardDelegate} from '@react-types/shared';\n\nexport interface WaterfallLayoutOptions extends BaseLayoutOptions {\n /**\n * The minimum item size.\n * @default 240 x 136\n */\n minItemSize?: Size,\n /**\n * The maximum item size.\n * @default Infinity\n */\n maxItemSize?: Size,\n /**\n * The minimum space required between items.\n * @default 18 x 18\n */\n minSpace?: Size,\n /**\n * The maximum number of columns.\n * @default Infinity\n */\n maxColumns?: number\n}\n\n// TODO: this didn't have any options that varied with card size, should it have?\nexport class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegate {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n protected numColumns: number;\n protected itemWidth: number;\n protected horizontalSpacing: number;\n\n constructor(options: WaterfallLayoutOptions = {}) {\n // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify\n // minItemSize defaults or other things\n super(options);\n this.minItemSize = options.minItemSize || new Size(240, 136);\n this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);\n this.margin = options.margin != null ? options.margin : 24;\n this.minSpace = options.minSpace || new Size(18, 18);\n this.maxColumns = options.maxColumns || Infinity;\n\n this.itemWidth = 0;\n this.numColumns = 0;\n\n this.lastCollection = null;\n this.collator = options.collator;\n }\n\n get layoutType() {\n return 'waterfall';\n }\n\n buildCollection(invalidationContext: InvalidationContext) {\n // Compute the number of columns needed to display the content\n let visibleWidth = this.virtualizer.visibleRect.width;\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * (this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.round(width / this.numColumns);\n itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));\n this.itemWidth = itemWidth;\n\n // Compute the horizontal spacing\n // if only one column, we cannot divide by zero, so set it to 1\n let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));\n this.horizontalSpacing = horizontalSpacing;\n\n // Setup an array of column heights\n let columnHeights = Array(this.numColumns).fill(this.margin);\n for (let node of this.collection) {\n let key = node.key;\n // Compute the height of the item. Use the existing height if available,\n // otherwise call the delegate to estimate the size.\n let oldLayoutInfo = this.layoutInfos.get(key);\n let height;\n let estimatedSize = true;\n if (oldLayoutInfo) {\n height = oldLayoutInfo.rect.height;\n estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;\n } else if (node.props.width && node.props.height) {\n let nodeWidth = node.props.width;\n let nodeHeight = node.props.height;\n let scaledHeight = Math.round(nodeHeight * ((itemWidth) / nodeWidth));\n height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));\n } else {\n height = itemWidth;\n }\n\n // Figure out which column to place the item in, and compute its position.\n let column = this.getNextColumnIndex(columnHeights);\n let x = this.margin + column * (itemWidth + horizontalSpacing);\n let y = columnHeights[column];\n\n let rect = new Rect(x, y, itemWidth, height);\n let layoutInfo = new LayoutInfo(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(key, layoutInfo);\n\n // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?\n // Removing it from v2 doesn't seem to do anything?\n // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {\n // this.updateItemSize(new IndexPath(section, i));\n // }\n\n columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;\n }\n\n // Reset all columns to the maximum for the next section\n let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;\n columnHeights.fill(maxHeight);\n let y = columnHeights[0];\n\n if (this.isLoading) {\n let loaderY = y;\n let loaderHeight = 60;\n // If there aren't any items, make loader take all avaliable room and remove margin from y calculation\n // so it doesn't scroll\n if (this.collection.size === 0) {\n loaderY = 0;\n loaderHeight = this.virtualizer.visibleRect.height || 60;\n }\n\n let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n this.layoutInfos.set('loader', loader);\n y = loader.rect.maxY;\n }\n\n if (this.collection.size === 0 && !this.isLoading) {\n let rect = new Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n this.layoutInfos.set('placeholder', placeholder);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize = new Size(this.virtualizer.visibleRect.width, y);\n }\n\n updateItemSize(key: Key, size: Size) {\n let layoutInfo = this.layoutInfos.get(key);\n if (!size || !layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below\n // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n return true;\n }\n\n return false;\n }\n\n getNextColumnIndex(columnHeights) {\n let minIndex = 0;\n for (let i = 0; i < columnHeights.length; i++) {\n if (columnHeights[i] < columnHeights[minIndex]) {\n minIndex = i;\n }\n }\n\n return minIndex;\n }\n\n getClosestRight(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // Refactored from v2. Current strategy is to find the closest card in the adjacent column.\n // 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\n // and thus the top corner to top corner distance was massive.\n\n // 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\n let rect = new Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getClosestLeft(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // 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\n let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getKeyRightOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);\n }\n\n getKeyLeftOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);\n }\n}\n"],"names":[],"version":3,"file":"WaterfallLayout.main.js.map"}
@@ -17,7 +17,7 @@ import {Rect as $bRzF0$Rect, LayoutInfo as $bRzF0$LayoutInfo, Size as $bRzF0$Siz
17
17
 
18
18
  class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$export$64943d2e59d72a29) {
19
19
  get layoutType() {
20
- return "waterfall";
20
+ return 'waterfall';
21
21
  }
22
22
  buildCollection(invalidationContext) {
23
23
  // Compute the number of columns needed to display the content
@@ -83,14 +83,14 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
83
83
  loaderHeight = this.virtualizer.visibleRect.height || 60;
84
84
  }
85
85
  let rect = new (0, $bRzF0$Rect)(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
86
- let loader = new (0, $bRzF0$LayoutInfo)("loader", "loader", rect);
87
- this.layoutInfos.set("loader", loader);
86
+ let loader = new (0, $bRzF0$LayoutInfo)('loader', 'loader', rect);
87
+ this.layoutInfos.set('loader', loader);
88
88
  y = loader.rect.maxY;
89
89
  }
90
90
  if (this.collection.size === 0 && !this.isLoading) {
91
91
  let rect = new (0, $bRzF0$Rect)(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
92
- let placeholder = new (0, $bRzF0$LayoutInfo)("placeholder", "placeholder", rect);
93
- this.layoutInfos.set("placeholder", placeholder);
92
+ let placeholder = new (0, $bRzF0$LayoutInfo)('placeholder', 'placeholder', rect);
93
+ this.layoutInfos.set('placeholder', placeholder);
94
94
  y = placeholder.rect.maxY;
95
95
  }
96
96
  this.contentSize = new (0, $bRzF0$Size)(this.virtualizer.visibleRect.width, y);
@@ -148,12 +148,12 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
148
148
  getKeyRightOf(key) {
149
149
  // Expected key is the currently focused cell so we need the parent row key
150
150
  let parentRowKey = this.collection.getItem(key).parentKey;
151
- return this.direction === "rtl" ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
151
+ return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
152
152
  }
153
153
  getKeyLeftOf(key) {
154
154
  // Expected key is the currently focused cell so we need the parent row key
155
155
  let parentRowKey = this.collection.getItem(key).parentKey;
156
- return this.direction === "rtl" ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
156
+ return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
157
157
  }
158
158
  constructor(options = {}){
159
159
  // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
@@ -173,4 +173,4 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
173
173
 
174
174
 
175
175
  export {$03278f8d0f6860bb$export$e9f7cda058ba8df8 as WaterfallLayout};
176
- //# sourceMappingURL=WaterfallLayout.mjs.map
176
+ //# sourceMappingURL=WaterfallLayout.module.js.map
@@ -17,7 +17,7 @@ import {Rect as $bRzF0$Rect, LayoutInfo as $bRzF0$LayoutInfo, Size as $bRzF0$Siz
17
17
 
18
18
  class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$export$64943d2e59d72a29) {
19
19
  get layoutType() {
20
- return "waterfall";
20
+ return 'waterfall';
21
21
  }
22
22
  buildCollection(invalidationContext) {
23
23
  // Compute the number of columns needed to display the content
@@ -83,14 +83,14 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
83
83
  loaderHeight = this.virtualizer.visibleRect.height || 60;
84
84
  }
85
85
  let rect = new (0, $bRzF0$Rect)(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
86
- let loader = new (0, $bRzF0$LayoutInfo)("loader", "loader", rect);
87
- this.layoutInfos.set("loader", loader);
86
+ let loader = new (0, $bRzF0$LayoutInfo)('loader', 'loader', rect);
87
+ this.layoutInfos.set('loader', loader);
88
88
  y = loader.rect.maxY;
89
89
  }
90
90
  if (this.collection.size === 0 && !this.isLoading) {
91
91
  let rect = new (0, $bRzF0$Rect)(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
92
- let placeholder = new (0, $bRzF0$LayoutInfo)("placeholder", "placeholder", rect);
93
- this.layoutInfos.set("placeholder", placeholder);
92
+ let placeholder = new (0, $bRzF0$LayoutInfo)('placeholder', 'placeholder', rect);
93
+ this.layoutInfos.set('placeholder', placeholder);
94
94
  y = placeholder.rect.maxY;
95
95
  }
96
96
  this.contentSize = new (0, $bRzF0$Size)(this.virtualizer.visibleRect.width, y);
@@ -148,12 +148,12 @@ class $03278f8d0f6860bb$export$e9f7cda058ba8df8 extends (0, $3d424c147206bac9$ex
148
148
  getKeyRightOf(key) {
149
149
  // Expected key is the currently focused cell so we need the parent row key
150
150
  let parentRowKey = this.collection.getItem(key).parentKey;
151
- return this.direction === "rtl" ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
151
+ return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
152
152
  }
153
153
  getKeyLeftOf(key) {
154
154
  // Expected key is the currently focused cell so we need the parent row key
155
155
  let parentRowKey = this.collection.getItem(key).parentKey;
156
- return this.direction === "rtl" ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
156
+ return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
157
157
  }
158
158
  constructor(options = {}){
159
159
  // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,MAAM,kDAA2B,CAAA,GAAA,yCAAS;IA0B/C,IAAI,aAAa;QACf,OAAO;IACT;IAEA,gBAAgB,mBAA0D,EAAE;QAC1E,8DAA8D;QAC9D,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK;QACrD,IAAI,iBAAiB,eAAe,IAAI,CAAC,MAAM,GAAG;QAClD,IAAI,UAAU,KAAK,KAAK,CAAC,AAAC,CAAA,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD,IAAM,CAAA,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD;QAC9G,IAAI,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE;QAGxD,8DAA8D;QAC9D,IAAI,QAAQ,iBAAkB,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAI,CAAA,IAAI,CAAC,UAAU,GAAG,CAAA;QAEvE,sDAAsD;QACtD,IAAI,YAAY,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC,UAAU;QAClD,YAAY,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAA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A,GAAA,WAAG,EAAE,IAAI;QACjD,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI;QAExC,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,UAAU,GAAG;QAElB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ;IAClC;AA8KF","sources":["packages/@react-spectrum/card/src/WaterfallLayout.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseLayout, BaseLayoutOptions} from './BaseLayout';\nimport {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {InvalidationContext, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\nimport {Key, KeyboardDelegate, Node} from '@react-types/shared';\n\nexport interface WaterfallLayoutOptions extends BaseLayoutOptions {\n /**\n * The minimum item size.\n * @default 240 x 136\n */\n minItemSize?: Size,\n /**\n * The maximum item size.\n * @default Infinity\n */\n maxItemSize?: Size,\n /**\n * The minimum space required between items.\n * @default 18 x 18\n */\n minSpace?: Size,\n /**\n * The maximum number of columns.\n * @default Infinity\n */\n maxColumns?: number\n}\n\n// TODO: this didn't have any options that varied with card size, should it have?\nexport class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegate {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n protected numColumns: number;\n protected itemWidth: number;\n protected horizontalSpacing: number;\n\n constructor(options: WaterfallLayoutOptions = {}) {\n // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify\n // minItemSize defaults or other things\n super(options);\n this.minItemSize = options.minItemSize || new Size(240, 136);\n this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);\n this.margin = options.margin != null ? options.margin : 24;\n this.minSpace = options.minSpace || new Size(18, 18);\n this.maxColumns = options.maxColumns || Infinity;\n\n this.itemWidth = 0;\n this.numColumns = 0;\n\n this.lastCollection = null;\n this.collator = options.collator;\n }\n\n get layoutType() {\n return 'waterfall';\n }\n\n buildCollection(invalidationContext: InvalidationContext<Node<T>, unknown>) {\n // Compute the number of columns needed to display the content\n let visibleWidth = this.virtualizer.visibleRect.width;\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * (this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.round(width / this.numColumns);\n itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));\n this.itemWidth = itemWidth;\n\n // Compute the horizontal spacing\n // if only one column, we cannot divide by zero, so set it to 1\n let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));\n this.horizontalSpacing = horizontalSpacing;\n\n // Setup an array of column heights\n let columnHeights = Array(this.numColumns).fill(this.margin);\n for (let node of this.collection) {\n let key = node.key;\n // Compute the height of the item. Use the existing height if available,\n // otherwise call the delegate to estimate the size.\n let oldLayoutInfo = this.layoutInfos.get(key);\n let height;\n let estimatedSize = true;\n if (oldLayoutInfo) {\n height = oldLayoutInfo.rect.height;\n estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;\n } else if (node.props.width && node.props.height) {\n let nodeWidth = node.props.width;\n let nodeHeight = node.props.height;\n let scaledHeight = Math.round(nodeHeight * ((itemWidth) / nodeWidth));\n height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));\n } else {\n height = itemWidth;\n }\n\n // Figure out which column to place the item in, and compute its position.\n let column = this.getNextColumnIndex(columnHeights);\n let x = this.margin + column * (itemWidth + horizontalSpacing);\n let y = columnHeights[column];\n\n let rect = new Rect(x, y, itemWidth, height);\n let layoutInfo = new LayoutInfo(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(key, layoutInfo);\n\n // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?\n // Removing it from v2 doesn't seem to do anything?\n // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {\n // this.updateItemSize(new IndexPath(section, i));\n // }\n\n columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;\n }\n\n // Reset all columns to the maximum for the next section\n let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;\n columnHeights.fill(maxHeight);\n let y = columnHeights[0];\n\n if (this.isLoading) {\n let loaderY = y;\n let loaderHeight = 60;\n // If there aren't any items, make loader take all avaliable room and remove margin from y calculation\n // so it doesn't scroll\n if (this.collection.size === 0) {\n loaderY = 0;\n loaderHeight = this.virtualizer.visibleRect.height || 60;\n }\n\n let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n this.layoutInfos.set('loader', loader);\n y = loader.rect.maxY;\n }\n\n if (this.collection.size === 0 && !this.isLoading) {\n let rect = new Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n this.layoutInfos.set('placeholder', placeholder);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize = new Size(this.virtualizer.visibleRect.width, y);\n }\n\n updateItemSize(key: Key, size: Size) {\n let layoutInfo = this.layoutInfos.get(key);\n if (!size || !layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below\n // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n return true;\n }\n\n return false;\n }\n\n getNextColumnIndex(columnHeights) {\n let minIndex = 0;\n for (let i = 0; i < columnHeights.length; i++) {\n if (columnHeights[i] < columnHeights[minIndex]) {\n minIndex = i;\n }\n }\n\n return minIndex;\n }\n\n getClosestRight(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // Refactored from v2. Current strategy is to find the closest card in the adjacent column.\n // 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\n // and thus the top corner to top corner distance was massive.\n\n // 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\n let rect = new Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getClosestLeft(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // 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\n let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getKeyRightOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);\n }\n\n getKeyLeftOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);\n }\n}\n"],"names":[],"version":3,"file":"WaterfallLayout.module.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,MAAM,kDAA2B,CAAA,GAAA,yCAAS;IA0B/C,IAAI,aAAa;QACf,OAAO;IACT;IAEA,gBAAgB,mBAAwC,EAAE;QACxD,8DAA8D;QAC9D,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK;QACrD,IAAI,iBAAiB,eAAe,IAAI,CAAC,MAAM,GAAG;QAClD,IAAI,UAAU,KAAK,KAAK,CAAC,AAAC,CAAA,iBAAiB,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD,IAAM,CAAA,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,AAAD;QAC9G,IAAI,CAAC,UAAU,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE;QAGxD,8DAA8D;QAC9D,IAAI,QAAQ,iBAAkB,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAI,CAAA,IAAI,CAAC,UAAU,GAAG,CAAA;QAEvE,sDAAsD;QACtD,IAAI,YAAY,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC,UAAU;QAClD,YAAY,KAAK,GAAG,CAAC,IAAI,CAAC,W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;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ,IAAI,IAAI,CAAA,GAAA,WAAG,EAAE,IAAI;QACjD,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI;QAExC,IAAI,CAAC,SAAS,GAAG;QACjB,IAAI,CAAC,UAAU,GAAG;QAElB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ;IAClC;AA8KF","sources":["packages/@react-spectrum/card/src/WaterfallLayout.tsx"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseLayout, BaseLayoutOptions} from './BaseLayout';\nimport {getChildNodes, getFirstItem} from '@react-stately/collections';\nimport {InvalidationContext, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\nimport {Key, KeyboardDelegate} from '@react-types/shared';\n\nexport interface WaterfallLayoutOptions extends BaseLayoutOptions {\n /**\n * The minimum item size.\n * @default 240 x 136\n */\n minItemSize?: Size,\n /**\n * The maximum item size.\n * @default Infinity\n */\n maxItemSize?: Size,\n /**\n * The minimum space required between items.\n * @default 18 x 18\n */\n minSpace?: Size,\n /**\n * The maximum number of columns.\n * @default Infinity\n */\n maxColumns?: number\n}\n\n// TODO: this didn't have any options that varied with card size, should it have?\nexport class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegate {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n protected numColumns: number;\n protected itemWidth: number;\n protected horizontalSpacing: number;\n\n constructor(options: WaterfallLayoutOptions = {}) {\n // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify\n // minItemSize defaults or other things\n super(options);\n this.minItemSize = options.minItemSize || new Size(240, 136);\n this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);\n this.margin = options.margin != null ? options.margin : 24;\n this.minSpace = options.minSpace || new Size(18, 18);\n this.maxColumns = options.maxColumns || Infinity;\n\n this.itemWidth = 0;\n this.numColumns = 0;\n\n this.lastCollection = null;\n this.collator = options.collator;\n }\n\n get layoutType() {\n return 'waterfall';\n }\n\n buildCollection(invalidationContext: InvalidationContext) {\n // Compute the number of columns needed to display the content\n let visibleWidth = this.virtualizer.visibleRect.width;\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * (this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.round(width / this.numColumns);\n itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));\n this.itemWidth = itemWidth;\n\n // Compute the horizontal spacing\n // if only one column, we cannot divide by zero, so set it to 1\n let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));\n this.horizontalSpacing = horizontalSpacing;\n\n // Setup an array of column heights\n let columnHeights = Array(this.numColumns).fill(this.margin);\n for (let node of this.collection) {\n let key = node.key;\n // Compute the height of the item. Use the existing height if available,\n // otherwise call the delegate to estimate the size.\n let oldLayoutInfo = this.layoutInfos.get(key);\n let height;\n let estimatedSize = true;\n if (oldLayoutInfo) {\n height = oldLayoutInfo.rect.height;\n estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;\n } else if (node.props.width && node.props.height) {\n let nodeWidth = node.props.width;\n let nodeHeight = node.props.height;\n let scaledHeight = Math.round(nodeHeight * ((itemWidth) / nodeWidth));\n height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));\n } else {\n height = itemWidth;\n }\n\n // Figure out which column to place the item in, and compute its position.\n let column = this.getNextColumnIndex(columnHeights);\n let x = this.margin + column * (itemWidth + horizontalSpacing);\n let y = columnHeights[column];\n\n let rect = new Rect(x, y, itemWidth, height);\n let layoutInfo = new LayoutInfo(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(key, layoutInfo);\n\n // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?\n // Removing it from v2 doesn't seem to do anything?\n // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {\n // this.updateItemSize(new IndexPath(section, i));\n // }\n\n columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;\n }\n\n // Reset all columns to the maximum for the next section\n let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;\n columnHeights.fill(maxHeight);\n let y = columnHeights[0];\n\n if (this.isLoading) {\n let loaderY = y;\n let loaderHeight = 60;\n // If there aren't any items, make loader take all avaliable room and remove margin from y calculation\n // so it doesn't scroll\n if (this.collection.size === 0) {\n loaderY = 0;\n loaderHeight = this.virtualizer.visibleRect.height || 60;\n }\n\n let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);\n let loader = new LayoutInfo('loader', 'loader', rect);\n this.layoutInfos.set('loader', loader);\n y = loader.rect.maxY;\n }\n\n if (this.collection.size === 0 && !this.isLoading) {\n let rect = new Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n this.layoutInfos.set('placeholder', placeholder);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize = new Size(this.virtualizer.visibleRect.width, y);\n }\n\n updateItemSize(key: Key, size: Size) {\n let layoutInfo = this.layoutInfos.get(key);\n if (!size || !layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below\n // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n return true;\n }\n\n return false;\n }\n\n getNextColumnIndex(columnHeights) {\n let minIndex = 0;\n for (let i = 0; i < columnHeights.length; i++) {\n if (columnHeights[i] < columnHeights[minIndex]) {\n minIndex = i;\n }\n }\n\n return minIndex;\n }\n\n getClosestRight(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // Refactored from v2. Current strategy is to find the closest card in the adjacent column.\n // 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\n // and thus the top corner to top corner distance was massive.\n\n // 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\n let rect = new Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getClosestLeft(key: Key) {\n let layoutInfo = this.getLayoutInfo(key);\n // 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\n let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n\n if (!key) {\n rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);\n key = this._findClosest(layoutInfo.rect, rect)?.key;\n }\n\n let item = this.collection.getItem(key);\n return getFirstItem(getChildNodes(item, this.collection))?.key;\n }\n\n getKeyRightOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);\n }\n\n getKeyLeftOf(key: Key) {\n // Expected key is the currently focused cell so we need the parent row key\n let parentRowKey = this.collection.getItem(key).parentKey;\n return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);\n }\n}\n"],"names":[],"version":3,"file":"WaterfallLayout.module.js.map"}
package/dist/ar-AE.mjs CHANGED
@@ -6,4 +6,4 @@ $6cb102354c06de53$exports = {
6
6
 
7
7
 
8
8
  export {$6cb102354c06de53$exports as default};
9
- //# sourceMappingURL=ar-AE.mjs.map
9
+ //# sourceMappingURL=ar-AE.module.js.map
package/dist/bg-BG.mjs CHANGED
@@ -6,4 +6,4 @@ $17b8c838d83f13fc$exports = {
6
6
 
7
7
 
8
8
  export {$17b8c838d83f13fc$exports as default};
9
- //# sourceMappingURL=bg-BG.mjs.map
9
+ //# sourceMappingURL=bg-BG.module.js.map
@@ -115,4 +115,4 @@ $408a78e5068502c2$export$fb184b623420d9be = `dqWSla_title`;
115
115
 
116
116
 
117
117
  export {$408a78e5068502c2$exports as default};
118
- //# sourceMappingURL=card_vars_css.mjs.map
118
+ //# sourceMappingURL=card_vars_css.module.js.map
package/dist/cs-CZ.mjs CHANGED
@@ -6,4 +6,4 @@ $1ddb4e1a3e8b15a5$exports = {
6
6
 
7
7
 
8
8
  export {$1ddb4e1a3e8b15a5$exports as default};
9
- //# sourceMappingURL=cs-CZ.mjs.map
9
+ //# sourceMappingURL=cs-CZ.module.js.map
package/dist/da-DK.mjs CHANGED
@@ -6,4 +6,4 @@ $44b7f17cd1f1db7f$exports = {
6
6
 
7
7
 
8
8
  export {$44b7f17cd1f1db7f$exports as default};
9
- //# sourceMappingURL=da-DK.mjs.map
9
+ //# sourceMappingURL=da-DK.module.js.map
package/dist/de-DE.mjs CHANGED
@@ -6,4 +6,4 @@ $ffa85bef2c730318$exports = {
6
6
 
7
7
 
8
8
  export {$ffa85bef2c730318$exports as default};
9
- //# sourceMappingURL=de-DE.mjs.map
9
+ //# sourceMappingURL=de-DE.module.js.map
package/dist/el-GR.mjs CHANGED
@@ -6,4 +6,4 @@ $1904be2ca25ad4ef$exports = {
6
6
 
7
7
 
8
8
  export {$1904be2ca25ad4ef$exports as default};
9
- //# sourceMappingURL=el-GR.mjs.map
9
+ //# sourceMappingURL=el-GR.module.js.map
package/dist/en-US.mjs CHANGED
@@ -6,4 +6,4 @@ $d120e7d3833466fb$exports = {
6
6
 
7
7
 
8
8
  export {$d120e7d3833466fb$exports as default};
9
- //# sourceMappingURL=en-US.mjs.map
9
+ //# sourceMappingURL=en-US.module.js.map
package/dist/es-ES.mjs CHANGED
@@ -6,4 +6,4 @@ $fe39ef3292597d11$exports = {
6
6
 
7
7
 
8
8
  export {$fe39ef3292597d11$exports as default};
9
- //# sourceMappingURL=es-ES.mjs.map
9
+ //# sourceMappingURL=es-ES.module.js.map
package/dist/et-EE.mjs CHANGED
@@ -6,4 +6,4 @@ $3204c020860ca192$exports = {
6
6
 
7
7
 
8
8
  export {$3204c020860ca192$exports as default};
9
- //# sourceMappingURL=et-EE.mjs.map
9
+ //# sourceMappingURL=et-EE.module.js.map
package/dist/fi-FI.mjs CHANGED
@@ -6,4 +6,4 @@ $5ced2ee930f1d61a$exports = {
6
6
 
7
7
 
8
8
  export {$5ced2ee930f1d61a$exports as default};
9
- //# sourceMappingURL=fi-FI.mjs.map
9
+ //# sourceMappingURL=fi-FI.module.js.map
package/dist/fr-FR.mjs CHANGED
@@ -6,4 +6,4 @@ $bd751114db2e8872$exports = {
6
6
 
7
7
 
8
8
  export {$bd751114db2e8872$exports as default};
9
- //# sourceMappingURL=fr-FR.mjs.map
9
+ //# sourceMappingURL=fr-FR.module.js.map
package/dist/he-IL.mjs CHANGED
@@ -6,4 +6,4 @@ $6291b4a5eb5146c5$exports = {
6
6
 
7
7
 
8
8
  export {$6291b4a5eb5146c5$exports as default};
9
- //# sourceMappingURL=he-IL.mjs.map
9
+ //# sourceMappingURL=he-IL.module.js.map
package/dist/hr-HR.mjs CHANGED
@@ -6,4 +6,4 @@ $cdc3f7b2aa8b1879$exports = {
6
6
 
7
7
 
8
8
  export {$cdc3f7b2aa8b1879$exports as default};
9
- //# sourceMappingURL=hr-HR.mjs.map
9
+ //# sourceMappingURL=hr-HR.module.js.map
package/dist/hu-HU.mjs CHANGED
@@ -6,4 +6,4 @@ $1a69968dcbcabdff$exports = {
6
6
 
7
7
 
8
8
  export {$1a69968dcbcabdff$exports as default};
9
- //# sourceMappingURL=hu-HU.mjs.map
9
+ //# sourceMappingURL=hu-HU.module.js.map
@@ -107,4 +107,4 @@ $49aba923a95704ba$exports = {
107
107
 
108
108
 
109
109
  export {$49aba923a95704ba$exports as default};
110
- //# sourceMappingURL=intlStrings.mjs.map
110
+ //# sourceMappingURL=intlStrings.module.js.map
package/dist/it-IT.mjs CHANGED
@@ -6,4 +6,4 @@ $fe72420090e5e44f$exports = {
6
6
 
7
7
 
8
8
  export {$fe72420090e5e44f$exports as default};
9
- //# sourceMappingURL=it-IT.mjs.map
9
+ //# sourceMappingURL=it-IT.module.js.map
package/dist/ja-JP.mjs CHANGED
@@ -6,4 +6,4 @@ $8643fac062a08b30$exports = {
6
6
 
7
7
 
8
8
  export {$8643fac062a08b30$exports as default};
9
- //# sourceMappingURL=ja-JP.mjs.map
9
+ //# sourceMappingURL=ja-JP.module.js.map
package/dist/ko-KR.mjs CHANGED
@@ -6,4 +6,4 @@ $41f4de1d2f63c8f4$exports = {
6
6
 
7
7
 
8
8
  export {$41f4de1d2f63c8f4$exports as default};
9
- //# sourceMappingURL=ko-KR.mjs.map
9
+ //# sourceMappingURL=ko-KR.module.js.map
package/dist/lt-LT.mjs CHANGED
@@ -6,4 +6,4 @@ $9819c3a9877418b0$exports = {
6
6
 
7
7
 
8
8
  export {$9819c3a9877418b0$exports as default};
9
- //# sourceMappingURL=lt-LT.mjs.map
9
+ //# sourceMappingURL=lt-LT.module.js.map
package/dist/lv-LV.mjs CHANGED
@@ -6,4 +6,4 @@ $3e8ad6b78b8cc064$exports = {
6
6
 
7
7
 
8
8
  export {$3e8ad6b78b8cc064$exports as default};
9
- //# sourceMappingURL=lv-LV.mjs.map
9
+ //# sourceMappingURL=lv-LV.module.js.map
package/dist/nb-NO.mjs CHANGED
@@ -6,4 +6,4 @@ $baa4fb210e65a6c5$exports = {
6
6
 
7
7
 
8
8
  export {$baa4fb210e65a6c5$exports as default};
9
- //# sourceMappingURL=nb-NO.mjs.map
9
+ //# sourceMappingURL=nb-NO.module.js.map
package/dist/nl-NL.mjs CHANGED
@@ -6,4 +6,4 @@ $ee123eda5b089b7d$exports = {
6
6
 
7
7
 
8
8
  export {$ee123eda5b089b7d$exports as default};
9
- //# sourceMappingURL=nl-NL.mjs.map
9
+ //# sourceMappingURL=nl-NL.module.js.map
package/dist/pl-PL.mjs CHANGED
@@ -6,4 +6,4 @@ $36a325cd1c9e414f$exports = {
6
6
 
7
7
 
8
8
  export {$36a325cd1c9e414f$exports as default};
9
- //# sourceMappingURL=pl-PL.mjs.map
9
+ //# sourceMappingURL=pl-PL.module.js.map
package/dist/pt-BR.mjs CHANGED
@@ -6,4 +6,4 @@ $52d4fd0f211d7e51$exports = {
6
6
 
7
7
 
8
8
  export {$52d4fd0f211d7e51$exports as default};
9
- //# sourceMappingURL=pt-BR.mjs.map
9
+ //# sourceMappingURL=pt-BR.module.js.map
package/dist/pt-PT.mjs CHANGED
@@ -6,4 +6,4 @@ $ad1f55e36e4e9241$exports = {
6
6
 
7
7
 
8
8
  export {$ad1f55e36e4e9241$exports as default};
9
- //# sourceMappingURL=pt-PT.mjs.map
9
+ //# sourceMappingURL=pt-PT.module.js.map
package/dist/ro-RO.mjs CHANGED
@@ -6,4 +6,4 @@ $bfc201ee55c5f26f$exports = {
6
6
 
7
7
 
8
8
  export {$bfc201ee55c5f26f$exports as default};
9
- //# sourceMappingURL=ro-RO.mjs.map
9
+ //# sourceMappingURL=ro-RO.module.js.map
package/dist/ru-RU.mjs CHANGED
@@ -6,4 +6,4 @@ $5773113377d944b4$exports = {
6
6
 
7
7
 
8
8
  export {$5773113377d944b4$exports as default};
9
- //# sourceMappingURL=ru-RU.mjs.map
9
+ //# sourceMappingURL=ru-RU.module.js.map
package/dist/sk-SK.mjs CHANGED
@@ -6,4 +6,4 @@ $75167f0b339049be$exports = {
6
6
 
7
7
 
8
8
  export {$75167f0b339049be$exports as default};
9
- //# sourceMappingURL=sk-SK.mjs.map
9
+ //# sourceMappingURL=sk-SK.module.js.map
package/dist/sl-SI.mjs CHANGED
@@ -6,4 +6,4 @@ $83a887ec3d5f2028$exports = {
6
6
 
7
7
 
8
8
  export {$83a887ec3d5f2028$exports as default};
9
- //# sourceMappingURL=sl-SI.mjs.map
9
+ //# sourceMappingURL=sl-SI.module.js.map
package/dist/sr-SP.mjs CHANGED
@@ -6,4 +6,4 @@ $8352707b2eadbfb4$exports = {
6
6
 
7
7
 
8
8
  export {$8352707b2eadbfb4$exports as default};
9
- //# sourceMappingURL=sr-SP.mjs.map
9
+ //# sourceMappingURL=sr-SP.module.js.map
package/dist/sv-SE.mjs CHANGED
@@ -6,4 +6,4 @@ $212352f469058747$exports = {
6
6
 
7
7
 
8
8
  export {$212352f469058747$exports as default};
9
- //# sourceMappingURL=sv-SE.mjs.map
9
+ //# sourceMappingURL=sv-SE.module.js.map
package/dist/tr-TR.mjs CHANGED
@@ -6,4 +6,4 @@ $334510787f8a69f9$exports = {
6
6
 
7
7
 
8
8
  export {$334510787f8a69f9$exports as default};
9
- //# sourceMappingURL=tr-TR.mjs.map
9
+ //# sourceMappingURL=tr-TR.module.js.map
package/dist/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Direction, Key, KeyboardDelegate, Node, Orientation, DOMRef, DOMRefValu
2
2
  import { GridCollection } from "@react-stately/grid";
3
3
  import { InvalidationContext, Layout, LayoutInfo, Rect, Size } from "@react-stately/virtualizer";
4
4
  import { Scale } from "@react-types/provider";
5
- import React, { ReactElement } from "react";
5
+ import { ReactElement, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
6
6
  import { SpectrumCardViewProps, SpectrumCardProps } from "@react-types/card";
7
7
  interface BaseLayoutOptions {
8
8
  collator?: Intl.Collator;
@@ -13,7 +13,11 @@ interface BaseLayoutOptions {
13
13
  */
14
14
  margin?: number;
15
15
  }
16
- declare class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
16
+ interface CardViewLayoutOptions {
17
+ isLoading: boolean;
18
+ direction: Direction;
19
+ }
20
+ declare class BaseLayout<T> extends Layout<Node<T>, CardViewLayoutOptions> implements KeyboardDelegate {
17
21
  protected contentSize: Size;
18
22
  protected layoutInfos: Map<Key, LayoutInfo>;
19
23
  protected collator: Intl.Collator;
@@ -25,14 +29,12 @@ declare class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate
25
29
  scale: Scale;
26
30
  margin: number;
27
31
  constructor(options?: BaseLayoutOptions);
28
- validate(invalidationContext: InvalidationContext<Node<T>, unknown>): void;
29
- buildCollection(invalidationContext?: InvalidationContext<Node<T>, unknown>): void;
32
+ update(invalidationContext: InvalidationContext<CardViewLayoutOptions>): void;
33
+ buildCollection(invalidationContext?: InvalidationContext): void;
30
34
  getContentSize(): Size;
31
35
  getLayoutInfo(key: Key): LayoutInfo;
32
- getVisibleLayoutInfos(rect: any): LayoutInfo[];
33
- isVisible(layoutInfo: LayoutInfo, rect: Rect): boolean;
34
- getInitialLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo;
35
- getFinalLayoutInfo(layoutInfo: LayoutInfo): LayoutInfo;
36
+ getVisibleLayoutInfos(rect: Rect, excludePersistedKeys?: boolean): LayoutInfo[];
37
+ isVisible(layoutInfo: LayoutInfo, rect: Rect, excludePersistedKeys: boolean): boolean;
36
38
  _findClosestLayoutInfo(target: Rect, rect: Rect): any;
37
39
  _findClosest(target: Rect, rect: Rect): any;
38
40
  getKeyBelow(key: Key): Key;
@@ -135,7 +137,6 @@ export class GridLayout<T> extends BaseLayout<T> {
135
137
  constructor(options?: GridLayoutOptions);
136
138
  get layoutType(): string;
137
139
  getIndexAtPoint(x: any, y: any, allowInsertingAtEnd?: boolean): number;
138
- getVisibleLayoutInfos(rect: any): LayoutInfo[];
139
140
  buildCollection(): void;
140
141
  buildChild(node: Node<T>, y: number, index: number): LayoutInfo;
141
142
  getKeyBelow(key: Key): Key;
@@ -173,7 +174,7 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
173
174
  protected horizontalSpacing: number;
174
175
  constructor(options?: WaterfallLayoutOptions);
175
176
  get layoutType(): string;
176
- buildCollection(invalidationContext: InvalidationContext<Node<T>, unknown>): void;
177
+ buildCollection(invalidationContext: InvalidationContext): void;
177
178
  updateItemSize(key: Key, size: Size): boolean;
178
179
  getNextColumnIndex(columnHeights: any): number;
179
180
  getClosestRight(key: Key): Key;
@@ -187,7 +188,7 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
187
188
  export const CardView: <T>(props: SpectrumCardViewProps<T> & {
188
189
  ref?: DOMRef<HTMLDivElement>;
189
190
  }) => ReactElement;
190
- export let Card: React.ForwardRefExoticComponent<ItemProps<SpectrumCardProps> & SpectrumCardProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
191
+ export let Card: ForwardRefExoticComponent<ItemProps<SpectrumCardProps> & PropsWithoutRef<SpectrumCardProps> & RefAttributes<DOMRefValue<HTMLDivElement>>>;
191
192
  export type { SpectrumCardViewProps } from '@react-types/card';
192
193
 
193
194
  //# sourceMappingURL=types.d.ts.map