@vsn-ux/ngx-gaia 0.14.4 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,11 +10,11 @@ import { NgTemplateOutlet } from '@angular/common';
10
10
  import { ComponentPortal } from '@angular/cdk/portal';
11
11
  import { Subject, takeUntil, map, merge, filter, Observable, isObservable, timer } from 'rxjs';
12
12
  import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
13
+ import * as i1$3 from '@angular/cdk/a11y';
14
+ import { FocusMonitor, CdkTrapFocus } from '@angular/cdk/a11y';
13
15
  import * as i1$2 from '@angular/cdk/menu';
14
16
  import { CdkMenu, CdkMenuItem, CdkMenuTrigger, MENU_SCROLL_STRATEGY } from '@angular/cdk/menu';
15
17
  import { Router, ResolveStart } from '@angular/router';
16
- import * as i1$3 from '@angular/cdk/a11y';
17
- import { CdkTrapFocus } from '@angular/cdk/a11y';
18
18
  import * as i1$4 from '@angular/cdk/scrolling';
19
19
  import { CdkScrollable } from '@angular/cdk/scrolling';
20
20
  import * as i1$5 from '@angular/cdk/listbox';
@@ -2532,6 +2532,7 @@ class GaTooltipDirective {
2532
2532
  elementRef = inject(ElementRef);
2533
2533
  overlay = inject(Overlay);
2534
2534
  ngZone = inject(NgZone);
2535
+ focusMonitor = inject(FocusMonitor);
2535
2536
  destroyed$ = new Subject();
2536
2537
  _content = null;
2537
2538
  tooltipInstanceDestroyed$ = null;
@@ -2612,9 +2613,28 @@ class GaTooltipDirective {
2612
2613
  get placement() {
2613
2614
  return this._placement;
2614
2615
  }
2616
+ constructor() {
2617
+ // Only treat keyboard focus as a tooltip trigger. Pointer-originated focus
2618
+ // (e.g. clicking a button) is left to the hover lifecycle, so the tooltip
2619
+ // dismisses on mouse leave even though the element keeps focus.
2620
+ this.focusMonitor
2621
+ .monitor(this.elementRef)
2622
+ .pipe(takeUntil(this.destroyed$))
2623
+ .subscribe((origin) => {
2624
+ this.ngZone.run(() => {
2625
+ if (origin === 'keyboard') {
2626
+ this.handleFocusIn();
2627
+ }
2628
+ else if (!origin) {
2629
+ this.handleFocusOut();
2630
+ }
2631
+ });
2632
+ });
2633
+ }
2615
2634
  ngOnDestroy() {
2616
2635
  this.clearShowTimeout();
2617
2636
  this.isAnimatingOut = false;
2637
+ this.focusMonitor.stopMonitoring(this.elementRef);
2618
2638
  this.destroyed$.next();
2619
2639
  this.destroyed$.complete();
2620
2640
  this.overlayRef?.detach();
@@ -2875,7 +2895,7 @@ class GaTooltipDirective {
2875
2895
  }
2876
2896
  }
2877
2897
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2878
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: GaTooltipDirective, isStandalone: true, selector: "[gaTooltip]", inputs: { content: { classPropertyName: "content", publicName: "gaTooltip", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "gaTooltipDisabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, controlMode: { classPropertyName: "controlMode", publicName: "gaTooltipControlMode", isSignal: false, isRequired: false, transformFunction: null }, showControlMode: { classPropertyName: "showControlMode", publicName: "gaTooltipShowControlMode", isSignal: false, isRequired: false, transformFunction: null }, hideControlMode: { classPropertyName: "hideControlMode", publicName: "gaTooltipHideControlMode", isSignal: false, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "gaTooltipOffsetSize", isSignal: false, isRequired: false, transformFunction: numberAttribute }, showDelay: { classPropertyName: "showDelay", publicName: "gaTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "gaTooltipPlacement", isSignal: false, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "handleMouseClick()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()", "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.aria-describedby": "ariaDescribedBy()" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2898
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: GaTooltipDirective, isStandalone: true, selector: "[gaTooltip]", inputs: { content: { classPropertyName: "content", publicName: "gaTooltip", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "gaTooltipDisabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, controlMode: { classPropertyName: "controlMode", publicName: "gaTooltipControlMode", isSignal: false, isRequired: false, transformFunction: null }, showControlMode: { classPropertyName: "showControlMode", publicName: "gaTooltipShowControlMode", isSignal: false, isRequired: false, transformFunction: null }, hideControlMode: { classPropertyName: "hideControlMode", publicName: "gaTooltipHideControlMode", isSignal: false, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "gaTooltipOffsetSize", isSignal: false, isRequired: false, transformFunction: numberAttribute }, showDelay: { classPropertyName: "showDelay", publicName: "gaTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "gaTooltipPlacement", isSignal: false, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "handleMouseClick()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()" }, properties: { "attr.aria-describedby": "ariaDescribedBy()" } }, exportAs: ["gaTooltip"], ngImport: i0 });
2879
2899
  }
2880
2900
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: GaTooltipDirective, decorators: [{
2881
2901
  type: Directive,
@@ -2887,11 +2907,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
2887
2907
  '(click)': 'handleMouseClick()',
2888
2908
  '(mouseenter)': 'handleMouseEnter()',
2889
2909
  '(mouseleave)': 'handleMouseLeave()',
2890
- '(focusin)': 'handleFocusIn()',
2891
- '(focusout)': 'handleFocusOut()',
2892
2910
  },
2893
2911
  }]
2894
- }], propDecorators: { content: [{
2912
+ }], ctorParameters: () => [], propDecorators: { content: [{
2895
2913
  type: Input,
2896
2914
  args: ['gaTooltip']
2897
2915
  }], disabled: [{