@react-spectrum/card 3.0.0-alpha.37 → 3.0.0-alpha.39

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 (55) hide show
  1. package/dist/BaseLayout.main.js +2 -2
  2. package/dist/BaseLayout.main.js.map +1 -1
  3. package/dist/BaseLayout.mjs +2 -2
  4. package/dist/BaseLayout.module.js +2 -2
  5. package/dist/BaseLayout.module.js.map +1 -1
  6. package/dist/Card.main.js +1 -0
  7. package/dist/Card.main.js.map +1 -1
  8. package/dist/Card.mjs +1 -0
  9. package/dist/Card.module.js +1 -0
  10. package/dist/Card.module.js.map +1 -1
  11. package/dist/CardBase.main.js +4 -6
  12. package/dist/CardBase.main.js.map +1 -1
  13. package/dist/CardBase.mjs +4 -6
  14. package/dist/CardBase.module.js +4 -6
  15. package/dist/CardBase.module.js.map +1 -1
  16. package/dist/CardView.main.js +4 -6
  17. package/dist/CardView.main.js.map +1 -1
  18. package/dist/CardView.mjs +4 -6
  19. package/dist/CardView.module.js +4 -6
  20. package/dist/CardView.module.js.map +1 -1
  21. package/dist/CardViewContext.main.js +1 -0
  22. package/dist/CardViewContext.main.js.map +1 -1
  23. package/dist/CardViewContext.mjs +1 -0
  24. package/dist/CardViewContext.module.js +1 -0
  25. package/dist/CardViewContext.module.js.map +1 -1
  26. package/dist/GalleryLayout.main.js +1 -0
  27. package/dist/GalleryLayout.main.js.map +1 -1
  28. package/dist/GalleryLayout.mjs +1 -0
  29. package/dist/GalleryLayout.module.js +1 -0
  30. package/dist/GalleryLayout.module.js.map +1 -1
  31. package/dist/GridLayout.main.js +1 -0
  32. package/dist/GridLayout.main.js.map +1 -1
  33. package/dist/GridLayout.mjs +1 -0
  34. package/dist/GridLayout.module.js +1 -0
  35. package/dist/GridLayout.module.js.map +1 -1
  36. package/dist/WaterfallLayout.main.js +1 -0
  37. package/dist/WaterfallLayout.main.js.map +1 -1
  38. package/dist/WaterfallLayout.mjs +1 -0
  39. package/dist/WaterfallLayout.module.js +1 -0
  40. package/dist/WaterfallLayout.module.js.map +1 -1
  41. package/dist/card_vars_css.main.js.map +1 -1
  42. package/dist/card_vars_css.module.js.map +1 -1
  43. package/dist/types.d.ts +17 -17
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/{vars.081f4c73.css → vars.02438011.css} +3 -3
  46. package/dist/{vars.081f4c73.css.map → vars.02438011.css.map} +1 -1
  47. package/package.json +20 -20
  48. package/src/BaseLayout.tsx +1 -0
  49. package/src/Card.tsx +1 -0
  50. package/src/CardBase.tsx +6 -8
  51. package/src/CardView.tsx +6 -8
  52. package/src/CardViewContext.tsx +1 -0
  53. package/src/GalleryLayout.tsx +1 -0
  54. package/src/GridLayout.tsx +1 -0
  55. package/src/WaterfallLayout.tsx +1 -0
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA4CD,MAAM,wCAAkB;IACtB,GAAG;QACD,aAAa;QACb,aAAa;YACX,YAAY,IAAI,CAAA,GAAA,WAAG,EAAE,IAAI;QAC3B;QACA,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,UAAU;QAChC,QAAQ;QACR,UAAU,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG;QACtB,YAAY;QACZ,aAAa;IACf;IACA,GAAG;QACD,aAAa;YACX,YAAY;gBACV,UAAU;gBACV,SAAS;YACX;YACA,cAAc;gBACZ,UAAU;gBACV,SAAS;YACX;QACF;QACA,aAAa;YACX,YAAY,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;YAC1B,cAAc,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;QAC9B;QACA,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,UAAU;QAChC,QAAQ;QACR,UAAU,IAAI,CAAA,GAAA,WAAG,EAAE,IAAI;QACvB,YAAY;QACZ,aAAa;IACf;AACF;AAEO,MAAM,kDAAsB,CAAA,GAAA,yCAAS;IA4B1C,IAAI,aAAa;QACf,OAAO;IACT;IA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C,KAAK,CAAC;QACN,IAAI,WAAW;QACf,IAAI,CAAC,eAAe,GAAG,QAAQ,eAAe,IAAI;QAClD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,qCAAe,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC;QACrG,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,qCAAe,CAAC,SAAS,CAAC,WAAW;QAC/E,IAAI,CAAC,MAAM,GAAG,QAAQ,MAAM,IAAI,OAAO,QAAQ,MAAM,GAAG,qCAAe,CAAC,SAAS,CAAC,MAAM;QACxF,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ,IAAI,qCAAe,CAAC,SAAS,CAAC,QAAQ;QACtE,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI,qCAAe,CAAC,SAAS,CAAC,UAAU;QAC5E,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,OAAO,QAAQ,WAAW,GAAG,qCAAe,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9I,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,iBAAiB,GAAG;IAC3B;AA6HF","sources":["packages/@react-spectrum/card/src/GridLayout.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 {Key, Node, Orientation} from '@react-types/shared';\nimport {LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface GridLayoutOptions extends BaseLayoutOptions {\n // /**\n // * The card size in the grid.\n // */\n // cardSize?: 'S' | 'M' | 'L',\n /**\n * The minimum item size.\n * @default 208 x 208 for horizontal card orientation. 102 x 102 for vertical card orientation.\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 * The additional padding along the card's main axis. Affects the sizing of the content area following the card image.\n * @default 95\n */\n itemPadding?: number,\n /**\n * The orientation of the cards withn the grid.\n * @default vertical\n */\n cardOrientation?: Orientation\n}\n\nconst DEFAULT_OPTIONS = {\n S: {\n itemPadding: 20,\n minItemSize: {\n 'vertical': new Size(96, 96)\n },\n maxItemSize: new Size(Infinity, Infinity),\n margin: 8,\n minSpace: new Size(6, 6),\n maxColumns: Infinity,\n dropSpacing: 50\n },\n L: {\n itemPadding: {\n 'vertical': {\n 'medium': 78,\n 'large': 98\n },\n 'horizontal': {\n 'medium': 150,\n 'large': 170\n }\n },\n minItemSize: {\n 'vertical': new Size(208, 208),\n 'horizontal': new Size(102, 102)\n },\n maxItemSize: new Size(Infinity, Infinity),\n margin: 24,\n minSpace: new Size(18, 18),\n maxColumns: Infinity,\n dropSpacing: 100\n }\n};\n\nexport class GridLayout<T> extends BaseLayout<T> {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n itemPadding: number;\n cardOrientation: Orientation;\n protected itemSize: Size;\n protected numColumns: number;\n protected numRows: number;\n protected horizontalSpacing: number;\n\n constructor(options: GridLayoutOptions = {}) {\n super(options);\n let cardSize = 'L';\n this.cardOrientation = options.cardOrientation || 'vertical';\n this.minItemSize = options.minItemSize || DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];\n this.maxItemSize = options.maxItemSize || DEFAULT_OPTIONS[cardSize].maxItemSize;\n this.margin = options.margin != null ? options.margin : DEFAULT_OPTIONS[cardSize].margin;\n this.minSpace = options.minSpace || DEFAULT_OPTIONS[cardSize].minSpace;\n this.maxColumns = options.maxColumns || DEFAULT_OPTIONS[cardSize].maxColumns;\n this.itemPadding = options.itemPadding != null ? options.itemPadding : DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];\n this.itemSize = null;\n this.numColumns = 0;\n this.numRows = 0;\n this.horizontalSpacing = 0;\n }\n\n get layoutType() {\n return 'grid';\n }\n\n getIndexAtPoint(x, y, allowInsertingAtEnd = false) {\n let itemHeight = this.itemSize.height + this.minSpace.height;\n let itemWidth = this.itemSize.width + this.horizontalSpacing;\n return Math.max(0,\n Math.min(\n this.collection.size - (allowInsertingAtEnd ? 0 : 1),\n Math.floor(y / itemHeight) * this.numColumns + Math.floor((x - this.horizontalSpacing) / itemWidth)\n )\n );\n }\n\n buildCollection() {\n let visibleWidth = this.virtualizer.visibleRect.width;\n let visibleHeight = this.virtualizer.visibleRect.height;\n let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;\n let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;\n let minCardWidth = this.minItemSize.width + horizontalItemPadding;\n\n // Compute the number of rows and columns needed to display the content\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n this.numRows = Math.ceil(this.collection.size / this.numColumns);\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * Math.max(0, this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.floor(width / this.numColumns);\n itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth));\n // Compute the item height, which is proportional to the item width\n let t = ((itemWidth - minCardWidth) / minCardWidth);\n let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);\n itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;\n this.itemSize = new Size(itemWidth, itemHeight);\n\n // Compute the horizontal spacing and content height\n this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));\n\n let y = this.margin;\n let index = 0;\n for (let node of this.collection) {\n let layoutInfo = this.buildChild(node, y, index);\n y = layoutInfo.rect.maxY;\n index++;\n }\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 = visibleHeight || 60;\n }\n\n let rect = new Rect(0, loaderY, visibleWidth, 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, visibleWidth, visibleHeight);\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(visibleWidth, y);\n }\n\n buildChild(node: Node<T>, y: number, index: number): LayoutInfo {\n let row = Math.floor(index / this.numColumns);\n let column = index % this.numColumns;\n let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);\n y = this.margin + row * (this.itemSize.height + this.minSpace.height);\n\n let rect = new Rect(x, y, this.itemSize.width, this.itemSize.height);\n // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(node.key, layoutInfo);\n return layoutInfo;\n }\n\n // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,\n // then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the\n // collection contents by that number (which will give us the row distribution)\n getKeyBelow(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 let indexRowBelow;\n let index = this.collection.rows.findIndex(card => card.key === parentRowKey);\n if (index !== -1) {\n indexRowBelow = index + this.numColumns;\n } else {\n return null;\n }\n\n let row = this.collection.rows[indexRowBelow];\n return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;\n }\n\n getKeyAbove(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 let indexRowAbove;\n let index = this.collection.rows.findIndex(card => card.key === parentRowKey);\n if (index !== -1) {\n indexRowAbove = index - this.numColumns;\n } else {\n return null;\n }\n\n let row = this.collection.rows[indexRowAbove];\n return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;\n }\n}\n"],"names":[],"version":3,"file":"GridLayout.module.js.map"}
1
+ {"mappings":";;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;;;AA4CD,MAAM,wCAAkB;IACtB,GAAG;QACD,aAAa;QACb,aAAa;YACX,YAAY,IAAI,CAAA,GAAA,WAAG,EAAE,IAAI;QAC3B;QACA,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,UAAU;QAChC,QAAQ;QACR,UAAU,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG;QACtB,YAAY;QACZ,aAAa;IACf;IACA,GAAG;QACD,aAAa;YACX,YAAY;gBACV,UAAU;gBACV,SAAS;YACX;YACA,cAAc;gBACZ,UAAU;gBACV,SAAS;YACX;QACF;QACA,aAAa;YACX,YAAY,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;YAC1B,cAAc,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;QAC9B;QACA,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,UAAU;QAChC,QAAQ;QACR,UAAU,IAAI,CAAA,GAAA,WAAG,EA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oBAAY,EAAE,KAAK,IAAI,CAAC,UAAU,gBAA/C,oCAAA,cAAmD,GAAG,GAAG;IACxE;IA1IA,YAAY,UAA6B,CAAC,CAAC,CAAE;QAC3C,KAAK,CAAC;QACN,IAAI,WAAW;QACf,IAAI,CAAC,eAAe,GAAG,QAAQ,eAAe,IAAI;QAClD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,qCAAe,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC;QACrG,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,qCAAe,CAAC,SAAS,CAAC,WAAW;QAC/E,IAAI,CAAC,MAAM,GAAG,QAAQ,MAAM,IAAI,OAAO,QAAQ,MAAM,GAAG,qCAAe,CAAC,SAAS,CAAC,MAAM;QACxF,IAAI,CAAC,QAAQ,GAAG,QAAQ,QAAQ,IAAI,qCAAe,CAAC,SAAS,CAAC,QAAQ;QACtE,IAAI,CAAC,UAAU,GAAG,QAAQ,UAAU,IAAI,qCAAe,CAAC,SAAS,CAAC,UAAU;QAC5E,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,OAAO,QAAQ,WAAW,GAAG,qCAAe,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAC9I,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,iBAAiB,GAAG;IAC3B;AA6HF","sources":["packages/@react-spectrum/card/src/GridLayout.tsx"],"sourcesContent":["// @ts-nocheck\n/*\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 {Key, Node, Orientation} from '@react-types/shared';\nimport {LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface GridLayoutOptions extends BaseLayoutOptions {\n // /**\n // * The card size in the grid.\n // */\n // cardSize?: 'S' | 'M' | 'L',\n /**\n * The minimum item size.\n * @default 208 x 208 for horizontal card orientation. 102 x 102 for vertical card orientation.\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 * The additional padding along the card's main axis. Affects the sizing of the content area following the card image.\n * @default 95\n */\n itemPadding?: number,\n /**\n * The orientation of the cards withn the grid.\n * @default vertical\n */\n cardOrientation?: Orientation\n}\n\nconst DEFAULT_OPTIONS = {\n S: {\n itemPadding: 20,\n minItemSize: {\n 'vertical': new Size(96, 96)\n },\n maxItemSize: new Size(Infinity, Infinity),\n margin: 8,\n minSpace: new Size(6, 6),\n maxColumns: Infinity,\n dropSpacing: 50\n },\n L: {\n itemPadding: {\n 'vertical': {\n 'medium': 78,\n 'large': 98\n },\n 'horizontal': {\n 'medium': 150,\n 'large': 170\n }\n },\n minItemSize: {\n 'vertical': new Size(208, 208),\n 'horizontal': new Size(102, 102)\n },\n maxItemSize: new Size(Infinity, Infinity),\n margin: 24,\n minSpace: new Size(18, 18),\n maxColumns: Infinity,\n dropSpacing: 100\n }\n};\n\nexport class GridLayout<T> extends BaseLayout<T> {\n protected minItemSize: Size;\n protected maxItemSize: Size;\n protected minSpace: Size;\n protected maxColumns: number;\n itemPadding: number;\n cardOrientation: Orientation;\n protected itemSize: Size;\n protected numColumns: number;\n protected numRows: number;\n protected horizontalSpacing: number;\n\n constructor(options: GridLayoutOptions = {}) {\n super(options);\n let cardSize = 'L';\n this.cardOrientation = options.cardOrientation || 'vertical';\n this.minItemSize = options.minItemSize || DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];\n this.maxItemSize = options.maxItemSize || DEFAULT_OPTIONS[cardSize].maxItemSize;\n this.margin = options.margin != null ? options.margin : DEFAULT_OPTIONS[cardSize].margin;\n this.minSpace = options.minSpace || DEFAULT_OPTIONS[cardSize].minSpace;\n this.maxColumns = options.maxColumns || DEFAULT_OPTIONS[cardSize].maxColumns;\n this.itemPadding = options.itemPadding != null ? options.itemPadding : DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];\n this.itemSize = null;\n this.numColumns = 0;\n this.numRows = 0;\n this.horizontalSpacing = 0;\n }\n\n get layoutType() {\n return 'grid';\n }\n\n getIndexAtPoint(x, y, allowInsertingAtEnd = false) {\n let itemHeight = this.itemSize.height + this.minSpace.height;\n let itemWidth = this.itemSize.width + this.horizontalSpacing;\n return Math.max(0,\n Math.min(\n this.collection.size - (allowInsertingAtEnd ? 0 : 1),\n Math.floor(y / itemHeight) * this.numColumns + Math.floor((x - this.horizontalSpacing) / itemWidth)\n )\n );\n }\n\n buildCollection() {\n let visibleWidth = this.virtualizer.visibleRect.width;\n let visibleHeight = this.virtualizer.visibleRect.height;\n let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;\n let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;\n let minCardWidth = this.minItemSize.width + horizontalItemPadding;\n\n // Compute the number of rows and columns needed to display the content\n let availableWidth = visibleWidth - this.margin * 2;\n let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));\n this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));\n this.numRows = Math.ceil(this.collection.size / this.numColumns);\n\n // Compute the available width (minus the space between items)\n let width = availableWidth - (this.minSpace.width * Math.max(0, this.numColumns - 1));\n\n // Compute the item width based on the space available\n let itemWidth = Math.floor(width / this.numColumns);\n itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth));\n // Compute the item height, which is proportional to the item width\n let t = ((itemWidth - minCardWidth) / minCardWidth);\n let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);\n itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;\n this.itemSize = new Size(itemWidth, itemHeight);\n\n // Compute the horizontal spacing and content height\n this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));\n\n let y = this.margin;\n let index = 0;\n for (let node of this.collection) {\n let layoutInfo = this.buildChild(node, y, index);\n y = layoutInfo.rect.maxY;\n index++;\n }\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 = visibleHeight || 60;\n }\n\n let rect = new Rect(0, loaderY, visibleWidth, 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, visibleWidth, visibleHeight);\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(visibleWidth, y);\n }\n\n buildChild(node: Node<T>, y: number, index: number): LayoutInfo {\n let row = Math.floor(index / this.numColumns);\n let column = index % this.numColumns;\n let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);\n y = this.margin + row * (this.itemSize.height + this.minSpace.height);\n\n let rect = new Rect(x, y, this.itemSize.width, this.itemSize.height);\n // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.allowOverflow = true;\n this.layoutInfos.set(node.key, layoutInfo);\n return layoutInfo;\n }\n\n // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,\n // then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the\n // collection contents by that number (which will give us the row distribution)\n getKeyBelow(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 let indexRowBelow;\n let index = this.collection.rows.findIndex(card => card.key === parentRowKey);\n if (index !== -1) {\n indexRowBelow = index + this.numColumns;\n } else {\n return null;\n }\n\n let row = this.collection.rows[indexRowBelow];\n return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;\n }\n\n getKeyAbove(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 let indexRowAbove;\n let index = this.collection.rows.findIndex(card => card.key === parentRowKey);\n if (index !== -1) {\n indexRowAbove = index - this.numColumns;\n } else {\n return null;\n }\n\n let row = this.collection.rows[indexRowAbove];\n return row ? getFirstItem(getChildNodes(row, this.collection))?.key : null;\n }\n}\n"],"names":[],"version":3,"file":"GridLayout.module.js.map"}
@@ -8,6 +8,7 @@ function $parcel$export(e, n, v, s) {
8
8
  }
9
9
 
10
10
  $parcel$export(module.exports, "WaterfallLayout", () => $632abf8fbf0ad57b$export$e9f7cda058ba8df8);
11
+ // @ts-nocheck
11
12
  /*
12
13
  * Copyright 2021 Adobe. All rights reserved.
13
14
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1 +1 @@
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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,eAAe,CAAC;IAC9F;IAEA,aAAa,GAAQ,EAAE;QACrB,2EAA2E;QAC3E,IAAI,eAAe,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,SAAS;QACzD,OAAO,IAAI,CAAC,SAAS,KAAK,QAAS,IAAI,CAAC,eAAe,CAAC,gBAAgB,IAAI,CAAC,cAAc,CAAC;IAC9F;IA5LA,YAAY,UAAkC,CAAC,CAAC,CAAE;QAChD,+GAA+G;QAC/G,uCAAuC;QACvC,KAAK,CAAC;QACN,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,mCAAG,EAAE,KAAK;QACxD,IAAI,CAAC,WAAW,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"}
1
+ {"mappings":";;;;;;;;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;;;AA+BM,MAAM,kDAA2B,CAAA,GAAA,oCAAS;IA0B/C,IAAI,aAAa;QACf,OAAO;IACT;IAEA,gBAAgB,mBAAwC,EAAE;QACxD,8DA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AO,IAAI,CAAC,SAAS,KAAK,QAAS,IAAI,CAAC,cAAc,CAAC,gBAAgB,IAAI,CAAC,eAAe,CAAC;IAC9F;IAEA,aAAa,GAAQ,EAAE;QACrB,2EAA2E;QAC3E,IAAI,eAAe,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,SAAS;QACzD,OAAO,IAAI,CAAC,SAAS,KAAK,QAAS,IAAI,CAAC,eAAe,CAAC,gBAAgB,IAAI,CAAC,cAAc,CAAC;IAC9F;IA5LA,YAAY,UAAkC,CAAC,CAAC,CAAE;QAChD,+GAA+G;QAC/G,uCAAuC;QACvC,KAAK,CAAC;QACN,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,mCAAG,EAAE,KAAK;QACxD,IAAI,CAAC,WAAW,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":["// @ts-nocheck\n/*\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"}
@@ -2,6 +2,7 @@ import {BaseLayout as $3d424c147206bac9$export$64943d2e59d72a29} from "./BaseLay
2
2
  import {getFirstItem as $bRzF0$getFirstItem, getChildNodes as $bRzF0$getChildNodes} from "@react-stately/collections";
3
3
  import {Rect as $bRzF0$Rect, LayoutInfo as $bRzF0$LayoutInfo, Size as $bRzF0$Size} from "@react-stately/virtualizer";
4
4
 
5
+ // @ts-nocheck
5
6
  /*
6
7
  * Copyright 2021 Adobe. All rights reserved.
7
8
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -2,6 +2,7 @@ import {BaseLayout as $3d424c147206bac9$export$64943d2e59d72a29} from "./BaseLay
2
2
  import {getFirstItem as $bRzF0$getFirstItem, getChildNodes as $bRzF0$getChildNodes} from "@react-stately/collections";
3
3
  import {Rect as $bRzF0$Rect, LayoutInfo as $bRzF0$LayoutInfo, Size as $bRzF0$Size} from "@react-stately/virtualizer";
4
4
 
5
+ // @ts-nocheck
5
6
  /*
6
7
  * Copyright 2021 Adobe. All rights reserved.
7
8
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1 +1 @@
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,G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;QACxD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,WAAG,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,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"}
1
+ {"mappings":";;;;AAAA,cAAc;AACd;;;;;;;;;;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;QAC9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G,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;QACxD,IAAI,CAAC,WAAW,GAAG,QAAQ,WAAW,IAAI,IAAI,CAAA,GAAA,WAAG,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,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":["// @ts-nocheck\n/*\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"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAnCA,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAA4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sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"card_vars_css.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAnCA,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAA4B,CAAC,cAAc,CAAC;AAC5C,4CAA2B,CAAC,aAAa,CAAC;AAC1C,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAA4B,CAAC,cAAc,CAAC;AAC5C,2CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,2CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAAkD,CAAC,oCAAoC,CAAC;AACxF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,4CAAsD,CAAC,wCAAwC,CAAC;AAChG,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,2CAA2C;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0B,CAAC,YAAY,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index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4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,4CAAkD,CAAC,oCAAoC,CAAC;AACxF,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAAuC,CAAC,yBAAyB,CAAC;AAClE,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAAsC,CAAC,wBAAwB,CAAC;AAChE,4CAAsD,CAAC,wCAAwC,CAAC;AAChG,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,0CAA0C,CAAC;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0B,CAAC,YAAY,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"card_vars_css.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IA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AwB,CAAC;AAChE,4CAAsD,CAAC,wCAAwC,CAAC;AAChG,4CAA0C,CAAC,4BAA4B,CAAC;AACxE,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,2CAA2C;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAA0B,CAAC,YAAY,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"card_vars_css.module.js.map"}
package/dist/types.d.ts CHANGED
@@ -35,17 +35,17 @@ declare class BaseLayout<T> extends Layout<Node<T>, CardViewLayoutOptions> imple
35
35
  getLayoutInfo(key: Key): LayoutInfo;
36
36
  getVisibleLayoutInfos(rect: Rect, excludePersistedKeys?: boolean): LayoutInfo[];
37
37
  isVisible(layoutInfo: LayoutInfo, rect: Rect, excludePersistedKeys: boolean): boolean;
38
- _findClosestLayoutInfo(target: Rect, rect: Rect): any;
39
- _findClosest(target: Rect, rect: Rect): any;
40
- getKeyBelow(key: Key): Key;
41
- getKeyAbove(key: Key): Key;
42
- getKeyRightOf(key: Key): Key;
43
- getKeyLeftOf(key: Key): Key;
44
- getFirstKey(): Key;
45
- getLastKey(): Key;
46
- getKeyPageAbove(key: Key): Key;
47
- getKeyPageBelow(key: Key): Key;
48
- getKeyForSearch(search: string, fromKey?: Key): Key;
38
+ _findClosestLayoutInfo(target: Rect, rect: Rect): null;
39
+ _findClosest(target: Rect, rect: Rect): null;
40
+ getKeyBelow(key: Key): Key | undefined;
41
+ getKeyAbove(key: Key): Key | undefined;
42
+ getKeyRightOf(key: Key): Key | undefined;
43
+ getKeyLeftOf(key: Key): Key | undefined;
44
+ getFirstKey(): Key | undefined;
45
+ getLastKey(): Key | undefined;
46
+ getKeyPageAbove(key: Key): Key | undefined;
47
+ getKeyPageBelow(key: Key): Key | undefined;
48
+ getKeyForSearch(search: string, fromKey?: Key): Key | null | undefined;
49
49
  }
50
50
  export interface GalleryLayoutOptions extends BaseLayoutOptions {
51
51
  /**
@@ -139,8 +139,8 @@ export class GridLayout<T> extends BaseLayout<T> {
139
139
  getIndexAtPoint(x: any, y: any, allowInsertingAtEnd?: boolean): number;
140
140
  buildCollection(): void;
141
141
  buildChild(node: Node<T>, y: number, index: number): LayoutInfo;
142
- getKeyBelow(key: Key): Key;
143
- getKeyAbove(key: Key): Key;
142
+ getKeyBelow(key: Key): Key | null | undefined;
143
+ getKeyAbove(key: Key): Key | null | undefined;
144
144
  }
145
145
  export interface WaterfallLayoutOptions extends BaseLayoutOptions {
146
146
  /**
@@ -177,10 +177,10 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
177
177
  buildCollection(invalidationContext: InvalidationContext): void;
178
178
  updateItemSize(key: Key, size: Size): boolean;
179
179
  getNextColumnIndex(columnHeights: any): number;
180
- getClosestRight(key: Key): Key;
181
- getClosestLeft(key: Key): Key;
182
- getKeyRightOf(key: Key): Key;
183
- getKeyLeftOf(key: Key): Key;
180
+ getClosestRight(key: Key): Key | undefined;
181
+ getClosestLeft(key: Key): Key | undefined;
182
+ getKeyRightOf(key: Key): Key | undefined;
183
+ getKeyLeftOf(key: Key): Key | undefined;
184
184
  }
185
185
  /**
186
186
  * TODO: Add description of component here.
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAkBA;IACE,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IAEzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,MAAM,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AE,MAAM,CAAC;IAC7B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC;gBAExB,OAAO,GAAE,sBAA2B;IAiBhD,IAAI,UAAU,WAEb;IAED,eAAe,CAAC,mBAAmB,EAAE,mBAAmB;IA6FxD,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;IAmBnC,kBAAkB,CAAC,aAAa,KAAA;IAWhC,eAAe,CAAC,GAAG,EAAE,GAAG;IAmBxB,cAAc,CAAC,GAAG,EAAE,GAAG;IAevB,aAAa,CAAC,GAAG,EAAE,GAAG;IAMtB,YAAY,CAAC,GAAG,EAAE,GAAG;CAKtB;AGQD;;GAEG;AACH,OAAA,MAAM,UAA0C,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC7MtI,OAAA,IAAI,MAAgB,0BAA0B,UAAU,iBAAiB,CAAC,GAAG,gBAAgB,iBAAiB,CAAC,GAAG,cAAc,YAAY,cAAc,CAAC,CAAC,CAAC,CAAC;ACtB9J,YAAY,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/BaseLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GalleryLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GridLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/WaterfallLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardViewContext.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardBase.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardView.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/Card.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/index.ts","packages/@react-spectrum/card/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\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\n/// <reference types=\"css-module-types\" />\n\nexport type {GalleryLayoutOptions} from './GalleryLayout';\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\n\nexport {CardView} from './CardView';\nexport {GalleryLayout} from './GalleryLayout';\nexport {GridLayout} from './GridLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\nexport {Card} from './Card';\nexport type {SpectrumCardViewProps} from '@react-types/card';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;AAmBA;IACE,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IAEzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;IACE,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,yBAAwB,CAAC,CAAE,SAAQ,OAAO,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAE,YAAW,gBAAgB;IACnG,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC5C,SAAS,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC;IAClC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAC5C,UAAU,EAAG,eAAe,CA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AAG;CAKtB;AGhND;;GAEG;AACH,OAAO,MAAM,UA8GP,CAAC,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACnG5F,OAAA,IAAI,MAAgB,0BAA0B,UAAU,iBAAiB,CAAC,GAAG,gBAAgB,iBAAiB,CAAC,GAAG,cAAc,YAAY,cAAc,CAAC,CAAC,CAAC,CAAC;ACvB9J,YAAY,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/BaseLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GalleryLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GridLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/WaterfallLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardViewContext.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardBase.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardView.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/Card.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/index.ts","packages/@react-spectrum/card/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\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\n/// <reference types=\"css-module-types\" />\n\nexport type {GalleryLayoutOptions} from './GalleryLayout';\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\n\nexport {CardView} from './CardView';\nexport {GalleryLayout} from './GalleryLayout';\nexport {GridLayout} from './GridLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\nexport {Card} from './Card';\nexport type {SpectrumCardViewProps} from '@react-types/card';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -803,9 +803,9 @@
803
803
  }
804
804
 
805
805
  .NOE1la_spectrum-Card--noLayout.NOE1la_spectrum-Card--default .NOE1la_spectrum-Card-illustration {
806
+ inline-size: 100%;
806
807
  block-size: var(--spectrum-card-coverphoto-height, var(--spectrum-global-dimension-size-1700));
807
808
  place-items: center;
808
- inline-size: 100%;
809
809
  display: grid;
810
810
  }
811
811
 
@@ -1179,9 +1179,9 @@
1179
1179
  }
1180
1180
 
1181
1181
  .NOE1la_spectrum-Card--noLayout.NOE1la_spectrum-Card--isQuiet .NOE1la_spectrum-Card-illustration {
1182
+ inline-size: 100%;
1182
1183
  block-size: var(--spectrum-card-coverphoto-height, var(--spectrum-global-dimension-size-1700));
1183
1184
  place-items: center;
1184
- inline-size: 100%;
1185
1185
  display: grid;
1186
1186
  }
1187
1187
 
@@ -1668,4 +1668,4 @@
1668
1668
  .NOE1la_spectrum-Card--horizontal .NOE1la_spectrum-Card-image, .NOE1la_spectrum-Card--horizontal .NOE1la_spectrum-Card-illustration {
1669
1669
  border-inline-end-color: var(--spectrum-card-coverphoto-border-color, var(--spectrum-global-color-gray-200));
1670
1670
  }
1671
- /*# sourceMappingURL=vars.081f4c73.css.map */
1671
+ /*# sourceMappingURL=vars.02438011.css.map */
@@ -1 +1 @@
1
- {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAwFJ;;;;;;;;;;AASE;;;;AA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;;;;;;AAOA;;;;AAIA;;;;;;;;;AAaF;;;;;;AACE;;;;AAMA;;;;AAWA;;;;;;;;;;;;AAYE;;;;;;;;AAgBF;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAkBA;;;;;AAMA;;;;AAGA;;;;;;;;AAOA;;;;AAIA;;;;;;;;;AAeF;;;;AAGE;;;;;;;;AAOA;;;;;AAoBA;;;;;;AAMC;;;;AAID;;;;AAcF;;;;AAIA;;;;AAiBA;;;;;AAIE;;;;AAEE;;;;AAOA;;;;AAQF;;;;AAEE;;;;AAQF;;;;AAEE;;;;AAKF;;;;AAEE;;;;AAKF;;;;AAEE;;;;;AAIA;;;;AAEE;;;;;AAMJ;;;;AAGA;;;;;AAME;;;;;AAMF;;;;AAcA;;;;AASF;;;;;AAKM;;;;;AAUA;;;;AAsBA;;;;AAgBA;;;;AAME;;;;AAQJ;;;;;AAwBF;;;;;;AAQF;;;;;AAGE;;;;AAGI;;;;AASA;;;;AASJ;;;;AAGI;;;;AASJ;;;;AAGI;;;;AAMJ;;;;AAGI;;;;AAMJ;;;;AAGI;;;;;AAKF;;;;AAGI;;;;;AASJ;;;;;AAMF","sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.081f4c73.css.map"}
1
+ {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;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A;;;;AAWA;;;;;;;;;;AAUE;;;;;;;;AASF;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAkBA;;;;;AAMA;;;;AAGA;;;;;;;;AAOA;;;;AAIA;;;;;;;;;AAaF;;;;;;AACE;;;;AAMA;;;;AAWA;;;;;;;;;;;;AAYE;;;;;;;;AAgBF;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAAA;;;;;AAkBA;;;;;AAMA;;;;AAGA;;;;;;;;AAOA;;;;AAIA;;;;;;;;;AAeF;;;;AAGE;;;;;;;;AAOA;;;;;AAoBA;;;;;;AAMC;;;;AAID;;;;AAcF;;;;AAIA;;;;AAiBA;;;;;AAIE;;;;AAEE;;;;AAOA;;;;AAQF;;;;AAEE;;;;AAQF;;;;AAEE;;;;AAKF;;;;AAEE;;;;AAKF;;;;AAEE;;;;;AAIA;;;;AAEE;;;;;AAMJ;;;;AAGA;;;;;AAME;;;;;AAMF;;;;AAcA;;;;AASF;;;;;AAKM;;;;;AAUA;;;;AAsBA;;;;AAgBA;;;;AAME;;;;AAQJ;;;;;AAwBF;;;;;;AAQF;;;;;AAGE;;;;AAGI;;;;AASA;;;;AASJ;;;;AAGI;;;;AASJ;;;;AAGI;;;;AAMJ;;;;AAGI;;;;AAMJ;;;;AAGI;;;;;AAKF;;;;AAGI;;;;;AASJ;;;;;AAMF","sources":["packages/@adobe/spectrum-css-temp/components/card/vars.css"],"sourcesContent":["/*\n * Copyright 2020 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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.02438011.css.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/card",
3
- "version": "3.0.0-alpha.37",
3
+ "version": "3.0.0-alpha.39",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,22 +36,22 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/focus": "^3.18.4",
40
- "@react-aria/grid": "^3.10.5",
41
- "@react-aria/i18n": "^3.12.3",
42
- "@react-aria/interactions": "^3.22.4",
43
- "@react-aria/utils": "^3.25.3",
44
- "@react-aria/virtualizer": "^4.0.4",
45
- "@react-spectrum/checkbox": "^3.9.10",
46
- "@react-spectrum/progress": "^3.7.10",
47
- "@react-spectrum/utils": "^3.11.11",
48
- "@react-stately/collections": "^3.11.0",
49
- "@react-stately/grid": "^3.9.3",
50
- "@react-stately/list": "^3.11.0",
51
- "@react-stately/virtualizer": "^4.1.0",
52
- "@react-types/card": "3.0.0-alpha.30",
53
- "@react-types/provider": "^3.8.4",
54
- "@react-types/shared": "^3.25.0",
39
+ "@react-aria/focus": "^3.19.1",
40
+ "@react-aria/grid": "^3.11.1",
41
+ "@react-aria/i18n": "^3.12.5",
42
+ "@react-aria/interactions": "^3.23.0",
43
+ "@react-aria/utils": "^3.27.0",
44
+ "@react-aria/virtualizer": "^4.1.1",
45
+ "@react-spectrum/checkbox": "^3.9.12",
46
+ "@react-spectrum/progress": "^3.7.12",
47
+ "@react-spectrum/utils": "^3.12.1",
48
+ "@react-stately/collections": "^3.12.1",
49
+ "@react-stately/grid": "^3.10.1",
50
+ "@react-stately/list": "^3.11.2",
51
+ "@react-stately/virtualizer": "^4.2.1",
52
+ "@react-types/card": "3.0.0-alpha.32",
53
+ "@react-types/provider": "^3.8.6",
54
+ "@react-types/shared": "^3.27.0",
55
55
  "@swc/helpers": "^0.5.0"
56
56
  },
57
57
  "devDependencies": {
@@ -59,11 +59,11 @@
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@react-spectrum/provider": "^3.0.0",
62
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
63
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
62
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
63
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
64
64
  },
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "8e0a28d188cdbdbd2b32296fa034b1b02ddde229"
68
+ "gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
69
69
  }
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
package/src/Card.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
package/src/CardBase.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -27,7 +28,10 @@ interface CardBaseProps<T> extends SpectrumCardProps {
27
28
  item?: Node<T>
28
29
  }
29
30
 
30
- function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDivElement>) {
31
+ /**
32
+ * TODO: Add description of component here.
33
+ */
34
+ export const CardBase = React.forwardRef(function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDivElement>) {
31
35
  props = useProviderProps(props);
32
36
  let context = useCardViewContext() || {}; // we can call again here, won't change from Card.tsx
33
37
  let {state} = context;
@@ -150,7 +154,7 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
150
154
  </article>
151
155
  </FocusRing>
152
156
  );
153
- }
157
+ });
154
158
 
155
159
  interface AriaCardOptions extends AriaCardProps {
156
160
  }
@@ -182,9 +186,3 @@ function useCard(props: AriaCardOptions): CardAria {
182
186
  contentProps
183
187
  };
184
188
  }
185
-
186
- /**
187
- * TODO: Add description of component here.
188
- */
189
- const _CardBase = React.forwardRef(CardBase);
190
- export {_CardBase as CardBase};
package/src/CardView.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -29,7 +30,10 @@ import {useListState} from '@react-stately/list';
29
30
  import {useProvider} from '@react-spectrum/provider';
30
31
  import {Virtualizer, VirtualizerItem} from '@react-aria/virtualizer';
31
32
 
32
- function CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef<HTMLDivElement>) {
33
+ /**
34
+ * TODO: Add description of component here.
35
+ */
36
+ export const CardView = React.forwardRef(function CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef<HTMLDivElement>) {
33
37
  let {scale} = useProvider();
34
38
  let {styleProps} = useStyleProps(props);
35
39
  let domRef = useDOMRef(ref);
@@ -139,7 +143,7 @@ function CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef
139
143
  </CardViewContext.Provider>
140
144
 
141
145
  );
142
- }
146
+ }) as <T>(props: SpectrumCardViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
143
147
 
144
148
  function LoadingState() {
145
149
  let {state} = useCardViewContext();
@@ -244,9 +248,3 @@ function InternalCard(props) {
244
248
  </div>
245
249
  );
246
250
  }
247
-
248
- /**
249
- * TODO: Add description of component here.
250
- */
251
- const _CardView = React.forwardRef(CardView) as <T>(props: SpectrumCardViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
252
- export {_CardView as CardView};
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2020 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /*
2
3
  * Copyright 2021 Adobe. All rights reserved.
3
4
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");