import type { Icon } from "../icon.js"; interface BaseComboboxOption { /** The value that will be saved into your form data when this option is selected */ value: string; /** The label the user will see for this option */ label: string; /** An optional description the user will see for this option */ description?: string; /** Optional additional search terms that will be matched against the user's search query but not displayed */ keywords?: ReadonlyArray; } export interface IconComboboxOption extends BaseComboboxOption { /** An icon to display for this option */ icon: Icon; /** Excluded from icon options */ avatarUrl?: never; /** Excluded from icon options */ color?: never; } export interface AvatarComboboxOption extends BaseComboboxOption { /** Excluded from avatar options */ icon?: never; /** An avatar to display for this option */ avatarUrl: string; /** Excluded from avatar options */ color?: never; } export interface ColorComboboxOption extends BaseComboboxOption { /** Excluded from color options */ icon?: never; /** Excluded from color options */ avatarUrl?: never; /** A CSS color to display for this option */ color: string; } export interface PlainComboboxOption extends BaseComboboxOption { /** Excluded from plain options */ icon?: never; /** Excluded from plain options */ avatarUrl?: never; /** Excluded from plain options */ color?: never; } export type ComboboxOption = IconComboboxOption | AvatarComboboxOption | ColorComboboxOption | PlainComboboxOption; export interface CategorizedIconComboboxOption extends IconComboboxOption { /** * A category label to display this option under. */ categoryLabel: string; } export interface CategorizedAvatarComboboxOption extends AvatarComboboxOption { /** * A category label to display this option under. */ categoryLabel: string; } export interface CategorizedColorComboboxOption extends ColorComboboxOption { /** * A category label to display this option under. */ categoryLabel: string; } export interface CategorizedPlainComboboxOption extends PlainComboboxOption { /** * A category label to display this option under. */ categoryLabel: string; } export type CategorizedComboboxOption = CategorizedIconComboboxOption | CategorizedAvatarComboboxOption | CategorizedColorComboboxOption | CategorizedPlainComboboxOption; export type DecoratedComboboxOption = IconComboboxOption | AvatarComboboxOption | ColorComboboxOption; export type CategorizedDecoratedComboboxOption = CategorizedIconComboboxOption | CategorizedAvatarComboboxOption | CategorizedColorComboboxOption; export interface DecoratedComboboxOptionsProvider { /** * An async function that, given an option value, returns the label and icon of the option, * or undefined if the option is not found. * * @param value The value of the option (string for single-select, or string from array for multi-select) * @returns The label and icon of the option */ getOption: (value: string) => Promise | undefined>; /** * An async function that, given a search query, returns a list of "matching" icon combobox options. * * What "matching" means is up to the developer. * * @param query The search query * @returns A list of icon combobox options */ search: (query: string) => Promise | Array>; } export interface PlainComboboxOptionsProvider { /** * An async function that, given an option value, returns the label of the option, * or undefined if the option is not found. * * @param value The value of the option (string for single-select, or string from array for multi-select) * @returns The label of the option */ getOption: (value: string) => Promise | undefined>; /** * An async function that, given a search query, returns a list of "matching" plain combobox options. * * What "matching" means is up to the developer. * * @param query The search query * @returns A list of plain combobox options */ search: (query: string) => Promise | Array>; } export type ComboboxOptionsProvider = DecoratedComboboxOptionsProvider | PlainComboboxOptionsProvider; export {}; //# sourceMappingURL=combobox.d.ts.map