@clr/angular 12.0.6 → 12.0.10

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.
@@ -12590,6 +12590,12 @@
12590
12590
  _this.focusOnClose();
12591
12591
  }
12592
12592
  }), this.signpostIdService.id.subscribe(function (idChange) { return (_this.ariaControl = idChange); }));
12593
+ this.addDefaultAriaLabel(this.el.nativeElement);
12594
+ };
12595
+ ClrSignpostTrigger.prototype.addDefaultAriaLabel = function (el) {
12596
+ if (!el.hasAttribute('aria-label')) {
12597
+ el.setAttribute('aria-label', this.commonStrings.keys.signpostToggle);
12598
+ }
12593
12599
  };
12594
12600
  ClrSignpostTrigger.prototype.focusOnClose = function () {
12595
12601
  if (!i1.isPlatformBrowser(this.platformId)) {
@@ -12619,7 +12625,6 @@
12619
12625
  selector: '[clrSignpostTrigger]',
12620
12626
  host: {
12621
12627
  class: 'signpost-trigger',
12622
- '[attr.aria-label]': 'commonStrings.keys.signpostToggle',
12623
12628
  '[attr.aria-expanded]': 'ariaExpanded',
12624
12629
  '[attr.aria-controls]': 'ariaControl',
12625
12630
  '[class.active]': 'isOpen',
@@ -17844,6 +17849,7 @@
17844
17849
  var _this = this;
17845
17850
  this.parentHost = parentHost;
17846
17851
  this.updateAnchor = false;
17852
+ this.recentlyOpened = false;
17847
17853
  this.popoverOptions = {};
17848
17854
  /*
17849
17855
  * Until https://github.com/angular/angular/issues/8785 is supported, we don't have any way to instantiate
@@ -17860,6 +17866,7 @@
17860
17866
  if (change) {
17861
17867
  _this.anchor();
17862
17868
  _this.attachESCListener();
17869
+ _this.setRecentlyOpened();
17863
17870
  }
17864
17871
  else {
17865
17872
  _this.release();
@@ -17869,6 +17876,7 @@
17869
17876
  if (this.toggleService.open) {
17870
17877
  this.anchor();
17871
17878
  this.attachESCListener();
17879
+ this.setRecentlyOpened();
17872
17880
  }
17873
17881
  }
17874
17882
  AbstractPopover.prototype.anchor = function () {
@@ -17934,7 +17942,7 @@
17934
17942
  this.ignoredElementClickListener = this.renderer.listen(this.ignoredElement, 'click', function (event) { return (_this.ignore = event); });
17935
17943
  }
17936
17944
  this.documentClickListener = this.renderer.listen('document', 'click', function (event) {
17937
- if (event === _this.ignore) {
17945
+ if (event === _this.ignore || _this.recentlyOpened) {
17938
17946
  delete _this.ignore;
17939
17947
  }
17940
17948
  else {
@@ -17959,6 +17967,13 @@
17959
17967
  }
17960
17968
  }
17961
17969
  };
17970
+ AbstractPopover.prototype.setRecentlyOpened = function () {
17971
+ var _this = this;
17972
+ this.recentlyOpened = true;
17973
+ setTimeout(function () {
17974
+ _this.recentlyOpened = false;
17975
+ });
17976
+ };
17962
17977
  return AbstractPopover;
17963
17978
  }());
17964
17979
  AbstractPopover.decorators = [
@@ -20363,7 +20378,7 @@
20363
20378
  { type: i0.Component, args: [{
20364
20379
  selector: 'clr-modal',
20365
20380
  viewProviders: [ScrollingService],
20366
- template: "<!--\n ~ Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.\n ~ This software is released under MIT license.\n ~ The full license information can be found in LICENSE in the root directory of this project.\n -->\n\n<div clrFocusTrap class=\"modal\" *ngIf=\"_open\">\n <!--fixme: revisit when ngClass works with exit animation-->\n <div\n [@fadeDown]=\"skipAnimation\"\n (@fadeDown.done)=\"fadeDone($event)\"\n class=\"modal-dialog\"\n [class.modal-sm]=\"size == 'sm'\"\n [class.modal-lg]=\"size == 'lg'\"\n [class.modal-xl]=\"size == 'xl'\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-hidden]=\"!_open\"\n [attr.aria-labelledby]=\"modalId\"\n >\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentStart}}</div>\n <div class=\"modal-content-wrapper\">\n <!-- only used in wizards -->\n <ng-content select=\".modal-nav\"></ng-content>\n\n <div class=\"modal-content\">\n <div class=\"modal-header--accessible\">\n <div class=\"modal-title-wrapper\" id=\"{{modalId}}\" clrFocusOnViewInit>\n <ng-content select=\".modal-title\"></ng-content>\n </div>\n <button\n type=\"button\"\n [attr.aria-label]=\"commonStrings.keys.close\"\n class=\"close\"\n *ngIf=\"closable\"\n (click)=\"close()\"\n >\n <cds-icon shape=\"window-close\"></cds-icon>\n </button>\n </div>\n <ng-content select=\".modal-body\"></ng-content>\n <ng-content select=\".modal-footer\"></ng-content>\n </div>\n </div>\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentEnd}}</div>\n </div>\n\n <div [@fade] class=\"modal-backdrop\" aria-hidden=\"true\" (click)=\"staticBackdrop || close()\"></div>\n</div>\n",
20381
+ template: "<!--\n ~ Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n ~ This software is released under MIT license.\n ~ The full license information can be found in LICENSE in the root directory of this project.\n -->\n\n<div clrFocusTrap class=\"modal\" *ngIf=\"_open\">\n <!--fixme: revisit when ngClass works with exit animation-->\n <div\n [@fadeDown]=\"skipAnimation\"\n (@fadeDown.done)=\"fadeDone($event)\"\n class=\"modal-dialog\"\n [class.modal-sm]=\"size == 'sm'\"\n [class.modal-lg]=\"size == 'lg'\"\n [class.modal-xl]=\"size == 'xl'\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-hidden]=\"!_open\"\n [attr.aria-labelledby]=\"modalId\"\n >\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentStart}}</div>\n <div class=\"modal-content-wrapper\">\n <!-- only used in wizards -->\n <ng-content select=\".modal-nav\"></ng-content>\n\n <div class=\"modal-content\">\n <div class=\"modal-header--accessible\">\n <div class=\"modal-title-wrapper\" id=\"{{modalId}}\" clrFocusOnViewInit>\n <ng-content select=\".modal-title\"></ng-content>\n </div>\n <button\n type=\"button\"\n [attr.aria-label]=\"commonStrings.keys.close\"\n class=\"close\"\n *ngIf=\"closable\"\n (click)=\"close()\"\n >\n <cds-icon shape=\"window-close\"></cds-icon>\n </button>\n </div>\n <div class=\"modal-body-wrapper\">\n <ng-content select=\".modal-body\"></ng-content>\n </div>\n <ng-content select=\".modal-footer\"></ng-content>\n </div>\n </div>\n <div class=\"clr-sr-only\">{{commonStrings.keys.modalContentEnd}}</div>\n </div>\n\n <div [@fade] class=\"modal-backdrop\" aria-hidden=\"true\" (click)=\"staticBackdrop || close()\"></div>\n</div>\n",
20367
20382
  animations: [
20368
20383
  animations.trigger('fadeDown', [
20369
20384
  animations.transition('* => false', [animations.style({ opacity: 0, transform: 'translate(0, -25%)' }), animations.animate('0.2s ease-in-out')]),
@@ -20398,7 +20413,7 @@
20398
20413
  };
20399
20414
 
20400
20415
  /*
20401
- * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.
20416
+ * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
20402
20417
  * This software is released under MIT license.
20403
20418
  * The full license information can be found in LICENSE in the root directory of this project.
20404
20419
  */
@@ -20409,19 +20424,21 @@
20409
20424
  * the overflow scroll being focused.
20410
20425
  */
20411
20426
  var ClrModalBody = /** @class */ (function () {
20412
- function ClrModalBody(ngZone, renderer, host) {
20427
+ function ClrModalBody(renderer, host, ngZone) {
20413
20428
  var _this = this;
20429
+ this.renderer = renderer;
20430
+ this.host = host;
20414
20431
  this.tabindex = '0';
20415
20432
  this.unlisteners = [];
20416
- renderer.setAttribute(host.nativeElement, 'tabindex', this.tabindex);
20417
20433
  ngZone.runOutsideAngular(function () {
20418
- _this.unlisteners.push(renderer.listen(host.nativeElement, 'mouseup', function () {
20434
+ new ResizeObserver(function () { return _this.addOrRemoveTabIndex(); }).observe(_this.host.nativeElement);
20435
+ _this.unlisteners.push(_this.renderer.listen(_this.host.nativeElement, 'mouseup', function () {
20419
20436
  // set the tabindex binding back when click is completed with mouseup
20420
- renderer.setAttribute(host.nativeElement, 'tabindex', _this.tabindex);
20421
- }), renderer.listen(host.nativeElement, 'mousedown', function () {
20437
+ _this.addOrRemoveTabIndex();
20438
+ }), _this.renderer.listen(_this.host.nativeElement, 'mousedown', function () {
20422
20439
  // tabindex = 0 binding should be removed
20423
20440
  // so it won't be focused when click starts with mousedown
20424
- renderer.removeAttribute(host.nativeElement, 'tabindex');
20441
+ _this.removeTabIndex();
20425
20442
  }));
20426
20443
  });
20427
20444
  }
@@ -20430,15 +20447,30 @@
20430
20447
  this.unlisteners.pop()();
20431
20448
  }
20432
20449
  };
20450
+ ClrModalBody.prototype.addTabIndex = function () {
20451
+ this.renderer.setAttribute(this.host.nativeElement, 'tabindex', this.tabindex);
20452
+ };
20453
+ ClrModalBody.prototype.removeTabIndex = function () {
20454
+ this.renderer.removeAttribute(this.host.nativeElement, 'tabindex');
20455
+ };
20456
+ ClrModalBody.prototype.addOrRemoveTabIndex = function () {
20457
+ var modalBody = this.host.nativeElement.parentElement;
20458
+ if (modalBody.clientHeight < modalBody.scrollHeight) {
20459
+ this.addTabIndex();
20460
+ }
20461
+ else {
20462
+ this.removeTabIndex();
20463
+ }
20464
+ };
20433
20465
  return ClrModalBody;
20434
20466
  }());
20435
20467
  ClrModalBody.decorators = [
20436
20468
  { type: i0.Directive, args: [{ selector: '.modal-body' },] }
20437
20469
  ];
20438
20470
  ClrModalBody.ctorParameters = function () { return [
20439
- { type: i0.NgZone },
20440
20471
  { type: i0.Renderer2 },
20441
- { type: i0.ElementRef }
20472
+ { type: i0.ElementRef },
20473
+ { type: i0.NgZone }
20442
20474
  ]; };
20443
20475
 
20444
20476
  /*
@@ -23747,10 +23779,11 @@
23747
23779
  };
23748
23780
  AccordionModel.prototype.togglePanel = function (panelId, open) {
23749
23781
  var panelIsOpen = this._panels[panelId].open;
23750
- if (this.strategy === AccordionStrategy.Default) {
23782
+ var newOpenState = open !== undefined ? open : !panelIsOpen;
23783
+ if (newOpenState && this.strategy === AccordionStrategy.Default) {
23751
23784
  this.closeAllPanels();
23752
23785
  }
23753
- this._panels[panelId].open = open !== undefined ? open : !panelIsOpen;
23786
+ this._panels[panelId].open = newOpenState;
23754
23787
  };
23755
23788
  AccordionModel.prototype.disablePanel = function (panelId, disabled) {
23756
23789
  this._panels[panelId].disabled = disabled;