import * as i1 from '@angular/cdk/a11y';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { SelectionModel } from '@angular/cdk/collections';
import * as i0 from '@angular/core';
import { forwardRef, EventEmitter, Directive, Input, ContentChildren, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, ViewChild, NgModule } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import * as i2 from '@koobiq/components/button';
import { KbqButton, KbqButtonModule } from '@koobiq/components/button';
import { getNodesWithoutComments } from '@koobiq/components/core';
import { KbqIcon } from '@koobiq/components/icon';
import * as i3 from '@koobiq/components/title';
import { KbqTitleModule } from '@koobiq/components/title';

/**
 * Provider Expression that allows kbq-button-toggle-group to register as a ControlValueAccessor.
 * This allows it to support [(ngModel)].
 * @docs-private
 */
const KBQ_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = {
    provide: NG_VALUE_ACCESSOR,
    useExisting: forwardRef(() => KbqButtonToggleGroup),
    multi: true
};
/** Change event object emitted by MсButtonToggle. */
class KbqButtonToggleChange {
    constructor(
    /** The MсButtonToggle that emits the event. */
    source, 
    /** The value assigned to the MсButtonToggle. */
    value) {
        this.source = source;
        this.value = value;
    }
}
/** Exclusive selection button toggle group that behaves like a radio-button group. */
class KbqButtonToggleGroup {
    /** Whether the toggle group is vertical. */
    get vertical() {
        return this._vertical;
    }
    set vertical(value) {
        this._vertical = coerceBooleanProperty(value);
    }
    /** Value of the toggle group. */
    get value() {
        const selected = this.selectionModel ? this.selectionModel.selected : [];
        if (this.multiple) {
            return selected.map((toggle) => toggle.value);
        }
        return selected[0] ? selected[0].value : undefined;
    }
    set value(newValue) {
        this.setSelectionByValue(newValue);
        this.valueChange.emit(this.value);
    }
    /** Selected button toggles in the group. */
    get selected() {
        const selected = this.selectionModel.selected;
        return this.multiple ? selected : selected[0] || null;
    }
    /** Whether multiple button toggles can be selected. */
    get multiple() {
        return this._multiple;
    }
    set multiple(value) {
        this._multiple = coerceBooleanProperty(value);
    }
    /** Whether multiple button toggle group is disabled. */
    get disabled() {
        return this._disabled;
    }
    set disabled(value) {
        this._disabled = coerceBooleanProperty(value);
        if (!this.buttonToggles) {
            return;
        }
        this.buttonToggles.forEach((toggle) => toggle.markForCheck());
    }
    constructor(_changeDetector) {
        this._changeDetector = _changeDetector;
        /**
         * Event that emits whenever the value of the group changes.
         * Used to facilitate two-way data binding.
         * @docs-private
         */
        this.valueChange = new EventEmitter();
        /** Event emitted when the group's value changes. */
        this.change = new EventEmitter();
        this._vertical = false;
        this._multiple = false;
        this._disabled = false;
        /**
         * The method to be called in order to update ngModel.
         * Now `ngModel` binding is not supported in multiple selection mode.
         */
        this.controlValueAccessorChangeFn = () => { };
        /** onTouch function registered via registerOnTouch (ControlValueAccessor). */
        this.onTouched = () => { };
    }
    ngOnInit() {
        this.selectionModel = new SelectionModel(this.multiple, undefined, false);
    }
    ngAfterContentInit() {
        this.selectionModel.select(...this.buttonToggles.filter((toggle) => toggle.checked));
        this.disabled = this._disabled;
    }
    /**
     * Sets the model value. Implemented as part of ControlValueAccessor.
     * @param value Value to be set to the model.
     */
    writeValue(value) {
        this.value = value;
        this._changeDetector.markForCheck();
    }
    // Implemented as part of ControlValueAccessor.
    registerOnChange(fn) {
        this.controlValueAccessorChangeFn = fn;
    }
    // Implemented as part of ControlValueAccessor.
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    // Implemented as part of ControlValueAccessor.
    setDisabledState(isDisabled) {
        this.disabled = isDisabled;
    }
    /** Dispatch change event with current selection and group value. */
    emitChangeEvent() {
        const selected = this.selected;
        const source = Array.isArray(selected) ? selected[selected.length - 1] : selected;
        const event = new KbqButtonToggleChange(source, this.value);
        this.controlValueAccessorChangeFn(event.value);
        this.change.emit(event);
    }
    /**
     * Syncs a button toggle's selected state with the model value.
     * @param toggle Toggle to be synced.
     * @param select Whether the toggle should be selected.
     * @param isUserInput Whether the change was a result of a user interaction.
     */
    syncButtonToggle(toggle, select, isUserInput = false) {
        // Deselect the currently-selected toggle, if we're in single-selection
        // mode and the button being toggled isn't selected at the moment.
        if (!this.multiple && this.selected && !toggle.checked) {
            this.selected.checked = false;
        }
        if (select) {
            this.selectionModel.select(toggle);
        }
        else {
            this.selectionModel.deselect(toggle);
        }
        // Only emit the change event for user input.
        if (isUserInput) {
            this.emitChangeEvent();
        }
        // Note: we emit this one no matter whether it was a user interaction, because
        // it is used by Angular to sync up the two-way data binding.
        this.valueChange.emit(this.value);
    }
    /** Checks whether a button toggle is selected. */
    isSelected(toggle) {
        return this.selectionModel.isSelected(toggle);
    }
    /** Determines whether a button toggle should be checked on init. */
    isPrechecked(toggle) {
        if (this.rawValue === undefined) {
            return false;
        }
        if (this.multiple && Array.isArray(this.rawValue)) {
            return this.rawValue.some((value) => toggle.value != null && value === toggle.value);
        }
        return toggle.value === this.rawValue;
    }
    /** Updates the selection state of the toggles in the group based on a value. */
    setSelectionByValue(value) {
        this.rawValue = value;
        if (!this.buttonToggles) {
            return;
        }
        if (this.multiple && value) {
            if (!Array.isArray(value)) {
                throw Error('Value must be an array in multiple-selection mode.');
            }
            this.clearSelection();
            value.forEach((currentValue) => this.selectValue(currentValue));
        }
        else {
            this.clearSelection();
            this.selectValue(value);
        }
    }
    /** Clears the selected toggles. */
    clearSelection() {
        this.selectionModel.clear();
        this.buttonToggles.forEach((toggle) => (toggle.checked = false));
    }
    /** Selects a value if there's a toggle that corresponds to it. */
    selectValue(value) {
        const correspondingOption = this.buttonToggles.find((toggle) => {
            return toggle.value != null && toggle.value === value;
        });
        if (correspondingOption) {
            correspondingOption.checked = true;
            this.selectionModel.select(correspondingOption);
        }
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleGroup, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: KbqButtonToggleGroup, selector: "kbq-button-toggle-group", inputs: { vertical: "vertical", value: "value", multiple: "multiple", disabled: "disabled" }, outputs: { valueChange: "valueChange", change: "change" }, host: { properties: { "class.kbq-button-toggle_vertical": "vertical" }, classAttribute: "kbq-button-toggle-group" }, providers: [KBQ_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR], queries: [{ propertyName: "buttonToggles", predicate: i0.forwardRef(() => KbqButtonToggle) }], exportAs: ["kbqButtonToggleGroup"], ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleGroup, decorators: [{
            type: Directive,
            args: [{
                    selector: 'kbq-button-toggle-group',
                    providers: [KBQ_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR],
                    host: {
                        class: 'kbq-button-toggle-group',
                        '[class.kbq-button-toggle_vertical]': 'vertical'
                    },
                    exportAs: 'kbqButtonToggleGroup'
                }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { vertical: [{
                type: Input
            }], value: [{
                type: Input
            }], multiple: [{
                type: Input
            }], buttonToggles: [{
                type: ContentChildren,
                args: [forwardRef(() => KbqButtonToggle)]
            }], disabled: [{
                type: Input
            }], valueChange: [{
                type: Output
            }], change: [{
                type: Output
            }] } });
/** Single button inside of a toggle group. */
class KbqButtonToggle {
    /** Whether the button is checked. */
    get checked() {
        return this.buttonToggleGroup ? this.buttonToggleGroup.isSelected(this) : this._checked;
    }
    set checked(value) {
        const newValue = coerceBooleanProperty(value);
        if (newValue !== this._checked) {
            this._checked = newValue;
            if (this.buttonToggleGroup) {
                this.buttonToggleGroup.syncButtonToggle(this, this._checked);
            }
            this.changeDetectorRef.markForCheck();
        }
    }
    get disabled() {
        return this._disabled || (this.buttonToggleGroup && this.buttonToggleGroup.disabled);
    }
    set disabled(value) {
        this._disabled = coerceBooleanProperty(value);
    }
    constructor(buttonToggleGroup, changeDetectorRef, focusMonitor, element) {
        this.buttonToggleGroup = buttonToggleGroup;
        this.changeDetectorRef = changeDetectorRef;
        this.focusMonitor = focusMonitor;
        this.element = element;
        this.iconType = '';
        /** Event emitted when the group value changes. */
        this.change = new EventEmitter();
        this.isSingleSelector = false;
        this._checked = false;
        this._disabled = false;
    }
    ngOnInit() {
        this.isSingleSelector = this.buttonToggleGroup && !this.buttonToggleGroup.multiple;
        this.type = this.isSingleSelector ? 'radio' : 'checkbox';
        if (this.buttonToggleGroup && this.buttonToggleGroup.isPrechecked(this)) {
            this.checked = true;
        }
    }
    ngAfterContentInit() {
        if (this.icons.length) {
            const nodesWithoutComments = getNodesWithoutComments(this.element.nativeElement.querySelector('.kbq-button-toggle-wrapper').childNodes).length;
            this.iconType = nodesWithoutComments === this.icons.length ? '-icon' : '-icon-text';
        }
    }
    ngAfterViewInit() {
        this.focusMonitor.monitor(this.element.nativeElement, true);
    }
    ngOnDestroy() {
        const group = this.buttonToggleGroup;
        this.focusMonitor.stopMonitoring(this.element.nativeElement);
        // Remove the toggle from the selection once it's destroyed. Needs to happen
        // on the next tick in order to avoid "changed after checked" errors.
        if (group && group.isSelected(this)) {
            Promise.resolve().then(() => group.syncButtonToggle(this, false));
        }
    }
    /** Focuses the button. */
    focus() {
        this.element.nativeElement.focus();
    }
    /** Checks the button toggle due to an interaction with the underlying native button. */
    onToggleClick() {
        if (this.disabled) {
            return;
        }
        const newChecked = this.isSingleSelector ? true : !this._checked;
        if (newChecked !== this._checked) {
            this._checked = newChecked;
            if (this.buttonToggleGroup) {
                this.buttonToggleGroup.syncButtonToggle(this, this._checked, true);
                this.buttonToggleGroup.onTouched();
            }
        }
        // Emit a change event when it's the single selector
        this.change.emit(new KbqButtonToggleChange(this, this.value));
    }
    /**
     * Marks the button toggle as needing checking for change detection.
     * This method is exposed because the parent button toggle group will directly
     * update bound properties of the radio button.
     */
    markForCheck() {
        // When the group value changes, the button will not be notified.
        // Use `markForCheck` to explicit update button toggle's status.
        this.changeDetectorRef.markForCheck();
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggle, deps: [{ token: KbqButtonToggleGroup, optional: true }, { token: i0.ChangeDetectorRef }, { token: i1.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KbqButtonToggle, selector: "kbq-button-toggle", inputs: { checked: "checked", value: "value", tabIndex: "tabIndex", disabled: "disabled" }, outputs: { change: "change" }, host: { properties: { "class": "\"kbq-button-toggle\" + iconType" }, classAttribute: "kbq-button-toggle" }, queries: [{ propertyName: "icons", predicate: KbqIcon, descendants: true }], viewQueries: [{ propertyName: "mcButton", first: true, predicate: KbqButton, descendants: true }], exportAs: ["kbqButtonToggle"], ngImport: i0, template: `
        <button
            kbq-button
            kbq-title
            type="button"
            [kbqStyle]="'transparent'"
            [class.kbq-selected]="checked"
            [disabled]="disabled"
            [tabIndex]="tabIndex || 0"
            (click)="onToggleClick()"
        >
            <div #kbqTitleText class="kbq-button-toggle-wrapper">
                <ng-content />
            </div>
        </button>
    `, isInline: true, styles: [".kbq-button-toggle-group{box-sizing:border-box;display:inline-flex;flex-direction:row;align-items:center;gap:var(--kbq-button-toggle-size-container-content-gap-horizontal);border-radius:var(--kbq-button-toggle-size-container-border-radius);padding:var(--kbq-button-toggle-size-container-padding-vertical) var(--kbq-button-toggle-size-container-padding-horizontal)}.kbq-button-toggle-group .kbq-button-toggle{display:flex;overflow:hidden;justify-content:flex-start;align-items:center;height:var(--kbq-button-toggle-size-item-height);min-height:var(--kbq-button-toggle-size-item-height);border-radius:var(--kbq-button-toggle-size-item-border-radius);border:var(--kbq-size-border-width) solid transparent}.kbq-button-toggle-group .kbq-button-toggle.cdk-keyboard-focused{outline:1px solid var(--kbq-states-line-focus-theme);border-color:var(--kbq-states-line-focus-theme)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon{height:inherit;min-height:inherit;border-radius:var(--kbq-button-toggle-size-item-border-radius);border-width:0;padding:calc(var(--kbq-button-toggle-size-item-padding-vertical) - var(--kbq-button-toggle-size-item-focus-outline-width)) calc(var(--kbq-button-toggle-size-item-padding-horizontal) - var(--kbq-button-toggle-size-item-focus-outline-width))}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-button-wrapper,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon .kbq-button-wrapper{width:100%}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-button-toggle-wrapper,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon .kbq-button-toggle-wrapper{display:inline-flex;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;align-items:center;width:100%;gap:var(--kbq-button-toggle-size-item-content-gap-horizontal)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.cdk-keyboard-focused,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon.cdk-keyboard-focused{outline:none}.kbq-button-toggle-group:not(.kbq-button-toggle_vertical) .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group:not(.kbq-button-toggle_vertical) .kbq-button-toggle>.kbq-button-icon{max-width:100%;height:var(--kbq-button-toggle-size-item-height)}.kbq-button-toggle_vertical{flex-direction:column}.kbq-button-toggle_vertical .kbq-button-toggle{width:100%}.kbq-button-toggle_vertical .kbq-button-toggle>.kbq-button,.kbq-button-toggle_vertical .kbq-button-toggle>.kbq-button-icon{width:100%;border-radius:var(--kbq-button-toggle-size-item-border-radius)}.kbq-button-toggle-group{background:var(--kbq-button-toggle-container-background)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button{background:var(--kbq-button-toggle-item-default-background);color:var(--kbq-button-toggle-item-default-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-default-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:hover:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:hover:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-hover-background);color:var(--kbq-button-toggle-item-states-hover-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:hover:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:hover:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-hover-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:active:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:active:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-active-background);color:var(--kbq-button-toggle-item-states-active-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:active:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:active:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-active-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-selected-background);color:var(--kbq-button-toggle-item-states-selected-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled):active,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled):active{background:var(--kbq-button-toggle-item-states-selected-active-background);color:var(--kbq-button-toggle-item-states-selected-active-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled):active .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled):active .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-active-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled{background:var(--kbq-button-toggle-item-states-disabled-background);color:var(--kbq-button-toggle-item-states-disabled-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-disabled-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled.kbq-selected,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled.kbq-selected{background:var(--kbq-button-toggle-item-states-selected-disabled-background);color:var(--kbq-button-toggle-item-states-selected-disabled-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled.kbq-selected .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled.kbq-selected .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-disabled-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.cdk-keyboard-focused,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.cdk-keyboard-focused{border-color:var(--kbq-button-toggle-item-states-focused-outline)}.kbq-button-toggle .kbq-button-toggle-wrapper{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}\n", ".kbq-button-toggle-group{--kbq-button-toggle-size-container-border-radius: var(--kbq-size-border-radius);--kbq-button-toggle-size-container-padding-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-container-padding-vertical: var(--kbq-size-xxs);--kbq-button-toggle-size-container-content-gap-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-item-height: 22px;--kbq-button-toggle-size-item-border-radius: var(--kbq-size-xxs);--kbq-button-toggle-size-item-padding-horizontal: var(--kbq-size-s);--kbq-button-toggle-size-item-padding-vertical: var(--kbq-size-3xs);--kbq-button-toggle-size-item-content-gap-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-item-focus-outline-width: var(--kbq-size-3xs);--kbq-button-toggle-container-background: var(--kbq-background-contrast-fade);--kbq-button-toggle-item-default-background: var(--kbq-background-contrast-fade);--kbq-button-toggle-item-default-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-default-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-hover-background: var(--kbq-states-background-contrast-fade-hover);--kbq-button-toggle-item-states-hover-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-hover-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-active-background: var(--kbq-states-background-contrast-fade-active);--kbq-button-toggle-item-states-active-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-active-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-background: var(--kbq-background-card);--kbq-button-toggle-item-states-selected-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-selected-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-active-background: var(--kbq-states-background-transparent-active);--kbq-button-toggle-item-states-selected-active-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-selected-active-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-disabled-background: var(--kbq-states-background-disabled);--kbq-button-toggle-item-states-selected-disabled-text: var(--kbq-states-foreground-disabled);--kbq-button-toggle-item-states-selected-disabled-icon: var(--kbq-states-icon-disabled);--kbq-button-toggle-item-states-disabled-background: none;--kbq-button-toggle-item-states-disabled-text: var(--kbq-states-foreground-disabled);--kbq-button-toggle-item-states-disabled-icon: var(--kbq-states-icon-disabled);--kbq-button-toggle-item-states-focused-outline: var(--kbq-states-line-focus-theme)}\n"], dependencies: [{ kind: "component", type: i2.KbqButton, selector: "[kbq-button]", inputs: ["kbqStyle", "disabled", "tabIndex"] }, { kind: "directive", type: i2.KbqButtonCssStyler, selector: "[kbq-button]" }, { kind: "directive", type: i3.KbqTitleDirective, selector: "[kbq-title]", exportAs: ["kbqTitle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggle, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-button-toggle', exportAs: 'kbqButtonToggle', template: `
        <button
            kbq-button
            kbq-title
            type="button"
            [kbqStyle]="'transparent'"
            [class.kbq-selected]="checked"
            [disabled]="disabled"
            [tabIndex]="tabIndex || 0"
            (click)="onToggleClick()"
        >
            <div #kbqTitleText class="kbq-button-toggle-wrapper">
                <ng-content />
            </div>
        </button>
    `, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
                        class: 'kbq-button-toggle',
                        '[class]': '"kbq-button-toggle" + iconType'
                    }, styles: [".kbq-button-toggle-group{box-sizing:border-box;display:inline-flex;flex-direction:row;align-items:center;gap:var(--kbq-button-toggle-size-container-content-gap-horizontal);border-radius:var(--kbq-button-toggle-size-container-border-radius);padding:var(--kbq-button-toggle-size-container-padding-vertical) var(--kbq-button-toggle-size-container-padding-horizontal)}.kbq-button-toggle-group .kbq-button-toggle{display:flex;overflow:hidden;justify-content:flex-start;align-items:center;height:var(--kbq-button-toggle-size-item-height);min-height:var(--kbq-button-toggle-size-item-height);border-radius:var(--kbq-button-toggle-size-item-border-radius);border:var(--kbq-size-border-width) solid transparent}.kbq-button-toggle-group .kbq-button-toggle.cdk-keyboard-focused{outline:1px solid var(--kbq-states-line-focus-theme);border-color:var(--kbq-states-line-focus-theme)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon{height:inherit;min-height:inherit;border-radius:var(--kbq-button-toggle-size-item-border-radius);border-width:0;padding:calc(var(--kbq-button-toggle-size-item-padding-vertical) - var(--kbq-button-toggle-size-item-focus-outline-width)) calc(var(--kbq-button-toggle-size-item-padding-horizontal) - var(--kbq-button-toggle-size-item-focus-outline-width))}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-button-wrapper,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon .kbq-button-wrapper{width:100%}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-button-toggle-wrapper,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon .kbq-button-toggle-wrapper{display:inline-flex;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;align-items:center;width:100%;gap:var(--kbq-button-toggle-size-item-content-gap-horizontal)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.cdk-keyboard-focused,.kbq-button-toggle-group .kbq-button-toggle>.kbq-button-icon.cdk-keyboard-focused{outline:none}.kbq-button-toggle-group:not(.kbq-button-toggle_vertical) .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group:not(.kbq-button-toggle_vertical) .kbq-button-toggle>.kbq-button-icon{max-width:100%;height:var(--kbq-button-toggle-size-item-height)}.kbq-button-toggle_vertical{flex-direction:column}.kbq-button-toggle_vertical .kbq-button-toggle{width:100%}.kbq-button-toggle_vertical .kbq-button-toggle>.kbq-button,.kbq-button-toggle_vertical .kbq-button-toggle>.kbq-button-icon{width:100%;border-radius:var(--kbq-button-toggle-size-item-border-radius)}.kbq-button-toggle-group{background:var(--kbq-button-toggle-container-background)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button{background:var(--kbq-button-toggle-item-default-background);color:var(--kbq-button-toggle-item-default-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-default-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:hover:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:hover:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-hover-background);color:var(--kbq-button-toggle-item-states-hover-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:hover:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:hover:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-hover-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:active:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:active:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-active-background);color:var(--kbq-button-toggle-item-states-active-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button:active:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button:active:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-active-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled),.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled){background:var(--kbq-button-toggle-item-states-selected-background);color:var(--kbq-button-toggle-item-states-selected-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled) .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled) .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled):active,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled):active{background:var(--kbq-button-toggle-item-states-selected-active-background);color:var(--kbq-button-toggle-item-states-selected-active-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-selected:not(.kbq-disabled):active .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-selected:not(.kbq-disabled):active .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-active-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled{background:var(--kbq-button-toggle-item-states-disabled-background);color:var(--kbq-button-toggle-item-states-disabled-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-disabled-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled.kbq-selected,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled.kbq-selected{background:var(--kbq-button-toggle-item-states-selected-disabled-background);color:var(--kbq-button-toggle-item-states-selected-disabled-text)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.kbq-disabled.kbq-selected .kbq-icon.kbq-empty,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.kbq-disabled.kbq-selected .kbq-icon.kbq-empty{color:var(--kbq-button-toggle-item-states-selected-disabled-icon)}.kbq-button-toggle-group .kbq-button-toggle>.kbq-button.cdk-keyboard-focused,.kbq-button-toggle-group .kbq-button-toggle>.kbq-icon-button.cdk-keyboard-focused{border-color:var(--kbq-button-toggle-item-states-focused-outline)}.kbq-button-toggle .kbq-button-toggle-wrapper{font-size:var(--kbq-typography-text-normal-medium-font-size);font-style:var(--kbq-typography-text-normal-medium-font-style);font-weight:var(--kbq-typography-text-normal-medium-font-weight);line-height:var(--kbq-typography-text-normal-medium-line-height);font-family:var(--kbq-typography-text-normal-medium-font-family);text-transform:var(--kbq-typography-text-normal-medium-text-transform);font-feature-settings:var(--kbq-typography-text-normal-medium-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-medium-letter-spacing)}\n", ".kbq-button-toggle-group{--kbq-button-toggle-size-container-border-radius: var(--kbq-size-border-radius);--kbq-button-toggle-size-container-padding-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-container-padding-vertical: var(--kbq-size-xxs);--kbq-button-toggle-size-container-content-gap-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-item-height: 22px;--kbq-button-toggle-size-item-border-radius: var(--kbq-size-xxs);--kbq-button-toggle-size-item-padding-horizontal: var(--kbq-size-s);--kbq-button-toggle-size-item-padding-vertical: var(--kbq-size-3xs);--kbq-button-toggle-size-item-content-gap-horizontal: var(--kbq-size-xxs);--kbq-button-toggle-size-item-focus-outline-width: var(--kbq-size-3xs);--kbq-button-toggle-container-background: var(--kbq-background-contrast-fade);--kbq-button-toggle-item-default-background: var(--kbq-background-contrast-fade);--kbq-button-toggle-item-default-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-default-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-hover-background: var(--kbq-states-background-contrast-fade-hover);--kbq-button-toggle-item-states-hover-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-hover-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-active-background: var(--kbq-states-background-contrast-fade-active);--kbq-button-toggle-item-states-active-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-active-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-background: var(--kbq-background-card);--kbq-button-toggle-item-states-selected-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-selected-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-active-background: var(--kbq-states-background-transparent-active);--kbq-button-toggle-item-states-selected-active-text: var(--kbq-foreground-contrast);--kbq-button-toggle-item-states-selected-active-icon: var(--kbq-icon-contrast-fade);--kbq-button-toggle-item-states-selected-disabled-background: var(--kbq-states-background-disabled);--kbq-button-toggle-item-states-selected-disabled-text: var(--kbq-states-foreground-disabled);--kbq-button-toggle-item-states-selected-disabled-icon: var(--kbq-states-icon-disabled);--kbq-button-toggle-item-states-disabled-background: none;--kbq-button-toggle-item-states-disabled-text: var(--kbq-states-foreground-disabled);--kbq-button-toggle-item-states-disabled-icon: var(--kbq-states-icon-disabled);--kbq-button-toggle-item-states-focused-outline: var(--kbq-states-line-focus-theme)}\n"] }]
        }], ctorParameters: () => [{ type: KbqButtonToggleGroup, decorators: [{
                    type: Optional
                }] }, { type: i0.ChangeDetectorRef }, { type: i1.FocusMonitor }, { type: i0.ElementRef }], propDecorators: { icons: [{
                type: ContentChildren,
                args: [KbqIcon, { descendants: true }]
            }], checked: [{
                type: Input
            }], mcButton: [{
                type: ViewChild,
                args: [KbqButton, { static: false }]
            }], value: [{
                type: Input
            }], tabIndex: [{
                type: Input
            }], disabled: [{
                type: Input
            }], change: [{
                type: Output
            }] } });

class KbqButtonToggleModule {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleModule, declarations: [KbqButtonToggleGroup, KbqButtonToggle], imports: [KbqButtonModule, KbqTitleModule], exports: [KbqButtonToggleGroup, KbqButtonToggle] }); }
    /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleModule, imports: [KbqButtonModule, KbqTitleModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqButtonToggleModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [KbqButtonModule, KbqTitleModule],
                    exports: [KbqButtonToggleGroup, KbqButtonToggle],
                    declarations: [KbqButtonToggleGroup, KbqButtonToggle]
                }]
        }] });

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

export { KBQ_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR, KbqButtonToggle, KbqButtonToggleChange, KbqButtonToggleGroup, KbqButtonToggleModule };
//# sourceMappingURL=koobiq-components-button-toggle.mjs.map
