@bygghammar/cms-platform 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +56 -3
- package/src/admin/format-log.ts +217 -0
- package/src/backoffice/PreviewLightbox.tsx +66 -0
- package/src/backoffice/ProgressBar.tsx +36 -0
- package/src/backoffice/RichTextEditor.tsx +633 -0
- package/src/backoffice/forms/ActivityLog.tsx +153 -0
- package/src/backoffice/forms/ConditionBuilder.tsx +170 -0
- package/src/backoffice/forms/RuleSimulator.tsx +163 -0
- package/src/backoffice/forms/SmartTags.tsx +181 -0
- package/src/backoffice/media/ConfirmDialog.tsx +77 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Loader2 } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Small backoffice confirmation modal (English UI) used before destructive or
|
|
5
|
+
* bulk actions in the Media Library.
|
|
6
|
+
*/
|
|
7
|
+
export function ConfirmDialog({
|
|
8
|
+
title,
|
|
9
|
+
description,
|
|
10
|
+
details,
|
|
11
|
+
confirmLabel = "Confirm",
|
|
12
|
+
cancelLabel = "Cancel",
|
|
13
|
+
danger = false,
|
|
14
|
+
busy = false,
|
|
15
|
+
onConfirm,
|
|
16
|
+
onCancel,
|
|
17
|
+
}: {
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
details?: string[];
|
|
21
|
+
confirmLabel?: string;
|
|
22
|
+
cancelLabel?: string;
|
|
23
|
+
danger?: boolean;
|
|
24
|
+
busy?: boolean;
|
|
25
|
+
onConfirm: () => void;
|
|
26
|
+
onCancel: () => void;
|
|
27
|
+
}) {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className="fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4"
|
|
31
|
+
onClick={() => !busy && onCancel()}
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
className="w-full max-w-md border border-ink/15 bg-white"
|
|
35
|
+
onClick={(e) => e.stopPropagation()}
|
|
36
|
+
>
|
|
37
|
+
<div className="border-b border-ink/10 px-4 py-3">
|
|
38
|
+
<h2 className="text-sm font-medium text-ink">{title}</h2>
|
|
39
|
+
</div>
|
|
40
|
+
<div className="space-y-3 px-4 py-4">
|
|
41
|
+
{description ? <p className="text-sm text-ink/70">{description}</p> : null}
|
|
42
|
+
{details?.length ? (
|
|
43
|
+
<ul className="max-h-40 space-y-1 overflow-auto border border-ink/10 bg-ice/30 p-2 text-[0.72rem] text-ink/70">
|
|
44
|
+
{details.map((d) => (
|
|
45
|
+
<li key={d} className="truncate" title={d}>
|
|
46
|
+
{d}
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
</ul>
|
|
50
|
+
) : null}
|
|
51
|
+
</div>
|
|
52
|
+
<div className="flex justify-end gap-2 border-t border-ink/10 px-4 py-3">
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
disabled={busy}
|
|
56
|
+
onClick={onCancel}
|
|
57
|
+
className="border border-ink/20 px-3 py-1.5 text-xs uppercase tracking-[0.18em] text-ink hover:border-ink disabled:opacity-50"
|
|
58
|
+
>
|
|
59
|
+
{cancelLabel}
|
|
60
|
+
</button>
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
disabled={busy}
|
|
64
|
+
onClick={onConfirm}
|
|
65
|
+
className={[
|
|
66
|
+
"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs uppercase tracking-[0.18em] text-white disabled:opacity-50",
|
|
67
|
+
danger ? "bg-red-600 hover:bg-red-700" : "bg-ink hover:bg-sea",
|
|
68
|
+
].join(" ")}
|
|
69
|
+
>
|
|
70
|
+
{busy ? <Loader2 className="size-3.5 animate-spin" /> : null}
|
|
71
|
+
{confirmLabel}
|
|
72
|
+
</button>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|