"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkForm = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const TextInput_1 = require("../../../../../forms/TextInput.js");
const UrlInputRow_1 = require("../../../../../forms/UrlInputRow.js");
const base_1 = tslib_1.__importDefault(require("../../../../../forms/base/index.js"));
const forms_1 = require("../../../../../i18n/forms/index.js");
const handlers_1 = require("../../../../../utils/handlers.js");
exports.LinkForm = (0, react_1.memo)(function LinkForm({ href, autoFocus, onChange, onCancel, }) {
    const [url, setUrl] = (0, react_1.useState)(href);
    const handleSubmit = () => {
        onChange?.({ href: url });
    };
    const inputEnterKeyHandler = (0, handlers_1.enterKeyHandler)(handleSubmit);
    return ((0, jsx_runtime_1.jsxs)(base_1.default.Form, { children: [(0, jsx_runtime_1.jsx)(base_1.default.Layout, { children: (0, jsx_runtime_1.jsx)(base_1.default.Row, { label: (0, forms_1.i18n)('common_link'), help: (0, forms_1.i18n)('link_url_help'), control: (0, jsx_runtime_1.jsx)(UrlInputRow_1.UrlInputRow, { href: url, input: (0, jsx_runtime_1.jsx)(TextInput_1.TextInputFixed, { size: "s", hasClear: true, view: "normal", value: url, onUpdate: setUrl, placeholder: "https://", autoFocus: autoFocus, onKeyPress: inputEnterKeyHandler }) }) }) }), (0, jsx_runtime_1.jsx)(base_1.default.Footer, { onCancel: onCancel, onSubmit: handleSubmit })] }));
});
//# sourceMappingURL=TooltipView.js.map
