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;
}
import React from 'react';
import styled from 'styled-components';
import { applyDisabled, applyBlur, applyEllipsis } from '../../mixins';
import { Spinner } from '../Spinner';
/**
 * Корневой элемент для стилизации кнопки.
 * Должен быть передан в функцию `createButton`.
 */ export var ButtonRoot = styled.button.withConfig({
    displayName: "Button__ButtonRoot",
    componentId: "sc-b39b3537-0"
})([
    "position:relative;display:inline-flex;align-items:center;box-sizing:border-box;justify-content:center;appearance:none;border:none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);a&{text-decoration:none;}&:focus{outline:none;}",
    " ",
    ""
], function(param) {
    var isLoading = param.$isLoading;
    return !isLoading && applyDisabled;
}, applyBlur);
/**
 * Элемент лоадера для кнопки.
 */ export var ButtonLoader = styled.div.withConfig({
    displayName: "Button__ButtonLoader",
    componentId: "sc-b39b3537-1"
})([
    "position:absolute;"
]);
/**
 * Спиннер по умолчанию с фиксированной шириной.
 */ export var StyledSpinner = styled(Spinner).withConfig({
    displayName: "Button__StyledSpinner",
    componentId: "sc-b39b3537-2"
})([
    "width:1.375rem;"
]);
/**
 * Обёртка для содержимого кнопки.
 */ export var ButtonContentWrapper = styled.span.withConfig({
    displayName: "Button__ButtonContentWrapper",
    componentId: "sc-b39b3537-3"
})([
    "display:flex;align-items:inherit;justify-content:inherit;width:100%;",
    ""
], function(param) {
    var isLoading = param.$isLoading;
    return isLoading && 'opacity: 0;';
});
/**
 * A text wrapping element, that used when `text` prop is passed.
 * @private
 */ export var ButtonText = styled.span.withConfig({
    displayName: "Button__ButtonText",
    componentId: "sc-b39b3537-4"
})([
    "box-sizing:border-box;",
    " ",
    " ",
    ""
], applyEllipsis, function(param) {
    var isContentLeft = param.$isContentLeft;
    return isContentLeft && 'margin-left: 0.375rem;';
}, function(param) {
    var isContentRight = param.$isContentRight;
    return isContentRight && 'margin-right: 0.375rem;';
});
/**
 * Базовая кнопка.
 * @deprecated
 */ export var Button = /*#__PURE__*/ React.forwardRef(// eslint-disable-next-line prefer-arrow-callback
function Button(props, ref) {
    return /*#__PURE__*/ React.createElement(ButtonRoot, _object_spread({
        ref: ref
    }, props));
});
Button.defaultProps = {
    pin: 'square-square',
    outlined: false
};
