import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef, useRef } from 'react';
import { TextArea as TextAreaUIKit, TextInput as TextInputUIKit, } from '@gravity-ui/uikit';
import { useEffectOnce } from 'react-use';
// TODO: remove after fix https://github.com/yandex-cloud/uikit/issues/133
export const TextInputFixed = forwardRef((props, ref) => {
    const inputRef = useRef(null);
    const controlRef = props.controlRef ?? inputRef;
    useEffectOnce(() => {
        if (props.autoFocus) {
            setTimeout(() => {
                controlRef.current?.focus();
            }, 30);
        }
    });
    // eslint-disable-next-line jsx-a11y/no-autofocus
    return _jsx(TextInputUIKit, { ref: ref, ...props, controlRef: controlRef, autoFocus: false });
});
TextInputFixed.displayName = 'TextInputFixed';
// TODO: remove after fix https://github.com/yandex-cloud/uikit/issues/133
export const TextAreaFixed = forwardRef((props, ref) => {
    const inputRef = useRef(null);
    const controlRef = props.controlRef ?? inputRef;
    useEffectOnce(() => {
        if (props.autoFocus) {
            setTimeout(() => {
                controlRef.current?.focus();
            }, 30);
        }
    });
    return _jsx(TextAreaUIKit, { ref: ref, ...props, controlRef: controlRef, autoFocus: false });
});
TextAreaFixed.displayName = 'TextInputFixed';
//# sourceMappingURL=TextInput.js.map
