@truenas/ui-components 0.1.20 → 0.1.21

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.
@@ -7536,6 +7536,7 @@ class TnTooltipDirective {
7536
7536
  _showTimeout = null;
7537
7537
  _hideTimeout = null;
7538
7538
  _isTooltipVisible = false;
7539
+ _positionSub = null;
7539
7540
  _ariaDescribedBy = null;
7540
7541
  _overlay = inject(Overlay);
7541
7542
  _elementRef = inject((ElementRef));
@@ -7548,6 +7549,7 @@ class TnTooltipDirective {
7548
7549
  ngOnDestroy() {
7549
7550
  this._clearTimeouts();
7550
7551
  this.hide(0);
7552
+ this._positionSub?.unsubscribe();
7551
7553
  if (this._overlayRef) {
7552
7554
  this._overlayRef.dispose();
7553
7555
  this._overlayRef = null;
@@ -7615,6 +7617,33 @@ class TnTooltipDirective {
7615
7617
  scrollStrategy: this._overlay.scrollStrategies.reposition({ scrollThrottle: 20 }),
7616
7618
  panelClass: ['tn-tooltip-panel', `tn-tooltip-panel-${this.position()}`, this.tooltipClass()].filter(Boolean),
7617
7619
  });
7620
+ this._positionSub = positionStrategy.positionChanges
7621
+ .subscribe((change) => {
7622
+ const panel = this._overlayRef?.overlayElement?.parentElement;
7623
+ if (!panel) {
7624
+ return;
7625
+ }
7626
+ const actual = this._resolvePosition(change.connectionPair);
7627
+ const allPositionClasses = [
7628
+ 'tn-tooltip-panel-above', 'tn-tooltip-panel-below',
7629
+ 'tn-tooltip-panel-left', 'tn-tooltip-panel-right',
7630
+ 'tn-tooltip-panel-before', 'tn-tooltip-panel-after',
7631
+ ];
7632
+ panel.classList.remove(...allPositionClasses);
7633
+ panel.classList.add(`tn-tooltip-panel-${actual}`);
7634
+ });
7635
+ }
7636
+ _resolvePosition(pair) {
7637
+ if (pair.overlayY === 'bottom') {
7638
+ return 'above';
7639
+ }
7640
+ if (pair.overlayY === 'top') {
7641
+ return 'below';
7642
+ }
7643
+ if (pair.overlayX === 'end') {
7644
+ return 'left';
7645
+ }
7646
+ return 'right';
7618
7647
  }
7619
7648
  _attachTooltip() {
7620
7649
  if (!this._overlayRef) {