import { ControllerStateAndHelpers, DownshiftProps } from 'downshift'; import React from 'react'; import { Omit } from '../../../util'; export interface SelectDownshiftProps extends Omit, 'children'> { /** * Items to be populated on the select component. */ items: ReadonlyArray; /** * Whether the select menu should be opened when the select is focused. */ openOnFocus?: boolean; /** * Minimum width of the dropdown menu */ menuMinWidth?: number; /** * Whether the current input filter should be kept after an item is selected. * This is necessary for multi selects, for example, when the filter should be kept after an item is selected. * @default false */ keepFilterAfterSelect?: boolean; children?(props: SelectDownshiftRenderProps): React.ReactNode; /** * Called when the inputValue is changed. * @param filter The `inputValue` or `null` if an item is selected. * @param downshift The downshift controller and helpers. */ onFilterChange?(filter: string, downshift: SelectDownshiftRenderProps): void; /** * If informed, select will allow insertion of items not present on the select. * @param inputValue The string type in the text box * @return The value that should be created and hold by the select */ createNewItem?(inputValue: string): T; } export interface SelectDownshiftRenderProps extends ControllerStateAndHelpers, State { items: T[]; setVisibleItems(visibleItems: T[]): void; } interface State { visibleItems: T[]; } /** * Default filter prop used by the Select component. */ export declare function defaultSelectFilter(items: T[], filter: string, itemToString: SelectDownshiftRenderProps['itemToString']): T[]; /** * Downshift extension with item and filter management. */ export declare function SelectDownshift(props: SelectDownshiftProps): JSX.Element; export declare namespace SelectDownshift { var defaultProps: Partial>; } export {};