UNPKG

@ngx-uk-frontend/core

Version:

Core utilities and shared functionality for ngx-uk-frontend libraries

34 lines 2.16 kB
import { Directive, input, model } from '@angular/core'; import * as i0 from "@angular/core"; /** * Base directive for tabs components across different design systems. * Provides common functionality for managing tab collections and navigation. */ export class TabsDirective { /** The title for the tabs component. This input is required. */ title = input.required(...(ngDevMode ? [{ debugName: "title" }] : [])); /** Two-way binding model for the currently active tab index. Defaults to 0 (first tab). */ activeTab = model(0, ...(ngDevMode ? [{ debugName: "activeTab" }] : [])); /** * Computed property that returns the tab items. * This provides a consistent interface for templates to access tabs. */ tabs() { return this.getTabs(); } /** * Selects a tab at the specified index. * @param index The index of the tab to select * @param event The event that triggered the selection */ selectTab(index, event) { event.preventDefault(); this.activeTab.set(index); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TabsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: TabsDirective, isStandalone: true, inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, activeTab: { classPropertyName: "activeTab", publicName: "activeTab", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeTab: "activeTabChange" }, ngImport: i0 }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TabsDirective, decorators: [{ type: Directive }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], activeTab: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeTab", required: false }] }, { type: i0.Output, args: ["activeTabChange"] }] } }); //# sourceMappingURL=tabs.directive.js.map