import{ ChangeDetectionStrategy, Component, contentChildren, Directive, TemplateRef, viewChild }from'@angular/core';import{ MatButtonModule }from'@angular/material/button';import{ RichTooltipController }from'../rich-tooltip.types';/**
* Directive to provide tooltip context
* to the RichTooltip component.
*/@Directive({
selector:'ng-template[hraRichTooltipContext]',})exportclassRichTooltipContextDirective{/** Types the context as `RichTooltipDirective` *//* istanbul ignore next */staticngTemplateContextGuard(
_dir: RichTooltipContextDirective,
_ctx:unknown,): _ctx is{ $implicit: RichTooltipController }{returntrue;}}/**
* Component for the Rich Tooltip Tagline
*/@Component({
selector:'hra-rich-tooltip-tagline',
template:'<ng-content />',
changeDetection: ChangeDetectionStrategy.OnPush,})exportclassRichTooltipTaglineComponent{}/**
* Component for the Rich Tooltip Content
*/@Component({
selector:'hra-rich-tooltip-content',
template:'<ng-content />',
changeDetection: ChangeDetectionStrategy.OnPush,})exportclassRichTooltipContentComponent{}/**
* Component for the Rich Tooltip actions row
*/@Component({
selector:'hra-rich-tooltip-actions',
template:'<ng-content />',
changeDetection: ChangeDetectionStrategy.OnPush,})exportclassRichTooltipActionsComponent{}/**
* Directive that can be used on a button
* for closing the rich tooltip.
*/@Directive({
selector:'[hraRichTooltipClose]',
host:{'(click)':'controller?.close()',},})exportclassRichTooltipCloseDirective{/**
* The controller for the rich tooltip.
* (context is set by component once initialized)
*/
controller?: RichTooltipController =undefined;}/**
* The main component of the Rich Tooltip - the container,
* encapsulates all the other components (tagline, content & actions).
*/@Component({
selector:'hra-rich-tooltip-container',
imports:[RichTooltipContextDirective, MatButtonModule],
templateUrl:'./rich-tooltip-content.component.html',
styleUrl:'./rich-tooltip-content.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
exportAs:'hraRichTooltipContainer',})exportclassRichTooltipContainerComponent{/**
* ViewChild for the container template.
*/readonly template = viewChild.required('container',{ read: TemplateRef<{ $implicit: RichTooltipController }>});/**
* List of close directives used in the custom template.
*/readonly closeDirectives =contentChildren(RichTooltipCloseDirective,{ descendants:true});}