import * as i0 from '@angular/core';
import { inject, ElementRef, input, model, booleanAttribute, computed, effect, Component } from '@angular/core';
import * as i1 from '@angular/material/icon';
import { MatIconModule } from '@angular/material/icon';

/* eslint-disable @angular-eslint/no-input-rename */
class SdSection {
    #el = inject(ElementRef);
    title = input(undefined, ...(ngDevMode ? [{ debugName: "title" }] : []));
    subTitle = input(undefined, ...(ngDevMode ? [{ debugName: "subTitle" }] : []));
    icon = input(undefined, ...(ngDevMode ? [{ debugName: "icon" }] : []));
    iconColor = input('primary', ...(ngDevMode ? [{ debugName: "iconColor", alias: 'iconColor' }] : [{ alias: 'iconColor' }]));
    collapsed = model(false, ...(ngDevMode ? [{ debugName: "collapsed", alias: 'collapsed' }] : [{ alias: 'collapsed' }]));
    collapsible = input(false, ...(ngDevMode ? [{ debugName: "collapsible", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    /** @deprecated Use `collapsible` instead. */
    collapsable = input(false, ...(ngDevMode ? [{ debugName: "collapsable", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    isCollapsible = computed(() => this.collapsible() || this.collapsable(), ...(ngDevMode ? [{ debugName: "isCollapsible" }] : []));
    hideHeader = input(false, ...(ngDevMode ? [{ debugName: "hideHeader", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    noPaddingBody = input(false, ...(ngDevMode ? [{ debugName: "noPaddingBody", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
    constructor() {
        effect(() => {
            if (this.title()) {
                this.#el.nativeElement.removeAttribute('title');
            }
        });
    }
    toggleCollapse = () => {
        if (this.isCollapsible()) {
            this.collapsed.set(!this.collapsed());
        }
        else {
            if (this.collapsed()) {
                this.collapsed.set(false);
            }
        }
    };
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SdSection, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.24", type: SdSection, isStandalone: true, selector: "sd-section", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subTitle: { classPropertyName: "subTitle", publicName: "subTitle", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, iconColor: { classPropertyName: "iconColor", publicName: "iconColor", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, collapsable: { classPropertyName: "collapsable", publicName: "collapsable", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null }, noPaddingBody: { classPropertyName: "noPaddingBody", publicName: "noPaddingBody", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapsed: "collapsedChange" }, ngImport: i0, template: "@let _hideHeader = hideHeader();\n@let _collapsible = isCollapsible();\n@let _collapsed = collapsed();\n@let _title = title();\n@let _subTitle = subTitle();\n@let _icon = icon();\n@let _iconColor = iconColor();\n@let _noPaddingBody = noPaddingBody();\n<div class=\"rounded-8 bg-white\" [class.c-shadow-section]=\"!_collapsed\">\n  @if (!_hideHeader) {\n    <div\n      class=\"d-flex align-items-center justify-content-between w-full px-16 py-8 cursor-pointer\"\n      (click)=\"toggleCollapse()\"\n      aria-hidden=\"true\">\n      <div class=\"d-flex align-items-center\">\n        <ng-content select=\"[sdHeaderLeft]\">\n          @if (_icon) {\n            <span\n              class=\"mr-8 material-icons-outlined\"\n              [class.text-primary]=\"_iconColor === 'primary'\"\n              [class.text-secondary]=\"_iconColor === 'secondary'\"\n              [class.text-error]=\"_iconColor === 'error'\"\n              [class.text-warning]=\"_iconColor === 'warning'\"\n              [class.text-success]=\"_iconColor === 'success'\">\n              {{ _icon }}\n            </span>\n          }\n          <div>\n            @if (_title) {\n              <div class=\"T16M\">{{ _title }}</div>\n            }\n            @if (_subTitle) {\n              <div class=\"T12R text-secondary\">{{ _subTitle }}</div>\n            }\n          </div>\n        </ng-content>\n      </div>\n      <div class=\"d-flex\">\n        <ng-content select=\"[sdHeaderRight]\"></ng-content>\n        @if (_collapsible) {\n          <div class=\"d-flex align-items-center\">\n            @if (_collapsed) {\n              <mat-icon>expand_more</mat-icon>\n            } @else {\n              <mat-icon>expand_less</mat-icon>\n            }\n          </div>\n        }\n      </div>\n    </div>\n  }\n  @if (!_collapsed || _hideHeader) {\n    <!-- N\u1EBFu header b\u1ECB \u1EA9n th\u00EC kh\u00F4ng c\u1EA7n border top -->\n    <div [class.p-16]=\"!_noPaddingBody\" [class.c-no-padding-body]=\"_noPaddingBody\" [style.border-top]=\"_hideHeader ? 'none' : '1px solid #e6e6e6'\">\n      <ng-content></ng-content>\n    </div>\n  }\n</div>\n", styles: [":host{width:100%;display:block}.c-no-padding-body{padding:0!important}.c-shadow-section{box-shadow:-1px 0 #f2f2f2 inset,1px 0 #f2f2f2 inset,0 1px #f2f2f2 inset,0 -1px #f2f2f2 inset,0 1px 2px #2f31361a}.cursor-pointer{cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SdSection, decorators: [{
            type: Component,
            args: [{ selector: 'sd-section', imports: [MatIconModule], template: "@let _hideHeader = hideHeader();\n@let _collapsible = isCollapsible();\n@let _collapsed = collapsed();\n@let _title = title();\n@let _subTitle = subTitle();\n@let _icon = icon();\n@let _iconColor = iconColor();\n@let _noPaddingBody = noPaddingBody();\n<div class=\"rounded-8 bg-white\" [class.c-shadow-section]=\"!_collapsed\">\n  @if (!_hideHeader) {\n    <div\n      class=\"d-flex align-items-center justify-content-between w-full px-16 py-8 cursor-pointer\"\n      (click)=\"toggleCollapse()\"\n      aria-hidden=\"true\">\n      <div class=\"d-flex align-items-center\">\n        <ng-content select=\"[sdHeaderLeft]\">\n          @if (_icon) {\n            <span\n              class=\"mr-8 material-icons-outlined\"\n              [class.text-primary]=\"_iconColor === 'primary'\"\n              [class.text-secondary]=\"_iconColor === 'secondary'\"\n              [class.text-error]=\"_iconColor === 'error'\"\n              [class.text-warning]=\"_iconColor === 'warning'\"\n              [class.text-success]=\"_iconColor === 'success'\">\n              {{ _icon }}\n            </span>\n          }\n          <div>\n            @if (_title) {\n              <div class=\"T16M\">{{ _title }}</div>\n            }\n            @if (_subTitle) {\n              <div class=\"T12R text-secondary\">{{ _subTitle }}</div>\n            }\n          </div>\n        </ng-content>\n      </div>\n      <div class=\"d-flex\">\n        <ng-content select=\"[sdHeaderRight]\"></ng-content>\n        @if (_collapsible) {\n          <div class=\"d-flex align-items-center\">\n            @if (_collapsed) {\n              <mat-icon>expand_more</mat-icon>\n            } @else {\n              <mat-icon>expand_less</mat-icon>\n            }\n          </div>\n        }\n      </div>\n    </div>\n  }\n  @if (!_collapsed || _hideHeader) {\n    <!-- N\u1EBFu header b\u1ECB \u1EA9n th\u00EC kh\u00F4ng c\u1EA7n border top -->\n    <div [class.p-16]=\"!_noPaddingBody\" [class.c-no-padding-body]=\"_noPaddingBody\" [style.border-top]=\"_hideHeader ? 'none' : '1px solid #e6e6e6'\">\n      <ng-content></ng-content>\n    </div>\n  }\n</div>\n", styles: [":host{width:100%;display:block}.c-no-padding-body{padding:0!important}.c-shadow-section{box-shadow:-1px 0 #f2f2f2 inset,1px 0 #f2f2f2 inset,0 1px #f2f2f2 inset,0 -1px #f2f2f2 inset,0 1px 2px #2f31361a}.cursor-pointer{cursor:pointer}\n"] }]
        }], ctorParameters: () => [], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], subTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subTitle", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], iconColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconColor", required: false }] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], collapsable: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsable", required: false }] }], hideHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideHeader", required: false }] }], noPaddingBody: [{ type: i0.Input, args: [{ isSignal: true, alias: "noPaddingBody", required: false }] }] } });

class SdSectionItem {
    label = input.required(...(ngDevMode ? [{ debugName: "label" }] : []));
    labelWidth = input('150px', ...(ngDevMode ? [{ debugName: "labelWidth", transform: (val) => {
                return val || '150px';
            } }] : [{
            transform: (val) => {
                return val || '150px';
            },
        }]));
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SdSectionItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.24", type: SdSectionItem, isStandalone: true, selector: "sd-section-item", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, labelWidth: { classPropertyName: "labelWidth", publicName: "labelWidth", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"c-item\">\n  <div class=\"T14R text-black400\" [style.width]=\"labelWidth()\">{{ label() }}</div>\n  <div style=\"flex: 1;\"><ng-content></ng-content></div>\n</div>", styles: [":host{width:100%;display:block}.c-item{display:flex;flex-direction:row;align-items:center;column-gap:8px;padding:8px 16px;border-bottom:1px solid #f2f2f2}\n"] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SdSectionItem, decorators: [{
            type: Component,
            args: [{ selector: 'sd-section-item', standalone: true, template: "<div class=\"c-item\">\n  <div class=\"T14R text-black400\" [style.width]=\"labelWidth()\">{{ label() }}</div>\n  <div style=\"flex: 1;\"><ng-content></ng-content></div>\n</div>", styles: [":host{width:100%;display:block}.c-item{display:flex;flex-direction:row;align-items:center;column-gap:8px;padding:8px 16px;border-bottom:1px solid #f2f2f2}\n"] }]
        }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], labelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelWidth", required: false }] }] } });

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

export { SdSection, SdSectionItem };
//# sourceMappingURL=sdcorejs-angular-components-section.mjs.map
