import { Widget } from "../widget.js"; import { ThemeIcon } from "../../../common/themables.js"; import { IHoverDelegate } from "../hover/hoverDelegate.js"; import { IDisposable } from "../../../common/lifecycle.js"; export interface IRadioStyles { readonly activeForeground?: string; readonly activeBackground?: string; readonly activeBorder?: string; readonly inactiveForeground?: string; readonly inactiveBackground?: string; readonly inactiveHoverBackground?: string; readonly inactiveBorder?: string; } export interface IRadioOptionItem { readonly text: string; readonly tooltip?: string; /** Accessible name. Defaults to {@link tooltip} ?? {@link text}. Set it when {@link text} is icon-only. */ readonly ariaLabel?: string; readonly isActive?: boolean; readonly disabled?: boolean; /** Starts a new row of a segmented radio, for items that don't fit beside the ones before them. */ readonly startsRow?: boolean; } export interface IRadioOptions { readonly items: ReadonlyArray; readonly activeIcon?: ThemeIcon; readonly hoverDelegate?: IHoverDelegate; /** Accessible name of the radio group. */ readonly ariaLabel?: string; /** Extra class added to {@link Radio.domNode}, e.g. `segmented` for rounded-rectangle segments. */ readonly className?: string; /** Leaves every item unchecked when none is marked active, without removing the group from the tab order. */ readonly allowNoSelection?: boolean; /** * How arrow keys behave. `select` (default) moves focus and selects, matching the * ARIA radiogroup pattern. `focus` only moves focus, and Enter or Space selects — * use it when selecting has a side effect the user should be able to travel past. */ readonly arrowKeyBehavior?: "select" | "focus"; } export declare class Radio extends Widget { private readonly _onDidSelect; readonly onDidSelect: import("../../../common/event.js").Event; private readonly _onDidActivate; /** Fires on click, Enter, or Space, even when the item is already selected. */ readonly onDidActivate: import("../../../common/event.js").Event; readonly domNode: HTMLElement; private readonly hoverDelegate; private readonly arrowKeyBehavior; private readonly allowNoSelection; private items; private activeItem; private orderedButtons; private readonly selectionIndicator; private readonly resizeObserver; private selectionIndicatorBounds; private readonly buttons; constructor(opts: IRadioOptions); /** The option buttons in item order, for callers that need to measure or decorate them. */ get optionElements(): readonly HTMLElement[]; /** Shows `text` on an option until the returned disposable puts the item's own label back. */ overrideOptionLabel(index: number, text: string): IDisposable; setItems(items: ReadonlyArray): void; setActiveItem(index: number): void; /** Waits for selection motion, including a newer selection that interrupts it. */ whenSelectionAnimationSettles(): Promise; setEnabled(enabled: boolean): void; /** Moves focus to the active item, for callers that rebuild the row after a selection. */ focusActiveItem(): void; /** Moves focus to an item without selecting it. */ focusItem(index: number): void; private selectItem; /** Moves to the next enabled item in `delta` direction, wrapping around the ends. */ private navigate; private setButtonLabel; private updateButtons; private layoutSelectionIndicator; }