import type { ControlSize } from "@charcuterie/tokens" import type { ReactNode } from "react" import { PANEL_ITEM_SIZE_CLASS } from "../controlStyles.ts" import type { ListboxItem } from "../Listbox/Listbox.tsx" import { toClassName } from "../toClassName.ts" export type ComboboxOptionProps = { /** The stable DOM id `aria-activedescendant` points at. */ id: string isActive: boolean isSelected: boolean /** Already stepped down for a short window by `usePanelItemSize`. */ itemSize: ControlSize item: ListboxItem onSelect: (value: string) => void /** * `aria-posinset`/`aria-setsize`, required when the list is * virtualized: most of it is not in the DOM, so a screen reader * would otherwise announce "2 of 12" for a 4,000-item list. */ posInSet?: number setSize?: number } /** * `role="option"` with **`tabIndex={-1}`**, and both halves matter. * The APG combobox keeps focus in the text input and tracks the * active option with `aria-activedescendant`, so no option is ever a * tab stop — `tabIndex={-1}` is that. It is a ` ) }