"use strict";
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputPure = void 0;
var react_1 = __importStar(require("react"));
exports.InputPure = function InputPure(props) {
    var _a;
    var textRight = props.textRight, prefix = props.prefix, error = props.error, textCenter = props.textCenter, loading = props.loading, suffix = props.suffix, inputRef = props.inputRef, defaultValueInput = props.defaultValueInput, rest = __rest(props, ["textRight", "prefix", "error", "textCenter", "loading", "suffix", "inputRef", "defaultValueInput"]);
    var _b = react_1.useState(false), focus = _b[0], setFocus = _b[1];
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("div", { className: "input-border " + (textRight && ' text-right') + " " + (rest.type && rest.type === 'hidden' && ' input-hidden') + " " + (error && 'has-error') + " " + (focus && 'focus') },
            prefix && react_1.default.createElement("div", { className: "prefix" }, prefix),
            react_1.default.createElement("input", __assign({ ref: inputRef, defaultValue: defaultValueInput }, rest, { onBlur: function (ev) {
                    if (rest.onBlur)
                        rest.onBlur(ev);
                    setFocus(false);
                }, onFocus: function (ev) {
                    if (rest.onFocus)
                        rest.onFocus(ev);
                    setFocus(true);
                }, className: "" + (textCenter && ' text-center') })),
            loading && (react_1.default.createElement("div", { className: "suffix suffix-loading" },
                react_1.default.createElement("i", { className: "fas fa-spinner fa-spin fa-fw" }))),
            suffix && react_1.default.createElement("div", { className: "suffix" }, suffix)),
        error && (react_1.default.createElement("div", { "data-cy": "input-error." + ((_a = rest['data-cy']) !== null && _a !== void 0 ? _a : ''), className: "error-input", "data-testid": "input-error" }, error))));
};
//# sourceMappingURL=InputPure.js.map