laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
35 lines (34 loc) • 1.23 kB
JavaScript
"use client";
import { jsx as o, jsxs as t } from "react/jsx-runtime";
import { createAsk as p } from "../../node_modules/use-ask/dist/index.js";
import { AlertDialog as d, AlertDialogContent as m, AlertDialogHeader as A, AlertDialogTitle as f, AlertDialogDescription as g, AlertDialogFooter as h, AlertDialogCancel as u } from "./alert-dialog.js";
import { Button as C } from "./button.js";
const [n, D] = p({}), O = n.ask;
n.safeAsk;
const k = {
title: "Are you sure?",
cancelText: "Cancel",
actionText: "Continue"
}, P = () => {
const [{ key: r, payload: i }, { asking: l, cancel: c, ok: a }] = D(), e = { ...k, ...i };
return /* @__PURE__ */ o(
d,
{
open: l,
onOpenChange: (s) => !s && c(),
children: /* @__PURE__ */ t(m, { children: [
/* @__PURE__ */ o(A, { children: /* @__PURE__ */ o(f, { children: e.title }) }),
/* @__PURE__ */ o(g, { children: e.description }),
/* @__PURE__ */ t(h, { children: [
/* @__PURE__ */ o(u, { ...e.CancelProps, children: e.cancelText }),
/* @__PURE__ */ o(C, { ...e.ActionProps, onClick: () => a(!0), children: e.actionText })
] })
] })
},
r
);
};
export {
P as Confirmer,
O as confirm
};