admin-lib-cms 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2108,10 +2108,59 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2108
2108
  }
2109
2109
  )
2110
2110
  ] }) }),
2111
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4", children: [
2112
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2113
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { className: "text-sm text-slate-800 whitespace-pre-wrap", children: String(val ?? "\u2014") })
2114
- ] }, key)) })
2111
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
2112
+ const strVal = String(val ?? "\u2014");
2113
+ const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
2114
+ const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
2115
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2116
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2117
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-2", children: [
2118
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2119
+ "a",
2120
+ {
2121
+ href: strVal,
2122
+ target: "_blank",
2123
+ rel: "noopener noreferrer",
2124
+ className: "inline-block max-w-sm rounded-lg overflow-hidden border border-slate-200 shadow-sm hover:shadow transition-shadow bg-slate-50 p-1",
2125
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2126
+ "img",
2127
+ {
2128
+ src: strVal,
2129
+ alt: key,
2130
+ className: "max-h-64 w-auto object-contain rounded"
2131
+ }
2132
+ )
2133
+ }
2134
+ ),
2135
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2136
+ "a",
2137
+ {
2138
+ href: strVal,
2139
+ target: "_blank",
2140
+ rel: "noopener noreferrer",
2141
+ className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
2142
+ children: [
2143
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ExternalLink, { className: "w-3.5 h-3.5" }),
2144
+ " View / Download file"
2145
+ ]
2146
+ }
2147
+ ) })
2148
+ ] }) : isUrl ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2149
+ "a",
2150
+ {
2151
+ href: strVal,
2152
+ target: "_blank",
2153
+ rel: "noopener noreferrer",
2154
+ className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
2155
+ children: [
2156
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.ExternalLink, { className: "w-3.5 h-3.5 flex-shrink-0" }),
2157
+ " ",
2158
+ strVal
2159
+ ]
2160
+ }
2161
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "whitespace-pre-wrap", children: strVal }) })
2162
+ ] }, key);
2163
+ }) })
2115
2164
  ] })
2116
2165
  ] });
2117
2166
  }
package/dist/index.mjs CHANGED
@@ -653,7 +653,8 @@ import {
653
653
  ChevronLeft,
654
654
  ChevronRight,
655
655
  SlidersHorizontal,
656
- LogOut
656
+ LogOut,
657
+ ExternalLink as ExternalLink2
657
658
  } from "lucide-react";
658
659
  import { CreditCard as CreditCard2 } from "lucide-react";
659
660
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -2106,10 +2107,59 @@ function SubmissionsList({ formId, submissions, onLoad, loading }) {
2106
2107
  }
2107
2108
  )
2108
2109
  ] }) }),
2109
- /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => /* @__PURE__ */ jsxs3("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4", children: [
2110
- /* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2111
- /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800 whitespace-pre-wrap", children: String(val ?? "\u2014") })
2112
- ] }, key)) })
2110
+ /* @__PURE__ */ jsx5("div", { className: "px-8 py-6 divide-y divide-slate-100", children: Object.entries(detail.data).map(([key, val]) => {
2111
+ const strVal = String(val ?? "\u2014");
2112
+ const isImage = typeof val === "string" && (val.startsWith("data:image/") || /\.(jpg|jpeg|png|webp|avif|gif|svg)(\?.*)?$/i.test(val) || val.includes("/images/") && val.includes("sanity.io"));
2113
+ const isUrl = typeof val === "string" && /^https?:\/\//i.test(val);
2114
+ return /* @__PURE__ */ jsxs3("div", { className: "py-4 grid grid-cols-[160px_1fr] gap-4 items-start", children: [
2115
+ /* @__PURE__ */ jsx5("dt", { className: "text-xs font-bold uppercase tracking-wide text-slate-400 pt-0.5", children: key }),
2116
+ /* @__PURE__ */ jsx5("dd", { className: "text-sm text-slate-800", children: isImage ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
2117
+ /* @__PURE__ */ jsx5(
2118
+ "a",
2119
+ {
2120
+ href: strVal,
2121
+ target: "_blank",
2122
+ rel: "noopener noreferrer",
2123
+ className: "inline-block max-w-sm rounded-lg overflow-hidden border border-slate-200 shadow-sm hover:shadow transition-shadow bg-slate-50 p-1",
2124
+ children: /* @__PURE__ */ jsx5(
2125
+ "img",
2126
+ {
2127
+ src: strVal,
2128
+ alt: key,
2129
+ className: "max-h-64 w-auto object-contain rounded"
2130
+ }
2131
+ )
2132
+ }
2133
+ ),
2134
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsxs3(
2135
+ "a",
2136
+ {
2137
+ href: strVal,
2138
+ target: "_blank",
2139
+ rel: "noopener noreferrer",
2140
+ className: "inline-flex items-center gap-1.5 text-xs text-indigo-600 font-semibold hover:underline",
2141
+ children: [
2142
+ /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5" }),
2143
+ " View / Download file"
2144
+ ]
2145
+ }
2146
+ ) })
2147
+ ] }) : isUrl ? /* @__PURE__ */ jsxs3(
2148
+ "a",
2149
+ {
2150
+ href: strVal,
2151
+ target: "_blank",
2152
+ rel: "noopener noreferrer",
2153
+ className: "inline-flex items-center gap-1.5 text-indigo-600 font-medium hover:underline break-all text-sm",
2154
+ children: [
2155
+ /* @__PURE__ */ jsx5(ExternalLink2, { className: "w-3.5 h-3.5 flex-shrink-0" }),
2156
+ " ",
2157
+ strVal
2158
+ ]
2159
+ }
2160
+ ) : /* @__PURE__ */ jsx5("p", { className: "whitespace-pre-wrap", children: strVal }) })
2161
+ ] }, key);
2162
+ }) })
2113
2163
  ] })
2114
2164
  ] });
2115
2165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admin-lib-cms",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Agnostic Admin CMS Library",
5
5
  "keywords": [
6
6
  "cms",