'use strict';

var iconsReact = require('@cloudtower/icons-react');
var react = require('@linaria/react');
var index$1 = require('../Icon/index.js');
var cs = require('classnames');
var React = require('react');
var index = require('../../coreX/DropdownTransition/index.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var cs__default = /*#__PURE__*/_interopDefault(cs);
var React__default = /*#__PURE__*/_interopDefault(React);

const Card = /*#__PURE__*/react.styled('div')({
  name: "Card",
  class: "E_c18gxmrl",
  propsAsIs: false
});
const CloseButton = props => {
  const {
    className,
    onClick
  } = props;
  return /* @__PURE__ */React__default.default.createElement(index$1, {
    src: iconsReact.XmarkRemove24SecondaryIcon,
    iconHeight: 24,
    iconWidth: 24,
    className,
    onClick: e => {
      e.stopPropagation();
      onClick == null ? void 0 : onClick(e);
    }
  });
};
const AccordionCard = props => {
  const {
    header,
    expand,
    className,
    defaultExpand = true,
    mountOnEnter,
    unmountOnExit
  } = props;
  const [active, setActive] = React.useState(defaultExpand);
  return /* @__PURE__ */React__default.default.createElement(Card, {
    className: cs__default.default(active && "active", className)
  }, /* @__PURE__ */React__default.default.createElement("header", {
    onClick: () => setActive(!active),
    className: "show-close"
  }, typeof header === "function" ? header(active) : header), /* @__PURE__ */React__default.default.createElement(index, {
    visible: active,
    timeout: 200,
    classNames: "topo-dropdown",
    mountOnEnter,
    unmountOnExit
  }, /* @__PURE__ */React__default.default.createElement("div", {
    className: "expand"
  }, expand)));
};
AccordionCard.CloseButton = CloseButton;
var AccordionCard$1 = AccordionCard;

module.exports = AccordionCard$1;
