@react-aria/table 3.0.1-nightly.2977 → 3.1.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/main.js +42 -38
- package/dist/main.js.map +1 -1
- package/dist/module.js +42 -38
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/useTableCell.ts +6 -3
- package/src/useTableHeaderRow.ts +8 -3
- package/src/useTableRow.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/table",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/focus": "3.
|
|
22
|
-
"@react-aria/grid": "3.
|
|
23
|
-
"@react-aria/i18n": "3.
|
|
24
|
-
"@react-aria/interactions": "3.
|
|
25
|
-
"@react-aria/live-announcer": "3.0.
|
|
26
|
-
"@react-aria/selection": "3.
|
|
27
|
-
"@react-aria/utils": "3.
|
|
28
|
-
"@react-stately/table": "3.
|
|
29
|
-
"@react-stately/virtualizer": "3.1.6
|
|
30
|
-
"@react-types/checkbox": "3.
|
|
31
|
-
"@react-types/grid": "3.0.
|
|
32
|
-
"@react-types/shared": "3.
|
|
33
|
-
"@react-types/table": "3.
|
|
21
|
+
"@react-aria/focus": "^3.5.0",
|
|
22
|
+
"@react-aria/grid": "^3.1.0",
|
|
23
|
+
"@react-aria/i18n": "^3.3.3",
|
|
24
|
+
"@react-aria/interactions": "^3.7.0",
|
|
25
|
+
"@react-aria/live-announcer": "^3.0.1",
|
|
26
|
+
"@react-aria/selection": "^3.7.0",
|
|
27
|
+
"@react-aria/utils": "^3.10.0",
|
|
28
|
+
"@react-stately/table": "^3.1.0",
|
|
29
|
+
"@react-stately/virtualizer": "^3.1.6",
|
|
30
|
+
"@react-types/checkbox": "^3.2.3",
|
|
31
|
+
"@react-types/grid": "^3.0.0",
|
|
32
|
+
"@react-types/shared": "^3.10.0",
|
|
33
|
+
"@react-types/table": "^3.1.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^16.8.0 || ^17.0.0-rc.1",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "896eabe5521a0349a675c4773ed7629addd4b8c4"
|
|
43
43
|
}
|
package/src/useTableCell.ts
CHANGED
|
@@ -27,7 +27,9 @@ interface TableCellProps {
|
|
|
27
27
|
|
|
28
28
|
interface TableCellAria {
|
|
29
29
|
/** Props for the table cell element. */
|
|
30
|
-
gridCellProps: HTMLAttributes<HTMLElement
|
|
30
|
+
gridCellProps: HTMLAttributes<HTMLElement>,
|
|
31
|
+
/** Whether the cell is currently in a pressed state. */
|
|
32
|
+
isPressed: boolean
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -37,7 +39,7 @@ interface TableCellAria {
|
|
|
37
39
|
* @param ref - The ref attached to the cell element.
|
|
38
40
|
*/
|
|
39
41
|
export function useTableCell<T>(props: TableCellProps, state: TableState<T>, ref: RefObject<HTMLElement>): TableCellAria {
|
|
40
|
-
let {gridCellProps} = useGridCell(props, state, ref);
|
|
42
|
+
let {gridCellProps, isPressed} = useGridCell(props, state, ref);
|
|
41
43
|
|
|
42
44
|
let columnKey = props.node.column.key;
|
|
43
45
|
if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
@@ -46,6 +48,7 @@ export function useTableCell<T>(props: TableCellProps, state: TableState<T>, ref
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
return {
|
|
49
|
-
gridCellProps
|
|
51
|
+
gridCellProps,
|
|
52
|
+
isPressed
|
|
50
53
|
};
|
|
51
54
|
}
|
package/src/useTableHeaderRow.ts
CHANGED
|
@@ -10,17 +10,22 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {RefObject} from 'react';
|
|
13
|
+
import {GridRowProps} from '@react-aria/grid';
|
|
14
|
+
import {HTMLAttributes, RefObject} from 'react';
|
|
15
15
|
import {TableState} from '@react-stately/table';
|
|
16
16
|
|
|
17
|
+
export interface TableHeaderRowAria {
|
|
18
|
+
/** Props for the grid row element. */
|
|
19
|
+
rowProps: HTMLAttributes<HTMLElement>
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Provides the behavior and accessibility implementation for a header row in a table.
|
|
19
24
|
* @param props - Props for the row.
|
|
20
25
|
* @param state - State of the table, as returned by `useTableState`.
|
|
21
26
|
*/
|
|
22
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
export function useTableHeaderRow<T>(props: GridRowProps<T>, state: TableState<T>, ref: RefObject<HTMLElement>):
|
|
28
|
+
export function useTableHeaderRow<T>(props: GridRowProps<T>, state: TableState<T>, ref: RefObject<HTMLElement>): TableHeaderRowAria {
|
|
24
29
|
let {node, isVirtualized} = props;
|
|
25
30
|
let rowProps = {
|
|
26
31
|
role: 'row'
|
package/src/useTableRow.ts
CHANGED
|
@@ -23,11 +23,12 @@ import {TableState} from '@react-stately/table';
|
|
|
23
23
|
*/
|
|
24
24
|
export function useTableRow<T>(props: GridRowProps<T>, state: TableState<T>, ref: RefObject<HTMLElement>): GridRowAria {
|
|
25
25
|
let {node} = props;
|
|
26
|
-
let {rowProps} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);
|
|
26
|
+
let {rowProps, isPressed} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);
|
|
27
27
|
return {
|
|
28
28
|
rowProps: {
|
|
29
29
|
...rowProps,
|
|
30
30
|
'aria-labelledby': getRowLabelledBy(state, node.key)
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
isPressed
|
|
32
33
|
};
|
|
33
34
|
}
|