"use client"; import { Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, ComboboxValue, } from "@/components/ui/combobox"; export interface Option { id: string; label: string; } interface Props { value: string; options: Option[]; onChange: (id: string) => void; ariaLabel: string; /** shown in the search field inside the popup */ placeholder?: string; /** render the value in placeholder grey — a default nobody has confirmed yet */ muted?: boolean; } /** * A type-ahead that reads as part of the sentence. Same chip as * SentenceSelect, but the list is long enough (316 hardware configurations) * that scrolling it is hopeless — so the popup opens on a search field. */ export default function SentenceCombobox({ value, options, onChange, ariaLabel, placeholder = "Search", muted = false, }: Props) { const current = options.find((o) => o.id === value) ?? options[0]; return ( o && onChange(o.id)} itemToStringLabel={(o: Option) => o.label} > Nothing matches {(o: Option) => ( {o.label} )} ); }