forked from JedWatson/react-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.js
119 lines (101 loc) · 2.67 KB
/
types.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// @flow
import type { Ref } from 'react';
export type OptionType = {
[string]: any,
};
export type OptionsType = Array<OptionType>;
export type GroupType = {
options: OptionsType,
[string]: any,
};
export type ValueType = OptionType | OptionsType | null | void;
export type FocusEventHandler = (SyntheticFocusEvent<HTMLElement>) => void;
export type MouseEventHandler = (SyntheticMouseEvent<HTMLElement>) => void;
export type KeyboardEventHandler = (
SyntheticKeyboardEvent<HTMLElement>
) => void;
export type InnerRef = Ref<*>;
export type PropsWithInnerRef = {
/** The inner reference. */
innerRef: Ref<*>,
};
type ThemeSpacing = {
baseUnit: number,
controlHeight: number,
menuGutter: number,
};
export type Theme = {
borderRadius: number,
colors: { [key: string]: string },
spacing: ThemeSpacing,
};
export type PropsWithStyles = {
/**
Get the styles of a particular part of the select. Pass in the name of the
property as the first argument, and the current props as the second argument.
See the `styles` object for the properties available.
*/
getStyles: (string, any) => {},
theme: Theme,
};
export type ClassNameList = Array<string>;
export type ClassNamesState = { [string]: boolean } | void;
export type CommonProps = {
clearValue: () => void,
className?: string,
cx: (?string | null, ClassNamesState | void, string | void) => string | void,
/**
Get the styles of a particular part of the select. Pass in the name of the
property as the first argument, and the current props as the second argument.
See the `styles` object for the properties available.
*/
getStyles: (string, any) => {},
theme: Theme,
getValue: () => ValueType,
hasValue: boolean,
isMulti: boolean,
options: OptionsType,
selectOption: OptionType => void,
selectProps: any,
setValue: (ValueType, ActionTypes) => void,
};
export type ActionTypes =
| 'select-option'
| 'deselect-option'
| 'remove-value'
| 'pop-value'
| 'set-value'
| 'clear'
| 'create-option';
export type ActionMeta = {
action: ActionTypes,
};
export type InputActionTypes =
| 'set-value'
| 'input-change'
| 'input-blur'
| 'menu-close';
export type InputActionMeta = {|
action: InputActionTypes,
|};
export type MenuPlacement = 'auto' | 'bottom' | 'top';
export type MenuPosition = 'absolute' | 'fixed';
export type FocusDirection =
| 'up'
| 'down'
| 'pageup'
| 'pagedown'
| 'first'
| 'last';
export type OptionProps = PropsWithInnerRef & {
data: any,
id: number,
index: number,
isDisabled: boolean,
isFocused: boolean,
isSelected: boolean,
label: string,
onClick: MouseEventHandler,
onMouseOver: MouseEventHandler,
value: any,
};