@clr/angular 13.0.0-next.0 → 13.0.0-next.1

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.
@@ -18523,6 +18523,7 @@ class AbstractPopover {
18523
18523
  constructor(injector, parentHost) {
18524
18524
  this.parentHost = parentHost;
18525
18525
  this.updateAnchor = false;
18526
+ this.recentlyOpened = false;
18526
18527
  this.popoverOptions = {};
18527
18528
  /*
18528
18529
  * Until https://github.com/angular/angular/issues/8785 is supported, we don't have any way to instantiate
@@ -18539,6 +18540,7 @@ class AbstractPopover {
18539
18540
  if (change) {
18540
18541
  this.anchor();
18541
18542
  this.attachESCListener();
18543
+ this.setRecentlyOpened();
18542
18544
  }
18543
18545
  else {
18544
18546
  this.release();
@@ -18548,6 +18550,7 @@ class AbstractPopover {
18548
18550
  if (this.toggleService.open) {
18549
18551
  this.anchor();
18550
18552
  this.attachESCListener();
18553
+ this.setRecentlyOpened();
18551
18554
  }
18552
18555
  }
18553
18556
  anchor() {
@@ -18606,7 +18609,7 @@ class AbstractPopover {
18606
18609
  this.ignoredElementClickListener = this.renderer.listen(this.ignoredElement, 'click', event => (this.ignore = event));
18607
18610
  }
18608
18611
  this.documentClickListener = this.renderer.listen('document', 'click', event => {
18609
- if (event === this.ignore) {
18612
+ if (event === this.ignore || this.recentlyOpened) {
18610
18613
  delete this.ignore;
18611
18614
  }
18612
18615
  else {
@@ -18631,6 +18634,12 @@ class AbstractPopover {
18631
18634
  }
18632
18635
  }
18633
18636
  }
18637
+ setRecentlyOpened() {
18638
+ this.recentlyOpened = true;
18639
+ setTimeout(() => {
18640
+ this.recentlyOpened = false;
18641
+ });
18642
+ }
18634
18643
  }
18635
18644
  AbstractPopover.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: AbstractPopover, deps: [{ token: i0.Injector }, { token: i0.ElementRef, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
18636
18645
  AbstractPopover.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: AbstractPopover, host: { properties: { "class.is-off-screen": "this.isOffScreen" } }, ngImport: i0 });
@@ -21063,7 +21072,7 @@ class ClrModal {
21063
21072
  }
21064
21073
  }
21065
21074
  ClrModal.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ClrModal, deps: [{ token: ScrollingService }, { token: ClrCommonStringsService }, { token: UNIQUE_ID }], target: i0.ɵɵFactoryTarget.Component });
21066
- ClrModal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: ClrModal, selector: "clr-modal", inputs: { _open: ["clrModalOpen", "_open"], closable: ["clrModalClosable", "closable"], size: ["clrModalSize", "size"], staticBackdrop: ["clrModalStaticBackdrop", "staticBackdrop"], skipAnimation: ["clrModalSkipAnimation", "skipAnimation"], bypassScrollService: ["clrModalOverrideScrollService", "bypassScrollService"], stopClose: ["clrModalPreventClose", "stopClose"] }, outputs: { _openChanged: "clrModalOpenChange", altClose: "clrModalAlternateClose" }, host: { listeners: { "body:keyup.escape": "close()" }, properties: { "class.open": "this._open" } }, providers: [UNIQUE_ID_PROVIDER], viewQueries: [{ propertyName: "focusTrap", first: true, predicate: FocusTrapDirective, descendants: true }], usesOnChanges: true, ngImport: i0, 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", styles: [":host{display:none}:host.open{display:inline}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FocusTrapDirective, selector: "[clrFocusTrap]", inputs: ["clrFocusTrap"] }, { type: ClrFocusOnViewInit, selector: "[clrFocusOnViewInit]", inputs: ["clrFocusOnViewInit"] }, { type: CdsIconCustomTag, selector: "cds-icon" }], viewProviders: [ScrollingService], animations: [
21075
+ ClrModal.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: ClrModal, selector: "clr-modal", inputs: { _open: ["clrModalOpen", "_open"], closable: ["clrModalClosable", "closable"], size: ["clrModalSize", "size"], staticBackdrop: ["clrModalStaticBackdrop", "staticBackdrop"], skipAnimation: ["clrModalSkipAnimation", "skipAnimation"], bypassScrollService: ["clrModalOverrideScrollService", "bypassScrollService"], stopClose: ["clrModalPreventClose", "stopClose"] }, outputs: { _openChanged: "clrModalOpenChange", altClose: "clrModalAlternateClose" }, host: { listeners: { "body:keyup.escape": "close()" }, properties: { "class.open": "this._open" } }, providers: [UNIQUE_ID_PROVIDER], viewQueries: [{ propertyName: "focusTrap", first: true, predicate: FocusTrapDirective, descendants: true }], usesOnChanges: true, ngImport: i0, 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", styles: [":host{display:none}:host.open{display:inline}\n"], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FocusTrapDirective, selector: "[clrFocusTrap]", inputs: ["clrFocusTrap"] }, { type: ClrFocusOnViewInit, selector: "[clrFocusOnViewInit]", inputs: ["clrFocusOnViewInit"] }, { type: CdsIconCustomTag, selector: "cds-icon" }], viewProviders: [ScrollingService], animations: [
21067
21076
  trigger('fadeDown', [
21068
21077
  transition('* => false', [style({ opacity: 0, transform: 'translate(0, -25%)' }), animate('0.2s ease-in-out')]),
21069
21078
  transition('false => *', [animate('0.2s ease-in-out', style({ opacity: 0, transform: 'translate(0, -25%)' }))]),
@@ -21093,7 +21102,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
21093
21102
  transition('void => *', [style({ opacity: 0 }), animate('0.2s ease-in-out', style({ opacity: 0.85 }))]),
21094
21103
  transition('* => void', [animate('0.2s ease-in-out', style({ opacity: 0 }))]),
21095
21104
  ]),
21096
- ], providers: [UNIQUE_ID_PROVIDER], 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" }]
21105
+ ], providers: [UNIQUE_ID_PROVIDER], 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" }]
21097
21106
  }], ctorParameters: function () { return [{ type: ScrollingService }, { type: ClrCommonStringsService }, { type: undefined, decorators: [{
21098
21107
  type: Inject,
21099
21108
  args: [UNIQUE_ID]
@@ -21136,7 +21145,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
21136
21145
  }] } });
21137
21146
 
21138
21147
  /*
21139
- * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.
21148
+ * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.
21140
21149
  * This software is released under MIT license.
21141
21150
  * The full license information can be found in LICENSE in the root directory of this project.
21142
21151
  */
@@ -21147,18 +21156,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
21147
21156
  * the overflow scroll being focused.
21148
21157
  */
21149
21158
  class ClrModalBody {
21150
- constructor(ngZone, renderer, host) {
21159
+ constructor(renderer, host, ngZone) {
21160
+ this.renderer = renderer;
21161
+ this.host = host;
21151
21162
  this.tabindex = '0';
21152
21163
  this.unlisteners = [];
21153
- renderer.setAttribute(host.nativeElement, 'tabindex', this.tabindex);
21154
21164
  ngZone.runOutsideAngular(() => {
21155
- this.unlisteners.push(renderer.listen(host.nativeElement, 'mouseup', () => {
21165
+ new ResizeObserver(() => this.addOrRemoveTabIndex()).observe(this.host.nativeElement);
21166
+ this.unlisteners.push(this.renderer.listen(this.host.nativeElement, 'mouseup', () => {
21156
21167
  // set the tabindex binding back when click is completed with mouseup
21157
- renderer.setAttribute(host.nativeElement, 'tabindex', this.tabindex);
21158
- }), renderer.listen(host.nativeElement, 'mousedown', () => {
21168
+ this.addOrRemoveTabIndex();
21169
+ }), this.renderer.listen(this.host.nativeElement, 'mousedown', () => {
21159
21170
  // tabindex = 0 binding should be removed
21160
21171
  // so it won't be focused when click starts with mousedown
21161
- renderer.removeAttribute(host.nativeElement, 'tabindex');
21172
+ this.removeTabIndex();
21162
21173
  }));
21163
21174
  });
21164
21175
  }
@@ -21167,13 +21178,28 @@ class ClrModalBody {
21167
21178
  this.unlisteners.pop()();
21168
21179
  }
21169
21180
  }
21181
+ addTabIndex() {
21182
+ this.renderer.setAttribute(this.host.nativeElement, 'tabindex', this.tabindex);
21183
+ }
21184
+ removeTabIndex() {
21185
+ this.renderer.removeAttribute(this.host.nativeElement, 'tabindex');
21186
+ }
21187
+ addOrRemoveTabIndex() {
21188
+ const modalBody = this.host.nativeElement.parentElement;
21189
+ if (modalBody.clientHeight < modalBody.scrollHeight) {
21190
+ this.addTabIndex();
21191
+ }
21192
+ else {
21193
+ this.removeTabIndex();
21194
+ }
21195
+ }
21170
21196
  }
21171
- ClrModalBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ClrModalBody, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
21197
+ ClrModalBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ClrModalBody, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
21172
21198
  ClrModalBody.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: ClrModalBody, selector: ".modal-body", ngImport: i0 });
21173
21199
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: ClrModalBody, decorators: [{
21174
21200
  type: Directive,
21175
21201
  args: [{ selector: '.modal-body' }]
21176
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ElementRef }]; } });
21202
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
21177
21203
 
21178
21204
  /*
21179
21205
  * Copyright (c) 2016-2021 VMware, Inc. All Rights Reserved.
@@ -24494,10 +24520,11 @@ class AccordionModel {
24494
24520
  }
24495
24521
  togglePanel(panelId, open) {
24496
24522
  const panelIsOpen = this._panels[panelId].open;
24497
- if (this.strategy === AccordionStrategy.Default) {
24523
+ const newOpenState = open !== undefined ? open : !panelIsOpen;
24524
+ if (newOpenState && this.strategy === AccordionStrategy.Default) {
24498
24525
  this.closeAllPanels();
24499
24526
  }
24500
- this._panels[panelId].open = open !== undefined ? open : !panelIsOpen;
24527
+ this._panels[panelId].open = newOpenState;
24501
24528
  }
24502
24529
  disablePanel(panelId, disabled) {
24503
24530
  this._panels[panelId].disabled = disabled;