@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
43 lines (42 loc) • 1.41 kB
JavaScript
import { jsx as r, jsxs as n, Fragment as a } from "react/jsx-runtime";
import { B as c } from "./Button-nH76KtOO.mjs";
import "react";
import { D as d, c as g, g as h, j as u, e as D, f as m } from "./Dialog-Df-tvqUy.mjs";
const f = 4, p = ({ itemNames: e }) => {
const o = e.length > f, t = o ? e.slice(0, 2) : e, i = e.length - t.length;
return /* @__PURE__ */ n(a, { children: [
/* @__PURE__ */ r("br", {}),
t.map((l, s) => /* @__PURE__ */ n("span", { children: [
s > 0 && ", ",
/* @__PURE__ */ r("b", { className: "text-foreground font-medium", children: l })
] }, s)),
o && ` and ${i} more`,
" will be deleted forever."
] });
}, j = ({
entityName: e,
itemName: o,
onDelete: t,
...i
}) => {
const l = o ? Array.isArray(o) ? o : [o] : null;
return /* @__PURE__ */ r(d, { ...i, children: /* @__PURE__ */ n(g, { "data-slot": "confirm-delete-dialog", children: [
/* @__PURE__ */ n(h, { children: [
/* @__PURE__ */ n(u, { children: [
"Deleting ",
e
] }),
/* @__PURE__ */ n(D, { children: [
"Are you sure you want to proceed? This action cannot be undone.",
l && /* @__PURE__ */ r(p, { itemNames: l })
] })
] }),
/* @__PURE__ */ r(m, { children: /* @__PURE__ */ n(c, { onClick: t, variant: "destructive", children: [
"Delete ",
e
] }) })
] }) });
};
export {
j as C
};