-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
index.js
117 lines (109 loc) · 3.43 KB
/
index.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
// @flow
import { type ComponentType, type Element } from 'react';
import {
type IndicatorContainerProps,
type ContainerProps,
type ValueContainerProps,
IndicatorsContainer,
SelectContainer,
ValueContainer,
} from './containers';
import {
type IndicatorProps,
type LoadingIconProps,
ClearIndicator,
DropdownIndicator,
LoadingIndicator,
IndicatorSeparator,
DownChevron,
CrossIcon,
} from './indicators';
import Control, { type ControlProps } from './Control';
import Group, { type GroupProps, GroupHeading } from './Group';
import Input, { type InputProps } from './Input';
import Menu, {
type MenuProps,
MenuList,
type MenuListComponentProps,
MenuPortal,
type MenuPortalProps,
type NoticeProps,
NoOptionsMessage,
LoadingMessage,
} from './Menu';
import MultiValue, {
type MultiValueProps,
MultiValueContainer,
MultiValueLabel,
MultiValueRemove,
} from './MultiValue';
import Option, { type OptionProps } from './Option';
import Placeholder, { type PlaceholderProps } from './Placeholder';
import SingleValue, { type SingleValueProps } from './SingleValue';
export type PlaceholderOrValue =
| Element<ComponentType<PlaceholderProps>>
| Element<ComponentType<SingleValueProps>>
| Array<Element<ComponentType<MultiValueProps>>>;
type IndicatorComponentType = ComponentType<IndicatorProps>;
export type SelectComponents = {
ClearIndicator: IndicatorComponentType | null,
Control: ComponentType<ControlProps>,
DropdownIndicator: IndicatorComponentType | null,
DownChevron: ComponentType<any>,
CrossIcon: ComponentType<any>,
Group: ComponentType<GroupProps>,
GroupHeading: ComponentType<any>,
IndicatorsContainer: ComponentType<IndicatorContainerProps>,
IndicatorSeparator: IndicatorComponentType | null,
Input: ComponentType<InputProps>,
LoadingIndicator: ComponentType<LoadingIconProps> | null,
Menu: ComponentType<MenuProps>,
MenuList: ComponentType<MenuListComponentProps>,
MenuPortal: ComponentType<MenuPortalProps>,
LoadingMessage: ComponentType<NoticeProps>,
NoOptionsMessage: ComponentType<NoticeProps>,
MultiValue: ComponentType<MultiValueProps>,
MultiValueContainer: ComponentType<any>,
MultiValueLabel: ComponentType<any>,
MultiValueRemove: ComponentType<any>,
Option: ComponentType<OptionProps>,
Placeholder: ComponentType<PlaceholderProps>,
SelectContainer: ComponentType<ContainerProps>,
SingleValue: ComponentType<SingleValueProps>,
ValueContainer: ComponentType<ValueContainerProps>,
};
export type SelectComponentsConfig = $Shape<SelectComponents>;
export const components = {
ClearIndicator: ClearIndicator,
Control: Control,
DropdownIndicator: DropdownIndicator,
DownChevron: DownChevron,
CrossIcon: CrossIcon,
Group: Group,
GroupHeading: GroupHeading,
IndicatorsContainer: IndicatorsContainer,
IndicatorSeparator: IndicatorSeparator,
Input: Input,
LoadingIndicator: LoadingIndicator,
Menu: Menu,
MenuList: MenuList,
MenuPortal: MenuPortal,
LoadingMessage: LoadingMessage,
NoOptionsMessage: NoOptionsMessage,
MultiValue: MultiValue,
MultiValueContainer: MultiValueContainer,
MultiValueLabel: MultiValueLabel,
MultiValueRemove: MultiValueRemove,
Option: Option,
Placeholder: Placeholder,
SelectContainer: SelectContainer,
SingleValue: SingleValue,
ValueContainer: ValueContainer,
};
type Props = {
components: SelectComponentsConfig,
};
export const defaultComponents = (props: Props) => ({
...components,
...props.components,
});