@react-spectrum/table 3.9.1-nightly.3940 → 3.9.1-nightly.3960

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.
@@ -1 +1 @@
1
- {"mappings":";;;;AKmIA,oCAAoC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,EAAE,sBAAsB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IAC3H;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;CACxD;AAgxCD;;GAEG;AACH,OAAA,MAAM;UAAsF,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC;ACx6CrI,OAAA,MAAM,8CAAiE,WAAW,CAAC;AAGnF,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,GAAG,EACH,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/InsertionIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Nubbin.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Resizer.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/RootDropIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/DragPreview.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/index.ts","packages/@react-spectrum/table/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\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/// <reference types=\"css-module-types\" />\n\nexport {TableView} from './TableView';\nimport {Column} from '@react-stately/table';\nimport {SpectrumColumnProps} from '@react-types/table';\n\n// Override TS for Column to support spectrum specific props.\nconst SpectrumColumn = Column as <T>(props: SpectrumColumnProps<T>) => JSX.Element;\nexport {SpectrumColumn as Column};\n\nexport {\n TableHeader,\n TableBody,\n Section,\n Row,\n Cell\n} from '@react-stately/table';\n\nexport type {SpectrumColumnProps, TableHeaderProps, TableBodyProps, RowProps, CellProps} from '@react-types/table';\nexport type {SpectrumTableProps} from './TableView';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AKmIA,oCAAoC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,EAAE,sBAAsB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IAC3H;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;CACxD;AA+vCD;;GAEG;AACH,OAAA,MAAM;UAAsF,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC;ACv5CrI,OAAA,MAAM,8CAAiE,WAAW,CAAC;AAGnF,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,GAAG,EACH,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/InsertionIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Nubbin.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Resizer.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/RootDropIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/DragPreview.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/index.ts","packages/@react-spectrum/table/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\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/// <reference types=\"css-module-types\" />\n\nexport {TableView} from './TableView';\nimport {Column} from '@react-stately/table';\nimport {SpectrumColumnProps} from '@react-types/table';\n\n// Override TS for Column to support spectrum specific props.\nconst SpectrumColumn = Column as <T>(props: SpectrumColumnProps<T>) => JSX.Element;\nexport {SpectrumColumn as Column};\n\nexport {\n TableHeader,\n TableBody,\n Section,\n Row,\n Cell\n} from '@react-stately/table';\n\nexport type {SpectrumColumnProps, TableHeaderProps, TableBodyProps, RowProps, CellProps} from '@react-types/table';\nexport type {SpectrumTableProps} from './TableView';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/table",
3
- "version": "3.9.1-nightly.3940+b1545c0d2",
3
+ "version": "3.9.1-nightly.3960+16f72e9fb",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,38 +36,38 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/button": "3.0.0-nightly.2238+b1545c0d2",
40
- "@react-aria/focus": "3.0.0-nightly.2238+b1545c0d2",
41
- "@react-aria/grid": "3.7.2-nightly.3940+b1545c0d2",
42
- "@react-aria/i18n": "3.0.0-nightly.2238+b1545c0d2",
43
- "@react-aria/interactions": "3.0.0-nightly.2238+b1545c0d2",
44
- "@react-aria/table": "3.9.2-nightly.3940+b1545c0d2",
45
- "@react-aria/utils": "3.0.0-nightly.2238+b1545c0d2",
46
- "@react-aria/virtualizer": "3.8.2-nightly.3940+b1545c0d2",
47
- "@react-aria/visually-hidden": "3.0.0-nightly.2238+b1545c0d2",
48
- "@react-spectrum/button": "3.0.0-nightly.2238+b1545c0d2",
49
- "@react-spectrum/checkbox": "3.0.0-nightly.2238+b1545c0d2",
50
- "@react-spectrum/dnd": "3.2.1-nightly.3940+b1545c0d2",
51
- "@react-spectrum/layout": "3.5.3-nightly.3940+b1545c0d2",
52
- "@react-spectrum/menu": "3.11.2-nightly.3940+b1545c0d2",
53
- "@react-spectrum/progress": "3.0.0-nightly.2238+b1545c0d2",
54
- "@react-spectrum/tooltip": "3.0.0-nightly.2238+b1545c0d2",
55
- "@react-spectrum/utils": "3.0.0-nightly.2238+b1545c0d2",
56
- "@react-stately/collections": "3.0.0-nightly.2238+b1545c0d2",
57
- "@react-stately/grid": "3.6.2-nightly.3940+b1545c0d2",
58
- "@react-stately/layout": "3.12.2-nightly.3940+b1545c0d2",
59
- "@react-stately/table": "3.9.2-nightly.3940+b1545c0d2",
60
- "@react-stately/virtualizer": "3.5.3-nightly.3940+b1545c0d2",
61
- "@react-types/grid": "3.1.9-nightly.3940+b1545c0d2",
62
- "@react-types/shared": "3.0.0-nightly.2238+b1545c0d2",
63
- "@react-types/table": "3.6.2-nightly.3940+b1545c0d2",
64
- "@spectrum-icons/ui": "3.0.0-nightly.2238+b1545c0d2",
39
+ "@react-aria/button": "3.0.0-nightly.2258+16f72e9fb",
40
+ "@react-aria/focus": "3.0.0-nightly.2258+16f72e9fb",
41
+ "@react-aria/grid": "3.7.2-nightly.3960+16f72e9fb",
42
+ "@react-aria/i18n": "3.0.0-nightly.2258+16f72e9fb",
43
+ "@react-aria/interactions": "3.0.0-nightly.2258+16f72e9fb",
44
+ "@react-aria/table": "3.9.2-nightly.3960+16f72e9fb",
45
+ "@react-aria/utils": "3.0.0-nightly.2258+16f72e9fb",
46
+ "@react-aria/virtualizer": "3.8.2-nightly.3960+16f72e9fb",
47
+ "@react-aria/visually-hidden": "3.0.0-nightly.2258+16f72e9fb",
48
+ "@react-spectrum/button": "3.0.0-nightly.2258+16f72e9fb",
49
+ "@react-spectrum/checkbox": "3.0.0-nightly.2258+16f72e9fb",
50
+ "@react-spectrum/dnd": "3.2.1-nightly.3960+16f72e9fb",
51
+ "@react-spectrum/layout": "3.5.3-nightly.3960+16f72e9fb",
52
+ "@react-spectrum/menu": "3.11.2-nightly.3960+16f72e9fb",
53
+ "@react-spectrum/progress": "3.0.0-nightly.2258+16f72e9fb",
54
+ "@react-spectrum/tooltip": "3.0.0-nightly.2258+16f72e9fb",
55
+ "@react-spectrum/utils": "3.0.0-nightly.2258+16f72e9fb",
56
+ "@react-stately/collections": "3.0.0-nightly.2258+16f72e9fb",
57
+ "@react-stately/grid": "3.6.2-nightly.3960+16f72e9fb",
58
+ "@react-stately/layout": "3.12.2-nightly.3960+16f72e9fb",
59
+ "@react-stately/table": "3.9.2-nightly.3960+16f72e9fb",
60
+ "@react-stately/virtualizer": "3.5.3-nightly.3960+16f72e9fb",
61
+ "@react-types/grid": "3.1.9-nightly.3960+16f72e9fb",
62
+ "@react-types/shared": "3.0.0-nightly.2258+16f72e9fb",
63
+ "@react-types/table": "3.6.2-nightly.3960+16f72e9fb",
64
+ "@spectrum-icons/ui": "3.0.0-nightly.2258+16f72e9fb",
65
65
  "@swc/helpers": "^0.4.14"
66
66
  },
67
67
  "devDependencies": {
68
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2238+b1545c0d2",
69
- "@react-aria/dnd": "3.2.2-nightly.3940+b1545c0d2",
70
- "@react-stately/dnd": "3.2.2-nightly.3940+b1545c0d2"
68
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2258+16f72e9fb",
69
+ "@react-aria/dnd": "3.2.2-nightly.3960+16f72e9fb",
70
+ "@react-stately/dnd": "3.2.2-nightly.3960+16f72e9fb"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@react-spectrum/provider": "^3.0.0",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "b1545c0d225b12672fb6a4e7b787268591d66b90"
80
+ "gitHead": "16f72e9fbfc28adf104c3cb7557f1d3cab617960"
81
81
  }
package/src/TableView.tsx CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  import {AriaLabelingProps, DOMProps, DOMRef, DropTarget, FocusableElement, FocusableRef, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
14
14
  import ArrowDownSmall from '@spectrum-icons/ui/ArrowDownSmall';
15
- import {chain, mergeProps, scrollIntoView, scrollIntoViewport, useLayoutEffect} from '@react-aria/utils';
15
+ import {chain, mergeProps, scrollIntoView, scrollIntoViewport} from '@react-aria/utils';
16
16
  import {Checkbox} from '@react-spectrum/checkbox';
17
17
  import ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';
18
18
  import {
@@ -38,9 +38,9 @@ import {layoutInfoToStyle, ScrollView, setScrollLeft, useVirtualizer, Virtualize
38
38
  import ListGripper from '@spectrum-icons/ui/ListGripper';
39
39
  import {Nubbin} from './Nubbin';
40
40
  import {ProgressCircle} from '@react-spectrum/progress';
41
- import React, {DOMAttributes, HTMLAttributes, Key, ReactElement, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
42
- import {Rect, ReusableView, useVirtualizerState} from '@react-stately/virtualizer';
41
+ import React, {DOMAttributes, HTMLAttributes, Key, ReactElement, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
43
42
  import {Resizer} from './Resizer';
43
+ import {ReusableView, useVirtualizerState} from '@react-stately/virtualizer';
44
44
  import {RootDropIndicator} from './RootDropIndicator';
45
45
  import {DragPreview as SpectrumDragPreview} from './DragPreview';
46
46
  import styles from '@adobe/spectrum-css-temp/components/table/vars.css';
@@ -322,7 +322,7 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
322
322
  let [headerRowHovered, setHeaderRowHovered] = useState(false);
323
323
 
324
324
  // This overrides collection view's renderWrapper to support DOM hierarchy.
325
- type View = ReusableView<GridNode<T>, unknown>;
325
+ type View = ReusableView<GridNode<T>, ReactNode>;
326
326
  let renderWrapper = (parent: View, reusableView: View, children: View[], renderChildren: (views: View[]) => ReactElement[]) => {
327
327
  let style = layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
328
328
  if (style.overflow === 'hidden') {
@@ -387,8 +387,9 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
387
387
  return (
388
388
  <VirtualizerItem
389
389
  key={reusableView.key}
390
- reusableView={reusableView}
391
- parent={parent}
390
+ layoutInfo={reusableView.layoutInfo}
391
+ virtualizer={reusableView.virtualizer}
392
+ parent={parent?.layoutInfo}
392
393
  className={
393
394
  classNames(
394
395
  styles,
@@ -401,7 +402,9 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
401
402
  }
402
403
  )
403
404
  )
404
- } />
405
+ }>
406
+ {reusableView.rendered}
407
+ </VirtualizerItem>
405
408
  );
406
409
  };
407
410
 
@@ -578,7 +581,8 @@ function TableView<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<H
578
581
  }
579
582
 
580
583
  // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
581
- function TableVirtualizer({layout, collection, focusedKey, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible, isVirtualDragging, isRootDropTarget, ...otherProps}) {
584
+ function TableVirtualizer(props) {
585
+ let {layout, collection, focusedKey, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible, isVirtualDragging, isRootDropTarget, ...otherProps} = props;
582
586
  let {direction} = useLocale();
583
587
  let loadingState = collection.body.props.loadingState;
584
588
  let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
@@ -591,7 +595,7 @@ function TableVirtualizer({layout, collection, focusedKey, renderView, renderWra
591
595
  // while resizing, prop changes should not cause animations
592
596
  transitionDuration = 0;
593
597
  }
594
- let state = useVirtualizerState({
598
+ let state = useVirtualizerState<object, ReactNode, ReactNode>({
595
599
  layout,
596
600
  collection,
597
601
  renderView,
@@ -608,8 +612,6 @@ function TableVirtualizer({layout, collection, focusedKey, renderView, renderWra
608
612
  let column = collection.columns[0];
609
613
  let virtualizer = state.virtualizer;
610
614
 
611
- let modality = getInteractionModality();
612
-
613
615
  virtualizer.scrollToItem(key, {
614
616
  duration: 0,
615
617
  // Prevent scrolling to the top when clicking on column headers.
@@ -624,16 +626,17 @@ function TableVirtualizer({layout, collection, focusedKey, renderView, renderWra
624
626
  // Sync the scroll positions of the column headers and the body so scrollIntoViewport can
625
627
  // properly decide if the column is outside the viewport or not
626
628
  headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
627
- if (modality === 'keyboard') {
628
- scrollIntoViewport(document.activeElement, {containingElement: domRef.current});
629
- }
630
- }, [collection, domRef, bodyRef, headerRef, layout, state.virtualizer]);
629
+ }, [collection, bodyRef, headerRef, layout, state.virtualizer]);
631
630
 
632
- let {virtualizerProps} = useVirtualizer({
631
+ let memoedVirtualizerProps = useMemo(() => ({
633
632
  tabIndex: otherProps.tabIndex,
634
633
  focusedKey,
635
- scrollToItem
636
- }, state, domRef);
634
+ scrollToItem,
635
+ isLoading,
636
+ onLoadMore
637
+ }), [otherProps.tabIndex, focusedKey, scrollToItem, isLoading, onLoadMore]);
638
+
639
+ let {virtualizerProps, scrollViewProps: {onVisibleRectChange}} = useVirtualizer(memoedVirtualizerProps, state, domRef);
637
640
 
638
641
  // this effect runs whenever the contentSize changes, it doesn't matter what the content size is
639
642
  // only that it changes in a resize, and when that happens, we want to sync the body to the
@@ -654,26 +657,6 @@ function TableVirtualizer({layout, collection, focusedKey, renderView, renderWra
654
657
  headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
655
658
  }, [bodyRef, headerRef]);
656
659
 
657
- let onVisibleRectChange = useCallback((rect: Rect) => {
658
- state.setVisibleRect(rect);
659
-
660
- if (!isLoading && onLoadMore) {
661
- let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
662
- if (rect.y > scrollOffset) {
663
- onLoadMore();
664
- }
665
- }
666
- // eslint-disable-next-line react-hooks/exhaustive-deps
667
- }, [onLoadMore, isLoading, state.setVisibleRect, state.virtualizer]);
668
-
669
- useLayoutEffect(() => {
670
- if (!isLoading && onLoadMore && !state.isAnimating) {
671
- if (state.contentSize.height <= state.virtualizer.visibleRect.height) {
672
- onLoadMore();
673
- }
674
- }
675
- }, [state.contentSize, state.virtualizer, state.isAnimating, onLoadMore, isLoading]);
676
-
677
660
  let resizerPosition = layout.getResizerPosition() - 2;
678
661
 
679
662
  let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
@@ -1119,7 +1102,7 @@ function TableDragHeaderCell({column}) {
1119
1102
  <div
1120
1103
  {...columnHeaderProps}
1121
1104
  ref={ref}
1122
- className={
1105
+ className={
1123
1106
  classNames(
1124
1107
  styles,
1125
1108
  'spectrum-Table-headCell',