import { ReactElement, ReactNode, Ref } from 'react'; import { DropdownSharedProps } from '@synerise/ds-dropdown'; import { FormFieldCommonProps } from '@synerise/ds-form-field'; import { InformationCardTooltipProps } from '@synerise/ds-information-card'; import { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar'; import { SearchBarProps } from '@synerise/ds-search-bar'; import { WithHTMLAttributes } from '@synerise/ds-utils'; import { ItemSelectHandler } from '../ItemPickerList/ItemPickerList.types'; import { RenderMode } from '../ItemPickerList/types/renderMode'; import { ItemPickerTriggerProps, ItemPickerTriggerTexts } from '../ItemPickerTrigger/Trigger.types'; import { Action } from './types/actions.types'; import { BaseItemType, BaseSectionType, BaseSectionTypeWithFolders } from './types/baseItemSectionType.types'; import { ItemPickerListTexts } from './types/itemPickerListTexts.types'; type HeightConfig = { defaultHeight: number; viewportHeightThreshold?: number; belowThresholdHeight?: number; }; export type ContainerHeightType = 'fitContent' | 'fillSpace' | HeightConfig; export type ItemLoaderMeta = Record | undefined; export type ItemLoaderResponse = { items: ItemType[]; total: number; meta?: ItemLoaderMeta; }; export type LoaderProps = { sectionId?: BaseSectionType['id']; page: number; limit: number; searchQuery?: string; meta?: ItemLoaderMeta; abortController?: AbortController; searchKey?: string; searchInItem?: BaseItemType; }; export type OnLoadedData = (options: Pick & { renderMode: RenderMode; }) => void; export type ItemLoaderConfig = { limitPerPage?: number; limitPerSection?: number; loadItems: (props: LoaderProps) => Promise>; }; export type ItemsConfig = { limitPerSection?: number; items: ItemType[]; }; export type ItemPickerTexts = ItemPickerListTexts & ItemPickerTriggerTexts; export type ItemPickerProps = WithHTMLAttributes) => ReactNode; texts?: Partial; triggerProps?: { size?: ItemPickerTriggerProps['size']; allowClear?: boolean; withChangeButton?: ItemPickerTriggerProps['withChangeButton']; withClearConfirmation?: ItemPickerTriggerProps['withClearConfirmation']; informationCardTooltipProps?: Omit; }; /** * @deprecated - use errorText prop instead */ errorMessage?: FormFieldCommonProps['errorText']; error?: boolean; isObjectDeleted?: boolean; disabled?: boolean; onChange?: (item: ItemType) => void; onFocus?: () => void; onBlur?: () => void; onLoadedData?: OnLoadedData; dropdownProps?: Partial>; } & Pick, 'items' | 'actions' | 'recents' | 'sections' | 'isLoading' | 'onRefresh' | 'onSectionChange' | 'containerHeight' | 'showItemsSectionLabel' | 'noResultsIcon' | 'emptyListIcon' | 'emptyStateComponent' | 'noResultsComponent' | 'selectedItem' | 'getItemHeight' | 'scrollbarProps' | 'searchBarProps' | 'includeFooter' | 'includeSearchBar'>> & FormFieldCommonProps & Partial>; export type ItemPickerListProps = WithHTMLAttributes; containerHeight?: ContainerHeightType; showItemsSectionLabel?: boolean; noResultsIcon?: ReactElement; emptyListIcon?: ReactElement; emptyStateComponent?: ReactNode; noResultsComponent?: ReactNode; onItemSelect: ItemSelectHandler; onSectionChange?: SectionType extends BaseSectionType ? (section?: BaseSectionTypeWithFolders) => void : undefined; selectedItem?: ItemType; getItemHeight?: (item: ItemType | SectionType | Action) => number; scrollbarProps?: ScrollbarAdditionalProps; searchBarProps?: Omit; onRefresh?: () => void; items: ItemType[] | ItemsConfig | ItemLoaderConfig; isLoading?: boolean; isVisible?: boolean; sections?: SectionType extends BaseSectionType ? BaseSectionTypeWithFolders[] : undefined; containerRef?: Ref; includeSearchBar?: boolean; includeFooter?: boolean; onLoadedData?: OnLoadedData; isDropdown?: boolean; }>; export {};