@ai-matrx/records-ui 0.116.6 → 0.116.8

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.cjs CHANGED
@@ -7907,6 +7907,7 @@ __export(src_exports, {
7907
7907
  TablePage: () => TablePage2,
7908
7908
  TablePageSkeleton: () => TablePageSkeleton,
7909
7909
  TablePicker: () => TablePicker,
7910
+ TablePresence: () => TablePresence,
7910
7911
  TableReferenceDialog: () => TableReferenceDialog,
7911
7912
  TableRenameDialog: () => TableRenameDialog,
7912
7913
  TableRestoreRefused: () => TableRestoreRefused,
@@ -8148,6 +8149,7 @@ __export(src_exports, {
8148
8149
  placedSentence: () => placedSentence,
8149
8150
  platformOwned: () => platformOwned,
8150
8151
  pointsAtRecords: () => pointsAtRecords,
8152
+ presenceOutlineCss: () => presenceOutlineCss,
8151
8153
  presentationDocument: () => presentationDocument,
8152
8154
  presentationIsEmpty: () => presentationIsEmpty,
8153
8155
  previewLine: () => previewLine,
@@ -8264,6 +8266,7 @@ __export(src_exports, {
8264
8266
  useRowColorBy: () => useRowColorBy,
8265
8267
  useRowRights: () => useRowRights,
8266
8268
  useStructureHidden: () => useStructureHidden,
8269
+ useTablePresence: () => useTablePresence,
8267
8270
  useTableRights: () => useTableRights,
8268
8271
  useTableToolbarSlot: () => useTableToolbarSlot,
8269
8272
  useTablesAnywhere: () => useTablesAnywhere,
@@ -21467,13 +21470,17 @@ function OpenCell({
21467
21470
  {
21468
21471
  ref: host,
21469
21472
  "data-matrx-cell-control": "",
21470
- ...widens ? { "data-matrx-cell-widens": "" } : { "data-matrx-cell-fill": "" },
21473
+ ...widens ? { "data-matrx-cell-widens": "" } : multiline ? { "data-matrx-cell-widens": "", "data-matrx-cell-fill": "", "data-records-cell-multiline": "" } : { "data-matrx-cell-fill": "" },
21471
21474
  style: wideTo ? { width: wideTo, minWidth: wideTo, maxWidth: "28rem", right: "auto" } : void 0,
21472
21475
  "data-matrx-cell-editor": "",
21473
21476
  tabIndex: -1,
21474
21477
  className: (0, import_design_system56.cn)(
21475
21478
  // OVER the cell's ghost (see `data-records-open-cell`), never in the table's measuring.
21476
- "absolute inset-x-0 top-1/2 z-[25] flex w-full min-w-0 max-w-full -translate-y-1/2 flex-col gap-1 outline-none",
21479
+ "absolute inset-x-0 z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
21480
+ // A one-line control sits centred on the row; a multi-line box hangs from the cell's top and
21481
+ // grows downward over the rows below (Airtable's expanded long-text cell), never up over the
21482
+ // header (D10: centred, its first lines sat 58px above the cell, outside it).
21483
+ multiline ? "top-0 rounded-md bg-card shadow-md" : "top-1/2 -translate-y-1/2",
21477
21484
  // A box reaching over the next column is opaque, so what it covers never shows through it
21478
21485
  // (the calendar button sat over the Actions cell's copy icon, both drawn).
21479
21486
  widens && "rounded-md bg-card shadow-sm",
@@ -36603,9 +36610,17 @@ function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = fal
36603
36610
  const [asking, setAsking] = (0, import_react199.useState)(null);
36604
36611
  const record = (0, import_react200.useRecord)(recordId, true, { tableId });
36605
36612
  const answered = Boolean(record.data) && !record.error;
36613
+ const panelRef = (0, import_react199.useRef)(null);
36614
+ (0, import_react199.useEffect)(() => {
36615
+ if (onPage) return;
36616
+ const panel = panelRef.current;
36617
+ if (!panel || panel.contains(document.activeElement)) return;
36618
+ panel.focus({ preventScroll: true });
36619
+ }, [recordId, onPage]);
36606
36620
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
36607
36621
  "div",
36608
36622
  {
36623
+ ref: panelRef,
36609
36624
  className: "space-y-3 outline-none",
36610
36625
  tabIndex: -1,
36611
36626
  "data-record-panel": recordId,
@@ -57487,9 +57502,9 @@ init_WhereItLives();
57487
57502
 
57488
57503
  // src/TablePage.tsx
57489
57504
  var import_clipboard17 = require("@ai-matrx/kit/clipboard");
57490
- var import_react334 = require("react");
57505
+ var import_react335 = require("react");
57491
57506
  var import_records69 = require("@ai-matrx/records");
57492
- var import_react335 = require("@ai-matrx/records/react");
57507
+ var import_react336 = require("@ai-matrx/records/react");
57493
57508
  var import_design_system169 = require("@ai-matrx/design-system");
57494
57509
  init_names();
57495
57510
  var import_text_case23 = require("@ai-matrx/kit/text-case");
@@ -58300,8 +58315,87 @@ init_WhereItLives();
58300
58315
  init_objectActions();
58301
58316
  init_host();
58302
58317
 
58303
- // src/toolbarFit.ts
58318
+ // src/presence.tsx
58304
58319
  var import_react333 = require("react");
58320
+ init_host();
58321
+ var import_jsx_runtime190 = require("react/jsx-runtime");
58322
+ var NO_PEOPLE = [];
58323
+ var MAX_AVATARS = 4;
58324
+ var SAFE = /^[A-Za-z0-9_.:\-]+$/;
58325
+ function useTablePresence(tableId) {
58326
+ const port = useRecordsUi().presence;
58327
+ const [session, setSession] = (0, import_react333.useState)(null);
58328
+ (0, import_react333.useEffect)(() => {
58329
+ if (!port) {
58330
+ setSession(null);
58331
+ return;
58332
+ }
58333
+ const joined = port.join({ tableId });
58334
+ setSession(joined);
58335
+ return () => {
58336
+ joined.close();
58337
+ setSession(null);
58338
+ };
58339
+ }, [port, tableId]);
58340
+ const people = (0, import_react333.useSyncExternalStore)(
58341
+ (listener) => session ? session.subscribe(listener) : () => void 0,
58342
+ () => session ? session.getSnapshot() : NO_PEOPLE,
58343
+ () => NO_PEOPLE
58344
+ );
58345
+ return { session, people };
58346
+ }
58347
+ function presenceOutlineCss(people) {
58348
+ return people.filter((p) => p.cell && SAFE.test(p.cell.recordId) && SAFE.test(p.cell.fieldKey) && /^hsl\([0-9 %.]+\)$|^#[0-9a-fA-F]{3,8}$/.test(p.color)).map(
58349
+ (p) => `td[data-matrx-cell-row="${p.cell.recordId}"][data-matrx-cell-col="${p.cell.fieldKey}"]{outline:2px solid ${p.color};outline-offset:-2px;}`
58350
+ ).join("\n");
58351
+ }
58352
+ function initials(name) {
58353
+ const parts = name.trim().split(/\s+/).filter(Boolean);
58354
+ return ((parts[0]?.[0] ?? "?") + (parts.length > 1 ? parts[parts.length - 1][0] : "")).toUpperCase();
58355
+ }
58356
+ function TablePresence({ tableId }) {
58357
+ const { session, people } = useTablePresence(tableId);
58358
+ const root = (0, import_react333.useRef)(null);
58359
+ const css = (0, import_react333.useMemo)(() => presenceOutlineCss(people), [people]);
58360
+ (0, import_react333.useEffect)(() => {
58361
+ if (!session || typeof MutationObserver === "undefined") return;
58362
+ const scope = document.body;
58363
+ const read = () => {
58364
+ const td = scope.querySelector("td[data-matrx-cell-active]");
58365
+ const recordId = td?.getAttribute("data-matrx-cell-row");
58366
+ const fieldKey = td?.getAttribute("data-matrx-cell-col");
58367
+ session.selectCell(recordId && fieldKey ? { recordId, fieldKey } : null);
58368
+ };
58369
+ const watch = new MutationObserver(read);
58370
+ watch.observe(scope, { subtree: true, attributes: true, attributeFilter: ["data-matrx-cell-active"] });
58371
+ read();
58372
+ return () => watch.disconnect();
58373
+ }, [session]);
58374
+ if (!session) return null;
58375
+ const shown5 = people.slice(0, MAX_AVATARS);
58376
+ const more = people.length - shown5.length;
58377
+ return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { ref: root, className: "flex shrink-0 items-center -space-x-1.5", "data-table-presence": "", "data-count": people.length, "aria-label": people.length ? `${people.length} other ${people.length === 1 ? "person is" : "people are"} looking at this table` : void 0, children: [
58378
+ css ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("style", { "data-table-presence-outlines": "", children: css }) : null,
58379
+ shown5.map((p) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58380
+ "span",
58381
+ {
58382
+ title: p.name,
58383
+ "data-table-presence-person": p.name,
58384
+ className: "inline-flex h-6 w-6 items-center justify-center overflow-hidden rounded-full border-2 bg-muted text-[10px] font-medium text-foreground",
58385
+ style: { borderColor: p.color },
58386
+ children: p.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("img", { src: p.avatarUrl, alt: "", className: "h-full w-full object-cover" }) : initials(p.name)
58387
+ },
58388
+ p.key
58389
+ )),
58390
+ more > 0 ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "inline-flex h-6 min-w-6 items-center justify-center rounded-full border border-border bg-muted px-1 text-[10px]", "data-table-presence-more": "", children: [
58391
+ "+",
58392
+ more
58393
+ ] }) : null
58394
+ ] });
58395
+ }
58396
+
58397
+ // src/toolbarFit.ts
58398
+ var import_react334 = require("react");
58305
58399
  var import_react_dom3 = require("react-dom");
58306
58400
  function widthAtFold(piece, fold) {
58307
58401
  for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
@@ -58393,9 +58487,9 @@ function createFitMemory() {
58393
58487
  }
58394
58488
  };
58395
58489
  }
58396
- var useIsoLayoutEffect = typeof window === "undefined" ? import_react333.useEffect : import_react333.useLayoutEffect;
58490
+ var useIsoLayoutEffect = typeof window === "undefined" ? import_react334.useEffect : import_react334.useLayoutEffect;
58397
58491
  function useToolbarFit(row) {
58398
- const [fold, setFold] = (0, import_react333.useState)(0);
58492
+ const [fold, setFold] = (0, import_react334.useState)(0);
58399
58493
  useIsoLayoutEffect(() => {
58400
58494
  if (!row) return;
58401
58495
  const memory = createFitMemory();
@@ -58471,8 +58565,8 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
58471
58565
  return start && end ? "both" : start ? "start" : end ? "end" : "none";
58472
58566
  }
58473
58567
  function useSlotScroll(slot) {
58474
- const [ends, setEnds] = (0, import_react333.useState)("none");
58475
- (0, import_react333.useEffect)(() => {
58568
+ const [ends, setEnds] = (0, import_react334.useState)("none");
58569
+ (0, import_react334.useEffect)(() => {
58476
58570
  if (!slot) return;
58477
58571
  let pending = 0;
58478
58572
  const read = () => {
@@ -58514,7 +58608,7 @@ function useSlotScroll(slot) {
58514
58608
  // src/TablePage.tsx
58515
58609
  var import_uuid10 = require("@ai-matrx/kit/uuid");
58516
58610
  var import_outbound4 = require("@ai-matrx/kit/outbound");
58517
- var import_jsx_runtime190 = require("react/jsx-runtime");
58611
+ var import_jsx_runtime191 = require("react/jsx-runtime");
58518
58612
  var RAIL_TITLE = {
58519
58613
  settings: "Table settings",
58520
58614
  inbox: "Inbox",
@@ -58531,10 +58625,10 @@ var RAIL_TITLE = {
58531
58625
  export: "Export"
58532
58626
  };
58533
58627
  function LookGlyph() {
58534
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
58535
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
58536
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "16", cy: "7", r: "2" }),
58537
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "8", cy: "17", r: "2" })
58628
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
58629
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M4 7h10M18 7h2M4 17h2M10 17h10" }),
58630
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "16", cy: "7", r: "2" }),
58631
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "8", cy: "17", r: "2" })
58538
58632
  ] });
58539
58633
  }
58540
58634
  function RailFrame({
@@ -58546,7 +58640,7 @@ function RailFrame({
58546
58640
  children
58547
58641
  }) {
58548
58642
  if (phone) {
58549
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58643
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58550
58644
  import_design_system169.BottomSheet,
58551
58645
  {
58552
58646
  open: true,
@@ -58556,18 +58650,18 @@ function RailFrame({
58556
58650
  title,
58557
58651
  size: "full",
58558
58652
  surface: "solid",
58559
- children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
58653
+ children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { "data-rail-sheet": "", className: "min-h-0 flex-1 overflow-y-auto px-3 pb-6", children })
58560
58654
  }
58561
58655
  );
58562
58656
  }
58563
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58657
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58564
58658
  "aside",
58565
58659
  {
58566
58660
  "data-rail-column": "",
58567
58661
  "data-rail-over": over ? "" : void 0,
58568
58662
  "data-matrx-page-scroll": "",
58569
58663
  className: over ? "w-[26rem] shrink-0" : "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3",
58570
- children: over ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58664
+ children: over ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58571
58665
  "div",
58572
58666
  {
58573
58667
  className: (0, import_design_system169.cn)(
@@ -58619,11 +58713,11 @@ function TableNotHere({
58619
58713
  leaveLabel,
58620
58714
  className
58621
58715
  }) {
58622
- const client = (0, import_react335.useRecordsClient)();
58623
- const [archived, setArchived] = (0, import_react334.useState)({ phase: "asking" });
58624
- const [restoring, setRestoring] = (0, import_react334.useState)(false);
58625
- const [refusal3, setRefusal] = (0, import_react334.useState)(null);
58626
- (0, import_react334.useEffect)(() => {
58716
+ const client = (0, import_react336.useRecordsClient)();
58717
+ const [archived, setArchived] = (0, import_react335.useState)({ phase: "asking" });
58718
+ const [restoring, setRestoring] = (0, import_react335.useState)(false);
58719
+ const [refusal3, setRefusal] = (0, import_react335.useState)(null);
58720
+ (0, import_react335.useEffect)(() => {
58627
58721
  let alive = true;
58628
58722
  void client.tableArchived({ table_id: tableId }).then((answered) => {
58629
58723
  if (!alive) return;
@@ -58633,16 +58727,16 @@ function TableNotHere({
58633
58727
  alive = false;
58634
58728
  };
58635
58729
  }, [client, tableId]);
58636
- if (archived.phase === "asking") return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Skeleton, { className: "h-40 w-full" });
58730
+ if (archived.phase === "asking") return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Skeleton, { className: "h-40 w-full" });
58637
58731
  const row = archived.phase === "answered" ? archived.row : null;
58638
58732
  if (row) {
58639
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58640
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
58641
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
58642
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
58643
- refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: refusal3 }) : null,
58644
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex gap-2", children: [
58645
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
58733
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58734
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-sm font-medium", children: "This table is archived" }),
58735
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_IS_ARCHIVED }),
58736
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-xs text-muted-foreground", children: (0, import_records69.archivedByLine)(row) }),
58737
+ refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: refusal3 }) : null,
58738
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex gap-2", children: [
58739
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
58646
58740
  import_design_system169.Button,
58647
58741
  {
58648
58742
  size: "sm",
@@ -58661,14 +58755,14 @@ function TableNotHere({
58661
58755
  children: restoring ? "Bringing it back\u2026" : "Bring it back"
58662
58756
  }
58663
58757
  ),
58664
- onLeave ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58758
+ onLeave ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58665
58759
  ] })
58666
58760
  ] });
58667
58761
  }
58668
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58669
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-sm font-medium", children: "This table is not here" }),
58670
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
58671
- onLeave ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58762
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
58763
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-sm font-medium", children: "This table is not here" }),
58764
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
58765
+ onLeave ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
58672
58766
  ] });
58673
58767
  }
58674
58768
  var TABLE_NOT_REACHABLE = (
@@ -58824,17 +58918,17 @@ function TablePage({
58824
58918
  onViewAddressChange,
58825
58919
  className
58826
58920
  }) {
58827
- const client = (0, import_react335.useRecordsClient)();
58828
- const table = (0, import_react335.useTable)(tableId);
58921
+ const client = (0, import_react336.useRecordsClient)();
58922
+ const table = (0, import_react336.useTable)(tableId);
58829
58923
  const rights = useTableRights(table.data);
58830
58924
  const structure = useStructureHidden(tableId, table.data?.level);
58831
- const pageFields = (0, import_react335.useFields)(filter ? tableId : null);
58832
- const allFields = (0, import_react335.useFields)(tableId);
58925
+ const pageFields = (0, import_react336.useFields)(filter ? tableId : null);
58926
+ const allFields = (0, import_react336.useFields)(tableId);
58833
58927
  const viewLabels = useRecordLabels(allFields.data ?? void 0);
58834
58928
  const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
58835
- const organizationId = (0, import_react335.useRecordsClient)().config.organizationId;
58929
+ const organizationId = (0, import_react336.useRecordsClient)().config.organizationId;
58836
58930
  const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
58837
- const seededOpening = (0, import_react335.useSeededAnswer)(
58931
+ const seededOpening = (0, import_react336.useSeededAnswer)(
58838
58932
  `table-page-opening:${tableId}`,
58839
58933
  async (c) => {
58840
58934
  const [listed, looked] = await Promise.all([c.views({ table_id: tableId }), readLooks(c, tableId)]);
@@ -58845,14 +58939,14 @@ function TablePage({
58845
58939
  }
58846
58940
  );
58847
58941
  const seededViews = seededOpening && (seedViews ?? [defaultView(tableId)]).every((spec) => seedIsSatisfied(spec, seededOpening.views)) ? seededOpening.views : void 0;
58848
- const [view, setView] = (0, import_react334.useState)(() => {
58942
+ const [view, setView] = (0, import_react335.useState)(() => {
58849
58943
  if (!seededViews || seededViews.length === 0) return null;
58850
58944
  const asked4 = savedViewFromParam(activeView);
58851
58945
  return seededViews.find((v) => v.id === asked4) ?? (0, import_views2.defaultViewOf)(seededViews) ?? seededViews[0];
58852
58946
  });
58853
- const [looks, setLooks] = (0, import_react334.useState)(() => seededViews ? seededOpening?.looks : void 0);
58854
- const looksSeededFor = (0, import_react334.useRef)(seededViews && seededOpening ? tableId : null);
58855
- (0, import_react334.useEffect)(() => {
58947
+ const [looks, setLooks] = (0, import_react335.useState)(() => seededViews ? seededOpening?.looks : void 0);
58948
+ const looksSeededFor = (0, import_react335.useRef)(seededViews && seededOpening ? tableId : null);
58949
+ (0, import_react335.useEffect)(() => {
58856
58950
  if (looksSeededFor.current === tableId) {
58857
58951
  looksSeededFor.current = null;
58858
58952
  return;
@@ -58869,7 +58963,7 @@ function TablePage({
58869
58963
  }, [client, tableId]);
58870
58964
  const look = view && looks ? looks[view.id] : void 0;
58871
58965
  const shown5 = view ? (0, import_views3.applyLook)(view, look) : null;
58872
- const [viewsEpoch, setViewsEpoch] = (0, import_react334.useState)(0);
58966
+ const [viewsEpoch, setViewsEpoch] = (0, import_react335.useState)(0);
58873
58967
  const opening = openingRail(activeRecordId, activeRail);
58874
58968
  const recordsUi = useRecordsUi();
58875
58969
  const savedFromLink = savedViewFromParam(activeView);
@@ -58877,33 +58971,33 @@ function TablePage({
58877
58971
  const formFromLink = formFromParam(activeView);
58878
58972
  const openedByPackage = openingView(savedFromLink || questionsFromLink || formFromLink ? null : activeView, activeDashboardId);
58879
58973
  const opened = questionsFromLink ? { ...openedByPackage, main: "questions" } : formFromLink ? { ...openedByPackage, main: "form" } : openedByPackage;
58880
- const [views, setViews] = (0, import_react334.useState)(() => seededViews);
58881
- const [pickedViewId, setPickedViewId] = (0, import_react334.useState)(savedFromLink);
58882
- const viewSeen = (0, import_react334.useRef)(null);
58883
- const [viewLinkMissed, setViewLinkMissed] = (0, import_react334.useState)(false);
58974
+ const [views, setViews] = (0, import_react335.useState)(() => seededViews);
58975
+ const [pickedViewId, setPickedViewId] = (0, import_react335.useState)(savedFromLink);
58976
+ const viewSeen = (0, import_react335.useRef)(null);
58977
+ const [viewLinkMissed, setViewLinkMissed] = (0, import_react335.useState)(false);
58884
58978
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
58885
58979
  const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
58886
58980
  const shareFromLink = railFromParam(activeRail) === "share";
58887
58981
  const canShare = useCanShare();
58888
58982
  const itemFor = (which) => railFromParam(activeRail) === which ? activeItemId ?? null : null;
58889
- const [asking, setAsking] = (0, import_react334.useState)(null);
58890
- const [layoutFromLink, setLayoutFromLink] = (0, import_react334.useState)(opened.layout);
58891
- const [surface, setSurface] = (0, import_react334.useState)({
58983
+ const [asking, setAsking] = (0, import_react335.useState)(null);
58984
+ const [layoutFromLink, setLayoutFromLink] = (0, import_react335.useState)(opened.layout);
58985
+ const [surface, setSurface] = (0, import_react335.useState)({
58892
58986
  main: opened.main,
58893
58987
  rail: opening.rail
58894
58988
  });
58895
58989
  const { main, rail } = surface;
58896
- const [questionDraft, setQuestionDraft] = (0, import_react334.useState)(null);
58990
+ const [questionDraft, setQuestionDraft] = (0, import_react335.useState)(null);
58897
58991
  const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
58898
- const [importEpoch, setImportEpoch] = (0, import_react334.useState)(0);
58899
- const [openRecord, setOpenRecord] = (0, import_react334.useState)(opening.record);
58992
+ const [importEpoch, setImportEpoch] = (0, import_react335.useState)(0);
58993
+ const [openRecord, setOpenRecord] = (0, import_react335.useState)(opening.record);
58900
58994
  const phone = (0, import_design_system169.useIsMobile)();
58901
- const [shareAsked, setShareAsked] = (0, import_react334.useState)(0);
58995
+ const [shareAsked, setShareAsked] = (0, import_react335.useState)(0);
58902
58996
  const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
58903
- const [archiveAsked, setArchiveAsked] = (0, import_react334.useState)(0);
58904
- const pageArchive = (0, import_react335.useTableArchive)(tableId);
58905
- const archiveRunning = (0, import_react334.useRef)(false);
58906
- const archiveFromMenu = (0, import_react334.useCallback)(async () => {
58997
+ const [archiveAsked, setArchiveAsked] = (0, import_react335.useState)(0);
58998
+ const pageArchive = (0, import_react336.useTableArchive)(tableId);
58999
+ const archiveRunning = (0, import_react335.useRef)(false);
59000
+ const archiveFromMenu = (0, import_react335.useCallback)(async () => {
58907
59001
  if (archiveRunning.current) return;
58908
59002
  archiveRunning.current = true;
58909
59003
  try {
@@ -58921,9 +59015,9 @@ function TablePage({
58921
59015
  client,
58922
59016
  tableId,
58923
59017
  name: finished.table_name || table.data?.name || "the table",
58924
- onRestored: () => (0, import_react335.tableShapeChanged)(tableId)
59018
+ onRestored: () => (0, import_react336.tableShapeChanged)(tableId)
58925
59019
  });
58926
- (0, import_react335.tableShapeChanged)(tableId);
59020
+ (0, import_react336.tableShapeChanged)(tableId);
58927
59021
  return;
58928
59022
  }
58929
59023
  setSurface((now) => ({ ...now, main: "records", rail: "settings" }));
@@ -58932,15 +59026,15 @@ function TablePage({
58932
59026
  archiveRunning.current = false;
58933
59027
  }
58934
59028
  }, [pageArchive, client, tableId, table.data, recordsUi.notify]);
58935
- const [moveAsked, setMoveAsked] = (0, import_react334.useState)(0);
59029
+ const [moveAsked, setMoveAsked] = (0, import_react335.useState)(0);
58936
59030
  const canCleanTable = useTableCanBeCleaned(tableId);
58937
- const [duplicateOpen, setDuplicateOpen] = (0, import_react334.useState)(false);
58938
- const [referenceOpen, setReferenceOpen] = (0, import_react334.useState)(false);
58939
- const [subscribeOpen, setSubscribeOpen] = (0, import_react334.useState)(false);
58940
- const [breakDownOpen, setBreakDownOpen] = (0, import_react334.useState)(false);
59031
+ const [duplicateOpen, setDuplicateOpen] = (0, import_react335.useState)(false);
59032
+ const [referenceOpen, setReferenceOpen] = (0, import_react335.useState)(false);
59033
+ const [subscribeOpen, setSubscribeOpen] = (0, import_react335.useState)(false);
59034
+ const [breakDownOpen, setBreakDownOpen] = (0, import_react335.useState)(false);
58941
59035
  const canGetReference = useCanGetReference();
58942
- const [toolbarSlot, setToolbarSlot] = (0, import_react334.useState)(null);
58943
- const [toolbarRow, setToolbarRow] = (0, import_react334.useState)(null);
59036
+ const [toolbarSlot, setToolbarSlot] = (0, import_react335.useState)(null);
59037
+ const [toolbarRow, setToolbarRow] = (0, import_react335.useState)(null);
58944
59038
  const toolbarFold2 = useToolbarFit(toolbarRow);
58945
59039
  const slotClipped = useSlotScroll(toolbarSlot);
58946
59040
  const embedded = pagePresentation2 === "embedded";
@@ -58965,7 +59059,7 @@ function TablePage({
58965
59059
  const skeletonFace = skeletonLayoutFor(
58966
59060
  faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
58967
59061
  );
58968
- (0, import_react334.useEffect)(() => {
59062
+ (0, import_react335.useEffect)(() => {
58969
59063
  if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
58970
59064
  rememberLayout(tableId, shownLayout);
58971
59065
  }, [embedded, faceUnknown, main, shownLayout, tableId, table.data !== void 0]);
@@ -58983,9 +59077,9 @@ function TablePage({
58983
59077
  lookDiffers: view ? (0, import_views3.lookDiffers)(view, look) : false
58984
59078
  };
58985
59079
  const shownSignature = JSON.stringify(shownReport);
58986
- const reportRef = (0, import_react334.useRef)(onShownViewChange);
59080
+ const reportRef = (0, import_react335.useRef)(onShownViewChange);
58987
59081
  reportRef.current = onShownViewChange;
58988
- (0, import_react334.useEffect)(() => {
59082
+ (0, import_react335.useEffect)(() => {
58989
59083
  reportRef.current?.(JSON.parse(shownSignature));
58990
59084
  }, [shownSignature]);
58991
59085
  const pickLayout = (next) => {
@@ -58994,9 +59088,9 @@ function TablePage({
58994
59088
  onViewChanged?.(addressForView(view, next));
58995
59089
  void patchView({ layout: next });
58996
59090
  };
58997
- const reportedRecords = (0, import_react334.useRef)(/* @__PURE__ */ new Set());
58998
- const lastActiveRecord = (0, import_react334.useRef)(activeRecordId ?? null);
58999
- (0, import_react334.useEffect)(() => {
59091
+ const reportedRecords = (0, import_react335.useRef)(/* @__PURE__ */ new Set());
59092
+ const lastActiveRecord = (0, import_react335.useRef)(activeRecordId ?? null);
59093
+ (0, import_react335.useEffect)(() => {
59000
59094
  const before = lastActiveRecord.current;
59001
59095
  lastActiveRecord.current = activeRecordId ?? null;
59002
59096
  if (!activeRecordId) {
@@ -59007,32 +59101,32 @@ function TablePage({
59007
59101
  setOpenRecord(activeRecordId);
59008
59102
  setSurface((now) => ({ ...now, rail: "record" }));
59009
59103
  }, [activeRecordId]);
59010
- const [shownIds, setShownIdsRaw] = (0, import_react334.useState)([]);
59011
- const setShownIds = (0, import_react334.useCallback)(
59104
+ const [shownIds, setShownIdsRaw] = (0, import_react335.useState)([]);
59105
+ const setShownIds = (0, import_react335.useCallback)(
59012
59106
  (next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
59013
59107
  []
59014
59108
  );
59015
- const [recordExpanded, setRecordExpanded] = (0, import_react334.useState)(false);
59016
- const [recordFull, setRecordFull] = (0, import_react334.useState)(false);
59017
- (0, import_react334.useEffect)(() => {
59109
+ const [recordExpanded, setRecordExpanded] = (0, import_react335.useState)(false);
59110
+ const [recordFull, setRecordFull] = (0, import_react335.useState)(false);
59111
+ (0, import_react335.useEffect)(() => {
59018
59112
  if (rail !== "record") setRecordFull(false);
59019
59113
  }, [rail]);
59020
59114
  const shownRecord = rail === "record" ? openRecord : null;
59021
- const reportedRecord = (0, import_react334.useRef)(activeRecordId ?? null);
59022
- (0, import_react334.useEffect)(() => {
59115
+ const reportedRecord = (0, import_react335.useRef)(activeRecordId ?? null);
59116
+ (0, import_react335.useEffect)(() => {
59023
59117
  if (shownRecord === reportedRecord.current) return;
59024
59118
  const how = shownRecord === null ? "close" : reportedRecord.current === null ? "open" : "step";
59025
59119
  reportedRecord.current = shownRecord;
59026
59120
  if (shownRecord) reportedRecords.current.add(shownRecord);
59027
59121
  onRecordChange?.(shownRecord, how);
59028
59122
  }, [shownRecord, onRecordChange]);
59029
- (0, import_react334.useEffect)(() => {
59123
+ (0, import_react335.useEffect)(() => {
59030
59124
  if (activeRecordId) return;
59031
59125
  const named = railFromParam(activeRail);
59032
59126
  if (named === null || named === "share") return;
59033
59127
  setSurface((now) => ({ ...now, rail: named }));
59034
59128
  }, [activeRail, activeRecordId]);
59035
- (0, import_react334.useEffect)(() => {
59129
+ (0, import_react335.useEffect)(() => {
59036
59130
  if (formFromParam(activeView)) {
59037
59131
  setSurface((now) => ({ ...now, main: "form" }));
59038
59132
  return;
@@ -59043,9 +59137,9 @@ function TablePage({
59043
59137
  setLayoutFromLink(isLayout ? named : null);
59044
59138
  setSurface((now) => ({ ...now, main: isLayout ? "records" : named }));
59045
59139
  }, [activeView]);
59046
- const [viewSaveRefused, setViewSaveRefused] = (0, import_react334.useState)(null);
59140
+ const [viewSaveRefused, setViewSaveRefused] = (0, import_react335.useState)(null);
59047
59141
  const viewLocked = view?.presentation?.locked === true;
59048
- const unlockView = (0, import_react334.useCallback)(async () => {
59142
+ const unlockView = (0, import_react335.useCallback)(async () => {
59049
59143
  const current = view;
59050
59144
  if (!current) return;
59051
59145
  const presentation = { ...current.presentation ?? {} };
@@ -59058,10 +59152,10 @@ function TablePage({
59058
59152
  setView({ ...current, presentation });
59059
59153
  setViewsEpoch((n) => n + 1);
59060
59154
  }, [client, tableId, view, recordsUi.notify]);
59061
- const sayLocked = (0, import_react334.useCallback)(() => {
59155
+ const sayLocked = (0, import_react335.useCallback)(() => {
59062
59156
  recordsUi.notify?.success(VIEW_LOCKED_REASON, rights.organise ? { label: "Unlock", run: () => void unlockView() } : void 0);
59063
59157
  }, [recordsUi.notify, unlockView, rights.organise]);
59064
- const patchView = (0, import_react334.useCallback)(
59158
+ const patchView = (0, import_react335.useCallback)(
59065
59159
  async (asked4) => {
59066
59160
  const current = view;
59067
59161
  if (!current) return;
@@ -59077,19 +59171,19 @@ function TablePage({
59077
59171
  },
59078
59172
  [client, tableId, view, looks, viewLocked, sayLocked]
59079
59173
  );
59080
- const arrival = (0, import_react334.useRef)(viewAddress ?? null);
59081
- const [gridQuery, setGridQuery] = (0, import_react334.useState)(null);
59082
- const [addressResetEpoch, setAddressResetEpoch] = (0, import_react334.useState)(0);
59083
- const reportGrid = (0, import_react334.useCallback)((q) => {
59174
+ const arrival = (0, import_react335.useRef)(viewAddress ?? null);
59175
+ const [gridQuery, setGridQuery] = (0, import_react335.useState)(null);
59176
+ const [addressResetEpoch, setAddressResetEpoch] = (0, import_react335.useState)(0);
59177
+ const reportGrid = (0, import_react335.useCallback)((q) => {
59084
59178
  const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
59085
59179
  setGridQuery((held) => sameViewAddress(held, next) ? held : next);
59086
59180
  }, []);
59087
- const addressPort = (0, import_react334.useMemo)(
59181
+ const addressPort = (0, import_react335.useMemo)(
59088
59182
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
59089
59183
  [reportGrid, addressResetEpoch]
59090
59184
  );
59091
- const hiddenApplied = (0, import_react334.useRef)(false);
59092
- (0, import_react334.useEffect)(() => {
59185
+ const hiddenApplied = (0, import_react335.useRef)(false);
59186
+ (0, import_react335.useEffect)(() => {
59093
59187
  const hidden = arrival.current?.hidden;
59094
59188
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
59095
59189
  hiddenApplied.current = true;
@@ -59109,10 +59203,10 @@ function TablePage({
59109
59203
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
59110
59204
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
59111
59205
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
59112
- const addressReportRef = (0, import_react334.useRef)(onViewAddressChange);
59206
+ const addressReportRef = (0, import_react335.useRef)(onViewAddressChange);
59113
59207
  addressReportRef.current = onViewAddressChange;
59114
- const addressSent = (0, import_react334.useRef)(null);
59115
- (0, import_react334.useEffect)(() => {
59208
+ const addressSent = (0, import_react335.useRef)(null);
59209
+ (0, import_react335.useEffect)(() => {
59116
59210
  if (!addressReady) return;
59117
59211
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
59118
59212
  addressSent.current = addressSignature;
@@ -59124,9 +59218,9 @@ function TablePage({
59124
59218
  }, [addressReady, addressSignature]);
59125
59219
  const queryShowing = !isViewAddressEmpty({ ...gridQuery ?? {}, hidden: [] });
59126
59220
  const lookShowing = Boolean(view && looks && ((0, import_views3.lookDiffers)(view, looks[view.id]) || queryShowing));
59127
- const [lookRefused, setLookRefused] = (0, import_react334.useState)(null);
59128
- const [namingLook, setNamingLook] = (0, import_react334.useState)(false);
59129
- const [lookName, setLookName] = (0, import_react334.useState)("");
59221
+ const [lookRefused, setLookRefused] = (0, import_react335.useState)(null);
59222
+ const [namingLook, setNamingLook] = (0, import_react335.useState)(false);
59223
+ const [lookName, setLookName] = (0, import_react335.useState)("");
59130
59224
  const resetLook = async () => {
59131
59225
  const current = view;
59132
59226
  setAddressResetEpoch((n) => n + 1);
@@ -59191,7 +59285,7 @@ function TablePage({
59191
59285
  setPickedViewId(written.data);
59192
59286
  setViewsEpoch((n) => n + 1);
59193
59287
  };
59194
- const [designateRefused, setDesignateRefused] = (0, import_react334.useState)(null);
59288
+ const [designateRefused, setDesignateRefused] = (0, import_react335.useState)(null);
59195
59289
  const opensAs = view?.isDefault ? view.layout : null;
59196
59290
  const canDesignate = Boolean(
59197
59291
  rights.organise && view && layoutShowing && layoutShowing !== opensAs && (0, import_views2.storeKeepsLayout)(layoutShowing)
@@ -59216,7 +59310,7 @@ function TablePage({
59216
59310
  };
59217
59311
  const footer = footerOf(shown5?.presentation);
59218
59312
  const setFooter = (next) => void patchView({ presentation: { ...shown5?.presentation ?? {}, footer: next } });
59219
- const layoutRadio = /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59313
+ const layoutRadio = /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59220
59314
  import_design_system169.DropdownMenuRadioGroup,
59221
59315
  {
59222
59316
  value: layoutShowing ?? (main === "form" ? FORM_LAYOUT : ""),
@@ -59228,14 +59322,14 @@ function TablePage({
59228
59322
  if (import_views2.VIEW_LAYOUTS.includes(value)) pickLayout(value);
59229
59323
  },
59230
59324
  children: [
59231
- import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuRadioItem, { value: option, children: import_views2.LAYOUT_LABEL[option] }, option)),
59232
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuRadioItem, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
59325
+ import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuRadioItem, { value: option, children: import_views2.LAYOUT_LABEL[option] }, option)),
59326
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuRadioItem, { value: FORM_LAYOUT, "data-layout-form": "", children: FORM_LAYOUT_LABEL })
59233
59327
  ]
59234
59328
  }
59235
59329
  );
59236
- const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59237
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
59238
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59330
+ const sheetExtras = controlsInSheet && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59331
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex items-center gap-2 text-xs", "data-table-sheet-filter": "", "data-matrx-table-tools-keep-open": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) }),
59332
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { role: "group", "aria-label": "Layout", className: "flex flex-wrap gap-1 pt-1", "data-table-sheet-layout": "", children: import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59239
59333
  import_design_system169.Button,
59240
59334
  {
59241
59335
  size: "sm",
@@ -59247,7 +59341,7 @@ function TablePage({
59247
59341
  },
59248
59342
  option
59249
59343
  )) }),
59250
- rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
59344
+ rights.share && canShare ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
59251
59345
  ] }) : void 0;
59252
59346
  const go = (pressed) => {
59253
59347
  if (!surfaceChosen(surface, pressed)) press(pressed);
@@ -59434,14 +59528,14 @@ function TablePage({
59434
59528
  }
59435
59529
  });
59436
59530
  const openedEntry = ACTION_PRESS.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? ACTION_PRESS.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
59437
- const actionsRef = (0, import_react334.useRef)(actions);
59531
+ const actionsRef = (0, import_react335.useRef)(actions);
59438
59532
  actionsRef.current = actions;
59439
- const onActionsRef = (0, import_react334.useRef)(onActions);
59533
+ const onActionsRef = (0, import_react335.useRef)(onActions);
59440
59534
  onActionsRef.current = onActions;
59441
- (0, import_react334.useEffect)(() => {
59535
+ (0, import_react335.useEffect)(() => {
59442
59536
  onActionsRef.current?.(actionsRef.current);
59443
59537
  });
59444
- (0, import_react334.useEffect)(() => {
59538
+ (0, import_react335.useEffect)(() => {
59445
59539
  const onKey = (event) => {
59446
59540
  const asked4 = objectActionForKey(actionsRef.current, event);
59447
59541
  if (!asked4) return;
@@ -59453,9 +59547,9 @@ function TablePage({
59453
59547
  return () => window.removeEventListener("keydown", onKey);
59454
59548
  }, [recordsUi]);
59455
59549
  const openedFromMenu = openedEntry ? { ...openedEntry, label: actions.find((a) => a.id === openedEntry.id)?.label ?? openedEntry.key } : null;
59456
- const pageActions = /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59457
- publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
59458
- !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59550
+ const pageActions = /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59551
+ publicReadOnly ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Badge, { variant: "neutral", className: "shrink-0", "data-public-read-only": "", children: PUBLIC_READ_ONLY }, "public-read-only") : null,
59552
+ !phone && rights.read && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59459
59553
  TableAsk,
59460
59554
  {
59461
59555
  tableId,
@@ -59467,7 +59561,7 @@ function TablePage({
59467
59561
  },
59468
59562
  "ask"
59469
59563
  ) : null,
59470
- organizationId ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59564
+ organizationId ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59471
59565
  ShareControl,
59472
59566
  {
59473
59567
  kind: "table",
@@ -59481,28 +59575,28 @@ function TablePage({
59481
59575
  },
59482
59576
  `share-${shareAsked}`
59483
59577
  ) }, "share") : null,
59484
- phone ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59485
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59486
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
59487
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-56", children: layoutRadio })
59578
+ phone ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59579
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59580
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Layout", title: "Layout", "data-table-layout-menu": "", children: "Layout" }) }),
59581
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-56", children: layoutRadio })
59488
59582
  ] }, "phone-layout") : null,
59489
59583
  phoneTableActions(actions)
59490
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59491
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
59492
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
59493
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
59494
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
59584
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59585
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
59586
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "5", cy: "12", r: "1.75" }),
59587
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "12", cy: "12", r: "1.75" }),
59588
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("circle", { cx: "19", cy: "12", r: "1.75" })
59495
59589
  ] }) }) }),
59496
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
59497
- !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59498
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59590
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "end", className: "w-64", "data-table-menu-content": "", ...renameMenuProps, children: [
59591
+ !chooserInline && !chooserCompact && !embedded ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59592
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59499
59593
  layoutRadio,
59500
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuSeparator, {})
59594
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuSeparator, {})
59501
59595
  ] }) : null,
59502
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ObjectActionMenuItems, { actions })
59596
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ObjectActionMenuItems, { actions })
59503
59597
  ] })
59504
59598
  ] }, "menu"),
59505
- moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59599
+ moveAsked > 0 && !actionHost?.move ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59506
59600
  WhereItLives,
59507
59601
  {
59508
59602
  tableId,
@@ -59515,7 +59609,7 @@ function TablePage({
59515
59609
  },
59516
59610
  "move"
59517
59611
  ) : null,
59518
- breakDownOpen ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59612
+ breakDownOpen ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59519
59613
  BreakDownDialog,
59520
59614
  {
59521
59615
  tableId,
@@ -59526,7 +59620,7 @@ function TablePage({
59526
59620
  },
59527
59621
  "break-down"
59528
59622
  ) : null,
59529
- subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59623
+ subscribeOpen && recordsUi.calendarFeed && organizationId && view ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59530
59624
  CalendarSubscribeDialog,
59531
59625
  {
59532
59626
  port: recordsUi.calendarFeed,
@@ -59539,8 +59633,8 @@ function TablePage({
59539
59633
  },
59540
59634
  "subscribe"
59541
59635
  ) : null,
59542
- referenceOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
59543
- duplicateOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59636
+ referenceOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableReferenceDialog, { table: table.data, open: referenceOpen, onOpenChange: setReferenceOpen }, "reference") : null,
59637
+ duplicateOpen && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59544
59638
  TableDuplicateDialog,
59545
59639
  {
59546
59640
  tableId,
@@ -59552,40 +59646,40 @@ function TablePage({
59552
59646
  },
59553
59647
  "duplicate"
59554
59648
  ) : null,
59555
- rights.structure && table.data ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
59649
+ rights.structure && table.data ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableRenameDialog, { tableId, name: table.data.name, open: renameOpen, onOpenChange: setRenameOpen }, "rename") : null
59556
59650
  ] });
59557
59651
  const headerNode = header && !embedded ? header({ actions: table.data ? pageActions : null, tableName: table.data?.name ?? null }) : null;
59558
- if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59652
+ if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59559
59653
  headerNode,
59560
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: table.error })
59654
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: table.error })
59561
59655
  ] });
59562
59656
  if (table.loading && !table.data) {
59563
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59657
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59564
59658
  headerNode,
59565
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
59659
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
59566
59660
  ] });
59567
59661
  }
59568
59662
  if (!table.data) {
59569
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59663
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59570
59664
  headerNode,
59571
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableNotHere, { tableId, onLeave, leaveLabel, className })
59665
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableNotHere, { tableId, onLeave, leaveLabel, className })
59572
59666
  ] });
59573
59667
  }
59574
59668
  const lookSavable = Boolean(
59575
59669
  rights.write && view && Object.keys(viewPatchDocument((0, import_views3.saveToViewPlan)(view, look ?? {}).patch)).length > 0
59576
59670
  );
59577
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(ViewAddressContext.Provider, { value: addressPort, children: [
59578
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: (0, import_design_system169.cn)("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
59671
+ return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(ViewAddressContext.Provider, { value: addressPort, children: [
59672
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system169.cn)("flex h-full min-h-0 gap-4", className), "data-table-footer": footer, children: [
59579
59673
  headerNode,
59580
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
59674
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col gap-2", children: structure.hidden || !structure.settled ? (
59581
59675
  /* THE TOOLBAR ROW'S HEIGHT IS KEPT (min-h-8), so the sentence lands exactly where the bar was. */
59582
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59583
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
59584
- structure.hidden ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(StructureLocked, {}) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RecordsSkeleton, { layout: skeletonFace, embedded })
59676
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59677
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "aria-hidden": "true" }),
59678
+ structure.hidden ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(StructureLocked, {}) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RecordsSkeleton, { layout: skeletonFace, embedded })
59585
59679
  ] })
59586
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_jsx_runtime190.Fragment, { children: [
59587
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
59588
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59680
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
59681
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ImportNotice, { tableId, epoch: importEpoch, onOpenImport: () => setRail("import") }),
59682
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59589
59683
  "div",
59590
59684
  {
59591
59685
  ref: setToolbarRow,
@@ -59593,7 +59687,7 @@ function TablePage({
59593
59687
  "data-table-toolbar": "",
59594
59688
  "data-table-toolbar-fold": toolbarFold2,
59595
59689
  children: [
59596
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59690
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59597
59691
  ViewBar,
59598
59692
  {
59599
59693
  tableId,
@@ -59620,9 +59714,9 @@ function TablePage({
59620
59714
  },
59621
59715
  ...seededViews && viewsEpoch === 0 ? { initialViews: seededViews } : {},
59622
59716
  seed: seedViews ?? [defaultView(tableId)],
59623
- settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
59624
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
59625
- ["sticky", "inline"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59717
+ settings: view && main === "records" && shownLayout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-0.5 px-1 py-1", role: "radiogroup", "aria-label": FOOTER_WORDS.label, children: [
59718
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "px-1 pb-0.5 text-[11px] font-medium text-muted-foreground", children: FOOTER_WORDS.label }),
59719
+ ["sticky", "inline"].map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59626
59720
  "button",
59627
59721
  {
59628
59722
  type: "button",
@@ -59635,7 +59729,7 @@ function TablePage({
59635
59729
  ),
59636
59730
  onClick: () => setFooter(option),
59637
59731
  children: [
59638
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59732
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59639
59733
  "span",
59640
59734
  {
59641
59735
  "aria-hidden": "true",
@@ -59651,8 +59745,8 @@ function TablePage({
59651
59745
  },
59652
59746
  viewsEpoch
59653
59747
  ),
59654
- chooserInline ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
59655
- import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59748
+ chooserInline ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex shrink-0 items-center gap-0.5", role: "group", "aria-label": "Layout", "data-toolbar-fit": "chooser", children: [
59749
+ import_views2.VIEW_LAYOUTS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59656
59750
  import_design_system169.Button,
59657
59751
  {
59658
59752
  size: "sm",
@@ -59663,7 +59757,7 @@ function TablePage({
59663
59757
  },
59664
59758
  option
59665
59759
  )),
59666
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59760
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59667
59761
  import_design_system169.Button,
59668
59762
  {
59669
59763
  size: "sm",
@@ -59679,20 +59773,20 @@ function TablePage({
59679
59773
  /* THE ROW HAD NO ROOM (lane C, review 2026-09-26 D6: the switcher vanished at 1280 px and
59680
59774
  with the record panel open): the chooser folds to ONE button naming the layout that is
59681
59775
  showing — it never leaves the row. */
59682
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59683
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
59776
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "flex shrink-0 items-center", "data-toolbar-fit": "chooser", "data-layout-chooser-compact": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59777
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 gap-1 px-2 text-xs", "aria-label": `Layout: ${layoutShowingLabel ?? "none"}`, children: [
59684
59778
  layoutShowingLabel ?? "Layout",
59685
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "m6 9 6 6 6-6" }) })
59779
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("svg", { viewBox: "0 0 24 24", className: "h-3.5 w-3.5 opacity-70", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "m6 9 6 6 6-6" }) })
59686
59780
  ] }) }),
59687
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
59688
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59781
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-44", "data-layout-chooser-menu": "", children: [
59782
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuLabel, { className: "text-xs text-muted-foreground", children: "Layout" }),
59689
59783
  layoutRadio
59690
59784
  ] })
59691
59785
  ] }) })
59692
59786
  ) : null,
59693
- main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
59694
- lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
59695
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59787
+ main === "records" && !(controlsInSheet && shownLayout === "grid") ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ViewFilter, { tableId, view: shown5, onApply: (where) => void patchView({ where }) }) : null,
59788
+ lookShowing && main === "records" && !namingLook ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-view-look-folded": "", "data-toolbar-fit": "look", children: [
59789
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59696
59790
  import_design_system169.Button,
59697
59791
  {
59698
59792
  size: "sm",
@@ -59702,36 +59796,36 @@ function TablePage({
59702
59796
  "aria-label": "Reset view",
59703
59797
  onClick: () => void resetLook(),
59704
59798
  "data-view-look-reset-button": "",
59705
- children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
59706
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
59707
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("path", { d: "M3 3v5h5" })
59799
+ children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
59800
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7L3 8" }),
59801
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("path", { d: "M3 3v5h5" })
59708
59802
  ] })
59709
59803
  }
59710
59804
  ),
59711
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenu, { children: [
59712
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
59713
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(LookGlyph, {}),
59714
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
59805
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenu, { children: [
59806
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.Button, { size: "sm", variant: "outline", className: "relative h-8 w-8 shrink-0 px-0", title: LOOK_WORDS.folded, "aria-label": LOOK_WORDS.folded, "data-view-look-menu": "", children: [
59807
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(LookGlyph, {}),
59808
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { "aria-hidden": "true", className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-primary" })
59715
59809
  ] }) }),
59716
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
59717
- lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59718
- rights.write ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59719
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59810
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_design_system169.DropdownMenuContent, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
59811
+ lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59812
+ rights.write ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59813
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.DropdownMenuItem, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59720
59814
  ] })
59721
59815
  ] })
59722
59816
  ] }) : !lookShowing && main === "records" && view && !phone && !controlsInSheet ? (
59723
59817
  /* The reserved place keeps its full width at every row width (STABLE-TABLES): when it
59724
59818
  shrank on a narrow row, the look arriving on a sort pushed every control after it.
59725
59819
  A row too narrow for it scrolls sideways, as the row already does. */
59726
- /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
59727
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(LookGlyph, {}) }),
59728
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
59820
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { "aria-hidden": "true", className: "invisible flex shrink-0 items-center gap-1 overflow-hidden", "data-view-look-place": "", "data-toolbar-fit-gives": "", children: [
59821
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(LookGlyph, {}) }),
59822
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 w-8 shrink-0 px-0", tabIndex: -1 })
59729
59823
  ] })
59730
- ) : lookShowing && main === "records" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
59731
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "sr-only", children: LOOK_WORDS.yours }),
59732
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
59733
- lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59734
- rights.write ? namingLook ? /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59824
+ ) : lookShowing && main === "records" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex shrink-0 items-center gap-1", "data-view-look": "", "data-toolbar-fit": "look", title: LOOK_WORDS.yours, children: [
59825
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "sr-only", children: LOOK_WORDS.yours }),
59826
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { "aria-hidden": "true", className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary" }),
59827
+ lookSavable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", className: "h-8 px-2 text-xs", onClick: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
59828
+ rights.write ? namingLook ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59735
59829
  "form",
59736
59830
  {
59737
59831
  className: "flex items-center gap-1",
@@ -59740,7 +59834,7 @@ function TablePage({
59740
59834
  void saveLookAsNewView(lookName);
59741
59835
  },
59742
59836
  children: [
59743
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59837
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59744
59838
  import_design_system169.Input,
59745
59839
  {
59746
59840
  autoFocus: true,
@@ -59751,13 +59845,13 @@ function TablePage({
59751
59845
  placeholder: "View name"
59752
59846
  }
59753
59847
  ),
59754
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
59848
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", type: "submit", className: "h-8 px-2 text-xs", disabled: lookName.trim() === "", children: "Save" })
59755
59849
  ]
59756
59850
  }
59757
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59758
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59851
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
59852
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "ghost", className: "h-8 px-2 text-xs", onClick: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
59759
59853
  ] }) : null,
59760
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59854
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59761
59855
  "div",
59762
59856
  {
59763
59857
  ref: setToolbarSlot,
@@ -59779,8 +59873,9 @@ function TablePage({
59779
59873
  "data-clipped": slotClipped
59780
59874
  }
59781
59875
  ),
59782
- rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
59783
- openedFromMenu ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59876
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TablePresence, { tableId }),
59877
+ rights.write && view && main === "records" && shownLayout !== "grid" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", className: "shrink-0", onClick: () => show("new-record"), children: "New record" }) : null,
59878
+ openedFromMenu ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59784
59879
  import_design_system169.Button,
59785
59880
  {
59786
59881
  size: "sm",
@@ -59793,18 +59888,18 @@ function TablePage({
59793
59888
  children: openedFromMenu.label
59794
59889
  }
59795
59890
  ) : null,
59796
- header ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
59891
+ header ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "flex shrink-0 items-center gap-1", "data-table-page-actions": "", children: pageActions })
59797
59892
  ]
59798
59893
  }
59799
59894
  ),
59800
- designateRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: designateRefused }) : null,
59801
- viewSaveRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59895
+ designateRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: designateRefused }) : null,
59896
+ viewSaveRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59802
59897
  RefusalNotice,
59803
59898
  {
59804
59899
  error: viewSaveRefused.error,
59805
- actions: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
59806
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
59807
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59900
+ actions: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "flex flex-wrap gap-1 pt-0.5", "data-view-save-refused": "", children: [
59901
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system169.Button, { size: "sm", variant: "outline", onClick: () => void patchView(viewSaveRefused.patch), children: "Try again" }),
59902
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59808
59903
  import_design_system169.Button,
59809
59904
  {
59810
59905
  size: "sm",
@@ -59825,8 +59920,8 @@ function TablePage({
59825
59920
  ] })
59826
59921
  }
59827
59922
  ) : null,
59828
- lookRefused ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(RefusalNotice, { error: lookRefused }) : null,
59829
- main === "dashboards" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && (0, import_uuid10.isUuidShape)(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59923
+ lookRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RefusalNotice, { error: lookRefused }) : null,
59924
+ main === "dashboards" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(DashboardCanvas, { tableId, activeDashboardId: activeDashboardId ?? null }) : main === "form" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", "data-table-form-view": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FormsPanel, { tableId, activeFormId: formFromLink && activeItemId && (0, import_uuid10.isUuidShape)(activeItemId) ? activeItemId : null, asView: true }) }) : main === "questions" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59830
59925
  QuestionPanel,
59831
59926
  {
59832
59927
  tableId,
@@ -59838,7 +59933,7 @@ function TablePage({
59838
59933
  page returns to the records rather than leaving the person looking
59839
59934
  at a list the record is no longer in — and opens it, because the
59840
59935
  thing they just rescued is the thing they came for. */
59841
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59936
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59842
59937
  ArchivedView,
59843
59938
  {
59844
59939
  tableId,
@@ -59850,7 +59945,7 @@ function TablePage({
59850
59945
  }
59851
59946
  }
59852
59947
  )
59853
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
59948
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarSlotContext.Provider, { value: toolbarSlot, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarFoldContext.Provider, { value: toolbarFold2, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(TableToolbarSheetExtrasContext.Provider, { value: sheetExtras, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
59854
59949
  "div",
59855
59950
  {
59856
59951
  className: (0, import_design_system169.cn)(
@@ -59861,10 +59956,10 @@ function TablePage({
59861
59956
  ),
59862
59957
  "data-table-records": "",
59863
59958
  children: [
59864
- railUnknown ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
59865
- shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
59866
- opened.unknown ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: (0, import_views2.unknownViewLine)(opened.unknown) }) : null,
59867
- viewLinkMissed ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59959
+ railUnknown ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: unknownRailLine(railUnknown) }) : null,
59960
+ shareFromLink && rights.known && (!rights.share || !canShare) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: canShare ? SHARE_NOT_YOURS_LINE : shareUnavailableReason() }) : null,
59961
+ opened.unknown ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "rounded-md border border-amber-600/40 bg-amber-500/5 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:border-amber-400/40 dark:text-amber-300", children: (0, import_views2.unknownViewLine)(opened.unknown) }) : null,
59962
+ viewLinkMissed ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59868
59963
  "p",
59869
59964
  {
59870
59965
  "data-records-view-link-missed": "",
@@ -59872,7 +59967,7 @@ function TablePage({
59872
59967
  children: unknownSavedViewLine(view?.name ?? null)
59873
59968
  }
59874
59969
  ) : null,
59875
- cameFrom ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59970
+ cameFrom ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59876
59971
  "p",
59877
59972
  {
59878
59973
  "data-testid": "came-from-a-number",
@@ -59882,7 +59977,7 @@ function TablePage({
59882
59977
  ) : null,
59883
59978
  faceUnknown ? (
59884
59979
  /* REVIEW-FIX 10: a full page paints the rows this table showed last time (else fills). */
59885
- /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59980
+ /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59886
59981
  RecordsSkeleton,
59887
59982
  {
59888
59983
  layout: skeletonFace,
@@ -59890,7 +59985,7 @@ function TablePage({
59890
59985
  ...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
59891
59986
  }
59892
59987
  )
59893
- ) : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
59988
+ ) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59894
59989
  ViewSwitcher,
59895
59990
  {
59896
59991
  chooser: false,
@@ -59939,13 +60034,13 @@ function TablePage({
59939
60034
  }
59940
60035
  }
59941
60036
  ),
59942
- view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
60037
+ view || faceUnknown || views === void 0 || views !== null && views.length > 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "text-xs text-muted-foreground", children: VIEW_NOT_SAVED_YET })
59943
60038
  ]
59944
60039
  }
59945
60040
  ) }) }) })
59946
60041
  ] }) }),
59947
- rail === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
59948
- rail === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60042
+ rail === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(RailFrame, { phone, title: RAIL_TITLE[rail], onClose: () => setRail("none"), over: rail === "record" && (recordExpanded || recordFull), full: rail === "record" && recordFull, children: [
60043
+ rail === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59949
60044
  TableSettings,
59950
60045
  {
59951
60046
  tableId,
@@ -59962,7 +60057,7 @@ function TablePage({
59962
60057
  } : void 0
59963
60058
  }
59964
60059
  ) : null,
59965
- rail === "inbox" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60060
+ rail === "inbox" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59966
60061
  ActionInbox,
59967
60062
  {
59968
60063
  tableId,
@@ -59972,9 +60067,9 @@ function TablePage({
59972
60067
  }
59973
60068
  }
59974
60069
  ) : null,
59975
- rail === "forms" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
59976
- rail === "bookings" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
59977
- rail === "checklists" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60070
+ rail === "forms" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FormsPanel, { tableId, activeFormId: itemFor("forms") }) : null,
60071
+ rail === "bookings" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(BookingSlots, { tableId, activeBookingId: itemFor("bookings") }) : null,
60072
+ rail === "checklists" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59978
60073
  ChecklistsPanel,
59979
60074
  {
59980
60075
  tableId,
@@ -59984,12 +60079,12 @@ function TablePage({
59984
60079
  }
59985
60080
  }
59986
60081
  ) : null,
59987
- rail === "notifications" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
59988
- rail === "portals" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
59989
- rail === "export" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ExportMenu, { tableId, view: viewReading }) : null,
59990
- rail === "import" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
59991
- rail === "field" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
59992
- rail === "new-record" ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60082
+ rail === "notifications" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(SubscriptionsPanel, { tableId, activeRuleId: itemFor("notifications") }) : null,
60083
+ rail === "portals" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(PortalsPanel, { tableId, activePortalId: itemFor("portals") }) : null,
60084
+ rail === "export" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ExportMenu, { tableId, view: viewReading }) : null,
60085
+ rail === "import" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(ImportWizard, { tableId, onWrote: () => setImportEpoch((n) => n + 1), onDone: () => setRail("none") }) : null,
60086
+ rail === "field" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(FieldEditor, { tableId, onSaved: () => setRail("none"), onCancel: () => setRail("none") }) : null,
60087
+ rail === "new-record" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
59993
60088
  RecordForm,
59994
60089
  {
59995
60090
  tableId,
@@ -60000,7 +60095,7 @@ function TablePage({
60000
60095
  onCancel: () => setRail("none")
60001
60096
  }
60002
60097
  ) : null,
60003
- rail === "who-changed" && asking ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60098
+ rail === "who-changed" && asking ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60004
60099
  FieldHistoryPanel,
60005
60100
  {
60006
60101
  tableId,
@@ -60013,7 +60108,7 @@ function TablePage({
60013
60108
  }
60014
60109
  }
60015
60110
  ) : null,
60016
- rail === "record" && openRecord ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
60111
+ rail === "record" && openRecord ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60017
60112
  RecordPanel,
60018
60113
  {
60019
60114
  tableId,
@@ -60033,15 +60128,15 @@ function TablePage({
60033
60128
  ) : null
60034
60129
  ] })
60035
60130
  ] }),
60036
- embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(GridShortcutsHelp, {})
60131
+ embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(GridShortcutsHelp, {})
60037
60132
  ] });
60038
60133
  }
60039
60134
  var PUBLIC_READ_ONLY = "Public \xB7 read only";
60040
60135
  function usePublicReadOnly(client, organizationId, tableId, table, rights) {
60041
60136
  const readOnly = rights.known && rights.read && !rights.write;
60042
60137
  const marked = table?.published_to_web;
60043
- const [isPublic, setIsPublic] = (0, import_react334.useState)(false);
60044
- (0, import_react334.useEffect)(() => {
60138
+ const [isPublic, setIsPublic] = (0, import_react335.useState)(false);
60139
+ (0, import_react335.useEffect)(() => {
60045
60140
  if (!readOnly || !table) {
60046
60141
  setIsPublic(false);
60047
60142
  return;
@@ -60067,11 +60162,11 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
60067
60162
  var import_format16 = require("@ai-matrx/kit/format");
60068
60163
  var import_design_system170 = require("@ai-matrx/design-system");
60069
60164
  var import_data_table25 = require("@ai-matrx/design-system/data-table");
60070
- var import_react336 = require("react");
60165
+ var import_react337 = require("react");
60071
60166
  var import_design_system171 = require("@ai-matrx/design-system");
60072
- var import_react337 = require("@ai-matrx/records/react");
60167
+ var import_react338 = require("@ai-matrx/records/react");
60073
60168
  init_plainWords();
60074
- var import_jsx_runtime191 = require("react/jsx-runtime");
60169
+ var import_jsx_runtime192 = require("react/jsx-runtime");
60075
60170
  var entityTitleColumn = entityNameColumn;
60076
60171
  function shown4(v) {
60077
60172
  if (v === null || v === void 0 || v === "") return "";
@@ -60081,15 +60176,15 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60081
60176
  const choiceColumns = entityChoiceColumns(entity.columns);
60082
60177
  const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
60083
60178
  const title = entityTitleColumn(entity.columns);
60084
- const extra = (0, import_react336.useMemo)(
60179
+ const extra = (0, import_react337.useMemo)(
60085
60180
  () => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
60086
60181
  [cardFields, entity.columns, title, column]
60087
60182
  );
60088
- const [refused, setRefused] = (0, import_react336.useState)(null);
60089
- const [over, setOver] = (0, import_react336.useState)(null);
60090
- if (entity.error) return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
60183
+ const [refused, setRefused] = (0, import_react337.useState)(null);
60184
+ const [over, setOver] = (0, import_react337.useState)(null);
60185
+ if (entity.error) return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
60091
60186
  if (!entity.loading && !column) {
60092
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
60187
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
60093
60188
  }
60094
60189
  if (!column) return null;
60095
60190
  const words2 = column.choices ?? [];
@@ -60107,10 +60202,10 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60107
60202
  const says = await entity.update(id, column, to);
60108
60203
  if (says) setRefused({ to, says });
60109
60204
  };
60110
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: (0, import_design_system171.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
60205
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { className: (0, import_design_system171.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.key, children: lanes.map((lane) => {
60111
60206
  const cards = rowsOf2(lane.key);
60112
60207
  if (lane.key === "" && cards.length === 0) return null;
60113
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
60208
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
60114
60209
  "section",
60115
60210
  {
60116
60211
  "aria-label": lane.label,
@@ -60122,12 +60217,12 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60122
60217
  onDragLeave: writable && lane.key ? () => setOver((o) => o === lane.key ? null : o) : void 0,
60123
60218
  onDrop: writable && lane.key ? (e) => void drop(e, lane.key) : void 0,
60124
60219
  children: [
60125
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
60126
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate font-medium", children: lane.label }),
60127
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
60220
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("header", { className: "flex items-baseline gap-1.5 px-1 text-xs", children: [
60221
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate font-medium", children: lane.label }),
60222
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
60128
60223
  ] }),
60129
- refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
60130
- cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
60224
+ refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
60225
+ cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
60131
60226
  "article",
60132
60227
  {
60133
60228
  draggable: writable,
@@ -60138,8 +60233,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
60138
60233
  className: (0, import_design_system171.cn)("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab"),
60139
60234
  "data-records-entity-card": row._id,
60140
60235
  children: [
60141
- onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
60142
- extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
60236
+ onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row._id), children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate font-medium", children: (title ? entityValueText(title, entityCellValue(row, title)) : shown4(row._id)) || "Untitled" }),
60237
+ extra.map((c) => entityValueText(c, entityCellValue(row, c)) ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "truncate text-muted-foreground", children: entityValueText(c, entityCellValue(row, c)) }, c.key) : null)
60143
60238
  ]
60144
60239
  },
60145
60240
  row._id
@@ -60167,18 +60262,18 @@ function blockOfAnswer(answer, base2, by) {
60167
60262
  return { ...base2, rows };
60168
60263
  }
60169
60264
  function EntityChartBlock({ source, kind: kind2, by, measure, title, where, organization, centerValue, variant, className }) {
60170
- const client = (0, import_react337.useRecordsClient)();
60265
+ const client = (0, import_react338.useRecordsClient)();
60171
60266
  const m = measure ?? { op: "count" };
60172
60267
  const ask2 = JSON.stringify([source.token, by ?? null, m, where ?? null, organization ?? null]);
60173
60268
  const question = (0, import_first_page9.entityChartQuestion)({ by, measure, where, organization });
60174
60269
  const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
60175
60270
  const base2 = { title: title ?? "", kind: kind2, measures, group_by: by ? [by] : [] };
60176
- const seeded = (0, import_react337.useSeededAnswerAt)(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
60177
- const [block, setBlock] = (0, import_react336.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
60178
- const seededFor = (0, import_react336.useRef)(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
60179
- (0, import_react336.useEffect)(() => {
60271
+ const seeded = (0, import_react338.useSeededAnswerAt)(`entity-chart:${ask2}`, (c) => c.drillAsk({ source, question }));
60272
+ const [block, setBlock] = (0, import_react337.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base2, by) : null);
60273
+ const seededFor = (0, import_react337.useRef)(seeded ? { ask: `${ask2}|${kind2}|${title ?? ""}`, at: seeded.at } : null);
60274
+ (0, import_react337.useEffect)(() => {
60180
60275
  const held = seededFor.current;
60181
- if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < import_react337.SEED_FRESH_MS) return;
60276
+ if (held && held.ask === `${ask2}|${kind2}|${title ?? ""}` && Date.now() - held.at < import_react338.SEED_FRESH_MS) return;
60182
60277
  seededFor.current = null;
60183
60278
  let cancelled = false;
60184
60279
  void client.drillAsk({ source, question }).then((answer) => {
@@ -60190,9 +60285,9 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
60190
60285
  };
60191
60286
  }, [client, ask2, kind2, title]);
60192
60287
  if (!block) {
60193
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
60288
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(RecordsSkeleton, { layout: "chart", embedded: variant === "bare", ...className ? { className } : {} });
60194
60289
  }
60195
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60290
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60196
60291
  ChartBlock,
60197
60292
  {
60198
60293
  block,
@@ -60205,7 +60300,7 @@ function EntityChartBlock({ source, kind: kind2, by, measure, title, where, orga
60205
60300
  );
60206
60301
  }
60207
60302
  function EntityTablePage(props) {
60208
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityTablePageBody, { ...props }) });
60303
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityTablePageBody, { ...props }) });
60209
60304
  }
60210
60305
  function EntityTablePageBody({
60211
60306
  source,
@@ -60221,20 +60316,20 @@ function EntityTablePageBody({
60221
60316
  actions,
60222
60317
  className
60223
60318
  }) {
60224
- const [typed2, setTyped] = (0, import_react336.useState)("");
60319
+ const [typed2, setTyped] = (0, import_react337.useState)("");
60225
60320
  const term = searchOverride ?? typed2;
60226
60321
  const entity = useEntityTable(source.token, { pageSize, search: term });
60227
- const [layout, setLayout] = (0, import_react336.useState)(opened);
60228
- (0, import_react336.useEffect)(() => setLayout(opened), [opened]);
60322
+ const [layout, setLayout] = (0, import_react337.useState)(opened);
60323
+ (0, import_react337.useEffect)(() => setLayout(opened), [opened]);
60229
60324
  const choose = (next) => {
60230
60325
  setLayout(next);
60231
60326
  onLayoutChange?.(next);
60232
60327
  };
60233
60328
  const boardable = entityChoiceColumns(entity.columns).length > 0;
60234
60329
  const nameColumn = entityNameColumn(entity.columns);
60235
- const [naming, setNaming] = (0, import_react336.useState)(null);
60236
- const [adding, setAdding] = (0, import_react336.useState)(false);
60237
- const [addRefused, setAddRefused] = (0, import_react336.useState)(null);
60330
+ const [naming, setNaming] = (0, import_react337.useState)(null);
60331
+ const [adding, setAdding] = (0, import_react337.useState)(false);
60332
+ const [addRefused, setAddRefused] = (0, import_react337.useState)(null);
60238
60333
  const add = async () => {
60239
60334
  const name = (naming ?? "").trim();
60240
60335
  if (!name || !nameColumn || adding) return;
@@ -60246,7 +60341,7 @@ function EntityTablePageBody({
60246
60341
  setNaming(null);
60247
60342
  onOpenRecord?.(made.id);
60248
60343
  };
60249
- const [question, setQuestion] = (0, import_react336.useState)(() => questionFromGrouping(void 0));
60344
+ const [question, setQuestion] = (0, import_react337.useState)(() => questionFromGrouping(void 0));
60250
60345
  const { config: drill } = useDrill({
60251
60346
  source,
60252
60347
  question,
@@ -60255,20 +60350,20 @@ function EntityTablePageBody({
60255
60350
  rowNoun: (entity.label ?? "record").toLowerCase(),
60256
60351
  enabled: layout === "grid"
60257
60352
  });
60258
- return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: (0, import_design_system171.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
60259
- presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
60260
- presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
60261
- presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
60262
- /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
60263
- boardable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
60264
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
60265
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
60353
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: (0, import_design_system171.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
60354
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
60355
+ presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
60356
+ presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
60357
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
60358
+ boardable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
60359
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
60360
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
60266
60361
  ] }) : null,
60267
- entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.Button, { size: "sm", variant: "ghost", onClick: () => {
60362
+ entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.Button, { size: "sm", variant: "ghost", onClick: () => {
60268
60363
  setAddRefused(null);
60269
60364
  setNaming("");
60270
60365
  }, children: "New page" }) : null,
60271
- entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60366
+ entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60272
60367
  import_design_system171.Input,
60273
60368
  {
60274
60369
  autoFocus: true,
@@ -60298,9 +60393,9 @@ function EntityTablePageBody({
60298
60393
  actions
60299
60394
  ] })
60300
60395
  ] }) : null,
60301
- addRefused ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system171.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
60302
- entity.error ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
60303
- presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_design_system170.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60396
+ addRefused ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system171.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
60397
+ entity.error ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
60398
+ presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_design_system170.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60304
60399
  import_design_system170.TapTargetSearchGroup,
60305
60400
  {
60306
60401
  surface: "solid",
@@ -60312,8 +60407,8 @@ function EntityTablePageBody({
60312
60407
  }
60313
60408
  }
60314
60409
  ) }) }) : null,
60315
- /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
60316
- entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(
60410
+ /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
60411
+ entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60317
60412
  import_data_table25.MatrxTableCardShowMore,
60318
60413
  {
60319
60414
  shown: entity.rows.length,
@@ -60327,12 +60422,12 @@ function EntityTablePageBody({
60327
60422
  }
60328
60423
 
60329
60424
  // src/TablePageSource.tsx
60330
- var import_jsx_runtime192 = require("react/jsx-runtime");
60425
+ var import_jsx_runtime193 = require("react/jsx-runtime");
60331
60426
  function TablePage2(props) {
60332
- if (props.source === void 0) return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(TablePage, { ...props });
60427
+ if (props.source === void 0) return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePage, { ...props });
60333
60428
  const { source, layout, onLayoutChange, groupBy, onOpenRecord, ...rest } = props;
60334
- if (source.kind === "table") return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(TablePage, { ...rest, tableId: source.id });
60335
- return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
60429
+ if (source.kind === "table") return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePage, { ...rest, tableId: source.id });
60430
+ return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60336
60431
  EntityTablePage,
60337
60432
  {
60338
60433
  source,
@@ -60359,12 +60454,12 @@ init_ObjectActionMenuItems();
60359
60454
  init_objectActionIcons();
60360
60455
 
60361
60456
  // src/DataBindingPicker.tsx
60362
- var import_react338 = require("react");
60457
+ var import_react339 = require("react");
60363
60458
  var import_records70 = require("@ai-matrx/records");
60364
- var import_react339 = require("@ai-matrx/records/react");
60459
+ var import_react340 = require("@ai-matrx/records/react");
60365
60460
  var import_design_system172 = require("@ai-matrx/design-system");
60366
60461
  init_names();
60367
- var import_jsx_runtime193 = require("react/jsx-runtime");
60462
+ var import_jsx_runtime194 = require("react/jsx-runtime");
60368
60463
  var DATA_BINDING_SHAPES = [
60369
60464
  { value: "collection", label: "The whole table" },
60370
60465
  { value: "reference", label: "One record" },
@@ -60431,9 +60526,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
60431
60526
  ...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
60432
60527
  });
60433
60528
  };
60434
- return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-2", children: [
60435
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
60436
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60529
+ return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-2", children: [
60530
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
60531
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60437
60532
  BindingDetails,
60438
60533
  {
60439
60534
  tableId,
@@ -60452,11 +60547,11 @@ function BindingDetails({
60452
60547
  disabled,
60453
60548
  defaultRowLimit
60454
60549
  }) {
60455
- const table = (0, import_react339.useTable)(tableId);
60456
- const fields = (0, import_react339.useFields)(tableId);
60457
- const fieldList = (0, import_react338.useMemo)(() => fields.data ?? [], [fields.data]);
60550
+ const table = (0, import_react340.useTable)(tableId);
60551
+ const fields = (0, import_react340.useFields)(tableId);
60552
+ const fieldList = (0, import_react339.useMemo)(() => fields.data ?? [], [fields.data]);
60458
60553
  const shape = binding.semantic_type;
60459
- (0, import_react338.useEffect)(() => {
60554
+ (0, import_react339.useEffect)(() => {
60460
60555
  if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
60461
60556
  onChange({
60462
60557
  ...binding,
@@ -60497,8 +60592,8 @@ function BindingDetails({
60497
60592
  const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
60498
60593
  const template = binding.transform?.template ?? "";
60499
60594
  const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
60500
- return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-2", children: [
60501
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60595
+ return /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-2", children: [
60596
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60502
60597
  import_design_system172.Button,
60503
60598
  {
60504
60599
  type: "button",
@@ -60512,7 +60607,7 @@ function BindingDetails({
60512
60607
  },
60513
60608
  s.value
60514
60609
  )) }),
60515
- shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60610
+ shape !== "collection" && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60516
60611
  RecordPicker,
60517
60612
  {
60518
60613
  tableId,
@@ -60521,7 +60616,7 @@ function BindingDetails({
60521
60616
  disabled: Boolean(disabled)
60522
60617
  }
60523
60618
  ),
60524
- shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60619
+ shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60525
60620
  import_design_system172.CreatablePicker,
60526
60621
  {
60527
60622
  value: binding.field_key ?? null,
@@ -60535,8 +60630,8 @@ function BindingDetails({
60535
60630
  ariaLabel: "Column"
60536
60631
  }
60537
60632
  ),
60538
- shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-col gap-1", children: [
60539
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60633
+ shape !== "value" && /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-col gap-1", children: [
60634
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60540
60635
  "textarea",
60541
60636
  {
60542
60637
  className: (0, import_design_system172.cn)(
@@ -60548,7 +60643,7 @@ function BindingDetails({
60548
60643
  onChange: (e) => setTemplate(e.target.value)
60549
60644
  }
60550
60645
  ),
60551
- !disabled && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60646
+ !disabled && /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60552
60647
  import_design_system172.Button,
60553
60648
  {
60554
60649
  type: "button",
@@ -60561,9 +60656,9 @@ function BindingDetails({
60561
60656
  p.token
60562
60657
  )) })
60563
60658
  ] }),
60564
- shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
60659
+ shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
60565
60660
  "Up to",
60566
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60661
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60567
60662
  import_design_system172.BasicInput,
60568
60663
  {
60569
60664
  type: "number",
@@ -60580,9 +60675,9 @@ function BindingDetails({
60580
60675
  ),
60581
60676
  "rows"
60582
60677
  ] }),
60583
- /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
60584
- /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
60585
- DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
60678
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
60679
+ /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
60680
+ DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60586
60681
  import_design_system172.Button,
60587
60682
  {
60588
60683
  type: "button",
@@ -60601,15 +60696,15 @@ function BindingDetails({
60601
60696
  }
60602
60697
 
60603
60698
  // src/PickedSummaries.tsx
60604
- var import_react340 = require("@ai-matrx/records/react");
60699
+ var import_react341 = require("@ai-matrx/records/react");
60605
60700
  init_names();
60606
- var import_jsx_runtime194 = require("react/jsx-runtime");
60701
+ var import_jsx_runtime195 = require("react/jsx-runtime");
60607
60702
  function TableNameText({ dataSource, tableId }) {
60608
60703
  const tables = useTablesAnywhere(dataSource);
60609
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60610
- if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60611
- if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load the table's name" });
60612
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
60704
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60705
+ if (tables.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60706
+ if (tables.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load the table's name" });
60707
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
60613
60708
  }
60614
60709
  function ColumnValuesText({
60615
60710
  dataSource,
@@ -60617,38 +60712,38 @@ function ColumnValuesText({
60617
60712
  tableId,
60618
60713
  value
60619
60714
  }) {
60620
- if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60621
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60715
+ if (!tableId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60716
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
60622
60717
  TableScope,
60623
60718
  {
60624
60719
  dataSource,
60625
60720
  userId,
60626
60721
  tableId,
60627
- fallback: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" }),
60628
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this table's columns" }),
60629
- children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(ColumnValuesWords, { tableId, value }) })
60722
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" }),
60723
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this table's columns" }),
60724
+ children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RecordLabelProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(ColumnValuesWords, { tableId, value }) })
60630
60725
  }
60631
60726
  );
60632
60727
  }
60633
60728
  function ColumnValuesWords({ tableId, value }) {
60634
- const fields = (0, import_react340.useFields)(tableId);
60729
+ const fields = (0, import_react341.useFields)(tableId);
60635
60730
  const labels = useRecordLabels(fields.data ?? void 0);
60636
- if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60637
- if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this table's columns" });
60731
+ if (fields.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60732
+ if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this table's columns" });
60638
60733
  const parts = [];
60639
60734
  for (const [key, stored] of Object.entries(value)) {
60640
60735
  if (key.startsWith("_")) continue;
60641
60736
  const field2 = (fields.data ?? []).find((f) => f.key === key);
60642
- if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime194.jsx)("span", { children: ", " }, `${key}-sep`));
60737
+ if (parts.length) parts.push(/* @__PURE__ */ (0, import_jsx_runtime195.jsx)("span", { children: ", " }, `${key}-sep`));
60643
60738
  parts.push(
60644
- /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("span", { children: [
60739
+ /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("span", { children: [
60645
60740
  field2 ? fieldName(field2) : "A removed column",
60646
60741
  " is ",
60647
60742
  field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
60648
60743
  ] }, key)
60649
60744
  );
60650
60745
  }
60651
- return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60746
+ return parts.length ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60652
60747
  }
60653
60748
  function RecordNameText({
60654
60749
  dataSource,
@@ -60656,47 +60751,47 @@ function RecordNameText({
60656
60751
  tableId,
60657
60752
  recordId
60658
60753
  }) {
60659
- if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2014" });
60660
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
60754
+ if (!tableId || !recordId) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2014" });
60755
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(
60661
60756
  TableScope,
60662
60757
  {
60663
60758
  dataSource,
60664
60759
  userId,
60665
60760
  tableId,
60666
- fallback: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" }),
60667
- unavailable: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this record" }),
60668
- children: /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(RecordNameWords, { tableId, recordId })
60761
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" }),
60762
+ unavailable: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this record" }),
60763
+ children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RecordNameWords, { tableId, recordId })
60669
60764
  }
60670
60765
  );
60671
60766
  }
60672
60767
  function RecordNameWords({ tableId, recordId }) {
60673
- const table = (0, import_react340.useTable)(tableId);
60674
- const record = (0, import_react340.useRecord)(recordId);
60675
- if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "\u2026" });
60676
- if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "Couldn't load this record" });
60677
- if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: "A record you cannot open" });
60678
- return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(import_jsx_runtime194.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
60768
+ const table = (0, import_react341.useTable)(tableId);
60769
+ const record = (0, import_react341.useRecord)(recordId);
60770
+ if (record.loading || table.loading) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "\u2026" });
60771
+ if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "Couldn't load this record" });
60772
+ if (!record.data) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: "A record you cannot open" });
60773
+ return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_jsx_runtime195.Fragment, { children: recordName(record.data.document, table.data?.title_field ?? null) });
60679
60774
  }
60680
60775
 
60681
60776
  // src/HeldChangeDecision.tsx
60682
- var import_react341 = require("react");
60683
- var import_react342 = require("@ai-matrx/records/react");
60777
+ var import_react342 = require("react");
60778
+ var import_react343 = require("@ai-matrx/records/react");
60684
60779
  var import_design_system173 = require("@ai-matrx/design-system");
60685
60780
  init_Refusal();
60686
- var import_jsx_runtime195 = require("react/jsx-runtime");
60781
+ var import_jsx_runtime196 = require("react/jsx-runtime");
60687
60782
  function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
60688
- return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_react342.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
60783
+ return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_react343.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
60689
60784
  }
60690
60785
  function Decision({
60691
60786
  approvalId,
60692
60787
  onDecided,
60693
60788
  approveLabel
60694
60789
  }) {
60695
- const client = (0, import_react342.useRecordsClient)();
60696
- const [may, setMay] = (0, import_react341.useState)(null);
60697
- const [busy, setBusy] = (0, import_react341.useState)(null);
60698
- const [error, setError] = (0, import_react341.useState)(null);
60699
- (0, import_react341.useEffect)(() => {
60790
+ const client = (0, import_react343.useRecordsClient)();
60791
+ const [may, setMay] = (0, import_react342.useState)(null);
60792
+ const [busy, setBusy] = (0, import_react342.useState)(null);
60793
+ const [error, setError] = (0, import_react342.useState)(null);
60794
+ (0, import_react342.useEffect)(() => {
60700
60795
  let live = true;
60701
60796
  void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
60702
60797
  if (!live) return;
@@ -60718,13 +60813,13 @@ function Decision({
60718
60813
  if (res.ok) onDecided(approve);
60719
60814
  else setError(res.error);
60720
60815
  };
60721
- if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
60722
- return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
60723
- may ? /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)("div", { className: "flex gap-2", children: [
60724
- /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_design_system173.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
60725
- /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(import_design_system173.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
60726
- ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
60727
- error ? /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RefusalLine, { error }) : null
60816
+ if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
60817
+ return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
60818
+ may ? /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex gap-2", children: [
60819
+ /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_design_system173.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
60820
+ /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_design_system173.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
60821
+ ] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
60822
+ error ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(RefusalLine, { error }) : null
60728
60823
  ] });
60729
60824
  }
60730
60825
 
@@ -60732,16 +60827,16 @@ function Decision({
60732
60827
  init_newTableColumns();
60733
60828
 
60734
60829
  // src/CalendarLinks.tsx
60735
- var import_react343 = require("react");
60830
+ var import_react344 = require("react");
60736
60831
  init_Refusal();
60737
60832
  var import_design_system174 = require("@ai-matrx/design-system");
60738
- var import_jsx_runtime196 = require("react/jsx-runtime");
60833
+ var import_jsx_runtime197 = require("react/jsx-runtime");
60739
60834
  var day = (iso) => iso ? new Date(iso).toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }) : null;
60740
60835
  function CalendarLinks({ port }) {
60741
- const [rows, setRows] = (0, import_react343.useState)(null);
60742
- const [error, setError] = (0, import_react343.useState)(null);
60743
- const [fresh, setFresh] = (0, import_react343.useState)(null);
60744
- const load = (0, import_react343.useCallback)(async () => {
60836
+ const [rows, setRows] = (0, import_react344.useState)(null);
60837
+ const [error, setError] = (0, import_react344.useState)(null);
60838
+ const [fresh, setFresh] = (0, import_react344.useState)(null);
60839
+ const load = (0, import_react344.useCallback)(async () => {
60745
60840
  try {
60746
60841
  setRows(await port.list());
60747
60842
  setError(null);
@@ -60749,7 +60844,7 @@ function CalendarLinks({ port }) {
60749
60844
  setError(asRefusal3(e, "The links could not be read"));
60750
60845
  }
60751
60846
  }, [port]);
60752
- (0, import_react343.useEffect)(() => {
60847
+ (0, import_react344.useEffect)(() => {
60753
60848
  void load();
60754
60849
  }, [load]);
60755
60850
  const act = async (run) => {
@@ -60760,15 +60855,15 @@ function CalendarLinks({ port }) {
60760
60855
  setError(asRefusal3(e, "That didn\u2019t work"));
60761
60856
  }
60762
60857
  };
60763
- if (rows === null && !error) return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
60764
- return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
60765
- error ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(RefusalNotice, { error }) : null,
60766
- rows && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
60767
- rows?.map((row) => /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
60768
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
60769
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "min-w-0", children: [
60770
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("div", { className: "truncate text-sm font-medium", children: row.title }),
60771
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "text-xs text-muted-foreground", children: [
60858
+ if (rows === null && !error) return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { className: "text-sm text-muted-foreground", "data-calendar-links-loading": "", children: "Reading your links\u2026" });
60859
+ return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-col gap-2", "data-calendar-links": "", children: [
60860
+ error ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(RefusalNotice, { error }) : null,
60861
+ rows && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("p", { className: "text-sm text-muted-foreground", children: "No calendar links yet." }) : null,
60862
+ rows?.map((row) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-col gap-2 rounded-md border px-3 py-2", "data-calendar-link-row": row.id, children: [
60863
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
60864
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0", children: [
60865
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "truncate text-sm font-medium", children: row.title }),
60866
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "text-xs text-muted-foreground", children: [
60772
60867
  "Made ",
60773
60868
  day(row.created_at),
60774
60869
  " \xB7 ",
@@ -60777,8 +60872,8 @@ function CalendarLinks({ port }) {
60777
60872
  row.expired ? "Expired" : row.expires_at ? `Expires ${day(row.expires_at)}` : "Never expires"
60778
60873
  ] })
60779
60874
  ] }),
60780
- /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "flex shrink-0 gap-2", children: [
60781
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
60875
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex shrink-0 gap-2", children: [
60876
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
60782
60877
  import_design_system174.Button,
60783
60878
  {
60784
60879
  size: "sm",
@@ -60792,7 +60887,7 @@ function CalendarLinks({ port }) {
60792
60887
  children: "Rotate"
60793
60888
  }
60794
60889
  ),
60795
- /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
60890
+ /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
60796
60891
  import_design_system174.Button,
60797
60892
  {
60798
60893
  size: "sm",
@@ -60808,30 +60903,30 @@ function CalendarLinks({ port }) {
60808
60903
  )
60809
60904
  ] })
60810
60905
  ] }),
60811
- fresh?.id === row.id ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(CalendarLinkOnce, { url: fresh.url }) : null
60906
+ fresh?.id === row.id ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(CalendarLinkOnce, { url: fresh.url }) : null
60812
60907
  ] }, row.id))
60813
60908
  ] });
60814
60909
  }
60815
60910
 
60816
60911
  // src/TemplatePreview.tsx
60817
- var import_react344 = require("react");
60912
+ var import_react345 = require("react");
60818
60913
  var import_memory = require("@ai-matrx/records/memory");
60819
- var import_react345 = require("@ai-matrx/records/react");
60914
+ var import_react346 = require("@ai-matrx/records/react");
60820
60915
  var import_forms7 = require("@ai-matrx/records/forms");
60821
- var import_jsx_runtime197 = require("react/jsx-runtime");
60916
+ var import_jsx_runtime198 = require("react/jsx-runtime");
60822
60917
  function useTemplatePreview(spec, today) {
60823
- return (0, import_react344.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
60918
+ return (0, import_react345.useMemo)(() => (0, import_memory.templatePreview)(spec, today ? { today } : {}), [spec, today]);
60824
60919
  }
60825
60920
  function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
60826
60921
  const preview = useTemplatePreview(spec, today);
60827
- const bound2 = (0, import_react344.useMemo)(() => ({ ...host, sayLevelNeeded: false }), [host]);
60922
+ const bound2 = (0, import_react345.useMemo)(() => ({ ...host, sayLevelNeeded: false }), [host]);
60828
60923
  const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
60829
- const [active, setActive] = (0, import_react344.useState)(first?.id ?? null);
60924
+ const [active, setActive] = (0, import_react345.useState)(first?.id ?? null);
60830
60925
  const table = preview.tables.find((t) => t.id === active) ?? first;
60831
60926
  if (!table) return null;
60832
- return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
60833
- preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
60834
- preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
60927
+ return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
60928
+ preview.tables.length > 1 || aside ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", role: "tablist", "aria-label": "Tables", children: [
60929
+ preview.tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
60835
60930
  "button",
60836
60931
  {
60837
60932
  type: "button",
@@ -60845,28 +60940,28 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
60845
60940
  ].join(" "),
60846
60941
  children: [
60847
60942
  t.name,
60848
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
60943
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: t.rows })
60849
60944
  ]
60850
60945
  },
60851
60946
  t.id
60852
60947
  )),
60853
- aside ? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "ml-auto", children: aside }) : null
60948
+ aside ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "ml-auto", children: aside }) : null
60854
60949
  ] }) : null,
60855
- /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(RecordsMount, { config: preview.config, host: bound2, children: [
60856
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(TablePage, { tableId: table.id }, table.id) }),
60857
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(PreviewForms, { preview, booking }),
60858
- preview.dashboards.length ? /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
60859
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
60860
- preview.dashboards.map((d) => /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
60950
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(RecordsMount, { config: preview.config, host: bound2, children: [
60951
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "min-h-[32rem] min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(TablePage, { tableId: table.id }, table.id) }),
60952
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(PreviewForms, { preview, booking }),
60953
+ preview.dashboards.length ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Dashboards", "data-template-preview-dashboards": preview.dashboards.length, children: [
60954
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Dashboards" }),
60955
+ preview.dashboards.map((d) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card p-3", "data-template-preview-dashboard": d.token, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(DashboardCanvas, { tableId: d.tableId, activeDashboardId: d.id }) }, d.id))
60861
60956
  ] }) : null
60862
60957
  ] })
60863
60958
  ] });
60864
60959
  }
60865
60960
  function PreviewForms({ preview, booking }) {
60866
- const client = (0, import_react345.useRecordsClient)();
60867
- const [forms, setForms] = (0, import_react344.useState)(null);
60868
- const [pages, setPages] = (0, import_react344.useState)([]);
60869
- (0, import_react344.useEffect)(() => {
60961
+ const client = (0, import_react346.useRecordsClient)();
60962
+ const [forms, setForms] = (0, import_react345.useState)(null);
60963
+ const [pages, setPages] = (0, import_react345.useState)([]);
60964
+ (0, import_react345.useEffect)(() => {
60870
60965
  let gone = false;
60871
60966
  void client.forms().then((answered) => {
60872
60967
  if (!gone) setForms(answered.ok ? answered.data.map(import_forms7.formFromSummary) : []);
@@ -60885,29 +60980,29 @@ function PreviewForms({ preview, booking }) {
60885
60980
  };
60886
60981
  }, [client, preview, booking]);
60887
60982
  if (!forms?.length && !pages.length) return null;
60888
- return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
60889
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
60890
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
60891
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
60892
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(FormRunner, { form: f, preview: true })
60983
+ return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { className: "flex min-w-0 flex-col gap-3", "aria-label": "Forms and booking", "data-template-preview-forms": forms?.length ?? 0, children: [
60984
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "text-lg font-semibold tracking-tight", children: "Forms and booking" }),
60985
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "grid min-w-0 gap-4 md:grid-cols-2", children: (forms ?? []).map((f) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-form": f.slug ?? f.id, children: [
60986
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: f.name }),
60987
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FormRunner, { form: f, preview: true })
60893
60988
  ] }, f.id)) }),
60894
- booking ? pages.map((p) => /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
60895
- /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
60989
+ booking ? pages.map((p) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 rounded-xl border border-border bg-card p-4", "data-template-preview-booking": p.id, children: [
60990
+ /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h3", { className: "mb-3 text-sm font-semibold", children: String(p.page["title"] ?? "") }),
60896
60991
  booking(p.page)
60897
60992
  ] }, p.id)) : null
60898
60993
  ] });
60899
60994
  }
60900
60995
 
60901
60996
  // src/SectionCard.tsx
60902
- var import_react346 = require("react");
60997
+ var import_react347 = require("react");
60903
60998
  var import_field_kinds9 = require("@ai-matrx/records/field-kinds");
60904
- var import_react347 = require("@ai-matrx/records/react");
60999
+ var import_react348 = require("@ai-matrx/records/react");
60905
61000
  var import_design_system175 = require("@ai-matrx/design-system");
60906
61001
  var import_icons2 = require("@ai-matrx/design-system/icons");
60907
61002
  var import_field_formats10 = require("@ai-matrx/design-system/field-formats");
60908
61003
  init_names();
60909
61004
  init_plainWords();
60910
- var import_jsx_runtime198 = require("react/jsx-runtime");
61005
+ var import_jsx_runtime199 = require("react/jsx-runtime");
60911
61006
  var NAME_KEYS3 = ["name", "title", "token", "label"];
60912
61007
  var GROUP_KEYS = ["group", "set", "section", "category"];
60913
61008
  var NOTE_KEYS = ["usage_note", "note", "notes", "usage"];
@@ -60951,12 +61046,12 @@ function columnsOf(values) {
60951
61046
  }
60952
61047
  var same4 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
60953
61048
  function useDraft(stored, save) {
60954
- const [draft, setDraft] = (0, import_react346.useState)(null);
60955
- const latest = (0, import_react346.useRef)({ draft, save, stored });
60956
- (0, import_react346.useEffect)(() => {
61049
+ const [draft, setDraft] = (0, import_react347.useState)(null);
61050
+ const latest = (0, import_react347.useRef)({ draft, save, stored });
61051
+ (0, import_react347.useEffect)(() => {
60957
61052
  latest.current = { draft, save, stored };
60958
61053
  });
60959
- (0, import_react346.useEffect)(() => {
61054
+ (0, import_react347.useEffect)(() => {
60960
61055
  if (!draft || draft.phase !== "typing") return;
60961
61056
  const timer = setTimeout(() => {
60962
61057
  const sending = draft.value;
@@ -60968,7 +61063,7 @@ function useDraft(stored, save) {
60968
61063
  }, SAVE_AFTER_MS);
60969
61064
  return () => clearTimeout(timer);
60970
61065
  }, [draft]);
60971
- (0, import_react346.useEffect)(
61066
+ (0, import_react347.useEffect)(
60972
61067
  () => () => {
60973
61068
  const held = latest.current;
60974
61069
  if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
@@ -60980,9 +61075,9 @@ function useDraft(stored, save) {
60980
61075
  }
60981
61076
  function ChecksLine({ checks, onFix }) {
60982
61077
  if (checks.length === 0) return null;
60983
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
60984
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
60985
- check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
61078
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
61079
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
61080
+ check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
60986
61081
  ] }, i)) });
60987
61082
  }
60988
61083
  function ValueCell({
@@ -60999,16 +61094,16 @@ function ValueCell({
60999
61094
  const fix = onFix ? (check) => onFix({ check, row, field: field2 }) : void 0;
61000
61095
  const id = `section-${row.id}-${field2.key}`;
61001
61096
  const withheld = row.hidden?.[field2.key] ?? null;
61002
- if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value: null, withheld });
61097
+ if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value: null, withheld });
61003
61098
  if (format?.id === "color_pair") {
61004
61099
  const pair = (0, import_field_formats10.readColorPair)(value) ?? null;
61005
61100
  const contrast = pair ? colorPairContrast(pair, format) : {};
61006
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
61101
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
61007
61102
  const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
61008
61103
  const ratio = contrast[part];
61009
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0 px-3", children: [
61010
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
61011
- editable ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61104
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0 px-3", children: [
61105
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
61106
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61012
61107
  ColorWell,
61013
61108
  {
61014
61109
  id: `${id}-${part}`,
@@ -61022,10 +61117,10 @@ function ValueCell({
61022
61117
  change(updated.light ? JSON.stringify(updated) : null);
61023
61118
  }
61024
61119
  }
61025
- ) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
61026
- ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ContrastMark, { ratio }) : null
61120
+ ) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
61121
+ ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ContrastMark, { ratio }) : null
61027
61122
  ] }),
61028
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
61123
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
61029
61124
  ] }, part);
61030
61125
  }) });
61031
61126
  }
@@ -61033,21 +61128,21 @@ function ValueCell({
61033
61128
  const pictureFirst = format?.id === "type_style" || format?.id === "shadow";
61034
61129
  if (look && pictureFirst) {
61035
61130
  const { Editor, Preview: Preview2 } = look;
61036
- const view = /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value, withheld: null });
61037
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61038
- editable && Editor ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Popover, { children: [
61039
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
61040
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.PopoverContent, { align: "start", className: "w-80", children: [
61041
- Preview2 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(Preview2, { value, format }) }) : null,
61042
- Editor ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(Editor, { value, format, onChange: change, id, label: fieldName(field2) }) : null
61131
+ const view = /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value, withheld: null });
61132
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61133
+ editable && Editor ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Popover, { children: [
61134
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
61135
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.PopoverContent, { align: "start", className: "w-80", children: [
61136
+ Preview2 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Preview2, { value, format }) }) : null,
61137
+ Editor ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Editor, { value, format, onChange: change, id, label: fieldName(field2) }) : null
61043
61138
  ] })
61044
61139
  ] }) : view,
61045
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks, onFix: fix })
61140
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks, onFix: fix })
61046
61141
  ] });
61047
61142
  }
61048
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61049
- editable ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FieldControl, { field: field2, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(RecordValue, { field: field2, value, withheld: null }),
61050
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ChecksLine, { checks, onFix: fix })
61143
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61144
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(FieldControl, { field: field2, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(RecordValue, { field: field2, value, withheld: null }),
61145
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ChecksLine, { checks, onFix: fix })
61051
61146
  ] });
61052
61147
  }
61053
61148
  function NoteButton({ row, noteField, editable, save }) {
@@ -61055,8 +61150,8 @@ function NoteButton({ row, noteField, editable, save }) {
61055
61150
  const [value, change] = useDraft(stored, (next) => save(noteField, next));
61056
61151
  const text = typeof value === "string" ? value : "";
61057
61152
  const has = text.trim() !== "";
61058
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Popover, { children: [
61059
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61153
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Popover, { children: [
61154
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61060
61155
  "button",
61061
61156
  {
61062
61157
  type: "button",
@@ -61066,10 +61161,10 @@ function NoteButton({ row, noteField, editable, save }) {
61066
61161
  "inline-flex h-7 w-7 items-center justify-center rounded-md hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
61067
61162
  has ? "text-foreground" : "text-muted-foreground"
61068
61163
  ),
61069
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.StickyNoteIcon, { className: "h-4 w-4" })
61164
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.StickyNoteIcon, { className: "h-4 w-4" })
61070
61165
  }
61071
61166
  ) }),
61072
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61167
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61073
61168
  import_design_system175.BasicTextarea,
61074
61169
  {
61075
61170
  "aria-label": fieldName(noteField),
@@ -61103,13 +61198,13 @@ function AddDialog({
61103
61198
  }
61104
61199
  return out;
61105
61200
  };
61106
- const [data, setData] = (0, import_react346.useState)(starters);
61107
- const [name, setName] = (0, import_react346.useState)("");
61108
- const [group, setGroup] = (0, import_react346.useState)(startGroup);
61109
- const [newGroup, setNewGroup] = (0, import_react346.useState)("");
61110
- const [note, setNote] = (0, import_react346.useState)("");
61111
- const [busy, setBusy] = (0, import_react346.useState)(false);
61112
- const [seenOpen, setSeenOpen] = (0, import_react346.useState)(open);
61201
+ const [data, setData] = (0, import_react347.useState)(starters);
61202
+ const [name, setName] = (0, import_react347.useState)("");
61203
+ const [group, setGroup] = (0, import_react347.useState)(startGroup);
61204
+ const [newGroup, setNewGroup] = (0, import_react347.useState)("");
61205
+ const [note, setNote] = (0, import_react347.useState)("");
61206
+ const [busy, setBusy] = (0, import_react347.useState)(false);
61207
+ const [seenOpen, setSeenOpen] = (0, import_react347.useState)(open);
61113
61208
  if (seenOpen !== open) {
61114
61209
  setSeenOpen(open);
61115
61210
  if (open) {
@@ -61127,12 +61222,12 @@ function AddDialog({
61127
61222
  const ready = !busy && name.trim() !== "" && (!groupField || group !== "__new" || newGroup.trim() !== "");
61128
61223
  const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
61129
61224
  const labelCls = "pt-2 text-sm text-muted-foreground";
61130
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.DialogContent, { className: "max-w-md", children: [
61131
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.DialogTitle, { children: [
61225
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.DialogContent, { className: "max-w-md", children: [
61226
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.DialogTitle, { children: [
61132
61227
  "New ",
61133
61228
  noun
61134
61229
  ] }) }),
61135
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
61230
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(
61136
61231
  "form",
61137
61232
  {
61138
61233
  className: "flex flex-col gap-3",
@@ -61148,40 +61243,40 @@ function AddDialog({
61148
61243
  if (ok) onOpenChange(false);
61149
61244
  },
61150
61245
  children: [
61151
- preview ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { children: preview }) : null,
61152
- groupField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61153
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: labelCls, children: fieldName(groupField) }),
61154
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex flex-col gap-2", children: [
61155
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Select, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
61156
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectTrigger, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectValue, {}) }),
61157
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.SelectContent, { children: [
61158
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectItem, { value: "__none", children: "None" }),
61159
- groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.SelectItem, { value: g, children: g }, g)),
61160
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.SelectItem, { value: "__new", children: [
61246
+ preview ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { children: preview }) : null,
61247
+ groupField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61248
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: labelCls, children: fieldName(groupField) }),
61249
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex flex-col gap-2", children: [
61250
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Select, { value: group === UNGROUPED ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED : v), children: [
61251
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectTrigger, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectValue, {}) }),
61252
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.SelectContent, { children: [
61253
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectItem, { value: "__none", children: "None" }),
61254
+ groups.filter((g) => g !== UNGROUPED).map((g) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.SelectItem, { value: g, children: g }, g)),
61255
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.SelectItem, { value: "__new", children: [
61161
61256
  "New ",
61162
61257
  fieldName(groupField).toLowerCase(),
61163
61258
  "\u2026"
61164
61259
  ] })
61165
61260
  ] })
61166
61261
  ] }),
61167
- group === "__new" ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicInput, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
61262
+ group === "__new" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicInput, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
61168
61263
  ] })
61169
61264
  ] }) : null,
61170
- nameField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61171
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
61172
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicInput, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
61265
+ nameField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61266
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
61267
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicInput, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
61173
61268
  ] }) : null,
61174
- values.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61175
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: `section-add-${field2.key}`, className: labelCls, children: fieldName(field2) }),
61176
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(FieldControl, { field: field2, value: data[field2.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field2.key]: v })), id: `section-add-${field2.key}`, asForm: true })
61269
+ values.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61270
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: `section-add-${field2.key}`, className: labelCls, children: fieldName(field2) }),
61271
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(FieldControl, { field: field2, value: data[field2.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field2.key]: v })), id: `section-add-${field2.key}`, asForm: true })
61177
61272
  ] }, field2.key)),
61178
- noteField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: rowCls, children: [
61179
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
61180
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.BasicTextarea, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
61273
+ noteField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: rowCls, children: [
61274
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
61275
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.BasicTextarea, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
61181
61276
  ] }) : null,
61182
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
61183
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
61184
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_design_system175.Button, { type: "submit", disabled: !ready, children: "Add" })
61277
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
61278
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
61279
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system175.Button, { type: "submit", disabled: !ready, children: "Add" })
61185
61280
  ] })
61186
61281
  ]
61187
61282
  }
@@ -61190,12 +61285,12 @@ function AddDialog({
61190
61285
  }
61191
61286
  function SectionCard(props) {
61192
61287
  const { tableId, readOnly, noun = "entry", onFix, className } = props;
61193
- const table = (0, import_react347.useTable)(tableId);
61194
- const fieldsRead = (0, import_react347.useFields)(tableId);
61195
- const page = (0, import_react347.useRecordPage)(tableId, { pageSize: 200 });
61196
- const mutation = (0, import_react347.useRecordMutation)();
61197
- const [adding, setAdding] = (0, import_react346.useState)(null);
61198
- const [failed, setFailed] = (0, import_react346.useState)(null);
61288
+ const table = (0, import_react348.useTable)(tableId);
61289
+ const fieldsRead = (0, import_react348.useFields)(tableId);
61290
+ const page = (0, import_react348.useRecordPage)(tableId, { pageSize: 200 });
61291
+ const mutation = (0, import_react348.useRecordMutation)();
61292
+ const [adding, setAdding] = (0, import_react347.useState)(null);
61293
+ const [failed, setFailed] = (0, import_react347.useState)(null);
61199
61294
  const fields = fieldsRead.data ?? [];
61200
61295
  const cols = sectionColumns(fields, table.data?.title_field, props);
61201
61296
  const nameField = fields.find((f) => f.key === cols.name);
@@ -61216,65 +61311,65 @@ function SectionCard(props) {
61216
61311
  const total = page.data?.total ?? null;
61217
61312
  const refused = table.error ?? fieldsRead.error ?? page.error;
61218
61313
  const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 2.5rem` };
61219
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("section", { "data-records-section-card": "", className: (0, import_design_system175.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
61220
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
61221
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "min-w-0", children: [
61222
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
61223
- props.description ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
61314
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("section", { "data-records-section-card": "", className: (0, import_design_system175.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
61315
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("header", { className: "flex items-start justify-between gap-4 px-6 pt-6 pb-4 sm:px-8 sm:pt-8", children: [
61316
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "min-w-0", children: [
61317
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("h2", { className: "truncate font-serif text-3xl tracking-tight text-foreground", children: title || "\xA0" }),
61318
+ props.description ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "mt-2 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
61224
61319
  ] }),
61225
- mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_design_system175.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
61226
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.PlusIcon, { className: "h-3.5 w-3.5" }),
61320
+ mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_design_system175.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
61321
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.PlusIcon, { className: "h-3.5 w-3.5" }),
61227
61322
  "Add"
61228
61323
  ] }) : null
61229
61324
  ] }),
61230
- refused ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
61231
- cols.group ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
61232
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
61233
- mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61325
+ refused ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-6 text-sm text-muted-foreground sm:px-8", children: refusalSentence(refused) }) : page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "flex flex-col gap-2 px-6 pb-6 sm:px-8", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "h-12 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-8 text-sm text-muted-foreground sm:px-8", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("div", { className: "overflow-x-auto pb-4", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { "data-records-section-group": group.key, className: "mb-6 last:mb-0", children: [
61326
+ cols.group ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex items-center justify-between border-b border-border px-6 py-2.5 sm:px-8", children: [
61327
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-sm font-medium text-foreground", children: group.key || "No group" }),
61328
+ mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61234
61329
  "button",
61235
61330
  {
61236
61331
  type: "button",
61237
61332
  "aria-label": `Add to ${group.key || "no group"}`,
61238
61333
  className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
61239
61334
  onClick: () => setAdding(group.key),
61240
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(import_icons2.PlusIcon, { className: "h-4 w-4" })
61335
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_icons2.PlusIcon, { className: "h-4 w-4" })
61241
61336
  }
61242
61337
  ) : null
61243
61338
  ] }) : null,
61244
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
61245
- /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
61246
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
61247
- columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
61248
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", {})
61339
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
61340
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-sm text-muted-foreground", children: [
61341
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "columnheader", className: "border-r border-border px-6 py-3 sm:px-8", children: nameField ? fieldName(nameField) : "Name" }),
61342
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "columnheader", className: "truncate px-3 py-3", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
61343
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", {})
61249
61344
  ] }),
61250
61345
  group.rows.map((row) => {
61251
61346
  const editable = mayWrite && (0, import_field_kinds9.atLeast)(row.level, "edit_content");
61252
61347
  const rowSave = save(row);
61253
- return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
61254
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
61255
- cells.map((c) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61348
+ return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { role: "row", "data-records-section-row": row.id, style: gridStyle, className: "grid items-center border-b border-border last:border-b-0", children: [
61349
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "cell", className: "truncate self-stretch border-r border-border px-6 py-4 font-mono text-sm text-foreground sm:px-8", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
61350
+ cells.map((c) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61256
61351
  "div",
61257
61352
  {
61258
61353
  role: "cell",
61259
61354
  style: c.part ? { gridColumn: "span 2" } : void 0,
61260
61355
  className: (0, import_design_system175.cn)("min-w-0 py-2.5", c.part ? "" : "px-3"),
61261
- children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(ValueCell, { row, column: c, editable, save: rowSave, onFix })
61356
+ children: /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(ValueCell, { row, column: c, editable, save: rowSave, onFix })
61262
61357
  },
61263
61358
  c.field.key
61264
61359
  )),
61265
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(NoteButton, { row, noteField, editable, save: rowSave }) : null })
61360
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { role: "cell", className: "flex justify-center pr-2", children: noteField ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(NoteButton, { row, noteField, editable, save: rowSave }) : null })
61266
61361
  ] }, row.id);
61267
61362
  })
61268
61363
  ] })
61269
61364
  ] }, group.key || "__ungrouped")) }),
61270
- total !== null && total > rows.length ? /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
61365
+ total !== null && total > rows.length ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("p", { className: "px-6 pb-4 text-sm text-muted-foreground sm:px-8", children: [
61271
61366
  "Showing ",
61272
61367
  rows.length,
61273
61368
  " of ",
61274
61369
  total
61275
61370
  ] }) : null,
61276
- failed ? /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
61277
- /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
61371
+ failed ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("p", { className: "px-6 pb-4 text-sm text-warning-ink sm:px-8", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
61372
+ /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
61278
61373
  AddDialog,
61279
61374
  {
61280
61375
  open: adding !== null,