UNPKG

@coconut-software/ui

Version:

React components for faster and easier web development.

40 lines (39 loc) 1.7 kB
import type { ChangeEvent, Dispatch, MutableRefObject, PropsWithChildren, ReactNode, Ref } from 'react'; import React from 'react'; import type SvgIcon from '../SvgIcon/SvgIcon'; import type { TextInputColor, TextInputSize, TextInputVariant } from '../TextInput/styles'; import type { Actions } from './Actions'; import type { OptionProps } from './Option'; type EventActions = 'revert'; interface SelectState { value: string; } type SelectContextState = SelectState & { displayInputRef: MutableRefObject<HTMLInputElement | null>; inputRef: MutableRefObject<HTMLInputElement | null>; }; type UseSelectValues = [SelectContextState, Dispatch<Actions>]; export declare const useSelect: () => UseSelectValues; interface SelectProps { color?: TextInputColor; defaultValue?: string; dataSet?: Record<string, string | undefined>; disabled?: boolean; error?: boolean; helperText?: string; inputRef?: Ref<HTMLInputElement>; label: string; name?: string; onChange?: (event: ChangeEvent<HTMLInputElement>, actions: Record<EventActions, () => void>) => void; size?: TextInputSize; startAdornment?: typeof SvgIcon | ReactNode; variant?: TextInputVariant; } declare function Select({ children, color, dataSet, defaultValue, disabled, error, helperText, inputRef, label, name, onChange, size, startAdornment, variant, }: PropsWithChildren<SelectProps>): JSX.Element; declare namespace Select { var Option: React.ForwardRefExoticComponent<OptionProps & { children?: ReactNode; } & React.RefAttributes<HTMLButtonElement>>; var Group: typeof import("./Group").default; } export default Select;