@fluentui/react-table 9.0.0-alpha.1 → 9.0.0-alpha.3

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 (195) hide show
  1. package/CHANGELOG.json +168 -4
  2. package/CHANGELOG.md +43 -5
  3. package/dist/index.d.ts +318 -21
  4. package/lib/TableCellActions.js +2 -0
  5. package/lib/TableCellActions.js.map +1 -0
  6. package/lib/TableCellLayout.js +2 -0
  7. package/lib/TableCellLayout.js.map +1 -0
  8. package/lib/TableCellPrimaryLayout.js +2 -0
  9. package/lib/TableCellPrimaryLayout.js.map +1 -0
  10. package/lib/TableSelectionCell.js +2 -0
  11. package/lib/TableSelectionCell.js.map +1 -0
  12. package/lib/components/Table/Table.types.js.map +1 -1
  13. package/lib/components/Table/useTableContextValues.js +7 -5
  14. package/lib/components/Table/useTableContextValues.js.map +1 -1
  15. package/lib/components/Table/useTableStyles.js +7 -2
  16. package/lib/components/Table/useTableStyles.js.map +1 -1
  17. package/lib/components/TableBody/useTableBody.js +3 -1
  18. package/lib/components/TableBody/useTableBody.js.map +1 -1
  19. package/lib/components/TableBody/useTableBodyStyles.js +12 -2
  20. package/lib/components/TableBody/useTableBodyStyles.js.map +1 -1
  21. package/lib/components/TableCell/TableCell.types.js.map +1 -1
  22. package/lib/components/TableCell/renderTableCell.js +2 -4
  23. package/lib/components/TableCell/renderTableCell.js.map +1 -1
  24. package/lib/components/TableCell/useTableCell.js +5 -5
  25. package/lib/components/TableCell/useTableCell.js.map +1 -1
  26. package/lib/components/TableCell/useTableCellStyles.js +6 -20
  27. package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
  28. package/lib/components/TableCellActions/TableCellActions.js +15 -0
  29. package/lib/components/TableCellActions/TableCellActions.js.map +1 -0
  30. package/lib/components/TableCellActions/TableCellActions.types.js +2 -0
  31. package/lib/components/TableCellActions/TableCellActions.types.js.map +1 -0
  32. package/lib/components/TableCellActions/index.js +6 -0
  33. package/lib/components/TableCellActions/index.js.map +1 -0
  34. package/lib/components/TableCellActions/renderTableCellActions.js +16 -0
  35. package/lib/components/TableCellActions/renderTableCellActions.js.map +1 -0
  36. package/lib/components/TableCellActions/useTableCellActions.js +27 -0
  37. package/lib/components/TableCellActions/useTableCellActions.js.map +1 -0
  38. package/lib/components/TableCellActions/useTableCellActionsStyles.js +40 -0
  39. package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
  40. package/lib/components/TableCellLayout/TableCellLayout.js +15 -0
  41. package/lib/components/TableCellLayout/TableCellLayout.js.map +1 -0
  42. package/lib/components/TableCellLayout/TableCellLayout.types.js +2 -0
  43. package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
  44. package/lib/components/TableCellLayout/index.js +6 -0
  45. package/lib/components/TableCellLayout/index.js.map +1 -0
  46. package/lib/components/TableCellLayout/renderTableCellLayout.js +19 -0
  47. package/lib/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
  48. package/lib/components/TableCellLayout/useTableCellLayout.js +36 -0
  49. package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -0
  50. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +74 -0
  51. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
  52. package/lib/components/TableHeader/useTableHeader.js +4 -2
  53. package/lib/components/TableHeader/useTableHeader.js.map +1 -1
  54. package/lib/components/TableHeader/useTableHeaderStyles.js +12 -2
  55. package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -1
  56. package/lib/components/TableHeaderCell/useTableHeaderCell.js +4 -2
  57. package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  58. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +11 -9
  59. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
  60. package/lib/components/TableRow/useTableRow.js +4 -2
  61. package/lib/components/TableRow/useTableRow.js.map +1 -1
  62. package/lib/components/TableRow/useTableRowStyles.js +11 -7
  63. package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
  64. package/lib/components/TableSelectionCell/TableSelectionCell.js +15 -0
  65. package/lib/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
  66. package/lib/components/TableSelectionCell/TableSelectionCell.types.js +2 -0
  67. package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
  68. package/lib/components/TableSelectionCell/index.js +6 -0
  69. package/lib/components/TableSelectionCell/index.js.map +1 -0
  70. package/lib/components/TableSelectionCell/renderTableSelectionCell.js +17 -0
  71. package/lib/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
  72. package/lib/components/TableSelectionCell/useTableSelectionCell.js +42 -0
  73. package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
  74. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +55 -0
  75. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
  76. package/lib/contexts/tableContext.js +7 -3
  77. package/lib/contexts/tableContext.js.map +1 -1
  78. package/lib/hooks/index.js +3 -0
  79. package/lib/hooks/index.js.map +1 -0
  80. package/lib/hooks/selectionManager.js +89 -0
  81. package/lib/hooks/selectionManager.js.map +1 -0
  82. package/lib/hooks/types.js +2 -0
  83. package/lib/hooks/types.js.map +1 -0
  84. package/lib/hooks/useSelection.js +47 -0
  85. package/lib/hooks/useSelection.js.map +1 -0
  86. package/lib/hooks/useSort.js +72 -0
  87. package/lib/hooks/useSort.js.map +1 -0
  88. package/lib/hooks/useTable.js +87 -0
  89. package/lib/hooks/useTable.js.map +1 -0
  90. package/lib/index.js +4 -0
  91. package/lib/index.js.map +1 -1
  92. package/lib/navigationModes/cell.js +250 -0
  93. package/lib/navigationModes/cell.js.map +1 -0
  94. package/lib/navigationModes/composite.js +208 -0
  95. package/lib/navigationModes/composite.js.map +1 -0
  96. package/lib/navigationModes/index.js +3 -0
  97. package/lib/navigationModes/index.js.map +1 -0
  98. package/lib/navigationModes/useNavigationMode.js +42 -0
  99. package/lib/navigationModes/useNavigationMode.js.map +1 -0
  100. package/lib-commonjs/TableCellActions.js +10 -0
  101. package/lib-commonjs/TableCellActions.js.map +1 -0
  102. package/lib-commonjs/TableCellLayout.js +10 -0
  103. package/lib-commonjs/TableCellLayout.js.map +1 -0
  104. package/lib-commonjs/TableCellPrimaryLayout.js +10 -0
  105. package/lib-commonjs/TableCellPrimaryLayout.js.map +1 -0
  106. package/lib-commonjs/TableSelectionCell.js +10 -0
  107. package/lib-commonjs/TableSelectionCell.js.map +1 -0
  108. package/lib-commonjs/components/Table/useTableContextValues.js +8 -5
  109. package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -1
  110. package/lib-commonjs/components/Table/useTableStyles.js +8 -2
  111. package/lib-commonjs/components/Table/useTableStyles.js.map +1 -1
  112. package/lib-commonjs/components/TableBody/useTableBody.js +3 -1
  113. package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -1
  114. package/lib-commonjs/components/TableBody/useTableBodyStyles.js +10 -1
  115. package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -1
  116. package/lib-commonjs/components/TableCell/renderTableCell.js +2 -4
  117. package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -1
  118. package/lib-commonjs/components/TableCell/useTableCell.js +4 -4
  119. package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
  120. package/lib-commonjs/components/TableCell/useTableCellStyles.js +6 -20
  121. package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
  122. package/lib-commonjs/components/TableCellActions/TableCellActions.js +26 -0
  123. package/lib-commonjs/components/TableCellActions/TableCellActions.js.map +1 -0
  124. package/lib-commonjs/components/TableCellActions/TableCellActions.types.js +6 -0
  125. package/lib-commonjs/components/TableCellActions/TableCellActions.types.js.map +1 -0
  126. package/lib-commonjs/components/TableCellActions/index.js +18 -0
  127. package/lib-commonjs/components/TableCellActions/index.js.map +1 -0
  128. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js +27 -0
  129. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js.map +1 -0
  130. package/lib-commonjs/components/TableCellActions/useTableCellActions.js +38 -0
  131. package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -0
  132. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +51 -0
  133. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
  134. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js +26 -0
  135. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js.map +1 -0
  136. package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js +6 -0
  137. package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
  138. package/lib-commonjs/components/TableCellLayout/index.js +18 -0
  139. package/lib-commonjs/components/TableCellLayout/index.js.map +1 -0
  140. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js +30 -0
  141. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
  142. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +46 -0
  143. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -0
  144. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +85 -0
  145. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
  146. package/lib-commonjs/components/TableHeader/useTableHeader.js +4 -2
  147. package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
  148. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +11 -1
  149. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -1
  150. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +4 -2
  151. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  152. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +11 -9
  153. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
  154. package/lib-commonjs/components/TableRow/useTableRow.js +4 -2
  155. package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
  156. package/lib-commonjs/components/TableRow/useTableRowStyles.js +12 -7
  157. package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
  158. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js +26 -0
  159. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
  160. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js +6 -0
  161. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
  162. package/lib-commonjs/components/TableSelectionCell/index.js +18 -0
  163. package/lib-commonjs/components/TableSelectionCell/index.js.map +1 -0
  164. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js +28 -0
  165. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
  166. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +56 -0
  167. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
  168. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +65 -0
  169. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
  170. package/lib-commonjs/contexts/tableContext.js +7 -3
  171. package/lib-commonjs/contexts/tableContext.js.map +1 -1
  172. package/lib-commonjs/hooks/index.js +12 -0
  173. package/lib-commonjs/hooks/index.js.map +1 -0
  174. package/lib-commonjs/hooks/selectionManager.js +98 -0
  175. package/lib-commonjs/hooks/selectionManager.js.map +1 -0
  176. package/lib-commonjs/hooks/types.js +6 -0
  177. package/lib-commonjs/hooks/types.js.map +1 -0
  178. package/lib-commonjs/hooks/useSelection.js +59 -0
  179. package/lib-commonjs/hooks/useSelection.js.map +1 -0
  180. package/lib-commonjs/hooks/useSort.js +82 -0
  181. package/lib-commonjs/hooks/useSort.js.map +1 -0
  182. package/lib-commonjs/hooks/useTable.js +99 -0
  183. package/lib-commonjs/hooks/useTable.js.map +1 -0
  184. package/lib-commonjs/index.js +110 -1
  185. package/lib-commonjs/index.js.map +1 -1
  186. package/lib-commonjs/navigationModes/cell.js +259 -0
  187. package/lib-commonjs/navigationModes/cell.js.map +1 -0
  188. package/lib-commonjs/navigationModes/composite.js +217 -0
  189. package/lib-commonjs/navigationModes/composite.js.map +1 -0
  190. package/lib-commonjs/navigationModes/index.js +16 -0
  191. package/lib-commonjs/navigationModes/index.js.map +1 -0
  192. package/lib-commonjs/navigationModes/useNavigationMode.js +55 -0
  193. package/lib-commonjs/navigationModes/useNavigationMode.js.map +1 -0
  194. package/package.json +9 -9
  195. package/dist/tsdoc-metadata.json +0 -11
package/dist/index.d.ts CHANGED
@@ -1,17 +1,29 @@
1
1
  /// <reference types="react" />
2
2
 
3
3
  import { ARIAButtonSlotProps } from '@fluentui/react-aria';
4
+ import type { Checkbox } from '@fluentui/react-checkbox';
5
+ import type { CheckboxProps } from '@fluentui/react-checkbox';
4
6
  import type { ComponentProps } from '@fluentui/react-utilities';
5
7
  import type { ComponentState } from '@fluentui/react-utilities';
6
- import { ContextSelector } from '@fluentui/react-context-selector';
7
- import { FC } from 'react';
8
8
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
9
- import { Provider } from 'react';
10
- import { ProviderProps } from 'react';
11
9
  import * as React_2 from 'react';
12
10
  import type { Slot } from '@fluentui/react-utilities';
13
11
  import type { SlotClassNames } from '@fluentui/react-utilities';
14
12
 
13
+ export declare interface ColumnDefinition<TItem> {
14
+ columnId: ColumnId;
15
+ compare?: (a: TItem, b: TItem) => number;
16
+ }
17
+
18
+ export declare type ColumnId = string | number;
19
+
20
+ declare type OnSelectionChangeCallback = (selectedItems: Set<RowId>) => void;
21
+
22
+ declare type OnSortChangeCallback = (state: {
23
+ sortColumn: ColumnId | undefined;
24
+ sortDirection: SortDirection;
25
+ }) => void;
26
+
15
27
  /**
16
28
  * Render the final JSX of Table
17
29
  */
@@ -27,6 +39,16 @@ export declare const renderTableBody_unstable: (state: TableBodyState) => JSX.El
27
39
  */
28
40
  export declare const renderTableCell_unstable: (state: TableCellState) => JSX.Element;
29
41
 
42
+ /**
43
+ * Render the final JSX of TableCellActions
44
+ */
45
+ export declare const renderTableCellActions_unstable: (state: TableCellActionsState) => JSX.Element;
46
+
47
+ /**
48
+ * Render the final JSX of TableCellLayout
49
+ */
50
+ export declare const renderTableCellLayout_unstable: (state: TableCellLayoutState) => JSX.Element;
51
+
30
52
  /**
31
53
  * Render the final JSX of TableHeader
32
54
  */
@@ -42,12 +64,37 @@ export declare const renderTableHeaderCell_unstable: (state: TableHeaderCellStat
42
64
  */
43
65
  export declare const renderTableRow_unstable: (state: TableRowState) => JSX.Element;
44
66
 
67
+ /**
68
+ * Render the final JSX of TableSelectionCell
69
+ */
70
+ export declare const renderTableSelectionCell_unstable: (state: TableSelectionCellState) => JSX.Element;
71
+
72
+ declare type RowEnhancer<TItem, TRowState extends RowState<TItem> = RowState<TItem>> = (row: RowState<TItem>, state: {
73
+ selection: TableSelectionState;
74
+ sort: TableSortState;
75
+ }) => TRowState;
76
+
77
+ export declare type RowId = string | number;
78
+
79
+ export declare interface RowState<TItem> {
80
+ /**
81
+ * User provided data
82
+ */
83
+ item: TItem;
84
+ /**
85
+ * The row id, defaults to index position in the collection
86
+ */
87
+ rowId: RowId;
88
+ }
89
+
90
+ declare type SelectionMode_2 = 'single' | 'multiselect';
91
+
45
92
  export declare type SortDirection = 'ascending' | 'descending';
46
93
 
47
- declare type SortState = {
48
- sortColumn: string | undefined;
49
- sortDirection: 'ascending' | 'descending';
50
- };
94
+ declare interface SortState {
95
+ sortColumn: ColumnId | undefined;
96
+ sortDirection: SortDirection;
97
+ }
51
98
 
52
99
  /**
53
100
  * Table component - TODO: add more docs
@@ -82,10 +129,76 @@ export declare type TableBodyState = ComponentState<TableBodySlots>;
82
129
  */
83
130
  export declare const TableCell: ForwardRefComponent<TableCellProps>;
84
131
 
132
+ /**
133
+ * TableCellActions component - TODO: add more docs
134
+ */
135
+ export declare const TableCellActions: ForwardRefComponent<TableCellActionsProps>;
136
+
137
+ export declare const tableCellActionsClassNames: SlotClassNames<TableCellActionsSlots>;
138
+
139
+ /**
140
+ * TableCellActions Props
141
+ */
142
+ export declare type TableCellActionsProps = ComponentProps<TableCellActionsSlots> & {
143
+ /**
144
+ * When true, the actions are always visible regardless of row hover.
145
+ * Can be useful keeping the actions visible when a popout surface is opened.
146
+ */
147
+ visible?: boolean;
148
+ };
149
+
150
+ export declare type TableCellActionsSlots = {
151
+ root: Slot<'div'>;
152
+ };
153
+
154
+ /**
155
+ * State used in rendering TableCellActions
156
+ */
157
+ export declare type TableCellActionsState = ComponentState<TableCellActionsSlots> & Pick<Required<TableCellActionsProps>, 'visible'>;
158
+
85
159
  export declare const tableCellClassName = "fui-TableCell";
86
160
 
87
161
  export declare const tableCellClassNames: SlotClassNames<TableCellSlots>;
88
162
 
163
+ /**
164
+ * TableCellLayout component - TODO: add more docs
165
+ */
166
+ export declare const TableCellLayout: ForwardRefComponent<TableCellLayoutProps>;
167
+
168
+ export declare const tableCellLayoutClassNames: SlotClassNames<TableCellLayoutSlots>;
169
+
170
+ /**
171
+ * TableCellLayout Props
172
+ */
173
+ export declare type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>> & {
174
+ appearance?: 'primary';
175
+ };
176
+
177
+ export declare type TableCellLayoutSlots = {
178
+ root: Slot<'div'>;
179
+ /**
180
+ * Slot for an icon or other visual element
181
+ */
182
+ media: Slot<'span'>;
183
+ /**
184
+ * Main text for the table cell. Children of the root slot are automatically rendered here
185
+ */
186
+ main: Slot<'span'>;
187
+ /**
188
+ * Secondary text that describes or complements the main text
189
+ */
190
+ description: Slot<'span'>;
191
+ /**
192
+ * A layout wrapper for the main and description slots
193
+ */
194
+ wrapper: Slot<'div'>;
195
+ };
196
+
197
+ /**
198
+ * State used in rendering TableCellLayout
199
+ */
200
+ export declare type TableCellLayoutState = ComponentState<TableCellLayoutSlots> & Pick<TableCellLayoutProps, 'appearance'>;
201
+
89
202
  /**
90
203
  * TableCell Props
91
204
  */
@@ -93,7 +206,6 @@ export declare type TableCellProps = ComponentProps<TableCellSlots> & {};
93
206
 
94
207
  export declare type TableCellSlots = {
95
208
  root: Slot<'td', 'div'>;
96
- media?: Slot<'span'>;
97
209
  };
98
210
 
99
211
  /**
@@ -105,7 +217,7 @@ export declare const tableClassName = "fui-Table";
105
217
 
106
218
  export declare const tableClassNames: SlotClassNames<TableSlots>;
107
219
 
108
- export declare const TableContextProvider: Provider<TableContextValue | undefined> & FC<ProviderProps<TableContextValue | undefined>>;
220
+ export declare const TableContextProvider: React_2.Provider<TableContextValue | undefined>;
109
221
 
110
222
  export declare type TableContextValue = {
111
223
  size: 'small' | 'smaller' | 'medium';
@@ -175,16 +287,7 @@ export declare type TableHeaderState = ComponentState<TableHeaderSlots>;
175
287
  /**
176
288
  * Table Props
177
289
  */
178
- export declare type TableProps = ComponentProps<TableSlots> & {} & Partial<TableContextValue> & {
179
- /**
180
- * Called when the sorted column changes
181
- */
182
- onSortColumnChange?: (e: React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement>, data: {
183
- sortState: SortState;
184
- }) => void;
185
- sortState?: SortState;
186
- defaultSortState?: SortState;
187
- };
290
+ export declare type TableProps = ComponentProps<TableSlots> & Partial<TableContextValue>;
188
291
 
189
292
  /**
190
293
  * TableRow component - TODO: add more docs
@@ -211,15 +314,129 @@ export declare type TableRowState = ComponentState<TableRowSlots> & {
211
314
  size: TableState['size'];
212
315
  };
213
316
 
317
+ /**
318
+ * TableSelectionCell component - TODO: add more docs
319
+ */
320
+ export declare const TableSelectionCell: ForwardRefComponent<TableSelectionCellProps>;
321
+
322
+ export declare const tableSelectionCellClassNames: SlotClassNames<TableSelectionCellSlots>;
323
+
324
+ /**
325
+ * TableSelectionCell Props
326
+ */
327
+ export declare type TableSelectionCellProps = ComponentProps<Partial<Omit<TableSelectionCellSlots, 'media'>>> & {
328
+ /**
329
+ * A table can have two kinds of selection modes
330
+ */
331
+ type?: 'checkbox' | 'radio';
332
+ checked?: CheckboxProps['checked'];
333
+ };
334
+
335
+ export declare type TableSelectionCellSlots = {
336
+ /**
337
+ * Selection indicator if selection type is checkbox
338
+ */
339
+ checkboxIndicator: Slot<typeof Checkbox>;
340
+ /**
341
+ * Selection indicator if selection type is radio
342
+ */
343
+ radioIndicator: Slot<'span'>;
344
+ } & Pick<TableCellSlots, 'root'>;
345
+
346
+ /**
347
+ * State used in rendering TableSelectionCell
348
+ */
349
+ export declare type TableSelectionCellState = ComponentState<TableSelectionCellSlots> & Pick<Required<TableSelectionCellProps>, 'type' | 'checked'>;
350
+
351
+ export declare interface TableSelectionState {
352
+ /**
353
+ * Clears all selected rows
354
+ */
355
+ clearRows: () => void;
356
+ /**
357
+ * Selects single row
358
+ */
359
+ selectRow: (rowId: RowId) => void;
360
+ /**
361
+ * De-selects single row
362
+ */
363
+ deselectRow: (rowId: RowId) => void;
364
+ /**
365
+ * Toggle selection of all rows
366
+ */
367
+ toggleAllRows: () => void;
368
+ /**
369
+ * Toggle selection of single row
370
+ */
371
+ toggleRow: (rowId: RowId) => void;
372
+ /**
373
+ * Collection of row ids corresponding to selected rows
374
+ */
375
+ selectedRows: RowId[];
376
+ /**
377
+ * Whether all rows are selected
378
+ */
379
+ allRowsSelected: boolean;
380
+ /**
381
+ * Whether some rows are selected
382
+ */
383
+ someRowsSelected: boolean;
384
+ /**
385
+ * Checks if a given rowId is selected
386
+ */
387
+ isRowSelected: (rowId: RowId) => boolean;
388
+ }
389
+
214
390
  export declare type TableSlots = {
215
391
  root: Slot<'table', 'div'>;
216
392
  };
217
393
 
394
+ export declare interface TableSortState {
395
+ /**
396
+ * Current sort direction
397
+ */
398
+ sortDirection: SortDirection;
399
+ /**
400
+ * Column id of the currently sorted column
401
+ */
402
+ sortColumn: ColumnId | undefined;
403
+ /**
404
+ * Set the sort direction for the specified column
405
+ */
406
+ setColumnSort: (columnId: ColumnId, sortDirection: SortDirection) => void;
407
+ /**
408
+ * Toggles the sort direction for specified column
409
+ */
410
+ toggleColumnSort: (columnId: ColumnId) => void;
411
+ /**
412
+ * Returns the sort direction if a column is sorted,
413
+ * returns undefined if the column is not sorted
414
+ */
415
+ getSortDirection: (columnId: ColumnId) => SortDirection | undefined;
416
+ }
417
+
218
418
  /**
219
419
  * State used in rendering Table
220
420
  */
221
421
  export declare type TableState = ComponentState<TableSlots> & Pick<Required<TableProps>, 'size' | 'noNativeElements'> & TableContextValue;
222
422
 
423
+ declare interface TableState_2<TItem, TRowState extends RowState<TItem> = RowState<TItem>> {
424
+ /**
425
+ * The row data for rendering
426
+ */
427
+ rows: TRowState[];
428
+ /**
429
+ * State and actions to manage row selection
430
+ */
431
+ selection: TableSelectionState;
432
+ /**
433
+ * State and actions to manage row sorting
434
+ */
435
+ sort: TableSortState;
436
+ }
437
+
438
+ export declare function useTable<TItem, TRowState extends RowState<TItem> = RowState<TItem>>(options: UseTableOptions<TItem, TRowState>): TableState_2<TItem, TRowState>;
439
+
223
440
  /**
224
441
  * Create the state required to render Table.
225
442
  *
@@ -258,12 +475,44 @@ export declare const useTableBodyStyles_unstable: (state: TableBodyState) => Tab
258
475
  */
259
476
  export declare const useTableCell_unstable: (props: TableCellProps, ref: React_2.Ref<HTMLElement>) => TableCellState;
260
477
 
478
+ /**
479
+ * Create the state required to render TableCellActions.
480
+ *
481
+ * The returned state can be modified with hooks such as useTableCellActionsStyles_unstable,
482
+ * before being passed to renderTableCellActions_unstable.
483
+ *
484
+ * @param props - props from this instance of TableCellActions
485
+ * @param ref - reference to root HTMLElement of TableCellActions
486
+ */
487
+ export declare const useTableCellActions_unstable: (props: TableCellActionsProps, ref: React_2.Ref<HTMLElement>) => TableCellActionsState;
488
+
489
+ /**
490
+ * Apply styling to the TableCellActions slots based on the state
491
+ */
492
+ export declare const useTableCellActionsStyles_unstable: (state: TableCellActionsState) => TableCellActionsState;
493
+
494
+ /**
495
+ * Create the state required to render TableCellLayout.
496
+ *
497
+ * The returned state can be modified with hooks such as useTableCellLayoutStyles_unstable,
498
+ * before being passed to renderTableCellLayout_unstable.
499
+ *
500
+ * @param props - props from this instance of TableCellLayout
501
+ * @param ref - reference to root HTMLElement of TableCellLayout
502
+ */
503
+ export declare const useTableCellLayout_unstable: (props: TableCellLayoutProps, ref: React_2.Ref<HTMLElement>) => TableCellLayoutState;
504
+
505
+ /**
506
+ * Apply styling to the TableCellLayout slots based on the state
507
+ */
508
+ export declare const useTableCellLayoutStyles_unstable: (state: TableCellLayoutState) => TableCellLayoutState;
509
+
261
510
  /**
262
511
  * Apply styling to the TableCell slots based on the state
263
512
  */
264
513
  export declare const useTableCellStyles_unstable: (state: TableCellState) => TableCellState;
265
514
 
266
- export declare const useTableContext: <T>(selector: ContextSelector<TableContextValue, T>) => T;
515
+ export declare const useTableContext: () => TableContextValue;
267
516
 
268
517
  /**
269
518
  * Create the state required to render TableHeader.
@@ -297,6 +546,38 @@ export declare const useTableHeaderCellStyles_unstable: (state: TableHeaderCellS
297
546
  */
298
547
  export declare const useTableHeaderStyles_unstable: (state: TableHeaderState) => TableHeaderState;
299
548
 
549
+ export declare interface UseTableOptions<TItem, TRowState extends RowState<TItem> = RowState<TItem>> {
550
+ columns: ColumnDefinition<TItem>[];
551
+ items: TItem[];
552
+ selectionMode?: SelectionMode_2;
553
+ /**
554
+ * Used in uncontrolled mode to set initial selected rows on mount
555
+ */
556
+ defaultSelectedRows?: Set<RowId>;
557
+ /**
558
+ * Used to control row selection
559
+ */
560
+ selectedRows?: Set<RowId>;
561
+ /**
562
+ * Called when selection changes
563
+ */
564
+ onSelectionChange?: OnSelectionChangeCallback;
565
+ /**
566
+ * Used to control sorting
567
+ */
568
+ sortState?: SortState;
569
+ /**
570
+ * Used in uncontrolled mode to set initial sort column and direction on mount
571
+ */
572
+ defaultSortState?: SortState;
573
+ /**
574
+ * Called when sort changes
575
+ */
576
+ onSortChange?: OnSortChangeCallback;
577
+ getRowId?: (item: TItem) => RowId;
578
+ rowEnhancer?: RowEnhancer<TItem, TRowState>;
579
+ }
580
+
300
581
  /**
301
582
  * Create the state required to render TableRow.
302
583
  *
@@ -313,6 +594,22 @@ export declare const useTableRow_unstable: (props: TableRowProps, ref: React_2.R
313
594
  */
314
595
  export declare const useTableRowStyles_unstable: (state: TableRowState) => TableRowState;
315
596
 
597
+ /**
598
+ * Create the state required to render TableSelectionCell.
599
+ *
600
+ * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,
601
+ * before being passed to renderTableSelectionCell_unstable.
602
+ *
603
+ * @param props - props from this instance of TableSelectionCell
604
+ * @param ref - reference to root HTMLElement of TableSelectionCell
605
+ */
606
+ export declare const useTableSelectionCell_unstable: (props: TableSelectionCellProps, ref: React_2.Ref<HTMLElement>) => TableSelectionCellState;
607
+
608
+ /**
609
+ * Apply styling to the TableSelectionCell slots based on the state
610
+ */
611
+ export declare const useTableSelectionCellStyles_unstable: (state: TableSelectionCellState) => TableSelectionCellState;
612
+
316
613
  /**
317
614
  * Apply styling to the Table slots based on the state
318
615
  */
@@ -0,0 +1,2 @@
1
+ export * from './components/TableCellActions/index';
2
+ //# sourceMappingURL=TableCellActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCellActions.js","sourceRoot":"../src/","sources":["TableCellActions.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC","sourcesContent":["export * from './components/TableCellActions/index';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components/TableCellLayout/index';
2
+ //# sourceMappingURL=TableCellLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCellLayout.js","sourceRoot":"../src/","sources":["TableCellLayout.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC","sourcesContent":["export * from './components/TableCellLayout/index';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components/TableCellLayout/index';
2
+ //# sourceMappingURL=TableCellPrimaryLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableCellPrimaryLayout.js","sourceRoot":"../src/","sources":["TableCellPrimaryLayout.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC","sourcesContent":["export * from './components/TableCellLayout/index';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components/TableSelectionCell/index';
2
+ //# sourceMappingURL=TableSelectionCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableSelectionCell.js","sourceRoot":"../src/","sources":["TableSelectionCell.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './components/TableSelectionCell/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.types.js","sourceRoot":"../src/","sources":["components/Table/Table.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type TableSlots = {\n root: Slot<'table', 'div'>;\n};\n\nexport type TableContextValue = {\n size: 'small' | 'smaller' | 'medium';\n\n noNativeElements: boolean;\n\n sortable: boolean;\n};\n\nexport type SortDirection = 'ascending' | 'descending';\nexport type SortState = {\n sortColumn: string | undefined;\n sortDirection: 'ascending' | 'descending';\n};\n\nexport type TableContextValues = {\n table: TableContextValue;\n};\n\n/**\n * Table Props\n */\nexport type TableProps = ComponentProps<TableSlots> & {} & Partial<TableContextValue> & {\n /**\n * Called when the sorted column changes\n */\n onSortColumnChange?: (\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n data: { sortState: SortState },\n ) => void;\n\n sortState?: SortState;\n\n defaultSortState?: SortState;\n };\n\n/**\n * State used in rendering Table\n */\nexport type TableState = ComponentState<TableSlots> &\n Pick<Required<TableProps>, 'size' | 'noNativeElements'> &\n TableContextValue;\n"]}
1
+ {"version":3,"file":"Table.types.js","sourceRoot":"../src/","sources":["components/Table/Table.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableSlots = {\n root: Slot<'table', 'div'>;\n};\n\nexport type TableContextValue = {\n size: 'small' | 'smaller' | 'medium';\n\n noNativeElements: boolean;\n\n sortable: boolean;\n};\n\nexport type SortDirection = 'ascending' | 'descending';\n\nexport type TableContextValues = {\n table: TableContextValue;\n};\n\n/**\n * Table Props\n */\nexport type TableProps = ComponentProps<TableSlots> & Partial<TableContextValue>;\n\n/**\n * State used in rendering Table\n */\nexport type TableState = ComponentState<TableSlots> &\n Pick<Required<TableProps>, 'size' | 'noNativeElements'> &\n TableContextValue;\n"]}
@@ -1,15 +1,17 @@
1
+ import * as React from 'react';
1
2
  export function useTableContextValues_unstable(state) {
2
3
  const {
3
4
  size,
4
5
  noNativeElements,
5
6
  sortable
6
7
  } = state;
8
+ const tableContext = React.useMemo(() => ({
9
+ noNativeElements,
10
+ size,
11
+ sortable
12
+ }), [noNativeElements, size, sortable]);
7
13
  return {
8
- table: {
9
- noNativeElements,
10
- size,
11
- sortable
12
- }
14
+ table: tableContext
13
15
  };
14
16
  }
15
17
  //# sourceMappingURL=useTableContextValues.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Table/useTableContextValues.ts"],"names":[],"mappings":"AAEA,OAAM,SAAU,8BAAV,CAAyC,KAAzC,EAA0D;EAC9D,MAAM;IAAE,IAAF;IAAQ,gBAAR;IAA0B;EAA1B,IAAuC,KAA7C;EAEA,OAAO;IACL,KAAK,EAAE;MACL,gBADK;MAEL,IAFK;MAGL;IAHK;EADF,CAAP;AAOD","sourcesContent":["import { TableContextValues, TableState } from './Table.types';\n\nexport function useTableContextValues_unstable(state: TableState): TableContextValues {\n const { size, noNativeElements, sortable } = state;\n\n return {\n table: {\n noNativeElements,\n size,\n sortable,\n },\n };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Table/useTableContextValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,OAAM,SAAU,8BAAV,CAAyC,KAAzC,EAA0D;EAC9D,MAAM;IAAE,IAAF;IAAQ,gBAAR;IAA0B;EAA1B,IAAuC,KAA7C;EAEA,MAAM,YAAY,GAAG,KAAK,CAAC,OAAN,CACnB,OAAO;IACL,gBADK;IAEL,IAFK;IAGL;EAHK,CAAP,CADmB,EAMnB,CAAC,gBAAD,EAAmB,IAAnB,EAAyB,QAAzB,CANmB,CAArB;EASA,OAAO;IACL,KAAK,EAAE;EADF,CAAP;AAGD","sourcesContent":["import * as React from 'react';\nimport { TableContextValues, TableState } from './Table.types';\n\nexport function useTableContextValues_unstable(state: TableState): TableContextValues {\n const { size, noNativeElements, sortable } = state;\n\n const tableContext = React.useMemo(\n () => ({\n noNativeElements,\n size,\n sortable,\n }),\n [noNativeElements, size, sortable],\n );\n\n return {\n table: tableContext,\n };\n}\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,5 @@
1
1
  import { __styles, mergeClasses } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
2
3
  export const tableClassName = 'fui-Table';
3
4
  export const tableClassNames = {
4
5
  root: 'fui-Table'
@@ -9,10 +10,14 @@ export const tableClassNames = {
9
10
 
10
11
  const useStyles = /*#__PURE__*/__styles({
11
12
  "root": {
12
- "a9b677": "fly5x3f"
13
+ "ha4doy": "fmrv4ls",
14
+ "po53p8": "fgkb47j",
15
+ "a9b677": "fly5x3f",
16
+ "mc9l5x": "f1w4nmp0",
17
+ "De3pzq": "fxugw4r"
13
18
  }
14
19
  }, {
15
- "d": [".fly5x3f{width:100%;}"]
20
+ "d": [".fmrv4ls{vertical-align:middle;}", ".fgkb47j{border-collapse:collapse;}", ".fly5x3f{width:100%;}", ".f1w4nmp0{display:table;}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}"]
16
21
  });
17
22
  /**
18
23
  * Apply styling to the Table slots based on the state
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Table/useTableStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AAIA,OAAO,MAAM,cAAc,GAAG,WAAvB;AACP,OAAO,MAAM,eAAe,GAA+B;EACzD,IAAI,EAAE;AADmD,CAApD;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAMA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAkC;EACvE,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,cAAD,EAAiB,MAAM,CAAC,IAAxB,EAA8B,KAAK,CAAC,IAAN,CAAW,SAAzC,CAAnC;EAEA,OAAO,KAAP;AACD,CALM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport type { TableSlots, TableState } from './Table.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableClassName = 'fui-Table';\nexport const tableClassNames: SlotClassNames<TableSlots> = {\n root: 'fui-Table',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n },\n});\n\n/**\n * Apply styling to the Table slots based on the state\n */\nexport const useTableStyles_unstable = (state: TableState): TableState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableClassName, styles.root, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Table/useTableStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,cAAc,GAAG,WAAvB;AACP,OAAO,MAAM,eAAe,GAA+B;EACzD,IAAI,EAAE;AADmD,CAApD;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAUA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAkC;EACvE,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,cAAD,EAAiB,MAAM,CAAC,IAAxB,EAA8B,KAAK,CAAC,IAAN,CAAW,SAAzC,CAAnC;EAEA,OAAO,KAAP;AACD,CALM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableSlots, TableState } from './Table.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableClassName = 'fui-Table';\nexport const tableClassNames: SlotClassNames<TableSlots> = {\n root: 'fui-Table',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n verticalAlign: 'middle',\n borderCollapse: 'collapse',\n width: '100%',\n display: 'table',\n backgroundColor: tokens.colorNeutralBackground1,\n },\n});\n\n/**\n * Apply styling to the Table slots based on the state\n */\nexport const useTableStyles_unstable = (state: TableState): TableState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableClassName, styles.root, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -13,7 +13,9 @@ import { useTableContext } from '../../contexts/tableContext';
13
13
  export const useTableBody_unstable = (props, ref) => {
14
14
  var _a;
15
15
 
16
- const noNativeElements = useTableContext(ctx => ctx.noNativeElements);
16
+ const {
17
+ noNativeElements
18
+ } = useTableContext();
17
19
  const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'tbody';
18
20
  return {
19
21
  components: {
@@ -1 +1 @@
1
- {"version":3,"sources":["components/TableBody/useTableBody.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM,gBAAgB,GAAG,eAAe,CAAC,GAAG,IAAI,GAAG,CAAC,gBAAZ,CAAxC;EACA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,OAA7D;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,aAAD,EAAgB;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,UAA1B,GAAuC,SAFJ;MAGzC,GAAG;IAHsC,CAAhB;EAJtB,CAAP;AAUD,CAdM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableBodyProps, TableBodyState } from './TableBody.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableBody.\n *\n * The returned state can be modified with hooks such as useTableBodyStyles_unstable,\n * before being passed to renderTableBody_unstable.\n *\n * @param props - props from this instance of TableBody\n * @param ref - reference to root HTMLElement of TableBody\n */\nexport const useTableBody_unstable = (props: TableBodyProps, ref: React.Ref<HTMLElement>): TableBodyState => {\n const noNativeElements = useTableContext(ctx => ctx.noNativeElements);\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'tbody';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'rowgroup' : undefined,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/TableBody/useTableBody.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE;EAAF,IAAuB,eAAe,EAA5C;EACA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,OAA7D;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,qBAAqB,CAAC,aAAD,EAAgB;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,UAA1B,GAAuC,SAFJ;MAGzC,GAAG;IAHsC,CAAhB;EAJtB,CAAP;AAUD,CAdM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableBodyProps, TableBodyState } from './TableBody.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableBody.\n *\n * The returned state can be modified with hooks such as useTableBodyStyles_unstable,\n * before being passed to renderTableBody_unstable.\n *\n * @param props - props from this instance of TableBody\n * @param ref - reference to root HTMLElement of TableBody\n */\nexport const useTableBody_unstable = (props: TableBodyProps, ref: React.Ref<HTMLElement>): TableBodyState => {\n const { noNativeElements } = useTableContext();\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'tbody';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'rowgroup' : undefined,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,13 @@
1
- import { mergeClasses } from '@griffel/react';
1
+ import { mergeClasses, __styles } from '@griffel/react';
2
+
3
+ const useStyles = /*#__PURE__*/__styles({
4
+ "root": {
5
+ "mc9l5x": "f1tp1avn"
6
+ }
7
+ }, {
8
+ "d": [".f1tp1avn{display:table-row-group;}"]
9
+ });
10
+
2
11
  export const tableBodyClassName = 'fui-TableBody';
3
12
  export const tableBodyClassNames = {
4
13
  root: 'fui-TableBody'
@@ -8,7 +17,8 @@ export const tableBodyClassNames = {
8
17
  */
9
18
 
10
19
  export const useTableBodyStyles_unstable = state => {
11
- state.root.className = mergeClasses(tableBodyClassName, state.root.className);
20
+ const styles = useStyles();
21
+ state.root.className = mergeClasses(tableBodyClassName, styles.root, state.root.className);
12
22
  return state;
13
23
  };
14
24
  //# sourceMappingURL=useTableBodyStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/TableBody/useTableBodyStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,gBAA7B;AAIA,OAAO,MAAM,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAM,mBAAmB,GAAmC;EACjE,IAAI,EAAE;AAD2D,CAA5D;AAIP;;AAEG;;AACH,OAAO,MAAM,2BAA2B,GAAI,KAAD,IAA0C;EACnF,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,kBAAD,EAAqB,KAAK,CAAC,IAAN,CAAW,SAAhC,CAAnC;EAEA,OAAO,KAAP;AACD,CAJM","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport type { TableBodySlots, TableBodyState } from './TableBody.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableBodyClassName = 'fui-TableBody';\nexport const tableBodyClassNames: SlotClassNames<TableBodySlots> = {\n root: 'fui-TableBody',\n};\n\n/**\n * Apply styling to the TableBody slots based on the state\n */\nexport const useTableBodyStyles_unstable = (state: TableBodyState): TableBodyState => {\n state.root.className = mergeClasses(tableBodyClassName, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/TableBody/useTableBodyStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,gBAAzC;;AAIA,MAAM,SAAS,gBAAG;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;;AAMA,OAAO,MAAM,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAM,mBAAmB,GAAmC;EACjE,IAAI,EAAE;AAD2D,CAA5D;AAIP;;AAEG;;AACH,OAAO,MAAM,2BAA2B,GAAI,KAAD,IAA0C;EACnF,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,kBAAD,EAAqB,MAAM,CAAC,IAA5B,EAAkC,KAAK,CAAC,IAAN,CAAW,SAA7C,CAAnC;EAEA,OAAO,KAAP;AACD,CALM","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport type { TableBodySlots, TableBodyState } from './TableBody.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nconst useStyles = makeStyles({\n root: {\n display: 'table-row-group',\n },\n});\n\nexport const tableBodyClassName = 'fui-TableBody';\nexport const tableBodyClassNames: SlotClassNames<TableBodySlots> = {\n root: 'fui-TableBody',\n};\n\n/**\n * Apply styling to the TableBody slots based on the state\n */\nexport const useTableBodyStyles_unstable = (state: TableBodyState): TableBodyState => {\n const styles = useStyles();\n state.root.className = mergeClasses(tableBodyClassName, styles.root, state.root.className);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableCell.types.js","sourceRoot":"../src/","sources":["components/TableCell/TableCell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableCellSlots = {\n root: Slot<'td', 'div'>;\n\n media?: Slot<'span'>;\n};\n\n/**\n * TableCell Props\n */\nexport type TableCellProps = ComponentProps<TableCellSlots> & {};\n\n/**\n * State used in rendering TableCell\n */\nexport type TableCellState = ComponentState<TableCellSlots>;\n"]}
1
+ {"version":3,"file":"TableCell.types.js","sourceRoot":"../src/","sources":["components/TableCell/TableCell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TableCellSlots = {\n root: Slot<'td', 'div'>;\n};\n\n/**\n * TableCell Props\n */\nexport type TableCellProps = ComponentProps<TableCellSlots> & {};\n\n/**\n * State used in rendering TableCell\n */\nexport type TableCellState = ComponentState<TableCellSlots>;\n"]}
@@ -8,10 +8,8 @@ export const renderTableCell_unstable = state => {
8
8
  const {
9
9
  slots,
10
10
  slotProps
11
- } = getSlots(state); // TODO Add additional slots in the appropriate place
12
-
11
+ } = getSlots(state);
13
12
  return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
14
- }, slots.media && /*#__PURE__*/React.createElement(slots.media, { ...slotProps.media
15
- }), " ", slotProps.root.children);
13
+ });
16
14
  };
17
15
  //# sourceMappingURL=renderTableCell.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/TableCell/renderTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAAI,KAAD,IAA0B;EAChE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAiB,KAAjB,CAArC,CADgE,CAGhE;;EACA,oBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,KAAN,iBAAe,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,KAAP,EAAY,EAAA,GAAK,SAAS,CAAC;EAAf,CAAZ,CADlB,E,GAAA,EACyD,SAAS,CAAC,IAAV,CAAe,QADxE,CADF;AAKD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TableCellState, TableCellSlots } from './TableCell.types';\n\n/**\n * Render the final JSX of TableCell\n */\nexport const renderTableCell_unstable = (state: TableCellState) => {\n const { slots, slotProps } = getSlots<TableCellSlots>(state);\n\n // TODO Add additional slots in the appropriate place\n return (\n <slots.root {...slotProps.root}>\n {slots.media && <slots.media {...slotProps.media} />} {slotProps.root.children}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/TableCell/renderTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,wBAAwB,GAAI,KAAD,IAA0B;EAChE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAiB,KAAjB,CAArC;EAEA,oBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CAAP;AACD,CAJM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TableCellState, TableCellSlots } from './TableCell.types';\n\n/**\n * Render the final JSX of TableCell\n */\nexport const renderTableCell_unstable = (state: TableCellState) => {\n const { slots, slotProps } = getSlots<TableCellSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
@@ -1,4 +1,4 @@
1
- import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
1
+ import { getNativeElementProps } from '@fluentui/react-utilities';
2
2
  import { useTableContext } from '../../contexts/tableContext';
3
3
  /**
4
4
  * Create the state required to render TableCell.
@@ -13,14 +13,14 @@ import { useTableContext } from '../../contexts/tableContext';
13
13
  export const useTableCell_unstable = (props, ref) => {
14
14
  var _a;
15
15
 
16
- const noNativeElements = useTableContext(ctx => ctx.noNativeElements);
16
+ const {
17
+ noNativeElements
18
+ } = useTableContext();
17
19
  const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'td';
18
20
  return {
19
21
  components: {
20
- root: rootComponent,
21
- media: 'span'
22
+ root: rootComponent
22
23
  },
23
- media: resolveShorthand(props.media),
24
24
  root: getNativeElementProps(rootComponent, {
25
25
  ref,
26
26
  role: rootComponent === 'div' ? 'cell' : undefined,