"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextAreaFixed = exports.TextInputFixed = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const uikit_1 = require("@gravity-ui/uikit");
const react_use_1 = require("react-use");
// TODO: remove after fix https://github.com/yandex-cloud/uikit/issues/133
exports.TextInputFixed = (0, react_1.forwardRef)((props, ref) => {
    const inputRef = (0, react_1.useRef)(null);
    const controlRef = props.controlRef ?? inputRef;
    (0, react_use_1.useEffectOnce)(() => {
        if (props.autoFocus) {
            setTimeout(() => {
                controlRef.current?.focus();
            }, 30);
        }
    });
    // eslint-disable-next-line jsx-a11y/no-autofocus
    return (0, jsx_runtime_1.jsx)(uikit_1.TextInput, { ref: ref, ...props, controlRef: controlRef, autoFocus: false });
});
exports.TextInputFixed.displayName = 'TextInputFixed';
// TODO: remove after fix https://github.com/yandex-cloud/uikit/issues/133
exports.TextAreaFixed = (0, react_1.forwardRef)((props, ref) => {
    const inputRef = (0, react_1.useRef)(null);
    const controlRef = props.controlRef ?? inputRef;
    (0, react_use_1.useEffectOnce)(() => {
        if (props.autoFocus) {
            setTimeout(() => {
                controlRef.current?.focus();
            }, 30);
        }
    });
    return (0, jsx_runtime_1.jsx)(uikit_1.TextArea, { ref: ref, ...props, controlRef: controlRef, autoFocus: false });
});
exports.TextAreaFixed.displayName = 'TextInputFixed';
//# sourceMappingURL=TextInput.js.map
