@sprintup-cms/sdk 1.8.59 → 1.8.63

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.
@@ -1197,60 +1197,98 @@ var SOCIAL_ICONS = [
1197
1197
  { key: "linkedin", label: "LinkedIn", d: "M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-4 0v7h-4v-7a6 6 0 0 1 6-6zM2 9h4v12H2zm2-3a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" },
1198
1198
  { key: "youtube", label: "YouTube", d: "M22.54 6.42a2.78 2.78 0 0 0-1.94-1.96C18.88 4 12 4 12 4s-6.88 0-8.6.46a2.78 2.78 0 0 0-1.94 1.96A29 29 0 0 0 1 12a29 29 0 0 0 .46 5.58 2.78 2.78 0 0 0 1.94 1.96C5.12 20 12 20 12 20s6.88 0 8.6-.46a2.78 2.78 0 0 0 1.94-1.96A29 29 0 0 0 23 12a29 29 0 0 0-.46-5.58zM9.75 15.02V8.98L15.5 12l-5.75 3.02z" }
1199
1199
  ];
1200
+ function renderFooterSection(sec, mutedLink) {
1201
+ if (sec.type === "brand") {
1202
+ if (!sec.logo_url && !sec.tagline) return null;
1203
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
1204
+ sec.logo_url && /* @__PURE__ */ jsx("img", { src: sec.logo_url, alt: "Logo", style: { height: "32px", width: "auto", objectFit: "contain" } }),
1205
+ sec.tagline && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", lineHeight: 1.6, margin: 0 }, children: sec.tagline })
1206
+ ] });
1207
+ }
1208
+ if (sec.type === "links") {
1209
+ const links = (sec.links || []).filter((l) => l.label);
1210
+ if (!links.length && !sec.title) return null;
1211
+ return /* @__PURE__ */ jsxs("div", { children: [
1212
+ sec.title && /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: sec.title }),
1213
+ /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "0.5rem" }, children: links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
1214
+ "a",
1215
+ {
1216
+ href: link.url || "#",
1217
+ target: link.external ? "_blank" : void 0,
1218
+ rel: link.external ? "noopener noreferrer" : void 0,
1219
+ style: mutedLink,
1220
+ children: link.label
1221
+ }
1222
+ ) }, link.id || link.label)) })
1223
+ ] });
1224
+ }
1225
+ if (sec.type === "contact") {
1226
+ if (!sec.email && !sec.phone && !sec.address) return null;
1227
+ return /* @__PURE__ */ jsxs("div", { children: [
1228
+ sec.title && /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: sec.title }),
1229
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
1230
+ sec.email && /* @__PURE__ */ jsx("a", { href: `mailto:${sec.email}`, style: mutedLink, children: sec.email }),
1231
+ sec.phone && /* @__PURE__ */ jsx("a", { href: `tel:${sec.phone}`, style: mutedLink, children: sec.phone }),
1232
+ sec.address && /* @__PURE__ */ jsx("p", { style: { ...mutedLink, whiteSpace: "pre-line", margin: 0 }, children: sec.address })
1233
+ ] })
1234
+ ] });
1235
+ }
1236
+ if (sec.type === "social") {
1237
+ const active = SOCIAL_ICONS.filter((s) => sec[s.key]?.trim());
1238
+ if (!active.length) return null;
1239
+ return /* @__PURE__ */ jsxs("div", { children: [
1240
+ sec.title && /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: sec.title }),
1241
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.625rem" }, children: active.map((s) => /* @__PURE__ */ jsx(
1242
+ "a",
1243
+ {
1244
+ href: sec[s.key],
1245
+ target: "_blank",
1246
+ rel: "noopener noreferrer",
1247
+ "aria-label": s.label,
1248
+ style: { display: "flex", alignItems: "center", justifyContent: "center", width: "34px", height: "34px", borderRadius: "8px", border: "1px solid var(--border, #e5e7eb)", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" },
1249
+ children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: s.d }) })
1250
+ },
1251
+ s.key
1252
+ )) })
1253
+ ] });
1254
+ }
1255
+ return null;
1256
+ }
1200
1257
  function CMSFooter({ footer }) {
1201
1258
  const sd = getSD(footer);
1202
1259
  if (!sd) return null;
1203
- const brand = sd.brand || {};
1204
- const columns = Array.isArray(sd.columns) ? sd.columns : [];
1205
- const social = sd.social || {};
1206
- const contact = sd.contact || {};
1207
- const legal = sd.legal || {};
1208
- const hasBrand = brand.logo_url || brand.tagline;
1209
- const hasContact = contact.email || contact.phone || contact.address;
1210
- const hasSocial = SOCIAL_ICONS.some((s) => social[s.key]?.trim());
1211
- const hasBottom = legal.copyright || Array.isArray(legal.links) && legal.links.length > 0;
1212
- const hasContent = hasBrand || columns.length > 0 || hasContact;
1213
- if (!hasContent && !hasSocial && !hasBottom) return null;
1214
- const totalCols = [hasBrand, ...columns.map(() => true), hasContact].filter(Boolean).length;
1215
- const gridCols = totalCols <= 1 ? "1fr" : totalCols === 2 ? "repeat(2,1fr)" : totalCols === 3 ? "repeat(3,1fr)" : "repeat(4,1fr)";
1260
+ const sections = Array.isArray(sd.sections) ? sd.sections : [];
1261
+ const isLegacy = sections.length === 0 && ("brand" in sd || "columns" in sd || "contact" in sd || "social" in sd || "legal" in sd);
1262
+ let renderSections = sections;
1263
+ if (isLegacy) {
1264
+ renderSections = [];
1265
+ if (sd.brand?.logo_url || sd.brand?.tagline) renderSections.push({ id: "b", type: "brand", ...sd.brand });
1266
+ (Array.isArray(sd.columns) ? sd.columns : []).forEach((col) => renderSections.push({ id: col.id || col.title || Math.random(), type: "links", title: col.title, links: col.links || [] }));
1267
+ if (sd.contact?.email || sd.contact?.phone || sd.contact?.address) renderSections.push({ id: "c", type: "contact", ...sd.contact });
1268
+ if (sd.social && Object.values(sd.social).some(Boolean)) renderSections.push({ id: "s", type: "social", ...sd.social });
1269
+ }
1270
+ const legalSec = sections.find((s) => s.type === "legal") ?? (isLegacy ? sd.legal ?? null : null);
1271
+ const mainSections = renderSections.filter((s) => s.type !== "legal");
1272
+ const copyright = legalSec?.copyright || "";
1273
+ const legalLinks = Array.isArray(legalSec?.legal_links) ? legalSec.legal_links : Array.isArray(legalSec?.links) ? legalSec.links : [];
1274
+ const hasBottom = !!(copyright || legalLinks.filter((l) => l.label).length);
1275
+ if (mainSections.length === 0 && !hasBottom) return null;
1276
+ const gridCount = mainSections.length;
1277
+ const gridCols = gridCount <= 1 ? "1fr" : gridCount === 2 ? "repeat(2,1fr)" : gridCount === 3 ? "repeat(3,1fr)" : "repeat(4,1fr)";
1216
1278
  const mutedLink = { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" };
1217
1279
  return /* @__PURE__ */ jsx("footer", { style: { borderTop: "1px solid var(--border, #e5e7eb)", background: "var(--muted, #f9fafb)", marginTop: "4rem" }, children: /* @__PURE__ */ jsxs("div", { style: { maxWidth: "1200px", margin: "0 auto", padding: "3rem 1.5rem 1.5rem" }, children: [
1218
- hasContent && /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: gridCols, gap: "2.5rem", marginBottom: hasSocial || hasBottom ? "2.5rem" : 0 }, children: [
1219
- hasBrand && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: [
1220
- brand.logo_url && /* @__PURE__ */ jsx("img", { src: brand.logo_url, alt: "Logo", style: { height: "32px", width: "auto", objectFit: "contain" } }),
1221
- brand.tagline && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: "var(--muted-foreground, #6b7280)", lineHeight: 1.6, margin: 0 }, children: brand.tagline })
1222
- ] }),
1223
- columns.map((col) => /* @__PURE__ */ jsxs("div", { children: [
1224
- col.title && /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: col.title }),
1225
- /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "0.5rem" }, children: (col.links || []).filter((l) => l.label).map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { href: link.url || "#", style: mutedLink, children: link.label }) }, link.id || link.label)) })
1226
- ] }, col.id || col.title)),
1227
- hasContact && /* @__PURE__ */ jsxs("div", { children: [
1228
- /* @__PURE__ */ jsx("h4", { style: { fontWeight: 600, fontSize: "0.875rem", margin: "0 0 0.875rem", color: "var(--foreground, #111)" }, children: "Contact" }),
1229
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.4rem" }, children: [
1230
- contact.email && /* @__PURE__ */ jsx("a", { href: `mailto:${contact.email}`, style: mutedLink, children: contact.email }),
1231
- contact.phone && /* @__PURE__ */ jsx("a", { href: `tel:${contact.phone}`, style: mutedLink, children: contact.phone }),
1232
- contact.address && /* @__PURE__ */ jsx("p", { style: { ...mutedLink, whiteSpace: "pre-line", margin: 0 }, children: contact.address })
1233
- ] })
1234
- ] })
1235
- ] }),
1236
- hasSocial && /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "0.75rem", marginBottom: hasBottom ? "1.5rem" : 0 }, children: SOCIAL_ICONS.filter((s) => social[s.key]?.trim()).map((s) => /* @__PURE__ */ jsx(
1237
- "a",
1238
- {
1239
- href: social[s.key],
1240
- target: "_blank",
1241
- rel: "noopener noreferrer",
1242
- "aria-label": s.label,
1243
- style: { display: "flex", alignItems: "center", justifyContent: "center", width: "36px", height: "36px", borderRadius: "8px", border: "1px solid var(--border, #e5e7eb)", color: "var(--muted-foreground, #6b7280)", textDecoration: "none", flexShrink: 0 },
1244
- children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: s.d }) })
1245
- },
1246
- s.key
1247
- )) }),
1280
+ mainSections.length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: gridCols, gap: "2.5rem", marginBottom: hasBottom ? "2.5rem" : 0 }, children: mainSections.map((sec) => {
1281
+ const rendered = renderFooterSection(sec, mutedLink);
1282
+ return rendered ? /* @__PURE__ */ jsx("div", { children: rendered }, sec.id) : null;
1283
+ }) }),
1248
1284
  hasBottom && /* @__PURE__ */ jsxs("div", { style: { borderTop: "1px solid var(--border, #e5e7eb)", paddingTop: "1.25rem", display: "flex", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: "1rem" }, children: [
1249
- legal.copyright && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", margin: 0 }, children: legal.copyright }),
1250
- Array.isArray(legal.links) && legal.links.filter((l) => l.label).length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "1.25rem" }, children: legal.links.filter((l) => l.label).map((link) => /* @__PURE__ */ jsx(
1285
+ copyright && /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", margin: 0 }, children: copyright }),
1286
+ legalLinks.filter((l) => l.label).length > 0 && /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "1.25rem" }, children: legalLinks.filter((l) => l.label).map((link) => /* @__PURE__ */ jsx(
1251
1287
  "a",
1252
1288
  {
1253
1289
  href: link.url || "#",
1290
+ target: link.external ? "_blank" : void 0,
1291
+ rel: link.external ? "noopener noreferrer" : void 0,
1254
1292
  style: { fontSize: "0.8rem", color: "var(--muted-foreground, #6b7280)", textDecoration: "none" },
1255
1293
  children: link.label
1256
1294
  },