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; subLabel?: string; avatarUrl?: string; groupId?: string | number; disabled?: boolean; }; export type DefaultGroup = { label: string; id: string | number; }; type RenderValueProps = { item: ITEM; handleRemove?: (e: React.SyntheticEvent) => void; }; export type PropGetItemLabel = (item: ITEM) => string; export type PropGetItemSubLabel = (item: ITEM) => string | undefined; export type PropGetItemAvatarUrl = (item: ITEM) => string | undefined; 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; type PropSearchFunction = (item: ITEM, searchValue: string) => boolean; type PropOnChange = (props: { value: (MULTIPLE extends true ? ITEM[] : ITEM) | null; e: React.SyntheticEvent; }) => void; type PropValue = (MULTIPLE extends true ? ITEM[] : ITEM) | null | undefined; export type PropRenderItem = (props: RenderItemProps) => React.ReactNode | null; export type PropRenderValue = (props: RenderValueProps) => React.ReactNode | null; export type UserSelectProps = PropsWithHTMLAttributesAndRef<{ disabled?: boolean; form?: PropForm; size?: Exclude; view?: PropView; dropdownForm?: 'default' | 'brick' | 'round'; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; status?: PropStatus; dropdownRef?: React.RefObject; name?: string; items: ITEM[]; required?: boolean; isLoading?: boolean; renderItem?: PropRenderItem; renderValue?: PropRenderValue; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; onCreate?: (props: { e: React.SyntheticEvent; label: string; }) => void; inputRef?: React.RefObject; labelForNotFound?: string; labelForCreate?: string; labelForEmptyItems?: string; searchFunction?: PropSearchFunction; searchValue?: string; multiple?: MULTIPLE; value?: PropValue; onChange: PropOnChange; groups?: GROUP[]; getItemLabel?: PropGetItemLabel; getItemSubLabel?: PropGetItemSubLabel; getItemAvatarUrl?: PropGetItemAvatarUrl; getItemKey?: PropGetItemKey; getItemGroupKey?: PropGetItemGroupKey; getItemDisabled?: PropGetItemDisabled; getGroupLabel?: PropGetGroupLabel; getGroupKey?: PropGetGroupKey; label?: string; labelIcon?: IconComponent; caption?: string; labelPosition?: 'top' | 'left'; }, 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 UserSelectComponent = (props: UserSelectProps) => React.ReactNode | null; export declare const defaultGetItemKey: PropGetItemKey; export declare const defaultGetItemLabel: PropGetItemLabel; export declare const defaultGetItemSubLabel: PropGetItemSubLabel; export declare const defaultGetItemAvatarUrl: PropGetItemAvatarUrl; export declare const defaultGetItemGroupKey: PropGetItemGroupKey; export declare const defaultGetItemDisabled: PropGetItemDisabled; export declare const defaultGetGroupKey: PropGetGroupKey; export declare const defaultGetGroupLabel: PropGetGroupLabel; export declare const isMultipleParams: (params: UserSelectProps) => params is UserSelectProps; export declare const isNotMultipleParams: (params: UserSelectProps) => params is UserSelectProps; export declare function withDefaultGetters(props: UserSelectProps): { disabled?: boolean; form?: PropForm; size?: Exclude; view?: PropView; dropdownForm?: "default" | "brick" | "round"; placeholder?: string; ariaLabel?: string; dropdownClassName?: string; status?: PropStatus; dropdownRef?: React.RefObject; name?: string; items: ITEM[]; required?: boolean; isLoading?: boolean; renderItem?: PropRenderItem | undefined; renderValue?: PropRenderValue | undefined; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; onCreate?: (props: { e: React.SyntheticEvent; label: string; }) => void; inputRef?: React.RefObject; labelForNotFound?: string; labelForCreate?: string; labelForEmptyItems?: string; searchFunction?: PropSearchFunction | undefined; searchValue?: string; multiple?: MULTIPLE | undefined; value?: PropValue; onChange: PropOnChange; groups?: GROUP[] | undefined; getItemLabel?: PropGetItemLabel | undefined; getItemSubLabel?: PropGetItemSubLabel | undefined; getItemAvatarUrl?: PropGetItemAvatarUrl | undefined; getItemKey?: PropGetItemKey | undefined; getItemGroupKey?: PropGetItemGroupKey | undefined; getItemDisabled?: PropGetItemDisabled | undefined; getGroupLabel?: PropGetGroupLabel | undefined; getGroupKey?: PropGetGroupKey | undefined; label?: string; labelIcon?: IconComponent; caption?: string; labelPosition?: "top" | "left"; } & Omit, "css" | "onFocus" | "onBlur" | "onChange" | "size" | "view" | "form" | "status" | "caption" | "label" | "name" | "disabled" | "value" | "multiple" | "placeholder" | "required" | "inputRef" | "items" | "dropdownForm" | "ariaLabel" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "labelIcon" | "labelPosition" | "labelForCreate" | "searchFunction" | "searchValue" | "labelForNotFound" | "onCreate" | "getItemSubLabel" | "getItemAvatarUrl"> & 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; getItemSubLabel: PropGetItemSubLabel | PropGetItemSubLabel; getItemAvatarUrl: PropGetItemAvatarUrl | PropGetItemAvatarUrl; }; export declare const searchCompare: (searchValue: string, compare?: string) => boolean; export declare const clearSizeMap: Record; export declare const iconSizeMap: Record; export {};