import { jsxs as o, jsx as e } from "react/jsx-runtime";
import { useState as f } from "react";
import { Button as i } from "../atoms/button.js";
import { Popover as v, PopoverTrigger as h, PopoverContent as u, PopoverHeader as C, PopoverTitle as P, PopoverDescription as g } from "../atoms/popover.js";
function z({
  title: t,
  description: n,
  confirmLabel: a = "Confirm",
  cancelLabel: p = "Cancel",
  confirmVariant: c = "destructive",
  onConfirm: s,
  children: l,
  side: m = "bottom"
}) {
  const [d, r] = f(!1);
  return /* @__PURE__ */ o(v, { onOpenChange: r, open: d, children: [
    /* @__PURE__ */ e(h, { render: l }),
    /* @__PURE__ */ o(u, { className: "w-auto max-w-64 gap-3 p-4", side: m, children: [
      /* @__PURE__ */ o(C, { children: [
        /* @__PURE__ */ e(P, { children: t }),
        n && /* @__PURE__ */ e(g, { children: n })
      ] }),
      /* @__PURE__ */ o("div", { className: "flex justify-end gap-2", children: [
        /* @__PURE__ */ e(
          i,
          {
            "data-testid": "confirm-popover-cancel",
            onClick: () => r(!1),
            size: "sm",
            variant: "outline",
            children: p
          }
        ),
        /* @__PURE__ */ e(
          i,
          {
            "data-testid": "confirm-popover-confirm",
            onClick: () => {
              s(), r(!1);
            },
            size: "sm",
            variant: c,
            children: a
          }
        )
      ] })
    ] })
  ] });
}
export {
  z as ConfirmPopover
};
