import React from 'react'; import { DropdownProps } from '../../build/Dropdown/type'; import { SearchProps } from '../../build/Search/type'; declare type SelectAttributes = React.ComponentPropsWithRef<'button'>; export interface SelectProps extends Omit { /** * Set the component className. */ className?: string; /** * Set the component data-testid value. */ dataTestId?: string; /** * Set the component into disabled state. * @default false */ disabled?: boolean; /** * Set interaction to close select dropdown when click outside dropdown. * @default false */ dismissable?: boolean; /** * Set additional props for menu dropdown */ dropdownProps?: DropdownProps; /** * Set the Select dropdown menu opened. * @default false */ open?: boolean; /** * Set the component into error state. * @default false */ error?: boolean; /** * Set the component id attribute. */ id?: string; /** * Set the component list of items. * @default [] */ items?: SelectItemWithEventProps[]; /** * Set field label */ label?: string; /** * Set the width of dropdown menu */ menuWidth?: number | string; /** * Set behavior of clicking item not close the dropdown. * @default false */ multiSelectMode?: boolean; /** * Set the component placeholder text. */ placeholder?: string; /** * Add icon on the left of Select value text */ leftIcon?: React.ReactNode; props?: Record; /** * Set the component size * @default "medium" */ size?: 'medium' | 'large'; /** * Set the component into success state. * @default false */ success?: boolean; /** * Set the component value. * @default '' */ value?: string; /** * Set the component width. */ width?: number | string; /** * Add search capability on the component. */ withSearch?: SearchProps; /** * Set the number of visible items on dropdown window. * @default 5 */ visibleItems?: number; /** * Set the component loading state, if set to `true` it will show default predefined loading style, if set * to `number` it will generate list item loading shimmer as much as the number given, and if you wanted a custome style of loading * just pass as it as a custom node of your choice. */ listLoading?: boolean | number | React.ReactNode; /** * Callback when selecting the item. */ onChange?: (item: SelectItemWithEventProps, e: React.MouseEvent) => void; /** * Callback for onclick. */ onClick?: (e: React.MouseEvent) => void; /** * Callback when dropdown closeed */ onClose?: () => void; /** * Callback when drodown opened */ onOpen?: () => void; /** * Callback when scrolling the dropdown. */ onScroll?: (e: React.UIEvent) => void; } export interface SelectItemProps { /** * Append an object on the item. */ appendObject?: React.ReactNode; /** * Set item to be disabled. */ disabled?: boolean; /** * Set item description. */ description?: string; /** * Add icon on the item. */ icon?: string; /** * Set item as non selectable */ nonSelectable?: boolean; /** * Set item text. */ text?: string; /** * Prepend an object on the item. */ prependObject?: React.ReactNode; /** * Set the item user defined properties. */ props?: any; subItems?: SelectItemWithEventProps[]; /** * Set the item value and text. */ value?: string; } export interface SelectItemWithEventProps extends SelectItemProps { /** * Callback when item is clicked. */ onClick?: (item: SelectItemProps, e: React.MouseEvent) => void; } export interface SelectState { appendObject?: React.ReactNode; hasIcon?: string; openSelect?: boolean; prependObject?: React.ReactNode; focusItem?: number; } export {};