"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkPlaceholderWidget = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const uikit_1 = require("@gravity-ui/uikit");
const classname_1 = require("../../../../classname.js");
const LinkForm_1 = require("../../../../forms/LinkForm.js");
const widgets_1 = require("../../../../i18n/widgets/index.js");
const react_utils_1 = require("../../../../react-utils/index.js");
require("./widget.css");
const b = (0, classname_1.cn)('link-placeholder-widget');
const placement = ['bottom-start', 'top-start', 'bottom-end', 'top-end'];
const LinkPlaceholderWidget = ({ onCancel, onSubmit, }) => {
    const [anchor, setAnchor] = (0, react_utils_1.useElementState)();
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { ref: setAnchor, className: b(), children: (0, jsx_runtime_1.jsx)("a", { href: "#", children: (0, widgets_1.i18n)('link') }) }), (0, jsx_runtime_1.jsx)(uikit_1.Popup, { qa: "g-md-link-form", open: true, modal: true, onOpenChange: onCancel, anchorElement: anchor, placement: placement, children: (0, jsx_runtime_1.jsx)(LinkForm_1.LinkForm, { autoFocus: true, onSubmit: onSubmit, onCancel: onCancel }) })] }));
};
exports.LinkPlaceholderWidget = LinkPlaceholderWidget;
//# sourceMappingURL=widget.js.map
