@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.js CHANGED
@@ -8538,6 +8538,9 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
8538
8538
  if (Array.isArray(value)) {
8539
8539
  return /* @__PURE__ */ jsx29("span", { className: "flex flex-wrap gap-1", children: value.map((item, i) => /* @__PURE__ */ jsx29(Badge7, { variant: "secondary", className: "text-[11px]", children: scalarText(field, item, labels) }, `${String(item)}-${i}`)) });
8540
8540
  }
8541
+ if ((kind === "text" || kind === "url") && typeof value === "string" && isImageUrl2(value)) {
8542
+ return /* @__PURE__ */ jsx29(ImageUrlValue, { url: value.trim(), alt: field.label || field.key, room });
8543
+ }
8541
8544
  if (kind === "url" && typeof value === "string") {
8542
8545
  const href = value.includes("://") ? value : `https://${value}`;
8543
8546
  return /* @__PURE__ */ jsx29(LinkPreviewCard, { url: href, children: /* @__PURE__ */ jsxs27(
@@ -8576,6 +8579,32 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
8576
8579
  }
8577
8580
  return /* @__PURE__ */ jsx29("span", { className: cn24("truncate", kind === "number" || kind === "currency" || kind === "percent" ? "tabular-nums" : ""), children: scalarText(field, value, labels, stillWaitingFor) });
8578
8581
  }
8582
+ function isImageUrl2(value) {
8583
+ const text = value.trim();
8584
+ if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
8585
+ let url;
8586
+ try {
8587
+ url = new URL(text);
8588
+ } catch {
8589
+ return false;
8590
+ }
8591
+ return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
8592
+ }
8593
+ function ImageUrlValue({ url, alt, room }) {
8594
+ const host = useRecordsUi();
8595
+ const box = room === "full" ? "size-24" : "size-6";
8596
+ return /* @__PURE__ */ jsx29(
8597
+ OutboundLink6,
8598
+ {
8599
+ className: cn24("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"),
8600
+ href: url,
8601
+ title: url,
8602
+ "data-records-image-url": "",
8603
+ onClick: (event) => event.stopPropagation(),
8604
+ children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ jsx29("span", { className: "truncate", children: linkChipText(url) })
8605
+ }
8606
+ );
8607
+ }
8579
8608
  function LivePersonChip({ id, name }) {
8580
8609
  const open = useRecordsUi().openPerson;
8581
8610
  return /* @__PURE__ */ jsx29(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });