import * as i0 from '@angular/core';
import { InjectionToken, inject, EventEmitter, booleanAttribute, Output, Input, forwardRef, ContentChildren, Directive, ElementRef, ChangeDetectorRef, ContentChild, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
import { Subject, merge, Subscription } from 'rxjs';
import { FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';
import { Directionality } from '@angular/cdk/bidi';
import { ENTER, SPACE, TAB } from '@angular/cdk/keycodes';
import { KbqIcon } from '@koobiq/components/icon';

const KbqAccordionRootToken = new InjectionToken('KbqAccordionRootDirective');
let nextId$1 = 0;
class KbqAccordionRootDirective {
    constructor() {
        /** @docs-private */
        this.selectionDispatcher = inject(UniqueSelectionDispatcher);
        /** @docs-private */
        this.dir = inject(Directionality, { optional: true });
        /** @docs-private */
        this.id = `kbq-accordion-${nextId$1++}`;
        /** @docs-private */
        this.openCloseAllActions = new Subject();
        /** The orientation of the accordion. */
        this.orientation = 'vertical';
        /**
         * Determines whether one or multiple items can be opened at the same time.
         */
        this.type = 'single';
        /** @docs-private */
        this.collapsible = true;
        this.onValueChange = new EventEmitter();
        this._defaultValue = [];
    }
    get isMultiple() {
        return this.type === 'multiple';
    }
    /**
     * The value of the item to expand when initially rendered and type is "single". Use when you do not need to control the state of the items.
     */
    set defaultValue(value) {
        if (value !== this._defaultValue) {
            this._defaultValue = Array.isArray(value) ? value : [value];
        }
    }
    get defaultValue() {
        return this.isMultiple ? this._defaultValue : this._defaultValue[0];
    }
    /** The controlled value of the item to expand */
    set value(value) {
        if (value !== this._value) {
            this._value = Array.isArray(value) ? value : [value];
            this.selectionDispatcher.notify(this.value, this.id);
        }
    }
    get value() {
        if (this._value === undefined) {
            return this.defaultValue;
        }
        return this.isMultiple ? this._value : this._value[0];
    }
    ngAfterContentInit() {
        this.selectionDispatcher.notify((this._value ?? this._defaultValue), this.id);
        this.keyManager = new FocusKeyManager(this.items).withHomeAndEnd();
        if (this.orientation === 'horizontal') {
            this.keyManager.withHorizontalOrientation(this.dir?.value || 'ltr');
        }
        else {
            this.keyManager.withVerticalOrientation();
        }
        this.onValueChangeSubscription = merge(...this.items.map((item) => item.expandedChange)).subscribe(() => this.onValueChange.emit());
    }
    ngOnDestroy() {
        this.openCloseAllActions.complete();
        this.onValueChangeSubscription.unsubscribe();
    }
    /** @docs-private */
    handleKeydown(event) {
        if (!this.keyManager.activeItem) {
            this.keyManager.setFirstItemActive();
        }
        const activeItem = this.keyManager.activeItem;
        if ((event.keyCode === ENTER || event.keyCode === SPACE) &&
            !this.keyManager.isTyping() &&
            activeItem &&
            !activeItem.disabled) {
            event.preventDefault();
            activeItem.toggle();
        }
        else if (event.keyCode === TAB && event.shiftKey) {
            if (this.keyManager.activeItemIndex === 0)
                return;
            this.keyManager.setPreviousItemActive();
            event.preventDefault();
        }
        else if (event.keyCode === TAB) {
            if (this.keyManager.activeItemIndex === this.items.length - 1)
                return;
            this.keyManager.setNextItemActive();
            event.preventDefault();
        }
        else {
            this.keyManager.onKeydown(event);
        }
    }
    /** Opens all enabled accordion items in an accordion where multi is enabled.
     * @docs-private
     */
    openAll() {
        if (this.isMultiple) {
            this.openCloseAllActions.next(true);
        }
    }
    /** Closes all enabled accordion items.
     * @docs-private
     */
    closeAll() {
        this.openCloseAllActions.next(false);
    }
    /** @docs-private */
    setActiveItem(item) {
        this.keyManager.setActiveItem(item);
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.17", type: KbqAccordionRootDirective, isStandalone: true, selector: "[kbqAccordionRoot]", inputs: { disabled: ["disabled", "disabled", booleanAttribute], orientation: "orientation", defaultValue: "defaultValue", type: "type", collapsible: "collapsible", value: "value" }, outputs: { onValueChange: "onValueChange" }, host: { listeners: { "keydown": "handleKeydown($event)" }, properties: { "attr.data-orientation": "orientation" } }, providers: [
            { provide: KbqAccordionRootToken, useExisting: KbqAccordionRootDirective },
            { provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }
        ], queries: [{ propertyName: "items", predicate: i0.forwardRef(() => KbqAccordionItemDirective), descendants: true }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionRootDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbqAccordionRoot]',
                    providers: [
                        { provide: KbqAccordionRootToken, useExisting: KbqAccordionRootDirective },
                        { provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }
                    ],
                    host: {
                        '[attr.data-orientation]': 'orientation',
                        '(keydown)': 'handleKeydown($event)'
                    }
                }]
        }], propDecorators: { disabled: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], orientation: [{
                type: Input
            }], items: [{
                type: ContentChildren,
                args: [forwardRef(() => KbqAccordionItemDirective), { descendants: true }]
            }], defaultValue: [{
                type: Input
            }], type: [{
                type: Input
            }], collapsible: [{
                type: Input
            }], value: [{
                type: Input
            }], onValueChange: [{
                type: Output
            }] } });

class KbqAccordionTriggerDirective {
    constructor() {
        this.nativeElement = inject(ElementRef).nativeElement;
        this.accordionRoot = inject(KbqAccordionRootDirective);
        this.item = inject(KbqAccordionItemDirective);
    }
    /** Fires when trigger clicked */
    onClick() {
        if (!this.accordionRoot.collapsible && this.item.expanded)
            return;
        this.item.toggle();
        this.accordionRoot.setActiveItem(this.item);
    }
    focus() {
        this.nativeElement.focus();
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionTriggerDirective, isStandalone: true, selector: "[kbqAccordionTrigger]", host: { listeners: { "click": "onClick()" }, properties: { "attr.role": "\"button\"", "attr.aria-expanded": "item.expanded", "attr.data-state": "item.dataState", "attr.data-disabled": "item.disabled", "attr.disabled": "item.disabled ? \"\" : null", "attr.data-orientation": "item.orientation" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionTriggerDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbqAccordionTrigger]',
                    host: {
                        '[attr.role]': '"button"',
                        '[attr.aria-expanded]': 'item.expanded',
                        '[attr.data-state]': 'item.dataState',
                        '[attr.data-disabled]': 'item.disabled',
                        '[attr.disabled]': 'item.disabled ? "" : null',
                        '[attr.data-orientation]': 'item.orientation',
                        '(click)': 'onClick()'
                    }
                }]
        }] });

let nextId = 0;
class KbqAccordionItemDirective {
    get dataState() {
        return this.expanded ? 'open' : 'closed';
    }
    get orientation() {
        return this.accordion.orientation;
    }
    /** Whether the AccordionItem is expanded. */
    set expanded(expanded) {
        // Only emit events and update the internal value if the value changes.
        if (this._expanded !== expanded) {
            this._expanded = expanded;
            this.expandedChange.emit(expanded);
            if (expanded) {
                this.opened.emit();
                /**
                 * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,
                 * the name value is the id of the accordion.
                 */
                const accordionId = this.accordion ? this.accordion.id : this.value;
                this.expansionDispatcher.notify(this.value, accordionId);
            }
            else {
                this.closed.emit();
            }
            // Ensures that the animation will run when the value is set outside of an `@Input`.
            // This includes cases like the open, close and toggle methods.
            this.changeDetectorRef.markForCheck();
        }
    }
    get expanded() {
        return this._expanded;
    }
    set value(value) {
        this._value = value;
    }
    get value() {
        return this._value || this.id;
    }
    /** Whether the AccordionItem is disabled. */
    set disabled(value) {
        this._disabled = value;
    }
    get disabled() {
        return this.accordion.disabled ?? this._disabled;
    }
    constructor() {
        /** @docs-private */
        this.accordion = inject(KbqAccordionRootToken, { skipSelf: true });
        /** @docs-private */
        this.changeDetectorRef = inject(ChangeDetectorRef);
        /** @docs-private */
        this.expansionDispatcher = inject(UniqueSelectionDispatcher);
        /**
         * The unique AccordionItem id.
         * @docs-private
         */
        this.id = `kbq-accordion-item-${nextId++}`;
        this._expanded = false;
        this._disabled = false;
        /** Event emitted every time the AccordionItem is closed. */
        this.closed = new EventEmitter();
        /** Event emitted every time the AccordionItem is opened. */
        this.opened = new EventEmitter();
        /**
         * Event emitted when the AccordionItem is destroyed.
         * @docs-private
         */
        this.destroyed = new EventEmitter();
        /**
         * Emits whenever the expanded state of the accordion changes.
         * Primarily used to facilitate two-way binding.
         * @docs-private
         */
        this.expandedChange = new EventEmitter();
        /** Subscription to openAll/closeAll events. */
        this.openCloseAllSubscription = Subscription.EMPTY;
        this.removeUniqueSelectionListener = this.expansionDispatcher.listen((id, accordionId) => {
            if (this.accordion.isMultiple) {
                if (this.accordion.id === accordionId && id.includes(this.value)) {
                    this.expanded = true;
                }
            }
            else {
                this.expanded = this.accordion.id === accordionId && id.includes(this.value);
            }
        });
        // When an accordion item is hosted in an accordion, subscribe to open/close events.
        if (this.accordion) {
            this.openCloseAllSubscription = this.subscribeToOpenCloseAllActions();
        }
    }
    /** Emits an event for the accordion item being destroyed. */
    ngOnDestroy() {
        this.opened.complete();
        this.closed.complete();
        this.destroyed.emit();
        this.destroyed.complete();
        this.removeUniqueSelectionListener();
        this.openCloseAllSubscription.unsubscribe();
    }
    focus() {
        this.trigger.focus();
    }
    /** Toggles the expanded state of the accordion item. */
    toggle() {
        if (!this.disabled) {
            this.content.onToggle();
            this.expanded = !this.expanded;
        }
    }
    /** Sets the expanded state of the accordion item to false. */
    close() {
        if (!this.disabled) {
            this.expanded = false;
        }
    }
    /** Sets the expanded state of the accordion item to true. */
    open() {
        if (!this.disabled) {
            this.expanded = true;
        }
    }
    subscribeToOpenCloseAllActions() {
        return this.accordion.openCloseAllActions.subscribe((expanded) => {
            // Only change expanded state if item is enabled
            if (!this.disabled) {
                this.expanded = expanded;
            }
        });
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.17", type: KbqAccordionItemDirective, isStandalone: true, selector: "[kbqAccordionItem]", inputs: { expanded: ["expanded", "expanded", booleanAttribute], value: "value", disabled: ["disabled", "disabled", booleanAttribute] }, outputs: { closed: "closed", opened: "opened", expandedChange: "expandedChange" }, host: { properties: { "attr.data-state": "dataState", "attr.data-disabled": "disabled", "attr.data-orientation": "orientation" } }, providers: [
            { provide: KbqAccordionRootToken, useValue: undefined }
        ], queries: [{ propertyName: "trigger", first: true, predicate: KbqAccordionTriggerDirective, descendants: true }, { propertyName: "content", first: true, predicate: i0.forwardRef(() => KbqAccordionContentDirective), descendants: true }], exportAs: ["kbqAccordionItem"], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionItemDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbqAccordionItem]',
                    exportAs: 'kbqAccordionItem',
                    host: {
                        '[attr.data-state]': 'dataState',
                        '[attr.data-disabled]': 'disabled',
                        '[attr.data-orientation]': 'orientation'
                    },
                    providers: [
                        { provide: KbqAccordionRootToken, useValue: undefined }
                    ]
                }]
        }], ctorParameters: () => [], propDecorators: { trigger: [{
                type: ContentChild,
                args: [KbqAccordionTriggerDirective, { descendants: true }]
            }], content: [{
                type: ContentChild,
                args: [forwardRef(() => KbqAccordionContentDirective), { descendants: true }]
            }], expanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], value: [{
                type: Input
            }], disabled: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], closed: [{
                type: Output
            }], opened: [{
                type: Output
            }], expandedChange: [{
                type: Output
            }] } });

class KbqAccordionContentDirective {
    constructor() {
        this.item = inject(KbqAccordionItemDirective);
        this.nativeElement = inject(ElementRef).nativeElement;
        this.hidden = false;
    }
    onAnimationEnd() {
        this.hidden = !this.item.expanded;
        const { height, width } = this.nativeElement.getBoundingClientRect();
        this.nativeElement.style.setProperty('--radix-collapsible-content-height', `${height}px`);
        this.nativeElement.style.setProperty('--radix-collapsible-content-width', `${width}px`);
        this.nativeElement.style.setProperty('--radix-accordion-content-height', 'var(--radix-collapsible-content-height)');
        this.nativeElement.style.setProperty('--radix-accordion-content-width', 'var(--radix-collapsible-content-width)');
    }
    onToggle() {
        if (!this.item.expanded) {
            this.hidden = false;
        }
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionContentDirective, isStandalone: true, selector: "[kbqAccordionContent]", host: { listeners: { "animationend": "onAnimationEnd()" }, properties: { "attr.role": "\"region\"", "style.display": "hidden ? \"none\" : \"\"", "attr.data-state": "item.dataState", "attr.data-disabled": "item.disabled", "attr.data-orientation": "item.orientation" } }, exportAs: ["kbqAccordionContent"], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionContentDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbqAccordionContent]',
                    exportAs: 'kbqAccordionContent',
                    host: {
                        '[attr.role]': '"region"',
                        '[style.display]': 'hidden ? "none" : ""',
                        '[attr.data-state]': 'item.dataState',
                        '[attr.data-disabled]': 'item.disabled',
                        '[attr.data-orientation]': 'item.orientation',
                        '(animationend)': 'onAnimationEnd()'
                    }
                }]
        }] });

class KbqAccordionContent {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionContent, isStandalone: true, selector: "kbq-accordion-content, [kbq-accordion-content]", host: { classAttribute: "kbq-accordion-content" }, hostDirectives: [{ directive: KbqAccordionContentDirective }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionContent, decorators: [{
            type: Directive,
            args: [{
                    selector: 'kbq-accordion-content, [kbq-accordion-content]',
                    hostDirectives: [KbqAccordionContentDirective],
                    host: {
                        class: 'kbq-accordion-content'
                    }
                }]
        }] });

class KbqAccordionHeaderDirective {
    constructor() {
        this.item = inject(KbqAccordionItemDirective);
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionHeaderDirective, isStandalone: true, selector: "[kbqAccordionHeader]", host: { properties: { "attr.data-state": "item.dataState", "attr.data-disabled": "item.disabled", "attr.data-orientation": "item.orientation" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionHeaderDirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbqAccordionHeader]',
                    host: {
                        '[attr.data-state]': 'item.dataState',
                        '[attr.data-disabled]': 'item.disabled',
                        '[attr.data-orientation]': 'item.orientation'
                    }
                }]
        }] });

class KbqAccordionHeader {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionHeader, isStandalone: true, selector: "kbq-accordion-header, [kbq-accordion-header]", host: { classAttribute: "kbq-accordion-header" }, hostDirectives: [{ directive: KbqAccordionHeaderDirective }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionHeader, decorators: [{
            type: Directive,
            args: [{
                    selector: 'kbq-accordion-header, [kbq-accordion-header]',
                    hostDirectives: [KbqAccordionHeaderDirective],
                    host: {
                        class: 'kbq-accordion-header'
                    }
                }]
        }] });

class KbqAccordionItem {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordionItem, isStandalone: true, selector: "kbq-accordion-item, [kbq-accordion-item]", host: { classAttribute: "kbq-accordion-item" }, hostDirectives: [{ directive: KbqAccordionItemDirective, inputs: ["expanded", "expanded", "disabled", "disabled", "value", "value"], outputs: ["closed", "closed", "opened", "opened", "expandedChange", "expandedChange"] }], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionItem, decorators: [{
            type: Directive,
            args: [{
                    selector: 'kbq-accordion-item, [kbq-accordion-item]',
                    hostDirectives: [
                        {
                            directive: KbqAccordionItemDirective,
                            inputs: ['expanded', 'disabled', 'value'],
                            outputs: ['closed', 'opened', 'expandedChange']
                        }
                    ],
                    host: {
                        class: 'kbq-accordion-item'
                    }
                }]
        }] });

var KbqAccordionVariant;
(function (KbqAccordionVariant) {
    KbqAccordionVariant["fill"] = "fill";
    KbqAccordionVariant["hug"] = "hug";
    KbqAccordionVariant["hugSpaceBetween"] = "hugSpaceBetween";
})(KbqAccordionVariant || (KbqAccordionVariant = {}));
class KbqAccordion {
    constructor() {
        this.focusMonitor = inject(FocusMonitor);
        this.elementRef = inject(ElementRef);
        this.variant = KbqAccordionVariant.fill;
    }
    ngAfterViewInit() {
        this.focusMonitor.monitor(this.elementRef, true);
    }
    ngOnDestroy() {
        this.focusMonitor.stopMonitoring(this.elementRef);
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordion, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: KbqAccordion, isStandalone: true, selector: "kbq-accordion, [kbq-accordion]", inputs: { variant: "variant" }, host: { classAttribute: "kbq-accordion" }, hostDirectives: [{ directive: KbqAccordionRootDirective, inputs: ["type", "type", "collapsible", "collapsible", "disabled", "disabled", "defaultValue", "defaultValue", "value", "value"], outputs: ["onValueChange", "onValueChange"] }], ngImport: i0, template: '<ng-content />', isInline: true, styles: ["@keyframes slideDown{0%{height:0;padding-bottom:0}to{height:var(--radix-accordion-content-height);padding-bottom:0}}@keyframes slideUp{0%{height:var(--radix-accordion-content-height);padding-bottom:0}to{height:0;padding-bottom:0}}.kbq-accordion{display:block}.kbq-accordion-item{box-sizing:border-box;display:block;border-width:2px;border-style:solid;border-color:transparent}.kbq-accordion-header{display:flex;height:var(--kbq-accordion-size-item-header-height)}.kbq-accordion-content{display:block;overflow:hidden;padding:var(--kbq-accordion-size-item-content-padding)}.kbq-accordion-content[data-state=open]{animation:slideDown .3s ease-out}.kbq-accordion-content[data-state=closed]{animation:slideUp .3s ease-out}.kbq-accordion.cdk-keyboard-focused .kbq-accordion-item:focus-within{border-color:var(--kbq-accordion-item-states-focus-border-color)}.kbq-accordion-item{background:var(--kbq-accordion-item-default-background);color:var(--kbq-accordion-item-default-text-color)}.kbq-accordion-item .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-default-icon-color)}.kbq-accordion-trigger{width:100%;background:transparent;border:none;outline:none;color:var(--kbq-accordion-item-default-text-color)}.kbq-accordion-trigger:hover:not([data-disabled=true]){cursor:pointer}.kbq-accordion-trigger:hover:not([data-disabled=true]) .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-hover-icon-color)}.kbq-accordion-trigger[data-disabled=true]{color:var(--kbq-accordion-item-states-disabled-text-color)}.kbq-accordion-trigger[data-disabled=true] .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-disabled-icon-color)!important}.kbq-accordion-header,.kbq-accordion-trigger{font-size:var(--kbq-typography-text-big-font-size);font-style:var(--kbq-typography-text-big-font-style);font-weight:var(--kbq-typography-text-big-font-weight);line-height:var(--kbq-typography-text-big-line-height);font-family:var(--kbq-typography-text-big-font-family);text-transform:var(--kbq-typography-text-big-text-transform);font-feature-settings:var(--kbq-typography-text-big-font-feature-settings);letter-spacing:var(--kbq-typography-text-big-letter-spacing)}.kbq-accordion-trigger__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}.kbq-accordion-content{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-accordion{--kbq-accordion-size-item-header-height: 36px;--kbq-accordion-size-item-header-variant-fill-padding: var(--kbq-size-xs) var(--kbq-size-s);--kbq-accordion-size-item-header-variant-hug-padding: var(--kbq-size-xs) var(--kbq-size-s) var(--kbq-size-xs) var(--kbq-size-m);--kbq-accordion-size-item-content-padding: 0px var(--kbq-size-m) var(--kbq-size-s) var(--kbq-size-m);--kbq-accordion-item-default-background: transparent;--kbq-accordion-item-default-text-color: var(--kbq-foreground-contrast);--kbq-accordion-item-default-icon-color: var(--kbq-icon-contrast-fade);--kbq-accordion-item-states-hover-icon-color: var(--kbq-icon-contrast);--kbq-accordion-item-states-focus-border-color: var(--kbq-line-theme);--kbq-accordion-item-states-disabled-text-color: var(--kbq-foreground-contrast-secondary);--kbq-accordion-item-states-disabled-icon-color: var(--kbq-states-icon-disabled)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordion, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-accordion, [kbq-accordion]', template: '<ng-content />', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, hostDirectives: [
                        {
                            directive: KbqAccordionRootDirective,
                            inputs: ['type', 'collapsible', 'disabled', 'defaultValue', 'value'],
                            outputs: ['onValueChange']
                        }
                    ], host: {
                        class: 'kbq-accordion'
                    }, styles: ["@keyframes slideDown{0%{height:0;padding-bottom:0}to{height:var(--radix-accordion-content-height);padding-bottom:0}}@keyframes slideUp{0%{height:var(--radix-accordion-content-height);padding-bottom:0}to{height:0;padding-bottom:0}}.kbq-accordion{display:block}.kbq-accordion-item{box-sizing:border-box;display:block;border-width:2px;border-style:solid;border-color:transparent}.kbq-accordion-header{display:flex;height:var(--kbq-accordion-size-item-header-height)}.kbq-accordion-content{display:block;overflow:hidden;padding:var(--kbq-accordion-size-item-content-padding)}.kbq-accordion-content[data-state=open]{animation:slideDown .3s ease-out}.kbq-accordion-content[data-state=closed]{animation:slideUp .3s ease-out}.kbq-accordion.cdk-keyboard-focused .kbq-accordion-item:focus-within{border-color:var(--kbq-accordion-item-states-focus-border-color)}.kbq-accordion-item{background:var(--kbq-accordion-item-default-background);color:var(--kbq-accordion-item-default-text-color)}.kbq-accordion-item .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-default-icon-color)}.kbq-accordion-trigger{width:100%;background:transparent;border:none;outline:none;color:var(--kbq-accordion-item-default-text-color)}.kbq-accordion-trigger:hover:not([data-disabled=true]){cursor:pointer}.kbq-accordion-trigger:hover:not([data-disabled=true]) .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-hover-icon-color)}.kbq-accordion-trigger[data-disabled=true]{color:var(--kbq-accordion-item-states-disabled-text-color)}.kbq-accordion-trigger[data-disabled=true] .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-disabled-icon-color)!important}.kbq-accordion-header,.kbq-accordion-trigger{font-size:var(--kbq-typography-text-big-font-size);font-style:var(--kbq-typography-text-big-font-style);font-weight:var(--kbq-typography-text-big-font-weight);line-height:var(--kbq-typography-text-big-line-height);font-family:var(--kbq-typography-text-big-font-family);text-transform:var(--kbq-typography-text-big-text-transform);font-feature-settings:var(--kbq-typography-text-big-font-feature-settings);letter-spacing:var(--kbq-typography-text-big-letter-spacing)}.kbq-accordion-trigger__caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}.kbq-accordion-content{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}\n", ".kbq-accordion{--kbq-accordion-size-item-header-height: 36px;--kbq-accordion-size-item-header-variant-fill-padding: var(--kbq-size-xs) var(--kbq-size-s);--kbq-accordion-size-item-header-variant-hug-padding: var(--kbq-size-xs) var(--kbq-size-s) var(--kbq-size-xs) var(--kbq-size-m);--kbq-accordion-size-item-content-padding: 0px var(--kbq-size-m) var(--kbq-size-s) var(--kbq-size-m);--kbq-accordion-item-default-background: transparent;--kbq-accordion-item-default-text-color: var(--kbq-foreground-contrast);--kbq-accordion-item-default-icon-color: var(--kbq-icon-contrast-fade);--kbq-accordion-item-states-hover-icon-color: var(--kbq-icon-contrast);--kbq-accordion-item-states-focus-border-color: var(--kbq-line-theme);--kbq-accordion-item-states-disabled-text-color: var(--kbq-foreground-contrast-secondary);--kbq-accordion-item-states-disabled-icon-color: var(--kbq-states-icon-disabled)}\n"] }]
        }], propDecorators: { variant: [{
                type: Input
            }] } });

class KbqAccordionTrigger {
    constructor() {
        this.accordion = inject(KbqAccordion);
    }
    get isFill() {
        return this.accordion.variant === KbqAccordionVariant.fill;
    }
    get isHug() {
        return this.accordion.variant === KbqAccordionVariant.hug;
    }
    get isHugSpaceBetween() {
        return this.accordion.variant === KbqAccordionVariant.hugSpaceBetween;
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: KbqAccordionTrigger, isStandalone: true, selector: "kbq-accordion-trigger, [kbq-accordion-trigger]", host: { properties: { "class.kbq-accordion-trigger_fill": "isFill", "class.kbq-accordion-trigger_hug": "isHug", "class.kbq-accordion-trigger_hug-space-between": "isHugSpaceBetween" }, classAttribute: "kbq-accordion-trigger" }, hostDirectives: [{ directive: KbqAccordionTriggerDirective }], ngImport: i0, template: `
        @if (isHugSpaceBetween) {
            <i class="kbq-accordion-trigger__icon" kbq-icon="kbq-chevron-down-s_16"></i>
        } @else {
            <i class="kbq-accordion-trigger__icon" kbq-icon="kbq-chevron-right-s_16"></i>
        }

        <ng-content />
    `, isInline: true, styles: [".kbq-accordion-trigger{display:flex;flex-direction:row;align-items:center;background:transparent;border:none;outline:none}.kbq-accordion-trigger .kbq-accordion-trigger__icon{box-sizing:initial;align-self:flex-start;padding:var(--kbq-size-xxs);transition:transform .3s ease-out}.kbq-accordion-trigger .kbq-accordion-trigger__badge,.kbq-accordion-trigger .kbq-accordion-trigger__caption{margin-top:var(--kbq-size-xxs);margin-right:var(--kbq-size-s)}.kbq-accordion-trigger .kbq-accordion-trigger__action{padding:var(--kbq-size-xxs) var(--kbq-size-xxs) var(--kbq-size-3xs);margin-bottom:calc(-1 * var(--kbq-size-3xs))}.kbq-accordion-trigger:hover:not([data-disabled=true]){cursor:pointer}.kbq-accordion-trigger:hover:not([data-disabled=true]) .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-hover-icon-color)}.kbq-accordion-trigger.kbq-accordion-trigger_fill{padding:var(--kbq-accordion-size-item-header-variant-fill-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_fill[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(90deg)}.kbq-accordion-trigger.kbq-accordion-trigger_hug{flex-direction:row-reverse;justify-content:flex-end;padding:var(--kbq-accordion-size-item-header-variant-hug-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_hug[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(90deg)}.kbq-accordion-trigger.kbq-accordion-trigger_hug-space-between{flex-direction:row-reverse;justify-content:space-between;padding:var(--kbq-accordion-size-item-header-variant-hug-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_hug-space-between[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(-180deg)}.kbq-accordion-trigger[data-disabled=true] .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-disabled-icon-color)!important}button.kbq-accordion-trigger{flex:1}\n", ".kbq-accordion{--kbq-accordion-size-item-header-height: 36px;--kbq-accordion-size-item-header-variant-fill-padding: var(--kbq-size-xs) var(--kbq-size-s);--kbq-accordion-size-item-header-variant-hug-padding: var(--kbq-size-xs) var(--kbq-size-s) var(--kbq-size-xs) var(--kbq-size-m);--kbq-accordion-size-item-content-padding: 0px var(--kbq-size-m) var(--kbq-size-s) var(--kbq-size-m);--kbq-accordion-item-default-background: transparent;--kbq-accordion-item-default-text-color: var(--kbq-foreground-contrast);--kbq-accordion-item-default-icon-color: var(--kbq-icon-contrast-fade);--kbq-accordion-item-states-hover-icon-color: var(--kbq-icon-contrast);--kbq-accordion-item-states-focus-border-color: var(--kbq-line-theme);--kbq-accordion-item-states-disabled-text-color: var(--kbq-foreground-contrast-secondary);--kbq-accordion-item-states-disabled-icon-color: var(--kbq-states-icon-disabled)}\n"], dependencies: [{ kind: "component", type: KbqIcon, selector: "[kbq-icon]", inputs: ["small", "autoColor", "kbq-icon"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionTrigger, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-accordion-trigger, [kbq-accordion-trigger]', imports: [
                        KbqIcon
                    ], template: `
        @if (isHugSpaceBetween) {
            <i class="kbq-accordion-trigger__icon" kbq-icon="kbq-chevron-down-s_16"></i>
        } @else {
            <i class="kbq-accordion-trigger__icon" kbq-icon="kbq-chevron-right-s_16"></i>
        }

        <ng-content />
    `, encapsulation: ViewEncapsulation.None, hostDirectives: [KbqAccordionTriggerDirective], host: {
                        class: 'kbq-accordion-trigger',
                        '[class.kbq-accordion-trigger_fill]': 'isFill',
                        '[class.kbq-accordion-trigger_hug]': 'isHug',
                        '[class.kbq-accordion-trigger_hug-space-between]': 'isHugSpaceBetween'
                    }, styles: [".kbq-accordion-trigger{display:flex;flex-direction:row;align-items:center;background:transparent;border:none;outline:none}.kbq-accordion-trigger .kbq-accordion-trigger__icon{box-sizing:initial;align-self:flex-start;padding:var(--kbq-size-xxs);transition:transform .3s ease-out}.kbq-accordion-trigger .kbq-accordion-trigger__badge,.kbq-accordion-trigger .kbq-accordion-trigger__caption{margin-top:var(--kbq-size-xxs);margin-right:var(--kbq-size-s)}.kbq-accordion-trigger .kbq-accordion-trigger__action{padding:var(--kbq-size-xxs) var(--kbq-size-xxs) var(--kbq-size-3xs);margin-bottom:calc(-1 * var(--kbq-size-3xs))}.kbq-accordion-trigger:hover:not([data-disabled=true]){cursor:pointer}.kbq-accordion-trigger:hover:not([data-disabled=true]) .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-hover-icon-color)}.kbq-accordion-trigger.kbq-accordion-trigger_fill{padding:var(--kbq-accordion-size-item-header-variant-fill-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_fill[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(90deg)}.kbq-accordion-trigger.kbq-accordion-trigger_hug{flex-direction:row-reverse;justify-content:flex-end;padding:var(--kbq-accordion-size-item-header-variant-hug-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_hug[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(90deg)}.kbq-accordion-trigger.kbq-accordion-trigger_hug-space-between{flex-direction:row-reverse;justify-content:space-between;padding:var(--kbq-accordion-size-item-header-variant-hug-padding)}.kbq-accordion-trigger.kbq-accordion-trigger_hug-space-between[data-state=open]>.kbq-accordion-trigger__icon{transform:rotate(-180deg)}.kbq-accordion-trigger[data-disabled=true] .kbq-accordion-trigger__icon{color:var(--kbq-accordion-item-states-disabled-icon-color)!important}button.kbq-accordion-trigger{flex:1}\n", ".kbq-accordion{--kbq-accordion-size-item-header-height: 36px;--kbq-accordion-size-item-header-variant-fill-padding: var(--kbq-size-xs) var(--kbq-size-s);--kbq-accordion-size-item-header-variant-hug-padding: var(--kbq-size-xs) var(--kbq-size-s) var(--kbq-size-xs) var(--kbq-size-m);--kbq-accordion-size-item-content-padding: 0px var(--kbq-size-m) var(--kbq-size-s) var(--kbq-size-m);--kbq-accordion-item-default-background: transparent;--kbq-accordion-item-default-text-color: var(--kbq-foreground-contrast);--kbq-accordion-item-default-icon-color: var(--kbq-icon-contrast-fade);--kbq-accordion-item-states-hover-icon-color: var(--kbq-icon-contrast);--kbq-accordion-item-states-focus-border-color: var(--kbq-line-theme);--kbq-accordion-item-states-disabled-text-color: var(--kbq-foreground-contrast-secondary);--kbq-accordion-item-states-disabled-icon-color: var(--kbq-states-icon-disabled)}\n"] }]
        }] });

class KbqAccordionModule {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionModule, imports: [KbqIcon,
            KbqAccordion,
            KbqAccordionContent,
            KbqAccordionHeader,
            KbqAccordionItem,
            KbqAccordionTrigger], exports: [KbqAccordion,
            KbqAccordionContent,
            KbqAccordionHeader,
            KbqAccordionItem,
            KbqAccordionTrigger] }); }
    /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionModule, imports: [KbqIcon,
            KbqAccordionTrigger] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KbqAccordionModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        KbqIcon,
                        KbqAccordion,
                        KbqAccordionContent,
                        KbqAccordionHeader,
                        KbqAccordionItem,
                        KbqAccordionTrigger
                    ],
                    exports: [
                        KbqAccordion,
                        KbqAccordionContent,
                        KbqAccordionHeader,
                        KbqAccordionItem,
                        KbqAccordionTrigger
                    ]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { KbqAccordion, KbqAccordionContent, KbqAccordionContentDirective, KbqAccordionHeader, KbqAccordionHeaderDirective, KbqAccordionItem, KbqAccordionItemDirective, KbqAccordionModule, KbqAccordionRootDirective, KbqAccordionRootToken, KbqAccordionTrigger, KbqAccordionTriggerDirective, KbqAccordionVariant };
//# sourceMappingURL=koobiq-components-accordion.mjs.map
