@coreui/angular 5.3.12 → 5.3.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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, Input, booleanAttribute, NgModule, computed, Injectable, Component, linkedSignal, output, signal, afterNextRender, contentChildren, DestroyRef, untracked, HostBinding, RendererFactory2, PLATFORM_ID, Inject, viewChild, HostListener, ContentChildren, forwardRef, EventEmitter, Output, ContentChild, contentChild, numberAttribute, afterRender, ViewContainerRef, ChangeDetectorRef, model, Pipe, ViewChild, ChangeDetectionStrategy, Injector, runInInjectionContext } from '@angular/core';
2
+ import { inject, ElementRef, Directive, input, Renderer2, effect, TemplateRef, Input, booleanAttribute, untracked, NgModule, computed, Injectable, Component, linkedSignal, output, signal, afterNextRender, contentChildren, DestroyRef, HostBinding, RendererFactory2, PLATFORM_ID, Inject, ContentChildren, forwardRef, ContentChild, contentChild, numberAttribute, afterRender, HostListener, viewChild, ViewContainerRef, ChangeDetectorRef, model, EventEmitter, Output, Pipe, ViewChild, ChangeDetectionStrategy, Injector, runInInjectionContext } from '@angular/core';
3
3
  import { NgTemplateOutlet, DOCUMENT, NgClass, AsyncPipe, isPlatformServer, isPlatformBrowser, NgStyle } from '@angular/common';
4
4
  import { animation, animate, style, AnimationBuilder, useAnimation, trigger, state, transition, group, query, animateChild } from '@angular/animations';
5
5
  import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
@@ -124,7 +124,7 @@ class ThemeDirective {
124
124
  });
125
125
  this.dark = input(false, { transform: booleanAttribute });
126
126
  this.#darkChange = effect(() => {
127
- const darkTheme = this.dark();
127
+ const darkTheme = this.dark() || untracked(this.colorScheme) === 'dark';
128
128
  darkTheme ? this.setTheme('dark') : this.unsetTheme();
129
129
  });
130
130
  }
@@ -2281,7 +2281,8 @@ class CarouselState {
2281
2281
  animate: true,
2282
2282
  items: [],
2283
2283
  direction: 'next',
2284
- transition: 'slide'
2284
+ transition: 'slide',
2285
+ interval: 0
2285
2286
  };
2286
2287
  get state() {
2287
2288
  return this.#state;
@@ -2340,7 +2341,8 @@ class CarouselState {
2340
2341
  animate: true,
2341
2342
  items: [],
2342
2343
  direction: 'next',
2343
- transition: 'slide'
2344
+ transition: 'slide',
2345
+ interval: 0
2344
2346
  };
2345
2347
  }
2346
2348
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselState, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -2359,7 +2361,7 @@ class CarouselConfig {
2359
2361
  /* Default direction of auto changing of slides */
2360
2362
  this.direction = 'next';
2361
2363
  /* Default interval of auto changing of slides */
2362
- this.interval = 3000;
2364
+ this.interval = 0;
2363
2365
  }
2364
2366
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2365
2367
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselConfig, providedIn: 'root' }); }
@@ -2420,7 +2422,9 @@ class CarouselComponent {
2420
2422
  computation: (value) => value
2421
2423
  });
2422
2424
  this.#intervalEffect = effect(() => {
2423
- this.interval() ? this.setTimer() : this.resetTimer();
2425
+ const interval = this.interval();
2426
+ this.#carouselState.state = { interval: interval };
2427
+ interval ? this.setTimer() : this.resetTimer();
2424
2428
  });
2425
2429
  /**
2426
2430
  * Sets which event handlers you’d like provided to your pause prop. You can specify one trigger or an array of them.
@@ -2476,6 +2480,7 @@ class CarouselComponent {
2476
2480
  this.#carouselState.state = {
2477
2481
  activeItemIndex: this.activeIndex(),
2478
2482
  animate: this.animate(),
2483
+ interval: this.interval(),
2479
2484
  transition: this.transition()
2480
2485
  };
2481
2486
  this.setListeners();
@@ -2505,7 +2510,7 @@ class CarouselComponent {
2505
2510
  }
2506
2511
  #visible;
2507
2512
  setTimer() {
2508
- const interval = this.activeItemInterval || 0;
2513
+ const interval = this.activeItemInterval || this.interval();
2509
2514
  const direction = this.direction();
2510
2515
  this.resetTimer();
2511
2516
  if (interval > 0) {
@@ -2526,6 +2531,7 @@ class CarouselComponent {
2526
2531
  }
2527
2532
  this.activeItemInterval =
2528
2533
  typeof nextItem.interval === 'number' && nextItem.interval > -1 ? nextItem.interval : this.interval();
2534
+ console.log('activeItemInterval', nextItem.interval, this.activeItemInterval);
2529
2535
  const direction = this.direction();
2530
2536
  const isLastItem = (nextItem.active === nextItem.lastItemIndex && direction === 'next') ||
2531
2537
  (nextItem.active === 0 && direction === 'prev');
@@ -2620,10 +2626,6 @@ class CarouselControlComponent {
2620
2626
  this.carouselControlIconClass = computed(() => {
2621
2627
  return `carousel-control-${this.direction()}-icon`;
2622
2628
  });
2623
- this.content = viewChild('content', { read: ElementRef });
2624
- this.hasContent = computed(() => {
2625
- return this.content()?.nativeElement.childNodes.length ?? false;
2626
- });
2627
2629
  }
2628
2630
  #carouselState;
2629
2631
  onKeyUp($event) {
@@ -2645,7 +2647,7 @@ class CarouselControlComponent {
2645
2647
  this.#carouselState.state = { activeItemIndex: nextIndex };
2646
2648
  }
2647
2649
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2648
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: CarouselControlComponent, isStandalone: true, selector: "c-carousel-control", inputs: { captionInput: { classPropertyName: "captionInput", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "attr.role": "role()", "class": "hostClasses()" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ElementRef, isSignal: true }], exportAs: ["cCarouselControl"], ngImport: i0, template: "@if (hasContent()) {\n <div #content>\n <ng-content />\n </div>\n} @else {\n <span [class]=\"carouselControlIconClass()\" [attr.aria-label]=\"direction()\" [attr.aria-hidden]=\"true\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n}\n" }); }
2650
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: CarouselControlComponent, isStandalone: true, selector: "c-carousel-control", inputs: { captionInput: { classPropertyName: "captionInput", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "attr.role": "role()", "class": "hostClasses()" } }, exportAs: ["cCarouselControl"], ngImport: i0, template: "<ng-content>\n <span [attr.aria-hidden]=\"true\" [class]=\"carouselControlIconClass()\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n</ng-content>\n" }); }
2649
2651
  }
2650
2652
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselControlComponent, decorators: [{
2651
2653
  type: Component,
@@ -2654,7 +2656,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
2654
2656
  '[class]': 'hostClasses()',
2655
2657
  '(keyup)': 'onKeyUp($event)',
2656
2658
  '(click)': 'onClick($event)'
2657
- }, template: "@if (hasContent()) {\n <div #content>\n <ng-content />\n </div>\n} @else {\n <span [class]=\"carouselControlIconClass()\" [attr.aria-label]=\"direction()\" [attr.aria-hidden]=\"true\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n}\n" }]
2659
+ }, template: "<ng-content>\n <span [attr.aria-hidden]=\"true\" [class]=\"carouselControlIconClass()\"></span>\n <span class=\"visually-hidden\">{{ caption() }}</span>\n</ng-content>\n" }]
2658
2660
  }] });
2659
2661
 
2660
2662
  class CarouselIndicatorsComponent {
@@ -2719,6 +2721,12 @@ class CarouselItemComponent {
2719
2721
  * @default -1
2720
2722
  */
2721
2723
  this.interval = input(-1);
2724
+ /**
2725
+ * Carousel item role.
2726
+ * @return string
2727
+ * @default 'group'
2728
+ */
2729
+ this.role = input('group');
2722
2730
  this.#carouselService.carouselIndex$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((nextIndex) => {
2723
2731
  if ('active' in nextIndex) {
2724
2732
  this.active.set(nextIndex.active === this.index);
@@ -2726,13 +2734,14 @@ class CarouselItemComponent {
2726
2734
  });
2727
2735
  }
2728
2736
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2729
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: CarouselItemComponent, isStandalone: true, selector: "c-carousel-item", inputs: { activeInput: { classPropertyName: "activeInput", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "active()" }, classAttribute: "carousel-item" }, exportAs: ["cCarouselItem"], ngImport: i0, template: "@if (active()) {\n <ng-content />\n}\n", styles: [":host{display:block}\n"] }); }
2737
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: CarouselItemComponent, isStandalone: true, selector: "c-carousel-item", inputs: { activeInput: { classPropertyName: "activeInput", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "active()", "attr.role": "role()" }, classAttribute: "carousel-item" }, exportAs: ["cCarouselItem"], ngImport: i0, template: "@if (active()) {\n <ng-content />\n}\n", styles: [":host{display:block}\n"] }); }
2730
2738
  }
2731
2739
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselItemComponent, decorators: [{
2732
2740
  type: Component,
2733
2741
  args: [{ selector: 'c-carousel-item', exportAs: 'cCarouselItem', host: {
2734
2742
  class: 'carousel-item',
2735
- '[class.active]': 'active()'
2743
+ '[class.active]': 'active()',
2744
+ '[attr.role]': 'role()'
2736
2745
  }, template: "@if (active()) {\n <ng-content />\n}\n", styles: [":host{display:block}\n"] }]
2737
2746
  }], ctorParameters: () => [] });
2738
2747
 
@@ -2817,11 +2826,15 @@ class CarouselInnerComponent {
2817
2826
  this.#carouselState = inject(CarouselState);
2818
2827
  this.activeIndex = signal(undefined);
2819
2828
  this.animate = signal(true);
2829
+ this.interval = signal(0);
2820
2830
  this.slide = signal({ left: true });
2821
2831
  this.transition = signal('crossfade');
2822
2832
  this.slideType = computed(() => {
2823
2833
  return { left: this.slide().left, type: this.transition() };
2824
2834
  });
2835
+ this.ariaLive = computed(() => {
2836
+ return this.interval() ? 'off' : 'polite';
2837
+ });
2825
2838
  this.contentItems = contentChildren(CarouselItemComponent);
2826
2839
  this.#prevContentItems = signal([]);
2827
2840
  }
@@ -2837,8 +2850,9 @@ class CarouselInnerComponent {
2837
2850
  const nextDirection = state?.direction;
2838
2851
  if (this.activeIndex() !== nextIndex) {
2839
2852
  this.animate.set(state?.animate ?? false);
2840
- this.slide.set({ left: nextDirection === 'next' });
2841
2853
  this.activeIndex.set(state?.activeItemIndex);
2854
+ this.interval.set(state?.interval ?? 0);
2855
+ this.slide.set({ left: nextDirection === 'next' });
2842
2856
  this.transition.set(state?.transition ?? 'slide');
2843
2857
  }
2844
2858
  }
@@ -2850,14 +2864,15 @@ class CarouselInnerComponent {
2850
2864
  }
2851
2865
  }
2852
2866
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselInnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2853
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.5", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "@carouselPlay": "slideType()", "@.disabled": "!animate()" }, classAttribute: "carousel-inner" }, queries: [{ propertyName: "contentItems", predicate: CarouselItemComponent, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"], animations: [carouselPlay] }); }
2867
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.5", type: CarouselInnerComponent, isStandalone: true, selector: "c-carousel-inner", host: { properties: { "@carouselPlay": "slideType()", "@.disabled": "!animate()", "attr.aria-live": "ariaLive()" }, classAttribute: "carousel-inner" }, queries: [{ propertyName: "contentItems", predicate: CarouselItemComponent, isSignal: true }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host{display:block}\n"], animations: [carouselPlay] }); }
2854
2868
  }
2855
2869
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CarouselInnerComponent, decorators: [{
2856
2870
  type: Component,
2857
2871
  args: [{ selector: 'c-carousel-inner', animations: [carouselPlay], template: '<ng-content />', host: {
2858
2872
  class: 'carousel-inner',
2859
2873
  '[@carouselPlay]': 'slideType()',
2860
- '[@.disabled]': '!animate()'
2874
+ '[@.disabled]': '!animate()',
2875
+ '[attr.aria-live]': 'ariaLive()'
2861
2876
  }, styles: [":host{display:block}\n"] }]
2862
2877
  }] });
2863
2878
 
@@ -2946,31 +2961,43 @@ class DropdownMenuDirective {
2946
2961
  this.#destroyRef = inject(DestroyRef);
2947
2962
  this.elementRef = inject(ElementRef);
2948
2963
  this.#dropdownService = inject(DropdownService);
2964
+ /**
2965
+ * Set alignment of dropdown menu.
2966
+ * @return 'start' | 'end'
2967
+ */
2968
+ this.alignment = input();
2949
2969
  /**
2950
2970
  * Toggle the visibility of dropdown menu component.
2951
- * @type boolean
2971
+ * @return boolean
2952
2972
  */
2953
- this.visible = false;
2973
+ this.visibleInput = input(false, { alias: 'visible' });
2974
+ this.visible = linkedSignal({
2975
+ source: () => this.visibleInput(),
2976
+ computation: (value) => value
2977
+ });
2978
+ this.hostClasses = computed(() => {
2979
+ const alignment = this.alignment();
2980
+ const visible = this.visible();
2981
+ return {
2982
+ 'dropdown-menu': true,
2983
+ [`dropdown-menu-${alignment}`]: !!alignment,
2984
+ show: visible
2985
+ };
2986
+ });
2987
+ this.hostStyles = computed(() => {
2988
+ // workaround for popper position calculate (see also: dropdown.component)
2989
+ const visible = this.visible();
2990
+ return {
2991
+ visibility: visible ? null : '',
2992
+ display: visible ? null : ''
2993
+ };
2994
+ });
2954
2995
  }
2955
2996
  #destroyRef;
2956
2997
  #dropdownService;
2957
2998
  #focusKeyManager;
2958
- get hostClasses() {
2959
- return {
2960
- 'dropdown-menu': true,
2961
- [`dropdown-menu-${this.alignment}`]: !!this.alignment,
2962
- show: this.visible
2963
- };
2964
- }
2965
- get hostStyles() {
2966
- // workaround for popper position calculate (see also: dropdown.component)
2967
- return {
2968
- visibility: this.visible ? null : '',
2969
- display: this.visible ? null : ''
2970
- };
2971
- }
2972
2999
  onKeyDown($event) {
2973
- if (!this.visible) {
3000
+ if (!this.visible()) {
2974
3001
  return;
2975
3002
  }
2976
3003
  if (['Space', 'ArrowDown'].includes($event.code)) {
@@ -2979,7 +3006,7 @@ class DropdownMenuDirective {
2979
3006
  this.#focusKeyManager.onKeydown($event);
2980
3007
  }
2981
3008
  onKeyUp($event) {
2982
- if (!this.visible) {
3009
+ if (!this.visible()) {
2983
3010
  return;
2984
3011
  }
2985
3012
  if (['Tab'].includes($event.key)) {
@@ -3003,8 +3030,8 @@ class DropdownMenuDirective {
3003
3030
  this.#dropdownService.dropdownState$
3004
3031
  .pipe(tap((state) => {
3005
3032
  if ('visible' in state) {
3006
- this.visible = state.visible === 'toggle' ? !this.visible : state.visible;
3007
- if (!this.visible) {
3033
+ this.visible.update((visible) => (state.visible === 'toggle' ? !visible : state.visible));
3034
+ if (!this.visible()) {
3008
3035
  this.#focusKeyManager?.setActiveItem(-1);
3009
3036
  }
3010
3037
  }
@@ -3019,7 +3046,7 @@ class DropdownMenuDirective {
3019
3046
  .skipPredicate((dropdownItem) => dropdownItem.disabled === true);
3020
3047
  }
3021
3048
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3022
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: DropdownMenuDirective, isStandalone: true, selector: "[cDropdownMenu]", inputs: { alignment: "alignment", visible: "visible" }, host: { listeners: { "keydown": "onKeyDown($event)", "keyup": "onKeyUp($event)" }, properties: { "class": "this.hostClasses", "style": "this.hostStyles" }, classAttribute: "dropdown-menu" }, queries: [{ propertyName: "dropdownItemsContent", predicate: i0.forwardRef(() => DropdownItemDirective), descendants: true }], exportAs: ["cDropdownMenu"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0 }); }
3049
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: DropdownMenuDirective, isStandalone: true, selector: "[cDropdownMenu]", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeyDown($event)", "keyup": "onKeyUp($event)" }, properties: { "class": "hostClasses()", "style": "hostStyles()" }, classAttribute: "dropdown-menu" }, queries: [{ propertyName: "dropdownItemsContent", predicate: i0.forwardRef(() => DropdownItemDirective), descendants: true }], exportAs: ["cDropdownMenu"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0 }); }
3023
3050
  }
3024
3051
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownMenuDirective, decorators: [{
3025
3052
  type: Directive,
@@ -3027,25 +3054,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
3027
3054
  selector: '[cDropdownMenu]',
3028
3055
  exportAs: 'cDropdownMenu',
3029
3056
  hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }],
3030
- host: { class: 'dropdown-menu' }
3057
+ host: {
3058
+ class: 'dropdown-menu',
3059
+ '[class]': 'hostClasses()',
3060
+ '[style]': 'hostStyles()',
3061
+ '(keydown)': 'onKeyDown($event)',
3062
+ '(keyup)': 'onKeyUp($event)'
3063
+ }
3031
3064
  }]
3032
- }], propDecorators: { alignment: [{
3033
- type: Input
3034
- }], visible: [{
3035
- type: Input
3036
- }], hostClasses: [{
3037
- type: HostBinding,
3038
- args: ['class']
3039
- }], hostStyles: [{
3040
- type: HostBinding,
3041
- args: ['style']
3042
- }], onKeyDown: [{
3043
- type: HostListener,
3044
- args: ['keydown', ['$event']]
3045
- }], onKeyUp: [{
3046
- type: HostListener,
3047
- args: ['keyup', ['$event']]
3048
- }], dropdownItemsContent: [{
3065
+ }], propDecorators: { dropdownItemsContent: [{
3049
3066
  type: ContentChildren,
3050
3067
  args: [forwardRef(() => DropdownItemDirective), { descendants: true }]
3051
3068
  }] } });
@@ -3060,86 +3077,79 @@ class DropdownToggleDirective {
3060
3077
  this.elementRef = inject(ElementRef);
3061
3078
  this.#dropdownService = inject(DropdownService);
3062
3079
  this.dropdown = inject(DropdownToken, { optional: true });
3080
+ /**
3081
+ * Reference to dropdown component.
3082
+ * @return DropdownComponent | undefined
3083
+ * @default undefined
3084
+ */
3085
+ this.dropdownComponent = input();
3063
3086
  /**
3064
3087
  * Disables the toggler.
3065
- * @type boolean
3088
+ * @return boolean
3066
3089
  * @default false
3067
3090
  */
3068
- this.disabled = false;
3091
+ this.disabled = input(false, { transform: booleanAttribute });
3069
3092
  /**
3070
3093
  * Enables pseudo element caret on toggler.
3071
- * @type boolean
3094
+ * @return boolean
3072
3095
  */
3073
- this.caret = true;
3096
+ this.caret = input(true);
3074
3097
  /**
3075
3098
  * Create split button dropdowns with virtually the same markup as single button dropdowns,
3076
3099
  * but with the addition of `.dropdown-toggle-split` class for proper spacing around the dropdown caret.
3077
- * @type boolean
3100
+ * @return boolean
3078
3101
  * @default false
3079
3102
  */
3080
- this.split = false;
3103
+ this.split = input(false, { transform: booleanAttribute });
3104
+ this.hostClasses = computed(() => {
3105
+ return {
3106
+ 'dropdown-toggle': this.caret(),
3107
+ 'dropdown-toggle-split': this.split(),
3108
+ disabled: this.disabled()
3109
+ };
3110
+ });
3081
3111
  this.#ariaExpanded = signal(false);
3082
3112
  }
3083
3113
  // injections
3084
3114
  #destroyRef;
3085
3115
  #dropdownService;
3086
- get hostClasses() {
3087
- return {
3088
- 'dropdown-toggle': this.caret,
3089
- 'dropdown-toggle-split': this.split,
3090
- disabled: this.disabled
3091
- };
3092
- }
3093
3116
  #ariaExpanded;
3094
3117
  get ariaExpanded() {
3095
3118
  return this.#ariaExpanded();
3096
3119
  }
3097
3120
  onClick($event) {
3098
3121
  $event.preventDefault();
3099
- !this.disabled && this.#dropdownService.toggle({ visible: 'toggle', dropdown: this.dropdown });
3122
+ !this.disabled() && this.#dropdownService.toggle({ visible: 'toggle', dropdown: this.dropdown });
3100
3123
  }
3101
3124
  ngAfterViewInit() {
3102
- if (this.dropdownComponent) {
3103
- this.dropdown = this.dropdownComponent;
3104
- this.#dropdownService = this.dropdownComponent?.dropdownService;
3125
+ const dropdownComponent = this.dropdownComponent();
3126
+ if (dropdownComponent) {
3127
+ this.dropdown = dropdownComponent;
3128
+ this.#dropdownService = dropdownComponent?.dropdownService;
3105
3129
  }
3106
3130
  if (this.dropdown) {
3107
3131
  const dropdown = this.dropdown;
3108
- dropdown?.visibleChange?.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((visible) => {
3132
+ dropdown?.visibleChange?.subscribe((visible) => {
3109
3133
  this.#ariaExpanded.set(visible);
3110
3134
  });
3111
3135
  }
3112
3136
  }
3113
3137
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3114
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.1.5", type: DropdownToggleDirective, isStandalone: true, selector: "[cDropdownToggle]", inputs: { dropdownComponent: "dropdownComponent", disabled: ["disabled", "disabled", booleanAttribute], caret: "caret", split: ["split", "split", booleanAttribute] }, host: { listeners: { "click": "onClick($event)" }, properties: { "class": "this.hostClasses", "attr.aria-expanded": "this.ariaExpanded" } }, providers: [{ provide: DropdownToken, useExisting: forwardRef(() => DropdownComponent) }], exportAs: ["cDropdownToggle"], ngImport: i0 }); }
3138
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: DropdownToggleDirective, isStandalone: true, selector: "[cDropdownToggle]", inputs: { dropdownComponent: { classPropertyName: "dropdownComponent", publicName: "dropdownComponent", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, caret: { classPropertyName: "caret", publicName: "caret", isSignal: true, isRequired: false, transformFunction: null }, split: { classPropertyName: "split", publicName: "split", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "class": "hostClasses()", "attr.aria-expanded": "ariaExpanded" } }, providers: [{ provide: DropdownToken, useExisting: forwardRef(() => DropdownComponent) }], exportAs: ["cDropdownToggle"], ngImport: i0 }); }
3115
3139
  }
3116
3140
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownToggleDirective, decorators: [{
3117
3141
  type: Directive,
3118
3142
  args: [{
3119
3143
  selector: '[cDropdownToggle]',
3120
3144
  providers: [{ provide: DropdownToken, useExisting: forwardRef(() => DropdownComponent) }],
3121
- exportAs: 'cDropdownToggle'
3145
+ exportAs: 'cDropdownToggle',
3146
+ host: {
3147
+ '[class]': 'hostClasses()',
3148
+ '[attr.aria-expanded]': 'ariaExpanded',
3149
+ '(click)': 'onClick($event)'
3150
+ }
3122
3151
  }]
3123
- }], propDecorators: { dropdownComponent: [{
3124
- type: Input
3125
- }], disabled: [{
3126
- type: Input,
3127
- args: [{ transform: booleanAttribute }]
3128
- }], caret: [{
3129
- type: Input
3130
- }], split: [{
3131
- type: Input,
3132
- args: [{ transform: booleanAttribute }]
3133
- }], hostClasses: [{
3134
- type: HostBinding,
3135
- args: ['class']
3136
- }], ariaExpanded: [{
3137
- type: HostBinding,
3138
- args: ['attr.aria-expanded']
3139
- }], onClick: [{
3140
- type: HostListener,
3141
- args: ['click', ['$event']]
3142
- }] } });
3152
+ }] });
3143
3153
  class DropdownComponent {
3144
3154
  constructor(document, elementRef, renderer, ngZone, changeDetectorRef, dropdownService) {
3145
3155
  this.document = document;
@@ -3148,45 +3158,93 @@ class DropdownComponent {
3148
3158
  this.ngZone = ngZone;
3149
3159
  this.changeDetectorRef = changeDetectorRef;
3150
3160
  this.dropdownService = dropdownService;
3151
- this.autoClose = true;
3161
+ /**
3162
+ * Set alignment of dropdown menu.
3163
+ * @return {'start' | 'end' | { xs: 'start' | 'end' } | { sm: 'start' | 'end' } | { md: 'start' | 'end' } | { lg: 'start' | 'end' } | { xl: 'start' | 'end'} | { xxl: 'start' | 'end'}}
3164
+ */
3165
+ this.alignment = input();
3166
+ /**
3167
+ * Automatically close dropdown when clicking outside the dropdown menu.
3168
+ */
3169
+ this.autoClose = input(true);
3170
+ /**
3171
+ * Sets a specified direction and location of the dropdown menu.
3172
+ * @return 'dropup' | 'dropend' | 'dropstart'
3173
+ */
3174
+ this.direction = input();
3152
3175
  /**
3153
3176
  * Describes the placement of your component after Popper.js has applied all the modifiers
3154
3177
  * that may have flipped or altered the originally provided placement property.
3155
- * @type Placement
3178
+ * @return Placement
3156
3179
  */
3157
- this.placement = 'bottom-start';
3180
+ this.placement = input('bottom-start');
3158
3181
  /**
3159
3182
  * If you want to disable dynamic positioning set this property to `false`.
3160
- * @type boolean
3183
+ * @return boolean
3161
3184
  * @default true
3162
3185
  */
3163
- this.popper = true;
3164
- this._popperOptions = {
3165
- placement: this.placement,
3186
+ this.popper = input(true, { transform: booleanAttribute });
3187
+ /**
3188
+ * Optional popper Options object, placement prop takes precedence over
3189
+ * @return Partial<Options>
3190
+ */
3191
+ this.popperOptionsInput = input({}, { alias: 'popperOptions' });
3192
+ this.popperOptionsEffect = effect(() => {
3193
+ this.popperOptions = { ...untracked(this.#popperOptions), ...this.popperOptionsInput() };
3194
+ });
3195
+ this.#popperOptions = signal({
3196
+ placement: this.placement(),
3166
3197
  modifiers: [],
3167
3198
  strategy: 'absolute'
3168
- };
3199
+ });
3169
3200
  /**
3170
3201
  * Set the dropdown variant to a btn-group, dropdown, input-group, and nav-item.
3171
3202
  */
3172
- this.variant = 'dropdown';
3173
- this._visible = false;
3174
- this.visibleChange = new EventEmitter();
3175
- this.dropdownContext = { $implicit: this.visible };
3203
+ this.variant = input('dropdown');
3204
+ /**
3205
+ * Toggle the visibility of dropdown menu component.
3206
+ * @return boolean
3207
+ * @default false
3208
+ */
3209
+ this.visibleInput = input(false, { transform: booleanAttribute, alias: 'visible' });
3210
+ this.visible = linkedSignal({
3211
+ source: () => this.visibleInput(),
3212
+ computation: (value) => value
3213
+ });
3214
+ this.visibleEffect = effect(() => {
3215
+ const visible = this.visible();
3216
+ this.activeTrap = visible;
3217
+ visible ? this.createPopperInstance() : this.destroyPopperInstance();
3218
+ this.setVisibleState(visible);
3219
+ this.visibleChange.emit(visible);
3220
+ });
3221
+ this.visibleChange = output();
3222
+ this.dropdownContext = { $implicit: this.visible() };
3176
3223
  this.activeTrap = false;
3177
3224
  this.listeners = [];
3225
+ this.hostClasses = computed(() => {
3226
+ const direction = this.direction();
3227
+ const variant = this.variant();
3228
+ return {
3229
+ dropdown: (variant === 'dropdown' || variant === 'nav-item') && !direction,
3230
+ [`${direction}`]: !!direction,
3231
+ [`${variant}`]: !!variant,
3232
+ dropup: direction === 'dropup' || direction === 'dropup-center',
3233
+ show: this.visible()
3234
+ };
3235
+ });
3236
+ // todo: find better solution
3237
+ this.hostStyle = computed(() => {
3238
+ return this.variant() === 'input-group' ? { display: 'contents' } : {};
3239
+ });
3178
3240
  this.dropdownStateSubscribe();
3179
3241
  }
3180
- /**
3181
- * Optional popper Options object, placement prop takes precedence over
3182
- * @type Partial<Options>
3183
- */
3184
3242
  set popperOptions(value) {
3185
- this._popperOptions = { ...this._popperOptions, ...value };
3243
+ this.#popperOptions.update((popperOptions) => ({ ...popperOptions, ...value }));
3186
3244
  }
3187
3245
  get popperOptions() {
3188
- let placement = this.placement;
3189
- switch (this.direction) {
3246
+ let placement = this.placement();
3247
+ switch (this.direction()) {
3190
3248
  case 'dropup': {
3191
3249
  placement = 'top-start';
3192
3250
  break;
@@ -3208,42 +3266,13 @@ class DropdownComponent {
3208
3266
  break;
3209
3267
  }
3210
3268
  }
3211
- if (this.alignment === 'end') {
3269
+ if (this.alignment() === 'end') {
3212
3270
  placement = 'bottom-end';
3213
3271
  }
3214
- this._popperOptions = { ...this._popperOptions, placement: placement };
3215
- return this._popperOptions;
3216
- }
3217
- /**
3218
- * Toggle the visibility of dropdown menu component.
3219
- * @type boolean
3220
- * @default false
3221
- */
3222
- set visible(value) {
3223
- const _value = value;
3224
- if (_value !== this._visible) {
3225
- this.activeTrap = _value;
3226
- this._visible = _value;
3227
- _value ? this.createPopperInstance() : this.destroyPopperInstance();
3228
- this.visibleChange.emit(_value);
3229
- }
3230
- }
3231
- get visible() {
3232
- return this._visible;
3233
- }
3234
- get hostClasses() {
3235
- return {
3236
- dropdown: (this.variant === 'dropdown' || this.variant === 'nav-item') && !this.direction,
3237
- [`${this.direction}`]: !!this.direction,
3238
- [`${this.variant}`]: !!this.variant,
3239
- dropup: this.direction === 'dropup' || this.direction === 'dropup-center',
3240
- show: this.visible
3241
- };
3242
- }
3243
- // todo: find better solution
3244
- get hostStyle() {
3245
- return this.variant === 'input-group' ? { display: 'contents' } : {};
3272
+ this.#popperOptions.update((value) => ({ ...value, placement: placement }));
3273
+ return this.#popperOptions();
3246
3274
  }
3275
+ #popperOptions;
3247
3276
  onHostClick($event) {
3248
3277
  this.clickedTarget = $event.target;
3249
3278
  }
@@ -3255,7 +3284,7 @@ class DropdownComponent {
3255
3284
  }))
3256
3285
  .subscribe((state) => {
3257
3286
  if ('visible' in state) {
3258
- state?.visible === 'toggle' ? this.toggleDropdown() : (this.visible = state.visible);
3287
+ state?.visible === 'toggle' ? this.toggleDropdown() : this.visible.set(state.visible);
3259
3288
  }
3260
3289
  });
3261
3290
  }
@@ -3264,7 +3293,7 @@ class DropdownComponent {
3264
3293
  }
3265
3294
  }
3266
3295
  toggleDropdown() {
3267
- this.visible = !this.visible;
3296
+ this.visible.update((visible) => !visible);
3268
3297
  }
3269
3298
  onClick(event) {
3270
3299
  if (!this._toggler?.elementRef.nativeElement.contains(event.target?.closest('[cDropdownToggle]'))) {
@@ -3272,17 +3301,12 @@ class DropdownComponent {
3272
3301
  }
3273
3302
  }
3274
3303
  ngAfterContentInit() {
3275
- if (this.variant === 'nav-item') {
3304
+ if (this.variant() === 'nav-item') {
3276
3305
  this.renderer.addClass(this._toggler.elementRef.nativeElement, 'nav-link');
3277
3306
  }
3278
3307
  }
3279
3308
  ngOnInit() {
3280
- this.setVisibleState(this.visible);
3281
- }
3282
- ngOnChanges(changes) {
3283
- if (changes['visible'] && !changes['visible'].firstChange) {
3284
- this.setVisibleState(changes['visible'].currentValue);
3285
- }
3309
+ this.setVisibleState(this.visible());
3286
3310
  }
3287
3311
  ngOnDestroy() {
3288
3312
  this.clearListeners();
@@ -3299,7 +3323,7 @@ class DropdownComponent {
3299
3323
  // workaround for popper position calculate (see also: dropdown-menu.component)
3300
3324
  this._menu.elementRef.nativeElement.style.visibility = 'hidden';
3301
3325
  this._menu.elementRef.nativeElement.style.display = 'block';
3302
- if (this.popper) {
3326
+ if (this.popper()) {
3303
3327
  this.popperInstance = createPopper(this._toggler.elementRef.nativeElement, this._menu.elementRef.nativeElement, { ...this.popperOptions });
3304
3328
  }
3305
3329
  this.ngZone.run(() => {
@@ -3325,28 +3349,31 @@ class DropdownComponent {
3325
3349
  if (this._toggler?.elementRef.nativeElement.contains(event.target)) {
3326
3350
  return;
3327
3351
  }
3328
- if (this.autoClose === true) {
3352
+ const autoClose = this.autoClose();
3353
+ if (autoClose === true) {
3329
3354
  this.setVisibleState(false);
3330
3355
  return;
3331
3356
  }
3332
- if (this.clickedTarget === target && this.autoClose === 'inside') {
3357
+ if (this.clickedTarget === target && autoClose === 'inside') {
3333
3358
  this.setVisibleState(false);
3334
3359
  return;
3335
3360
  }
3336
- if (this.clickedTarget !== target && this.autoClose === 'outside') {
3361
+ if (this.clickedTarget !== target && autoClose === 'outside') {
3337
3362
  this.setVisibleState(false);
3338
3363
  return;
3339
3364
  }
3340
3365
  }));
3341
3366
  this.listeners.push(this.renderer.listen(this.elementRef.nativeElement, 'keyup', (event) => {
3342
- if (event.key === 'Escape' && this.autoClose !== false) {
3367
+ if (event.key === 'Escape' && this.autoClose() !== false) {
3343
3368
  event.stopPropagation();
3344
3369
  this.setVisibleState(false);
3345
3370
  return;
3346
3371
  }
3347
3372
  }));
3348
3373
  this.listeners.push(this.renderer.listen(this.document, 'keyup', (event) => {
3349
- if (event.key === 'Tab' && this.autoClose !== false && !this.elementRef.nativeElement.contains(event.target)) {
3374
+ if (event.key === 'Tab' &&
3375
+ this.autoClose() !== false &&
3376
+ !this.elementRef.nativeElement.contains(event.target)) {
3350
3377
  this.setVisibleState(false);
3351
3378
  return;
3352
3379
  }
@@ -3361,35 +3388,19 @@ class DropdownComponent {
3361
3388
  this.listeners = [];
3362
3389
  }
3363
3390
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownComponent, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: DropdownService }], target: i0.ɵɵFactoryTarget.Component }); }
3364
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.5", type: DropdownComponent, isStandalone: true, selector: "c-dropdown", inputs: { alignment: "alignment", autoClose: "autoClose", direction: "direction", placement: "placement", popper: ["popper", "popper", booleanAttribute], popperOptions: "popperOptions", variant: "variant", visible: ["visible", "visible", booleanAttribute] }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "click": "onHostClick($event)" }, properties: { "class": "this.hostClasses", "style": "this.hostStyle" } }, providers: [DropdownService], queries: [{ propertyName: "_toggler", first: true, predicate: DropdownToggleDirective, descendants: true }, { propertyName: "_menu", first: true, predicate: DropdownMenuDirective, descendants: true }, { propertyName: "_menuElementRef", first: true, predicate: DropdownMenuDirective, descendants: true, read: ElementRef }], exportAs: ["cDropdown"], usesOnChanges: true, hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host-context(.dropdown,.dropup):not(.btn-group){display:block}:host-context(.dropstart,.dropend):not(.btn-group){display:inline-flex}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host{direction:rtl}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}\n"] }); }
3391
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: DropdownComponent, isStandalone: true, selector: "c-dropdown", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, autoClose: { classPropertyName: "autoClose", publicName: "autoClose", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, popper: { classPropertyName: "popper", publicName: "popper", isSignal: true, isRequired: false, transformFunction: null }, popperOptionsInput: { classPropertyName: "popperOptionsInput", publicName: "popperOptions", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "click": "onHostClick($event)" }, properties: { "class": "hostClasses()", "style": "hostStyle()" } }, providers: [DropdownService], queries: [{ propertyName: "_toggler", first: true, predicate: DropdownToggleDirective, descendants: true }, { propertyName: "_menu", first: true, predicate: DropdownMenuDirective, descendants: true }, { propertyName: "_menuElementRef", first: true, predicate: DropdownMenuDirective, descendants: true, read: ElementRef }], exportAs: ["cDropdown"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":host-context(.dropdown,.dropup):not(.btn-group){display:block}:host-context(.dropstart,.dropend):not(.btn-group){display:inline-flex}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host{direction:rtl}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}\n"] }); }
3365
3392
  }
3366
3393
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownComponent, decorators: [{
3367
3394
  type: Component,
3368
- args: [{ selector: 'c-dropdown', template: '<ng-content />', exportAs: 'cDropdown', providers: [DropdownService], hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }], styles: [":host-context(.dropdown,.dropup):not(.btn-group){display:block}:host-context(.dropstart,.dropend):not(.btn-group){display:inline-flex}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host{direction:rtl}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}\n"] }]
3395
+ args: [{ selector: 'c-dropdown', template: '<ng-content />', exportAs: 'cDropdown', providers: [DropdownService], hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }], host: {
3396
+ '[class]': 'hostClasses()',
3397
+ '[style]': 'hostStyle()',
3398
+ '(click)': 'onHostClick($event)'
3399
+ }, styles: [":host-context(.dropdown,.dropup):not(.btn-group){display:block}:host-context(.dropstart,.dropend):not(.btn-group){display:inline-flex}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-right-radius:0;border-bottom-right-radius:0}:host-context(html:not([dir=rtl])) :host-context(.input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host{direction:rtl}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :first-child{border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child{border-top-right-radius:0;border-bottom-right-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :first-child:not(:only-of-type){border-top-left-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl] .input-group) :host:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0}\n"] }]
3369
3400
  }], ctorParameters: () => [{ type: Document, decorators: [{
3370
3401
  type: Inject,
3371
3402
  args: [DOCUMENT]
3372
- }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DropdownService }], propDecorators: { alignment: [{
3373
- type: Input
3374
- }], autoClose: [{
3375
- type: Input
3376
- }], direction: [{
3377
- type: Input
3378
- }], placement: [{
3379
- type: Input
3380
- }], popper: [{
3381
- type: Input,
3382
- args: [{ transform: booleanAttribute }]
3383
- }], popperOptions: [{
3384
- type: Input
3385
- }], variant: [{
3386
- type: Input
3387
- }], visible: [{
3388
- type: Input,
3389
- args: [{ transform: booleanAttribute }]
3390
- }], visibleChange: [{
3391
- type: Output
3392
- }], _toggler: [{
3403
+ }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DropdownService }], propDecorators: { _toggler: [{
3393
3404
  type: ContentChild,
3394
3405
  args: [DropdownToggleDirective]
3395
3406
  }], _menu: [{
@@ -3398,15 +3409,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
3398
3409
  }], _menuElementRef: [{
3399
3410
  type: ContentChild,
3400
3411
  args: [DropdownMenuDirective, { read: ElementRef }]
3401
- }], hostClasses: [{
3402
- type: HostBinding,
3403
- args: ['class']
3404
- }], hostStyle: [{
3405
- type: HostBinding,
3406
- args: ['style']
3407
- }], onHostClick: [{
3408
- type: HostListener,
3409
- args: ['click', ['$event']]
3410
3412
  }] } });
3411
3413
 
3412
3414
  class DropdownItemDirective {
@@ -3414,90 +3416,90 @@ class DropdownItemDirective {
3414
3416
  this.#elementRef = inject(ElementRef);
3415
3417
  this.#dropdownService = inject(DropdownService);
3416
3418
  this.dropdown = inject(DropdownComponent, { optional: true });
3419
+ /**
3420
+ * Set active state to a dropdown-item.
3421
+ * @return boolean
3422
+ * @default undefined
3423
+ */
3424
+ this.active = input();
3417
3425
  /**
3418
3426
  * Configure dropdown-item close dropdown behavior.
3419
- * @type boolean
3427
+ * @return boolean
3420
3428
  * @default true
3421
3429
  */
3422
- this.autoClose = true;
3423
- this._tabIndex = null;
3430
+ this.autoClose = input(true);
3431
+ /**
3432
+ * Disables a dropdown-item.
3433
+ * @return boolean
3434
+ * @default undefined
3435
+ */
3436
+ this.disabledInput = input(false, { transform: booleanAttribute, alias: 'disabled' });
3437
+ this.disabledEffect = linkedSignal({
3438
+ source: this.disabledInput,
3439
+ computation: (value) => value
3440
+ });
3441
+ this.ariaCurrent = computed(() => {
3442
+ return this.active() ? 'true' : null;
3443
+ });
3444
+ this.hostClasses = computed(() => {
3445
+ return {
3446
+ 'dropdown-item': true,
3447
+ active: this.active(),
3448
+ disabled: this.disabled
3449
+ };
3450
+ });
3451
+ this.tabIndexInput = input(null, { alias: 'tabIndex' });
3452
+ this.tabIndex = linkedSignal({
3453
+ source: this.tabIndexInput,
3454
+ computation: (value) => (this.disabled ? '-1' : value)
3455
+ });
3424
3456
  }
3425
3457
  #elementRef;
3426
3458
  #dropdownService;
3459
+ set disabled(value) {
3460
+ this.disabledEffect.set(value);
3461
+ }
3462
+ get disabled() {
3463
+ return this.disabledEffect();
3464
+ }
3427
3465
  focus(origin) {
3428
3466
  this.#elementRef?.nativeElement?.focus();
3429
3467
  }
3430
3468
  getLabel() {
3431
3469
  return this.#elementRef?.nativeElement?.textContent.trim();
3432
3470
  }
3433
- get ariaCurrent() {
3434
- return this.active ? 'true' : null;
3435
- }
3436
- get hostClasses() {
3437
- return {
3438
- 'dropdown-item': true,
3439
- active: this.active,
3440
- disabled: this.disabled
3441
- };
3442
- }
3443
- set tabIndex(value) {
3444
- this._tabIndex = value;
3445
- }
3446
- get tabIndex() {
3447
- return this.disabled ? '-1' : this._tabIndex;
3448
- }
3449
- get isDisabled() {
3450
- return this.disabled || null;
3451
- }
3452
3471
  onClick($event) {
3453
- if (this.autoClose) {
3454
- this.#dropdownService.toggle({ visible: 'toggle', dropdown: this.dropdown });
3455
- }
3472
+ this.handleInteraction();
3456
3473
  }
3457
3474
  onKeyUp($event) {
3458
3475
  if ($event.key === 'Enter') {
3459
- if (this.autoClose) {
3460
- this.#dropdownService.toggle({ visible: false, dropdown: this.dropdown });
3461
- }
3476
+ this.handleInteraction();
3477
+ }
3478
+ }
3479
+ handleInteraction() {
3480
+ if (this.autoClose()) {
3481
+ this.#dropdownService.toggle({ visible: 'toggle', dropdown: this.dropdown });
3462
3482
  }
3463
3483
  }
3464
3484
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3465
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: DropdownItemDirective, isStandalone: true, selector: "[cDropdownItem]", inputs: { active: "active", autoClose: "autoClose", disabled: "disabled", tabIndex: "tabIndex" }, host: { listeners: { "click": "onClick($event)", "keyup": "onKeyUp($event)" }, properties: { "attr.aria-current": "this.ariaCurrent", "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.aria-disabled": "this.isDisabled" }, classAttribute: "dropdown-item" }, exportAs: ["cDropdownItem"], ngImport: i0 }); }
3485
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: DropdownItemDirective, isStandalone: true, selector: "[cDropdownItem]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, autoClose: { classPropertyName: "autoClose", publicName: "autoClose", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndexInput: { classPropertyName: "tabIndexInput", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keyup": "onKeyUp($event)" }, properties: { "class": "hostClasses()", "attr.tabindex": "tabIndex()", "attr.aria-current": "ariaCurrent()", "attr.aria-disabled": "disabled || null" }, classAttribute: "dropdown-item" }, exportAs: ["cDropdownItem"], ngImport: i0 }); }
3466
3486
  }
3467
3487
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownItemDirective, decorators: [{
3468
3488
  type: Directive,
3469
3489
  args: [{
3470
3490
  selector: '[cDropdownItem]',
3471
3491
  exportAs: 'cDropdownItem',
3472
- host: { class: 'dropdown-item' }
3492
+ host: {
3493
+ class: 'dropdown-item',
3494
+ '[class]': 'hostClasses()',
3495
+ '[attr.tabindex]': 'tabIndex()',
3496
+ '[attr.aria-current]': 'ariaCurrent()',
3497
+ '[attr.aria-disabled]': 'disabled || null',
3498
+ '(click)': 'onClick($event)',
3499
+ '(keyup)': 'onKeyUp($event)'
3500
+ }
3473
3501
  }]
3474
- }], propDecorators: { active: [{
3475
- type: Input
3476
- }], autoClose: [{
3477
- type: Input
3478
- }], disabled: [{
3479
- type: Input
3480
- }], ariaCurrent: [{
3481
- type: HostBinding,
3482
- args: ['attr.aria-current']
3483
- }], hostClasses: [{
3484
- type: HostBinding,
3485
- args: ['class']
3486
- }], tabIndex: [{
3487
- type: HostBinding,
3488
- args: ['attr.tabindex']
3489
- }, {
3490
- type: Input
3491
- }], isDisabled: [{
3492
- type: HostBinding,
3493
- args: ['attr.aria-disabled']
3494
- }], onClick: [{
3495
- type: HostListener,
3496
- args: ['click', ['$event']]
3497
- }], onKeyUp: [{
3498
- type: HostListener,
3499
- args: ['keyup', ['$event']]
3500
- }] } });
3502
+ }] });
3501
3503
 
3502
3504
  class DropdownItemPlainDirective {
3503
3505
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownItemPlainDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
@@ -3515,68 +3517,61 @@ class DropdownCloseDirective {
3515
3517
  constructor() {
3516
3518
  this.#dropdownService = inject(DropdownService);
3517
3519
  this.dropdown = inject(DropdownComponent, { optional: true });
3518
- this._tabIndex = null;
3520
+ /**
3521
+ * Disables a dropdown-close directive.
3522
+ * @return boolean
3523
+ * @default false
3524
+ */
3525
+ this.disabledInput = input(false, { transform: booleanAttribute, alias: 'disabled' });
3526
+ this.disabled = linkedSignal({
3527
+ source: this.disabledInput,
3528
+ computation: (value) => value || null
3529
+ });
3530
+ this.dropdownComponent = input();
3531
+ this.tabIndexInput = input(null, { alias: 'tabIndex' });
3532
+ this.tabIndex = linkedSignal({
3533
+ source: this.tabIndexInput,
3534
+ computation: (value) => (this.disabled() ? '-1' : value)
3535
+ });
3519
3536
  }
3520
3537
  #dropdownService;
3521
3538
  ngAfterViewInit() {
3522
- if (this.dropdownComponent) {
3523
- this.dropdown = this.dropdownComponent;
3524
- this.#dropdownService = this.dropdownComponent?.dropdownService;
3539
+ const dropdownComponent = this.dropdownComponent();
3540
+ if (dropdownComponent) {
3541
+ this.dropdown = dropdownComponent;
3542
+ this.#dropdownService = dropdownComponent?.dropdownService;
3525
3543
  }
3526
3544
  }
3527
- get hostClasses() {
3528
- return {
3529
- disabled: this.disabled
3530
- };
3531
- }
3532
- set tabIndex(value) {
3533
- this._tabIndex = value;
3534
- }
3535
- get tabIndex() {
3536
- return this.disabled ? '-1' : this._tabIndex;
3537
- }
3538
- get isDisabled() {
3539
- return this.disabled || null;
3540
- }
3541
3545
  onClick($event) {
3542
- !this.disabled && this.#dropdownService.toggle({ visible: false, dropdown: this.dropdown });
3546
+ this.handleToggle();
3543
3547
  }
3544
3548
  onKeyUp($event) {
3545
3549
  if ($event.key === 'Enter') {
3546
- !this.disabled && this.#dropdownService.toggle({ visible: false, dropdown: this.dropdown });
3550
+ this.handleToggle();
3551
+ }
3552
+ }
3553
+ handleToggle() {
3554
+ if (!this.disabled()) {
3555
+ this.#dropdownService.toggle({ visible: false, dropdown: this.dropdown });
3547
3556
  }
3548
3557
  }
3549
3558
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownCloseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3550
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.5", type: DropdownCloseDirective, isStandalone: true, selector: "[cDropdownClose]", inputs: { disabled: "disabled", dropdownComponent: "dropdownComponent", tabIndex: "tabIndex" }, host: { listeners: { "click": "onClick($event)", "keyup": "onKeyUp($event)" }, properties: { "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.aria-disabled": "this.isDisabled" } }, exportAs: ["cDropdownClose"], ngImport: i0 }); }
3559
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: DropdownCloseDirective, isStandalone: true, selector: "[cDropdownClose]", inputs: { disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dropdownComponent: { classPropertyName: "dropdownComponent", publicName: "dropdownComponent", isSignal: true, isRequired: false, transformFunction: null }, tabIndexInput: { classPropertyName: "tabIndexInput", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keyup": "onKeyUp($event)" }, properties: { "class.disabled": "disabled()", "attr.aria-disabled": "disabled() || null", "attr.tabindex": "tabIndex()" } }, exportAs: ["cDropdownClose"], ngImport: i0 }); }
3551
3560
  }
3552
3561
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownCloseDirective, decorators: [{
3553
3562
  type: Directive,
3554
3563
  args: [{
3555
3564
  selector: '[cDropdownClose]',
3556
- exportAs: 'cDropdownClose'
3565
+ exportAs: 'cDropdownClose',
3566
+ host: {
3567
+ '[class.disabled]': 'disabled()',
3568
+ '[attr.aria-disabled]': 'disabled() || null',
3569
+ '[attr.tabindex]': 'tabIndex()',
3570
+ '(click)': 'onClick($event)',
3571
+ '(keyup)': 'onKeyUp($event)'
3572
+ }
3557
3573
  }]
3558
- }], propDecorators: { disabled: [{
3559
- type: Input
3560
- }], dropdownComponent: [{
3561
- type: Input
3562
- }], hostClasses: [{
3563
- type: HostBinding,
3564
- args: ['class']
3565
- }], tabIndex: [{
3566
- type: HostBinding,
3567
- args: ['attr.tabindex']
3568
- }, {
3569
- type: Input
3570
- }], isDisabled: [{
3571
- type: HostBinding,
3572
- args: ['attr.aria-disabled']
3573
- }], onClick: [{
3574
- type: HostListener,
3575
- args: ['click', ['$event']]
3576
- }], onKeyUp: [{
3577
- type: HostListener,
3578
- args: ['keyup', ['$event']]
3579
- }] } });
3574
+ }] });
3580
3575
 
3581
3576
  class DropdownModule {
3582
3577
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -6667,7 +6662,7 @@ class ProgressBarDirective {
6667
6662
  * @return number
6668
6663
  * @default 0
6669
6664
  */
6670
- this.value = input(undefined, { transform: numberAttribute });
6665
+ this.value = input(0, { transform: numberAttribute });
6671
6666
  /**
6672
6667
  * Set the progress bar variant to optional striped.
6673
6668
  * @values 'striped'