@ai-matrx/records-ui 0.115.99 → 0.115.100

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/pickers.cjs CHANGED
@@ -8442,6 +8442,9 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
8442
8442
  if (Array.isArray(value)) {
8443
8443
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_design_system27.Badge, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
8444
8444
  }
8445
+ if ((kind === "text" || kind === "url") && typeof value === "string" && isImageUrl2(value)) {
8446
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageUrlValue, { url: value.trim(), alt: field.label || field.key, room });
8447
+ }
8445
8448
  if (kind === "url" && typeof value === "string") {
8446
8449
  const href = value.includes("://") ? value : `https://${value}`;
8447
8450
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LinkPreviewCard, { url: href, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
@@ -8480,6 +8483,32 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
8480
8483
  }
8481
8484
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: (0, import_design_system27.cn)("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
8482
8485
  }
8486
+ function isImageUrl2(value) {
8487
+ const text = value.trim();
8488
+ if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
8489
+ let url;
8490
+ try {
8491
+ url = new URL(text);
8492
+ } catch {
8493
+ return false;
8494
+ }
8495
+ return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
8496
+ }
8497
+ function ImageUrlValue({ url, alt, room }) {
8498
+ const host = useRecordsUi();
8499
+ const box = room === "full" ? "size-24" : "size-6";
8500
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
8501
+ import_outbound_react6.OutboundLink,
8502
+ {
8503
+ className: (0, import_design_system27.cn)("inline-flex shrink-0 overflow-hidden rounded-md border border-border bg-muted/40", host.fileImage ? box : "min-w-0 max-w-full items-center gap-1 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent"),
8504
+ href: url,
8505
+ title: url,
8506
+ "data-records-image-url": "",
8507
+ onClick: (event) => event.stopPropagation(),
8508
+ children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "truncate", children: linkChipText(url) })
8509
+ }
8510
+ );
8511
+ }
8483
8512
  function LivePersonChip({ id, name }) {
8484
8513
  const open = useRecordsUi().openPerson;
8485
8514
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });