@react-spectrum/table 3.3.2-nightly.3458 → 3.3.2

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.
package/dist/module.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "./main.css";
2
2
  import {Column as $gyhAV$Column, TableHeader as $e668f3d0f378a712$re_export$TableHeader, TableBody as $e668f3d0f378a712$re_export$TableBody, Section as $e668f3d0f378a712$re_export$Section, Row as $e668f3d0f378a712$re_export$Row, Cell as $e668f3d0f378a712$re_export$Cell, useTableState as $gyhAV$useTableState, useTableColumnResizeState as $gyhAV$useTableColumnResizeState} from "@react-stately/table";
3
3
  import $gyhAV$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSmall";
4
- import {mergeProps as $gyhAV$mergeProps, useLayoutEffect as $gyhAV$useLayoutEffect, chain as $gyhAV$chain} from "@react-aria/utils";
4
+ import {useLayoutEffect as $gyhAV$useLayoutEffect, mergeProps as $gyhAV$mergeProps, chain as $gyhAV$chain} from "@react-aria/utils";
5
5
  import {Checkbox as $gyhAV$Checkbox} from "@react-spectrum/checkbox";
6
6
  import {useStyleProps as $gyhAV$useStyleProps, useDOMRef as $gyhAV$useDOMRef, classNames as $gyhAV$classNames, useFocusableRef as $gyhAV$useFocusableRef, useUnwrapDOMRef as $gyhAV$useUnwrapDOMRef} from "@react-spectrum/utils";
7
- import {useFocusRing as $gyhAV$useFocusRing, FocusScope as $gyhAV$FocusScope, FocusRing as $gyhAV$FocusRing} from "@react-aria/focus";
7
+ import {FocusRing as $gyhAV$FocusRing, useFocusRing as $gyhAV$useFocusRing} from "@react-aria/focus";
8
8
  import {MenuTrigger as $gyhAV$MenuTrigger, Menu as $gyhAV$Menu, Item as $gyhAV$Item} from "@react-spectrum/menu";
9
9
  import {layoutInfoToStyle as $gyhAV$layoutInfoToStyle, VirtualizerItem as $gyhAV$VirtualizerItem, setScrollLeft as $gyhAV$setScrollLeft, useVirtualizer as $gyhAV$useVirtualizer, ScrollView as $gyhAV$ScrollView} from "@react-aria/virtualizer";
10
10
  import {ProgressCircle as $gyhAV$ProgressCircle} from "@react-spectrum/progress";
@@ -13,7 +13,7 @@ import {useVirtualizerState as $gyhAV$useVirtualizerState} from "@react-stately/
13
13
  import {TableLayout as $gyhAV$TableLayout} from "@react-stately/layout";
14
14
  import {TooltipTrigger as $gyhAV$TooltipTrigger, Tooltip as $gyhAV$Tooltip} from "@react-spectrum/tooltip";
15
15
  import {useButton as $gyhAV$useButton} from "@react-aria/button";
16
- import {usePress as $gyhAV$usePress, useHover as $gyhAV$useHover} from "@react-aria/interactions";
16
+ import {useHover as $gyhAV$useHover, usePress as $gyhAV$usePress} from "@react-aria/interactions";
17
17
  import {useLocale as $gyhAV$useLocale, useLocalizedStringFormatter as $gyhAV$useLocalizedStringFormatter} from "@react-aria/i18n";
18
18
  import {useProviderProps as $gyhAV$useProviderProps, useProvider as $gyhAV$useProvider} from "@react-spectrum/provider";
19
19
  import {useTable as $gyhAV$useTable, useTableRowGroup as $gyhAV$useTableRowGroup, useTableColumnHeader as $gyhAV$useTableColumnHeader, useTableSelectAllCheckbox as $gyhAV$useTableSelectAllCheckbox, useTableRow as $gyhAV$useTableRow, useTableHeaderRow as $gyhAV$useTableHeaderRow, useTableCell as $gyhAV$useTableCell, useTableSelectionCheckbox as $gyhAV$useTableSelectionCheckbox, useTableColumnResize as $gyhAV$useTableColumnResize} from "@react-aria/table";
@@ -583,13 +583,12 @@ $bd5d41f647a296c3$export$53aa811f86efbfad = "is-next-selected_d0fc74";
583
583
 
584
584
  function $fc695d2eafc2b351$var$Resizer(props, ref) {
585
585
  let { column: column , showResizer: showResizer } = props;
586
- let { state: state , columnState: columnState , isEmpty: isEmpty } = $d14697b14e638114$export$3cb274deb6c2d854();
586
+ let { state: state , columnState: columnState } = $d14697b14e638114$export$3cb274deb6c2d854();
587
587
  let stringFormatter = $gyhAV$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($467944769c14687b$exports)));
588
588
  let { direction: direction } = $gyhAV$useLocale();
589
589
  let { inputProps: inputProps , resizerProps: resizerProps } = $gyhAV$useTableColumnResize({
590
590
  ...props,
591
- label: stringFormatter.format('columnResizer'),
592
- isDisabled: isEmpty
591
+ label: stringFormatter.format('columnResizer')
593
592
  }, state, columnState, ref);
594
593
  let style = {
595
594
  cursor: undefined,
@@ -792,7 +791,6 @@ function $d14697b14e638114$var$TableView(props, ref) {
792
791
  if (item.props.isSelectionCell) return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableSelectAllCell, {
793
792
  column: item
794
793
  }));
795
- // TODO: consider this case, what if we have hidden headers and a empty table
796
794
  if (item.props.hideHeader) return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$TooltipTrigger, {
797
795
  placement: "top",
798
796
  trigger: "focus"
@@ -837,18 +835,15 @@ function $d14697b14e638114$var$TableView(props, ref) {
837
835
  setHorizontalScollbarVisible(bodyRef.current.clientHeight + 2 < bodyRef.current.offsetHeight);
838
836
  }
839
837
  }, []);
840
- let { isFocusVisible: isFocusVisible , focusProps: focusProps } = $gyhAV$useFocusRing();
841
- let isEmpty = state.collection.size === 0;
842
838
  return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableContext.Provider, {
843
839
  value: {
844
840
  state: state,
845
841
  layout: layout,
846
842
  columnState: columnState,
847
- headerRowHovered: headerRowHovered,
848
- isEmpty: isEmpty
843
+ headerRowHovered: headerRowHovered
849
844
  }
850
845
  }, /*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableVirtualizer, {
851
- ...$gyhAV$mergeProps(gridProps, focusProps),
846
+ ...gridProps,
852
847
  ...styleProps,
853
848
  className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table', `spectrum-Table--${density}`, {
854
849
  'spectrum-Table--quiet': isQuiet,
@@ -866,12 +861,11 @@ function $d14697b14e638114$var$TableView(props, ref) {
866
861
  onVisibleRectChange: onVisibleRectChange,
867
862
  domRef: domRef,
868
863
  bodyRef: bodyRef,
869
- isFocusVisible: isFocusVisible,
870
864
  getColumnWidth: columnState.getColumnWidth
871
865
  })));
872
866
  }
873
867
  // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
874
- function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , setTableWidth: setTableWidth , getColumnWidth: getColumnWidth , onVisibleRectChange: onVisibleRectChangeProp , isFocusVisible: isFocusVisible , ...otherProps }) {
868
+ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , setTableWidth: setTableWidth , getColumnWidth: getColumnWidth , onVisibleRectChange: onVisibleRectChangeProp , ...otherProps }) {
875
869
  var ref;
876
870
  let { direction: direction } = $gyhAV$useLocale();
877
871
  let headerRef = $gyhAV$useRef();
@@ -945,10 +939,8 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
945
939
  onLoadMore,
946
940
  isLoading
947
941
  ]);
948
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusScope, null, /*#__PURE__*/ $gyhAV$react.createElement("div", {
949
- ...$gyhAV$mergeProps(otherProps, virtualizerProps, collection.size === 0 && {
950
- tabIndex: 0
951
- }),
942
+ return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
943
+ ...$gyhAV$mergeProps(otherProps, virtualizerProps),
952
944
  ref: domRef
953
945
  }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
954
946
  role: "presentation",
@@ -964,9 +956,7 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
964
956
  ref: headerRef
965
957
  }, state.visibleViews[0]), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$ScrollView, {
966
958
  role: "presentation",
967
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-body', {
968
- 'focus-ring': isFocusVisible
969
- }),
959
+ className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-body'),
970
960
  style: {
971
961
  flex: 1
972
962
  },
@@ -980,7 +970,7 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
980
970
  onScrollStart: state.startScrolling,
981
971
  onScrollEnd: state.endScrolling,
982
972
  onScroll: onScroll
983
- }, state.visibleViews[1]))));
973
+ }, state.visibleViews[1])));
984
974
  }
985
975
  function $d14697b14e638114$var$TableHeader({ children: children , ...otherProps }) {
986
976
  let { rowGroupProps: rowGroupProps } = $gyhAV$useTableRowGroup();
@@ -994,23 +984,16 @@ function $d14697b14e638114$var$TableColumnHeader(props) {
994
984
  var ref, ref1, ref2, ref3;
995
985
  let { column: column } = props;
996
986
  let ref4 = $gyhAV$useRef(null);
997
- let { state: state , isEmpty: isEmpty } = $d14697b14e638114$export$3cb274deb6c2d854();
998
- let { pressProps: pressProps , isPressed: isPressed } = $gyhAV$usePress({
999
- isDisabled: isEmpty
1000
- });
987
+ let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1001
988
  let { columnHeaderProps: columnHeaderProps } = $gyhAV$useTableColumnHeader({
1002
989
  node: column,
1003
990
  isVirtualized: true
1004
991
  }, state, ref4);
1005
992
  let columnProps = column.props;
1006
- let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover({
1007
- ...props,
1008
- isDisabled: isEmpty
1009
- });
993
+ let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover(props);
1010
994
  const allProps = [
1011
995
  columnHeaderProps,
1012
- hoverProps,
1013
- pressProps
996
+ hoverProps
1014
997
  ];
1015
998
  return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1016
999
  focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
@@ -1018,7 +1001,6 @@ function $d14697b14e638114$var$TableColumnHeader(props) {
1018
1001
  ...$gyhAV$mergeProps(...allProps),
1019
1002
  ref: ref4,
1020
1003
  className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCell', {
1021
- 'is-active': isPressed,
1022
1004
  'is-resizable': columnProps.allowsResizing,
1023
1005
  'is-sortable': columnProps.allowsSorting,
1024
1006
  'is-sorted-desc': ((ref = state.sortDescriptor) === null || ref === void 0 ? void 0 : ref.column) === column.key && ((ref1 = state.sortDescriptor) === null || ref1 === void 0 ? void 0 : ref1.direction) === 'descending',
@@ -1036,12 +1018,10 @@ function $d14697b14e638114$var$TableColumnHeader(props) {
1036
1018
  }))));
1037
1019
  }
1038
1020
  let $d14697b14e638114$var$_TableColumnHeaderButton = (props, ref)=>{
1039
- let { isEmpty: isEmpty } = $d14697b14e638114$export$3cb274deb6c2d854();
1040
1021
  let domRef = $gyhAV$useFocusableRef(ref);
1041
1022
  let { buttonProps: buttonProps } = $gyhAV$useButton({
1042
1023
  ...props,
1043
- elementType: 'div',
1044
- isDisabled: isEmpty
1024
+ elementType: 'div'
1045
1025
  }, domRef);
1046
1026
  return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1047
1027
  className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCellContents')
@@ -1060,24 +1040,17 @@ function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
1060
1040
  let ref9 = $gyhAV$useRef(null);
1061
1041
  let triggerRef = $gyhAV$useRef(null);
1062
1042
  let resizingRef = $gyhAV$useRef(null);
1063
- let { state: state , columnState: columnState , headerRowHovered: headerRowHovered , isEmpty: isEmpty } = $d14697b14e638114$export$3cb274deb6c2d854();
1043
+ let { state: state , columnState: columnState , headerRowHovered: headerRowHovered } = $d14697b14e638114$export$3cb274deb6c2d854();
1064
1044
  let stringFormatter = $gyhAV$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($467944769c14687b$exports)));
1065
- let { pressProps: pressProps , isPressed: isPressed } = $gyhAV$usePress({
1066
- isDisabled: isEmpty
1067
- });
1068
1045
  let { columnHeaderProps: columnHeaderProps } = $gyhAV$useTableColumnHeader({
1069
1046
  node: column,
1070
1047
  isVirtualized: true,
1071
1048
  hasMenu: true
1072
1049
  }, state, ref9);
1073
- let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover({
1074
- ...props,
1075
- isDisabled: isEmpty
1076
- });
1050
+ let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover(props);
1077
1051
  const allProps = [
1078
1052
  columnHeaderProps,
1079
- hoverProps,
1080
- pressProps
1053
+ hoverProps
1081
1054
  ];
1082
1055
  let columnProps = column.props;
1083
1056
  if (columnProps.width && columnProps.allowsResizing) throw new Error('Controlled state is not yet supported with column resizing. Please use defaultWidth for uncontrolled column resizing or remove the allowsResizing prop.');
@@ -1124,14 +1097,13 @@ function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
1124
1097
  columnState.currentlyResizingColumn,
1125
1098
  column.key
1126
1099
  ]);
1127
- let showResizer = !isEmpty && (headerRowHovered || columnState.currentlyResizingColumn != null);
1100
+ let showResizer = headerRowHovered || columnState.currentlyResizingColumn != null;
1128
1101
  return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1129
1102
  focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
1130
1103
  }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1131
1104
  ...$gyhAV$mergeProps(...allProps),
1132
1105
  ref: ref9,
1133
1106
  className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCell', {
1134
- 'is-active': isPressed,
1135
1107
  'is-resizable': columnProps.allowsResizing,
1136
1108
  'is-sortable': columnProps.allowsSorting,
1137
1109
  'is-sorted-desc': ((ref5 = state.sortDescriptor) === null || ref5 === void 0 ? void 0 : ref5.column) === column.key && ((ref6 = state.sortDescriptor) === null || ref6 === void 0 ? void 0 : ref6.direction) === 'descending',
@@ -1184,6 +1156,7 @@ function $d14697b14e638114$var$TableSelectAllCell({ column: column }) {
1184
1156
  which for single selection will be "Select."
1185
1157
  */ isSingleSelectionMode && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$VisuallyHidden, null, checkboxProps['aria-label']), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Checkbox, {
1186
1158
  ...checkboxProps,
1159
+ isDisabled: isSingleSelectionMode,
1187
1160
  isEmphasized: true,
1188
1161
  UNSAFE_style: isSingleSelectionMode ? {
1189
1162
  visibility: 'hidden'