import type { ReactNode } from 'react'; import { type ComboboxItem, type ComboboxItems } from '../../components/comboboxItems.js'; /** A choice as workflow YAML writes it, or as a host's option hook builds one. */ export interface FieldOptionItem { label: string; value: Value; description?: string | undefined; /** The older key for description. */ secondaryLabel?: string | undefined; /** What choosing this sets the field's `secondaryField` to. */ secondaryValue?: unknown; disabled?: boolean | undefined; icon?: ReactNode; } /** Choices under a heading. */ export interface FieldOptionGroup { category?: string | undefined; options: readonly (FieldOptionItem | string)[]; } /** A dropdown option: a bare string is a choice labeled by its value. */ export type FieldOption = string | FieldOptionItem | FieldOptionGroup; /** A picker item that also sets other fields when chosen, through `secondaryField`. */ export type ChoiceItem = ComboboxItem & { secondaryValue?: unknown; }; /** Options as picker items, groups kept where they sit. */ export declare function toFieldItems(options: readonly FieldOption[]): ComboboxItems; /** Every item, groups flattened. */ export declare const leaves: (items: ComboboxItems) => (ChoiceItem | string)[]; export declare const itemValue: (item: ChoiceItem | string) => unknown; /** The item among `items` holding `value`, with what it sets through `secondaryField`. */ export declare function findChoice(items: ComboboxItems, value: unknown): ChoiceItem | undefined;