@aveonline/ui-react
Version:
Home base for Aveonline design system - ecosystem react
111 lines (110 loc) • 2.71 kB
TypeScript
import { FocusEventHandler } from 'react';
import { IKindLogo, ITooltipProps, IKind as IKindIcon } from '../../..';
export declare type IOption = {
label: string | number;
value: string | number;
image?: string | JSX.Element;
prefix?: string;
};
export declare type ITooltipSelect = Omit<ITooltipProps, 'children' | 'initialOpen'> & {
isActive?: boolean;
icon?: IKindIcon;
};
export interface ISelect {
/**
* Array of options that populate the select menu
*/
options?: IOption[];
/**
* Is the select disabled
*/
isDisabled?: boolean;
/**
* Placeholder for the select value
*/
placeholder?: string;
/**
* Object default of options
*/
defaultValue?: IOption;
/**
* Object default of options when isMulti is true
*/
defaultValueMulti?: IOption[];
/**
* Message error
*/
error?: string;
/**
* The id to set on the SelectContainer component.
*/
id?: string;
/**
* Name of the HTML Input (optional - without this, no input will be rendered)
*/
name?: string;
/**
* Handle change events on the select
*/
onChange?: (value: IOption) => void;
/**
* Handle change events on the select for multiple options
*/
onChangeMulti?: (value: IOption[]) => void;
/**
* Message for help human
*/
helpText?: string;
/**
* Placeholder to convert on label
*/
hasLabelPlaceholder?: boolean;
/**
* Whether to enable search functionality
*/
isSearchable?: boolean;
/**
* Is the select value clearable
*/
isClearable?: boolean;
/** Handle blur events on the control */
onBlur?: FocusEventHandler<HTMLInputElement>;
/**
* Active and desactive description error
*/
showErrorText?: boolean;
/**
* Validation boolean for error
*/
isError?: boolean;
/**
* Open close menu
*/
menuIsOpen?: boolean;
/** Define an id prefix for the select components e.g. {your-id}-value */
instanceId?: number | string;
ref?: any;
value?: any;
loadingMessage?: string;
noOptionsMessage?: string;
logo?: IKindLogo;
/**
* Support multiple selected options
*/
isMulti?: boolean;
/**
* Active tooltip for icon right verify dropdown indicator - default true
*/
iconTooltip?: ITooltipSelect;
/**
* Verify dropdown indicator - default true
*/
isActiveDropdownIndicator?: boolean;
/**
* Close menu when select option
* @default true
*/
closeMenuOnSelect?: boolean;
_t?: (text: string) => string;
useT?: boolean;
}