function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _object_spread(target) {
    for(var i = 1; i < arguments.length; i++){
        var source = arguments[i] != null ? arguments[i] : {};
        var ownKeys = Object.keys(source);
        if (typeof Object.getOwnPropertySymbols === "function") {
            ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
                return Object.getOwnPropertyDescriptor(source, sym).enumerable;
            }));
        }
        ownKeys.forEach(function(key) {
            _define_property(target, key, source[key]);
        });
    }
    return target;
}
function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys, key, i;
    if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
        sourceKeys = Reflect.ownKeys(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
        return target;
    }
    target = _object_without_properties_loose(source, excluded);
    if (Object.getOwnPropertySymbols) {
        sourceKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
    }
    return target;
}
import React, { forwardRef } from "react";
import { StyledIconButton, StyledButton } from "../../ui";
import { IconPlus } from "../../../_Icon";
var getDefaultIcon = function getDefaultIcon(size) {
    var iconSize = size === 'xs' ? 'xs' : 's';
    return /*#__PURE__*/ React.createElement(IconPlus, {
        size: iconSize,
        color: "inherit"
    });
};
export var AttachButton = /*#__PURE__*/ forwardRef(function(props, ref) {
    if (props.buttonType === 'iconButton') {
        var size = props.size, icon = props.icon, rest = _object_without_properties(props, [
            "size",
            "icon"
        ]);
        return /*#__PURE__*/ React.createElement(StyledIconButton, _object_spread({
            ref: ref
        }, rest), icon || getDefaultIcon(size));
    }
    var _props_text = props.text, text = _props_text === void 0 ? 'Загрузить файл' : _props_text, rest1 = _object_without_properties(props, [
        "text"
    ]);
    return /*#__PURE__*/ React.createElement(StyledButton, _object_spread({
        ref: ref,
        text: text
    }, rest1));
});
