@fluentui/react-table 9.0.0-alpha.19 → 9.0.0-alpha.20

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 (44) hide show
  1. package/CHANGELOG.json +28 -1
  2. package/CHANGELOG.md +13 -2
  3. package/dist/index.d.ts +91 -91
  4. package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
  5. package/lib/components/DataGridBody/DataGridBody.js.map +1 -1
  6. package/lib/components/DataGridBody/DataGridBody.types.js.map +1 -1
  7. package/lib/components/DataGridBody/renderDataGridBody.js +2 -2
  8. package/lib/components/DataGridBody/renderDataGridBody.js.map +1 -1
  9. package/lib/components/DataGridRow/DataGridRow.js.map +1 -1
  10. package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
  11. package/lib/components/DataGridRow/useDataGridRow.js +2 -2
  12. package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
  13. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
  14. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  15. package/lib/contexts/columnIdContext.js.map +1 -1
  16. package/lib/contexts/rowIdContext.js +4 -4
  17. package/lib/contexts/rowIdContext.js.map +1 -1
  18. package/lib/hooks/createColumn.js +1 -1
  19. package/lib/hooks/createColumn.js.map +1 -1
  20. package/lib/hooks/types.js.map +1 -1
  21. package/lib/hooks/useTableFeatures.js.map +1 -1
  22. package/lib/hooks/useTableSelection.js.map +1 -1
  23. package/lib/hooks/useTableSort.js.map +1 -1
  24. package/lib/index.js +2 -2
  25. package/lib/index.js.map +1 -1
  26. package/lib-commonjs/components/DataGridBody/DataGridBody.js.map +1 -1
  27. package/lib-commonjs/components/DataGridBody/renderDataGridBody.js +1 -1
  28. package/lib-commonjs/components/DataGridBody/renderDataGridBody.js.map +1 -1
  29. package/lib-commonjs/components/DataGridRow/DataGridRow.js.map +1 -1
  30. package/lib-commonjs/components/DataGridRow/useDataGridRow.js +1 -1
  31. package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
  32. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +1 -1
  33. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  34. package/lib-commonjs/contexts/columnIdContext.js.map +1 -1
  35. package/lib-commonjs/contexts/rowIdContext.js +6 -6
  36. package/lib-commonjs/contexts/rowIdContext.js.map +1 -1
  37. package/lib-commonjs/hooks/createColumn.js +3 -3
  38. package/lib-commonjs/hooks/createColumn.js.map +1 -1
  39. package/lib-commonjs/hooks/useTableFeatures.js.map +1 -1
  40. package/lib-commonjs/hooks/useTableSelection.js.map +1 -1
  41. package/lib-commonjs/hooks/useTableSort.js.map +1 -1
  42. package/lib-commonjs/index.js +7 -7
  43. package/lib-commonjs/index.js.map +1 -1
  44. package/package.json +2 -2
package/CHANGELOG.json CHANGED
@@ -2,7 +2,34 @@
2
2
  "name": "@fluentui/react-table",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 16 Jan 2023 08:35:24 GMT",
5
+ "date": "Tue, 17 Jan 2023 12:22:15 GMT",
6
+ "tag": "@fluentui/react-table_v9.0.0-alpha.20",
7
+ "version": "9.0.0-alpha.20",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "lingfangao@hotmail.com",
12
+ "package": "@fluentui/react-table",
13
+ "commit": "0d265cf542add3b4895e3ba764bbb22be7843f45",
14
+ "comment": "BREAKING: API naming changes"
15
+ },
16
+ {
17
+ "author": "lingfangao@hotmail.com",
18
+ "package": "@fluentui/react-table",
19
+ "commit": "08ccb46dd03a8871c1234008a5a543cd53f579a9",
20
+ "comment": "BREAKING(DataGrid): render functions need to by typed"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-table",
25
+ "comment": "Bump @fluentui/react-avatar to v9.2.14",
26
+ "commit": "08ccb46dd03a8871c1234008a5a543cd53f579a9"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Mon, 16 Jan 2023 08:38:48 GMT",
6
33
  "tag": "@fluentui/react-table_v9.0.0-alpha.19",
7
34
  "version": "9.0.0-alpha.19",
8
35
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,23 @@
1
1
  # Change Log - @fluentui/react-table
2
2
 
3
- This log was last generated on Mon, 16 Jan 2023 08:35:24 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 17 Jan 2023 12:22:15 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-alpha.20](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-alpha.20)
8
+
9
+ Tue, 17 Jan 2023 12:22:15 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-alpha.19..@fluentui/react-table_v9.0.0-alpha.20)
11
+
12
+ ### Changes
13
+
14
+ - BREAKING: API naming changes ([PR #26304](https://github.com/microsoft/fluentui/pull/26304) by lingfangao@hotmail.com)
15
+ - BREAKING(DataGrid): render functions need to by typed ([PR #26371](https://github.com/microsoft/fluentui/pull/26371) by lingfangao@hotmail.com)
16
+ - Bump @fluentui/react-avatar to v9.2.14 ([PR #26371](https://github.com/microsoft/fluentui/pull/26371) by beachball)
17
+
7
18
  ## [9.0.0-alpha.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-alpha.19)
8
19
 
9
- Mon, 16 Jan 2023 08:35:24 GMT
20
+ Mon, 16 Jan 2023 08:38:48 GMT
10
21
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-alpha.18..@fluentui/react-table_v9.0.0-alpha.19)
11
22
 
12
23
  ### Changes
package/dist/index.d.ts CHANGED
@@ -13,31 +13,22 @@ import { ReactNode } from 'react';
13
13
  import type { Slot } from '@fluentui/react-utilities';
14
14
  import type { SlotClassNames } from '@fluentui/react-utilities';
15
15
 
16
- export declare type CellRenderFunction = (column: ColumnDefinition<any>) => React_2.ReactNode;
17
-
18
- export declare interface ColumnDefinition<TItem> {
19
- columnId: ColumnId;
20
- compare: (a: TItem, b: TItem) => number;
21
- renderHeaderCell: () => React_2.ReactNode;
22
- renderCell: (item: TItem) => React_2.ReactNode;
23
- }
24
-
25
- export declare type ColumnId = string | number;
16
+ export declare type CellRenderFunction<TItem = unknown> = (column: TableColumnDefinition<TItem>) => React_2.ReactNode;
26
17
 
27
18
  /**
28
19
  * Helper function to create column definition with defaults
29
20
  * @param options - column definition options
30
21
  * @returns - column definition with defaults
31
22
  */
32
- export declare function createColumn<TItem>(options: CreateColumnOptions<TItem>): {
33
- columnId: ColumnId;
23
+ export declare function createTableColumn<TItem>(options: CreateTableColumnOptions<TItem>): {
24
+ columnId: TableColumnId;
34
25
  renderCell: (item: TItem) => ReactNode;
35
26
  renderHeaderCell: () => ReactNode;
36
27
  compare: (a: TItem, b: TItem) => number;
37
28
  };
38
29
 
39
- export declare interface CreateColumnOptions<TItem> extends Partial<ColumnDefinition<TItem>> {
40
- columnId: ColumnId;
30
+ export declare interface CreateTableColumnOptions<TItem> extends Partial<TableColumnDefinition<TItem>> {
31
+ columnId: TableColumnId;
41
32
  }
42
33
 
43
34
  /**
@@ -48,18 +39,18 @@ export declare const DataGrid: ForwardRefComponent<DataGridProps>;
48
39
  /**
49
40
  * DataGridBody component
50
41
  */
51
- export declare const DataGridBody: ForwardRefComponent<DataGridBodyProps>;
42
+ export declare const DataGridBody: ForwardRefComponent<DataGridBodyProps> & (<TItem>(props: DataGridBodyProps<TItem>) => JSX.Element);
52
43
 
53
44
  export declare const dataGridBodyClassNames: SlotClassNames<DataGridBodySlots>;
54
45
 
55
46
  /**
56
47
  * DataGridBody Props
57
48
  */
58
- export declare type DataGridBodyProps = Omit<TableBodyProps, 'children'> & {
49
+ export declare type DataGridBodyProps<TItem = unknown> = Omit<TableBodyProps, 'children'> & {
59
50
  /**
60
51
  * Render function for rows
61
52
  */
62
- children: RowRenderFunction;
53
+ children: RowRenderFunction<TItem>;
63
54
  };
64
55
 
65
56
  export declare type DataGridBodySlots = TableBodySlots;
@@ -68,7 +59,7 @@ export declare type DataGridBodySlots = TableBodySlots;
68
59
  * State used in rendering DataGridBody
69
60
  */
70
61
  export declare type DataGridBodyState = TableBodyState & {
71
- rows: RowState<any>[];
62
+ rows: TableRowData<unknown>[];
72
63
  renderRow: RowRenderFunction;
73
64
  };
74
65
 
@@ -93,12 +84,12 @@ export declare type DataGridCellState = TableCellState;
93
84
 
94
85
  export declare const dataGridClassNames: SlotClassNames<DataGridSlots>;
95
86
 
96
- export declare type DataGridContextValue = HeadlessTableState<any> & {
87
+ export declare type DataGridContextValue = TableFeaturesState<any> & {
97
88
  /**
98
89
  * How focus navigation will work in the datagrid
99
90
  * @default cell
100
91
  */
101
- focusMode: FocusMode;
92
+ focusMode: DataGridFocusMode;
102
93
  /**
103
94
  * Lets child components know if rows selection is enabled
104
95
  * @see selectionMode prop enables row selection on the component
@@ -120,6 +111,8 @@ export declare type DataGridContextValues = TableContextValues & {
120
111
  dataGrid: DataGridContextValue;
121
112
  };
122
113
 
114
+ export declare type DataGridFocusMode = 'none' | 'cell' | 'row_unstable';
115
+
123
116
  /**
124
117
  * DataGridHeader component
125
118
  */
@@ -174,15 +167,15 @@ export declare type DataGridProps = TableProps & Pick<DataGridContextValue, 'ite
174
167
  /**
175
168
  * DataGridRow component
176
169
  */
177
- export declare const DataGridRow: ForwardRefComponent<DataGridRowProps>;
170
+ export declare const DataGridRow: ForwardRefComponent<DataGridRowProps> & (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element);
178
171
 
179
172
  export declare const dataGridRowClassNames: SlotClassNames<DataGridRowSlots>;
180
173
 
181
174
  /**
182
175
  * DataGridRow Props
183
176
  */
184
- export declare type DataGridRowProps = Omit<TableRowProps, 'children'> & Omit<ComponentProps<DataGridRowSlots>, 'children'> & {
185
- children: CellRenderFunction;
177
+ export declare type DataGridRowProps<TItem = unknown> = Omit<TableRowProps, 'children'> & Omit<ComponentProps<DataGridRowSlots>, 'children'> & {
178
+ children: CellRenderFunction<TItem>;
186
179
  };
187
180
 
188
181
  export declare type DataGridRowSlots = TableRowSlots & {
@@ -198,7 +191,7 @@ export declare type DataGridRowSlots = TableRowSlots & {
198
191
  */
199
192
  export declare type DataGridRowState = TableRowState & ComponentState<DataGridRowSlots> & {
200
193
  renderCell: CellRenderFunction;
201
- columnDefs: ColumnDefinition<any>[];
194
+ columnDefs: TableColumnDefinition<any>[];
202
195
  };
203
196
 
204
197
  /**
@@ -226,33 +219,11 @@ export declare type DataGridSlots = TableSlots;
226
219
  * State used in rendering DataGrid
227
220
  */
228
221
  export declare type DataGridState = TableState & {
229
- tableState: HeadlessTableState<unknown>;
222
+ tableState: TableFeaturesState<unknown>;
230
223
  } & Pick<DataGridContextValue, 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId'>;
231
224
 
232
- export declare type FocusMode = 'none' | 'cell' | 'row_unstable';
233
-
234
- export declare interface HeadlessTableState<TItem> extends Pick<UseTableOptions<TItem>, 'items' | 'getRowId'> {
235
- /**
236
- * The row data for rendering
237
- * @param rowEnhancer - Enhances the row with extra user data
238
- */
239
- getRows: <TRowState extends RowState<TItem> = RowState<TItem>>(rowEnhancer?: RowEnhancer<TItem, TRowState>) => TRowState[];
240
- /**
241
- * State and actions to manage row selection
242
- */
243
- selection: TableSelectionState;
244
- /**
245
- * State and actions to manage row sorting
246
- */
247
- sort: TableSortState<TItem>;
248
- /**
249
- * Table columns
250
- */
251
- columns: ColumnDefinition<TItem>[];
252
- }
253
-
254
225
  declare interface OnSelectionChangeData {
255
- selectedItems: Set<RowId>;
226
+ selectedItems: Set<TableRowId>;
256
227
  }
257
228
 
258
229
  /**
@@ -335,31 +306,16 @@ export declare const renderTableRow_unstable: (state: TableRowState) => JSX.Elem
335
306
  */
336
307
  export declare const renderTableSelectionCell_unstable: (state: TableSelectionCellState) => JSX.Element;
337
308
 
338
- declare type RowEnhancer<TItem, TRowState extends RowState<TItem> = RowState<TItem>> = (row: RowState<TItem>) => TRowState;
309
+ declare type RowEnhancer<TItem, TRowState extends TableRowData<TItem> = TableRowData<TItem>> = (row: TableRowData<TItem>) => TRowState;
339
310
 
340
- export declare type RowId = string | number;
341
-
342
- export declare const RowIdContextProvider: React_2.Provider<RowId | undefined>;
343
-
344
- export declare type RowRenderFunction = (row: RowState<any>, ...rest: any[]) => React_2.ReactNode;
345
-
346
- export declare interface RowState<TItem> {
347
- /**
348
- * User provided data
349
- */
350
- item: TItem;
351
- /**
352
- * The row id, defaults to index position in the collection
353
- */
354
- rowId: RowId;
355
- }
311
+ export declare type RowRenderFunction<TItem = unknown> = (row: TableRowData<TItem>, ...rest: unknown[]) => React_2.ReactNode;
356
312
 
357
313
  declare type SelectionMode_2 = 'single' | 'multiselect';
358
314
 
359
315
  export declare type SortDirection = 'ascending' | 'descending';
360
316
 
361
317
  declare interface SortState {
362
- sortColumn: ColumnId | undefined;
318
+ sortColumn: TableColumnId | undefined;
363
319
  sortDirection: SortDirection;
364
320
  }
365
321
 
@@ -496,6 +452,15 @@ export declare const tableClassName = "fui-Table";
496
452
 
497
453
  export declare const tableClassNames: SlotClassNames<TableSlots>;
498
454
 
455
+ export declare interface TableColumnDefinition<TItem> {
456
+ columnId: TableColumnId;
457
+ compare: (a: TItem, b: TItem) => number;
458
+ renderHeaderCell: () => React_2.ReactNode;
459
+ renderCell: (item: TItem) => React_2.ReactNode;
460
+ }
461
+
462
+ export declare type TableColumnId = string | number;
463
+
499
464
  export declare const TableContextProvider: React_2.Provider<TableContextValue | undefined>;
500
465
 
501
466
  export declare type TableContextValue = {
@@ -521,6 +486,28 @@ export declare type TableContextValues = {
521
486
  table: TableContextValue;
522
487
  };
523
488
 
489
+ export declare type TableFeaturePlugin = <TItem>(tableState: TableFeaturesState<TItem>) => TableFeaturesState<TItem>;
490
+
491
+ export declare interface TableFeaturesState<TItem> extends Pick<UseTableFeaturesOptions<TItem>, 'items' | 'getRowId'> {
492
+ /**
493
+ * The row data for rendering
494
+ * @param rowEnhancer - Enhances the row with extra user data
495
+ */
496
+ getRows: <TRowState extends TableRowData<TItem> = TableRowData<TItem>>(rowEnhancer?: RowEnhancer<TItem, TRowState>) => TRowState[];
497
+ /**
498
+ * State and actions to manage row selection
499
+ */
500
+ selection: TableSelectionState;
501
+ /**
502
+ * State and actions to manage row sorting
503
+ */
504
+ sort: TableSortState<TItem>;
505
+ /**
506
+ * Table columns
507
+ */
508
+ columns: TableColumnDefinition<TItem>[];
509
+ }
510
+
524
511
  /**
525
512
  * TableHeader component
526
513
  */
@@ -591,6 +578,21 @@ export declare const tableRowClassName = "fui-TableRow";
591
578
 
592
579
  export declare const tableRowClassNames: SlotClassNames<TableRowSlots>;
593
580
 
581
+ export declare interface TableRowData<TItem> {
582
+ /**
583
+ * User provided data
584
+ */
585
+ item: TItem;
586
+ /**
587
+ * The row id, defaults to index position in the collection
588
+ */
589
+ rowId: TableRowId;
590
+ }
591
+
592
+ export declare type TableRowId = string | number;
593
+
594
+ export declare const TableRowIdContextProvider: React_2.Provider<TableRowId | undefined>;
595
+
594
596
  /**
595
597
  * TableRow Props
596
598
  */
@@ -670,11 +672,11 @@ export declare interface TableSelectionState {
670
672
  /**
671
673
  * Selects single row
672
674
  */
673
- selectRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
675
+ selectRow: (e: React_2.SyntheticEvent, rowId: TableRowId) => void;
674
676
  /**
675
677
  * De-selects single row
676
678
  */
677
- deselectRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
679
+ deselectRow: (e: React_2.SyntheticEvent, rowId: TableRowId) => void;
678
680
  /**
679
681
  * Toggle selection of all rows
680
682
  */
@@ -682,11 +684,11 @@ export declare interface TableSelectionState {
682
684
  /**
683
685
  * Toggle selection of single row
684
686
  */
685
- toggleRow: (e: React_2.SyntheticEvent, rowId: RowId) => void;
687
+ toggleRow: (e: React_2.SyntheticEvent, rowId: TableRowId) => void;
686
688
  /**
687
689
  * Collection of row ids corresponding to selected rows
688
690
  */
689
- selectedRows: Set<RowId>;
691
+ selectedRows: Set<TableRowId>;
690
692
  /**
691
693
  * Whether all rows are selected
692
694
  */
@@ -698,7 +700,7 @@ export declare interface TableSelectionState {
698
700
  /**
699
701
  * Checks if a given rowId is selected
700
702
  */
701
- isRowSelected: (rowId: RowId) => boolean;
703
+ isRowSelected: (rowId: TableRowId) => boolean;
702
704
  selectionMode: SelectionMode_2;
703
705
  }
704
706
 
@@ -714,24 +716,24 @@ export declare interface TableSortState<TItem> {
714
716
  /**
715
717
  * Column id of the currently sorted column
716
718
  */
717
- sortColumn: ColumnId | undefined;
719
+ sortColumn: TableColumnId | undefined;
718
720
  /**
719
721
  * Set the sort direction for the specified column
720
722
  */
721
- setColumnSort: (event: React_2.SyntheticEvent, columnId: ColumnId, sortDirection: SortDirection) => void;
723
+ setColumnSort: (event: React_2.SyntheticEvent, columnId: TableColumnId, sortDirection: SortDirection) => void;
722
724
  /**
723
725
  * Toggles the sort direction for specified column
724
726
  */
725
- toggleColumnSort: (event: React_2.SyntheticEvent, columnId: ColumnId) => void;
727
+ toggleColumnSort: (event: React_2.SyntheticEvent, columnId: TableColumnId) => void;
726
728
  /**
727
729
  * Returns the sort direction if a column is sorted,
728
730
  * returns undefined if the column is not sorted
729
731
  */
730
- getSortDirection: (columnId: ColumnId) => SortDirection | undefined;
732
+ getSortDirection: (columnId: TableColumnId) => SortDirection | undefined;
731
733
  /**
732
734
  * Sorts rows and returns a **shallow** copy of original items
733
735
  */
734
- sort: <TRowState extends RowState<TItem>>(rows: TRowState[]) => TRowState[];
736
+ sort: <TRowState extends TableRowData<TItem>>(rows: TRowState[]) => TRowState[];
735
737
  }
736
738
 
737
739
  /**
@@ -739,8 +741,6 @@ export declare interface TableSortState<TItem> {
739
741
  */
740
742
  export declare type TableState = ComponentState<TableSlots> & Pick<Required<TableProps>, 'size' | 'noNativeElements'> & TableContextValue;
741
743
 
742
- export declare type TableStatePlugin = <TItem>(tableState: HeadlessTableState<TItem>) => HeadlessTableState<TItem>;
743
-
744
744
  /**
745
745
  * Create the state required to render DataGrid.
746
746
  *
@@ -853,8 +853,6 @@ export declare const useDataGridSelectionCellStyles_unstable: (state: DataGridSe
853
853
  */
854
854
  export declare const useDataGridStyles_unstable: (state: DataGridState) => DataGridState;
855
855
 
856
- export declare const useRowIdContext: () => RowId;
857
-
858
856
  /**
859
857
  * Create the state required to render Table.
860
858
  *
@@ -932,7 +930,13 @@ export declare const useTableCellStyles_unstable: (state: TableCellState) => Tab
932
930
 
933
931
  export declare const useTableContext: () => TableContextValue;
934
932
 
935
- export declare function useTableFeatures<TItem>(options: UseTableOptions<TItem>, plugins?: TableStatePlugin[]): HeadlessTableState<TItem>;
933
+ export declare function useTableFeatures<TItem>(options: UseTableFeaturesOptions<TItem>, plugins?: TableFeaturePlugin[]): TableFeaturesState<TItem>;
934
+
935
+ export declare interface UseTableFeaturesOptions<TItem> {
936
+ columns: TableColumnDefinition<TItem>[];
937
+ items: TItem[];
938
+ getRowId?: (item: TItem) => TableRowId;
939
+ }
936
940
 
937
941
  /**
938
942
  * Create the state required to render TableHeader.
@@ -966,12 +970,6 @@ export declare const useTableHeaderCellStyles_unstable: (state: TableHeaderCellS
966
970
  */
967
971
  export declare const useTableHeaderStyles_unstable: (state: TableHeaderState) => TableHeaderState;
968
972
 
969
- export declare interface UseTableOptions<TItem> {
970
- columns: ColumnDefinition<TItem>[];
971
- items: TItem[];
972
- getRowId?: (item: TItem) => RowId;
973
- }
974
-
975
973
  /**
976
974
  * Create the state required to render TableRow.
977
975
  *
@@ -983,12 +981,14 @@ export declare interface UseTableOptions<TItem> {
983
981
  */
984
982
  export declare const useTableRow_unstable: (props: TableRowProps, ref: React_2.Ref<HTMLElement>) => TableRowState;
985
983
 
984
+ export declare const useTableRowIdContext: () => TableRowId;
985
+
986
986
  /**
987
987
  * Apply styling to the TableRow slots based on the state
988
988
  */
989
989
  export declare const useTableRowStyles_unstable: (state: TableRowState) => TableRowState;
990
990
 
991
- export declare function useTableSelection<TItem>(options: UseTableSelectionOptions): (tableState: HeadlessTableState<TItem>) => HeadlessTableState<TItem>;
991
+ export declare function useTableSelection<TItem>(options: UseTableSelectionOptions): (tableState: TableFeaturesState<TItem>) => TableFeaturesState<TItem>;
992
992
 
993
993
  /**
994
994
  * Create the state required to render TableSelectionCell.
@@ -1014,18 +1014,18 @@ declare interface UseTableSelectionOptions {
1014
1014
  /**
1015
1015
  * Used in uncontrolled mode to set initial selected rows on mount
1016
1016
  */
1017
- defaultSelectedItems?: Set<RowId>;
1017
+ defaultSelectedItems?: Set<TableRowId>;
1018
1018
  /**
1019
1019
  * Used to control row selection
1020
1020
  */
1021
- selectedItems?: Set<RowId>;
1021
+ selectedItems?: Set<TableRowId>;
1022
1022
  /**
1023
1023
  * Called when selection changes
1024
1024
  */
1025
1025
  onSelectionChange?(e: React_2.SyntheticEvent, data: OnSelectionChangeData): void;
1026
1026
  }
1027
1027
 
1028
- export declare function useTableSort<TItem>(options: UseTableSortOptions): (tableState: HeadlessTableState<TItem>) => HeadlessTableState<TItem>;
1028
+ export declare function useTableSort<TItem>(options: UseTableSortOptions): (tableState: TableFeaturesState<TItem>) => TableFeaturesState<TItem>;
1029
1029
 
1030
1030
  declare interface UseTableSortOptions {
1031
1031
  /**
@@ -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 * as React from 'react';\nimport type { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\nimport type {\n SortState,\n TableState as HeadlessTableState,\n UseTableSortOptions,\n SelectionMode,\n UseTableSelectionOptions,\n OnSelectionChangeData,\n} from '../../hooks';\nimport { TableRowProps } from '../TableRow/TableRow.types';\n\nexport type DataGridSlots = TableSlots;\n\nexport type FocusMode = 'none' | 'cell' | 'row_unstable';\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 cell\n */\n focusMode: FocusMode;\n\n /**\n * Lets child components know if rows selection is enabled\n * @see selectionMode prop enables row selection on the component\n */\n selectableRows: boolean;\n\n /**\n * Enables subtle selection style\n * @default false\n */\n subtleSelection: boolean;\n\n /**\n * Row appearance when selected\n * @default brand\n */\n selectionAppearance: TableRowProps['appearance'];\n};\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps &\n Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> &\n Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance'> &\n Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> &\n Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {\n onSortChange?: (e: React.MouseEvent, sortState: SortState) => void;\n onSelectionChange?: (e: React.MouseEvent | React.KeyboardEvent, data: OnSelectionChangeData) => void;\n /**\n * Enables row selection and sets the selection mode\n * @default false\n */\n selectionMode?: SelectionMode;\n };\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState & { tableState: HeadlessTableState<unknown> } & Pick<\n DataGridContextValue,\n 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId'\n >;\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 * as React from 'react';\nimport type { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\nimport type {\n SortState,\n TableFeaturesState,\n UseTableSortOptions,\n SelectionMode,\n UseTableSelectionOptions,\n OnSelectionChangeData,\n} from '../../hooks';\nimport { TableRowProps } from '../TableRow/TableRow.types';\n\nexport type DataGridSlots = TableSlots;\n\nexport type DataGridFocusMode = 'none' | 'cell' | 'row_unstable';\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 = TableFeaturesState<any> & {\n /**\n * How focus navigation will work in the datagrid\n * @default cell\n */\n focusMode: DataGridFocusMode;\n\n /**\n * Lets child components know if rows selection is enabled\n * @see selectionMode prop enables row selection on the component\n */\n selectableRows: boolean;\n\n /**\n * Enables subtle selection style\n * @default false\n */\n subtleSelection: boolean;\n\n /**\n * Row appearance when selected\n * @default brand\n */\n selectionAppearance: TableRowProps['appearance'];\n};\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps &\n Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> &\n Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance'> &\n Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> &\n Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {\n onSortChange?: (e: React.MouseEvent, sortState: SortState) => void;\n onSelectionChange?: (e: React.MouseEvent | React.KeyboardEvent, data: OnSelectionChangeData) => void;\n /**\n * Enables row selection and sets the selection mode\n * @default false\n */\n selectionMode?: SelectionMode;\n };\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState & { tableState: TableFeaturesState<unknown> } & Pick<\n DataGridContextValue,\n 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId'\n >;\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,wBAAwB,QAAQ,mBAAmB;AAC5D,SAASC,2BAA2B,QAAQ,sBAAsB;AAClE,SAASC,8BAA8B,QAAQ,yBAAyB;AAIxE;;;AAGA,OAAO,MAAMC,YAAY,gBAA2CJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAClG,MAAMC,KAAK,GAAGP,wBAAwB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAElDJ,8BAA8B,CAACK,KAAK,CAAC;EACrC,OAAON,2BAA2B,CAACM,KAAK,CAAC;AAC3C,CAAC,CAAC;AAEFJ,YAAY,CAACK,WAAW,GAAG,cAAc","names":["React","useDataGridBody_unstable","renderDataGridBody_unstable","useDataGridBodyStyles_unstable","DataGridBody","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/DataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridBody_unstable } from './useDataGridBody';\nimport { renderDataGridBody_unstable } from './renderDataGridBody';\nimport { useDataGridBodyStyles_unstable } from './useDataGridBodyStyles';\nimport type { DataGridBodyProps } from './DataGridBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridBody component\n */\nexport const DataGridBody: ForwardRefComponent<DataGridBodyProps> = React.forwardRef((props, ref) => {\n const state = useDataGridBody_unstable(props, ref);\n\n useDataGridBodyStyles_unstable(state);\n return renderDataGridBody_unstable(state);\n});\n\nDataGridBody.displayName = 'DataGridBody';\n"]}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,wBAAwB,QAAQ,mBAAmB;AAC5D,SAASC,2BAA2B,QAAQ,sBAAsB;AAClE,SAASC,8BAA8B,QAAQ,yBAAyB;AAIxE;;;AAGA,OAAO,MAAMC,YAAY,gBACqCJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC5F,MAAMC,KAAK,GAAGP,wBAAwB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAElDJ,8BAA8B,CAACK,KAAK,CAAC;EACrC,OAAON,2BAA2B,CAACM,KAAK,CAAC;AAC3C,CAAC,CAAuG;AAExGJ,YAAY,CAACK,WAAW,GAAG,cAAc","names":["React","useDataGridBody_unstable","renderDataGridBody_unstable","useDataGridBodyStyles_unstable","DataGridBody","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/DataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridBody_unstable } from './useDataGridBody';\nimport { renderDataGridBody_unstable } from './renderDataGridBody';\nimport { useDataGridBodyStyles_unstable } from './useDataGridBodyStyles';\nimport type { DataGridBodyProps } from './DataGridBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridBody component\n */\nexport const DataGridBody: ForwardRefComponent<DataGridBodyProps> &\n (<TItem>(props: DataGridBodyProps<TItem>) => JSX.Element) = React.forwardRef((props, ref) => {\n const state = useDataGridBody_unstable(props, ref);\n\n useDataGridBodyStyles_unstable(state);\n return renderDataGridBody_unstable(state);\n}) as ForwardRefComponent<DataGridBodyProps> & (<TItem>(props: DataGridBodyProps<TItem>) => JSX.Element);\n\nDataGridBody.displayName = 'DataGridBody';\n"]}
@@ -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 * 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 = (row: RowState<any>, ...rest: any[]) => 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n rows: RowState<any>[];\n\n renderRow: RowRenderFunction;\n};\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 { TableRowData } from '../../hooks';\nimport type { TableBodySlots, TableBodyProps, TableBodyState } from '../TableBody/TableBody.types';\n\nexport type DataGridBodySlots = TableBodySlots;\n\nexport type RowRenderFunction<TItem = unknown> = (row: TableRowData<TItem>, ...rest: unknown[]) => React.ReactNode;\n\n/**\n * DataGridBody Props\n */\nexport type DataGridBodyProps<TItem = unknown> = Omit<TableBodyProps, 'children'> & {\n /**\n * Render function for rows\n */\n children: RowRenderFunction<TItem>;\n};\n\n/**\n * State used in rendering DataGridBody\n */\nexport type DataGridBodyState = TableBodyState & {\n rows: TableRowData<unknown>[];\n\n renderRow: RowRenderFunction;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { getSlots } from '@fluentui/react-utilities';
3
- import { RowIdContextProvider } from '../../contexts/rowIdContext';
3
+ import { TableRowIdContextProvider } from '../../contexts/rowIdContext';
4
4
  /**
5
5
  * Render the final JSX of DataGridBody
6
6
  */
@@ -11,7 +11,7 @@ export const renderDataGridBody_unstable = state => {
11
11
  } = getSlots(state);
12
12
  return /*#__PURE__*/React.createElement(slots.root, {
13
13
  ...slotProps.root
14
- }, state.rows.map(row => /*#__PURE__*/React.createElement(RowIdContextProvider, {
14
+ }, state.rows.map(row => /*#__PURE__*/React.createElement(TableRowIdContextProvider, {
15
15
  key: row.rowId,
16
16
  value: row.rowId
17
17
  }, state.renderRow(row))));
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,oBAAoB,QAAQ,6BAA6B;AAElE;;;AAGA,OAAO,MAAMC,2BAA2B,GAAIC,KAAwB,IAAI;EACtE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGL,QAAQ,CAAoBG,KAAK,CAAC;EAE/D,oBACEJ,oBAACK,KAAK,CAACE,IAAI;IAAA,GAAKD,SAAS,CAACC;EAAI,GAC3BH,KAAK,CAACI,IAAI,CAACC,GAAG,CAACC,GAAG,iBACjBV,oBAACE,oBAAoB;IAACS,GAAG,EAAED,GAAG,CAACE,KAAK;IAAEC,KAAK,EAAEH,GAAG,CAACE;EAAK,GACnDR,KAAK,CAACU,SAAS,CAACJ,GAAG,CAAC,CAExB,CAAC,CACS;AAEjB,CAAC","names":["React","getSlots","RowIdContextProvider","renderDataGridBody_unstable","state","slots","slotProps","root","rows","map","row","key","rowId","value","renderRow"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/renderDataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DataGridBodyState, DataGridBodySlots } from './DataGridBody.types';\nimport { RowIdContextProvider } from '../../contexts/rowIdContext';\n\n/**\n * Render the final JSX of DataGridBody\n */\nexport const renderDataGridBody_unstable = (state: DataGridBodyState) => {\n const { slots, slotProps } = getSlots<DataGridBodySlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.rows.map(row => (\n <RowIdContextProvider key={row.rowId} value={row.rowId}>\n {state.renderRow(row)}\n </RowIdContextProvider>\n ))}\n </slots.root>\n );\n};\n"]}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE;;;AAGA,OAAO,MAAMC,2BAA2B,GAAIC,KAAwB,IAAI;EACtE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGL,QAAQ,CAAoBG,KAAK,CAAC;EAE/D,oBACEJ,oBAACK,KAAK,CAACE,IAAI;IAAA,GAAKD,SAAS,CAACC;EAAI,GAC3BH,KAAK,CAACI,IAAI,CAACC,GAAG,CAACC,GAAG,iBACjBV,oBAACE,yBAAyB;IAACS,GAAG,EAAED,GAAG,CAACE,KAAK;IAAEC,KAAK,EAAEH,GAAG,CAACE;EAAK,GACxDR,KAAK,CAACU,SAAS,CAACJ,GAAG,CAAC,CAExB,CAAC,CACS;AAEjB,CAAC","names":["React","getSlots","TableRowIdContextProvider","renderDataGridBody_unstable","state","slots","slotProps","root","rows","map","row","key","rowId","value","renderRow"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/renderDataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DataGridBodyState, DataGridBodySlots } from './DataGridBody.types';\nimport { TableRowIdContextProvider } from '../../contexts/rowIdContext';\n\n/**\n * Render the final JSX of DataGridBody\n */\nexport const renderDataGridBody_unstable = (state: DataGridBodyState) => {\n const { slots, slotProps } = getSlots<DataGridBodySlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.rows.map(row => (\n <TableRowIdContextProvider key={row.rowId} value={row.rowId}>\n {state.renderRow(row)}\n </TableRowIdContextProvider>\n ))}\n </slots.root>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,6BAA6B,QAAQ,wBAAwB;AAItE;;;AAGA,OAAO,MAAMC,WAAW,gBAA0CJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAChG,MAAMC,KAAK,GAAGP,uBAAuB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAEjDJ,6BAA6B,CAACK,KAAK,CAAC;EACpC,OAAON,0BAA0B,CAACM,KAAK,CAAC;AAC1C,CAAC,CAAC;AAEFJ,WAAW,CAACK,WAAW,GAAG,aAAa","names":["React","useDataGridRow_unstable","renderDataGridRow_unstable","useDataGridRowStyles_unstable","DataGridRow","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridRow_unstable } from './useDataGridRow';\nimport { renderDataGridRow_unstable } from './renderDataGridRow';\nimport { useDataGridRowStyles_unstable } from './useDataGridRowStyles';\nimport type { DataGridRowProps } from './DataGridRow.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridRow component\n */\nexport const DataGridRow: ForwardRefComponent<DataGridRowProps> = React.forwardRef((props, ref) => {\n const state = useDataGridRow_unstable(props, ref);\n\n useDataGridRowStyles_unstable(state);\n return renderDataGridRow_unstable(state);\n});\n\nDataGridRow.displayName = 'DataGridRow';\n"]}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,SAASC,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,6BAA6B,QAAQ,wBAAwB;AAItE;;;AAGA,OAAO,MAAMC,WAAW,gBACqCJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC3F,MAAMC,KAAK,GAAGP,uBAAuB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAEjDJ,6BAA6B,CAACK,KAAK,CAAC;EACpC,OAAON,0BAA0B,CAACM,KAAK,CAAC;AAC1C,CAAC,CAAqG;AAEtGJ,WAAW,CAACK,WAAW,GAAG,aAAa","names":["React","useDataGridRow_unstable","renderDataGridRow_unstable","useDataGridRowStyles_unstable","DataGridRow","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridRow_unstable } from './useDataGridRow';\nimport { renderDataGridRow_unstable } from './renderDataGridRow';\nimport { useDataGridRowStyles_unstable } from './useDataGridRowStyles';\nimport type { DataGridRowProps } from './DataGridRow.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridRow component\n */\nexport const DataGridRow: ForwardRefComponent<DataGridRowProps> &\n (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element) = React.forwardRef((props, ref) => {\n const state = useDataGridRow_unstable(props, ref);\n\n useDataGridRowStyles_unstable(state);\n return renderDataGridRow_unstable(state);\n}) as ForwardRefComponent<DataGridRowProps> & (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element);\n\nDataGridRow.displayName = 'DataGridRow';\n"]}
@@ -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 * as React from 'react';\nimport type { Slot, ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { ColumnDefinition } from '../../hooks';\nimport type { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\nimport type { TableSelectionCell } from '../TableSelectionCell/TableSelectionCell';\n\nexport type DataGridRowSlots = TableRowSlots & {\n /**\n * When selection is enabled on the @see DataGrid, all rows\n * will render the selection cell.\n */\n selectionCell?: Slot<typeof TableSelectionCell>;\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 CellRenderFunction = (column: ColumnDefinition<any>) => React.ReactNode;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps = Omit<TableRowProps, 'children'> &\n Omit<ComponentProps<DataGridRowSlots>, 'children'> & {\n children: CellRenderFunction;\n };\n\n/**\n * State used in rendering DataGridRow\n */\nexport type DataGridRowState = TableRowState &\n ComponentState<DataGridRowSlots> & {\n renderCell: CellRenderFunction;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n columnDefs: ColumnDefinition<any>[];\n };\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 type { Slot, ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { TableColumnDefinition } from '../../hooks';\nimport type { TableRowProps, TableRowSlots, TableRowState } from '../TableRow/TableRow.types';\nimport type { TableSelectionCell } from '../TableSelectionCell/TableSelectionCell';\n\nexport type DataGridRowSlots = TableRowSlots & {\n /**\n * When selection is enabled on the @see DataGrid, all rows\n * will render the selection cell.\n */\n selectionCell?: Slot<typeof TableSelectionCell>;\n};\n\nexport type CellRenderFunction<TItem = unknown> = (column: TableColumnDefinition<TItem>) => React.ReactNode;\n\n/**\n * DataGridRow Props\n */\nexport type DataGridRowProps<TItem = unknown> = Omit<TableRowProps, 'children'> &\n Omit<ComponentProps<DataGridRowSlots>, 'children'> & {\n children: CellRenderFunction<TItem>;\n };\n\n/**\n * State used in rendering DataGridRow\n */\nexport type DataGridRowState = TableRowState &\n ComponentState<DataGridRowSlots> & {\n renderCell: CellRenderFunction;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n columnDefs: TableColumnDefinition<any>[];\n };\n"]}
@@ -3,7 +3,7 @@ import { Space } from '@fluentui/keyboard-keys';
3
3
  import { useTableRow_unstable } from '../TableRow/useTableRow';
4
4
  import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
5
5
  import { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';
6
- import { useRowIdContext } from '../../contexts/rowIdContext';
6
+ import { useTableRowIdContext } from '../../contexts/rowIdContext';
7
7
  import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
8
8
  /**
9
9
  * Create the state required to render DataGridRow.
@@ -15,7 +15,7 @@ import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
15
15
  * @param ref - reference to root HTMLElement of DataGridRow
16
16
  */
17
17
  export const useDataGridRow_unstable = (props, ref) => {
18
- const rowId = useRowIdContext();
18
+ const rowId = useTableRowIdContext();
19
19
  const isHeader = useIsInTableHeader();
20
20
  const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);
21
21
  const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);
@@ -1 +1 @@
1
- {"version":3,"mappings":"AACA,SAASA,wBAAwB,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,2BAA2B;AACxG,SAASC,KAAK,QAAQ,yBAAyB;AAE/C,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,qBAAqB,QAAQ,gDAAgD;AACtF,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,kBAAkB,QAAQ,mCAAmC;AAEtE;;;;;;;;;AASA,OAAO,MAAMC,uBAAuB,GAAG,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;EAChH,MAAMC,KAAK,GAAGL,eAAe,EAAE;EAC/B,MAAMM,QAAQ,GAAGL,kBAAkB,EAAE;EACrC,MAAMM,UAAU,GAAGT,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACC,OAAO,CAAC;EAClE,MAAMC,UAAU,GAAGZ,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACG,cAAc,CAAC;EACzE,MAAMC,QAAQ,GAAGd,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACK,SAAS,CAACC,aAAa,CAACT,KAAK,CAAC,CAAC;EACvF,MAAMU,QAAQ,GAAGjB,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACQ,SAAS,KAAK,cAAc,CAAC;EACrF,MAAMC,UAAU,GAAGnB,2BAA2B,CAACU,GAAG,IAAG;IACnD,IAAI,CAACF,QAAQ,IAAII,UAAU,IAAIF,GAAG,CAACK,SAAS,CAACC,aAAa,CAACT,KAAK,CAAC,EAAE;MACjE,OAAOG,GAAG,CAACU,mBAAmB;;IAGhC,OAAO,MAAM;EACf,CAAC,CAAC;EACF,MAAMC,SAAS,GAAGrB,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACK,SAAS,CAACM,SAAS,CAAC;EAE7E,MAAMC,OAAO,GAAG1B,gBAAgB,CAAE2B,CAAwC,IAAI;;IAC5E,IAAIX,UAAU,IAAI,CAACJ,QAAQ,EAAE;MAC3Ba,SAAS,CAACE,CAAC,EAAEhB,KAAK,CAAC;;IAGrB,WAAK,CAACe,OAAO,+CAAbjB,KAAK,EAAWkB,CAAC,CAAC;EACpB,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG5B,gBAAgB,CAAE2B,CAA2C,IAAI;;IACjF,IAAIX,UAAU,IAAI,CAACJ,QAAQ,IAAIe,CAAC,CAACE,GAAG,KAAK3B,KAAK,IAAI,CAACH,wBAAwB,CAAC4B,CAAC,CAACG,MAAqB,CAAC,EAAE;MACpG;MACAH,CAAC,CAACI,cAAc,EAAE;MAClBN,SAAS,CAACE,CAAC,EAAEhB,KAAK,CAAC;;IAGrB,WAAK,CAACiB,SAAS,+CAAfnB,KAAK,EAAakB,CAAC,CAAC;EACtB,CAAC,CAAC;EAEF,MAAMK,SAAS,GAAG7B,oBAAoB,CACpC;IACEoB,UAAU;IACV,eAAe,EAAEP,UAAU,GAAGE,QAAQ,GAAGe,SAAS;IAClD,GAAGxB,KAAK;IACRiB,OAAO;IACPE,SAAS;IACTM,QAAQ,EAAE,IAAI;IACdC,EAAE,EAAE,KAAK;IACTC,QAAQ,EAAEf,QAAQ,IAAI,CAACT,QAAQ,GAAG,CAAC,GAAGqB;GACvC,EACDvB,GAAG,CACJ;EAED,OAAO;IACL,GAAGsB,SAAS;IACZK,UAAU,EAAE;MACV,GAAGL,SAAS,CAACK,UAAU;MACvBC,aAAa,EAAEjC;KAChB;IACDiC,aAAa,EAAErC,gBAAgB,CAACQ,KAAK,CAAC6B,aAAa,EAAE;MAAEC,QAAQ,EAAEvB;IAAU,CAAE,CAAC;IAC9EwB,UAAU,EAAE/B,KAAK,CAACyB,QAAQ;IAC1BrB;GACD;AACH,CAAC","names":["isInteractiveHTMLElement","useEventCallback","resolveShorthand","Space","useTableRow_unstable","useDataGridContext_unstable","DataGridSelectionCell","useRowIdContext","useIsInTableHeader","useDataGridRow_unstable","props","ref","rowId","isHeader","columnDefs","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","tabbable","focusMode","appearance","selectionAppearance","toggleRow","onClick","e","onKeyDown","key","target","preventDefault","baseState","undefined","children","as","tabIndex","components","selectionCell","required","renderCell"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, resolveShorthand } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\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 rowId = useRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'row_unstable');\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: null,\n as: 'div',\n tabIndex: tabbable && !isHeader ? 0 : undefined,\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n renderCell: props.children,\n columnDefs,\n };\n};\n"]}
1
+ {"version":3,"mappings":"AACA,SAASA,wBAAwB,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,2BAA2B;AACxG,SAASC,KAAK,QAAQ,yBAAyB;AAE/C,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,qBAAqB,QAAQ,gDAAgD;AACtF,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,kBAAkB,QAAQ,mCAAmC;AAEtE;;;;;;;;;AASA,OAAO,MAAMC,uBAAuB,GAAG,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;EAChH,MAAMC,KAAK,GAAGL,oBAAoB,EAAE;EACpC,MAAMM,QAAQ,GAAGL,kBAAkB,EAAE;EACrC,MAAMM,UAAU,GAAGT,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACC,OAAO,CAAC;EAClE,MAAMC,UAAU,GAAGZ,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACG,cAAc,CAAC;EACzE,MAAMC,QAAQ,GAAGd,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACK,SAAS,CAACC,aAAa,CAACT,KAAK,CAAC,CAAC;EACvF,MAAMU,QAAQ,GAAGjB,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACQ,SAAS,KAAK,cAAc,CAAC;EACrF,MAAMC,UAAU,GAAGnB,2BAA2B,CAACU,GAAG,IAAG;IACnD,IAAI,CAACF,QAAQ,IAAII,UAAU,IAAIF,GAAG,CAACK,SAAS,CAACC,aAAa,CAACT,KAAK,CAAC,EAAE;MACjE,OAAOG,GAAG,CAACU,mBAAmB;;IAGhC,OAAO,MAAM;EACf,CAAC,CAAC;EACF,MAAMC,SAAS,GAAGrB,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACK,SAAS,CAACM,SAAS,CAAC;EAE7E,MAAMC,OAAO,GAAG1B,gBAAgB,CAAE2B,CAAwC,IAAI;;IAC5E,IAAIX,UAAU,IAAI,CAACJ,QAAQ,EAAE;MAC3Ba,SAAS,CAACE,CAAC,EAAEhB,KAAK,CAAC;;IAGrB,WAAK,CAACe,OAAO,+CAAbjB,KAAK,EAAWkB,CAAC,CAAC;EACpB,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG5B,gBAAgB,CAAE2B,CAA2C,IAAI;;IACjF,IAAIX,UAAU,IAAI,CAACJ,QAAQ,IAAIe,CAAC,CAACE,GAAG,KAAK3B,KAAK,IAAI,CAACH,wBAAwB,CAAC4B,CAAC,CAACG,MAAqB,CAAC,EAAE;MACpG;MACAH,CAAC,CAACI,cAAc,EAAE;MAClBN,SAAS,CAACE,CAAC,EAAEhB,KAAK,CAAC;;IAGrB,WAAK,CAACiB,SAAS,+CAAfnB,KAAK,EAAakB,CAAC,CAAC;EACtB,CAAC,CAAC;EAEF,MAAMK,SAAS,GAAG7B,oBAAoB,CACpC;IACEoB,UAAU;IACV,eAAe,EAAEP,UAAU,GAAGE,QAAQ,GAAGe,SAAS;IAClD,GAAGxB,KAAK;IACRiB,OAAO;IACPE,SAAS;IACTM,QAAQ,EAAE,IAAI;IACdC,EAAE,EAAE,KAAK;IACTC,QAAQ,EAAEf,QAAQ,IAAI,CAACT,QAAQ,GAAG,CAAC,GAAGqB;GACvC,EACDvB,GAAG,CACJ;EAED,OAAO;IACL,GAAGsB,SAAS;IACZK,UAAU,EAAE;MACV,GAAGL,SAAS,CAACK,UAAU;MACvBC,aAAa,EAAEjC;KAChB;IACDiC,aAAa,EAAErC,gBAAgB,CAACQ,KAAK,CAAC6B,aAAa,EAAE;MAAEC,QAAQ,EAAEvB;IAAU,CAAE,CAAC;IAC9EwB,UAAU,EAAE/B,KAAK,CAACyB,QAAQ;IAC1BrB;GACD;AACH,CAAC","names":["isInteractiveHTMLElement","useEventCallback","resolveShorthand","Space","useTableRow_unstable","useDataGridContext_unstable","DataGridSelectionCell","useTableRowIdContext","useIsInTableHeader","useDataGridRow_unstable","props","ref","rowId","isHeader","columnDefs","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","tabbable","focusMode","appearance","selectionAppearance","toggleRow","onClick","e","onKeyDown","key","target","preventDefault","baseState","undefined","children","as","tabIndex","components","selectionCell","required","renderCell"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, resolveShorthand } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\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 rowId = useTableRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'row_unstable');\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: null,\n as: 'div',\n tabIndex: tabbable && !isHeader ? 0 : undefined,\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n renderCell: props.children,\n columnDefs,\n };\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { useEventCallback } from '@fluentui/react-utilities';
2
2
  import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
3
- import { useRowIdContext } from '../../contexts/rowIdContext';
3
+ import { useTableRowIdContext } from '../../contexts/rowIdContext';
4
4
  import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
5
5
  import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';
6
6
  /**
@@ -14,7 +14,7 @@ import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSe
14
14
  */
15
15
  export const useDataGridSelectionCell_unstable = (props, ref) => {
16
16
  const isHeader = useIsInTableHeader();
17
- const rowId = useRowIdContext();
17
+ const rowId = useTableRowIdContext();
18
18
  const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);
19
19
  const checked = useDataGridContext_unstable(ctx => {
20
20
  if (isHeader && ctx.selection.selectionMode === 'multiselect') {