import * as React from "react"; import { SelectDropdownItemProps } from "../SelectDropdown"; import { ViewProps } from "../View"; export interface EmailToAuthor { firstName: string; lastName: string; avatar?: string; mail: string; required?: boolean; label?: string; value: string; } export interface AuthorSelectorProps extends ViewProps { optionRenderer?: (item: SelectDropdownItemProps) => React.ReactNode; /** * The selected elements of the component. These will be the email addresses of the users. */ value?: string[]; /** * The options of the component. These will be the email addresses of the users. */ options: string[]; /** * Function to map an email address to it's corresponding user. */ mapEmailToAuthor: (author: string) => EmailToAuthor; onInputChange?: (evt: React.SyntheticEvent) => void; onChange?: (evt: React.ChangeEvent & { target: { value: string[]; }; }) => void; /** * Optional function to call when a new option is created. Returns a promise to allow for asynchronous actions to finish before continuing */ onCreate?: (evt: React.SyntheticEvent) => Promise | void; /** * Whether new options may be created. Defaults to true */ createable?: boolean; placeholder?: string; createableText?: string; } interface State { value: string[]; isFocused: boolean; search: string; } /** * A component to allow the selection of multiple authors. */ declare class AuthorSelector extends React.PureComponent { private inputRef; constructor(props: AuthorSelectorProps); static defaultProps: { createableText: string; }; filterAndMap(options: string[], mapEmailToAuthor: (author: string) => EmailToAuthor, value: string[], search: string): SelectDropdownItemProps[]; onChange(evt: { target: { value: any; }; }): void; onInputChange(evt: React.SyntheticEvent): void; handleFocus(evt: React.SyntheticEvent): void; handleBlur(evt: React.SyntheticEvent): void; createNewValue(evt: React.SyntheticEvent): void; selectValue(evt: React.SyntheticEvent): void; renderOption(item: SelectDropdownItemProps): JSX.Element; handleDelete(evt: React.SyntheticEvent): void; renderCreate(): JSX.Element; render(): JSX.Element; } export default AuthorSelector;