@orion-studios/payload-studio 0.5.0-beta.3 → 0.5.0-beta.30

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.
Files changed (46) hide show
  1. package/dist/admin/client.js +68 -7
  2. package/dist/admin/client.mjs +68 -7
  3. package/dist/admin/index.d.mts +1 -1
  4. package/dist/admin/index.d.ts +1 -1
  5. package/dist/admin/index.js +37 -0
  6. package/dist/admin/index.mjs +3 -1
  7. package/dist/admin-app/client.d.mts +4 -0
  8. package/dist/admin-app/client.d.ts +4 -0
  9. package/dist/admin-app/client.js +705 -2
  10. package/dist/admin-app/client.mjs +701 -1
  11. package/dist/admin-app/index.d.mts +1 -1
  12. package/dist/admin-app/index.d.ts +1 -1
  13. package/dist/admin-app/index.js +167 -0
  14. package/dist/admin-app/index.mjs +13 -1
  15. package/dist/admin-app/styles.css +127 -0
  16. package/dist/blocks/index.js +193 -3
  17. package/dist/blocks/index.mjs +2 -2
  18. package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
  19. package/dist/{chunk-ZLLNO5FM.mjs → chunk-GPQPDEB5.mjs} +44 -13
  20. package/dist/{chunk-PC5622T7.mjs → chunk-H7DSTEVT.mjs} +180 -4
  21. package/dist/{chunk-UJFU323N.mjs → chunk-QW24Y4UH.mjs} +18 -8
  22. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  23. package/dist/chunk-XVH5SCBD.mjs +234 -0
  24. package/dist/index-BBvk9b9i.d.mts +97 -0
  25. package/dist/index-BBvk9b9i.d.ts +97 -0
  26. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
  27. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
  28. package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
  29. package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +674 -250
  33. package/dist/index.mjs +11 -11
  34. package/dist/nextjs/index.d.mts +1 -1
  35. package/dist/nextjs/index.d.ts +1 -1
  36. package/dist/nextjs/index.js +276 -13
  37. package/dist/nextjs/index.mjs +4 -1
  38. package/dist/studio-pages/builder.css +25 -1
  39. package/dist/studio-pages/client.js +2063 -1118
  40. package/dist/studio-pages/client.mjs +2063 -1118
  41. package/dist/studio-pages/index.js +18 -7
  42. package/dist/studio-pages/index.mjs +2 -2
  43. package/package.json +2 -2
  44. package/dist/chunk-AAOHJDNS.mjs +0 -67
  45. package/dist/index-BallJs-K.d.mts +0 -43
  46. package/dist/index-BallJs-K.d.ts +0 -43
@@ -14,6 +14,7 @@ var sectionStyleDefaults = {
14
14
  contentGradientPreset: "none",
15
15
  contentGradientTo: "#f4f6f2",
16
16
  contentWidth: "inherit",
17
+ sectionPaddingX: "inherit",
17
18
  sectionBackgroundColor: "#ffffff",
18
19
  sectionBackgroundMode: "none",
19
20
  sectionGradientAngle: "135",
@@ -41,6 +42,9 @@ var defaultNodeData = {
41
42
  items: [
42
43
  {
43
44
  description: "Before and after result summary.",
45
+ imageCornerStyle: "rounded",
46
+ imageFit: "cover",
47
+ imagePosition: "center",
44
48
  label: "Project One"
45
49
  }
46
50
  ],
@@ -64,9 +68,9 @@ var defaultNodeData = {
64
68
  featureGrid: {
65
69
  ...withSectionStyleDefaults({}),
66
70
  items: [
67
- { description: "Explain this point.", icon: "01", title: "Feature One" },
68
- { description: "Explain this point.", icon: "02", title: "Feature Two" },
69
- { description: "Explain this point.", icon: "03", title: "Feature Three" }
71
+ { description: "Explain this point.", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
72
+ { description: "Explain this point.", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
73
+ { description: "Explain this point.", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
70
74
  ],
71
75
  title: "Section Title",
72
76
  variant: "cards"
@@ -79,7 +83,11 @@ var defaultNodeData = {
79
83
  },
80
84
  hero: {
81
85
  ...withSectionStyleDefaults({}),
82
- backgroundColor: "#124a37",
86
+ backgroundColor: "",
87
+ backgroundImageCornerStyle: "rounded",
88
+ backgroundImageFit: "cover",
89
+ backgroundImagePosition: "center",
90
+ heroHeight: "sm",
83
91
  headline: "New Hero Section",
84
92
  kicker: "Optional kicker",
85
93
  primaryHref: "/contact",
@@ -92,13 +100,16 @@ var defaultNodeData = {
92
100
  media: {
93
101
  ...withSectionStyleDefaults({}),
94
102
  caption: "Add a caption",
103
+ imageCornerStyle: "rounded",
104
+ imageFit: "cover",
105
+ imagePosition: "center",
95
106
  size: "default"
96
107
  },
97
108
  logoWall: withSectionStyleDefaults({
98
109
  items: [
99
- { name: "Trusted Partner 1" },
100
- { name: "Trusted Partner 2" },
101
- { name: "Trusted Partner 3" }
110
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 1" },
111
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 2" },
112
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Trusted Partner 3" }
102
113
  ],
103
114
  subtitle: "Trusted by teams and homeowners across Central Texas.",
104
115
  title: "Trusted by Local Organizations"
@@ -425,6 +436,61 @@ var resolveMedia = (value) => {
425
436
  }
426
437
  return null;
427
438
  };
439
+ var normalizeHeroImageFit = (value) => {
440
+ if (value === "contain" || value === "contain-square") {
441
+ return "contain";
442
+ }
443
+ return "cover";
444
+ };
445
+ var normalizeHeroImageCornerStyle = (value, legacyFitValue) => {
446
+ if (value === "rounded" || value === "square") {
447
+ return value;
448
+ }
449
+ if (legacyFitValue === "cover-square" || legacyFitValue === "contain-square") {
450
+ return "square";
451
+ }
452
+ return "rounded";
453
+ };
454
+ var getHeroImageCornerRadius = (cornerStyle) => cornerStyle === "square" ? "0px" : "var(--orion-studio-radius-lg)";
455
+ var normalizeHeroImagePosition = (value) => {
456
+ if (value === "top" || value === "bottom" || value === "left" || value === "right") {
457
+ return value;
458
+ }
459
+ return "center";
460
+ };
461
+ var normalizeHeroHeight = (value) => {
462
+ if (value === "md" || value === "full") {
463
+ return value;
464
+ }
465
+ return "sm";
466
+ };
467
+ var heroHeightMap = {
468
+ sm: "360px",
469
+ md: "50svh",
470
+ full: "100svh"
471
+ };
472
+ var normalizeImageFit = (value) => normalizeHeroImageFit(value);
473
+ var normalizeImageCornerStyle = (value, legacyFitValue) => normalizeHeroImageCornerStyle(value, legacyFitValue);
474
+ var normalizeImagePosition = (value) => normalizeHeroImagePosition(value);
475
+ var imageObjectPosition = (value) => {
476
+ switch (value) {
477
+ case "top":
478
+ return "center top";
479
+ case "bottom":
480
+ return "center bottom";
481
+ case "left":
482
+ return "left center";
483
+ case "right":
484
+ return "right center";
485
+ default:
486
+ return "center center";
487
+ }
488
+ };
489
+ var getImagePresentationStyle = (options) => ({
490
+ borderRadius: options.cornerStyle === "square" ? 0 : `${options.roundedRadius ?? 12}px`,
491
+ objectFit: options.fit || "cover",
492
+ objectPosition: imageObjectPosition(options.position || "center")
493
+ });
428
494
  function cloneBlockLayout(layout) {
429
495
  return JSON.parse(JSON.stringify(layout));
430
496
  }
@@ -515,6 +581,7 @@ var defaultSectionStyle = {
515
581
  contentGradientPreset: "none",
516
582
  contentGradientTo: "#f4f6f2",
517
583
  contentWidth: "inherit",
584
+ sectionPaddingX: "inherit",
518
585
  sectionBackgroundColor: "#ffffff",
519
586
  sectionBackgroundMode: "none",
520
587
  sectionGradientAngle: "135",
@@ -536,6 +603,7 @@ var gradientPresetPairs = {
536
603
  slate: ["#1a2f2a", "#34524a"]
537
604
  };
538
605
  var sectionPaddingMap = {
606
+ none: "0px",
539
607
  sm: "1.4rem",
540
608
  md: "2.6rem",
541
609
  lg: "3.4rem"
@@ -562,8 +630,12 @@ function getDefaultBlock(blockType) {
562
630
  switch (blockType) {
563
631
  case "hero":
564
632
  return withSectionStyleDefaults2({
565
- backgroundColor: "#124a37",
633
+ backgroundColor: "",
634
+ backgroundImageCornerStyle: "rounded",
635
+ backgroundImageFit: "cover",
636
+ backgroundImagePosition: "center",
566
637
  blockType: "hero",
638
+ heroHeight: "sm",
567
639
  headline: "New Hero Section",
568
640
  kicker: "Optional kicker",
569
641
  primaryHref: "/contact",
@@ -578,9 +650,9 @@ function getDefaultBlock(blockType) {
578
650
  backgroundColor: "#1f684f",
579
651
  blockType: "featureGrid",
580
652
  items: [
581
- { description: "Explain this point.", icon: "01", title: "Feature One" },
582
- { description: "Explain this point.", icon: "02", title: "Feature Two" },
583
- { description: "Explain this point.", icon: "03", title: "Feature Three" }
653
+ { description: "Explain this point.", icon: "01", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature One" },
654
+ { description: "Explain this point.", icon: "02", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Two" },
655
+ { description: "Explain this point.", icon: "03", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", title: "Feature Three" }
584
656
  ],
585
657
  title: "Section Title",
586
658
  variant: "cards"
@@ -599,14 +671,18 @@ function getDefaultBlock(blockType) {
599
671
  case "logoWall":
600
672
  return withSectionStyleDefaults2({
601
673
  blockType: "logoWall",
602
- items: [{ name: "Partner One" }, { name: "Partner Two" }, { name: "Partner Three" }],
674
+ items: [
675
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Partner One" },
676
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Partner Two" },
677
+ { imageCornerStyle: "rounded", imageFit: "contain", imagePosition: "center", name: "Partner Three" }
678
+ ],
603
679
  subtitle: "Show logos from trusted organizations.",
604
680
  title: "Trusted by Local Partners"
605
681
  });
606
682
  case "beforeAfter":
607
683
  return withSectionStyleDefaults2({
608
684
  blockType: "beforeAfter",
609
- items: [{ description: "Project result summary.", label: "Project One" }],
685
+ items: [{ description: "Project result summary.", imageCornerStyle: "rounded", imageFit: "cover", imagePosition: "center", label: "Project One" }],
610
686
  subtitle: "Visual proof from completed projects.",
611
687
  title: "Before & After Results"
612
688
  });
@@ -621,6 +697,9 @@ function getDefaultBlock(blockType) {
621
697
  return withSectionStyleDefaults2({
622
698
  blockType: "media",
623
699
  caption: "Add a caption",
700
+ imageCornerStyle: "rounded",
701
+ imageFit: "cover",
702
+ imagePosition: "center",
624
703
  size: "default"
625
704
  });
626
705
  case "testimonials":
@@ -690,20 +769,40 @@ function parseAngle(value, fallback = "135") {
690
769
  var sectionStyleFromBlock = (block, pageDefaults) => {
691
770
  const contentWidthRaw = normalizeText(block.contentWidth, defaultSectionStyle.contentWidth);
692
771
  const sectionPaddingRaw = normalizeText(block.sectionPaddingY, defaultSectionStyle.sectionPaddingY);
693
- const sectionPaddingY = sectionPaddingRaw === "sm" || sectionPaddingRaw === "lg" ? sectionPaddingRaw : "md";
772
+ const sectionPaddingXRaw = normalizeText(block.sectionPaddingX, defaultSectionStyle.sectionPaddingX);
773
+ const sectionPaddingY = sectionPaddingRaw === "none" || sectionPaddingRaw === "sm" || sectionPaddingRaw === "lg" ? sectionPaddingRaw : "md";
774
+ const sectionPaddingX = sectionPaddingXRaw === "none" || sectionPaddingXRaw === "sm" || sectionPaddingXRaw === "md" || sectionPaddingXRaw === "lg" ? sectionPaddingXRaw : pageDefaults.pageWidthDefault === "full" ? "none" : "md";
694
775
  const contentWidth = contentWidthRaw === "narrow" || contentWidthRaw === "content" || contentWidthRaw === "wide" || contentWidthRaw === "full" || contentWidthRaw === "inherit" ? contentWidthRaw : "inherit";
695
776
  const resolvedContentWidth = contentWidth === "inherit" ? pageDefaults.pageWidthDefault : contentWidth;
696
777
  const sectionMode = normalizeText(block.sectionBackgroundMode, defaultSectionStyle.sectionBackgroundMode);
697
- const sectionColor = parseColor(block.sectionBackgroundColor, defaultSectionStyle.sectionBackgroundColor);
778
+ const sectionColor = parseColor(
779
+ normalizeText(block.sectionBackgroundColor, ""),
780
+ normalizeText(defaultSectionStyle.sectionBackgroundColor, "#ffffff")
781
+ );
698
782
  const sectionPreset = normalizeText(block.sectionGradientPreset, defaultSectionStyle.sectionGradientPreset);
699
- const sectionFrom = parseColor(block.sectionGradientFrom, defaultSectionStyle.sectionGradientFrom);
700
- const sectionTo = parseColor(block.sectionGradientTo, defaultSectionStyle.sectionGradientTo);
783
+ const sectionFrom = parseColor(
784
+ normalizeText(block.sectionGradientFrom, ""),
785
+ normalizeText(defaultSectionStyle.sectionGradientFrom, "#124a37")
786
+ );
787
+ const sectionTo = parseColor(
788
+ normalizeText(block.sectionGradientTo, ""),
789
+ normalizeText(defaultSectionStyle.sectionGradientTo, "#1f684f")
790
+ );
701
791
  const sectionAngle = parseAngle(block.sectionGradientAngle, defaultSectionStyle.sectionGradientAngle);
702
792
  const contentMode = normalizeText(block.contentBackgroundMode, defaultSectionStyle.contentBackgroundMode);
703
- const contentColor = parseColor(block.contentBackgroundColor, defaultSectionStyle.contentBackgroundColor);
793
+ const contentColor = parseColor(
794
+ normalizeText(block.contentBackgroundColor, ""),
795
+ normalizeText(defaultSectionStyle.contentBackgroundColor, "#ffffff")
796
+ );
704
797
  const contentPreset = normalizeText(block.contentGradientPreset, defaultSectionStyle.contentGradientPreset);
705
- const contentFrom = parseColor(block.contentGradientFrom, defaultSectionStyle.contentGradientFrom);
706
- const contentTo = parseColor(block.contentGradientTo, defaultSectionStyle.contentGradientTo);
798
+ const contentFrom = parseColor(
799
+ normalizeText(block.contentGradientFrom, ""),
800
+ normalizeText(defaultSectionStyle.contentGradientFrom, "#ffffff")
801
+ );
802
+ const contentTo = parseColor(
803
+ normalizeText(block.contentGradientTo, ""),
804
+ normalizeText(defaultSectionStyle.contentGradientTo, "#f4f6f2")
805
+ );
707
806
  const contentAngle = parseAngle(block.contentGradientAngle, defaultSectionStyle.contentGradientAngle);
708
807
  const sectionPresetPair = gradientPresetPairs[sectionPreset];
709
808
  const contentPresetPair = gradientPresetPairs[contentPreset];
@@ -714,18 +813,20 @@ var sectionStyleFromBlock = (block, pageDefaults) => {
714
813
  contentStyle: contentMode === "color" ? {
715
814
  background: contentColor,
716
815
  borderRadius: 20,
717
- boxShadow: "0 8px 20px rgba(13, 74, 55, 0.08)"
816
+ boxShadow: "0 8px 20px rgba(13, 74, 55, 0.08)",
817
+ padding: "1rem"
718
818
  } : contentMode === "gradient" ? {
719
819
  background: contentGradient,
720
820
  borderRadius: 20,
721
- boxShadow: "0 8px 20px rgba(13, 74, 55, 0.08)"
821
+ boxShadow: "0 8px 20px rgba(13, 74, 55, 0.08)",
822
+ padding: "1rem"
722
823
  } : {},
723
- sectionClass: `orion-builder-shell is-${pageDefaults.pageWidthDefault}`,
824
+ sectionClass: `orion-builder-shell is-${pageDefaults.pageWidthDefault} padx-${sectionPaddingX}`,
724
825
  sectionInnerStyle: {
725
826
  paddingBottom: sectionPaddingMap[sectionPaddingY],
726
827
  paddingTop: sectionPaddingMap[sectionPaddingY]
727
828
  },
728
- sectionStyle: sectionMode === "color" ? { background: sectionColor } : sectionMode === "gradient" ? { background: sectionGradient } : {}
829
+ sectionStyle: sectionMode === "color" ? { background: sectionColor } : sectionMode === "gradient" ? { background: sectionGradient } : block.blockType === "hero" ? { background: "transparent" } : {}
729
830
  };
730
831
  };
731
832
  function getRelationID(value) {
@@ -743,6 +844,19 @@ function getRelationID(value) {
743
844
  }
744
845
  return null;
745
846
  }
847
+ function getMediaURL(value) {
848
+ if (!value || typeof value !== "object") {
849
+ return "";
850
+ }
851
+ const typed = value;
852
+ if (typeof typed.url === "string" && typed.url.trim().length > 0) {
853
+ return typed.url.trim();
854
+ }
855
+ if (typeof typed.filename === "string" && typed.filename.trim().length > 0) {
856
+ return `/api/media/file/${encodeURIComponent(typed.filename)}`;
857
+ }
858
+ return "";
859
+ }
746
860
  function extractUploadedMedia(value) {
747
861
  const candidate = value && typeof value === "object" && "doc" in value ? value.doc : value;
748
862
  if (!candidate || typeof candidate !== "object") {
@@ -759,18 +873,58 @@ function extractUploadedMedia(value) {
759
873
  url: typeof candidate.url === "string" ? candidate.url : ""
760
874
  };
761
875
  }
762
- function getUploadedMediaURL(value) {
876
+ function toMediaLibraryItem(value) {
763
877
  if (!value || typeof value !== "object") {
764
- return "";
878
+ return null;
879
+ }
880
+ const id = getRelationID(value);
881
+ if (id === null) {
882
+ return null;
765
883
  }
766
884
  const typed = value;
767
- if (typeof typed.url === "string" && typed.url.length > 0) {
768
- return typed.url;
885
+ const filename = typeof typed.filename === "string" ? typed.filename : "";
886
+ const url = typeof typed.url === "string" && typed.url.length > 0 ? typed.url : filename ? `/api/media/file/${encodeURIComponent(filename)}` : "";
887
+ return {
888
+ alt: typeof typed.alt === "string" ? typed.alt : "",
889
+ filename,
890
+ id,
891
+ url
892
+ };
893
+ }
894
+ function mediaLabel(item) {
895
+ return item.filename || item.alt || `Media #${item.id}`;
896
+ }
897
+ function mediaFromLibraryItem(item) {
898
+ return {
899
+ alt: item.alt,
900
+ filename: item.filename,
901
+ id: item.id,
902
+ url: item.url
903
+ };
904
+ }
905
+ async function parsePayloadErrorMessage(response, fallbackMessage) {
906
+ const contentType = response.headers.get("content-type") || "";
907
+ if (!contentType.toLowerCase().includes("application/json")) {
908
+ const raw = await response.text();
909
+ return raw.trim() || fallbackMessage;
769
910
  }
770
- if (typeof typed.filename === "string" && typed.filename.length > 0) {
771
- return `/api/media/file/${encodeURIComponent(typed.filename)}`;
911
+ try {
912
+ const payload = await response.json();
913
+ const nestedMessage = payload.errors?.[0]?.data?.errors?.[0]?.message;
914
+ if (typeof nestedMessage === "string" && nestedMessage.trim().length > 0) {
915
+ return nestedMessage;
916
+ }
917
+ const topMessage = payload.errors?.[0]?.message;
918
+ if (typeof topMessage === "string" && topMessage.trim().length > 0) {
919
+ return topMessage;
920
+ }
921
+ if (typeof payload.message === "string" && payload.message.trim().length > 0) {
922
+ return payload.message;
923
+ }
924
+ } catch {
925
+ return fallbackMessage;
772
926
  }
773
- return "";
927
+ return fallbackMessage;
774
928
  }
775
929
  var MAX_DIRECT_UPLOAD_BYTES = 4e6;
776
930
  async function optimizeImageForUpload(file) {
@@ -1122,22 +1276,19 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1122
1276
  const [dragIndex, setDragIndex] = useState(null);
1123
1277
  const [sidebarOpen, setSidebarOpen] = useState(true);
1124
1278
  const [savingStatus, setSavingStatus] = useState(null);
1125
- const [saveMessage, setSaveMessage] = useState("");
1126
- const [saveError, setSaveError] = useState("");
1127
1279
  const [uploadingTarget, setUploadingTarget] = useState(null);
1128
1280
  const [uploadError, setUploadError] = useState("");
1129
1281
  const [uploadMessage, setUploadMessage] = useState("");
1130
1282
  const [uploadAltText, setUploadAltText] = useState("");
1283
+ const [mediaLibrary, setMediaLibrary] = useState([]);
1284
+ const [mediaLibraryError, setMediaLibraryError] = useState("");
1285
+ const [mediaLibraryLoading, setMediaLibraryLoading] = useState(false);
1286
+ const [selectedHeroMediaID, setSelectedHeroMediaID] = useState("");
1131
1287
  const [presetQuery, setPresetQuery] = useState("");
1132
1288
  const [pastSnapshots, setPastSnapshots] = useState([]);
1133
1289
  const [futureSnapshots, setFutureSnapshots] = useState([]);
1134
- const [panelState, setPanelState] = useState({
1135
- addSections: true,
1136
- pageDefaults: true,
1137
- quickAdd: true,
1138
- save: true,
1139
- selected: true
1140
- });
1290
+ const isSidebarPanelKey = (value) => value === "pageDefaults" || value === "addSections" || value === "selected";
1291
+ const [activeSidebarPanel, setActiveSidebarPanel] = useState("selected");
1141
1292
  const historyBypassRef = useRef(true);
1142
1293
  const previousSnapshotRef = useRef({
1143
1294
  layout: cloneBlockLayout(initialLayout).map((block) => withSectionStyleDefaults2(block)),
@@ -1154,6 +1305,23 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1154
1305
  ...defaultSectionStyle,
1155
1306
  ...selectedBlock || {}
1156
1307
  };
1308
+ const resolveMediaLibraryItemFromValue = (value) => {
1309
+ const direct = toMediaLibraryItem(value);
1310
+ if (direct) {
1311
+ return direct;
1312
+ }
1313
+ const relationID = getRelationID(value);
1314
+ if (relationID === null) {
1315
+ return null;
1316
+ }
1317
+ return mediaLibrary.find((item) => String(item.id) === String(relationID)) || null;
1318
+ };
1319
+ const selectedHeroMedia = useMemo(() => {
1320
+ if (selectedType !== "hero" || !selectedBlock) {
1321
+ return null;
1322
+ }
1323
+ return resolveMediaLibraryItemFromValue(selectedBlock.media);
1324
+ }, [mediaLibrary, selectedBlock, selectedType]);
1157
1325
  const filteredSectionPresets = useMemo(() => {
1158
1326
  const query = presetQuery.trim().toLowerCase();
1159
1327
  if (!query) {
@@ -1163,6 +1331,37 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1163
1331
  (preset) => `${preset.title} ${preset.description}`.toLowerCase().includes(query)
1164
1332
  );
1165
1333
  }, [presetQuery]);
1334
+ useEffect(() => {
1335
+ const loadMediaLibrary = async () => {
1336
+ setMediaLibraryLoading(true);
1337
+ setMediaLibraryError("");
1338
+ try {
1339
+ const response = await fetch("/api/media?depth=1&limit=100&sort=-updatedAt", {
1340
+ credentials: "include"
1341
+ });
1342
+ if (!response.ok) {
1343
+ throw new Error("Could not load media library.");
1344
+ }
1345
+ const json = await response.json();
1346
+ const docs = Array.isArray(json.docs) ? json.docs : [];
1347
+ const items = docs.map((doc2) => toMediaLibraryItem(doc2)).filter((item) => item !== null);
1348
+ setMediaLibrary(items);
1349
+ } catch (error) {
1350
+ setMediaLibraryError(error instanceof Error ? error.message : "Could not load media library.");
1351
+ } finally {
1352
+ setMediaLibraryLoading(false);
1353
+ }
1354
+ };
1355
+ void loadMediaLibrary();
1356
+ }, []);
1357
+ useEffect(() => {
1358
+ if (selectedType !== "hero") {
1359
+ setSelectedHeroMediaID("");
1360
+ return;
1361
+ }
1362
+ const relationID = getRelationID(selectedBlock?.media);
1363
+ setSelectedHeroMediaID(relationID !== null ? String(relationID) : "");
1364
+ }, [selectedBlock, selectedType]);
1166
1365
  const applyTemplateStarter = () => {
1167
1366
  const templateBlocks = templateStarterPresets[pageTemplate] || templateStarterPresets.standard;
1168
1367
  const nextLayout = clonePresetBlocks(templateBlocks).map((block) => withSectionStyleDefaults2(block));
@@ -1247,6 +1446,55 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1247
1446
  currentItems.filter((_, index) => index !== itemIndex)
1248
1447
  );
1249
1448
  };
1449
+ const setSelectedMediaFieldFromLibrary = (fieldName, mediaID) => {
1450
+ if (!mediaID) {
1451
+ updateSelectedField(fieldName, null);
1452
+ if (selectedType === "hero" && fieldName === "media") {
1453
+ updateSelectedField("backgroundImageURL", "");
1454
+ setSelectedHeroMediaID("");
1455
+ }
1456
+ return;
1457
+ }
1458
+ const selectedMedia = mediaLibrary.find((item) => String(item.id) === mediaID);
1459
+ if (!selectedMedia) {
1460
+ return;
1461
+ }
1462
+ updateSelectedField(fieldName, mediaFromLibraryItem(selectedMedia));
1463
+ if (selectedType === "hero" && fieldName === "media") {
1464
+ updateSelectedField("backgroundImageURL", selectedMedia.url);
1465
+ setSelectedHeroMediaID(String(selectedMedia.id));
1466
+ }
1467
+ };
1468
+ const setSelectedItemMediaFieldFromLibrary = (itemIndex, fieldName, mediaID) => {
1469
+ if (selectedIndex === null) {
1470
+ return;
1471
+ }
1472
+ if (!mediaID) {
1473
+ updateArrayItemField(selectedIndex, "items", itemIndex, fieldName, null);
1474
+ return;
1475
+ }
1476
+ const selectedMedia = mediaLibrary.find((item) => String(item.id) === mediaID);
1477
+ if (!selectedMedia) {
1478
+ return;
1479
+ }
1480
+ updateArrayItemField(selectedIndex, "items", itemIndex, fieldName, mediaFromLibraryItem(selectedMedia));
1481
+ };
1482
+ const setHeroMediaFromLibrary = (mediaID) => {
1483
+ if (selectedIndex === null || selectedType !== "hero") {
1484
+ return;
1485
+ }
1486
+ setSelectedMediaFieldFromLibrary("media", mediaID);
1487
+ };
1488
+ const clearHeroMedia = () => {
1489
+ if (selectedType !== "hero") {
1490
+ return;
1491
+ }
1492
+ updateSelectedField("media", null);
1493
+ updateSelectedField("backgroundImageURL", "");
1494
+ setSelectedHeroMediaID("");
1495
+ setUploadMessage("Hero image removed.");
1496
+ setUploadError("");
1497
+ };
1250
1498
  const uploadMediaForSelected = async (target, file) => {
1251
1499
  if (selectedIndex === null) {
1252
1500
  setUploadError("Select a section first.");
@@ -1272,8 +1520,7 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1272
1520
  method: "POST"
1273
1521
  });
1274
1522
  if (!response.ok) {
1275
- const body = await response.text();
1276
- throw new Error(body || "Upload failed");
1523
+ throw new Error(await parsePayloadErrorMessage(response, "Could not upload image."));
1277
1524
  }
1278
1525
  const json = await response.json();
1279
1526
  const uploaded = extractUploadedMedia(json);
@@ -1283,12 +1530,19 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1283
1530
  const nextLayout = cloneBlockLayout(layout);
1284
1531
  const block = nextLayout[selectedIndex];
1285
1532
  if (target.kind === "hero") {
1286
- const uploadedURL = getUploadedMediaURL(uploaded);
1533
+ const uploadedItem = toMediaLibraryItem(uploaded);
1287
1534
  nextLayout[selectedIndex] = {
1288
1535
  ...block,
1289
- backgroundImageURL: uploadedURL,
1536
+ backgroundImageURL: uploadedItem?.url || normalizeText(uploaded.url),
1290
1537
  media: uploaded
1291
1538
  };
1539
+ if (uploadedItem) {
1540
+ setMediaLibrary((current) => {
1541
+ const deduped = current.filter((item) => String(item.id) !== String(uploadedItem.id));
1542
+ return [uploadedItem, ...deduped];
1543
+ });
1544
+ setSelectedHeroMediaID(String(uploadedItem.id));
1545
+ }
1292
1546
  } else if (target.kind === "media") {
1293
1547
  nextLayout[selectedIndex] = {
1294
1548
  ...block,
@@ -1314,6 +1568,25 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1314
1568
  setUploadingTarget(null);
1315
1569
  }
1316
1570
  };
1571
+ const withHeroMediaFallbacks = (sourceLayout) => sourceLayout.map((block) => {
1572
+ if (!block || typeof block !== "object") {
1573
+ return block;
1574
+ }
1575
+ const nextBlock = { ...block };
1576
+ const blockType = normalizeText(nextBlock.blockType);
1577
+ if (blockType !== "hero") {
1578
+ return nextBlock;
1579
+ }
1580
+ const existingBackgroundImageURL = normalizeText(nextBlock.backgroundImageURL).trim();
1581
+ if (existingBackgroundImageURL.length > 0) {
1582
+ return nextBlock;
1583
+ }
1584
+ const mediaURL = getMediaURL(nextBlock.media);
1585
+ if (mediaURL.length > 0) {
1586
+ nextBlock.backgroundImageURL = mediaURL;
1587
+ }
1588
+ return nextBlock;
1589
+ });
1317
1590
  const toPersistedLayout = (sourceLayout) => sourceLayout.map((block) => {
1318
1591
  if (!block || typeof block !== "object") {
1319
1592
  return block;
@@ -1358,7 +1631,7 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1358
1631
  });
1359
1632
  const renderWithSectionShell = (block, className, content) => {
1360
1633
  const shell = sectionStyleFromBlock(block, pageDefaults);
1361
- return /* @__PURE__ */ jsx("section", { className: `${className} ${shell.sectionClass}`, style: shell.sectionStyle, children: /* @__PURE__ */ jsx("div", { className: shell.contentClass, style: shell.contentStyle, children: /* @__PURE__ */ jsx("div", { style: shell.sectionInnerStyle, children: content }) }) });
1634
+ return /* @__PURE__ */ jsx("section", { className: `${className} ${shell.sectionClass}`, style: shell.sectionStyle, children: /* @__PURE__ */ jsx("div", { style: shell.sectionInnerStyle, children: /* @__PURE__ */ jsx("div", { className: shell.contentClass, style: shell.contentStyle, children: content }) }) });
1362
1635
  };
1363
1636
  const sidebarSectionStyle = {
1364
1637
  border: "1px solid rgba(13, 74, 55, 0.15)",
@@ -1450,8 +1723,10 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1450
1723
  setLayout(cloneBlockLayout(target.layout));
1451
1724
  setPageDefaults(clonePageDefaults(target.pageDefaults));
1452
1725
  };
1453
- const togglePanel = (panel) => {
1454
- setPanelState((current) => ({ ...current, [panel]: !current[panel] }));
1726
+ const collapseSidebar = () => setSidebarOpen(false);
1727
+ const openSidebarPanel = (panel) => {
1728
+ setActiveSidebarPanel(panel);
1729
+ setSidebarOpen(true);
1455
1730
  };
1456
1731
  const setSelectedStyleField = (fieldName, value) => {
1457
1732
  updateSelectedField(fieldName, value);
@@ -1473,17 +1748,19 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1473
1748
  }
1474
1749
  };
1475
1750
  const saveLayout = async (status) => {
1751
+ if (savingStatus !== null) {
1752
+ return false;
1753
+ }
1476
1754
  setSavingStatus(status);
1477
- setSaveError("");
1478
- setSaveMessage("");
1479
1755
  try {
1480
- const persistedLayout = toPersistedLayout(layout);
1756
+ const normalizedLayout = withHeroMediaFallbacks(layout);
1757
+ const persistedLayout = toPersistedLayout(normalizedLayout);
1481
1758
  const response = await fetch(`/api/pages/${pageID}`, {
1482
1759
  body: JSON.stringify({
1483
1760
  _status: status,
1484
1761
  layout: persistedLayout,
1485
1762
  studioDocument: layoutToStudioDocument(
1486
- layout,
1763
+ normalizedLayout,
1487
1764
  title,
1488
1765
  {
1489
1766
  pageWidthDefault: pageDefaults.pageWidthDefault
@@ -1497,14 +1774,19 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1497
1774
  method: "PATCH"
1498
1775
  });
1499
1776
  if (!response.ok) {
1500
- const body = await response.text();
1501
- throw new Error(body || "Failed to save page");
1777
+ throw new Error(await parsePayloadErrorMessage(response, "Could not save this page."));
1502
1778
  }
1503
- setSaveMessage(status === "published" ? "Published." : "Draft saved.");
1504
- lastSavedRef.current = cloneSnapshot({
1505
- layout: cloneBlockLayout(layout),
1779
+ const savedSnapshot = {
1780
+ layout: cloneBlockLayout(normalizedLayout),
1506
1781
  pageDefaults: clonePageDefaults(pageDefaults)
1507
- });
1782
+ };
1783
+ const shouldSyncLayout = snapshotKey(savedSnapshot) !== snapshotKey(currentSnapshot);
1784
+ if (shouldSyncLayout) {
1785
+ historyBypassRef.current = true;
1786
+ previousSnapshotRef.current = cloneSnapshot(savedSnapshot);
1787
+ setLayout(cloneBlockLayout(savedSnapshot.layout));
1788
+ }
1789
+ lastSavedRef.current = cloneSnapshot(savedSnapshot);
1508
1790
  window.parent?.postMessage(
1509
1791
  {
1510
1792
  message: status === "published" ? "Published." : "Draft saved.",
@@ -1518,10 +1800,9 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1518
1800
  return true;
1519
1801
  } catch (error) {
1520
1802
  console.error(error);
1521
- setSaveError("Could not save. Check permissions/session and retry.");
1522
1803
  window.parent?.postMessage(
1523
1804
  {
1524
- message: "Could not save. Check permissions/session and retry.",
1805
+ message: error instanceof Error ? error.message : "Could not save. Check permissions/session and retry.",
1525
1806
  ok: false,
1526
1807
  source: "payload-visual-builder-child",
1527
1808
  status,
@@ -1542,26 +1823,42 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1542
1823
  }
1543
1824
  try {
1544
1825
  const parsed = JSON.parse(raw);
1545
- setPanelState((current) => ({
1546
- addSections: typeof parsed.addSections === "boolean" ? parsed.addSections : current.addSections,
1547
- pageDefaults: typeof parsed.pageDefaults === "boolean" ? parsed.pageDefaults : current.pageDefaults,
1548
- quickAdd: typeof parsed.quickAdd === "boolean" ? parsed.quickAdd : current.quickAdd,
1549
- save: typeof parsed.save === "boolean" ? parsed.save : current.save,
1550
- selected: typeof parsed.selected === "boolean" ? parsed.selected : current.selected
1551
- }));
1826
+ const maybeActive = parsed.activePanel;
1827
+ if (isSidebarPanelKey(maybeActive)) {
1828
+ setActiveSidebarPanel(maybeActive);
1829
+ return;
1830
+ }
1831
+ const oldSelected = typeof parsed.selected === "boolean" ? parsed.selected : false;
1832
+ const oldAdd = (typeof parsed.addSections === "boolean" ? parsed.addSections : false) || (typeof parsed.addContent === "boolean" ? parsed.addContent : false) || (typeof parsed.quickAdd === "boolean" ? parsed.quickAdd : false);
1833
+ const oldDefaults = typeof parsed.pageDefaults === "boolean" ? parsed.pageDefaults : false;
1834
+ if (oldSelected) {
1835
+ setActiveSidebarPanel("selected");
1836
+ } else if (oldAdd) {
1837
+ setActiveSidebarPanel("addSections");
1838
+ } else if (oldDefaults) {
1839
+ setActiveSidebarPanel("pageDefaults");
1840
+ }
1552
1841
  } catch {
1553
1842
  }
1554
1843
  }, [pageID]);
1555
1844
  useEffect(() => {
1556
1845
  const storageKey = `orion-builder-panels:${pageID}`;
1557
- window.localStorage.setItem(storageKey, JSON.stringify(panelState));
1558
- }, [pageID, panelState]);
1846
+ window.localStorage.setItem(storageKey, JSON.stringify({ activePanel: activeSidebarPanel }));
1847
+ }, [activeSidebarPanel, pageID]);
1559
1848
  useEffect(() => {
1560
1849
  if (selectedIndex === null) {
1561
1850
  return;
1562
1851
  }
1563
- setPanelState((current) => current.selected ? current : { ...current, selected: true });
1852
+ setSidebarOpen(true);
1853
+ setActiveSidebarPanel("selected");
1564
1854
  }, [selectedIndex]);
1855
+ useEffect(() => {
1856
+ if (layout.length > 0) {
1857
+ return;
1858
+ }
1859
+ setSidebarOpen(true);
1860
+ setActiveSidebarPanel("addSections");
1861
+ }, [layout.length]);
1565
1862
  useEffect(() => {
1566
1863
  if (historyBypassRef.current) {
1567
1864
  historyBypassRef.current = false;
@@ -1592,29 +1889,79 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1592
1889
  return () => window.removeEventListener("keydown", onKeyDown);
1593
1890
  }, [canRedo, canUndo, futureSnapshots, pastSnapshots, currentSnapshot]);
1594
1891
  useEffect(() => {
1595
- const onBeforeUnload = (event) => {
1596
- if (!isDirty) {
1597
- return;
1598
- }
1599
- event.preventDefault();
1600
- event.returnValue = "";
1601
- };
1602
- window.addEventListener("beforeunload", onBeforeUnload);
1603
- return () => window.removeEventListener("beforeunload", onBeforeUnload);
1892
+ window.parent?.postMessage(
1893
+ {
1894
+ dirty: isDirty,
1895
+ source: "payload-visual-builder-child",
1896
+ type: "dirty-state"
1897
+ },
1898
+ "*"
1899
+ );
1604
1900
  }, [isDirty]);
1901
+ useEffect(() => {
1902
+ window.parent?.postMessage(
1903
+ {
1904
+ canRedo,
1905
+ canUndo,
1906
+ source: "payload-visual-builder-child",
1907
+ type: "history-state"
1908
+ },
1909
+ "*"
1910
+ );
1911
+ }, [canRedo, canUndo]);
1605
1912
  useEffect(() => {
1606
1913
  const onMessage = (event) => {
1607
1914
  const data = event.data;
1608
- if (!data || data.source !== "payload-visual-builder-parent" || data.type !== "save") {
1915
+ if (!data || data.source !== "payload-visual-builder-parent") {
1916
+ return;
1917
+ }
1918
+ if (data.type === "dirty-check-request") {
1919
+ window.parent?.postMessage(
1920
+ {
1921
+ dirty: isDirty,
1922
+ source: "payload-visual-builder-child",
1923
+ type: "dirty-state"
1924
+ },
1925
+ "*"
1926
+ );
1927
+ window.parent?.postMessage(
1928
+ {
1929
+ canRedo,
1930
+ canUndo,
1931
+ source: "payload-visual-builder-child",
1932
+ type: "history-state"
1933
+ },
1934
+ "*"
1935
+ );
1936
+ return;
1937
+ }
1938
+ if (data.type === "history-check-request") {
1939
+ window.parent?.postMessage(
1940
+ {
1941
+ canRedo,
1942
+ canUndo,
1943
+ source: "payload-visual-builder-child",
1944
+ type: "history-state"
1945
+ },
1946
+ "*"
1947
+ );
1609
1948
  return;
1610
1949
  }
1611
- if (data.status === "draft" || data.status === "published") {
1950
+ if (data.type === "save" && (data.status === "draft" || data.status === "published")) {
1612
1951
  void saveLayout(data.status);
1952
+ return;
1953
+ }
1954
+ if (data.type === "undo") {
1955
+ undo();
1956
+ return;
1957
+ }
1958
+ if (data.type === "redo") {
1959
+ redo();
1613
1960
  }
1614
1961
  };
1615
1962
  window.addEventListener("message", onMessage);
1616
1963
  return () => window.removeEventListener("message", onMessage);
1617
- }, [layout, pageDefaults.pageWidthDefault, title]);
1964
+ }, [canRedo, canUndo, isDirty, layout, pageDefaults.pageWidthDefault, title]);
1618
1965
  useEffect(() => {
1619
1966
  const preventNavigationWhileEditing = (event) => {
1620
1967
  const editorRoot = editorRootRef.current;
@@ -1649,43 +1996,6 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1649
1996
  },
1650
1997
  children: [
1651
1998
  /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
1652
- /* @__PURE__ */ jsxs(
1653
- "div",
1654
- {
1655
- style: {
1656
- alignItems: "center",
1657
- display: "flex",
1658
- gap: 8,
1659
- justifyContent: "space-between",
1660
- marginBottom: 10
1661
- },
1662
- children: [
1663
- /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12, fontWeight: 600 }, children: isDirty ? "Unsaved changes" : "All changes saved" }),
1664
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6 }, children: [
1665
- /* @__PURE__ */ jsx(
1666
- "button",
1667
- {
1668
- disabled: !canUndo,
1669
- onClick: undo,
1670
- style: { borderRadius: 999, cursor: canUndo ? "pointer" : "not-allowed", fontSize: 12, padding: "7px 11px" },
1671
- type: "button",
1672
- children: "Undo"
1673
- }
1674
- ),
1675
- /* @__PURE__ */ jsx(
1676
- "button",
1677
- {
1678
- disabled: !canRedo,
1679
- onClick: redo,
1680
- style: { borderRadius: 999, cursor: canRedo ? "pointer" : "not-allowed", fontSize: 12, padding: "7px 11px" },
1681
- type: "button",
1682
- children: "Redo"
1683
- }
1684
- )
1685
- ] })
1686
- ]
1687
- }
1688
- ),
1689
1999
  layout.map((block, index) => {
1690
2000
  const type = normalizeText(block.blockType, "unknown");
1691
2001
  const selectBlock = () => setSelectedIndex(index);
@@ -1700,14 +2010,36 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1700
2010
  if (type === "hero") {
1701
2011
  const media = resolveMedia(block.media);
1702
2012
  const variant = normalizeText(block.variant, "default");
1703
- const backgroundColor = normalizeText(block.backgroundColor);
2013
+ const backgroundColor = normalizeText(block.backgroundColor).trim();
2014
+ const backgroundImageFit = normalizeHeroImageFit(block.backgroundImageFit);
2015
+ const backgroundImageCornerStyle = normalizeHeroImageCornerStyle(
2016
+ block.backgroundImageCornerStyle,
2017
+ block.backgroundImageFit
2018
+ );
2019
+ const backgroundImagePosition = normalizeHeroImagePosition(block.backgroundImagePosition);
2020
+ const heroHeight = normalizeHeroHeight(block.heroHeight);
2021
+ const heroMinHeight = heroHeightMap[heroHeight];
2022
+ const heroCornerRadius = getHeroImageCornerRadius(backgroundImageCornerStyle);
2023
+ const sectionBackgroundMode = normalizeText(
2024
+ block.sectionBackgroundMode,
2025
+ defaultSectionStyle.sectionBackgroundMode
2026
+ );
1704
2027
  const backgroundImageURL = normalizeText(block.backgroundImageURL);
1705
- const backgroundImage = backgroundImageURL || media?.url;
2028
+ const backgroundImage = media?.url || backgroundImageURL;
2029
+ const hasCustomHeroColor = backgroundColor.length > 0 && backgroundColor.toLowerCase() !== "#124a37";
1706
2030
  const mediaStyle = backgroundImage && variant === "default" ? {
1707
- backgroundColor: backgroundColor || void 0,
1708
- backgroundImage: `linear-gradient(145deg, rgba(13, 74, 55, 0.34), rgba(13, 74, 55, 0.74)), url('${backgroundImage}')`
1709
- } : {
1710
- backgroundColor: backgroundColor || void 0
2031
+ ...hasCustomHeroColor ? { backgroundColor } : {},
2032
+ backgroundImage: `url('${backgroundImage}')`,
2033
+ backgroundPosition: backgroundImagePosition,
2034
+ backgroundRepeat: "no-repeat",
2035
+ backgroundSize: backgroundImageFit,
2036
+ minHeight: heroMinHeight
2037
+ } : hasCustomHeroColor && sectionBackgroundMode !== "none" ? {
2038
+ backgroundColor,
2039
+ minHeight: heroMinHeight
2040
+ } : { minHeight: heroMinHeight };
2041
+ const heroStyle = {
2042
+ borderRadius: heroCornerRadius
1711
2043
  };
1712
2044
  return /* @__PURE__ */ jsx(
1713
2045
  BlockFrame,
@@ -1721,8 +2053,8 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1721
2053
  setDragIndex,
1722
2054
  children: renderWithSectionShell(
1723
2055
  block,
1724
- `hero ${variant === "centered" ? "hero-centered" : ""}`,
1725
- /* @__PURE__ */ jsxs(Fragment, { children: [
2056
+ "",
2057
+ /* @__PURE__ */ jsxs("section", { className: `hero ${variant === "centered" ? "hero-centered" : ""}`, style: heroStyle, children: [
1726
2058
  /* @__PURE__ */ jsx("div", { className: "hero-grid", children: /* @__PURE__ */ jsx("div", { className: "hero-media", role: "img", style: mediaStyle }) }),
1727
2059
  /* @__PURE__ */ jsxs("div", { className: "hero-content", children: [
1728
2060
  /* @__PURE__ */ jsx("div", { className: "kicker", children: /* @__PURE__ */ jsx(
@@ -1809,47 +2141,57 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1809
2141
  value: normalizeText(block.title)
1810
2142
  }
1811
2143
  ) }) }),
1812
- /* @__PURE__ */ jsx("div", { className: "feature-grid", children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs("article", { className: "feature-item", children: [
1813
- resolveMedia(item?.media)?.url ? (
1814
- // eslint-disable-next-line @next/next/no-img-element
2144
+ /* @__PURE__ */ jsx("div", { className: "feature-grid", children: items.map((item, itemIndex) => {
2145
+ const itemRecord = item;
2146
+ const itemMedia = resolveMedia(itemRecord?.media);
2147
+ const itemImageStyle = getImagePresentationStyle({
2148
+ cornerStyle: normalizeImageCornerStyle(itemRecord?.imageCornerStyle),
2149
+ fit: normalizeImageFit(itemRecord?.imageFit),
2150
+ position: normalizeImagePosition(itemRecord?.imagePosition)
2151
+ });
2152
+ return /* @__PURE__ */ jsxs("article", { className: "feature-item", children: [
2153
+ itemMedia?.url ? (
2154
+ // eslint-disable-next-line @next/next/no-img-element
2155
+ /* @__PURE__ */ jsx(
2156
+ "img",
2157
+ {
2158
+ alt: itemMedia.alt || normalizeText(itemRecord?.title, "Feature image"),
2159
+ className: "feature-item-media",
2160
+ src: itemMedia.url,
2161
+ style: itemImageStyle
2162
+ }
2163
+ )
2164
+ ) : null,
2165
+ /* @__PURE__ */ jsx("div", { className: "feature-icon", children: /* @__PURE__ */ jsx(
2166
+ InlineText,
2167
+ {
2168
+ as: "span",
2169
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "icon", value),
2170
+ placeholder: "01",
2171
+ value: normalizeText(itemRecord?.icon)
2172
+ }
2173
+ ) }),
1815
2174
  /* @__PURE__ */ jsx(
1816
- "img",
2175
+ InlineText,
2176
+ {
2177
+ as: "h3",
2178
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "title", value),
2179
+ placeholder: "Feature title",
2180
+ value: normalizeText(itemRecord?.title)
2181
+ }
2182
+ ),
2183
+ /* @__PURE__ */ jsx(
2184
+ InlineText,
1817
2185
  {
1818
- alt: resolveMedia(item?.media)?.alt || normalizeText(item?.title, "Feature image"),
1819
- className: "feature-item-media",
1820
- src: resolveMedia(item?.media)?.url
2186
+ as: "p",
2187
+ multiline: true,
2188
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "description", value),
2189
+ placeholder: "Feature description",
2190
+ value: normalizeText(itemRecord?.description)
1821
2191
  }
1822
2192
  )
1823
- ) : null,
1824
- /* @__PURE__ */ jsx("div", { className: "feature-icon", children: /* @__PURE__ */ jsx(
1825
- InlineText,
1826
- {
1827
- as: "span",
1828
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "icon", value),
1829
- placeholder: "01",
1830
- value: normalizeText(item?.icon)
1831
- }
1832
- ) }),
1833
- /* @__PURE__ */ jsx(
1834
- InlineText,
1835
- {
1836
- as: "h3",
1837
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "title", value),
1838
- placeholder: "Feature title",
1839
- value: normalizeText(item?.title)
1840
- }
1841
- ),
1842
- /* @__PURE__ */ jsx(
1843
- InlineText,
1844
- {
1845
- as: "p",
1846
- multiline: true,
1847
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "description", value),
1848
- placeholder: "Feature description",
1849
- value: normalizeText(item?.description)
1850
- }
1851
- )
1852
- ] }, `item-${itemIndex}`)) })
2193
+ ] }, `item-${itemIndex}`);
2194
+ }) })
1853
2195
  ] }) })
1854
2196
  )
1855
2197
  },
@@ -1879,47 +2221,57 @@ function BuilderPageEditor({ initialDoc, pageID }) {
1879
2221
  value: normalizeText(block.title)
1880
2222
  }
1881
2223
  ) }) }),
1882
- /* @__PURE__ */ jsx("div", { className: "card-grid services", children: items.map((item, itemIndex) => /* @__PURE__ */ jsx("article", { className: "service-card", children: /* @__PURE__ */ jsxs("div", { className: "service-body", children: [
1883
- resolveMedia(item?.media)?.url ? (
1884
- // eslint-disable-next-line @next/next/no-img-element
2224
+ /* @__PURE__ */ jsx("div", { className: "card-grid services", children: items.map((item, itemIndex) => {
2225
+ const itemRecord = item;
2226
+ const itemMedia = resolveMedia(itemRecord?.media);
2227
+ const itemImageStyle = getImagePresentationStyle({
2228
+ cornerStyle: normalizeImageCornerStyle(itemRecord?.imageCornerStyle),
2229
+ fit: normalizeImageFit(itemRecord?.imageFit),
2230
+ position: normalizeImagePosition(itemRecord?.imagePosition)
2231
+ });
2232
+ return /* @__PURE__ */ jsx("article", { className: "service-card", children: /* @__PURE__ */ jsxs("div", { className: "service-body", children: [
2233
+ itemMedia?.url ? (
2234
+ // eslint-disable-next-line @next/next/no-img-element
2235
+ /* @__PURE__ */ jsx(
2236
+ "img",
2237
+ {
2238
+ alt: itemMedia.alt || normalizeText(itemRecord?.title, "Feature image"),
2239
+ className: "feature-item-media feature-item-media-card",
2240
+ src: itemMedia.url,
2241
+ style: itemImageStyle
2242
+ }
2243
+ )
2244
+ ) : null,
2245
+ /* @__PURE__ */ jsx("div", { className: "service-tag", children: /* @__PURE__ */ jsx(
2246
+ InlineText,
2247
+ {
2248
+ as: "span",
2249
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "icon", value),
2250
+ placeholder: "01",
2251
+ value: normalizeText(itemRecord?.icon)
2252
+ }
2253
+ ) }),
1885
2254
  /* @__PURE__ */ jsx(
1886
- "img",
2255
+ InlineText,
2256
+ {
2257
+ as: "h3",
2258
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "title", value),
2259
+ placeholder: "Feature title",
2260
+ value: normalizeText(itemRecord?.title)
2261
+ }
2262
+ ),
2263
+ /* @__PURE__ */ jsx(
2264
+ InlineText,
1887
2265
  {
1888
- alt: resolveMedia(item?.media)?.alt || normalizeText(item?.title, "Feature image"),
1889
- className: "feature-item-media feature-item-media-card",
1890
- src: resolveMedia(item?.media)?.url
2266
+ as: "p",
2267
+ multiline: true,
2268
+ onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "description", value),
2269
+ placeholder: "Feature description",
2270
+ value: normalizeText(itemRecord?.description)
1891
2271
  }
1892
2272
  )
1893
- ) : null,
1894
- /* @__PURE__ */ jsx("div", { className: "service-tag", children: /* @__PURE__ */ jsx(
1895
- InlineText,
1896
- {
1897
- as: "span",
1898
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "icon", value),
1899
- placeholder: "01",
1900
- value: normalizeText(item?.icon)
1901
- }
1902
- ) }),
1903
- /* @__PURE__ */ jsx(
1904
- InlineText,
1905
- {
1906
- as: "h3",
1907
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "title", value),
1908
- placeholder: "Feature title",
1909
- value: normalizeText(item?.title)
1910
- }
1911
- ),
1912
- /* @__PURE__ */ jsx(
1913
- InlineText,
1914
- {
1915
- as: "p",
1916
- multiline: true,
1917
- onCommit: (value) => updateArrayItemField(index, "items", itemIndex, "description", value),
1918
- placeholder: "Feature description",
1919
- value: normalizeText(item?.description)
1920
- }
1921
- )
1922
- ] }) }, `item-${itemIndex}`)) })
2273
+ ] }) }, `item-${itemIndex}`);
2274
+ }) })
1923
2275
  ] })
1924
2276
  )
1925
2277
  },
@@ -2038,6 +2390,12 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2038
2390
  ] }) }),
2039
2391
  /* @__PURE__ */ jsx("div", { className: "orion-logo-wall", children: items.map((item, itemIndex) => {
2040
2392
  const media = resolveMedia(item?.media);
2393
+ const imageStyle = getImagePresentationStyle({
2394
+ cornerStyle: normalizeImageCornerStyle(item?.imageCornerStyle),
2395
+ fit: normalizeImageFit(item?.imageFit),
2396
+ position: normalizeImagePosition(item?.imagePosition),
2397
+ roundedRadius: 10
2398
+ });
2041
2399
  return /* @__PURE__ */ jsx("article", { className: "orion-logo-wall-item", children: media?.url ? (
2042
2400
  // eslint-disable-next-line @next/next/no-img-element
2043
2401
  /* @__PURE__ */ jsx(
@@ -2045,7 +2403,8 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2045
2403
  {
2046
2404
  alt: media.alt || normalizeText(item?.name, "Logo"),
2047
2405
  className: "orion-logo-wall-image",
2048
- src: media.url
2406
+ src: media.url,
2407
+ style: imageStyle
2049
2408
  }
2050
2409
  )
2051
2410
  ) : /* @__PURE__ */ jsx(
@@ -2104,6 +2463,11 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2104
2463
  /* @__PURE__ */ jsx("div", { className: "orion-before-after-grid", children: items.map((item, itemIndex) => {
2105
2464
  const beforeMedia = resolveMedia(item?.beforeMedia);
2106
2465
  const afterMedia = resolveMedia(item?.afterMedia);
2466
+ const imageStyle = getImagePresentationStyle({
2467
+ cornerStyle: normalizeImageCornerStyle(item?.imageCornerStyle),
2468
+ fit: normalizeImageFit(item?.imageFit),
2469
+ position: normalizeImagePosition(item?.imagePosition)
2470
+ });
2107
2471
  return /* @__PURE__ */ jsxs("article", { className: "orion-before-after-card", children: [
2108
2472
  /* @__PURE__ */ jsxs("div", { className: "orion-before-after-media", children: [
2109
2473
  /* @__PURE__ */ jsxs("figure", { children: [
@@ -2113,7 +2477,8 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2113
2477
  "img",
2114
2478
  {
2115
2479
  alt: beforeMedia.alt || `${normalizeText(item?.label, "Project")} before`,
2116
- src: beforeMedia.url
2480
+ src: beforeMedia.url,
2481
+ style: imageStyle
2117
2482
  }
2118
2483
  )
2119
2484
  ) : /* @__PURE__ */ jsx("div", { className: "orion-before-after-placeholder", children: "Before" }),
@@ -2126,7 +2491,8 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2126
2491
  "img",
2127
2492
  {
2128
2493
  alt: afterMedia.alt || `${normalizeText(item?.label, "Project")} after`,
2129
- src: afterMedia.url
2494
+ src: afterMedia.url,
2495
+ style: imageStyle
2130
2496
  }
2131
2497
  )
2132
2498
  ) : /* @__PURE__ */ jsx("div", { className: "orion-before-after-placeholder", children: "After" }),
@@ -2391,6 +2757,11 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2391
2757
  if (type === "media") {
2392
2758
  const image = resolveMedia(block.image);
2393
2759
  const size = normalizeText(block.size, "default");
2760
+ const imageStyle = getImagePresentationStyle({
2761
+ cornerStyle: normalizeImageCornerStyle(block?.imageCornerStyle),
2762
+ fit: normalizeImageFit(block?.imageFit),
2763
+ position: normalizeImagePosition(block?.imagePosition)
2764
+ });
2394
2765
  return /* @__PURE__ */ jsx(
2395
2766
  BlockFrame,
2396
2767
  {
@@ -2407,7 +2778,7 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2407
2778
  /* @__PURE__ */ jsxs("figure", { className: `media-figure ${size === "wide" ? "wide" : ""}`, children: [
2408
2779
  image?.url ? (
2409
2780
  // eslint-disable-next-line @next/next/no-img-element
2410
- /* @__PURE__ */ jsx("img", { alt: image.alt || "Page media", src: image.url })
2781
+ /* @__PURE__ */ jsx("img", { alt: image.alt || "Page media", src: image.url, style: imageStyle })
2411
2782
  ) : /* @__PURE__ */ jsx(
2412
2783
  "div",
2413
2784
  {
@@ -2610,998 +2981,1572 @@ function BuilderPageEditor({ initialDoc, pageID }) {
2610
2981
  ] }) : /* @__PURE__ */ jsx("span", { children: "+" })
2611
2982
  }
2612
2983
  ),
2613
- sidebarOpen ? /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 12, maxHeight: "calc(100vh - 90px)", overflowY: "auto", padding: 12 }, children: [
2614
- /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
2615
- /* @__PURE__ */ jsxs(
2984
+ (() => {
2985
+ const tabs = [
2986
+ { key: "pageDefaults", label: "Page Defaults" },
2987
+ { key: "addSections", label: "Add Sections" },
2988
+ { key: "selected", label: "Selected Section" }
2989
+ ].map((panel) => {
2990
+ const isActive = activeSidebarPanel === panel.key;
2991
+ const iconFill = isActive ? "#ffffff" : "#124a37";
2992
+ const iconButtonBg = isActive ? "#124a37" : "rgba(18, 74, 55, 0.08)";
2993
+ return /* @__PURE__ */ jsxs(
2616
2994
  "button",
2617
2995
  {
2618
- onClick: () => togglePanel("save"),
2619
- style: { alignItems: "center", background: "transparent", border: "none", cursor: "pointer", display: "flex", fontSize: 13, fontWeight: 700, justifyContent: "space-between", padding: 0, width: "100%" },
2996
+ "aria-label": panel.label,
2997
+ onClick: () => openSidebarPanel(panel.key),
2998
+ style: {
2999
+ alignItems: "center",
3000
+ background: iconButtonBg,
3001
+ border: "1px solid rgba(18, 74, 55, 0.14)",
3002
+ borderRadius: 14,
3003
+ cursor: "pointer",
3004
+ display: "grid",
3005
+ height: 34,
3006
+ placeItems: "center",
3007
+ width: 34
3008
+ },
3009
+ title: panel.label,
2620
3010
  type: "button",
2621
3011
  children: [
2622
- /* @__PURE__ */ jsx("span", { children: "Save & Publish" }),
2623
- /* @__PURE__ */ jsx("span", { children: panelState.save ? "Hide" : "Show" })
3012
+ panel.key === "pageDefaults" ? /* @__PURE__ */ jsxs("svg", { fill: "none", height: "18", viewBox: "0 0 24 24", width: "18", children: [
3013
+ /* @__PURE__ */ jsx("rect", { height: "14", rx: "2", stroke: iconFill, strokeWidth: "2", width: "18", x: "3", y: "5" }),
3014
+ /* @__PURE__ */ jsx("path", { d: "M9 5v14", stroke: iconFill, strokeWidth: "2" })
3015
+ ] }) : null,
3016
+ panel.key === "addSections" ? /* @__PURE__ */ jsxs("svg", { fill: "none", height: "18", viewBox: "0 0 24 24", width: "18", children: [
3017
+ /* @__PURE__ */ jsx("path", { d: "M12 5v14", stroke: iconFill, strokeWidth: "2", strokeLinecap: "round" }),
3018
+ /* @__PURE__ */ jsx("path", { d: "M5 12h14", stroke: iconFill, strokeWidth: "2", strokeLinecap: "round" })
3019
+ ] }) : null,
3020
+ panel.key === "selected" ? /* @__PURE__ */ jsx("svg", { fill: "none", height: "18", viewBox: "0 0 24 24", width: "18", children: /* @__PURE__ */ jsx("path", { d: "M6 3l12 9-7 2-2 7-3-18z", fill: iconFill, opacity: "0.92" }) }) : null
2624
3021
  ]
2625
- }
2626
- ),
2627
- panelState.save ? /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: [
2628
- /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11, fontWeight: 600 }, children: isDirty ? "Unsaved edits" : "All changes saved" }),
2629
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6 }, children: [
2630
- /* @__PURE__ */ jsx(
2631
- "button",
2632
- {
2633
- disabled: !canUndo,
2634
- onClick: undo,
2635
- style: { borderRadius: 999, cursor: canUndo ? "pointer" : "not-allowed", fontSize: 12, padding: "7px 10px" },
2636
- type: "button",
2637
- children: "Undo"
2638
- }
2639
- ),
2640
- /* @__PURE__ */ jsx(
2641
- "button",
2642
- {
2643
- disabled: !canRedo,
2644
- onClick: redo,
2645
- style: { borderRadius: 999, cursor: canRedo ? "pointer" : "not-allowed", fontSize: 12, padding: "7px 10px" },
2646
- type: "button",
2647
- children: "Redo"
2648
- }
2649
- )
2650
- ] }),
2651
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6 }, children: [
2652
- /* @__PURE__ */ jsx(
2653
- "button",
2654
- {
2655
- disabled: savingStatus !== null,
2656
- onClick: () => void saveLayout("draft"),
2657
- style: {
2658
- borderRadius: 999,
2659
- cursor: savingStatus ? "not-allowed" : "pointer",
2660
- fontSize: 12,
2661
- fontWeight: 700,
2662
- padding: "7px 10px"
2663
- },
2664
- type: "button",
2665
- children: savingStatus === "draft" ? "Saving..." : "Save Draft"
2666
- }
2667
- ),
2668
- /* @__PURE__ */ jsx(
2669
- "button",
2670
- {
2671
- disabled: savingStatus !== null,
2672
- onClick: () => void saveLayout("published"),
2673
- style: {
2674
- background: "#0f7d52",
2675
- border: "none",
2676
- borderRadius: 999,
2677
- color: "#fff",
2678
- cursor: savingStatus ? "not-allowed" : "pointer",
2679
- fontSize: 12,
2680
- fontWeight: 700,
2681
- padding: "7px 10px"
2682
- },
2683
- type: "button",
2684
- children: savingStatus === "published" ? "Publishing..." : "Publish"
2685
- }
2686
- )
2687
- ] }),
2688
- saveMessage ? /* @__PURE__ */ jsx("div", { style: { color: "#0f7d52", fontSize: 11, fontWeight: 700 }, children: saveMessage }) : null,
2689
- saveError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11, fontWeight: 700 }, children: saveError }) : null
2690
- ] }) : null
2691
- ] }),
2692
- /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
2693
- /* @__PURE__ */ jsxs(
2694
- "button",
2695
- {
2696
- onClick: () => togglePanel("pageDefaults"),
2697
- style: { alignItems: "center", background: "transparent", border: "none", cursor: "pointer", display: "flex", fontSize: 13, fontWeight: 700, justifyContent: "space-between", padding: 0, width: "100%" },
2698
- type: "button",
2699
- children: [
2700
- /* @__PURE__ */ jsx("span", { children: "Page Defaults" }),
2701
- /* @__PURE__ */ jsx("span", { children: panelState.pageDefaults ? "Hide" : "Show" })
2702
- ]
2703
- }
2704
- ),
2705
- panelState.pageDefaults ? /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: [
2706
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2707
- "Default Page Width",
2708
- /* @__PURE__ */ jsxs(
2709
- "select",
2710
- {
2711
- onChange: (event) => setPageDefaults((current) => ({
2712
- ...current,
2713
- pageWidthDefault: event.target.value === "wide" || event.target.value === "full" ? event.target.value : "content"
2714
- })),
2715
- style: sidebarInputStyle,
2716
- value: pageDefaults.pageWidthDefault,
2717
- children: [
2718
- /* @__PURE__ */ jsx("option", { value: "content", children: "Content" }),
2719
- /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" }),
2720
- /* @__PURE__ */ jsx("option", { value: "full", children: "Full" })
2721
- ]
2722
- }
2723
- )
2724
- ] }),
2725
- /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Applies when section/content width is set to inherit." })
2726
- ] }) : null
2727
- ] }),
2728
- /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
2729
- /* @__PURE__ */ jsxs(
2730
- "button",
2731
- {
2732
- onClick: () => togglePanel("addSections"),
2733
- style: { alignItems: "center", background: "transparent", border: "none", cursor: "pointer", display: "flex", fontSize: 13, fontWeight: 700, justifyContent: "space-between", padding: 0, width: "100%" },
2734
- type: "button",
2735
- children: [
2736
- /* @__PURE__ */ jsx("span", { children: "Add Sections" }),
2737
- /* @__PURE__ */ jsx("span", { children: panelState.addSections ? "Hide" : "Show" })
2738
- ]
2739
- }
2740
- ),
2741
- panelState.addSections ? /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: [
2742
- /* @__PURE__ */ jsxs(
2743
- "button",
2744
- {
2745
- onClick: applyTemplateStarter,
2746
- style: {
2747
- background: "#0f7d52",
2748
- border: "none",
2749
- borderRadius: 999,
2750
- color: "#fff",
2751
- cursor: "pointer",
2752
- fontSize: 12,
2753
- fontWeight: 700,
2754
- padding: "8px 10px"
2755
- },
2756
- type: "button",
2757
- children: [
2758
- "Apply ",
2759
- pageTemplate,
2760
- " Template Starter"
2761
- ]
2762
- }
2763
- ),
2764
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8 }, children: [
2765
- /* @__PURE__ */ jsx(
2766
- "input",
2767
- {
2768
- onChange: (event) => setPresetQuery(event.target.value),
2769
- placeholder: "Search presets...",
2770
- style: sidebarInputStyle,
2771
- type: "text",
2772
- value: presetQuery
2773
- }
2774
- ),
2775
- filteredSectionPresets.map((preset) => /* @__PURE__ */ jsxs(
2776
- "button",
2777
- {
2778
- onClick: () => addSectionPreset(preset.blocks),
2779
- style: {
2780
- border: "1px solid rgba(13, 74, 55, 0.2)",
2781
- borderRadius: 10,
2782
- cursor: "pointer",
2783
- display: "grid",
2784
- gap: 3,
2785
- padding: 9,
2786
- textAlign: "left"
2787
- },
2788
- type: "button",
2789
- children: [
2790
- /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 700 }, children: preset.title }),
2791
- /* @__PURE__ */ jsx("span", { style: { color: "var(--ink-700)", fontSize: 11 }, children: preset.description })
2792
- ]
2793
- },
2794
- preset.id
2795
- )),
2796
- filteredSectionPresets.length === 0 ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "No presets match this search." }) : null
2797
- ] })
2798
- ] }) : null
2799
- ] }),
2800
- /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
2801
- /* @__PURE__ */ jsxs(
2802
- "button",
2803
- {
2804
- onClick: () => togglePanel("quickAdd"),
2805
- style: { alignItems: "center", background: "transparent", border: "none", cursor: "pointer", display: "flex", fontSize: 13, fontWeight: 700, justifyContent: "space-between", padding: 0, width: "100%" },
2806
- type: "button",
2807
- children: [
2808
- /* @__PURE__ */ jsx("span", { children: "Quick Add Block" }),
2809
- /* @__PURE__ */ jsx("span", { children: panelState.quickAdd ? "Hide" : "Show" })
2810
- ]
2811
- }
2812
- ),
2813
- panelState.quickAdd ? /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr", marginTop: 10 }, children: quickAddBlockTypes.map((type) => /* @__PURE__ */ jsxs(
2814
- "button",
3022
+ },
3023
+ panel.key
3024
+ );
3025
+ });
3026
+ return sidebarOpen ? /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateRows: "auto 1fr", maxHeight: "calc(100vh - 90px)", overflow: "hidden" }, children: [
3027
+ /* @__PURE__ */ jsx(
3028
+ "div",
2815
3029
  {
2816
- onClick: () => addBlockByType(type),
2817
3030
  style: {
2818
- border: "1px solid rgba(13, 74, 55, 0.2)",
2819
- borderRadius: 10,
2820
- cursor: "pointer",
2821
- fontSize: 12,
2822
- fontWeight: 600,
2823
- padding: "8px 7px"
3031
+ alignItems: "center",
3032
+ background: "linear-gradient(180deg, rgba(18, 74, 55, 0.06), rgba(18, 74, 55, 0))",
3033
+ borderBottom: "1px solid rgba(13, 74, 55, 0.12)",
3034
+ display: "flex",
3035
+ gap: 8,
3036
+ padding: "10px 10px"
2824
3037
  },
2825
- type: "button",
2826
- children: [
2827
- "+ ",
2828
- blockTypeLabels[type] || type
2829
- ]
2830
- },
2831
- type
2832
- )) }) : null
2833
- ] }),
2834
- /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
2835
- /* @__PURE__ */ jsxs(
2836
- "button",
2837
- {
2838
- onClick: () => togglePanel("selected"),
2839
- style: { alignItems: "center", background: "transparent", border: "none", cursor: "pointer", display: "flex", fontSize: 13, fontWeight: 700, justifyContent: "space-between", padding: 0, width: "100%" },
2840
- type: "button",
2841
- children: [
2842
- /* @__PURE__ */ jsx("span", { children: "Selected Section" }),
2843
- /* @__PURE__ */ jsx("span", { children: selectedIndex !== null ? `#${selectedIndex + 1}` : "None" })
2844
- ]
3038
+ children: tabs
2845
3039
  }
2846
3040
  ),
2847
- panelState.selected ? /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: selectedBlock ? /* @__PURE__ */ jsxs(Fragment, { children: [
2848
- /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12, fontWeight: 600 }, children: blockTypeLabels[selectedType] || selectedType }),
2849
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
2850
- /* @__PURE__ */ jsx(
2851
- "button",
2852
- {
2853
- disabled: selectedIndex === null || selectedIndex <= 0,
2854
- onClick: () => moveSelectedBlock("up"),
2855
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
2856
- type: "button",
2857
- children: "Move Up"
2858
- }
2859
- ),
2860
- /* @__PURE__ */ jsx(
2861
- "button",
2862
- {
2863
- disabled: selectedIndex === null || selectedIndex >= layout.length - 1,
2864
- onClick: () => moveSelectedBlock("down"),
2865
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
2866
- type: "button",
2867
- children: "Move Down"
2868
- }
2869
- ),
2870
- /* @__PURE__ */ jsx(
2871
- "button",
2872
- {
2873
- onClick: duplicateSelectedBlock,
2874
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
2875
- type: "button",
2876
- children: "Duplicate"
2877
- }
2878
- ),
2879
- /* @__PURE__ */ jsx(
2880
- "button",
2881
- {
2882
- onClick: removeSelectedBlock,
2883
- style: {
2884
- background: "#8d1d1d",
2885
- border: "none",
2886
- borderRadius: 999,
2887
- color: "#fff",
2888
- cursor: "pointer",
2889
- fontSize: 12,
2890
- padding: "7px 10px"
2891
- },
2892
- type: "button",
2893
- children: "Remove"
2894
- }
2895
- )
2896
- ] }),
2897
- /* @__PURE__ */ jsxs("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: [
2898
- "Section width follows ",
2899
- /* @__PURE__ */ jsx("strong", { children: "Page Defaults" }),
2900
- " for a consistent page layout."
2901
- ] }),
2902
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2903
- "Content Width",
2904
- /* @__PURE__ */ jsxs(
2905
- "select",
2906
- {
2907
- onChange: (event) => setSelectedStyleField("contentWidth", event.target.value),
2908
- style: sidebarInputStyle,
2909
- value: normalizeText(selectedSectionStyle.contentWidth, "inherit"),
2910
- children: [
2911
- /* @__PURE__ */ jsx("option", { value: "inherit", children: "Inherit Page Default" }),
2912
- /* @__PURE__ */ jsx("option", { value: "narrow", children: "Narrow" }),
2913
- /* @__PURE__ */ jsx("option", { value: "content", children: "Content" }),
2914
- /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" }),
2915
- /* @__PURE__ */ jsx("option", { value: "full", children: "Full" })
2916
- ]
2917
- }
2918
- )
2919
- ] }),
2920
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2921
- "Section Vertical Spacing",
2922
- /* @__PURE__ */ jsxs(
2923
- "select",
2924
- {
2925
- onChange: (event) => setSelectedStyleField("sectionPaddingY", event.target.value),
2926
- style: sidebarInputStyle,
2927
- value: normalizeText(selectedSectionStyle.sectionPaddingY, "md"),
2928
- children: [
2929
- /* @__PURE__ */ jsx("option", { value: "sm", children: "Small" }),
2930
- /* @__PURE__ */ jsx("option", { value: "md", children: "Medium" }),
2931
- /* @__PURE__ */ jsx("option", { value: "lg", children: "Large" })
2932
- ]
2933
- }
2934
- )
2935
- ] }),
2936
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2937
- "Section Background",
2938
- /* @__PURE__ */ jsxs(
2939
- "select",
2940
- {
2941
- onChange: (event) => setSelectedStyleField("sectionBackgroundMode", event.target.value),
2942
- style: sidebarInputStyle,
2943
- value: normalizeText(selectedSectionStyle.sectionBackgroundMode, "none"),
2944
- children: [
2945
- /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
2946
- /* @__PURE__ */ jsx("option", { value: "color", children: "Color" }),
2947
- /* @__PURE__ */ jsx("option", { value: "gradient", children: "Gradient" })
2948
- ]
2949
- }
2950
- )
2951
- ] }),
2952
- normalizeText(selectedSectionStyle.sectionBackgroundMode, "none") === "color" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2953
- "Section Background Color",
2954
- /* @__PURE__ */ jsx(
2955
- "input",
2956
- {
2957
- onChange: (event) => setSelectedStyleField("sectionBackgroundColor", event.target.value),
2958
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
2959
- type: "color",
2960
- value: parseColor(selectedSectionStyle.sectionBackgroundColor, "#ffffff")
2961
- }
2962
- )
2963
- ] }) : null,
2964
- normalizeText(selectedSectionStyle.sectionBackgroundMode, "none") === "gradient" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2965
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2966
- "Section Gradient Preset",
3041
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", overflowY: "auto", padding: 12 }, children: [
3042
+ activeSidebarPanel === "pageDefaults" ? /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
3043
+ /* @__PURE__ */ jsxs("div", { style: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
3044
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 800 }, children: "Page Defaults" }),
2967
3045
  /* @__PURE__ */ jsx(
2968
- "select",
3046
+ "button",
2969
3047
  {
2970
- onChange: (event) => applyGradientPreset("section", event.target.value),
2971
- style: sidebarInputStyle,
2972
- value: normalizeText(selectedSectionStyle.sectionGradientPreset, "forest"),
2973
- children: Object.keys(gradientPresetPairs).map((preset) => /* @__PURE__ */ jsx("option", { value: preset, children: preset }, preset))
3048
+ onClick: collapseSidebar,
3049
+ style: {
3050
+ background: "transparent",
3051
+ border: "none",
3052
+ color: "var(--ink-700)",
3053
+ cursor: "pointer",
3054
+ fontSize: 12,
3055
+ fontWeight: 700,
3056
+ padding: 0
3057
+ },
3058
+ type: "button",
3059
+ children: "Hide"
2974
3060
  }
2975
3061
  )
2976
3062
  ] }),
2977
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr" }, children: [
3063
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: [
2978
3064
  /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2979
- "From",
2980
- /* @__PURE__ */ jsx(
2981
- "input",
3065
+ "Default Page Width",
3066
+ /* @__PURE__ */ jsxs(
3067
+ "select",
2982
3068
  {
2983
- onChange: (event) => setSelectedStyleField("sectionGradientFrom", event.target.value),
2984
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
2985
- type: "color",
2986
- value: parseColor(selectedSectionStyle.sectionGradientFrom, "#124a37")
3069
+ onChange: (event) => setPageDefaults((current) => ({
3070
+ ...current,
3071
+ pageWidthDefault: event.target.value === "wide" || event.target.value === "full" ? event.target.value : "content"
3072
+ })),
3073
+ style: sidebarInputStyle,
3074
+ value: pageDefaults.pageWidthDefault,
3075
+ children: [
3076
+ /* @__PURE__ */ jsx("option", { value: "content", children: "Content" }),
3077
+ /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" }),
3078
+ /* @__PURE__ */ jsx("option", { value: "full", children: "Full" })
3079
+ ]
2987
3080
  }
2988
3081
  )
2989
3082
  ] }),
2990
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
2991
- "To",
2992
- /* @__PURE__ */ jsx(
2993
- "input",
2994
- {
2995
- onChange: (event) => setSelectedStyleField("sectionGradientTo", event.target.value),
2996
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
2997
- type: "color",
2998
- value: parseColor(selectedSectionStyle.sectionGradientTo, "#1f684f")
2999
- }
3000
- )
3001
- ] })
3002
- ] }),
3003
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3004
- "Angle",
3005
- /* @__PURE__ */ jsx(
3006
- "input",
3007
- {
3008
- max: 360,
3009
- min: 0,
3010
- onChange: (event) => setSelectedStyleField("sectionGradientAngle", event.target.value),
3011
- style: sidebarInputStyle,
3012
- type: "number",
3013
- value: parseAngle(selectedSectionStyle.sectionGradientAngle, "135")
3014
- }
3015
- )
3083
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Applies when section/content width is set to inherit." })
3016
3084
  ] })
3017
3085
  ] }) : null,
3018
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3019
- "Content Background",
3020
- /* @__PURE__ */ jsxs(
3021
- "select",
3022
- {
3023
- onChange: (event) => setSelectedStyleField("contentBackgroundMode", event.target.value),
3024
- style: sidebarInputStyle,
3025
- value: normalizeText(selectedSectionStyle.contentBackgroundMode, "none"),
3026
- children: [
3027
- /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
3028
- /* @__PURE__ */ jsx("option", { value: "color", children: "Color" }),
3029
- /* @__PURE__ */ jsx("option", { value: "gradient", children: "Gradient" })
3030
- ]
3031
- }
3032
- )
3033
- ] }),
3034
- normalizeText(selectedSectionStyle.contentBackgroundMode, "none") === "color" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3035
- "Content Background Color",
3036
- /* @__PURE__ */ jsx(
3037
- "input",
3038
- {
3039
- onChange: (event) => setSelectedStyleField("contentBackgroundColor", event.target.value),
3040
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3041
- type: "color",
3042
- value: parseColor(selectedSectionStyle.contentBackgroundColor, "#ffffff")
3043
- }
3044
- )
3045
- ] }) : null,
3046
- normalizeText(selectedSectionStyle.contentBackgroundMode, "none") === "gradient" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3047
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3048
- "Content Gradient Preset",
3086
+ activeSidebarPanel === "addSections" ? /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
3087
+ /* @__PURE__ */ jsxs("div", { style: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
3088
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 13, fontWeight: 800 }, children: "Add Sections" }),
3049
3089
  /* @__PURE__ */ jsx(
3050
- "select",
3090
+ "button",
3051
3091
  {
3052
- onChange: (event) => applyGradientPreset("content", event.target.value),
3053
- style: sidebarInputStyle,
3054
- value: normalizeText(selectedSectionStyle.contentGradientPreset, "none"),
3055
- children: Object.keys(gradientPresetPairs).map((preset) => /* @__PURE__ */ jsx("option", { value: preset, children: preset }, preset))
3092
+ onClick: collapseSidebar,
3093
+ style: {
3094
+ background: "transparent",
3095
+ border: "none",
3096
+ color: "var(--ink-700)",
3097
+ cursor: "pointer",
3098
+ fontSize: 12,
3099
+ fontWeight: 700,
3100
+ padding: 0
3101
+ },
3102
+ type: "button",
3103
+ children: "Hide"
3056
3104
  }
3057
3105
  )
3058
3106
  ] }),
3059
- /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr" }, children: [
3060
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3061
- "From",
3107
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 10, marginTop: 10 }, children: [
3108
+ /* @__PURE__ */ jsxs(
3109
+ "button",
3110
+ {
3111
+ onClick: applyTemplateStarter,
3112
+ style: {
3113
+ background: "#0f7d52",
3114
+ border: "none",
3115
+ borderRadius: 999,
3116
+ color: "#fff",
3117
+ cursor: "pointer",
3118
+ fontSize: 12,
3119
+ fontWeight: 700,
3120
+ padding: "8px 10px"
3121
+ },
3122
+ type: "button",
3123
+ children: [
3124
+ "Apply ",
3125
+ pageTemplate,
3126
+ " Template Starter"
3127
+ ]
3128
+ }
3129
+ ),
3130
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 8 }, children: [
3062
3131
  /* @__PURE__ */ jsx(
3063
3132
  "input",
3064
3133
  {
3065
- onChange: (event) => setSelectedStyleField("contentGradientFrom", event.target.value),
3066
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3067
- type: "color",
3068
- value: parseColor(selectedSectionStyle.contentGradientFrom, "#ffffff")
3134
+ onChange: (event) => setPresetQuery(event.target.value),
3135
+ placeholder: "Search section presets...",
3136
+ style: sidebarInputStyle,
3137
+ type: "text",
3138
+ value: presetQuery
3069
3139
  }
3070
- )
3140
+ ),
3141
+ filteredSectionPresets.map((preset) => /* @__PURE__ */ jsxs(
3142
+ "button",
3143
+ {
3144
+ onClick: () => addSectionPreset(preset.blocks),
3145
+ style: {
3146
+ border: "1px solid rgba(13, 74, 55, 0.2)",
3147
+ borderRadius: 10,
3148
+ cursor: "pointer",
3149
+ display: "grid",
3150
+ gap: 3,
3151
+ padding: 9,
3152
+ textAlign: "left"
3153
+ },
3154
+ type: "button",
3155
+ children: [
3156
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 700 }, children: preset.title }),
3157
+ /* @__PURE__ */ jsx("span", { style: { color: "var(--ink-700)", fontSize: 11 }, children: preset.description })
3158
+ ]
3159
+ },
3160
+ preset.id
3161
+ )),
3162
+ filteredSectionPresets.length === 0 ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "No presets match this search." }) : null
3071
3163
  ] }),
3072
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3073
- "To",
3074
- /* @__PURE__ */ jsx(
3075
- "input",
3164
+ /* @__PURE__ */ jsxs("div", { style: { borderTop: "1px solid rgba(13, 74, 55, 0.12)", marginTop: 2, paddingTop: 10 }, children: [
3165
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11, fontWeight: 800, textTransform: "uppercase" }, children: "Quick Add Blocks" }),
3166
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr", marginTop: 8 }, children: quickAddBlockTypes.map((type) => /* @__PURE__ */ jsxs(
3167
+ "button",
3076
3168
  {
3077
- onChange: (event) => setSelectedStyleField("contentGradientTo", event.target.value),
3078
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3079
- type: "color",
3080
- value: parseColor(selectedSectionStyle.contentGradientTo, "#f4f6f2")
3081
- }
3082
- )
3169
+ onClick: () => addBlockByType(type),
3170
+ style: {
3171
+ border: "1px solid rgba(13, 74, 55, 0.2)",
3172
+ borderRadius: 10,
3173
+ cursor: "pointer",
3174
+ fontSize: 12,
3175
+ fontWeight: 600,
3176
+ padding: "8px 7px"
3177
+ },
3178
+ type: "button",
3179
+ children: [
3180
+ "+ ",
3181
+ blockTypeLabels[type] || type
3182
+ ]
3183
+ },
3184
+ type
3185
+ )) })
3083
3186
  ] })
3084
- ] }),
3085
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3086
- "Angle",
3087
- /* @__PURE__ */ jsx(
3088
- "input",
3089
- {
3090
- max: 360,
3091
- min: 0,
3092
- onChange: (event) => setSelectedStyleField("contentGradientAngle", event.target.value),
3093
- style: sidebarInputStyle,
3094
- type: "number",
3095
- value: parseAngle(selectedSectionStyle.contentGradientAngle, "135")
3096
- }
3097
- )
3098
3187
  ] })
3099
3188
  ] }) : null,
3100
- selectedType === "hero" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3101
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3102
- "Variant",
3103
- /* @__PURE__ */ jsxs(
3104
- "select",
3105
- {
3106
- onChange: (event) => updateSelectedField("variant", event.target.value),
3107
- style: sidebarInputStyle,
3108
- value: normalizeText(selectedBlock.variant, "default"),
3109
- children: [
3110
- /* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
3111
- /* @__PURE__ */ jsx("option", { value: "centered", children: "Centered" })
3112
- ]
3113
- }
3114
- )
3115
- ] }),
3116
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3117
- "Background Image URL",
3118
- /* @__PURE__ */ jsx(
3119
- "input",
3120
- {
3121
- onChange: (event) => updateSelectedField("backgroundImageURL", event.target.value),
3122
- placeholder: "https://...",
3123
- style: sidebarInputStyle,
3124
- type: "text",
3125
- value: normalizeText(selectedBlock.backgroundImageURL)
3126
- }
3127
- )
3128
- ] }),
3129
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3130
- "Background Color",
3131
- /* @__PURE__ */ jsx(
3132
- "input",
3133
- {
3134
- onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
3135
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3136
- type: "color",
3137
- value: parseColor(selectedBlock.backgroundColor, "#124a37")
3138
- }
3139
- )
3140
- ] }),
3141
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3142
- "Upload Hero Background Image",
3189
+ activeSidebarPanel === "selected" ? /* @__PURE__ */ jsxs("section", { style: sidebarSectionStyle, children: [
3190
+ /* @__PURE__ */ jsxs("div", { style: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
3191
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 13, fontWeight: 800 }, children: [
3192
+ "Selected Section ",
3193
+ selectedIndex !== null ? `#${selectedIndex + 1}` : ""
3194
+ ] }),
3143
3195
  /* @__PURE__ */ jsx(
3144
- "input",
3196
+ "button",
3145
3197
  {
3146
- accept: "image/*",
3147
- disabled: uploadingTarget !== null,
3148
- onChange: (event) => {
3149
- const file = event.currentTarget.files?.[0];
3150
- if (file) {
3151
- void uploadMediaForSelected({ kind: "hero" }, file);
3152
- }
3153
- event.currentTarget.value = "";
3198
+ onClick: collapseSidebar,
3199
+ style: {
3200
+ background: "transparent",
3201
+ border: "none",
3202
+ color: "var(--ink-700)",
3203
+ cursor: "pointer",
3204
+ fontSize: 12,
3205
+ fontWeight: 700,
3206
+ padding: 0
3154
3207
  },
3155
- style: sidebarInputStyle,
3156
- type: "file"
3157
- }
3158
- )
3159
- ] })
3160
- ] }) : null,
3161
- selectedType === "featureGrid" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3162
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3163
- "Variant",
3164
- /* @__PURE__ */ jsxs(
3165
- "select",
3166
- {
3167
- onChange: (event) => updateSelectedField("variant", event.target.value),
3168
- style: sidebarInputStyle,
3169
- value: normalizeText(selectedBlock.variant, "cards"),
3170
- children: [
3171
- /* @__PURE__ */ jsx("option", { value: "cards", children: "Cards" }),
3172
- /* @__PURE__ */ jsx("option", { value: "highlight", children: "Highlight" })
3173
- ]
3174
- }
3175
- )
3176
- ] }),
3177
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3178
- "Highlight Background Color",
3179
- /* @__PURE__ */ jsx(
3180
- "input",
3181
- {
3182
- onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
3183
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3184
- type: "color",
3185
- value: parseColor(selectedBlock.backgroundColor, "#1f684f")
3208
+ type: "button",
3209
+ children: "Hide"
3186
3210
  }
3187
3211
  )
3188
3212
  ] }),
3189
- /* @__PURE__ */ jsx(
3190
- "button",
3191
- {
3192
- onClick: () => appendItemToSelected("items", {
3193
- description: "Describe this feature.",
3194
- icon: "04",
3195
- title: "New Feature"
3196
- }),
3197
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3198
- type: "button",
3199
- children: "Add Feature Item"
3200
- }
3201
- ),
3202
- /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3203
- /* @__PURE__ */ jsxs("div", { style: { color: "var(--ink-700)", fontSize: 11, fontWeight: 700 }, children: [
3204
- "Item ",
3205
- itemIndex + 1
3206
- ] }),
3207
- /* @__PURE__ */ jsx(
3208
- "input",
3209
- {
3210
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "title", event.target.value),
3211
- placeholder: "Title",
3212
- style: sidebarInputStyle,
3213
- type: "text",
3214
- value: normalizeText(item.title)
3215
- }
3216
- ),
3217
- /* @__PURE__ */ jsx(
3218
- "input",
3219
- {
3220
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "icon", event.target.value),
3221
- placeholder: "Icon",
3222
- style: sidebarInputStyle,
3223
- type: "text",
3224
- value: normalizeText(item.icon)
3225
- }
3226
- ),
3227
- /* @__PURE__ */ jsx(
3228
- "textarea",
3229
- {
3230
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
3231
- placeholder: "Description",
3232
- style: { ...sidebarInputStyle, minHeight: 70, resize: "vertical" },
3233
- value: normalizeText(item.description)
3234
- }
3235
- ),
3236
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3237
- "Item Image",
3213
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8, marginTop: 10 }, children: selectedBlock ? /* @__PURE__ */ jsxs(Fragment, { children: [
3214
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12, fontWeight: 600 }, children: blockTypeLabels[selectedType] || selectedType }),
3215
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
3238
3216
  /* @__PURE__ */ jsx(
3239
- "input",
3217
+ "button",
3240
3218
  {
3241
- accept: "image/*",
3242
- disabled: uploadingTarget !== null,
3243
- onChange: (event) => {
3244
- const file = event.currentTarget.files?.[0];
3245
- if (file) {
3246
- void uploadMediaForSelected({ field: "media", itemIndex, kind: "featureGridItem" }, file);
3247
- }
3248
- event.currentTarget.value = "";
3219
+ disabled: selectedIndex === null || selectedIndex <= 0,
3220
+ onClick: () => moveSelectedBlock("up"),
3221
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3222
+ type: "button",
3223
+ children: "Move Up"
3224
+ }
3225
+ ),
3226
+ /* @__PURE__ */ jsx(
3227
+ "button",
3228
+ {
3229
+ disabled: selectedIndex === null || selectedIndex >= layout.length - 1,
3230
+ onClick: () => moveSelectedBlock("down"),
3231
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3232
+ type: "button",
3233
+ children: "Move Down"
3234
+ }
3235
+ ),
3236
+ /* @__PURE__ */ jsx(
3237
+ "button",
3238
+ {
3239
+ onClick: duplicateSelectedBlock,
3240
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3241
+ type: "button",
3242
+ children: "Duplicate"
3243
+ }
3244
+ ),
3245
+ /* @__PURE__ */ jsx(
3246
+ "button",
3247
+ {
3248
+ onClick: removeSelectedBlock,
3249
+ style: {
3250
+ background: "#8d1d1d",
3251
+ border: "none",
3252
+ borderRadius: 999,
3253
+ color: "#fff",
3254
+ cursor: "pointer",
3255
+ fontSize: 12,
3256
+ padding: "7px 10px"
3249
3257
  },
3258
+ type: "button",
3259
+ children: "Remove"
3260
+ }
3261
+ )
3262
+ ] }),
3263
+ /* @__PURE__ */ jsxs("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: [
3264
+ "Section width follows ",
3265
+ /* @__PURE__ */ jsx("strong", { children: "Page Defaults" }),
3266
+ " for a consistent page layout."
3267
+ ] }),
3268
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3269
+ "Content Width",
3270
+ /* @__PURE__ */ jsxs(
3271
+ "select",
3272
+ {
3273
+ onChange: (event) => setSelectedStyleField("contentWidth", event.target.value),
3250
3274
  style: sidebarInputStyle,
3251
- type: "file"
3275
+ value: normalizeText(selectedSectionStyle.contentWidth, "inherit"),
3276
+ children: [
3277
+ /* @__PURE__ */ jsx("option", { value: "inherit", children: "Inherit Page Default" }),
3278
+ /* @__PURE__ */ jsx("option", { value: "narrow", children: "Narrow" }),
3279
+ /* @__PURE__ */ jsx("option", { value: "content", children: "Content" }),
3280
+ /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" }),
3281
+ /* @__PURE__ */ jsx("option", { value: "full", children: "Full" })
3282
+ ]
3252
3283
  }
3253
3284
  )
3254
3285
  ] }),
3255
- /* @__PURE__ */ jsx(
3256
- "button",
3257
- {
3258
- onClick: () => removeItemFromSelected("items", itemIndex),
3259
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3260
- type: "button",
3261
- children: "Remove Item"
3262
- }
3263
- )
3264
- ] }, `feature-item-control-${itemIndex}`)) })
3265
- ] }) : null,
3266
- selectedType === "stats" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3267
- /* @__PURE__ */ jsx(
3268
- "button",
3269
- {
3270
- onClick: () => appendItemToSelected("items", {
3271
- description: "Add context for this metric.",
3272
- label: "Metric",
3273
- value: "00"
3274
- }),
3275
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3276
- type: "button",
3277
- children: "Add Stat"
3278
- }
3279
- ),
3280
- /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3281
- /* @__PURE__ */ jsx(
3282
- "input",
3283
- {
3284
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "value", event.target.value),
3285
- placeholder: "Value",
3286
- style: sidebarInputStyle,
3287
- type: "text",
3288
- value: normalizeText(item.value)
3289
- }
3290
- ),
3291
- /* @__PURE__ */ jsx(
3292
- "input",
3293
- {
3294
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "label", event.target.value),
3295
- placeholder: "Label",
3296
- style: sidebarInputStyle,
3297
- type: "text",
3298
- value: normalizeText(item.label)
3299
- }
3300
- ),
3301
- /* @__PURE__ */ jsx(
3302
- "input",
3303
- {
3304
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
3305
- placeholder: "Description",
3306
- style: sidebarInputStyle,
3307
- type: "text",
3308
- value: normalizeText(item.description)
3309
- }
3310
- ),
3311
- /* @__PURE__ */ jsx(
3312
- "button",
3313
- {
3314
- onClick: () => removeItemFromSelected("items", itemIndex),
3315
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3316
- type: "button",
3317
- children: "Remove Item"
3318
- }
3319
- )
3320
- ] }, `stats-item-control-${itemIndex}`)) })
3321
- ] }) : null,
3322
- selectedType === "logoWall" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3323
- /* @__PURE__ */ jsx(
3324
- "button",
3325
- {
3326
- onClick: () => appendItemToSelected("items", {
3327
- href: "",
3328
- name: "Partner"
3329
- }),
3330
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3331
- type: "button",
3332
- children: "Add Logo"
3333
- }
3334
- ),
3335
- /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3336
- /* @__PURE__ */ jsx(
3337
- "input",
3338
- {
3339
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "name", event.target.value),
3340
- placeholder: "Partner Name",
3341
- style: sidebarInputStyle,
3342
- type: "text",
3343
- value: normalizeText(item.name)
3344
- }
3345
- ),
3346
- /* @__PURE__ */ jsx(
3347
- "input",
3348
- {
3349
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "href", event.target.value),
3350
- placeholder: "https://example.com",
3351
- style: sidebarInputStyle,
3352
- type: "text",
3353
- value: normalizeText(item.href)
3354
- }
3355
- ),
3356
3286
  /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3357
- "Logo Image",
3358
- /* @__PURE__ */ jsx(
3359
- "input",
3287
+ "Section Vertical Spacing",
3288
+ /* @__PURE__ */ jsxs(
3289
+ "select",
3360
3290
  {
3361
- accept: "image/*",
3362
- disabled: uploadingTarget !== null,
3363
- onChange: (event) => {
3364
- const file = event.currentTarget.files?.[0];
3365
- if (file) {
3366
- void uploadMediaForSelected({ field: "media", itemIndex, kind: "logoWallItem" }, file);
3367
- }
3368
- event.currentTarget.value = "";
3369
- },
3291
+ onChange: (event) => setSelectedStyleField("sectionPaddingY", event.target.value),
3370
3292
  style: sidebarInputStyle,
3371
- type: "file"
3293
+ value: normalizeText(selectedSectionStyle.sectionPaddingY, "md"),
3294
+ children: [
3295
+ /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
3296
+ /* @__PURE__ */ jsx("option", { value: "sm", children: "Small" }),
3297
+ /* @__PURE__ */ jsx("option", { value: "md", children: "Medium" }),
3298
+ /* @__PURE__ */ jsx("option", { value: "lg", children: "Large" })
3299
+ ]
3372
3300
  }
3373
3301
  )
3374
3302
  ] }),
3375
- /* @__PURE__ */ jsx(
3376
- "button",
3377
- {
3378
- onClick: () => removeItemFromSelected("items", itemIndex),
3379
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3380
- type: "button",
3381
- children: "Remove Item"
3382
- }
3383
- )
3384
- ] }, `logo-item-control-${itemIndex}`)) })
3385
- ] }) : null,
3386
- selectedType === "beforeAfter" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3387
- /* @__PURE__ */ jsx(
3388
- "button",
3389
- {
3390
- onClick: () => appendItemToSelected("items", {
3391
- description: "Describe the outcome.",
3392
- label: "Project"
3393
- }),
3394
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3395
- type: "button",
3396
- children: "Add Before/After Pair"
3397
- }
3398
- ),
3399
- /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3400
- /* @__PURE__ */ jsx(
3401
- "input",
3402
- {
3403
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "label", event.target.value),
3404
- placeholder: "Project Label",
3405
- style: sidebarInputStyle,
3406
- type: "text",
3407
- value: normalizeText(item.label)
3408
- }
3409
- ),
3410
- /* @__PURE__ */ jsx(
3411
- "textarea",
3412
- {
3413
- onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
3414
- placeholder: "Description",
3415
- style: { ...sidebarInputStyle, minHeight: 70, resize: "vertical" },
3416
- value: normalizeText(item.description)
3417
- }
3418
- ),
3419
3303
  /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3420
- "Before Image",
3304
+ "Section Horizontal Spacing",
3305
+ /* @__PURE__ */ jsxs(
3306
+ "select",
3307
+ {
3308
+ onChange: (event) => setSelectedStyleField("sectionPaddingX", event.target.value),
3309
+ style: sidebarInputStyle,
3310
+ value: normalizeText(selectedSectionStyle.sectionPaddingX, "inherit"),
3311
+ children: [
3312
+ /* @__PURE__ */ jsx("option", { value: "inherit", children: "Inherit (Edge-to-Edge on Full Width)" }),
3313
+ /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
3314
+ /* @__PURE__ */ jsx("option", { value: "sm", children: "Small" }),
3315
+ /* @__PURE__ */ jsx("option", { value: "md", children: "Medium" }),
3316
+ /* @__PURE__ */ jsx("option", { value: "lg", children: "Large" })
3317
+ ]
3318
+ }
3319
+ )
3320
+ ] }),
3321
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3322
+ "Section Background",
3323
+ /* @__PURE__ */ jsxs(
3324
+ "select",
3325
+ {
3326
+ onChange: (event) => setSelectedStyleField("sectionBackgroundMode", event.target.value),
3327
+ style: sidebarInputStyle,
3328
+ value: normalizeText(selectedSectionStyle.sectionBackgroundMode, "none"),
3329
+ children: [
3330
+ /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
3331
+ /* @__PURE__ */ jsx("option", { value: "color", children: "Color" }),
3332
+ /* @__PURE__ */ jsx("option", { value: "gradient", children: "Gradient" })
3333
+ ]
3334
+ }
3335
+ )
3336
+ ] }),
3337
+ normalizeText(selectedSectionStyle.sectionBackgroundMode, "none") === "color" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3338
+ "Section Background Color",
3421
3339
  /* @__PURE__ */ jsx(
3422
3340
  "input",
3423
3341
  {
3424
- accept: "image/*",
3425
- disabled: uploadingTarget !== null,
3426
- onChange: (event) => {
3427
- const file = event.currentTarget.files?.[0];
3428
- if (file) {
3429
- void uploadMediaForSelected({ field: "beforeMedia", itemIndex, kind: "beforeAfterItem" }, file);
3342
+ onChange: (event) => setSelectedStyleField("sectionBackgroundColor", event.target.value),
3343
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3344
+ type: "color",
3345
+ value: parseColor(selectedSectionStyle.sectionBackgroundColor, "#ffffff")
3346
+ }
3347
+ )
3348
+ ] }) : null,
3349
+ normalizeText(selectedSectionStyle.sectionBackgroundMode, "none") === "gradient" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3350
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3351
+ "Section Gradient Preset",
3352
+ /* @__PURE__ */ jsx(
3353
+ "select",
3354
+ {
3355
+ onChange: (event) => applyGradientPreset("section", event.target.value),
3356
+ style: sidebarInputStyle,
3357
+ value: normalizeText(selectedSectionStyle.sectionGradientPreset, "forest"),
3358
+ children: Object.keys(gradientPresetPairs).map((preset) => /* @__PURE__ */ jsx("option", { value: preset, children: preset }, preset))
3359
+ }
3360
+ )
3361
+ ] }),
3362
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr" }, children: [
3363
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3364
+ "From",
3365
+ /* @__PURE__ */ jsx(
3366
+ "input",
3367
+ {
3368
+ onChange: (event) => setSelectedStyleField("sectionGradientFrom", event.target.value),
3369
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3370
+ type: "color",
3371
+ value: parseColor(selectedSectionStyle.sectionGradientFrom, "#124a37")
3430
3372
  }
3431
- event.currentTarget.value = "";
3432
- },
3373
+ )
3374
+ ] }),
3375
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3376
+ "To",
3377
+ /* @__PURE__ */ jsx(
3378
+ "input",
3379
+ {
3380
+ onChange: (event) => setSelectedStyleField("sectionGradientTo", event.target.value),
3381
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3382
+ type: "color",
3383
+ value: parseColor(selectedSectionStyle.sectionGradientTo, "#1f684f")
3384
+ }
3385
+ )
3386
+ ] })
3387
+ ] }),
3388
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3389
+ "Angle",
3390
+ /* @__PURE__ */ jsx(
3391
+ "input",
3392
+ {
3393
+ max: 360,
3394
+ min: 0,
3395
+ onChange: (event) => setSelectedStyleField("sectionGradientAngle", event.target.value),
3396
+ style: sidebarInputStyle,
3397
+ type: "number",
3398
+ value: parseAngle(selectedSectionStyle.sectionGradientAngle, "135")
3399
+ }
3400
+ )
3401
+ ] })
3402
+ ] }) : null,
3403
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3404
+ "Content Background",
3405
+ /* @__PURE__ */ jsxs(
3406
+ "select",
3407
+ {
3408
+ onChange: (event) => setSelectedStyleField("contentBackgroundMode", event.target.value),
3433
3409
  style: sidebarInputStyle,
3434
- type: "file"
3410
+ value: normalizeText(selectedSectionStyle.contentBackgroundMode, "none"),
3411
+ children: [
3412
+ /* @__PURE__ */ jsx("option", { value: "none", children: "None" }),
3413
+ /* @__PURE__ */ jsx("option", { value: "color", children: "Color" }),
3414
+ /* @__PURE__ */ jsx("option", { value: "gradient", children: "Gradient" })
3415
+ ]
3435
3416
  }
3436
3417
  )
3437
3418
  ] }),
3438
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3439
- "After Image",
3419
+ normalizeText(selectedSectionStyle.contentBackgroundMode, "none") === "color" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3420
+ "Content Background Color",
3440
3421
  /* @__PURE__ */ jsx(
3441
3422
  "input",
3442
3423
  {
3443
- accept: "image/*",
3444
- disabled: uploadingTarget !== null,
3445
- onChange: (event) => {
3446
- const file = event.currentTarget.files?.[0];
3447
- if (file) {
3448
- void uploadMediaForSelected({ field: "afterMedia", itemIndex, kind: "beforeAfterItem" }, file);
3424
+ onChange: (event) => setSelectedStyleField("contentBackgroundColor", event.target.value),
3425
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3426
+ type: "color",
3427
+ value: parseColor(selectedSectionStyle.contentBackgroundColor, "#ffffff")
3428
+ }
3429
+ )
3430
+ ] }) : null,
3431
+ normalizeText(selectedSectionStyle.contentBackgroundMode, "none") === "gradient" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3432
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3433
+ "Content Gradient Preset",
3434
+ /* @__PURE__ */ jsx(
3435
+ "select",
3436
+ {
3437
+ onChange: (event) => applyGradientPreset("content", event.target.value),
3438
+ style: sidebarInputStyle,
3439
+ value: normalizeText(selectedSectionStyle.contentGradientPreset, "none"),
3440
+ children: Object.keys(gradientPresetPairs).map((preset) => /* @__PURE__ */ jsx("option", { value: preset, children: preset }, preset))
3441
+ }
3442
+ )
3443
+ ] }),
3444
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 6, gridTemplateColumns: "1fr 1fr" }, children: [
3445
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3446
+ "From",
3447
+ /* @__PURE__ */ jsx(
3448
+ "input",
3449
+ {
3450
+ onChange: (event) => setSelectedStyleField("contentGradientFrom", event.target.value),
3451
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3452
+ type: "color",
3453
+ value: parseColor(selectedSectionStyle.contentGradientFrom, "#ffffff")
3449
3454
  }
3450
- event.currentTarget.value = "";
3451
- },
3455
+ )
3456
+ ] }),
3457
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3458
+ "To",
3459
+ /* @__PURE__ */ jsx(
3460
+ "input",
3461
+ {
3462
+ onChange: (event) => setSelectedStyleField("contentGradientTo", event.target.value),
3463
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3464
+ type: "color",
3465
+ value: parseColor(selectedSectionStyle.contentGradientTo, "#f4f6f2")
3466
+ }
3467
+ )
3468
+ ] })
3469
+ ] }),
3470
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3471
+ "Angle",
3472
+ /* @__PURE__ */ jsx(
3473
+ "input",
3474
+ {
3475
+ max: 360,
3476
+ min: 0,
3477
+ onChange: (event) => setSelectedStyleField("contentGradientAngle", event.target.value),
3478
+ style: sidebarInputStyle,
3479
+ type: "number",
3480
+ value: parseAngle(selectedSectionStyle.contentGradientAngle, "135")
3481
+ }
3482
+ )
3483
+ ] })
3484
+ ] }) : null,
3485
+ selectedType === "hero" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3486
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3487
+ "Variant",
3488
+ /* @__PURE__ */ jsxs(
3489
+ "select",
3490
+ {
3491
+ onChange: (event) => updateSelectedField("variant", event.target.value),
3492
+ style: sidebarInputStyle,
3493
+ value: normalizeText(selectedBlock.variant, "default"),
3494
+ children: [
3495
+ /* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
3496
+ /* @__PURE__ */ jsx("option", { value: "centered", children: "Centered" })
3497
+ ]
3498
+ }
3499
+ )
3500
+ ] }),
3501
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3502
+ "Hero Height",
3503
+ /* @__PURE__ */ jsxs(
3504
+ "select",
3505
+ {
3506
+ onChange: (event) => updateSelectedField("heroHeight", event.target.value),
3507
+ style: sidebarInputStyle,
3508
+ value: normalizeHeroHeight(selectedBlock.heroHeight),
3509
+ children: [
3510
+ /* @__PURE__ */ jsx("option", { value: "sm", children: "Small" }),
3511
+ /* @__PURE__ */ jsx("option", { value: "md", children: "Medium (Half Screen)" }),
3512
+ /* @__PURE__ */ jsx("option", { value: "full", children: "Full Screen" })
3513
+ ]
3514
+ }
3515
+ )
3516
+ ] }),
3517
+ /* @__PURE__ */ jsxs("div", { style: { ...sidebarSectionStyle, display: "grid", gap: 8 }, children: [
3518
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12, fontWeight: 600 }, children: "Hero Image" }),
3519
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: selectedHeroMedia ? `${selectedHeroMedia.filename || `Media #${selectedHeroMedia.id}`}${selectedHeroMedia.alt ? ` (${selectedHeroMedia.alt})` : ""}` : "No image selected." }),
3520
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3521
+ "Choose from Media Library",
3522
+ /* @__PURE__ */ jsxs(
3523
+ "select",
3524
+ {
3525
+ onChange: (event) => setHeroMediaFromLibrary(event.target.value),
3526
+ style: sidebarInputStyle,
3527
+ value: selectedHeroMediaID,
3528
+ children: [
3529
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
3530
+ mediaLibrary.map((item) => /* @__PURE__ */ jsx("option", { value: String(item.id), children: mediaLabel(item) }, String(item.id)))
3531
+ ]
3532
+ }
3533
+ )
3534
+ ] }),
3535
+ mediaLibraryLoading ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Loading media library..." }) : null,
3536
+ mediaLibraryError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11 }, children: mediaLibraryError }) : null,
3537
+ /* @__PURE__ */ jsx(
3538
+ "button",
3539
+ {
3540
+ disabled: !selectedHeroMedia && !selectedHeroMediaID,
3541
+ onClick: clearHeroMedia,
3542
+ style: {
3543
+ borderRadius: 999,
3544
+ cursor: selectedHeroMedia || selectedHeroMediaID ? "pointer" : "not-allowed",
3545
+ fontSize: 12,
3546
+ padding: "7px 10px"
3547
+ },
3548
+ type: "button",
3549
+ children: "Remove Hero Image"
3550
+ }
3551
+ ),
3552
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3553
+ "Upload Hero Background Image",
3554
+ /* @__PURE__ */ jsx(
3555
+ "input",
3556
+ {
3557
+ accept: "image/*",
3558
+ disabled: uploadingTarget !== null,
3559
+ onChange: (event) => {
3560
+ const file = event.currentTarget.files?.[0];
3561
+ if (file) {
3562
+ void uploadMediaForSelected({ kind: "hero" }, file);
3563
+ }
3564
+ event.currentTarget.value = "";
3565
+ },
3566
+ style: sidebarInputStyle,
3567
+ type: "file"
3568
+ }
3569
+ )
3570
+ ] }),
3571
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3572
+ "Image Fit",
3573
+ /* @__PURE__ */ jsxs(
3574
+ "select",
3575
+ {
3576
+ onChange: (event) => updateSelectedField("backgroundImageFit", event.target.value),
3577
+ style: sidebarInputStyle,
3578
+ value: normalizeHeroImageFit(selectedBlock.backgroundImageFit),
3579
+ children: [
3580
+ /* @__PURE__ */ jsx("option", { value: "cover", children: "Cover" }),
3581
+ /* @__PURE__ */ jsx("option", { value: "contain", children: "Contain" })
3582
+ ]
3583
+ }
3584
+ )
3585
+ ] }),
3586
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3587
+ "Image Corners",
3588
+ /* @__PURE__ */ jsxs(
3589
+ "select",
3590
+ {
3591
+ onChange: (event) => updateSelectedField("backgroundImageCornerStyle", event.target.value),
3592
+ style: sidebarInputStyle,
3593
+ value: normalizeHeroImageCornerStyle(
3594
+ selectedBlock.backgroundImageCornerStyle,
3595
+ selectedBlock.backgroundImageFit
3596
+ ),
3597
+ children: [
3598
+ /* @__PURE__ */ jsx("option", { value: "rounded", children: "Rounded" }),
3599
+ /* @__PURE__ */ jsx("option", { value: "square", children: "Square" })
3600
+ ]
3601
+ }
3602
+ )
3603
+ ] }),
3604
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3605
+ "Image Position",
3606
+ /* @__PURE__ */ jsxs(
3607
+ "select",
3608
+ {
3609
+ onChange: (event) => updateSelectedField("backgroundImagePosition", event.target.value),
3610
+ style: sidebarInputStyle,
3611
+ value: normalizeHeroImagePosition(selectedBlock.backgroundImagePosition),
3612
+ children: [
3613
+ /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
3614
+ /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
3615
+ /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
3616
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
3617
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
3618
+ ]
3619
+ }
3620
+ )
3621
+ ] })
3622
+ ] }),
3623
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3624
+ "Background Color",
3625
+ /* @__PURE__ */ jsx(
3626
+ "input",
3627
+ {
3628
+ onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
3629
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3630
+ type: "color",
3631
+ value: parseColor(selectedBlock.backgroundColor, "#ffffff")
3632
+ }
3633
+ )
3634
+ ] }),
3635
+ /* @__PURE__ */ jsx(
3636
+ "button",
3637
+ {
3638
+ onClick: () => updateSelectedField("backgroundColor", ""),
3639
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3640
+ type: "button",
3641
+ children: "Clear Hero Background Color"
3642
+ }
3643
+ )
3644
+ ] }) : null,
3645
+ selectedType === "featureGrid" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3646
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3647
+ "Variant",
3648
+ /* @__PURE__ */ jsxs(
3649
+ "select",
3650
+ {
3651
+ onChange: (event) => updateSelectedField("variant", event.target.value),
3652
+ style: sidebarInputStyle,
3653
+ value: normalizeText(selectedBlock.variant, "cards"),
3654
+ children: [
3655
+ /* @__PURE__ */ jsx("option", { value: "cards", children: "Cards" }),
3656
+ /* @__PURE__ */ jsx("option", { value: "highlight", children: "Highlight" })
3657
+ ]
3658
+ }
3659
+ )
3660
+ ] }),
3661
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3662
+ "Highlight Background Color",
3663
+ /* @__PURE__ */ jsx(
3664
+ "input",
3665
+ {
3666
+ onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
3667
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
3668
+ type: "color",
3669
+ value: parseColor(selectedBlock.backgroundColor, "#1f684f")
3670
+ }
3671
+ )
3672
+ ] }),
3673
+ /* @__PURE__ */ jsx(
3674
+ "button",
3675
+ {
3676
+ onClick: () => appendItemToSelected("items", {
3677
+ description: "Describe this feature.",
3678
+ icon: "04",
3679
+ imageCornerStyle: "rounded",
3680
+ imageFit: "cover",
3681
+ imagePosition: "center",
3682
+ title: "New Feature"
3683
+ }),
3684
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3685
+ type: "button",
3686
+ children: "Add Feature Item"
3687
+ }
3688
+ ),
3689
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3690
+ /* @__PURE__ */ jsxs("div", { style: { color: "var(--ink-700)", fontSize: 11, fontWeight: 700 }, children: [
3691
+ "Item ",
3692
+ itemIndex + 1
3693
+ ] }),
3694
+ /* @__PURE__ */ jsx(
3695
+ "input",
3696
+ {
3697
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "title", event.target.value),
3698
+ placeholder: "Title",
3699
+ style: sidebarInputStyle,
3700
+ type: "text",
3701
+ value: normalizeText(item.title)
3702
+ }
3703
+ ),
3704
+ /* @__PURE__ */ jsx(
3705
+ "input",
3706
+ {
3707
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "icon", event.target.value),
3708
+ placeholder: "Icon",
3709
+ style: sidebarInputStyle,
3710
+ type: "text",
3711
+ value: normalizeText(item.icon)
3712
+ }
3713
+ ),
3714
+ /* @__PURE__ */ jsx(
3715
+ "textarea",
3716
+ {
3717
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
3718
+ placeholder: "Description",
3719
+ style: { ...sidebarInputStyle, minHeight: 70, resize: "vertical" },
3720
+ value: normalizeText(item.description)
3721
+ }
3722
+ ),
3723
+ (() => {
3724
+ const itemMedia = resolveMediaLibraryItemFromValue(item.media);
3725
+ const itemMediaID = getRelationID(item.media);
3726
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3727
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: itemMedia ? `Selected image: ${mediaLabel(itemMedia)}` : "No item image selected." }),
3728
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3729
+ "Choose from Media Library",
3730
+ /* @__PURE__ */ jsxs(
3731
+ "select",
3732
+ {
3733
+ onChange: (event) => setSelectedItemMediaFieldFromLibrary(itemIndex, "media", event.target.value),
3734
+ style: sidebarInputStyle,
3735
+ value: itemMediaID !== null ? String(itemMediaID) : "",
3736
+ children: [
3737
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
3738
+ mediaLibrary.map((libraryItem) => /* @__PURE__ */ jsx("option", { value: String(libraryItem.id), children: mediaLabel(libraryItem) }, String(libraryItem.id)))
3739
+ ]
3740
+ }
3741
+ )
3742
+ ] }),
3743
+ mediaLibraryLoading ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Loading media library..." }) : null,
3744
+ mediaLibraryError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11 }, children: mediaLibraryError }) : null,
3745
+ /* @__PURE__ */ jsx(
3746
+ "button",
3747
+ {
3748
+ disabled: !itemMedia && itemMediaID === null,
3749
+ onClick: () => setSelectedItemMediaFieldFromLibrary(itemIndex, "media", ""),
3750
+ style: {
3751
+ borderRadius: 999,
3752
+ cursor: itemMedia || itemMediaID !== null ? "pointer" : "not-allowed",
3753
+ fontSize: 12,
3754
+ padding: "7px 10px"
3755
+ },
3756
+ type: "button",
3757
+ children: "Remove Item Image"
3758
+ }
3759
+ ),
3760
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3761
+ "Image Fit",
3762
+ /* @__PURE__ */ jsxs(
3763
+ "select",
3764
+ {
3765
+ onChange: (event) => updateArrayItemField(
3766
+ selectedIndex ?? 0,
3767
+ "items",
3768
+ itemIndex,
3769
+ "imageFit",
3770
+ event.target.value
3771
+ ),
3772
+ style: sidebarInputStyle,
3773
+ value: normalizeImageFit(item.imageFit),
3774
+ children: [
3775
+ /* @__PURE__ */ jsx("option", { value: "cover", children: "Cover" }),
3776
+ /* @__PURE__ */ jsx("option", { value: "contain", children: "Contain" })
3777
+ ]
3778
+ }
3779
+ )
3780
+ ] }),
3781
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3782
+ "Image Corners",
3783
+ /* @__PURE__ */ jsxs(
3784
+ "select",
3785
+ {
3786
+ onChange: (event) => updateArrayItemField(
3787
+ selectedIndex ?? 0,
3788
+ "items",
3789
+ itemIndex,
3790
+ "imageCornerStyle",
3791
+ event.target.value
3792
+ ),
3793
+ style: sidebarInputStyle,
3794
+ value: normalizeImageCornerStyle(item.imageCornerStyle),
3795
+ children: [
3796
+ /* @__PURE__ */ jsx("option", { value: "rounded", children: "Rounded" }),
3797
+ /* @__PURE__ */ jsx("option", { value: "square", children: "Square" })
3798
+ ]
3799
+ }
3800
+ )
3801
+ ] }),
3802
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3803
+ "Image Position",
3804
+ /* @__PURE__ */ jsxs(
3805
+ "select",
3806
+ {
3807
+ onChange: (event) => updateArrayItemField(
3808
+ selectedIndex ?? 0,
3809
+ "items",
3810
+ itemIndex,
3811
+ "imagePosition",
3812
+ event.target.value
3813
+ ),
3814
+ style: sidebarInputStyle,
3815
+ value: normalizeImagePosition(item.imagePosition),
3816
+ children: [
3817
+ /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
3818
+ /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
3819
+ /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
3820
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
3821
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
3822
+ ]
3823
+ }
3824
+ )
3825
+ ] })
3826
+ ] });
3827
+ })(),
3828
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3829
+ "Upload Item Image",
3830
+ /* @__PURE__ */ jsx(
3831
+ "input",
3832
+ {
3833
+ accept: "image/*",
3834
+ disabled: uploadingTarget !== null,
3835
+ onChange: (event) => {
3836
+ const file = event.currentTarget.files?.[0];
3837
+ if (file) {
3838
+ void uploadMediaForSelected({ field: "media", itemIndex, kind: "featureGridItem" }, file);
3839
+ }
3840
+ event.currentTarget.value = "";
3841
+ },
3842
+ style: sidebarInputStyle,
3843
+ type: "file"
3844
+ }
3845
+ )
3846
+ ] }),
3847
+ /* @__PURE__ */ jsx(
3848
+ "button",
3849
+ {
3850
+ onClick: () => removeItemFromSelected("items", itemIndex),
3851
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3852
+ type: "button",
3853
+ children: "Remove Item"
3854
+ }
3855
+ )
3856
+ ] }, `feature-item-control-${itemIndex}`)) })
3857
+ ] }) : null,
3858
+ selectedType === "stats" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3859
+ /* @__PURE__ */ jsx(
3860
+ "button",
3861
+ {
3862
+ onClick: () => appendItemToSelected("items", {
3863
+ description: "Add context for this metric.",
3864
+ label: "Metric",
3865
+ value: "00"
3866
+ }),
3867
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3868
+ type: "button",
3869
+ children: "Add Stat"
3870
+ }
3871
+ ),
3872
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3873
+ /* @__PURE__ */ jsx(
3874
+ "input",
3875
+ {
3876
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "value", event.target.value),
3877
+ placeholder: "Value",
3878
+ style: sidebarInputStyle,
3879
+ type: "text",
3880
+ value: normalizeText(item.value)
3881
+ }
3882
+ ),
3883
+ /* @__PURE__ */ jsx(
3884
+ "input",
3885
+ {
3886
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "label", event.target.value),
3887
+ placeholder: "Label",
3888
+ style: sidebarInputStyle,
3889
+ type: "text",
3890
+ value: normalizeText(item.label)
3891
+ }
3892
+ ),
3893
+ /* @__PURE__ */ jsx(
3894
+ "input",
3895
+ {
3896
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
3897
+ placeholder: "Description",
3898
+ style: sidebarInputStyle,
3899
+ type: "text",
3900
+ value: normalizeText(item.description)
3901
+ }
3902
+ ),
3903
+ /* @__PURE__ */ jsx(
3904
+ "button",
3905
+ {
3906
+ onClick: () => removeItemFromSelected("items", itemIndex),
3907
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3908
+ type: "button",
3909
+ children: "Remove Item"
3910
+ }
3911
+ )
3912
+ ] }, `stats-item-control-${itemIndex}`)) })
3913
+ ] }) : null,
3914
+ selectedType === "logoWall" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3915
+ /* @__PURE__ */ jsx(
3916
+ "button",
3917
+ {
3918
+ onClick: () => appendItemToSelected("items", {
3919
+ href: "",
3920
+ imageCornerStyle: "rounded",
3921
+ imageFit: "contain",
3922
+ imagePosition: "center",
3923
+ name: "Partner"
3924
+ }),
3925
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3926
+ type: "button",
3927
+ children: "Add Logo"
3928
+ }
3929
+ ),
3930
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
3931
+ /* @__PURE__ */ jsx(
3932
+ "input",
3933
+ {
3934
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "name", event.target.value),
3935
+ placeholder: "Partner Name",
3936
+ style: sidebarInputStyle,
3937
+ type: "text",
3938
+ value: normalizeText(item.name)
3939
+ }
3940
+ ),
3941
+ /* @__PURE__ */ jsx(
3942
+ "input",
3943
+ {
3944
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "href", event.target.value),
3945
+ placeholder: "https://example.com",
3946
+ style: sidebarInputStyle,
3947
+ type: "text",
3948
+ value: normalizeText(item.href)
3949
+ }
3950
+ ),
3951
+ (() => {
3952
+ const logoMedia = resolveMediaLibraryItemFromValue(item.media);
3953
+ const logoMediaID = getRelationID(item.media);
3954
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
3955
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: logoMedia ? `Selected logo: ${mediaLabel(logoMedia)}` : "No logo image selected." }),
3956
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3957
+ "Choose from Media Library",
3958
+ /* @__PURE__ */ jsxs(
3959
+ "select",
3960
+ {
3961
+ onChange: (event) => setSelectedItemMediaFieldFromLibrary(itemIndex, "media", event.target.value),
3962
+ style: sidebarInputStyle,
3963
+ value: logoMediaID !== null ? String(logoMediaID) : "",
3964
+ children: [
3965
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
3966
+ mediaLibrary.map((libraryItem) => /* @__PURE__ */ jsx("option", { value: String(libraryItem.id), children: mediaLabel(libraryItem) }, String(libraryItem.id)))
3967
+ ]
3968
+ }
3969
+ )
3970
+ ] }),
3971
+ mediaLibraryLoading ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Loading media library..." }) : null,
3972
+ mediaLibraryError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11 }, children: mediaLibraryError }) : null,
3973
+ /* @__PURE__ */ jsx(
3974
+ "button",
3975
+ {
3976
+ disabled: !logoMedia && logoMediaID === null,
3977
+ onClick: () => setSelectedItemMediaFieldFromLibrary(itemIndex, "media", ""),
3978
+ style: {
3979
+ borderRadius: 999,
3980
+ cursor: logoMedia || logoMediaID !== null ? "pointer" : "not-allowed",
3981
+ fontSize: 12,
3982
+ padding: "7px 10px"
3983
+ },
3984
+ type: "button",
3985
+ children: "Remove Logo Image"
3986
+ }
3987
+ ),
3988
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3989
+ "Image Fit",
3990
+ /* @__PURE__ */ jsxs(
3991
+ "select",
3992
+ {
3993
+ onChange: (event) => updateArrayItemField(
3994
+ selectedIndex ?? 0,
3995
+ "items",
3996
+ itemIndex,
3997
+ "imageFit",
3998
+ event.target.value
3999
+ ),
4000
+ style: sidebarInputStyle,
4001
+ value: normalizeImageFit(item.imageFit),
4002
+ children: [
4003
+ /* @__PURE__ */ jsx("option", { value: "cover", children: "Cover" }),
4004
+ /* @__PURE__ */ jsx("option", { value: "contain", children: "Contain" })
4005
+ ]
4006
+ }
4007
+ )
4008
+ ] }),
4009
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4010
+ "Image Corners",
4011
+ /* @__PURE__ */ jsxs(
4012
+ "select",
4013
+ {
4014
+ onChange: (event) => updateArrayItemField(
4015
+ selectedIndex ?? 0,
4016
+ "items",
4017
+ itemIndex,
4018
+ "imageCornerStyle",
4019
+ event.target.value
4020
+ ),
4021
+ style: sidebarInputStyle,
4022
+ value: normalizeImageCornerStyle(item.imageCornerStyle),
4023
+ children: [
4024
+ /* @__PURE__ */ jsx("option", { value: "rounded", children: "Rounded" }),
4025
+ /* @__PURE__ */ jsx("option", { value: "square", children: "Square" })
4026
+ ]
4027
+ }
4028
+ )
4029
+ ] }),
4030
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4031
+ "Image Position",
4032
+ /* @__PURE__ */ jsxs(
4033
+ "select",
4034
+ {
4035
+ onChange: (event) => updateArrayItemField(
4036
+ selectedIndex ?? 0,
4037
+ "items",
4038
+ itemIndex,
4039
+ "imagePosition",
4040
+ event.target.value
4041
+ ),
4042
+ style: sidebarInputStyle,
4043
+ value: normalizeImagePosition(item.imagePosition),
4044
+ children: [
4045
+ /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4046
+ /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4047
+ /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4048
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4049
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4050
+ ]
4051
+ }
4052
+ )
4053
+ ] })
4054
+ ] });
4055
+ })(),
4056
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4057
+ "Upload Logo Image",
4058
+ /* @__PURE__ */ jsx(
4059
+ "input",
4060
+ {
4061
+ accept: "image/*",
4062
+ disabled: uploadingTarget !== null,
4063
+ onChange: (event) => {
4064
+ const file = event.currentTarget.files?.[0];
4065
+ if (file) {
4066
+ void uploadMediaForSelected({ field: "media", itemIndex, kind: "logoWallItem" }, file);
4067
+ }
4068
+ event.currentTarget.value = "";
4069
+ },
4070
+ style: sidebarInputStyle,
4071
+ type: "file"
4072
+ }
4073
+ )
4074
+ ] }),
4075
+ /* @__PURE__ */ jsx(
4076
+ "button",
4077
+ {
4078
+ onClick: () => removeItemFromSelected("items", itemIndex),
4079
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
4080
+ type: "button",
4081
+ children: "Remove Item"
4082
+ }
4083
+ )
4084
+ ] }, `logo-item-control-${itemIndex}`)) })
4085
+ ] }) : null,
4086
+ selectedType === "beforeAfter" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4087
+ /* @__PURE__ */ jsx(
4088
+ "button",
4089
+ {
4090
+ onClick: () => appendItemToSelected("items", {
4091
+ description: "Describe the outcome.",
4092
+ imageCornerStyle: "rounded",
4093
+ imageFit: "cover",
4094
+ imagePosition: "center",
4095
+ label: "Project"
4096
+ }),
4097
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
4098
+ type: "button",
4099
+ children: "Add Before/After Pair"
4100
+ }
4101
+ ),
4102
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gap: 8 }, children: selectedItems.map((item, itemIndex) => /* @__PURE__ */ jsxs("div", { style: { border: "1px solid rgba(13, 74, 55, 0.16)", borderRadius: 10, display: "grid", gap: 6, padding: 8 }, children: [
4103
+ /* @__PURE__ */ jsx(
4104
+ "input",
4105
+ {
4106
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "label", event.target.value),
4107
+ placeholder: "Project Label",
4108
+ style: sidebarInputStyle,
4109
+ type: "text",
4110
+ value: normalizeText(item.label)
4111
+ }
4112
+ ),
4113
+ /* @__PURE__ */ jsx(
4114
+ "textarea",
4115
+ {
4116
+ onChange: (event) => updateArrayItemField(selectedIndex ?? 0, "items", itemIndex, "description", event.target.value),
4117
+ placeholder: "Description",
4118
+ style: { ...sidebarInputStyle, minHeight: 70, resize: "vertical" },
4119
+ value: normalizeText(item.description)
4120
+ }
4121
+ ),
4122
+ (() => {
4123
+ const beforeMedia = resolveMediaLibraryItemFromValue(item.beforeMedia);
4124
+ const beforeMediaID = getRelationID(item.beforeMedia);
4125
+ const afterMedia = resolveMediaLibraryItemFromValue(item.afterMedia);
4126
+ const afterMediaID = getRelationID(item.afterMedia);
4127
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4128
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: beforeMedia ? `Before image: ${mediaLabel(beforeMedia)}` : "No before image selected." }),
4129
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4130
+ "Choose Before Image",
4131
+ /* @__PURE__ */ jsxs(
4132
+ "select",
4133
+ {
4134
+ onChange: (event) => setSelectedItemMediaFieldFromLibrary(itemIndex, "beforeMedia", event.target.value),
4135
+ style: sidebarInputStyle,
4136
+ value: beforeMediaID !== null ? String(beforeMediaID) : "",
4137
+ children: [
4138
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
4139
+ mediaLibrary.map((libraryItem) => /* @__PURE__ */ jsx("option", { value: String(libraryItem.id), children: mediaLabel(libraryItem) }, String(libraryItem.id)))
4140
+ ]
4141
+ }
4142
+ )
4143
+ ] }),
4144
+ /* @__PURE__ */ jsx(
4145
+ "button",
4146
+ {
4147
+ disabled: !beforeMedia && beforeMediaID === null,
4148
+ onClick: () => setSelectedItemMediaFieldFromLibrary(itemIndex, "beforeMedia", ""),
4149
+ style: {
4150
+ borderRadius: 999,
4151
+ cursor: beforeMedia || beforeMediaID !== null ? "pointer" : "not-allowed",
4152
+ fontSize: 12,
4153
+ padding: "7px 10px"
4154
+ },
4155
+ type: "button",
4156
+ children: "Remove Before Image"
4157
+ }
4158
+ ),
4159
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: afterMedia ? `After image: ${mediaLabel(afterMedia)}` : "No after image selected." }),
4160
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4161
+ "Choose After Image",
4162
+ /* @__PURE__ */ jsxs(
4163
+ "select",
4164
+ {
4165
+ onChange: (event) => setSelectedItemMediaFieldFromLibrary(itemIndex, "afterMedia", event.target.value),
4166
+ style: sidebarInputStyle,
4167
+ value: afterMediaID !== null ? String(afterMediaID) : "",
4168
+ children: [
4169
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
4170
+ mediaLibrary.map((libraryItem) => /* @__PURE__ */ jsx("option", { value: String(libraryItem.id), children: mediaLabel(libraryItem) }, String(libraryItem.id)))
4171
+ ]
4172
+ }
4173
+ )
4174
+ ] }),
4175
+ /* @__PURE__ */ jsx(
4176
+ "button",
4177
+ {
4178
+ disabled: !afterMedia && afterMediaID === null,
4179
+ onClick: () => setSelectedItemMediaFieldFromLibrary(itemIndex, "afterMedia", ""),
4180
+ style: {
4181
+ borderRadius: 999,
4182
+ cursor: afterMedia || afterMediaID !== null ? "pointer" : "not-allowed",
4183
+ fontSize: 12,
4184
+ padding: "7px 10px"
4185
+ },
4186
+ type: "button",
4187
+ children: "Remove After Image"
4188
+ }
4189
+ ),
4190
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4191
+ "Image Fit",
4192
+ /* @__PURE__ */ jsxs(
4193
+ "select",
4194
+ {
4195
+ onChange: (event) => updateArrayItemField(
4196
+ selectedIndex ?? 0,
4197
+ "items",
4198
+ itemIndex,
4199
+ "imageFit",
4200
+ event.target.value
4201
+ ),
4202
+ style: sidebarInputStyle,
4203
+ value: normalizeImageFit(item.imageFit),
4204
+ children: [
4205
+ /* @__PURE__ */ jsx("option", { value: "cover", children: "Cover" }),
4206
+ /* @__PURE__ */ jsx("option", { value: "contain", children: "Contain" })
4207
+ ]
4208
+ }
4209
+ )
4210
+ ] }),
4211
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4212
+ "Image Corners",
4213
+ /* @__PURE__ */ jsxs(
4214
+ "select",
4215
+ {
4216
+ onChange: (event) => updateArrayItemField(
4217
+ selectedIndex ?? 0,
4218
+ "items",
4219
+ itemIndex,
4220
+ "imageCornerStyle",
4221
+ event.target.value
4222
+ ),
4223
+ style: sidebarInputStyle,
4224
+ value: normalizeImageCornerStyle(item.imageCornerStyle),
4225
+ children: [
4226
+ /* @__PURE__ */ jsx("option", { value: "rounded", children: "Rounded" }),
4227
+ /* @__PURE__ */ jsx("option", { value: "square", children: "Square" })
4228
+ ]
4229
+ }
4230
+ )
4231
+ ] }),
4232
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4233
+ "Image Position",
4234
+ /* @__PURE__ */ jsxs(
4235
+ "select",
4236
+ {
4237
+ onChange: (event) => updateArrayItemField(
4238
+ selectedIndex ?? 0,
4239
+ "items",
4240
+ itemIndex,
4241
+ "imagePosition",
4242
+ event.target.value
4243
+ ),
4244
+ style: sidebarInputStyle,
4245
+ value: normalizeImagePosition(item.imagePosition),
4246
+ children: [
4247
+ /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4248
+ /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4249
+ /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4250
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4251
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4252
+ ]
4253
+ }
4254
+ )
4255
+ ] })
4256
+ ] });
4257
+ })(),
4258
+ mediaLibraryLoading ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Loading media library..." }) : null,
4259
+ mediaLibraryError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11 }, children: mediaLibraryError }) : null,
4260
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4261
+ "Upload Before Image",
4262
+ /* @__PURE__ */ jsx(
4263
+ "input",
4264
+ {
4265
+ accept: "image/*",
4266
+ disabled: uploadingTarget !== null,
4267
+ onChange: (event) => {
4268
+ const file = event.currentTarget.files?.[0];
4269
+ if (file) {
4270
+ void uploadMediaForSelected({ field: "beforeMedia", itemIndex, kind: "beforeAfterItem" }, file);
4271
+ }
4272
+ event.currentTarget.value = "";
4273
+ },
4274
+ style: sidebarInputStyle,
4275
+ type: "file"
4276
+ }
4277
+ )
4278
+ ] }),
4279
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4280
+ "Upload After Image",
4281
+ /* @__PURE__ */ jsx(
4282
+ "input",
4283
+ {
4284
+ accept: "image/*",
4285
+ disabled: uploadingTarget !== null,
4286
+ onChange: (event) => {
4287
+ const file = event.currentTarget.files?.[0];
4288
+ if (file) {
4289
+ void uploadMediaForSelected({ field: "afterMedia", itemIndex, kind: "beforeAfterItem" }, file);
4290
+ }
4291
+ event.currentTarget.value = "";
4292
+ },
4293
+ style: sidebarInputStyle,
4294
+ type: "file"
4295
+ }
4296
+ )
4297
+ ] }),
4298
+ /* @__PURE__ */ jsx(
4299
+ "button",
4300
+ {
4301
+ onClick: () => removeItemFromSelected("items", itemIndex),
4302
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
4303
+ type: "button",
4304
+ children: "Remove Item"
4305
+ }
4306
+ )
4307
+ ] }, `before-after-item-control-${itemIndex}`)) })
4308
+ ] }) : null,
4309
+ selectedType === "cta" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4310
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4311
+ "Style",
4312
+ /* @__PURE__ */ jsxs(
4313
+ "select",
4314
+ {
4315
+ onChange: (event) => updateSelectedField("style", event.target.value),
4316
+ style: sidebarInputStyle,
4317
+ value: normalizeText(selectedBlock.style, "light"),
4318
+ children: [
4319
+ /* @__PURE__ */ jsx("option", { value: "light", children: "Light" }),
4320
+ /* @__PURE__ */ jsx("option", { value: "dark", children: "Dark" })
4321
+ ]
4322
+ }
4323
+ )
4324
+ ] }),
4325
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4326
+ "Background Color",
4327
+ /* @__PURE__ */ jsx(
4328
+ "input",
4329
+ {
4330
+ onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
4331
+ style: { ...sidebarInputStyle, height: 36, padding: 4 },
4332
+ type: "color",
4333
+ value: parseColor(selectedBlock.backgroundColor, "#1f684f")
4334
+ }
4335
+ )
4336
+ ] })
4337
+ ] }) : null,
4338
+ selectedType === "media" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4339
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4340
+ "Image Size",
4341
+ /* @__PURE__ */ jsxs(
4342
+ "select",
4343
+ {
4344
+ onChange: (event) => updateSelectedField("size", event.target.value),
4345
+ style: sidebarInputStyle,
4346
+ value: normalizeText(selectedBlock.size, "default"),
4347
+ children: [
4348
+ /* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
4349
+ /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" })
4350
+ ]
4351
+ }
4352
+ )
4353
+ ] }),
4354
+ (() => {
4355
+ const selectedMedia = resolveMediaLibraryItemFromValue(selectedBlock.image);
4356
+ const selectedMediaID = getRelationID(selectedBlock.image);
4357
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4358
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 12 }, children: selectedMedia ? `Selected image: ${mediaLabel(selectedMedia)}` : "No image selected." }),
4359
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4360
+ "Choose from Media Library",
4361
+ /* @__PURE__ */ jsxs(
4362
+ "select",
4363
+ {
4364
+ onChange: (event) => setSelectedMediaFieldFromLibrary("image", event.target.value),
4365
+ style: sidebarInputStyle,
4366
+ value: selectedMediaID !== null ? String(selectedMediaID) : "",
4367
+ children: [
4368
+ /* @__PURE__ */ jsx("option", { value: "", children: "No image" }),
4369
+ mediaLibrary.map((libraryItem) => /* @__PURE__ */ jsx("option", { value: String(libraryItem.id), children: mediaLabel(libraryItem) }, String(libraryItem.id)))
4370
+ ]
4371
+ }
4372
+ )
4373
+ ] }),
4374
+ mediaLibraryLoading ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Loading media library..." }) : null,
4375
+ mediaLibraryError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11 }, children: mediaLibraryError }) : null,
4376
+ /* @__PURE__ */ jsx(
4377
+ "button",
4378
+ {
4379
+ disabled: !selectedMedia && selectedMediaID === null,
4380
+ onClick: () => setSelectedMediaFieldFromLibrary("image", ""),
4381
+ style: {
4382
+ borderRadius: 999,
4383
+ cursor: selectedMedia || selectedMediaID !== null ? "pointer" : "not-allowed",
4384
+ fontSize: 12,
4385
+ padding: "7px 10px"
4386
+ },
4387
+ type: "button",
4388
+ children: "Remove Section Image"
4389
+ }
4390
+ ),
4391
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4392
+ "Image Fit",
4393
+ /* @__PURE__ */ jsxs(
4394
+ "select",
4395
+ {
4396
+ onChange: (event) => updateSelectedField("imageFit", event.target.value),
4397
+ style: sidebarInputStyle,
4398
+ value: normalizeImageFit(selectedBlock.imageFit),
4399
+ children: [
4400
+ /* @__PURE__ */ jsx("option", { value: "cover", children: "Cover" }),
4401
+ /* @__PURE__ */ jsx("option", { value: "contain", children: "Contain" })
4402
+ ]
4403
+ }
4404
+ )
4405
+ ] }),
4406
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4407
+ "Image Corners",
4408
+ /* @__PURE__ */ jsxs(
4409
+ "select",
4410
+ {
4411
+ onChange: (event) => updateSelectedField("imageCornerStyle", event.target.value),
4412
+ style: sidebarInputStyle,
4413
+ value: normalizeImageCornerStyle(selectedBlock.imageCornerStyle),
4414
+ children: [
4415
+ /* @__PURE__ */ jsx("option", { value: "rounded", children: "Rounded" }),
4416
+ /* @__PURE__ */ jsx("option", { value: "square", children: "Square" })
4417
+ ]
4418
+ }
4419
+ )
4420
+ ] }),
4421
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4422
+ "Image Position",
4423
+ /* @__PURE__ */ jsxs(
4424
+ "select",
4425
+ {
4426
+ onChange: (event) => updateSelectedField("imagePosition", event.target.value),
4427
+ style: sidebarInputStyle,
4428
+ value: normalizeImagePosition(selectedBlock.imagePosition),
4429
+ children: [
4430
+ /* @__PURE__ */ jsx("option", { value: "center", children: "Center" }),
4431
+ /* @__PURE__ */ jsx("option", { value: "top", children: "Top" }),
4432
+ /* @__PURE__ */ jsx("option", { value: "bottom", children: "Bottom" }),
4433
+ /* @__PURE__ */ jsx("option", { value: "left", children: "Left" }),
4434
+ /* @__PURE__ */ jsx("option", { value: "right", children: "Right" })
4435
+ ]
4436
+ }
4437
+ )
4438
+ ] })
4439
+ ] });
4440
+ })(),
4441
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4442
+ "Upload Section Image",
4443
+ /* @__PURE__ */ jsx(
4444
+ "input",
4445
+ {
4446
+ accept: "image/*",
4447
+ disabled: uploadingTarget !== null,
4448
+ onChange: (event) => {
4449
+ const file = event.currentTarget.files?.[0];
4450
+ if (file) {
4451
+ void uploadMediaForSelected({ kind: "media" }, file);
4452
+ }
4453
+ event.currentTarget.value = "";
4454
+ },
4455
+ style: sidebarInputStyle,
4456
+ type: "file"
4457
+ }
4458
+ )
4459
+ ] })
4460
+ ] }) : null,
4461
+ selectedType === "richText" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4462
+ "Content Width",
4463
+ /* @__PURE__ */ jsxs(
4464
+ "select",
4465
+ {
4466
+ onChange: (event) => updateSelectedField("width", event.target.value),
3452
4467
  style: sidebarInputStyle,
3453
- type: "file"
4468
+ value: normalizeText(selectedBlock.width, "normal"),
4469
+ children: [
4470
+ /* @__PURE__ */ jsx("option", { value: "normal", children: "Normal" }),
4471
+ /* @__PURE__ */ jsx("option", { value: "narrow", children: "Narrow" })
4472
+ ]
3454
4473
  }
3455
4474
  )
3456
- ] }),
3457
- /* @__PURE__ */ jsx(
4475
+ ] }) : null,
4476
+ selectedType === "formEmbed" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4477
+ "Form Type",
4478
+ /* @__PURE__ */ jsx(
4479
+ "select",
4480
+ {
4481
+ onChange: (event) => updateSelectedField("formType", event.target.value),
4482
+ style: sidebarInputStyle,
4483
+ value: normalizeText(selectedBlock.formType, "quote"),
4484
+ children: /* @__PURE__ */ jsx("option", { value: "quote", children: "Quote" })
4485
+ }
4486
+ )
4487
+ ] }) : null,
4488
+ selectedType === "faq" ? /* @__PURE__ */ jsx(
3458
4489
  "button",
3459
4490
  {
3460
- onClick: () => removeItemFromSelected("items", itemIndex),
4491
+ onClick: () => appendItemToSelected("items", {
4492
+ answer: "Answer this question here.",
4493
+ question: "New frequently asked question?"
4494
+ }),
3461
4495
  style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3462
4496
  type: "button",
3463
- children: "Remove Item"
3464
- }
3465
- )
3466
- ] }, `before-after-item-control-${itemIndex}`)) })
3467
- ] }) : null,
3468
- selectedType === "cta" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3469
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3470
- "Style",
3471
- /* @__PURE__ */ jsxs(
3472
- "select",
3473
- {
3474
- onChange: (event) => updateSelectedField("style", event.target.value),
3475
- style: sidebarInputStyle,
3476
- value: normalizeText(selectedBlock.style, "light"),
3477
- children: [
3478
- /* @__PURE__ */ jsx("option", { value: "light", children: "Light" }),
3479
- /* @__PURE__ */ jsx("option", { value: "dark", children: "Dark" })
3480
- ]
3481
- }
3482
- )
3483
- ] }),
3484
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3485
- "Background Color",
3486
- /* @__PURE__ */ jsx(
3487
- "input",
3488
- {
3489
- onChange: (event) => updateSelectedField("backgroundColor", event.target.value),
3490
- style: { ...sidebarInputStyle, height: 36, padding: 4 },
3491
- type: "color",
3492
- value: parseColor(selectedBlock.backgroundColor, "#1f684f")
3493
- }
3494
- )
3495
- ] })
3496
- ] }) : null,
3497
- selectedType === "media" ? /* @__PURE__ */ jsxs(Fragment, { children: [
3498
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3499
- "Image Size",
3500
- /* @__PURE__ */ jsxs(
3501
- "select",
3502
- {
3503
- onChange: (event) => updateSelectedField("size", event.target.value),
3504
- style: sidebarInputStyle,
3505
- value: normalizeText(selectedBlock.size, "default"),
3506
- children: [
3507
- /* @__PURE__ */ jsx("option", { value: "default", children: "Default" }),
3508
- /* @__PURE__ */ jsx("option", { value: "wide", children: "Wide" })
3509
- ]
4497
+ children: "Add FAQ Item"
3510
4498
  }
3511
- )
3512
- ] }),
3513
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3514
- "Upload Section Image",
3515
- /* @__PURE__ */ jsx(
3516
- "input",
4499
+ ) : null,
4500
+ selectedType === "testimonials" ? /* @__PURE__ */ jsx(
4501
+ "button",
3517
4502
  {
3518
- accept: "image/*",
3519
- disabled: uploadingTarget !== null,
3520
- onChange: (event) => {
3521
- const file = event.currentTarget.files?.[0];
3522
- if (file) {
3523
- void uploadMediaForSelected({ kind: "media" }, file);
3524
- }
3525
- event.currentTarget.value = "";
3526
- },
3527
- style: sidebarInputStyle,
3528
- type: "file"
4503
+ onClick: () => appendItemToSelected("items", {
4504
+ location: "City, ST",
4505
+ name: "Customer Name",
4506
+ quote: "Add testimonial text."
4507
+ }),
4508
+ style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
4509
+ type: "button",
4510
+ children: "Add Testimonial"
3529
4511
  }
3530
- )
3531
- ] })
3532
- ] }) : null,
3533
- selectedType === "richText" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3534
- "Content Width",
3535
- /* @__PURE__ */ jsxs(
3536
- "select",
3537
- {
3538
- onChange: (event) => updateSelectedField("width", event.target.value),
3539
- style: sidebarInputStyle,
3540
- value: normalizeText(selectedBlock.width, "normal"),
3541
- children: [
3542
- /* @__PURE__ */ jsx("option", { value: "normal", children: "Normal" }),
3543
- /* @__PURE__ */ jsx("option", { value: "narrow", children: "Narrow" })
3544
- ]
3545
- }
3546
- )
3547
- ] }) : null,
3548
- selectedType === "formEmbed" ? /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3549
- "Form Type",
3550
- /* @__PURE__ */ jsx(
3551
- "select",
3552
- {
3553
- onChange: (event) => updateSelectedField("formType", event.target.value),
3554
- style: sidebarInputStyle,
3555
- value: normalizeText(selectedBlock.formType, "quote"),
3556
- children: /* @__PURE__ */ jsx("option", { value: "quote", children: "Quote" })
3557
- }
3558
- )
3559
- ] }) : null,
3560
- selectedType === "faq" ? /* @__PURE__ */ jsx(
3561
- "button",
3562
- {
3563
- onClick: () => appendItemToSelected("items", {
3564
- answer: "Answer this question here.",
3565
- question: "New frequently asked question?"
3566
- }),
3567
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3568
- type: "button",
3569
- children: "Add FAQ Item"
3570
- }
3571
- ) : null,
3572
- selectedType === "testimonials" ? /* @__PURE__ */ jsx(
3573
- "button",
3574
- {
3575
- onClick: () => appendItemToSelected("items", {
3576
- location: "City, ST",
3577
- name: "Customer Name",
3578
- quote: "Add testimonial text."
3579
- }),
3580
- style: { borderRadius: 999, cursor: "pointer", fontSize: 12, padding: "7px 10px" },
3581
- type: "button",
3582
- children: "Add Testimonial"
3583
- }
3584
- ) : null,
3585
- /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
3586
- "Upload Alt Text",
3587
- /* @__PURE__ */ jsx(
3588
- "input",
3589
- {
3590
- onChange: (event) => setUploadAltText(event.target.value),
3591
- placeholder: "Describe the image",
3592
- style: sidebarInputStyle,
3593
- type: "text",
3594
- value: uploadAltText
3595
- }
3596
- )
3597
- ] }),
3598
- /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Click section text directly on the page for copy edits. Use this panel for layout and style options." }),
3599
- uploadingTarget ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Uploading image..." }) : null,
3600
- uploadMessage ? /* @__PURE__ */ jsx("div", { style: { color: "#0f7d52", fontSize: 11, fontWeight: 700 }, children: uploadMessage }) : null,
3601
- uploadError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11, fontWeight: 700 }, children: uploadError }) : null
3602
- ] }) : /* @__PURE__ */ jsx("p", { style: { color: "var(--ink-700)", fontSize: 12, margin: 0 }, children: "Click a section on the page preview to edit its options here." }) }) : null
3603
- ] })
3604
- ] }) : null
4512
+ ) : null,
4513
+ /* @__PURE__ */ jsxs("label", { style: sidebarLabelStyle, children: [
4514
+ "Upload Alt Text",
4515
+ /* @__PURE__ */ jsx(
4516
+ "input",
4517
+ {
4518
+ onChange: (event) => setUploadAltText(event.target.value),
4519
+ placeholder: "Describe the image",
4520
+ style: sidebarInputStyle,
4521
+ type: "text",
4522
+ value: uploadAltText
4523
+ }
4524
+ )
4525
+ ] }),
4526
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Click section text directly on the page for copy edits. Use this panel for layout and style options." }),
4527
+ uploadingTarget ? /* @__PURE__ */ jsx("div", { style: { color: "var(--ink-700)", fontSize: 11 }, children: "Uploading image..." }) : null,
4528
+ uploadMessage ? /* @__PURE__ */ jsx("div", { style: { color: "#0f7d52", fontSize: 11, fontWeight: 700 }, children: uploadMessage }) : null,
4529
+ uploadError ? /* @__PURE__ */ jsx("div", { style: { color: "#8d1d1d", fontSize: 11, fontWeight: 700 }, children: uploadError }) : null
4530
+ ] }) : /* @__PURE__ */ jsx("p", { style: { color: "var(--ink-700)", fontSize: 12, margin: 0 }, children: "Click a section on the page preview to edit its options here." }) })
4531
+ ] }) : null
4532
+ ] })
4533
+ ] }) : /* @__PURE__ */ jsx(
4534
+ "div",
4535
+ {
4536
+ style: {
4537
+ alignContent: "start",
4538
+ background: "linear-gradient(180deg, rgba(18, 74, 55, 0.06), rgba(18, 74, 55, 0))",
4539
+ display: "grid",
4540
+ gap: 10,
4541
+ justifyItems: "center",
4542
+ maxHeight: "calc(100vh - 90px)",
4543
+ overflow: "hidden",
4544
+ padding: "10px 6px"
4545
+ },
4546
+ children: tabs
4547
+ }
4548
+ );
4549
+ })()
3605
4550
  ]
3606
4551
  }
3607
4552
  )