UNPKG

4.15 kBTypeScriptView Raw
1import { ComponentType, ReactElement as ElementType, SVGProps, ReactSVGElement, ReactElement } from 'react';
2import { CSSObject } from '@emotion/serialize';
3
4import { colors, spacing } from '../theme';
5import { CommonProps, GroupTypeBase, OptionTypeBase } from '../types';
6
7// ==============================
8// Dropdown & Clear Icons
9// ==============================
10
11export function CrossIcon(props?: SVGProps<SVGElement>): ReactSVGElement;
12export function DownChevron(props?: SVGProps<SVGElement>): ReactSVGElement;
13
14// ==============================
15// Dropdown & Clear Buttons
16// ==============================
17
18export type IndicatorProps<
19 OptionType extends OptionTypeBase,
20 IsMulti extends boolean,
21 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
22> = CommonProps<OptionType, IsMulti, GroupType> & {
23 /** The children to be rendered inside the indicator. */
24 children: ElementType;
25 /** Props that will be passed on to the children. */
26 innerProps: any;
27 /** The focused state of the select. */
28 isFocused: boolean;
29 /** Whether the text is right to left */
30 isRtl: boolean;
31 /** Whether the component is disabled */
32 isDisabled: boolean;
33};
34
35export type baseCSS = (props: IndicatorProps<any, boolean>) => CSSObject;
36
37export const dropdownIndicatorCSS: baseCSS;
38export function DropdownIndicator<
39 OptionType extends OptionTypeBase,
40 IsMulti extends boolean,
41 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
42 // tslint:disable-next-line:no-unnecessary-generics
43>(props: IndicatorProps<OptionType, IsMulti, GroupType>): ReactElement;
44
45export const clearIndicatorCSS: baseCSS;
46export function ClearIndicator<
47 OptionType extends OptionTypeBase,
48 IsMulti extends boolean,
49 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
50 // tslint:disable-next-line:no-unnecessary-generics
51>(props: IndicatorProps<OptionType, IsMulti, GroupType>): ReactElement;
52
53// ==============================
54// Separator
55// ==============================
56
57export interface SeparatorState {
58 isDisabled: boolean;
59}
60
61export function indicatorSeparatorCSS(state: SeparatorState): CSSObject;
62
63export function IndicatorSeparator<
64 OptionType extends OptionTypeBase,
65 IsMulti extends boolean,
66 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
67 // tslint:disable-next-line:no-unnecessary-generics
68>(props: IndicatorProps<OptionType, IsMulti, GroupType>): ReactElement;
69
70// ==============================
71// Loading
72// ==============================
73
74export function loadingIndicatorCSS(state: { isFocused: boolean; size: number }): CSSObject;
75
76/** @deprecated Use `LoadingIndicatorProps` instead. */
77export type LoadingIconProps<
78 OptionType extends OptionTypeBase,
79 IsMulti extends boolean,
80 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
81> = {
82 /** Props that will be passed on to the children. */
83 innerProps: any;
84 /** The focused state of the select. */
85 isFocused: boolean;
86 /** Whether the text is right to left */
87 isRtl: boolean;
88} & CommonProps<OptionType, IsMulti, GroupType> & {
89 /** Set size of the container. */
90 size: number;
91 };
92
93export type LoadingIndicatorProps<
94 OptionType extends OptionTypeBase,
95 IsMulti extends boolean,
96 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
97> = {
98 /** Props that will be passed on to the children. */
99 innerProps: any;
100 /** The focused state of the select. */
101 isFocused: boolean;
102 /** Whether the text is right to left */
103 isRtl: boolean;
104} & CommonProps<OptionType, IsMulti, GroupType> & {
105 /** Set size of the container. */
106 size: number;
107 };
108
109export function LoadingIndicator<
110 OptionType extends OptionTypeBase,
111 IsMulti extends boolean,
112 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
113 // tslint:disable-next-line:no-unnecessary-generics
114>(props: LoadingIndicatorProps<OptionType, IsMulti, GroupType>): ReactElement;
115// TODO LoadingIndicator.defaultProps: { size: number };