admin-lib-cms 1.2.0 → 1.2.2
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/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +724 -189
- package/dist/index.mjs +923 -388
- package/dist/types.d.mts +16 -3
- package/dist/types.d.ts +16 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -421,15 +421,15 @@ function useSubmit(formId) {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
// src/editable.tsx
|
|
424
|
-
import { createElement, useEffect as useEffect3 } from "react";
|
|
425
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
426
|
-
function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength) {
|
|
424
|
+
import { createElement, useEffect as useEffect3, useState as useState4, Fragment as Fragment2 } from "react";
|
|
425
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
426
|
+
function useRegister(id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField) {
|
|
427
427
|
const ctx = useCmsOptional();
|
|
428
428
|
useEffect3(() => {
|
|
429
429
|
if (!ctx) return;
|
|
430
|
-
ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength });
|
|
430
|
+
ctx.registerEditable({ id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField });
|
|
431
431
|
return () => ctx.unregisterEditable(id);
|
|
432
|
-
}, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength]);
|
|
432
|
+
}, [ctx?.registerEditable, ctx?.unregisterEditable, id, type, label, section, pageId, defaultValue, itemSchema, fixedLength, search, collection, max, displayField]);
|
|
433
433
|
return ctx;
|
|
434
434
|
}
|
|
435
435
|
function editableClasses(active, selected) {
|
|
@@ -446,26 +446,40 @@ function EditableText({
|
|
|
446
446
|
pageId,
|
|
447
447
|
children,
|
|
448
448
|
as = "span",
|
|
449
|
-
className
|
|
449
|
+
className,
|
|
450
|
+
type = "text"
|
|
450
451
|
}) {
|
|
451
|
-
const ctx = useRegister(id,
|
|
452
|
+
const ctx = useRegister(id, type, label, section, pageId, children);
|
|
452
453
|
const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? String(ctx.overrides[id] ?? "") : children;
|
|
453
454
|
const active = !!ctx?.editMode;
|
|
454
455
|
const selected = ctx?.selectedId === id;
|
|
456
|
+
const isEmpty = !value || String(value).trim() === "";
|
|
457
|
+
const renderValue = active && isEmpty ? `[Empty: ${label || id}]` : value;
|
|
455
458
|
const onClick = (e) => {
|
|
456
459
|
if (!active || !ctx) return;
|
|
457
460
|
e.preventDefault();
|
|
458
461
|
e.stopPropagation();
|
|
459
462
|
ctx.setSelectedId(id);
|
|
460
463
|
};
|
|
464
|
+
let finalChildren = renderValue;
|
|
465
|
+
if (typeof renderValue === "string" && renderValue.includes("\n")) {
|
|
466
|
+
finalChildren = renderValue.split("\n").map((line, i, arr) => /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
467
|
+
line,
|
|
468
|
+
i < arr.length - 1 && /* @__PURE__ */ jsx4("br", {})
|
|
469
|
+
] }, i));
|
|
470
|
+
}
|
|
461
471
|
return createElement(
|
|
462
472
|
as,
|
|
463
473
|
{
|
|
464
|
-
className: [
|
|
474
|
+
className: [
|
|
475
|
+
className,
|
|
476
|
+
editableClasses(active, selected),
|
|
477
|
+
active && isEmpty ? "opacity-50" : ""
|
|
478
|
+
].filter(Boolean).join(" "),
|
|
465
479
|
"data-cms-id": id,
|
|
466
480
|
onClick: active ? onClick : void 0
|
|
467
481
|
},
|
|
468
|
-
|
|
482
|
+
finalChildren
|
|
469
483
|
);
|
|
470
484
|
}
|
|
471
485
|
function EditableImage({
|
|
@@ -492,7 +506,7 @@ function EditableImage({
|
|
|
492
506
|
return /* @__PURE__ */ jsx4(
|
|
493
507
|
"img",
|
|
494
508
|
{
|
|
495
|
-
src: value,
|
|
509
|
+
src: value || void 0,
|
|
496
510
|
alt,
|
|
497
511
|
width,
|
|
498
512
|
height,
|
|
@@ -578,6 +592,9 @@ function EditableLink({
|
|
|
578
592
|
const isExternal = hrefValue.startsWith("http");
|
|
579
593
|
const computedTarget = target || (isExternal ? "_blank" : void 0);
|
|
580
594
|
const computedRel = computedTarget === "_blank" ? "noopener noreferrer" : void 0;
|
|
595
|
+
const content = typeof children !== "undefined" ? children : textValue;
|
|
596
|
+
const isEmpty = !content || String(content).trim() === "";
|
|
597
|
+
const renderContent = active && isEmpty ? `[Empty Link: ${label || id}]` : content;
|
|
581
598
|
return /* @__PURE__ */ jsx4(
|
|
582
599
|
"a",
|
|
583
600
|
{
|
|
@@ -586,8 +603,12 @@ function EditableLink({
|
|
|
586
603
|
rel: computedRel,
|
|
587
604
|
"data-cms-id": id,
|
|
588
605
|
onClick: active ? onClick : void 0,
|
|
589
|
-
className: [
|
|
590
|
-
|
|
606
|
+
className: [
|
|
607
|
+
className,
|
|
608
|
+
editableClasses(active, selected),
|
|
609
|
+
active && isEmpty ? "opacity-50" : ""
|
|
610
|
+
].filter(Boolean).join(" "),
|
|
611
|
+
children: renderContent
|
|
591
612
|
}
|
|
592
613
|
);
|
|
593
614
|
}
|
|
@@ -602,9 +623,10 @@ function EditableList({
|
|
|
602
623
|
itemSchema,
|
|
603
624
|
fixedLength,
|
|
604
625
|
className,
|
|
605
|
-
listClassName
|
|
626
|
+
listClassName,
|
|
627
|
+
search
|
|
606
628
|
}) {
|
|
607
|
-
const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength);
|
|
629
|
+
const ctx = useRegister(id, "list", label, section, pageId, initialItems, itemSchema, fixedLength, search);
|
|
608
630
|
const rawValue = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : initialItems;
|
|
609
631
|
const value = Array.isArray(rawValue) ? rawValue : initialItems;
|
|
610
632
|
const active = !!ctx?.editMode;
|
|
@@ -615,19 +637,78 @@ function EditableList({
|
|
|
615
637
|
e.stopPropagation();
|
|
616
638
|
ctx.setSelectedId(id);
|
|
617
639
|
};
|
|
618
|
-
return /* @__PURE__ */
|
|
640
|
+
return /* @__PURE__ */ jsxs3(
|
|
641
|
+
"div",
|
|
642
|
+
{
|
|
643
|
+
"data-cms-id": id,
|
|
644
|
+
onClick: active ? onClick : void 0,
|
|
645
|
+
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
646
|
+
children: [
|
|
647
|
+
renderList ? renderList(value) : /* @__PURE__ */ jsx4("div", { className: listClassName, children: renderItem && value.map(renderItem) }),
|
|
648
|
+
active && value.length === 0 && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
|
|
649
|
+
"Empty List ",
|
|
650
|
+
label ? `(${label})` : "",
|
|
651
|
+
" \u2014 Click to add items"
|
|
652
|
+
] })
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
function EditableReference({
|
|
658
|
+
id,
|
|
659
|
+
label,
|
|
660
|
+
section,
|
|
661
|
+
pageId,
|
|
662
|
+
collection,
|
|
663
|
+
max,
|
|
664
|
+
displayField,
|
|
665
|
+
className,
|
|
666
|
+
children
|
|
667
|
+
}) {
|
|
668
|
+
const ctx = useRegister(id, "reference", label, section, pageId, max === 1 ? "" : [], void 0, void 0, void 0, collection, max, displayField);
|
|
669
|
+
const active = !!ctx?.editMode;
|
|
670
|
+
const selected = ctx?.selectedId === id;
|
|
671
|
+
const value = ctx && Object.prototype.hasOwnProperty.call(ctx.overrides, id) ? ctx.overrides[id] : void 0;
|
|
672
|
+
const [resolvedItems, setResolvedItems] = useState4([]);
|
|
673
|
+
useEffect3(() => {
|
|
674
|
+
if (!ctx) return;
|
|
675
|
+
const ids = Array.isArray(value) ? value : value ? [value] : [];
|
|
676
|
+
if (ids.length === 0) {
|
|
677
|
+
setResolvedItems([]);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
ctx.adapter.listEntries(collection).then((res) => {
|
|
681
|
+
setResolvedItems(res.filter((r) => ids.includes(r.id)));
|
|
682
|
+
}).catch(() => {
|
|
683
|
+
});
|
|
684
|
+
}, [value, collection, ctx]);
|
|
685
|
+
const onClick = (e) => {
|
|
686
|
+
if (!active || !ctx) return;
|
|
687
|
+
e.preventDefault();
|
|
688
|
+
e.stopPropagation();
|
|
689
|
+
ctx.setSelectedId(id);
|
|
690
|
+
};
|
|
691
|
+
const childContent = typeof children === "function" ? children(resolvedItems) : children;
|
|
692
|
+
return /* @__PURE__ */ jsxs3(
|
|
619
693
|
"div",
|
|
620
694
|
{
|
|
621
695
|
"data-cms-id": id,
|
|
622
696
|
onClick: active ? onClick : void 0,
|
|
623
697
|
className: [className, editableClasses(active, selected)].filter(Boolean).join(" "),
|
|
624
|
-
children:
|
|
698
|
+
children: [
|
|
699
|
+
childContent,
|
|
700
|
+
active && (!resolvedItems || resolvedItems.length === 0) && /* @__PURE__ */ jsxs3("div", { style: { padding: "2rem", textAlign: "center", fontSize: "0.875rem", color: "#737373", backgroundColor: "rgba(245, 245, 245, 0.5)", border: "2px dashed #d4d4d4", borderRadius: "0.75rem", width: "100%", cursor: "pointer" }, children: [
|
|
701
|
+
"Empty Reference ",
|
|
702
|
+
label ? `(${label})` : "",
|
|
703
|
+
" \u2014 Click to select"
|
|
704
|
+
] })
|
|
705
|
+
]
|
|
625
706
|
}
|
|
626
707
|
);
|
|
627
708
|
}
|
|
628
709
|
|
|
629
710
|
// src/admin/AdminApp.tsx
|
|
630
|
-
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef2, useState as
|
|
711
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef2, useState as useState5 } from "react";
|
|
631
712
|
import {
|
|
632
713
|
FileText,
|
|
633
714
|
Boxes,
|
|
@@ -654,10 +735,11 @@ import {
|
|
|
654
735
|
ChevronRight,
|
|
655
736
|
SlidersHorizontal,
|
|
656
737
|
LogOut,
|
|
657
|
-
ExternalLink as ExternalLink2
|
|
738
|
+
ExternalLink as ExternalLink2,
|
|
739
|
+
Check
|
|
658
740
|
} from "lucide-react";
|
|
659
741
|
import { CreditCard as CreditCard2 } from "lucide-react";
|
|
660
|
-
import { Fragment as
|
|
742
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
661
743
|
async function handleImageFile(file, onUrl, uploadImage) {
|
|
662
744
|
if (uploadImage) {
|
|
663
745
|
try {
|
|
@@ -679,9 +761,9 @@ function AdminApp({ apiUrl, projectId, email }) {
|
|
|
679
761
|
return /* @__PURE__ */ jsx5(AdminAppContent, {});
|
|
680
762
|
}
|
|
681
763
|
function AdminAppContent() {
|
|
682
|
-
const [section, setSection] =
|
|
683
|
-
const [authChecking, setAuthChecking] =
|
|
684
|
-
const [authenticated, setAuthenticated] =
|
|
764
|
+
const [section, setSection] = useState5("pages");
|
|
765
|
+
const [authChecking, setAuthChecking] = useState5(true);
|
|
766
|
+
const [authenticated, setAuthenticated] = useState5(false);
|
|
685
767
|
const ctx = useCmsContext();
|
|
686
768
|
useEffect4(() => {
|
|
687
769
|
fetch("/api/admin/auth").then((res) => res.json()).then((data) => {
|
|
@@ -704,7 +786,7 @@ function AdminAppContent() {
|
|
|
704
786
|
const isSubscriptionActive = subscriptionCtx?.isSubscriptionActive ?? true;
|
|
705
787
|
const daysOverdue = subscriptionCtx?.daysOverdue ?? 0;
|
|
706
788
|
if (authChecking) {
|
|
707
|
-
return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-screen w-full items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 text-slate-500 font-medium text-sm", children: [
|
|
708
790
|
/* @__PURE__ */ jsx5("div", { className: "w-5 h-5 border-2 border-indigo-600 border-t-transparent rounded-full animate-spin" }),
|
|
709
791
|
"Authenticating Admin..."
|
|
710
792
|
] }) });
|
|
@@ -715,23 +797,23 @@ function AdminAppContent() {
|
|
|
715
797
|
if (!isSubscriptionActive) {
|
|
716
798
|
return /* @__PURE__ */ jsx5("div", { className: "flex flex-col lg:flex-row h-screen w-full overflow-hidden bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900", children: /* @__PURE__ */ jsx5(SubscriptionPage, {}) });
|
|
717
799
|
}
|
|
718
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col h-screen w-full bg-slate-50 text-slate-900 font-sans selection:bg-indigo-100 selection:text-indigo-900 overflow-hidden", children: [
|
|
719
801
|
daysOverdue > 0 && daysOverdue <= 15 && /* @__PURE__ */ jsx5("div", { className: "bg-amber-400 text-amber-950 px-4 py-2.5 text-center text-sm font-semibold shadow-sm z-50", children: "Your account has an overdue balance. Please update your payment." }),
|
|
720
802
|
daysOverdue > 15 && daysOverdue < 30 && /* @__PURE__ */ jsx5("div", { className: "bg-rose-600 text-white px-4 py-2.5 text-center text-sm font-bold shadow-sm z-50", children: "Attention: If you do not settle your balance, your account will be suspended soon." }),
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row flex-1 overflow-hidden relative", children: [
|
|
804
|
+
/* @__PURE__ */ jsx5("div", { className: "lg:hidden flex items-center justify-between bg-white/80 backdrop-blur-xl border-b border-slate-200 px-4 py-3 shrink-0 z-20 relative", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
723
805
|
ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
|
|
724
806
|
/* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 tracking-tight", children: "Admin CMS" })
|
|
725
807
|
] }) }),
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ jsxs4("aside", { className: "flex w-full lg:w-64 shrink-0 flex-col border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/80 backdrop-blur-xl shadow-sm z-10 overflow-hidden", children: [
|
|
809
|
+
/* @__PURE__ */ jsxs4("div", { className: "hidden lg:block border-b border-slate-200 px-6 py-5 bg-white/50", children: [
|
|
810
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-1", children: [
|
|
729
811
|
ctx.overrides?.["global-logo"] ? /* @__PURE__ */ jsx5("img", { src: String(ctx.overrides["global-logo"]), alt: "Logo", className: "h-5 w-auto object-contain" }) : /* @__PURE__ */ jsx5("div", { className: "w-2 h-2 rounded-full bg-indigo-500 shadow-[0_0_8px_rgba(99,102,241,0.8)]" }),
|
|
730
812
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: "Admin CMS" })
|
|
731
813
|
] }),
|
|
732
814
|
/* @__PURE__ */ jsx5("div", { className: "truncate font-bold text-lg text-slate-900", children: ctx.config.siteName ?? "Site Administration" })
|
|
733
815
|
] }),
|
|
734
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ jsxs4("nav", { className: "flex flex-row lg:flex-col overflow-x-auto lg:overflow-visible space-x-2 lg:space-x-0 lg:space-y-1.5 p-3 lg:p-4 text-sm font-medium hide-scrollbar", children: [
|
|
735
817
|
/* @__PURE__ */ jsx5(
|
|
736
818
|
SideItem,
|
|
737
819
|
{
|
|
@@ -787,12 +869,12 @@ function AdminAppContent() {
|
|
|
787
869
|
}
|
|
788
870
|
)
|
|
789
871
|
] }),
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ jsxs4("div", { className: "hidden lg:block mt-auto border-t border-slate-200 p-4 bg-slate-50/50", children: [
|
|
873
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-xs text-slate-500 mb-4", children: [
|
|
792
874
|
/* @__PURE__ */ jsx5("span", { children: "Storage Adapter" }),
|
|
793
875
|
/* @__PURE__ */ jsx5("span", { className: "font-semibold px-2 py-0.5 rounded-full bg-slate-200 text-slate-700", children: ctx.adapter.name })
|
|
794
876
|
] }),
|
|
795
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ jsxs4(
|
|
796
878
|
"button",
|
|
797
879
|
{
|
|
798
880
|
onClick: async () => {
|
|
@@ -808,7 +890,7 @@ function AdminAppContent() {
|
|
|
808
890
|
)
|
|
809
891
|
] })
|
|
810
892
|
] }),
|
|
811
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsxs4("main", { className: "flex-1 overflow-hidden relative flex flex-col", children: [
|
|
812
894
|
section === "pages" && /* @__PURE__ */ jsx5(PagesSection, {}),
|
|
813
895
|
section === "collections" && /* @__PURE__ */ jsx5(CollectionsSection, {}),
|
|
814
896
|
section === "submissions" && /* @__PURE__ */ jsx5(SubmissionsSection, {}),
|
|
@@ -825,7 +907,7 @@ function SideItem({
|
|
|
825
907
|
icon,
|
|
826
908
|
children
|
|
827
909
|
}) {
|
|
828
|
-
return /* @__PURE__ */
|
|
910
|
+
return /* @__PURE__ */ jsxs4(
|
|
829
911
|
"button",
|
|
830
912
|
{
|
|
831
913
|
onClick,
|
|
@@ -837,24 +919,80 @@ function SideItem({
|
|
|
837
919
|
}
|
|
838
920
|
);
|
|
839
921
|
}
|
|
922
|
+
function PageListItem({
|
|
923
|
+
p,
|
|
924
|
+
selected,
|
|
925
|
+
onSelect,
|
|
926
|
+
depth = 0
|
|
927
|
+
}) {
|
|
928
|
+
const [expanded, setExpanded] = useState5(false);
|
|
929
|
+
if (p.isSeparator) {
|
|
930
|
+
return /* @__PURE__ */ jsx5("li", { className: "my-2 border-t border-slate-200/60" });
|
|
931
|
+
}
|
|
932
|
+
const hasChildren = p.children && p.children.length > 0;
|
|
933
|
+
const isSelected = selected?.id === p.id;
|
|
934
|
+
const hasSelectedChild = hasChildren && p.children?.some((child) => child.id === selected?.id);
|
|
935
|
+
useEffect4(() => {
|
|
936
|
+
if (hasSelectedChild) {
|
|
937
|
+
setExpanded(true);
|
|
938
|
+
}
|
|
939
|
+
}, [hasSelectedChild]);
|
|
940
|
+
return /* @__PURE__ */ jsxs4("li", { className: "shrink-0 lg:w-full", children: [
|
|
941
|
+
/* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
|
|
942
|
+
"button",
|
|
943
|
+
{
|
|
944
|
+
onClick: () => {
|
|
945
|
+
if (hasChildren) {
|
|
946
|
+
setExpanded(!expanded);
|
|
947
|
+
}
|
|
948
|
+
if (p.path || !hasChildren) {
|
|
949
|
+
onSelect(p);
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
className: `flex-1 w-full rounded-lg py-2.5 text-left text-sm transition-all duration-200 ${depth === 0 ? "px-3" : "px-3 ml-2"} ${isSelected ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
953
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
954
|
+
/* @__PURE__ */ jsx5(
|
|
955
|
+
"div",
|
|
956
|
+
{
|
|
957
|
+
className: `truncate ${isSelected ? "text-slate-900" : "text-slate-700"}`,
|
|
958
|
+
children: p.name
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
hasChildren && /* @__PURE__ */ jsx5("span", { className: "text-slate-400", children: expanded ? /* @__PURE__ */ jsx5(ChevronUp, { size: 14 }) : /* @__PURE__ */ jsx5(ChevronDown, { size: 14 }) })
|
|
962
|
+
] })
|
|
963
|
+
}
|
|
964
|
+
) }),
|
|
965
|
+
hasChildren && expanded && /* @__PURE__ */ jsx5("ul", { className: `mt-1 space-y-1 ${depth === 0 ? "ml-4 border-l-2 border-slate-100 pl-1" : "ml-2"}`, children: p.children.map((child) => /* @__PURE__ */ jsx5(
|
|
966
|
+
PageListItem,
|
|
967
|
+
{
|
|
968
|
+
p: child,
|
|
969
|
+
selected,
|
|
970
|
+
onSelect,
|
|
971
|
+
depth: depth + 1
|
|
972
|
+
},
|
|
973
|
+
child.id
|
|
974
|
+
)) })
|
|
975
|
+
] });
|
|
976
|
+
}
|
|
840
977
|
function PagesSection() {
|
|
841
978
|
const ctx = useCmsContext();
|
|
842
|
-
const [selected, setSelected] =
|
|
979
|
+
const [selected, setSelected] = useState5(
|
|
843
980
|
ctx.config.pages[0] ?? null
|
|
844
981
|
);
|
|
845
|
-
const [showList, setShowList] =
|
|
846
|
-
return /* @__PURE__ */
|
|
847
|
-
showList && /* @__PURE__ */
|
|
982
|
+
const [showList, setShowList] = useState5(true);
|
|
983
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
|
|
984
|
+
showList && /* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
|
|
848
985
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Pages" }),
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
|
|
851
|
-
|
|
986
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
|
|
987
|
+
ctx.config.pages.map((p) => /* @__PURE__ */ jsx5(
|
|
988
|
+
PageListItem,
|
|
852
989
|
{
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}
|
|
857
|
-
|
|
990
|
+
p,
|
|
991
|
+
selected,
|
|
992
|
+
onSelect: setSelected
|
|
993
|
+
},
|
|
994
|
+
p.id
|
|
995
|
+
)),
|
|
858
996
|
ctx.config.pages.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No pages registered." })
|
|
859
997
|
] })
|
|
860
998
|
] }),
|
|
@@ -871,10 +1009,10 @@ function PagesSection() {
|
|
|
871
1009
|
function PageEditor({ page, showList, onToggleList }) {
|
|
872
1010
|
const ctx = useCmsContext();
|
|
873
1011
|
const iframeRef = useRef2(null);
|
|
874
|
-
const [registered, setRegistered] =
|
|
875
|
-
const [selectedId, setSelectedId] =
|
|
876
|
-
const [preview, setPreview] =
|
|
877
|
-
const [drawerState, setDrawerState] =
|
|
1012
|
+
const [registered, setRegistered] = useState5([]);
|
|
1013
|
+
const [selectedId, setSelectedId] = useState5(null);
|
|
1014
|
+
const [preview, setPreview] = useState5(false);
|
|
1015
|
+
const [drawerState, setDrawerState] = useState5("half");
|
|
878
1016
|
const src = useMemo2(
|
|
879
1017
|
() => `${page.path}${preview ? "" : "?__cms=edit"}`,
|
|
880
1018
|
[page.path, preview]
|
|
@@ -916,22 +1054,22 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
916
1054
|
[ctx]
|
|
917
1055
|
);
|
|
918
1056
|
const selectedMeta = registered.find((r) => r.id === selectedId) ?? null;
|
|
919
|
-
const [viewMode, setViewMode] =
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
1057
|
+
const [viewMode, setViewMode] = useState5("desktop");
|
|
1058
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex h-full flex-col", children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-slate-200 bg-white/80 backdrop-blur px-4 py-3 shadow-sm z-10 shrink-0", children: [
|
|
1060
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-sm shrink-0", children: [
|
|
923
1061
|
/* @__PURE__ */ jsx5("button", { onClick: onToggleList, className: "text-slate-400 hover:text-slate-700 p-1 hidden lg:block", title: "Toggle Pages Menu", children: showList ? /* @__PURE__ */ jsx5(PanelLeftClose, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx5(PanelLeftOpen, { className: "w-5 h-5" }) }),
|
|
924
1062
|
/* @__PURE__ */ jsx5("span", { className: "font-bold text-slate-800 text-sm md:text-base", children: page.name }),
|
|
925
1063
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-300 hidden sm:inline", children: "|" }),
|
|
926
1064
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-500 font-mono text-[10px] md:text-xs bg-slate-100 px-2 py-1 rounded hidden sm:inline-block", children: page.path })
|
|
927
1065
|
] }),
|
|
928
|
-
/* @__PURE__ */
|
|
929
|
-
/* @__PURE__ */
|
|
1066
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 overflow-x-auto w-full sm:w-auto pb-1 sm:pb-0 hide-scrollbar shrink-0", children: [
|
|
1067
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex bg-slate-100/80 p-0.5 rounded-lg mr-2 shrink-0", children: [
|
|
930
1068
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("desktop"), className: `p-1.5 rounded-md transition-all ${viewMode === "desktop" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Desktop View", children: /* @__PURE__ */ jsx5(Monitor, { className: "w-4 h-4" }) }),
|
|
931
1069
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("tablet"), className: `p-1.5 rounded-md transition-all ${viewMode === "tablet" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Tablet View", children: /* @__PURE__ */ jsx5(Tablet, { className: "w-4 h-4" }) }),
|
|
932
1070
|
/* @__PURE__ */ jsx5("button", { onClick: () => setViewMode("mobile"), className: `p-1.5 rounded-md transition-all ${viewMode === "mobile" ? "bg-white shadow-sm text-indigo-600" : "text-slate-500 hover:text-slate-800"}`, title: "Mobile View", children: /* @__PURE__ */ jsx5(Smartphone, { className: "w-4 h-4" }) })
|
|
933
1071
|
] }),
|
|
934
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsxs4(
|
|
935
1073
|
"button",
|
|
936
1074
|
{
|
|
937
1075
|
onClick: () => setPreview((v) => !v),
|
|
@@ -942,7 +1080,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
942
1080
|
]
|
|
943
1081
|
}
|
|
944
1082
|
),
|
|
945
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsxs4(
|
|
946
1084
|
"a",
|
|
947
1085
|
{
|
|
948
1086
|
href: page.path,
|
|
@@ -955,7 +1093,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
955
1093
|
]
|
|
956
1094
|
}
|
|
957
1095
|
),
|
|
958
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ jsxs4(
|
|
959
1097
|
"button",
|
|
960
1098
|
{
|
|
961
1099
|
onClick: () => ctx.reset(),
|
|
@@ -967,7 +1105,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
967
1105
|
]
|
|
968
1106
|
}
|
|
969
1107
|
),
|
|
970
|
-
/* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ jsxs4(
|
|
971
1109
|
"button",
|
|
972
1110
|
{
|
|
973
1111
|
onClick: () => ctx.save(),
|
|
@@ -981,7 +1119,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
981
1119
|
)
|
|
982
1120
|
] })
|
|
983
1121
|
] }),
|
|
984
|
-
/* @__PURE__ */
|
|
1122
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col sm:flex-row flex-1 overflow-hidden", children: [
|
|
985
1123
|
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-hidden bg-slate-100/80 p-2 sm:p-4 flex flex-col items-center", children: /* @__PURE__ */ jsx5("div", { className: `flex-1 rounded-xl overflow-hidden border border-slate-200 bg-white shadow-lg ring-1 ring-slate-900/5 min-h-[300px] transition-all duration-300 w-full ${viewMode === "mobile" ? "max-w-[375px]" : viewMode === "tablet" ? "max-w-[768px]" : "w-full"}`, children: /* @__PURE__ */ jsx5(
|
|
986
1124
|
"iframe",
|
|
987
1125
|
{
|
|
@@ -992,11 +1130,11 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
992
1130
|
},
|
|
993
1131
|
src
|
|
994
1132
|
) }) }),
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
1133
|
+
/* @__PURE__ */ jsxs4("aside", { className: `w-full sm:w-[320px] lg:w-[360px] shrink-0 overflow-y-auto border-t sm:border-t-0 sm:border-l border-slate-200 bg-white shadow-[-4px_0_15px_-3px_rgba(0,0,0,0.05)] z-10 hide-scrollbar transition-all duration-300 ${drawerState === "min" ? "max-h-[52px] sm:max-h-none" : drawerState === "full" ? "max-h-[85vh] sm:max-h-none" : "max-h-[50vh] sm:max-h-none"}`, children: [
|
|
1134
|
+
/* @__PURE__ */ jsxs4("div", { className: "sticky top-0 bg-white/90 backdrop-blur border-b border-slate-200 px-5 py-3 md:py-4 z-10 flex items-center justify-between", children: [
|
|
997
1135
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-bold uppercase tracking-widest text-slate-500", children: selectedMeta ? "Edit Field" : "Editable Elements" }),
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
1137
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 sm:hidden", children: [
|
|
1000
1138
|
/* @__PURE__ */ jsx5(
|
|
1001
1139
|
"button",
|
|
1002
1140
|
{
|
|
@@ -1019,7 +1157,7 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
1019
1157
|
selectedMeta && /* @__PURE__ */ jsx5("button", { onClick: () => setSelectedId(null), className: "sm:hidden text-slate-400 hover:text-slate-700 text-xs font-bold uppercase tracking-widest", children: "Close" })
|
|
1020
1158
|
] })
|
|
1021
1159
|
] }),
|
|
1022
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsxs4("div", { className: drawerState === "min" ? "hidden sm:block" : "block", children: [
|
|
1023
1161
|
!selectedMeta && /* @__PURE__ */ jsx5("div", { className: "px-5 mt-1 mb-2", children: /* @__PURE__ */ jsx5("p", { className: "text-[10px] md:text-xs text-slate-400", children: "Select an element on the left to edit it." }) }),
|
|
1024
1162
|
selectedMeta ? /* @__PURE__ */ jsx5(
|
|
1025
1163
|
FieldEditor,
|
|
@@ -1041,20 +1179,38 @@ function PageEditor({ page, showList, onToggleList }) {
|
|
|
1041
1179
|
},
|
|
1042
1180
|
onClose: () => setSelectedId(null)
|
|
1043
1181
|
}
|
|
1044
|
-
) : /* @__PURE__ */
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1182
|
+
) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1183
|
+
page.hideable && /* @__PURE__ */ jsxs4("div", { className: "px-5 py-4 border-b border-slate-100 bg-slate-50/50", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3", children: [
|
|
1185
|
+
/* @__PURE__ */ jsx5(
|
|
1186
|
+
"input",
|
|
1187
|
+
{
|
|
1188
|
+
type: "checkbox",
|
|
1189
|
+
id: `page-visible-toggle-${page.id}`,
|
|
1190
|
+
checked: ctx.overrides[`page-${page.id}-visible`] !== false,
|
|
1191
|
+
onChange: (e) => updateOverride(`page-${page.id}-visible`, e.target.checked),
|
|
1192
|
+
className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: `page-visible-toggle-${page.id}`, className: "text-sm font-medium text-slate-800 cursor-pointer flex-1", children: "Page is Visible" })
|
|
1196
|
+
] }),
|
|
1197
|
+
/* @__PURE__ */ jsx5("p", { className: "text-[11px] text-slate-500 mt-1.5 pl-8", children: "If unchecked, this page will be hidden from navigation and URL access." })
|
|
1198
|
+
] }),
|
|
1199
|
+
/* @__PURE__ */ jsx5(
|
|
1200
|
+
SectionAccordion,
|
|
1201
|
+
{
|
|
1202
|
+
registered,
|
|
1203
|
+
onSelect: (id) => {
|
|
1204
|
+
setSelectedId(id);
|
|
1205
|
+
setDrawerState((prev) => prev === "min" ? "half" : prev);
|
|
1206
|
+
iframeRef.current?.contentWindow?.postMessage(
|
|
1207
|
+
{ __cms: true, type: "cms:select", id },
|
|
1208
|
+
"*"
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1055
1211
|
}
|
|
1056
|
-
|
|
1057
|
-
)
|
|
1212
|
+
)
|
|
1213
|
+
] })
|
|
1058
1214
|
] })
|
|
1059
1215
|
] })
|
|
1060
1216
|
] })
|
|
@@ -1064,9 +1220,9 @@ function SectionAccordion({
|
|
|
1064
1220
|
registered,
|
|
1065
1221
|
onSelect
|
|
1066
1222
|
}) {
|
|
1067
|
-
const [expanded, setExpanded] =
|
|
1223
|
+
const [expanded, setExpanded] = useState5({});
|
|
1068
1224
|
if (registered.length === 0) {
|
|
1069
|
-
return /* @__PURE__ */
|
|
1225
|
+
return /* @__PURE__ */ jsxs4("div", { className: "px-4 py-8 text-center text-sm text-slate-500", children: [
|
|
1070
1226
|
/* @__PURE__ */ jsx5("div", { className: "w-12 h-12 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-3", children: /* @__PURE__ */ jsx5(Pencil, { className: "h-5 w-5 text-slate-400" }) }),
|
|
1071
1227
|
"No editable fields detected on this page."
|
|
1072
1228
|
] });
|
|
@@ -1080,19 +1236,19 @@ function SectionAccordion({
|
|
|
1080
1236
|
const sectionNames = Object.keys(groups).filter((n) => n !== "Unsectioned");
|
|
1081
1237
|
const unsectionedFields = groups["Unsectioned"] || [];
|
|
1082
1238
|
const toggle = (name) => setExpanded((prev) => ({ ...prev, [name]: !prev[name] }));
|
|
1083
|
-
return /* @__PURE__ */
|
|
1239
|
+
return /* @__PURE__ */ jsxs4("div", { className: "p-2 space-y-3", children: [
|
|
1084
1240
|
unsectionedFields.length > 0 && /* @__PURE__ */ jsx5("ul", { className: "divide-y divide-slate-100 bg-white rounded-lg border border-slate-200 overflow-hidden shadow-sm", children: unsectionedFields.map((m) => /* @__PURE__ */ jsx5(FieldListItem, { meta: m, onSelect }, m.id)) }),
|
|
1085
1241
|
sectionNames.map((sectionName) => {
|
|
1086
1242
|
const isOpen = expanded[sectionName] ?? false;
|
|
1087
1243
|
const fields = groups[sectionName];
|
|
1088
|
-
return /* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1244
|
+
return /* @__PURE__ */ jsxs4("div", { className: "rounded-lg border border-slate-200 overflow-hidden", children: [
|
|
1245
|
+
/* @__PURE__ */ jsxs4(
|
|
1090
1246
|
"button",
|
|
1091
1247
|
{
|
|
1092
1248
|
onClick: () => toggle(sectionName),
|
|
1093
1249
|
className: "flex w-full items-center justify-between px-3 py-2.5 bg-slate-50/80 hover:bg-slate-100 transition-colors text-left",
|
|
1094
1250
|
children: [
|
|
1095
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2", children: [
|
|
1096
1252
|
/* @__PURE__ */ jsx5("span", { className: "font-semibold text-sm text-slate-800", children: sectionName }),
|
|
1097
1253
|
/* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-400 bg-slate-200/70 px-1.5 py-0.5 rounded-full", children: fields.length })
|
|
1098
1254
|
] }),
|
|
@@ -1116,15 +1272,15 @@ function SectionAccordion({
|
|
|
1116
1272
|
] });
|
|
1117
1273
|
}
|
|
1118
1274
|
function FieldListItem({ meta, onSelect }) {
|
|
1119
|
-
return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */
|
|
1275
|
+
return /* @__PURE__ */ jsx5("li", { className: "p-1 list-none", children: /* @__PURE__ */ jsxs4(
|
|
1120
1276
|
"button",
|
|
1121
1277
|
{
|
|
1122
1278
|
onClick: () => onSelect(meta.id),
|
|
1123
1279
|
className: "flex w-full items-center justify-between gap-2 rounded-md px-3 py-2.5 text-left hover:bg-slate-50 group transition-colors",
|
|
1124
1280
|
children: [
|
|
1125
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ jsxs4("span", { className: "overflow-hidden", children: [
|
|
1126
1282
|
/* @__PURE__ */ jsx5("span", { className: "block font-medium text-slate-800 text-sm truncate", children: meta.label ?? meta.id }),
|
|
1127
|
-
/* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ jsxs4("span", { className: "block text-[10px] md:text-xs text-slate-400 truncate mt-0.5 font-mono", children: [
|
|
1128
1284
|
meta.type,
|
|
1129
1285
|
" ",
|
|
1130
1286
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-300 mx-1", children: "\xB7" }),
|
|
@@ -1137,6 +1293,74 @@ function FieldListItem({ meta, onSelect }) {
|
|
|
1137
1293
|
}
|
|
1138
1294
|
) });
|
|
1139
1295
|
}
|
|
1296
|
+
function SidebarReferenceSelect({ meta, value, onChange }) {
|
|
1297
|
+
const ctx = useCmsContext();
|
|
1298
|
+
const collection = ctx.config.collections?.find((c) => c.id === meta.collection);
|
|
1299
|
+
const [items, setItems] = useState5([]);
|
|
1300
|
+
const [search, setSearch] = useState5("");
|
|
1301
|
+
const [loading, setLoading] = useState5(true);
|
|
1302
|
+
useEffect4(() => {
|
|
1303
|
+
if (!meta.collection) return;
|
|
1304
|
+
setLoading(true);
|
|
1305
|
+
ctx.adapter.listEntries(meta.collection).then((res) => {
|
|
1306
|
+
setItems(res);
|
|
1307
|
+
setLoading(false);
|
|
1308
|
+
});
|
|
1309
|
+
}, [meta.collection, ctx.adapter]);
|
|
1310
|
+
const selectedIds = Array.isArray(value) ? value : value ? [value] : [];
|
|
1311
|
+
const max = meta.max ?? 1;
|
|
1312
|
+
const toggle = (id) => {
|
|
1313
|
+
if (max === 1) {
|
|
1314
|
+
onChange([id]);
|
|
1315
|
+
} else {
|
|
1316
|
+
if (selectedIds.includes(id)) {
|
|
1317
|
+
onChange(selectedIds.filter((s) => s !== id));
|
|
1318
|
+
} else if (selectedIds.length < max) {
|
|
1319
|
+
onChange([...selectedIds, id]);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
const imgField = collection?.fields.find((f) => f.type === "image");
|
|
1324
|
+
const txtField = collection?.fields.find((f) => f.type === "text" || f.type === "textarea" || f.type === "richtext");
|
|
1325
|
+
const filtered = items.filter((it) => {
|
|
1326
|
+
if (!search) return true;
|
|
1327
|
+
const q = search.toLowerCase();
|
|
1328
|
+
const txt = String(it[txtField?.id || "id"] || "");
|
|
1329
|
+
return txt.toLowerCase().includes(q);
|
|
1330
|
+
});
|
|
1331
|
+
return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1332
|
+
/* @__PURE__ */ jsx5(
|
|
1333
|
+
"input",
|
|
1334
|
+
{
|
|
1335
|
+
placeholder: "Search...",
|
|
1336
|
+
value: search,
|
|
1337
|
+
onChange: (e) => setSearch(e.target.value),
|
|
1338
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1339
|
+
}
|
|
1340
|
+
),
|
|
1341
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-2 max-h-60 overflow-y-auto pr-1", children: [
|
|
1342
|
+
loading ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500", children: "Loading..." }) : filtered.map((it) => {
|
|
1343
|
+
const isSelected = selectedIds.includes(it.id);
|
|
1344
|
+
const imgSrc = imgField ? it[imgField.id] : null;
|
|
1345
|
+
const label = txtField ? it[txtField.id] : it.id;
|
|
1346
|
+
return /* @__PURE__ */ jsxs4(
|
|
1347
|
+
"div",
|
|
1348
|
+
{
|
|
1349
|
+
onClick: () => toggle(it.id),
|
|
1350
|
+
className: `flex items-center gap-3 p-2 rounded-xl cursor-pointer border ${isSelected ? "border-indigo-500 bg-indigo-50" : "border-slate-100 bg-slate-50 hover:border-slate-300"}`,
|
|
1351
|
+
children: [
|
|
1352
|
+
!!imgSrc && /* @__PURE__ */ jsx5("img", { src: Array.isArray(imgSrc) ? String(imgSrc[0]) : String(imgSrc), alt: "", className: "w-10 h-10 rounded-lg object-cover bg-white border border-slate-200" }),
|
|
1353
|
+
/* @__PURE__ */ jsx5("span", { className: `text-sm ${isSelected ? "font-semibold text-indigo-900" : "text-slate-700"}`, children: String(label) }),
|
|
1354
|
+
isSelected && /* @__PURE__ */ jsx5(Check, { className: "w-4 h-4 text-indigo-600 ml-auto" })
|
|
1355
|
+
]
|
|
1356
|
+
},
|
|
1357
|
+
it.id
|
|
1358
|
+
);
|
|
1359
|
+
}),
|
|
1360
|
+
!loading && filtered.length === 0 && /* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-500 text-center py-4", children: "No items found." })
|
|
1361
|
+
] })
|
|
1362
|
+
] });
|
|
1363
|
+
}
|
|
1140
1364
|
function FieldEditor({
|
|
1141
1365
|
meta,
|
|
1142
1366
|
value,
|
|
@@ -1145,13 +1369,28 @@ function FieldEditor({
|
|
|
1145
1369
|
onClose
|
|
1146
1370
|
}) {
|
|
1147
1371
|
const ctx = useCmsContext();
|
|
1148
|
-
|
|
1149
|
-
|
|
1372
|
+
const [expandedItems, setExpandedItems] = useState5({});
|
|
1373
|
+
const [searchQuery, setSearchQuery] = useState5("");
|
|
1374
|
+
return /* @__PURE__ */ jsxs4("div", { className: "p-5 animate-in slide-in-from-right-4 duration-200", children: [
|
|
1375
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-5", children: [
|
|
1150
1376
|
/* @__PURE__ */ jsx5("div", { className: "inline-flex items-center gap-1.5 px-2 py-1 rounded bg-indigo-50 text-indigo-700 text-[10px] font-bold uppercase tracking-wider mb-2", children: meta.type }),
|
|
1151
1377
|
/* @__PURE__ */ jsx5("div", { className: "font-bold text-slate-900 text-lg leading-tight", children: meta.label ?? meta.id }),
|
|
1152
1378
|
/* @__PURE__ */ jsx5("div", { className: "text-xs font-mono text-slate-400 mt-1", children: meta.id })
|
|
1153
1379
|
] }),
|
|
1154
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1381
|
+
meta.type === "boolean" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-3 py-1", children: [
|
|
1382
|
+
/* @__PURE__ */ jsx5(
|
|
1383
|
+
"input",
|
|
1384
|
+
{
|
|
1385
|
+
type: "checkbox",
|
|
1386
|
+
id: meta.id,
|
|
1387
|
+
checked: value === void 0 ? meta.defaultValue : !!value,
|
|
1388
|
+
onChange: (e) => onChange(e.target.checked),
|
|
1389
|
+
className: "w-5 h-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0"
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: meta.id, className: "text-sm font-medium text-slate-700 cursor-pointer", children: meta.label || "Enabled" })
|
|
1393
|
+
] }),
|
|
1155
1394
|
meta.type === "text" && /* @__PURE__ */ jsx5(
|
|
1156
1395
|
"input",
|
|
1157
1396
|
{
|
|
@@ -1170,8 +1409,8 @@ function FieldEditor({
|
|
|
1170
1409
|
className: "w-full rounded-xl border border-slate-200 px-4 py-3 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
|
|
1171
1410
|
}
|
|
1172
1411
|
),
|
|
1173
|
-
meta.type === "image" && /* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1412
|
+
meta.type === "image" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1413
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1175
1414
|
/* @__PURE__ */ jsx5(
|
|
1176
1415
|
"input",
|
|
1177
1416
|
{
|
|
@@ -1182,7 +1421,7 @@ function FieldEditor({
|
|
|
1182
1421
|
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"
|
|
1183
1422
|
}
|
|
1184
1423
|
),
|
|
1185
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1186
1425
|
"Upload",
|
|
1187
1426
|
/* @__PURE__ */ jsx5(
|
|
1188
1427
|
"input",
|
|
@@ -1200,7 +1439,7 @@ function FieldEditor({
|
|
|
1200
1439
|
)
|
|
1201
1440
|
] })
|
|
1202
1441
|
] }),
|
|
1203
|
-
value ? /* @__PURE__ */
|
|
1442
|
+
value ? /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group", children: [
|
|
1204
1443
|
/* @__PURE__ */ jsx5(
|
|
1205
1444
|
"img",
|
|
1206
1445
|
{
|
|
@@ -1212,8 +1451,8 @@ function FieldEditor({
|
|
|
1212
1451
|
/* @__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" }) })
|
|
1213
1452
|
] }) : null
|
|
1214
1453
|
] }),
|
|
1215
|
-
meta.type === "file" && /* @__PURE__ */
|
|
1216
|
-
/* @__PURE__ */
|
|
1454
|
+
meta.type === "file" && /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1455
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1217
1456
|
/* @__PURE__ */ jsx5(
|
|
1218
1457
|
"input",
|
|
1219
1458
|
{
|
|
@@ -1224,7 +1463,7 @@ function FieldEditor({
|
|
|
1224
1463
|
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"
|
|
1225
1464
|
}
|
|
1226
1465
|
),
|
|
1227
|
-
/* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ jsxs4("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: [
|
|
1228
1467
|
"Upload File",
|
|
1229
1468
|
/* @__PURE__ */ jsx5(
|
|
1230
1469
|
"input",
|
|
@@ -1242,13 +1481,13 @@ function FieldEditor({
|
|
|
1242
1481
|
)
|
|
1243
1482
|
] })
|
|
1244
1483
|
] }),
|
|
1245
|
-
value ? /* @__PURE__ */
|
|
1484
|
+
value ? /* @__PURE__ */ jsxs4("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: [
|
|
1246
1485
|
/* @__PURE__ */ jsx5("span", { children: "\u{1F4C4} File URL:" }),
|
|
1247
1486
|
/* @__PURE__ */ jsx5("span", { className: "truncate text-indigo-600 font-semibold", children: String(value) })
|
|
1248
1487
|
] }) : null
|
|
1249
1488
|
] }),
|
|
1250
|
-
meta.type === "link" && /* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1489
|
+
meta.type === "link" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4 bg-slate-50 p-4 rounded-xl border border-slate-100", children: [
|
|
1490
|
+
/* @__PURE__ */ jsxs4("label", { className: "block", children: [
|
|
1252
1491
|
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "Link Text" }),
|
|
1253
1492
|
/* @__PURE__ */ jsx5(
|
|
1254
1493
|
"input",
|
|
@@ -1259,7 +1498,7 @@ function FieldEditor({
|
|
|
1259
1498
|
}
|
|
1260
1499
|
)
|
|
1261
1500
|
] }),
|
|
1262
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsxs4("label", { className: "block", children: [
|
|
1263
1502
|
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-slate-500 uppercase tracking-wide", children: "URL Target" }),
|
|
1264
1503
|
/* @__PURE__ */ jsx5(
|
|
1265
1504
|
"input",
|
|
@@ -1272,7 +1511,7 @@ function FieldEditor({
|
|
|
1272
1511
|
)
|
|
1273
1512
|
] })
|
|
1274
1513
|
] }),
|
|
1275
|
-
meta.type === "color" && /* @__PURE__ */
|
|
1514
|
+
meta.type === "color" && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 bg-slate-50 p-2 rounded-xl border border-slate-100", children: [
|
|
1276
1515
|
/* @__PURE__ */ jsx5(
|
|
1277
1516
|
"input",
|
|
1278
1517
|
{
|
|
@@ -1301,140 +1540,185 @@ function FieldEditor({
|
|
|
1301
1540
|
className: "w-full rounded-xl border border-slate-200 px-4 py-3 font-mono text-xs text-slate-700 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-4 focus:ring-indigo-500/10 transition-all resize-y"
|
|
1302
1541
|
}
|
|
1303
1542
|
),
|
|
1304
|
-
meta.type === "list" && /* @__PURE__ */
|
|
1305
|
-
|
|
1306
|
-
/* @__PURE__ */ jsx5(
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1329
|
-
onChange(arr);
|
|
1330
|
-
},
|
|
1331
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1332
|
-
}
|
|
1333
|
-
) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs3("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1334
|
-
/* @__PURE__ */ jsx5(
|
|
1335
|
-
"input",
|
|
1543
|
+
meta.type === "list" && /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
1544
|
+
meta.search && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
1545
|
+
/* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }),
|
|
1546
|
+
/* @__PURE__ */ jsx5(
|
|
1547
|
+
"input",
|
|
1548
|
+
{
|
|
1549
|
+
type: "text",
|
|
1550
|
+
placeholder: "Search by title...",
|
|
1551
|
+
value: searchQuery,
|
|
1552
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1553
|
+
className: "w-full rounded-lg border border-slate-200 pl-9 pr-3 py-2 text-sm shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1554
|
+
}
|
|
1555
|
+
)
|
|
1556
|
+
] }),
|
|
1557
|
+
(Array.isArray(value) ? value : []).map((item, idx) => {
|
|
1558
|
+
if (meta.search && searchQuery) {
|
|
1559
|
+
const title = String(item?.title || item?.name || "").toLowerCase();
|
|
1560
|
+
if (!title.includes(searchQuery.toLowerCase())) return null;
|
|
1561
|
+
}
|
|
1562
|
+
const isExpanded = expandedItems[idx] ?? false;
|
|
1563
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-3 items-start bg-slate-50 p-3 rounded-xl border border-slate-100 relative group", children: [
|
|
1564
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-3 w-full", children: [
|
|
1565
|
+
/* @__PURE__ */ jsxs4(
|
|
1566
|
+
"div",
|
|
1336
1567
|
{
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
},
|
|
1344
|
-
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1568
|
+
className: "flex items-center justify-between cursor-pointer py-1 select-none",
|
|
1569
|
+
onClick: () => setExpandedItems((prev) => ({ ...prev, [idx]: !isExpanded })),
|
|
1570
|
+
children: [
|
|
1571
|
+
/* @__PURE__ */ jsx5("div", { className: "font-semibold text-slate-700 text-sm flex-1 truncate pr-4", children: meta.itemSchema ? item?.title || item?.name || `Item ${idx + 1}` : String(item) }),
|
|
1572
|
+
isExpanded ? /* @__PURE__ */ jsx5(ChevronUp, { className: "w-4 h-4 text-slate-500 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronDown, { className: "w-4 h-4 text-slate-500 shrink-0" })
|
|
1573
|
+
]
|
|
1345
1574
|
}
|
|
1346
1575
|
),
|
|
1347
|
-
/* @__PURE__ */ jsx5("
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1576
|
+
isExpanded && /* @__PURE__ */ jsx5("div", { className: "pt-3 border-t border-slate-200 mt-2 space-y-3", children: meta.itemSchema ? meta.itemSchema.map((schemaField) => /* @__PURE__ */ jsxs4("div", { children: [
|
|
1577
|
+
/* @__PURE__ */ jsx5("label", { className: "block text-[10px] font-bold text-slate-500 uppercase mb-1", children: schemaField.label || schemaField.key }),
|
|
1578
|
+
schemaField.type === "icon" ? /* @__PURE__ */ jsx5(
|
|
1579
|
+
SearchableSelect,
|
|
1580
|
+
{
|
|
1581
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1582
|
+
options: schemaField.options ?? [],
|
|
1583
|
+
placeholder: "Search icon...",
|
|
1584
|
+
iconMap: ctx.iconMap,
|
|
1585
|
+
onChange: (val) => {
|
|
1586
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1587
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: val };
|
|
1588
|
+
onChange(arr);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
) : schemaField.type === "textarea" ? /* @__PURE__ */ jsx5(
|
|
1592
|
+
"textarea",
|
|
1352
1593
|
{
|
|
1353
|
-
|
|
1594
|
+
rows: 3,
|
|
1354
1595
|
value: String(item?.[schemaField.key] ?? ""),
|
|
1355
1596
|
onChange: (e) => {
|
|
1356
1597
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1357
1598
|
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1358
1599
|
onChange(arr);
|
|
1359
1600
|
},
|
|
1360
|
-
placeholder: "https://...",
|
|
1361
1601
|
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1362
1602
|
}
|
|
1363
|
-
),
|
|
1364
|
-
/* @__PURE__ */ jsxs3("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1365
|
-
"Upload",
|
|
1603
|
+
) : schemaField.type === "boolean" ? /* @__PURE__ */ jsxs4("label", { className: "flex items-center gap-2 mt-1 cursor-pointer", children: [
|
|
1366
1604
|
/* @__PURE__ */ jsx5(
|
|
1367
1605
|
"input",
|
|
1368
1606
|
{
|
|
1369
|
-
type: "
|
|
1370
|
-
|
|
1371
|
-
className: "hidden",
|
|
1607
|
+
type: "checkbox",
|
|
1608
|
+
checked: !!item?.[schemaField.key],
|
|
1372
1609
|
onChange: (e) => {
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1610
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1611
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.checked };
|
|
1612
|
+
onChange(arr);
|
|
1613
|
+
},
|
|
1614
|
+
className: "w-4 h-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500"
|
|
1615
|
+
}
|
|
1616
|
+
),
|
|
1617
|
+
/* @__PURE__ */ jsx5("span", { className: "text-sm text-slate-700", children: schemaField.label || schemaField.key })
|
|
1618
|
+
] }) : schemaField.type === "image" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3 mt-1", children: [
|
|
1619
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1620
|
+
/* @__PURE__ */ jsx5(
|
|
1621
|
+
"input",
|
|
1622
|
+
{
|
|
1623
|
+
type: "url",
|
|
1624
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1625
|
+
onChange: (e) => {
|
|
1626
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1627
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1628
|
+
onChange(arr);
|
|
1629
|
+
},
|
|
1630
|
+
placeholder: "https://...",
|
|
1631
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1385
1632
|
}
|
|
1633
|
+
),
|
|
1634
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-lg bg-slate-100 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1635
|
+
"Upload",
|
|
1636
|
+
/* @__PURE__ */ jsx5(
|
|
1637
|
+
"input",
|
|
1638
|
+
{
|
|
1639
|
+
type: "file",
|
|
1640
|
+
accept: "image/*",
|
|
1641
|
+
className: "hidden",
|
|
1642
|
+
onChange: (e) => {
|
|
1643
|
+
const file = e.target.files?.[0];
|
|
1644
|
+
if (file) {
|
|
1645
|
+
void handleImageFile(
|
|
1646
|
+
file,
|
|
1647
|
+
(url) => {
|
|
1648
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1649
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: url };
|
|
1650
|
+
onChange(arr);
|
|
1651
|
+
},
|
|
1652
|
+
ctx.uploadImage
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
)
|
|
1658
|
+
] })
|
|
1659
|
+
] }),
|
|
1660
|
+
item?.[schemaField.key] ? /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group max-w-xs", children: /* @__PURE__ */ jsx5(
|
|
1661
|
+
"img",
|
|
1662
|
+
{
|
|
1663
|
+
src: String(item?.[schemaField.key]),
|
|
1664
|
+
alt: "",
|
|
1665
|
+
className: "w-full h-auto max-h-32 object-contain rounded-md"
|
|
1386
1666
|
}
|
|
1387
|
-
)
|
|
1388
|
-
] })
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1667
|
+
) }) : null
|
|
1668
|
+
] }) : schemaField.type === "select" ? /* @__PURE__ */ jsx5(
|
|
1669
|
+
"select",
|
|
1670
|
+
{
|
|
1671
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1672
|
+
onChange: (e) => {
|
|
1673
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1674
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1675
|
+
onChange(arr);
|
|
1676
|
+
},
|
|
1677
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 bg-white",
|
|
1678
|
+
children: schemaField.options?.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt, children: opt }, opt))
|
|
1679
|
+
}
|
|
1680
|
+
) : /* @__PURE__ */ jsx5(
|
|
1681
|
+
"input",
|
|
1682
|
+
{
|
|
1683
|
+
type: "text",
|
|
1684
|
+
value: String(item?.[schemaField.key] ?? ""),
|
|
1685
|
+
onChange: (e) => {
|
|
1686
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1687
|
+
arr[idx] = { ...arr[idx] || {}, [schemaField.key]: e.target.value };
|
|
1688
|
+
onChange(arr);
|
|
1689
|
+
},
|
|
1690
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1691
|
+
}
|
|
1692
|
+
)
|
|
1693
|
+
] }, schemaField.key)) : /* @__PURE__ */ jsx5(
|
|
1694
|
+
"input",
|
|
1392
1695
|
{
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1696
|
+
type: "text",
|
|
1697
|
+
value: String(item),
|
|
1698
|
+
onChange: (e) => {
|
|
1699
|
+
const arr = Array.isArray(value) ? [...value] : [];
|
|
1700
|
+
arr[idx] = e.target.value;
|
|
1701
|
+
onChange(arr);
|
|
1702
|
+
},
|
|
1703
|
+
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1396
1704
|
}
|
|
1397
|
-
) })
|
|
1398
|
-
] })
|
|
1399
|
-
|
|
1705
|
+
) })
|
|
1706
|
+
] }),
|
|
1707
|
+
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1708
|
+
"button",
|
|
1400
1709
|
{
|
|
1401
|
-
|
|
1402
|
-
value: String(item?.[schemaField.key] ?? ""),
|
|
1403
|
-
onChange: (e) => {
|
|
1710
|
+
onClick: () => {
|
|
1404
1711
|
const arr = Array.isArray(value) ? [...value] : [];
|
|
1405
|
-
arr
|
|
1712
|
+
arr.splice(idx, 1);
|
|
1406
1713
|
onChange(arr);
|
|
1407
1714
|
},
|
|
1408
|
-
className: "
|
|
1715
|
+
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1716
|
+
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1409
1717
|
}
|
|
1410
1718
|
)
|
|
1411
|
-
] },
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
type: "text",
|
|
1415
|
-
value: String(item),
|
|
1416
|
-
onChange: (e) => {
|
|
1417
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1418
|
-
arr[idx] = e.target.value;
|
|
1419
|
-
onChange(arr);
|
|
1420
|
-
},
|
|
1421
|
-
className: "w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
1422
|
-
}
|
|
1423
|
-
) }),
|
|
1424
|
-
!meta.fixedLength && /* @__PURE__ */ jsx5(
|
|
1425
|
-
"button",
|
|
1426
|
-
{
|
|
1427
|
-
onClick: () => {
|
|
1428
|
-
const arr = Array.isArray(value) ? [...value] : [];
|
|
1429
|
-
arr.splice(idx, 1);
|
|
1430
|
-
onChange(arr);
|
|
1431
|
-
},
|
|
1432
|
-
className: "p-1.5 text-slate-400 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors absolute top-2 right-2 opacity-0 group-hover:opacity-100",
|
|
1433
|
-
children: /* @__PURE__ */ jsx5(Trash2, { className: "w-4 h-4" })
|
|
1434
|
-
}
|
|
1435
|
-
)
|
|
1436
|
-
] }, idx)),
|
|
1437
|
-
!meta.fixedLength && /* @__PURE__ */ jsxs3(
|
|
1719
|
+
] }, idx);
|
|
1720
|
+
}),
|
|
1721
|
+
!meta.fixedLength && /* @__PURE__ */ jsxs4(
|
|
1438
1722
|
"button",
|
|
1439
1723
|
{
|
|
1440
1724
|
onClick: () => {
|
|
@@ -1458,10 +1742,10 @@ function FieldEditor({
|
|
|
1458
1742
|
}
|
|
1459
1743
|
)
|
|
1460
1744
|
] }),
|
|
1461
|
-
"
|
|
1745
|
+
meta.type === "reference" && /* @__PURE__ */ jsx5(SidebarReferenceSelect, { meta, value, onChange })
|
|
1462
1746
|
] }),
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1747
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between pt-6 mt-6 border-t border-slate-100", children: [
|
|
1748
|
+
/* @__PURE__ */ jsxs4(
|
|
1465
1749
|
"button",
|
|
1466
1750
|
{
|
|
1467
1751
|
onClick: onReset,
|
|
@@ -1486,10 +1770,10 @@ function FieldEditor({
|
|
|
1486
1770
|
function CollectionsSection() {
|
|
1487
1771
|
const ctx = useCmsContext();
|
|
1488
1772
|
const collections = ctx.config.collections ?? [];
|
|
1489
|
-
const [selected, setSelected] =
|
|
1773
|
+
const [selected, setSelected] = useState5(
|
|
1490
1774
|
collections[0] ?? null
|
|
1491
1775
|
);
|
|
1492
|
-
const [counts, setCounts] =
|
|
1776
|
+
const [counts, setCounts] = useState5({});
|
|
1493
1777
|
useEffect4(() => {
|
|
1494
1778
|
collections.forEach((c) => {
|
|
1495
1779
|
ctx.adapter.listEntries(c.id).then((entries) => {
|
|
@@ -1497,18 +1781,18 @@ function CollectionsSection() {
|
|
|
1497
1781
|
});
|
|
1498
1782
|
});
|
|
1499
1783
|
}, [ctx.adapter, collections]);
|
|
1500
|
-
return /* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
1785
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
|
|
1502
1786
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Collections" }),
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
|
|
1788
|
+
collections.map((c) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
|
|
1505
1789
|
"button",
|
|
1506
1790
|
{
|
|
1507
1791
|
onClick: () => setSelected(c),
|
|
1508
1792
|
className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selected?.id === c.id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
1509
1793
|
children: [
|
|
1510
1794
|
/* @__PURE__ */ jsx5("div", { className: selected?.id === c.id ? "text-slate-900" : "text-slate-700", children: c.name }),
|
|
1511
|
-
/* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selected?.id === c.id ? "text-indigo-500" : "text-slate-400"}`, children: [
|
|
1512
1796
|
counts[c.id] ?? 0,
|
|
1513
1797
|
" items"
|
|
1514
1798
|
] })
|
|
@@ -1518,7 +1802,7 @@ function CollectionsSection() {
|
|
|
1518
1802
|
collections.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No collections registered." })
|
|
1519
1803
|
] })
|
|
1520
1804
|
] }),
|
|
1521
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
|
|
1522
1806
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
|
|
1523
1807
|
selected ? /* @__PURE__ */ jsx5(CollectionEditor, { collection: selected }, selected.id) : /* @__PURE__ */ jsx5("div", { className: "grid h-full place-items-center text-sm text-slate-500", children: "Select a collection to manage its entries." })
|
|
1524
1808
|
] })
|
|
@@ -1526,13 +1810,17 @@ function CollectionsSection() {
|
|
|
1526
1810
|
}
|
|
1527
1811
|
function CollectionEditor({ collection }) {
|
|
1528
1812
|
const ctx = useCmsContext();
|
|
1529
|
-
const [entries, setEntries] =
|
|
1530
|
-
const [editing, setEditing] =
|
|
1531
|
-
const [saving, setSaving] =
|
|
1532
|
-
const [deletingId, setDeletingId] =
|
|
1533
|
-
const [loadingEntries, setLoadingEntries] =
|
|
1534
|
-
const [draggedIdx, setDraggedIdx] =
|
|
1535
|
-
const [dragOverIdx, setDragOverIdx] =
|
|
1813
|
+
const [entries, setEntries] = useState5([]);
|
|
1814
|
+
const [editing, setEditing] = useState5(null);
|
|
1815
|
+
const [saving, setSaving] = useState5(false);
|
|
1816
|
+
const [deletingId, setDeletingId] = useState5(null);
|
|
1817
|
+
const [loadingEntries, setLoadingEntries] = useState5(true);
|
|
1818
|
+
const [draggedIdx, setDraggedIdx] = useState5(null);
|
|
1819
|
+
const [dragOverIdx, setDragOverIdx] = useState5(null);
|
|
1820
|
+
const [search, setSearch] = useState5("");
|
|
1821
|
+
const [filters, setFilters] = useState5({});
|
|
1822
|
+
const [page, setPage] = useState5(1);
|
|
1823
|
+
const itemsPerPage = 10;
|
|
1536
1824
|
const load = useCallback3(() => {
|
|
1537
1825
|
setLoadingEntries(true);
|
|
1538
1826
|
ctx.adapter.listEntries(collection.id).then((res) => {
|
|
@@ -1556,7 +1844,7 @@ function CollectionEditor({ collection }) {
|
|
|
1556
1844
|
} else if (f.defaultValue !== void 0) {
|
|
1557
1845
|
base[f.id] = f.defaultValue;
|
|
1558
1846
|
} else {
|
|
1559
|
-
base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : "";
|
|
1847
|
+
base[f.id] = f.type === "boolean" ? false : f.type === "number" ? 0 : f.type === "select" ? f.options?.[0] ?? "" : "";
|
|
1560
1848
|
}
|
|
1561
1849
|
});
|
|
1562
1850
|
setEditing(base);
|
|
@@ -1565,7 +1853,16 @@ function CollectionEditor({ collection }) {
|
|
|
1565
1853
|
if (!editing) return;
|
|
1566
1854
|
setSaving(true);
|
|
1567
1855
|
try {
|
|
1568
|
-
|
|
1856
|
+
const finalEditing = { ...editing };
|
|
1857
|
+
collection.fields.forEach((f) => {
|
|
1858
|
+
if (f.type === "slug" && !finalEditing[f.id]) {
|
|
1859
|
+
const sourceField = f.source || "title";
|
|
1860
|
+
let val = String(finalEditing[sourceField] || finalEditing.id || "");
|
|
1861
|
+
val = val.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
|
|
1862
|
+
finalEditing[f.id] = val;
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
await ctx.adapter.putEntry(collection.id, finalEditing);
|
|
1569
1866
|
ctx.notifyCollectionChanged();
|
|
1570
1867
|
setEditing(null);
|
|
1571
1868
|
load();
|
|
@@ -1618,14 +1915,14 @@ function CollectionEditor({ collection }) {
|
|
|
1618
1915
|
setDraggedIdx(null);
|
|
1619
1916
|
setDragOverIdx(null);
|
|
1620
1917
|
};
|
|
1621
|
-
const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order").slice(0, 5);
|
|
1622
|
-
return /* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1624
|
-
/* @__PURE__ */
|
|
1918
|
+
const visibleFields = collection.fields.filter((f) => !["richtext", "list", "password"].includes(f.type) && f.id !== "order" && !f.hidden).slice(0, 5);
|
|
1919
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto max-w-5xl", children: [
|
|
1920
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-8 flex items-center justify-between", children: [
|
|
1921
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1625
1922
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: collection.name }),
|
|
1626
1923
|
collection.description && /* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: collection.description })
|
|
1627
1924
|
] }),
|
|
1628
|
-
/* @__PURE__ */
|
|
1925
|
+
/* @__PURE__ */ jsxs4(
|
|
1629
1926
|
"button",
|
|
1630
1927
|
{
|
|
1631
1928
|
onClick: startNew,
|
|
@@ -1637,13 +1934,57 @@ function CollectionEditor({ collection }) {
|
|
|
1637
1934
|
}
|
|
1638
1935
|
)
|
|
1639
1936
|
] }),
|
|
1640
|
-
editing && /* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1937
|
+
!editing && (collection.searchBy?.length || collection.filterBy?.length) && /* @__PURE__ */ jsxs4("div", { className: "mb-6 flex flex-wrap gap-4 items-center p-4 bg-white rounded-2xl border border-slate-200 shadow-sm animate-in fade-in slide-in-from-top-2", children: [
|
|
1938
|
+
collection.searchBy?.length ? /* @__PURE__ */ jsxs4("div", { className: "relative flex-1 min-w-[200px]", children: [
|
|
1939
|
+
/* @__PURE__ */ jsx5(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
|
|
1940
|
+
/* @__PURE__ */ jsx5(
|
|
1941
|
+
"input",
|
|
1942
|
+
{
|
|
1943
|
+
type: "text",
|
|
1944
|
+
placeholder: `Search by ${collection.searchBy.join(", ")}...`,
|
|
1945
|
+
value: search,
|
|
1946
|
+
onChange: (e) => {
|
|
1947
|
+
setSearch(e.target.value);
|
|
1948
|
+
setPage(1);
|
|
1949
|
+
},
|
|
1950
|
+
className: "w-full rounded-xl border border-slate-200 bg-slate-50 py-2.5 pl-10 pr-4 text-sm focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-500/10 outline-none transition-all"
|
|
1951
|
+
}
|
|
1952
|
+
)
|
|
1953
|
+
] }) : null,
|
|
1954
|
+
collection.filterBy?.map((f) => {
|
|
1955
|
+
const fieldDef = collection.fields.find((cf) => cf.id === f);
|
|
1956
|
+
const uniqueVals = Array.from(new Set(entries.map((e) => String(e[f] || "")))).filter(Boolean);
|
|
1957
|
+
if (!fieldDef || uniqueVals.length === 0) return null;
|
|
1958
|
+
return /* @__PURE__ */ jsxs4("div", { className: "min-w-[150px] relative", children: [
|
|
1959
|
+
/* @__PURE__ */ jsxs4(
|
|
1960
|
+
"select",
|
|
1961
|
+
{
|
|
1962
|
+
value: filters[f] || "",
|
|
1963
|
+
onChange: (e) => {
|
|
1964
|
+
setFilters((prev) => ({ ...prev, [f]: e.target.value }));
|
|
1965
|
+
setPage(1);
|
|
1966
|
+
},
|
|
1967
|
+
className: "w-full rounded-xl border border-slate-200 bg-slate-50 py-2.5 px-4 pr-10 text-sm focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-500/10 outline-none transition-all appearance-none",
|
|
1968
|
+
children: [
|
|
1969
|
+
/* @__PURE__ */ jsxs4("option", { value: "", children: [
|
|
1970
|
+
"All ",
|
|
1971
|
+
fieldDef.label
|
|
1972
|
+
] }),
|
|
1973
|
+
uniqueVals.map((v) => /* @__PURE__ */ jsx5("option", { value: v, children: v }, v))
|
|
1974
|
+
]
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
/* @__PURE__ */ jsx5(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
|
|
1978
|
+
] }, f);
|
|
1979
|
+
})
|
|
1980
|
+
] }),
|
|
1981
|
+
editing && /* @__PURE__ */ jsxs4("div", { className: "mb-8 rounded-2xl border border-indigo-100 bg-white p-6 shadow-xl shadow-indigo-100/50 animate-in fade-in slide-in-from-top-4", children: [
|
|
1982
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-6", children: [
|
|
1642
1983
|
/* @__PURE__ */ jsx5("div", { className: "w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-600", children: /* @__PURE__ */ jsx5(Pencil, { className: "w-4 h-4" }) }),
|
|
1643
1984
|
/* @__PURE__ */ jsx5("h3", { className: "text-lg font-bold text-slate-900", children: "Edit Entry" })
|
|
1644
1985
|
] }),
|
|
1645
|
-
/* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order").map((f) => /* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ jsx5("div", { className: "grid gap-5 md:grid-cols-2", children: collection.fields.filter((f) => f.id !== "order" && !f.hidden).map((f) => /* @__PURE__ */ jsxs4("label", { className: `block ${f.type === "richtext" ? "md:col-span-2" : ""}`, children: [
|
|
1987
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-xs font-bold text-slate-500 uppercase tracking-wide flex items-center justify-between mb-1.5", children: [
|
|
1647
1988
|
f.label,
|
|
1648
1989
|
/* @__PURE__ */ jsx5("span", { className: "text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded", children: f.type })
|
|
1649
1990
|
] }),
|
|
@@ -1680,7 +2021,7 @@ function CollectionEditor({ collection }) {
|
|
|
1680
2021
|
placeholder: `Search ${f.label.toLowerCase()}...`,
|
|
1681
2022
|
iconMap: ctx.iconMap
|
|
1682
2023
|
}
|
|
1683
|
-
) : f.type === "slug" ? /* @__PURE__ */
|
|
2024
|
+
) : f.type === "slug" ? /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1684
2025
|
/* @__PURE__ */ jsx5(
|
|
1685
2026
|
"input",
|
|
1686
2027
|
{
|
|
@@ -1704,7 +2045,15 @@ function CollectionEditor({ collection }) {
|
|
|
1704
2045
|
children: "Generate"
|
|
1705
2046
|
}
|
|
1706
2047
|
)
|
|
1707
|
-
] }) : f.type === "
|
|
2048
|
+
] }) : f.type === "reference" ? /* @__PURE__ */ jsx5(
|
|
2049
|
+
ReferenceSelect,
|
|
2050
|
+
{
|
|
2051
|
+
collectionId: f.collection,
|
|
2052
|
+
displayField: f.displayField,
|
|
2053
|
+
value: String(editing[f.id] ?? ""),
|
|
2054
|
+
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
2055
|
+
}
|
|
2056
|
+
) : f.type === "select" ? /* @__PURE__ */ jsxs4("div", { children: [
|
|
1708
2057
|
/* @__PURE__ */ jsx5(
|
|
1709
2058
|
"input",
|
|
1710
2059
|
{
|
|
@@ -1719,8 +2068,72 @@ function CollectionEditor({ collection }) {
|
|
|
1719
2068
|
const lab = typeof opt === "string" ? opt : opt.label;
|
|
1720
2069
|
return /* @__PURE__ */ jsx5("option", { value: val, children: lab }, val);
|
|
1721
2070
|
}) })
|
|
1722
|
-
] }) : f.type === "image" ? /* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
2071
|
+
] }) : f.type === "image" ? f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
2072
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-wrap gap-3", children: (editing[f.id] || []).map((url, i) => /* @__PURE__ */ jsxs4("div", { className: "rounded-xl border border-slate-200 p-1 bg-slate-50 overflow-hidden relative group w-32 h-32", children: [
|
|
2073
|
+
/* @__PURE__ */ jsx5("img", { src: url, alt: "", className: "w-full h-full object-cover rounded-lg" }),
|
|
2074
|
+
/* @__PURE__ */ jsx5(
|
|
2075
|
+
"button",
|
|
2076
|
+
{
|
|
2077
|
+
type: "button",
|
|
2078
|
+
onClick: () => {
|
|
2079
|
+
const arr = [...editing[f.id] || []];
|
|
2080
|
+
arr.splice(i, 1);
|
|
2081
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2082
|
+
},
|
|
2083
|
+
className: "absolute top-2 right-2 bg-red-500/80 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500",
|
|
2084
|
+
children: /* @__PURE__ */ jsx5(X, { className: "w-3 h-3" })
|
|
2085
|
+
}
|
|
2086
|
+
)
|
|
2087
|
+
] }, i)) }),
|
|
2088
|
+
(!f.max || (editing[f.id] || []).length < f.max) && /* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
2089
|
+
/* @__PURE__ */ jsx5(
|
|
2090
|
+
"input",
|
|
2091
|
+
{
|
|
2092
|
+
type: "url",
|
|
2093
|
+
placeholder: "Add image URL and press Enter...",
|
|
2094
|
+
onKeyDown: (e) => {
|
|
2095
|
+
if (e.key === "Enter" && e.currentTarget.value) {
|
|
2096
|
+
e.preventDefault();
|
|
2097
|
+
const arr = [...editing[f.id] || [], e.currentTarget.value];
|
|
2098
|
+
setEditing({ ...editing, [f.id]: arr });
|
|
2099
|
+
e.currentTarget.value = "";
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
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"
|
|
2103
|
+
}
|
|
2104
|
+
),
|
|
2105
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
2106
|
+
"Upload",
|
|
2107
|
+
/* @__PURE__ */ jsx5(
|
|
2108
|
+
"input",
|
|
2109
|
+
{
|
|
2110
|
+
type: "file",
|
|
2111
|
+
accept: "image/*",
|
|
2112
|
+
multiple: true,
|
|
2113
|
+
className: "hidden",
|
|
2114
|
+
onChange: (e) => {
|
|
2115
|
+
const files = Array.from(e.target.files || []);
|
|
2116
|
+
files.forEach((file) => {
|
|
2117
|
+
void handleImageFile(
|
|
2118
|
+
file,
|
|
2119
|
+
(url) => {
|
|
2120
|
+
setEditing((prev) => {
|
|
2121
|
+
if (!prev) return prev;
|
|
2122
|
+
const current = prev[f.id] || [];
|
|
2123
|
+
if (f.max && current.length >= f.max) return prev;
|
|
2124
|
+
return { ...prev, [f.id]: [...current, url] };
|
|
2125
|
+
});
|
|
2126
|
+
},
|
|
2127
|
+
ctx.uploadImage
|
|
2128
|
+
);
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
)
|
|
2133
|
+
] })
|
|
2134
|
+
] })
|
|
2135
|
+
] }) : /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
2136
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2", children: [
|
|
1724
2137
|
/* @__PURE__ */ jsx5(
|
|
1725
2138
|
"input",
|
|
1726
2139
|
{
|
|
@@ -1731,7 +2144,7 @@ function CollectionEditor({ collection }) {
|
|
|
1731
2144
|
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"
|
|
1732
2145
|
}
|
|
1733
2146
|
),
|
|
1734
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsxs4("label", { className: "flex-shrink-0 cursor-pointer rounded-xl bg-slate-100 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-200 transition-colors border border-slate-200 flex items-center justify-center", children: [
|
|
1735
2148
|
"Upload",
|
|
1736
2149
|
/* @__PURE__ */ jsx5(
|
|
1737
2150
|
"input",
|
|
@@ -1767,7 +2180,7 @@ function CollectionEditor({ collection }) {
|
|
|
1767
2180
|
value: String(editing[f.id] ?? ""),
|
|
1768
2181
|
onChange: (val) => setEditing({ ...editing, [f.id]: val })
|
|
1769
2182
|
}
|
|
1770
|
-
) : f.type === "color" && !f.multiple ? /* @__PURE__ */
|
|
2183
|
+
) : f.type === "color" && !f.multiple ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
1771
2184
|
/* @__PURE__ */ jsx5(
|
|
1772
2185
|
"input",
|
|
1773
2186
|
{
|
|
@@ -1794,11 +2207,11 @@ function CollectionEditor({ collection }) {
|
|
|
1794
2207
|
style: { backgroundColor: String(editing[f.id] ?? "#000000") }
|
|
1795
2208
|
}
|
|
1796
2209
|
)
|
|
1797
|
-
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */
|
|
2210
|
+
] }) : f.type === "color" && f.multiple || f.type === "list" && f.id === "colors" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
1798
2211
|
(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) => {
|
|
1799
2212
|
const colorVal = String(item ?? "").trim();
|
|
1800
2213
|
const validHex = colorVal.startsWith("#") && (colorVal.length === 4 || colorVal.length === 7) ? colorVal : "#000000";
|
|
1801
|
-
return /* @__PURE__ */
|
|
2214
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
|
|
1802
2215
|
/* @__PURE__ */ jsx5(
|
|
1803
2216
|
"input",
|
|
1804
2217
|
{
|
|
@@ -1848,7 +2261,7 @@ function CollectionEditor({ collection }) {
|
|
|
1848
2261
|
)
|
|
1849
2262
|
] }, idx);
|
|
1850
2263
|
}),
|
|
1851
|
-
/* @__PURE__ */
|
|
2264
|
+
/* @__PURE__ */ jsxs4(
|
|
1852
2265
|
"button",
|
|
1853
2266
|
{
|
|
1854
2267
|
type: "button",
|
|
@@ -1864,8 +2277,8 @@ function CollectionEditor({ collection }) {
|
|
|
1864
2277
|
]
|
|
1865
2278
|
}
|
|
1866
2279
|
)
|
|
1867
|
-
] }) : f.type === "list" ? /* @__PURE__ */
|
|
1868
|
-
(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__ */
|
|
2280
|
+
] }) : f.type === "list" ? /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
2281
|
+
(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__ */ jsxs4("div", { className: "flex gap-2 items-center", children: [
|
|
1869
2282
|
/* @__PURE__ */ jsx5(
|
|
1870
2283
|
"input",
|
|
1871
2284
|
{
|
|
@@ -1893,7 +2306,7 @@ function CollectionEditor({ collection }) {
|
|
|
1893
2306
|
}
|
|
1894
2307
|
)
|
|
1895
2308
|
] }, idx)),
|
|
1896
|
-
/* @__PURE__ */
|
|
2309
|
+
/* @__PURE__ */ jsxs4(
|
|
1897
2310
|
"button",
|
|
1898
2311
|
{
|
|
1899
2312
|
type: "button",
|
|
@@ -1918,7 +2331,7 @@ function CollectionEditor({ collection }) {
|
|
|
1918
2331
|
}
|
|
1919
2332
|
)
|
|
1920
2333
|
] }, f.id)) }),
|
|
1921
|
-
/* @__PURE__ */
|
|
2334
|
+
/* @__PURE__ */ jsxs4("div", { className: "mt-8 flex justify-end gap-3 pt-5 border-t border-slate-100", children: [
|
|
1922
2335
|
/* @__PURE__ */ jsx5(
|
|
1923
2336
|
"button",
|
|
1924
2337
|
{
|
|
@@ -1934,8 +2347,8 @@ function CollectionEditor({ collection }) {
|
|
|
1934
2347
|
onClick: save,
|
|
1935
2348
|
disabled: saving,
|
|
1936
2349
|
className: "inline-flex items-center gap-2 rounded-xl bg-slate-900 px-6 py-2.5 text-sm font-bold text-white shadow-sm hover:bg-slate-800 hover:shadow transition-all disabled:opacity-60",
|
|
1937
|
-
children: saving ? /* @__PURE__ */
|
|
1938
|
-
/* @__PURE__ */
|
|
2350
|
+
children: saving ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2351
|
+
/* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1939
2352
|
/* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1940
2353
|
/* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
1941
2354
|
] }),
|
|
@@ -1945,79 +2358,156 @@ function CollectionEditor({ collection }) {
|
|
|
1945
2358
|
)
|
|
1946
2359
|
] })
|
|
1947
2360
|
] }),
|
|
1948
|
-
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */
|
|
2361
|
+
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
|
|
2362
|
+
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200", children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
1950
2363
|
visibleFields.map((f) => /* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: f.label }, f.id)),
|
|
1951
2364
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
|
|
1952
2365
|
] }) }),
|
|
1953
2366
|
/* @__PURE__ */ jsx5("tbody", { className: "divide-y divide-slate-100", children: loadingEntries ? (
|
|
1954
2367
|
// Loading skeleton rows
|
|
1955
|
-
Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */
|
|
2368
|
+
Array.from({ length: 3 }).map((_, i) => /* @__PURE__ */ jsxs4("tr", { children: [
|
|
1956
2369
|
visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx5("div", { className: "h-4 bg-slate-100 rounded animate-pulse", style: { width: `${60 + i * 13 % 30}%` } }) }, f.id)),
|
|
1957
2370
|
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 sticky right-0 bg-white border-l border-slate-100", children: /* @__PURE__ */ jsx5("div", { className: "h-4 w-16 bg-slate-100 rounded animate-pulse ml-auto" }) })
|
|
1958
2371
|
] }, i))
|
|
1959
|
-
) : /* @__PURE__ */
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
{
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2372
|
+
) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2373
|
+
(() => {
|
|
2374
|
+
let res = entries;
|
|
2375
|
+
if (search && collection.searchBy?.length) {
|
|
2376
|
+
const q = search.toLowerCase();
|
|
2377
|
+
res = res.filter((e) => collection.searchBy.some((field) => String(e[field] || "").toLowerCase().includes(q)));
|
|
2378
|
+
}
|
|
2379
|
+
if (Object.keys(filters).length > 0) {
|
|
2380
|
+
res = res.filter((e) => {
|
|
2381
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
2382
|
+
if (v && String(e[k] || "") !== v) return false;
|
|
2383
|
+
}
|
|
2384
|
+
return true;
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
const paginatedRes = res.slice((page - 1) * itemsPerPage, page * itemsPerPage);
|
|
2388
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children: paginatedRes.map((e, idx) => /* @__PURE__ */ jsxs4(
|
|
2389
|
+
"tr",
|
|
2390
|
+
{
|
|
2391
|
+
draggable: true,
|
|
2392
|
+
onDragStart: (evt) => onDragStart(evt, idx),
|
|
2393
|
+
onDragOver: (evt) => onDragOver(evt, idx),
|
|
2394
|
+
onDrop: (evt) => onDrop(evt, idx),
|
|
2395
|
+
onDragEnd,
|
|
2396
|
+
className: `hover:bg-slate-50/50 transition-colors group cursor-grab active:cursor-grabbing ${deletingId === e.id ? "opacity-50" : ""} ${dragOverIdx === idx ? "border-t-2 border-t-indigo-500" : ""}`,
|
|
2397
|
+
children: [
|
|
2398
|
+
visibleFields.map((f) => /* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-700 max-w-[200px] truncate", children: f.type === "boolean" ? e[f.id] ? /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-green-100 text-green-700 text-xs font-bold", children: "Yes" }) : /* @__PURE__ */ jsx5("span", { className: "inline-flex px-2 py-1 rounded bg-slate-100 text-slate-500 text-xs font-bold", children: "No" }) : f.type === "image" && (Array.isArray(e[f.id]) ? e[f.id].length > 0 : !!e[f.id]) ? /* @__PURE__ */ jsx5("img", { src: Array.isArray(e[f.id]) ? String(e[f.id][0]) : String(e[f.id]), alt: "", className: "h-8 w-8 object-cover rounded shadow-sm ring-1 ring-slate-200" }) : f.type === "image" ? /* @__PURE__ */ jsx5("div", { className: "h-8 w-8 rounded bg-slate-100 ring-1 ring-slate-200/50 flex items-center justify-center text-slate-300", children: /* @__PURE__ */ jsx5("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }) : f.type === "reference" && e[f.id] ? /* @__PURE__ */ jsx5(ReferenceTableCell, { collectionId: f.collection, entryId: String(e[f.id]), displayField: f.displayField }) : String(e[f.id] ?? "") }, f.id)),
|
|
2399
|
+
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-2", children: [
|
|
2400
|
+
/* @__PURE__ */ jsx5("div", { className: "p-2 text-slate-300 cursor-grab active:cursor-grabbing", title: "Drag to reorder", children: /* @__PURE__ */ jsx5("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "w-4 h-4", children: /* @__PURE__ */ jsx5("path", { d: "M5.5 3C6.32843 3 7 3.67157 7 4.5C7 5.32843 6.32843 6 5.5 6C4.67157 6 4 5.32843 4 4.5C4 3.67157 4.67157 3 5.5 3ZM9.5 3C10.3284 3 11 3.67157 11 4.5C11 5.32843 10.3284 6 9.5 6C8.67157 6 8 5.32843 8 4.5C8 3.67157 8.67157 3 9.5 3ZM5.5 7.5C6.32843 7.5 7 8.17157 7 9C7 9.82843 6.32843 10.5 5.5 10.5C4.67157 10.5 4 9.82843 4 9C4 8.17157 4.67157 7.5 5.5 7.5ZM9.5 7.5C10.3284 7.5 11 8.17157 11 9C11 9.82843 10.3284 10.5 9.5 10.5C8.67157 10.5 8 9.82843 8 9C8 8.17157 8.67157 7.5 9.5 7.5ZM5.5 12C6.32843 12 7 12.6716 7 13.5C7 14.3284 6.32843 15 5.5 15C4.67157 15 4 14.3284 4 13.5C4 12.6716 4.67157 12 5.5 12ZM9.5 12C10.3284 12 11 12.6716 11 13.5C11 14.3284 10.3284 15 9.5 15C8.67157 15 8 14.3284 8 13.5C8 12.6716 8.67157 12 9.5 12Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }) }),
|
|
2401
|
+
/* @__PURE__ */ jsx5(
|
|
2402
|
+
"button",
|
|
2403
|
+
{
|
|
2404
|
+
onClick: () => setEditing(e),
|
|
2405
|
+
className: "p-2 rounded-lg text-slate-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",
|
|
2406
|
+
title: "Edit",
|
|
2407
|
+
children: /* @__PURE__ */ jsx5(Pencil, { className: "h-4 w-4" })
|
|
2408
|
+
}
|
|
2409
|
+
),
|
|
2410
|
+
/* @__PURE__ */ jsx5(
|
|
2411
|
+
"button",
|
|
2412
|
+
{
|
|
2413
|
+
onClick: () => remove(e.id),
|
|
2414
|
+
disabled: deletingId === e.id,
|
|
2415
|
+
className: "p-2 rounded-lg text-slate-400 hover:text-red-600 hover:bg-red-50 transition-colors disabled:opacity-50",
|
|
2416
|
+
title: "Delete",
|
|
2417
|
+
children: deletingId === e.id ? /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2418
|
+
/* @__PURE__ */ jsx5("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2419
|
+
/* @__PURE__ */ jsx5("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })
|
|
2420
|
+
] }) : /* @__PURE__ */ jsx5(Trash2, { className: "h-4 w-4" })
|
|
2421
|
+
}
|
|
2422
|
+
)
|
|
2423
|
+
] }) })
|
|
2424
|
+
]
|
|
2425
|
+
},
|
|
2426
|
+
e.id
|
|
2427
|
+
)) });
|
|
2428
|
+
})(),
|
|
2429
|
+
entries.length === 0 && !search && Object.values(filters).every((v) => !v) && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5(
|
|
2001
2430
|
"td",
|
|
2002
2431
|
{
|
|
2003
2432
|
colSpan: visibleFields.length + 1,
|
|
2004
2433
|
className: "px-6 py-12 text-center text-slate-500",
|
|
2005
|
-
children: /* @__PURE__ */
|
|
2434
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center", children: [
|
|
2006
2435
|
/* @__PURE__ */ jsx5(Boxes, { className: "h-10 w-10 text-slate-300 mb-3" }),
|
|
2007
2436
|
/* @__PURE__ */ jsx5("p", { children: 'No entries yet. Click "New Entry" to create one.' })
|
|
2008
2437
|
] })
|
|
2009
2438
|
}
|
|
2010
2439
|
) })
|
|
2011
2440
|
] }) })
|
|
2012
|
-
] }) })
|
|
2441
|
+
] }) }),
|
|
2442
|
+
!loadingEntries && entries.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500 mt-4 px-2", children: [
|
|
2443
|
+
/* @__PURE__ */ jsx5("span", { children: (() => {
|
|
2444
|
+
let res = entries;
|
|
2445
|
+
if (search && collection.searchBy?.length) {
|
|
2446
|
+
const q = search.toLowerCase();
|
|
2447
|
+
res = res.filter((e) => collection.searchBy.some((field) => String(e[field] || "").toLowerCase().includes(q)));
|
|
2448
|
+
}
|
|
2449
|
+
if (Object.keys(filters).length > 0) {
|
|
2450
|
+
res = res.filter((e) => {
|
|
2451
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
2452
|
+
if (v && String(e[k] || "") !== v) return false;
|
|
2453
|
+
}
|
|
2454
|
+
return true;
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
return `${res.length} item${res.length !== 1 ? "s" : ""}`;
|
|
2458
|
+
})() }),
|
|
2459
|
+
(() => {
|
|
2460
|
+
let res = entries;
|
|
2461
|
+
if (search && collection.searchBy?.length) {
|
|
2462
|
+
const q = search.toLowerCase();
|
|
2463
|
+
res = res.filter((e) => collection.searchBy.some((field) => String(e[field] || "").toLowerCase().includes(q)));
|
|
2464
|
+
}
|
|
2465
|
+
if (Object.keys(filters).length > 0) {
|
|
2466
|
+
res = res.filter((e) => {
|
|
2467
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
2468
|
+
if (v && String(e[k] || "") !== v) return false;
|
|
2469
|
+
}
|
|
2470
|
+
return true;
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
const totalPages = Math.max(1, Math.ceil(res.length / itemsPerPage));
|
|
2474
|
+
if (totalPages <= 1) return null;
|
|
2475
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2476
|
+
/* @__PURE__ */ jsx5(
|
|
2477
|
+
"button",
|
|
2478
|
+
{
|
|
2479
|
+
onClick: () => setPage((p) => Math.max(1, p - 1)),
|
|
2480
|
+
disabled: page === 1,
|
|
2481
|
+
className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
|
|
2482
|
+
children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
|
|
2483
|
+
}
|
|
2484
|
+
),
|
|
2485
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
|
|
2486
|
+
"Page ",
|
|
2487
|
+
page,
|
|
2488
|
+
" of ",
|
|
2489
|
+
totalPages
|
|
2490
|
+
] }),
|
|
2491
|
+
/* @__PURE__ */ jsx5(
|
|
2492
|
+
"button",
|
|
2493
|
+
{
|
|
2494
|
+
onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
|
|
2495
|
+
disabled: page === totalPages,
|
|
2496
|
+
className: "p-2 rounded-lg hover:bg-slate-100 disabled:opacity-30 transition-colors",
|
|
2497
|
+
children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
|
|
2498
|
+
}
|
|
2499
|
+
)
|
|
2500
|
+
] });
|
|
2501
|
+
})()
|
|
2502
|
+
] })
|
|
2013
2503
|
] });
|
|
2014
2504
|
}
|
|
2015
2505
|
var PAGE_SIZE = 10;
|
|
2016
2506
|
function SubmissionsSection() {
|
|
2017
2507
|
const ctx = useCmsContext();
|
|
2018
|
-
const [submissions, setSubmissions] =
|
|
2019
|
-
const [loading, setLoading] =
|
|
2020
|
-
const [selectedFormId, setSelectedFormId] =
|
|
2508
|
+
const [submissions, setSubmissions] = useState5([]);
|
|
2509
|
+
const [loading, setLoading] = useState5(false);
|
|
2510
|
+
const [selectedFormId, setSelectedFormId] = useState5(null);
|
|
2021
2511
|
const load = useCallback3(async () => {
|
|
2022
2512
|
setLoading(true);
|
|
2023
2513
|
const all = await ctx.adapter.listSubmissions();
|
|
@@ -2033,18 +2523,18 @@ function SubmissionsSection() {
|
|
|
2033
2523
|
setSelectedFormId(formIds[0]);
|
|
2034
2524
|
}
|
|
2035
2525
|
}, [formIds, selectedFormId]);
|
|
2036
|
-
return /* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col md:flex-row h-full bg-slate-50", children: [
|
|
2527
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-slate-200 bg-white/50 p-4", children: [
|
|
2038
2528
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500", children: "Data Collections" }),
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex overflow-x-auto gap-2 pb-2 md:block md:space-x-0 md:space-y-1 md:pb-0 md:overflow-visible", children: [
|
|
2530
|
+
formIds.map((id) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 min-w-[140px] md:w-full md:min-w-0", children: /* @__PURE__ */ jsxs4(
|
|
2041
2531
|
"button",
|
|
2042
2532
|
{
|
|
2043
2533
|
onClick: () => setSelectedFormId(id),
|
|
2044
2534
|
className: `w-full rounded-lg px-3 py-2.5 text-left text-sm transition-all duration-200 ${selectedFormId === id ? "bg-white shadow-sm ring-1 ring-slate-200 font-semibold" : "hover:bg-slate-100"}`,
|
|
2045
2535
|
children: [
|
|
2046
2536
|
/* @__PURE__ */ jsx5("div", { className: selectedFormId === id ? "text-slate-900" : "text-slate-700 capitalize", children: id }),
|
|
2047
|
-
/* @__PURE__ */
|
|
2537
|
+
/* @__PURE__ */ jsxs4("div", { className: `text-xs mt-0.5 ${selectedFormId === id ? "text-indigo-500" : "text-slate-400"}`, children: [
|
|
2048
2538
|
submissions.filter((s) => s.formId === id).length,
|
|
2049
2539
|
" items"
|
|
2050
2540
|
] })
|
|
@@ -2054,7 +2544,7 @@ function SubmissionsSection() {
|
|
|
2054
2544
|
formIds.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200", children: "No data collected." })
|
|
2055
2545
|
] })
|
|
2056
2546
|
] }),
|
|
2057
|
-
/* @__PURE__ */
|
|
2547
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 overflow-auto p-4 md:p-8 relative", children: [
|
|
2058
2548
|
/* @__PURE__ */ jsx5("div", { className: "absolute inset-0 bg-grid-slate-100 [mask-image:linear-gradient(0deg,white,rgba(255,255,255,0.6))] -z-10 pointer-events-none" }),
|
|
2059
2549
|
selectedFormId ? /* @__PURE__ */ jsx5(
|
|
2060
2550
|
SubmissionsList,
|
|
@@ -2071,9 +2561,9 @@ function SubmissionsSection() {
|
|
|
2071
2561
|
}
|
|
2072
2562
|
function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
2073
2563
|
const ctx = useCmsContext();
|
|
2074
|
-
const [search, setSearch] =
|
|
2075
|
-
const [page, setPage] =
|
|
2076
|
-
const [detail, setDetail] =
|
|
2564
|
+
const [search, setSearch] = useState5("");
|
|
2565
|
+
const [page, setPage] = useState5(1);
|
|
2566
|
+
const [detail, setDetail] = useState5(null);
|
|
2077
2567
|
const filtered = submissions.filter((s) => {
|
|
2078
2568
|
const q = search.toLowerCase();
|
|
2079
2569
|
if (!q) return true;
|
|
@@ -2103,8 +2593,8 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2103
2593
|
}
|
|
2104
2594
|
};
|
|
2105
2595
|
if (detail) {
|
|
2106
|
-
return /* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2596
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
|
|
2597
|
+
/* @__PURE__ */ jsxs4(
|
|
2108
2598
|
"button",
|
|
2109
2599
|
{
|
|
2110
2600
|
onClick: () => setDetail(null),
|
|
@@ -2115,9 +2605,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2115
2605
|
]
|
|
2116
2606
|
}
|
|
2117
2607
|
),
|
|
2118
|
-
/* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
|
|
2609
|
+
/* @__PURE__ */ jsx5("div", { className: "px-8 py-6 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
2610
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2121
2611
|
/* @__PURE__ */ jsx5("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-indigo-100 px-3 py-1 text-xs font-bold text-indigo-700 mb-2 capitalize", children: detail.formId }),
|
|
2122
2612
|
/* @__PURE__ */ jsx5("p", { className: "text-xs text-slate-400", children: formatDate(detail.submittedAt) })
|
|
2123
2613
|
] }),
|
|
@@ -2135,9 +2625,9 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2135
2625
|
const strVal = String(val ?? "\u2014");
|
|
2136
2626
|
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"));
|
|
2137
2627
|
const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
|
|
2138
|
-
return /* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ jsxs4("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
|
|
2139
2629
|
/* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
|
|
2140
|
-
/* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
2141
2631
|
/* @__PURE__ */ jsx5(
|
|
2142
2632
|
"a",
|
|
2143
2633
|
{
|
|
@@ -2155,7 +2645,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2155
2645
|
)
|
|
2156
2646
|
}
|
|
2157
2647
|
),
|
|
2158
|
-
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs4(
|
|
2159
2649
|
"a",
|
|
2160
2650
|
{
|
|
2161
2651
|
href: strVal,
|
|
@@ -2168,7 +2658,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2168
2658
|
]
|
|
2169
2659
|
}
|
|
2170
2660
|
) })
|
|
2171
|
-
] }) : isUrl ? /* @__PURE__ */
|
|
2661
|
+
] }) : isUrl ? /* @__PURE__ */ jsxs4(
|
|
2172
2662
|
"a",
|
|
2173
2663
|
{
|
|
2174
2664
|
href: strVal,
|
|
@@ -2187,16 +2677,16 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2187
2677
|
] })
|
|
2188
2678
|
] });
|
|
2189
2679
|
}
|
|
2190
|
-
return /* @__PURE__ */
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2680
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-5xl flex flex-col h-full gap-6", children: [
|
|
2681
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between", children: [
|
|
2682
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2683
|
+
/* @__PURE__ */ jsxs4("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight flex items-center gap-3 capitalize", children: [
|
|
2194
2684
|
formId,
|
|
2195
2685
|
unreadCount > 0 && /* @__PURE__ */ jsx5("span", { className: "inline-flex h-6 min-w-[24px] items-center justify-center rounded-full bg-indigo-600 px-2 text-xs font-bold text-white", children: unreadCount })
|
|
2196
2686
|
] }),
|
|
2197
2687
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Data received for this collection." })
|
|
2198
2688
|
] }),
|
|
2199
|
-
/* @__PURE__ */
|
|
2689
|
+
/* @__PURE__ */ jsxs4(
|
|
2200
2690
|
"button",
|
|
2201
2691
|
{
|
|
2202
2692
|
onClick: onLoad,
|
|
@@ -2209,7 +2699,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2209
2699
|
}
|
|
2210
2700
|
)
|
|
2211
2701
|
] }),
|
|
2212
|
-
/* @__PURE__ */
|
|
2702
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2213
2703
|
/* @__PURE__ */ jsx5(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" }),
|
|
2214
2704
|
/* @__PURE__ */ jsx5(
|
|
2215
2705
|
"input",
|
|
@@ -2224,28 +2714,28 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2224
2714
|
}
|
|
2225
2715
|
)
|
|
2226
2716
|
] }),
|
|
2227
|
-
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */
|
|
2228
|
-
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */
|
|
2717
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-x-auto rounded-2xl border border-slate-200 bg-white shadow-sm", children: /* @__PURE__ */ jsxs4("table", { className: "w-full text-sm text-left", children: [
|
|
2718
|
+
/* @__PURE__ */ jsx5("thead", { className: "bg-slate-50/80 border-b border-slate-200 sticky top-0", children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2229
2719
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Summary" }),
|
|
2230
2720
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-xs font-bold text-slate-500 uppercase tracking-wider", children: "Received" }),
|
|
2231
2721
|
/* @__PURE__ */ jsx5("th", { className: "px-6 py-4 text-right text-xs font-bold text-slate-500 uppercase tracking-wider sticky right-0 bg-slate-50 border-l border-slate-200 z-10", children: "Actions" })
|
|
2232
2722
|
] }) }),
|
|
2233
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ jsxs4("tbody", { className: "divide-y divide-slate-100", children: [
|
|
2234
2724
|
paginated.map((s) => {
|
|
2235
2725
|
const firstVal = Object.values(s.data)[0];
|
|
2236
2726
|
const preview = firstVal ? String(firstVal).slice(0, 60) : "\u2014";
|
|
2237
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ jsxs4(
|
|
2238
2728
|
"tr",
|
|
2239
2729
|
{
|
|
2240
2730
|
className: `hover:bg-slate-50/50 transition-colors group cursor-pointer ${!s.read ? "bg-indigo-50/40" : ""}`,
|
|
2241
2731
|
onClick: () => openDetail(s),
|
|
2242
2732
|
children: [
|
|
2243
|
-
/* @__PURE__ */
|
|
2733
|
+
/* @__PURE__ */ jsxs4("td", { className: "px-6 py-4", children: [
|
|
2244
2734
|
/* @__PURE__ */ jsx5("span", { className: "text-slate-600 max-w-[400px] truncate block", children: preview }),
|
|
2245
2735
|
!s.read && /* @__PURE__ */ jsx5("span", { className: "ml-2 inline-block h-2 w-2 rounded-full bg-indigo-500" })
|
|
2246
2736
|
] }),
|
|
2247
2737
|
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-slate-500 whitespace-nowrap", children: formatDate(s.submittedAt) }),
|
|
2248
|
-
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ jsx5("td", { className: "px-6 py-4 text-right sticky right-0 bg-white border-l border-slate-100 group-hover:bg-slate-50/50 transition-colors", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-1", children: [
|
|
2249
2739
|
/* @__PURE__ */ jsx5(
|
|
2250
2740
|
"button",
|
|
2251
2741
|
{
|
|
@@ -2270,19 +2760,19 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2270
2760
|
s.id
|
|
2271
2761
|
);
|
|
2272
2762
|
}),
|
|
2273
|
-
paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */
|
|
2763
|
+
paginated.length === 0 && /* @__PURE__ */ jsx5("tr", { children: /* @__PURE__ */ jsx5("td", { colSpan: 3, className: "px-6 py-16 text-center", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-3 text-slate-400", children: [
|
|
2274
2764
|
/* @__PURE__ */ jsx5(Inbox, { className: "h-12 w-12 text-slate-200" }),
|
|
2275
2765
|
/* @__PURE__ */ jsx5("p", { className: "text-sm font-medium", children: search ? "No matches." : "No data yet." })
|
|
2276
2766
|
] }) }) })
|
|
2277
2767
|
] })
|
|
2278
2768
|
] }) }),
|
|
2279
|
-
totalPages > 1 && /* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2769
|
+
totalPages > 1 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between text-sm text-slate-500", children: [
|
|
2770
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2281
2771
|
filtered.length,
|
|
2282
2772
|
" item",
|
|
2283
2773
|
filtered.length !== 1 ? "s" : ""
|
|
2284
2774
|
] }),
|
|
2285
|
-
/* @__PURE__ */
|
|
2775
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2286
2776
|
/* @__PURE__ */ jsx5(
|
|
2287
2777
|
"button",
|
|
2288
2778
|
{
|
|
@@ -2292,7 +2782,7 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2292
2782
|
children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
|
|
2293
2783
|
}
|
|
2294
2784
|
),
|
|
2295
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-medium text-slate-700", children: [
|
|
2296
2786
|
"Page ",
|
|
2297
2787
|
page,
|
|
2298
2788
|
" of ",
|
|
@@ -2313,14 +2803,14 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
|
|
|
2313
2803
|
}
|
|
2314
2804
|
function SettingsSection() {
|
|
2315
2805
|
const ctx = useCmsContext();
|
|
2316
|
-
return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2806
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex h-full bg-slate-50 p-8 overflow-y-auto", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl space-y-8", children: [
|
|
2807
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2318
2808
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "System Settings" }),
|
|
2319
2809
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Current configuration and statistics for your CMS instance." })
|
|
2320
2810
|
] }),
|
|
2321
|
-
/* @__PURE__ */
|
|
2811
|
+
/* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden", children: [
|
|
2322
2812
|
/* @__PURE__ */ jsx5("div", { className: "px-6 py-4 border-b border-slate-100 bg-slate-50/50", children: /* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800", children: "Configuration Snapshot" }) }),
|
|
2323
|
-
/* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ jsxs4("dl", { className: "divide-y divide-slate-100 text-sm", children: [
|
|
2324
2814
|
/* @__PURE__ */ jsx5(Row, { label: "Site Name", value: ctx.config.siteName ?? "\u2014" }),
|
|
2325
2815
|
/* @__PURE__ */ jsx5(Row, { label: "Active Storage Adapter", value: ctx.adapter.name, highlight: true }),
|
|
2326
2816
|
/* @__PURE__ */ jsx5(Row, { label: "Registered Pages", value: String(ctx.config.pages.length) }),
|
|
@@ -2353,7 +2843,7 @@ function SettingsSection() {
|
|
|
2353
2843
|
function ConfigSection() {
|
|
2354
2844
|
const ctx = useCmsContext();
|
|
2355
2845
|
const globals = ctx.config.globals ?? [];
|
|
2356
|
-
const [selectedGroupId, setSelectedGroupId] =
|
|
2846
|
+
const [selectedGroupId, setSelectedGroupId] = useState5(
|
|
2357
2847
|
globals[0]?.id ?? null
|
|
2358
2848
|
);
|
|
2359
2849
|
const selectedGroup = globals.find((g) => g.id === selectedGroupId) ?? null;
|
|
@@ -2363,10 +2853,10 @@ function ConfigSection() {
|
|
|
2363
2853
|
},
|
|
2364
2854
|
[ctx]
|
|
2365
2855
|
);
|
|
2366
|
-
return /* @__PURE__ */
|
|
2367
|
-
/* @__PURE__ */
|
|
2856
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col lg:flex-row h-full", children: [
|
|
2857
|
+
/* @__PURE__ */ jsxs4("div", { className: "w-full lg:w-72 shrink-0 border-b lg:border-b-0 lg:border-r border-slate-200 bg-white/50 p-3 lg:p-4 overflow-x-auto lg:overflow-y-auto hide-scrollbar", children: [
|
|
2368
2858
|
/* @__PURE__ */ jsx5("div", { className: "mb-3 px-2 text-xs font-bold uppercase tracking-widest text-slate-500 hidden lg:block", children: "Configuration Groups" }),
|
|
2369
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsxs4("ul", { className: "flex flex-row lg:flex-col space-x-2 lg:space-x-0 lg:space-y-1", children: [
|
|
2370
2860
|
globals.map((g) => /* @__PURE__ */ jsx5("li", { className: "shrink-0 w-32 lg:w-full", children: /* @__PURE__ */ jsx5(
|
|
2371
2861
|
"button",
|
|
2372
2862
|
{
|
|
@@ -2378,14 +2868,14 @@ function ConfigSection() {
|
|
|
2378
2868
|
globals.length === 0 && /* @__PURE__ */ jsx5("li", { className: "px-3 py-6 text-center text-sm text-slate-500 bg-slate-50 rounded-lg border border-dashed border-slate-200 w-full", children: "No global configurations." })
|
|
2379
2869
|
] })
|
|
2380
2870
|
] }),
|
|
2381
|
-
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-1 overflow-auto bg-slate-50 p-6 lg:p-10 relative", children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto w-full max-w-2xl", children: [
|
|
2872
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between mb-8", children: [
|
|
2873
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2384
2874
|
/* @__PURE__ */ jsx5("h2", { className: "text-2xl font-bold text-slate-900 tracking-tight", children: "Configuration" }),
|
|
2385
2875
|
/* @__PURE__ */ jsx5("p", { className: "text-sm text-slate-500 mt-1", children: "Edit global content like headers and footers." })
|
|
2386
2876
|
] }),
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2877
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
2878
|
+
/* @__PURE__ */ jsxs4(
|
|
2389
2879
|
"button",
|
|
2390
2880
|
{
|
|
2391
2881
|
onClick: () => ctx.reset(),
|
|
@@ -2397,7 +2887,7 @@ function ConfigSection() {
|
|
|
2397
2887
|
]
|
|
2398
2888
|
}
|
|
2399
2889
|
),
|
|
2400
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsxs4(
|
|
2401
2891
|
"button",
|
|
2402
2892
|
{
|
|
2403
2893
|
onClick: () => ctx.save(),
|
|
@@ -2411,7 +2901,7 @@ function ConfigSection() {
|
|
|
2411
2901
|
)
|
|
2412
2902
|
] })
|
|
2413
2903
|
] }),
|
|
2414
|
-
selectedGroup ? /* @__PURE__ */
|
|
2904
|
+
selectedGroup ? /* @__PURE__ */ jsxs4("div", { className: "space-y-4", children: [
|
|
2415
2905
|
/* @__PURE__ */ jsx5("h3", { className: "font-bold text-slate-800 text-lg", children: selectedGroup.label }),
|
|
2416
2906
|
/* @__PURE__ */ jsx5("div", { className: "rounded-2xl border border-slate-200 bg-white shadow-sm overflow-hidden divide-y divide-slate-100", children: selectedGroup.fields.map((field) => /* @__PURE__ */ jsx5("div", { className: "p-4", children: /* @__PURE__ */ jsx5(
|
|
2417
2907
|
FieldEditor,
|
|
@@ -2424,7 +2914,7 @@ function ConfigSection() {
|
|
|
2424
2914
|
}
|
|
2425
2915
|
}
|
|
2426
2916
|
) }, field.id)) })
|
|
2427
|
-
] }) : /* @__PURE__ */
|
|
2917
|
+
] }) : /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center justify-center p-16 text-center border-2 border-dashed border-slate-200 rounded-2xl bg-white/50", children: [
|
|
2428
2918
|
/* @__PURE__ */ jsx5(SettingsIcon, { className: "w-12 h-12 text-slate-300 mb-4" }),
|
|
2429
2919
|
/* @__PURE__ */ jsx5("p", { className: "text-slate-500 font-medium", children: "Select a setting group on the left to edit." })
|
|
2430
2920
|
] })
|
|
@@ -2437,19 +2927,19 @@ function Row({
|
|
|
2437
2927
|
highlight,
|
|
2438
2928
|
status
|
|
2439
2929
|
}) {
|
|
2440
|
-
return /* @__PURE__ */
|
|
2930
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-4 hover:bg-slate-50/50 transition-colors", children: [
|
|
2441
2931
|
/* @__PURE__ */ jsx5("dt", { className: "text-slate-500 font-medium", children: label }),
|
|
2442
2932
|
/* @__PURE__ */ jsx5("dd", { className: `font-semibold ${highlight ? "text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded" : status === "warning" ? "text-amber-600" : status === "success" ? "text-emerald-600" : "text-slate-900"}`, children: value })
|
|
2443
2933
|
] });
|
|
2444
2934
|
}
|
|
2445
2935
|
function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
2446
|
-
const [open, setOpen] =
|
|
2447
|
-
const [search, setSearch] =
|
|
2936
|
+
const [open, setOpen] = useState5(false);
|
|
2937
|
+
const [search, setSearch] = useState5("");
|
|
2448
2938
|
const filtered = options.filter((o) => o.toLowerCase().includes(search.toLowerCase()));
|
|
2449
2939
|
const capped = filtered.slice(0, 80);
|
|
2450
2940
|
const SelectedIcon = iconMap && value ? iconMap[value] : null;
|
|
2451
|
-
return /* @__PURE__ */
|
|
2452
|
-
/* @__PURE__ */
|
|
2941
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2942
|
+
/* @__PURE__ */ jsxs4(
|
|
2453
2943
|
"button",
|
|
2454
2944
|
{
|
|
2455
2945
|
type: "button",
|
|
@@ -2459,7 +2949,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2459
2949
|
},
|
|
2460
2950
|
className: "w-full flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 shadow-sm hover:border-slate-300 focus:border-indigo-500 bg-white transition-colors",
|
|
2461
2951
|
children: [
|
|
2462
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-2 truncate", children: [
|
|
2463
2953
|
SelectedIcon && /* @__PURE__ */ jsx5(SelectedIcon, { className: "w-4 h-4 text-indigo-600 shrink-0" }),
|
|
2464
2954
|
/* @__PURE__ */ jsx5("span", { className: "truncate", children: value || placeholder || "Select..." })
|
|
2465
2955
|
] }),
|
|
@@ -2467,10 +2957,10 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2467
2957
|
]
|
|
2468
2958
|
}
|
|
2469
2959
|
),
|
|
2470
|
-
open && /* @__PURE__ */
|
|
2960
|
+
open && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2471
2961
|
/* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-[100]", onClick: () => setOpen(false) }),
|
|
2472
|
-
/* @__PURE__ */
|
|
2473
|
-
/* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ jsxs4("div", { className: "absolute z-[101] mt-1 w-full rounded-xl border border-slate-200 bg-white shadow-2xl max-h-72 flex flex-col overflow-hidden animate-in fade-in slide-in-from-top-1 duration-150", children: [
|
|
2963
|
+
/* @__PURE__ */ jsxs4("div", { className: "p-2 border-b border-slate-100 flex items-center gap-2", children: [
|
|
2474
2964
|
/* @__PURE__ */ jsx5(Search, { className: "w-4 h-4 text-slate-400 shrink-0" }),
|
|
2475
2965
|
/* @__PURE__ */ jsx5(
|
|
2476
2966
|
"input",
|
|
@@ -2485,15 +2975,15 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2485
2975
|
),
|
|
2486
2976
|
search && /* @__PURE__ */ jsx5("span", { className: "text-[10px] font-bold text-slate-400 bg-slate-100 px-1.5 py-0.5 rounded-full shrink-0 tabular-nums", children: filtered.length })
|
|
2487
2977
|
] }),
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
2978
|
+
/* @__PURE__ */ jsxs4("div", { className: "overflow-y-auto flex-1 p-1", children: [
|
|
2979
|
+
filtered.length === 0 && /* @__PURE__ */ jsxs4("div", { className: "p-4 text-xs text-slate-500 text-center", children: [
|
|
2490
2980
|
'No results for "',
|
|
2491
2981
|
search,
|
|
2492
2982
|
'"'
|
|
2493
2983
|
] }),
|
|
2494
2984
|
capped.map((opt) => {
|
|
2495
2985
|
const OptIcon = iconMap ? iconMap[opt] : null;
|
|
2496
|
-
return /* @__PURE__ */
|
|
2986
|
+
return /* @__PURE__ */ jsxs4(
|
|
2497
2987
|
"button",
|
|
2498
2988
|
{
|
|
2499
2989
|
type: "button",
|
|
@@ -2510,7 +3000,7 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2510
3000
|
opt
|
|
2511
3001
|
);
|
|
2512
3002
|
}),
|
|
2513
|
-
filtered.length > 80 && /* @__PURE__ */
|
|
3003
|
+
filtered.length > 80 && /* @__PURE__ */ jsxs4("div", { className: "px-3 py-2 text-[10px] text-slate-400 text-center border-t border-slate-100 mt-1", children: [
|
|
2514
3004
|
"Showing 80 of ",
|
|
2515
3005
|
filtered.length,
|
|
2516
3006
|
" \u2014 type to narrow results"
|
|
@@ -2521,11 +3011,11 @@ function SearchableSelect({ value, onChange, options, placeholder, iconMap }) {
|
|
|
2521
3011
|
] });
|
|
2522
3012
|
}
|
|
2523
3013
|
function PasswordField({ value, onChange }) {
|
|
2524
|
-
const [show, setShow] =
|
|
3014
|
+
const [show, setShow] = useState5(false);
|
|
2525
3015
|
const isHash = value.startsWith("$2a$") || value.startsWith("$2b$");
|
|
2526
|
-
const [displayValue, setDisplayValue] =
|
|
2527
|
-
const [pristine, setPristine] =
|
|
2528
|
-
return /* @__PURE__ */
|
|
3016
|
+
const [displayValue, setDisplayValue] = useState5(isHash ? "" : value);
|
|
3017
|
+
const [pristine, setPristine] = useState5(isHash);
|
|
3018
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
2529
3019
|
/* @__PURE__ */ jsx5(
|
|
2530
3020
|
"input",
|
|
2531
3021
|
{
|
|
@@ -2551,20 +3041,64 @@ function PasswordField({ value, onChange }) {
|
|
|
2551
3041
|
)
|
|
2552
3042
|
] });
|
|
2553
3043
|
}
|
|
3044
|
+
function ReferenceSelect({ collectionId, displayField = "id", value, onChange }) {
|
|
3045
|
+
const ctx = useCmsContext();
|
|
3046
|
+
const [options, setOptions] = useState5([]);
|
|
3047
|
+
const [loading, setLoading] = useState5(true);
|
|
3048
|
+
useEffect4(() => {
|
|
3049
|
+
if (!collectionId) {
|
|
3050
|
+
setLoading(false);
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
setLoading(true);
|
|
3054
|
+
ctx.adapter.listEntries(collectionId).then((res) => {
|
|
3055
|
+
setOptions(res.map((r) => ({ id: r.id, label: String(r[displayField] || r.id) })));
|
|
3056
|
+
setLoading(false);
|
|
3057
|
+
}).catch(() => setLoading(false));
|
|
3058
|
+
}, [collectionId, displayField, ctx.adapter]);
|
|
3059
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
3060
|
+
/* @__PURE__ */ jsxs4(
|
|
3061
|
+
"select",
|
|
3062
|
+
{
|
|
3063
|
+
value,
|
|
3064
|
+
onChange: (e) => onChange(e.target.value),
|
|
3065
|
+
className: "w-full rounded-xl border border-slate-200 px-4 py-2.5 text-sm shadow-sm focus:border-indigo-500 focus:ring-4 focus:ring-indigo-500/10 transition-all bg-white appearance-none pr-10",
|
|
3066
|
+
children: [
|
|
3067
|
+
/* @__PURE__ */ jsx5("option", { value: "", children: loading ? "Loading..." : "Select..." }),
|
|
3068
|
+
options.map((o) => /* @__PURE__ */ jsx5("option", { value: o.id, children: o.label }, o.id))
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
),
|
|
3072
|
+
/* @__PURE__ */ jsx5(ChevronDown, { className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400 pointer-events-none" })
|
|
3073
|
+
] });
|
|
3074
|
+
}
|
|
3075
|
+
function ReferenceTableCell({ collectionId, entryId, displayField = "id" }) {
|
|
3076
|
+
const ctx = useCmsContext();
|
|
3077
|
+
const [label, setLabel] = useState5(entryId);
|
|
3078
|
+
useEffect4(() => {
|
|
3079
|
+
if (!collectionId || !entryId) return;
|
|
3080
|
+
ctx.adapter.listEntries(collectionId).then((res) => {
|
|
3081
|
+
const match = res.find((r) => r.id === entryId);
|
|
3082
|
+
if (match) setLabel(String(match[displayField] || match.id));
|
|
3083
|
+
}).catch(() => {
|
|
3084
|
+
});
|
|
3085
|
+
}, [collectionId, entryId, displayField, ctx.adapter]);
|
|
3086
|
+
return /* @__PURE__ */ jsx5("span", { children: label });
|
|
3087
|
+
}
|
|
2554
3088
|
|
|
2555
3089
|
// src/admin/AdminLogin.tsx
|
|
2556
|
-
import { useState as
|
|
3090
|
+
import { useState as useState6, useEffect as useEffect5 } from "react";
|
|
2557
3091
|
import { Lock, UserPlus } from "lucide-react";
|
|
2558
|
-
import { jsx as jsx6, jsxs as
|
|
3092
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2559
3093
|
function AdminLogin({
|
|
2560
3094
|
authApiRoute = "/api/admin/auth",
|
|
2561
3095
|
redirectRoute = "/admin"
|
|
2562
3096
|
}) {
|
|
2563
|
-
const [email, setEmail] =
|
|
2564
|
-
const [password, setPassword] =
|
|
2565
|
-
const [error, setError] =
|
|
2566
|
-
const [loading, setLoading] =
|
|
2567
|
-
const [view, setView] =
|
|
3097
|
+
const [email, setEmail] = useState6("");
|
|
3098
|
+
const [password, setPassword] = useState6("");
|
|
3099
|
+
const [error, setError] = useState6("");
|
|
3100
|
+
const [loading, setLoading] = useState6(false);
|
|
3101
|
+
const [view, setView] = useState6("checking");
|
|
2568
3102
|
useEffect5(() => {
|
|
2569
3103
|
fetch(authApiRoute, { cache: "no-store" }).then((res) => res.json()).then((data) => {
|
|
2570
3104
|
if (data.hasUsers) {
|
|
@@ -2601,19 +3135,19 @@ function AdminLogin({
|
|
|
2601
3135
|
}
|
|
2602
3136
|
};
|
|
2603
3137
|
if (view === "checking") {
|
|
2604
|
-
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */
|
|
3138
|
+
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-8 w-8 text-indigo-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2605
3139
|
/* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2606
3140
|
/* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
2607
3141
|
] }) });
|
|
2608
3142
|
}
|
|
2609
|
-
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
3143
|
+
return /* @__PURE__ */ jsx6("div", { className: "min-h-screen flex items-center justify-center bg-slate-50 p-4", children: /* @__PURE__ */ jsxs5("div", { className: "max-w-md w-full bg-white rounded-2xl shadow-xl border border-slate-100 overflow-hidden", children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs5("div", { className: "p-8", children: [
|
|
2611
3145
|
/* @__PURE__ */ jsx6("div", { className: "w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center mx-auto mb-6", children: view === "register" ? /* @__PURE__ */ jsx6(UserPlus, { className: "w-6 h-6 text-indigo-600" }) : /* @__PURE__ */ jsx6(Lock, { className: "w-6 h-6 text-indigo-600" }) }),
|
|
2612
3146
|
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-slate-900 text-center mb-2", children: view === "register" ? "Create Admin Account" : "Admin Login" }),
|
|
2613
3147
|
/* @__PURE__ */ jsx6("p", { className: "text-sm text-slate-500 text-center mb-8", children: view === "register" ? "No admin users found. Create the first admin account to get started." : "Sign in to manage your content." }),
|
|
2614
3148
|
error && /* @__PURE__ */ jsx6("div", { className: "mb-6 bg-red-50 text-red-700 p-3 rounded-lg text-sm border border-red-100", children: error }),
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
|
|
3150
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2617
3151
|
/* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Email Address" }),
|
|
2618
3152
|
/* @__PURE__ */ jsx6(
|
|
2619
3153
|
"input",
|
|
@@ -2627,7 +3161,7 @@ function AdminLogin({
|
|
|
2627
3161
|
}
|
|
2628
3162
|
)
|
|
2629
3163
|
] }),
|
|
2630
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
2631
3165
|
/* @__PURE__ */ jsx6("label", { className: "block text-sm font-medium text-slate-700 mb-1.5", children: "Password" }),
|
|
2632
3166
|
/* @__PURE__ */ jsx6(
|
|
2633
3167
|
"input",
|
|
@@ -2647,7 +3181,7 @@ function AdminLogin({
|
|
|
2647
3181
|
type: "submit",
|
|
2648
3182
|
disabled: loading,
|
|
2649
3183
|
className: "w-full bg-indigo-600 text-white font-semibold rounded-xl px-4 py-3 hover:bg-indigo-700 focus:outline-none focus:ring-4 focus:ring-indigo-500/20 transition-all shadow-md disabled:opacity-70 flex justify-center items-center",
|
|
2650
|
-
children: loading ? /* @__PURE__ */
|
|
3184
|
+
children: loading ? /* @__PURE__ */ jsxs5("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
2651
3185
|
/* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
2652
3186
|
/* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
2653
3187
|
] }) : view === "register" ? "Create Account" : "Sign In"
|
|
@@ -2666,6 +3200,7 @@ export {
|
|
|
2666
3200
|
EditableImage,
|
|
2667
3201
|
EditableLink,
|
|
2668
3202
|
EditableList,
|
|
3203
|
+
EditableReference,
|
|
2669
3204
|
EditableText,
|
|
2670
3205
|
SubscriptionPage,
|
|
2671
3206
|
SubscriptionProvider,
|