import * as i0 from '@angular/core';
import { Directive, EventEmitter, inject, booleanAttribute, ContentChildren, Output, Input, HostBinding, Component, NgModule } from '@angular/core';
import { EuiTemplateDirective } from '@eui/components/directives';
import * as i1 from '@eui/components/shared';
import { BaseStatesDirective } from '@eui/components/shared';
import { NgTemplateOutlet } from '@angular/common';
import { EUI_BUTTON } from '@eui/components/eui-button';
import * as i2 from '@eui/components/eui-icon';
import { EUI_ICON } from '@eui/components/eui-icon';
import * as i3 from '@eui/components/eui-icon-button-expander';
import { EUI_ICON_BUTTON_EXPANDER } from '@eui/components/eui-icon-button-expander';
import * as i5 from '@eui/components/eui-label';
import { EUI_LABEL } from '@eui/components/eui-label';
import * as i4 from '@eui/components/eui-icon-state';
import { EUI_ICON_STATE } from '@eui/components/eui-icon-state';

/**
 * Directive for projecting content into the right side of the fieldset label
 */
// eslint-disable-next-line
class EuiFieldsetLabelRightContentTagDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetLabelRightContentTagDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: EuiFieldsetLabelRightContentTagDirective, isStandalone: true, selector: "euiFieldsetLabelRightContent", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetLabelRightContentTagDirective, decorators: [{
            type: Directive,
            args: [{ selector: 'euiFieldsetLabelRightContent' }]
        }] });
/**
 * Directive for projecting extra content into the fieldset label area
 */
// eslint-disable-next-line
class EuiFieldsetLabelExtraContentTagDirective {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetLabelExtraContentTagDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: EuiFieldsetLabelExtraContentTagDirective, isStandalone: true, selector: "euiFieldsetLabelExtraContent", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetLabelExtraContentTagDirective, decorators: [{
            type: Directive,
            args: [{ selector: 'euiFieldsetLabelExtraContent' }]
        }] });
/**
 * Fieldset component that provides a grouped container with optional expand/collapse functionality
 * and customizable label content.
 */
class EuiFieldsetComponent {
    constructor() {
        /** Element attribute for e2e testing */
        this.e2eAttr = 'eui-fieldset';
        /** Whether to show the default icon */
        this.hasDefaultIcon = false;
        /** Whether the fieldset can be expanded/collapsed */
        this.isExpandable = false;
        /** Whether the fieldset is currently expanded */
        this.isExpanded = true;
        /** Whether to use large size styling */
        this.isLarge = false;
        /** Whether this is the first fieldset in a group */
        this.isFirst = false;
        /** Event emitted when the fieldset is expanded or collapsed */
        this.expand = new EventEmitter();
        /** Label for expand button accessibility */
        this.expandMenuLabel = 'Expand ';
        /** Label for collapse button accessibility */
        this.collapseMenuLabel = 'Collapse ';
        /**
         * @deprecated Use iconSvgName instead
         */
        this.iconSvgType = 'eui-info';
        this.baseStatesDirective = inject(BaseStatesDirective);
    }
    /** CSS classes applied to the host element */
    get cssClasses() {
        return [
            this.baseStatesDirective.getCssClasses('eui-fieldset'),
            this.isFirst ? 'eui-fieldset--first' : '',
            this.isExpandable ? 'eui-fieldset--expandable' : '',
            this.iconSvgFillColor ? 'eui-fieldset--has-icon-color' : '',
        ].join(' ').trim();
    }
    /**
     * Initializes lazy content template if provided
     */
    ngAfterContentInit() {
        const lazyTemplate = this.templates.filter(t => t.name === 'eui-fieldset-content')[0];
        if (lazyTemplate) {
            this.lazyContent = lazyTemplate.template;
        }
    }
    /**
     * Handles expand/collapse toggle events
     * Emits the fieldset ID when toggled
     */
    onToggle() {
        if (this.isExpandable) {
            this.isExpanded = !this.isExpanded;
            this.expand.emit(this.id);
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: EuiFieldsetComponent, isStandalone: true, selector: "eui-fieldset", inputs: { e2eAttr: "e2eAttr", id: "id", label: "label", iconClass: "iconClass", iconSvgName: "iconSvgName", iconSvgFillColor: "iconSvgFillColor", hasDefaultIcon: ["hasDefaultIcon", "hasDefaultIcon", booleanAttribute], isExpandable: ["isExpandable", "isExpandable", booleanAttribute], isExpanded: ["isExpanded", "isExpanded", booleanAttribute], isLarge: ["isLarge", "isLarge", booleanAttribute], isFirst: ["isFirst", "isFirst", booleanAttribute] }, outputs: { expand: "expand" }, host: { properties: { "class": "this.cssClasses", "attr.data-e2e": "this.e2eAttr" } }, queries: [{ propertyName: "templates", predicate: EuiTemplateDirective }], hostDirectives: [{ directive: i1.BaseStatesDirective, inputs: ["euiPrimary", "euiPrimary", "euiSecondary", "euiSecondary", "euiSuccess", "euiSuccess", "euiInfo", "euiInfo", "euiWarning", "euiWarning", "euiDanger", "euiDanger", "euiAccent", "euiAccent", "euiVariant", "euiVariant", "euiHighlighted", "euiHighlighted"] }], ngImport: i0, template: "<div class=\"eui-fieldset__container\">\n    @if (label) {\n        <div class=\"eui-fieldset__header\">\n            <div class=\"eui-fieldset__header-label\" [class.eui-fieldset__header-label--large]=\"isLarge\">\n                @if (iconSvgName) {\n                    <div class=\"eui-fieldset__header-icon\">\n                        <eui-icon-svg [icon]=\"iconSvgName\" [fillColor]=\"iconSvgFillColor\"/>\n                    </div>\n                }\n                @if (hasDefaultIcon) {\n                    <div class=\"eui-fieldset__header-icon\">\n                        <eui-icon-state [euiVariant]=\"baseStatesDirective.euiVariant\"/>\n                    </div>\n                }\n                <span euiLabel>{{ label }}</span>\n                <ng-content select=\"euiFieldsetLabelExtraContent\"></ng-content>\n            </div>\n            <div class=\"eui-fieldset__header-right-content\">\n                <ng-content select=\"euiFieldsetLabelRightContent\"></ng-content>\n                @if (isExpandable) {\n                    <eui-icon-button-expander\n                        [isExpanded]=\"isExpanded\"\n                        (click)=\"onToggle()\"\n                        isDirectionForward\n                        fillColor=\"neutral\">\n                    </eui-icon-button-expander>\n                }\n            </div>\n        </div>\n    }\n    @if (isExpanded) {\n        <div id=\"fieldset-content\" class=\"eui-fieldset__content\">\n            @if (lazyContent) {\n                <ng-template [ngTemplateOutlet]=\"lazyContent\"></ng-template>\n            } @else {\n                <ng-content></ng-content>\n            }\n        </div>\n    }\n</div>\n", styles: [".eui-19 :host.eui-fieldset{--_color: var(--eui-c-s-secondary)}.eui-19 :host.eui-fieldset--primary{--_color: var(--eui-c-s-primary)}.eui-19 :host.eui-fieldset--secondary{--_color: var(--eui-c-s-secondary)}.eui-19 :host.eui-fieldset--info{--_color: var(--eui-c-s-info)}.eui-19 :host.eui-fieldset--success{--_color: var(--eui-c-s-success)}.eui-19 :host.eui-fieldset--warning{--_color: var(--eui-c-s-warning)}.eui-19 :host.eui-fieldset--danger{--_color: var(--eui-c-s-danger)}.eui-19 :host.eui-fieldset{display:block;position:relative;width:100%}.eui-19 :host.eui-fieldset .eui-fieldset__header{align-items:center;background-color:initial;border:var(--eui-bw-none);border-bottom:1px solid var(--eui-c-divider);color:var(--_color);display:flex;gap:var(--eui-s-m);margin-bottom:var(--eui-s-m);min-height:var(--eui-s-4xl);outline:none;padding:0;width:100%}.eui-19 :host.eui-fieldset .eui-fieldset__header-icon{align-items:center;display:inline-flex;font-size:var(--eui-is-m);margin-right:var(--eui-s-xs)}.eui-19 :host.eui-fieldset .eui-fieldset__header-label{align-items:center;display:inline-flex;font:var(--eui-f-bold);text-align:left}.eui-19 :host.eui-fieldset .eui-fieldset__header-right-content{align-items:center;display:flex;gap:var(--eui-s-s);margin-left:auto}.eui-19 :host.eui-fieldset--highlighted{background-color:var(--eui-c-surface-page);z-index:var(--eui-zi-highlighted)}.eui-19 :host.eui-fieldset--expandable .eui-fieldset__header{padding-bottom:var(--eui-s-xs)}.eui-19 :host.eui-fieldset:not(:host.eui-fieldset--has-icon-color) .eui-icon-svg svg{fill:var(--_color);color:var(--_color)}.eui-19 :host.eui-fieldset--first{margin-top:var(--eui-s-s)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.EuiIconSvgComponent, selector: "eui-icon-svg, span[euiIconSvg], i[euiIconSvg]", inputs: ["icon", "fillColor", "set", "size", "style", "iconUrl", "transform", "euiVariant", "aria-label", "ariaHidden", "focusable", "isLoading", "isInputIcon", "euiStart", "euiEnd"] }, { kind: "component", type: i3.EuiIconButtonExpanderComponent, selector: "eui-icon-button-expander", inputs: ["fillColor", "size", "ariaLabel", "isExpanded", "isDirectionForward", "euiDisabled"], outputs: ["buttonClick"] }, { kind: "component", type: i4.EuiIconStateComponent, selector: "eui-icon-state", inputs: ["size", "ariaLabel"] }, { kind: "component", type: i5.EuiLabelComponent, selector: "label[euiLabel], span[euiLabel], div[euiLabel], a[euiLabel], eui-label,               label[euiSublabel], span[euiSublabel], div[euiSublabel], a[euiSublabel], eui-sublabel", inputs: ["euiRequired", "euiReadonly", "euiSublabel"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetComponent, decorators: [{
            type: Component,
            args: [{ selector: 'eui-fieldset', imports: [
                        NgTemplateOutlet,
                        BaseStatesDirective,
                        ...EUI_ICON,
                        ...EUI_ICON_BUTTON_EXPANDER,
                        ...EUI_ICON_STATE,
                        ...EUI_LABEL,
                        ...EUI_BUTTON,
                    ], hostDirectives: [
                        {
                            directive: BaseStatesDirective,
                            inputs: [
                                'euiPrimary',
                                'euiSecondary',
                                'euiSuccess',
                                'euiInfo',
                                'euiWarning',
                                'euiDanger',
                                'euiAccent',
                                'euiVariant',
                                'euiHighlighted',
                            ],
                        },
                    ], template: "<div class=\"eui-fieldset__container\">\n    @if (label) {\n        <div class=\"eui-fieldset__header\">\n            <div class=\"eui-fieldset__header-label\" [class.eui-fieldset__header-label--large]=\"isLarge\">\n                @if (iconSvgName) {\n                    <div class=\"eui-fieldset__header-icon\">\n                        <eui-icon-svg [icon]=\"iconSvgName\" [fillColor]=\"iconSvgFillColor\"/>\n                    </div>\n                }\n                @if (hasDefaultIcon) {\n                    <div class=\"eui-fieldset__header-icon\">\n                        <eui-icon-state [euiVariant]=\"baseStatesDirective.euiVariant\"/>\n                    </div>\n                }\n                <span euiLabel>{{ label }}</span>\n                <ng-content select=\"euiFieldsetLabelExtraContent\"></ng-content>\n            </div>\n            <div class=\"eui-fieldset__header-right-content\">\n                <ng-content select=\"euiFieldsetLabelRightContent\"></ng-content>\n                @if (isExpandable) {\n                    <eui-icon-button-expander\n                        [isExpanded]=\"isExpanded\"\n                        (click)=\"onToggle()\"\n                        isDirectionForward\n                        fillColor=\"neutral\">\n                    </eui-icon-button-expander>\n                }\n            </div>\n        </div>\n    }\n    @if (isExpanded) {\n        <div id=\"fieldset-content\" class=\"eui-fieldset__content\">\n            @if (lazyContent) {\n                <ng-template [ngTemplateOutlet]=\"lazyContent\"></ng-template>\n            } @else {\n                <ng-content></ng-content>\n            }\n        </div>\n    }\n</div>\n", styles: [".eui-19 :host.eui-fieldset{--_color: var(--eui-c-s-secondary)}.eui-19 :host.eui-fieldset--primary{--_color: var(--eui-c-s-primary)}.eui-19 :host.eui-fieldset--secondary{--_color: var(--eui-c-s-secondary)}.eui-19 :host.eui-fieldset--info{--_color: var(--eui-c-s-info)}.eui-19 :host.eui-fieldset--success{--_color: var(--eui-c-s-success)}.eui-19 :host.eui-fieldset--warning{--_color: var(--eui-c-s-warning)}.eui-19 :host.eui-fieldset--danger{--_color: var(--eui-c-s-danger)}.eui-19 :host.eui-fieldset{display:block;position:relative;width:100%}.eui-19 :host.eui-fieldset .eui-fieldset__header{align-items:center;background-color:initial;border:var(--eui-bw-none);border-bottom:1px solid var(--eui-c-divider);color:var(--_color);display:flex;gap:var(--eui-s-m);margin-bottom:var(--eui-s-m);min-height:var(--eui-s-4xl);outline:none;padding:0;width:100%}.eui-19 :host.eui-fieldset .eui-fieldset__header-icon{align-items:center;display:inline-flex;font-size:var(--eui-is-m);margin-right:var(--eui-s-xs)}.eui-19 :host.eui-fieldset .eui-fieldset__header-label{align-items:center;display:inline-flex;font:var(--eui-f-bold);text-align:left}.eui-19 :host.eui-fieldset .eui-fieldset__header-right-content{align-items:center;display:flex;gap:var(--eui-s-s);margin-left:auto}.eui-19 :host.eui-fieldset--highlighted{background-color:var(--eui-c-surface-page);z-index:var(--eui-zi-highlighted)}.eui-19 :host.eui-fieldset--expandable .eui-fieldset__header{padding-bottom:var(--eui-s-xs)}.eui-19 :host.eui-fieldset:not(:host.eui-fieldset--has-icon-color) .eui-icon-svg svg{fill:var(--_color);color:var(--_color)}.eui-19 :host.eui-fieldset--first{margin-top:var(--eui-s-s)}\n"] }]
        }], propDecorators: { cssClasses: [{
                type: HostBinding,
                args: ['class']
            }], e2eAttr: [{
                type: HostBinding,
                args: ['attr.data-e2e']
            }, {
                type: Input
            }], id: [{
                type: Input
            }], label: [{
                type: Input
            }], iconClass: [{
                type: Input
            }], iconSvgName: [{
                type: Input
            }], iconSvgFillColor: [{
                type: Input
            }], hasDefaultIcon: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isExpandable: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isExpanded: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isLarge: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], isFirst: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], expand: [{
                type: Output
            }], templates: [{
                type: ContentChildren,
                args: [EuiTemplateDirective]
            }] } });

/**
 * @deprecated Import the standalone {@link EUI_FIELDSET} instead.
 */
class EuiFieldsetModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetModule, imports: [EuiFieldsetComponent,
            EuiFieldsetLabelRightContentTagDirective,
            EuiFieldsetLabelExtraContentTagDirective], exports: [EuiFieldsetComponent,
            EuiFieldsetLabelRightContentTagDirective,
            EuiFieldsetLabelExtraContentTagDirective] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetModule, imports: [EuiFieldsetComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiFieldsetModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        EuiFieldsetComponent,
                        EuiFieldsetLabelRightContentTagDirective,
                        EuiFieldsetLabelExtraContentTagDirective,
                    ],
                    exports: [
                        EuiFieldsetComponent,
                        EuiFieldsetLabelRightContentTagDirective,
                        EuiFieldsetLabelExtraContentTagDirective,
                    ],
                }]
        }] });

const EUI_FIELDSET = [
    EuiFieldsetComponent,
    EuiFieldsetLabelExtraContentTagDirective,
    EuiFieldsetLabelRightContentTagDirective,
];

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

export { EUI_FIELDSET, EuiFieldsetComponent, EuiFieldsetLabelExtraContentTagDirective, EuiFieldsetLabelRightContentTagDirective, EuiFieldsetModule };
//# sourceMappingURL=eui-components-eui-fieldset.mjs.map
