import { jsx as _jsx } from "react/jsx-runtime";
import { BaseTooltipPluginView, } from "../BaseTooltip/index.js";
import { TooltipButton } from "./TooltipSelect.js";
/** @deprecated */
export class TooltipSelectPluginView extends BaseTooltipPluginView {
    buttonText;
    items;
    buildAttrs;
    withSearch;
    enableHideOnBlur;
    constructor(view, options) {
        super(view, options);
        this.buttonText = options.buttonText;
        this.items = options.items;
        this.buildAttrs = options.buildAttrs;
        this.withSearch = options.withSearch ?? true;
        this.enableHideOnBlur = options.disableHideOnBlur !== true;
        if (this.enableHideOnBlur) {
            this.view.dom.addEventListener('focus', this.onViewFocus);
        }
    }
    destroy() {
        super.destroy();
        this.view.dom.removeEventListener('focus', this.onViewFocus);
    }
    renderContent(currentNode) {
        return (_jsx(TooltipButton, { domRef: currentNode.dom, buttonTitle: this.buttonText?.(currentNode.node), items: this.items, onUpdate: (v) => this.changeAttrsCb(this.buildAttrs(v), { setFocus: true }), withSearch: this.withSearch, onOutsideClick: this.onOutsideClick }));
    }
    onOutsideClick = () => {
        if (this.enableHideOnBlur && !this.view.hasFocus()) {
            this.manualHidden = true;
            this.render();
        }
    };
    onViewFocus = () => {
        this.manualHidden = false;
        this.render();
    };
}
//# sourceMappingURL=index.js.map
