import { ReactElement, RefObject } from 'react'; import { AiMarkWithTooltipOrPopoverProps, CheckState } from '../../types'; import { SelectFieldOption, SelectFieldProps } from '../../beta/components/SelectField/types'; /** * Metadata about list sections for rendering purposes. * Used by SelectOptions, MultiSelectOptions, and their Menu counterparts to render section headers and dividers. * @property type - The type of section ("pinned" for pinned options, "group" for grouped options) * @property label - Section label (e.g., "Recent", "Favorites", or group name) * @property startIndex - Index in items where this section starts * @property endIndex - Index where this section ends (exclusive) * @property loading - Whether this section is still loading its options (pinned sections only) */ export type SectionMeta = { type: "pinned" | "group"; label: string; startIndex: number; endIndex: number; loading?: boolean; }; export type SelectFieldBaseInternalProps = { id: string; helperUid: string; selectedOption: SelectFieldOption | null; onSelectedOptionChange: (option: SelectFieldOption | null) => void; displayAs: "popover" | "dialog"; isDisabledOrReadOnly: boolean; disabled?: boolean; readOnly?: boolean; required?: boolean; placeholder?: string; size?: "small" | "medium" | "large"; error?: boolean | string | ReactElement | string[]; hasHelperText: boolean; disableClearButton: boolean; prefix?: string | ReactElement; suffix?: string | ReactElement; label: string; hideLabel?: boolean; hint?: ReactElement | string; labelAiMark?: AiMarkWithTooltipOrPopoverProps["aiMark"]; errorMessages?: string | ReactElement | string[]; warning?: string | string[]; description?: ReactElement | string; className?: string; style?: React.CSSProperties; layoutStyles?: React.CSSProperties; pinned?: SelectFieldProps["pinned"]; groupToString?: (groupValue: string | number) => string; groupSorter?: (a: string | number, b: string | number) => number; virtualize?: boolean; options: SelectFieldOption[]; loading: boolean; loadingMore: boolean; hasMore: boolean; loadOptions: (searchValue: string, opts?: { initial?: boolean; }) => Promise; loadMore: (searchValue: string) => Promise; initialLoad: "immediate" | "open"; initialLoadPerformed: boolean; setInitialLoadPerformed: (val: boolean) => void; inputWrapperRef: RefObject; }; export type SelectFieldComboboxInternalProps = SelectFieldBaseInternalProps & { debounceMs: number; }; /** * Loose prop getter types compatible with both downshift's useCombobox and useSelect. * Using `any` for the return types is intentional: the actual runtime shapes are identical * between the two hooks, but their compile-time generic types diverge. */ export type GetMenuPropsFn = (...args: any[]) => any; export type GetItemPropsFn = (...args: any[]) => any; export type GetLabelPropsFn = (...args: any[]) => any; export type SelectItem = { id: string | number; type: "option" | "pinned-option" | "grouped-option" | "select-all" | "select-filtered"; original: SelectFieldOption; disabled?: boolean; checkState?: CheckState; };