function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import isEmpty from 'lodash/fp/isEmpty';
import map from 'lodash/fp/map';
import ButtonLink from '../../atom/button-link';
import ButtonLinkIcon from '../../atom/button-link-icon';
import Tag from '../../atom/tag';
import BulletPointMenuButton from '../../molecule/bullet-point-menu-button';
import headerWithActionsPropTypes from './types';
import style from './style.css';
const getDataName = suffix => `header-with-actions-${suffix}`;
// @ts-expect-error (need to get the index)
const uncappedMap = map.convert({
  cap: false
});
const HeaderWithActions = props => {
  const {
    closeButton,
    title,
    tag,
    saveStatus,
    bulletPointMenuButton,
    actionButtons
  } = props;
  return /*#__PURE__*/React.createElement("div", {
    className: style.headerWrapper,
    "data-name": getDataName('wrapper')
  }, /*#__PURE__*/React.createElement("div", {
    className: style.titleAndButtonWrapper,
    "data-name": getDataName('title-and-button-wrapper')
  }, /*#__PURE__*/React.createElement(ButtonLinkIcon, _extends({}, closeButton, {
    className: style.button
  })), /*#__PURE__*/React.createElement("div", {
    className: style.titleWrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: style.statusWrapper
  }, /*#__PURE__*/React.createElement(Tag, tag), saveStatus.display && saveStatus.label ? /*#__PURE__*/React.createElement("p", {
    className: style.saveStatus
  }, saveStatus.label) : null), /*#__PURE__*/React.createElement("h3", {
    className: style.title,
    "aria-label": title,
    "data-name": getDataName('title')
  }, title))), /*#__PURE__*/React.createElement("div", {
    className: style.buttonsWrapper,
    "data-name": getDataName('buttons-wrapper')
  }, bulletPointMenuButton && !isEmpty(bulletPointMenuButton.buttons) ? /*#__PURE__*/React.createElement(BulletPointMenuButton, _extends({}, bulletPointMenuButton, {
    buttonAriaLabel: "More actions"
  })) : null, uncappedMap((action, key) => {
    return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, action, {
      key: key
    }));
  }, actionButtons)));
};
HeaderWithActions.propTypes = process.env.NODE_ENV !== "production" ? headerWithActionsPropTypes : {};
export default HeaderWithActions;
//# sourceMappingURL=index.js.map