@taiga-ui/core 5.23.0 → 5.24.0

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.
Files changed (51) hide show
  1. package/components/textfield/select-like.directive.d.ts +2 -1
  2. package/components/textfield/textfield.component.d.ts +2 -0
  3. package/fesm2022/taiga-ui-core-components-button.mjs +2 -2
  4. package/fesm2022/taiga-ui-core-components-cell.mjs +3 -3
  5. package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -1
  6. package/fesm2022/taiga-ui-core-components-checkbox.mjs +2 -2
  7. package/fesm2022/taiga-ui-core-components-data-list.mjs +4 -4
  8. package/fesm2022/taiga-ui-core-components-icon.mjs +2 -2
  9. package/fesm2022/taiga-ui-core-components-input.mjs +2 -1
  10. package/fesm2022/taiga-ui-core-components-input.mjs.map +1 -1
  11. package/fesm2022/taiga-ui-core-components-label.mjs +3 -3
  12. package/fesm2022/taiga-ui-core-components-link.mjs +2 -2
  13. package/fesm2022/taiga-ui-core-components-notification.mjs +2 -2
  14. package/fesm2022/taiga-ui-core-components-radio.mjs +2 -2
  15. package/fesm2022/taiga-ui-core-components-root.mjs +1 -1
  16. package/fesm2022/taiga-ui-core-components-scrollbar.mjs +5 -5
  17. package/fesm2022/taiga-ui-core-components-scrollbar.mjs.map +1 -1
  18. package/fesm2022/taiga-ui-core-components-textfield.mjs +25 -10
  19. package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
  20. package/fesm2022/taiga-ui-core-components-title.mjs +3 -3
  21. package/fesm2022/taiga-ui-core-directives-appearance.mjs +3 -3
  22. package/fesm2022/taiga-ui-core-directives-group.mjs +3 -3
  23. package/fesm2022/taiga-ui-core-directives-icons.mjs +3 -3
  24. package/fesm2022/taiga-ui-core-portals-alert.mjs +3 -3
  25. package/fesm2022/taiga-ui-core-portals-dialog.mjs +2 -2
  26. package/fesm2022/taiga-ui-core-portals-dropdown.mjs +92 -23
  27. package/fesm2022/taiga-ui-core-portals-dropdown.mjs.map +1 -1
  28. package/fesm2022/taiga-ui-core-portals-hint.mjs +155 -78
  29. package/fesm2022/taiga-ui-core-portals-hint.mjs.map +1 -1
  30. package/fesm2022/taiga-ui-core-portals-modal.mjs +3 -3
  31. package/fesm2022/taiga-ui-core-tokens.mjs +4 -2
  32. package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
  33. package/package.json +4 -4
  34. package/portals/dropdown/dropdown-anchor.directive.d.ts +2 -12
  35. package/portals/dropdown/dropdown-anchored.directive.d.ts +16 -0
  36. package/portals/dropdown/dropdown-context.directive.d.ts +5 -1
  37. package/portals/dropdown/dropdown-selection.directive.d.ts +5 -3
  38. package/portals/dropdown/dropdown.component.d.ts +2 -2
  39. package/portals/dropdown/dropdown.directive.d.ts +5 -4
  40. package/portals/dropdown/dropdown.providers.d.ts +1 -0
  41. package/portals/dropdown/index.d.ts +1 -0
  42. package/portals/hint/hint-anchor.directive.d.ts +8 -0
  43. package/portals/hint/hint-anchored.directive.d.ts +17 -0
  44. package/portals/hint/hint-host.directive.d.ts +4 -1
  45. package/portals/hint/hint-hover.directive.d.ts +1 -1
  46. package/portals/hint/hint-pointer.directive.d.ts +6 -1
  47. package/portals/hint/hint.component.d.ts +3 -10
  48. package/portals/hint/hint.directive.d.ts +5 -4
  49. package/portals/hint/index.d.ts +2 -0
  50. package/tokens/anchor-support.d.ts +2 -0
  51. package/tokens/index.d.ts +1 -0
@@ -1,27 +1,27 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Directive, inject, input, signal, INJECTOR, ChangeDetectionStrategy, Component, TemplateRef, forwardRef, computed } from '@angular/core';
3
- import { outputFromObservable, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
- import { EMPTY_CLIENT_RECT } from '@taiga-ui/cdk/constants';
2
+ import { InjectionToken, ElementRef, Directive, inject, input, signal, INJECTOR, forwardRef, afterNextRender, ChangeDetectionStrategy, Component, TemplateRef, computed, effect } from '@angular/core';
5
3
  import * as i3 from '@taiga-ui/cdk/directives/active-zone';
6
4
  import { TuiActiveZone } from '@taiga-ui/cdk/directives/active-zone';
7
5
  import * as i2 from '@taiga-ui/cdk/directives/animated';
8
6
  import { TuiAnimated } from '@taiga-ui/cdk/directives/animated';
9
- import { TuiHoveredService } from '@taiga-ui/cdk/directives/hovered';
10
7
  import { tuiInjectElement, tuiPointToClientRect } from '@taiga-ui/cdk/utils/dom';
11
- import { tuiClamp } from '@taiga-ui/cdk/utils/math';
12
- import { tuiSetSignal, tuiPx, tuiIsPresent } from '@taiga-ui/cdk/utils/miscellaneous';
13
- import { TuiDriverDirective, TuiDriver, tuiAsDriver, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsVehicle, tuiAsRectAccessor, tuiPositionAccessorFor, tuiRectAccessorFor } from '@taiga-ui/core/classes';
8
+ import { TuiDriverDirective, TuiDriver, tuiAsDriver, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsVehicle, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsRectAccessor } from '@taiga-ui/core/classes';
14
9
  import { tuiButtonOptionsProvider } from '@taiga-ui/core/components/button';
15
10
  import * as i1 from '@taiga-ui/core/directives/appearance';
16
11
  import { tuiAppearance, TuiAppearance } from '@taiga-ui/core/directives/appearance';
17
- import { TuiPositionService, TuiVisualViewportService } from '@taiga-ui/core/services';
18
- import { TUI_VIEWPORT } from '@taiga-ui/core/tokens';
19
12
  import { tuiIsObscured } from '@taiga-ui/core/utils/miscellaneous';
20
13
  import { PolymorpheusComponent, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
21
- import { Subject, merge, switchMap, of, delay, takeUntil, repeat, filter, map, tap, distinctUntilChanged, skip, takeWhile, fromEvent, debounce, timer, startWith, BehaviorSubject } from 'rxjs';
14
+ import { outputFromObservable, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
22
15
  import { TuiPopupService } from '@taiga-ui/core/portals/popup';
16
+ import { Subject, merge, switchMap, of, delay, takeUntil, repeat, filter, map, tap, distinctUntilChanged, skip, takeWhile, fromEvent, debounce, timer, startWith, BehaviorSubject } from 'rxjs';
17
+ import { tuiProvide, tuiCreateOptions } from '@taiga-ui/cdk/utils/di';
18
+ import { tuiGenerateId, tuiPx, tuiSetSignal, tuiIsPresent } from '@taiga-ui/cdk/utils/miscellaneous';
23
19
  import { WA_IS_MOBILE } from '@ng-web-apis/platform';
24
- import { tuiCreateOptions } from '@taiga-ui/cdk/utils/di';
20
+ import { TuiHoveredService } from '@taiga-ui/cdk/directives/hovered';
21
+ import { TUI_VIEWPORT } from '@taiga-ui/core/tokens';
22
+ import { EMPTY_CLIENT_RECT } from '@taiga-ui/cdk/constants';
23
+ import { tuiClamp } from '@taiga-ui/cdk/utils/math';
24
+ import { TuiVisualViewportService, TuiPositionService } from '@taiga-ui/core/services';
25
25
  import { DOCUMENT } from '@angular/common';
26
26
  import { tuiIfMap, tuiTypedFromEvent, tuiZoneOptimized } from '@taiga-ui/cdk/observables';
27
27
  import { tuiIsFocused } from '@taiga-ui/cdk/utils/focus';
@@ -31,6 +31,25 @@ import { tuiIsFocused } from '@taiga-ui/cdk/utils/focus';
31
31
  */
32
32
  const TUI_HINT_COMPONENT = new InjectionToken(ngDevMode ? 'TUI_HINT_COMPONENT' : '', { factory: () => TuiHintComponent });
33
33
 
34
+ const TUI_HINT_ANCHOR = new InjectionToken(ngDevMode ? 'TUI_HINT_ANCHOR' : '');
35
+ class TuiHintAnchor {
36
+ constructor() {
37
+ this.anchor = `--${tuiGenerateId()}`;
38
+ }
39
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintAnchor, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
40
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintAnchor, isStandalone: true, host: { properties: { "attr.data-tui-anchor": "anchor", "style.anchor-name": "anchor" } }, providers: [tuiProvide(TUI_HINT_ANCHOR, ElementRef)], ngImport: i0 }); }
41
+ }
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintAnchor, decorators: [{
43
+ type: Directive,
44
+ args: [{
45
+ providers: [tuiProvide(TUI_HINT_ANCHOR, ElementRef)],
46
+ host: {
47
+ '[attr.data-tui-anchor]': 'anchor',
48
+ '[style.anchor-name]': 'anchor',
49
+ },
50
+ }]
51
+ }] });
52
+
34
53
  class TuiHintDriver extends TuiDriverDirective {
35
54
  constructor() {
36
55
  super(...arguments);
@@ -77,7 +96,6 @@ class TuiHintHover extends TuiDriver {
77
96
  constructor() {
78
97
  super((subscriber) => this.stream$.subscribe(subscriber));
79
98
  this.isMobile = inject(WA_IS_MOBILE);
80
- this.el = tuiInjectElement();
81
99
  this.hovered$ = inject(TuiHoveredService);
82
100
  this.options = inject(TUI_HINT_OPTIONS);
83
101
  this.visible = false;
@@ -94,6 +112,7 @@ class TuiHintHover extends TuiDriver {
94
112
  optional: true,
95
113
  skipSelf: true,
96
114
  });
115
+ this.el = tuiInjectElement();
97
116
  this.showDelay = input(this.options.showDelay, {
98
117
  alias: 'tuiHintShowDelay',
99
118
  });
@@ -269,7 +288,7 @@ class TuiHintDirective {
269
288
  deps: [TUI_HINT_COMPONENT, INJECTOR],
270
289
  useClass: PolymorpheusComponent,
271
290
  },
272
- ], usesOnChanges: true, hostDirectives: [{ directive: TuiHintDriver }, { directive: TuiHintHover, inputs: ["tuiHintHideDelay", "tuiHintHideDelay", "tuiHintShowDelay", "tuiHintShowDelay"] }, { directive: TuiHintPosition, inputs: ["tuiHintDirection", "tuiHintDirection", "tuiHintCentered", "tuiHintCentered", "tuiHintOffset", "tuiHintOffset"], outputs: ["tuiHintDirectionChange", "tuiHintDirectionChange"] }], ngImport: i0 }); }
291
+ ], usesOnChanges: true, hostDirectives: [{ directive: TuiHintAnchor }, { directive: TuiHintDriver }, { directive: TuiHintHover, inputs: ["tuiHintHideDelay", "tuiHintHideDelay", "tuiHintShowDelay", "tuiHintShowDelay"] }, { directive: TuiHintPosition, inputs: ["tuiHintDirection", "tuiHintDirection", "tuiHintCentered", "tuiHintCentered", "tuiHintOffset", "tuiHintOffset"], outputs: ["tuiHintDirectionChange", "tuiHintDirectionChange"] }], ngImport: i0 }); }
273
292
  }
274
293
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintDirective, decorators: [{
275
294
  type: Directive,
@@ -284,6 +303,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
284
303
  },
285
304
  ],
286
305
  hostDirectives: [
306
+ TuiHintAnchor,
287
307
  TuiHintDriver,
288
308
  {
289
309
  directive: TuiHintHover,
@@ -298,28 +318,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
298
318
  }]
299
319
  }] });
300
320
 
321
+ const GAP = 8;
322
+ const ARROW_OFFSET = 22;
323
+ class TuiHintAnchored {
324
+ constructor() {
325
+ this.el = tuiInjectElement();
326
+ this.hover = inject(TuiHintHover);
327
+ this.vvs = inject(TuiVisualViewportService);
328
+ this.viewport = inject(TUI_VIEWPORT);
329
+ this.accessor = inject(TuiRectAccessor);
330
+ this.directive = inject(TuiHintDirective);
331
+ this.styles$ = inject(TuiPositionService).pipe(takeWhile(() => this.directive.el.isConnected &&
332
+ this.directive.el.getClientRects().length > 0), map((point) => this.vvs.correct(point)), takeUntilDestroyed());
333
+ this.sub = inject(TuiHoveredService)
334
+ .pipe(takeUntilDestroyed())
335
+ .subscribe((hover) => this.hover.toggle(hover));
336
+ }
337
+ ngAfterViewInit() {
338
+ this.styles$.subscribe({
339
+ next: (point) => this.update(...point),
340
+ complete: () => this.directive.toggle(false),
341
+ });
342
+ }
343
+ update(left, top) {
344
+ const { clientHeight, clientWidth } = this.el;
345
+ const rect = this.accessor.getClientRect();
346
+ if (rect === EMPTY_CLIENT_RECT || !clientHeight || !clientWidth) {
347
+ return;
348
+ }
349
+ const viewport = this.viewport.getClientRect();
350
+ const max = Math.max(GAP, viewport.width + viewport.left - clientWidth - GAP);
351
+ const safeLeft = tuiClamp(Math.max(GAP, left), viewport.left + GAP, max);
352
+ const startX = Math.round(safeLeft) === Math.round(rect.left);
353
+ const startY = Math.round(top) === Math.round(rect.top);
354
+ const endX = Math.round(safeLeft + clientWidth) === Math.round(rect.right);
355
+ const endY = Math.round(top + clientHeight) === Math.round(rect.bottom);
356
+ const [beakLeft, beakTop] = this.vvs.correct([
357
+ rect.left + rect.width / 2 - safeLeft,
358
+ rect.top + rect.height / 2 - top,
359
+ ]);
360
+ /* eslint-disable no-nested-ternary */
361
+ const x = startX ? ARROW_OFFSET : endX ? clientWidth - ARROW_OFFSET : beakLeft;
362
+ const y = startY ? ARROW_OFFSET : endY ? clientHeight - ARROW_OFFSET : beakTop;
363
+ this.apply(tuiPx(Math.round(top)), tuiPx(Math.round(safeLeft)), Math.round((tuiClamp(y, 0, clientHeight) / clientHeight) * 100), Math.round((tuiClamp(x, 0, clientWidth) / clientWidth) * 100));
364
+ }
365
+ apply(top, left, beakTop, beakLeft) {
366
+ this.el.style.setProperty('top', top);
367
+ this.el.style.setProperty('left', left);
368
+ this.el.style.setProperty('--t-top', `${beakTop}%`);
369
+ this.el.style.setProperty('--t-left', `${beakLeft}%`);
370
+ this.el.style.setProperty('--t-rotate', !beakLeft || Math.ceil(beakLeft) === 100 ? '90deg' : '0deg');
371
+ }
372
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintAnchored, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
373
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintAnchored, isStandalone: true, providers: [
374
+ TuiPositionService,
375
+ TuiHoveredService,
376
+ tuiPositionAccessorFor('hint', TuiHintPosition),
377
+ tuiRectAccessorFor('hint', forwardRef(() => TuiHintDirective)),
378
+ ], ngImport: i0 }); }
379
+ }
380
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintAnchored, decorators: [{
381
+ type: Directive,
382
+ args: [{
383
+ providers: [
384
+ TuiPositionService,
385
+ TuiHoveredService,
386
+ tuiPositionAccessorFor('hint', TuiHintPosition),
387
+ tuiRectAccessorFor('hint', forwardRef(() => TuiHintDirective)),
388
+ ],
389
+ }]
390
+ }] });
391
+
392
+ const STYLE = {
393
+ position: 'fixed',
394
+ blockSize: '1px',
395
+ inlineSize: '1px',
396
+ pointerEvents: 'none',
397
+ };
301
398
  class TuiHintPointer extends TuiHintHover {
302
399
  constructor() {
303
- super(...arguments);
400
+ super();
401
+ this.doc = inject(DOCUMENT);
304
402
  this.currentRect = EMPTY_CLIENT_RECT;
403
+ this.nativeElement = this.doc.createElement('div');
404
+ afterNextRender(() => {
405
+ const anchorName = `--${tuiGenerateId()}`;
406
+ const positionAnchor = this.el.getAttribute('data-tui-anchor');
407
+ const style = { ...STYLE, positionAnchor, anchorName };
408
+ Object.assign(this.nativeElement.style, style);
409
+ this.nativeElement.setAttribute('data-tui-anchor', anchorName);
410
+ this.doc.body.appendChild(this.nativeElement);
411
+ });
412
+ }
413
+ ngOnDestroy() {
414
+ this.nativeElement.parentNode?.removeChild(this.nativeElement);
305
415
  }
306
416
  getClientRect() {
307
417
  return this.currentRect;
308
418
  }
309
419
  onMove({ clientX, clientY }) {
420
+ const { top, left } = this.el.getBoundingClientRect();
310
421
  this.currentRect = tuiPointToClientRect(clientX, clientY);
311
- }
312
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintPointer, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
313
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintPointer, isStandalone: true, selector: "[tuiHint][tuiHintPointer]", host: { listeners: { "mousemove.zoneless": "onMove($event)" } }, providers: [tuiAsRectAccessor(TuiHintPointer), tuiAsDriver(TuiHintPointer)], usesInheritance: true, ngImport: i0 }); }
422
+ this.nativeElement.style.top = `calc(anchor(top) + ${clientY - top}px)`;
423
+ this.nativeElement.style.left = `calc(anchor(left) + ${clientX - left}px)`;
424
+ }
425
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintPointer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
426
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintPointer, isStandalone: true, selector: "[tuiHint][tuiHintPointer]", host: { listeners: { "mousemove.zoneless": "onMove($event)" } }, providers: [
427
+ tuiAsRectAccessor(TuiHintPointer),
428
+ tuiAsDriver(TuiHintPointer),
429
+ tuiProvide(TUI_HINT_ANCHOR, TuiHintPointer),
430
+ ], usesInheritance: true, ngImport: i0 }); }
314
431
  }
315
432
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintPointer, decorators: [{
316
433
  type: Directive,
317
434
  args: [{
318
435
  selector: '[tuiHint][tuiHintPointer]',
319
- providers: [tuiAsRectAccessor(TuiHintPointer), tuiAsDriver(TuiHintPointer)],
436
+ providers: [
437
+ tuiAsRectAccessor(TuiHintPointer),
438
+ tuiAsDriver(TuiHintPointer),
439
+ tuiProvide(TUI_HINT_ANCHOR, TuiHintPointer),
440
+ ],
320
441
  host: { '(mousemove.zoneless)': 'onMove($event)' },
321
442
  }]
322
- }] });
443
+ }], ctorParameters: () => [] });
323
444
 
324
445
  class TuiHintUnstyledComponent {
325
446
  constructor() {
@@ -350,43 +471,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
350
471
  args: [{ selector: 'ng-template[tuiHint]' }]
351
472
  }], ctorParameters: () => [] });
352
473
 
353
- /** @internal */
354
- function tuiGetHintProviders() {
355
- return [
356
- TuiPositionService,
357
- TuiHoveredService,
358
- tuiPositionAccessorFor('hint', TuiHintPosition),
359
- tuiRectAccessorFor('hint', forwardRef(() => TuiHintDirective)),
360
- ];
361
- }
362
- const GAP = 8;
363
- const ARROW_OFFSET = 22;
364
474
  class TuiHintComponent {
365
475
  constructor() {
366
476
  this.el = tuiInjectElement();
367
477
  this.hover = inject(TuiHintHover);
368
- this.vvs = inject(TuiVisualViewportService);
369
- this.viewport = inject(TUI_VIEWPORT);
370
478
  this.pointer = inject(TuiHintPointer, { optional: true });
371
479
  this.accessor = inject(TuiRectAccessor);
372
480
  this.hint = inject(TuiHintDirective);
481
+ this.appearance = tuiAppearance(this.hint.appearance);
373
482
  this.content = this.hint.component.component === TuiHintUnstyledComponent
374
483
  ? signal('')
375
484
  : this.hint.content;
376
485
  this.theme = this.hint.el
377
486
  .closest('[tuiTheme]')
378
487
  ?.getAttribute('tuiTheme');
379
- this.appearance = tuiAppearance(this.hint.appearance);
380
- inject(TuiPositionService)
381
- .pipe(takeWhile(() => this.hint.el.isConnected &&
382
- this.hint.el.getClientRects().length > 0), map((point) => this.vvs.correct(point)), takeUntilDestroyed())
383
- .subscribe({
384
- next: (point) => this.update(...point),
385
- complete: () => this.hint.toggle(false),
386
- });
387
- inject(TuiHoveredService)
388
- .pipe(takeUntilDestroyed())
389
- .subscribe((hover) => this.hover.toggle(hover));
390
488
  }
391
489
  onPointerDown(target) {
392
490
  if ((!target.closest(this.el.tagName) && !this.hint.el.contains(target)) ||
@@ -394,36 +492,8 @@ class TuiHintComponent {
394
492
  this.hover.toggle(false);
395
493
  }
396
494
  }
397
- apply(top, left, beakTop, beakLeft) {
398
- this.el.style.setProperty('top', top);
399
- this.el.style.setProperty('left', left);
400
- this.el.style.setProperty('--t-top', `${beakTop}%`);
401
- this.el.style.setProperty('--t-left', `${beakLeft}%`);
402
- this.el.style.setProperty('--t-rotate', !beakLeft || Math.ceil(beakLeft) === 100 ? '90deg' : '0deg');
403
- }
404
- update(left, top) {
405
- const { clientHeight, clientWidth } = this.el;
406
- const rect = this.accessor.getClientRect();
407
- if (rect === EMPTY_CLIENT_RECT || !clientHeight || !clientWidth) {
408
- return;
409
- }
410
- const viewport = this.viewport.getClientRect();
411
- const safeLeft = tuiClamp(Math.max(GAP, left), viewport.left + GAP, Math.max(GAP, viewport.width + viewport.left - clientWidth - GAP));
412
- const startX = Math.round(safeLeft) === Math.round(rect.left);
413
- const startY = Math.round(top) === Math.round(rect.top);
414
- const endX = Math.round(safeLeft + clientWidth) === Math.round(rect.right);
415
- const endY = Math.round(top + clientHeight) === Math.round(rect.bottom);
416
- const [beakLeft, beakTop] = this.vvs.correct([
417
- rect.left + rect.width / 2 - safeLeft,
418
- rect.top + rect.height / 2 - top,
419
- ]);
420
- /* eslint-disable no-nested-ternary */
421
- const x = startX ? ARROW_OFFSET : endX ? clientWidth - ARROW_OFFSET : beakLeft;
422
- const y = startY ? ARROW_OFFSET : endY ? clientHeight - ARROW_OFFSET : beakTop;
423
- this.apply(tuiPx(Math.round(top)), tuiPx(Math.round(safeLeft)), Math.round((tuiClamp(y, 0, clientHeight) / clientHeight) * 100), Math.round((tuiClamp(x, 0, clientWidth) / clientWidth) * 100));
424
- }
425
495
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
426
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintComponent, isStandalone: true, selector: "tui-hint", host: { attributes: { "role": "tooltip" }, listeners: { "document:pointerdown": "onPointerDown($event.target)" }, properties: { "attr.tuiTheme": "theme", "class._untouchable": "pointer" } }, providers: [tuiGetHintProviders(), tuiButtonOptionsProvider({ size: 's' })], hostDirectives: [{ directive: i1.TuiAppearance }, { directive: i2.TuiAnimated }, { directive: i3.TuiActiveZone }], ngImport: i0, template: `
496
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TuiHintComponent, isStandalone: true, selector: "tui-hint", host: { attributes: { "role": "tooltip" }, listeners: { "document:pointerdown": "onPointerDown($event.target)" }, properties: { "attr.tuiTheme": "theme", "class._untouchable": "pointer" } }, providers: [tuiButtonOptionsProvider({ size: 's' })], hostDirectives: [{ directive: i1.TuiAppearance }, { directive: i2.TuiAnimated }, { directive: i3.TuiActiveZone }, { directive: TuiHintAnchored }], ngImport: i0, template: `
427
497
  <ng-content />
428
498
  <span
429
499
  *polymorpheusOutlet="content() as text; context: hint.context()"
@@ -439,13 +509,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
439
509
  *polymorpheusOutlet="content() as text; context: hint.context()"
440
510
  [innerHTML]="text"
441
511
  ></span>
442
- `, changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiGetHintProviders(), tuiButtonOptionsProvider({ size: 's' })], hostDirectives: [TuiAppearance, TuiAnimated, TuiActiveZone], host: {
512
+ `, changeDetection: ChangeDetectionStrategy.OnPush, providers: [tuiButtonOptionsProvider({ size: 's' })], hostDirectives: [TuiAppearance, TuiAnimated, TuiActiveZone, TuiHintAnchored], host: {
443
513
  role: 'tooltip',
444
514
  '[attr.tuiTheme]': 'theme',
445
515
  '[class._untouchable]': 'pointer',
446
516
  '(document:pointerdown)': 'onPointerDown($event.target)',
447
517
  }, styles: [":host{position:absolute;max-inline-size:min(20rem,calc(100% - 1rem));padding:.75rem 1rem;background:var(--tui-background-accent-1);border-radius:var(--tui-radius-l);color:var(--tui-text-primary-on-accent-1);box-sizing:border-box;font:var(--tui-typography-body-s);white-space:pre-line;overflow-wrap:break-word;transform-origin:var(--t-left) var(--t-top);--tui-background-elevation-2: var(--tui-background-elevation-3);--tui-scale: .5}:host.tui-enter{animation:tuiFade var(--tui-duration) var(--tui-curve-expressive-standard),tuiScale var(--tui-duration) var(--tui-curve-expressive-standard) 10ms}:host.tui-leave{animation:tuiFade calc(var(--tui-duration) / 2) var(--tui-curve-expressive-standard) reverse,tuiScale calc(var(--tui-duration) / 2) var(--tui-curve-expressive-standard) reverse}:host:before{content:\"\";position:absolute;inset-block-start:var(--t-top);inset-inline-start:var(--t-left);inline-size:.75rem;block-size:.5rem;background:inherit;-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 12 8\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.61336 1.69607L2.44882 2.96493C1.84795 3.61964 0.949361 3.99951 0.00053941 4C0.000359608 4 0.000179805 4 0 4C0.000179863 4 0.000359764 4 0.000539623 4C0.949362 4.00049 1.84795 4.38036 2.44882 5.03506L3.61336 6.30394C4.55981 7.33517 5.03303 7.85079 5.63254 7.96535C5.87433 8.01155 6.12436 8.01155 6.36616 7.96535C6.96567 7.85079 7.43889 7.33517 8.38534 6.30393L9.54988 5.03507C10.1511 4.37994 11.0505 4 12 4C11.0505 4 10.1511 3.62006 9.54988 2.96493L8.38534 1.69606C7.43889 0.664826 6.96567 0.149207 6.36616 0.0346517C6.12436 -0.0115506 5.87433 -0.0115506 5.63254 0.0346517C5.03303 0.149207 4.55981 0.664827 3.61336 1.69607Z\" /></svg>');mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 12 8\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3.61336 1.69607L2.44882 2.96493C1.84795 3.61964 0.949361 3.99951 0.00053941 4C0.000359608 4 0.000179805 4 0 4C0.000179863 4 0.000359764 4 0.000539623 4C0.949362 4.00049 1.84795 4.38036 2.44882 5.03506L3.61336 6.30394C4.55981 7.33517 5.03303 7.85079 5.63254 7.96535C5.87433 8.01155 6.12436 8.01155 6.36616 7.96535C6.96567 7.85079 7.43889 7.33517 8.38534 6.30393L9.54988 5.03507C10.1511 4.37994 11.0505 4 12 4C11.0505 4 10.1511 3.62006 9.54988 2.96493L8.38534 1.69606C7.43889 0.664826 6.96567 0.149207 6.36616 0.0346517C6.12436 -0.0115506 5.87433 -0.0115506 5.63254 0.0346517C5.03303 0.149207 4.55981 0.664827 3.61336 1.69607Z\" /></svg>');transition:none;transform:translate(-50%,-50%) rotate(var(--t-rotate))}:host:not([style*=top]){visibility:hidden}:host._untouchable{pointer-events:none}:host ::ng-deep [tuiTitle]{margin-block-end:.75rem}:host ::ng-deep [tuiTitle]+footer{margin-block-start:.75rem}:host ::ng-deep [tuiIconButton][data-appearance=icon][data-size=xs]{float:right;margin-inline-end:-.25rem}@supports (float: inline-end){:host ::ng-deep [tuiIconButton][data-appearance=icon][data-size=xs]{float:inline-end}}:host ::ng-deep img{display:block;border-radius:var(--tui-radius-m)}:host ::ng-deep footer{display:flex;justify-content:flex-end;gap:.5rem;inline-size:18rem;max-inline-size:100%;margin:1rem 0 .25rem}\n"] }]
448
- }], ctorParameters: () => [] });
518
+ }] });
449
519
 
450
520
  class TuiHintDescribe extends TuiDriver {
451
521
  constructor() {
@@ -478,18 +548,25 @@ class TuiHintHost extends TuiRectAccessor {
478
548
  super(...arguments);
479
549
  this.tuiHintHost = input();
480
550
  this.type = 'hint';
551
+ this.nativeElement = tuiInjectElement();
552
+ this.sync = effect(() => {
553
+ const anchorName = `--${tuiGenerateId()}`;
554
+ this.nativeElement = this.tuiHintHost() || this.nativeElement;
555
+ this.nativeElement.setAttribute('data-tui-anchor', anchorName);
556
+ this.nativeElement.style.setProperty('anchor-name', anchorName);
557
+ });
481
558
  }
482
559
  getClientRect() {
483
- return this.tuiHintHost()?.getBoundingClientRect() || EMPTY_CLIENT_RECT;
560
+ return this.nativeElement.getBoundingClientRect();
484
561
  }
485
562
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintHost, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
486
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.25", type: TuiHintHost, isStandalone: true, selector: "[tuiHint][tuiHintHost]", inputs: { tuiHintHost: { classPropertyName: "tuiHintHost", publicName: "tuiHintHost", isSignal: true, isRequired: false, transformFunction: null } }, providers: [tuiAsRectAccessor(TuiHintHost)], usesInheritance: true, ngImport: i0 }); }
563
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.25", type: TuiHintHost, isStandalone: true, selector: "[tuiHint][tuiHintHost]", inputs: { tuiHintHost: { classPropertyName: "tuiHintHost", publicName: "tuiHintHost", isSignal: true, isRequired: false, transformFunction: null } }, providers: [tuiAsRectAccessor(TuiHintHost), tuiProvide(TUI_HINT_ANCHOR, TuiHintHost)], usesInheritance: true, ngImport: i0 }); }
487
564
  }
488
565
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TuiHintHost, decorators: [{
489
566
  type: Directive,
490
567
  args: [{
491
568
  selector: '[tuiHint][tuiHintHost]',
492
- providers: [tuiAsRectAccessor(TuiHintHost)],
569
+ providers: [tuiAsRectAccessor(TuiHintHost), tuiProvide(TUI_HINT_ANCHOR, TuiHintHost)],
493
570
  }]
494
571
  }] });
495
572
 
@@ -561,5 +638,5 @@ const TuiHint = [
561
638
  * Generated bundle index. Do not edit.
562
639
  */
563
640
 
564
- export { TUI_HINT_COMPONENT, TUI_HINT_DEFAULT_OPTIONS, TUI_HINT_DIRECTIONS, TUI_HINT_OPTIONS, TuiHint, TuiHintComponent, TuiHintDescribe, TuiHintDirective, TuiHintDriver, TuiHintHost, TuiHintHover, TuiHintManual, TuiHintOverflow, TuiHintPointer, TuiHintPosition, TuiHintUnstyled, TuiHintUnstyledComponent, tuiGetHintProviders, tuiHintOptionsProvider };
641
+ export { TUI_HINT_ANCHOR, TUI_HINT_COMPONENT, TUI_HINT_DEFAULT_OPTIONS, TUI_HINT_DIRECTIONS, TUI_HINT_OPTIONS, TuiHint, TuiHintAnchor, TuiHintAnchored, TuiHintComponent, TuiHintDescribe, TuiHintDirective, TuiHintDriver, TuiHintHost, TuiHintHover, TuiHintManual, TuiHintOverflow, TuiHintPointer, TuiHintPosition, TuiHintUnstyled, TuiHintUnstyledComponent, tuiHintOptionsProvider };
565
642
  //# sourceMappingURL=taiga-ui-core-portals-hint.mjs.map