@taiga-ui/core 3.19.0 → 3.20.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 (179) hide show
  1. package/abstract/abstract-driver.directive.d.ts +9 -2
  2. package/abstract/driver.d.ts +1 -0
  3. package/abstract/position-accessor.d.ts +3 -1
  4. package/abstract/rect-accessor.d.ts +4 -1
  5. package/abstract/vehicle.d.ts +1 -0
  6. package/bundles/taiga-ui-core-abstract.umd.js +49 -10
  7. package/bundles/taiga-ui-core-abstract.umd.js.map +1 -1
  8. package/bundles/taiga-ui-core-components-button.umd.js +4 -1
  9. package/bundles/taiga-ui-core-components-button.umd.js.map +1 -1
  10. package/bundles/taiga-ui-core-components-dialog.umd.js +8 -2
  11. package/bundles/taiga-ui-core-components-dialog.umd.js.map +1 -1
  12. package/bundles/taiga-ui-core-components-loader.umd.js +4 -1
  13. package/bundles/taiga-ui-core-components-loader.umd.js.map +1 -1
  14. package/bundles/taiga-ui-core-components-primitive-checkbox.umd.js +4 -1
  15. package/bundles/taiga-ui-core-components-primitive-checkbox.umd.js.map +1 -1
  16. package/bundles/taiga-ui-core-components-root.umd.js +1 -1
  17. package/bundles/taiga-ui-core-components-svg.umd.js +4 -1
  18. package/bundles/taiga-ui-core-components-svg.umd.js.map +1 -1
  19. package/bundles/taiga-ui-core-directives-dropdown.umd.js +167 -110
  20. package/bundles/taiga-ui-core-directives-dropdown.umd.js.map +1 -1
  21. package/bundles/taiga-ui-core-directives-hint.umd.js +242 -181
  22. package/bundles/taiga-ui-core-directives-hint.umd.js.map +1 -1
  23. package/bundles/taiga-ui-core-directives-textfield-controller.umd.js +15 -12
  24. package/bundles/taiga-ui-core-directives-textfield-controller.umd.js.map +1 -1
  25. package/bundles/taiga-ui-core-tokens.umd.js +129 -37
  26. package/bundles/taiga-ui-core-tokens.umd.js.map +1 -1
  27. package/components/button/button-options.d.ts +3 -0
  28. package/components/dialog/dialog.tokens.d.ts +6 -0
  29. package/components/loader/loader-options.d.ts +3 -0
  30. package/components/primitive-checkbox/checkbox-options.d.ts +3 -0
  31. package/components/svg/svg-options.d.ts +3 -0
  32. package/directives/dropdown/dropdown-context.directive.d.ts +1 -0
  33. package/directives/dropdown/dropdown-driver.directive.d.ts +5 -2
  34. package/directives/dropdown/dropdown-host.directive.d.ts +1 -0
  35. package/directives/dropdown/dropdown-hover-options.directive.d.ts +3 -0
  36. package/directives/dropdown/dropdown-hover.directive.d.ts +1 -0
  37. package/directives/dropdown/dropdown-manual.directive.d.ts +1 -0
  38. package/directives/dropdown/dropdown-options.directive.d.ts +3 -0
  39. package/directives/dropdown/dropdown-position-sided.directive.d.ts +4 -3
  40. package/directives/dropdown/dropdown-position.directive.d.ts +7 -3
  41. package/directives/dropdown/dropdown-selection.directive.d.ts +1 -0
  42. package/directives/dropdown/dropdown.directive.d.ts +7 -4
  43. package/directives/dropdown/dropdown.providers.d.ts +3 -0
  44. package/directives/hint/hint-describe.directive.d.ts +3 -5
  45. package/directives/hint/hint-driver.directive.d.ts +5 -2
  46. package/directives/hint/hint-host.directive.d.ts +1 -0
  47. package/directives/hint/hint-hover.directive.d.ts +2 -0
  48. package/directives/hint/hint-manual.directive.d.ts +3 -1
  49. package/directives/hint/hint-options.directive.d.ts +3 -0
  50. package/directives/hint/hint-position.directive.d.ts +6 -3
  51. package/directives/hint/hint.directive.d.ts +3 -2
  52. package/directives/hint/hint.providers.d.ts +3 -0
  53. package/directives/textfield-controller/textfield-options.d.ts +3 -0
  54. package/esm2015/abstract/abstract-driver.directive.js +15 -7
  55. package/esm2015/abstract/driver.js +2 -1
  56. package/esm2015/abstract/position-accessor.js +10 -1
  57. package/esm2015/abstract/rect-accessor.js +14 -1
  58. package/esm2015/abstract/vehicle.js +2 -1
  59. package/esm2015/components/button/button-options.js +5 -2
  60. package/esm2015/components/dialog/dialog.tokens.js +9 -3
  61. package/esm2015/components/loader/loader-options.js +5 -2
  62. package/esm2015/components/primitive-checkbox/checkbox-options.js +5 -2
  63. package/esm2015/components/root/root.component.js +1 -1
  64. package/esm2015/components/svg/svg-options.js +5 -2
  65. package/esm2015/directives/dropdown/dropdown-context.directive.js +2 -1
  66. package/esm2015/directives/dropdown/dropdown-driver.directive.js +22 -5
  67. package/esm2015/directives/dropdown/dropdown-host.directive.js +5 -1
  68. package/esm2015/directives/dropdown/dropdown-hover-options.directive.js +5 -2
  69. package/esm2015/directives/dropdown/dropdown-hover.directive.js +2 -1
  70. package/esm2015/directives/dropdown/dropdown-manual.directive.js +4 -3
  71. package/esm2015/directives/dropdown/dropdown-options.directive.js +5 -2
  72. package/esm2015/directives/dropdown/dropdown-position-sided.directive.js +13 -12
  73. package/esm2015/directives/dropdown/dropdown-position.directive.js +27 -10
  74. package/esm2015/directives/dropdown/dropdown-selection.directive.js +2 -1
  75. package/esm2015/directives/dropdown/dropdown.component.js +19 -9
  76. package/esm2015/directives/dropdown/dropdown.directive.js +14 -19
  77. package/esm2015/directives/dropdown/dropdown.providers.js +5 -2
  78. package/esm2015/directives/hint/hint-describe.directive.js +5 -11
  79. package/esm2015/directives/hint/hint-driver.directive.js +22 -5
  80. package/esm2015/directives/hint/hint-host.directive.js +5 -1
  81. package/esm2015/directives/hint/hint-hover.directive.js +5 -3
  82. package/esm2015/directives/hint/hint-manual.directive.js +12 -5
  83. package/esm2015/directives/hint/hint-options.directive.js +5 -2
  84. package/esm2015/directives/hint/hint-position.directive.js +24 -10
  85. package/esm2015/directives/hint/hint.component.js +18 -4
  86. package/esm2015/directives/hint/hint.directive.js +3 -1
  87. package/esm2015/directives/hint/hint.providers.js +6 -2
  88. package/esm2015/directives/textfield-controller/textfield-appearance.directive.js +2 -2
  89. package/esm2015/directives/textfield-controller/textfield-cleaner.directive.js +2 -2
  90. package/esm2015/directives/textfield-controller/textfield-controller.provider.js +2 -2
  91. package/esm2015/directives/textfield-controller/textfield-custom-content.directive.js +2 -2
  92. package/esm2015/directives/textfield-controller/textfield-filler.directive.js +2 -2
  93. package/esm2015/directives/textfield-controller/textfield-icon-left.directive.js +2 -2
  94. package/esm2015/directives/textfield-controller/textfield-icon.directive.js +2 -2
  95. package/esm2015/directives/textfield-controller/textfield-label-outside.directive.js +2 -2
  96. package/esm2015/directives/textfield-controller/textfield-options.js +5 -2
  97. package/esm2015/directives/textfield-controller/textfield-postfix.directive.js +2 -2
  98. package/esm2015/directives/textfield-controller/textfield-prefix.directive.js +2 -2
  99. package/esm2015/directives/textfield-controller/textfield-size.directive.js +2 -2
  100. package/esm2015/tokens/animation-options.js +5 -2
  101. package/esm2015/tokens/animations-duration.js +5 -2
  102. package/esm2015/tokens/assert-enabled.js +5 -2
  103. package/esm2015/tokens/data-list-accessor.js +5 -2
  104. package/esm2015/tokens/data-list-host.js +5 -2
  105. package/esm2015/tokens/day-type-handler.js +5 -2
  106. package/esm2015/tokens/document-or-shadow-root.js +2 -2
  107. package/esm2015/tokens/element-ref.js +5 -2
  108. package/esm2015/tokens/first-day-of-week.js +5 -2
  109. package/esm2015/tokens/i18n.js +25 -7
  110. package/esm2015/tokens/icon-place.js +3 -2
  111. package/esm2015/tokens/icons-path.js +5 -2
  112. package/esm2015/tokens/icons.js +5 -2
  113. package/esm2015/tokens/is-mobile-resolution.js +5 -2
  114. package/esm2015/tokens/media.js +5 -2
  115. package/esm2015/tokens/mode.js +5 -2
  116. package/esm2015/tokens/notification-options.js +5 -2
  117. package/esm2015/tokens/number-format.js +5 -2
  118. package/esm2015/tokens/option-content.js +5 -2
  119. package/esm2015/tokens/ordered-short-week-days.js +3 -2
  120. package/esm2015/tokens/sanitizer.js +5 -2
  121. package/esm2015/tokens/scroll-ref.js +5 -2
  122. package/esm2015/tokens/selection-stream.js +5 -2
  123. package/esm2015/tokens/svg-content-processor.js +3 -2
  124. package/esm2015/tokens/svg-src-processor.js +3 -2
  125. package/esm2015/tokens/textfield-appearance.js +7 -4
  126. package/esm2015/tokens/textfield-host.js +5 -2
  127. package/esm2015/tokens/theme.js +2 -2
  128. package/esm2015/tokens/value-accessor.js +5 -2
  129. package/esm2015/tokens/viewport.js +6 -2
  130. package/fesm2015/taiga-ui-core-abstract.js +39 -9
  131. package/fesm2015/taiga-ui-core-abstract.js.map +1 -1
  132. package/fesm2015/taiga-ui-core-components-button.js +4 -1
  133. package/fesm2015/taiga-ui-core-components-button.js.map +1 -1
  134. package/fesm2015/taiga-ui-core-components-dialog.js +8 -2
  135. package/fesm2015/taiga-ui-core-components-dialog.js.map +1 -1
  136. package/fesm2015/taiga-ui-core-components-loader.js +4 -1
  137. package/fesm2015/taiga-ui-core-components-loader.js.map +1 -1
  138. package/fesm2015/taiga-ui-core-components-primitive-checkbox.js +4 -1
  139. package/fesm2015/taiga-ui-core-components-primitive-checkbox.js.map +1 -1
  140. package/fesm2015/taiga-ui-core-components-root.js +1 -1
  141. package/fesm2015/taiga-ui-core-components-svg.js +4 -1
  142. package/fesm2015/taiga-ui-core-components-svg.js.map +1 -1
  143. package/fesm2015/taiga-ui-core-directives-dropdown.js +104 -53
  144. package/fesm2015/taiga-ui-core-directives-dropdown.js.map +1 -1
  145. package/fesm2015/taiga-ui-core-directives-hint.js +187 -132
  146. package/fesm2015/taiga-ui-core-directives-hint.js.map +1 -1
  147. package/fesm2015/taiga-ui-core-directives-textfield-controller.js +15 -12
  148. package/fesm2015/taiga-ui-core-directives-textfield-controller.js.map +1 -1
  149. package/fesm2015/taiga-ui-core-tokens.js +129 -37
  150. package/fesm2015/taiga-ui-core-tokens.js.map +1 -1
  151. package/package.json +4 -4
  152. package/tokens/animation-options.d.ts +3 -0
  153. package/tokens/animations-duration.d.ts +3 -0
  154. package/tokens/assert-enabled.d.ts +3 -0
  155. package/tokens/data-list-accessor.d.ts +3 -0
  156. package/tokens/data-list-host.d.ts +3 -0
  157. package/tokens/day-type-handler.d.ts +3 -0
  158. package/tokens/element-ref.d.ts +3 -0
  159. package/tokens/first-day-of-week.d.ts +3 -0
  160. package/tokens/i18n.d.ts +18 -0
  161. package/tokens/icon-place.d.ts +1 -0
  162. package/tokens/icons-path.d.ts +1 -0
  163. package/tokens/icons.d.ts +3 -0
  164. package/tokens/is-mobile-resolution.d.ts +3 -0
  165. package/tokens/media.d.ts +3 -0
  166. package/tokens/mode.d.ts +3 -0
  167. package/tokens/notification-options.d.ts +3 -0
  168. package/tokens/number-format.d.ts +3 -0
  169. package/tokens/option-content.d.ts +3 -0
  170. package/tokens/ordered-short-week-days.d.ts +1 -0
  171. package/tokens/sanitizer.d.ts +3 -0
  172. package/tokens/scroll-ref.d.ts +3 -0
  173. package/tokens/selection-stream.d.ts +3 -0
  174. package/tokens/svg-content-processor.d.ts +1 -0
  175. package/tokens/svg-src-processor.d.ts +1 -0
  176. package/tokens/textfield-appearance.d.ts +5 -1
  177. package/tokens/textfield-host.d.ts +3 -0
  178. package/tokens/value-accessor.d.ts +3 -0
  179. package/tokens/viewport.d.ts +3 -0
@@ -1,25 +1,32 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, Optional, SkipSelf, forwardRef, Directive, Inject, Input, ElementRef, HostListener, Component, ChangeDetectionStrategy, Self, HostBinding, INJECTOR, NgZone, NgModule } from '@angular/core';
3
+ import { InjectionToken, Optional, SkipSelf, forwardRef, Directive, Inject, Input, ElementRef, INJECTOR, HostListener, Component, ChangeDetectionStrategy, Self, HostBinding, NgZone, NgModule } from '@angular/core';
4
4
  import * as i3 from '@taiga-ui/cdk';
5
- import { AbstractTuiController, tuiDefaultProp, TuiHoveredService, EMPTY_CLIENT_RECT, tuiPointToClientRect, tuiPx, tuiClamp, TuiDestroyService, tuiPure, TuiActiveZoneDirective, tuiTypedFromEvent, tuiZoneOptimized, tuiIsNativeFocused } from '@taiga-ui/cdk';
5
+ import { AbstractTuiController, tuiDefaultProp, TuiActiveZoneDirective, TuiHoveredService, EMPTY_CLIENT_RECT, tuiPointToClientRect, tuiPx, tuiClamp, TuiDestroyService, tuiPure, tuiTypedFromEvent, tuiZoneOptimized, tuiIsNativeFocused } from '@taiga-ui/cdk';
6
6
  import * as i1$1 from '@taiga-ui/core/abstract';
7
- import { TuiDriver, tuiAsDriver, tuiAsRectAccessor, TuiRectAccessor, tuiAsVehicle, AbstractTuiDriverDirective, tuiAsPositionAccessor } from '@taiga-ui/core/abstract';
7
+ import { tuiAsRectAccessor, tuiAsVehicle, TuiDriver, tuiAsDriver, TuiRectAccessor, tuiPositionAccessorFor, tuiRectAccessorFor, AbstractTuiDriverDirective, TuiVehicle, TuiPositionAccessor, tuiFallbackRectAccessor, tuiAsPositionAccessor } from '@taiga-ui/core/abstract';
8
8
  import { tuiFadeIn } from '@taiga-ui/core/animations';
9
9
  import * as i5 from '@taiga-ui/core/directives/mode';
10
10
  import { TuiModeDirective } from '@taiga-ui/core/directives/mode';
11
- import * as i2$1 from '@taiga-ui/core/services';
12
- import { TuiPositionService, TuiHintService } from '@taiga-ui/core/services';
11
+ import * as i2 from '@taiga-ui/core/services';
12
+ import { TuiHintService, TuiPositionService } from '@taiga-ui/core/services';
13
13
  import { TUI_ANIMATION_OPTIONS, TUI_VIEWPORT } from '@taiga-ui/core/tokens';
14
14
  import * as i1 from '@tinkoff/ng-polymorpheus';
15
- import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
16
- import { switchMap, delay, takeUntil, repeat, map, debounce, startWith, distinctUntilChanged, skip } from 'rxjs/operators';
17
- import * as i2 from 'rxjs';
18
- import { Subject, merge, of, timer } from 'rxjs';
15
+ import { PolymorpheusComponent, POLYMORPHEUS_CONTEXT, PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
16
+ import { switchMap, delay, takeUntil, repeat, filter, map, debounce, startWith, distinctUntilChanged, skip } from 'rxjs/operators';
19
17
  import { tuiOverrideOptions } from '@taiga-ui/core/utils';
18
+ import * as i2$1 from 'rxjs';
19
+ import { Subject, merge, of, timer } from 'rxjs';
20
20
  import { DOCUMENT, CommonModule } from '@angular/common';
21
21
  import { TUI_HINT_DIRECTIONS } from '@taiga-ui/core/constants';
22
22
 
23
+ /**
24
+ * A component to display a hint
25
+ */
26
+ const TUI_HINT_COMPONENT = new InjectionToken(`[TUI_HINT_COMPONENT]`, {
27
+ factory: () => TuiHintComponent,
28
+ });
29
+
23
30
  /** Default values for hint options */
24
31
  const TUI_HINT_DEFAULT_OPTIONS = {
25
32
  direction: 'bottom-left',
@@ -28,7 +35,10 @@ const TUI_HINT_DEFAULT_OPTIONS = {
28
35
  appearance: '',
29
36
  icon: 'tuiIconHelpCircle',
30
37
  };
31
- const TUI_HINT_OPTIONS = new InjectionToken('[TUI_HINT_OPTIONS] Default parameters for hint directive', {
38
+ /**
39
+ * Default parameters for hint directive
40
+ */
41
+ const TUI_HINT_OPTIONS = new InjectionToken('[TUI_HINT_OPTIONS]', {
32
42
  factory: () => TUI_HINT_DEFAULT_OPTIONS,
33
43
  });
34
44
  const tuiHintOptionsProvider = (override) => ({
@@ -106,6 +116,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
106
116
  args: ['tuiHintHideDelay']
107
117
  }] } });
108
118
 
119
+ class TuiHintDirective {
120
+ constructor(elementRef, component, hintService, options, activeZone) {
121
+ this.elementRef = elementRef;
122
+ this.component = component;
123
+ this.hintService = hintService;
124
+ this.options = options;
125
+ this.activeZone = activeZone;
126
+ this.content = '';
127
+ this.tuiHintAppearance = null;
128
+ this.type = 'hint';
129
+ }
130
+ get appearance() {
131
+ var _a;
132
+ return (_a = this.tuiHintAppearance) !== null && _a !== void 0 ? _a : this.options.appearance;
133
+ }
134
+ ngOnChanges() {
135
+ if (!this.content) {
136
+ this.toggle(false);
137
+ }
138
+ }
139
+ ngOnDestroy() {
140
+ this.toggle(false);
141
+ }
142
+ getClientRect() {
143
+ return this.elementRef.nativeElement.getBoundingClientRect();
144
+ }
145
+ toggle(show) {
146
+ if (show && this.content) {
147
+ this.hintService.add(this);
148
+ }
149
+ else {
150
+ this.hintService.remove(this);
151
+ }
152
+ }
153
+ }
154
+ TuiHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, deps: [{ token: ElementRef }, { token: PolymorpheusComponent }, { token: TuiHintService }, { token: TUI_HINT_OPTIONS }, { token: TuiActiveZoneDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
155
+ TuiHintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: { content: ["tuiHint", "content"], context: ["tuiHintContext", "context"], tuiHintAppearance: "tuiHintAppearance" }, providers: [
156
+ tuiAsRectAccessor(TuiHintDirective),
157
+ tuiAsVehicle(TuiHintDirective),
158
+ {
159
+ provide: PolymorpheusComponent,
160
+ deps: [TUI_HINT_COMPONENT, INJECTOR],
161
+ useClass: PolymorpheusComponent,
162
+ },
163
+ ], usesOnChanges: true, ngImport: i0 });
164
+ __decorate([
165
+ tuiDefaultProp()
166
+ ], TuiHintDirective.prototype, "content", void 0);
167
+ __decorate([
168
+ tuiDefaultProp()
169
+ ], TuiHintDirective.prototype, "tuiHintAppearance", void 0);
170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, decorators: [{
171
+ type: Directive,
172
+ args: [{
173
+ selector: '[tuiHint]:not(ng-container)',
174
+ providers: [
175
+ tuiAsRectAccessor(TuiHintDirective),
176
+ tuiAsVehicle(TuiHintDirective),
177
+ {
178
+ provide: PolymorpheusComponent,
179
+ deps: [TUI_HINT_COMPONENT, INJECTOR],
180
+ useClass: PolymorpheusComponent,
181
+ },
182
+ ],
183
+ }]
184
+ }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
185
+ type: Inject,
186
+ args: [ElementRef]
187
+ }] }, { type: i1.PolymorpheusComponent, decorators: [{
188
+ type: Inject,
189
+ args: [PolymorpheusComponent]
190
+ }] }, { type: i2.TuiHintService, decorators: [{
191
+ type: Inject,
192
+ args: [TuiHintService]
193
+ }] }, { type: undefined, decorators: [{
194
+ type: Inject,
195
+ args: [TUI_HINT_OPTIONS]
196
+ }] }, { type: i3.TuiActiveZoneDirective, decorators: [{
197
+ type: Optional
198
+ }, {
199
+ type: Inject,
200
+ args: [TuiActiveZoneDirective]
201
+ }] }]; }, propDecorators: { content: [{
202
+ type: Input,
203
+ args: ['tuiHint']
204
+ }], context: [{
205
+ type: Input,
206
+ args: ['tuiHintContext']
207
+ }], tuiHintAppearance: [{
208
+ type: Input
209
+ }] } });
210
+
109
211
  class TuiHintHoverDirective extends TuiDriver {
110
212
  constructor(hovered$, options, elementRef) {
111
213
  super(subscriber => this.stream$.subscribe(subscriber));
@@ -113,9 +215,11 @@ class TuiHintHoverDirective extends TuiDriver {
113
215
  this.options = options;
114
216
  this.elementRef = elementRef;
115
217
  this.toggle$ = new Subject();
116
- this.stream$ = merge(this.toggle$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? 0 : this.hideDelay))), takeUntil(this.hovered$), repeat()), this.hovered$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? this.showDelay : this.hideDelay))), takeUntil(this.toggle$), repeat()));
218
+ this.stream$ = merge(this.toggle$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? 0 : this.hideDelay))), takeUntil(this.hovered$), repeat()), this.hovered$.pipe(switchMap(visible => of(visible).pipe(delay(visible ? this.showDelay : this.hideDelay))), takeUntil(this.toggle$), repeat())).pipe(filter(() => this.enabled));
117
219
  this.showDelay = this.options.showDelay;
118
220
  this.hideDelay = this.options.hideDelay;
221
+ this.type = 'hint';
222
+ this.enabled = true;
119
223
  }
120
224
  toggle(visible) {
121
225
  this.toggle$.next(visible);
@@ -136,7 +240,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
136
240
  exportAs: 'tuiHintHover',
137
241
  providers: [tuiAsDriver(TuiHintHoverDirective), TuiHoveredService],
138
242
  }]
139
- }], ctorParameters: function () { return [{ type: i2.Observable, decorators: [{
243
+ }], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
140
244
  type: Inject,
141
245
  args: [TuiHoveredService]
142
246
  }] }, { type: undefined, decorators: [{
@@ -229,7 +333,13 @@ class TuiHintComponent {
229
333
  }
230
334
  }
231
335
  TuiHintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintComponent, deps: [{ token: TuiHoveredService }, { token: TuiPositionService }, { token: TuiDestroyService, self: true }, { token: TuiRectAccessor }, { token: ElementRef }, { token: TUI_ANIMATION_OPTIONS }, { token: POLYMORPHEUS_CONTEXT }, { token: TuiHintHoverDirective }, { token: TuiHintPointerDirective, optional: true }, { token: TuiModeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
232
- TuiHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintComponent, selector: "tui-hint", host: { listeners: { "document:click": "onClick($event.target)" }, properties: { "@tuiFadeIn": "this.animation", "attr.data-appearance": "this.appearance", "class._untouchable": "this.untouchable" } }, providers: [TuiDestroyService, TuiPositionService, TuiHoveredService], ngImport: i0, template: `
336
+ TuiHintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintComponent, selector: "tui-hint", host: { listeners: { "document:click": "onClick($event.target)" }, properties: { "@tuiFadeIn": "this.animation", "attr.data-appearance": "this.appearance", "class._untouchable": "this.untouchable" } }, providers: [
337
+ TuiDestroyService,
338
+ TuiPositionService,
339
+ TuiHoveredService,
340
+ tuiPositionAccessorFor('hint'),
341
+ tuiRectAccessorFor('hint', TuiHintDirective),
342
+ ], ngImport: i0, template: `
233
343
  <ng-container *polymorpheusOutlet="content as text; context: context">
234
344
  {{ text }}
235
345
  </ng-container>
@@ -248,16 +358,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
248
358
  `,
249
359
  styleUrls: ['./hint.style.less'],
250
360
  changeDetection: ChangeDetectionStrategy.OnPush,
251
- providers: [TuiDestroyService, TuiPositionService, TuiHoveredService],
361
+ providers: [
362
+ TuiDestroyService,
363
+ TuiPositionService,
364
+ TuiHoveredService,
365
+ tuiPositionAccessorFor('hint'),
366
+ tuiRectAccessorFor('hint', TuiHintDirective),
367
+ ],
252
368
  animations: [tuiFadeIn],
253
369
  }]
254
- }], ctorParameters: function () { return [{ type: i2.Observable, decorators: [{
370
+ }], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
255
371
  type: Inject,
256
372
  args: [TuiHoveredService]
257
- }] }, { type: i2.Observable, decorators: [{
373
+ }] }, { type: i2$1.Observable, decorators: [{
258
374
  type: Inject,
259
375
  args: [TuiPositionService]
260
- }] }, { type: i2.Observable, decorators: [{
376
+ }] }, { type: i2$1.Observable, decorators: [{
261
377
  type: Self
262
378
  }, {
263
379
  type: Inject,
@@ -301,115 +417,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
301
417
  args: ['document:click', ['$event.target']]
302
418
  }], update: [] } });
303
419
 
304
- const TUI_HINT_COMPONENT = new InjectionToken(`[TUI_HINT_COMPONENT] A component to display a hint`, {
305
- factory: () => TuiHintComponent,
306
- });
307
-
308
- class TuiHintDirective {
309
- constructor(elementRef, component, hintService, options, activeZone) {
310
- this.elementRef = elementRef;
311
- this.component = component;
312
- this.hintService = hintService;
313
- this.options = options;
314
- this.activeZone = activeZone;
315
- this.content = '';
316
- this.tuiHintAppearance = null;
317
- }
318
- get appearance() {
319
- var _a;
320
- return (_a = this.tuiHintAppearance) !== null && _a !== void 0 ? _a : this.options.appearance;
321
- }
322
- ngOnChanges() {
323
- if (!this.content) {
324
- this.toggle(false);
325
- }
326
- }
327
- ngOnDestroy() {
328
- this.toggle(false);
329
- }
330
- getClientRect() {
331
- return this.elementRef.nativeElement.getBoundingClientRect();
332
- }
333
- toggle(show) {
334
- if (show && this.content) {
335
- this.hintService.add(this);
336
- }
337
- else {
338
- this.hintService.remove(this);
339
- }
340
- }
341
- }
342
- TuiHintDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, deps: [{ token: ElementRef }, { token: PolymorpheusComponent }, { token: TuiHintService }, { token: TUI_HINT_OPTIONS }, { token: TuiActiveZoneDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
343
- TuiHintDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: { content: ["tuiHint", "content"], context: ["tuiHintContext", "context"], tuiHintAppearance: "tuiHintAppearance" }, providers: [
344
- tuiAsRectAccessor(TuiHintDirective),
345
- tuiAsVehicle(TuiHintDirective),
346
- {
347
- provide: PolymorpheusComponent,
348
- deps: [TUI_HINT_COMPONENT, INJECTOR],
349
- useClass: PolymorpheusComponent,
350
- },
351
- ], usesOnChanges: true, ngImport: i0 });
352
- __decorate([
353
- tuiDefaultProp()
354
- ], TuiHintDirective.prototype, "content", void 0);
355
- __decorate([
356
- tuiDefaultProp()
357
- ], TuiHintDirective.prototype, "tuiHintAppearance", void 0);
358
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDirective, decorators: [{
359
- type: Directive,
360
- args: [{
361
- selector: '[tuiHint]:not(ng-container)',
362
- providers: [
363
- tuiAsRectAccessor(TuiHintDirective),
364
- tuiAsVehicle(TuiHintDirective),
365
- {
366
- provide: PolymorpheusComponent,
367
- deps: [TUI_HINT_COMPONENT, INJECTOR],
368
- useClass: PolymorpheusComponent,
369
- },
370
- ],
371
- }]
372
- }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
373
- type: Inject,
374
- args: [ElementRef]
375
- }] }, { type: i1.PolymorpheusComponent, decorators: [{
376
- type: Inject,
377
- args: [PolymorpheusComponent]
378
- }] }, { type: i2$1.TuiHintService, decorators: [{
379
- type: Inject,
380
- args: [TuiHintService]
381
- }] }, { type: undefined, decorators: [{
382
- type: Inject,
383
- args: [TUI_HINT_OPTIONS]
384
- }] }, { type: i3.TuiActiveZoneDirective, decorators: [{
385
- type: Optional
386
- }, {
387
- type: Inject,
388
- args: [TuiActiveZoneDirective]
389
- }] }]; }, propDecorators: { content: [{
390
- type: Input,
391
- args: ['tuiHint']
392
- }], context: [{
393
- type: Input,
394
- args: ['tuiHintContext']
395
- }], tuiHintAppearance: [{
396
- type: Input
397
- }] } });
398
-
399
420
  class TuiHintDescribeDirective extends TuiDriver {
400
- constructor(ngZone, hover$, documentRef, elementRef) {
421
+ constructor(ngZone, documentRef, elementRef) {
401
422
  super(subscriber => this.stream$.subscribe(subscriber));
402
423
  this.ngZone = ngZone;
403
- this.hover$ = hover$;
404
424
  this.documentRef = documentRef;
405
425
  this.elementRef = elementRef;
406
- this.focus$ = tuiTypedFromEvent(this.documentRef, 'keydown', {
426
+ this.stream$ = tuiTypedFromEvent(this.documentRef, 'keydown', {
407
427
  capture: true,
408
428
  }).pipe(switchMap(() => this.focused
409
429
  ? of(false)
410
430
  : merge(tuiTypedFromEvent(this.documentRef, 'keyup'), tuiTypedFromEvent(this.element, 'blur')).pipe(map(() => this.focused))), debounce(visible => (visible ? timer(1000) : of(null))), startWith(false), distinctUntilChanged(), skip(1), tuiZoneOptimized(this.ngZone));
411
- this.stream$ = merge(this.hover$, this.focus$);
412
431
  this.tuiHintDescribe = '';
432
+ this.type = 'hint';
413
433
  }
414
434
  get focused() {
415
435
  return tuiIsNativeFocused(this.element);
@@ -419,7 +439,7 @@ class TuiHintDescribeDirective extends TuiDriver {
419
439
  this.elementRef.nativeElement);
420
440
  }
421
441
  }
422
- TuiHintDescribeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDescribeDirective, deps: [{ token: NgZone }, { token: TuiHintHoverDirective }, { token: DOCUMENT }, { token: ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
442
+ TuiHintDescribeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDescribeDirective, deps: [{ token: NgZone }, { token: DOCUMENT }, { token: ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
423
443
  TuiHintDescribeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDescribeDirective, selector: "[tuiHintDescribe]", inputs: { tuiHintDescribe: "tuiHintDescribe" }, providers: [tuiAsDriver(TuiHintDescribeDirective)], usesInheritance: true, ngImport: i0 });
424
444
  __decorate([
425
445
  tuiPure
@@ -433,9 +453,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
433
453
  }], ctorParameters: function () { return [{ type: i0.NgZone, decorators: [{
434
454
  type: Inject,
435
455
  args: [NgZone]
436
- }] }, { type: i2.Observable, decorators: [{
437
- type: Inject,
438
- args: [TuiHintHoverDirective]
439
456
  }] }, { type: Document, decorators: [{
440
457
  type: Inject,
441
458
  args: [DOCUMENT]
@@ -447,8 +464,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
447
464
  }], element: [] } });
448
465
 
449
466
  class TuiHintDriverDirective extends AbstractTuiDriverDirective {
467
+ // TODO: Figure out why this is necessary under nx test runner
468
+ constructor(destroy$, drivers, vehicles) {
469
+ super(destroy$, drivers, vehicles);
470
+ this.type = 'hint';
471
+ }
450
472
  }
451
- TuiHintDriverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
473
+ TuiHintDriverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, deps: [{ token: TuiDestroyService, self: true }, { token: TuiDriver }, { token: TuiVehicle }], target: i0.ɵɵFactoryTarget.Directive });
452
474
  TuiHintDriverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintDriverDirective, selector: "[tuiHint]", providers: [TuiDestroyService], usesInheritance: true, ngImport: i0 });
453
475
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintDriverDirective, decorators: [{
454
476
  type: Directive,
@@ -456,9 +478,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
456
478
  selector: '[tuiHint]',
457
479
  providers: [TuiDestroyService],
458
480
  }]
459
- }] });
481
+ }], ctorParameters: function () { return [{ type: i2$1.Observable, decorators: [{
482
+ type: Self
483
+ }, {
484
+ type: Inject,
485
+ args: [TuiDestroyService]
486
+ }] }, { type: undefined, decorators: [{
487
+ type: Inject,
488
+ args: [TuiDriver]
489
+ }] }, { type: undefined, decorators: [{
490
+ type: Inject,
491
+ args: [TuiVehicle]
492
+ }] }]; } });
460
493
 
461
494
  class TuiHintHostDirective extends TuiRectAccessor {
495
+ constructor() {
496
+ super(...arguments);
497
+ this.type = 'hint';
498
+ }
462
499
  getClientRect() {
463
500
  var _a;
464
501
  return ((_a = this.tuiHintHost) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || EMPTY_CLIENT_RECT;
@@ -477,16 +514,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
477
514
  }] } });
478
515
 
479
516
  class TuiHintManualDirective extends TuiDriver {
480
- constructor() {
517
+ constructor(hover) {
481
518
  super(subscriber => this.stream$.subscribe(subscriber));
482
519
  this.stream$ = new Subject();
483
520
  this.tuiHintManual = false;
521
+ this.type = 'hint';
522
+ hover.enabled = false;
484
523
  }
485
524
  ngOnChanges() {
486
525
  this.stream$.next(this.tuiHintManual);
487
526
  }
488
527
  }
489
- TuiHintManualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
528
+ TuiHintManualDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, deps: [{ token: TuiHintHoverDirective }], target: i0.ɵɵFactoryTarget.Directive });
490
529
  TuiHintManualDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintManualDirective, selector: "[tuiHint][tuiHintManual]", inputs: { tuiHintManual: "tuiHintManual" }, providers: [tuiAsDriver(TuiHintManualDirective)], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
491
530
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintManualDirective, decorators: [{
492
531
  type: Directive,
@@ -494,7 +533,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
494
533
  selector: '[tuiHint][tuiHintManual]',
495
534
  providers: [tuiAsDriver(TuiHintManualDirective)],
496
535
  }]
497
- }], ctorParameters: function () { return []; }, propDecorators: { tuiHintManual: [{
536
+ }], ctorParameters: function () { return [{ type: TuiHintHoverDirective, decorators: [{
537
+ type: Inject,
538
+ args: [TuiHintHoverDirective]
539
+ }] }]; }, propDecorators: { tuiHintManual: [{
498
540
  type: Input
499
541
  }] } });
500
542
 
@@ -502,17 +544,21 @@ const OFFSET = 8;
502
544
  const ARROW_OFFSET = 22;
503
545
  const TOP = 0;
504
546
  const LEFT = 1;
505
- class TuiHintPositionDirective {
506
- constructor(options, viewport, accessor) {
547
+ class TuiHintPositionDirective extends TuiPositionAccessor {
548
+ constructor(options, viewport, directive, accessors) {
549
+ super();
507
550
  this.options = options;
508
551
  this.viewport = viewport;
509
- this.accessor = accessor;
552
+ this.directive = directive;
553
+ this.accessors = accessors;
510
554
  this.points = TUI_HINT_DIRECTIONS.reduce((acc, direction) => (Object.assign(Object.assign({}, acc), { [direction]: [0, 0] })), {});
511
555
  this.direction = this.options.direction;
556
+ this.type = 'hint';
512
557
  }
513
558
  // eslint-disable-next-line max-statements
514
559
  getPosition({ width, height }) {
515
- const hostRect = this.accessor.getClientRect();
560
+ var _a, _b;
561
+ const hostRect = (_b = (_a = this.accessor) === null || _a === void 0 ? void 0 : _a.getClientRect()) !== null && _b !== void 0 ? _b : EMPTY_CLIENT_RECT;
516
562
  const leftCenter = hostRect.left + hostRect.width / 2;
517
563
  const topCenter = hostRect.top + hostRect.height / 2;
518
564
  this.points['top-left'][TOP] = hostRect.top - height - OFFSET;
@@ -545,6 +591,9 @@ class TuiHintPositionDirective {
545
591
  const direction = TUI_HINT_DIRECTIONS.find(direction => this.checkPosition(this.points[direction], width, height));
546
592
  return this.points[direction || this.fallback];
547
593
  }
594
+ get accessor() {
595
+ return tuiFallbackRectAccessor('hint')(this.accessors, this.directive);
596
+ }
548
597
  get fallback() {
549
598
  return this.points.top[TOP] >
550
599
  this.viewport.getClientRect().bottom - this.points.bottom[TOP]
@@ -559,11 +608,14 @@ class TuiHintPositionDirective {
559
608
  left + width < viewport.right - OFFSET);
560
609
  }
561
610
  }
562
- TuiHintPositionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, deps: [{ token: TUI_HINT_OPTIONS }, { token: TUI_VIEWPORT }, { token: TuiRectAccessor }], target: i0.ɵɵFactoryTarget.Directive });
563
- TuiHintPositionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: { direction: ["tuiHintDirection", "direction"] }, providers: [tuiAsPositionAccessor(TuiHintPositionDirective)], ngImport: i0 });
611
+ TuiHintPositionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, deps: [{ token: TUI_HINT_OPTIONS }, { token: TUI_VIEWPORT }, { token: TuiHintDirective }, { token: TuiRectAccessor }], target: i0.ɵɵFactoryTarget.Directive });
612
+ TuiHintPositionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: { direction: ["tuiHintDirection", "direction"] }, providers: [tuiAsPositionAccessor(TuiHintPositionDirective)], usesInheritance: true, ngImport: i0 });
564
613
  __decorate([
565
614
  tuiDefaultProp()
566
615
  ], TuiHintPositionDirective.prototype, "direction", void 0);
616
+ __decorate([
617
+ tuiPure
618
+ ], TuiHintPositionDirective.prototype, "accessor", null);
567
619
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: TuiHintPositionDirective, decorators: [{
568
620
  type: Directive,
569
621
  args: [{
@@ -577,12 +629,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
577
629
  type: Inject,
578
630
  args: [TUI_VIEWPORT]
579
631
  }] }, { type: i1$1.TuiRectAccessor, decorators: [{
632
+ type: Inject,
633
+ args: [TuiHintDirective]
634
+ }] }, { type: undefined, decorators: [{
580
635
  type: Inject,
581
636
  args: [TuiRectAccessor]
582
637
  }] }]; }, propDecorators: { direction: [{
583
638
  type: Input,
584
639
  args: ['tuiHintDirection']
585
- }] } });
640
+ }], accessor: [] } });
586
641
 
587
642
  class TuiHintModule {
588
643
  }