var _excluded = ["background", "children", "testId"],
  _excluded2 = ["children", "testId"],
  _excluded3 = ["children", "testId"],
  _excluded4 = ["children", "hasBorder", "parentPadding", "testId"],
  _excluded5 = ["iconName", "onClick", "testId"],
  _excluded6 = ["onClose", "testId"],
  _excluded7 = ["children"];
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); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
import React from "react";
import Layer from "../templates/layer";
import Flex from "../templates/flex";
import { IconButton } from "../button";
var TOP_BOTTOM_PADDING = 2;
var LEFT_RIGHT_PADDING = 4;
export var ModalContent = function ModalContent(_ref) {
  var _ref$background = _ref.background,
    background = _ref$background === void 0 ? "mainBackground" : _ref$background,
    children = _ref.children,
    testId = _ref.testId,
    rest = _objectWithoutPropertiesLoose(_ref, _excluded);
  return /*#__PURE__*/React.createElement(Flex, _extends({
    background: background,
    column: true,
    "data-testid": testId,
    round: true
  }, rest), children);
};
export var ModalHeader = function ModalHeader(_ref2) {
  var children = _ref2.children,
    testId = _ref2.testId,
    rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
  return /*#__PURE__*/React.createElement(Flex, _extends({
    background: "modalHeaderBackground",
    "data-testid": testId,
    padding: [TOP_BOTTOM_PADDING, LEFT_RIGHT_PADDING]
  }, rest), children);
};
export var ModalBody = function ModalBody(_ref3) {
  var children = _ref3.children,
    testId = _ref3.testId,
    rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
  return /*#__PURE__*/React.createElement(Flex, _extends({
    "data-testid": testId,
    padding: [TOP_BOTTOM_PADDING, LEFT_RIGHT_PADDING],
    column: true
  }, rest), children);
};
export var ModalFooter = function ModalFooter(_ref4) {
  var children = _ref4.children,
    _ref4$hasBorder = _ref4.hasBorder,
    hasBorder = _ref4$hasBorder === void 0 ? true : _ref4$hasBorder,
    parentPadding = _ref4.parentPadding,
    testId = _ref4.testId,
    rest = _objectWithoutPropertiesLoose(_ref4, _excluded4);
  return /*#__PURE__*/React.createElement(Flex, {
    column: true,
    padding: parentPadding || [0, LEFT_RIGHT_PADDING],
    flex: 1
  }, /*#__PURE__*/React.createElement(Flex, _extends({
    "data-testid": testId,
    flex: 1,
    padding: [TOP_BOTTOM_PADDING, 0],
    alignItems: "center",
    justifyContent: "end",
    border: hasBorder ? {
      size: "1px",
      type: "solid",
      side: "top",
      color: "borderSecondary"
    } : {}
  }, rest), children));
};
export var ModalButton = function ModalButton(_ref5) {
  var iconName = _ref5.iconName,
    onClick = _ref5.onClick,
    testId = _ref5.testId,
    rest = _objectWithoutPropertiesLoose(_ref5, _excluded5);
  return /*#__PURE__*/React.createElement(IconButton, _extends({
    "data-testid": testId,
    icon: iconName,
    neutral: true,
    onClick: onClick,
    cursor: "pointer",
    flavour: "borderless"
  }, rest));
};
export var ModalCloseButton = function ModalCloseButton(_ref6) {
  var onClose = _ref6.onClose,
    testId = _ref6.testId,
    rest = _objectWithoutPropertiesLoose(_ref6, _excluded6);
  return /*#__PURE__*/React.createElement(ModalButton, _extends({
    iconName: "x",
    onClick: onClose,
    testId: testId,
    position: "absolute",
    height: "14px",
    width: "14px",
    top: 2,
    right: 2
  }, rest));
};
var Modal = function Modal(_ref7) {
  var children = _ref7.children,
    rest = _objectWithoutPropertiesLoose(_ref7, _excluded7);
  return /*#__PURE__*/React.createElement(Layer, rest, children);
};
export default Modal;