// @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> | Element> | Array>>; type IndicatorComponentType = ComponentType; export type SelectComponents = { ClearIndicator: IndicatorComponentType | null, Control: ComponentType, DropdownIndicator: IndicatorComponentType | null, DownChevron: ComponentType, CrossIcon: ComponentType, Group: ComponentType, GroupHeading: ComponentType, IndicatorsContainer: ComponentType, IndicatorSeparator: IndicatorComponentType | null, Input: ComponentType, LoadingIndicator: ComponentType | null, Menu: ComponentType, MenuList: ComponentType, MenuPortal: ComponentType, LoadingMessage: ComponentType, NoOptionsMessage: ComponentType, MultiValue: ComponentType, MultiValueContainer: ComponentType, MultiValueLabel: ComponentType, MultiValueRemove: ComponentType, Option: ComponentType, Placeholder: ComponentType, SelectContainer: ComponentType, SingleValue: ComponentType, ValueContainer: ComponentType, }; export type SelectComponentsConfig = $Shape; 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, });