@fluentui/react-table 9.0.0-alpha.10 → 9.0.0-alpha.12

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 (76) hide show
  1. package/CHANGELOG.json +167 -1
  2. package/CHANGELOG.md +40 -2
  3. package/dist/index.d.ts +59 -15
  4. package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
  5. package/lib/components/DataGrid/renderDataGrid.js +5 -1
  6. package/lib/components/DataGrid/renderDataGrid.js.map +1 -1
  7. package/lib/components/DataGrid/useDataGrid.js +24 -2
  8. package/lib/components/DataGrid/useDataGrid.js.map +1 -1
  9. package/lib/components/DataGrid/useDataGridContextValues.js +6 -1
  10. package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -1
  11. package/lib/components/DataGridBody/DataGridBody.types.js.map +1 -1
  12. package/lib/components/DataGridBody/useDataGridBody.js +8 -0
  13. package/lib/components/DataGridBody/useDataGridBody.js.map +1 -1
  14. package/lib/components/DataGridCell/useDataGridCell.js +7 -2
  15. package/lib/components/DataGridCell/useDataGridCell.js.map +1 -1
  16. package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
  17. package/lib/components/DataGridRow/useDataGridRow.js +7 -0
  18. package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
  19. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +4 -2
  20. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  21. package/lib/components/TableHeader/useTableHeader.js +1 -8
  22. package/lib/components/TableHeader/useTableHeader.js.map +1 -1
  23. package/lib/components/TableRow/useTableRowStyles.js +5 -5
  24. package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
  25. package/lib/contexts/dataGridContext.js +9 -0
  26. package/lib/contexts/dataGridContext.js.map +1 -0
  27. package/lib/hooks/createColumn.js +41 -0
  28. package/lib/hooks/createColumn.js.map +1 -0
  29. package/lib/hooks/index.js +1 -0
  30. package/lib/hooks/index.js.map +1 -1
  31. package/lib/hooks/selectionManager.js +16 -16
  32. package/lib/hooks/selectionManager.js.map +1 -1
  33. package/lib/hooks/types.js.map +1 -1
  34. package/lib/hooks/useSelection.js +7 -7
  35. package/lib/hooks/useSelection.js.map +1 -1
  36. package/lib/hooks/useSort.js +4 -4
  37. package/lib/hooks/useSort.js.map +1 -1
  38. package/lib/hooks/useTable.js +8 -0
  39. package/lib/hooks/useTable.js.map +1 -1
  40. package/lib/index.js +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib-commonjs/components/DataGrid/renderDataGrid.js +7 -1
  43. package/lib-commonjs/components/DataGrid/renderDataGrid.js.map +1 -1
  44. package/lib-commonjs/components/DataGrid/useDataGrid.js +26 -2
  45. package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
  46. package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +6 -1
  47. package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -1
  48. package/lib-commonjs/components/DataGridBody/useDataGridBody.js +9 -0
  49. package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -1
  50. package/lib-commonjs/components/DataGridCell/useDataGridCell.js +8 -2
  51. package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -1
  52. package/lib-commonjs/components/DataGridRow/useDataGridRow.js +8 -0
  53. package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
  54. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +4 -2
  55. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  56. package/lib-commonjs/components/TableHeader/useTableHeader.js +1 -9
  57. package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
  58. package/lib-commonjs/components/TableRow/useTableRowStyles.js +5 -5
  59. package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
  60. package/lib-commonjs/contexts/dataGridContext.js +21 -0
  61. package/lib-commonjs/contexts/dataGridContext.js.map +1 -0
  62. package/lib-commonjs/hooks/createColumn.js +50 -0
  63. package/lib-commonjs/hooks/createColumn.js.map +1 -0
  64. package/lib-commonjs/hooks/index.js +2 -0
  65. package/lib-commonjs/hooks/index.js.map +1 -1
  66. package/lib-commonjs/hooks/selectionManager.js +16 -16
  67. package/lib-commonjs/hooks/selectionManager.js.map +1 -1
  68. package/lib-commonjs/hooks/useSelection.js +7 -7
  69. package/lib-commonjs/hooks/useSelection.js.map +1 -1
  70. package/lib-commonjs/hooks/useSort.js +4 -4
  71. package/lib-commonjs/hooks/useSort.js.map +1 -1
  72. package/lib-commonjs/hooks/useTable.js +10 -1
  73. package/lib-commonjs/hooks/useTable.js.map +1 -1
  74. package/lib-commonjs/index.js +8 -2
  75. package/lib-commonjs/index.js.map +1 -1
  76. package/package.json +10 -9
package/CHANGELOG.json CHANGED
@@ -2,7 +2,173 @@
2
2
  "name": "@fluentui/react-table",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 02 Nov 2022 14:27:15 GMT",
5
+ "date": "Thu, 17 Nov 2022 23:02:45 GMT",
6
+ "tag": "@fluentui/react-table_v9.0.0-alpha.12",
7
+ "version": "9.0.0-alpha.12",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "martinhochel@microsoft.com",
12
+ "package": "@fluentui/react-table",
13
+ "commit": "ea768501802d65d63ddc63fff3816fb6b5008ae4",
14
+ "comment": "chore: update package scaffold"
15
+ }
16
+ ],
17
+ "prerelease": [
18
+ {
19
+ "author": "lingfangao@hotmail.com",
20
+ "package": "@fluentui/react-table",
21
+ "commit": "aef719f25d85a8d83f3d6b44d61b75d55f805ee8",
22
+ "comment": "BREAKING: `sortable` prop no longer enables `TableHeader` navigation"
23
+ },
24
+ {
25
+ "author": "tigeroakes@microsoft.com",
26
+ "package": "@fluentui/react-table",
27
+ "commit": "2c004858da092ef9ae0aad2f96b313ec0102913d",
28
+ "comment": "fix: Match hover background colors between table row and cell actions"
29
+ },
30
+ {
31
+ "author": "lingfangao@hotmail.com",
32
+ "package": "@fluentui/react-table",
33
+ "commit": "b49ab600353c77e48b67cc23bcb422535cad1b83",
34
+ "comment": "BREAKING: Headless table callbacks require event"
35
+ },
36
+ {
37
+ "author": "beachball",
38
+ "package": "@fluentui/react-table",
39
+ "comment": "Bump @fluentui/react-aria to v9.3.2",
40
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
41
+ },
42
+ {
43
+ "author": "beachball",
44
+ "package": "@fluentui/react-table",
45
+ "comment": "Bump @fluentui/react-avatar to v9.2.7",
46
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
47
+ },
48
+ {
49
+ "author": "beachball",
50
+ "package": "@fluentui/react-table",
51
+ "comment": "Bump @fluentui/react-checkbox to v9.0.13",
52
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
53
+ },
54
+ {
55
+ "author": "beachball",
56
+ "package": "@fluentui/react-table",
57
+ "comment": "Bump @fluentui/react-context-selector to v9.1.2",
58
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
59
+ },
60
+ {
61
+ "author": "beachball",
62
+ "package": "@fluentui/react-table",
63
+ "comment": "Bump @fluentui/react-radio to v9.0.12",
64
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
65
+ },
66
+ {
67
+ "author": "beachball",
68
+ "package": "@fluentui/react-table",
69
+ "comment": "Bump @fluentui/react-tabster to v9.3.1",
70
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
71
+ },
72
+ {
73
+ "author": "beachball",
74
+ "package": "@fluentui/react-table",
75
+ "comment": "Bump @fluentui/react-utilities to v9.2.2",
76
+ "commit": "94e156be5d3b5790d82dccf08c32672733fb9335"
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ {
82
+ "date": "Fri, 11 Nov 2022 14:57:41 GMT",
83
+ "tag": "@fluentui/react-table_v9.0.0-alpha.11",
84
+ "version": "9.0.0-alpha.11",
85
+ "comments": {
86
+ "none": [
87
+ {
88
+ "author": "martinhochel@microsoft.com",
89
+ "package": "@fluentui/react-table",
90
+ "commit": "87859b052155ca206ef3540a2a9623803f6e2b93",
91
+ "comment": "test: replace deprecated module.parent with require.main within isConformance"
92
+ }
93
+ ],
94
+ "prerelease": [
95
+ {
96
+ "author": "lingfangao@hotmail.com",
97
+ "package": "@fluentui/react-table",
98
+ "commit": "48c85202ce3c230fdc83bde3ce494f952632b16f",
99
+ "comment": "feat: Implement child render function for DataGrid rows"
100
+ },
101
+ {
102
+ "author": "lingfangao@hotmail.com",
103
+ "package": "@fluentui/react-table",
104
+ "commit": "3088a39d2d18156388378ac9a629e48277347ae7",
105
+ "comment": "feat: Implement `focusMode` prop for DataGrid, apply role=\"grid\" correctly"
106
+ },
107
+ {
108
+ "author": "lingfangao@hotmail.com",
109
+ "package": "@fluentui/react-table",
110
+ "commit": "6645c490bdc0ae1147e46890bef10759934457d3",
111
+ "comment": "BREAKING: ColumnDefinition type is stricter, use createColumn to create column definition. Implments render function for DataGridRow."
112
+ },
113
+ {
114
+ "author": "beachball",
115
+ "package": "@fluentui/react-table",
116
+ "comment": "Bump @fluentui/react-aria to v9.3.1",
117
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
118
+ },
119
+ {
120
+ "author": "beachball",
121
+ "package": "@fluentui/react-table",
122
+ "comment": "Bump @fluentui/react-avatar to v9.2.6",
123
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
124
+ },
125
+ {
126
+ "author": "beachball",
127
+ "package": "@fluentui/react-table",
128
+ "comment": "Bump @fluentui/react-checkbox to v9.0.12",
129
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
130
+ },
131
+ {
132
+ "author": "beachball",
133
+ "package": "@fluentui/react-table",
134
+ "comment": "Bump @fluentui/react-context-selector to v9.1.1",
135
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
136
+ },
137
+ {
138
+ "author": "beachball",
139
+ "package": "@fluentui/react-table",
140
+ "comment": "Bump @fluentui/react-radio to v9.0.11",
141
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
142
+ },
143
+ {
144
+ "author": "beachball",
145
+ "package": "@fluentui/react-table",
146
+ "comment": "Bump @fluentui/react-tabster to v9.3.0",
147
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
148
+ },
149
+ {
150
+ "author": "beachball",
151
+ "package": "@fluentui/react-table",
152
+ "comment": "Bump @fluentui/react-theme to v9.1.2",
153
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
154
+ },
155
+ {
156
+ "author": "beachball",
157
+ "package": "@fluentui/react-table",
158
+ "comment": "Bump @fluentui/react-utilities to v9.2.1",
159
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
160
+ },
161
+ {
162
+ "author": "beachball",
163
+ "package": "@fluentui/react-table",
164
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18",
165
+ "commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
166
+ }
167
+ ]
168
+ }
169
+ },
170
+ {
171
+ "date": "Wed, 02 Nov 2022 14:27:34 GMT",
6
172
  "tag": "@fluentui/react-table_v9.0.0-alpha.10",
7
173
  "version": "9.0.0-alpha.10",
8
174
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,50 @@
1
1
  # Change Log - @fluentui/react-table
2
2
 
3
- This log was last generated on Wed, 02 Nov 2022 14:27:15 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Nov 2022 23:02:45 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-alpha.12)
8
+
9
+ Thu, 17 Nov 2022 23:02:45 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-alpha.11..@fluentui/react-table_v9.0.0-alpha.12)
11
+
12
+ ### Changes
13
+
14
+ - BREAKING: `sortable` prop no longer enables `TableHeader` navigation ([PR #25656](https://github.com/microsoft/fluentui/pull/25656) by lingfangao@hotmail.com)
15
+ - fix: Match hover background colors between table row and cell actions ([PR #25628](https://github.com/microsoft/fluentui/pull/25628) by tigeroakes@microsoft.com)
16
+ - BREAKING: Headless table callbacks require event ([PR #25658](https://github.com/microsoft/fluentui/pull/25658) by lingfangao@hotmail.com)
17
+ - Bump @fluentui/react-aria to v9.3.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
18
+ - Bump @fluentui/react-avatar to v9.2.7 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
19
+ - Bump @fluentui/react-checkbox to v9.0.13 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
20
+ - Bump @fluentui/react-context-selector to v9.1.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
21
+ - Bump @fluentui/react-radio to v9.0.12 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
22
+ - Bump @fluentui/react-tabster to v9.3.1 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
23
+ - Bump @fluentui/react-utilities to v9.2.2 ([PR #25683](https://github.com/microsoft/fluentui/pull/25683) by beachball)
24
+
25
+ ## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-alpha.11)
26
+
27
+ Fri, 11 Nov 2022 14:57:41 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-alpha.10..@fluentui/react-table_v9.0.0-alpha.11)
29
+
30
+ ### Changes
31
+
32
+ - feat: Implement child render function for DataGrid rows ([PR #25476](https://github.com/microsoft/fluentui/pull/25476) by lingfangao@hotmail.com)
33
+ - feat: Implement `focusMode` prop for DataGrid, apply role="grid" correctly ([PR #25530](https://github.com/microsoft/fluentui/pull/25530) by lingfangao@hotmail.com)
34
+ - BREAKING: ColumnDefinition type is stricter, use createColumn to create column definition. Implments render function for DataGridRow. ([PR #25495](https://github.com/microsoft/fluentui/pull/25495) by lingfangao@hotmail.com)
35
+ - Bump @fluentui/react-aria to v9.3.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
36
+ - Bump @fluentui/react-avatar to v9.2.6 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
37
+ - Bump @fluentui/react-checkbox to v9.0.12 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
38
+ - Bump @fluentui/react-context-selector to v9.1.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
39
+ - Bump @fluentui/react-radio to v9.0.11 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
40
+ - Bump @fluentui/react-tabster to v9.3.0 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
41
+ - Bump @fluentui/react-theme to v9.1.2 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
42
+ - Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
43
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
44
+
7
45
  ## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-alpha.10)
8
46
 
9
- Wed, 02 Nov 2022 14:27:15 GMT
47
+ Wed, 02 Nov 2022 14:27:34 GMT
10
48
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-alpha.9..@fluentui/react-table_v9.0.0-alpha.10)
11
49
 
12
50
  ### Changes
package/dist/index.d.ts CHANGED
@@ -9,16 +9,37 @@ import type { ComponentState } from '@fluentui/react-utilities';
9
9
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
10
10
  import type { Radio } from '@fluentui/react-radio';
11
11
  import * as React_2 from 'react';
12
+ import { ReactNode } from 'react';
12
13
  import type { Slot } from '@fluentui/react-utilities';
13
14
  import type { SlotClassNames } from '@fluentui/react-utilities';
14
15
 
16
+ export declare type CellRenderFunction = (column: ColumnDefinition<any>) => React_2.ReactNode;
17
+
15
18
  export declare interface ColumnDefinition<TItem> {
16
19
  columnId: ColumnId;
17
- compare?: (a: TItem, b: TItem) => number;
20
+ compare: (a: TItem, b: TItem) => number;
21
+ renderHeaderCell: () => React_2.ReactNode;
22
+ renderCell: (item: TItem) => React_2.ReactNode;
18
23
  }
19
24
 
20
25
  export declare type ColumnId = string | number;
21
26
 
27
+ /**
28
+ * Helper function to create column definition with defaults
29
+ * @param options - column definition options
30
+ * @returns - column definition with defaults
31
+ */
32
+ export declare function createColumn<TItem>(options: CreateColumnOptions<TItem>): {
33
+ columnId: ColumnId;
34
+ renderCell: (item: TItem) => ReactNode;
35
+ renderHeaderCell: () => ReactNode;
36
+ compare: (a: TItem, b: TItem) => number;
37
+ };
38
+
39
+ export declare interface CreateColumnOptions<TItem> extends Partial<ColumnDefinition<TItem>> {
40
+ columnId: ColumnId;
41
+ }
42
+
22
43
  /**
23
44
  * DataGrid component - TODO: add more docs
24
45
  */
@@ -34,7 +55,12 @@ export declare const dataGridBodyClassNames: SlotClassNames<DataGridBodySlots>;
34
55
  /**
35
56
  * DataGridBody Props
36
57
  */
37
- export declare type DataGridBodyProps = TableBodyProps;
58
+ export declare type DataGridBodyProps = Omit<TableBodyProps, 'children'> & {
59
+ /**
60
+ * Render function for rows
61
+ */
62
+ children: RowRenderFunction;
63
+ };
38
64
 
39
65
  export declare type DataGridBodySlots = TableBodySlots;
40
66
 
@@ -64,7 +90,17 @@ export declare type DataGridCellState = TableCellState;
64
90
 
65
91
  export declare const dataGridClassNames: SlotClassNames<DataGridSlots>;
66
92
 
67
- export declare type DataGridContextValues = TableContextValues;
93
+ export declare type DataGridContextValue = HeadlessTableState<any> & {
94
+ /**
95
+ * How focus navigation will work in the datagrid
96
+ * @default none
97
+ */
98
+ focusMode: FocusMode;
99
+ };
100
+
101
+ export declare type DataGridContextValues = TableContextValues & {
102
+ dataGrid: DataGridContextValue;
103
+ };
68
104
 
69
105
  /**
70
106
  * DataGridHeader component - TODO: add more docs
@@ -107,7 +143,7 @@ export declare type DataGridHeaderState = TableHeaderState;
107
143
  /**
108
144
  * DataGrid Props
109
145
  */
110
- export declare type DataGridProps = TableProps;
146
+ export declare type DataGridProps = TableProps & Pick<DataGridContextValue, 'items' | 'columns'> & Pick<Partial<DataGridContextValue>, 'focusMode'>;
111
147
 
112
148
  /**
113
149
  * DataGridRow component - TODO: add more docs
@@ -119,7 +155,9 @@ export declare const dataGridRowClassNames: SlotClassNames<DataGridRowSlots>;
119
155
  /**
120
156
  * DataGridRow Props
121
157
  */
122
- export declare type DataGridRowProps = TableRowProps;
158
+ export declare type DataGridRowProps = Omit<TableRowProps, 'children'> & {
159
+ children: CellRenderFunction;
160
+ };
123
161
 
124
162
  export declare type DataGridRowSlots = TableRowSlots;
125
163
 
@@ -152,7 +190,11 @@ export declare type DataGridSlots = TableSlots;
152
190
  /**
153
191
  * State used in rendering DataGrid
154
192
  */
155
- export declare type DataGridState = TableState;
193
+ export declare type DataGridState = TableState & {
194
+ tableState: HeadlessTableState<unknown>;
195
+ } & Pick<DataGridContextValue, 'focusMode'>;
196
+
197
+ export declare type FocusMode = 'none' | 'cell';
156
198
 
157
199
  export declare interface HeadlessTableState<TItem> extends Pick<UseTableOptions<TItem>, 'items' | 'getRowId'> {
158
200
  /**
@@ -258,6 +300,8 @@ declare type RowEnhancer<TItem, TRowState extends RowState<TItem> = RowState<TIt
258
300
 
259
301
  export declare type RowId = string | number;
260
302
 
303
+ export declare type RowRenderFunction<TItem = any> = (row: RowState<TItem>) => React_2.ReactNode;
304
+
261
305
  export declare interface RowState<TItem> {
262
306
  /**
263
307
  * User provided data
@@ -563,23 +607,23 @@ export declare interface TableSelectionState {
563
607
  /**
564
608
  * Clears all selected rows
565
609
  */
566
- clearRows: () => void;
610
+ clearRows: (e: React_2.SyntheticEvent) => void;
567
611
  /**
568
612
  * Selects single row
569
613
  */
570
- selectRow: (rowId: RowId) => void;
614
+ selectRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
571
615
  /**
572
616
  * De-selects single row
573
617
  */
574
- deselectRow: (rowId: RowId) => void;
618
+ deselectRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
575
619
  /**
576
620
  * Toggle selection of all rows
577
621
  */
578
- toggleAllRows: () => void;
622
+ toggleAllRows: (e: React_2.SyntheticEvent) => void;
579
623
  /**
580
624
  * Toggle selection of single row
581
625
  */
582
- toggleRow: (rowId: RowId) => void;
626
+ toggleRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
583
627
  /**
584
628
  * Collection of row ids corresponding to selected rows
585
629
  */
@@ -614,11 +658,11 @@ export declare interface TableSortState<TItem> {
614
658
  /**
615
659
  * Set the sort direction for the specified column
616
660
  */
617
- setColumnSort: (columnId: ColumnId, sortDirection: SortDirection) => void;
661
+ setColumnSort: (event: React_2.SyntheticEvent, columnId: ColumnId, sortDirection: SortDirection) => void;
618
662
  /**
619
663
  * Toggles the sort direction for specified column
620
664
  */
621
- toggleColumnSort: (columnId: ColumnId) => void;
665
+ toggleColumnSort: (event: React_2.SyntheticEvent, columnId: ColumnId) => void;
622
666
  /**
623
667
  * Returns the sort direction if a column is sorted,
624
668
  * returns undefined if the column is not sorted
@@ -767,7 +811,7 @@ declare interface UseSelectionOptions {
767
811
  /**
768
812
  * Called when selection changes
769
813
  */
770
- onSelectionChange?: (selectedItems: Set<RowId>) => void;
814
+ onSelectionChange?: (e: React_2.SyntheticEvent, selectedItems: Set<RowId>) => void;
771
815
  }
772
816
 
773
817
  export declare function useSort<TItem>(options: UseSortOptions): (tableState: HeadlessTableState<TItem>) => HeadlessTableState<TItem>;
@@ -784,7 +828,7 @@ declare interface UseSortOptions {
784
828
  /**
785
829
  * Called when sort changes
786
830
  */
787
- onSortChange?: (state: SortState) => void;
831
+ onSortChange?: (e: React_2.SyntheticEvent, state: SortState) => void;
788
832
  }
789
833
 
790
834
  export declare function useTable<TItem>(options: UseTableOptions<TItem>, plugins?: TableStatePlugin[]): HeadlessTableState<TItem>;
@@ -1 +1 @@
1
- {"version":3,"file":"DataGrid.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/DataGrid.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\n\nexport type DataGridSlots = TableSlots;\n\nexport type DataGridContextValues = TableContextValues;\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps;\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState;\n"]}
1
+ {"version":3,"file":"DataGrid.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/DataGrid.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\nimport { TableState as HeadlessTableState } from '../../hooks';\n\nexport type DataGridSlots = TableSlots;\n\nexport type FocusMode = 'none' | 'cell';\n\nexport type DataGridContextValues = TableContextValues & {\n dataGrid: DataGridContextValue;\n};\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DataGridContextValue = HeadlessTableState<any> & {\n /**\n * How focus navigation will work in the datagrid\n * @default none\n */\n focusMode: FocusMode;\n};\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps &\n Pick<DataGridContextValue, 'items' | 'columns'> &\n Pick<Partial<DataGridContextValue>, 'focusMode'>;\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState & { tableState: HeadlessTableState<unknown> } & Pick<\n DataGridContextValue,\n 'focusMode'\n >;\n"]}
@@ -1,9 +1,13 @@
1
+ import * as React from 'react';
1
2
  import { renderTable_unstable } from '../Table/renderTable';
3
+ import { DataGridContextProvider } from '../../contexts/dataGridContext';
2
4
  /**
3
5
  * Render the final JSX of DataGrid
4
6
  */
5
7
 
6
8
  export const renderDataGrid_unstable = (state, contextValues) => {
7
- return renderTable_unstable(state, contextValues);
9
+ return /*#__PURE__*/React.createElement(DataGridContextProvider, {
10
+ value: contextValues.dataGrid
11
+ }, renderTable_unstable(state, contextValues));
8
12
  };
9
13
  //# sourceMappingURL=renderDataGrid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/renderDataGrid.tsx"],"names":[],"mappings":"AACA,SAAS,oBAAT,QAAqC,sBAArC;AAEA;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAAuB,aAAvB,KAA+D;EACpG,OAAO,oBAAoB,CAAC,KAAD,EAAQ,aAAR,CAA3B;AACD,CAFM","sourcesContent":["import type { DataGridContextValues, DataGridState } from './DataGrid.types';\nimport { renderTable_unstable } from '../Table/renderTable';\n\n/**\n * Render the final JSX of DataGrid\n */\nexport const renderDataGrid_unstable = (state: DataGridState, contextValues: DataGridContextValues) => {\n return renderTable_unstable(state, contextValues);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/renderDataGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SAAS,oBAAT,QAAqC,sBAArC;AACA,SAAS,uBAAT,QAAwC,gCAAxC;AAEA;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAAuB,aAAvB,KAA+D;EACpG,oBACE,KAAA,CAAA,aAAA,CAAC,uBAAD,EAAwB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAxB,EACG,oBAAoB,CAAC,KAAD,EAAQ,aAAR,CADvB,CADF;AAKD,CANM","sourcesContent":["import * as React from 'react';\nimport type { DataGridContextValues, DataGridState } from './DataGrid.types';\nimport { renderTable_unstable } from '../Table/renderTable';\nimport { DataGridContextProvider } from '../../contexts/dataGridContext';\n\n/**\n * Render the final JSX of DataGrid\n */\nexport const renderDataGrid_unstable = (state: DataGridState, contextValues: DataGridContextValues) => {\n return (\n <DataGridContextProvider value={contextValues.dataGrid}>\n {renderTable_unstable(state, contextValues)}\n </DataGridContextProvider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,6 @@
1
+ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
1
2
  import { useTable_unstable } from '../Table/useTable';
3
+ import { useTable } from '../../hooks/useTable';
2
4
  /**
3
5
  * Create the state required to render DataGrid.
4
6
  *
@@ -10,8 +12,28 @@ import { useTable_unstable } from '../Table/useTable';
10
12
  */
11
13
 
12
14
  export const useDataGrid_unstable = (props, ref) => {
13
- return useTable_unstable({ ...props,
14
- as: 'div'
15
+ const {
16
+ items,
17
+ columns,
18
+ focusMode = 'none'
19
+ } = props;
20
+ const navigable = focusMode !== 'none';
21
+ const keyboardNavAttr = useArrowNavigationGroup({
22
+ axis: 'grid'
23
+ });
24
+ const tableState = useTable({
25
+ items,
26
+ columns
27
+ }, []);
28
+ const baseTableState = useTable_unstable({
29
+ role: 'grid',
30
+ as: 'div',
31
+ ...(navigable && keyboardNavAttr),
32
+ ...props
15
33
  }, ref);
34
+ return { ...baseTableState,
35
+ focusMode,
36
+ tableState
37
+ };
16
38
  };
17
39
  //# sourceMappingURL=useDataGrid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":"AAEA,SAAS,iBAAT,QAAkC,mBAAlC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;EACvG,OAAO,iBAAiB,CAAC,EAAE,GAAG,KAAL;IAAY,EAAE,EAAE;EAAhB,CAAD,EAA0B,GAA1B,CAAxB;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n return useTable_unstable({ ...props, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":"AACA,SAAS,uBAAT,QAAwC,yBAAxC;AAEA,SAAS,iBAAT,QAAkC,mBAAlC;AACA,SAAS,QAAT,QAAyB,sBAAzB;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;EACvG,MAAM;IAAE,KAAF;IAAS,OAAT;IAAkB,SAAS,GAAG;EAA9B,IAAyC,KAA/C;EACA,MAAM,SAAS,GAAG,SAAS,KAAK,MAAhC;EACA,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAAE,IAAI,EAAE;EAAR,CAAD,CAA/C;EACA,MAAM,UAAU,GAAG,QAAQ,CAAC;IAAE,KAAF;IAAS;EAAT,CAAD,EAAqB,EAArB,CAA3B;EACA,MAAM,cAAc,GAAG,iBAAiB,CACtC;IAAE,IAAI,EAAE,MAAR;IAAgB,EAAE,EAAE,KAApB;IAA2B,IAAI,SAAS,IAAI,eAAjB,CAA3B;IAA8D,GAAG;EAAjE,CADsC,EAEtC,GAFsC,CAAxC;EAKA,OAAO,EACL,GAAG,cADE;IAEL,SAFK;IAGL;EAHK,CAAP;AAKD,CAfM","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useTable } from '../../hooks/useTable';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n const { items, columns, focusMode = 'none' } = props;\n const navigable = focusMode !== 'none';\n const keyboardNavAttr = useArrowNavigationGroup({ axis: 'grid' });\n const tableState = useTable({ items, columns }, []);\n const baseTableState = useTable_unstable(\n { role: 'grid', as: 'div', ...(navigable && keyboardNavAttr), ...props },\n ref,\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,5 +1,10 @@
1
1
  import { useTableContextValues_unstable } from '../Table/useTableContextValues';
2
2
  export function useDataGridContextValues_unstable(state) {
3
- return useTableContextValues_unstable(state);
3
+ const tableContextValues = useTableContextValues_unstable(state);
4
+ return { ...tableContextValues,
5
+ dataGrid: { ...state.tableState,
6
+ focusMode: state.focusMode
7
+ }
8
+ };
4
9
  }
5
10
  //# sourceMappingURL=useDataGridContextValues.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":"AAAA,SAAS,8BAAT,QAA+C,gCAA/C;AAGA,OAAM,SAAU,iCAAV,CAA4C,KAA5C,EAAgE;EACpE,OAAO,8BAA8B,CAAC,KAAD,CAArC;AACD","sourcesContent":["import { useTableContextValues_unstable } from '../Table/useTableContextValues';\nimport { DataGridState } from './DataGrid.types';\n\nexport function useDataGridContextValues_unstable(state: DataGridState) {\n return useTableContextValues_unstable(state);\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":"AAAA,SAAS,8BAAT,QAA+C,gCAA/C;AAGA,OAAM,SAAU,iCAAV,CAA4C,KAA5C,EAAgE;EACpE,MAAM,kBAAkB,GAAG,8BAA8B,CAAC,KAAD,CAAzD;EACA,OAAO,EACL,GAAG,kBADE;IAEL,QAAQ,EAAE,EACR,GAAG,KAAK,CAAC,UADD;MAER,SAAS,EAAE,KAAK,CAAC;IAFT;EAFL,CAAP;AAOD","sourcesContent":["import { useTableContextValues_unstable } from '../Table/useTableContextValues';\nimport { DataGridContextValues, DataGridState } from './DataGrid.types';\n\nexport function useDataGridContextValues_unstable(state: DataGridState): DataGridContextValues {\n const tableContextValues = useTableContextValues_unstable(state);\n return {\n ...tableContextValues,\n dataGrid: {\n ...state.tableState,\n focusMode: state.focusMode,\n },\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataGridBody.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/DataGridBody.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TableBodySlots, TableBodyProps, TableBodyState } from '../TableBody/TableBody.types';\n\nexport type DataGridBodySlots = TableBodySlots;\n\n/**\n * DataGridBody Props\n */\nexport type DataGridBodyProps = TableBodyProps;\n\n/**\n * State used in rendering DataGridBody\n */\nexport type DataGridBodyState = TableBodyState;\n"]}
1
+ {"version":3,"file":"DataGridBody.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/DataGridBody.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { RowState } from '../../hooks';\nimport type { TableBodySlots, TableBodyProps, TableBodyState } from '../TableBody/TableBody.types';\n\nexport type DataGridBodySlots = TableBodySlots;\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RowRenderFunction<TItem = any> = (row: RowState<TItem>) => React.ReactNode;\n\n/**\n * DataGridBody Props\n */\nexport type DataGridBodyProps = Omit<TableBodyProps, 'children'> & {\n /**\n * Render function for rows\n */\n children: RowRenderFunction;\n};\n\n/**\n * State used in rendering DataGridBody\n */\nexport type DataGridBodyState = TableBodyState;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { useTableBody_unstable } from '../TableBody/useTableBody';
2
+ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
2
3
  /**
3
4
  * Create the state required to render DataGridBody.
4
5
  *
@@ -10,7 +11,14 @@ import { useTableBody_unstable } from '../TableBody/useTableBody';
10
11
  */
11
12
 
12
13
  export const useDataGridBody_unstable = (props, ref) => {
14
+ const getRows = useDataGridContext_unstable(ctx => ctx.getRows);
15
+ const rows = getRows();
16
+ const {
17
+ children: renderRow
18
+ } = props;
19
+ const children = rows.map(row => renderRow(row));
13
20
  return useTableBody_unstable({ ...props,
21
+ children,
14
22
  as: 'div'
15
23
  }, ref);
16
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,OAAO,qBAAqB,CAAC,EAAE,GAAG,KAAL;IAAY,EAAE,EAAE;EAAhB,CAAD,EAA0B,GAA1B,CAA5B;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport type { DataGridBodyProps, DataGridBodyState } from './DataGridBody.types';\nimport { useTableBody_unstable } from '../TableBody/useTableBody';\n\n/**\n * Create the state required to render DataGridBody.\n *\n * The returned state can be modified with hooks such as useDataGridBodyStyles_unstable,\n * before being passed to renderDataGridBody_unstable.\n *\n * @param props - props from this instance of DataGridBody\n * @param ref - reference to root HTMLElement of DataGridBody\n */\nexport const useDataGridBody_unstable = (props: DataGridBodyProps, ref: React.Ref<HTMLElement>): DataGridBodyState => {\n return useTableBody_unstable({ ...props, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAT,QAAsC,2BAAtC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,MAAM,OAAO,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,OAAZ,CAA3C;EACA,MAAM,IAAI,GAAG,OAAO,EAApB;EAEA,MAAM;IAAE,QAAQ,EAAE;EAAZ,IAA0B,KAAhC;EACA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAL,CAAS,GAAG,IAAI,SAAS,CAAC,GAAD,CAAzB,CAAjB;EACA,OAAO,qBAAqB,CAAC,EAAE,GAAG,KAAL;IAAY,QAAZ;IAAsB,EAAE,EAAE;EAA1B,CAAD,EAAoC,GAApC,CAA5B;AACD,CAPM","sourcesContent":["import * as React from 'react';\nimport type { DataGridBodyProps, DataGridBodyState } from './DataGridBody.types';\nimport { useTableBody_unstable } from '../TableBody/useTableBody';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\n\n/**\n * Create the state required to render DataGridBody.\n *\n * The returned state can be modified with hooks such as useDataGridBodyStyles_unstable,\n * before being passed to renderDataGridBody_unstable.\n *\n * @param props - props from this instance of DataGridBody\n * @param ref - reference to root HTMLElement of DataGridBody\n */\nexport const useDataGridBody_unstable = (props: DataGridBodyProps, ref: React.Ref<HTMLElement>): DataGridBodyState => {\n const getRows = useDataGridContext_unstable(ctx => ctx.getRows);\n const rows = getRows();\n\n const { children: renderRow } = props;\n const children = rows.map(row => renderRow(row));\n return useTableBody_unstable({ ...props, children, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,5 @@
1
1
  import { useTableCell_unstable } from '../TableCell/useTableCell';
2
+ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
2
3
  /**
3
4
  * Create the state required to render DataGridCell.
4
5
  *
@@ -10,8 +11,12 @@ import { useTableCell_unstable } from '../TableCell/useTableCell';
10
11
  */
11
12
 
12
13
  export const useDataGridCell_unstable = (props, ref) => {
13
- return useTableCell_unstable({ ...props,
14
- as: 'div'
14
+ const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode !== 'none');
15
+ return useTableCell_unstable({
16
+ as: 'div',
17
+ role: 'gridcell',
18
+ tabIndex: tabbable ? 0 : undefined,
19
+ ...props
15
20
  }, ref);
16
21
  };
17
22
  //# sourceMappingURL=useDataGridCell.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridCell/useDataGridCell.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,OAAO,qBAAqB,CAAC,EAAE,GAAG,KAAL;IAAY,EAAE,EAAE;EAAhB,CAAD,EAA0B,GAA1B,CAA5B;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport type { DataGridCellProps, DataGridCellState } from './DataGridCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\n\n/**\n * Create the state required to render DataGridCell.\n *\n * The returned state can be modified with hooks such as useDataGridCellStyles_unstable,\n * before being passed to renderDataGridCell_unstable.\n *\n * @param props - props from this instance of DataGridCell\n * @param ref - reference to root HTMLElement of DataGridCell\n */\nexport const useDataGridCell_unstable = (props: DataGridCellProps, ref: React.Ref<HTMLElement>): DataGridCellState => {\n return useTableCell_unstable({ ...props, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridCell/useDataGridCell.ts"],"names":[],"mappings":"AAEA,SAAS,qBAAT,QAAsC,2BAAtC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,MAAM,QAAQ,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,SAAJ,KAAkB,MAA1B,CAA5C;EACA,OAAO,qBAAqB,CAAC;IAAE,EAAE,EAAE,KAAN;IAAa,IAAI,EAAE,UAAnB;IAA+B,QAAQ,EAAE,QAAQ,GAAG,CAAH,GAAO,SAAxD;IAAmE,GAAG;EAAtE,CAAD,EAAgF,GAAhF,CAA5B;AACD,CAHM","sourcesContent":["import * as React from 'react';\nimport type { DataGridCellProps, DataGridCellState } from './DataGridCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\n\n/**\n * Create the state required to render DataGridCell.\n *\n * The returned state can be modified with hooks such as useDataGridCellStyles_unstable,\n * before being passed to renderDataGridCell_unstable.\n *\n * @param props - props from this instance of DataGridCell\n * @param ref - reference to root HTMLElement of DataGridCell\n */\nexport const useDataGridCell_unstable = (props: DataGridCellProps, ref: React.Ref<HTMLElement>): DataGridCellState => {\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode !== 'none');\n return useTableCell_unstable({ as: 'div', role: 'gridcell', tabIndex: tabbable ? 0 : undefined, ...props }, ref);\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataGridRow.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.types.ts"],"names":[],"mappings":"","sourcesContent":["import { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\n\nexport type DataGridRowSlots = TableRowSlots;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps = TableRowProps;\n\n/**\n * State used in rendering DataGridRow\n */\nexport type DataGridRowState = TableRowState;\n"]}
1
+ {"version":3,"file":"DataGridRow.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ColumnDefinition } from '../../hooks';\nimport { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\n\nexport type DataGridRowSlots = TableRowSlots;\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CellRenderFunction = (column: ColumnDefinition<any>) => React.ReactNode;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps = Omit<TableRowProps, 'children'> & {\n children: CellRenderFunction;\n};\n\n/**\n * State used in rendering DataGridRow\n */\nexport type DataGridRowState = TableRowState;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { useTableRow_unstable } from '../TableRow/useTableRow';
2
+ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
2
3
  /**
3
4
  * Create the state required to render DataGridRow.
4
5
  *
@@ -10,7 +11,13 @@ import { useTableRow_unstable } from '../TableRow/useTableRow';
10
11
  */
11
12
 
12
13
  export const useDataGridRow_unstable = (props, ref) => {
14
+ const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);
15
+ const cellRenderFunction = props.children;
16
+ const children = columnDefs.map(columnDef => {
17
+ return cellRenderFunction(columnDef);
18
+ });
13
19
  return useTableRow_unstable({ ...props,
20
+ children,
14
21
  as: 'div'
15
22
  }, ref);
16
23
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.ts"],"names":[],"mappings":"AAEA,SAAS,oBAAT,QAAqC,yBAArC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,OAAO,oBAAoB,CAAC,EAAE,GAAG,KAAL;IAAY,EAAE,EAAE;EAAhB,CAAD,EAA0B,GAA1B,CAA3B;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n return useTableRow_unstable({ ...props, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.ts"],"names":[],"mappings":"AAEA,SAAS,oBAAT,QAAqC,yBAArC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,MAAM,UAAU,GAAG,2BAA2B,CAAC,GAAG,IAAI,GAAG,CAAC,OAAZ,CAA9C;EAEA,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAjC;EACA,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAX,CAAe,SAAS,IAAG;IAC1C,OAAO,kBAAkB,CAAC,SAAD,CAAzB;EACD,CAFgB,CAAjB;EAIA,OAAO,oBAAoB,CAAC,EAAE,GAAG,KAAL;IAAY,QAAZ;IAAsB,EAAE,EAAE;EAA1B,CAAD,EAAoC,GAApC,CAA3B;AACD,CATM","sourcesContent":["import * as React from 'react';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n\n const cellRenderFunction = props.children;\n const children = columnDefs.map(columnDef => {\n return cellRenderFunction(columnDef);\n });\n\n return useTableRow_unstable({ ...props, children, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
@@ -10,8 +10,10 @@ import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSe
10
10
  */
11
11
 
12
12
  export const useDataGridSelectionCell_unstable = (props, ref) => {
13
- return useTableSelectionCell_unstable({ ...props,
14
- as: 'div'
13
+ return useTableSelectionCell_unstable({
14
+ as: 'div',
15
+ role: 'gridcell',
16
+ ...props
15
17
  }, ref);
16
18
  };
17
19
  //# sourceMappingURL=useDataGridSelectionCell.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":"AACA,SAAS,8BAAT,QAA+C,6CAA/C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,OAAO,8BAA8B,CAAC,EAAE,GAAG,KAAL;IAAY,EAAE,EAAE;EAAhB,CAAD,EAA0B,GAA1B,CAArC;AACD,CALM","sourcesContent":["import * as React from 'react';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n return useTableSelectionCell_unstable({ ...props, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":"AACA,SAAS,8BAAT,QAA+C,6CAA/C;AAGA;;;;;;;;AAQG;;AACH,OAAO,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,OAAO,8BAA8B,CAAC;IAAE,EAAE,EAAE,KAAN;IAAa,IAAI,EAAE,UAAnB;IAA+B,GAAG;EAAlC,CAAD,EAA4C,GAA5C,CAArC;AACD,CALM","sourcesContent":["import * as React from 'react';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n return useTableSelectionCell_unstable({ as: 'div', role: 'gridcell', ...props }, ref);\n};\n"],"sourceRoot":"../src/"}