import * as React from "react"; import { Placement } from "popper.js"; import { ZIndex } from "../../foundations/foundation-types"; import { ViewProps } from "../View"; export interface SelectDropdownItemProps { value: string | number; label: string; disabled?: boolean; [key: string]: any; } export interface SelectDropdownProps extends ViewProps { /** * The selected elements of the component. If an object is supplied as options, this will be the value key. */ options: SelectDropdownItemProps[]; /** * value is used to process the update and return to the parent */ value?: string | string[]; /** * Option rendered. Createable = true means the option is not in the list currently. */ optionRenderer: (item: SelectDropdownItemProps) => React.ReactNode; /** * Searchbar renderer, search bar is shown if handleSearchChange is defined */ handleSearchChange?: (search: string, evt: React.SyntheticEvent) => void; searchTerm?: string; searchPlaceholder?: string; onChange?: (evt: any) => void; isMulti?: boolean; /** * Setting this to true forces the popup to close when a selection is made */ closeOnSelection?: boolean; /** * Prompt that is displayed to show that a new option can be created */ renderCreateOption?: () => React.ReactNode; /** * Whether showing status message defined by the statusRenderer. Defaults to false */ showStatus?: boolean; /** * Used to render status like loading or not found */ statusRenderer?: () => React.ReactNode; onCreate?: (evt: React.SyntheticEvent) => Promise | void; children: (params: any) => React.ReactNode; selectedColor?: string; name?: string; container?: React.RefObject; dropdownZindex?: ZIndex | number | ""; popperPlacement?: Placement; } interface State { focused: boolean; forceClose: boolean; search?: string; } /** * A SelectDropdown lets the user choose from 4 or more options from a list where the selected item will NOT be shown when the select dropdown is closed. * * Any children can be used to trigger the select dropdown, such as a button. */ declare class SelectDropdown extends React.PureComponent { static defaultProps: { createable: boolean; closeOnSelection: boolean; searchTerm: string; options: any[]; popperPlacement: string; }; state: State; handleClickOuter(...args: any[]): void; handleMultiValueChange(selection: string | number): (string | number)[]; handleOptionClick(option: SelectDropdownItemProps | string, selectActions: any): void; create(evt: React.SyntheticEvent): void; optionRenderer(item: SelectDropdownItemProps, index: number, getItemProps: any): JSX.Element; handleSearchChange(evt: any): void; renderSearch(getItemProps: any): JSX.Element; renderCreateOption(item: string, index: number, getItemProps: any): JSX.Element; itemToString(item: any): any; render(): JSX.Element; } export default SelectDropdown;