import * as i0 from '@angular/core'; import { OnChanges, AfterViewInit } from '@angular/core'; import { NgChanges } from '@odx/angular/utils'; type ActiveIndicatorDirection = typeof ActiveIndicatorDirection[keyof typeof ActiveIndicatorDirection]; declare const ActiveIndicatorDirection: { readonly HORIZONTAL: "horizontal"; readonly VERTICAL: "vertical"; }; type ActiveIndicatorPosition = typeof ActiveIndicatorPosition[keyof typeof ActiveIndicatorPosition]; declare const ActiveIndicatorPosition: { readonly START: "start"; readonly CENTER: "center"; readonly END: "end"; }; /** * `ActiveIndicatorDirective` is designed to adjust an indicator's position and size dynamically to highlight * the active element within a container. It's useful for tabs, menus, or any list where an active state is visually represented. * The directive can be customized to align the indicator based on the active element's position and supports * both horizontal and vertical orientations. * * To use this directive, apply it to the element you want to use as an active indicator. * Then, bind the active element using the `odxActiveIndicator` input. Optionally, specify * the container element with `odxActiveIndicatorParent` if the container is not the immediate parent of the indicator. * * @example * ```html *
* @for(tab of tabs; track tab.id) { *
{{ tab.label }}
* } *
*
* ``` * * ```ts * @Component({ * selector: 'app-tabs', * templateUrl: './tabs.component.html', * imports: [ActiveIndicatorDirective, NgForOf], * }) * export class TabsComponent { * tabs = [{ label: 'Tab 1', isActive: true }, { label: 'Tab 2', isActive: false }]; * @ViewChildren('tabElement') tabElements?: QueryList; * @ViewChild('tabsContainer') tabsContainer!: ElementRef; * * get activeTabElement(): HTMLElement { * const activeTab = this.tabElements?.find((tab) => tab.nativeElement.classList.contains('active')); * return activeTab ? activeTab.nativeElement : null; * } * } * ``` */ declare class ActiveIndicatorDirective implements OnChanges, AfterViewInit { private readonly takeUntilDestroyed; private readonly parentElement$$; private readonly onResize$; readonly element: i0.ElementRef; /** * Indicates whether the element is active or not. * * @type {boolean} */ isActive: boolean; /** * The currently active element to which the indicator should align. * It dynamically updates the indicator's position and size based on this element. * * @type {HTMLElement | null} */ activeElement?: HTMLElement | null; /** * The parent container element of the active elements. * If not set, the indicator's immediate parent element is used. * * @type {HTMLElement | null} */ set parent(value: HTMLElement | null); get parent(): HTMLElement | null; /** * The direction in which the indicator should move. * * @type {ActiveIndicatorDirection} */ direction: ActiveIndicatorDirection; /** * The position of the indicator relative to the active element. * * @type {ActiveIndicatorPosition} */ position: ActiveIndicatorPosition; ngAfterViewInit(): void; ngOnChanges(changes: NgChanges): void; private updateStyles; private getIndicatorPositionX; private getIndicatorPositionY; private getIndicatorRelativeOffset; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } export { ActiveIndicatorDirection, ActiveIndicatorDirective, ActiveIndicatorPosition };