@react-spectrum/table 3.14.1 → 3.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/DragPreview.main.js +1 -1
  2. package/dist/DragPreview.mjs +1 -1
  3. package/dist/DragPreview.module.js +1 -1
  4. package/dist/InsertionIndicator.main.js +4 -3
  5. package/dist/InsertionIndicator.main.js.map +1 -1
  6. package/dist/InsertionIndicator.mjs +4 -3
  7. package/dist/InsertionIndicator.module.js +4 -3
  8. package/dist/InsertionIndicator.module.js.map +1 -1
  9. package/dist/Resizer.main.js +7 -7
  10. package/dist/Resizer.main.js.map +1 -1
  11. package/dist/Resizer.mjs +8 -8
  12. package/dist/Resizer.module.js +8 -8
  13. package/dist/Resizer.module.js.map +1 -1
  14. package/dist/RootDropIndicator.main.js +1 -1
  15. package/dist/RootDropIndicator.main.js.map +1 -1
  16. package/dist/RootDropIndicator.mjs +1 -1
  17. package/dist/RootDropIndicator.module.js +1 -1
  18. package/dist/RootDropIndicator.module.js.map +1 -1
  19. package/dist/TableView.main.js +2 -3
  20. package/dist/TableView.main.js.map +1 -1
  21. package/dist/TableView.mjs +2 -3
  22. package/dist/TableView.module.js +2 -3
  23. package/dist/TableView.module.js.map +1 -1
  24. package/dist/TableViewBase.main.js +81 -81
  25. package/dist/TableViewBase.main.js.map +1 -1
  26. package/dist/TableViewBase.mjs +81 -81
  27. package/dist/TableViewBase.module.js +81 -81
  28. package/dist/TableViewBase.module.js.map +1 -1
  29. package/dist/TableViewLayout.main.js +7 -5
  30. package/dist/TableViewLayout.main.js.map +1 -1
  31. package/dist/TableViewLayout.mjs +7 -5
  32. package/dist/TableViewLayout.module.js +7 -5
  33. package/dist/TableViewLayout.module.js.map +1 -1
  34. package/dist/TableViewWrapper.main.js +4 -5
  35. package/dist/TableViewWrapper.main.js.map +1 -1
  36. package/dist/TableViewWrapper.mjs +4 -5
  37. package/dist/TableViewWrapper.module.js +4 -5
  38. package/dist/TableViewWrapper.module.js.map +1 -1
  39. package/dist/TreeGridTableView.main.js +2 -3
  40. package/dist/TreeGridTableView.main.js.map +1 -1
  41. package/dist/TreeGridTableView.mjs +2 -3
  42. package/dist/TreeGridTableView.module.js +2 -3
  43. package/dist/TreeGridTableView.module.js.map +1 -1
  44. package/dist/table_vars_css.main.js.map +1 -1
  45. package/dist/table_vars_css.module.js.map +1 -1
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/{vars.bd693cb4.css → vars.27f08d5f.css} +2 -2
  48. package/dist/{vars.bd693cb4.css.map → vars.27f08d5f.css.map} +1 -1
  49. package/package.json +29 -29
  50. package/src/InsertionIndicator.tsx +5 -5
  51. package/src/Resizer.tsx +11 -13
  52. package/src/RootDropIndicator.tsx +4 -4
  53. package/src/TableView.tsx +2 -5
  54. package/src/TableViewBase.tsx +136 -126
  55. package/src/TableViewLayout.ts +11 -5
  56. package/src/TableViewWrapper.tsx +6 -9
  57. package/src/TreeGridTableView.tsx +2 -5
@@ -4,7 +4,7 @@ import {Nubbin as $cb7d341e8868d81d$export$d9658cdf8c86807} from "./Nubbin.mjs";
4
4
  import {Resizer as $fc695d2eafc2b351$export$48a76196cafe3b93, ResizeStateContext as $fc695d2eafc2b351$export$b517d84d4ad20b24} from "./Resizer.mjs";
5
5
  import {RootDropIndicator as $4e6fc36ba71ba405$export$d30a7814cfd4033e} from "./RootDropIndicator.mjs";
6
6
  import {DragPreview as $daa6ead3d9d3506a$export$905ab40ac2179daa} from "./DragPreview.mjs";
7
- import "./vars.bd693cb4.css";
7
+ import "./vars.27f08d5f.css";
8
8
  import $7lS7h$table_vars_cssmodulejs from "./table_vars_css.mjs";
9
9
  import "./table.11fc8462.css";
10
10
  import $7lS7h$table_cssmodulejs from "./table_css.mjs";
@@ -122,7 +122,7 @@ function $bd013581c0a4b065$export$3f8f74b6bfd2c5df() {
122
122
  return (0, $7lS7h$useContext)($bd013581c0a4b065$export$d288a7dd40372bc);
123
123
  }
124
124
  function $bd013581c0a4b065$var$TableViewBase(props, ref) {
125
- var _dropState_target;
125
+ var _dropState_target, _dragAndDropHooks_isVirtualDragging, _dragAndDropHooks_isVirtualDragging1;
126
126
  props = (0, $7lS7h$useProviderProps)(props);
127
127
  let { isQuiet: isQuiet, onAction: onAction, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, dragAndDropHooks: dragAndDropHooks, state: state } = props;
128
128
  let isTableDraggable = !!(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.useDraggableCollectionState);
@@ -148,25 +148,24 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
148
148
  // with table layout, so we need to track it here
149
149
  let [, setIsResizing] = (0, $7lS7h$useState)(false);
150
150
  let domRef = (0, $7lS7h$useDOMRef)(ref);
151
- let headerRef = (0, $7lS7h$useRef)(undefined);
152
- let bodyRef = (0, $7lS7h$useRef)(undefined);
151
+ let headerRef = (0, $7lS7h$useRef)(null);
152
+ let bodyRef = (0, $7lS7h$useRef)(null);
153
153
  let density = props.density || 'regular';
154
154
  let layout = (0, $7lS7h$useMemo)(()=>new (0, $5fb43af69b290859$export$725d101278f5a47b)({
155
155
  // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
156
- rowHeight: props.overflowMode === 'wrap' ? null : $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale],
157
- estimatedRowHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale] : null,
158
- headingHeight: props.overflowMode === 'wrap' ? null : $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale],
159
- estimatedHeadingHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale] : null
156
+ rowHeight: props.overflowMode === 'wrap' ? undefined : $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale],
157
+ estimatedRowHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale] : undefined,
158
+ headingHeight: props.overflowMode === 'wrap' ? undefined : $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale],
159
+ estimatedHeadingHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale] : undefined
160
160
  }), // don't recompute when state.collection changes, only used for initial value
161
- // eslint-disable-next-line react-hooks/exhaustive-deps
162
161
  [
163
162
  props.overflowMode,
164
163
  scale,
165
164
  density
166
165
  ]);
167
- let dragState;
166
+ let dragState = null;
168
167
  let preview = (0, $7lS7h$useRef)(null);
169
- if (isTableDraggable) {
168
+ if (isTableDraggable && dragAndDropHooks) {
170
169
  dragState = dragAndDropHooks.useDraggableCollectionState({
171
170
  collection: state.collection,
172
171
  selectionManager: state.selectionManager,
@@ -175,10 +174,10 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
175
174
  dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
176
175
  }
177
176
  let DragPreview = dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.DragPreview;
178
- let dropState;
179
- let droppableCollection;
180
- let isRootDropTarget;
181
- if (isTableDroppable) {
177
+ let dropState = null;
178
+ let droppableCollection = null;
179
+ let isRootDropTarget = false;
180
+ if (isTableDroppable && dragAndDropHooks) {
182
181
  dropState = dragAndDropHooks.useDroppableCollectionState({
183
182
  collection: state.collection,
184
183
  selectionManager: state.selectionManager
@@ -207,31 +206,35 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
207
206
  let [headerRowHovered, setHeaderRowHovered] = (0, $7lS7h$useState)(false);
208
207
  // This overrides collection view's renderWrapper to support DOM hierarchy.
209
208
  let renderWrapper = (0, $7lS7h$useCallback)((parent, reusableView, children, renderChildren)=>{
209
+ var _parent_layoutInfo;
210
210
  if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowGroup, {
211
211
  key: reusableView.key,
212
212
  layoutInfo: reusableView.layoutInfo,
213
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
213
+ parent: (_parent_layoutInfo = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo !== void 0 ? _parent_layoutInfo : null,
214
214
  // Override the default role="rowgroup" with role="presentation",
215
215
  // in favor or adding role="rowgroup" to the ScrollView with
216
216
  // ref={bodyRef} in the TableVirtualizer below.
217
217
  role: "presentation"
218
218
  }, renderChildren(children));
219
+ var _parent_layoutInfo1;
219
220
  if (reusableView.viewType === 'header') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeader, {
220
221
  key: reusableView.key,
221
222
  layoutInfo: reusableView.layoutInfo,
222
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
223
+ parent: (_parent_layoutInfo1 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo1 !== void 0 ? _parent_layoutInfo1 : null
223
224
  }, renderChildren(children));
225
+ var _parent_layoutInfo2;
224
226
  if (reusableView.viewType === 'row') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRow, {
225
227
  key: reusableView.key,
226
228
  item: reusableView.content,
227
229
  layoutInfo: reusableView.layoutInfo,
228
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
230
+ parent: (_parent_layoutInfo2 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo2 !== void 0 ? _parent_layoutInfo2 : null
229
231
  }, renderChildren(children));
232
+ var _parent_layoutInfo3;
230
233
  if (reusableView.viewType === 'headerrow') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeaderRow, {
231
234
  onHoverChange: setHeaderRowHovered,
232
235
  key: reusableView.key,
233
236
  layoutInfo: reusableView.layoutInfo,
234
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
237
+ parent: (_parent_layoutInfo3 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo3 !== void 0 ? _parent_layoutInfo3 : null,
235
238
  item: reusableView.content
236
239
  }, renderChildren(children));
237
240
  return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableCellWrapper, {
@@ -264,7 +267,7 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
264
267
  return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
265
268
  role: "gridcell",
266
269
  "aria-colindex": item.index + 1,
267
- "aria-colspan": item.colspan > 1 ? item.colspan : null
270
+ "aria-colspan": item.colspan != null && item.colspan > 1 ? item.colspan : undefined
268
271
  });
269
272
  case 'column':
270
273
  if (item.props.isSelectionCell) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableSelectAllCell, {
@@ -293,6 +296,7 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
293
296
  case 'empty':
294
297
  return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$EmptyState, null);
295
298
  }
299
+ return null;
296
300
  }, []);
297
301
  let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = (0, $7lS7h$useState)(false);
298
302
  let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = (0, $7lS7h$useState)(false);
@@ -313,7 +317,7 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
313
317
  let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7lS7h$useFocusRing)();
314
318
  let isEmpty = state.collection.size === 0;
315
319
  let onFocusedResizer = ()=>{
316
- bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
320
+ if (bodyRef.current && headerRef.current) bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
317
321
  };
318
322
  let onResizeStart = (0, $7lS7h$useCallback)((widths)=>{
319
323
  setIsResizing(true);
@@ -348,9 +352,8 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
348
352
  focusedKey,
349
353
  dropTargetKey
350
354
  ]);
351
- let mergedProps = (0, $7lS7h$mergeProps)(isTableDroppable && (droppableCollection === null || droppableCollection === void 0 ? void 0 : droppableCollection.collectionProps), gridProps, focusProps, (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
352
- tabIndex: null
353
- });
355
+ let mergedProps = (0, $7lS7h$mergeProps)(isTableDroppable ? droppableCollection === null || droppableCollection === void 0 ? void 0 : droppableCollection.collectionProps : null, gridProps, focusProps);
356
+ if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
354
357
  return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$93e4b0b2cc49b648.Provider, {
355
358
  value: {
356
359
  state: state,
@@ -393,11 +396,12 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
393
396
  headerRef: headerRef,
394
397
  bodyRef: bodyRef,
395
398
  isFocusVisible: isFocusVisible,
396
- isVirtualDragging: dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging(),
399
+ isVirtualDragging: (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging1 = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging1 === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging1.call(dragAndDropHooks)) || false,
397
400
  isRootDropTarget: isRootDropTarget
398
- }), DragPreview && isTableDraggable && /*#__PURE__*/ (0, $7lS7h$react).createElement(DragPreview, {
401
+ }), DragPreview && isTableDraggable && dragAndDropHooks && dragState && /*#__PURE__*/ (0, $7lS7h$react).createElement(DragPreview, {
399
402
  ref: preview
400
403
  }, ()=>{
404
+ if (dragState.draggedKey == null) return null;
401
405
  if (dragAndDropHooks.renderPreview) return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);
402
406
  let itemCount = dragState.draggingKeys.size;
403
407
  let maxWidth = bodyRef.current.getBoundingClientRect().width;
@@ -450,8 +454,10 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
450
454
  collection: collection,
451
455
  renderView: renderView,
452
456
  onVisibleRectChange (rect) {
453
- bodyRef.current.scrollTop = rect.y;
454
- (0, $7lS7h$setScrollLeft)(bodyRef.current, direction, rect.x);
457
+ if (bodyRef.current) {
458
+ bodyRef.current.scrollTop = rect.y;
459
+ (0, $7lS7h$setScrollLeft)(bodyRef.current, direction, rect.x);
460
+ }
455
461
  },
456
462
  persistedKeys: persistedKeys,
457
463
  layoutOptions: (0, $7lS7h$useMemo)(()=>({
@@ -482,7 +488,8 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
482
488
  // only that it changes in a resize, and when that happens, we want to sync the body to the
483
489
  // header scroll position
484
490
  (0, $7lS7h$useEffect)(()=>{
485
- if ((0, $7lS7h$getInteractionModality)() === 'keyboard' && headerRef.current.contains(document.activeElement)) {
491
+ var _headerRef_current;
492
+ if ((0, $7lS7h$getInteractionModality)() === 'keyboard' && ((_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.contains(document.activeElement)) && bodyRef.current) {
486
493
  (0, $7lS7h$scrollIntoView)(headerRef.current, document.activeElement);
487
494
  (0, $7lS7h$scrollIntoViewport)(document.activeElement, {
488
495
  containingElement: domRef.current
@@ -498,7 +505,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
498
505
  let headerHeight = ((_layout_getLayoutInfo = layout.getLayoutInfo('header')) === null || _layout_getLayoutInfo === void 0 ? void 0 : _layout_getLayoutInfo.rect.height) || 0;
499
506
  // Sync the scroll position from the table body to the header container.
500
507
  let onScroll = (0, $7lS7h$useCallback)(()=>{
501
- headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
508
+ if (headerRef.current && bodyRef.current) headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
502
509
  }, [
503
510
  bodyRef,
504
511
  headerRef
@@ -518,9 +525,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
518
525
  resizingColumnWidth,
519
526
  columnResizeState.resizingColumn
520
527
  ]);
521
- let mergedProps = (0, $7lS7h$mergeProps)(otherProps, isVirtualDragging && {
522
- tabIndex: null
523
- });
528
+ if (isVirtualDragging) otherProps.tabIndex = undefined;
524
529
  let firstColumn = collection.columns[0];
525
530
  let scrollPadding = 0;
526
531
  if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
@@ -528,7 +533,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
528
533
  return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$d288a7dd40372bc.Provider, {
529
534
  value: resizingColumn
530
535
  }, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusScope), null, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
531
- ...mergedProps,
536
+ ...otherProps,
532
537
  ref: domRef
533
538
  }, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
534
539
  role: "presentation",
@@ -555,7 +560,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
555
560
  // Using tabIndex={-1} prevents the ScrollView from being tabbable, and using role="rowgroup"
556
561
  // here and role="presentation" on the table body content fixes the table structure.
557
562
  role: "rowgroup",
558
- tabIndex: isVirtualDragging ? null : -1,
563
+ tabIndex: isVirtualDragging ? undefined : -1,
559
564
  style: {
560
565
  flex: 1,
561
566
  scrollPaddingInlineStart: scrollPadding
@@ -650,7 +655,7 @@ function $bd013581c0a4b065$var$TableColumnHeader(props) {
650
655
  className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCellContents')
651
656
  }, column.rendered)));
652
657
  }
653
- let $bd013581c0a4b065$var$_TableColumnHeaderButton = (props, ref)=>{
658
+ let $bd013581c0a4b065$var$ForwardTableColumnHeaderButton = (props, ref)=>{
654
659
  let { focusProps: focusProps, alignment: alignment, ...otherProps } = props;
655
660
  let { isEmpty: isEmpty } = $bd013581c0a4b065$export$3cb274deb6c2d854();
656
661
  let domRef = (0, $7lS7h$useFocusableRef)(ref);
@@ -678,7 +683,7 @@ let $bd013581c0a4b065$var$_TableColumnHeaderButton = (props, ref)=>{
678
683
  ref: domRef
679
684
  }, props.children));
680
685
  };
681
- let $bd013581c0a4b065$var$TableColumnHeaderButton = /*#__PURE__*/ (0, $7lS7h$react).forwardRef($bd013581c0a4b065$var$_TableColumnHeaderButton);
686
+ let $bd013581c0a4b065$var$TableColumnHeaderButton = /*#__PURE__*/ (0, $7lS7h$react).forwardRef($bd013581c0a4b065$var$ForwardTableColumnHeaderButton);
682
687
  function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
683
688
  var _column_props, _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
684
689
  let { column: column } = props;
@@ -723,20 +728,21 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
723
728
  };
724
729
  let allowsSorting = (_column_props = column.props) === null || _column_props === void 0 ? void 0 : _column_props.allowsSorting;
725
730
  let items = (0, $7lS7h$useMemo)(()=>{
726
- let options = [
727
- allowsSorting ? {
731
+ let options = [];
732
+ if (allowsSorting) {
733
+ options.push({
728
734
  label: stringFormatter.format('sortAscending'),
729
735
  id: 'sort-asc'
730
- } : undefined,
731
- allowsSorting ? {
736
+ });
737
+ options.push({
732
738
  label: stringFormatter.format('sortDescending'),
733
739
  id: 'sort-desc'
734
- } : undefined,
735
- {
736
- label: stringFormatter.format('resizeColumn'),
737
- id: 'resize'
738
- }
739
- ];
740
+ });
741
+ }
742
+ options.push({
743
+ label: stringFormatter.format('resizeColumn'),
744
+ id: 'resize'
745
+ });
740
746
  return options;
741
747
  // eslint-disable-next-line react-hooks/exhaustive-deps
742
748
  }, [
@@ -807,7 +813,7 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
807
813
  }, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $cb7d341e8868d81d$export$d9658cdf8c86807), null)))));
808
814
  }
809
815
  function $bd013581c0a4b065$var$TableSelectAllCell({ column: column }) {
810
- let ref = (0, $7lS7h$useRef)(undefined);
816
+ let ref = (0, $7lS7h$useRef)(null);
811
817
  let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
812
818
  let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
813
819
  let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
@@ -839,7 +845,7 @@ function $bd013581c0a4b065$var$TableSelectAllCell({ column: column }) {
839
845
  })));
840
846
  }
841
847
  function $bd013581c0a4b065$var$TableDragHeaderCell({ column: column }) {
842
- let ref = (0, $7lS7h$useRef)(undefined);
848
+ let ref = (0, $7lS7h$useRef)(null);
843
849
  let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
844
850
  let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
845
851
  node: column,
@@ -888,8 +894,10 @@ function $bd013581c0a4b065$export$cd7c5802f9e21187() {
888
894
  return (0, $7lS7h$useContext)($bd013581c0a4b065$var$TableRowContext);
889
895
  }
890
896
  function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
891
- var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer;
892
- let ref = (0, $7lS7h$useRef)(undefined);
897
+ var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
898
+ // allowing for single swipe navigation between row drop indicator
899
+ _dragAndDropHooks_isVirtualDragging;
900
+ let ref = (0, $7lS7h$useRef)(null);
893
901
  let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $bd013581c0a4b065$export$3cb274deb6c2d854();
894
902
  let isSelected = state.selectionManager.isSelected(item.key);
895
903
  let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $7lS7h$useTableRow)({
@@ -899,7 +907,6 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
899
907
  }, state, ref);
900
908
  let isDisabled = state.selectionManager.isDisabled(item.key);
901
909
  let isInteractive = !isDisabled && (hasAction || allowsSelection || isTableDraggable);
902
- let isDroppable = isTableDroppable && !isDisabled;
903
910
  let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
904
911
  isDisabled: !isInteractive
905
912
  });
@@ -917,35 +924,33 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
917
924
  // Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
918
925
  // border corners of the last row when selected.
919
926
  let isFlushWithContainerBottom = false;
927
+ var _layout_virtualizer_visibleRect_height;
920
928
  if (isLastRow) {
921
- if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
929
+ if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
922
930
  }
923
- let draggableItem;
924
- if (isTableDraggable) {
925
- // eslint-disable-next-line react-hooks/rules-of-hooks
931
+ let draggableItem = null;
932
+ if (isTableDraggable && dragAndDropHooks && dragState) {
926
933
  draggableItem = dragAndDropHooks.useDraggableItem({
927
934
  key: item.key,
928
935
  hasDragButton: true
929
936
  }, dragState);
930
937
  if (isDisabled) draggableItem = null;
931
938
  }
932
- let droppableItem;
933
- let isDropTarget;
934
- let dropIndicator;
935
- let dropIndicatorRef = (0, $7lS7h$useRef)(undefined);
936
- if (isTableDroppable) {
939
+ let isDropTarget = false;
940
+ let dropIndicator = null;
941
+ let dropIndicatorRef = (0, $7lS7h$useRef)(null);
942
+ if (isTableDroppable && dragAndDropHooks && dropState) {
937
943
  let target = {
938
944
  type: 'item',
939
945
  key: item.key,
940
946
  dropPosition: 'on'
941
947
  };
942
948
  isDropTarget = dropState.isDropTarget(target);
943
- // eslint-disable-next-line react-hooks/rules-of-hooks
944
949
  dropIndicator = dragAndDropHooks.useDropIndicator({
945
950
  target: target
946
951
  }, dropState, dropIndicatorRef);
947
952
  }
948
- let dragButtonRef = (0, $7lS7h$react).useRef(undefined);
953
+ let dragButtonRef = (0, $7lS7h$react).useRef(null);
949
954
  let { buttonProps: dragButtonProps } = (0, $7lS7h$useButton)({
950
955
  ...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
951
956
  elementType: 'div'
@@ -953,14 +958,9 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
953
958
  let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
954
959
  let props = (0, $7lS7h$mergeProps)(rowProps, otherProps, {
955
960
  style: style
956
- }, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
957
- // allowing for single swipe navigation between row drop indicator
958
- (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
961
+ }, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) ? {
959
962
  tabIndex: null
960
- });
961
- let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
962
- 'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
963
- };
963
+ } : null);
964
964
  let { visuallyHiddenProps: visuallyHiddenProps } = (0, $7lS7h$useVisuallyHidden)();
965
965
  return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowContext.Provider, {
966
966
  value: {
@@ -986,13 +986,13 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
986
986
  ...dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.dropIndicatorProps,
987
987
  ref: dropIndicatorRef
988
988
  }))), /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
989
- ...(0, $7lS7h$mergeProps)(props, dropProps),
989
+ ...props,
990
990
  ref: ref,
991
991
  className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-row', {
992
992
  'is-active': isPressed,
993
993
  'is-selected': isSelected,
994
994
  'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
995
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
995
+ 'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
996
996
  'is-focused': isFocusVisibleWithin,
997
997
  'focus-ring': isFocusVisible,
998
998
  'is-hovered': isHovered,
@@ -1015,7 +1015,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
1015
1015
  }
1016
1016
  function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
1017
1017
  let { state: state, headerMenuOpen: headerMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
1018
- let ref = (0, $7lS7h$useRef)(undefined);
1018
+ let ref = (0, $7lS7h$useRef)(null);
1019
1019
  let { rowProps: rowProps } = (0, $7lS7h$useTableHeaderRow)({
1020
1020
  node: item,
1021
1021
  isVirtualized: true
@@ -1032,7 +1032,7 @@ function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children,
1032
1032
  }, children);
1033
1033
  }
1034
1034
  function $bd013581c0a4b065$var$TableDragCell({ cell: cell }) {
1035
- let ref = (0, $7lS7h$useRef)(undefined);
1035
+ let ref = (0, $7lS7h$useRef)(null);
1036
1036
  let { state: state, isTableDraggable: isTableDraggable } = $bd013581c0a4b065$export$3cb274deb6c2d854();
1037
1037
  let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
1038
1038
  let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
@@ -1050,7 +1050,7 @@ function $bd013581c0a4b065$var$TableDragCell({ cell: cell }) {
1050
1050
  }, isTableDraggable && !isDisabled && /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$DragButton, null)));
1051
1051
  }
1052
1052
  function $bd013581c0a4b065$var$TableCheckboxCell({ cell: cell }) {
1053
- let ref = (0, $7lS7h$useRef)(undefined);
1053
+ let ref = (0, $7lS7h$useRef)(null);
1054
1054
  let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
1055
1055
  // The TableCheckbox should always render its disabled status if the row is disabled, regardless of disabledBehavior,
1056
1056
  // but the cell itself should not render its disabled styles if disabledBehavior="selection" because the row might have actions on it.
@@ -1082,7 +1082,7 @@ function $bd013581c0a4b065$var$TableCell({ cell: cell }) {
1082
1082
  let { scale: scale } = (0, $7lS7h$useProvider)();
1083
1083
  let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
1084
1084
  let isExpandableTable = 'expandedKeys' in state;
1085
- let ref = (0, $7lS7h$useRef)(undefined);
1085
+ let ref = (0, $7lS7h$useRef)(null);
1086
1086
  let columnProps = cell.column.props;
1087
1087
  let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
1088
1088
  let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
@@ -1129,9 +1129,9 @@ function $bd013581c0a4b065$var$TableCell({ cell: cell }) {
1129
1129
  }
1130
1130
  function $bd013581c0a4b065$var$TableCellWrapper({ layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children }) {
1131
1131
  let { isTableDroppable: isTableDroppable, dropState: dropState } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
1132
- let isDropTarget;
1133
- let isRootDroptarget;
1134
- if (isTableDroppable) {
1132
+ let isDropTarget = false;
1133
+ let isRootDroptarget = false;
1134
+ if (isTableDroppable && dropState) {
1135
1135
  if (parent.content) isDropTarget = dropState.isDropTarget({
1136
1136
  type: 'item',
1137
1137
  dropPosition: 'on',
@@ -1159,7 +1159,7 @@ function $bd013581c0a4b065$var$ExpandableRowChevron({ cell: cell }) {
1159
1159
  // TODO: move some/all of the chevron button setup into a separate hook?
1160
1160
  let { direction: direction } = (0, $7lS7h$useLocale)();
1161
1161
  let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
1162
- let expandButtonRef = (0, $7lS7h$useRef)(undefined);
1162
+ let expandButtonRef = (0, $7lS7h$useRef)(null);
1163
1163
  let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
1164
1164
  let isExpanded;
1165
1165
  if ('expandedKeys' in state) isExpanded = state.expandedKeys === 'all' || state.expandedKeys.has(cell.parentKey);
@@ -1205,7 +1205,7 @@ function $bd013581c0a4b065$var$CenteredWrapper({ children: children }) {
1205
1205
  let rowProps;
1206
1206
  if ('expandedKeys' in state) {
1207
1207
  let topLevelRowCount = [
1208
- ...state.keyMap.get(state.collection.body.key).childNodes
1208
+ ...state.collection.body.childNodes
1209
1209
  ].length;
1210
1210
  rowProps = {
1211
1211
  'aria-level': 1,