@engie-group/fluid-design-system-angular
Version:
Fluid Design System Angular
106 lines (88 loc) • 2.17 kB
text/typescript
import {CommonModule} from '@angular/common';
import {ChangeDetectionStrategy, Component, Input, TemplateRef} from '@angular/core';
import {tooltipAnimation} from './tooltip.animations';
import {TooltipArrowPlacement, TooltipPlacement} from './tooltip.model';
export class TooltipComponent {
/**
* @ignore
*/
private readonly tooltipClassName = 'nj-tooltip';
/**
* Whether tooltip is inverse or no
*/
isInverse: boolean;
/**
* Whether tooltip has arrow or no
*/
hasArrow = true;
/**
* Tooltip label, if you want custom content unset the label and place content as element children
* e.g: `<nj-tooltip>Your Content</nj-tooltip>`
*/
label: string;
/**
* Tooltip id
*/
tooltipId: string;
/**
* Tooltip placement
*/
placement: TooltipPlacement = 'top';
/**
* Tooltip arrow placement
*/
arrowPlacement: TooltipArrowPlacement = 'center';
/**
* Whether tooltip management is standalone
*/
isStandalone: boolean = true;
/**
* Whether tooltip is animated
*/
isAnimated = true;
/**
* Tooltip custom template ref
*/
contentTemplateRef: TemplateRef<any>;
constructor() {
}
/**
* @ignore
*/
getPlacementClass(): string {
if (!this.placement) {
return '';
}
return `${this.tooltipClassName}--${this.placement}`;
}
/**
* @ignore
*/
getTooltipArrowPlacement(): string {
if (!this.arrowPlacement) {
return '';
}
return `${this.tooltipClassName}__arrow--${this.arrowPlacement}`;
}
/**
* @ignore
*/
getIsInverseClass(): string {
return this.isInverse ? `${this.tooltipClassName}--inverse` : '';
}
/**
* @ignore
*/
getIsStandaloneClass(): string {
return this.isStandalone ? `${this.tooltipClassName}--standalone` : '';
}
}