import { IconComponent, IconPropSize } from '@consta/icons/Icon'; import React from 'react'; import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes'; import { PropForm, PropSize, PropStatus, PropView, RenderItemProps } from '../SelectComponentsDeprecated/types'; export type DefaultItem = { label: string; id: string | number; groupId?: string | number; disabled?: boolean; }; export type DefaultGroup = { label: string; id: string | number; }; type PropValue = ITEM | null | undefined; type RenderValueProps = { item: ITEM; }; export type PropGetItemLabel = (item: ITEM) => string; export type PropGetItemKey = (item: ITEM) => string | number; export type PropGetItemGroupKey = (item: ITEM) => string | number | undefined; export type PropGetItemDisabled = (item: ITEM) => boolean | undefined; export type PropGetGroupKey = (group: GROUP) => string | number; export type PropGetGroupLabel = (group: GROUP) => string; export type PropRenderItem = (props: RenderItemProps) => React.ReactNode | null; export type PropRenderValue = (props: RenderValueProps) => React.ReactNode | null; export type SelectProps = PropsWithHTMLAttributesAndRef<{ items: ITEM[]; onChange: (props: { value: ITEM | null; e: React.SyntheticEvent; }) => void; disabled?: boolean; form?: PropForm; dropdownForm?: 'default' | 'brick' | 'round'; size?: PropSize; view?: PropView; status?: PropStatus; focused?: boolean; multiple?: boolean; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; dropdownRef?: React.RefObject; required?: boolean; name?: string; isLoading?: boolean; labelForEmptyItems?: string; value?: PropValue; renderItem?: PropRenderItem; renderValue?: PropRenderValue; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; inputRef?: React.RefObject; groups?: GROUP[]; getItemLabel?: PropGetItemLabel; getItemKey?: PropGetItemKey; getItemGroupKey?: PropGetItemGroupKey; getItemDisabled?: PropGetItemDisabled; getGroupLabel?: PropGetGroupLabel; getGroupKey?: PropGetGroupKey; label?: string; labelIcon?: IconComponent; labelPosition?: 'top' | 'left'; caption?: string; }, HTMLDivElement> & (ITEM extends { label: DefaultItem['label']; } ? {} : { getItemLabel: PropGetItemLabel; }) & (ITEM extends { id: DefaultItem['id']; } ? {} : { getItemKey: PropGetItemKey; }) & (GROUP extends { label: DefaultGroup['label']; } ? {} : { getGroupLabel: PropGetGroupLabel; }) & (GROUP extends { id: DefaultGroup['id']; } ? {} : { getGroupKey: PropGetGroupKey; }); export type SelectComponent = (props: SelectProps) => React.ReactNode | null; export declare const defaultGetItemKey: PropGetItemKey; export declare const defaultGetItemLabel: PropGetItemLabel; export declare const defaultGetItemGroupKey: PropGetItemGroupKey; export declare const defaultGetItemDisabled: PropGetItemDisabled; export declare const defaultGetGroupKey: PropGetGroupKey; export declare const defaultGetGroupLabel: PropGetGroupLabel; export declare function withDefaultGetters(props: SelectProps): { items: ITEM[]; onChange: (props: { value: ITEM | null; e: React.SyntheticEvent; }) => void; disabled?: boolean; form?: PropForm; dropdownForm?: "default" | "brick" | "round"; size?: PropSize; view?: PropView; status?: PropStatus; focused?: boolean; multiple?: boolean; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; dropdownRef?: React.RefObject; required?: boolean; name?: string; isLoading?: boolean; labelForEmptyItems?: string; value?: PropValue; renderItem?: PropRenderItem | undefined; renderValue?: PropRenderValue | undefined; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; inputRef?: React.RefObject; groups?: GROUP[] | undefined; getItemLabel?: PropGetItemLabel | undefined; getItemKey?: PropGetItemKey | undefined; getItemGroupKey?: PropGetItemGroupKey | undefined; getItemDisabled?: PropGetItemDisabled | undefined; getGroupLabel?: PropGetGroupLabel | undefined; getGroupKey?: PropGetGroupKey | undefined; label?: string; labelIcon?: IconComponent; labelPosition?: "top" | "left"; caption?: string; } & Omit, "css" | "onFocus" | "onBlur" | "onChange" | "size" | "view" | "form" | "status" | "caption" | "label" | "name" | "disabled" | "value" | "multiple" | "placeholder" | "required" | "inputRef" | "items" | "dropdownForm" | "focused" | "ariaLabel" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "labelIcon" | "labelPosition"> & React.RefAttributes & (ITEM extends { label: DefaultItem["label"]; } ? {} : { getItemLabel: PropGetItemLabel; }) & (ITEM extends { id: DefaultItem["id"]; } ? {} : { getItemKey: PropGetItemKey; }) & (GROUP extends { label: DefaultGroup["label"]; } ? {} : { getGroupLabel: PropGetGroupLabel; }) & (GROUP extends { id: DefaultGroup["id"]; } ? {} : { getGroupKey: PropGetGroupKey; }) & { getItemLabel: PropGetItemLabel | PropGetItemLabel; getItemKey: PropGetItemKey | PropGetItemKey; getItemGroupKey: PropGetItemGroupKey | PropGetItemGroupKey; getItemDisabled: PropGetItemDisabled | PropGetItemDisabled; getGroupLabel: PropGetGroupLabel | PropGetGroupLabel; getGroupKey: PropGetGroupKey | PropGetGroupKey; }; export declare const iconSizeMap: Record; export {};