Skip to content

Commit 05ef2ee

Browse files
feat: expose onShow and onHide from tippyJS
1 parent 40b41ab commit 05ef2ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

projects/ngneat/helipopper/src/lib/tippy.directive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
NgZone,
1616
OnChanges,
1717
OnInit,
18+
output,
1819
Output,
1920
PLATFORM_ID,
2021
SimpleChanges,
@@ -190,6 +191,10 @@ export class TippyDirective implements OnChanges, AfterViewInit, OnInit {
190191

191192
readonly customHost = input<HTMLElement | undefined>(undefined, { alias: 'tpHost' });
192193

194+
readonly onShow = output<void>({ alias: 'tpOnShow' });
195+
196+
readonly onHide = output<void>({ alias: 'tpOnHide' });
197+
193198
readonly isVisible = model(false, { alias: 'tpIsVisible' });
194199

195200
@Output('tpVisible') visible = new EventEmitter<boolean>();
@@ -432,6 +437,7 @@ export class TippyDirective implements OnChanges, AfterViewInit, OnInit {
432437
this.setInstanceWidth(instance, this.popperWidth()!);
433438
}
434439
this.globalConfig.onShow?.(instance);
440+
this.onShow.emit();
435441
},
436442
onHide(instance) {
437443
instance.reference.removeAttribute('data-tippy-open');
@@ -587,6 +593,7 @@ export class TippyDirective implements OnChanges, AfterViewInit, OnInit {
587593
this.ngZone.run(() => this.visible.next(isVisible));
588594
}
589595
this.globalConfig.onHidden?.(instance);
596+
this.onHide.emit();
590597
}
591598

592599
private isOverflowing$() {

0 commit comments

Comments
 (0)