function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
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 _iterable_to_array(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
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;
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _to_array(arr) {
    return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
import React from 'react';
import styled, { css } from 'styled-components';
import { surfaceCard } from '../../tokens';
import { addFocus, applyDisabled, applyRoundness, radiuses, syntheticFocus } from '../../mixins';
import { Body1 } from '../Typography';
// В этих константах задаем размеры в em, чтобы не зависеть напрямую от пикселей
// В то же время в числителях - значения в пикселях, взятые из макета
var fontSize = 16;
var shadowOffset = 8 / fontSize;
var shadowSize = 24 / fontSize;
var outlineSize = 2 / fontSize;
var DEFAULT_ROUNDNESS = 20;
export var StyledCard = styled(Body1).withConfig({
    displayName: "Card__StyledCard",
    componentId: "sc-34a54ef8-0"
})([
    "",
    " ",
    ";position:relative;display:flex;box-sizing:border-box;flex-direction:column;flex-shrink:0;background:",
    ";box-shadow:0 ",
    "em ",
    "em rgba(0,0,0,0.1);transition:",
    ";",
    ""
], applyDisabled, applyRoundness, surfaceCard, shadowOffset, shadowSize, function(param) {
    var theme = param.theme;
    return theme.lowPerformance ? 'unset' : 'transform 0.4s ease-in-out';
}, function(param) {
    var focused = param.focused, outlined = param.outlined, roundness = param.roundness, scaleOnFocus = param.scaleOnFocus, theme = param.theme;
    return css([
        "",
        " ",
        " &:focus{outline:none;}"
    ], addFocus({
        lowPerformance: theme.lowPerformance,
        focused: focused,
        outlined: outlined,
        outlineSize: "".concat(outlineSize, "rem"),
        outlineRadius: "".concat(radiuses[roundness] + outlineSize, "rem")
    }), scaleOnFocus && syntheticFocus(css([
        "&{transform:scale(1.04);}"
    ]), focused));
});
/**
 * Контейнер со скругленными углами с возможностью фокусировки на нем.
 */ // eslint-disable-next-line prefer-arrow-callback
export var Card = /*#__PURE__*/ React.forwardRef(function Card(_0, _1) {
    var _ref = [
        _0,
        _1
    ], _ref1 = _to_array(_ref), _ref2 = _ref1[0], _rest = _ref1.slice(1), _ref_roundness = _ref2.roundness, roundness = _ref_roundness === void 0 ? DEFAULT_ROUNDNESS : _ref_roundness, children = _ref2.children, rest = _object_without_properties(_ref2, [
        "roundness",
        "children"
    ]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
    return /*#__PURE__*/ React.createElement(StyledCard, _object_spread({
        ref: ref,
        roundness: roundness
    }, rest), children);
});
