"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccordionTab = void 0;
const react_1 = __importDefault(require("react"));
const Icon_1 = require("../icon/Icon");
/**
 * Primary UI component for user interaction
 */
const AccordionTab = ({ children, id, label, className, accordionStyle, startOpen, dropdown, onClick, }) => {
    const [isOpen, setOpen] = react_1.default.useState(startOpen);
    const fileTreeIcon = accordionStyle == 'file-tree' ? (react_1.default.createElement(Icon_1.Icon, { className: "file-icon", icon: isOpen ? 'fas fa-folder-open' : 'fas fa-folder', label: label })) : null;
    return (react_1.default.createElement("article", { className: `${accordionStyle || ''}` + ' accordion ' + `${className || ''}`, id: id },
        react_1.default.createElement("div", { className: `accordion-title ${isOpen ? 'open' : ''}`, onClick: () => {
                onClick?.(!isOpen);
                setOpen(!isOpen);
            } }, fileTreeIcon || label),
        react_1.default.createElement("div", { className: `accordion-item ${!isOpen ? ' collapsed' : ''} ${dropdown ? ' dropdown-style' : ''}` },
            react_1.default.createElement("div", { className: "accordion-content" }, children))));
};
exports.AccordionTab = AccordionTab;
