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 UserSelectItemDefault = { label: string; id: string | number; subLabel?: string; avatarUrl?: string; groupId?: string | number; disabled?: boolean; }; export type UserSelectGroupDefault = { label: string; id: string | number; }; type UserSelectRenderValueProps = { item: ITEM; handleRemove?: (e: React.SyntheticEvent) => void; }; export type UserSelectPropGetItemLabel = (item: ITEM) => string; export type UserSelectPropGetItemSubLabel = (item: ITEM) => string | undefined; export type UserSelectPropGetItemAvatarUrl = (item: ITEM) => string | undefined; export type UserSelectPropGetItemKey = (item: ITEM) => string | number; export type UserSelectPropGetItemGroupKey = (item: ITEM) => string | number | undefined; export type UserSelectPropGetItemDisabled = (item: ITEM) => boolean | undefined; export type UserSelectPropGetGroupKey = (group: GROUP) => string | number; export type UserSelectPropGetGroupLabel = (group: GROUP) => string; export type UserSelectPropSearchFunction = (item: ITEM, searchValue: string) => boolean; type UserSelectPropOnChange = (value: (MULTIPLE extends true ? ITEM[] : ITEM) | null, props: { e: React.SyntheticEvent; }) => void; type UserSelectPropValue = (MULTIPLE extends true ? ITEM[] : ITEM) | null | undefined; export type UserSelectPropRenderItem = (props: RenderItemProps) => React.ReactNode | null; export type UserSelectPropRenderValue = (props: UserSelectRenderValueProps) => 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?: UserSelectPropRenderItem; renderValue?: UserSelectPropRenderValue; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; onCreate?: (label: string, props: { e: React.SyntheticEvent; }) => void; inputRef?: React.RefObject; labelForNotFound?: string; labelForCreate?: string; labelForEmptyItems?: string; searchFunction?: UserSelectPropSearchFunction; searchValue?: string; multiple?: MULTIPLE; value?: UserSelectPropValue; onChange: UserSelectPropOnChange; groups?: GROUP[]; getItemLabel?: UserSelectPropGetItemLabel; getItemSubLabel?: UserSelectPropGetItemSubLabel; getItemAvatarUrl?: UserSelectPropGetItemAvatarUrl; getItemKey?: UserSelectPropGetItemKey; getItemGroupKey?: UserSelectPropGetItemGroupKey; getItemDisabled?: UserSelectPropGetItemDisabled; getGroupLabel?: UserSelectPropGetGroupLabel; getGroupKey?: UserSelectPropGetGroupKey; label?: string; labelIcon?: IconComponent; caption?: string; labelPosition?: 'top' | 'left'; virtualScroll?: boolean; onScrollToBottom?: (length: number) => void; onSearchValueChange?: (value: string) => void; onDropdownOpen?: (isOpen: boolean) => void; dropdownOpen?: boolean; ignoreOutsideClicksRefs?: ReadonlyArray>; }, HTMLDivElement> & (ITEM extends { label: UserSelectItemDefault['label']; } ? {} : { getItemLabel: UserSelectPropGetItemLabel; }) & (ITEM extends { id: UserSelectItemDefault['id']; } ? {} : { getItemKey: UserSelectPropGetItemKey; }) & (GROUP extends { label: UserSelectGroupDefault['label']; } ? {} : { getGroupLabel: UserSelectPropGetGroupLabel; }) & (GROUP extends { id: UserSelectGroupDefault['id']; } ? {} : { getGroupKey: UserSelectPropGetGroupKey; }); export type UserSelectComponent = (props: UserSelectProps) => React.ReactNode | null; export declare const defaultGetItemKey: UserSelectPropGetItemKey; export declare const defaultGetItemLabel: UserSelectPropGetItemLabel; export declare const defaultGetItemSubLabel: UserSelectPropGetItemSubLabel; export declare const defaultGetItemAvatarUrl: UserSelectPropGetItemAvatarUrl; export declare const defaultGetItemGroupKey: UserSelectPropGetItemGroupKey; export declare const defaultGetItemDisabled: UserSelectPropGetItemDisabled; export declare const defaultGetGroupKey: UserSelectPropGetGroupKey; export declare const defaultGetGroupLabel: UserSelectPropGetGroupLabel; 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?: UserSelectPropRenderItem | undefined; renderValue?: UserSelectPropRenderValue | undefined; onFocus?: React.FocusEventHandler; onBlur?: React.FocusEventHandler; onCreate?: (label: string, props: { e: React.SyntheticEvent; }) => void; inputRef?: React.RefObject; labelForNotFound?: string; labelForCreate?: string; labelForEmptyItems?: string; searchFunction?: UserSelectPropSearchFunction | undefined; searchValue?: string; multiple?: MULTIPLE | undefined; value?: UserSelectPropValue; onChange: UserSelectPropOnChange; groups?: GROUP[] | undefined; getItemLabel?: UserSelectPropGetItemLabel | undefined; getItemSubLabel?: UserSelectPropGetItemSubLabel | undefined; getItemAvatarUrl?: UserSelectPropGetItemAvatarUrl | undefined; getItemKey?: UserSelectPropGetItemKey | undefined; getItemGroupKey?: UserSelectPropGetItemGroupKey | undefined; getItemDisabled?: UserSelectPropGetItemDisabled | undefined; getGroupLabel?: UserSelectPropGetGroupLabel | undefined; getGroupKey?: UserSelectPropGetGroupKey | undefined; label?: string; labelIcon?: IconComponent; caption?: string; labelPosition?: "top" | "left"; virtualScroll?: boolean; onScrollToBottom?: (length: number) => void; onSearchValueChange?: (value: string) => void; onDropdownOpen?: (isOpen: boolean) => void; dropdownOpen?: boolean; ignoreOutsideClicksRefs?: ReadonlyArray>; } & 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" | "onScrollToBottom" | "labelForCreate" | "searchFunction" | "searchValue" | "onDropdownOpen" | "onSearchValueChange" | "dropdownOpen" | "ignoreOutsideClicksRefs" | "labelForNotFound" | "virtualScroll" | "onCreate" | "getItemSubLabel" | "getItemAvatarUrl"> & React.RefAttributes & (ITEM extends { label: UserSelectItemDefault["label"]; } ? {} : { getItemLabel: UserSelectPropGetItemLabel; }) & (ITEM extends { id: UserSelectItemDefault["id"]; } ? {} : { getItemKey: UserSelectPropGetItemKey; }) & (GROUP extends { label: UserSelectGroupDefault["label"]; } ? {} : { getGroupLabel: UserSelectPropGetGroupLabel; }) & (GROUP extends { id: UserSelectGroupDefault["id"]; } ? {} : { getGroupKey: UserSelectPropGetGroupKey; }) & { getItemLabel: UserSelectPropGetItemLabel | UserSelectPropGetItemLabel; getItemKey: UserSelectPropGetItemKey | UserSelectPropGetItemKey; getItemGroupKey: UserSelectPropGetItemGroupKey | UserSelectPropGetItemGroupKey; getItemDisabled: UserSelectPropGetItemDisabled | UserSelectPropGetItemDisabled; getGroupLabel: UserSelectPropGetGroupLabel | UserSelectPropGetGroupLabel; getGroupKey: UserSelectPropGetGroupKey | UserSelectPropGetGroupKey; getItemSubLabel: UserSelectPropGetItemSubLabel | UserSelectPropGetItemSubLabel; getItemAvatarUrl: UserSelectPropGetItemAvatarUrl | UserSelectPropGetItemAvatarUrl; }; export declare const searchCompare: (searchValue: string, compare?: string) => boolean; export declare const clearSizeMap: Record; export declare const iconSizeMap: Record; export {};