import * as ng_primitives_roving_focus from 'ng-primitives/roving-focus'; import * as _angular_core from '@angular/core'; import { Signal, ElementRef, InjectionToken, Type, FactoryProvider } from '@angular/core'; import { FocusOrigin } from '@angular/cdk/a11y'; import { BooleanInput } from '@angular/cdk/coercion'; import { NgpOrientation } from 'ng-primitives/common'; import * as ng_primitives_state from 'ng-primitives/state'; /** * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus. */ declare class NgpRovingFocusItem { /** * Define if the item is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; private readonly state; /** * Expose the internal id of the roving focus item. * @internal */ readonly id: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements. */ declare class NgpRovingFocusGroup { /** * Determine the orientation of the roving focus group. * @default 'vertical' */ readonly orientation: _angular_core.InputSignal; /** * Determine if focus should wrap when the end or beginning is reached. */ readonly wrap: _angular_core.InputSignalWithTransform; /** * Determine if the home and end keys should navigate to the first and last items. */ readonly homeEnd: _angular_core.InputSignalWithTransform; /** * Determine if the roving focus group is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * Store the active item in the roving focus group. * @internal */ readonly activeItem: _angular_core.WritableSignal; /** * The state of the roving focus group. */ readonly state: ng_primitives_roving_focus.NgpRovingFocusGroupState; /** * Activate an item in the roving focus group. * @param item The item to activate * @param origin The origin of the focus change */ setActiveItem(item: NgpRovingFocusItem | null, origin?: FocusOrigin): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The state interface for the RovingFocusItem pattern. */ interface NgpRovingFocusItemState { /** * The unique id of the roving focus item. */ readonly id: Signal; /** * Whether the item is disabled. */ readonly disabled: Signal; /** * The tabindex of the roving focus item. */ readonly tabindex: Signal; /** * The element reference of the roving focus item. */ readonly element: ElementRef; /** * Focus the roving focus item. * @param origin The focus origin */ focus(origin: FocusOrigin): void; } /** * The props interface for the RovingFocusItem pattern. */ interface NgpRovingFocusItemProps { /** * Whether the item is disabled. */ readonly disabled: Signal; } declare const NgpRovingFocusItemStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal>; declare const ngpRovingFocusItem: ({ disabled }: NgpRovingFocusItemProps) => NgpRovingFocusItemState; declare const injectRovingFocusItemState: { (): Signal; (options: ng_primitives_state.StateInjectionOptions): Signal; (options?: ng_primitives_state.StateInjectionOptions): Signal | Signal; }; declare const provideRovingFocusItemState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; interface NgpRovingFocusGroupState { /** * The orientation of the roving focus group. */ readonly orientation: Signal; /** * Whether the roving focus group should wrap around. */ readonly wrap: Signal; /** * Whether the Home and End keys are enabled. */ readonly homeEnd: Signal; /** * Whether the roving focus group is disabled. */ readonly disabled: Signal; /** * The id of the currently active item. */ readonly activeItem: Signal; /** * Handle keyboard navigation. * @param event The keyboard event */ onKeydown(event: KeyboardEvent): void; /** * Set the active item by id. * @param id The id of the item to activate * @param origin The origin of the focus change */ setActiveItem(id: string | null, origin?: FocusOrigin): void; /** * Set which item holds the tab stop without moving focus. Used by items that * declare themselves active (e.g. the selected tab) to claim the tab stop * without stealing focus. * @param id The id of the item that should hold the tab stop. */ setTabStop(id: string | null): void; /** * The element of the last item that is not disabled. * @internal */ lastEnabledElement(): HTMLElement | null; /** * Register an item with the roving focus group. * @param item The item to register */ register(item: NgpRovingFocusItemState): void; /** * Unregister an item from the roving focus group. * @param item The item to unregister * @internal */ unregister(item: NgpRovingFocusItemState): void; /** * Set the orientation of the roving focus group. * @param orientation The orientation value */ setOrientation(orientation: NgpOrientation): void; /** * Activate the first item in the roving focus group. * @param origin The origin of the focus change */ activateFirst(origin?: FocusOrigin): void; /** * Activate the last item in the roving focus group. * @param origin The origin of the focus change */ activateLast(origin?: FocusOrigin): void; } interface NgpRovingFocusGroupProps { /** * The orientation of the roving focus group. */ readonly orientation?: Signal; /** * Whether the roving focus group should wrap around. */ readonly wrap?: Signal; /** * Whether the Home and End keys are enabled. */ readonly homeEnd?: Signal; /** * Whether the roving focus group is disabled. */ readonly disabled?: Signal; /** * Whether typing a character moves focus to the next item whose text starts with it. */ readonly typeahead?: Signal; /** * Whether to inherit state from a parent roving focus group. */ readonly inherit?: boolean; } declare const NgpRovingFocusGroupStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal>; declare const ngpRovingFocusGroup: ({ orientation: _orientation, wrap, homeEnd, disabled, typeahead, inherit, }: NgpRovingFocusGroupProps) => NgpRovingFocusGroupState; declare const injectRovingFocusGroupState: { (): Signal; (options: ng_primitives_state.StateInjectionOptions): Signal; (options?: ng_primitives_state.StateInjectionOptions): Signal | Signal; }; declare const provideRovingFocusGroupState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; declare const NgpRovingFocusGroupToken: InjectionToken; /** * Inject the RovingFocusGroup directive instance * @returns The RovingFocusGroup directive instance */ declare function injectRovingFocusGroup(): NgpRovingFocusGroup; interface NgpRovingFocusGroupOptions { /** * Whether we should inherit the focus group from the parent * @default true */ inherit?: boolean; } /** * Provide the RovingFocusGroup directive instance * @param type The RovingFocusGroup directive type * @returns The RovingFocusGroup token */ declare function provideRovingFocusGroup(type: Type, { inherit }?: NgpRovingFocusGroupOptions): FactoryProvider; export { NgpRovingFocusGroup, NgpRovingFocusGroupStateToken, NgpRovingFocusGroupToken, NgpRovingFocusItem, NgpRovingFocusItemStateToken, injectRovingFocusGroup, injectRovingFocusGroupState, injectRovingFocusItemState, ngpRovingFocusGroup, ngpRovingFocusItem, provideRovingFocusGroup, provideRovingFocusGroupState, provideRovingFocusItemState }; export type { NgpRovingFocusGroupOptions, NgpRovingFocusGroupProps, NgpRovingFocusGroupState, NgpRovingFocusItemProps, NgpRovingFocusItemState };