@ai-matrx/records-ui 0.116.14 → 0.116.16
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 +25 -1
- package/dist/{SaveToTable-QZCRFD5Q.js → SaveToTable-54FVMGKL.js} +3 -3
- package/dist/{chunk-NE72B4OK.js → chunk-QVTYE4XU.js} +39 -17
- package/dist/chunk-QVTYE4XU.js.map +1 -0
- package/dist/{chunk-RQL7QRGR.js → chunk-TF3JYYJN.js} +1 -1
- package/dist/chunk-TF3JYYJN.js.map +1 -0
- package/dist/{chunk-6WDNTT2G.js → chunk-WETGQ7P3.js} +66 -10
- package/dist/chunk-WETGQ7P3.js.map +1 -0
- package/dist/{chunk-HUPBD4JF.js → chunk-YIGEIVU7.js} +2 -2
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +10 -1
- package/dist/helpers.d.ts +10 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2834 -2683
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -9
- package/dist/index.d.ts +40 -9
- package/dist/index.js +2523 -2422
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +34 -11
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -2
- package/dist/skeleton.cjs +64 -8
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.d.cts +48 -1
- package/dist/skeleton.d.ts +48 -1
- package/dist/skeleton.js +25 -1
- package/package.json +5 -5
- package/dist/chunk-6WDNTT2G.js.map +0 -1
- package/dist/chunk-NE72B4OK.js.map +0 -1
- package/dist/chunk-RQL7QRGR.js.map +0 -1
- /package/dist/{SaveToTable-QZCRFD5Q.js.map → SaveToTable-54FVMGKL.js.map} +0 -0
- /package/dist/{chunk-HUPBD4JF.js.map → chunk-YIGEIVU7.js.map} +0 -0
package/dist/pickers.cjs
CHANGED
|
@@ -850,6 +850,9 @@ function recordName(document2, titleKey, fallback = "Untitled") {
|
|
|
850
850
|
function looksLikeId(value) {
|
|
851
851
|
return typeof value === "string" && (0, import_uuid.isUuidShape)(value.trim());
|
|
852
852
|
}
|
|
853
|
+
function recordNameIn(table, document2, fallback = "Untitled") {
|
|
854
|
+
return recordName(document2, table?.title_field ?? null, fallback);
|
|
855
|
+
}
|
|
853
856
|
function rowNameIn(table, row, fallback = "Untitled") {
|
|
854
857
|
return recordName(row?.document, table?.title_field ?? null, fallback);
|
|
855
858
|
}
|
|
@@ -6719,8 +6722,15 @@ function numberOf(value) {
|
|
|
6719
6722
|
function Swatch({ color, className }) {
|
|
6720
6723
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { "aria-hidden": true, className: (0, import_design_system15.cn)("inline-block h-4 w-4 shrink-0 rounded border border-border", className), style: { backgroundColor: color } });
|
|
6721
6724
|
}
|
|
6722
|
-
function
|
|
6723
|
-
const
|
|
6725
|
+
function colorPairGround(format, context) {
|
|
6726
|
+
const fixed = format.options?.contrastWith;
|
|
6727
|
+
if (fixed?.readsOnField) return context?.ground ?? null;
|
|
6728
|
+
if (context?.ground) return context.ground;
|
|
6729
|
+
if (!fixed || !fixed.light && !fixed.dark) return null;
|
|
6730
|
+
return { ...fixed.light ? { light: fixed.light } : {}, ...fixed.dark ? { dark: fixed.dark } : {}, label: fixed.label ?? "its background" };
|
|
6731
|
+
}
|
|
6732
|
+
function colorPairContrast(pair, format, context) {
|
|
6733
|
+
const ground = colorPairGround(format, context);
|
|
6724
6734
|
if (!ground) return {};
|
|
6725
6735
|
const out = {};
|
|
6726
6736
|
if (ground.light) {
|
|
@@ -6855,11 +6865,11 @@ function ColorPairPreview({ value }) {
|
|
|
6855
6865
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex items-end p-2", style: { backgroundColor: pair.dark ?? pair.light }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs text-foreground", children: "Dark" }) })
|
|
6856
6866
|
] });
|
|
6857
6867
|
}
|
|
6858
|
-
function colorPairChecks(value, format) {
|
|
6868
|
+
function colorPairChecks(value, format, context) {
|
|
6859
6869
|
const pair = (0, import_field_formats3.readColorPair)(value);
|
|
6860
6870
|
if (!pair) return [];
|
|
6861
|
-
const contrast = colorPairContrast(pair, format);
|
|
6862
|
-
const ground = format
|
|
6871
|
+
const contrast = colorPairContrast(pair, format, context);
|
|
6872
|
+
const ground = colorPairGround(format, context)?.label ?? "its background";
|
|
6863
6873
|
const out = [];
|
|
6864
6874
|
for (const part of ["light", "dark"]) {
|
|
6865
6875
|
const ratio = contrast[part];
|
|
@@ -7710,10 +7720,7 @@ function LinkPreviewCard({ url, children }) {
|
|
|
7710
7720
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
7711
7721
|
) : null,
|
|
7712
7722
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
7713
|
-
shown2.faviconUrl
|
|
7714
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
7715
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: shown2.faviconUrl, alt: "", className: "h-3.5 w-3.5 shrink-0", referrerPolicy: "no-referrer" })
|
|
7716
|
-
) : null,
|
|
7723
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system20.SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
7717
7724
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
7718
7725
|
] }),
|
|
7719
7726
|
shown2.title ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
@@ -12322,6 +12329,10 @@ function buttonPressWords(label, pressed) {
|
|
|
12322
12329
|
const status = pressed.status ?? "ran";
|
|
12323
12330
|
return [`${pressed.automation ?? label}: ${status}.`, pressed.says].filter(Boolean).join(" ");
|
|
12324
12331
|
}
|
|
12332
|
+
function addRowWords(label, table, document2) {
|
|
12333
|
+
const name = recordNameIn(table, document2, "");
|
|
12334
|
+
return name !== "" ? `${label}: added \u201C${name}\u201D and opened it.` : `${label}: added to ${tableName(table)} and opened it.`;
|
|
12335
|
+
}
|
|
12325
12336
|
var POLL_EVERY_MS = 1200;
|
|
12326
12337
|
var POLL_FOR_MS = 12e4;
|
|
12327
12338
|
var RUN_BOOKKEEPING = /* @__PURE__ */ new Set(["run_id", "conversation_id"]);
|
|
@@ -12367,7 +12378,7 @@ function waitingRunsOf(pressed) {
|
|
|
12367
12378
|
return out;
|
|
12368
12379
|
}
|
|
12369
12380
|
var stop2 = (event) => event.stopPropagation();
|
|
12370
|
-
function ButtonValue({ field, recordId, inCell }) {
|
|
12381
|
+
function ButtonValue({ field, recordId, inCell, beforeSave }) {
|
|
12371
12382
|
const client = (0, import_react67.useOptionalRecordsClient)();
|
|
12372
12383
|
const b = (0, import_records26.buttonOf)(field);
|
|
12373
12384
|
const [busy, setBusy] = (0, import_react66.useState)(false);
|
|
@@ -12381,6 +12392,12 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
12381
12392
|
(0, import_react66.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
12382
12393
|
if (!b) return null;
|
|
12383
12394
|
const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
|
|
12395
|
+
if (beforeSave) {
|
|
12396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field.key, children: [
|
|
12397
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_design_system39.Button, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field.key}-before-save`, "data-records-button": field.key, className: (0, import_design_system39.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "truncate", children: b.label }) }),
|
|
12398
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: `${field.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
12399
|
+
] });
|
|
12400
|
+
}
|
|
12384
12401
|
const needs = (0, import_records26.buttonNeeds)(b);
|
|
12385
12402
|
const tableId = field.entity_definition_id;
|
|
12386
12403
|
const press = async () => {
|
|
@@ -12403,6 +12420,12 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
12403
12420
|
here.open(pressed.record_id);
|
|
12404
12421
|
return setSaid({ kind: "ran", says: `${b.label}: a row was added and opened.` });
|
|
12405
12422
|
}
|
|
12423
|
+
if (host.openRecord && addsTo.data) {
|
|
12424
|
+
const made = addsTo.data;
|
|
12425
|
+
host.openRecord({ table: made, recordId: pressed.record_id });
|
|
12426
|
+
const read = await client.recordRead({ record_id: pressed.record_id });
|
|
12427
|
+
return setSaid({ kind: "ran", says: addRowWords(b.label, made, read.ok ? read.data.document : void 0) });
|
|
12428
|
+
}
|
|
12406
12429
|
const href = addsTo.data ? host.hrefForRecord?.({ table: addsTo.data, recordId: pressed.record_id }) : void 0;
|
|
12407
12430
|
if (href) {
|
|
12408
12431
|
setOpening(true);
|
|
@@ -13124,7 +13147,7 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
13124
13147
|
const ownDetails = (0, import_react72.useOptionalRecordsClient)() === null;
|
|
13125
13148
|
if (isTypedDraft(value)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TypedTextControl, { field, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
13126
13149
|
if (isSignatureField(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
13127
|
-
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ButtonValue, { field });
|
|
13150
|
+
if ((0, import_records28.isButtonField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ButtonValue, { field, recordId: recordId ?? null, beforeSave: !recordId });
|
|
13128
13151
|
const newerControl = newerKindControl({ field, value, onChange, disabled, id: inputId });
|
|
13129
13152
|
if (newerControl !== void 0) return newerControl;
|
|
13130
13153
|
const format = formatForField(field);
|