"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolbarButtonPopup = ToolbarButtonPopup;
const jsx_runtime_1 = require("react/jsx-runtime");
const hooks_1 = require("../react-utils/hooks.js");
const ToolbarButton_1 = require("./ToolbarButton.js");
function ToolbarButtonPopup(props) {
    const { className, editor, isActive, isEnable, renderPopup, ...buttonProps } = props;
    const [anchorElement, setAnchorElement] = (0, hooks_1.useElementState)();
    const [isOpen, , close, toggle] = (0, hooks_1.useBooleanState)(false);
    const active = isActive(editor);
    const enabled = isEnable(editor);
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ToolbarButton_1.ToolbarButtonView, { ...buttonProps, ref: setAnchorElement, active: active, enabled: enabled, className: className, onClick: toggle }), isOpen &&
                renderPopup({
                    ...props,
                    anchorElement,
                    hide: close,
                })] }));
}
//# sourceMappingURL=ToolbarButtonPopup.js.map
