@react-spectrum/list 3.8.3 → 3.9.0

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.
@@ -23,7 +23,8 @@ class $bc6cc67dd6240ebd$export$dab781655dfbb7d3 extends (0, $9jo3j$ListLayout) {
23
23
  let nodes = super.buildCollection();
24
24
  let y = this.contentSize.height;
25
25
  if (this.isLoading) {
26
- let rect = new (0, $9jo3j$Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);
26
+ var _this_estimatedRowHeight;
27
+ let rect = new (0, $9jo3j$Rect)(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : (_this_estimatedRowHeight = this.estimatedRowHeight) !== null && _this_estimatedRowHeight !== void 0 ? _this_estimatedRowHeight : 48);
27
28
  let loader = new (0, $9jo3j$LayoutInfo)('loader', 'loader', rect);
28
29
  let node = {
29
30
  layoutInfo: loader,
@@ -54,8 +55,7 @@ class $bc6cc67dd6240ebd$export$dab781655dfbb7d3 extends (0, $9jo3j$ListLayout) {
54
55
  return res;
55
56
  }
56
57
  constructor(...args){
57
- super(...args);
58
- this.isLoading = false;
58
+ super(...args), this.isLoading = false;
59
59
  }
60
60
  }
61
61
 
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AASM,MAAM,kDAA0B,CAAA,GAAA,iBAAS;IAG9C,OAAO,mBAA6D,EAAQ;YACzD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;QACxC,IAAI,QAAQ,KAAK,CAAC;QAClB,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM;QAE/B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,OAAO,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB;YAChJ,IAAI,SAAS,IAAI,CAAA,GAAA,iBAAS,EAAE,UAAU,UAAU;YAChD,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,OAAO,IAAI;YACxB;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE;YACjC,IAAI,OAAO,IAAI,CAAC,IAAI;QACtB;QAEA,IAAI,MAAM,MAAM,KAAK,GAAG;YACtB,IAAI,OAAO,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM;YACjG,IAAI,cAAc,IAAI,CAAA,GAAA,iBAAS,EAAE,eAAe,eAAe;YAC/D,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,YAAY,IAAI;YAC7B;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,GAAG,EAAE;YACtC,IAAI,YAAY,IAAI,CAAC,IAAI;QAC3B;QAEA,IAAI,CAAC,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;;;aA5CQ,YAAqB;;AA6C/B","sources":["packages/@react-spectrum/list/src/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 {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps {\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(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);\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(0, y, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);\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.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AASM,MAAM,kDAA0B,CAAA,GAAA,iBAAS;IAG9C,OAAO,mBAA6D,EAAQ;YACzD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;QACxC,IAAI,QAAQ,KAAK,CAAC;QAClB,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM;QAE/B,IAAI,IAAI,CAAC,SAAS,EAAE;gBACyG;YAA3H,IAAI,OAAO,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,KAAK,EAAE,MAAM,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,MAAM,GAAG,CAAA,2BAAA,IAAI,CAAC,kBAAkB,cAAvB,sCAAA,2BAA2B;YACtJ,IAAI,SAAS,IAAI,CAAA,GAAA,iBAAS,EAAE,UAAU,UAAU;YAChD,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,OAAO,IAAI;YACxB;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE;YACjC,IAAI,OAAO,IAAI,CAAC,IAAI;QACtB;QAEA,IAAI,MAAM,MAAM,KAAK,GAAG;YACtB,IAAI,OAAO,IAAI,CAAA,GAAA,WAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,MAAM;YACnG,IAAI,cAAc,IAAI,CAAA,GAAA,iBAAS,EAAE,eAAe,eAAe;YAC/D,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,YAAY,IAAI;YAC7B;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,GAAG,EAAE;YACtC,IAAI,YAAY,IAAI,CAAC,IAAI;QAC3B;QAEA,IAAI,CAAC,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;;6BA5CQ,YAAqB;;AA6C/B","sources":["packages/@react-spectrum/list/src/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 {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListViewLayoutProps {\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(0, y, this.virtualizer!.visibleRect.width, nodes.length === 0 ? this.virtualizer!.visibleRect.height : this.estimatedRowHeight ?? 48);\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(0, y, this.virtualizer!.visibleRect.width, this.virtualizer!.visibleRect.height);\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.module.js.map"}
@@ -17,7 +17,7 @@ $parcel$export(module.exports, "default", () => $c59d3898f402f50b$export$2e2bcd8
17
17
 
18
18
  function $c59d3898f402f50b$export$2e2bcd8739ae039() {
19
19
  let { dropState: dropState, dragAndDropHooks: dragAndDropHooks } = (0, $63sFO$react.useContext)((0, $60684b441be8e84c$exports.ListViewContext));
20
- let ref = (0, $63sFO$react.useRef)(undefined);
20
+ let ref = (0, $63sFO$react.useRef)(null);
21
21
  let { dropIndicatorProps: dropIndicatorProps } = dragAndDropHooks.useDropIndicator({
22
22
  target: {
23
23
  type: 'root'
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAIe;IACb,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAE;IACjB,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAiB,gBAAgB,CAAC;QAC3D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAW;IACd,IAAI,eAAe,UAAU,YAAY,CAAC;QAAC,MAAM;IAAM;IACvD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,gDAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,0DAAC;QACC,MAAK;QACL,iBAAc;qBACd,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/@react-spectrum/list/src/RootDropIndicator.tsx"],"sourcesContent":["import {ListViewContext} from './ListView';\nimport React, {useContext, useRef} from 'react';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport default function RootDropIndicator() {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext);\n let ref = useRef(undefined);\n let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator({\n target: {type: 'root'}\n }, dropState, ref);\n let isDropTarget = dropState.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"RootDropIndicator.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAIe;IACb,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAyB;IACxC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,gDAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,0DAAC;QACC,MAAK;QACL,iBAAc;qBACd,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/@react-spectrum/list/src/RootDropIndicator.tsx"],"sourcesContent":["import {ListViewContext} from './ListView';\nimport React, {useContext, useRef} from 'react';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport default function RootDropIndicator() {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;\n let ref = useRef<HTMLDivElement | null>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"RootDropIndicator.main.js.map"}
@@ -7,7 +7,7 @@ import {useVisuallyHidden as $jzbuT$useVisuallyHidden} from "@react-aria/visuall
7
7
 
8
8
  function $41a60729487a82d7$export$2e2bcd8739ae039() {
9
9
  let { dropState: dropState, dragAndDropHooks: dragAndDropHooks } = (0, $jzbuT$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
10
- let ref = (0, $jzbuT$useRef)(undefined);
10
+ let ref = (0, $jzbuT$useRef)(null);
11
11
  let { dropIndicatorProps: dropIndicatorProps } = dragAndDropHooks.useDropIndicator({
12
12
  target: {
13
13
  type: 'root'
@@ -7,7 +7,7 @@ import {useVisuallyHidden as $jzbuT$useVisuallyHidden} from "@react-aria/visuall
7
7
 
8
8
  function $41a60729487a82d7$export$2e2bcd8739ae039() {
9
9
  let { dropState: dropState, dragAndDropHooks: dragAndDropHooks } = (0, $jzbuT$useContext)((0, $f85fb77f9d4cbc6c$export$870039b0abfe3de0));
10
- let ref = (0, $jzbuT$useRef)(undefined);
10
+ let ref = (0, $jzbuT$useRef)(null);
11
11
  let { dropIndicatorProps: dropIndicatorProps } = dragAndDropHooks.useDropIndicator({
12
12
  target: {
13
13
  type: 'root'
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAIe;IACb,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,IAAI,MAAM,CAAA,GAAA,aAAK,EAAE;IACjB,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAiB,gBAAgB,CAAC;QAC3D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAW;IACd,IAAI,eAAe,UAAU,YAAY,CAAC;QAAC,MAAM;IAAM;IACvD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,gCAAC;QACC,MAAK;QACL,iBAAc;qBACd,gCAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/@react-spectrum/list/src/RootDropIndicator.tsx"],"sourcesContent":["import {ListViewContext} from './ListView';\nimport React, {useContext, useRef} from 'react';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport default function RootDropIndicator() {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext);\n let ref = useRef(undefined);\n let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator({\n target: {type: 'root'}\n }, dropState, ref);\n let isDropTarget = dropState.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"RootDropIndicator.module.js.map"}
1
+ {"mappings":";;;;;;;AAIe;IACb,IAAI,aAAC,SAAS,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc;IAC7D,IAAI,MAAM,CAAA,GAAA,aAAK,EAAyB;IACxC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;qBAC5D,gCAAC;QACC,MAAK;QACL,iBAAc;qBACd,gCAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/@react-spectrum/list/src/RootDropIndicator.tsx"],"sourcesContent":["import {ListViewContext} from './ListView';\nimport React, {useContext, useRef} from 'react';\nimport {useVisuallyHidden} from '@react-aria/visually-hidden';\n\nexport default function RootDropIndicator() {\n let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;\n let ref = useRef<HTMLDivElement | null>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']}>\n <div\n role=\"gridcell\"\n aria-selected=\"false\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"RootDropIndicator.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;AKoCA,uCAAuC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,4BAA4B,CAAC,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;IAC9K;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gHAAgH;IAChH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACnC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;CACxD;AA8RD;;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;AClVtI,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC","sources":["packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/InsertionIndicator.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListViewItem.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListViewLayout.ts","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/RootDropIndicator.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/DragPreview.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListView.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/index.ts","packages/@react-spectrum/list/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2022 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\nexport {ListView} from './ListView';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumListViewProps} from './ListView';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AKoCA,uCAAuC,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,4BAA4B,CAAC,EAAE,UAAU,EAAE,sBAAsB,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC;IAC9K;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gHAAgH;IAChH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACnC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;CACxD;AAoSD;;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;ACxVtI,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC","sources":["packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/InsertionIndicator.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListViewItem.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListViewLayout.ts","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/RootDropIndicator.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/DragPreview.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/ListView.tsx","packages/@react-spectrum/list/src/packages/@react-spectrum/list/src/index.ts","packages/@react-spectrum/list/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2022 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\nexport {ListView} from './ListView';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumListViewProps} from './ListView';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/list",
3
- "version": "3.8.3",
3
+ "version": "3.9.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,28 +36,28 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/button": "^3.10.1",
40
- "@react-aria/focus": "^3.18.4",
41
- "@react-aria/gridlist": "^3.9.5",
42
- "@react-aria/i18n": "^3.12.3",
43
- "@react-aria/interactions": "^3.22.4",
44
- "@react-aria/selection": "^3.20.1",
45
- "@react-aria/utils": "^3.25.3",
46
- "@react-aria/virtualizer": "^4.0.4",
47
- "@react-aria/visually-hidden": "^3.8.17",
48
- "@react-spectrum/checkbox": "^3.9.10",
49
- "@react-spectrum/dnd": "^3.4.3",
50
- "@react-spectrum/layout": "^3.6.9",
51
- "@react-spectrum/progress": "^3.7.10",
52
- "@react-spectrum/text": "^3.5.9",
53
- "@react-spectrum/utils": "^3.11.11",
54
- "@react-stately/collections": "^3.11.0",
55
- "@react-stately/layout": "^4.0.3",
56
- "@react-stately/list": "^3.11.0",
57
- "@react-stately/virtualizer": "^4.1.0",
58
- "@react-types/grid": "^3.2.9",
59
- "@react-types/shared": "^3.25.0",
60
- "@spectrum-icons/ui": "^3.6.10",
39
+ "@react-aria/button": "^3.11.0",
40
+ "@react-aria/focus": "^3.19.0",
41
+ "@react-aria/gridlist": "^3.10.0",
42
+ "@react-aria/i18n": "^3.12.4",
43
+ "@react-aria/interactions": "^3.22.5",
44
+ "@react-aria/selection": "^3.21.0",
45
+ "@react-aria/utils": "^3.26.0",
46
+ "@react-aria/virtualizer": "^4.1.0",
47
+ "@react-aria/visually-hidden": "^3.8.18",
48
+ "@react-spectrum/checkbox": "^3.9.11",
49
+ "@react-spectrum/dnd": "^3.5.0",
50
+ "@react-spectrum/layout": "^3.6.10",
51
+ "@react-spectrum/progress": "^3.7.11",
52
+ "@react-spectrum/text": "^3.5.10",
53
+ "@react-spectrum/utils": "^3.12.0",
54
+ "@react-stately/collections": "^3.12.0",
55
+ "@react-stately/layout": "^4.1.0",
56
+ "@react-stately/list": "^3.11.1",
57
+ "@react-stately/virtualizer": "^4.2.0",
58
+ "@react-types/grid": "^3.2.10",
59
+ "@react-types/shared": "^3.26.0",
60
+ "@spectrum-icons/ui": "^3.6.11",
61
61
  "@swc/helpers": "^0.5.0",
62
62
  "react-transition-group": "^4.4.5"
63
63
  },
@@ -69,11 +69,11 @@
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@react-spectrum/provider": "^3.2.0",
72
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
73
- "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
72
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
73
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "8e0a28d188cdbdbd2b32296fa034b1b02ddde229"
78
+ "gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
79
79
  }
@@ -11,14 +11,14 @@ interface InsertionIndicatorProps {
11
11
  }
12
12
 
13
13
  export default function InsertionIndicator(props: InsertionIndicatorProps) {
14
- let {dropState, dragAndDropHooks} = useContext(ListViewContext);
14
+ let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;
15
15
  const {target, isPresentationOnly} = props;
16
16
 
17
- let ref = useRef(undefined);
18
- let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator(props, dropState, ref);
17
+ let ref = useRef<HTMLDivElement | null>(null);
18
+ let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!(props, dropState!, ref);
19
19
  let {visuallyHiddenProps} = useVisuallyHidden();
20
20
 
21
- let isDropTarget = dropState.isDropTarget(target);
21
+ let isDropTarget = dropState!.isDropTarget(target);
22
22
 
23
23
  if (!isDropTarget && dropIndicatorProps['aria-hidden']) {
24
24
  return null;
package/src/ListView.tsx CHANGED
@@ -64,18 +64,18 @@ export interface SpectrumListViewProps<T> extends Omit<AriaGridListProps<T>, 'ke
64
64
 
65
65
  interface ListViewContextValue<T> {
66
66
  state: ListState<T>,
67
- dragState: DraggableCollectionState,
68
- dropState: DroppableCollectionState,
69
- dragAndDropHooks: DragAndDropHooks['dragAndDropHooks'],
70
- onAction:(key: Key) => void,
67
+ dragState: DraggableCollectionState | null,
68
+ dropState: DroppableCollectionState | null,
69
+ dragAndDropHooks?: DragAndDropHooks['dragAndDropHooks'],
70
+ onAction?: (key: Key) => void,
71
71
  isListDraggable: boolean,
72
72
  isListDroppable: boolean,
73
73
  layout: ListViewLayout<T>,
74
- loadingState: LoadingState,
74
+ loadingState?: LoadingState,
75
75
  renderEmptyState?: () => JSX.Element
76
76
  }
77
77
 
78
- export const ListViewContext = React.createContext<ListViewContextValue<unknown>>(null);
78
+ export const ListViewContext = React.createContext<ListViewContextValue<unknown> | null>(null);
79
79
 
80
80
  const ROW_HEIGHTS = {
81
81
  compact: {
@@ -96,7 +96,7 @@ function useListLayout<T>(state: ListState<T>, density: SpectrumListViewProps<T>
96
96
  let {scale} = useProvider();
97
97
  let layout = useMemo(() =>
98
98
  new ListViewLayout<T>({
99
- estimatedRowHeight: ROW_HEIGHTS[density][scale]
99
+ estimatedRowHeight: ROW_HEIGHTS[density || 'regular'][scale]
100
100
  })
101
101
  // eslint-disable-next-line react-hooks/exhaustive-deps
102
102
  , [scale, density, overflowMode]);
@@ -138,15 +138,15 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
138
138
  let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
139
139
 
140
140
  let {styleProps} = useStyleProps(props);
141
- let dragState: DraggableCollectionState;
141
+ let dragState: DraggableCollectionState | null = null;
142
142
  let preview = useRef(null);
143
- if (isListDraggable) {
144
- dragState = dragAndDropHooks.useDraggableCollectionState({
143
+ if (isListDraggable && dragAndDropHooks) {
144
+ dragState = dragAndDropHooks.useDraggableCollectionState!({
145
145
  collection,
146
146
  selectionManager,
147
147
  preview
148
148
  });
149
- dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
149
+ dragAndDropHooks.useDraggableCollection!({}, dragState, domRef);
150
150
  }
151
151
  let layout = useListLayout(
152
152
  state,
@@ -155,18 +155,18 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
155
155
  );
156
156
 
157
157
  let DragPreview = dragAndDropHooks?.DragPreview;
158
- let dropState: DroppableCollectionState;
159
- let droppableCollection: DroppableCollectionResult;
160
- let isRootDropTarget: boolean;
161
- if (isListDroppable) {
162
- dropState = dragAndDropHooks.useDroppableCollectionState({
158
+ let dropState: DroppableCollectionState | null = null;
159
+ let droppableCollection: DroppableCollectionResult | null = null;
160
+ let isRootDropTarget = false;
161
+ if (isListDroppable && dragAndDropHooks) {
162
+ dropState = dragAndDropHooks.useDroppableCollectionState!({
163
163
  collection,
164
164
  selectionManager
165
165
  });
166
- droppableCollection = dragAndDropHooks.useDroppableCollection({
166
+ droppableCollection = dragAndDropHooks.useDroppableCollection!({
167
167
  keyboardDelegate: new ListKeyboardDelegate({
168
168
  collection,
169
- disabledKeys: dragState?.draggingKeys.size ? null : selectionManager.disabledKeys,
169
+ disabledKeys: dragState?.draggingKeys.size ? undefined : selectionManager.disabledKeys,
170
170
  ref: domRef,
171
171
  layoutDelegate: layout
172
172
  }),
@@ -216,7 +216,7 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
216
216
  <FocusScope>
217
217
  <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>
218
218
  <Virtualizer
219
- {...mergeProps(isListDroppable && droppableCollection?.collectionProps, gridProps)}
219
+ {...mergeProps(isListDroppable ? droppableCollection?.collectionProps : null, gridProps)}
220
220
  {...filterDOMProps(otherProps)}
221
221
  {...gridProps}
222
222
  {...styleProps}
@@ -247,7 +247,7 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
247
247
  layout={layout}
248
248
  layoutOptions={useMemo(() => ({isLoading}), [isLoading])}
249
249
  collection={collection}>
250
- {useCallback((type, item) => {
250
+ {useCallback((type, item: Node<T>) => {
251
251
  if (type === 'item') {
252
252
  return <Item item={item} />;
253
253
  } else if (type === 'loader') {
@@ -259,15 +259,21 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
259
259
  </Virtualizer>
260
260
  </FocusRing>
261
261
  </FocusScope>
262
- {DragPreview && isListDraggable &&
262
+ {DragPreview && isListDraggable && dragAndDropHooks && dragState &&
263
263
  <DragPreview ref={preview}>
264
264
  {() => {
265
+ if (dragState.draggedKey == null) {
266
+ return null;
267
+ }
265
268
  if (dragAndDropHooks.renderPreview) {
266
269
  return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);
267
270
  }
268
271
  let item = state.collection.getItem(dragState.draggedKey);
272
+ if (!item) {
273
+ return null;
274
+ }
269
275
  let itemCount = dragState.draggingKeys.size;
270
- let itemHeight = layout.getLayoutInfo(dragState.draggedKey).rect.height;
276
+ let itemHeight = layout.getLayoutInfo(dragState.draggedKey)?.rect.height ?? 0;
271
277
  return <SpectrumDragPreview item={item} itemCount={itemCount} itemHeight={itemHeight} density={density} />;
272
278
  }}
273
279
  </DragPreview>
@@ -277,7 +283,7 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
277
283
  }
278
284
 
279
285
  function Item({item}: {item: Node<unknown>}) {
280
- let {isListDroppable, state, onAction} = useContext(ListViewContext);
286
+ let {isListDroppable, state, onAction} = useContext(ListViewContext)!;
281
287
  return (
282
288
  <>
283
289
  {isListDroppable && state.collection.getKeyBefore(item.key) == null &&
@@ -300,7 +306,7 @@ function Item({item}: {item: Node<unknown>}) {
300
306
  }
301
307
 
302
308
  function LoadingView() {
303
- let {state} = useContext(ListViewContext);
309
+ let {state} = useContext(ListViewContext)!;
304
310
  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/list');
305
311
  return (
306
312
  <CenteredWrapper>
@@ -312,7 +318,7 @@ function LoadingView() {
312
318
  }
313
319
 
314
320
  function EmptyState() {
315
- let {renderEmptyState} = useContext(ListViewContext);
321
+ let {renderEmptyState} = useContext(ListViewContext)!;
316
322
  let emptyState = renderEmptyState ? renderEmptyState() : null;
317
323
  if (emptyState == null) {
318
324
  return null;
@@ -326,7 +332,7 @@ function EmptyState() {
326
332
  }
327
333
 
328
334
  function CenteredWrapper({children}) {
329
- let {state} = useContext(ListViewContext);
335
+ let {state} = useContext(ListViewContext)!;
330
336
  return (
331
337
  <div
332
338
  role="row"
@@ -14,7 +14,7 @@ import ChevronLeftMedium from '@spectrum-icons/ui/ChevronLeftMedium';
14
14
  import ChevronRightMedium from '@spectrum-icons/ui/ChevronRightMedium';
15
15
  import {classNames, ClearSlots, SlotProvider, useHasChild} from '@react-spectrum/utils';
16
16
  import {CSSTransition} from 'react-transition-group';
17
- import type {DraggableItemResult, DropIndicatorAria, DroppableItemResult} from '@react-aria/dnd';
17
+ import type {DraggableItemResult, DropIndicatorAria} from '@react-aria/dnd';
18
18
  import {DropTarget, Node} from '@react-types/shared';
19
19
  import {FocusRing, useFocusRing} from '@react-aria/focus';
20
20
  import {Grid} from '@react-spectrum/layout';
@@ -51,10 +51,10 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
51
51
  layout,
52
52
  dragAndDropHooks,
53
53
  loadingState
54
- } = useContext(ListViewContext);
54
+ } = useContext(ListViewContext)!;
55
55
  let {direction} = useLocale();
56
- let rowRef = useRef<HTMLDivElement>(undefined);
57
- let checkboxWrapperRef = useRef<HTMLDivElement>(undefined);
56
+ let rowRef = useRef<HTMLDivElement | null>(null);
57
+ let checkboxWrapperRef = useRef<HTMLDivElement | null>(null);
58
58
  let {
59
59
  isFocusVisible: isFocusVisibleWithin,
60
60
  focusProps: focusWithinProps
@@ -74,32 +74,30 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
74
74
  isVirtualized: true,
75
75
  shouldSelectOnPressUp: isListDraggable
76
76
  }, state, rowRef);
77
- let isDroppable = isListDroppable && !isDisabled;
78
77
  let {hoverProps, isHovered} = useHover({isDisabled: !allowsSelection && !hasAction});
79
78
 
80
79
  let {checkboxProps} = useGridListSelectionCheckbox({key: item.key}, state);
81
80
  let hasDescription = useHasChild(`.${listStyles['react-spectrum-ListViewItem-description']}`, rowRef);
82
81
 
83
- let draggableItem: DraggableItemResult;
84
- if (isListDraggable) {
85
- // eslint-disable-next-line react-hooks/rules-of-hooks
86
- draggableItem = dragAndDropHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);
82
+ let draggableItem: DraggableItemResult | null = null;
83
+ if (isListDraggable && dragAndDropHooks && dragState) {
84
+
85
+ draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);
87
86
  if (isDisabled) {
88
87
  draggableItem = null;
89
88
  }
90
89
  }
91
- let droppableItem: DroppableItemResult;
92
- let isDropTarget: boolean;
93
- let dropIndicator: DropIndicatorAria;
94
- let dropIndicatorRef = useRef(undefined);
95
- if (isListDroppable) {
90
+ let isDropTarget = false;
91
+ let dropIndicator: DropIndicatorAria | null = null;
92
+ let dropIndicatorRef = useRef<HTMLDivElement | null>(null);
93
+ if (isListDroppable && dragAndDropHooks && dropState) {
96
94
  let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;
97
95
  isDropTarget = dropState.isDropTarget(target);
98
- // eslint-disable-next-line react-hooks/rules-of-hooks
99
- dropIndicator = dragAndDropHooks.useDropIndicator({target}, dropState, dropIndicatorRef);
96
+
97
+ dropIndicator = dragAndDropHooks.useDropIndicator!({target}, dropState, dropIndicatorRef);
100
98
  }
101
99
 
102
- let dragButtonRef = React.useRef(undefined);
100
+ let dragButtonRef = React.useRef<HTMLDivElement | null>(null);
103
101
  let {buttonProps} = useButton({
104
102
  ...draggableItem?.dragButtonProps,
105
103
  elementType: 'div'
@@ -138,18 +136,19 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
138
136
  let showCheckbox = state.selectionManager.selectionMode !== 'none' && state.selectionManager.selectionBehavior === 'toggle';
139
137
  let {visuallyHiddenProps} = useVisuallyHidden();
140
138
 
141
- let dropProps = isDroppable ? droppableItem?.dropProps : {'aria-hidden': droppableItem?.dropProps['aria-hidden']};
142
139
  const mergedProps = mergeProps(
143
140
  rowProps,
144
141
  draggableItem?.dragProps,
145
- dropProps,
146
142
  hoverProps,
147
143
  focusWithinProps,
148
- focusProps,
149
- // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
150
- // allowing for single swipe navigation between row drop indicator
151
- dragAndDropHooks?.isVirtualDragging() && {tabIndex: null}
144
+ focusProps
152
145
  );
146
+
147
+ // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
148
+ // allowing for single swipe navigation between row drop indicator
149
+ if (dragAndDropHooks?.isVirtualDragging?.()) {
150
+ mergedProps.tabIndex = undefined;
151
+ }
153
152
 
154
153
  let isFirstRow = item.prevKey == null;
155
154
  let isLastRow = item.nextKey == null;
@@ -158,15 +157,15 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
158
157
  // with bottom border
159
158
  let isFlushWithContainerBottom = false;
160
159
  if (isLastRow && loadingState !== 'loadingMore') {
161
- if (layout.getContentSize()?.height >= layout.virtualizer?.visibleRect.height) {
160
+ if (layout.getContentSize()?.height >= (layout.virtualizer?.visibleRect.height ?? 0)) {
162
161
  isFlushWithContainerBottom = true;
163
162
  }
164
163
  }
165
164
  // previous item isn't selected
166
165
  // and the previous item isn't focused or, if it is focused, then if focus globally isn't visible or just focus isn't in the listview
167
- let roundTops = (!state.selectionManager.isSelected(item.prevKey)
166
+ let roundTops = (!(item.prevKey != null && state.selectionManager.isSelected(item.prevKey))
168
167
  && (state.selectionManager.focusedKey !== item.prevKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));
169
- let roundBottoms = (!state.selectionManager.isSelected(item.nextKey)
168
+ let roundBottoms = (!(item.nextKey != null && state.selectionManager.isSelected(item.nextKey))
170
169
  && (state.selectionManager.focusedKey !== item.nextKey || !(isGlobalFocusVisible() && state.selectionManager.isFocused)));
171
170
 
172
171
  let content = typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered;
@@ -204,9 +203,9 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
204
203
  'is-hovered': isHovered,
205
204
  'is-selected': isSelected,
206
205
  'is-disabled': isDisabled,
207
- 'is-prev-selected': state.selectionManager.isSelected(item.prevKey),
208
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
209
- 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)),
206
+ 'is-prev-selected': item.prevKey != null && state.selectionManager.isSelected(item.prevKey),
207
+ 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
208
+ 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || (item.nextKey != null && state.selectionManager.isSelected(item.nextKey))),
210
209
  'react-spectrum-ListViewItem--dropTarget': !!isDropTarget,
211
210
  'react-spectrum-ListViewItem--firstRow': isFirstRow,
212
211
  'react-spectrum-ListViewItem--lastRow': isLastRow,
@@ -30,7 +30,7 @@ export class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {
30
30
  let y = this.contentSize.height;
31
31
 
32
32
  if (this.isLoading) {
33
- let rect = new Rect(0, y, this.virtualizer.visibleRect.width, nodes.length === 0 ? this.virtualizer.visibleRect.height : this.estimatedRowHeight);
33
+ let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, nodes.length === 0 ? this.virtualizer!.visibleRect.height : this.estimatedRowHeight ?? 48);
34
34
  let loader = new LayoutInfo('loader', 'loader', rect);
35
35
  let node = {
36
36
  layoutInfo: loader,
@@ -42,7 +42,7 @@ export class ListViewLayout<T> extends ListLayout<T, ListViewLayoutProps> {
42
42
  }
43
43
 
44
44
  if (nodes.length === 0) {
45
- let rect = new Rect(0, y, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
45
+ let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, this.virtualizer!.visibleRect.height);
46
46
  let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
47
47
  let node = {
48
48
  layoutInfo: placeholder,
@@ -3,12 +3,12 @@ import React, {useContext, useRef} from 'react';
3
3
  import {useVisuallyHidden} from '@react-aria/visually-hidden';
4
4
 
5
5
  export default function RootDropIndicator() {
6
- let {dropState, dragAndDropHooks} = useContext(ListViewContext);
7
- let ref = useRef(undefined);
8
- let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator({
6
+ let {dropState, dragAndDropHooks} = useContext(ListViewContext)!;
7
+ let ref = useRef<HTMLDivElement | null>(null);
8
+ let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({
9
9
  target: {type: 'root'}
10
- }, dropState, ref);
11
- let isDropTarget = dropState.isDropTarget({type: 'root'});
10
+ }, dropState!, ref);
11
+ let isDropTarget = dropState!.isDropTarget({type: 'root'});
12
12
  let {visuallyHiddenProps} = useVisuallyHidden();
13
13
 
14
14
  if (!isDropTarget && dropIndicatorProps['aria-hidden']) {