"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@open-mercato/ui/primitives/dialog";
import { Button } from "@open-mercato/ui/primitives/button";
import { useT } from "@open-mercato/shared/lib/i18n/context";
function AttachmentDeleteDialog({ open, onOpenChange, fileName, onConfirm, isDeleting }) {
  const t = useT();
  const description = t(
    "attachments.library.confirm.delete",
    'Delete attachment "{{name}}"? This action cannot be undone.'
  ).replace("{{name}}", fileName || t("attachments.library.metadata.title", "attachment"));
  const handleKeyDown = React.useCallback(
    (event) => {
      if (event.key === "Escape") {
        event.preventDefault();
        onOpenChange(false);
        return;
      }
      if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
        event.preventDefault();
        if (!isDeleting) onConfirm();
      }
    },
    [isDeleting, onConfirm, onOpenChange]
  );
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { onKeyDown: handleKeyDown, children: [
    /* @__PURE__ */ jsxs(DialogHeader, { children: [
      /* @__PURE__ */ jsx(DialogTitle, { children: t("attachments.library.actions.delete", "Delete") }),
      /* @__PURE__ */ jsx(DialogDescription, { children: description })
    ] }),
    /* @__PURE__ */ jsxs(DialogFooter, { children: [
      /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isDeleting, children: t("attachments.library.metadata.cancel", "Cancel") }),
      /* @__PURE__ */ jsx(Button, { type: "button", variant: "destructive", onClick: onConfirm, disabled: isDeleting, children: t("attachments.library.actions.delete", "Delete") })
    ] })
  ] }) });
}
export {
  AttachmentDeleteDialog
};
//# sourceMappingURL=AttachmentDeleteDialog.js.map
