import { jsxs, Fragment, jsx } from "react/jsx-runtime";
import { useState } from "react";
import { Trash2 } from "lucide-react";
import { B as Button } from "./button-BXrfXN_b.js";
import { A as AlertDialog, e as AlertDialogContent, f as AlertDialogHeader, g as AlertDialogTitle, h as AlertDialogDescription, i as AlertDialogFooter, j as AlertDialogCancel, k as AlertDialogAction } from "./alert-dialog-Cbc2KPWf.js";
function DeleteButton({
  onDelete,
  title = "Delete this item?",
  description = "This action cannot be undone.",
  disabled,
  size = "sm"
}) {
  const [open, setOpen] = useState(false);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      Button,
      {
        variant: "ghost",
        size,
        disabled,
        onClick: () => setOpen(true),
        "aria-label": "Delete",
        children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
      }
    ),
    /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
      /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
        /* @__PURE__ */ jsx(AlertDialogTitle, { children: title }),
        /* @__PURE__ */ jsx(AlertDialogDescription, { children: description })
      ] }),
      /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
        /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Cancel" }),
        /* @__PURE__ */ jsx(
          AlertDialogAction,
          {
            className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
            onClick: () => {
              onDelete();
              setOpen(false);
            },
            children: "Delete"
          }
        )
      ] })
    ] }) })
  ] });
}
export {
  DeleteButton as D
};
