import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { memo, useState } from 'react';
import { TextInputFixed } from "../../../../../forms/TextInput.js";
import { UrlInputRow } from "../../../../../forms/UrlInputRow.js";
import Form from "../../../../../forms/base/index.js";
import { i18n } from "../../../../../i18n/forms/index.js";
import { enterKeyHandler } from "../../../../../utils/handlers.js";
export const LinkForm = memo(function LinkForm({ href, autoFocus, onChange, onCancel, }) {
    const [url, setUrl] = useState(href);
    const handleSubmit = () => {
        onChange?.({ href: url });
    };
    const inputEnterKeyHandler = enterKeyHandler(handleSubmit);
    return (_jsxs(Form.Form, { children: [_jsx(Form.Layout, { children: _jsx(Form.Row, { label: i18n('common_link'), help: i18n('link_url_help'), control: _jsx(UrlInputRow, { href: url, input: _jsx(TextInputFixed, { size: "s", hasClear: true, view: "normal", value: url, onUpdate: setUrl, placeholder: "https://", autoFocus: autoFocus, onKeyPress: inputEnterKeyHandler }) }) }) }), _jsx(Form.Footer, { onCancel: onCancel, onSubmit: handleSubmit })] }));
});
//# sourceMappingURL=TooltipView.js.map
