import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "menuItems"];
import React from "react";
import Flex from "../../CssFlex";
import IconButton from "../../IconButton";
import ShowMore from "../../Icon/ShowMore";
import Menu from "../Menu";

var hasChildren = function hasChildren(children) {
  return React.Children.toArray(children).length > 0;
};

var DialogHeader = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var children = props.children,
      menuItems = props.menuItems,
      restProps = _objectWithoutProperties(props, _excluded);

  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex, _extends({
    alignItems: "center",
    pb: "md",
    ref: ref
  }, restProps), /*#__PURE__*/React.createElement(Flex.Item, {
    grow: 1
  }, children), hasChildren(menuItems) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(Menu, {
    trigger: /*#__PURE__*/React.createElement(IconButton, {
      icon: /*#__PURE__*/React.createElement(ShowMore, null)
    }),
    textAlign: "right",
    placement: "bottom-end"
  }, menuItems)))));
});
export default DialogHeader;