UNPKG

@konstructio/ui

Version:

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

86 lines (85 loc) 2.49 kB
import { jsxs as a, jsx as e } from "react/jsx-runtime"; import { R as A, A as D, P as v, O as j, C as k, T, D as w, a as P, b as R } from "../../index-C65LtGuU.js"; import { Button as l } from "../Button/Button.js"; import { cn as t } from "../../utils/index.js"; import { useAlertDialog as z } from "./hooks/useAlertDialog.js"; const G = ({ buttonCancel: { className: s, text: i = "Cancel", ...r } = {}, buttonConfirm: { className: o, text: c = "OK", ...m } = {}, buttonTriggerClassName: d, buttonTriggerText: p, description: f, showCancelButton: h = !0, theme: n, title: x, wrapperClassName: u, onConfirm: C, ...b }) => { const { isOpen: N, handleCancel: g, handleConfirm: y, handleOpen: O } = z({ onConfirm: C }); return /* @__PURE__ */ a(A, { open: N, ...b, children: [ /* @__PURE__ */ e( D, { className: d, text: p, "data-theme": n, onOpen: O } ), /* @__PURE__ */ a(v, { children: [ /* @__PURE__ */ e(j, { className: "bg-black opacity-70 inset-0 fixed animate-in fade-in-0" }), /* @__PURE__ */ a( k, { "data-theme": n, className: t( "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-8 animate-in fade-in-0 zoom-in-85", u ), children: [ /* @__PURE__ */ e(T, { className: "text-base text-slate-700 font-semibold", children: x }), /* @__PURE__ */ e(w, { className: "text-sm text-slate-800", children: f }), /* @__PURE__ */ a("div", { className: "flex flex-row gap-5 justify-end", children: [ h && /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e( l, { type: "button", variant: "secondary", className: t(s), onClick: g, ...r, children: i } ) }), /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ e( l, { type: "button", variant: "primary", className: t(o), onClick: y, ...m, children: c } ) }) ] }) ] } ) ] }) ] }); }; export { G as AlertDialog };