import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, Provider } from '@angular/core'; import { FormCheckboxControl, FormValueControl } from '@angular/forms/signals'; import { FormUiControlBase, WritingDirection, RovingTabindex, ListNavigationAction, CollectionHandle } from 'forty-cdk/core'; import * as forty_cdk_toggle from 'forty-cdk/toggle'; /** * Headless implementation of the [WAI-ARIA Toggle Button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) — * a single-purpose ` * * * * ``` */ declare class ForToggle extends FormUiControlBase implements FormCheckboxControl { protected readonly buttonType: _angular_core.Signal; /** * Two-way bindable on/off state. Required by `FormCheckboxControl`, so the * toggle auto-wires with `[formField]`; the host reflects it through * `aria-pressed` and `data-state` (still a toggle button — only the value's * name is `checked`). The `model()` change emitter (`(checkedChange)`) fires * only on internal transitions (user click), never on consumer writes via * `[(checked)]`. */ readonly checked: _angular_core.ModelSignal; constructor(); protected onClick(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Per-item handle stored in the group's `Collection`. The directive * registers itself on construction so the group can compute selection, * roving tabindex, and arrow-key navigation in DOM order. */ interface ForToggleGroupItemHandle extends CollectionHandle { /** * Narrowed from {@link CollectionHandle}'s `Node`: the group focuses the item * and queries it against the roving-tabindex tracker. */ readonly host: HTMLElement; readonly value: Signal; readonly disabled: Signal; } /** * Coordination contract owned by `ForToggleGroup`. Items read selection * and navigation policy from here and call back through `toggle` and * `navigate` to drive state changes. */ interface ForToggleGroupContext { /** * The current selection, as a read-only signal. Mutate it through `toggle` * or the root's `[(value)]` binding — a direct write would bypass the group's * disabled guard and single/multiple mode rules. */ readonly value: Signal; readonly multiple: Signal; /** * The group's effective disabled — its own `disabled` input OR'd with a * surrounding disabled `[forFieldset]`. Each item ORs this into its own * `effectiveDisabled`, so a disabled group (or fieldset) disables every item. */ readonly effectiveDisabled: Signal; readonly orientation: Signal<'horizontal' | 'vertical'>; readonly dir: Signal; readonly loop: Signal; /** * Roving-tabindex tracker. Items call `setActive` on `(focus)` and prefer * `active()` in their tabindex computed so the tab stop follows the last * focused item (APG re-entry), matching Tabs / Tree. */ readonly roving: RovingTabindex; isSelected(value: string): boolean; toggle(value: string): void; navigate(currentItem: HTMLElement, action: ListNavigationAction): void; isFirstFocusableItem(el: HTMLElement): boolean; registerItem(handle: ForToggleGroupItemHandle): void; unregisterItem(handle: ForToggleGroupItemHandle): void; } declare const FOR_TOGGLE_GROUP_CONTEXT: InjectionToken; /** * Headless group of toggle buttons: a `role="group"` container whose items * each carry `aria-pressed`, modelled on the * [WAI-ARIA Button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/) * (toggle-button variant). Owns the * selected-values set, navigation policy, and the registry of * `[forToggleGroupItem]` children. Implements * `FormValueControl` from `@angular/forms/signals` for * `[formField]` auto-wiring. (The Toolbar pattern applies only when a group is * nested inside `[forToolbar]`; see the composition note on * `ForToggleGroupItem`.) * * Two selection modes: * - multiple (`multiple=true`): clicking an item flips its presence in * `value`. Matches a "formatting toolbar" (Bold, Italic, Underline). * - single (`multiple=false`, default): clicking selects exclusively; * clicking an already-selected item de-selects it (you can land on `[]`). * Matches an "alignment toolbar" (Left, Center, Right) where users may * want to clear the choice. * * `value` is always `readonly string[]` so consumers can flip `multiple` * without re-typing their state. In single mode the array carries 0 or * 1 entries. * * Roving tabindex: only one item is in the Tab sequence at a time. With * a non-empty selection, the first selected item; otherwise the first * enabled item in DOM order. Arrow keys move focus (no * selection-on-focus — toggles always require an explicit click). * * `ForToggle` (the standalone single-button toggle) is also a form * control, but a `FormCheckboxControl` carrying a single boolean value. * Use `ForToggleGroup` (in single or multiple mode) when you need a set * of pressed values as the form value. * * A read-only group is reflected as the boolean `data-readonly` styling hook * on this root only: `aria-readonly` is a supported property of neither * `role="group"` nor the items' `role="button"`, so there is no ARIA channel * for the state. Clicks stay no-ops and the items stay focusable. * * `required` is reflected the same way, as `data-required` on the root. */ declare class ForToggleGroup extends FormUiControlBase implements FormValueControl, ForToggleGroupContext { #private; /** * Two-way bindable. The currently pressed values, in arbitrary order. * In single mode the array holds 0 or 1 entries. The `model()` change * emitter (`(valueChange)`) fires only on internal transitions (item * click), never on consumer writes via `[(value)]`. Required by * `FormValueControl`. */ readonly value: _angular_core.ModelSignal; /** * When false (default), only one item can be pressed at a time. Clicking * an already-pressed item clears the selection. When true, clicks toggle * each item independently. */ readonly multiple: _angular_core.InputSignalWithTransform; /** Layout direction for keyboard navigation. */ readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">; /** * Reading direction. RTL swaps ArrowLeft/ArrowRight. When unset (default * `null`), the inherited ambient direction is resolved from the nearest * ancestor carrying a `dir` attribute (or ``), defaulting to * `'ltr'`. An explicit `[dir]` always wins and the resolved value is * reflected to the host `dir` attribute. */ readonly _dirInput: _angular_core.InputSignal; readonly dir: _angular_core.Signal; /** * When true (default), arrow nav wraps at the ends. The default is read * from `provideForToggleDefaults` for the surrounding scope. */ readonly loop: _angular_core.InputSignalWithTransform; /** * Roving-tabindex tracker. Items promote themselves to active on `(focus)` * and read `active()` in their tabindex computed, so re-entry (Shift+Tab * back into the group) restores the last focused item — matching Tabs / * Tree. Before any focus, `active()` is `null` and the tabindex falls back * to the first-selected / first-enabled entry point. */ readonly roving: RovingTabindex; constructor(); /** * Move focus to a toggle item, implementing `FormValueControl.focus` from * `@angular/forms/signals`. Without this override Signal Forms would focus the * host `role="group"` wrapper — which is not focusable — so focus-on-error * would silently go nowhere. Targets the first selected item's host when one * is pressed, else the first enabled item's host; no-op when disabled or when * no enabled item exists. */ focus(options?: FocusOptions): void; isSelected(v: string): boolean; toggle(v: string): void; navigate(currentItem: HTMLElement, action: ListNavigationAction): void; /** * Tabindex policy: with at least one selection, the first selected item * is the entry point; otherwise the first enabled item in DOM order. */ isFirstFocusableItem(el: HTMLElement): boolean; registerItem(handle: ForToggleGroupItemHandle): void; unregisterItem(handle: ForToggleGroupItemHandle): void; protected onFocusOut(event: FocusEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * One toggle button inside a `[forToggleGroup]`. Apply on a `