import type { Snippet } from 'svelte'; import type { Artifact, ArtifactType, RallyWSAPIStoreConfig } from '../../utils/rallySDKTypes.js'; export type ComboboxItem = Artifact> = { displayText: string | number; displaySubText?: string | number; value: Record | string | number | null | undefined; record?: T; }; export type ComboboxState = { selectedItem?: Omit; selectedItems?: Omit[]; }; export interface BaseComboboxProps> { /** * Can be used to specify a pre-defined configuration for commonly used combos. Eliminates the need to * specify storeConfig, displayField, etc... */ type?: ArtifactType | 'Release' | 'Iteration' | 'User' | 'ScheduleState' | 'FlowState' | 'Investment' | 'Tag' | 'Color' | 'Project' | (string & {}) | undefined; /** * Default is 50. * Limit the number of results shown. User then uses the search input to find other values not shown. * This is an alternate experience to paginating results. Pagination must be false and hasSearch must be true */ limit?: number; pagination?: boolean; pageSize?: number; label?: string; labelPosition?: 'top' | 'right' | 'bottom' | 'left'; labelStyle?: string; hasSearch?: boolean; allowBlank?: boolean; allowNoEntry?: boolean; noEntryText?: string; noEntryValue?: string | number | Record | null | undefined; value?: unknown; displayField?: string; valueField?: string; displaySubField?: string | undefined; subTextSeparator?: string | undefined; subTextStyle?: string; subTextRenderer?: ((record: T) => string) | undefined; storeConfig?: (RallyWSAPIStoreConfig & { types?: string[]; }) | undefined; queryDelay?: number; placeholder?: string; initialValue?: unknown; style?: string | undefined; stateId?: string | undefined; expandOnMount?: boolean; autoSelectWhenNotAllowingBlank?: boolean; disabled?: boolean; footer?: Snippet; defaultProps?: SingleSelectComboboxProps | MultiSelectComboboxProps | undefined; } export interface SingleSelectComboboxProps = Artifact> extends BaseComboboxProps { multiselect?: false; data?: T[] | Promise; onReady?: (selectedItem: ComboboxItem | undefined) => void; onChange?: (selectedItem: ComboboxItem | undefined) => void; fakePropForTesting?: string; } export interface MultiSelectComboboxProps = Artifact> extends BaseComboboxProps { multiselect: true; data?: T[] | Promise; onReady?: (selectedItems: ComboboxItem[]) => void; onChange?: (selectedItems: ComboboxItem[]) => void; differentFakePropForTesting?: string; } export type FooterProps> = { pagination: boolean; totalCount: number; pageSize: number; limit: number; hasSearch: boolean; currentPage: number; dropdownItems: ComboboxItem[]; includeClear: boolean; includeNoEntryItem: boolean; onPageChange: (currentPage: number) => void; };