"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Accordion = void 0;

var _react = _interopRequireDefault(require("react"));

var _carbonComponentsReact = require("carbon-components-react");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Accordion = function Accordion(_ref) {
  var items = _ref.items,
      _ref$titleHeadingLeve = _ref.titleHeadingLevel,
      titleHeadingLevel = _ref$titleHeadingLeve === void 0 ? 'h2' : _ref$titleHeadingLeve,
      className = _ref.className;
  var ItemTitleHeading = titleHeadingLevel;
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Accordion, {
    className: className
  }, items.map(function (i) {
    return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.AccordionItem, {
      title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ItemTitleHeading, null, i.title), i.headerContent),
      open: i.isExpanded
    }, i.content);
  }));
};

exports.Accordion = Accordion;