UNPKG

@hitachivantara/uikit-react-core

Version:

Core React components for the NEXT Design System.

54 lines (53 loc) 1.64 kB
import { jsxs, jsx } from "react/jsx-runtime"; import { useClasses } from "./ConfirmationDialog.styles.js"; import { HvDialog } from "../../Dialog/Dialog.js"; import { HvDialogTitle } from "../../Dialog/Title/Title.js"; import { HvDialogContent } from "../../Dialog/Content/Content.js"; import { HvDialogActions } from "../../Dialog/Actions/Actions.js"; import { HvButton } from "../../Button/Button.js"; const ConfirmationDialog = ({ title, message, isOpen, onConfirm, onCancel, confirmButtonLabel, cancelButtonLabel, closeButtonTooltip }) => { const { classes } = useClasses(); const handleClose = (_, reason) => { if (reason !== "backdropClick") { onCancel?.(); } }; return /* @__PURE__ */ jsxs( HvDialog, { classes: { paper: classes.paper }, open: isOpen, onClose: handleClose, firstFocusable: "confirmation-dialog-cancel", buttonTitle: closeButtonTooltip, children: [ /* @__PURE__ */ jsx(HvDialogTitle, { variant: "warning", children: title }), /* @__PURE__ */ jsx(HvDialogContent, { indentContent: true, children: message }), /* @__PURE__ */ jsxs(HvDialogActions, { children: [ /* @__PURE__ */ jsx(HvButton, { variant: "primaryGhost", onClick: onConfirm, children: confirmButtonLabel }), /* @__PURE__ */ jsx( HvButton, { id: "confirmation-dialog-cancel", variant: "primaryGhost", onClick: () => onCancel?.(), children: cancelButtonLabel } ) ] }) ] } ); }; export { ConfirmationDialog };