import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "@stigmer/theme";
import { Popover } from "@base-ui/react/popover";
import { useStigmerPortalContainer } from "../portal-container.js";
export function ContextPopover({ icon, label, count, children, disabled, open, onOpenChange, }) {
    const portalContainer = useStigmerPortalContainer();
    return (_jsxs(Popover.Root, { open: open, onOpenChange: onOpenChange, children: [_jsx(Popover.Trigger, { disabled: disabled, title: label, "aria-label": label, className: cn("inline-flex h-8 w-8 items-center justify-center rounded-md text-xs transition-colors", "text-muted-foreground hover:text-foreground hover:bg-accent-hover", "disabled:pointer-events-none disabled:opacity-50"), children: _jsxs("span", { className: "relative", children: [icon, count > 0 && (_jsx("span", { className: "absolute -right-1.5 -top-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-0.5 text-[0.5rem] font-medium leading-none text-primary-foreground", children: count }))] }) }), _jsx(Popover.Portal, { container: portalContainer, children: _jsx(Popover.Positioner, { sideOffset: 8, align: "start", children: _jsx(Popover.Popup, { className: [
                            "z-popover overflow-x-hidden overflow-y-auto rounded-lg border border-border",
                            "bg-popover p-3 shadow-md text-popover-foreground",
                            "max-h-[80vh]",
                        ].join(" "), children: children }) }) })] }));
}
//# sourceMappingURL=ContextPopover.js.map