@coreui/angular 5.7.12 → 5.7.13

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.
@@ -1,12 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component, afterNextRender, linkedSignal, output, signal, contentChildren, numberAttribute, MAX_ANIMATION_TIMEOUT, DestroyRef, DOCUMENT, PLATFORM_ID, RendererFactory2, forwardRef, NgZone, ChangeDetectorRef, contentChild, afterEveryRender, viewChild, ViewContainerRef, model, afterRenderEffect, ChangeDetectionStrategy, Pipe, Input, HostBinding, ContentChildren, HostListener, Injector, runInInjectionContext, ViewEncapsulation } from '@angular/core';
2
+ import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, booleanAttribute, untracked, NgModule, computed, Injectable, Component, linkedSignal, output, signal, contentChildren, numberAttribute, MAX_ANIMATION_TIMEOUT, DestroyRef, DOCUMENT, PLATFORM_ID, RendererFactory2, afterNextRender, forwardRef, NgZone, ChangeDetectorRef, contentChild, afterEveryRender, viewChild, ViewContainerRef, model, afterRenderEffect, ChangeDetectionStrategy, Pipe, Input, HostBinding, ContentChildren, HostListener, Injector, runInInjectionContext, ViewEncapsulation } from '@angular/core';
3
3
  import { NgTemplateOutlet, isPlatformServer, isPlatformBrowser } from '@angular/common';
4
- import { animation, animate, style, AnimationBuilder, useAnimation, group, query, trigger, state, transition, animateChild } from '@angular/animations';
5
4
  import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
6
5
  import { fromEvent, Subject, BehaviorSubject, merge, takeWhile, skipWhile } from 'rxjs';
7
6
  import * as i1 from '@angular/router';
8
7
  import { RouterModule, Router, ActivatedRoute, NavigationEnd, RouterLink } from '@angular/router';
9
8
  import { filter, tap, finalize, zipWith, withLatestFrom, debounceTime } from 'rxjs/operators';
9
+ import { animation, group, query, animate, style, trigger, state, transition, useAnimation, animateChild } from '@angular/animations';
10
10
  import { createPopper } from '@popperjs/core';
11
11
  import * as i1$1 from '@angular/cdk/a11y';
12
12
  import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
@@ -261,74 +261,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
261
261
  args: [{ selector: 'c-accordion', template: '<ng-content />', exportAs: 'cAccordionItem', providers: [AccordionService], host: { '[class]': 'hostClasses()' }, styles: [":host{display:block}\n"] }]
262
262
  }], propDecorators: { flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }], alwaysOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysOpen", required: false }] }] } });
263
263
 
264
- const expandAnimation = animation([animate('{{ time }} {{ easing }}')]);
265
- const collapseAnimation = animation([
266
- style({ height: '*', minHeight: '*' }),
267
- animate('{{ time }} {{ easing }}', style({ height: 0, minHeight: 0 }))
268
- ]);
269
- const expandHorizontalAnimation = animation([animate('{{ time }} {{ easing }}')]);
270
- const collapseHorizontalAnimation = animation([animate('{{ time }} {{ easing }}')]);
271
-
272
264
  class CollapseDirective {
273
- #animationBuilder = inject(AnimationBuilder);
265
+ static ngAcceptInputType_animate;
266
+ static ngAcceptInputType_horizontal;
267
+ static ngAcceptInputType_navbar;
268
+ static ngAcceptInputType_visible;
274
269
  #hostElement = inject(ElementRef);
275
270
  #renderer = inject(Renderer2);
276
- #player = undefined;
277
- constructor() {
278
- afterNextRender({
279
- read: () => {
280
- this.#initialized.set(true);
281
- }
282
- });
283
- }
271
+ #unlistenTransitionEnd;
272
+ #isFirstChange = true;
284
273
  /**
285
- * @ignore
274
+ * @ignore internal
286
275
  */
287
276
  animateInput = input(true, { ...(ngDevMode ? { debugName: "animateInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'animate' });
288
- animate = linkedSignal({ ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), source: this.animateInput,
289
- computation: (value) => value });
277
+ animate = linkedSignal(this.animateInput, /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
290
279
  /**
291
280
  * Set horizontal collapsing to transition the width instead of height.
292
- * @type boolean
281
+ * @return boolean
293
282
  * @default false
294
283
  */
295
284
  horizontal = input(false, { ...(ngDevMode ? { debugName: "horizontal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
296
285
  /**
297
- * Toggle the visibility of collapsible element.
298
- * @type boolean
286
+ * Toggle the visibility of a collapsible element.
287
+ * @return boolean
299
288
  * @default false
300
289
  */
301
290
  visibleInput = input(false, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
291
+ /**
292
+ * Event emitted on visibility change. [docs]
293
+ * @return boolean
294
+ */
302
295
  visibleChange = output();
303
- visible = linkedSignal({ ...(ngDevMode ? { debugName: "visible" } : /* istanbul ignore next */ {}), source: this.visibleInput, computation: (value) => value });
304
- #initialized = signal(false, /* @ts-ignore */
305
- ...(ngDevMode ? [{ debugName: "#initialized" }] : /* istanbul ignore next */ []));
296
+ visible = linkedSignal(this.visibleInput, /* @ts-ignore */
297
+ ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
306
298
  #visibleEffect = effect(() => {
307
299
  const visible = this.visible();
308
- if (this.#initialized()) {
309
- this.createPlayer(visible);
300
+ if (this.#isFirstChange || !untracked(() => this.animate())) {
301
+ // no transition
302
+ this.#isFirstChange = false;
303
+ this.setInitialState(visible);
304
+ return;
310
305
  }
306
+ untracked(() => {
307
+ this.runTransition(visible);
308
+ });
311
309
  }, /* @ts-ignore */
312
310
  ...(ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []));
313
311
  /**
314
- * Add `navbar` prop for grouping and hiding navbar contents by a parent breakpoint.
315
- * @type boolean
312
+ * Add a `navbar` prop for grouping and hiding navbar contents by a parent breakpoint.
313
+ * @return boolean
316
314
  * @default false
317
315
  */
318
316
  navbar = input(false, { ...(ngDevMode ? { debugName: "navbar" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
319
- /**
320
- * @ignore
321
- */
322
- duration = input('350ms', /* @ts-ignore */
323
- ...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
324
- /**
325
- * @ignore
326
- */
327
- transition = input('ease', /* @ts-ignore */
328
- ...(ngDevMode ? [{ debugName: "transition" }] : /* istanbul ignore next */ []));
329
317
  /**
330
318
  * Event emitted on visibility change. [docs]
331
- * @type string
319
+ * @return string
332
320
  */
333
321
  collapseChange = output();
334
322
  hostClasses = computed(() => {
@@ -339,60 +327,88 @@ class CollapseDirective {
339
327
  }, /* @ts-ignore */
340
328
  ...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
341
329
  ngOnDestroy() {
342
- this.destroyPlayer();
330
+ this.clearPendingCallbacks();
343
331
  }
344
332
  toggle(visible = !this.visible()) {
345
333
  this.visible.set(visible);
346
334
  }
347
- destroyPlayer() {
348
- this.#player?.destroy();
349
- this.#player = undefined;
335
+ clearPendingCallbacks() {
336
+ this.#unlistenTransitionEnd?.();
337
+ this.#unlistenTransitionEnd = undefined;
350
338
  }
351
- createPlayer(visible = this.visible()) {
352
- if (this.#player?.hasStarted()) {
353
- this.destroyPlayer();
354
- }
339
+ setInitialState(visible) {
355
340
  const host = this.#hostElement.nativeElement;
341
+ this.#renderer.addClass(host, 'collapse');
342
+ this.#renderer.removeClass(host, 'collapsing');
356
343
  if (visible) {
357
- this.#renderer.removeStyle(host, 'display');
344
+ this.#renderer.addClass(host, 'show');
358
345
  }
359
- const duration = this.animate() ? this.duration() : '0ms';
360
- const expand = this.horizontal() ? expandHorizontalAnimation : expandAnimation;
361
- const collapse = this.horizontal() ? collapseHorizontalAnimation : collapseAnimation;
346
+ else {
347
+ this.#renderer.removeClass(host, 'show');
348
+ }
349
+ }
350
+ runTransition(visible) {
351
+ this.clearPendingCallbacks();
352
+ const host = this.#hostElement.nativeElement;
362
353
  const dimension = this.horizontal() ? 'width' : 'height';
363
354
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
364
355
  const scrollSize = `scroll${capitalizedDimension}`;
365
- const animationFactory = this.#animationBuilder?.build(useAnimation(visible ? expand : collapse, { params: { time: duration, easing: this.transition() } }));
366
- this.#player = animationFactory.create(host);
367
- !visible && host.offsetHeight && host.style[dimension] && host.scrollHeight;
368
- this.#renderer.setStyle(host, dimension, visible ? 0 : `${host.getBoundingClientRect()[dimension]}px`);
369
- this.#player.onStart(() => {
356
+ const animate = this.animate();
357
+ if (visible) {
370
358
  this.setMaxSize();
359
+ // Switch off `collapse`/`show` before we measure its scroll size below.
371
360
  this.#renderer.removeClass(host, 'collapse');
361
+ this.#renderer.removeClass(host, 'show');
372
362
  this.#renderer.addClass(host, 'collapsing');
363
+ this.collapseChange?.emit('opening');
364
+ // Reading scrollHeight/scrollWidth forces a synchronous reflow, committing the 0-size
365
+ // starting point before we set the target size below, so the browser animates the change.
366
+ const targetSize = host[scrollSize];
367
+ this.#renderer.setStyle(host, dimension, `${targetSize}px`);
368
+ }
369
+ else {
370
+ // Lock in the current pixel size first so the browser has a committed starting point,
371
+ // then switch to the collapsing state and clear it so the size can animate down to 0.
372
+ const startSize = host.getBoundingClientRect()[dimension];
373
+ this.#renderer.setStyle(host, dimension, `${startSize}px`);
374
+ // Force a reflow so the browser registers the starting size before the next style change.
375
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
376
+ host.offsetHeight;
377
+ this.#renderer.removeClass(host, 'collapse');
373
378
  this.#renderer.removeClass(host, 'show');
374
- this.#renderer.setStyle(host, dimension, visible ? `${host[scrollSize]}px` : '');
375
- if (this.#player) {
376
- this.collapseChange?.emit(visible ? 'opening' : 'collapsing');
377
- }
378
- });
379
- this.#player.onDone(() => {
380
- this.#renderer.removeClass(host, 'collapsing');
381
- this.#renderer.addClass(host, 'collapse');
382
- if (visible) {
383
- this.#renderer.addClass(host, 'show');
384
- this.#renderer.setStyle(host, dimension, '');
385
- }
386
- else {
387
- this.#renderer.removeClass(host, 'show');
388
- }
389
- if (this.#player) {
390
- this.collapseChange?.emit(visible ? 'open' : 'collapsed');
391
- this.visibleChange?.emit(visible);
392
- }
393
- this.destroyPlayer();
394
- });
395
- this.#player?.play();
379
+ this.#renderer.addClass(host, 'collapsing');
380
+ this.collapseChange?.emit('collapsing');
381
+ // Now that the starting size is committed, set the target size (0) so the browser
382
+ // animates the transition down.
383
+ this.#renderer.setStyle(host, dimension, '0px');
384
+ }
385
+ const finish = () => this.finishTransition(visible, host, dimension);
386
+ if (animate) {
387
+ this.#unlistenTransitionEnd = this.#renderer.listen(host, 'transitionend', (event) => {
388
+ // Ignore bubbled transitionend events from descendant elements.
389
+ if (event.target === host && event.propertyName === dimension) {
390
+ finish();
391
+ }
392
+ });
393
+ }
394
+ else {
395
+ finish();
396
+ }
397
+ }
398
+ finishTransition(visible, host, dimension) {
399
+ this.clearPendingCallbacks();
400
+ this.#renderer.removeClass(host, 'collapsing');
401
+ this.#renderer.addClass(host, 'collapse');
402
+ if (visible) {
403
+ this.#renderer.addClass(host, 'show');
404
+ }
405
+ else {
406
+ this.#renderer.removeClass(host, 'show');
407
+ }
408
+ this.#renderer.removeStyle(host, 'transition');
409
+ this.#renderer.removeStyle(host, dimension);
410
+ this.collapseChange?.emit(visible ? 'open' : 'collapsed');
411
+ this.visibleChange?.emit(visible);
396
412
  }
397
413
  setMaxSize() {
398
414
  const host = this.#hostElement.nativeElement;
@@ -403,16 +419,16 @@ class CollapseDirective {
403
419
  }
404
420
  }
405
421
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CollapseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
406
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: CollapseDirective, isStandalone: true, selector: "[cCollapse]", inputs: { animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, navbar: { classPropertyName: "navbar", publicName: "navbar", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange", collapseChange: "collapseChange" }, host: { properties: { "class": "hostClasses()", "style": "{ display: \"none\" }" } }, exportAs: ["cCollapse"], ngImport: i0 });
422
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.0", type: CollapseDirective, isStandalone: true, selector: "[cCollapse]", inputs: { animateInput: { classPropertyName: "animateInput", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, horizontal: { classPropertyName: "horizontal", publicName: "horizontal", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, navbar: { classPropertyName: "navbar", publicName: "navbar", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange", collapseChange: "collapseChange" }, host: { properties: { "class": "hostClasses()" } }, exportAs: ["cCollapse"], ngImport: i0 });
407
423
  }
408
424
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: CollapseDirective, decorators: [{
409
425
  type: Directive,
410
426
  args: [{
411
427
  selector: '[cCollapse]',
412
428
  exportAs: 'cCollapse',
413
- host: { '[class]': 'hostClasses()', '[style]': '{ display: "none" }' }
429
+ host: { '[class]': 'hostClasses()' }
414
430
  }]
415
- }], ctorParameters: () => [], propDecorators: { animateInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], navbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "navbar", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], collapseChange: [{ type: i0.Output, args: ["collapseChange"] }] } });
431
+ }], propDecorators: { animateInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], horizontal: [{ type: i0.Input, args: [{ isSignal: true, alias: "horizontal", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], navbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "navbar", required: false }] }], collapseChange: [{ type: i0.Output, args: ["collapseChange"] }] } });
416
432
 
417
433
  class CollapseModule {
418
434
  static forRoot() {
@@ -473,7 +489,7 @@ class AccordionItemComponent {
473
489
  this.#accordionService.toggleItem(this);
474
490
  }
475
491
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AccordionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
476
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: AccordionItemComponent, isStandalone: true, selector: "c-accordion-item", inputs: { visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "accordion-item" }, queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], exportAs: ["cAccordionItem"], ngImport: i0, template: "@let tmpl = templates();\n<ng-container>\n <div class=\"accordion-header\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeaderTemplate'] || defaultAccordionHeaderTemplate; context: itemContext\" />\n </div>\n <div class=\"accordion-collapse\" cCollapse [visible]=\"itemVisible()\" [attr.aria-expanded]=\"itemVisible()\" [id]=\"contentId\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBodyTemplate'] || defaultAccordionBodyTemplate; context: itemContext\" />\n </div>\n</ng-container>\n\n<ng-template #defaultAccordionHeaderTemplate>\n <button cAccordionButton [collapsed]=\"!itemVisible()\" [attr.aria-controls]=\"contentId\" (click)=\"toggleItem()\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeader'] || defaultAccordionHeaderContentTemplate; context: itemContext\" />\n </button>\n</ng-template>\n\n<ng-template #defaultAccordionHeaderContentTemplate>\n <ng-content />\n</ng-template>\n\n<ng-template #defaultAccordionBodyTemplate>\n <div class=\"accordion-body\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBody'] || defaultAccordionBodyContentTemplate; context: itemContext\" />\n </div>\n</ng-template>\n\n<ng-template #defaultAccordionBodyContentTemplate>\n <ng-content />\n</ng-template>\n", styles: [":host{display:block;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: AccordionButtonDirective, selector: "[cAccordionButton]", inputs: ["collapsed", "type"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CollapseDirective, selector: "[cCollapse]", inputs: ["animate", "horizontal", "visible", "navbar", "duration", "transition"], outputs: ["visibleChange", "collapseChange"], exportAs: ["cCollapse"] }] });
492
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: AccordionItemComponent, isStandalone: true, selector: "c-accordion-item", inputs: { visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "accordion-item" }, queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true, isSignal: true }], exportAs: ["cAccordionItem"], ngImport: i0, template: "@let tmpl = templates();\n<ng-container>\n <div class=\"accordion-header\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeaderTemplate'] || defaultAccordionHeaderTemplate; context: itemContext\" />\n </div>\n <div class=\"accordion-collapse\" cCollapse [visible]=\"itemVisible()\" [attr.aria-expanded]=\"itemVisible()\" [id]=\"contentId\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBodyTemplate'] || defaultAccordionBodyTemplate; context: itemContext\" />\n </div>\n</ng-container>\n\n<ng-template #defaultAccordionHeaderTemplate>\n <button cAccordionButton [collapsed]=\"!itemVisible()\" [attr.aria-controls]=\"contentId\" (click)=\"toggleItem()\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionHeader'] || defaultAccordionHeaderContentTemplate; context: itemContext\" />\n </button>\n</ng-template>\n\n<ng-template #defaultAccordionHeaderContentTemplate>\n <ng-content />\n</ng-template>\n\n<ng-template #defaultAccordionBodyTemplate>\n <div class=\"accordion-body\">\n <ng-container *ngTemplateOutlet=\"tmpl['accordionBody'] || defaultAccordionBodyContentTemplate; context: itemContext\" />\n </div>\n</ng-template>\n\n<ng-template #defaultAccordionBodyContentTemplate>\n <ng-content />\n</ng-template>\n", styles: [":host{display:block;overflow:hidden}\n"], dependencies: [{ kind: "directive", type: AccordionButtonDirective, selector: "[cAccordionButton]", inputs: ["collapsed", "type"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CollapseDirective, selector: "[cCollapse]", inputs: ["animate", "horizontal", "visible", "navbar"], outputs: ["visibleChange", "collapseChange"], exportAs: ["cCollapse"] }] });
477
493
  }
478
494
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AccordionItemComponent, decorators: [{
479
495
  type: Component,
@@ -5055,12 +5071,11 @@ class NavbarComponent {
5055
5071
  if (!collapse) {
5056
5072
  return;
5057
5073
  }
5058
- const animate = collapse.animate();
5059
5074
  collapse.animate.set(false);
5060
5075
  collapse.toggle(false);
5061
5076
  setTimeout(() => {
5062
5077
  collapse.toggle(result.matches);
5063
- setTimeout(() => collapse.animate.set(animate));
5078
+ setTimeout(() => collapse.animate.set(collapse.animateInput()));
5064
5079
  });
5065
5080
  });
5066
5081
  onCleanup(() => subscription.unsubscribe());
@@ -5141,27 +5156,29 @@ class NavbarTogglerDirective {
5141
5156
  }
5142
5157
  /**
5143
5158
  * Reference to navbar collapse element (via # template variable) . [docs]
5144
- * @type string
5159
+ * @return string
5145
5160
  * @default 'button'
5146
5161
  */
5147
5162
  collapseRef = input(undefined, { ...(ngDevMode ? { debugName: "collapseRef" } : /* istanbul ignore next */ {}), alias: 'cNavbarToggler' });
5148
5163
  /**
5149
5164
  * Default type for navbar-toggler. [docs]
5150
- * @type string
5165
+ * @return string
5151
5166
  * @default 'button'
5152
5167
  */
5153
5168
  type = input('button', /* @ts-ignore */
5154
5169
  ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
5155
5170
  /**
5156
5171
  * Default aria-label attr for navbar-toggler. [docs]
5157
- * @type string
5172
+ * @return string
5158
5173
  * @default 'Toggle navigation'
5159
5174
  */
5160
5175
  ariaLabel = input('Toggle navigation', /* @ts-ignore */
5161
5176
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
5162
5177
  handleClick($event) {
5163
5178
  const collapseRef = this.collapseRef();
5164
- collapseRef?.toggle(!collapseRef?.visible());
5179
+ if (collapseRef) {
5180
+ collapseRef?.toggle(!collapseRef?.visible());
5181
+ }
5165
5182
  }
5166
5183
  addDefaultIcon() {
5167
5184
  const span = this.#renderer.createElement('span');