@react-spectrum/table 3.1.7-nightly.3271 → 3.2.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.
package/dist/module.js CHANGED
@@ -4,19 +4,17 @@ import $gyhAV$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSm
4
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} from "@react-spectrum/utils";
7
- import {FocusRing as $gyhAV$FocusRing, focusSafely as $gyhAV$focusSafely, useFocusRing as $gyhAV$useFocusRing} from "@react-aria/focus";
8
- import {MenuTrigger as $gyhAV$MenuTrigger, Menu as $gyhAV$Menu, Item as $gyhAV$Item} from "@react-spectrum/menu";
7
+ import {FocusRing as $gyhAV$FocusRing, useFocusRing as $gyhAV$useFocusRing} from "@react-aria/focus";
9
8
  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
9
  import {ProgressCircle as $gyhAV$ProgressCircle} from "@react-spectrum/progress";
11
- import $gyhAV$react, {useContext as $gyhAV$useContext, useState as $gyhAV$useState, useCallback as $gyhAV$useCallback, useRef as $gyhAV$useRef, useMemo as $gyhAV$useMemo} from "react";
10
+ import $gyhAV$react, {useContext as $gyhAV$useContext, useState as $gyhAV$useState, useRef as $gyhAV$useRef, useMemo as $gyhAV$useMemo, useCallback as $gyhAV$useCallback} from "react";
12
11
  import {useVirtualizerState as $gyhAV$useVirtualizerState} from "@react-stately/virtualizer";
13
- import {TableLayout as $gyhAV$TableLayout, TableLayout_DEPRECATED as $gyhAV$TableLayout_DEPRECATED} from "@react-stately/layout";
12
+ import {TableLayout as $gyhAV$TableLayout} from "@react-stately/layout";
14
13
  import {TooltipTrigger as $gyhAV$TooltipTrigger, Tooltip as $gyhAV$Tooltip} from "@react-spectrum/tooltip";
15
- import {useButton as $gyhAV$useButton} from "@react-aria/button";
16
14
  import {useHover as $gyhAV$useHover, usePress as $gyhAV$usePress} from "@react-aria/interactions";
17
15
  import {useMessageFormatter as $gyhAV$useMessageFormatter, useLocale as $gyhAV$useLocale} from "@react-aria/i18n";
18
16
  import {useProviderProps as $gyhAV$useProviderProps, useProvider as $gyhAV$useProvider} from "@react-spectrum/provider";
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";
17
+ 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} from "@react-aria/table";
20
18
  import {VisuallyHidden as $gyhAV$VisuallyHidden} from "@react-aria/visually-hidden";
21
19
 
22
20
  function $parcel$interopDefault(a) {
@@ -210,10 +208,6 @@ $467944769c14687b$exports = {
210
208
 
211
209
 
212
210
 
213
-
214
-
215
-
216
-
217
211
  var $bd5d41f647a296c3$exports = {};
218
212
 
219
213
  $parcel$export($bd5d41f647a296c3$exports, "spectrum-Table", () => $bd5d41f647a296c3$export$455c59d2b5bafef0, (v) => $bd5d41f647a296c3$export$455c59d2b5bafef0 = v);
@@ -338,31 +332,6 @@ $bd5d41f647a296c3$export$d35bc1e505d1ebbf = "is-disabled_d0fc74";
338
332
  $bd5d41f647a296c3$export$53aa811f86efbfad = "is-next-selected_d0fc74";
339
333
 
340
334
 
341
-
342
-
343
- function $fc695d2eafc2b351$var$Resizer(props, ref) {
344
- const { item: item } = props;
345
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
346
- let { resizerProps: resizerProps } = $gyhAV$useTableColumnResize(state, item, ref);
347
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
348
- focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
349
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
350
- ref: ref,
351
- ...resizerProps,
352
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-columnResizer'),
353
- role: "separator",
354
- "aria-orientation": "vertical",
355
- "aria-label": "Resize column",
356
- "aria-labelledby": item.key,
357
- "aria-valuenow": state.getColumnWidth(item.key),
358
- "aria-valuemin": state.getColumnMinWidth(item.key),
359
- "aria-valuemax": state.getColumnMaxWidth(item.key)
360
- })));
361
- }
362
- const $fc695d2eafc2b351$export$48a76196cafe3b93 = /*#__PURE__*/ $gyhAV$react.forwardRef($fc695d2eafc2b351$var$Resizer);
363
-
364
-
365
-
366
335
  var $325bc3d43b25708b$exports = {};
367
336
 
368
337
  $parcel$export($325bc3d43b25708b$exports, "react-spectrum-Table", () => $325bc3d43b25708b$export$8cc7e6e5f955c192, (v) => $325bc3d43b25708b$export$8cc7e6e5f955c192 = v);
@@ -392,20 +361,6 @@ $325bc3d43b25708b$export$8bffb31c98aaf8d5 = "react-spectrum-Table-centeredWrappe
392
361
 
393
362
 
394
363
 
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
364
 
410
365
 
411
366
 
@@ -459,7 +414,7 @@ function $c0025c334c996aed$var$TableView_DEPRECATED(props, ref) {
459
414
  let formatMessage = $gyhAV$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($467944769c14687b$exports)));
460
415
  let { scale: scale } = $gyhAV$useProvider();
461
416
  let density = props.density || 'regular';
462
- let layout = $gyhAV$useMemo(()=>new $gyhAV$TableLayout_DEPRECATED({
417
+ let layout = $gyhAV$useMemo(()=>new $gyhAV$TableLayout({
463
418
  // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
464
419
  rowHeight: props.overflowMode === 'wrap' ? null : $c0025c334c996aed$var$ROW_HEIGHTS[density][scale],
465
420
  estimatedRowHeight: props.overflowMode === 'wrap' ? $c0025c334c996aed$var$ROW_HEIGHTS[density][scale] : null,
@@ -914,616 +869,9 @@ function $c0025c334c996aed$var$CenteredWrapper({ children: children }) {
914
869
 
915
870
 
916
871
 
917
-
918
-
919
-
920
-
921
-
922
-
923
-
924
- const $d14697b14e638114$var$DEFAULT_HEADER_HEIGHT = {
925
- medium: 34,
926
- large: 40
927
- };
928
- const $d14697b14e638114$var$DEFAULT_HIDE_HEADER_CELL_WIDTH = {
929
- medium: 36,
930
- large: 44
931
- };
932
- const $d14697b14e638114$var$ROW_HEIGHTS = {
933
- compact: {
934
- medium: 32,
935
- large: 40
936
- },
937
- regular: {
938
- medium: 40,
939
- large: 50
940
- },
941
- spacious: {
942
- medium: 48,
943
- large: 60
944
- }
945
- };
946
- const $d14697b14e638114$var$SELECTION_CELL_DEFAULT_WIDTH = {
947
- medium: 38,
948
- large: 48
949
- };
950
- const $d14697b14e638114$var$TableContext = /*#__PURE__*/ $gyhAV$react.createContext(null);
951
- function $d14697b14e638114$export$3cb274deb6c2d854() {
952
- return $gyhAV$useContext($d14697b14e638114$var$TableContext);
953
- }
954
- function $d14697b14e638114$var$TableView(props, ref) {
955
- props = $gyhAV$useProviderProps(props);
956
- let { isQuiet: isQuiet , onAction: onAction } = props;
957
- let { styleProps: styleProps } = $gyhAV$useStyleProps(props);
958
- let [showSelectionCheckboxes, setShowSelectionCheckboxes] = $gyhAV$useState(props.selectionStyle !== 'highlight');
959
- let { scale: scale } = $gyhAV$useProvider();
960
- const getDefaultWidth = $gyhAV$useCallback(({ hideHeader: hideHeader , isSelectionCell: isSelectionCell , showDivider: showDivider })=>{
961
- if (hideHeader) {
962
- let width = $d14697b14e638114$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
963
- return showDivider ? width + 1 : width;
964
- } else if (isSelectionCell) return $d14697b14e638114$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
965
- }, [
966
- scale
967
- ]);
968
- let state = $gyhAV$useTableState({
969
- ...props,
970
- showSelectionCheckboxes: showSelectionCheckboxes,
971
- selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle',
972
- getDefaultWidth: getDefaultWidth
973
- });
974
- // If the selection behavior changes in state, we need to update showSelectionCheckboxes here due to the circular dependency...
975
- let shouldShowCheckboxes = state.selectionManager.selectionBehavior !== 'replace';
976
- if (shouldShowCheckboxes !== showSelectionCheckboxes) setShowSelectionCheckboxes(shouldShowCheckboxes);
977
- let domRef = $gyhAV$useDOMRef(ref);
978
- let bodyRef = $gyhAV$useRef();
979
- let formatMessage = $gyhAV$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($467944769c14687b$exports)));
980
- let density = props.density || 'regular';
981
- let layout = $gyhAV$useMemo(()=>new $gyhAV$TableLayout({
982
- // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
983
- rowHeight: props.overflowMode === 'wrap' ? null : $d14697b14e638114$var$ROW_HEIGHTS[density][scale],
984
- estimatedRowHeight: props.overflowMode === 'wrap' ? $d14697b14e638114$var$ROW_HEIGHTS[density][scale] : null,
985
- headingHeight: props.overflowMode === 'wrap' ? null : $d14697b14e638114$var$DEFAULT_HEADER_HEIGHT[scale],
986
- estimatedHeadingHeight: props.overflowMode === 'wrap' ? $d14697b14e638114$var$DEFAULT_HEADER_HEIGHT[scale] : null
987
- })
988
- , [
989
- props.overflowMode,
990
- scale,
991
- density
992
- ]);
993
- let { direction: direction } = $gyhAV$useLocale();
994
- layout.collection = state.collection;
995
- layout.getColumnWidth = state.getColumnWidth;
996
- let { gridProps: gridProps } = $gyhAV$useTable({
997
- ...props,
998
- isVirtualized: true,
999
- layout: layout,
1000
- onRowAction: onAction
1001
- }, state, domRef);
1002
- let renderWrapper = (parent, reusableView, children, renderChildren)=>{
1003
- let style = $gyhAV$layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
1004
- if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
1005
- if (reusableView.viewType === 'rowgroup') return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableRowGroup, {
1006
- key: reusableView.key,
1007
- style: style
1008
- }, renderChildren(children)));
1009
- if (reusableView.viewType === 'header') return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableHeader, {
1010
- key: reusableView.key,
1011
- style: style
1012
- }, renderChildren(children)));
1013
- if (reusableView.viewType === 'row') return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableRow, {
1014
- key: reusableView.key,
1015
- item: reusableView.content,
1016
- style: style,
1017
- hasActions: onAction
1018
- }, renderChildren(children)));
1019
- if (reusableView.viewType === 'headerrow') return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableHeaderRow, {
1020
- key: reusableView.key,
1021
- style: style,
1022
- item: reusableView.content
1023
- }, renderChildren(children)));
1024
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$VirtualizerItem, {
1025
- key: reusableView.key,
1026
- reusableView: reusableView,
1027
- parent: parent,
1028
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-cellWrapper', $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), {
1029
- 'react-spectrum-Table-cellWrapper': !reusableView.layoutInfo.estimatedSize
1030
- }))
1031
- }));
1032
- };
1033
- let renderView = (type, item)=>{
1034
- switch(type){
1035
- case 'header':
1036
- case 'rowgroup':
1037
- case 'section':
1038
- case 'row':
1039
- case 'headerrow':
1040
- return null;
1041
- case 'cell':
1042
- if (item.props.isSelectionCell) return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableCheckboxCell, {
1043
- cell: item
1044
- }));
1045
- return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableCell, {
1046
- cell: item
1047
- }));
1048
- case 'placeholder':
1049
- // TODO: move to react-aria?
1050
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1051
- role: "gridcell",
1052
- "aria-colindex": item.index + 1,
1053
- "aria-colspan": item.colspan > 1 ? item.colspan : null
1054
- }));
1055
- case 'column':
1056
- if (item.props.isSelectionCell) return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableSelectAllCell, {
1057
- column: item
1058
- }));
1059
- if (item.props.hideHeader) return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$TooltipTrigger, {
1060
- placement: "top",
1061
- trigger: "focus"
1062
- }, /*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableColumnHeader, {
1063
- column: item
1064
- }), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Tooltip, {
1065
- placement: "top"
1066
- }, item.rendered)));
1067
- if (item.props.allowsResizing) return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$ResizableTableColumnHeader, {
1068
- item: item,
1069
- state: state
1070
- }));
1071
- return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableColumnHeader, {
1072
- column: item
1073
- }));
1074
- case 'loader':
1075
- return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$CenteredWrapper, null, /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$ProgressCircle, {
1076
- isIndeterminate: true,
1077
- "aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
1078
- })));
1079
- case 'empty':
1080
- {
1081
- let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
1082
- if (emptyState == null) return null;
1083
- return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$CenteredWrapper, null, emptyState));
1084
- }
1085
- }
1086
- };
1087
- let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = $gyhAV$useState(false);
1088
- let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = $gyhAV$useState(false);
1089
- let viewport = $gyhAV$useRef({
1090
- x: 0,
1091
- y: 0,
1092
- width: 0,
1093
- height: 0
1094
- });
1095
- let onVisibleRectChange = $gyhAV$useCallback((e)=>{
1096
- if (viewport.current.width === e.width && viewport.current.height === e.height) return;
1097
- viewport.current = e;
1098
- if (bodyRef.current) {
1099
- setVerticalScollbarVisible(bodyRef.current.clientWidth + 2 < bodyRef.current.offsetWidth);
1100
- setHorizontalScollbarVisible(bodyRef.current.clientHeight + 2 < bodyRef.current.offsetHeight);
1101
- }
1102
- }, []);
1103
- return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableContext.Provider, {
1104
- value: {
1105
- state: state,
1106
- layout: layout
1107
- }
1108
- }, /*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableVirtualizer, {
1109
- ...gridProps,
1110
- ...styleProps,
1111
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table', `spectrum-Table--${density}`, {
1112
- 'spectrum-Table--quiet': isQuiet,
1113
- 'spectrum-Table--wrap': props.overflowMode === 'wrap',
1114
- 'spectrum-Table--loadingMore': state.collection.body.props.loadingState === 'loadingMore',
1115
- 'spectrum-Table--resizingColumn': state.isResizingColumn,
1116
- 'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
1117
- 'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
1118
- }, $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), 'react-spectrum-Table')),
1119
- layout: layout,
1120
- collection: state.collection,
1121
- focusedKey: state.selectionManager.focusedKey,
1122
- renderView: renderView,
1123
- renderWrapper: renderWrapper,
1124
- setTableWidth: state.setTableWidth,
1125
- onVisibleRectChange: onVisibleRectChange,
1126
- domRef: domRef,
1127
- bodyRef: bodyRef,
1128
- getColumnWidth: state.getColumnWidth
1129
- })));
1130
- }
1131
- // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
1132
- 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 }) {
1133
- var ref;
1134
- let { direction: direction } = $gyhAV$useLocale();
1135
- let headerRef = $gyhAV$useRef();
1136
- let loadingState = collection.body.props.loadingState;
1137
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
1138
- let onLoadMore = collection.body.props.onLoadMore;
1139
- let state = $gyhAV$useVirtualizerState({
1140
- layout: layout,
1141
- collection: collection,
1142
- renderView: renderView,
1143
- renderWrapper: renderWrapper,
1144
- onVisibleRectChange (rect) {
1145
- bodyRef.current.scrollTop = rect.y;
1146
- $gyhAV$setScrollLeft(bodyRef.current, direction, rect.x);
1147
- },
1148
- transitionDuration: isLoading ? 160 : 220
1149
- });
1150
- let { virtualizerProps: virtualizerProps } = $gyhAV$useVirtualizer({
1151
- focusedKey: focusedKey,
1152
- scrollToItem (key) {
1153
- let item = collection.getItem(key);
1154
- let column = collection.columns[0];
1155
- state.virtualizer.scrollToItem(key, {
1156
- duration: 0,
1157
- // Prevent scrolling to the top when clicking on column headers.
1158
- shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
1159
- // Offset scroll position by width of selection cell
1160
- // (which is sticky and will overlap the cell we're scrolling to).
1161
- offsetX: column.props.isSelectionCell ? layout.getColumnWidth(column.key) : 0
1162
- });
1163
- }
1164
- }, state, domRef);
1165
- // If columnwidths change, need to relayout.
1166
- $gyhAV$useLayoutEffect(()=>{
1167
- state.virtualizer.relayoutNow({
1168
- sizeChanged: true
1169
- });
1170
- }, [
1171
- getColumnWidth,
1172
- state.virtualizer
1173
- ]);
1174
- let headerHeight = ((ref = layout.getLayoutInfo('header')) === null || ref === void 0 ? void 0 : ref.rect.height) || 0;
1175
- let visibleRect = state.virtualizer.visibleRect;
1176
- // Sync the scroll position from the table body to the header container.
1177
- let onScroll = $gyhAV$useCallback(()=>{
1178
- headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
1179
- }, [
1180
- bodyRef
1181
- ]);
1182
- let onVisibleRectChange = $gyhAV$useCallback((rect)=>{
1183
- // setting the table width will recalculate column widths which we only want to do once the virtualizer is done initializing
1184
- if (state.virtualizer.contentSize.height > 0) setTableWidth(rect.width);
1185
- state.setVisibleRect(rect);
1186
- if (!isLoading && onLoadMore) {
1187
- let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
1188
- if (rect.y > scrollOffset) onLoadMore();
1189
- }
1190
- }, [
1191
- onLoadMore,
1192
- isLoading,
1193
- state.setVisibleRect,
1194
- state.virtualizer
1195
- ]);
1196
- $gyhAV$useLayoutEffect(()=>{
1197
- if (!isLoading && onLoadMore && !state.isAnimating) {
1198
- if (state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
1199
- }
1200
- }, [
1201
- state.contentSize,
1202
- state.virtualizer,
1203
- state.isAnimating,
1204
- onLoadMore,
1205
- isLoading
1206
- ]);
1207
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1208
- ...$gyhAV$mergeProps(otherProps, virtualizerProps),
1209
- ref: domRef
1210
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1211
- role: "presentation",
1212
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headWrapper'),
1213
- style: {
1214
- width: visibleRect.width,
1215
- height: headerHeight,
1216
- overflow: 'hidden',
1217
- position: 'relative',
1218
- willChange: state.isScrolling ? 'scroll-position' : '',
1219
- transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
1220
- },
1221
- ref: headerRef
1222
- }, state.visibleViews[0]), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$ScrollView, {
1223
- role: "presentation",
1224
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-body'),
1225
- style: {
1226
- flex: 1
1227
- },
1228
- innerStyle: {
1229
- overflow: 'visible',
1230
- transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
1231
- },
1232
- ref: bodyRef,
1233
- contentSize: state.contentSize,
1234
- onVisibleRectChange: $gyhAV$chain(onVisibleRectChange, onVisibleRectChangeProp),
1235
- onScrollStart: state.startScrolling,
1236
- onScrollEnd: state.endScrolling,
1237
- onScroll: onScroll
1238
- }, state.visibleViews[1])));
1239
- }
1240
- function $d14697b14e638114$var$TableHeader({ children: children , ...otherProps }) {
1241
- let { rowGroupProps: rowGroupProps } = $gyhAV$useTableRowGroup();
1242
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1243
- ...rowGroupProps,
1244
- ...otherProps,
1245
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-head')
1246
- }, children));
1247
- }
1248
- function $d14697b14e638114$var$TableColumnHeader(props) {
1249
- var ref, ref1, ref2, ref3;
1250
- let { column: column } = props;
1251
- let ref4 = $gyhAV$useRef();
1252
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1253
- let { columnHeaderProps: columnHeaderProps } = $gyhAV$useTableColumnHeader({
1254
- node: column,
1255
- isVirtualized: true
1256
- }, state, ref4);
1257
- let { buttonProps: buttonProps } = $gyhAV$useButton({
1258
- ...props,
1259
- elementType: 'div'
1260
- }, ref4);
1261
- let columnProps = column.props;
1262
- 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.');
1263
- let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover({
1264
- });
1265
- const allProps = [
1266
- columnHeaderProps,
1267
- hoverProps
1268
- ];
1269
- if (columnProps.allowsResizing) allProps.push(buttonProps);
1270
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1271
- focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
1272
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1273
- ...$gyhAV$mergeProps(...allProps),
1274
- ref: ref4,
1275
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCell', {
1276
- 'is-resizable': columnProps.allowsResizing,
1277
- 'is-sortable': columnProps.allowsSorting,
1278
- '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',
1279
- 'is-sorted-asc': ((ref2 = state.sortDescriptor) === null || ref2 === void 0 ? void 0 : ref2.column) === column.key && ((ref3 = state.sortDescriptor) === null || ref3 === void 0 ? void 0 : ref3.direction) === 'ascending',
1280
- 'is-hovered': isHovered,
1281
- 'spectrum-Table-cell--hideHeader': columnProps.hideHeader
1282
- }, $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), 'react-spectrum-Table-cell', {
1283
- 'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center' || column.colspan > 1,
1284
- 'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
1285
- }))
1286
- }, columnProps.hideHeader ? /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$VisuallyHidden, null, column.rendered) : /*#__PURE__*/ $gyhAV$react.createElement("div", {
1287
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCellContents')
1288
- }, column.rendered), columnProps.allowsSorting && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$spectrumiconsuiArrowDownSmall, {
1289
- UNSAFE_className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-sortedIcon')
1290
- }))));
1291
- }
1292
- function $d14697b14e638114$var$ResizableTableColumnHeader({ item: item , state: state }) {
1293
- var ref, ref5;
1294
- let ref6 = $gyhAV$useRef();
1295
- const onMenuSelect = (key)=>{
1296
- switch(key){
1297
- case `${item.key}-sort-asc`:
1298
- state.sort(item.key, 'ascending');
1299
- break;
1300
- case `${item.key}-sort-desc`:
1301
- state.sort(item.key, 'descending');
1302
- break;
1303
- case `${item.key}-resize`:
1304
- // focusResizer, needs timeout so that it happens after the animation timeout for menu close
1305
- setTimeout(()=>{
1306
- $gyhAV$focusSafely(ref6.current);
1307
- }, 360);
1308
- break;
1309
- }
1310
- };
1311
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$react.Fragment, null, /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$MenuTrigger, null, /*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$TableColumnHeader, {
1312
- column: item
1313
- }), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Menu, {
1314
- onAction: onMenuSelect,
1315
- minWidth: "size-2000"
1316
- }, ((ref = item.props) === null || ref === void 0 ? void 0 : ref.allowsSorting) && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Item, {
1317
- key: `${item.key}-sort-asc`
1318
- }, "Sort Ascending"), ((ref5 = item.props) === null || ref5 === void 0 ? void 0 : ref5.allowsSorting) && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Item, {
1319
- key: `${item.key}-sort-desc`
1320
- }, "Sort Descending"), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Item, {
1321
- key: `${item.key}-resize`
1322
- }, "Resize column"))), /*#__PURE__*/ $gyhAV$react.createElement($fc695d2eafc2b351$export$48a76196cafe3b93, {
1323
- ref: ref6,
1324
- item: item
1325
- })));
1326
- }
1327
- function $d14697b14e638114$var$TableSelectAllCell({ column: column }) {
1328
- let ref = $gyhAV$useRef();
1329
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1330
- let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
1331
- let { columnHeaderProps: columnHeaderProps } = $gyhAV$useTableColumnHeader({
1332
- node: column,
1333
- isVirtualized: true
1334
- }, state, ref);
1335
- let { checkboxProps: checkboxProps } = $gyhAV$useTableSelectAllCheckbox(state);
1336
- let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover({
1337
- });
1338
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1339
- focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
1340
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1341
- ...$gyhAV$mergeProps(columnHeaderProps, hoverProps),
1342
- ref: ref,
1343
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-headCell', 'spectrum-Table-checkboxCell', {
1344
- 'is-hovered': isHovered
1345
- })
1346
- }, /*
1347
- In single selection mode, the checkbox will be hidden.
1348
- So to avoid leaving a column header with no accessible content,
1349
- we use a VisuallyHidden component to include the aria-label from the checkbox,
1350
- which for single selection will be "Select."
1351
- */ isSingleSelectionMode && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$VisuallyHidden, null, checkboxProps['aria-label']), /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Checkbox, {
1352
- ...checkboxProps,
1353
- isDisabled: isSingleSelectionMode,
1354
- isEmphasized: true,
1355
- UNSAFE_style: isSingleSelectionMode ? {
1356
- visibility: 'hidden'
1357
- } : undefined,
1358
- UNSAFE_className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-checkbox')
1359
- }))));
1360
- }
1361
- function $d14697b14e638114$var$TableRowGroup({ children: children , ...otherProps }) {
1362
- let { rowGroupProps: rowGroupProps } = $gyhAV$useTableRowGroup();
1363
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1364
- ...rowGroupProps,
1365
- ...otherProps
1366
- }, children));
1367
- }
1368
- function $d14697b14e638114$var$TableRow({ item: item , children: children , hasActions: hasActions , ...otherProps }) {
1369
- var ref, ref7, ref8;
1370
- let ref9 = $gyhAV$useRef();
1371
- let { state: state , layout: layout } = $d14697b14e638114$export$3cb274deb6c2d854();
1372
- let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
1373
- let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
1374
- let isSelected = state.selectionManager.isSelected(item.key);
1375
- let { rowProps: rowProps } = $gyhAV$useTableRow({
1376
- node: item,
1377
- isVirtualized: true
1378
- }, state, ref9);
1379
- let { pressProps: pressProps , isPressed: isPressed } = $gyhAV$usePress({
1380
- isDisabled: isDisabled
1381
- });
1382
- // The row should show the focus background style when any cell inside it is focused.
1383
- // If the row itself is focused, then it should have a blue focus indicator on the left.
1384
- let { isFocusVisible: isFocusVisibleWithin , focusProps: focusWithinProps } = $gyhAV$useFocusRing({
1385
- within: true
1386
- });
1387
- let { isFocusVisible: isFocusVisible , focusProps: focusProps } = $gyhAV$useFocusRing();
1388
- let { hoverProps: hoverProps , isHovered: isHovered } = $gyhAV$useHover({
1389
- isDisabled: isDisabled
1390
- });
1391
- let props = $gyhAV$mergeProps(rowProps, otherProps, focusWithinProps, focusProps, hoverProps, pressProps);
1392
- let isFirstRow = ((ref = state.collection.rows.find((row)=>row.level === 1
1393
- )) === null || ref === void 0 ? void 0 : ref.key) === item.key;
1394
- let isLastRow = item.nextKey == null;
1395
- // Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
1396
- // border corners of the last row when selected.
1397
- let isFlushWithContainerBottom = false;
1398
- if (isLastRow) {
1399
- if (((ref7 = layout.getContentSize()) === null || ref7 === void 0 ? void 0 : ref7.height) >= ((ref8 = layout.virtualizer) === null || ref8 === void 0 ? void 0 : ref8.getVisibleRect().height)) isFlushWithContainerBottom = true;
1400
- }
1401
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1402
- ...props,
1403
- ref: ref9,
1404
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-row', {
1405
- 'is-active': isPressed,
1406
- 'is-selected': isSelected,
1407
- 'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
1408
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
1409
- 'is-focused': isFocusVisibleWithin,
1410
- 'focus-ring': isFocusVisible,
1411
- 'is-hovered': isHovered,
1412
- 'is-disabled': isDisabled,
1413
- 'spectrum-Table-row--firstRow': isFirstRow,
1414
- 'spectrum-Table-row--lastRow': isLastRow,
1415
- 'spectrum-Table-row--isFlushBottom': isFlushWithContainerBottom
1416
- })
1417
- }, children));
1418
- }
1419
- function $d14697b14e638114$var$TableHeaderRow({ item: item , children: children , style: style }) {
1420
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1421
- let ref = $gyhAV$useRef();
1422
- let { rowProps: rowProps } = $gyhAV$useTableHeaderRow({
1423
- node: item,
1424
- isVirtualized: true
1425
- }, state, ref);
1426
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1427
- ...rowProps,
1428
- ref: ref,
1429
- style: style
1430
- }, children));
1431
- }
1432
- function $d14697b14e638114$var$TableCheckboxCell({ cell: cell }) {
1433
- let ref = $gyhAV$useRef();
1434
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1435
- let isDisabled = state.disabledKeys.has(cell.parentKey);
1436
- let { gridCellProps: gridCellProps } = $gyhAV$useTableCell({
1437
- node: cell,
1438
- isVirtualized: true
1439
- }, state, ref);
1440
- let { checkboxProps: checkboxProps } = $gyhAV$useTableSelectionCheckbox({
1441
- key: cell.parentKey
1442
- }, state);
1443
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1444
- focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
1445
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1446
- ...gridCellProps,
1447
- ref: ref,
1448
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-cell', 'spectrum-Table-checkboxCell', {
1449
- 'is-disabled': isDisabled
1450
- }, $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), 'react-spectrum-Table-cell'))
1451
- }, state.selectionManager.selectionMode !== 'none' && /*#__PURE__*/ $gyhAV$react.createElement($gyhAV$Checkbox, {
1452
- ...checkboxProps,
1453
- isEmphasized: true,
1454
- isDisabled: isDisabled,
1455
- UNSAFE_className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-checkbox')
1456
- }))));
1457
- }
1458
- function $d14697b14e638114$var$TableCell({ cell: cell }) {
1459
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1460
- let ref = $gyhAV$useRef();
1461
- let columnProps = cell.column.props;
1462
- let isDisabled = state.disabledKeys.has(cell.parentKey);
1463
- let { gridCellProps: gridCellProps } = $gyhAV$useTableCell({
1464
- node: cell,
1465
- isVirtualized: true
1466
- }, state, ref);
1467
- return(/*#__PURE__*/ $gyhAV$react.createElement($gyhAV$FocusRing, {
1468
- focusRingClass: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'focus-ring')
1469
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1470
- ...gridCellProps,
1471
- ref: ref,
1472
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-cell', {
1473
- 'spectrum-Table-cell--divider': columnProps.showDivider && cell.column.nextKey !== null,
1474
- 'spectrum-Table-cell--hideHeader': columnProps.hideHeader,
1475
- 'is-disabled': isDisabled
1476
- }, $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), 'react-spectrum-Table-cell', {
1477
- 'react-spectrum-Table-cell--alignStart': columnProps.align === 'start',
1478
- 'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center',
1479
- 'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
1480
- }))
1481
- }, /*#__PURE__*/ $gyhAV$react.createElement("span", {
1482
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports)), 'spectrum-Table-cellContents')
1483
- }, cell.rendered))));
1484
- }
1485
- function $d14697b14e638114$var$CenteredWrapper({ children: children }) {
1486
- let { state: state } = $d14697b14e638114$export$3cb274deb6c2d854();
1487
- return(/*#__PURE__*/ $gyhAV$react.createElement("div", {
1488
- role: "row",
1489
- "aria-rowindex": state.collection.headerRows.length + state.collection.size + 1,
1490
- className: $gyhAV$classNames((/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports)), 'react-spectrum-Table-centeredWrapper')
1491
- }, /*#__PURE__*/ $gyhAV$react.createElement("div", {
1492
- role: "rowheader",
1493
- "aria-colspan": state.collection.columns.length
1494
- }, children)));
1495
- }
1496
- /**
1497
- * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
1498
- */ const $d14697b14e638114$var$_TableView = /*#__PURE__*/ $gyhAV$react.forwardRef($d14697b14e638114$var$TableView);
1499
- /*
1500
- When ready to remove this feature flag, you can remove this whole section of code, delete the _DEPRECATED files, and just replace the export with the _TableView above.
1501
- */ function $d14697b14e638114$var$FeatureFlaggedTableView(props, ref10) {
1502
- let state = $gyhAV$useTableState({
1503
- ...props
1504
- });
1505
- const someColumnsAllowResizing = state.collection.columns.some((c)=>{
1506
- var ref;
1507
- return (ref = c.props) === null || ref === void 0 ? void 0 : ref.allowsResizing;
1508
- });
1509
- if (someColumnsAllowResizing) return(/*#__PURE__*/ $gyhAV$react.createElement($d14697b14e638114$var$_TableView, {
1510
- ...props,
1511
- ref: ref10
1512
- }));
1513
- else return(/*#__PURE__*/ $gyhAV$react.createElement($c0025c334c996aed$export$8790f9f1576000df, {
1514
- ...props,
1515
- ref: ref10
1516
- }));
1517
- }
1518
- /**
1519
- * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
1520
- */ const $d14697b14e638114$export$b3c27e869d856b7 = /*#__PURE__*/ $gyhAV$react.forwardRef($d14697b14e638114$var$FeatureFlaggedTableView);
1521
-
1522
-
1523
-
1524
872
  // Override TS for Column to support spectrum specific props.
1525
873
  const $e668f3d0f378a712$export$816b5d811295e6bc = $gyhAV$Column;
1526
874
 
1527
875
 
1528
- export {$e668f3d0f378a712$export$816b5d811295e6bc as Column, $d14697b14e638114$export$b3c27e869d856b7 as TableView, $e668f3d0f378a712$re_export$TableHeader as TableHeader, $e668f3d0f378a712$re_export$TableBody as TableBody, $e668f3d0f378a712$re_export$Section as Section, $e668f3d0f378a712$re_export$Row as Row, $e668f3d0f378a712$re_export$Cell as Cell};
876
+ export {$e668f3d0f378a712$export$816b5d811295e6bc as Column, $c0025c334c996aed$export$8790f9f1576000df as TableView, $e668f3d0f378a712$re_export$TableHeader as TableHeader, $e668f3d0f378a712$re_export$TableBody as TableBody, $e668f3d0f378a712$re_export$Section as Section, $e668f3d0f378a712$re_export$Row as Row, $e668f3d0f378a712$re_export$Cell as Cell};
1529
877
  //# sourceMappingURL=module.js.map