"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) || function () {
    __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;
    };
    return __assign.apply(this, arguments);
};
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 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
var styleConstants_1 = require("../styleConstants");
var Input_1 = require("./Input");
var StyledInputGroupContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  margin: 0 0 10px;\n"], ["\n  margin: 0 0 10px;\n"])));
var StyledInputGroup = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  align-items: 100%;\n  box-sizing: border-box;\n  display: flex;\n  position: relative;\n  margin: 5px 0;\n  width: 100%;\n\n  & > div {\n    margin-bottom: 0;\n  }\n  && input {\n    margin: 0;\n  }\n"], ["\n  align-items: 100%;\n  box-sizing: border-box;\n  display: flex;\n  position: relative;\n  margin: 5px 0;\n  width: 100%;\n\n  & > div {\n    margin-bottom: 0;\n  }\n  && input {\n    margin: 0;\n  }\n"])));
var StyledInputGroupPrepend = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n  display: flex;\n  box-sizing: border-box;\n\n  & > span {\n    margin-right: -1px;\n  }\n"], ["\n  display: flex;\n  box-sizing: border-box;\n\n  & > span {\n    margin-right: -1px;\n  }\n"])));
var StyledInputGroupAppend = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n  display: flex;\n  box-sizing: border-box;\n\n  & > span {\n    margin-left: -1px;\n  }\n"], ["\n  display: flex;\n  box-sizing: border-box;\n\n  & > span {\n    margin-left: -1px;\n  }\n"])));
var InputGroupText = styled_components_1.default.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n  border: 1px solid ", ";\n  display: flex;\n  font-size: inherit;\n  padding: ", ";\n  text-align: center;\n  white-space: nowrap;\n"], ["\n  border: 1px solid ", ";\n  display: flex;\n  font-size: inherit;\n  padding: ", ";\n  text-align: center;\n  white-space: nowrap;\n"])), styleConstants_1.colors.accent.CIVIL_GRAY_3, function (props) { return (props.noPadding ? "0" : "10px"); });
var InputGroupAppend = function (props) {
    return (React.createElement(StyledInputGroupAppend, null,
        React.createElement(InputGroupText, { noPadding: props.noPadding }, props.children)));
};
var InputGroupPrepend = function (props) {
    return (React.createElement(StyledInputGroupPrepend, null,
        React.createElement(InputGroupText, null, props.children)));
};
exports.InputGroup = function (props) {
    var label = props.label, append = props.append, prepend = props.prepend, placeholder = props.placeholder, noAppendPadding = props.noAppendPadding, invalid = props.invalid, invalidMessage = props.invalidMessage, inputProps = __rest(props, ["label", "append", "prepend", "placeholder", "noAppendPadding", "invalid", "invalidMessage"]);
    var Input = props.inputComponent || Input_1.TextInput;
    return (React.createElement(StyledInputGroupContainer, null,
        !props.noLabel && React.createElement(Input_1.InputLabel, null, label || placeholder),
        React.createElement(StyledInputGroup, null,
            prepend && React.createElement(InputGroupPrepend, null, props.prepend),
            React.createElement(Input, __assign({ noLabel: true }, inputProps)),
            append && React.createElement(InputGroupAppend, { noPadding: noAppendPadding }, props.append)),
        invalid && invalidMessage && React.createElement(Input_1.ErrorMessage, null, invalidMessage)));
};
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
//# sourceMappingURL=InputGroup.js.map