@progress/kendo-angular-tooltip 11.1.0-develop.8 → 11.1.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.
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { InjectionToken, Injectable, forwardRef, Directive, Input, EventEmitter, Component, HostBinding, Output, isDevMode, Optional, Inject, ContentChild, ElementRef, NgModule } from '@angular/core';
6
+ import { InjectionToken, Injectable, forwardRef, Directive, Input, EventEmitter, Component, HostBinding, Output, isDevMode, Optional, Inject, ViewChild, ContentChild, ElementRef, NgModule } from '@angular/core';
7
7
  import { filter, take, auditTime } from 'rxjs/operators';
8
8
  import { Subscription, fromEvent, BehaviorSubject, Subject, combineLatest } from 'rxjs';
9
9
  import * as i1$1 from '@progress/kendo-angular-popup';
@@ -11,12 +11,12 @@ import { PopupModule } from '@progress/kendo-angular-popup';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import * as i1 from '@progress/kendo-angular-l10n';
13
13
  import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
14
+ import { focusableSelector, isDocumentAvailable, Keys, PreventableEvent, closest, hasObservers } from '@progress/kendo-angular-common';
14
15
  import { xIcon } from '@progress/kendo-svg-icons';
15
16
  import * as i2 from '@progress/kendo-angular-icons';
16
17
  import { IconsModule } from '@progress/kendo-angular-icons';
17
18
  import * as i2$1 from '@angular/common';
18
19
  import { CommonModule } from '@angular/common';
19
- import { isDocumentAvailable, Keys, PreventableEvent, closest, hasObservers } from '@progress/kendo-angular-common';
20
20
 
21
21
  /**
22
22
  * @hidden
@@ -25,8 +25,8 @@ const packageMetadata = {
25
25
  name: '@progress/kendo-angular-tooltip',
26
26
  productName: 'Kendo UI for Angular',
27
27
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
28
- publishDate: 1674850457,
29
- version: '11.1.0-develop.8',
28
+ publishDate: 1675250300,
29
+ version: '11.1.0',
30
30
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
31
31
  };
32
32
 
@@ -81,8 +81,23 @@ let idx = 0;
81
81
  /**
82
82
  * @hidden
83
83
  */
84
- const getId = (prefix) => {
85
- return `${prefix}-${++idx}`;
84
+ let popoverTitleIdx = 0;
85
+ /**
86
+ * @hidden
87
+ */
88
+ let popoverBodyIdx = 0;
89
+ /**
90
+ * @hidden
91
+ */
92
+ const getId = (prefix, idSource) => {
93
+ switch (idSource) {
94
+ case 'popoverTitle':
95
+ return `${prefix}-${++popoverTitleIdx}`;
96
+ case 'popoverBody':
97
+ return `${prefix}-${++popoverBodyIdx}`;
98
+ default:
99
+ return `${prefix}-${++idx}`;
100
+ }
86
101
  };
87
102
  /**
88
103
  * @hidden
@@ -192,6 +207,21 @@ function getCenterOffset(item, dir, size) {
192
207
  function containsItem(collection, item) {
193
208
  return collection.indexOf(item) !== -1;
194
209
  }
210
+ /**
211
+ * @hidden
212
+ */
213
+ function getAllFocusableChildren(parent) {
214
+ return parent.querySelectorAll(focusableSelector);
215
+ }
216
+ /**
217
+ * @hidden
218
+ */
219
+ function getFirstAndLastFocusable(parent) {
220
+ const all = getAllFocusableChildren(parent);
221
+ const firstFocusable = all.length > 0 ? all[0] : parent;
222
+ const lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
223
+ return [firstFocusable, lastFocusable];
224
+ }
195
225
 
196
226
  /**
197
227
  * @hidden
@@ -968,6 +998,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
968
998
  type: Optional
969
999
  }] }]; } });
970
1000
 
1001
+ /* eslint-disable @typescript-eslint/no-explicit-any */
971
1002
  /**
972
1003
  * Represents the [Kendo UI Popover component for Angular]({% slug overview_popover %}).
973
1004
  * Used to display additional information that is related to a target element.
@@ -982,8 +1013,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
982
1013
  * ```
983
1014
  */
984
1015
  class PopoverComponent {
985
- constructor(localization) {
1016
+ constructor(localization, renderer, element, zone) {
986
1017
  this.localization = localization;
1018
+ this.renderer = renderer;
1019
+ this.element = element;
1020
+ this.zone = zone;
987
1021
  /**
988
1022
  * Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
989
1023
  *
@@ -1034,6 +1068,10 @@ class PopoverComponent {
1034
1068
  * Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
1035
1069
  */
1036
1070
  this.hidden = new EventEmitter();
1071
+ /**
1072
+ * @hidden
1073
+ */
1074
+ this.closeOnKeyDown = new EventEmitter();
1037
1075
  /**
1038
1076
  * @hidden
1039
1077
  */
@@ -1042,11 +1080,12 @@ class PopoverComponent {
1042
1080
  * @hidden
1043
1081
  */
1044
1082
  this._height = 'auto';
1045
- this._offset = 6;
1046
- this.subs = new Subscription();
1047
1083
  /**
1048
1084
  * @hidden
1049
1085
  */
1086
+ this.popoverId = '';
1087
+ this._offset = 6;
1088
+ this.subs = new Subscription();
1050
1089
  this._templateData = () => null;
1051
1090
  validatePackage(packageMetadata);
1052
1091
  }
@@ -1110,9 +1149,21 @@ class PopoverComponent {
1110
1149
  return !this.visible;
1111
1150
  }
1112
1151
  ngOnInit() {
1113
- this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
1114
- this.direction = rtl ? 'rtl' : 'ltr';
1115
- }));
1152
+ this.popoverId = getId('k-popover');
1153
+ this.subs.add(this.localization.changes.subscribe(({ rtl }) => { this.direction = rtl ? 'rtl' : 'ltr'; }));
1154
+ this.subs.add(this.renderer.listen(this.element.nativeElement, 'keydown', event => this.onKeyDown(event)));
1155
+ }
1156
+ ngAfterViewInit() {
1157
+ this.zone.onStable.pipe(take(1)).subscribe(() => {
1158
+ if (this.visible) {
1159
+ const wrapper = this.popoverWrapper.nativeElement;
1160
+ const focusablePopoverChildren = getAllFocusableChildren(wrapper);
1161
+ if (focusablePopoverChildren.length > 0) {
1162
+ focusablePopoverChildren[0].focus();
1163
+ }
1164
+ this.setAriaAttributes(wrapper, focusablePopoverChildren);
1165
+ }
1166
+ });
1116
1167
  }
1117
1168
  ngOnDestroy() {
1118
1169
  this.subs.unsubscribe();
@@ -1129,16 +1180,65 @@ class PopoverComponent {
1129
1180
  default: return { 'k-callout-s': true };
1130
1181
  }
1131
1182
  }
1183
+ /**
1184
+ * @hidden
1185
+ */
1186
+ onKeyDown(event) {
1187
+ const keyCode = event.keyCode;
1188
+ const target = event.target;
1189
+ if (keyCode === Keys.Tab) {
1190
+ this.keepFocusWithinComponent(target, event);
1191
+ }
1192
+ if (keyCode === Keys.Escape) {
1193
+ this.closeOnKeyDown.emit();
1194
+ }
1195
+ }
1196
+ keepFocusWithinComponent(target, event) {
1197
+ const wrapper = this.popoverWrapper.nativeElement;
1198
+ const [firstFocusable, lastFocusable] = getFirstAndLastFocusable(wrapper);
1199
+ const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
1200
+ const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
1201
+ if (tabAfterLastFocusable) {
1202
+ event.preventDefault();
1203
+ firstFocusable.focus();
1204
+ }
1205
+ if (shiftTabAfterFirstFocusable) {
1206
+ event.preventDefault();
1207
+ lastFocusable.focus();
1208
+ }
1209
+ }
1210
+ setAriaAttributes(wrapper, focusablePopoverChildren) {
1211
+ if (this.titleTemplate) {
1212
+ const titleRef = this.titleTemplateWrapper.nativeElement;
1213
+ const focusableHeaderChildren = getAllFocusableChildren(titleRef).length > 0;
1214
+ if (focusableHeaderChildren) {
1215
+ const headerId = getId('k-popover-header', 'popoverTitle');
1216
+ this.renderer.setAttribute(titleRef, 'id', headerId);
1217
+ this.renderer.setAttribute(wrapper, 'aria-labelledby', headerId);
1218
+ }
1219
+ }
1220
+ if (this.bodyTemplate) {
1221
+ const bodyRef = this.bodyTemplateWrapper.nativeElement;
1222
+ const focusableBodyChildren = getAllFocusableChildren(bodyRef).length > 0;
1223
+ if (focusableBodyChildren) {
1224
+ const bodyId = getId('k-popover-body', 'popoverBody');
1225
+ this.renderer.setAttribute(bodyRef, 'id', bodyId);
1226
+ this.renderer.setAttribute(wrapper, 'aria-describedby', bodyId);
1227
+ }
1228
+ }
1229
+ this.renderer.setAttribute(wrapper, 'id', this.popoverId);
1230
+ this.renderer.setAttribute(wrapper, 'role', focusablePopoverChildren.length > 0 ? 'dialog' : 'tooltip');
1231
+ }
1132
1232
  }
1133
- PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PopoverComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1134
- PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PopoverComponent, selector: "kendo-popover", inputs: { position: "position", offset: "offset", width: "width", height: "height", title: "title", subtitle: "subtitle", body: "body", callout: "callout", animation: "animation", templateData: "templateData" }, outputs: { show: "show", shown: "shown", hide: "hide", hidden: "hidden" }, host: { properties: { "attr.dir": "this.direction", "class.k-hidden": "this.isHidden", "attr.aria-hidden": "this.hasAttributeHidden", "style.width": "this._width", "style.height": "this._height" } }, providers: [
1233
+ PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PopoverComponent, deps: [{ token: i1.LocalizationService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1234
+ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PopoverComponent, selector: "kendo-popover", inputs: { position: "position", offset: "offset", width: "width", height: "height", title: "title", subtitle: "subtitle", body: "body", callout: "callout", animation: "animation", templateData: "templateData" }, outputs: { show: "show", shown: "shown", hide: "hide", hidden: "hidden", closeOnKeyDown: "closeOnKeyDown" }, host: { properties: { "attr.dir": "this.direction", "class.k-hidden": "this.isHidden", "attr.aria-hidden": "this.hasAttributeHidden", "style.width": "this._width", "style.height": "this._height" } }, providers: [
1135
1235
  LocalizationService,
1136
1236
  {
1137
1237
  provide: L10N_PREFIX,
1138
1238
  useValue: 'kendo.popover'
1139
1239
  }
1140
- ], queries: [{ propertyName: "titleTemplate", first: true, predicate: PopoverTitleTemplateDirective, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: PopoverBodyTemplateDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: PopoverActionsTemplateDirective, descendants: true }], ngImport: i0, template: `
1141
- <div *ngIf="visible" role="tooltip" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1240
+ ], queries: [{ propertyName: "titleTemplate", first: true, predicate: PopoverTitleTemplateDirective, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: PopoverBodyTemplateDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: PopoverActionsTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "popoverWrapper", first: true, predicate: ["popoverWrapper"], descendants: true }, { propertyName: "titleTemplateWrapper", first: true, predicate: ["titleTemplateWrapper"], descendants: true }, { propertyName: "bodyTemplateWrapper", first: true, predicate: ["bodyTemplateWrapper"], descendants: true }], ngImport: i0, template: `
1241
+ <div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1142
1242
  <div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
1143
1243
 
1144
1244
  <div class="k-popover-inner" *ngIf="callout; else noCallout">
@@ -1146,7 +1246,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
1146
1246
  </div>
1147
1247
 
1148
1248
  <ng-template #noCallout>
1149
- <div *ngIf="titleTemplate || title" class="k-popover-header">
1249
+ <div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
1150
1250
  <ng-template *ngIf="titleTemplate"
1151
1251
  [ngTemplateOutlet]="titleTemplate?.templateRef"
1152
1252
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1156,7 +1256,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
1156
1256
  </ng-container>
1157
1257
  </div>
1158
1258
 
1159
- <div *ngIf="bodyTemplate || body" class="k-popover-body">
1259
+ <div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
1160
1260
  <ng-template *ngIf="bodyTemplate"
1161
1261
  [ngTemplateOutlet]="bodyTemplate?.templateRef"
1162
1262
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1187,7 +1287,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1187
1287
  }
1188
1288
  ],
1189
1289
  template: `
1190
- <div *ngIf="visible" role="tooltip" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1290
+ <div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1191
1291
  <div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
1192
1292
 
1193
1293
  <div class="k-popover-inner" *ngIf="callout; else noCallout">
@@ -1195,7 +1295,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1195
1295
  </div>
1196
1296
 
1197
1297
  <ng-template #noCallout>
1198
- <div *ngIf="titleTemplate || title" class="k-popover-header">
1298
+ <div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
1199
1299
  <ng-template *ngIf="titleTemplate"
1200
1300
  [ngTemplateOutlet]="titleTemplate?.templateRef"
1201
1301
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1205,7 +1305,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1205
1305
  </ng-container>
1206
1306
  </div>
1207
1307
 
1208
- <div *ngIf="bodyTemplate || body" class="k-popover-body">
1308
+ <div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
1209
1309
  <ng-template *ngIf="bodyTemplate"
1210
1310
  [ngTemplateOutlet]="bodyTemplate?.templateRef"
1211
1311
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1225,7 +1325,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1225
1325
  </div>
1226
1326
  `
1227
1327
  }]
1228
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { position: [{
1328
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { position: [{
1229
1329
  type: Input
1230
1330
  }], offset: [{
1231
1331
  type: Input
@@ -1262,6 +1362,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1262
1362
  type: Output
1263
1363
  }], hidden: [{
1264
1364
  type: Output
1365
+ }], closeOnKeyDown: [{
1366
+ type: Output
1367
+ }], popoverWrapper: [{
1368
+ type: ViewChild,
1369
+ args: ['popoverWrapper']
1370
+ }], titleTemplateWrapper: [{
1371
+ type: ViewChild,
1372
+ args: ['titleTemplateWrapper']
1373
+ }], bodyTemplateWrapper: [{
1374
+ type: ViewChild,
1375
+ args: ['bodyTemplateWrapper']
1265
1376
  }], titleTemplate: [{
1266
1377
  type: ContentChild,
1267
1378
  args: [PopoverTitleTemplateDirective, { static: false }]
@@ -1340,6 +1451,7 @@ class PopoverHiddenEvent {
1340
1451
  }
1341
1452
  }
1342
1453
 
1454
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1343
1455
  const validShowOptions = ['hover', 'click', 'none', 'focus'];
1344
1456
  /**
1345
1457
  * @hidden
@@ -1349,6 +1461,10 @@ class PopoverDirectivesBase {
1349
1461
  this.ngZone = ngZone;
1350
1462
  this.popupService = popupService;
1351
1463
  this.renderer = renderer;
1464
+ /**
1465
+ * @hidden
1466
+ */
1467
+ this.anchor = null;
1352
1468
  this.subs = new Subscription();
1353
1469
  this._showOn = 'click';
1354
1470
  }
@@ -1398,14 +1514,14 @@ class PopoverDirectivesBase {
1398
1514
  this.ngZone.runOutsideAngular(() => {
1399
1515
  switch (this.showOn) {
1400
1516
  case 'hover':
1401
- this.subscribeToEvents([{
1517
+ this.subscribeToShowEvents([{
1402
1518
  name: 'mouseenter', handler: this.mouseenterHandler
1403
1519
  }, {
1404
1520
  name: 'mouseleave', handler: this.mouseleaveHandler
1405
1521
  }]);
1406
1522
  break;
1407
1523
  case 'focus':
1408
- this.subscribeToEvents([{
1524
+ this.subscribeToShowEvents([{
1409
1525
  name: 'focus', handler: this.focusHandler
1410
1526
  }, {
1411
1527
  name: 'blur', handler: this.blurHandler
@@ -1421,6 +1537,7 @@ class PopoverDirectivesBase {
1421
1537
  }
1422
1538
  ngOnDestroy() {
1423
1539
  this.closePopup();
1540
+ this.subs.unsubscribe();
1424
1541
  if (this.disposeHoverOverListener) {
1425
1542
  this.disposeHoverOverListener();
1426
1543
  }
@@ -1436,9 +1553,6 @@ class PopoverDirectivesBase {
1436
1553
  if (this._hideSub) {
1437
1554
  this._hideSub.unsubscribe();
1438
1555
  }
1439
- if (this.subs) {
1440
- this.subs.unsubscribe();
1441
- }
1442
1556
  if (this._popupOpenSub) {
1443
1557
  this._popupOpenSub.unsubscribe();
1444
1558
  }
@@ -1457,6 +1571,9 @@ class PopoverDirectivesBase {
1457
1571
  */
1458
1572
  closePopup() {
1459
1573
  if (this.popupRef) {
1574
+ if (this.anchor) {
1575
+ this.renderer.removeAttribute(this.anchor, 'aria-describedby');
1576
+ }
1460
1577
  this.popupRef.close();
1461
1578
  this.popupRef = null;
1462
1579
  if (this.disposePopupHoverOutListener) {
@@ -1474,15 +1591,15 @@ class PopoverDirectivesBase {
1474
1591
  * @hidden
1475
1592
  */
1476
1593
  openPopup(anchor) {
1477
- const _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1478
- const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(_anchor);
1594
+ this.anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1595
+ const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(this.anchor);
1479
1596
  const alignSettings = align(popoverComp.position, popoverComp.offset);
1480
1597
  const anchorAlign = alignSettings.anchorAlign;
1481
1598
  const popupAlign = alignSettings.popupAlign;
1482
1599
  const popupMargin = alignSettings.popupMargin;
1483
1600
  const _animation = popoverComp.animation;
1484
1601
  this.popupRef = this.popupService.open({
1485
- anchor: { nativeElement: _anchor },
1602
+ anchor: { nativeElement: this.anchor },
1486
1603
  animate: _animation,
1487
1604
  content: PopoverComponent,
1488
1605
  popupAlign,
@@ -1491,9 +1608,18 @@ class PopoverDirectivesBase {
1491
1608
  popupClass: 'k-popup-transparent',
1492
1609
  collision: { horizontal: 'fit', vertical: 'fit' }
1493
1610
  });
1494
- this.applySettings(this.popupRef.content, popoverComp, anchor);
1611
+ const popupInstance = this.popupRef.content.instance;
1612
+ if (anchor) {
1613
+ this.subs.add(this.renderer.listen(this.anchor, 'keydown', event => this.onKeyDown(event)));
1614
+ this.renderer.setAttribute(this.anchor, 'aria-describedby', popupInstance.popoverId);
1615
+ }
1616
+ this.subs.add(popupInstance.closeOnKeyDown.subscribe(() => {
1617
+ this.anchor.focus();
1618
+ this.hide();
1619
+ }));
1620
+ this.applySettings(this.popupRef.content, popoverComp);
1495
1621
  this.monitorPopup();
1496
- this.initializeCompletionEvents(popoverComp, _anchor);
1622
+ this.initializeCompletionEvents(popoverComp, this.anchor);
1497
1623
  }
1498
1624
  /**
1499
1625
  * @hidden
@@ -1532,11 +1658,10 @@ class PopoverDirectivesBase {
1532
1658
  });
1533
1659
  }
1534
1660
  }
1535
- applySettings(contentComponent, popover, anchor) {
1661
+ applySettings(contentComponent, popover) {
1536
1662
  const content = contentComponent.instance;
1537
- const _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1538
1663
  content.visible = true;
1539
- content.anchor = _anchor;
1664
+ content.anchor = this.anchor;
1540
1665
  content.position = popover.position;
1541
1666
  content.offset = popover.offset;
1542
1667
  content.width = popover.width;
@@ -1545,7 +1670,7 @@ class PopoverDirectivesBase {
1545
1670
  content.body = popover.body;
1546
1671
  content.callout = popover.callout;
1547
1672
  content.animation = popover.animation;
1548
- content.contextData = popover.templateData(_anchor);
1673
+ content.contextData = popover.templateData(this.anchor);
1549
1674
  content.titleTemplate = popover.titleTemplate;
1550
1675
  content.bodyTemplate = popover.bodyTemplate;
1551
1676
  content.actionsTemplate = popover.actionsTemplate;
@@ -1569,6 +1694,12 @@ class PopoverDirectivesBase {
1569
1694
  }
1570
1695
  return eventArgs;
1571
1696
  }
1697
+ onKeyDown(event) {
1698
+ const keyCode = event.keyCode;
1699
+ if (keyCode === Keys.Escape) {
1700
+ this.hide();
1701
+ }
1702
+ }
1572
1703
  initializeCompletionEvents(popoverComp, _anchor) {
1573
1704
  if (this.shouldEmitCompletionEvents('shown', popoverComp)) {
1574
1705
  this.popupRef.popupOpen.subscribe(() => {
@@ -1671,6 +1802,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1671
1802
  type: Injectable
1672
1803
  }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1673
1804
 
1805
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1674
1806
  /**
1675
1807
  * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
1676
1808
  * It is used to filter and target multiple elements, which should display a popover on interaction.
@@ -1779,7 +1911,7 @@ class PopoverContainerDirective extends PopoverDirectivesBase {
1779
1911
  this.clickHandler(filterElement, e);
1780
1912
  });
1781
1913
  }
1782
- subscribeToEvents(arr) {
1914
+ subscribeToShowEvents(arr) {
1783
1915
  const filteredElements = Array.from(document.querySelectorAll(this.filter));
1784
1916
  filteredElements.forEach((el) => {
1785
1917
  this.subs.add(this.renderer.listen(el, arr[0].name, () => {
@@ -1836,6 +1968,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1836
1968
  type: Input
1837
1969
  }] } });
1838
1970
 
1971
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1839
1972
  /**
1840
1973
  * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
1841
1974
  * It is used to target an element, which should display a popover on interaction.
@@ -1918,12 +2051,13 @@ class PopoverAnchorDirective extends PopoverDirectivesBase {
1918
2051
  this.show();
1919
2052
  }
1920
2053
  }
1921
- subscribeToEvents(arr) {
1922
- this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, () => {
1923
- this.popoverService.emitAnchorState(true, this.hostEl.nativeElement);
2054
+ subscribeToShowEvents(arr) {
2055
+ const hostEl = this.hostEl.nativeElement;
2056
+ this.subs.add(this.renderer.listen(hostEl, arr[0].name, () => {
2057
+ this.popoverService.emitAnchorState(true, hostEl);
1924
2058
  arr[0].handler();
1925
2059
  }));
1926
- this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, (e) => {
2060
+ this.subs.add(this.renderer.listen(hostEl, arr[1].name, (e) => {
1927
2061
  this.popoverService.emitAnchorState(false, null);
1928
2062
  arr[1].handler({ domEvent: e });
1929
2063
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-tooltip",
3
- "version": "11.1.0-develop.8",
3
+ "version": "11.1.0",
4
4
  "description": "Kendo UI Tooltip for Angular - A highly customizable and easily themeable tooltip from the creators developers trust for professional Angular components.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -25,15 +25,15 @@
25
25
  "@angular/core": "13 - 15",
26
26
  "@angular/platform-browser": "13 - 15",
27
27
  "@progress/kendo-licensing": "^1.0.2",
28
- "@progress/kendo-angular-common": "11.1.0-develop.8",
29
- "@progress/kendo-angular-l10n": "11.1.0-develop.8",
30
- "@progress/kendo-angular-popup": "11.1.0-develop.8",
31
- "@progress/kendo-angular-icons": "11.1.0-develop.8",
28
+ "@progress/kendo-angular-common": "11.1.0",
29
+ "@progress/kendo-angular-l10n": "11.1.0",
30
+ "@progress/kendo-angular-popup": "11.1.0",
31
+ "@progress/kendo-angular-icons": "11.1.0",
32
32
  "rxjs": "^6.5.3 || ^7.0.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "tslib": "^2.3.1",
36
- "@progress/kendo-angular-schematics": "11.1.0-develop.8"
36
+ "@progress/kendo-angular-schematics": "11.1.0"
37
37
  },
38
38
  "schematics": "./schematics/collection.json",
39
39
  "module": "fesm2015/progress-kendo-angular-tooltip.mjs",
@@ -31,7 +31,7 @@ export declare class PopoverAnchorDirective extends PopoverDirectivesBase {
31
31
  * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
32
32
  */
33
33
  toggle(): void;
34
- protected subscribeToEvents(arr: any[]): void;
34
+ protected subscribeToShowEvents(arr: any[]): void;
35
35
  protected subscribeClick(): void;
36
36
  protected mouseenterHandler: () => void;
37
37
  protected mouseleaveHandler: () => void;
@@ -51,7 +51,7 @@ export declare class PopoverContainerDirective extends PopoverDirectivesBase {
51
51
  protected mouseleaveHandler: (args: any) => void;
52
52
  protected focusHandler: (anchor: Element) => void;
53
53
  protected blurHandler: (args: any) => void;
54
- protected subscribeToEvents(arr: any[]): void;
54
+ protected subscribeToShowEvents(arr: any[]): void;
55
55
  private clickHandler;
56
56
  private controlVisibility;
57
57
  static ɵfac: i0.ɵɵFactoryDeclaration<PopoverContainerDirective, never>;
@@ -38,6 +38,10 @@ export declare abstract class PopoverDirectivesBase {
38
38
  */
39
39
  set showOn(value: PopoverShowOption);
40
40
  get showOn(): PopoverShowOption;
41
+ /**
42
+ * @hidden
43
+ */
44
+ private anchor;
41
45
  popupRef: PopupRef;
42
46
  protected disposeHoverOverListener: () => void;
43
47
  protected disposeHoverOutListener: () => void;
@@ -76,8 +80,8 @@ export declare abstract class PopoverDirectivesBase {
76
80
  * @hidden
77
81
  */
78
82
  protected monitorPopup(): void;
79
- protected applySettings(contentComponent: ComponentRef<PopoverComponent>, popover: PopoverComponent, anchor: Element | ElementRef): void;
80
- protected abstract subscribeToEvents(args?: any): void;
83
+ protected applySettings(contentComponent: ComponentRef<PopoverComponent>, popover: PopoverComponent): void;
84
+ protected abstract subscribeToShowEvents(args?: any): void;
81
85
  protected abstract subscribeClick(): void;
82
86
  protected abstract mouseenterHandler(args?: any): void;
83
87
  protected abstract mouseleaveHandler(args?: any): void;
@@ -87,6 +91,7 @@ export declare abstract class PopoverDirectivesBase {
87
91
  * @hidden
88
92
  */
89
93
  private initializeEvents;
94
+ private onKeyDown;
90
95
  private initializeCompletionEvents;
91
96
  private shouldEmitEvent;
92
97
  private shouldEmitCompletionEvents;
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { EventEmitter } from '@angular/core';
5
+ import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, Renderer2 } from '@angular/core';
6
6
  import { LocalizationService } from '@progress/kendo-angular-l10n';
7
7
  import { Position } from '../models/position.type';
8
8
  import { PopoverDataFn } from '../models/functions.model';
@@ -25,8 +25,11 @@ import * as i0 from "@angular/core";
25
25
  * </kendo-popover>
26
26
  * ```
27
27
  */
28
- export declare class PopoverComponent {
28
+ export declare class PopoverComponent implements OnInit, AfterViewInit, OnDestroy {
29
29
  private localization;
30
+ private renderer;
31
+ private element;
32
+ private zone;
30
33
  /**
31
34
  * @hidden
32
35
  */
@@ -137,6 +140,22 @@ export declare class PopoverComponent {
137
140
  * Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
138
141
  */
139
142
  hidden: EventEmitter<any>;
143
+ /**
144
+ * @hidden
145
+ */
146
+ closeOnKeyDown: EventEmitter<any>;
147
+ /**
148
+ * @hidden
149
+ */
150
+ popoverWrapper: ElementRef;
151
+ /**
152
+ * @hidden
153
+ */
154
+ titleTemplateWrapper: ElementRef;
155
+ /**
156
+ * @hidden
157
+ */
158
+ bodyTemplateWrapper: ElementRef;
140
159
  /**
141
160
  * @hidden
142
161
  */
@@ -161,10 +180,15 @@ export declare class PopoverComponent {
161
180
  * @hidden
162
181
  */
163
182
  _height: string;
183
+ /**
184
+ * @hidden
185
+ */
186
+ popoverId: string;
164
187
  private _offset;
165
188
  private subs;
166
- constructor(localization: LocalizationService);
189
+ constructor(localization: LocalizationService, renderer: Renderer2, element: ElementRef, zone: NgZone);
167
190
  ngOnInit(): void;
191
+ ngAfterViewInit(): void;
168
192
  ngOnDestroy(): void;
169
193
  /**
170
194
  * @hidden
@@ -173,7 +197,10 @@ export declare class PopoverComponent {
173
197
  /**
174
198
  * @hidden
175
199
  */
200
+ onKeyDown(event: any): void;
176
201
  private _templateData;
202
+ private keepFocusWithinComponent;
203
+ private setAriaAttributes;
177
204
  static ɵfac: i0.ɵɵFactoryDeclaration<PopoverComponent, never>;
178
- static ɵcmp: i0.ɵɵComponentDeclaration<PopoverComponent, "kendo-popover", never, { "position": "position"; "offset": "offset"; "width": "width"; "height": "height"; "title": "title"; "subtitle": "subtitle"; "body": "body"; "callout": "callout"; "animation": "animation"; "templateData": "templateData"; }, { "show": "show"; "shown": "shown"; "hide": "hide"; "hidden": "hidden"; }, ["titleTemplate", "bodyTemplate", "actionsTemplate"], never>;
205
+ static ɵcmp: i0.ɵɵComponentDeclaration<PopoverComponent, "kendo-popover", never, { "position": "position"; "offset": "offset"; "width": "width"; "height": "height"; "title": "title"; "subtitle": "subtitle"; "body": "body"; "callout": "callout"; "animation": "animation"; "templateData": "templateData"; }, { "show": "show"; "shown": "shown"; "hide": "hide"; "hidden": "hidden"; "closeOnKeyDown": "closeOnKeyDown"; }, ["titleTemplate", "bodyTemplate", "actionsTemplate"], never>;
179
206
  }
package/utils.d.ts CHANGED
@@ -7,7 +7,7 @@ import { Collision } from '@progress/kendo-angular-popup';
7
7
  /**
8
8
  * @hidden
9
9
  */
10
- export declare const getId: (prefix: string) => string;
10
+ export declare const getId: (prefix: string, idSource?: string) => string;
11
11
  /**
12
12
  * @hidden
13
13
  */
@@ -36,3 +36,11 @@ export declare function getCenterOffset(item: Element, dir: string, size: string
36
36
  * @hidden
37
37
  */
38
38
  export declare function containsItem(collection: any, item: any): boolean;
39
+ /**
40
+ * @hidden
41
+ */
42
+ export declare function getAllFocusableChildren(parent: any): Array<any>;
43
+ /**
44
+ * @hidden
45
+ */
46
+ export declare function getFirstAndLastFocusable(parent: any): Array<HTMLElement>;