UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

59 lines (58 loc) 2.04 kB
import { jsxs as t, jsx as e } from "react/jsx-runtime"; import { R as C, A as b, P as y, O as N, C as O, T as A, D, a as T, b as v } from "../../index-DUA6Y_AE.js"; import { cn as l } from "../../utils/index.js"; import { Button as r } from "../Button/Button.js"; import { useAlertDialog as j } from "./hooks/useAlertDialog.js"; import { useTheme as k } from "../../contexts/theme.hook.js"; const z = ({ buttonCancelClassName: o, buttonCancelText: i = "Cancel", buttonConfirmClassName: s, buttonConfirmText: c = "OK", buttonText: d, description: m, theme: a, title: h, onConfirm: p }) => { const { theme: n } = k(), { isOpen: f, handleCancel: x, handleConfirm: g, handleOpen: u } = j({ onConfirm: p }); return /* @__PURE__ */ t(C, { open: f, children: [ /* @__PURE__ */ e(b, { text: d, theme: a, onOpen: u }), /* @__PURE__ */ t(y, { children: [ /* @__PURE__ */ e(N, { className: "bg-black opacity-75 inset-0 fixed" }), /* @__PURE__ */ t(O, { className: "bg-white rounded-md fixed top-1/2 left-1/2 -translate-y-2/4 -translate-x-2/4 flex flex-col gap-8 p-6", children: [ /* @__PURE__ */ e(A, { className: "font-bold text-center text-2xl", children: h }), /* @__PURE__ */ e(D, { children: m }), /* @__PURE__ */ t("div", { className: "flex flex-row gap-5 justify-end", children: [ /* @__PURE__ */ e(T, { asChild: !0, children: /* @__PURE__ */ e( r, { type: "button", theme: a ?? n, variant: "secondary", className: l(o), onClick: x, children: i } ) }), /* @__PURE__ */ e(v, { asChild: !0, children: /* @__PURE__ */ e( r, { type: "button", theme: a ?? n, variant: "danger", className: l(s), onClick: g, children: c } ) }) ] }) ] }) ] }) ] }); }; export { z as AlertDialog };