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C,WAAW,CAAC,MAAM,GAAG;QAC1B,OAAO;IACT;IAEU,UAAU,IAAa,EAAE,CAAS,EAAE,CAAS,EAAc;QACnE,IAAI,MAAM,KAAK,CAAC,UAAU,MAAM,GAAG;QACnC,gHAAgH;QAChH,IAAI,UAAU,CAAC,aAAa,GAAG;QAC/B,OAAO;IACT;;QAvDK,qBACG,YAAqB;;AAuD/B","sources":["packages/@adobe/react-spectrum/src/list/ListViewLayout.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport {\n  InvalidationContext,\n  LayoutInfo,\n  LayoutNode,\n  ListLayout,\n  ListLayoutOptions,\n  Rect\n} from 'react-stately/useVirtualizerState';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps extends ListLayoutOptions {\n  isLoading?: boolean;\n}\n\nexport class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {\n  private isLoading: boolean = false;\n\n  update(invalidationContext: InvalidationContext<ListViewLayoutProps>): void {\n    this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n    super.update(invalidationContext);\n  }\n\n  protected buildCollection(): LayoutNode[] {\n    let nodes = super.buildCollection();\n    let y = this.contentSize.height;\n\n    if (this.isLoading) {\n      let rect = new Rect(\n        0,\n        y,\n        this.virtualizer!.visibleRect.width,\n        nodes.length === 0 ? this.virtualizer!.visibleRect.height : (this.estimatedRowHeight ?? 48)\n      );\n      let loader = new LayoutInfo('loader', 'loader', rect);\n      let node = {\n        layoutInfo: loader,\n        validRect: loader.rect\n      };\n      nodes.push(node);\n      this.layoutNodes.set(loader.key, node);\n      y = loader.rect.maxY;\n    }\n\n    if (nodes.length === 0) {\n      let rect = new Rect(\n        0,\n        y,\n        this.virtualizer!.visibleRect.width,\n        this.virtualizer!.visibleRect.height\n      );\n      let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n      let node = {\n        layoutInfo: placeholder,\n        validRect: placeholder.rect\n      };\n      nodes.push(node);\n      this.layoutNodes.set(placeholder.key, node);\n      y = placeholder.rect.maxY;\n    }\n\n    this.contentSize.height = y;\n    return nodes;\n  }\n\n  protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n    let res = super.buildItem(node, x, y);\n    // allow overflow so the focus ring/selection ring can extend outside to overlap with the adjacent items borders\n    res.layoutInfo.allowOverflow = true;\n    return res;\n  }\n}\n"],"names":[],"version":3,"file":"ListViewLayout.cjs.map"}