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;
};
import React, { useState } from 'react';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import './../styles/accordion.sass';
import './../styles/accordionDefaults.sass';
import { getStyleForTopLevelComponent } from '../../core/utils/getStyleForTopLevelComponent';
export var Accordion = function (_a) {
    var title = _a.title, subtitle = _a.subtitle, children = _a.children, className = _a.className;
    var _b = __read(useState(false), 2), visible = _b[0], setVisibility = _b[1];
    var toggle = function () { return setVisibility(function (visible) { return !visible; }); };
    return (React.createElement("div", { className: "universal-login-accordion" },
        React.createElement("div", { className: getStyleForTopLevelComponent(className) },
            React.createElement("div", { className: "accordion" },
                React.createElement("button", { onClick: toggle, className: "accordion-btn " + (visible ? 'expanded' : '') },
                    React.createElement("div", null,
                        React.createElement("h2", { className: "accordion-title" }, title),
                        React.createElement("p", { className: "accordion-subtitle" }, subtitle))),
                React.createElement(TransitionGroup, null, visible
                    ? React.createElement(CSSTransition, { timeout: 300, classNames: "accordion-content" },
                        React.createElement("div", { className: "accordion-content" }, children))
                    : null)))));
};
export default Accordion;
//# sourceMappingURL=Accordion.js.map