"use strict";

exports.__esModule = true;
exports.default = exports.ICONS = void 0;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _types = require("./types");
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const ICONS = exports.ICONS = {
  arrow: _novaIcons.NovaCompositionNavigationArrowDown
};
const ExpandableItem = ({
  icon,
  title,
  isExpended,
  isLink,
  content,
  onClick,
  image,
  ariaLabel
}) => {
  const Icon = ICONS[icon];
  return /*#__PURE__*/_react.default.createElement("div", {
    className: isExpended ? _style.default.expendedContainer : _style.default.container
  }, isLink ? /*#__PURE__*/_react.default.createElement("a", {
    className: (0, _classnames.default)(_style.default.header, isExpended ? _style.default.expendedHeader : null),
    onClick: onClick,
    "aria-label": ariaLabel
  }, /*#__PURE__*/_react.default.createElement("h3", {
    className: _style.default.title
  }, title), Icon ? /*#__PURE__*/_react.default.createElement(Icon, {
    className: (0, _classnames.default)(_style.default.icon, isExpended ? _style.default.expendedIcon : null, isLink ? _style.default.linkIcon : null)
  }) : null) : /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)(_style.default.header, isExpended ? _style.default.expendedHeader : null),
    onClick: onClick,
    id: `${title}_expended_item_id`,
    "aria-controls": `${title}_expended_item_aria-controls`,
    "aria-expanded": isExpended
  }, /*#__PURE__*/_react.default.createElement("h3", {
    className: _style.default.title
  }, title), Icon ? /*#__PURE__*/_react.default.createElement(Icon, {
    className: (0, _classnames.default)(_style.default.icon, isExpended ? _style.default.expendedIcon : null, isLink ? _style.default.linkIcon : null)
  }) : null), isExpended ? /*#__PURE__*/_react.default.createElement("div", {
    id: `${title}_expended_item_aria-controls`,
    role: "region",
    "aria-labelledby": `${title}_expended_item_id`
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.content // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: content
    }
  }), image ? /*#__PURE__*/_react.default.createElement("img", {
    className: _style.default.image,
    src: image,
    alt: ''
  }) : null) : null);
};
ExpandableItem.propTypes = process.env.NODE_ENV !== "production" ? _types.propTypes : {};
var _default = exports.default = ExpandableItem;
//# sourceMappingURL=index.js.map