@ai-matrx/records-ui 0.115.32 → 0.115.33

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.115.33
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.115.32..npm/records-ui/v0.115.33 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.115.32
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -31116,6 +31116,7 @@ function RecordFieldsInPlace({
31116
31116
  var import_react183 = require("react");
31117
31117
  var import_records54 = require("@ai-matrx/records");
31118
31118
  var import_react184 = require("@ai-matrx/records/react");
31119
+ var import_text_case12 = require("@ai-matrx/kit/text-case");
31119
31120
  var import_design_system92 = require("@ai-matrx/design-system");
31120
31121
  var import_jsx_runtime108 = require("react/jsx-runtime");
31121
31122
  function sourceWords(document2, pointer) {
@@ -31125,6 +31126,14 @@ function sourceWords(document2, pointer) {
31125
31126
  const said2 = Object.values(source).map(String).join(" \xB7 ");
31126
31127
  return said2 === "" ? null : said2;
31127
31128
  }
31129
+ function sourceObjectWords(source) {
31130
+ if (!source) return null;
31131
+ const named = source["name"] ?? source["label"] ?? source["title"];
31132
+ if (typeof named === "string" && named !== "") return named;
31133
+ const kind = source["kind"];
31134
+ if (kind === "record") return "Merged record";
31135
+ return typeof kind === "string" && kind !== "" ? (0, import_text_case12.humanizeIdentifier)(kind) : null;
31136
+ }
31128
31137
  function shown3(field2, value) {
31129
31138
  return value === null || value === void 0 || value === "" ? "nothing" : scalarText(field2, value);
31130
31139
  }
@@ -31137,12 +31146,14 @@ function ValueAlternates({
31137
31146
  }) {
31138
31147
  const client = (0, import_react184.useRecordsClient)();
31139
31148
  const envelope = envelopeFor(document2, field2.key);
31140
- const held = envelope?.alternates ?? [];
31149
+ const offered = document2?.["_alternates"];
31150
+ const held = envelope?.alternates ?? offered?.[field2.key] ?? [];
31141
31151
  const [read, setRead] = (0, import_react183.useState)(null);
31142
31152
  const [asked3, setAsked] = (0, import_react183.useState)(false);
31143
31153
  const [refusal3, setRefusal] = (0, import_react183.useState)(null);
31144
31154
  const [busy, setBusy] = (0, import_react183.useState)(null);
31145
31155
  const [open, setOpen] = (0, import_react183.useState)(false);
31156
+ const shownList = read?.alternates && read.alternates.length > 0 ? read.alternates : held;
31146
31157
  if (held.length === 0) return null;
31147
31158
  async function opened(next) {
31148
31159
  setOpen(next);
@@ -31157,7 +31168,7 @@ function ValueAlternates({
31157
31168
  async function use(index) {
31158
31169
  setBusy(index);
31159
31170
  setRefusal(null);
31160
- const written = await (0, import_records54.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index });
31171
+ const written = await (0, import_records54.chooseAlternate)(client, { record_id: recordId, field_key: field2.key, alternate_index: index, ...shownList[index]?.rank !== void 0 ? { rank: shownList[index].rank } : {} });
31161
31172
  setBusy(null);
31162
31173
  if (!written.ok) return setRefusal(written.error);
31163
31174
  setOpen(false);
@@ -31165,7 +31176,7 @@ function ValueAlternates({
31165
31176
  onChosen();
31166
31177
  }
31167
31178
  const actor = read?.actor;
31168
- const currentFrom = sourceWords(document2, envelope?.src) ?? (read?.source ? Object.values(read.source).map(String).join(" \xB7 ") : null) ?? (typeof actor === "string" ? actor : null);
31179
+ const currentFrom = sourceWords(document2, envelope?.src) ?? sourceObjectWords(read?.source) ?? (typeof actor === "string" ? actor : null);
31169
31180
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_design_system92.Popover, { open, onOpenChange: (next) => void opened(next), children: [
31170
31181
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_design_system92.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
31171
31182
  "button",
@@ -31184,11 +31195,11 @@ function ValueAlternates({
31184
31195
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "truncate font-medium", children: shown3(field2, document2?.[field2.key]) }),
31185
31196
  asked3 || currentFrom ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "truncate text-[11px] text-muted-foreground", children: currentFrom ?? "" }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_design_system92.Skeleton, { shape: "line", width: "1/2" })
31186
31197
  ] }),
31187
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("ul", { className: "flex flex-col divide-y", children: held.map((alt, i) => /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("li", { className: "flex items-center gap-2 py-1", "data-alternate-index": i, children: [
31198
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("ul", { className: "flex flex-col divide-y", children: shownList.map((alt, i) => /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("li", { className: "flex items-center gap-2 py-1", "data-alternate-index": i, children: [
31188
31199
  /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("span", { className: "flex min-w-0 flex-1 flex-col", children: [
31189
31200
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "truncate font-medium", children: shown3(field2, alt.value) }),
31190
31201
  /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("span", { className: "truncate text-[11px] text-muted-foreground", children: [
31191
- sourceWords(document2, alt.src) ?? "Unknown source",
31202
+ sourceWords(document2, alt.src) ?? sourceObjectWords(alt.source) ?? "Unknown source",
31192
31203
  " \xB7 rank ",
31193
31204
  alt.rank
31194
31205
  ] })
@@ -31396,7 +31407,7 @@ function AddBody({ tableId }) {
31396
31407
  }
31397
31408
 
31398
31409
  // src/Peek.tsx
31399
- var import_text_case12 = require("@ai-matrx/kit/text-case");
31410
+ var import_text_case13 = require("@ai-matrx/kit/text-case");
31400
31411
  var import_jsx_runtime111 = require("react/jsx-runtime");
31401
31412
  function drawnBelowOnPage(field2, bodyKey) {
31402
31413
  return field2.key === bodyKey || editorKindFor(field2) === "relation";
@@ -31545,7 +31556,7 @@ function computedLinesWorthShowing(rows, document2) {
31545
31556
  );
31546
31557
  }
31547
31558
  function computedInPlainWords(row, field2) {
31548
- const name = field2 ? fieldName(field2) : (0, import_text_case12.humanizeIdentifier)(row.field_key);
31559
+ const name = field2 ? fieldName(field2) : (0, import_text_case13.humanizeIdentifier)(row.field_key);
31549
31560
  const shown5 = row.value === null || row.value === void 0 || row.value === "" ? "nothing" : field2 ? scalarText(field2, row.value) : String(row.value);
31550
31561
  const when = new Date(row.computed_at);
31551
31562
  const at = Number.isNaN(when.getTime()) ? "" : ` on ${when.toLocaleDateString()}`;
@@ -35576,18 +35587,18 @@ function useLinkGroupNamer(block, tableId) {
35576
35587
  // src/measureWords.ts
35577
35588
  var import_react214 = require("react");
35578
35589
  var import_react215 = require("@ai-matrx/records/react");
35579
- var import_text_case13 = require("@ai-matrx/kit/text-case");
35590
+ var import_text_case14 = require("@ai-matrx/kit/text-case");
35580
35591
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
35581
35592
  function measureWords(key, fields) {
35582
35593
  if (key === "count") return "How many";
35583
35594
  const at = key.indexOf("_");
35584
- if (at < 0) return (0, import_text_case13.humanizeIdentifier)(key);
35595
+ if (at < 0) return (0, import_text_case14.humanizeIdentifier)(key);
35585
35596
  const op2 = key.slice(0, at);
35586
35597
  const column = key.slice(at + 1);
35587
35598
  const field2 = fields?.find((f) => f.key === column);
35588
- const name = field2 ? fieldName(field2) : (0, import_text_case13.humanizeIdentifier)(column);
35599
+ const name = field2 ? fieldName(field2) : (0, import_text_case14.humanizeIdentifier)(column);
35589
35600
  const word = OP_WORD[op2];
35590
- return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${(0, import_text_case13.humanizeIdentifier)(op2)} ${name}`;
35601
+ return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${(0, import_text_case14.humanizeIdentifier)(op2)} ${name}`;
35591
35602
  }
35592
35603
  function useMeasureWords(key, tableId) {
35593
35604
  const client = (0, import_react215.useOptionalRecordsClient)();
@@ -38322,7 +38333,7 @@ var import_format10 = require("@ai-matrx/kit/format");
38322
38333
  var import_react232 = require("react");
38323
38334
  var import_react233 = require("@ai-matrx/records/react");
38324
38335
  var import_design_system112 = require("@ai-matrx/design-system");
38325
- var import_text_case14 = require("@ai-matrx/kit/text-case");
38336
+ var import_text_case15 = require("@ai-matrx/kit/text-case");
38326
38337
  var import_jsx_runtime131 = require("react/jsx-runtime");
38327
38338
  var DUE_WORD = DUE_STATE_LABEL;
38328
38339
  var REQUIRES_WORD = CHECKLIST_REQUIREMENT_LABEL;
@@ -38553,7 +38564,7 @@ function StepRow({
38553
38564
  /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "flex items-center gap-2", children: [
38554
38565
  /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "w-5 shrink-0 text-right text-[11px] tabular-nums text-muted-foreground", children: step2.step_order }),
38555
38566
  /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: (0, import_design_system112.cn)("min-w-0 flex-1 truncate text-xs", step2.finished && "line-through"), children: step2.title }),
38556
- step2.role ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_design_system112.Badge, { variant: "outline", className: "text-[10px]", children: step2.assignee_name ?? (0, import_text_case14.humanizeIdentifier)(step2.role) }) : null,
38567
+ step2.role ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_design_system112.Badge, { variant: "outline", className: "text-[10px]", children: step2.assignee_name ?? (0, import_text_case15.humanizeIdentifier)(step2.role) }) : null,
38557
38568
  step2.due_state && step2.due_state !== "undated" ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
38558
38569
  import_design_system112.Badge,
38559
38570
  {
@@ -39970,7 +39981,7 @@ var import_react236 = require("react");
39970
39981
  var import_records63 = require("@ai-matrx/records");
39971
39982
  var import_react237 = require("@ai-matrx/records/react");
39972
39983
  var import_design_system114 = require("@ai-matrx/design-system");
39973
- var import_text_case15 = require("@ai-matrx/kit/text-case");
39984
+ var import_text_case16 = require("@ai-matrx/kit/text-case");
39974
39985
  var import_jsx_runtime133 = require("react/jsx-runtime");
39975
39986
  function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
39976
39987
  const [y, m, d] = day2.split("-").map(Number);
@@ -40113,7 +40124,7 @@ function AsOfReading({
40113
40124
  ] });
40114
40125
  }
40115
40126
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dl", { className: (0, import_design_system114.cn)(box, "grid grid-cols-[minmax(5rem,9rem)_1fr] content-start gap-x-3 gap-y-0.5 p-2 text-[11px]"), "data-records-as-of-reading": "", children: rows.map(({ field: field2, was, now, differs }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "contents", "data-as-of-field": field2.key, "data-as-of-differs": differs ? "" : void 0, children: [
40116
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "truncate text-muted-foreground", title: fieldName(field2) || (0, import_text_case15.humanizeIdentifier)(field2.key), children: fieldName(field2) || (0, import_text_case15.humanizeIdentifier)(field2.key) }),
40127
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dt", { className: "truncate text-muted-foreground", title: fieldName(field2) || (0, import_text_case16.humanizeIdentifier)(field2.key), children: fieldName(field2) || (0, import_text_case16.humanizeIdentifier)(field2.key) }),
40117
40128
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("dd", { className: (0, import_design_system114.cn)("min-w-0 truncate", differs && "rounded bg-amber-500/10 px-1"), children: differs ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
40118
40129
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "font-medium", children: isEmpty2(was) ? "nothing" : scalarText(field2, was) }),
40119
40130
  /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
@@ -40124,7 +40135,7 @@ function AsOfReading({
40124
40135
  }
40125
40136
 
40126
40137
  // src/HistoryPanel.tsx
40127
- var import_text_case16 = require("@ai-matrx/kit/text-case");
40138
+ var import_text_case17 = require("@ai-matrx/kit/text-case");
40128
40139
  var import_jsx_runtime134 = require("react/jsx-runtime");
40129
40140
  function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
40130
40141
  const client = (0, import_react239.useRecordsClient)();
@@ -40363,7 +40374,7 @@ function ChangeLine({
40363
40374
  onAskAboutField
40364
40375
  }) {
40365
40376
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("li", { "data-change-key": change.key, className: "flex items-baseline gap-2 text-[11px]", children: [
40366
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "w-24 shrink-0 truncate font-medium", title: change.label, children: change.label || (0, import_text_case16.humanizeIdentifier)(change.key) }),
40377
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "w-24 shrink-0 truncate font-medium", title: change.label, children: change.label || (0, import_text_case17.humanizeIdentifier)(change.key) }),
40367
40378
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
40368
40379
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "text-muted-foreground line-through", children: say(change.before, field2) }),
40369
40380
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "mx-1 text-muted-foreground", children: "\u2192" }),
@@ -40377,7 +40388,7 @@ function ChangeLine({
40377
40388
  "span",
40378
40389
  {
40379
40390
  className: "shrink-0 text-muted-foreground",
40380
- title: Object.entries(change.source).map(([k, v]) => `${(0, import_text_case16.humanizeIdentifier)(k)}: ${String(v)}`).join(" \xB7 "),
40391
+ title: Object.entries(change.source).map(([k, v]) => `${(0, import_text_case17.humanizeIdentifier)(k)}: ${String(v)}`).join(" \xB7 "),
40381
40392
  children: "evidence"
40382
40393
  }
40383
40394
  ) : null,
@@ -40438,7 +40449,7 @@ function say(value, field2) {
40438
40449
  var import_react240 = require("react");
40439
40450
  var import_react241 = require("@ai-matrx/records/react");
40440
40451
  var import_design_system116 = require("@ai-matrx/design-system");
40441
- var import_text_case17 = require("@ai-matrx/kit/text-case");
40452
+ var import_text_case18 = require("@ai-matrx/kit/text-case");
40442
40453
  var import_jsx_runtime135 = require("react/jsx-runtime");
40443
40454
  function CommentThread({ tableId, recordId, fieldKey, className }) {
40444
40455
  const client = (0, import_react241.useRecordsClient)();
@@ -40499,7 +40510,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
40499
40510
  const shown5 = fieldKey ? thread.comments.filter((c) => c.field_key === fieldKey) : thread.comments;
40500
40511
  const roots = shown5.filter((c) => !c.parent_comment_id);
40501
40512
  const repliesOf = (id) => shown5.filter((c) => c.parent_comment_id === id);
40502
- const fieldLabel = fieldKey ? (fields.data ?? []).find((f) => f.key === fieldKey)?.label || (0, import_text_case17.humanizeIdentifier)(fieldKey) : null;
40513
+ const fieldLabel = fieldKey ? (fields.data ?? []).find((f) => f.key === fieldKey)?.label || (0, import_text_case18.humanizeIdentifier)(fieldKey) : null;
40503
40514
  async function post() {
40504
40515
  if (draft.trim() === "") return;
40505
40516
  setBusy(true);
@@ -40651,7 +40662,7 @@ function Line2({
40651
40662
  onReply,
40652
40663
  onResolve
40653
40664
  }) {
40654
- const about = comment.field_key ? fields.find((f) => f.key === comment.field_key)?.label || (0, import_text_case17.humanizeIdentifier)(comment.field_key) : null;
40665
+ const about = comment.field_key ? fields.find((f) => f.key === comment.field_key)?.label || (0, import_text_case18.humanizeIdentifier)(comment.field_key) : null;
40655
40666
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
40656
40667
  /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex items-baseline gap-2 text-[11px] text-muted-foreground", children: [
40657
40668
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "truncate font-medium text-foreground", children: comment.created_by_name }),
@@ -40678,7 +40689,7 @@ function Line2({
40678
40689
  var import_react242 = require("react");
40679
40690
  var import_react243 = require("@ai-matrx/records/react");
40680
40691
  var import_design_system117 = require("@ai-matrx/design-system");
40681
- var import_text_case18 = require("@ai-matrx/kit/text-case");
40692
+ var import_text_case19 = require("@ai-matrx/kit/text-case");
40682
40693
  var import_jsx_runtime136 = require("react/jsx-runtime");
40683
40694
  function FieldHistoryPanel({
40684
40695
  tableId,
@@ -40711,7 +40722,7 @@ function FieldHistoryPanel({
40711
40722
  (0, import_react242.useEffect)(() => {
40712
40723
  void load();
40713
40724
  }, [load]);
40714
- const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || (0, import_text_case18.humanizeIdentifier)(fieldKey);
40725
+ const label = (fields.data ?? []).find((f) => f.key === fieldKey)?.label || (0, import_text_case19.humanizeIdentifier)(fieldKey);
40715
40726
  if (error) return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(RefusalNotice, { error, className });
40716
40727
  if (!rows || fields.loading && !fields.data || table.loading && !table.data) return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_design_system117.Skeleton, { className: (0, import_design_system117.cn)("h-40 w-full", className) });
40717
40728
  async function start(row) {
@@ -43501,7 +43512,7 @@ var import_react259 = require("react");
43501
43512
  var import_react260 = require("@ai-matrx/records/react");
43502
43513
  var import_design_system128 = require("@ai-matrx/design-system");
43503
43514
  var import_forms2 = require("@ai-matrx/records/forms");
43504
- var import_text_case19 = require("@ai-matrx/kit/text-case");
43515
+ var import_text_case20 = require("@ai-matrx/kit/text-case");
43505
43516
  var import_jsx_runtime147 = require("react/jsx-runtime");
43506
43517
  function authored(host, text, where) {
43507
43518
  return host.renderText ? host.renderText(text, where) : text;
@@ -43629,7 +43640,7 @@ function FormStage({
43629
43640
  // THE FORM'S OWN WORDS FIRST (MAKE-HOME W5). Unwritten, the Field's display name
43630
43641
  // (`fieldName`: a machine-key label is written the way a person writes it), and with no
43631
43642
  // Field at all the key humanized — a stranger never reads `full_name`.
43632
- ask: q.ask?.trim() || (field2 ? fieldName(field2) : (0, import_text_case19.humanizeIdentifier)(q.field)),
43643
+ ask: q.ask?.trim() || (field2 ? fieldName(field2) : (0, import_text_case20.humanizeIdentifier)(q.field)),
43633
43644
  help: q.help ?? null,
43634
43645
  required: q.required ?? field2?.required ?? false,
43635
43646
  field: field2,
@@ -49763,7 +49774,7 @@ var import_react305 = require("react");
49763
49774
  var import_records73 = require("@ai-matrx/records");
49764
49775
  var import_react306 = require("@ai-matrx/records/react");
49765
49776
  var import_design_system154 = require("@ai-matrx/design-system");
49766
- var import_text_case20 = require("@ai-matrx/kit/text-case");
49777
+ var import_text_case21 = require("@ai-matrx/kit/text-case");
49767
49778
 
49768
49779
  // src/calendarFeed.ts
49769
49780
  function webcalUrl(httpsUrl) {
@@ -50695,7 +50706,7 @@ function RailFrame({
50695
50706
  function filterInWords(filter, fields) {
50696
50707
  const nameOf2 = (key) => {
50697
50708
  const field2 = fields.find((f) => f.key === key);
50698
- return field2 ? fieldName(field2) : (0, import_text_case20.humanizeIdentifier)(key);
50709
+ return field2 ? fieldName(field2) : (0, import_text_case21.humanizeIdentifier)(key);
50699
50710
  };
50700
50711
  const parts = Object.keys(filter).map((key) => {
50701
50712
  const value = filter[key];