@kopexa/alert-dialog
Version: 
A modal dialog that interrupts the user with important content and expects a response.
40 lines (37 loc) • 1.26 kB
JavaScript
"use client";
import {
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogRoot,
  AlertDialogTitle
} from "./chunk-UYXIWF7G.mjs";
// src/confirm.dialog.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var ConfirmDialog = (props) => {
  const { isOpen, onOpenChange, config, onCancel, onConfirm } = props;
  return /* @__PURE__ */ jsx(AlertDialogRoot, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
    /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
      /* @__PURE__ */ jsx(AlertDialogTitle, { children: config.title }),
      /* @__PURE__ */ jsx(AlertDialogDescription, { children: config.children })
    ] }),
    /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
      /* @__PURE__ */ jsx(AlertDialogCancel, { onClick: onCancel, children: config.cancelButtonContent }),
      !config.hideConfirmButton && /* @__PURE__ */ jsx(
        AlertDialogAction,
        {
          onClick: onConfirm,
          color: config.confirmButtonType,
          variant: config.confirmButtonVariant,
          children: config.confirmButtonContent
        }
      )
    ] })
  ] }) });
};
export {
  ConfirmDialog
};