@ai-matrx/records-ui 0.115.99 → 0.115.101
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/CHANGELOG.md +30 -1
- package/dist/index.cjs +3115 -3079
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +946 -910
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +37 -0
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +37 -0
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/pickers.cjs
CHANGED
|
@@ -8442,6 +8442,8 @@ 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
|
+
const pictureAt = imageAddressOf(field, value);
|
|
8446
|
+
if (pictureAt) return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ImageUrlValue, { url: pictureAt, alt: field.label || field.key, room });
|
|
8445
8447
|
if (kind === "url" && typeof value === "string") {
|
|
8446
8448
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
8447
8449
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LinkPreviewCard, { url: href, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
@@ -8480,6 +8482,41 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look, roo
|
|
|
8480
8482
|
}
|
|
8481
8483
|
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
8484
|
}
|
|
8485
|
+
function isImageUrl2(value) {
|
|
8486
|
+
const text = value.trim();
|
|
8487
|
+
if (!/^https?:\/\/[^\s]+$/i.test(text)) return false;
|
|
8488
|
+
let url;
|
|
8489
|
+
try {
|
|
8490
|
+
url = new URL(text);
|
|
8491
|
+
} catch {
|
|
8492
|
+
return false;
|
|
8493
|
+
}
|
|
8494
|
+
return /\.(png|jpe?g|gif|webp|avif|svg|bmp|ico)$/i.test(url.pathname) || /\/(images?|img)\//i.test(url.pathname);
|
|
8495
|
+
}
|
|
8496
|
+
function imageAddressOf(field, value) {
|
|
8497
|
+
if (typeof value !== "string") return null;
|
|
8498
|
+
const kind = editorKindFor(field);
|
|
8499
|
+
if (kind !== "text" && kind !== "url") return null;
|
|
8500
|
+
const text = value.trim();
|
|
8501
|
+
if (isImageUrl2(text)) return text;
|
|
8502
|
+
const named = /(^|[^a-z])(logo|image|img|photo|picture|avatar|thumbnail|headshot)s?([^a-z]|$)/i.test(`${field.label ?? ""} ${field.key}`);
|
|
8503
|
+
return named && /^https?:\/\/[^\s]+$/i.test(text) ? text : null;
|
|
8504
|
+
}
|
|
8505
|
+
function ImageUrlValue({ url, alt, room }) {
|
|
8506
|
+
const host = useRecordsUi();
|
|
8507
|
+
const box = room === "full" ? "size-24" : "size-6";
|
|
8508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
8509
|
+
import_outbound_react6.OutboundLink,
|
|
8510
|
+
{
|
|
8511
|
+
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"),
|
|
8512
|
+
href: url,
|
|
8513
|
+
title: url,
|
|
8514
|
+
"data-records-image-url": "",
|
|
8515
|
+
onClick: (event) => event.stopPropagation(),
|
|
8516
|
+
children: host.fileImage ? host.fileImage({ fileId: url, alt }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "truncate", children: linkChipText(url) })
|
|
8517
|
+
}
|
|
8518
|
+
);
|
|
8519
|
+
}
|
|
8483
8520
|
function LivePersonChip({ id, name }) {
|
|
8484
8521
|
const open = useRecordsUi().openPerson;
|
|
8485
8522
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PersonChip, { name, ...open ? { onOpen: () => void openStoredPerson(id, open) } : {} });
|