-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
TableSelectionCell.types.ts
60 lines (53 loc) · 1.71 KB
/
TableSelectionCell.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { Checkbox, CheckboxProps } from '@fluentui/react-checkbox';
import type { Radio } from '@fluentui/react-radio';
import { TableCellSlots } from '../TableCell/TableCell.types';
import { TableContextValue } from '../Table/Table.types';
export type TableSelectionCellSlots = {
/**
* Selection indicator if selection type is checkbox
*/
checkboxIndicator: Slot<typeof Checkbox>;
/**
* Selection indicator if selection type is radio
*/
radioIndicator: Slot<typeof Radio>;
} & Pick<TableCellSlots, 'root'>;
/**
* TableSelectionCell Props
*/
export type TableSelectionCellProps = ComponentProps<Partial<TableSelectionCellSlots>> & {
/**
* A table can have two kinds of selection modes.
* @default checkbox
*/
type?: 'checkbox' | 'radio';
/**
* @default false
*/
checked?: CheckboxProps['checked'];
/**
* Only visible when checked or the parent row is hovered/focused
* @default false
*/
subtle?: boolean;
/**
* Completely hides the selection cell
* @deprecated cells should never use hidden, since doing so breaks table structure and screen reader navigation. Use `invisible` instead.
*/
hidden?: boolean;
/**
* Hides the selection cell visually but takes up the same space
* @default false
*/
invisible?: boolean;
};
/**
* State used in rendering TableSelectionCell
*/
export type TableSelectionCellState = ComponentState<TableSelectionCellSlots> &
Pick<Required<TableSelectionCellProps>, 'type' | 'checked' | 'subtle'> &
Pick<TableContextValue, 'noNativeElements'> & {
/* Visually hides the selection cell; not deprecated on state */
hidden: boolean;
};