import * as i0 from '@angular/core';
import { ChangeDetectionStrategy, ViewEncapsulation, Component, Input, HostBinding, Injectable, EventEmitter, ViewChild, ContentChild, Output, NgModule } from '@angular/core';
import * as i1 from '@fundamental-ngx/platform/shared';
import { BaseComponent } from '@fundamental-ngx/platform/shared';
import * as i2 from '@fundamental-ngx/core/content-density';
import { ContentDensityDirective, contentDensityObserverProviders, defaultContentDensityObserverConfigs, ContentDensityModule } from '@fundamental-ngx/core/content-density';
import { PanelComponent as PanelComponent$1, PanelTitleDirective, PanelContentDirective } from '@fundamental-ngx/core/panel';

class PanelActionsComponent {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: PanelActionsComponent, isStandalone: true, selector: "fdp-panel-actions", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["fdp-panel-actions>*{margin-left:.5rem}[dir=rtl] fdp-panel-actions>*{margin-left:0;margin-right:.5rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelActionsComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fdp-panel-actions', template: '<ng-content></ng-content>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, styles: ["fdp-panel-actions>*{margin-left:.5rem}[dir=rtl] fdp-panel-actions>*{margin-left:0;margin-right:.5rem}\n"] }]
        }] });

let platformPanelContentUniqueId = 0;
class PanelContentComponent {
    constructor() {
        /** Id of the host element. */
        this.id = 'fdp-panel-content-' + platformPanelContentUniqueId++;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: PanelContentComponent, isStandalone: true, selector: "fdp-panel-content", inputs: { contentHeight: "contentHeight", id: "id" }, host: { properties: { "attr.id": "this.id" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:block;overflow:auto}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelContentComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fdp-panel-content', template: `<ng-content></ng-content>`, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, styles: [":host{display:block;overflow:auto}\n"] }]
        }], propDecorators: { contentHeight: [{
                type: Input
            }], id: [{
                type: Input
            }, {
                type: HostBinding,
                args: ['attr.id']
            }] } });

/**
 * Default options for platform panel
 */
class PanelConfig {
    /** @hidden */
    constructor(platformConfig) {
        /**
         * ARIA label for button when the Panel is collapsed
         */
        this.expandLabel = 'Expand Panel';
        /**
         * ARIA label for button when the Panel is expanded
         */
        this.collapseLabel = 'Collapse Panel';
        this.contentDensity = platformConfig.contentDensity;
    }
    /**
     * Create Provider factory function
     */
    static createProviderFactory(obj) {
        const useFactory = (platformConfig) => Object.assign(new PanelConfig(platformConfig), obj);
        return useFactory;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelConfig, deps: [{ token: i1.PlatformConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelConfig, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelConfig, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1.PlatformConfig }] });

/** Panel change event instance */
class PanelExpandChangeEvent {
    /**
     * Panel expand change event
     * @param source Panel component
     * @param payload Panel expand state
     */
    constructor(source, payload) {
        this.source = source;
        this.payload = payload;
    }
}
let platformPanelTitleUniqueId = 0;
/**
 * Fundamental Panel component
 *
 * ```html
 * <fdp-panel title="Panel Header">
 *     <fdp-panel-content>
 *        Panel Content
 *     </fdp-panel-content>
 * </fdp-panel>
 * ```
 *
 * */
class PanelComponent extends BaseComponent {
    /** @hidden */
    constructor(_panelConfig, contentDensityObserver) {
        super();
        this._panelConfig = _panelConfig;
        this.contentDensityObserver = contentDensityObserver;
        /**
         * Whether the Panel Content is expanded
         */
        this.expanded = true;
        /**
         * Whether the Panel is expandable
         */
        this.expandable = true;
        /**
         * ARIA label for button when the Panel is collapsed
         */
        this.expandLabel = this._panelConfig.expandLabel;
        /**
         * ARIA label for button when the Panel is expanded
         */
        this.collapseLabel = this._panelConfig.collapseLabel;
        /** Output event triggered when the Expand button is clicked */
        this.panelExpandChange = new EventEmitter();
        /** @hidden id of the title element */
        this._titleId = 'fdp-panel-title-' + platformPanelTitleUniqueId++;
    }
    /** @hidden */
    ngOnInit() {
        this._calculateExpandAriaLabel();
    }
    /** @hidden */
    ngOnChanges(changes) {
        if (changes.expanded) {
            this._calculateExpandAriaLabel();
        }
    }
    /** Handles expanded/collapsed event */
    onExpandedChange(expanded) {
        this.expanded = expanded;
        const event = new PanelExpandChangeEvent(this, expanded);
        this.panelExpandChange.emit(event);
        this._calculateExpandAriaLabel();
    }
    /**
     * @hidden
     * Calculate expandAriaLabel based on panel state
     */
    _calculateExpandAriaLabel() {
        this._expandAriaLabel = this.expanded ? this.collapseLabel : this.expandLabel;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelComponent, deps: [{ token: PanelConfig }, { token: i2.ContentDensityObserver }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.4", type: PanelComponent, isStandalone: true, selector: "fdp-panel", inputs: { title: "title", expanded: "expanded", expandable: "expandable", expandLabel: "expandLabel", collapseLabel: "collapseLabel" }, outputs: { panelExpandChange: "panelExpandChange" }, providers: [
            contentDensityObserverProviders({
                defaultContentDensity: {
                    useFactory: (panelConfig) => panelConfig.contentDensity || defaultContentDensityObserverConfigs.defaultContentDensity,
                    deps: [PanelConfig]
                }
            })
        ], queries: [{ propertyName: "_panelContentComponent", first: true, predicate: PanelContentComponent, descendants: true }], viewQueries: [{ propertyName: "_panelTitleDirective", first: true, predicate: PanelTitleDirective, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<fd-panel\n    [fdContentDensity]=\"contentDensityObserver.value\"\n    [expanded]=\"expanded\"\n    [fixed]=\"!expandable\"\n    [expandAriaLabel]=\"_expandAriaLabel\"\n    [expandAriaLabelledBy]=\"_titleId\"\n    [attr.aria-disabled]=\"disabled\"\n    (expandedChange)=\"onExpandedChange($event)\"\n>\n    <h5 [id]=\"_titleId\" fd-panel-title>{{ title }}</h5>\n\n    <ng-content select=\"fdp-panel-actions\"></ng-content>\n\n    <div\n        fd-panel-content\n        [id]=\"_panelContentComponent?.id\"\n        [height]=\"_panelContentComponent?.contentHeight || null\"\n        [ariaLabelledBy]=\"_panelTitleDirective?.id || null\"\n    >\n        <ng-content select=\"fdp-panel-content\"></ng-content>\n    </div>\n</fd-panel>\n", dependencies: [{ kind: "component", type: PanelComponent$1, selector: "fd-panel", inputs: ["class", "fixed", "id", "expandId", "expandAriaLabel", "expandAriaLabelledBy", "expanded", "transparent", "noRadius"], outputs: ["expandedChange"] }, { kind: "directive", type: ContentDensityDirective, selector: "[fdContentDensity]:not([fdCompact]):not([fdCondensed]):not([fdCozy]),                [fdCompact]:not([fdContentDensity]):not([fdCondensed]):not([fdCozy]),                [fdCondensed]:not([fdContentDensity]):not([fdCompact]):not([fdCozy]),                [fdCozy]:not([fdContentDensity]):not([fdCompact]):not([fdCondensed])", inputs: ["fdContentDensity", "fdCompact", "fdCondensed", "fdCozy"], exportAs: ["fdContentDensity"] }, { kind: "directive", type: PanelTitleDirective, selector: "[fd-panel-title]", inputs: ["id"] }, { kind: "directive", type: PanelContentDirective, selector: "[fd-panel-content]", inputs: ["height", "minHeight", "maxHeight", "ariaLabel", "ariaLabelledBy", "role", "noPadding", "transparent", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PanelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fdp-panel', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                        contentDensityObserverProviders({
                            defaultContentDensity: {
                                useFactory: (panelConfig) => panelConfig.contentDensity || defaultContentDensityObserverConfigs.defaultContentDensity,
                                deps: [PanelConfig]
                            }
                        })
                    ], imports: [PanelComponent$1, ContentDensityDirective, PanelTitleDirective, PanelContentDirective], template: "<fd-panel\n    [fdContentDensity]=\"contentDensityObserver.value\"\n    [expanded]=\"expanded\"\n    [fixed]=\"!expandable\"\n    [expandAriaLabel]=\"_expandAriaLabel\"\n    [expandAriaLabelledBy]=\"_titleId\"\n    [attr.aria-disabled]=\"disabled\"\n    (expandedChange)=\"onExpandedChange($event)\"\n>\n    <h5 [id]=\"_titleId\" fd-panel-title>{{ title }}</h5>\n\n    <ng-content select=\"fdp-panel-actions\"></ng-content>\n\n    <div\n        fd-panel-content\n        [id]=\"_panelContentComponent?.id\"\n        [height]=\"_panelContentComponent?.contentHeight || null\"\n        [ariaLabelledBy]=\"_panelTitleDirective?.id || null\"\n    >\n        <ng-content select=\"fdp-panel-content\"></ng-content>\n    </div>\n</fd-panel>\n" }]
        }], ctorParameters: () => [{ type: PanelConfig }, { type: i2.ContentDensityObserver }], propDecorators: { title: [{
                type: Input
            }], expanded: [{
                type: Input
            }], expandable: [{
                type: Input
            }], expandLabel: [{
                type: Input
            }], collapseLabel: [{
                type: Input
            }], panelExpandChange: [{
                type: Output
            }], _panelContentComponent: [{
                type: ContentChild,
                args: [PanelContentComponent]
            }], _panelTitleDirective: [{
                type: ViewChild,
                args: [PanelTitleDirective]
            }] } });

const components = [PanelComponent, PanelContentComponent, PanelActionsComponent, ContentDensityModule];
/**
 * @deprecated
 * Use direct imports of components and directives.
 */
class PlatformPanelModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PlatformPanelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: PlatformPanelModule, imports: [PanelComponent, PanelContentComponent, PanelActionsComponent, ContentDensityModule], exports: [PanelComponent, PanelContentComponent, PanelActionsComponent, ContentDensityModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PlatformPanelModule, imports: [PanelComponent, ContentDensityModule, ContentDensityModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: PlatformPanelModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [...components],
                    exports: [...components]
                }]
        }] });

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

export { PanelActionsComponent, PanelComponent, PanelConfig, PanelContentComponent, PanelExpandChangeEvent, PlatformPanelModule };
//# sourceMappingURL=fundamental-ngx-platform-panel.mjs.map
