UNPKG

@coconut-software/ui

Version:

React components for faster and easier web development.

47 lines (46 loc) 2.11 kB
import type { ChangeEventHandler, Dispatch, FocusEventHandler, PropsWithChildren, ReactNode, Ref, SetStateAction } from 'react'; import type SvgIcon from '../SvgIcon/SvgIcon'; import type { TextInputSize, TextInputVariant } from '../TextInput/styles'; import type { Actions, MultiSelectValue } from './Actions'; export { DisplayModes } from '../Autocomplete/Autocomplete'; interface MultiSelectProps { defaultDisplayValue?: string; defaultValue?: MultiSelectValue; dense?: boolean; displayRef?: Ref<HTMLInputElement>; disabled?: boolean; endAdornment?: typeof SvgIcon | string; error?: boolean; helperText?: string; inputRef?: Ref<HTMLInputElement>; label: string; loading?: boolean; name?: string; onBlur?: FocusEventHandler<HTMLInputElement>; onChange: ChangeEventHandler<HTMLInputElement>; onFocus?: FocusEventHandler<HTMLInputElement>; onSelect: (value: MultiSelectValue) => unknown; size?: TextInputSize; startAdornment?: typeof SvgIcon | string; total?: number; variant?: TextInputVariant; } type MultiSelectState = { actions: ReactNode; handleClose: () => void; selections: MultiSelectValue; setDisplayedSuggestionsValues: Dispatch<SetStateAction<MultiSelectValue>>; }; type UseMultiSelectValues = [MultiSelectState, Dispatch<Actions>]; export declare const useMultiSelect: () => UseMultiSelectValues; declare function MultiSelect({ children, defaultDisplayValue, defaultValue, dense, disabled, displayRef, endAdornment: endAdornmentProp, error, helperText, inputRef, label, loading, name, onBlur, onChange, onFocus, onSelect, size, startAdornment, total, variant, }: PropsWithChildren<MultiSelectProps>): JSX.Element; declare namespace MultiSelect { var Group: typeof import("../Autocomplete/Group").default; var Suggestion: ({ children, disabled, displayValue, value, }: PropsWithChildren<SuggestionProps>) => JSX.Element; } interface SuggestionProps { disabled?: boolean; value: string; displayValue?: string; } export default MultiSelect;