admin-lib-cms 1.1.7 → 1.1.9
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/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +282 -5
- package/dist/index.mjs +283 -6
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -65,6 +65,13 @@ interface EditableImageProps extends BaseProps {
|
|
|
65
65
|
height?: number;
|
|
66
66
|
}
|
|
67
67
|
declare function EditableImage({ id, label, section, pageId, src, alt, className, width, height, }: EditableImageProps): react.JSX.Element;
|
|
68
|
+
interface EditableFileProps extends BaseProps {
|
|
69
|
+
src?: string;
|
|
70
|
+
defaultUrl?: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
children?: (url: string) => React.ReactNode;
|
|
73
|
+
}
|
|
74
|
+
declare function EditableFile({ id, label, section, pageId, src, defaultUrl, className, children, }: EditableFileProps): react.JSX.Element;
|
|
68
75
|
interface EditableLinkProps extends BaseProps {
|
|
69
76
|
href: string;
|
|
70
77
|
children?: React.ReactNode;
|
|
@@ -134,4 +141,4 @@ declare function SubscriptionProvider({ children, apiUrl, projectId, email, vali
|
|
|
134
141
|
|
|
135
142
|
declare function SubscriptionPage(): react.JSX.Element;
|
|
136
143
|
|
|
137
|
-
export { AdminApp, AdminLogin, type AdminLoginProps, CmsConfig, CmsProvider, EditableImage, EditableLink, EditableList, EditableMeta, EditableText, OverridesMap, StorageAdapter, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useCmsContext, useCmsOptional, useSubmit, useSubscription, useSubscriptionContext };
|
|
144
|
+
export { AdminApp, AdminLogin, type AdminLoginProps, CmsConfig, CmsProvider, EditableFile, EditableImage, EditableLink, EditableList, EditableMeta, EditableText, OverridesMap, StorageAdapter, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useCmsContext, useCmsOptional, useSubmit, useSubscription, useSubscriptionContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,13 @@ interface EditableImageProps extends BaseProps {
|
|
|
65
65
|
height?: number;
|
|
66
66
|
}
|
|
67
67
|
declare function EditableImage({ id, label, section, pageId, src, alt, className, width, height, }: EditableImageProps): react.JSX.Element;
|
|
68
|
+
interface EditableFileProps extends BaseProps {
|
|
69
|
+
src?: string;
|
|
70
|
+
defaultUrl?: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
children?: (url: string) => React.ReactNode;
|
|
73
|
+
}
|
|
74
|
+
declare function EditableFile({ id, label, section, pageId, src, defaultUrl, className, children, }: EditableFileProps): react.JSX.Element;
|
|
68
75
|
interface EditableLinkProps extends BaseProps {
|
|
69
76
|
href: string;
|
|
70
77
|
children?: React.ReactNode;
|
|
@@ -134,4 +141,4 @@ declare function SubscriptionProvider({ children, apiUrl, projectId, email, vali
|
|
|
134
141
|
|
|
135
142
|
declare function SubscriptionPage(): react.JSX.Element;
|
|
136
143
|
|
|
137
|
-
export { AdminApp, AdminLogin, type AdminLoginProps, CmsConfig, CmsProvider, EditableImage, EditableLink, EditableList, EditableMeta, EditableText, OverridesMap, StorageAdapter, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useCmsContext, useCmsOptional, useSubmit, useSubscription, useSubscriptionContext };
|
|
144
|
+
export { AdminApp, AdminLogin, type AdminLoginProps, CmsConfig, CmsProvider, EditableFile, EditableImage, EditableLink, EditableList, EditableMeta, EditableText, OverridesMap, StorageAdapter, type SubscriptionContextValue, type SubscriptionData, SubscriptionPage, SubscriptionProvider, useCmsContext, useCmsOptional, useSubmit, useSubscription, useSubscriptionContext };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
AdminApp: () => AdminApp,
|
|
25
25
|
AdminLogin: () => AdminLogin,
|
|
26
26
|
CmsProvider: () => CmsProvider,
|
|
27
|
+
EditableFile: () => EditableFile,
|
|
27
28
|
EditableImage: () => EditableImage,
|
|
28
29
|
EditableLink: () => EditableLink,
|
|
29
30
|
EditableList: () => EditableList,
|
|
@@ -529,6 +530,55 @@ function EditableImage({
|
|
|
529
530
|
}
|
|
530
531
|
);
|
|
531
532
|
}
|
|
533
|
+
function EditableFile({
|
|
534
|
+
id,
|
|
535
|
+
label,
|
|
536
|
+
section,
|
|
537
|
+
pageId,
|
|
538
|
+
src,
|
|
539
|
+
defaultUrl = "",
|
|
540
|
+
className,
|
|
541
|
+
children
|
|
542
|
+
}) {
|
|
543
|
+
const initialUrl = src || defaultUrl;
|
|
544
|
+
const ctx = useRegister(id, "file", label, section, pageId, initialUrl);
|
|
545
|
+
const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? initialUrl) : initialUrl;
|
|
546
|
+
const active = !!ctx?.editMode;
|
|
547
|
+
const selected = ctx?.selectedId === id;
|
|
548
|
+
const onClick = (e) => {
|
|
549
|
+
if (!active || !ctx) return;
|
|
550
|
+
e.preventDefault();
|
|
551
|
+
e.stopPropagation();
|
|
552
|
+
ctx.setSelectedId(id);
|
|
553
|
+
};
|
|
554
|
+
if (children) {
|
|
555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
556
|
+
"div",
|
|
557
|
+
{
|
|
558
|
+
"data-cms-id": id,
|
|
559
|
+
onClick: active ? onClick : void 0,
|
|
560
|
+
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
561
|
+
children: children(value)
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
566
|
+
"div",
|
|
567
|
+
{
|
|
568
|
+
"data-cms-id": id,
|
|
569
|
+
onClick: active ? onClick : void 0,
|
|
570
|
+
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
571
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
572
|
+
"iframe",
|
|
573
|
+
{
|
|
574
|
+
src: value,
|
|
575
|
+
className: "w-full h-[500px] rounded-xl border-0",
|
|
576
|
+
title: label || id
|
|
577
|
+
}
|
|
578
|
+
)
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
}
|
|
532
582
|
function EditableLink({
|
|
533
583
|
id,
|
|
534
584
|
label,
|
|
@@ -1139,6 +1189,41 @@ function FieldEditor({
|
|
|
1139
1189
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-white text-xs font-medium px-2 py-1 bg-black/50 rounded backdrop-blur", children: "Preview" }) })
|
|
1140
1190
|
] }) : null
|
|
1141
1191
|
] }),
|
|
1192
|
+
meta.type === "file" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3", children: [
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2", children: [
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1195
|
+
"input",
|
|
1196
|
+
{
|
|
1197
|
+
type: "url",
|
|
1198
|
+
value: String(value ?? ""),
|
|
1199
|
+
onChange: (e) => onChange(e.target.value),
|
|
1200
|
+
placeholder: "https://... or upload PDF/file",
|
|
1201
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1202
|
+
}
|
|
1203
|
+
),
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
|
|
1205
|
+
"Upload File",
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1207
|
+
"input",
|
|
1208
|
+
{
|
|
1209
|
+
type: "file",
|
|
1210
|
+
accept: "application/pdf,.pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/*",
|
|
1211
|
+
className: "hidden",
|
|
1212
|
+
onChange: (e) => {
|
|
1213
|
+
const file = e.target.files?.[0];
|
|
1214
|
+
if (file) {
|
|
1215
|
+
void handleImageFile(file, onChange, ctx.uploadImage);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] })
|
|
1221
|
+
] }),
|
|
1222
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u{1F4C4} File URL:" }),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
|
|
1225
|
+
] }) : null
|
|
1226
|
+
] }),
|
|
1142
1227
|
meta.type === "link" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
|
|
1143
1228
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "block", children: [
|
|
1144
1229
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
|
|
@@ -1659,7 +1744,149 @@ function CollectionEditor({ collection }) {
|
|
|
1659
1744
|
value: String(editing[f.id] ?? ""),
|
|
1660
1745
|
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1661
1746
|
}
|
|
1662
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime5.
|
|
1747
|
+
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1749
|
+
"input",
|
|
1750
|
+
{
|
|
1751
|
+
type: "color",
|
|
1752
|
+
value: String(editing[f.id] ?? "#000000").startsWith("#") && String(editing[f.id] ?? "").length === 7 ? String(editing[f.id]) : "#000000",
|
|
1753
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1754
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
1755
|
+
}
|
|
1756
|
+
),
|
|
1757
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1758
|
+
"input",
|
|
1759
|
+
{
|
|
1760
|
+
type: "text",
|
|
1761
|
+
value: String(editing[f.id] ?? ""),
|
|
1762
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1763
|
+
placeholder: "#000000",
|
|
1764
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1765
|
+
}
|
|
1766
|
+
),
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1768
|
+
"div",
|
|
1769
|
+
{
|
|
1770
|
+
className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
1771
|
+
style: { backgroundColor: String(editing[f.id] ?? "#000000") }
|
|
1772
|
+
}
|
|
1773
|
+
)
|
|
1774
|
+
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3", children: [
|
|
1775
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : []).map((item, idx) => {
|
|
1776
|
+
const colorVal = String(item ?? "").trim();
|
|
1777
|
+
const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
|
|
1778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1780
|
+
"input",
|
|
1781
|
+
{
|
|
1782
|
+
type: "color",
|
|
1783
|
+
value: validHex.length === 7 ? validHex : "#000000",
|
|
1784
|
+
onChange: (e) => {
|
|
1785
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1786
|
+
arr[idx] = e.target.value;
|
|
1787
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1788
|
+
},
|
|
1789
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
1790
|
+
}
|
|
1791
|
+
),
|
|
1792
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1793
|
+
"input",
|
|
1794
|
+
{
|
|
1795
|
+
type: "text",
|
|
1796
|
+
value: colorVal,
|
|
1797
|
+
onChange: (e) => {
|
|
1798
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1799
|
+
arr[idx] = e.target.value;
|
|
1800
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1801
|
+
},
|
|
1802
|
+
placeholder: "#1c2a44",
|
|
1803
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1804
|
+
}
|
|
1805
|
+
),
|
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1807
|
+
"div",
|
|
1808
|
+
{
|
|
1809
|
+
className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
1810
|
+
style: { backgroundColor: colorVal || "#000000" }
|
|
1811
|
+
}
|
|
1812
|
+
),
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1814
|
+
"button",
|
|
1815
|
+
{
|
|
1816
|
+
type: "button",
|
|
1817
|
+
onClick: () => {
|
|
1818
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1819
|
+
arr.splice(idx, 1);
|
|
1820
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1821
|
+
},
|
|
1822
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
|
|
1823
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Trash2, { className: "w-4 h-4" })
|
|
1824
|
+
}
|
|
1825
|
+
)
|
|
1826
|
+
] }, idx);
|
|
1827
|
+
}),
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1829
|
+
"button",
|
|
1830
|
+
{
|
|
1831
|
+
type: "button",
|
|
1832
|
+
onClick: () => {
|
|
1833
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1834
|
+
arr.push("#000000");
|
|
1835
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1836
|
+
},
|
|
1837
|
+
className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg border border-indigo-100 transition-colors",
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Plus, { className: "w-3.5 h-3.5" }),
|
|
1840
|
+
" Add Color"
|
|
1841
|
+
]
|
|
1842
|
+
}
|
|
1843
|
+
)
|
|
1844
|
+
] }) : f.type === "list" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3", children: [
|
|
1845
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1847
|
+
"input",
|
|
1848
|
+
{
|
|
1849
|
+
type: "text",
|
|
1850
|
+
value: String(item ?? ""),
|
|
1851
|
+
onChange: (e) => {
|
|
1852
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1853
|
+
arr[idx] = e.target.value;
|
|
1854
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1855
|
+
},
|
|
1856
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1857
|
+
}
|
|
1858
|
+
),
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1860
|
+
"button",
|
|
1861
|
+
{
|
|
1862
|
+
type: "button",
|
|
1863
|
+
onClick: () => {
|
|
1864
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1865
|
+
arr.splice(idx, 1);
|
|
1866
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1867
|
+
},
|
|
1868
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
|
|
1869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Trash2, { className: "w-4 h-4" })
|
|
1870
|
+
}
|
|
1871
|
+
)
|
|
1872
|
+
] }, idx)),
|
|
1873
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1874
|
+
"button",
|
|
1875
|
+
{
|
|
1876
|
+
type: "button",
|
|
1877
|
+
onClick: () => {
|
|
1878
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1879
|
+
arr.push("");
|
|
1880
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1881
|
+
},
|
|
1882
|
+
className: "inline-flex items-center gap-1.5 px-3 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-semibold rounded-xl transition-colors",
|
|
1883
|
+
children: [
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Plus, { className: "w-3.5 h-3.5" }),
|
|
1885
|
+
" Add Item"
|
|
1886
|
+
]
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1663
1890
|
"input",
|
|
1664
1891
|
{
|
|
1665
1892
|
value: String(editing[f.id] ?? ""),
|
|
@@ -1881,10 +2108,59 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
1881
2108
|
}
|
|
1882
2109
|
)
|
|
1883
2110
|
] }) }),
|
|
1884
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) =>
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
|
|
2112
|
+
const strVal = String(val ?? "\u2014");
|
|
2113
|
+
const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
|
|
2114
|
+
const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
|
|
2115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
|
|
2117
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-2", children: [
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2119
|
+
"a",
|
|
2120
|
+
{
|
|
2121
|
+
href: strVal,
|
|
2122
|
+
target: "_blank",
|
|
2123
|
+
rel: "noopener noreferrer",
|
|
2124
|
+
className: "inline-block max-w-sm rounded-lg overflow-hidden border border-slate-200 shadow-sm hover:shadow transition-shadow bg-slate-50 p-1",
|
|
2125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2126
|
+
"img",
|
|
2127
|
+
{
|
|
2128
|
+
src: strVal,
|
|
2129
|
+
alt: key,
|
|
2130
|
+
className: "max-h-64 w-auto object-contain rounded"
|
|
2131
|
+
}
|
|
2132
|
+
)
|
|
2133
|
+
}
|
|
2134
|
+
),
|
|
2135
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2136
|
+
"a",
|
|
2137
|
+
{
|
|
2138
|
+
href: strVal,
|
|
2139
|
+
target: "_blank",
|
|
2140
|
+
rel: "noopener noreferrer",
|
|
2141
|
+
className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
|
|
2142
|
+
children: [
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ExternalLink, { className: "w-3.5 h-3.5" }),
|
|
2144
|
+
" View / Download file"
|
|
2145
|
+
]
|
|
2146
|
+
}
|
|
2147
|
+
) })
|
|
2148
|
+
] }) : isUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2149
|
+
"a",
|
|
2150
|
+
{
|
|
2151
|
+
href: strVal,
|
|
2152
|
+
target: "_blank",
|
|
2153
|
+
rel: "noopener noreferrer",
|
|
2154
|
+
className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
|
|
2155
|
+
children: [
|
|
2156
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ExternalLink, { className: "w-3.5 h-3.5 flex-shrink-0" }),
|
|
2157
|
+
" ",
|
|
2158
|
+
strVal
|
|
2159
|
+
]
|
|
2160
|
+
}
|
|
2161
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "whitespace-pre-wrap", children: strVal }) })
|
|
2162
|
+
] }, key);
|
|
2163
|
+
}) })
|
|
1888
2164
|
] })
|
|
1889
2165
|
] });
|
|
1890
2166
|
}
|
|
@@ -2512,6 +2788,7 @@ async function sendEmailNotification(content, apiUrl) {
|
|
|
2512
2788
|
AdminApp,
|
|
2513
2789
|
AdminLogin,
|
|
2514
2790
|
CmsProvider,
|
|
2791
|
+
EditableFile,
|
|
2515
2792
|
EditableImage,
|
|
2516
2793
|
EditableLink,
|
|
2517
2794
|
EditableList,
|
package/dist/index.mjs
CHANGED
|
@@ -502,6 +502,55 @@ function EditableImage({
|
|
|
502
502
|
}
|
|
503
503
|
);
|
|
504
504
|
}
|
|
505
|
+
function EditableFile({
|
|
506
|
+
id,
|
|
507
|
+
label,
|
|
508
|
+
section,
|
|
509
|
+
pageId,
|
|
510
|
+
src,
|
|
511
|
+
defaultUrl = "",
|
|
512
|
+
className,
|
|
513
|
+
children
|
|
514
|
+
}) {
|
|
515
|
+
const initialUrl = src || defaultUrl;
|
|
516
|
+
const ctx = useRegister(id, "file", label, section, pageId, initialUrl);
|
|
517
|
+
const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? initialUrl) : initialUrl;
|
|
518
|
+
const active = !!ctx?.editMode;
|
|
519
|
+
const selected = ctx?.selectedId === id;
|
|
520
|
+
const onClick = (e) => {
|
|
521
|
+
if (!active || !ctx) return;
|
|
522
|
+
e.preventDefault();
|
|
523
|
+
e.stopPropagation();
|
|
524
|
+
ctx.setSelectedId(id);
|
|
525
|
+
};
|
|
526
|
+
if (children) {
|
|
527
|
+
return /* @__PURE__ */ jsx4(
|
|
528
|
+
"div",
|
|
529
|
+
{
|
|
530
|
+
"data-cms-id": id,
|
|
531
|
+
onClick: active ? onClick : void 0,
|
|
532
|
+
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
533
|
+
children: children(value)
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
return /* @__PURE__ */ jsx4(
|
|
538
|
+
"div",
|
|
539
|
+
{
|
|
540
|
+
"data-cms-id": id,
|
|
541
|
+
onClick: active ? onClick : void 0,
|
|
542
|
+
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
543
|
+
children: /* @__PURE__ */ jsx4(
|
|
544
|
+
"iframe",
|
|
545
|
+
{
|
|
546
|
+
src: value,
|
|
547
|
+
className: "w-full h-[500px] rounded-xl border-0",
|
|
548
|
+
title: label || id
|
|
549
|
+
}
|
|
550
|
+
)
|
|
551
|
+
}
|
|
552
|
+
);
|
|
553
|
+
}
|
|
505
554
|
function EditableLink({
|
|
506
555
|
id,
|
|
507
556
|
label,
|
|
@@ -604,7 +653,8 @@ import {
|
|
|
604
653
|
ChevronLeft,
|
|
605
654
|
ChevronRight,
|
|
606
655
|
SlidersHorizontal,
|
|
607
|
-
LogOut
|
|
656
|
+
LogOut,
|
|
657
|
+
ExternalLink as ExternalLink2
|
|
608
658
|
} from "lucide-react";
|
|
609
659
|
import { CreditCard as CreditCard2 } from "lucide-react";
|
|
610
660
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -1138,6 +1188,41 @@ function FieldEditor({
|
|
|
1138
1188
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsx5("span", { className: "text-white text-xs font-medium px-2 py-1 bg-black/50 rounded backdrop-blur", children: "Preview" }) })
|
|
1139
1189
|
] }) : null
|
|
1140
1190
|
] }),
|
|
1191
|
+
meta.type === "file" && /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
|
|
1192
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
|
|
1193
|
+
/* @__PURE__ */ jsx5(
|
|
1194
|
+
"input",
|
|
1195
|
+
{
|
|
1196
|
+
type: "url",
|
|
1197
|
+
value: String(value ?? ""),
|
|
1198
|
+
onChange: (e) => onChange(e.target.value),
|
|
1199
|
+
placeholder: "https://... or upload PDF/file",
|
|
1200
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-indigo-50 px-4 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-indigo-100 transition-colors border border-indigo-100 flex items-center justify-center", children: [
|
|
1204
|
+
"Upload File",
|
|
1205
|
+
/* @__PURE__ */ jsx5(
|
|
1206
|
+
"input",
|
|
1207
|
+
{
|
|
1208
|
+
type: "file",
|
|
1209
|
+
accept: "application/pdf,.pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/*",
|
|
1210
|
+
className: "hidden",
|
|
1211
|
+
onChange: (e) => {
|
|
1212
|
+
const file = e.target.files?.[0];
|
|
1213
|
+
if (file) {
|
|
1214
|
+
void handleImageFile(file, onChange, ctx.uploadImage);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
)
|
|
1219
|
+
] })
|
|
1220
|
+
] }),
|
|
1221
|
+
value ? /* @__PURE__ */ jsxs3("div", { className: "rounded-xl border border-slate-200 p-3 bg-slate-50 text-xs font-mono text-slate-600 truncate flex items-center gap-2", children: [
|
|
1222
|
+
/* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} File URL:" }),
|
|
1223
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
|
|
1224
|
+
] }) : null
|
|
1225
|
+
] }),
|
|
1141
1226
|
meta.type === "link" && /* @__PURE__ */ jsxs3("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
|
|
1142
1227
|
/* @__PURE__ */ jsxs3("label", { className: "block", children: [
|
|
1143
1228
|
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
|
|
@@ -1658,7 +1743,149 @@ function CollectionEditor({ collection }) {
|
|
|
1658
1743
|
value: String(editing[f.id] ?? ""),
|
|
1659
1744
|
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1660
1745
|
}
|
|
1661
|
-
) : /* @__PURE__ */
|
|
1746
|
+
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
1747
|
+
/* @__PURE__ */ jsx5(
|
|
1748
|
+
"input",
|
|
1749
|
+
{
|
|
1750
|
+
type: "color",
|
|
1751
|
+
value: String(editing[f.id] ?? "#000000").startsWith("#") && String(editing[f.id] ?? "").length === 7 ? String(editing[f.id]) : "#000000",
|
|
1752
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1753
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
1754
|
+
}
|
|
1755
|
+
),
|
|
1756
|
+
/* @__PURE__ */ jsx5(
|
|
1757
|
+
"input",
|
|
1758
|
+
{
|
|
1759
|
+
type: "text",
|
|
1760
|
+
value: String(editing[f.id] ?? ""),
|
|
1761
|
+
onChange: (e) => setEditing({ ...editing, [f.id]: e.target.value }),
|
|
1762
|
+
placeholder: "#000000",
|
|
1763
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2.5 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1764
|
+
}
|
|
1765
|
+
),
|
|
1766
|
+
/* @__PURE__ */ jsx5(
|
|
1767
|
+
"div",
|
|
1768
|
+
{
|
|
1769
|
+
className: "w-8 h-8 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
1770
|
+
style: { backgroundColor: String(editing[f.id] ?? "#000000") }
|
|
1771
|
+
}
|
|
1772
|
+
)
|
|
1773
|
+
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
|
|
1774
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : []).map((item, idx) => {
|
|
1775
|
+
const colorVal = String(item ?? "").trim();
|
|
1776
|
+
const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
|
|
1777
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
|
|
1778
|
+
/* @__PURE__ */ jsx5(
|
|
1779
|
+
"input",
|
|
1780
|
+
{
|
|
1781
|
+
type: "color",
|
|
1782
|
+
value: validHex.length === 7 ? validHex : "#000000",
|
|
1783
|
+
onChange: (e) => {
|
|
1784
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1785
|
+
arr[idx] = e.target.value;
|
|
1786
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1787
|
+
},
|
|
1788
|
+
className: "w-10 h-10 rounded-xl border border-slate-200 p-0.5 cursor-pointer shadow-sm flex-shrink-0"
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
/* @__PURE__ */ jsx5(
|
|
1792
|
+
"input",
|
|
1793
|
+
{
|
|
1794
|
+
type: "text",
|
|
1795
|
+
value: colorVal,
|
|
1796
|
+
onChange: (e) => {
|
|
1797
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1798
|
+
arr[idx] = e.target.value;
|
|
1799
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1800
|
+
},
|
|
1801
|
+
placeholder: "#1c2a44",
|
|
1802
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 font-mono shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1803
|
+
}
|
|
1804
|
+
),
|
|
1805
|
+
/* @__PURE__ */ jsx5(
|
|
1806
|
+
"div",
|
|
1807
|
+
{
|
|
1808
|
+
className: "w-7 h-7 rounded-full border border-slate-300 shadow-inner flex-shrink-0",
|
|
1809
|
+
style: { backgroundColor: colorVal || "#000000" }
|
|
1810
|
+
}
|
|
1811
|
+
),
|
|
1812
|
+
/* @__PURE__ */ jsx5(
|
|
1813
|
+
"button",
|
|
1814
|
+
{
|
|
1815
|
+
type: "button",
|
|
1816
|
+
onClick: () => {
|
|
1817
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1818
|
+
arr.splice(idx, 1);
|
|
1819
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1820
|
+
},
|
|
1821
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
|
|
1822
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1823
|
+
}
|
|
1824
|
+
)
|
|
1825
|
+
] }, idx);
|
|
1826
|
+
}),
|
|
1827
|
+
/* @__PURE__ */ jsxs3(
|
|
1828
|
+
"button",
|
|
1829
|
+
{
|
|
1830
|
+
type: "button",
|
|
1831
|
+
onClick: () => {
|
|
1832
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
1833
|
+
arr.push("#000000");
|
|
1834
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1835
|
+
},
|
|
1836
|
+
className: "inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-lg border border-indigo-100 transition-colors",
|
|
1837
|
+
children: [
|
|
1838
|
+
/* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
|
|
1839
|
+
" Add Color"
|
|
1840
|
+
]
|
|
1841
|
+
}
|
|
1842
|
+
)
|
|
1843
|
+
] }) : f.type === "list" ? /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
|
|
1844
|
+
(Array.isArray(editing[f.id]) ? editing[f.id] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : []).map((item, idx) => /* @__PURE__ */ jsxs3("div", { className: "flex gap-2 items-center", children: [
|
|
1845
|
+
/* @__PURE__ */ jsx5(
|
|
1846
|
+
"input",
|
|
1847
|
+
{
|
|
1848
|
+
type: "text",
|
|
1849
|
+
value: String(item ?? ""),
|
|
1850
|
+
onChange: (e) => {
|
|
1851
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1852
|
+
arr[idx] = e.target.value;
|
|
1853
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1854
|
+
},
|
|
1855
|
+
className: "flex-1 rounded-xl border border-slate-200 px-4 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all"
|
|
1856
|
+
}
|
|
1857
|
+
),
|
|
1858
|
+
/* @__PURE__ */ jsx5(
|
|
1859
|
+
"button",
|
|
1860
|
+
{
|
|
1861
|
+
type: "button",
|
|
1862
|
+
onClick: () => {
|
|
1863
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1864
|
+
arr.splice(idx, 1);
|
|
1865
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1866
|
+
},
|
|
1867
|
+
className: "p-2 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-xl transition-colors",
|
|
1868
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1869
|
+
}
|
|
1870
|
+
)
|
|
1871
|
+
] }, idx)),
|
|
1872
|
+
/* @__PURE__ */ jsxs3(
|
|
1873
|
+
"button",
|
|
1874
|
+
{
|
|
1875
|
+
type: "button",
|
|
1876
|
+
onClick: () => {
|
|
1877
|
+
let arr = Array.isArray(editing[f.id]) ? [...editing[f.id]] : typeof editing[f.id] === "string" ? String(editing[f.id]).split("\n").filter(Boolean) : [];
|
|
1878
|
+
arr.push("");
|
|
1879
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
1880
|
+
},
|
|
1881
|
+
className: "inline-flex items-center gap-1.5 px-3 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-semibold rounded-xl transition-colors",
|
|
1882
|
+
children: [
|
|
1883
|
+
/* @__PURE__ */ jsx5(Plus, { className: "w-3.5 h-3.5" }),
|
|
1884
|
+
" Add Item"
|
|
1885
|
+
]
|
|
1886
|
+
}
|
|
1887
|
+
)
|
|
1888
|
+
] }) : /* @__PURE__ */ jsx5(
|
|
1662
1889
|
"input",
|
|
1663
1890
|
{
|
|
1664
1891
|
value: String(editing[f.id] ?? ""),
|
|
@@ -1880,10 +2107,59 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
1880
2107
|
}
|
|
1881
2108
|
)
|
|
1882
2109
|
] }) }),
|
|
1883
|
-
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) =>
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
2110
|
+
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
|
|
2111
|
+
const strVal = String(val ?? "\u2014");
|
|
2112
|
+
const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
|
|
2113
|
+
const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
|
|
2114
|
+
return /* @__PURE__ */ jsxs3("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
|
|
2115
|
+
/* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
|
|
2116
|
+
/* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
2117
|
+
/* @__PURE__ */ jsx5(
|
|
2118
|
+
"a",
|
|
2119
|
+
{
|
|
2120
|
+
href: strVal,
|
|
2121
|
+
target: "_blank",
|
|
2122
|
+
rel: "noopener noreferrer",
|
|
2123
|
+
className: "inline-block max-w-sm rounded-lg overflow-hidden border border-slate-200 shadow-sm hover:shadow transition-shadow bg-slate-50 p-1",
|
|
2124
|
+
children: /* @__PURE__ */ jsx5(
|
|
2125
|
+
"img",
|
|
2126
|
+
{
|
|
2127
|
+
src: strVal,
|
|
2128
|
+
alt: key,
|
|
2129
|
+
className: "max-h-64 w-auto object-contain rounded"
|
|
2130
|
+
}
|
|
2131
|
+
)
|
|
2132
|
+
}
|
|
2133
|
+
),
|
|
2134
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs3(
|
|
2135
|
+
"a",
|
|
2136
|
+
{
|
|
2137
|
+
href: strVal,
|
|
2138
|
+
target: "_blank",
|
|
2139
|
+
rel: "noopener noreferrer",
|
|
2140
|
+
className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
|
|
2141
|
+
children: [
|
|
2142
|
+
/* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5" }),
|
|
2143
|
+
" View / Download file"
|
|
2144
|
+
]
|
|
2145
|
+
}
|
|
2146
|
+
) })
|
|
2147
|
+
] }) : isUrl ? /* @__PURE__ */ jsxs3(
|
|
2148
|
+
"a",
|
|
2149
|
+
{
|
|
2150
|
+
href: strVal,
|
|
2151
|
+
target: "_blank",
|
|
2152
|
+
rel: "noopener noreferrer",
|
|
2153
|
+
className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
|
|
2154
|
+
children: [
|
|
2155
|
+
/* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5 flex-shrink-0" }),
|
|
2156
|
+
" ",
|
|
2157
|
+
strVal
|
|
2158
|
+
]
|
|
2159
|
+
}
|
|
2160
|
+
) : /* @__PURE__ */ jsx5("p", { className: "whitespace-pre-wrap", children: strVal }) })
|
|
2161
|
+
] }, key);
|
|
2162
|
+
}) })
|
|
1887
2163
|
] })
|
|
1888
2164
|
] });
|
|
1889
2165
|
}
|
|
@@ -2362,6 +2638,7 @@ export {
|
|
|
2362
2638
|
AdminApp,
|
|
2363
2639
|
AdminLogin,
|
|
2364
2640
|
CmsProvider,
|
|
2641
|
+
EditableFile,
|
|
2365
2642
|
EditableImage,
|
|
2366
2643
|
EditableLink,
|
|
2367
2644
|
EditableList,
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type FieldType = "text" | "textarea" | "richtext" | "image" | "link" | "color" | "list" | "password";
|
|
1
|
+
type FieldType = "text" | "textarea" | "richtext" | "image" | "file" | "link" | "color" | "list" | "password";
|
|
2
2
|
interface EditableMeta {
|
|
3
3
|
id: string;
|
|
4
4
|
label?: string;
|
|
@@ -8,7 +8,7 @@ interface EditableMeta {
|
|
|
8
8
|
defaultValue?: unknown;
|
|
9
9
|
itemSchema?: {
|
|
10
10
|
key: string;
|
|
11
|
-
type: "text" | "textarea" | "boolean" | "icon" | "image" | "number";
|
|
11
|
+
type: "text" | "textarea" | "boolean" | "icon" | "image" | "file" | "number";
|
|
12
12
|
label?: string;
|
|
13
13
|
options?: string[];
|
|
14
14
|
}[];
|
|
@@ -29,6 +29,7 @@ interface CollectionField {
|
|
|
29
29
|
value: string;
|
|
30
30
|
}[];
|
|
31
31
|
source?: string;
|
|
32
|
+
multiple?: boolean;
|
|
32
33
|
defaultValue?: unknown;
|
|
33
34
|
}
|
|
34
35
|
interface CollectionDef {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type FieldType = "text" | "textarea" | "richtext" | "image" | "link" | "color" | "list" | "password";
|
|
1
|
+
type FieldType = "text" | "textarea" | "richtext" | "image" | "file" | "link" | "color" | "list" | "password";
|
|
2
2
|
interface EditableMeta {
|
|
3
3
|
id: string;
|
|
4
4
|
label?: string;
|
|
@@ -8,7 +8,7 @@ interface EditableMeta {
|
|
|
8
8
|
defaultValue?: unknown;
|
|
9
9
|
itemSchema?: {
|
|
10
10
|
key: string;
|
|
11
|
-
type: "text" | "textarea" | "boolean" | "icon" | "image" | "number";
|
|
11
|
+
type: "text" | "textarea" | "boolean" | "icon" | "image" | "file" | "number";
|
|
12
12
|
label?: string;
|
|
13
13
|
options?: string[];
|
|
14
14
|
}[];
|
|
@@ -29,6 +29,7 @@ interface CollectionField {
|
|
|
29
29
|
value: string;
|
|
30
30
|
}[];
|
|
31
31
|
source?: string;
|
|
32
|
+
multiple?: boolean;
|
|
32
33
|
defaultValue?: unknown;
|
|
33
34
|
}
|
|
34
35
|
interface CollectionDef {
|