/** * Select accessibility projection. */ import type { MdyPartContract } from "../contract.js"; import type { defaultWidgetIdFactory } from "../ids.js"; export interface MdySelectA11yOptions { readonly widgetId: string; readonly open: boolean; readonly activeKey: string | null; readonly selectedKey: string | null; readonly disabled: boolean; readonly readonly: boolean; readonly invalid: boolean; /** * Whether the form is asking for an answer here. * * A combobox is not a native control and carries none of a field's rules on its own: without this * a required select announced nothing about being required, while its two siblings said so — and * the renderers that said it were each deciding for themselves what the contract had not. * * Optional so a caller with no field behind the widget says nothing rather than guessing. */ readonly required?: boolean; readonly loading: boolean; readonly idFactory: typeof defaultWidgetIdFactory; /** Keys of options currently visible to the user. */ readonly visibleKeys: readonly string[]; /** * Whether the error list and the supporting text are on screen. * * `aria-describedby` must name an element that exists, so what the trigger describes itself by * follows what was *rendered* rather than what is wrong. The renderer knows both; this projection * cannot see the DOM. */ readonly errorsVisible?: boolean; readonly descriptionVisible?: boolean; /** * Whether the listbox is in the document. * * Not the same question as `open`: an eagerly-mounted popup is present and hidden while closed, a * lazily-mounted one does not exist until it opens. Defaults to true. */ readonly popupRendered?: boolean; /** * Which of the kind's two shapes this is, as `variantOf` answers it. * * The custom combobox is a control this library builds, so it carries the whole opener relation — * expanded, controls, the cursor it points at. The native chooser is the platform's, and the * platform owns that popup: those attributes describe a list this projection does not draw, and * on an element whose role does not admit them they are dropped without a word. What both shapes * share is the field's own verdict — wrong, required, described by, out of play — and that is * what stays unconditional. ADR 0176. * * Defaults to the custom shape, which is what every caller drew before the variants were declared. */ readonly variant?: string; } export interface MdySelectA11yProjection { readonly trigger: MdyPartContract; /** The filter field. It lives inside the popup, not over the trigger's own text. */ readonly search: MdyPartContract; readonly options: MdyPartContract; readonly option: (key: string, disabled?: boolean) => MdyPartContract; } export declare function projectSelectA11y(options: MdySelectA11yOptions): MdySelectA11yProjection;