@ai-matrx/records-ui 0.93.83 → 0.93.85

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/index.d.cts CHANGED
@@ -2320,7 +2320,7 @@ interface CustomFieldsAgentDoor {
2320
2320
  setValues: (values: CustomFieldValuesRequest) => Promise<CustomFieldSetResult>;
2321
2321
  }
2322
2322
  declare const ADDABLE_TYPES: {
2323
- value: "number" | "member" | "text" | "long_text" | "currency" | "percent" | "datetime" | "email" | "url" | "phone" | "attachment";
2323
+ value: "number" | "attachment" | "currency" | "datetime" | "email" | "text" | "member" | "percent" | "phone" | "url" | "long_text";
2324
2324
  label: string;
2325
2325
  }[];
2326
2326
  /**
package/dist/index.d.ts CHANGED
@@ -2320,7 +2320,7 @@ interface CustomFieldsAgentDoor {
2320
2320
  setValues: (values: CustomFieldValuesRequest) => Promise<CustomFieldSetResult>;
2321
2321
  }
2322
2322
  declare const ADDABLE_TYPES: {
2323
- value: "number" | "member" | "text" | "long_text" | "currency" | "percent" | "datetime" | "email" | "url" | "phone" | "attachment";
2323
+ value: "number" | "attachment" | "currency" | "datetime" | "email" | "text" | "member" | "percent" | "phone" | "url" | "long_text";
2324
2324
  label: string;
2325
2325
  }[];
2326
2326
  /**
package/dist/index.js CHANGED
@@ -1214,111 +1214,114 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
1214
1214
  if (q === "") return true;
1215
1215
  return `${titleOf(row.id)} ${apart.get(row.id) ?? ""}`.toLowerCase().includes(q);
1216
1216
  });
1217
- return /* @__PURE__ */ jsxs4("div", { className: cn4("flex flex-wrap items-center gap-1", className), children: [
1218
- picked.map((recordId) => /* @__PURE__ */ jsx5(
1219
- RecordChip,
1220
- {
1221
- title: titleOf(recordId),
1222
- ...disabled ? {} : { onRemove: () => toggle(recordId) }
1223
- },
1224
- recordId
1225
- )),
1226
- disabled ? null : (
1227
- // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
1228
- /* @__PURE__ */ jsx5(
1229
- PickOrAdd,
1217
+ return (
1218
+ // Never wider than where it is drawn (a grid cell beside a sticky column: B3-07) — chips truncate, the button wraps.
1219
+ /* @__PURE__ */ jsxs4("div", { className: cn4("flex min-w-0 max-w-full flex-wrap items-center gap-1", className), children: [
1220
+ picked.map((recordId) => /* @__PURE__ */ jsx5(
1221
+ RecordChip,
1230
1222
  {
1231
- triggerId: id,
1232
- triggerLabel: `Pick for ${fieldName(field2)}`,
1233
- triggerText: picked.length === 0 ? "Pick" : "Change",
1234
- open,
1235
- onOpenChange: setOpen,
1236
- search,
1237
- onSearch: setSearch,
1238
- items: visible.map((row) => ({
1239
- id: row.id,
1240
- label: titleOf(row.id),
1241
- detail: apart.get(row.id) ?? null,
1242
- picked: picked.includes(row.id),
1243
- title: apart.has(row.id) ? `${titleOf(row.id)} \u2014 ${apart.get(row.id)}` : titleOf(row.id),
1244
- attrs: { "data-relation-candidate": row.id }
1245
- })),
1246
- onPick: toggle,
1247
- notice: /* @__PURE__ */ jsxs4(Fragment2, { children: [
1248
- refusal2 ? /* @__PURE__ */ jsx5(RefusalLine, { error: refusal2, className: "p-2" }) : null,
1249
- !rows && !refusal2 ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
1250
- full ? /* @__PURE__ */ jsxs4("p", { className: "p-2 text-xs text-muted-foreground", children: [
1251
- fieldName(field2),
1252
- " can point at ",
1253
- field2.relation_max,
1254
- " at most. Remove one to add another."
1255
- ] }) : null
1256
- ] }),
1257
- empty: rows ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
1258
- add: allowCreate && !full && !targetRefusal && target && !creating ? {
1259
- label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
1260
- disabled: busy,
1261
- // TYPED SOMETHING THAT IS NOT THERE? That IS the name. The champions
1262
- // (Airtable, Notion) make the search text the new record's title in one
1263
- // press; an empty box asks for one.
1264
- onAdd: () => {
1265
- if (search.trim() !== "") void create(search);
1266
- else {
1267
- setNewTitle("");
1268
- setCreating(true);
1223
+ title: titleOf(recordId),
1224
+ ...disabled ? {} : { onRemove: () => toggle(recordId) }
1225
+ },
1226
+ recordId
1227
+ )),
1228
+ disabled ? null : (
1229
+ // THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the choice editor draws the same one.
1230
+ /* @__PURE__ */ jsx5(
1231
+ PickOrAdd,
1232
+ {
1233
+ triggerId: id,
1234
+ triggerLabel: `Pick for ${fieldName(field2)}`,
1235
+ triggerText: picked.length === 0 ? "Pick" : "Change",
1236
+ open,
1237
+ onOpenChange: setOpen,
1238
+ search,
1239
+ onSearch: setSearch,
1240
+ items: visible.map((row) => ({
1241
+ id: row.id,
1242
+ label: titleOf(row.id),
1243
+ detail: apart.get(row.id) ?? null,
1244
+ picked: picked.includes(row.id),
1245
+ title: apart.has(row.id) ? `${titleOf(row.id)} \u2014 ${apart.get(row.id)}` : titleOf(row.id),
1246
+ attrs: { "data-relation-candidate": row.id }
1247
+ })),
1248
+ onPick: toggle,
1249
+ notice: /* @__PURE__ */ jsxs4(Fragment2, { children: [
1250
+ refusal2 ? /* @__PURE__ */ jsx5(RefusalLine, { error: refusal2, className: "p-2" }) : null,
1251
+ !rows && !refusal2 ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading\u2026" }) : null,
1252
+ full ? /* @__PURE__ */ jsxs4("p", { className: "p-2 text-xs text-muted-foreground", children: [
1253
+ fieldName(field2),
1254
+ " can point at ",
1255
+ field2.relation_max,
1256
+ " at most. Remove one to add another."
1257
+ ] }) : null
1258
+ ] }),
1259
+ empty: rows ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Nothing in that table matches." }) : null,
1260
+ add: allowCreate && !full && !targetRefusal && target && !creating ? {
1261
+ label: search.trim() !== "" ? `Create \u201C${search.trim()}\u201D` : `New ${targetWord}`,
1262
+ disabled: busy,
1263
+ // TYPED SOMETHING THAT IS NOT THERE? That IS the name. The champions
1264
+ // (Airtable, Notion) make the search text the new record's title in one
1265
+ // press; an empty box asks for one.
1266
+ onAdd: () => {
1267
+ if (search.trim() !== "") void create(search);
1268
+ else {
1269
+ setNewTitle("");
1270
+ setCreating(true);
1271
+ }
1269
1272
  }
1270
- }
1271
- } : null,
1272
- foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ jsx5(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 p-1", children: [
1273
- /* @__PURE__ */ jsx5(
1274
- BasicInput3,
1275
- {
1276
- autoFocus: true,
1277
- value: newTitle,
1278
- onChange: (e) => setNewTitle(e.target.value),
1279
- onKeyDown: (e) => {
1280
- if (e.key === "Enter") {
1281
- e.preventDefault();
1282
- void create(newTitle);
1273
+ } : null,
1274
+ foot: !allowCreate || full ? void 0 : targetRefusal ? /* @__PURE__ */ jsx5(RefusalLine, { error: targetRefusal, className: "p-2" }) : !target ? /* @__PURE__ */ jsx5("p", { className: "p-2 text-xs text-muted-foreground", children: "Reading that table\u2026" }) : creating ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 p-1", children: [
1275
+ /* @__PURE__ */ jsx5(
1276
+ BasicInput3,
1277
+ {
1278
+ autoFocus: true,
1279
+ value: newTitle,
1280
+ onChange: (e) => setNewTitle(e.target.value),
1281
+ onKeyDown: (e) => {
1282
+ if (e.key === "Enter") {
1283
+ e.preventDefault();
1284
+ void create(newTitle);
1285
+ }
1286
+ },
1287
+ placeholder: `New ${targetWord}`,
1288
+ className: "h-7 flex-1 text-xs",
1289
+ "aria-label": `Name the new ${targetWord}`
1290
+ }
1291
+ ),
1292
+ /* @__PURE__ */ jsx5(
1293
+ Button3,
1294
+ {
1295
+ type: "button",
1296
+ size: "sm",
1297
+ variant: "default",
1298
+ disabled: busy || newTitle.trim() === "",
1299
+ onClick: () => void create(newTitle),
1300
+ children: busy ? "Creating\u2026" : "Create"
1301
+ }
1302
+ )
1303
+ ] }) : void 0,
1304
+ footNote: allowCreate && !full && createRefusal ? (
1305
+ // The typed title is still in the search box: the notice owns the
1306
+ // two doors out (lane REFUSAL-SWEEP).
1307
+ /* @__PURE__ */ jsx5(
1308
+ RefusalNotice,
1309
+ {
1310
+ error: createRefusal,
1311
+ className: "mt-1 max-w-72",
1312
+ onKeepEditing: () => setCreateRefusal(null),
1313
+ onDiscard: () => {
1314
+ setCreateRefusal(null);
1315
+ setSearch("");
1283
1316
  }
1284
- },
1285
- placeholder: `New ${targetWord}`,
1286
- className: "h-7 flex-1 text-xs",
1287
- "aria-label": `Name the new ${targetWord}`
1288
- }
1289
- ),
1290
- /* @__PURE__ */ jsx5(
1291
- Button3,
1292
- {
1293
- type: "button",
1294
- size: "sm",
1295
- variant: "default",
1296
- disabled: busy || newTitle.trim() === "",
1297
- onClick: () => void create(newTitle),
1298
- children: busy ? "Creating\u2026" : "Create"
1299
- }
1300
- )
1301
- ] }) : void 0,
1302
- footNote: allowCreate && !full && createRefusal ? (
1303
- // The typed title is still in the search box: the notice owns the
1304
- // two doors out (lane REFUSAL-SWEEP).
1305
- /* @__PURE__ */ jsx5(
1306
- RefusalNotice,
1307
- {
1308
- error: createRefusal,
1309
- className: "mt-1 max-w-72",
1310
- onKeepEditing: () => setCreateRefusal(null),
1311
- onDiscard: () => {
1312
- setCreateRefusal(null);
1313
- setSearch("");
1314
1317
  }
1315
- }
1316
- )
1317
- ) : null
1318
- }
1318
+ )
1319
+ ) : null
1320
+ }
1321
+ )
1319
1322
  )
1320
- )
1321
- ] });
1323
+ ] })
1324
+ );
1322
1325
  }
1323
1326
 
1324
1327
  // src/gridAttachments.tsx
@@ -5213,9 +5216,10 @@ function OpenCell({
5213
5216
  {
5214
5217
  ref: host,
5215
5218
  "data-matrx-cell-control": "",
5219
+ "data-matrx-cell-fill": "",
5216
5220
  "data-matrx-cell-editor": "",
5217
5221
  tabIndex: -1,
5218
- className: "relative z-[25] flex w-full min-w-[10rem] flex-col gap-1 outline-none",
5222
+ className: "relative z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
5219
5223
  onDoubleClick: (event) => event.stopPropagation(),
5220
5224
  onKeyDown: (event) => {
5221
5225
  if (event.target?.closest?.("[data-refusal-notice], [data-records-choice-ask]")) return;
@@ -31513,13 +31517,14 @@ function ViewFilter({ tableId, view, onApply, className }) {
31513
31517
 
31514
31518
  // src/toolbarFit.ts
31515
31519
  import { useEffect as useEffect81, useState as useState93 } from "react";
31516
- var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
31520
+ var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120, share: 0 };
31517
31521
  function toolbarFold(input) {
31518
31522
  const { available, needsNow, gap, folded } = input;
31519
31523
  const pieces = [
31520
31524
  { piece: input.look, stage: 1, guess: FOLDED_GUESS.look },
31521
31525
  { piece: input.chooser, stage: 2, guess: FOLDED_GUESS.chooser },
31522
- ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : []
31526
+ ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : [],
31527
+ ...input.tools && input.share ? [{ piece: input.share, stage: 4, guess: FOLDED_GUESS.share }] : []
31523
31528
  ];
31524
31529
  const widthAt = ({ piece, stage, guess }, fold) => {
31525
31530
  if (piece.now === 0 && piece.full === null) return 0;
@@ -31528,7 +31533,7 @@ function toolbarFold(input) {
31528
31533
  };
31529
31534
  const withGap = (width) => width > 0 ? width + gap : 0;
31530
31535
  const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow);
31531
- const stages = input.tools ? [0, 1, 2, 3] : [0, 1, 2];
31536
+ const stages = input.tools ? input.share ? [0, 1, 2, 3, 4] : [0, 1, 2, 3] : [0, 1, 2];
31532
31537
  const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base));
31533
31538
  const fits = needs.findIndex((need) => need <= available + 0.5);
31534
31539
  if (fits >= 0) return stages[fits];
@@ -31569,9 +31574,10 @@ function useToolbarFit(row) {
31569
31574
  const widths = {
31570
31575
  look: { full: null, folded: null },
31571
31576
  chooser: { full: null, folded: null },
31572
- tools: { full: null, folded: null }
31577
+ tools: { full: null, folded: null },
31578
+ share: { full: null, folded: null }
31573
31579
  };
31574
- const stageOf = { look: 1, chooser: 2, tools: 3 };
31580
+ const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
31575
31581
  let current = 0;
31576
31582
  let pending = 0;
31577
31583
  let stopped = false;
@@ -31581,7 +31587,7 @@ function useToolbarFit(row) {
31581
31587
  const available = row.clientWidth;
31582
31588
  if (available <= 0) return;
31583
31589
  const read = (name) => {
31584
- const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
31590
+ const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : name === "share" ? row.querySelector('[data-toolbar-fit="share"]') : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
31585
31591
  const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
31586
31592
  const w = widths[name];
31587
31593
  if (el && now > 0) {
@@ -31594,8 +31600,11 @@ function useToolbarFit(row) {
31594
31600
  const look = read("look");
31595
31601
  const chooser = read("chooser");
31596
31602
  const tools = read("tools");
31603
+ const shareEl = row.querySelector('[data-toolbar-fit="share"]');
31604
+ const shareRead = shareEl ? read("share") : null;
31605
+ const share = shareRead && (shareRead.now > 0 || shareRead.full !== null) ? shareRead : void 0;
31597
31606
  const { needs, gap } = rowNeeds(row);
31598
- const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools });
31607
+ const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools, share });
31599
31608
  if (next !== current) {
31600
31609
  current = next;
31601
31610
  setFold(next);
@@ -32012,6 +32021,7 @@ function TablePage({
32012
32021
  const chooserInline = !designated && !phone && toolbarFold2 < 2;
32013
32022
  const chooserCompact = !designated && !phone && toolbarFold2 >= 2;
32014
32023
  const controlsInSheet = phone && !designated;
32024
+ const shareInMenu = phone || toolbarFold2 >= 4;
32015
32025
  useEffect82(() => {
32016
32026
  if (face.kind !== "designated") return;
32017
32027
  if (hostFromLink || opened.layout || layoutChosen) return;
@@ -32236,7 +32246,7 @@ function TablePage({
32236
32246
  rights.share && canShare ? /* @__PURE__ */ jsx105(Button80, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
32237
32247
  ] }) : void 0;
32238
32248
  const pageActions = /* @__PURE__ */ jsxs95(Fragment44, { children: [
32239
- organizationId ? /* @__PURE__ */ jsx105(
32249
+ organizationId ? /* @__PURE__ */ jsx105("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx105(
32240
32250
  ShareControl,
32241
32251
  {
32242
32252
  kind: "table",
@@ -32246,10 +32256,10 @@ function TablePage({
32246
32256
  may: rights.share,
32247
32257
  whyNot: rights.read ? rights.why("share") : void 0,
32248
32258
  initiallyOpen: shareFromLink || shareAsked > 0,
32249
- ...phone ? { className: "hidden" } : {}
32259
+ ...shareInMenu ? { className: "hidden" } : {}
32250
32260
  },
32251
- phone ? `share-${shareAsked}` : "share"
32252
- ) : null,
32261
+ shareInMenu ? `share-${shareAsked}` : "share"
32262
+ ) }, "share") : null,
32253
32263
  /* @__PURE__ */ jsxs95(DropdownMenu5, { children: [
32254
32264
  /* @__PURE__ */ jsx105(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx105(Button80, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs95("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
32255
32265
  /* @__PURE__ */ jsx105("circle", { cx: "5", cy: "12", r: "1.75" }),
@@ -32272,7 +32282,7 @@ function TablePage({
32272
32282
  },
32273
32283
  entry.key
32274
32284
  )),
32275
- phone && rights.share && canShare ? /* @__PURE__ */ jsxs95(Fragment44, { children: [
32285
+ shareInMenu && rights.share && canShare ? /* @__PURE__ */ jsxs95(Fragment44, { children: [
32276
32286
  /* @__PURE__ */ jsx105(DropdownMenuSeparator4, {}),
32277
32287
  /* @__PURE__ */ jsx105(DropdownMenuItem5, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
32278
32288
  ] }) : null,