-
-
Notifications
You must be signed in to change notification settings - Fork 459
/
Copy pathSelectContext.ts
39 lines (36 loc) · 1.15 KB
/
SelectContext.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
import * as React from 'react';
import type { RawValueType, RenderNode } from './BaseSelect';
import type {
BaseOptionType,
FieldNames,
OnActiveValue,
OnInternalSelect,
SelectProps,
SemanticName,
} from './Select';
import type { FlattenOptionData } from './interface';
// Use any here since we do not get the type during compilation
/**
* SelectContext is only used for Select. BaseSelect should not consume this context.
*/
export interface SelectContextProps {
classNames?: Partial<Record<SemanticName, string>>;
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
options: BaseOptionType[];
optionRender?: SelectProps['optionRender'];
flattenOptions: FlattenOptionData<BaseOptionType>[];
onActiveValue: OnActiveValue;
defaultActiveFirstOption?: boolean;
onSelect: OnInternalSelect;
menuItemSelectedIcon?: RenderNode;
rawValues: Set<RawValueType>;
fieldNames?: FieldNames;
virtual?: boolean;
direction?: 'ltr' | 'rtl';
listHeight?: number;
listItemHeight?: number;
childrenAsData?: boolean;
maxCount?: number;
}
const SelectContext = React.createContext<SelectContextProps>(null);
export default SelectContext;