"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;
};
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
            t[p[i]] = s[p[i]];
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var recompose_1 = require("recompose");
var styled_components_1 = require("styled-components");
var asRendition_1 = require("../asRendition");
var theme_1 = require("../theme");
var utils_1 = require("../utils");
var Base = styled_components_1.default.textarea(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder-radius: ", ";\n\tfont-size: inherit;\n\tborder: 1px solid ", ";\n\tpadding: 8px 16px;\n\tresize: vertical;\n\tdisplay: block;\n\twidth: 100%;\n\n\t&:hover {\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", ";\n"], ["\n\tborder-radius: ", ";\n\tfont-size: inherit;\n\tborder: 1px solid ", ";\n\tpadding: 8px 16px;\n\tresize: vertical;\n\tdisplay: block;\n\twidth: 100%;\n\n\t&:hover {\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", ";\n"])), utils_1.px(theme_1.radius), function (props) { return props.theme.colors.gray.main; }, function (props) { return props.theme.colors.gray.main; }, utils_1.monospace);
var Component = function (_a) {
    var autoRows = _a.autoRows, maxRows = _a.maxRows, minRows = _a.minRows, rows = _a.rows, props = __rest(_a, ["autoRows", "maxRows", "minRows", "rows"]);
    var rowsProp = rows;
    if (autoRows && props.onChange) {
        rowsProp = (props.value || '').split('\n').length;
    }
    if (maxRows && (rowsProp || 0) > maxRows) {
        rowsProp = maxRows;
    }
    if (minRows && (rowsProp || 0) < minRows) {
        rowsProp = minRows;
    }
    return React.createElement(Base, __assign({ rows: rowsProp }, props));
};
exports.default = recompose_1.compose(styled_components_1.withTheme, asRendition_1.default)(Component);
var templateObject_1;
