"use strict";
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;
};
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const sc = __importStar(require("./styles"));
// export const BaseInput: FC<Props> = React.forwardRef(
//   (
//     {
//       icon,
//       unit,
//       onFocus,
//       onBlur,
//       readOnly,
//       disabled,
//       invalid,
//       className,
//       inputRef,
//       ...props
//     }: Props,
//     ref
//   ) => {
//   }
// );
exports.BaseInput = props => {
    const { icon, unit, onFocus, onBlur, readOnly, disabled, invalid, className, inputRef } = props, restProps = __rest(props, ["icon", "unit", "onFocus", "onBlur", "readOnly", "disabled", "invalid", "className", "inputRef"]);
    const [focused, setFocusedState] = react_1.useState(false);
    const handleBlur = react_1.useCallback(e => {
        onBlur && onBlur(e);
        setFocusedState(false);
    }, [onBlur, setFocusedState]);
    const handleFocus = react_1.useCallback(e => {
        onFocus && onFocus(e);
        setFocusedState(true);
    }, [onFocus, setFocusedState]);
    return (react_1.default.createElement(sc.Wrapper, Object.assign({}, { focused, disabled, invalid, readOnly, className }),
        icon && react_1.default.createElement(sc.Icon, null, icon),
        react_1.default.createElement(sc.Input, Object.assign({ onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, disabled: disabled, readOnly: readOnly, "data-testid": "base-input" }, restProps)),
        unit && react_1.default.createElement(sc.Unit, null, unit)));
};
//# sourceMappingURL=BaseInput.js.map