UNPKG

2.49 kBTypeScriptView Raw
1import { ComponentType, Component, ReactNode, ReactElement } from 'react';
2import { CSSObject } from '@emotion/serialize';
3
4import { borderRadius, colors, spacing } from '../theme';
5import { CommonProps, GroupTypeBase, OptionTypeBase } from '../types';
6
7export type MultiValueProps<
8 OptionType extends OptionTypeBase,
9 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
10> = CommonProps<OptionType, true, GroupType> & {
11 children: ReactNode;
12 components: any;
13 cropWithEllipsis: boolean;
14 data: OptionType;
15 innerProps: any;
16 isFocused: boolean;
17 isDisabled: boolean;
18 removeProps: {
19 onTouchEnd: (event: any) => void;
20 onClick: (event: any) => void;
21 onMouseDown: (event: any) => void;
22 };
23};
24
25export function multiValueCSS(): CSSObject;
26export function multiValueLabelCSS(props: MultiValueProps<any>): CSSObject;
27export function multiValueRemoveCSS(props: MultiValueProps<any>): CSSObject;
28
29export interface MultiValueGenericProps<OptionType extends OptionTypeBase> {
30 children: ReactNode;
31 data: OptionType;
32 innerProps: { className?: string | undefined };
33 selectProps: any;
34}
35export function MultiValueGeneric<OptionType extends OptionTypeBase>(
36 // tslint:disable-next-line:no-unnecessary-generics
37 props: MultiValueGenericProps<OptionType>,
38): ReactElement;
39
40export const MultiValueContainer: typeof MultiValueGeneric;
41export const MultiValueLabel: typeof MultiValueGeneric;
42export type MultiValueRemoveProps<
43 OptionType extends OptionTypeBase,
44 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
45> = CommonProps<OptionType, true, GroupType> & {
46 children: ReactNode;
47 data: OptionType;
48 innerProps: {
49 className: string;
50 onTouchEnd: (event: any) => void;
51 onClick: (event: any) => void;
52 onMouseDown: (event: any) => void;
53 };
54 selectProps: any;
55};
56export function MultiValueRemove<
57 OptionType extends OptionTypeBase,
58 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
59 // tslint:disable-next-line:no-unnecessary-generics
60>(props: MultiValueRemoveProps<OptionType, GroupType>): ReactElement;
61
62declare function MultiValue<
63 OptionType extends OptionTypeBase,
64 GroupType extends GroupTypeBase<OptionType> = GroupTypeBase<OptionType>
65 // tslint:disable-next-line:no-unnecessary-generics
66>(props: MultiValueProps<OptionType, GroupType>): ReactElement;
67
68export default MultiValue;