import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["fillProps", "customMessages"];
import { forwardRef } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { FormattedMessage } from 'react-intl';
import Button from '@material-ui/core/Button';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var useStyles = makeStyles(function (theme) {
  return {
    buttonContainer: {
      '& > *': {
        marginRight: theme.spacing(1),
        marginTop: theme.spacing(1),
        '@media print': {
          display: 'none'
        }
      }
    }
  };
});
export default function withFillActions(Form) {
  return /*#__PURE__*/forwardRef(function (_ref, ref) {
    var fillProps = _ref.fillProps,
        customMessages = _ref.customMessages,
        otherProps = _objectWithoutProperties(_ref, _excluded);

    var classes = useStyles();

    if (fillProps === null || fillProps === void 0 ? void 0 : fillProps.actions) {
      var _customMessages$submi;

      return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({
        ref: ref,
        fillProps: fillProps,
        customMessages: customMessages
      }, otherProps), {}, {
        children: /*#__PURE__*/_jsxs("div", {
          className: classes.buttonContainer,
          children: [/*#__PURE__*/_jsx(Button, {
            type: "submit",
            variant: "contained",
            color: "primary",
            children: (_customMessages$submi = customMessages === null || customMessages === void 0 ? void 0 : customMessages.submit) !== null && _customMessages$submi !== void 0 ? _customMessages$submi : /*#__PURE__*/_jsx(FormattedMessage, {
              id: "6jFMKd",
              defaultMessage: [{
                "type": 0,
                "value": "Lähetä"
              }]
            })
          }), otherProps.draftButton, fillProps.actions]
        })
      }));
    } else {
      return /*#__PURE__*/_jsx(Form, _objectSpread({
        ref: ref,
        fillProps: fillProps,
        customMessages: customMessages
      }, otherProps));
    }
  });
}
//# sourceMappingURL=withFillActions.js.map