"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = DeleteButton;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _reactIntl = require("react-intl");
var _cspaceInput = require("cspace-input");
var _DeleteButton = _interopRequireDefault(require("../../../styles/cspace-ui/DeleteButton.css"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
  Button
} = _cspaceInput.components;
const messages = (0, _reactIntl.defineMessages)({
  label: {
    "id": "deleteButton.label",
    "defaultMessage": "Delete"
  }
});
const propTypes = {
  disabled: _propTypes.default.bool,
  isDeletable: _propTypes.default.bool,
  isSavePending: _propTypes.default.bool,
  onClick: _propTypes.default.func
};
function DeleteButton(props) {
  const {
    disabled,
    isDeletable,
    isSavePending,
    onClick
  } = props;
  if (!isDeletable) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(Button, {
    className: _DeleteButton.default.common,
    disabled: disabled || isSavePending,
    icon: true,
    name: "delete",
    onClick: onClick
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, messages.label));
}
DeleteButton.propTypes = propTypes;