@taiga-ui/core 5.0.0-rc.3 → 5.0.0-rc.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.
Files changed (113) hide show
  1. package/components/calendar/calendar-sheet.component.d.ts +8 -23
  2. package/components/calendar/calendar-spin.component.d.ts +5 -8
  3. package/components/calendar/calendar-year.component.d.ts +11 -19
  4. package/components/calendar/calendar.component.d.ts +17 -29
  5. package/components/carousel/carousel.component.d.ts +20 -0
  6. package/components/carousel/carousel.d.ts +4 -0
  7. package/components/carousel/carousel.directive.d.ts +11 -0
  8. package/components/carousel/index.d.ts +3 -0
  9. package/components/data-list/data-list.component.d.ts +1 -0
  10. package/components/error/error.directive.d.ts +1 -1
  11. package/components/index.d.ts +1 -0
  12. package/components/input/input.directive.d.ts +2 -0
  13. package/directives/appearance/appearance.options.d.ts +1 -1
  14. package/fesm2022/taiga-ui-core-classes.mjs +3 -3
  15. package/fesm2022/taiga-ui-core-classes.mjs.map +1 -1
  16. package/fesm2022/taiga-ui-core-components-button.mjs +8 -8
  17. package/fesm2022/taiga-ui-core-components-button.mjs.map +1 -1
  18. package/fesm2022/taiga-ui-core-components-calendar.mjs +123 -269
  19. package/fesm2022/taiga-ui-core-components-calendar.mjs.map +1 -1
  20. package/fesm2022/taiga-ui-core-components-carousel.mjs +100 -0
  21. package/fesm2022/taiga-ui-core-components-carousel.mjs.map +1 -0
  22. package/fesm2022/taiga-ui-core-components-cell.mjs +9 -7
  23. package/fesm2022/taiga-ui-core-components-cell.mjs.map +1 -1
  24. package/fesm2022/taiga-ui-core-components-checkbox.mjs +4 -4
  25. package/fesm2022/taiga-ui-core-components-checkbox.mjs.map +1 -1
  26. package/fesm2022/taiga-ui-core-components-data-list.mjs +30 -21
  27. package/fesm2022/taiga-ui-core-components-data-list.mjs.map +1 -1
  28. package/fesm2022/taiga-ui-core-components-error.mjs +11 -11
  29. package/fesm2022/taiga-ui-core-components-error.mjs.map +1 -1
  30. package/fesm2022/taiga-ui-core-components-expand.mjs +5 -5
  31. package/fesm2022/taiga-ui-core-components-expand.mjs.map +1 -1
  32. package/fesm2022/taiga-ui-core-components-icon.mjs +8 -7
  33. package/fesm2022/taiga-ui-core-components-icon.mjs.map +1 -1
  34. package/fesm2022/taiga-ui-core-components-input.mjs +9 -7
  35. package/fesm2022/taiga-ui-core-components-input.mjs.map +1 -1
  36. package/fesm2022/taiga-ui-core-components-label.mjs +7 -7
  37. package/fesm2022/taiga-ui-core-components-label.mjs.map +1 -1
  38. package/fesm2022/taiga-ui-core-components-link.mjs +8 -8
  39. package/fesm2022/taiga-ui-core-components-link.mjs.map +1 -1
  40. package/fesm2022/taiga-ui-core-components-loader.mjs +4 -4
  41. package/fesm2022/taiga-ui-core-components-loader.mjs.map +1 -1
  42. package/fesm2022/taiga-ui-core-components-notification.mjs +18 -18
  43. package/fesm2022/taiga-ui-core-components-notification.mjs.map +1 -1
  44. package/fesm2022/taiga-ui-core-components-radio.mjs +7 -7
  45. package/fesm2022/taiga-ui-core-components-radio.mjs.map +1 -1
  46. package/fesm2022/taiga-ui-core-components-root.mjs +4 -4
  47. package/fesm2022/taiga-ui-core-components-root.mjs.map +1 -1
  48. package/fesm2022/taiga-ui-core-components-scrollbar.mjs +22 -22
  49. package/fesm2022/taiga-ui-core-components-scrollbar.mjs.map +1 -1
  50. package/fesm2022/taiga-ui-core-components-slider.mjs +17 -17
  51. package/fesm2022/taiga-ui-core-components-slider.mjs.map +1 -1
  52. package/fesm2022/taiga-ui-core-components-spin-button.mjs +4 -4
  53. package/fesm2022/taiga-ui-core-components-spin-button.mjs.map +1 -1
  54. package/fesm2022/taiga-ui-core-components-textfield.mjs +59 -31
  55. package/fesm2022/taiga-ui-core-components-textfield.mjs.map +1 -1
  56. package/fesm2022/taiga-ui-core-components-title.mjs +7 -7
  57. package/fesm2022/taiga-ui-core-components-title.mjs.map +1 -1
  58. package/fesm2022/taiga-ui-core-components.mjs +1 -0
  59. package/fesm2022/taiga-ui-core-components.mjs.map +1 -1
  60. package/fesm2022/taiga-ui-core-directives-appearance.mjs +10 -10
  61. package/fesm2022/taiga-ui-core-directives-appearance.mjs.map +1 -1
  62. package/fesm2022/taiga-ui-core-directives-button-x.mjs +3 -3
  63. package/fesm2022/taiga-ui-core-directives-button-x.mjs.map +1 -1
  64. package/fesm2022/taiga-ui-core-directives-date-format.mjs +3 -3
  65. package/fesm2022/taiga-ui-core-directives-date-format.mjs.map +1 -1
  66. package/fesm2022/taiga-ui-core-directives-group.mjs +7 -7
  67. package/fesm2022/taiga-ui-core-directives-group.mjs.map +1 -1
  68. package/fesm2022/taiga-ui-core-directives-icons.mjs +10 -10
  69. package/fesm2022/taiga-ui-core-directives-icons.mjs.map +1 -1
  70. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs +9 -9
  71. package/fesm2022/taiga-ui-core-directives-items-handlers.mjs.map +1 -1
  72. package/fesm2022/taiga-ui-core-directives-number-format.mjs +3 -3
  73. package/fesm2022/taiga-ui-core-directives-number-format.mjs.map +1 -1
  74. package/fesm2022/taiga-ui-core-pipes-filter-by-input.mjs +55 -0
  75. package/fesm2022/taiga-ui-core-pipes-filter-by-input.mjs.map +1 -0
  76. package/fesm2022/taiga-ui-core-pipes-format-number.mjs +3 -3
  77. package/fesm2022/taiga-ui-core-pipes-format-number.mjs.map +1 -1
  78. package/fesm2022/taiga-ui-core-pipes.mjs +1 -0
  79. package/fesm2022/taiga-ui-core-pipes.mjs.map +1 -1
  80. package/fesm2022/taiga-ui-core-portals-alert.mjs +12 -10
  81. package/fesm2022/taiga-ui-core-portals-alert.mjs.map +1 -1
  82. package/fesm2022/taiga-ui-core-portals-dialog.mjs +16 -15
  83. package/fesm2022/taiga-ui-core-portals-dialog.mjs.map +1 -1
  84. package/fesm2022/taiga-ui-core-portals-dropdown.mjs +328 -263
  85. package/fesm2022/taiga-ui-core-portals-dropdown.mjs.map +1 -1
  86. package/fesm2022/taiga-ui-core-portals-hint.mjs +39 -39
  87. package/fesm2022/taiga-ui-core-portals-hint.mjs.map +1 -1
  88. package/fesm2022/taiga-ui-core-portals-modal.mjs +10 -8
  89. package/fesm2022/taiga-ui-core-portals-modal.mjs.map +1 -1
  90. package/fesm2022/taiga-ui-core-portals-popup.mjs +10 -10
  91. package/fesm2022/taiga-ui-core-portals-popup.mjs.map +1 -1
  92. package/fesm2022/taiga-ui-core-services.mjs +6 -6
  93. package/fesm2022/taiga-ui-core-services.mjs.map +1 -1
  94. package/fesm2022/taiga-ui-core-tokens.mjs +4 -2
  95. package/fesm2022/taiga-ui-core-tokens.mjs.map +1 -1
  96. package/fesm2022/taiga-ui-core-utils-dom.mjs.map +1 -1
  97. package/fesm2022/taiga-ui-core-utils-format.mjs.map +1 -1
  98. package/fesm2022/taiga-ui-core-utils-miscellaneous.mjs.map +1 -1
  99. package/package.json +33 -11
  100. package/pipes/filter-by-input/filter-by-input.options.d.ts +6 -0
  101. package/pipes/filter-by-input/filter-by-input.pipe.d.ts +19 -0
  102. package/pipes/filter-by-input/index.d.ts +2 -0
  103. package/pipes/index.d.ts +1 -0
  104. package/portals/dropdown/dropdown-a11y.directive.d.ts +10 -0
  105. package/portals/dropdown/dropdown-close.directive.d.ts +3 -3
  106. package/portals/dropdown/dropdown-open.directive.d.ts +3 -2
  107. package/portals/dropdown/dropdown-selection.directive.d.ts +1 -0
  108. package/portals/dropdown/dropdown.d.ts +2 -1
  109. package/portals/dropdown/dropdown.directive.d.ts +6 -6
  110. package/portals/dropdown/dropdown.providers.d.ts +2 -1
  111. package/portals/dropdown/index.d.ts +2 -1
  112. package/tokens/index.d.ts +1 -0
  113. package/tokens/textfield.d.ts +2 -0
@@ -1,41 +1,41 @@
1
+ import { tuiProvide, tuiDirectiveBinding, tuiCreateOptions } from '@taiga-ui/cdk/utils/di';
2
+ import { coerceArray } from '@angular/cdk/coercion';
1
3
  import * as i0 from '@angular/core';
2
- import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, ChangeDetectorRef, effect, signal, INJECTOR, input, computed, TemplateRef, forwardRef, ChangeDetectionStrategy, Component, PLATFORM_ID, contentChild, ElementRef, model, ViewContainerRef } from '@angular/core';
4
+ import { Injectable, Directive, InjectionToken, Optional, Self, SkipSelf, inject, computed, forwardRef, ChangeDetectionStrategy, Component, input, effect, ChangeDetectorRef, signal, INJECTOR, TemplateRef, ElementRef, contentChild, model, PLATFORM_ID, ViewContainerRef } from '@angular/core';
3
5
  import { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
6
+ import { tuiZonefreeScheduler, tuiIfMap, tuiCloseWatcher, tuiTypedFromEvent, tuiStopPropagation, tuiZoneOptimized } from '@taiga-ui/cdk/observables';
7
+ import { tuiInjectElement, tuiGetActualTarget, tuiIsElement, tuiIsElementEditable, tuiIsHTMLElement, tuiPointToClientRect, tuiIsTextNode, tuiIsTextfield } from '@taiga-ui/cdk/utils/dom';
8
+ import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsVehicle, tuiAsDriver, tuiAsRectAccessor, TuiDriver, tuiAsPositionAccessor } from '@taiga-ui/core/classes';
9
+ import { TuiPopupService } from '@taiga-ui/core/portals/popup';
10
+ import { tuiCheckFixedPosition, tuiGetWordRange } from '@taiga-ui/core/utils/dom';
11
+ import { PolymorpheusOutlet, PolymorpheusComponent, PolymorpheusTemplate } from '@taiga-ui/polymorpheus';
12
+ import { BehaviorSubject, Subject, distinctUntilChanged, takeWhile, map, throttleTime, merge, filter, EMPTY, switchMap, delay, startWith, takeUntil, fromEvent, of, tap, share, combineLatest } from 'rxjs';
4
13
  import { EMPTY_CLIENT_RECT, TUI_TRUE_HANDLER, CHAR_ZERO_WIDTH_SPACE, CHAR_NO_BREAK_SPACE } from '@taiga-ui/cdk/constants';
5
14
  import * as i1 from '@taiga-ui/cdk/directives/active-zone';
6
15
  import { TuiActiveZone } from '@taiga-ui/cdk/directives/active-zone';
7
16
  import * as i2 from '@taiga-ui/cdk/directives/animated';
8
17
  import { TuiAnimated } from '@taiga-ui/cdk/directives/animated';
9
- import { tuiInjectElement, tuiGetActualTarget, tuiPointToClientRect, tuiIsElement, tuiIsElementEditable, tuiIsHTMLElement, tuiIsTextNode, tuiIsTextfield } from '@taiga-ui/cdk/utils/dom';
10
18
  import { tuiClamp } from '@taiga-ui/cdk/utils/math';
11
- import { tuiPx, tuiSetSignal, tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
12
- import { TuiDriverDirective, TuiPositionAccessor, tuiFallbackAccessor, TuiRectAccessor, tuiAsVehicle, tuiPositionAccessorFor, tuiRectAccessorFor, tuiAsDriver, tuiAsRectAccessor, TuiDriver, tuiAsPositionAccessor } from '@taiga-ui/core/classes';
19
+ import { tuiPx, tuiGenerateId, tuiSetSignal, tuiIsString } from '@taiga-ui/cdk/utils/miscellaneous';
13
20
  import { TuiScrollbar } from '@taiga-ui/core/components/scrollbar';
14
21
  import { TuiVisualViewportService, TuiPositionService } from '@taiga-ui/core/services';
15
22
  import { TUI_VIEWPORT, TUI_DARK_MODE, TUI_SELECTION_STREAM } from '@taiga-ui/core/tokens';
16
- import { PolymorpheusComponent, PolymorpheusTemplate, PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
17
- import { BehaviorSubject, Subject, distinctUntilChanged, throttleTime, takeWhile, map, merge, filter, EMPTY, switchMap, delay, startWith, takeUntil, fromEvent, of, tap, share, combineLatest } from 'rxjs';
18
- import { coerceArray } from '@angular/cdk/coercion';
19
- import { tuiZonefreeScheduler, tuiTypedFromEvent, tuiZoneOptimized, tuiIfMap, tuiCloseWatcher, tuiStopPropagation } from '@taiga-ui/cdk/observables';
20
- import { TuiPopupService } from '@taiga-ui/core/portals/popup';
21
- import { tuiCheckFixedPosition, tuiGetWordRange } from '@taiga-ui/core/utils/dom';
22
- import { tuiProvide, tuiCreateOptions, tuiDirectiveBinding } from '@taiga-ui/cdk/utils/di';
23
23
  import { tuiOverrideOptions, tuiIsEditingKey } from '@taiga-ui/core/utils/miscellaneous';
24
- import { isPlatformBrowser, DOCUMENT } from '@angular/common';
25
- import { WA_IS_TOUCH } from '@ng-web-apis/platform';
24
+ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
26
25
  import * as i1$1 from '@taiga-ui/cdk/directives/obscured';
27
26
  import { TuiObscured } from '@taiga-ui/cdk/directives/obscured';
28
27
  import { tuiIsFocusable, tuiGetClosestFocusable, tuiIsFocusedIn, tuiGetFocused } from '@taiga-ui/cdk/utils/focus';
28
+ import { WA_IS_TOUCH } from '@ng-web-apis/platform';
29
29
 
30
30
  class TuiDropdownDriver extends BehaviorSubject {
31
31
  constructor() {
32
32
  super(false);
33
33
  this.type = 'dropdown';
34
34
  }
35
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
36
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDriver }); }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
36
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDriver }); }
37
37
  }
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDriver, decorators: [{
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDriver, decorators: [{
39
39
  type: Injectable
40
40
  }], ctorParameters: () => [] });
41
41
  class TuiDropdownDriverDirective extends TuiDriverDirective {
@@ -43,19 +43,13 @@ class TuiDropdownDriverDirective extends TuiDriverDirective {
43
43
  super(...arguments);
44
44
  this.type = 'dropdown';
45
45
  }
46
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDriverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
47
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownDriverDirective, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
46
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDriverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
47
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownDriverDirective, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
48
48
  }
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDriverDirective, decorators: [{
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDriverDirective, decorators: [{
50
50
  type: Directive
51
51
  }] });
52
52
 
53
- /**
54
- * A component to display a dropdown
55
- */
56
- const TUI_DROPDOWN_COMPONENT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_COMPONENT' : '', { factory: () => TuiDropdownComponent });
57
- const TUI_DROPDOWN_CONTEXT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_CONTEXT' : '');
58
-
59
53
  const TUI_DROPDOWN_DEFAULT_OPTIONS = {
60
54
  align: 'start',
61
55
  direction: null,
@@ -85,10 +79,10 @@ class TuiDropdownOptionsDirective {
85
79
  this.maxHeight = this.options.maxHeight;
86
80
  this.offset = this.options.offset;
87
81
  }
88
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownOptionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
89
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownOptionsDirective, isStandalone: true, selector: "[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]", inputs: { align: ["tuiDropdownAlign", "align"], appearance: ["tuiDropdownAppearance", "appearance"], direction: ["tuiDropdownDirection", "direction"], limitWidth: ["tuiDropdownLimitWidth", "limitWidth"], minHeight: ["tuiDropdownMinHeight", "minHeight"], maxHeight: ["tuiDropdownMaxHeight", "maxHeight"], offset: ["tuiDropdownOffset", "offset"] }, providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)], ngImport: i0 }); }
82
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownOptionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
83
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownOptionsDirective, isStandalone: true, selector: "[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]", inputs: { align: ["tuiDropdownAlign", "align"], appearance: ["tuiDropdownAppearance", "appearance"], direction: ["tuiDropdownDirection", "direction"], limitWidth: ["tuiDropdownLimitWidth", "limitWidth"], minHeight: ["tuiDropdownMinHeight", "minHeight"], maxHeight: ["tuiDropdownMaxHeight", "maxHeight"], offset: ["tuiDropdownOffset", "offset"] }, providers: [tuiProvide(TUI_DROPDOWN_OPTIONS, TuiDropdownOptionsDirective)], ngImport: i0 }); }
90
84
  }
91
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownOptionsDirective, decorators: [{
85
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownOptionsDirective, decorators: [{
92
86
  type: Directive,
93
87
  args: [{
94
88
  selector: '[tuiDropdownAlign], [tuiDropdownAppearance], [tuiDropdownDirection], [tuiDropdownLimitWidth], [tuiDropdownMinHeight], [tuiDropdownMaxHeight], [tuiDropdownOffset]',
@@ -170,86 +164,14 @@ class TuiDropdownPosition extends TuiPositionAccessor {
170
164
  }
171
165
  return align === 'end' ? 'right' : 'left';
172
166
  }
173
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownPosition, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
174
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownPosition, isStandalone: true, outputs: { tuiDropdownDirectionChange: "tuiDropdownDirectionChange" }, usesInheritance: true, ngImport: i0 }); }
167
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownPosition, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
168
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownPosition, isStandalone: true, outputs: { tuiDropdownDirectionChange: "tuiDropdownDirectionChange" }, usesInheritance: true, ngImport: i0 }); }
175
169
  }
176
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownPosition, decorators: [{
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownPosition, decorators: [{
177
171
  type: Directive
178
172
  }] });
179
173
 
180
- class TuiDropdownDirective {
181
- constructor() {
182
- this.refresh$ = new Subject();
183
- this.service = inject(TuiPopupService);
184
- this.cdr = inject(ChangeDetectorRef);
185
- this.drivers = coerceArray(inject(TuiDropdownDriver, { self: true, optional: true }));
186
- this.sub = this.refresh$
187
- .pipe(throttleTime(0, tuiZonefreeScheduler()), takeUntilDestroyed())
188
- .subscribe(() => {
189
- this.ref()?.changeDetectorRef.detectChanges();
190
- this.ref()?.changeDetectorRef.markForCheck();
191
- });
192
- this.autoClose = effect(() => {
193
- if (!this.content()) {
194
- this.toggle(false);
195
- }
196
- });
197
- this.ref = signal(null);
198
- this.el = tuiInjectElement();
199
- this.type = 'dropdown';
200
- this.component = new PolymorpheusComponent(inject(TUI_DROPDOWN_COMPONENT), inject(INJECTOR));
201
- this.tuiDropdown = input();
202
- this.content = computed((content = this.tuiDropdown()) => {
203
- return content instanceof TemplateRef
204
- ? new PolymorpheusTemplate(content, this.cdr)
205
- : content;
206
- });
207
- }
208
- get position() {
209
- return tuiCheckFixedPosition(this.el) ? 'fixed' : 'absolute';
210
- }
211
- ngAfterViewChecked() {
212
- this.refresh$.next();
213
- }
214
- ngOnDestroy() {
215
- this.toggle(false);
216
- }
217
- getClientRect() {
218
- return this.el.getBoundingClientRect();
219
- }
220
- toggle(show) {
221
- const ref = this.ref();
222
- if (show && this.content() && !ref) {
223
- this.ref.set(this.service.add(this.component));
224
- }
225
- else if (!show && ref) {
226
- this.ref.set(null);
227
- ref.destroy();
228
- }
229
- // TODO: Remove in v5, only needed in Angular 16
230
- this.cdr.markForCheck();
231
- this.drivers.forEach((driver) => driver?.next(show));
232
- }
233
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
234
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiDropdownDirective, isStandalone: true, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: { tuiDropdown: { classPropertyName: "tuiDropdown", publicName: "tuiDropdown", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tui-dropdown-open": "ref()" } }, providers: [tuiAsVehicle(TuiDropdownDirective)], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
235
- }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownDirective, decorators: [{
237
- type: Directive,
238
- args: [{
239
- selector: '[tuiDropdown]:not(ng-container):not(ng-template)',
240
- providers: [tuiAsVehicle(TuiDropdownDirective)],
241
- exportAs: 'tuiDropdown',
242
- hostDirectives: [
243
- TuiDropdownDriverDirective,
244
- {
245
- directive: TuiDropdownPosition,
246
- outputs: ['tuiDropdownDirectionChange'],
247
- },
248
- ],
249
- host: { '[class.tui-dropdown-open]': 'ref()' },
250
- }]
251
- }] });
252
-
174
+ const MAX_WIDTH_GAP = 16; // 8px min gap from each side
253
175
  /**
254
176
  * @description:
255
177
  * This component is used to show template in a portal
@@ -283,6 +205,7 @@ class TuiDropdownComponent {
283
205
  const { left = 0, top = 0 } = this.position === 'fixed' ? {} : parent;
284
206
  const rect = this.accessor.getClientRect();
285
207
  const viewport = this.viewport.getClientRect();
208
+ const zoom = this.directive.el.currentCSSZoom || 1;
286
209
  const above = rect.top - viewport.top - 2 * offset;
287
210
  const below = viewport.top + viewport.height - y - offset;
288
211
  const available = y > rect.bottom ? below : above;
@@ -293,22 +216,22 @@ class TuiDropdownComponent {
293
216
  x -= left;
294
217
  return {
295
218
  position: this.position,
296
- top: tuiPx(Math.round(Math.max(y, offset - top))),
297
- left: tuiPx(Math.round(x)),
298
- maxHeight: tuiPx(Math.round(height)),
299
- width: limitWidth === 'fixed' ? tuiPx(Math.round(rect.width)) : '',
300
- minWidth: limitWidth === 'min' ? tuiPx(Math.round(rect.width)) : '',
301
- maxWidth: tuiPx(Math.round(viewport.width) - 16), // 8px min gap from each side
219
+ top: tuiPx(Math.round(Math.max(y, offset - top) / zoom)),
220
+ left: tuiPx(Math.round(x / zoom)),
221
+ maxHeight: tuiPx(Math.round(height / zoom)),
222
+ width: limitWidth === 'fixed' ? tuiPx(Math.round(rect.width / zoom)) : '',
223
+ minWidth: limitWidth === 'min' ? tuiPx(Math.round(rect.width / zoom)) : '',
224
+ maxWidth: tuiPx(Math.round(viewport.width / zoom) - MAX_WIDTH_GAP),
302
225
  };
303
226
  }
304
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
305
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownComponent, isStandalone: true, selector: "tui-dropdown", host: { properties: { "attr.data-appearance": "options.appearance", "attr.tuiTheme": "theme()" } }, providers: [
227
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
228
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownComponent, isStandalone: true, selector: "tui-dropdown", host: { properties: { "attr.data-appearance": "options.appearance", "attr.tuiTheme": "theme()" } }, providers: [
306
229
  TuiPositionService,
307
230
  tuiPositionAccessorFor('dropdown', TuiDropdownPosition),
308
231
  tuiRectAccessorFor('dropdown', forwardRef(() => TuiDropdownDirective)),
309
232
  ], hostDirectives: [{ directive: i1.TuiActiveZone }, { directive: i2.TuiAnimated }], ngImport: i0, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host:has(tui-data-list[data-size=l]){border-radius:var(--tui-radius-l)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:calc(100% + 2px);inline-size:max-content;overscroll-behavior:none;margin:-1px}.t-primitive{padding:1rem}\n"], dependencies: [{ kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
310
233
  }
311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownComponent, decorators: [{
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownComponent, decorators: [{
312
235
  type: Component,
313
236
  args: [{ selector: 'tui-dropdown', imports: [PolymorpheusOutlet, TuiScrollbar], changeDetection: ChangeDetectionStrategy.Default, providers: [
314
237
  TuiPositionService,
@@ -320,88 +243,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
320
243
  }, template: "<tui-scrollbar class=\"t-scroll\">\n <div\n *polymorpheusOutlet=\"directive.content() as text; context: {$implicit: close}\"\n class=\"t-primitive\"\n >\n {{ text }}\n </div>\n</tui-scrollbar>\n", styles: [":host{position:absolute;display:flex;box-shadow:var(--tui-shadow-medium);color:var(--tui-text-primary);background:var(--tui-background-elevation-3);border-radius:var(--tui-radius-m);overflow:hidden;border:1px solid var(--tui-border-normal);box-sizing:border-box;isolation:isolate;pointer-events:auto;--tui-from: translateY(-1rem)}:host:has(tui-data-list[data-size=l]){border-radius:var(--tui-radius-l)}:host.tui-enter,:host.tui-leave{animation-name:tuiFade,tuiSlide}:host:not([style*=top]){visibility:hidden}.t-scroll{flex-grow:1;max-inline-size:calc(100% + 2px);inline-size:max-content;overscroll-behavior:none;margin:-1px}.t-primitive{padding:1rem}\n"] }]
321
244
  }] });
322
245
 
323
- class TuiDropdownContent {
246
+ /**
247
+ * A component to display a dropdown
248
+ */
249
+ const TUI_DROPDOWN_COMPONENT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_COMPONENT' : '', { factory: () => TuiDropdownComponent });
250
+ const TUI_DROPDOWN_CONTEXT = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_CONTEXT' : '');
251
+ const TUI_DROPDOWN_HOST = new InjectionToken(ngDevMode ? 'TUI_DROPDOWN_HOST' : '');
252
+
253
+ class TuiDropdownA11y {
324
254
  constructor() {
325
- this.directive = inject(TuiDropdownDirective);
326
- tuiSetSignal(this.directive.tuiDropdown, inject(TemplateRef));
327
- if (isPlatformBrowser(inject(PLATFORM_ID)) &&
328
- this.directive.el.matches(':focus-within')) {
329
- this.directive.toggle(true);
330
- }
331
- }
332
- ngOnDestroy() {
333
- tuiSetSignal(this.directive.tuiDropdown, null);
255
+ this.id = tuiGenerateId();
256
+ this.host = inject(TUI_DROPDOWN_HOST);
257
+ this.dropdown = inject(TuiDropdownDirective);
258
+ this.tuiDropdownRole = input('listbox');
259
+ this.sync = effect(() => {
260
+ const content = this.dropdown.content();
261
+ const dropdown = this.dropdown.ref();
262
+ const host = this.host.nativeElement;
263
+ host.setAttribute('aria-expanded', String(!!dropdown));
264
+ host.setAttribute('aria-controls', this.id);
265
+ host.setAttribute('aria-haspopup', this.tuiDropdownRole());
266
+ dropdown?.location.nativeElement.setAttribute('id', this.id);
267
+ dropdown?.location.nativeElement.setAttribute('role', this.tuiDropdownRole());
268
+ if (content) {
269
+ return;
270
+ }
271
+ host.removeAttribute('aria-expanded');
272
+ host.removeAttribute('aria-controls');
273
+ host.removeAttribute('aria-haspopup');
274
+ });
334
275
  }
335
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
336
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownContent, isStandalone: true, selector: "ng-template[tuiDropdown]", ngImport: i0 }); }
276
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownA11y, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
277
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.19", type: TuiDropdownA11y, isStandalone: true, selector: "[tuiDropdownA11y]", inputs: { tuiDropdownRole: { classPropertyName: "tuiDropdownRole", publicName: "tuiDropdownRole", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
337
278
  }
338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownContent, decorators: [{
279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownA11y, decorators: [{
339
280
  type: Directive,
340
- args: [{ selector: 'ng-template[tuiDropdown]' }]
341
- }], ctorParameters: () => [] });
281
+ args: [{ selector: '[tuiDropdownA11y]' }]
282
+ }] });
342
283
 
343
- class TuiDropdownContext extends TuiRectAccessor {
284
+ class TuiDropdownDirective {
344
285
  constructor() {
345
- super(...arguments);
346
- this.isTouch = inject(WA_IS_TOUCH);
347
- this.currentRect = EMPTY_CLIENT_RECT;
348
- this.userSelect = computed(() => (this.isTouch() ? 'none' : null));
349
- this.activeZone = inject(TuiActiveZone);
350
- this.driver = inject(TuiDropdownDriver);
351
- this.doc = inject(DOCUMENT);
352
- this.sub = merge(tuiTypedFromEvent(this.doc, 'pointerdown'), tuiTypedFromEvent(this.doc, 'keydown').pipe(filter(({ key }) => key === 'Escape')), tuiTypedFromEvent(this.doc, 'contextmenu', { capture: true }))
353
- .pipe(filter((event) => this.driver.value &&
354
- !this.activeZone.contains(tuiGetActualTarget(event))), tuiZoneOptimized(), takeUntilDestroyed())
286
+ this.refresh$ = new Subject();
287
+ this.service = inject(TuiPopupService);
288
+ this.cdr = inject(ChangeDetectorRef);
289
+ this.drivers = coerceArray(inject(TuiDropdownDriver, { self: true, optional: true }));
290
+ this.sub = this.refresh$
291
+ .pipe(throttleTime(0, tuiZonefreeScheduler()), takeUntilDestroyed())
355
292
  .subscribe(() => {
356
- this.driver.next(false);
357
- this.currentRect = EMPTY_CLIENT_RECT;
293
+ this.ref()?.changeDetectorRef.detectChanges();
294
+ this.ref()?.changeDetectorRef.markForCheck();
295
+ });
296
+ this.autoClose = effect(() => {
297
+ if (!this.content()) {
298
+ this.toggle(false);
299
+ }
358
300
  });
301
+ this.ref = signal(null);
302
+ this.el = tuiInjectElement();
359
303
  this.type = 'dropdown';
304
+ this.component = new PolymorpheusComponent(inject(TUI_DROPDOWN_COMPONENT), inject(INJECTOR));
305
+ this.content = input(null, {
306
+ alias: 'tuiDropdown',
307
+ transform: (content) => content instanceof TemplateRef
308
+ ? new PolymorpheusTemplate(content, this.cdr)
309
+ : content,
310
+ });
311
+ }
312
+ get position() {
313
+ return tuiCheckFixedPosition(this.el) ? 'fixed' : 'absolute';
314
+ }
315
+ ngAfterViewChecked() {
316
+ if (this.ref()) {
317
+ this.refresh$.next();
318
+ }
319
+ }
320
+ ngOnDestroy() {
321
+ this.toggle(false);
360
322
  }
361
323
  getClientRect() {
362
- return this.currentRect;
324
+ return this.el.getBoundingClientRect();
363
325
  }
364
- onContextMenu(x, y) {
365
- this.currentRect = tuiPointToClientRect(x, y);
366
- this.driver.next(true);
326
+ toggle(show) {
327
+ const ref = this.ref();
328
+ if (show && this.content() && !ref) {
329
+ this.ref.set(this.service.add(this.component));
330
+ }
331
+ else if (!show && ref) {
332
+ this.ref.set(null);
333
+ ref.destroy();
334
+ }
335
+ this.drivers.forEach((driver) => driver?.next(show));
367
336
  }
368
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownContext, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
369
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownContext, isStandalone: true, selector: "[tuiDropdownContext]", host: { listeners: { "longtap": "onContextMenu($event.detail.clientX, $event.detail.clientY)" }, properties: { "style.user-select": "userSelect()", "style.-webkit-user-select": "userSelect()", "style.-webkit-touch-callout": "userSelect()" } }, providers: [
370
- TuiActiveZone,
371
- TuiDropdownDriver,
372
- tuiAsDriver(TuiDropdownDriver),
373
- tuiAsRectAccessor(TuiDropdownContext),
374
- ], usesInheritance: true, ngImport: i0 }); }
337
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
338
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.19", type: TuiDropdownDirective, isStandalone: true, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: { content: { classPropertyName: "content", publicName: "tuiDropdown", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tui-dropdown-open": "ref()" } }, providers: [
339
+ tuiAsVehicle(TuiDropdownDirective),
340
+ tuiProvide(TUI_DROPDOWN_HOST, ElementRef),
341
+ ], exportAs: ["tuiDropdown"], hostDirectives: [{ directive: TuiDropdownDriverDirective }, { directive: TuiDropdownA11y, inputs: ["tuiDropdownRole", "tuiDropdownRole"] }, { directive: TuiDropdownPosition, outputs: ["tuiDropdownDirectionChange", "tuiDropdownDirectionChange"] }], ngImport: i0 }); }
375
342
  }
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownContext, decorators: [{
343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownDirective, decorators: [{
377
344
  type: Directive,
378
345
  args: [{
379
- selector: '[tuiDropdownContext]',
346
+ selector: '[tuiDropdown]:not(ng-container):not(ng-template)',
380
347
  providers: [
381
- TuiActiveZone,
382
- TuiDropdownDriver,
383
- tuiAsDriver(TuiDropdownDriver),
384
- tuiAsRectAccessor(TuiDropdownContext),
348
+ tuiAsVehicle(TuiDropdownDirective),
349
+ tuiProvide(TUI_DROPDOWN_HOST, ElementRef),
385
350
  ],
386
- host: {
387
- '[style.user-select]': 'userSelect()',
388
- '[style.-webkit-user-select]': 'userSelect()',
389
- '[style.-webkit-touch-callout]': 'userSelect()',
390
- '(longtap)': 'onContextMenu($event.detail.clientX, $event.detail.clientY)',
391
- },
351
+ exportAs: 'tuiDropdown',
352
+ hostDirectives: [
353
+ TuiDropdownDriverDirective,
354
+ { directive: TuiDropdownA11y, inputs: ['tuiDropdownRole'] },
355
+ {
356
+ directive: TuiDropdownPosition,
357
+ outputs: ['tuiDropdownDirectionChange'],
358
+ },
359
+ ],
360
+ host: { '[class.tui-dropdown-open]': 'ref()' },
392
361
  }]
393
362
  }] });
394
363
 
395
- /** Default values for hint options */
396
- const TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS = {
397
- showDelay: 200,
398
- hideDelay: 500,
399
- };
400
- /**
401
- * Default parameters for dropdown hover directive
402
- */
403
- const [TUI_DROPDOWN_HOVER_OPTIONS, tuiDropdownHoverOptionsProvider] = tuiCreateOptions(TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
404
-
405
364
  class TuiDropdownClose {
406
365
  constructor() {
407
366
  this.el = tuiInjectElement();
@@ -409,8 +368,7 @@ class TuiDropdownClose {
409
368
  this.open = inject(TuiDropdownOpen);
410
369
  this.obscured = inject(TuiObscured);
411
370
  this.activeZone = inject(TuiActiveZone);
412
- this.tuiDropdownClose = outputFromObservable(merge(inject(TuiDropdownDriver).pipe(tuiIfMap(() => merge(tuiCloseWatcher(), this.obscured.tuiObscured$.pipe(filter(Boolean)), this.activeZone.tuiActiveZoneChange.pipe(filter((a) => !a)), tuiTypedFromEvent(this.el, 'focusin').pipe(filter((event) => !this.open.host.contains(tuiGetActualTarget(event)) ||
413
- !this.ref()))))),
371
+ this.tuiDropdownClose = outputFromObservable(merge(inject(TuiDropdownDriver).pipe(tuiIfMap(() => merge(tuiCloseWatcher(), this.obscured.tuiObscured$.pipe(filter(Boolean)), this.activeZone.tuiActiveZoneChange.pipe(filter((a) => !a)), tuiTypedFromEvent(this.el, 'focusin').pipe(filter((event) => !this.open.nativeElement.contains(tuiGetActualTarget(event)) || !this.ref()))))),
414
372
  // @ts-ignore
415
373
  typeof CloseWatcher === 'undefined'
416
374
  ? tuiTypedFromEvent(inject(DOCUMENT), 'keydown', { capture: true }).pipe(filter(({ key }) => key === 'Escape' &&
@@ -418,10 +376,10 @@ class TuiDropdownClose {
418
376
  !this.ref()?.location.nativeElement?.nextElementSibling), tuiStopPropagation())
419
377
  : EMPTY));
420
378
  }
421
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownClose, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
422
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownClose, isStandalone: true, outputs: { tuiDropdownClose: "tuiDropdownClose" }, ngImport: i0 }); }
379
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownClose, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
380
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownClose, isStandalone: true, outputs: { tuiDropdownClose: "tuiDropdownClose" }, ngImport: i0 }); }
423
381
  }
424
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownClose, decorators: [{
382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownClose, decorators: [{
425
383
  type: Directive
426
384
  }] });
427
385
 
@@ -446,7 +404,7 @@ class TuiDropdownOpen {
446
404
  .pipe(takeUntilDestroyed())
447
405
  .subscribe((event) => this.onKeydown(event));
448
406
  }
449
- get host() {
407
+ get nativeElement() {
450
408
  const initial = this.dropdownHost()?.nativeElement || this.el;
451
409
  const focusable = tuiIsFocusable(initial)
452
410
  ? initial
@@ -455,18 +413,18 @@ class TuiDropdownOpen {
455
413
  }
456
414
  toggle(open) {
457
415
  if (this.focused && !open) {
458
- this.host.focus({ preventScroll: true });
416
+ this.nativeElement.focus({ preventScroll: true });
459
417
  }
460
418
  this.update(open);
461
419
  }
462
420
  onClick(target) {
463
- if (!this.editable && this.host.contains(target)) {
421
+ if (!this.editable && this.nativeElement.contains(target)) {
464
422
  this.update(!this.open());
465
423
  }
466
424
  }
467
425
  onArrow(event, up) {
468
426
  if (!tuiIsElement(event.target) ||
469
- !this.host.contains(event.target) ||
427
+ !this.nativeElement.contains(event.target) ||
470
428
  !this.enabled() ||
471
429
  !this.directive.content()) {
472
430
  return;
@@ -475,10 +433,10 @@ class TuiDropdownOpen {
475
433
  this.focusDropdown(up);
476
434
  }
477
435
  get editable() {
478
- return tuiIsElementEditable(this.host);
436
+ return tuiIsElementEditable(this.nativeElement);
479
437
  }
480
438
  get focused() {
481
- return tuiIsFocusedIn(this.host) || tuiIsFocusedIn(this.dropdown());
439
+ return tuiIsFocusedIn(this.nativeElement) || tuiIsFocusedIn(this.dropdown());
482
440
  }
483
441
  onKeydown(event) {
484
442
  const target = tuiGetActualTarget(event);
@@ -488,7 +446,7 @@ class TuiDropdownOpen {
488
446
  this.focused &&
489
447
  tuiIsHTMLElement(target) &&
490
448
  !tuiIsElementEditable(target)) {
491
- this.host.focus({ preventScroll: true });
449
+ this.nativeElement.focus({ preventScroll: true });
492
450
  }
493
451
  }
494
452
  update(open) {
@@ -515,20 +473,25 @@ class TuiDropdownOpen {
515
473
  child.remove();
516
474
  focusable?.focus();
517
475
  }
518
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
519
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.18", type: TuiDropdownOpen, isStandalone: true, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: { enabled: { classPropertyName: "enabled", publicName: "tuiDropdownEnabled", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "tuiDropdownOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "tuiDropdownOpenChange" }, host: { listeners: { "click": "onClick($event.target)", "keydown.arrowDown": "onArrow($event, false)", "keydown.arrowUp": "onArrow($event, true)", "tuiActiveZoneChange": "0", "tuiDropdownClose": "toggle(false)" } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$1.TuiObscured }, { directive: TuiDropdownClose, outputs: ["tuiDropdownClose", "tuiDropdownClose"] }, { directive: i1.TuiActiveZone, inputs: ["tuiActiveZoneParent", "tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange", "tuiActiveZoneChange"] }], ngImport: i0 }); }
476
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
477
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.19", type: TuiDropdownOpen, isStandalone: true, selector: "[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: { enabled: { classPropertyName: "enabled", publicName: "tuiDropdownEnabled", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "tuiDropdownOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "tuiDropdownOpenChange" }, host: { listeners: { "click": "onClick($event.target)", "keydown.arrowDown": "onArrow($event, false)", "keydown.arrowUp": "onArrow($event, true)", "tuiActiveZoneChange": "0", "tuiDropdownClose": "toggle(false)" } }, providers: [
478
+ TuiDropdownDriver,
479
+ tuiAsDriver(TuiDropdownDriver),
480
+ tuiProvide(TUI_DROPDOWN_HOST, TuiDropdownOpen),
481
+ ], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], hostDirectives: [{ directive: i1$1.TuiObscured }, { directive: TuiDropdownClose, outputs: ["tuiDropdownClose", "tuiDropdownClose"] }, { directive: i1.TuiActiveZone, inputs: ["tuiActiveZoneParent", "tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange", "tuiActiveZoneChange"] }], ngImport: i0 }); }
520
482
  }
521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownOpen, decorators: [{
483
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownOpen, decorators: [{
522
484
  type: Directive,
523
485
  args: [{
524
486
  selector: '[tuiDropdown][tuiDropdownAuto],[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]',
525
- providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)],
487
+ providers: [
488
+ TuiDropdownDriver,
489
+ tuiAsDriver(TuiDropdownDriver),
490
+ tuiProvide(TUI_DROPDOWN_HOST, TuiDropdownOpen),
491
+ ],
526
492
  hostDirectives: [
527
493
  TuiObscured,
528
- {
529
- directive: TuiDropdownClose,
530
- outputs: ['tuiDropdownClose'],
531
- },
494
+ { directive: TuiDropdownClose, outputs: ['tuiDropdownClose'] },
532
495
  {
533
496
  directive: TuiActiveZone,
534
497
  inputs: ['tuiActiveZoneParent'],
@@ -546,6 +509,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
546
509
  }]
547
510
  }] });
548
511
 
512
+ function tuiDropdown(value) {
513
+ return tuiDirectiveBinding(TuiDropdownDirective, 'content', value, {});
514
+ }
515
+ function tuiDropdownEnabled(value) {
516
+ return tuiDirectiveBinding(TuiDropdownOpen, 'enabled', value, {});
517
+ }
518
+
519
+ class TuiDropdownContent {
520
+ constructor() {
521
+ this.directive = inject(TuiDropdownDirective);
522
+ tuiSetSignal(this.directive.content, inject(TemplateRef));
523
+ if (isPlatformBrowser(inject(PLATFORM_ID)) &&
524
+ this.directive.el.matches(':focus-within')) {
525
+ this.directive.toggle(true);
526
+ }
527
+ }
528
+ ngOnDestroy() {
529
+ tuiSetSignal(this.directive.content, null);
530
+ }
531
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
532
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownContent, isStandalone: true, selector: "ng-template[tuiDropdown]", ngImport: i0 }); }
533
+ }
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownContent, decorators: [{
535
+ type: Directive,
536
+ args: [{ selector: 'ng-template[tuiDropdown]' }]
537
+ }], ctorParameters: () => [] });
538
+
539
+ class TuiDropdownContext extends TuiRectAccessor {
540
+ constructor() {
541
+ super(...arguments);
542
+ this.isTouch = inject(WA_IS_TOUCH);
543
+ this.currentRect = EMPTY_CLIENT_RECT;
544
+ this.userSelect = computed(() => (this.isTouch() ? 'none' : null));
545
+ this.activeZone = inject(TuiActiveZone);
546
+ this.driver = inject(TuiDropdownDriver);
547
+ this.doc = inject(DOCUMENT);
548
+ this.sub = merge(tuiTypedFromEvent(this.doc, 'pointerdown'), tuiTypedFromEvent(this.doc, 'keydown').pipe(filter(({ key }) => key === 'Escape')), tuiTypedFromEvent(this.doc, 'contextmenu', { capture: true }))
549
+ .pipe(filter((event) => this.driver.value &&
550
+ !this.activeZone.contains(tuiGetActualTarget(event))), tuiZoneOptimized(), takeUntilDestroyed())
551
+ .subscribe(() => {
552
+ this.driver.next(false);
553
+ this.currentRect = EMPTY_CLIENT_RECT;
554
+ });
555
+ this.type = 'dropdown';
556
+ }
557
+ getClientRect() {
558
+ return this.currentRect;
559
+ }
560
+ onContextMenu(x, y) {
561
+ this.currentRect = tuiPointToClientRect(x, y);
562
+ this.driver.next(true);
563
+ }
564
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownContext, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
565
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownContext, isStandalone: true, selector: "[tuiDropdownContext]", host: { listeners: { "longtap": "onContextMenu($event.detail.clientX, $event.detail.clientY)" }, properties: { "style.user-select": "userSelect()", "style.-webkit-user-select": "userSelect()", "style.-webkit-touch-callout": "userSelect()" } }, providers: [
566
+ TuiActiveZone,
567
+ TuiDropdownDriver,
568
+ tuiAsDriver(TuiDropdownDriver),
569
+ tuiAsRectAccessor(TuiDropdownContext),
570
+ ], usesInheritance: true, ngImport: i0 }); }
571
+ }
572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownContext, decorators: [{
573
+ type: Directive,
574
+ args: [{
575
+ selector: '[tuiDropdownContext]',
576
+ providers: [
577
+ TuiActiveZone,
578
+ TuiDropdownDriver,
579
+ tuiAsDriver(TuiDropdownDriver),
580
+ tuiAsRectAccessor(TuiDropdownContext),
581
+ ],
582
+ host: {
583
+ '[style.user-select]': 'userSelect()',
584
+ '[style.-webkit-user-select]': 'userSelect()',
585
+ '[style.-webkit-touch-callout]': 'userSelect()',
586
+ '(longtap)': 'onContextMenu($event.detail.clientX, $event.detail.clientY)',
587
+ },
588
+ }]
589
+ }] });
590
+
591
+ /** Default values for hint options */
592
+ const TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS = {
593
+ showDelay: 200,
594
+ hideDelay: 500,
595
+ };
596
+ /**
597
+ * Default parameters for dropdown hover directive
598
+ */
599
+ const [TUI_DROPDOWN_HOVER_OPTIONS, tuiDropdownHoverOptionsProvider] = tuiCreateOptions(TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS);
600
+
549
601
  class TuiDropdownHover extends TuiDriver {
550
602
  constructor() {
551
603
  super((subscriber) => this.stream$.subscribe(subscriber));
@@ -564,7 +616,7 @@ class TuiDropdownHover extends TuiDriver {
564
616
  * Dropdown can be removed not only via click/touch –
565
617
  * swipe on mobile devices removes dropdown sheet without triggering new mouseover / mouseout events.
566
618
  */
567
- toObservable(inject(TuiDropdownDirective).ref).pipe(filter((x) => !x && this.hovered), switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.tuiDropdownHideDelay()), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.tuiDropdownShowDelay() : this.tuiDropdownHideDelay()))), tuiZoneOptimized(), tap((hovered) => {
619
+ toObservable(inject(TuiDropdownDirective).ref).pipe(filter((x) => !x && this.hovered), switchMap(() => tuiTypedFromEvent(this.doc, 'pointerdown').pipe(map(tuiGetActualTarget), delay(this.tuiDropdownHideDelay()), startWith(null), takeUntil(fromEvent(this.doc, 'mouseover'))))), tuiTypedFromEvent(this.doc, 'mouseover').pipe(map(tuiGetActualTarget)), tuiTypedFromEvent(this.doc, 'mouseout').pipe(map((e) => e.relatedTarget))).pipe(map((element) => tuiIsElement(element) && this.isHovered(element)), distinctUntilChanged(), switchMap((v) => of(v).pipe(delay(v ? this.tuiDropdownShowDelay() : this.tuiDropdownHideDelay()), takeUntil(this.open ? fromEvent(this.el, 'pointerdown') : EMPTY))), tuiZoneOptimized(), tap((hovered) => {
568
620
  this.hovered = hovered;
569
621
  this.open?.toggle(hovered);
570
622
  }), share());
@@ -583,10 +635,10 @@ class TuiDropdownHover extends TuiDriver {
583
635
  const child = !this.el.contains(element) && this.activeZone.contains(element);
584
636
  return hovered || child;
585
637
  }
586
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownHover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
587
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.18", type: TuiDropdownHover, isStandalone: true, selector: "[tuiDropdownHover]", inputs: { tuiDropdownShowDelay: { classPropertyName: "tuiDropdownShowDelay", publicName: "tuiDropdownShowDelay", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownHideDelay: { classPropertyName: "tuiDropdownHideDelay", publicName: "tuiDropdownHideDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click.capture": "onClick($event)" } }, providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
638
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownHover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
639
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.19", type: TuiDropdownHover, isStandalone: true, selector: "[tuiDropdownHover]", inputs: { tuiDropdownShowDelay: { classPropertyName: "tuiDropdownShowDelay", publicName: "tuiDropdownShowDelay", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownHideDelay: { classPropertyName: "tuiDropdownHideDelay", publicName: "tuiDropdownHideDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click.capture": "onClick($event)" } }, providers: [TuiActiveZone, tuiAsDriver(TuiDropdownHover)], queries: [{ propertyName: "dropdownHost", first: true, predicate: ["tuiDropdownHost"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0 }); }
588
640
  }
589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownHover, decorators: [{
641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownHover, decorators: [{
590
642
  type: Directive,
591
643
  args: [{
592
644
  selector: '[tuiDropdownHover]',
@@ -595,6 +647,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
595
647
  }]
596
648
  }], ctorParameters: () => [] });
597
649
 
650
+ class TuiDropdownFixed {
651
+ constructor() {
652
+ const override = tuiOverrideOptions({ limitWidth: 'fixed' }, TUI_DROPDOWN_DEFAULT_OPTIONS);
653
+ override(inject(TUI_DROPDOWN_OPTIONS, { self: true, optional: true }), null);
654
+ }
655
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownFixed, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
656
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownFixed, isStandalone: true, providers: [tuiDropdownOptionsProvider({})], ngImport: i0 }); }
657
+ }
658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownFixed, decorators: [{
659
+ type: Directive,
660
+ args: [{ providers: [tuiDropdownOptionsProvider({})] }]
661
+ }], ctorParameters: () => [] });
662
+ class TuiDropdownAuto {
663
+ constructor() {
664
+ /**
665
+ * Update directive props with new defaults before inputs are processed
666
+ * TODO: find better way to override TuiDropdownFixed host directive from parent component
667
+ */
668
+ inject(TUI_DROPDOWN_OPTIONS).limitWidth = 'auto';
669
+ }
670
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownAuto, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
671
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiDropdownAuto, isStandalone: true, ngImport: i0 }); }
672
+ }
673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownAuto, decorators: [{
674
+ type: Directive
675
+ }], ctorParameters: () => [] });
676
+
598
677
  class TuiDropdownManual {
599
678
  constructor() {
600
679
  this.driver = inject(TuiDropdownDriver);
@@ -603,10 +682,10 @@ class TuiDropdownManual {
603
682
  ngOnChanges() {
604
683
  this.driver.next(!!this.tuiDropdownManual());
605
684
  }
606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownManual, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
607
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiDropdownManual, isStandalone: true, selector: "[tuiDropdownManual]", inputs: { tuiDropdownManual: { classPropertyName: "tuiDropdownManual", publicName: "tuiDropdownManual", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], usesOnChanges: true, ngImport: i0 }); }
685
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownManual, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
686
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.19", type: TuiDropdownManual, isStandalone: true, selector: "[tuiDropdownManual]", inputs: { tuiDropdownManual: { classPropertyName: "tuiDropdownManual", publicName: "tuiDropdownManual", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownDriver, tuiAsDriver(TuiDropdownDriver)], usesOnChanges: true, ngImport: i0 }); }
608
687
  }
609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownManual, decorators: [{
688
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownManual, decorators: [{
610
689
  type: Directive,
611
690
  args: [{
612
691
  selector: '[tuiDropdownManual]',
@@ -659,10 +738,10 @@ class TuiDropdownPositionSided extends TuiPositionAccessor {
659
738
  this.vertical.direction.next(better);
660
739
  return [left, position[better]];
661
740
  }
662
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownPositionSided, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
663
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiDropdownPositionSided, isStandalone: true, selector: "[tuiDropdownSided]", inputs: { tuiDropdownSided: { classPropertyName: "tuiDropdownSided", publicName: "tuiDropdownSided", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSidedOffset: { classPropertyName: "tuiDropdownSidedOffset", publicName: "tuiDropdownSidedOffset", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)], usesInheritance: true, ngImport: i0 }); }
741
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownPositionSided, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
742
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.19", type: TuiDropdownPositionSided, isStandalone: true, selector: "[tuiDropdownSided]", inputs: { tuiDropdownSided: { classPropertyName: "tuiDropdownSided", publicName: "tuiDropdownSided", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSidedOffset: { classPropertyName: "tuiDropdownSidedOffset", publicName: "tuiDropdownSidedOffset", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TuiDropdownPosition, tuiAsPositionAccessor(TuiDropdownPositionSided)], usesInheritance: true, ngImport: i0 }); }
664
743
  }
665
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownPositionSided, decorators: [{
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownPositionSided, decorators: [{
666
745
  type: Directive,
667
746
  args: [{
668
747
  selector: '[tuiDropdownSided]',
@@ -683,13 +762,20 @@ class TuiDropdownSelection extends TuiDriver {
683
762
  inject(TUI_SELECTION_STREAM).pipe(map(() => this.getRange()), filter((range) => this.isValid(range)), distinctUntilChanged((x, y) => x.startOffset === y.startOffset &&
684
763
  x.endOffset === y.endOffset &&
685
764
  x.commonAncestorContainer === y.commonAncestorContainer)),
686
- ]).pipe(map(([handler, range]) => {
687
- const contained = this.el.contains(range.commonAncestorContainer);
765
+ merge(fromEvent(this.el, 'scroll', { passive: true, capture: true })).pipe(throttleTime(16, undefined, { leading: false, trailing: true }), startWith(0)),
766
+ ]).pipe(tap(([, range]) => {
688
767
  this.range =
689
- contained && tuiIsTextNode(range.commonAncestorContainer)
768
+ this.el.contains(range.commonAncestorContainer) &&
769
+ tuiIsTextNode(range.commonAncestorContainer)
690
770
  ? range
691
771
  : this.range;
692
- return (contained && handler(this.range)) || this.inDropdown(range);
772
+ }), map(([handler, range]) => {
773
+ const contained = this.el.contains(range.commonAncestorContainer);
774
+ const valid = contained && handler(this.range);
775
+ const visible = valid || this.inDropdown(range);
776
+ const active = tuiGetFocused(this.doc);
777
+ const textfield = active && tuiIsTextfield(active) && this.el.contains(active);
778
+ return visible && textfield ? this.isCaretVisible(this.range) : visible;
693
779
  }));
694
780
  this.range = isPlatformBrowser(inject(PLATFORM_ID))
695
781
  ? new Range()
@@ -790,13 +876,25 @@ class TuiDropdownSelection extends TuiDriver {
790
876
  this.ghost = ghost;
791
877
  return ghost;
792
878
  }
793
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
794
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.18", type: TuiDropdownSelection, isStandalone: true, selector: "[tuiDropdownSelection]", inputs: { tuiDropdownSelection: { classPropertyName: "tuiDropdownSelection", publicName: "tuiDropdownSelection", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSelectionPosition: { classPropertyName: "tuiDropdownSelectionPosition", publicName: "tuiDropdownSelectionPosition", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
879
+ isCaretVisible(range) {
880
+ const caret = range.getBoundingClientRect();
881
+ const host = this.ghostHost.getBoundingClientRect();
882
+ const styles = getComputedStyle(this.ghostHost);
883
+ const fontSize = parseFloat(styles.fontSize) || 16;
884
+ const lineHeight = parseFloat(styles.lineHeight) || fontSize * 1.2;
885
+ const visibleTop = Math.max(caret.top, host.top);
886
+ const visibleBottom = Math.min(caret.bottom, host.bottom);
887
+ const visibleHeight = Math.max(0, visibleBottom - visibleTop);
888
+ const threshold = lineHeight * 0.5;
889
+ return visibleHeight >= threshold;
890
+ }
891
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownSelection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
892
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.19", type: TuiDropdownSelection, isStandalone: true, selector: "[tuiDropdownSelection]", inputs: { tuiDropdownSelection: { classPropertyName: "tuiDropdownSelection", publicName: "tuiDropdownSelection", isSignal: true, isRequired: false, transformFunction: null }, tuiDropdownSelectionPosition: { classPropertyName: "tuiDropdownSelectionPosition", publicName: "tuiDropdownSelectionPosition", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
795
893
  tuiAsDriver(TuiDropdownSelection),
796
894
  tuiAsRectAccessor(TuiDropdownSelection),
797
895
  ], usesInheritance: true, ngImport: i0 }); }
798
896
  }
799
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownSelection, decorators: [{
897
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiDropdownSelection, decorators: [{
800
898
  type: Directive,
801
899
  args: [{
802
900
  selector: '[tuiDropdownSelection]',
@@ -807,11 +905,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
807
905
  }]
808
906
  }], ctorParameters: () => [] });
809
907
 
908
+ class TuiWithDropdownOpen {
909
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiWithDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
910
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: TuiWithDropdownOpen, isStandalone: true, hostDirectives: [{ directive: TuiDropdownOpen, inputs: ["tuiDropdownOpen", "open", "tuiDropdownEnabled", "tuiDropdownEnabled"], outputs: ["tuiDropdownOpenChange", "openChange"] }], ngImport: i0 }); }
911
+ }
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TuiWithDropdownOpen, decorators: [{
913
+ type: Directive,
914
+ args: [{
915
+ hostDirectives: [
916
+ {
917
+ directive: TuiDropdownOpen,
918
+ inputs: ['tuiDropdownOpen: open', 'tuiDropdownEnabled'],
919
+ outputs: ['tuiDropdownOpenChange: openChange'],
920
+ },
921
+ ],
922
+ }]
923
+ }] });
924
+
810
925
  const TuiDropdown = [
811
926
  TuiDropdownOptionsDirective,
812
927
  TuiDropdownDriverDirective,
813
928
  TuiDropdownDirective,
814
929
  TuiDropdownComponent,
930
+ TuiDropdownA11y,
815
931
  TuiDropdownOpen,
816
932
  TuiDropdownManual,
817
933
  TuiDropdownHover,
@@ -822,60 +938,9 @@ const TuiDropdown = [
822
938
  TuiDropdownSelection,
823
939
  ];
824
940
 
825
- function tuiDropdown(value) {
826
- return tuiDirectiveBinding(TuiDropdownDirective, 'tuiDropdown', value, {});
827
- }
828
- function tuiDropdownEnabled(value) {
829
- return tuiDirectiveBinding(TuiDropdownOpen, 'enabled', value, {});
830
- }
831
-
832
- class TuiDropdownFixed {
833
- constructor() {
834
- const override = tuiOverrideOptions({ limitWidth: 'fixed' }, TUI_DROPDOWN_DEFAULT_OPTIONS);
835
- override(inject(TUI_DROPDOWN_OPTIONS, { self: true, optional: true }), null);
836
- }
837
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownFixed, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
838
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownFixed, isStandalone: true, providers: [tuiDropdownOptionsProvider({})], ngImport: i0 }); }
839
- }
840
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownFixed, decorators: [{
841
- type: Directive,
842
- args: [{ providers: [tuiDropdownOptionsProvider({})] }]
843
- }], ctorParameters: () => [] });
844
- class TuiDropdownAuto {
845
- constructor() {
846
- /**
847
- * Update directive props with new defaults before inputs are processed
848
- * TODO: find better way to override TuiDropdownFixed host directive from parent component
849
- */
850
- inject(TUI_DROPDOWN_OPTIONS).limitWidth = 'auto';
851
- }
852
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownAuto, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
853
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiDropdownAuto, isStandalone: true, ngImport: i0 }); }
854
- }
855
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiDropdownAuto, decorators: [{
856
- type: Directive
857
- }], ctorParameters: () => [] });
858
-
859
- class TuiWithDropdownOpen {
860
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiWithDropdownOpen, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
861
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: TuiWithDropdownOpen, isStandalone: true, hostDirectives: [{ directive: TuiDropdownOpen, inputs: ["tuiDropdownOpen", "open", "tuiDropdownEnabled", "tuiDropdownEnabled"], outputs: ["tuiDropdownOpenChange", "openChange"] }], ngImport: i0 }); }
862
- }
863
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TuiWithDropdownOpen, decorators: [{
864
- type: Directive,
865
- args: [{
866
- hostDirectives: [
867
- {
868
- directive: TuiDropdownOpen,
869
- inputs: ['tuiDropdownOpen: open', 'tuiDropdownEnabled'],
870
- outputs: ['tuiDropdownOpenChange: openChange'],
871
- },
872
- ],
873
- }]
874
- }] });
875
-
876
941
  /**
877
942
  * Generated bundle index. Do not edit.
878
943
  */
879
944
 
880
- export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownAuto, TuiDropdownClose, TuiDropdownComponent, TuiDropdownContent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen, TuiDropdownOptionsDirective, TuiDropdownPosition, TuiDropdownPositionSided, TuiDropdownSelection, TuiWithDropdownOpen, tuiDropdown, tuiDropdownEnabled, tuiDropdownHoverOptionsProvider, tuiDropdownOptionsProvider };
945
+ export { TUI_DROPDOWN_COMPONENT, TUI_DROPDOWN_CONTEXT, TUI_DROPDOWN_DEFAULT_OPTIONS, TUI_DROPDOWN_HOST, TUI_DROPDOWN_HOVER_DEFAULT_OPTIONS, TUI_DROPDOWN_HOVER_OPTIONS, TUI_DROPDOWN_OPTIONS, TuiDropdown, TuiDropdownA11y, TuiDropdownAuto, TuiDropdownClose, TuiDropdownComponent, TuiDropdownContent, TuiDropdownContext, TuiDropdownDirective, TuiDropdownDriver, TuiDropdownDriverDirective, TuiDropdownFixed, TuiDropdownHover, TuiDropdownManual, TuiDropdownOpen, TuiDropdownOptionsDirective, TuiDropdownPosition, TuiDropdownPositionSided, TuiDropdownSelection, TuiWithDropdownOpen, tuiDropdown, tuiDropdownEnabled, tuiDropdownHoverOptionsProvider, tuiDropdownOptionsProvider };
881
946
  //# sourceMappingURL=taiga-ui-core-portals-dropdown.mjs.map