@react-types/table 3.13.5 → 3.14.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/package.json +8 -5
- package/src/index.d.ts +5 -137
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/table",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
"url": "https://github.com/adobe/react-spectrum"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-
|
|
13
|
-
"@react-
|
|
12
|
+
"@react-spectrum/table": "^3.18.0",
|
|
13
|
+
"@react-stately/table": "^3.16.0",
|
|
14
|
+
"@react-types/shared": "^3.34.0"
|
|
14
15
|
},
|
|
15
16
|
"peerDependencies": {
|
|
16
|
-
"react": "^
|
|
17
|
+
"@react-spectrum/provider": "^3.0.0",
|
|
18
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
19
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
17
20
|
},
|
|
18
21
|
"publishConfig": {
|
|
19
22
|
"access": "public"
|
|
20
23
|
},
|
|
21
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
22
25
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -10,38 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {AriaLabelingProps,
|
|
14
|
-
import {
|
|
15
|
-
import {JSX
|
|
13
|
+
import {AriaLabelingProps, DOMProps, Key, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
|
|
14
|
+
import {ColumnSize, TableProps} from '@react-stately/table';
|
|
15
|
+
import {JSX} from 'react';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
/**
|
|
20
|
-
* Widths that change size in relation to the remaining space and in ratio to other dynamic columns.
|
|
21
|
-
* All numbers must be integers and greater than 0.
|
|
22
|
-
* FR units take up remaining, if any, space in the table.
|
|
23
|
-
*/
|
|
24
|
-
export type ColumnDynamicSize = `${number}fr`; // match regex: /^(\d+)(?=fr$)/
|
|
25
|
-
/** All possible sizes a column can be assigned. */
|
|
26
|
-
export type ColumnSize = ColumnStaticSize | ColumnDynamicSize;
|
|
27
|
-
|
|
28
|
-
export interface TableProps<T> extends MultipleSelection, Sortable {
|
|
29
|
-
/** The elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows. */
|
|
30
|
-
children: [ReactElement<TableHeaderProps<T>>, ReactElement<TableBodyProps<T>>],
|
|
31
|
-
/** A list of row keys to disable. */
|
|
32
|
-
disabledKeys?: Iterable<Key>,
|
|
33
|
-
/**
|
|
34
|
-
* Whether pressing the escape key should clear selection in the table or not.
|
|
35
|
-
*
|
|
36
|
-
* Most experiences should not modify this option as it eliminates a keyboard user's ability to
|
|
37
|
-
* easily clear selection. Only use if the escape key is being handled externally or should not
|
|
38
|
-
* trigger selection clearing contextually.
|
|
39
|
-
* @default 'clearSelection'
|
|
40
|
-
*/
|
|
41
|
-
escapeKeyBehavior?: 'clearSelection' | 'none',
|
|
42
|
-
/** Whether selection should occur on press up instead of press down. */
|
|
43
|
-
shouldSelectOnPressUp?: boolean
|
|
44
|
-
}
|
|
17
|
+
export {TableProps, ColumnStaticSize, ColumnDynamicSize, ColumnSize, TableHeaderProps, ColumnElement, ColumnRenderer, ColumnProps, RowElement, TableBodyProps, RowProps, CellProps, CellElement, CellRenderer, ITableCollection as TableCollection} from '@react-stately/table';
|
|
18
|
+
export {SpectrumColumnProps} from '@react-spectrum/table';
|
|
45
19
|
|
|
46
20
|
/**
|
|
47
21
|
* @deprecated - use SpectrumTableProps from '@adobe/react-spectrum' instead.
|
|
@@ -79,109 +53,3 @@ export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionP
|
|
|
79
53
|
*/
|
|
80
54
|
onResizeEnd?: (widths: Map<Key, ColumnSize>) => void
|
|
81
55
|
}
|
|
82
|
-
|
|
83
|
-
export interface TableHeaderProps<T> {
|
|
84
|
-
/** A list of table columns. */
|
|
85
|
-
columns?: T[],
|
|
86
|
-
/** A list of `Column(s)` or a function. If the latter, a list of columns must be provided using the `columns` prop. */
|
|
87
|
-
children: ColumnElement<T> | ColumnElement<T>[] | ColumnRenderer<T>
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
type ColumnElement<T> = ReactElement<ColumnProps<T>>;
|
|
91
|
-
type ColumnRenderer<T> = (item: T) => ColumnElement<T>;
|
|
92
|
-
export interface ColumnProps<T> {
|
|
93
|
-
/** Rendered contents of the column if `children` contains child columns. */
|
|
94
|
-
title?: ReactNode,
|
|
95
|
-
/** Static child columns or content to render as the column header. */
|
|
96
|
-
children: ReactNode | ColumnElement<T> | ColumnElement<T>[],
|
|
97
|
-
/** A list of child columns used when dynamically rendering nested child columns. */
|
|
98
|
-
childColumns?: T[],
|
|
99
|
-
/** The width of the column. */
|
|
100
|
-
width?: ColumnSize | null,
|
|
101
|
-
/** The minimum width of the column. */
|
|
102
|
-
minWidth?: ColumnStaticSize | null,
|
|
103
|
-
/** The maximum width of the column. */
|
|
104
|
-
maxWidth?: ColumnStaticSize | null,
|
|
105
|
-
/** The default width of the column. */
|
|
106
|
-
defaultWidth?: ColumnSize | null,
|
|
107
|
-
/** Whether the column allows resizing. */
|
|
108
|
-
allowsResizing?: boolean,
|
|
109
|
-
/** Whether the column allows sorting. */
|
|
110
|
-
allowsSorting?: boolean,
|
|
111
|
-
/** Whether a column is a [row header](https://www.w3.org/TR/wai-aria-1.1/#rowheader) and should be announced by assistive technology during row navigation. */
|
|
112
|
-
isRowHeader?: boolean,
|
|
113
|
-
/** A string representation of the column's contents, used for accessibility announcements. */
|
|
114
|
-
textValue?: string
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// TODO: how to support these in CollectionBuilder...
|
|
118
|
-
export interface SpectrumColumnProps<T> extends ColumnProps<T> {
|
|
119
|
-
/**
|
|
120
|
-
* The alignment of the column's contents relative to its allotted width.
|
|
121
|
-
* @default 'start'
|
|
122
|
-
*/
|
|
123
|
-
align?: 'start' | 'center' | 'end',
|
|
124
|
-
// /** Whether the column should stick to the viewport when scrolling. */
|
|
125
|
-
// isSticky?: boolean, // shouldStick?? Not implemented yet?
|
|
126
|
-
/** Whether the column should render a divider between it and the next column. */
|
|
127
|
-
showDivider?: boolean,
|
|
128
|
-
/**
|
|
129
|
-
* Whether the column should hide its header text. A tooltip with the column's header text
|
|
130
|
-
* will be displayed when the column header is focused instead. Note that this prop is specifically for columns
|
|
131
|
-
* that contain ActionButtons in place of text content.
|
|
132
|
-
*/
|
|
133
|
-
hideHeader?: boolean
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export type RowElement<T> = ReactElement<RowProps<T>>;
|
|
137
|
-
export interface TableBodyProps<T> extends Omit<AsyncLoadable, 'isLoading'> {
|
|
138
|
-
/** The contents of the table body. Supports static items or a function for dynamic rendering. */
|
|
139
|
-
children: RowElement<T> | RowElement<T>[] | ((item: T) => RowElement<T>),
|
|
140
|
-
/** A list of row objects in the table body used when dynamically rendering rows. */
|
|
141
|
-
items?: Iterable<T>,
|
|
142
|
-
/** The current loading state of the table. */
|
|
143
|
-
loadingState?: LoadingState
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface RowProps<T> extends LinkDOMProps {
|
|
147
|
-
/**
|
|
148
|
-
* A list of child item objects used when dynamically rendering row children. Requires the feature flag to be
|
|
149
|
-
* enabled along with UNSTABLE_allowsExpandableRows, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows.
|
|
150
|
-
* @version alpha
|
|
151
|
-
* @private
|
|
152
|
-
*/
|
|
153
|
-
UNSTABLE_childItems?: Iterable<T>,
|
|
154
|
-
// TODO: update when async loading is supported for expandable rows
|
|
155
|
-
// /** Whether this row has children, even if not loaded yet. */
|
|
156
|
-
// hasChildItems?: boolean,
|
|
157
|
-
/** Rendered contents of the row or row child items. */
|
|
158
|
-
children: CellElement | CellElement[] | CellRenderer,
|
|
159
|
-
/** A string representation of the row's contents, used for features like typeahead. */
|
|
160
|
-
textValue?: string // ???
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface CellProps {
|
|
164
|
-
/** The contents of the cell. */
|
|
165
|
-
children: ReactNode,
|
|
166
|
-
/** A string representation of the cell's contents, used for features like typeahead. */
|
|
167
|
-
textValue?: string,
|
|
168
|
-
/** Indicates how many columns the data cell spans. */
|
|
169
|
-
colSpan?: number
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export type CellElement = ReactElement<CellProps>;
|
|
173
|
-
export type CellRenderer = (columnKey: Key) => CellElement;
|
|
174
|
-
|
|
175
|
-
export interface TableCollection<T> extends GridCollection<T> {
|
|
176
|
-
// TODO perhaps elaborate on this? maybe not clear enough, essentially returns the table header rows (e.g. in a tiered headers table, will return the nodes containing the top tier column, next tier, etc)
|
|
177
|
-
/** A list of header row nodes in the table. */
|
|
178
|
-
headerRows: GridNode<T>[],
|
|
179
|
-
/** A list of column nodes in the table. */
|
|
180
|
-
columns: GridNode<T>[],
|
|
181
|
-
/** A set of column keys that serve as the [row header](https://www.w3.org/TR/wai-aria-1.1/#rowheader). */
|
|
182
|
-
rowHeaderColumnKeys: Set<Key>,
|
|
183
|
-
/** The node that makes up the header of the table. */
|
|
184
|
-
head?: GridNode<T>,
|
|
185
|
-
/** The node that makes up the body of the table. */
|
|
186
|
-
body: GridNode<T>
|
|
187
|
-
}
|