import { FocusEventHandler } from 'react'; import { GroupBase, MultiValue, Options, SelectInstance, SingleValue } from 'react-select'; import { InputWrapperBaseProps } from '../../internals/InputWrapper'; export type GroupedSelectValues = Array<{ label?: string; options: InputSelectValue[]; }>; export interface InputSelectValue { value: string | number | boolean; label: string; meta?: Record; isDisabled?: boolean; } export type PossibleSelectValue = MultiValue | SingleValue; export interface InputSelectProps extends InputWrapperBaseProps { /** * Initial values to populate the select options. It can be a flat array of values or a grouped array. */ initialValues: GroupedSelectValues | InputSelectValue[]; /** * Selected value or values, in case of `isMulti` */ defaultValue?: InputSelectValue | InputSelectValue[]; /** * Selected value or values, in case of `isMulti` */ value?: InputSelectValue | InputSelectValue[]; /** * Placeholder text to display when no value is selected */ placeholder?: string; /** * Controls loading UI state */ isLoading?: boolean; /** * Text to display when loading */ loadingText?: string; /** * Add a clear button (x) to the select to empty all selected values */ isClearable?: boolean; /** * Disable the select */ isDisabled?: boolean; /** * When `true` it's possible to type to narrow down the options */ isSearchable?: boolean; /** * Allow to select multiple values */ isMulti?: boolean; /** * Custom rule to disable an option */ isOptionDisabled?: (option: InputSelectValue, selectValue: Options) => boolean; /** * Callback triggered when a value is selected. */ onSelect: (value: PossibleSelectValue) => void; /** * onBlur event handler */ onBlur?: FocusEventHandler; /** * HTML name attribute for the input component */ name?: string; /** * The id of the search input */ inputId?: string; /** * When `true` the dropdown menu is always open */ menuIsOpen?: boolean; /** * Message to display when no options are found */ noOptionsMessage?: string; /** * CSS class name */ className?: string; /** * Function to load async values on search */ loadAsyncValues?: (inputValue: string) => Promise; /** * Optional text to display at the bottom of the dropdown menu */ menuFooterText?: string; /** * Debounce time in milliseconds for async search. * It only works when `loadAsyncValues` is provided */ debounceMs?: number; /** * Allows to create new options on the fly when no option is found. * It does not work with `loadAsyncValues`. */ isCreatable?: boolean; /** * When `true` the async select will show a text input instead of a select input. * This is useful for cases where you want to allow freeform text input in addition to selecting from the dropdown. * * **This option is only available when `loadAsyncValues` is provided.** */ asTextSearch?: boolean; /** * Whether the menu should use a portal, and where it should attach to. */ menuPortalTarget?: HTMLElement | null; } /** * Advanced select component with support for async options loading and multi-select. * It's a wrapper around `react-select` with a subset of props exposed. * * To enable async data fetching for loading options while typing, provide the `loadAsyncValues` prop. * This function will be used to fetch new options while typing and the results will be displayed in the options menu. * * When `isSearchable` is `true`, it's possible to type to narrow down the options. The component will always be searchable when `loadAsyncValues` is provided. * On both standard and async mode it can be set to select a single single value or multiple values. * */ export declare const InputSelect: import('react').ForwardRefExoticComponent>>>;