UNPKG

react-elegant-ui

Version:

Elegant UI components, made by BEM best practices for react

44 lines (43 loc) 1.52 kB
import { FC, Ref } from 'react'; import { PressEvents } from '@react-types/shared'; import { IComponentWithAddonNodes, IComponentHTMLElement } from '../../types/IComponent'; import { IToggleable } from '../../types/features/IToggleable'; import { MenuMixedItem } from '../Menu/Menu'; import './Select.css'; import './Trigger/Select-Trigger.css'; export declare const cnSelect: import("@bem-react/classname").ClassNameFormatter; export type Option = MenuMixedItem; export { getTextOfItem as getTextOfOption, isGroup } from '../Menu/Menu'; export interface ISelectProps extends IToggleable, IComponentHTMLElement<HTMLElement>, IComponentWithAddonNodes, PressEvents { options: Option[]; /** * Selected value. When set as array then mode will checkbox, otherwise radio */ value?: string | string[]; /** * Hook for set value */ setValue?: (value?: string | string[]) => void; /** * Disabled state */ disabled?: boolean; /** * Text who will show when selected nothing */ placeholder?: string; /** * Reference to trigger element */ triggerRef?: Ref<HTMLElement>; } export declare const getTextOfSelectedOptions: (options: ISelectProps['options'], value: ISelectProps['value'], opts?: { separator: string; isRemoveHiddenItems: boolean; isRemoveHiddenGroups: boolean; } | undefined) => string; export declare const defaultProps: { placeholder: string; value: string; }; export declare const Select: FC<ISelectProps>;