'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var IconPlus = require('../../../_Icon/Icons/IconPlus.js');
var IconButton_styles = require('../../ui/IconButton/IconButton.styles.js');
var Button_styles = require('../../ui/Button/Button.styles.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

var _excluded = ["size", "icon"],
  _excluded2 = ["text"];
var getDefaultIcon = function getDefaultIcon(size) {
  var iconSize = size === 'xs' ? 'xs' : 's';
  return /*#__PURE__*/React__default.default.createElement(IconPlus.IconPlus, {
    size: iconSize,
    color: "inherit"
  });
};
var AttachButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
  if (props.buttonType === 'iconButton') {
    var size = props.size,
      icon = props.icon,
      _rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
    return /*#__PURE__*/React__default.default.createElement(IconButton_styles.StyledIconButton, _rollupPluginBabelHelpers.extends({
      ref: ref
    }, _rest), icon || getDefaultIcon(size));
  }
  var _props$text = props.text,
    text = _props$text === void 0 ? 'Загрузить файл' : _props$text,
    rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded2);
  return /*#__PURE__*/React__default.default.createElement(Button_styles.StyledButton, _rollupPluginBabelHelpers.extends({
    ref: ref,
    text: text
  }, rest));
});

exports.AttachButton = AttachButton;
