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