@i-cell/ids-angular 0.0.0-watch

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 (133) hide show
  1. package/README.md +24 -0
  2. package/accordion/index.d.ts +81 -0
  3. package/accordion/package.json +3 -0
  4. package/avatar/index.d.ts +66 -0
  5. package/avatar/package.json +3 -0
  6. package/badge/index.d.ts +61 -0
  7. package/badge/package.json +3 -0
  8. package/breadcrumb/index.d.ts +67 -0
  9. package/breadcrumb/package.json +3 -0
  10. package/button/index.d.ts +81 -0
  11. package/button/package.json +3 -0
  12. package/card/index.d.ts +91 -0
  13. package/card/package.json +3 -0
  14. package/checkbox/index.d.ts +137 -0
  15. package/checkbox/package.json +3 -0
  16. package/chip/index.d.ts +82 -0
  17. package/chip/package.json +3 -0
  18. package/core/index.d.ts +168 -0
  19. package/core/package.json +3 -0
  20. package/datepicker/index.d.ts +112 -0
  21. package/datepicker/package.json +3 -0
  22. package/dialog/index.d.ts +72 -0
  23. package/dialog/package.json +3 -0
  24. package/divider/index.d.ts +45 -0
  25. package/divider/package.json +3 -0
  26. package/fesm2022/i-cell-ids-angular-accordion.mjs +223 -0
  27. package/fesm2022/i-cell-ids-angular-accordion.mjs.map +1 -0
  28. package/fesm2022/i-cell-ids-angular-avatar.mjs +125 -0
  29. package/fesm2022/i-cell-ids-angular-avatar.mjs.map +1 -0
  30. package/fesm2022/i-cell-ids-angular-badge.mjs +172 -0
  31. package/fesm2022/i-cell-ids-angular-badge.mjs.map +1 -0
  32. package/fesm2022/i-cell-ids-angular-breadcrumb.mjs +313 -0
  33. package/fesm2022/i-cell-ids-angular-breadcrumb.mjs.map +1 -0
  34. package/fesm2022/i-cell-ids-angular-button.mjs +149 -0
  35. package/fesm2022/i-cell-ids-angular-button.mjs.map +1 -0
  36. package/fesm2022/i-cell-ids-angular-card.mjs +222 -0
  37. package/fesm2022/i-cell-ids-angular-card.mjs.map +1 -0
  38. package/fesm2022/i-cell-ids-angular-checkbox.mjs +350 -0
  39. package/fesm2022/i-cell-ids-angular-checkbox.mjs.map +1 -0
  40. package/fesm2022/i-cell-ids-angular-chip.mjs +166 -0
  41. package/fesm2022/i-cell-ids-angular-chip.mjs.map +1 -0
  42. package/fesm2022/i-cell-ids-angular-core.mjs +409 -0
  43. package/fesm2022/i-cell-ids-angular-core.mjs.map +1 -0
  44. package/fesm2022/i-cell-ids-angular-datepicker.mjs +860 -0
  45. package/fesm2022/i-cell-ids-angular-datepicker.mjs.map +1 -0
  46. package/fesm2022/i-cell-ids-angular-dialog.mjs +183 -0
  47. package/fesm2022/i-cell-ids-angular-dialog.mjs.map +1 -0
  48. package/fesm2022/i-cell-ids-angular-divider.mjs +76 -0
  49. package/fesm2022/i-cell-ids-angular-divider.mjs.map +1 -0
  50. package/fesm2022/i-cell-ids-angular-forms.mjs +972 -0
  51. package/fesm2022/i-cell-ids-angular-forms.mjs.map +1 -0
  52. package/fesm2022/i-cell-ids-angular-icon-button.mjs +120 -0
  53. package/fesm2022/i-cell-ids-angular-icon-button.mjs.map +1 -0
  54. package/fesm2022/i-cell-ids-angular-icon.mjs +158 -0
  55. package/fesm2022/i-cell-ids-angular-icon.mjs.map +1 -0
  56. package/fesm2022/i-cell-ids-angular-menu.mjs +154 -0
  57. package/fesm2022/i-cell-ids-angular-menu.mjs.map +1 -0
  58. package/fesm2022/i-cell-ids-angular-notification.mjs +167 -0
  59. package/fesm2022/i-cell-ids-angular-notification.mjs.map +1 -0
  60. package/fesm2022/i-cell-ids-angular-overlay-panel.mjs +72 -0
  61. package/fesm2022/i-cell-ids-angular-overlay-panel.mjs.map +1 -0
  62. package/fesm2022/i-cell-ids-angular-paginator.mjs +319 -0
  63. package/fesm2022/i-cell-ids-angular-paginator.mjs.map +1 -0
  64. package/fesm2022/i-cell-ids-angular-radio.mjs +312 -0
  65. package/fesm2022/i-cell-ids-angular-radio.mjs.map +1 -0
  66. package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs +264 -0
  67. package/fesm2022/i-cell-ids-angular-segmented-control-toggle.mjs.map +1 -0
  68. package/fesm2022/i-cell-ids-angular-segmented-control.mjs +283 -0
  69. package/fesm2022/i-cell-ids-angular-segmented-control.mjs.map +1 -0
  70. package/fesm2022/i-cell-ids-angular-select.mjs +549 -0
  71. package/fesm2022/i-cell-ids-angular-select.mjs.map +1 -0
  72. package/fesm2022/i-cell-ids-angular-side-nav.mjs +375 -0
  73. package/fesm2022/i-cell-ids-angular-side-nav.mjs.map +1 -0
  74. package/fesm2022/i-cell-ids-angular-side-sheet.mjs +179 -0
  75. package/fesm2022/i-cell-ids-angular-side-sheet.mjs.map +1 -0
  76. package/fesm2022/i-cell-ids-angular-snackbar.mjs +440 -0
  77. package/fesm2022/i-cell-ids-angular-snackbar.mjs.map +1 -0
  78. package/fesm2022/i-cell-ids-angular-spinner.mjs +67 -0
  79. package/fesm2022/i-cell-ids-angular-spinner.mjs.map +1 -0
  80. package/fesm2022/i-cell-ids-angular-switch.mjs +181 -0
  81. package/fesm2022/i-cell-ids-angular-switch.mjs.map +1 -0
  82. package/fesm2022/i-cell-ids-angular-tab.mjs +142 -0
  83. package/fesm2022/i-cell-ids-angular-tab.mjs.map +1 -0
  84. package/fesm2022/i-cell-ids-angular-table.mjs +663 -0
  85. package/fesm2022/i-cell-ids-angular-table.mjs.map +1 -0
  86. package/fesm2022/i-cell-ids-angular-tag.mjs +116 -0
  87. package/fesm2022/i-cell-ids-angular-tag.mjs.map +1 -0
  88. package/fesm2022/i-cell-ids-angular-tooltip.mjs +586 -0
  89. package/fesm2022/i-cell-ids-angular-tooltip.mjs.map +1 -0
  90. package/fesm2022/i-cell-ids-angular.mjs +9 -0
  91. package/fesm2022/i-cell-ids-angular.mjs.map +1 -0
  92. package/forms/index.d.ts +470 -0
  93. package/forms/package.json +3 -0
  94. package/icon/index.d.ts +69 -0
  95. package/icon/package.json +3 -0
  96. package/icon-button/index.d.ts +68 -0
  97. package/icon-button/package.json +3 -0
  98. package/index.d.ts +2 -0
  99. package/menu/index.d.ts +68 -0
  100. package/menu/package.json +3 -0
  101. package/notification/index.d.ts +68 -0
  102. package/notification/package.json +3 -0
  103. package/overlay-panel/index.d.ts +41 -0
  104. package/overlay-panel/package.json +3 -0
  105. package/package.json +180 -0
  106. package/paginator/index.d.ts +122 -0
  107. package/paginator/package.json +3 -0
  108. package/radio/index.d.ts +95 -0
  109. package/radio/package.json +3 -0
  110. package/segmented-control/index.d.ts +98 -0
  111. package/segmented-control/package.json +3 -0
  112. package/segmented-control-toggle/index.d.ts +103 -0
  113. package/segmented-control-toggle/package.json +3 -0
  114. package/select/index.d.ts +103 -0
  115. package/select/package.json +3 -0
  116. package/side-nav/index.d.ts +107 -0
  117. package/side-nav/package.json +3 -0
  118. package/side-sheet/index.d.ts +84 -0
  119. package/side-sheet/package.json +3 -0
  120. package/snackbar/index.d.ts +149 -0
  121. package/snackbar/package.json +3 -0
  122. package/spinner/index.d.ts +41 -0
  123. package/spinner/package.json +3 -0
  124. package/switch/index.d.ts +89 -0
  125. package/switch/package.json +3 -0
  126. package/tab/index.d.ts +78 -0
  127. package/tab/package.json +3 -0
  128. package/table/index.d.ts +393 -0
  129. package/table/package.json +3 -0
  130. package/tag/index.d.ts +70 -0
  131. package/tag/package.json +3 -0
  132. package/tooltip/index.d.ts +96 -0
  133. package/tooltip/package.json +3 -0
@@ -0,0 +1,586 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, input, computed, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, NgZone, ElementRef, ViewContainerRef, DOCUMENT, signal, effect, Directive } from '@angular/core';
3
+ import { IdsSize, ComponentBase, DirectiveBaseWithDefaults, coerceStringAttribute } from '@i-cell/ids-angular/core';
4
+ import { Subject } from 'rxjs';
5
+ import { FocusMonitor } from '@angular/cdk/a11y';
6
+ import { hasModifierKey } from '@angular/cdk/keycodes';
7
+ import { Overlay } from '@angular/cdk/overlay';
8
+ import { normalizePassiveListenerOptions, Platform } from '@angular/cdk/platform';
9
+ import { ComponentPortal } from '@angular/cdk/portal';
10
+ import { ScrollDispatcher } from '@angular/cdk/scrolling';
11
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
+
13
+ const IdsTooltipPosition = {
14
+ NORTH: 'north',
15
+ NORTHEAST: 'northeast',
16
+ EAST: 'east',
17
+ SOUTHEAST: 'southeast',
18
+ SOUTH: 'south',
19
+ SOUTHWEST: 'southwest',
20
+ WEST: 'west',
21
+ NORTHWEST: 'northwest',
22
+ };
23
+
24
+ const IdsTooltipVariant = {
25
+ LIGHT: 'light',
26
+ DARK: 'dark',
27
+ };
28
+
29
+ const DEFAULT_SHOW_DELAY = 1_000;
30
+ const DEFAULT_HIDE_DELAY = 1_000;
31
+ const DEFAULT_VIEWPORT_MARGIN = 8;
32
+ const DEFAULT_LONGPRESS_DELAY = 500;
33
+ const DEFAULT_TOUCHEND_HIDE_DELAY = 1500;
34
+ const DEFAULT_SCROLL_DEBOUNCE_TIME = 20;
35
+ const IDS_TOOLTIP_DEFAULT_CONFIG = new InjectionToken('IDS_TOOLTIP_DEFAULT_CONFIG', {
36
+ providedIn: 'root',
37
+ factory: IDS_TOOLTIP_DEFAULT_CONFIG_FACTORY,
38
+ });
39
+ function IDS_TOOLTIP_DEFAULT_CONFIG_FACTORY() {
40
+ return {
41
+ position: IdsTooltipPosition.NORTH,
42
+ size: IdsSize.COMPACT,
43
+ variant: IdsTooltipVariant.DARK,
44
+ showPointer: true,
45
+ showDelay: DEFAULT_SHOW_DELAY,
46
+ hideDelay: DEFAULT_HIDE_DELAY,
47
+ touchLongPressShowDelay: DEFAULT_LONGPRESS_DELAY,
48
+ viewPortMargin: DEFAULT_VIEWPORT_MARGIN,
49
+ touchendHideDelay: DEFAULT_TOUCHEND_HIDE_DELAY,
50
+ scrollDebounceTime: DEFAULT_SCROLL_DEBOUNCE_TIME,
51
+ };
52
+ }
53
+
54
+ function setTooltipFlexibleConnectedPositionStrategy(connectedTo, tooltipPosition) {
55
+ switch (tooltipPosition) {
56
+ case IdsTooltipPosition.NORTH:
57
+ return connectedTo.withPositions([
58
+ connectedPosition.north,
59
+ connectedPosition.northwest,
60
+ connectedPosition.northeast,
61
+ connectedPosition.south,
62
+ connectedPosition.southwest,
63
+ connectedPosition.southeast,
64
+ ]);
65
+ case IdsTooltipPosition.NORTHEAST:
66
+ return connectedTo.withPositions([
67
+ connectedPosition.northeast,
68
+ connectedPosition.southeast,
69
+ connectedPosition.northwest,
70
+ connectedPosition.southwest,
71
+ ]);
72
+ case IdsTooltipPosition.EAST:
73
+ return connectedTo.withPositions([
74
+ connectedPosition.east,
75
+ connectedPosition.northeast,
76
+ connectedPosition.southeast,
77
+ connectedPosition.west,
78
+ connectedPosition.northwest,
79
+ connectedPosition.southwest,
80
+ ]);
81
+ case IdsTooltipPosition.SOUTHEAST:
82
+ return connectedTo.withPositions([
83
+ connectedPosition.southeast,
84
+ connectedPosition.southwest,
85
+ connectedPosition.northeast,
86
+ connectedPosition.northwest,
87
+ ]);
88
+ case IdsTooltipPosition.SOUTH:
89
+ return connectedTo.withPositions([
90
+ connectedPosition.south,
91
+ connectedPosition.southwest,
92
+ connectedPosition.southeast,
93
+ connectedPosition.north,
94
+ connectedPosition.northwest,
95
+ connectedPosition.northeast,
96
+ ]);
97
+ case IdsTooltipPosition.SOUTHWEST:
98
+ return connectedTo.withPositions([
99
+ connectedPosition.southwest,
100
+ connectedPosition.northwest,
101
+ connectedPosition.southeast,
102
+ connectedPosition.northeast,
103
+ ]);
104
+ case IdsTooltipPosition.WEST:
105
+ return connectedTo.withPositions([
106
+ connectedPosition.west,
107
+ connectedPosition.northwest,
108
+ connectedPosition.southwest,
109
+ connectedPosition.east,
110
+ connectedPosition.northeast,
111
+ connectedPosition.southeast,
112
+ ]);
113
+ case IdsTooltipPosition.NORTHWEST:
114
+ return connectedTo.withPositions([
115
+ connectedPosition.northwest,
116
+ connectedPosition.southwest,
117
+ connectedPosition.northeast,
118
+ connectedPosition.southeast,
119
+ ]);
120
+ }
121
+ }
122
+ const connectedPosition = {
123
+ north: {
124
+ originX: 'center',
125
+ originY: 'top',
126
+ overlayX: 'center',
127
+ overlayY: 'bottom',
128
+ },
129
+ northeast: {
130
+ originX: 'end',
131
+ originY: 'top',
132
+ overlayX: 'start',
133
+ overlayY: 'bottom',
134
+ },
135
+ east: {
136
+ originX: 'end',
137
+ originY: 'center',
138
+ overlayX: 'start',
139
+ overlayY: 'center',
140
+ },
141
+ southeast: {
142
+ originX: 'end',
143
+ originY: 'bottom',
144
+ overlayX: 'start',
145
+ overlayY: 'top',
146
+ },
147
+ south: {
148
+ originX: 'center',
149
+ originY: 'bottom',
150
+ overlayX: 'center',
151
+ overlayY: 'top',
152
+ },
153
+ southwest: {
154
+ originX: 'start',
155
+ originY: 'bottom',
156
+ overlayX: 'end',
157
+ overlayY: 'top',
158
+ },
159
+ west: {
160
+ originX: 'start',
161
+ originY: 'center',
162
+ overlayX: 'end',
163
+ overlayY: 'center',
164
+ },
165
+ northwest: {
166
+ originX: 'start',
167
+ originY: 'top',
168
+ overlayX: 'end',
169
+ overlayY: 'bottom',
170
+ },
171
+ };
172
+
173
+ class IdsTooltipComponent extends ComponentBase {
174
+ constructor() {
175
+ super(...arguments);
176
+ this._onHide = new Subject();
177
+ this.message = input(...(ngDevMode ? [undefined, { debugName: "message" }] : []));
178
+ this.position = input(...(ngDevMode ? [undefined, { debugName: "position" }] : []));
179
+ this.size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
180
+ this.variant = input(...(ngDevMode ? [undefined, { debugName: "variant" }] : []));
181
+ this.textAlign = input(...(ngDevMode ? [undefined, { debugName: "textAlign" }] : []));
182
+ this.mouseLeaveHideDelay = input(0, ...(ngDevMode ? [{ debugName: "mouseLeaveHideDelay" }] : []));
183
+ this.tooltipClass = input(...(ngDevMode ? [undefined, { debugName: "tooltipClass" }] : []));
184
+ this.showPointer = input(...(ngDevMode ? [undefined, { debugName: "showPointer" }] : []));
185
+ this._hostClasses = computed(() => this._getHostClasses([
186
+ this.size(),
187
+ this.variant(),
188
+ [
189
+ 'position',
190
+ this.position(),
191
+ ],
192
+ [
193
+ 'text-align',
194
+ this.textAlign(),
195
+ ],
196
+ this.showPointer() ? 'pointered' : null,
197
+ ]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
198
+ }
199
+ get _hostName() {
200
+ return 'tooltip';
201
+ }
202
+ get isHideTimerTicking() {
203
+ return Boolean(this._hideTimeout);
204
+ }
205
+ hide(delay) {
206
+ this._hideTimeout = setTimeout(() => {
207
+ this._hideTimeout = undefined;
208
+ this._onHide.next();
209
+ }, delay);
210
+ }
211
+ afterHidden() {
212
+ return this._onHide;
213
+ }
214
+ abortHide() {
215
+ clearTimeout(this._hideTimeout);
216
+ this._hideTimeout = undefined;
217
+ }
218
+ _handleMouseEnter() {
219
+ if (this._hideTimeout) {
220
+ this.abortHide();
221
+ }
222
+ }
223
+ _handleMouseLeave({ relatedTarget }) {
224
+ if (!relatedTarget || !this.triggerElement?.contains(relatedTarget)) {
225
+ this.hide(this.mouseLeaveHideDelay());
226
+ }
227
+ }
228
+ ngOnDestroy() {
229
+ this._onHide.complete();
230
+ }
231
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsTooltipComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
232
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.7", type: IdsTooltipComponent, isStandalone: true, selector: "ids-tooltip", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, textAlign: { classPropertyName: "textAlign", publicName: "textAlign", isSignal: true, isRequired: false, transformFunction: null }, mouseLeaveHideDelay: { classPropertyName: "mouseLeaveHideDelay", publicName: "mouseLeaveHideDelay", isSignal: true, isRequired: false, transformFunction: null }, tooltipClass: { classPropertyName: "tooltipClass", publicName: "tooltipClass", isSignal: true, isRequired: false, transformFunction: null }, showPointer: { classPropertyName: "showPointer", publicName: "showPointer", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, listeners: { "mouseenter": "_handleMouseEnter()", "mouseleave": "_handleMouseLeave($event)" }, properties: { "class": "tooltipClass()" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"ids-tooltip__content\">\n <span>{{ message() }}</span>\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
233
+ }
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsTooltipComponent, decorators: [{
235
+ type: Component,
236
+ args: [{ selector: 'ids-tooltip', imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
237
+ '(mouseenter)': '_handleMouseEnter()',
238
+ '(mouseleave)': '_handleMouseLeave($event)',
239
+ 'aria-hidden': 'true',
240
+ '[class]': 'tooltipClass()',
241
+ }, template: "<div class=\"ids-tooltip__content\">\n <span>{{ message() }}</span>\n</div>\n" }]
242
+ }] });
243
+
244
+ function connectedPositionPairToTooltipPosition(positionPair) {
245
+ const { originX, originY, overlayX, overlayY } = positionPair;
246
+ if (originX === 'center' &&
247
+ originY === 'top' &&
248
+ overlayX === 'center' &&
249
+ overlayY === 'bottom') {
250
+ return IdsTooltipPosition.NORTH;
251
+ }
252
+ if (originX === 'end' &&
253
+ originY === 'top' &&
254
+ overlayX === 'start' &&
255
+ overlayY === 'bottom') {
256
+ return IdsTooltipPosition.NORTHEAST;
257
+ }
258
+ if (originX === 'end' &&
259
+ originY === 'center' &&
260
+ overlayX === 'start' &&
261
+ overlayY === 'center') {
262
+ return IdsTooltipPosition.EAST;
263
+ }
264
+ if (originX === 'end' &&
265
+ originY === 'bottom' &&
266
+ overlayX === 'start' &&
267
+ overlayY === 'top') {
268
+ return IdsTooltipPosition.SOUTHEAST;
269
+ }
270
+ if (originX === 'center' &&
271
+ originY === 'bottom' &&
272
+ overlayX === 'center' &&
273
+ overlayY === 'top') {
274
+ return IdsTooltipPosition.SOUTH;
275
+ }
276
+ if (originX === 'start' &&
277
+ originY === 'bottom' &&
278
+ overlayX === 'end' &&
279
+ overlayY === 'top') {
280
+ return IdsTooltipPosition.SOUTHWEST;
281
+ }
282
+ if (originX === 'start' &&
283
+ originY === 'center' &&
284
+ overlayX === 'end' &&
285
+ overlayY === 'center') {
286
+ return IdsTooltipPosition.WEST;
287
+ }
288
+ if (originX === 'start' &&
289
+ originY === 'top' &&
290
+ overlayX === 'end' &&
291
+ overlayY === 'bottom') {
292
+ return IdsTooltipPosition.NORTHWEST;
293
+ }
294
+ return IdsTooltipPosition.EAST;
295
+ }
296
+
297
+ const defaultConfig = IDS_TOOLTIP_DEFAULT_CONFIG_FACTORY();
298
+ const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
299
+ class IdsTooltipDirective extends DirectiveBaseWithDefaults {
300
+ constructor() {
301
+ super(...arguments);
302
+ this._focusMonitor = inject(FocusMonitor);
303
+ this._platform = inject(Platform);
304
+ this._ngZone = inject(NgZone);
305
+ this._elementRef = inject((ElementRef));
306
+ this._viewContainerRef = inject(ViewContainerRef);
307
+ this._scrollDispatcher = inject(ScrollDispatcher);
308
+ this._overlay = inject(Overlay);
309
+ this._document = inject(DOCUMENT);
310
+ this._defaultConfig = this._getDefaultConfig(defaultConfig, IDS_TOOLTIP_DEFAULT_CONFIG);
311
+ this._passiveListeners = [];
312
+ this._overlayRef = null;
313
+ this._tooltipInstance = null;
314
+ this._pointerExitEventsInitialized = false;
315
+ this._viewportMargin = this._defaultConfig.viewPortMargin;
316
+ this._currentPosition = signal(null, ...(ngDevMode ? [{ debugName: "_currentPosition" }] : []));
317
+ this.message = input('', ...(ngDevMode ? [{ debugName: "message", alias: 'idsTooltip', transform: coerceStringAttribute }] : [{ alias: 'idsTooltip', transform: coerceStringAttribute }]));
318
+ this.position = input(this._defaultConfig.position, ...(ngDevMode ? [{ debugName: "position", alias: 'idsTooltipPosition' }] : [{ alias: 'idsTooltipPosition' }]));
319
+ this.size = input(this._defaultConfig.size, ...(ngDevMode ? [{ debugName: "size", alias: 'idsTooltipSize' }] : [{ alias: 'idsTooltipSize' }]));
320
+ this.variant = input(this._defaultConfig.variant, ...(ngDevMode ? [{ debugName: "variant", alias: 'idsTooltipVariant' }] : [{ alias: 'idsTooltipVariant' }]));
321
+ this.showDelay = input(this._defaultConfig.showDelay, ...(ngDevMode ? [{ debugName: "showDelay", alias: 'idsTooltipShowDelay' }] : [{ alias: 'idsTooltipShowDelay' }]));
322
+ this.hideDelay = input(this._defaultConfig.hideDelay, ...(ngDevMode ? [{ debugName: "hideDelay", alias: 'idsTooltipHideDelay' }] : [{ alias: 'idsTooltipHideDelay' }]));
323
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'idsTooltipDisabled' }] : [{ alias: 'idsTooltipDisabled' }]));
324
+ this.touchGestures = input('auto', ...(ngDevMode ? [{ debugName: "touchGestures", alias: 'idsTooltipTouchGestures' }] : [{ alias: 'idsTooltipTouchGestures' }]));
325
+ this.textAlign = input('auto', ...(ngDevMode ? [{ debugName: "textAlign", alias: 'idsTooltipTextAlign' }] : [{ alias: 'idsTooltipTextAlign' }]));
326
+ this.tooltipClass = input(undefined, ...(ngDevMode ? [{ debugName: "tooltipClass", alias: 'idsTooltipClass' }] : [{ alias: 'idsTooltipClass' }]));
327
+ this.showPointer = input(this._defaultConfig.showPointer, ...(ngDevMode ? [{ debugName: "showPointer", alias: 'idsTooltipShowPointer' }] : [{ alias: 'idsTooltipShowPointer' }]));
328
+ this._hostClasses = computed(() => this._getHostClasses([]), ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
329
+ this._tooltipClassEffect = effect(() => {
330
+ this._setTooltipInputs(this.message(), this._currentPosition() ?? this.position(), this.size(), this.variant(), this.textAlign(), this.hideDelay(), this.tooltipClass(), this.showPointer());
331
+ }, ...(ngDevMode ? [{ debugName: "_tooltipClassEffect" }] : []));
332
+ }
333
+ get _hostName() {
334
+ return 'tooltip-trigger';
335
+ }
336
+ ngAfterViewInit() {
337
+ this._setupPointerEnterEventsIfNeeded();
338
+ this._focusMonitor
339
+ .monitor(this._elementRef)
340
+ .pipe(takeUntilDestroyed(this._destroyRef))
341
+ .subscribe((origin) => {
342
+ if (!origin) {
343
+ this._ngZone.run(() => this.hide(0));
344
+ }
345
+ else if (origin === 'keyboard') {
346
+ this._ngZone.run(() => this.show());
347
+ }
348
+ });
349
+ }
350
+ show() {
351
+ if (this.disabled() || !this.message() || this._tooltipInstance) {
352
+ this._tooltipInstance?.abortHide();
353
+ return;
354
+ }
355
+ const overlayRef = this._createOverlay();
356
+ this._portal =
357
+ this._portal || new ComponentPortal(IdsTooltipComponent, this._viewContainerRef);
358
+ this._componentRef = overlayRef.attach(this._portal);
359
+ this._tooltipInstance = this._componentRef.instance;
360
+ const instance = this._tooltipInstance;
361
+ instance.triggerElement = this._elementRef.nativeElement;
362
+ this._setTooltipInputs(this.message(), this._currentPosition() ?? this.position(), this.size(), this.variant(), this.textAlign(), this.hideDelay(), this.tooltipClass(), this.showPointer());
363
+ instance
364
+ .afterHidden()
365
+ .pipe(takeUntilDestroyed(this._destroyRef))
366
+ .subscribe(() => {
367
+ this._detach();
368
+ });
369
+ }
370
+ hide(delay = this.hideDelay()) {
371
+ if (this._showTimeout) {
372
+ clearTimeout(this._showTimeout);
373
+ this._showTimeout = undefined;
374
+ return;
375
+ }
376
+ const instance = this._tooltipInstance;
377
+ if (instance?.isHideTimerTicking) {
378
+ return;
379
+ }
380
+ if (instance) {
381
+ instance.hide(delay);
382
+ }
383
+ }
384
+ toggle() {
385
+ this._tooltipInstance ? this.hide() : this.show();
386
+ }
387
+ _createOverlay() {
388
+ if (this._overlayRef) {
389
+ this._detach();
390
+ }
391
+ const scrollableAncestors = this._scrollDispatcher.getAncestorScrollContainers(this._elementRef);
392
+ const strategy = this._overlay
393
+ .position()
394
+ .flexibleConnectedTo(this._elementRef)
395
+ .withFlexibleDimensions(false)
396
+ .withViewportMargin(this._viewportMargin)
397
+ .withScrollableContainers(scrollableAncestors);
398
+ strategy.positionChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe((change) => {
399
+ this._updateCurrentPositionClass(change.connectionPair);
400
+ if (change.scrollableViewProperties.isOverlayClipped && this._tooltipInstance) {
401
+ this._ngZone.run(() => this.hide(0));
402
+ }
403
+ });
404
+ this._overlayRef = this._overlay.create({
405
+ positionStrategy: strategy,
406
+ panelClass: 'ids-tooltip-panel',
407
+ scrollStrategy: this._overlay.scrollStrategies.reposition({ scrollThrottle: this._defaultConfig.scrollDebounceTime }),
408
+ });
409
+ this._updatePosition(this._overlayRef);
410
+ this._overlayRef
411
+ .detachments()
412
+ .pipe(takeUntilDestroyed(this._destroyRef))
413
+ .subscribe(() => this._detach());
414
+ this._overlayRef
415
+ .outsidePointerEvents()
416
+ .pipe(takeUntilDestroyed(this._destroyRef))
417
+ .subscribe(() => this._tooltipInstance?.hide(0));
418
+ this._overlayRef
419
+ .keydownEvents()
420
+ .pipe(takeUntilDestroyed(this._destroyRef))
421
+ .subscribe((event) => {
422
+ if (this._tooltipInstance && event.key === 'Escape' && !hasModifierKey(event)) {
423
+ event.preventDefault();
424
+ event.stopPropagation();
425
+ this._ngZone.run(() => this.hide(0));
426
+ }
427
+ });
428
+ return this._overlayRef;
429
+ }
430
+ _detach() {
431
+ if (this._overlayRef && this._overlayRef.hasAttached()) {
432
+ this._overlayRef.detach();
433
+ }
434
+ this._componentRef?.destroy();
435
+ this._tooltipInstance = null;
436
+ }
437
+ _updatePosition(overlayRef) {
438
+ const position = overlayRef.getConfig().positionStrategy;
439
+ setTooltipFlexibleConnectedPositionStrategy(position, this.position());
440
+ }
441
+ _updateCurrentPositionClass(connectionPair) {
442
+ const newPosition = connectedPositionPairToTooltipPosition(connectionPair);
443
+ if (newPosition !== this._currentPosition()) {
444
+ const overlayRef = this._overlayRef;
445
+ if (overlayRef) {
446
+ const positionClassPrefix = 'is-tooltip-panel-position-';
447
+ overlayRef.removePanelClass(positionClassPrefix + this._currentPosition());
448
+ overlayRef.addPanelClass(positionClassPrefix + newPosition);
449
+ }
450
+ this._currentPosition.set(newPosition);
451
+ }
452
+ }
453
+ _setTooltipInputs(message, position, size, variant, textAlign, hideDelay, tooltipClass, showPointer) {
454
+ if (this._tooltipInstance) {
455
+ this._componentRef?.setInput('message', message);
456
+ this._componentRef?.setInput('position', position);
457
+ this._componentRef?.setInput('size', size);
458
+ this._componentRef?.setInput('variant', variant);
459
+ this._componentRef?.setInput('textAlign', textAlign);
460
+ this._componentRef?.setInput('mouseLeaveHideDelay', hideDelay);
461
+ this._componentRef?.setInput('tooltipClass', tooltipClass);
462
+ this._componentRef?.setInput('showPointer', showPointer);
463
+ }
464
+ }
465
+ _setupPointerEnterEventsIfNeeded() {
466
+ if (!this.message() || this._passiveListeners.length) {
467
+ return;
468
+ }
469
+ if (this._platformSupportsMouseEvents()) {
470
+ this._passiveListeners.push([
471
+ 'mouseenter',
472
+ () => {
473
+ this._setupPointerExitEventsIfNeeded();
474
+ this._showTimeout = setTimeout(() => {
475
+ this._showTimeout = undefined;
476
+ this.show();
477
+ }, this.showDelay());
478
+ },
479
+ ]);
480
+ }
481
+ else if (this.touchGestures() !== 'off') {
482
+ this._disableNativeGesturesIfNecessary();
483
+ this._passiveListeners.push([
484
+ 'touchstart',
485
+ () => {
486
+ this._setupPointerExitEventsIfNeeded();
487
+ clearTimeout(this._touchstartTimeout);
488
+ this._touchstartTimeout = setTimeout(() => this.show(), this._defaultConfig.touchLongPressShowDelay);
489
+ },
490
+ ]);
491
+ }
492
+ this._addListeners(this._passiveListeners);
493
+ }
494
+ _wheelListener(event) {
495
+ if (this._tooltipInstance) {
496
+ const elementUnderPointer = this._document.elementFromPoint(event.clientX, event.clientY);
497
+ const element = this._elementRef.nativeElement;
498
+ if (elementUnderPointer !== element && !element.contains(elementUnderPointer)) {
499
+ this.hide();
500
+ }
501
+ }
502
+ }
503
+ _setupPointerExitEventsIfNeeded() {
504
+ if (this._pointerExitEventsInitialized) {
505
+ return;
506
+ }
507
+ this._pointerExitEventsInitialized = true;
508
+ const exitListeners = [];
509
+ if (this._platformSupportsMouseEvents()) {
510
+ exitListeners.push([
511
+ 'mouseleave',
512
+ () => {
513
+ this.hide();
514
+ },
515
+ ], [
516
+ 'wheel',
517
+ (event) => {
518
+ this._wheelListener(event);
519
+ },
520
+ ]);
521
+ }
522
+ else if (this.touchGestures() !== 'off') {
523
+ this._disableNativeGesturesIfNecessary();
524
+ const touchendListener = () => {
525
+ clearTimeout(this._touchstartTimeout);
526
+ this.hide(this._defaultConfig.touchendHideDelay);
527
+ };
528
+ exitListeners.push([
529
+ 'touchend',
530
+ touchendListener,
531
+ ], [
532
+ 'touchcancel',
533
+ touchendListener,
534
+ ]);
535
+ }
536
+ this._addListeners(exitListeners);
537
+ this._passiveListeners.push(...exitListeners);
538
+ }
539
+ _addListeners(listeners) {
540
+ listeners.forEach(([event, listener,]) => {
541
+ this._elementRef.nativeElement.addEventListener(event, listener, passiveListenerOptions);
542
+ });
543
+ }
544
+ _disableNativeGesturesIfNecessary() {
545
+ const gestures = this.touchGestures();
546
+ if (gestures !== 'off') {
547
+ const element = this._elementRef.nativeElement;
548
+ const style = element.style;
549
+ if (gestures === 'on' || (element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA')) {
550
+ style.userSelect = 'none';
551
+ }
552
+ style.touchAction = 'none';
553
+ }
554
+ }
555
+ _platformSupportsMouseEvents() {
556
+ return !this._platform.IOS && !this._platform.ANDROID;
557
+ }
558
+ ngOnDestroy() {
559
+ const nativeElement = this._elementRef.nativeElement;
560
+ clearTimeout(this._touchstartTimeout);
561
+ if (this._componentRef) {
562
+ this._tooltipInstance = null;
563
+ }
564
+ this._passiveListeners.forEach(([event, listener,]) => {
565
+ nativeElement.removeEventListener(event, listener, passiveListenerOptions);
566
+ });
567
+ this._passiveListeners.length = 0;
568
+ this._focusMonitor.stopMonitoring(nativeElement);
569
+ }
570
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsTooltipDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
571
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.7", type: IdsTooltipDirective, isStandalone: true, selector: "[idsTooltip]", inputs: { message: { classPropertyName: "message", publicName: "idsTooltip", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "idsTooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "idsTooltipSize", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "idsTooltipVariant", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "idsTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "idsTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "idsTooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, touchGestures: { classPropertyName: "touchGestures", publicName: "idsTooltipTouchGestures", isSignal: true, isRequired: false, transformFunction: null }, textAlign: { classPropertyName: "textAlign", publicName: "idsTooltipTextAlign", isSignal: true, isRequired: false, transformFunction: null }, tooltipClass: { classPropertyName: "tooltipClass", publicName: "idsTooltipClass", isSignal: true, isRequired: false, transformFunction: null }, showPointer: { classPropertyName: "showPointer", publicName: "idsTooltipShowPointer", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
572
+ }
573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: IdsTooltipDirective, decorators: [{
574
+ type: Directive,
575
+ args: [{
576
+ selector: '[idsTooltip]',
577
+ standalone: true,
578
+ }]
579
+ }] });
580
+
581
+ /**
582
+ * Generated bundle index. Do not edit.
583
+ */
584
+
585
+ export { IDS_TOOLTIP_DEFAULT_CONFIG, IDS_TOOLTIP_DEFAULT_CONFIG_FACTORY, IdsTooltipDirective, IdsTooltipPosition, IdsTooltipVariant };
586
+ //# sourceMappingURL=i-cell-ids-angular-tooltip.mjs.map