@coreui/angular 5.3.12 → 5.3.14

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