@engie-group/fluid-design-system-angular
Version:
Fluid Design System Angular
95 lines (79 loc) • 1.88 kB
text/typescript
import {CommonModule} from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
Output,
TemplateRef,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import {BadgeComponent} from '../badge/badge.component';
type TBadgeOptions = Omit<BadgeComponent, 'size' | 'iconName' >;
({
selector: 'nj-tab',
templateUrl: './tab.component.html',
styleUrls: ['./tab.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [CommonModule, BadgeComponent]
})
export class TabComponent {
/**
* Whether tab is disabled or not
*/
() isDisabled: boolean;
/**
* Aria controls, for accessibility reasons
*/
() ariaControls: string;
/**
* Id of the tab
*/
() id: string;
/**
* Id of the content
*/
() tabContentId: string;
/**
* Aria labelled by which will be set on the content, for accessibility reasons
*/
() tabContentAriaLabelledBy: string;
/**
* Whether tab is active or not
*/
() isActive: boolean;
/**
* Options for the badge inside the tab
*/
() badgeOptions?: TBadgeOptions;
/**
* @ignore
*/
('contentTemplate') contentTemplateRef: TemplateRef<any>;
/**
* @ignore
*/
('tab') tab: ElementRef<HTMLButtonElement>;
/**
* Output that emits if tab is selected
*/
() tabSelect: EventEmitter<void> = new EventEmitter<void>();
/**
* Output that emits keyboard event
*/
() tabMove: EventEmitter<KeyboardEvent> = new EventEmitter<KeyboardEvent>();
constructor(private cdr: ChangeDetectorRef) {
}
/**
* @ignore
*/
setIsActive(isActive) {
this.isActive = isActive;
this.cdr.markForCheck();
}
}