/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import { h } from "@stencil/core";
import cn from "../../global/lib/cn";
export class ShiftAccordion {
    constructor() {
        this.openedItems = [];
        this.toggleAccordion = (item) => {
            if (this.openedItems.includes(item))
                this.openedItems = this.openedItems.filter(openedItem => openedItem !== item);
            else
                this.openedItems = [...this.openedItems, item];
        };
    }
    render() {
        return (h("div", { key: 'c0b650143c24e0a73f0f759402e402d51cf81563', class: "flex w-full flex-col gap-[4px]" }, this.items.map((item, idx) => (h("div", { key: item.label + idx, class: "w-full rounded border" }, h("button", { onClick: () => this.toggleAccordion(item), class: "w-full flex flex-col items-start" }, h("div", { class: "flex items-center justify-between mx-auto text-[17px] py-[4px] w-[calc(100%-20px)]" }, h("span", null, item.label), h("svg", { width: "24", height: "24", fill: "none", "stroke-width": "2", viewBox: "0 0 24 24", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", xmlns: "http://www.w3.org/2000/svg", class: cn('transition-all duration-500', { 'rotate-180': this.openedItems.includes(item) }) }, h("path", { d: "m6 9 6 6 6-6" }))), h("div", { class: "transition-all duration-500", style: { height: this.openedItems.includes(item) ? '6px' : '0px' } }), h("flexible-container", { isOpened: this.openedItems.includes(item) }, item.content)))))));
    }
    static get is() { return "shift-accordion"; }
    static get originalStyleUrls() {
        return {
            "$": ["shift-accordion.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["shift-accordion.css"]
        };
    }
    static get properties() {
        return {
            "items": {
                "type": "unknown",
                "attribute": "items",
                "mutable": false,
                "complexType": {
                    "original": "AccordionItem[]",
                    "resolved": "AccordionItem[]",
                    "references": {
                        "AccordionItem": {
                            "location": "local",
                            "path": "/home/vsts/work/1/s/ADP.WebComponents/adp-web-components/src/components/components/shift-accordion.tsx",
                            "id": "src/components/components/shift-accordion.tsx::AccordionItem"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "accordionClasses": {
                "type": "string",
                "attribute": "accordion-classes",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "accordionContentClasses": {
                "type": "string",
                "attribute": "accordion-content-classes",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "openedItems": {}
        };
    }
}
