import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useBooleanState, useElementState } from "../react-utils/hooks.js";
import { ToolbarButtonView } from "./ToolbarButton.js";
export function ToolbarButtonPopup(props) {
    const { className, editor, isActive, isEnable, renderPopup, ...buttonProps } = props;
    const [anchorElement, setAnchorElement] = useElementState();
    const [isOpen, , close, toggle] = useBooleanState(false);
    const active = isActive(editor);
    const enabled = isEnable(editor);
    return (_jsxs(_Fragment, { children: [_jsx(ToolbarButtonView, { ...buttonProps, ref: setAnchorElement, active: active, enabled: enabled, className: className, onClick: toggle }), isOpen &&
                renderPopup({
                    ...props,
                    anchorElement,
                    hide: close,
                })] }));
}
//# sourceMappingURL=ToolbarButtonPopup.js.map
