@coreui/angular 5.7.6 → 5.7.9

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.
@@ -3082,7 +3082,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
3082
3082
  class DropdownToken {
3083
3083
  }
3084
3084
  class DropdownToggleDirective {
3085
- // injections
3086
3085
  #destroyRef = inject(DestroyRef);
3087
3086
  elementRef = inject(ElementRef);
3088
3087
  #dropdownService = inject(DropdownService);
@@ -3101,7 +3100,7 @@ class DropdownToggleDirective {
3101
3100
  */
3102
3101
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
3103
3102
  /**
3104
- * Enables pseudo element caret on toggler.
3103
+ * Enables pseudo-element caret on toggler.
3105
3104
  * @return boolean
3106
3105
  */
3107
3106
  caret = input(true, /* @ts-ignore */
@@ -3138,9 +3137,14 @@ class DropdownToggleDirective {
3138
3137
  }
3139
3138
  if (this.dropdown) {
3140
3139
  const dropdown = this.dropdown;
3141
- dropdown?.visibleChange?.subscribe((visible) => {
3140
+ const subscription = dropdown?.visibleChange?.subscribe((visible) => {
3142
3141
  this.#ariaExpanded.set(visible);
3143
3142
  });
3143
+ if (subscription) {
3144
+ this.#destroyRef.onDestroy(() => {
3145
+ subscription.unsubscribe();
3146
+ });
3147
+ }
3144
3148
  }
3145
3149
  }
3146
3150
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: DropdownToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
@@ -5041,33 +5045,27 @@ class NavbarComponent {
5041
5045
  return false;
5042
5046
  }, /* @ts-ignore */
5043
5047
  ...(ngDevMode ? [{ debugName: "breakpoint" }] : /* istanbul ignore next */ []));
5044
- #observer;
5045
- ngAfterContentInit() {
5048
+ #breakpointEffect = effect((onCleanup) => {
5046
5049
  const breakpoint = this.breakpoint();
5047
- if (breakpoint) {
5048
- const onBreakpoint = `(min-width: ${breakpoint})`;
5049
- this.#observer = this.#breakpointObserver
5050
- .observe([onBreakpoint])
5051
- .pipe()
5052
- .subscribe((result) => {
5053
- const collapse = this.collapse();
5054
- if (collapse) {
5055
- const animate = collapse.animate();
5056
- collapse.animate.set(false);
5057
- collapse.toggle(false);
5058
- setTimeout(() => {
5059
- collapse.toggle(result.matches);
5060
- setTimeout(() => {
5061
- collapse.animate.set(animate);
5062
- });
5063
- });
5064
- }
5065
- });
5050
+ if (!breakpoint) {
5051
+ return;
5066
5052
  }
5067
- }
5068
- ngOnDestroy() {
5069
- this.#observer?.unsubscribe();
5070
- }
5053
+ const subscription = this.#breakpointObserver.observe([`(min-width: ${breakpoint})`]).subscribe((result) => {
5054
+ const collapse = this.collapse();
5055
+ if (!collapse) {
5056
+ return;
5057
+ }
5058
+ const animate = collapse.animate();
5059
+ collapse.animate.set(false);
5060
+ collapse.toggle(false);
5061
+ setTimeout(() => {
5062
+ collapse.toggle(result.matches);
5063
+ setTimeout(() => collapse.animate.set(animate));
5064
+ });
5065
+ });
5066
+ onCleanup(() => subscription.unsubscribe());
5067
+ }, /* @ts-ignore */
5068
+ ...(ngDevMode ? [{ debugName: "#breakpointEffect" }] : /* istanbul ignore next */ []));
5071
5069
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: NavbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5072
5070
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.7", type: NavbarComponent, isStandalone: true, selector: "c-navbar", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, expand: { classPropertyName: "expand", publicName: "expand", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()", "attr.role": "role()" } }, queries: [{ propertyName: "collapse", first: true, predicate: CollapseDirective, descendants: true, isSignal: true }], hostDirectives: [{ directive: ThemeDirective, inputs: ["colorScheme", "colorScheme"] }], ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"container() ? withContainerTemplate : noContainerTemplate\" />\n\n<ng-template #withContainerTemplate>\n <div [class]=\"containerClass()\">\n <ng-content />\n </div>\n</ng-template>\n\n<ng-template #noContainerTemplate>\n <ng-content />\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
5073
5071
  }
@@ -5552,7 +5550,7 @@ class ModalComponent {
5552
5550
  this.show = this.visible();
5553
5551
  });
5554
5552
  }
5555
- onKeyUpHandler(event) {
5553
+ onKeyDownHandler(event) {
5556
5554
  if (event.key === 'Escape' && this.keyboard() && this.visible()) {
5557
5555
  if (this.backdrop() === 'static') {
5558
5556
  this.setStaticBackdrop();
@@ -5633,7 +5631,7 @@ class ModalComponent {
5633
5631
  }
5634
5632
  }
5635
5633
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5636
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.7", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, fullscreen: { classPropertyName: "fullscreen", publicName: "fullscreen", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, attrId: { classPropertyName: "attrId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModalInput: { classPropertyName: "ariaModalInput", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)", "document:keyup": "onKeyUpHandler($event)" }, properties: { "class": "hostClasses()", "attr.role": "visible() ? role() : null", "attr.inert": "ariaHidden()", "attr.id": "id", "attr.aria-modal": "ariaModal()", "attr.aria-hidden": "ariaHidden()", "attr.tabindex": "-1" }, classAttribute: "modal" }, viewQueries: [{ propertyName: "modalContentRef", first: true, predicate: ["modalContentRef"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "modalDialogRef", first: true, predicate: ModalDialogComponent, descendants: true, read: ElementRef, isSignal: true }], exportAs: ["cModal"], ngImport: i0, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <ng-content />\n </div>\n </c-modal-content>\n</c-modal-dialog>\n", dependencies: [{ kind: "component", type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { kind: "component", type: ModalContentComponent, selector: "c-modal-content" }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
5634
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.7", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, fullscreen: { classPropertyName: "fullscreen", publicName: "fullscreen", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, attrId: { classPropertyName: "attrId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModalInput: { classPropertyName: "ariaModalInput", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "class": "hostClasses()", "attr.role": "visible() ? role() : null", "attr.inert": "ariaHidden()", "attr.id": "id", "attr.aria-modal": "ariaModal()", "attr.aria-hidden": "ariaHidden()", "attr.tabindex": "-1" }, classAttribute: "modal" }, viewQueries: [{ propertyName: "modalContentRef", first: true, predicate: ["modalContentRef"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "modalDialogRef", first: true, predicate: ModalDialogComponent, descendants: true, read: ElementRef, isSignal: true }], exportAs: ["cModal"], ngImport: i0, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <ng-content />\n </div>\n </c-modal-content>\n</c-modal-dialog>\n", dependencies: [{ kind: "component", type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { kind: "component", type: ModalContentComponent, selector: "c-modal-content" }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
5637
5635
  }
5638
5636
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: ModalComponent, decorators: [{
5639
5637
  type: Component,
@@ -5648,7 +5646,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
5648
5646
  '[attr.tabindex]': '-1',
5649
5647
  '(mousedown)': 'onMouseDownHandler($event)',
5650
5648
  '(click)': 'onClickHandler($event)',
5651
- '(document:keyup)': 'onKeyUpHandler($event)'
5649
+ '(document:keydown)': 'onKeyDownHandler($event)'
5652
5650
  }, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <ng-content />\n </div>\n </c-modal-content>\n</c-modal-dialog>\n" }]
5653
5651
  }], propDecorators: { alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], backdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "backdrop", required: false }] }], fullscreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullscreen", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], attrId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaModalInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaModal", required: false }] }], scrollable: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollable", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], modalContentRef: [{ type: i0.ViewChild, args: ['modalContentRef', { ...{ read: ElementRef }, isSignal: true }] }], modalDialogRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ModalDialogComponent), { ...{ read: ElementRef }, isSignal: true }] }] } });
5654
5652
 
@@ -6442,6 +6440,25 @@ class PopoverDirective {
6442
6440
  this.visible() ? this.addTooltipElement() : this.removeTooltipElement();
6443
6441
  }
6444
6442
  });
6443
+ #handleEscapeKey = (event) => {
6444
+ if (event.key !== 'Escape') {
6445
+ return;
6446
+ }
6447
+ event.preventDefault();
6448
+ event.stopPropagation();
6449
+ this.visible.set(false);
6450
+ };
6451
+ #escapeEffect = effect((onCleanup) => {
6452
+ if (!this.visible()) {
6453
+ return;
6454
+ }
6455
+ const useCapture = true;
6456
+ this.#document.addEventListener('keydown', this.#handleEscapeKey, useCapture);
6457
+ onCleanup(() => {
6458
+ this.#document.removeEventListener('keydown', this.#handleEscapeKey, useCapture);
6459
+ });
6460
+ }, /* @ts-ignore */
6461
+ ...(ngDevMode ? [{ debugName: "#escapeEffect" }] : /* istanbul ignore next */ []));
6445
6462
  get ariaDescribedBy() {
6446
6463
  return this.tooltipId ? this.tooltipId : null;
6447
6464
  }
@@ -9486,6 +9503,23 @@ class TooltipDirective {
9486
9503
  this.visible() ? this.addTooltipElement() : this.removeTooltipElement();
9487
9504
  }
9488
9505
  });
9506
+ #handleEscapeKey = (event) => {
9507
+ if (event.key !== 'Escape') {
9508
+ return;
9509
+ }
9510
+ event.preventDefault();
9511
+ event.stopPropagation();
9512
+ this.visible.set(false);
9513
+ };
9514
+ #escapeEffect = effect((onCleanup) => {
9515
+ if (!this.visible()) {
9516
+ return;
9517
+ }
9518
+ const useCapture = true;
9519
+ this.#document.addEventListener('keydown', this.#handleEscapeKey, useCapture);
9520
+ onCleanup(() => this.#document.removeEventListener('keydown', this.#handleEscapeKey, useCapture));
9521
+ }, /* @ts-ignore */
9522
+ ...(ngDevMode ? [{ debugName: "#escapeEffect" }] : /* istanbul ignore next */ []));
9489
9523
  get ariaDescribedBy() {
9490
9524
  return this.tooltipId ? this.tooltipId : null;
9491
9525
  }