import { IconComponent, IconPropSize } from '@consta/icons/Icon'; import React from 'react'; import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes'; import { PropForm, PropSize, PropStatus, PropView, RenderItemProps } from '../SelectComponents/types'; export type SelectItemDefault = { label: string; id: string | number; groupId?: string | number; disabled?: boolean; }; export type SelectGroupDefault = { label: string; id: string | number; }; type SelectPropValue = ITEM | null | undefined; type SelectRenderValueProps = { item: ITEM; }; export type SelectPropGetItemLabel = (item: ITEM) => string; export type SelectPropGetItemKey = (item: ITEM) => string | number; export type SelectPropGetItemGroupKey = (item: ITEM) => string | number | undefined; export type SelectPropGetItemDisabled = (item: ITEM) => boolean | undefined; export type SelectPropGetGroupKey = (group: GROUP) => string | number; export type SelectPropGetGroupLabel = (group: GROUP) => string; export type PropRenderItem = (props: RenderItemProps) => React.ReactNode | null; export type PropRenderValue = (props: SelectRenderValueProps) => React.ReactNode | null; export type SelectPropOnChange = (value: ITEM | null, props: { e: React.SyntheticEvent; }) => void; export type SelectProps = PropsWithHTMLAttributesAndRef<{ items: ITEM[]; onChange: SelectPropOnChange; disabled?: boolean; form?: PropForm; dropdownForm?: 'default' | 'brick' | 'round'; size?: PropSize; view?: PropView; status?: PropStatus; focused?: boolean; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; dropdownRef?: React.RefObject; required?: boolean; name?: string; isLoading?: boolean; labelForEmptyItems?: string; value?: SelectPropValue; renderItem?: PropRenderItem; renderValue?: PropRenderValue; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; inputRef?: React.RefObject; groups?: GROUP[]; getItemLabel?: SelectPropGetItemLabel; getItemKey?: SelectPropGetItemKey; getItemGroupKey?: SelectPropGetItemGroupKey; getItemDisabled?: SelectPropGetItemDisabled; getGroupLabel?: SelectPropGetGroupLabel; getGroupKey?: SelectPropGetGroupKey; label?: string; labelIcon?: IconComponent; labelPosition?: 'top' | 'left'; caption?: string; virtualScroll?: boolean; onScrollToBottom?: (length: number) => void; onDropdownOpen?: (isOpen: boolean) => void; dropdownOpen?: boolean; ignoreOutsideClicksRefs?: ReadonlyArray>; dropdownViewportRef?: React.RefObject; dropdownContainer?: Element; }, HTMLDivElement> & (ITEM extends { label: SelectItemDefault['label']; } ? {} : { getItemLabel: SelectPropGetItemLabel; }) & (ITEM extends { id: SelectItemDefault['id']; } ? {} : { getItemKey: SelectPropGetItemKey; }) & (GROUP extends { label: SelectGroupDefault['label']; } ? {} : { getGroupLabel: SelectPropGetGroupLabel; }) & (GROUP extends { id: SelectGroupDefault['id']; } ? {} : { getGroupKey: SelectPropGetGroupKey; }); export type SelectComponent = (props: SelectProps) => React.ReactNode | null; export declare const defaultGetItemKey: SelectPropGetItemKey; export declare const defaultGetItemLabel: SelectPropGetItemLabel; export declare const defaultGetItemGroupKey: SelectPropGetItemGroupKey; export declare const defaultGetItemDisabled: SelectPropGetItemDisabled; export declare const defaultGetGroupKey: SelectPropGetGroupKey; export declare const defaultGetGroupLabel: SelectPropGetGroupLabel; export declare function withDefaultGetters(props: SelectProps): { items: ITEM[]; onChange: SelectPropOnChange; disabled?: boolean; form?: PropForm; dropdownForm?: "default" | "brick" | "round"; size?: PropSize; view?: PropView; status?: PropStatus; focused?: boolean; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; dropdownRef?: React.RefObject; required?: boolean; name?: string; isLoading?: boolean; labelForEmptyItems?: string; value?: SelectPropValue; renderItem?: PropRenderItem | undefined; renderValue?: PropRenderValue | undefined; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; inputRef?: React.RefObject; groups?: GROUP[] | undefined; getItemLabel?: SelectPropGetItemLabel | undefined; getItemKey?: SelectPropGetItemKey | undefined; getItemGroupKey?: SelectPropGetItemGroupKey | undefined; getItemDisabled?: SelectPropGetItemDisabled | undefined; getGroupLabel?: SelectPropGetGroupLabel | undefined; getGroupKey?: SelectPropGetGroupKey | undefined; label?: string; labelIcon?: IconComponent; labelPosition?: "top" | "left"; caption?: string; virtualScroll?: boolean; onScrollToBottom?: (length: number) => void; onDropdownOpen?: (isOpen: boolean) => void; dropdownOpen?: boolean; ignoreOutsideClicksRefs?: ReadonlyArray>; dropdownViewportRef?: React.RefObject; dropdownContainer?: Element; } & Omit, "css" | "onFocus" | "onBlur" | "onChange" | "size" | "view" | "form" | "status" | "caption" | "label" | "name" | "disabled" | "value" | "placeholder" | "required" | "inputRef" | "items" | "dropdownForm" | "focused" | "ariaLabel" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "labelIcon" | "labelPosition" | "onScrollToBottom" | "onDropdownOpen" | "dropdownOpen" | "ignoreOutsideClicksRefs" | "virtualScroll" | "dropdownViewportRef" | "dropdownContainer"> & React.RefAttributes & (ITEM extends { label: SelectItemDefault["label"]; } ? {} : { getItemLabel: SelectPropGetItemLabel; }) & (ITEM extends { id: SelectItemDefault["id"]; } ? {} : { getItemKey: SelectPropGetItemKey; }) & (GROUP extends { label: SelectGroupDefault["label"]; } ? {} : { getGroupLabel: SelectPropGetGroupLabel; }) & (GROUP extends { id: SelectGroupDefault["id"]; } ? {} : { getGroupKey: SelectPropGetGroupKey; }) & { getItemLabel: SelectPropGetItemLabel | SelectPropGetItemLabel; getItemKey: SelectPropGetItemKey | SelectPropGetItemKey; getItemGroupKey: SelectPropGetItemGroupKey | SelectPropGetItemGroupKey; getItemDisabled: SelectPropGetItemDisabled | SelectPropGetItemDisabled; getGroupLabel: SelectPropGetGroupLabel | SelectPropGetGroupLabel; getGroupKey: SelectPropGetGroupKey | SelectPropGetGroupKey; }; export declare const iconSizeMap: Record; export {};