"use strict";
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var react_transition_group_1 = require("react-transition-group");
require("./../styles/accordion.sass");
require("./../styles/accordionDefaults.sass");
var getStyleForTopLevelComponent_1 = require("../../core/utils/getStyleForTopLevelComponent");
exports.Accordion = function (_a) {
    var title = _a.title, subtitle = _a.subtitle, children = _a.children, className = _a.className;
    var _b = __read(react_1.useState(false), 2), visible = _b[0], setVisibility = _b[1];
    var toggle = function () { return setVisibility(function (visible) { return !visible; }); };
    return (react_1.default.createElement("div", { className: "universal-login-accordion" },
        react_1.default.createElement("div", { className: getStyleForTopLevelComponent_1.getStyleForTopLevelComponent(className) },
            react_1.default.createElement("div", { className: "accordion" },
                react_1.default.createElement("button", { onClick: toggle, className: "accordion-btn " + (visible ? 'expanded' : '') },
                    react_1.default.createElement("div", null,
                        react_1.default.createElement("h2", { className: "accordion-title" }, title),
                        react_1.default.createElement("p", { className: "accordion-subtitle" }, subtitle))),
                react_1.default.createElement(react_transition_group_1.TransitionGroup, null, visible
                    ? react_1.default.createElement(react_transition_group_1.CSSTransition, { timeout: 300, classNames: "accordion-content" },
                        react_1.default.createElement("div", { className: "accordion-content" }, children))
                    : null)))));
};
exports.default = exports.Accordion;
//# sourceMappingURL=Accordion.js.map