"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });
var styled_components_1 = require("styled-components");
var asRendition_1 = require("../asRendition");
var theme_1 = require("../theme");
var utils_1 = require("../utils");
var getColor = function (props) {
    if (props.invalid) {
        return props.theme.colors.danger.main;
    }
    if (props.valid) {
        return props.theme.colors.success.main;
    }
    if (props.disabled) {
        return props.theme.colors.gray.light;
    }
    return props.theme.colors.gray.main;
};
var getHeight = function (props) {
    return props.emphasized ? props.theme.space[5] : props.theme.space[4];
};
var getSpinButtonMargin = function (props) {
    return (getHeight(props) - 2 - 20) / 2;
};
var Base = styled_components_1.default.input(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-radius: ", ";\n\theight: ", ";\n\tfont-size: inherit;\n\tborder: 1px solid ", ";\n\tpadding: 0px 16px;\n\n\t&[disabled] {\n\t\tbackground-color: ", ";\n\t\tcursor: not-allowed;\n\t}\n\t&:focus:enabled {\n\t\tborder-color: ", ";\n\t}\n\t&:hover:enabled {\n\t\tbox-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.1);\n\t}\n\t&::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t&[type='checkbox'] {\n\t\theight: auto;\n\t\tfont-size: ", ";\n\t}\n\n\t&[type='date' i],\n\t&[type='datetime-local' i],\n\t&[type='month' i],\n\t&[type='time' i],\n\t&[type='week' i] {\n\t\t&::-webkit-inner-spin-button {\n\t\t\theight: 20px;\n\t\t\tmargin-top: ", ";\n\t\t}\n\t}\n\n\t", ";\n"], ["\n\tborder-radius: ", ";\n\theight: ", ";\n\tfont-size: inherit;\n\tborder: 1px solid ", ";\n\tpadding: 0px 16px;\n\n\t&[disabled] {\n\t\tbackground-color: ", ";\n\t\tcursor: not-allowed;\n\t}\n\t&:focus:enabled {\n\t\tborder-color: ", ";\n\t}\n\t&:hover:enabled {\n\t\tbox-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.1);\n\t}\n\t&::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t&[type='checkbox'] {\n\t\theight: auto;\n\t\tfont-size: ", ";\n\t}\n\n\t&[type='date' i],\n\t&[type='datetime-local' i],\n\t&[type='month' i],\n\t&[type='time' i],\n\t&[type='week' i] {\n\t\t&::-webkit-inner-spin-button {\n\t\t\theight: 20px;\n\t\t\tmargin-top: ", ";\n\t\t}\n\t}\n\n\t", ";\n"])), utils_1.px(theme_1.radius), function (props) { return utils_1.px(getHeight(props)); }, getColor, function (props) { return props.theme.colors.gray.light; }, function (props) { return props.theme.colors.secondary.main; }, function (props) { return props.theme.colors.gray.main; }, function (props) { return utils_1.px(props.theme.fontSizes[1]); }, function (props) { return utils_1.px(getSpinButtonMargin(props)); }, utils_1.monospace);
exports.default = asRendition_1.default(Base);
var templateObject_1;
