@react-spectrum/table 3.17.11 → 3.18.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.
Files changed (263) hide show
  1. package/dist/import.mjs +2 -6
  2. package/dist/main.js +8 -12
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -6
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +3 -0
  7. package/package.json +14 -52
  8. package/src/index.ts +3 -18
  9. package/dist/DragPreview.main.js +0 -54
  10. package/dist/DragPreview.main.js.map +0 -1
  11. package/dist/DragPreview.mjs +0 -49
  12. package/dist/DragPreview.module.js +0 -49
  13. package/dist/DragPreview.module.js.map +0 -1
  14. package/dist/InsertionIndicator.main.js +0 -64
  15. package/dist/InsertionIndicator.main.js.map +0 -1
  16. package/dist/InsertionIndicator.mjs +0 -59
  17. package/dist/InsertionIndicator.module.js +0 -59
  18. package/dist/InsertionIndicator.module.js.map +0 -1
  19. package/dist/Nubbin.main.js +0 -62
  20. package/dist/Nubbin.main.js.map +0 -1
  21. package/dist/Nubbin.mjs +0 -53
  22. package/dist/Nubbin.module.js +0 -53
  23. package/dist/Nubbin.module.js.map +0 -1
  24. package/dist/Resizer.main.js +0 -150
  25. package/dist/Resizer.main.js.map +0 -1
  26. package/dist/Resizer.mjs +0 -144
  27. package/dist/Resizer.module.js +0 -144
  28. package/dist/Resizer.module.js.map +0 -1
  29. package/dist/RootDropIndicator.main.js +0 -57
  30. package/dist/RootDropIndicator.main.js.map +0 -1
  31. package/dist/RootDropIndicator.mjs +0 -48
  32. package/dist/RootDropIndicator.module.js +0 -48
  33. package/dist/RootDropIndicator.module.js.map +0 -1
  34. package/dist/TableView.main.js +0 -49
  35. package/dist/TableView.main.js.map +0 -1
  36. package/dist/TableView.mjs +0 -40
  37. package/dist/TableView.module.js +0 -40
  38. package/dist/TableView.module.js.map +0 -1
  39. package/dist/TableViewBase.main.js +0 -1240
  40. package/dist/TableViewBase.main.js.map +0 -1
  41. package/dist/TableViewBase.mjs +0 -1233
  42. package/dist/TableViewBase.module.js +0 -1233
  43. package/dist/TableViewBase.module.js.map +0 -1
  44. package/dist/TableViewLayout.main.js +0 -101
  45. package/dist/TableViewLayout.main.js.map +0 -1
  46. package/dist/TableViewLayout.mjs +0 -96
  47. package/dist/TableViewLayout.module.js +0 -96
  48. package/dist/TableViewLayout.module.js.map +0 -1
  49. package/dist/TableViewWrapper.main.js +0 -45
  50. package/dist/TableViewWrapper.main.js.map +0 -1
  51. package/dist/TableViewWrapper.mjs +0 -36
  52. package/dist/TableViewWrapper.module.js +0 -36
  53. package/dist/TableViewWrapper.module.js.map +0 -1
  54. package/dist/TreeGridTableView.main.js +0 -49
  55. package/dist/TreeGridTableView.main.js.map +0 -1
  56. package/dist/TreeGridTableView.mjs +0 -40
  57. package/dist/TreeGridTableView.module.js +0 -40
  58. package/dist/TreeGridTableView.module.js.map +0 -1
  59. package/dist/ar-AE.main.js +0 -14
  60. package/dist/ar-AE.main.js.map +0 -1
  61. package/dist/ar-AE.mjs +0 -16
  62. package/dist/ar-AE.module.js +0 -16
  63. package/dist/ar-AE.module.js.map +0 -1
  64. package/dist/bg-BG.main.js +0 -14
  65. package/dist/bg-BG.main.js.map +0 -1
  66. package/dist/bg-BG.mjs +0 -16
  67. package/dist/bg-BG.module.js +0 -16
  68. package/dist/bg-BG.module.js.map +0 -1
  69. package/dist/cs-CZ.main.js +0 -14
  70. package/dist/cs-CZ.main.js.map +0 -1
  71. package/dist/cs-CZ.mjs +0 -16
  72. package/dist/cs-CZ.module.js +0 -16
  73. package/dist/cs-CZ.module.js.map +0 -1
  74. package/dist/da-DK.main.js +0 -14
  75. package/dist/da-DK.main.js.map +0 -1
  76. package/dist/da-DK.mjs +0 -16
  77. package/dist/da-DK.module.js +0 -16
  78. package/dist/da-DK.module.js.map +0 -1
  79. package/dist/de-DE.main.js +0 -14
  80. package/dist/de-DE.main.js.map +0 -1
  81. package/dist/de-DE.mjs +0 -16
  82. package/dist/de-DE.module.js +0 -16
  83. package/dist/de-DE.module.js.map +0 -1
  84. package/dist/el-GR.main.js +0 -14
  85. package/dist/el-GR.main.js.map +0 -1
  86. package/dist/el-GR.mjs +0 -16
  87. package/dist/el-GR.module.js +0 -16
  88. package/dist/el-GR.module.js.map +0 -1
  89. package/dist/en-US.main.js +0 -14
  90. package/dist/en-US.main.js.map +0 -1
  91. package/dist/en-US.mjs +0 -16
  92. package/dist/en-US.module.js +0 -16
  93. package/dist/en-US.module.js.map +0 -1
  94. package/dist/es-ES.main.js +0 -14
  95. package/dist/es-ES.main.js.map +0 -1
  96. package/dist/es-ES.mjs +0 -16
  97. package/dist/es-ES.module.js +0 -16
  98. package/dist/es-ES.module.js.map +0 -1
  99. package/dist/et-EE.main.js +0 -14
  100. package/dist/et-EE.main.js.map +0 -1
  101. package/dist/et-EE.mjs +0 -16
  102. package/dist/et-EE.module.js +0 -16
  103. package/dist/et-EE.module.js.map +0 -1
  104. package/dist/fi-FI.main.js +0 -14
  105. package/dist/fi-FI.main.js.map +0 -1
  106. package/dist/fi-FI.mjs +0 -16
  107. package/dist/fi-FI.module.js +0 -16
  108. package/dist/fi-FI.module.js.map +0 -1
  109. package/dist/fr-FR.main.js +0 -14
  110. package/dist/fr-FR.main.js.map +0 -1
  111. package/dist/fr-FR.mjs +0 -16
  112. package/dist/fr-FR.module.js +0 -16
  113. package/dist/fr-FR.module.js.map +0 -1
  114. package/dist/he-IL.main.js +0 -14
  115. package/dist/he-IL.main.js.map +0 -1
  116. package/dist/he-IL.mjs +0 -16
  117. package/dist/he-IL.module.js +0 -16
  118. package/dist/he-IL.module.js.map +0 -1
  119. package/dist/hr-HR.main.js +0 -14
  120. package/dist/hr-HR.main.js.map +0 -1
  121. package/dist/hr-HR.mjs +0 -16
  122. package/dist/hr-HR.module.js +0 -16
  123. package/dist/hr-HR.module.js.map +0 -1
  124. package/dist/hu-HU.main.js +0 -14
  125. package/dist/hu-HU.main.js.map +0 -1
  126. package/dist/hu-HU.mjs +0 -16
  127. package/dist/hu-HU.module.js +0 -16
  128. package/dist/hu-HU.module.js.map +0 -1
  129. package/dist/intlStrings.main.js +0 -108
  130. package/dist/intlStrings.main.js.map +0 -1
  131. package/dist/intlStrings.mjs +0 -110
  132. package/dist/intlStrings.module.js +0 -110
  133. package/dist/intlStrings.module.js.map +0 -1
  134. package/dist/it-IT.main.js +0 -14
  135. package/dist/it-IT.main.js.map +0 -1
  136. package/dist/it-IT.mjs +0 -16
  137. package/dist/it-IT.module.js +0 -16
  138. package/dist/it-IT.module.js.map +0 -1
  139. package/dist/ja-JP.main.js +0 -14
  140. package/dist/ja-JP.main.js.map +0 -1
  141. package/dist/ja-JP.mjs +0 -16
  142. package/dist/ja-JP.module.js +0 -16
  143. package/dist/ja-JP.module.js.map +0 -1
  144. package/dist/ko-KR.main.js +0 -14
  145. package/dist/ko-KR.main.js.map +0 -1
  146. package/dist/ko-KR.mjs +0 -16
  147. package/dist/ko-KR.module.js +0 -16
  148. package/dist/ko-KR.module.js.map +0 -1
  149. package/dist/lt-LT.main.js +0 -14
  150. package/dist/lt-LT.main.js.map +0 -1
  151. package/dist/lt-LT.mjs +0 -16
  152. package/dist/lt-LT.module.js +0 -16
  153. package/dist/lt-LT.module.js.map +0 -1
  154. package/dist/lv-LV.main.js +0 -14
  155. package/dist/lv-LV.main.js.map +0 -1
  156. package/dist/lv-LV.mjs +0 -16
  157. package/dist/lv-LV.module.js +0 -16
  158. package/dist/lv-LV.module.js.map +0 -1
  159. package/dist/nb-NO.main.js +0 -14
  160. package/dist/nb-NO.main.js.map +0 -1
  161. package/dist/nb-NO.mjs +0 -16
  162. package/dist/nb-NO.module.js +0 -16
  163. package/dist/nb-NO.module.js.map +0 -1
  164. package/dist/nl-NL.main.js +0 -14
  165. package/dist/nl-NL.main.js.map +0 -1
  166. package/dist/nl-NL.mjs +0 -16
  167. package/dist/nl-NL.module.js +0 -16
  168. package/dist/nl-NL.module.js.map +0 -1
  169. package/dist/pl-PL.main.js +0 -14
  170. package/dist/pl-PL.main.js.map +0 -1
  171. package/dist/pl-PL.mjs +0 -16
  172. package/dist/pl-PL.module.js +0 -16
  173. package/dist/pl-PL.module.js.map +0 -1
  174. package/dist/pt-BR.main.js +0 -14
  175. package/dist/pt-BR.main.js.map +0 -1
  176. package/dist/pt-BR.mjs +0 -16
  177. package/dist/pt-BR.module.js +0 -16
  178. package/dist/pt-BR.module.js.map +0 -1
  179. package/dist/pt-PT.main.js +0 -14
  180. package/dist/pt-PT.main.js.map +0 -1
  181. package/dist/pt-PT.mjs +0 -16
  182. package/dist/pt-PT.module.js +0 -16
  183. package/dist/pt-PT.module.js.map +0 -1
  184. package/dist/ro-RO.main.js +0 -14
  185. package/dist/ro-RO.main.js.map +0 -1
  186. package/dist/ro-RO.mjs +0 -16
  187. package/dist/ro-RO.module.js +0 -16
  188. package/dist/ro-RO.module.js.map +0 -1
  189. package/dist/ru-RU.main.js +0 -14
  190. package/dist/ru-RU.main.js.map +0 -1
  191. package/dist/ru-RU.mjs +0 -16
  192. package/dist/ru-RU.module.js +0 -16
  193. package/dist/ru-RU.module.js.map +0 -1
  194. package/dist/sk-SK.main.js +0 -14
  195. package/dist/sk-SK.main.js.map +0 -1
  196. package/dist/sk-SK.mjs +0 -16
  197. package/dist/sk-SK.module.js +0 -16
  198. package/dist/sk-SK.module.js.map +0 -1
  199. package/dist/sl-SI.main.js +0 -14
  200. package/dist/sl-SI.main.js.map +0 -1
  201. package/dist/sl-SI.mjs +0 -16
  202. package/dist/sl-SI.module.js +0 -16
  203. package/dist/sl-SI.module.js.map +0 -1
  204. package/dist/sr-SP.main.js +0 -14
  205. package/dist/sr-SP.main.js.map +0 -1
  206. package/dist/sr-SP.mjs +0 -16
  207. package/dist/sr-SP.module.js +0 -16
  208. package/dist/sr-SP.module.js.map +0 -1
  209. package/dist/sv-SE.main.js +0 -14
  210. package/dist/sv-SE.main.js.map +0 -1
  211. package/dist/sv-SE.mjs +0 -16
  212. package/dist/sv-SE.module.js +0 -16
  213. package/dist/sv-SE.module.js.map +0 -1
  214. package/dist/table.0cdc494a.css +0 -992
  215. package/dist/table.0cdc494a.css.map +0 -1
  216. package/dist/table.11fc8462.css +0 -220
  217. package/dist/table.11fc8462.css.map +0 -1
  218. package/dist/table_css.main.js +0 -74
  219. package/dist/table_css.main.js.map +0 -1
  220. package/dist/table_css.mjs +0 -76
  221. package/dist/table_css.module.js +0 -76
  222. package/dist/table_css.module.js.map +0 -1
  223. package/dist/table_vars_css.main.js +0 -197
  224. package/dist/table_vars_css.main.js.map +0 -1
  225. package/dist/table_vars_css.mjs +0 -199
  226. package/dist/table_vars_css.module.js +0 -199
  227. package/dist/table_vars_css.module.js.map +0 -1
  228. package/dist/tr-TR.main.js +0 -14
  229. package/dist/tr-TR.main.js.map +0 -1
  230. package/dist/tr-TR.mjs +0 -16
  231. package/dist/tr-TR.module.js +0 -16
  232. package/dist/tr-TR.module.js.map +0 -1
  233. package/dist/types.d.ts +0 -85
  234. package/dist/types.d.ts.map +0 -1
  235. package/dist/uk-UA.main.js +0 -14
  236. package/dist/uk-UA.main.js.map +0 -1
  237. package/dist/uk-UA.mjs +0 -16
  238. package/dist/uk-UA.module.js +0 -16
  239. package/dist/uk-UA.module.js.map +0 -1
  240. package/dist/zh-CN.main.js +0 -14
  241. package/dist/zh-CN.main.js.map +0 -1
  242. package/dist/zh-CN.mjs +0 -16
  243. package/dist/zh-CN.module.js +0 -16
  244. package/dist/zh-CN.module.js.map +0 -1
  245. package/dist/zh-TW.main.js +0 -14
  246. package/dist/zh-TW.main.js.map +0 -1
  247. package/dist/zh-TW.mjs +0 -16
  248. package/dist/zh-TW.module.js +0 -16
  249. package/dist/zh-TW.module.js.map +0 -1
  250. package/src/DragPreview.tsx +0 -77
  251. package/src/InsertionIndicator.tsx +0 -62
  252. package/src/Nubbin.tsx +0 -28
  253. package/src/Resizer.tsx +0 -137
  254. package/src/RootDropIndicator.tsx +0 -40
  255. package/src/TableView.tsx +0 -44
  256. package/src/TableViewBase.tsx +0 -1570
  257. package/src/TableViewLayout.ts +0 -102
  258. package/src/TableViewWrapper.tsx +0 -103
  259. package/src/TreeGridTableView.tsx +0 -44
  260. package/src/cursors/Cur_MoveHorizontal_9_9.svg +0 -10
  261. package/src/cursors/Cur_MoveToLeft_9_9.svg +0 -10
  262. package/src/cursors/Cur_MoveToRight_9_9.svg +0 -10
  263. package/src/table.css +0 -235
@@ -1,102 +0,0 @@
1
- /*
2
- * Copyright 2024 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
- import {DropTarget} from '@react-types/shared';
13
- import {GridNode} from '@react-types/grid';
14
- import {LayoutInfo, Rect} from '@react-stately/virtualizer';
15
- import {LayoutNode, TableLayout} from '@react-stately/layout';
16
- import {TableCollection} from '@react-stately/table';
17
-
18
- export class TableViewLayout<T> extends TableLayout<T> {
19
- private isLoading: boolean = false;
20
-
21
- protected buildCollection(): LayoutNode[] {
22
- let collection = this.virtualizer!.collection as TableCollection<T>;
23
- let loadingState = collection.body.props.loadingState;
24
- this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
25
- return super.buildCollection();
26
- }
27
-
28
- protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {
29
- let res = super.buildColumn(node, x, y);
30
- res.layoutInfo.allowOverflow = true; // for resizer nubbin
31
- return res;
32
- }
33
-
34
- protected buildBody(): LayoutNode {
35
- let node = super.buildBody(0);
36
- let {children, layoutInfo} = node;
37
- if (!children) {
38
- throw new Error('Missing children in LayoutInfo');
39
- }
40
-
41
- let width = node.layoutInfo.rect.width;
42
-
43
- if (this.isLoading) {
44
- // Add some margin around the loader to ensure that scrollbars don't flicker in and out.
45
- let rect = new Rect(40, children.length === 0 ? 40 : layoutInfo.rect.maxY, (width || this.virtualizer!.visibleRect.width) - 80, children.length === 0 ? this.virtualizer!.visibleRect.height - 80 : 60);
46
- let loader = new LayoutInfo('loader', 'loader', rect);
47
- loader.parentKey = layoutInfo.key;
48
- loader.isSticky = children.length === 0;
49
- let node = {
50
- layoutInfo: loader,
51
- validRect: loader.rect
52
- };
53
- children.push(node);
54
- this.layoutNodes.set(loader.key, node);
55
- layoutInfo.rect.height = loader.rect.maxY;
56
- width = Math.max(width, rect.width);
57
- } else if (children.length === 0) {
58
- let rect = new Rect(40, 40, this.virtualizer!.visibleRect.width - 80, this.virtualizer!.visibleRect.height - 80);
59
- let empty = new LayoutInfo('empty', 'empty', rect);
60
- empty.parentKey = layoutInfo.key;
61
- empty.isSticky = true;
62
- empty.allowOverflow = true;
63
- let node = {
64
- layoutInfo: empty,
65
- validRect: empty.rect
66
- };
67
- children.push(node);
68
- layoutInfo.rect.height = empty.rect.maxY;
69
- width = Math.max(width, rect.width);
70
- }
71
-
72
- return node;
73
- }
74
-
75
- protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {
76
- let res = super.buildRow(node, x, y);
77
- res.layoutInfo.rect.height += 1; // for bottom border
78
- return res;
79
- }
80
-
81
- protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {
82
- let res = super.buildCell(node, x, y);
83
- if (node.column?.props.hideHeader) {
84
- res.layoutInfo.allowOverflow = true;
85
- }
86
- return res;
87
- }
88
-
89
- protected getEstimatedRowHeight(): number {
90
- return super.getEstimatedRowHeight() + 1; // for bottom border
91
- }
92
-
93
- protected isStickyColumn(node: GridNode<T>): boolean {
94
- return (node.props?.isDragButtonCell || node.props?.isSelectionCell) ?? false;
95
- }
96
-
97
- getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {
98
- // Offset for height of header row
99
- y -= this.getVisibleLayoutInfos(new Rect(x, y, 1, 1)).find(info => info.type === 'headerrow')?.rect.height ?? 0;
100
- return super.getDropTargetFromPoint(x, y, isValidDropTarget);
101
- }
102
- }
@@ -1,103 +0,0 @@
1
- /*
2
- * Copyright 2023 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import type {AriaLabelingProps, DisabledBehavior, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
14
- import type {ColumnSize, TableProps} from '@react-types/table';
15
- import type {DragAndDropHooks} from '@react-spectrum/dnd';
16
- import React, {JSX, ReactElement} from 'react';
17
- import {tableNestedRows} from '@react-stately/flags';
18
- import {TableView} from './TableView';
19
- import {TreeGridTableView} from './TreeGridTableView';
20
-
21
- export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionProps, DOMProps, AriaLabelingProps, StyleProps {
22
- /**
23
- * Sets the amount of vertical padding within each cell.
24
- * @default 'regular'
25
- */
26
- density?: 'compact' | 'regular' | 'spacious',
27
- /**
28
- * Sets the overflow behavior for the cell contents.
29
- * @default 'truncate'
30
- */
31
- overflowMode?: 'wrap' | 'truncate',
32
- /** Whether the TableView should be displayed with a quiet style. */
33
- isQuiet?: boolean,
34
- /** Sets what the TableView should render when there is no content to display. */
35
- renderEmptyState?: () => JSX.Element,
36
- /**
37
- * Whether `disabledKeys` applies to all interactions, or only selection.
38
- * @default "selection"
39
- */
40
- disabledBehavior?: DisabledBehavior,
41
- /** Handler that is called when a user performs an action on a row. */
42
- onAction?: (key: Key) => void,
43
- /**
44
- * Handler that is called when a user starts a column resize.
45
- */
46
- onResizeStart?: (widths: Map<Key, ColumnSize>) => void,
47
- /**
48
- * Handler that is called when a user performs a column resize.
49
- * Can be used with the width property on columns to put the column widths into
50
- * a controlled state.
51
- */
52
- onResize?: (widths: Map<Key, ColumnSize>) => void,
53
- /**
54
- * Handler that is called after a user performs a column resize.
55
- * Can be used to store the widths of columns for another future session.
56
- */
57
- onResizeEnd?: (widths: Map<Key, ColumnSize>) => void,
58
- /**
59
- * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the TableView.
60
- * @version beta
61
- */
62
- dragAndDropHooks?: DragAndDropHooks<NoInfer<T>>['dragAndDropHooks'],
63
- /**
64
- * Whether the TableView should support expandable rows. Requires the feature flag to be enabled first, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
65
- * @version alpha
66
- * @private
67
- */
68
- UNSTABLE_allowsExpandableRows?: boolean,
69
- /**
70
- * The currently expanded keys in the collection (controlled). Requires the feature flag to be
71
- * enabled along with UNSTABLE_allowsExpandableRows, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
72
- * @version alpha
73
- * @private
74
- */
75
- UNSTABLE_expandedKeys?: 'all' | Iterable<Key>,
76
- /**
77
- * The initial expanded keys in the collection (uncontrolled). Requires the feature flag to be
78
- * enabled along with UNSTABLE_allowsExpandableRows, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
79
- * @version alpha
80
- * @private
81
- */
82
- UNSTABLE_defaultExpandedKeys?: 'all' | Iterable<Key>,
83
- /**
84
- * Handler that is called when items are expanded or collapsed. Requires the feature flag to be
85
- * enabled along with UNSTABLE_allowsExpandableRows, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
86
- * @version alpha
87
- * @private
88
- */
89
- UNSTABLE_onExpandedChange?: (keys: Set<Key>) => any
90
- }
91
-
92
- /**
93
- * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
94
- */
95
- const TableViewWrapper = React.forwardRef(function TableViewWrapper<T extends object>(props: SpectrumTableProps<T>, ref: DOMRef<HTMLDivElement>) {
96
- let {UNSTABLE_allowsExpandableRows, ...otherProps} = props;
97
- if (tableNestedRows() && UNSTABLE_allowsExpandableRows) {
98
- return <TreeGridTableView {...otherProps} ref={ref} />;
99
- } else {
100
- return <TableView {...otherProps} ref={ref} />;
101
- }
102
- }) as <T>(props: SpectrumTableProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
103
- export {TableViewWrapper as TableView};
@@ -1,44 +0,0 @@
1
- /*
2
- * Copyright 2023 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {DOMRef} from '@react-types/shared';
14
- import React, {ReactElement, useState} from 'react';
15
- import {SpectrumTableProps} from './TableViewWrapper';
16
- import {TableViewBase} from './TableViewBase';
17
- import {UNSTABLE_useTreeGridState} from '@react-stately/table';
18
-
19
- export interface TreeGridTableProps<T> extends Omit<SpectrumTableProps<T>, 'UNSTABLE_allowsExpandableRows'> {}
20
-
21
- export const TreeGridTableView = React.forwardRef(function TreeGridTableView<T extends object>(props: TreeGridTableProps<T>, ref: DOMRef<HTMLDivElement>) {
22
- let {
23
- selectionStyle,
24
- dragAndDropHooks
25
- } = props;
26
- let [showSelectionCheckboxes, setShowSelectionCheckboxes] = useState(selectionStyle !== 'highlight');
27
- let isTableDraggable = !!dragAndDropHooks?.useDraggableCollectionState;
28
- let state = UNSTABLE_useTreeGridState({
29
- ...props,
30
- showSelectionCheckboxes,
31
- showDragButtons: isTableDraggable,
32
- selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'
33
- });
34
-
35
- // If the selection behavior changes in state, we need to update showSelectionCheckboxes here due to the circular dependency...
36
- let shouldShowCheckboxes = state.selectionManager.selectionBehavior !== 'replace';
37
- if (shouldShowCheckboxes !== showSelectionCheckboxes) {
38
- setShowSelectionCheckboxes(shouldShowCheckboxes);
39
- }
40
-
41
- return (
42
- <TableViewBase {...props} state={state} ref={ref} />
43
- );
44
- }) as <T>(props: TreeGridTableProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-1 0 31 32">
3
- <filter id="shadow">
4
- <feDropShadow dx="0" dy="0.5" stdDeviation="1.2" flood-opacity="0.7"/>
5
- </filter>
6
- <g filter="url(#shadow)" transform="translate(.5 0)">
7
- <path fill="#fff" d="M9.5,2a.5.5,0,0,1,.5.5V9h3V7.2505A.25014.25014,0,0,1,13.24978,7h.00152a.246.246,0,0,1,.15875.05847L16,9.5l-2.58995,2.44153A.24611.24611,0,0,1,13.2513,12,.25016.25016,0,0,1,13,11.751V10H10v6.5a.5.5,0,0,1-.5.5h-1a.5.5,0,0,1-.5-.5V10H5v1.7495A.25014.25014,0,0,1,4.75022,12H4.7487A.246.246,0,0,1,4.59,11.94153L2,9.5,4.59,7.05847A.246.246,0,0,1,4.7487,7,.25016.25016,0,0,1,5,7.249V9H8V2.5A.5.5,0,0,1,8.5,2Zm0-1h-1A1.5,1.5,0,0,0,7,2.5V8H6V7.32389a1.33,1.33,0,0,0-.4816-1.05444,1.23962,1.23962,0,0,0-1.56876.021l-.02344.01953-.0222.02088L.92812,9.13618A.5.5,0,0,0,.90726,9.843l.02086.02085L3.904,12.66919l.02221.02088.02345.01965a1.23986,1.23986,0,0,0,1.56836.02116A1.3294,1.3294,0,0,0,6,11.6765V11H7v5.5A1.5,1.5,0,0,0,8.5,18h1A1.5,1.5,0,0,0,11,16.5V11h1v.67757a1.32792,1.32792,0,0,0,.482,1.05347,1.24,1.24,0,0,0,1.56839-.02144l.02343-.01953.02221-.02088,2.97588-2.80537a.5.5,0,0,0,.02086-.70679l-.02086-.02085L14.096,6.33081l-.02221-.02087-.02345-.01965A1.24978,1.24978,0,0,0,12,7.2505V8H11V2.5A1.5,1.5,0,0,0,9.5,1Z"/>
8
- <path d="M10,16.5V10h3v1.7495a.25.25,0,0,0,.41.19206L16,9.5,13.41,7.05842A.25.25,0,0,0,13,7.2505V9H10V2.5A.5.5,0,0,0,9.5,2h-1a.5.5,0,0,0-.5.5V9H5V7.2505a.25.25,0,0,0-.41-.19206L2,9.5l2.59,2.44158A.25.25,0,0,0,5,11.7495V10H8v6.5a.5.5,0,0,0,.5.5h1A.5.5,0,0,0,10,16.5Z"/>
9
- </g>
10
- </svg>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-1 0 31 32">
3
- <filter id="shadow">
4
- <feDropShadow dx="0" dy="0.5" stdDeviation="1.2" flood-opacity="0.7"/>
5
- </filter>
6
- <g filter="url(#shadow)" transform="translate(.5 0)">
7
- <path d="M9.5,2c.27614,0,.5,.22388,.5,.5v14c0,.27612-.22386,.5-.5,.5h-1c-.27614,0-.5-.22388-.5-.5v-6.5h-3v1.74951c0,.14893-.12215,.25049-.2513,.25049-.05457,0-.1104-.01819-.15875-.05847l-2.58995-2.44153,2.58995-2.44153c.04837-.04028,.10419-.05847,.15875-.05847,.12914,0,.2513,.10156,.2513,.25049v1.74951h3V2.5c0-.27612,.22386-.5,.5-.5h1Zm0-1h-1c-.82843,0-1.5,.67157-1.5,1.5v5.5h-1v-.67611c0-.40436-.1629-.80555-.48159-1.05444-.4961-.38744-1.14015-.33635-1.56876,.02095l-.02344,.01953-.0222,.02087L.92811,9.13618c-.20937,.19737-.20937,.53028,0,.72765l2.97589,2.80537,.0222,.02087,.02345,.01965c.42839,.35694,1.07208,.40833,1.56837,.02116,.31886-.24875,.48198-.64994,.48198-1.05435v-.67652s.99999,0,.99999,0v5.5c0,.82843,.67157,1.5,1.5,1.5h1c.82843,0,1.5-.67157,1.5-1.5V2.5c0-.82843-.67157-1.5-1.5-1.5Z" fill="#fff" />
8
- <path d="M10,16.5V2.5c0-.27614-.22386-.5-.5-.5h-1c-.27614,0-.5,.22386-.5,.5v6.5h-3v-1.74952c0-.21196-.24721-.32775-.41005-.19206l-2.58995,2.44158,2.58995,2.44158c.16283,.13569,.41005,.0199,.41005-.19206v-1.74952h3v6.5c0,.27614,.22386,.5,.5,.5h1c.27614,0,.5-.22386,.5-.5Z"/>
9
- </g>
10
- </svg>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-1 0 31 32">
3
- <filter id="shadow">
4
- <feDropShadow dx="0" dy="0.5" stdDeviation="1.2" flood-opacity="0.7"/>
5
- </filter>
6
- <g filter="url(#shadow)" transform="translate(.5 0)">
7
- <path d="M9.5,2c.27614,0,.5,.22388,.5,.5v6.5h3v-1.74951c0-.14893,.12215-.25049,.2513-.25049,.05457,0,.1104,.01819,.15875,.05847l2.58995,2.44153-2.58995,2.44153c-.04837,.04028-.10419,.05847-.15875,.05847-.12914,0-.2513-.10156-.2513-.25049v-1.74951h-3v6.5c0,.27612-.22386,.5-.5,.5h-1c-.27614,0-.5-.22388-.5-.5V2.5c0-.27612,.22386-.5,.5-.5h1Zm0-1h-1c-.82843,0-1.5,.67157-1.5,1.5v14c0,.82843,.67157,1.5,1.5,1.5h1c.82843,0,1.5-.67157,1.5-1.5v-5.5h1v.67757c0,.40416,.1632,.80501,.48197,1.05347,.49639,.3869,1.14001,.33571,1.56838-.02144l.02344-.01953,.0222-.02087,2.97589-2.80537c.20937-.19737,.20937-.53028,0-.72765l-2.97589-2.80537-.0222-.02087-.02345-.01965c-.22456-.18713-.5083-.29028-.79895-.29028-.3208,0-.62624,.12134-.86003,.34167-.24872,.23438-.39136,.56567-.39136,.90881v.74951h-1V2.5c0-.82843-.67157-1.5-1.5-1.5Z" fill="#fff" />
8
- <path d="M10,16.5v-6.5h3v1.74952c0,.21196,.24721,.32775,.41005,.19206l2.58995-2.44158-2.58995-2.44158c-.16283-.13569-.41005-.0199-.41005,.19206v1.74952h-3V2.5c0-.27614-.22386-.5-.5-.5h-1c-.27614,0-.5,.22386-.5,.5v14c0,.27614,.22386,.5,.5,.5h1c.27614,0,.5-.22386,.5-.5Z"/>
9
- </g>
10
- </svg>
package/src/table.css DELETED
@@ -1,235 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- .react-spectrum-Table {
14
- --spectrum-table-droptarget-background-color: var(--spectrum-alias-highlight-selected);
15
- --spectrum-table-dropindicator-border-color: var(--spectrum-dropzone-border-color-selected-hover);
16
- --spectrum-table-dropindicator-circle-border-color: var(--spectrum-dropindicator-circle-border-color);
17
-
18
- --spectrum-table-dropindicator-circle-size: var(--spectrum-dropindicator-circle-size);
19
- --spectrum-table-dropindicator-border-size: var(--spectrum-dropindicator-border-size);
20
-
21
- --spectrum-table-dropzone-border-color-selected-hover: var(--spectrum-dropzone-border-color-selected-hover);
22
-
23
- --spectrum-table-item-draghandle-border-color-key-focus: var(--spectrum-table-item-border-color-key-focus);
24
- }
25
-
26
- .react-spectrum-Table {
27
- user-select: none;
28
- display: flex;
29
- flex-direction: column;
30
- min-height: 0;
31
- min-width: 0;
32
- }
33
-
34
- .react-spectrum-Table-cell {
35
- display: flex;
36
- align-items: center;
37
- }
38
-
39
- .react-spectrum-Table-cellWrapper > .react-spectrum-Table-cell {
40
- height: 100%;
41
- }
42
-
43
- .react-spectrum-Table-cell--alignStart {
44
- text-align: start;
45
- justify-content: flex-start;
46
- }
47
-
48
- .react-spectrum-Table-cell--alignCenter {
49
- text-align: center;
50
- justify-content: center;
51
- }
52
-
53
- .react-spectrum-Table-cell--alignEnd {
54
- text-align: end;
55
- justify-content: flex-end;
56
- }
57
-
58
- .react-spectrum-Table-centeredWrapper {
59
- display: flex;
60
- align-items: center;
61
- justify-content: center;
62
- width: 100%;
63
- height: 100%;
64
- }
65
-
66
- .react-spectrum-Table-row-dragPreview {
67
- --spectrum-table-row-badge-text-color: var(--spectrum-global-color-static-white);
68
- --spectrum-table-row-badge-background-color: var(--spectrum-global-color-blue-400);
69
-
70
- width: var(--spectrum-global-dimension-size-2400);
71
- border: 1px solid var(--spectrum-dropzone-border-color-selected-hover);
72
- border-radius: var(--spectrum-alias-border-radius-regular);
73
- background-color: var(--spectrum-table-background-color);
74
-
75
- /* forced-color-adjust: none, so that background-color style will render */
76
- forced-color-adjust: none;
77
-
78
- &::after {
79
- box-shadow: none;
80
- }
81
-
82
- .react-spectrum-Table-cell {
83
- overflow: hidden;
84
- white-space: nowrap;
85
- text-overflow: ellipsis;
86
- }
87
-
88
- &.react-spectrum-Table-row-dragPreview--multiple {
89
- position: relative;
90
-
91
- &:after {
92
- content: '';
93
- display: block;
94
- position: absolute;
95
- z-index: -1;
96
- top: 4px;
97
- inset-inline-start: 4px;
98
- width: 100%;
99
- height: 100%;
100
- border: 1px solid var(--spectrum-dropzone-border-color-selected-hover);
101
- border-radius: var(--spectrum-alias-border-radius-regular);
102
- background-color: var(--spectrum-table-background-color);
103
-
104
- /* forced-color-adjust: none, so that box-shadow style will render */
105
- forced-color-adjust: none;
106
- }
107
- }
108
-
109
- .react-spectrum-Table-row-badge {
110
- color: var(--spectrum-table-row-badge-text-color);
111
- background: var(--spectrum-table-row-badge-background-color);
112
- padding: 0 var(--spectrum-global-dimension-size-100);
113
- border-radius: var(--spectrum-alias-border-radius-regular);
114
- margin-inline-end: var(--spectrum-global-dimension-size-100);
115
- margin-top: auto;
116
- margin-bottom: auto;
117
- height: fit-content;
118
- }
119
- }
120
-
121
- .react-spectrum-Table-body {
122
- &.react-spectrum-Table-body--dropTarget {
123
- border-color: var(--spectrum-table-dropindicator-border-color);
124
- background-color: var(--spectrum-alias-highlight-selected);
125
- box-shadow: inset 0 0 0 1px var(--spectrum-table-cell-border-color-key-focus);
126
-
127
- /* forced-color-adjust: none, so that box-shadow style will render */
128
- forced-color-adjust: none;
129
- }
130
- }
131
-
132
- .react-spectrum-Table-InsertionIndicator {
133
- z-index: 3;
134
- width: calc(100% - (2 * var(--spectrum-table-dropindicator-circle-size)));
135
- inset-inline-start: var(--spectrum-table-dropindicator-circle-size);
136
- position: absolute;
137
- outline: none;
138
-
139
- &.react-spectrum-Table-InsertionIndicator--dropTarget {
140
- background: var(--spectrum-table-dropindicator-border-color);
141
- border-bottom: 2px solid var(--spectrum-table-dropindicator-border-color);
142
-
143
- /* forced-color-adjust: none, so that background color
144
- will render border for insertion indicator. */
145
- forced-color-adjust: none;
146
-
147
- &:before {
148
- left: calc(var(--spectrum-table-dropindicator-circle-size) * -1);
149
- }
150
-
151
- &:after {
152
- right: calc(var(--spectrum-table-dropindicator-circle-size) * -1);
153
- }
154
-
155
- &:before,
156
- &:after {
157
- content: '';
158
- position: absolute;
159
- top: calc(var(--spectrum-table-dropindicator-circle-size) * -1 / 2 + var(--spectrum-table-dropindicator-border-size) / 2);
160
- width: var(--spectrum-table-dropindicator-circle-size);
161
- height: var(--spectrum-table-dropindicator-circle-size);
162
- border-radius: 50%;
163
- border: var(--spectrum-table-dropindicator-border-size) solid;
164
- box-sizing: border-box;
165
- border-color: var(--spectrum-table-dropindicator-circle-border-color);
166
- background-color: var(--spectrum-table-background-color);
167
- z-index: 5;
168
-
169
- /* forced-color-adjust: none, so that box-shadow and background-color styles will render */
170
- forced-color-adjust: none;
171
- }
172
- }
173
- }
174
-
175
- .react-spectrum-Table-headCell {
176
- &.react-spectrum-Table-dragButtonHeadCell {
177
- padding: 0;
178
- height: inherit;
179
- }
180
- }
181
-
182
- .react-spectrum-Table-cell {
183
- &.react-spectrum-Table-dragButtonCell {
184
- padding: var(--spectrum-global-dimension-size-40);
185
-
186
- .react-spectrum-Table-dragButton {
187
- border-radius: var(--spectrum-alias-border-radius-regular);
188
- padding: var(--spectrum-global-dimension-size-10);
189
-
190
- &:focus-visible {
191
- box-shadow: inset 0 0 0 2px var(--spectrum-table-cell-border-color-key-focus);
192
- outline: none;
193
-
194
- /* forced-color-adjust: none, so that box-shadow style will render */
195
- forced-color-adjust: none;
196
- }
197
-
198
- svg {
199
- margin: auto 0;
200
- display: block;
201
- padding: var(--spectrum-global-dimension-size-40);
202
- }
203
- }
204
- }
205
- }
206
-
207
- .react-spectrum-Table-row {
208
- &.react-spectrum-Table-row--dropTarget {
209
- border: 1px var(--spectrum-table-dropindicator-border-color);
210
- box-shadow: inset 2px 0 0 0 var(--spectrum-table-dropindicator-border-color),
211
- inset -2px 0 0 0 var(--spectrum-table-dropindicator-border-color),
212
- inset 0 -3px 0 0 var(--spectrum-table-dropindicator-border-color),
213
- inset 0 2px 0 0 var(--spectrum-table-dropindicator-border-color);
214
-
215
- /* forced-color-adjust: none, so that box-shadow style will render */
216
- forced-color-adjust: none;
217
- }
218
-
219
- .react-spectrum-Table-cellWrapper.react-spectrum-Table-cellWrapper--dropTarget {
220
- background-color: var(--spectrum-table-droptarget-background-color);
221
- }
222
- }
223
-
224
- @media (forced-colors: active) {
225
- .react-spectrum-Table,
226
- .react-spectrum-Table-row {
227
- --spectrum-table-droptarget-background-color: var(--spectrum-alias-global-color-transparent);
228
- --spectrum-table-dropindicator-border-color: Highlight;
229
- --spectrum-dropzone-border-color-selected-hover: Highlight;
230
- --spectrum-table-dropindicator-circle-border-color: Highlight;
231
- --spectrum-table-dropzone-border-color-selected-hover: Highlight;
232
- --spectrum-table-row-badge-text-color: HighlightText;
233
- --spectrum-table-row-badge-background-color: Highlight;
234
- }
235
- }