@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.
- package/CHANGELOG.json +168 -4
- package/CHANGELOG.md +43 -5
- package/dist/index.d.ts +318 -21
- package/lib/TableCellActions.js +2 -0
- package/lib/TableCellActions.js.map +1 -0
- package/lib/TableCellLayout.js +2 -0
- package/lib/TableCellLayout.js.map +1 -0
- package/lib/TableCellPrimaryLayout.js +2 -0
- package/lib/TableCellPrimaryLayout.js.map +1 -0
- package/lib/TableSelectionCell.js +2 -0
- package/lib/TableSelectionCell.js.map +1 -0
- package/lib/components/Table/Table.types.js.map +1 -1
- package/lib/components/Table/useTableContextValues.js +7 -5
- package/lib/components/Table/useTableContextValues.js.map +1 -1
- package/lib/components/Table/useTableStyles.js +7 -2
- package/lib/components/Table/useTableStyles.js.map +1 -1
- package/lib/components/TableBody/useTableBody.js +3 -1
- package/lib/components/TableBody/useTableBody.js.map +1 -1
- package/lib/components/TableBody/useTableBodyStyles.js +12 -2
- package/lib/components/TableBody/useTableBodyStyles.js.map +1 -1
- package/lib/components/TableCell/TableCell.types.js.map +1 -1
- package/lib/components/TableCell/renderTableCell.js +2 -4
- package/lib/components/TableCell/renderTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCell.js +5 -5
- package/lib/components/TableCell/useTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCellStyles.js +6 -20
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib/components/TableCellActions/TableCellActions.js +15 -0
- package/lib/components/TableCellActions/TableCellActions.js.map +1 -0
- package/lib/components/TableCellActions/TableCellActions.types.js +2 -0
- package/lib/components/TableCellActions/TableCellActions.types.js.map +1 -0
- package/lib/components/TableCellActions/index.js +6 -0
- package/lib/components/TableCellActions/index.js.map +1 -0
- package/lib/components/TableCellActions/renderTableCellActions.js +16 -0
- package/lib/components/TableCellActions/renderTableCellActions.js.map +1 -0
- package/lib/components/TableCellActions/useTableCellActions.js +27 -0
- package/lib/components/TableCellActions/useTableCellActions.js.map +1 -0
- package/lib/components/TableCellActions/useTableCellActionsStyles.js +40 -0
- package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
- package/lib/components/TableCellLayout/TableCellLayout.js +15 -0
- package/lib/components/TableCellLayout/TableCellLayout.js.map +1 -0
- package/lib/components/TableCellLayout/TableCellLayout.types.js +2 -0
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
- package/lib/components/TableCellLayout/index.js +6 -0
- package/lib/components/TableCellLayout/index.js.map +1 -0
- package/lib/components/TableCellLayout/renderTableCellLayout.js +19 -0
- package/lib/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
- package/lib/components/TableCellLayout/useTableCellLayout.js +36 -0
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -0
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +74 -0
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
- package/lib/components/TableHeader/useTableHeader.js +4 -2
- package/lib/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib/components/TableHeader/useTableHeaderStyles.js +12 -2
- package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +4 -2
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +11 -9
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib/components/TableRow/useTableRow.js +4 -2
- package/lib/components/TableRow/useTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRowStyles.js +11 -7
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.js +15 -0
- package/lib/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js +2 -0
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
- package/lib/components/TableSelectionCell/index.js +6 -0
- package/lib/components/TableSelectionCell/index.js.map +1 -0
- package/lib/components/TableSelectionCell/renderTableSelectionCell.js +17 -0
- package/lib/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
- package/lib/components/TableSelectionCell/useTableSelectionCell.js +42 -0
- package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +55 -0
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
- package/lib/contexts/tableContext.js +7 -3
- package/lib/contexts/tableContext.js.map +1 -1
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/selectionManager.js +89 -0
- package/lib/hooks/selectionManager.js.map +1 -0
- package/lib/hooks/types.js +2 -0
- package/lib/hooks/types.js.map +1 -0
- package/lib/hooks/useSelection.js +47 -0
- package/lib/hooks/useSelection.js.map +1 -0
- package/lib/hooks/useSort.js +72 -0
- package/lib/hooks/useSort.js.map +1 -0
- package/lib/hooks/useTable.js +87 -0
- package/lib/hooks/useTable.js.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/navigationModes/cell.js +250 -0
- package/lib/navigationModes/cell.js.map +1 -0
- package/lib/navigationModes/composite.js +208 -0
- package/lib/navigationModes/composite.js.map +1 -0
- package/lib/navigationModes/index.js +3 -0
- package/lib/navigationModes/index.js.map +1 -0
- package/lib/navigationModes/useNavigationMode.js +42 -0
- package/lib/navigationModes/useNavigationMode.js.map +1 -0
- package/lib-commonjs/TableCellActions.js +10 -0
- package/lib-commonjs/TableCellActions.js.map +1 -0
- package/lib-commonjs/TableCellLayout.js +10 -0
- package/lib-commonjs/TableCellLayout.js.map +1 -0
- package/lib-commonjs/TableCellPrimaryLayout.js +10 -0
- package/lib-commonjs/TableCellPrimaryLayout.js.map +1 -0
- package/lib-commonjs/TableSelectionCell.js +10 -0
- package/lib-commonjs/TableSelectionCell.js.map +1 -0
- package/lib-commonjs/components/Table/useTableContextValues.js +8 -5
- package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -1
- package/lib-commonjs/components/Table/useTableStyles.js +8 -2
- package/lib-commonjs/components/Table/useTableStyles.js.map +1 -1
- package/lib-commonjs/components/TableBody/useTableBody.js +3 -1
- package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -1
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js +10 -1
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -1
- package/lib-commonjs/components/TableCell/renderTableCell.js +2 -4
- package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCell.js +4 -4
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +6 -20
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/TableCellActions.js +26 -0
- package/lib-commonjs/components/TableCellActions/TableCellActions.js.map +1 -0
- package/lib-commonjs/components/TableCellActions/TableCellActions.types.js +6 -0
- package/lib-commonjs/components/TableCellActions/TableCellActions.types.js.map +1 -0
- package/lib-commonjs/components/TableCellActions/index.js +18 -0
- package/lib-commonjs/components/TableCellActions/index.js.map +1 -0
- package/lib-commonjs/components/TableCellActions/renderTableCellActions.js +27 -0
- package/lib-commonjs/components/TableCellActions/renderTableCellActions.js.map +1 -0
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js +38 -0
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -0
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +51 -0
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.js +26 -0
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js +6 -0
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/index.js +18 -0
- package/lib-commonjs/components/TableCellLayout/index.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js +30 -0
- package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +46 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +85 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
- package/lib-commonjs/components/TableHeader/useTableHeader.js +4 -2
- package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +11 -1
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +4 -2
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +11 -9
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRow.js +4 -2
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +12 -7
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js +26 -0
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js +6 -0
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
- package/lib-commonjs/components/TableSelectionCell/index.js +18 -0
- package/lib-commonjs/components/TableSelectionCell/index.js.map +1 -0
- package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js +28 -0
- package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +56 -0
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +65 -0
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
- package/lib-commonjs/contexts/tableContext.js +7 -3
- package/lib-commonjs/contexts/tableContext.js.map +1 -1
- package/lib-commonjs/hooks/index.js +12 -0
- package/lib-commonjs/hooks/index.js.map +1 -0
- package/lib-commonjs/hooks/selectionManager.js +98 -0
- package/lib-commonjs/hooks/selectionManager.js.map +1 -0
- package/lib-commonjs/hooks/types.js +6 -0
- package/lib-commonjs/hooks/types.js.map +1 -0
- package/lib-commonjs/hooks/useSelection.js +59 -0
- package/lib-commonjs/hooks/useSelection.js.map +1 -0
- package/lib-commonjs/hooks/useSort.js +82 -0
- package/lib-commonjs/hooks/useSort.js.map +1 -0
- package/lib-commonjs/hooks/useTable.js +99 -0
- package/lib-commonjs/hooks/useTable.js.map +1 -0
- package/lib-commonjs/index.js +110 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/navigationModes/cell.js +259 -0
- package/lib-commonjs/navigationModes/cell.js.map +1 -0
- package/lib-commonjs/navigationModes/composite.js +217 -0
- package/lib-commonjs/navigationModes/composite.js.map +1 -0
- package/lib-commonjs/navigationModes/index.js +16 -0
- package/lib-commonjs/navigationModes/index.js.map +1 -0
- package/lib-commonjs/navigationModes/useNavigationMode.js +55 -0
- package/lib-commonjs/navigationModes/useNavigationMode.js.map +1 -0
- package/package.json +9 -9
- 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
|
|
48
|
-
sortColumn:
|
|
49
|
-
sortDirection:
|
|
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
|
|
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> &
|
|
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:
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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';\
|
|
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":"
|
|
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
|
-
"
|
|
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;
|
|
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
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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
|
|
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);
|
|
12
|
-
|
|
11
|
+
} = getSlots(state);
|
|
13
12
|
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
|
14
|
-
}
|
|
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,
|
|
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
|
|
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
|
|
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,
|