@ai-matrx/records-ui 0.101.33 → 0.101.34

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.js CHANGED
@@ -5179,6 +5179,7 @@ var EMBEDDED_TABLE_CLASS = [
5179
5179
  "[&_thead_th:last-child]:border-r-0"
5180
5180
  ].join(" ");
5181
5181
  var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
5182
+ var EMBEDDED_PAGE_SIZE = 50;
5182
5183
 
5183
5184
  // src/enumLabels.ts
5184
5185
  function exhaustiveValuesOf() {
@@ -13318,7 +13319,7 @@ function backLinkSentence(column, readers = [], tableName2 = null) {
13318
13319
  }
13319
13320
 
13320
13321
  // src/Grid.tsx
13321
- import { Button as Button42, ConfirmDialog as ConfirmDialog5, cn as cn34, useIsMobile } from "@ai-matrx/design-system";
13322
+ import { Button as Button42, ConfirmDialog as ConfirmDialog5, TapTargetSearchGroup, cn as cn34, useIsMobile } from "@ai-matrx/design-system";
13322
13323
 
13323
13324
  // src/gridAddRow.tsx
13324
13325
  import { useCallback as useCallback16, useEffect as useEffect34, useMemo as useMemo22, useRef as useRef23, useState as useState43 } from "react";
@@ -21099,7 +21100,9 @@ function GridBody({
21099
21100
  onAskWhoChanged,
21100
21101
  embedded = false,
21101
21102
  newRowLabel,
21102
- sortOverride
21103
+ sortOverride,
21104
+ searchOverride,
21105
+ onSearchChange
21103
21106
  }) {
21104
21107
  const toolbarSlot = useTableToolbarSlot();
21105
21108
  const tableCard = useMatrxTableCard();
@@ -21176,6 +21179,14 @@ function GridBody({
21176
21179
  page: 1
21177
21180
  }));
21178
21181
  }, [overrideKey]);
21182
+ const overrideSearchSeen = useRef29(void 0);
21183
+ useEffect47(() => {
21184
+ if (searchOverride === void 0) return;
21185
+ const wanted = searchOverride ?? "";
21186
+ if (overrideSearchSeen.current === wanted) return;
21187
+ overrideSearchSeen.current = wanted;
21188
+ setQuery((held) => held.search === wanted ? held : { ...held, search: wanted, page: 1 });
21189
+ }, [searchOverride]);
21179
21190
  const reportQuery = address?.report;
21180
21191
  useEffect47(() => {
21181
21192
  if (!reportQuery) return;
@@ -21259,7 +21270,32 @@ function GridBody({
21259
21270
  filter: readFilter ?? null,
21260
21271
  version: records.data
21261
21272
  });
21262
- const pageRows = useMemo35(() => manual && !storePaged ? hand.rows ?? [] : storeRows, [manual, storePaged, hand.rows, storeRows]);
21273
+ const embeddedMore = embedded && storePaged;
21274
+ const [appendedRows, setAppendedRows] = useState59([]);
21275
+ const [appending, setAppending] = useState59(false);
21276
+ const askKey2 = JSON.stringify([tableId, searchTerm, pageSort, readFilter ?? null, viewId]);
21277
+ useEffect47(() => setAppendedRows([]), [askKey2]);
21278
+ const pageRows = useMemo35(() => {
21279
+ if (manual && !storePaged) return hand.rows ?? [];
21280
+ if (!embeddedMore || appendedRows.length === 0) return storeRows;
21281
+ const seen = new Set(storeRows.map((row) => row.id));
21282
+ return [...storeRows, ...appendedRows.filter((row) => !seen.has(row.id))];
21283
+ }, [manual, storePaged, hand.rows, storeRows, embeddedMore, appendedRows]);
21284
+ const showMoreRows = useCallback25(async () => {
21285
+ if (appending || !embeddedMore) return;
21286
+ setAppending(true);
21287
+ const asked3 = await client.listPage({
21288
+ table_id: tableId,
21289
+ ...readFilter ? { filter: readFilter } : {},
21290
+ search: searchTerm.trim() === "" ? null : searchTerm.trim(),
21291
+ sort: pageSort,
21292
+ view_id: manual && pageSort.length === 0 ? viewId : null,
21293
+ limit: EMBEDDED_PAGE_SIZE,
21294
+ offset: pageRows.length
21295
+ });
21296
+ setAppending(false);
21297
+ if (asked3.ok) setAppendedRows((held) => [...held, ...asked3.data.rows]);
21298
+ }, [appending, embeddedMore, client, tableId, readFilter, searchTerm, pageSort, manual, viewId, pageRows.length]);
21263
21299
  const added = useAddedRows({
21264
21300
  tableId,
21265
21301
  enabled: merged,
@@ -22439,6 +22475,21 @@ function GridBody({
22439
22475
  const tableToolbar = useMemo35(
22440
22476
  () => ({
22441
22477
  search: !embedded,
22478
+ // EMBEDDED: Notion's magnifier — the design system's own search group, a button that
22479
+ // opens into a field. It is the same `query.search` the store's read asks.
22480
+ ...embedded ? {
22481
+ customSearch: /* @__PURE__ */ jsx68(
22482
+ TapTargetSearchGroup,
22483
+ {
22484
+ placeholder: "Search",
22485
+ value: searchOverride ?? query.search,
22486
+ onValueChange: (term) => {
22487
+ setQuery((held) => ({ ...held, search: term, page: 1 }));
22488
+ onSearchChange?.(term);
22489
+ }
22490
+ }
22491
+ )
22492
+ } : {},
22442
22493
  // The host (Spaces) has its own Properties menu: an embedded table draws no Columns button.
22443
22494
  ...embedded ? { columns: false } : {},
22444
22495
  searchPlaceholder: "Search records",
@@ -22639,7 +22690,9 @@ function GridBody({
22639
22690
  sheetExtras,
22640
22691
  tableId,
22641
22692
  noun,
22642
- embedded
22693
+ embedded,
22694
+ searchOverride,
22695
+ onSearchChange
22643
22696
  ]
22644
22697
  );
22645
22698
  const labelOfField = useCallback25(
@@ -22845,7 +22898,7 @@ function GridBody({
22845
22898
  pageSize,
22846
22899
  query: tableQuery,
22847
22900
  ...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
22848
- ...classicInCard ? { hidePagination: true } : {},
22901
+ ...classicInCard || embeddedMore ? { hidePagination: true } : {},
22849
22902
  ...embedded ? { appearance: "embedded" } : {},
22850
22903
  tableClassName: cn34(
22851
22904
  !look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
@@ -22950,7 +23003,15 @@ function GridBody({
22950
23003
  onShowMore: () => setCardExtraRows((extra) => extra + pageSize)
22951
23004
  }
22952
23005
  ) : null
22953
- ) : storePaged || embedded ? null : /* @__PURE__ */ jsx68(
23006
+ ) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ jsx68(
23007
+ MatrxTableCardShowMore,
23008
+ {
23009
+ shown: pageRows.length,
23010
+ total: records.data.total,
23011
+ busy: appending,
23012
+ onShowMore: () => void showMoreRows()
23013
+ }
23014
+ ) : null : storePaged || embedded ? null : /* @__PURE__ */ jsx68(
22954
23015
  Pager,
22955
23016
  {
22956
23017
  page,
@@ -23101,7 +23162,7 @@ import { MatrxTableCard, MatrxTableCardEmpty, TABLE_CARD_DEFAULT_INITIAL_ROWS }
23101
23162
  import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable7 } from "@ai-matrx/records/react";
23102
23163
 
23103
23164
  // src/entitySource.tsx
23104
- import { useCallback as useCallback26, useEffect as useEffect48, useMemo as useMemo36, useState as useState60 } from "react";
23165
+ import { useCallback as useCallback26, useEffect as useEffect48, useMemo as useMemo36, useRef as useRef30, useState as useState60 } from "react";
23105
23166
  import { MatrxDataTable as MatrxDataTable2 } from "@ai-matrx/design-system/data-table";
23106
23167
  import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
23107
23168
  import { jsx as jsx69 } from "react/jsx-runtime";
@@ -23109,6 +23170,8 @@ function useEntitySource(token, options = {}) {
23109
23170
  const client = useRecordsClient38();
23110
23171
  const limit = options.limit ?? 50;
23111
23172
  const [tick, setTick] = useState60(0);
23173
+ const held = useRef30(0);
23174
+ const [loadingMore, setLoadingMore] = useState60(false);
23112
23175
  const [state, setState] = useState60({
23113
23176
  label: null,
23114
23177
  columns: [],
@@ -23121,7 +23184,7 @@ function useEntitySource(token, options = {}) {
23121
23184
  useEffect48(() => {
23122
23185
  let cancelled = false;
23123
23186
  const source = { kind: "entity", token };
23124
- void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit })]).then(
23187
+ void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit: Math.max(limit, held.current) })]).then(
23125
23188
  ([def, page]) => {
23126
23189
  if (cancelled) return;
23127
23190
  if (!def.ok) return setState((s) => ({ ...s, loading: false, error: refusalSentence(def.error) || "This table could not be read." }));
@@ -23129,6 +23192,7 @@ function useEntitySource(token, options = {}) {
23129
23192
  const api = def.data.api;
23130
23193
  const shown4 = new Set(page.data.columns instanceof Array ? page.data.columns.filter((c) => typeof c === "string") : []);
23131
23194
  const columns = (api?.columns ?? []).filter((c) => c.api_name !== "id" && (shown4.size === 0 || shown4.has(c.api_name) || shown4.has(c.lookup?.via ?? "")));
23195
+ held.current = (page.data.rows ?? []).length;
23132
23196
  setState({
23133
23197
  label: api?.label ?? def.data.label ?? token,
23134
23198
  columns,
@@ -23172,7 +23236,22 @@ function useEntitySource(token, options = {}) {
23172
23236
  },
23173
23237
  [client, token]
23174
23238
  );
23175
- return { ...state, write, create, reload };
23239
+ const loadMore = useCallback26(async () => {
23240
+ if (loadingMore) return;
23241
+ setLoadingMore(true);
23242
+ const source = { kind: "entity", token };
23243
+ const next = await client.drillRows({ source, limit, offset: held.current });
23244
+ setLoadingMore(false);
23245
+ if (!next.ok) return;
23246
+ const more = next.data.rows ?? [];
23247
+ held.current += more.length;
23248
+ setState((s) => {
23249
+ const seen = new Set(s.rows.map((r) => r.id));
23250
+ return { ...s, rows: [...s.rows, ...more.filter((r) => !seen.has(r.id))] };
23251
+ });
23252
+ }, [client, token, limit, loadingMore]);
23253
+ const hasMore = !state.loading && state.total > state.rows.length;
23254
+ return { ...state, write, create, reload, loadMore, hasMore, loadingMore };
23176
23255
  }
23177
23256
  function entityValueText(column, v) {
23178
23257
  if (v === null || v === void 0 || v === "") return "";
@@ -23202,7 +23281,7 @@ function entityTableColumns(columns) {
23202
23281
  ...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
23203
23282
  }));
23204
23283
  }
23205
- function EntityGrid({ entity, pageSize, drill }) {
23284
+ function EntityGrid({ entity, pageSize, drill, embedded }) {
23206
23285
  const columns = useMemo36(() => entityTableColumns(entity.columns), [entity.columns]);
23207
23286
  return /* @__PURE__ */ jsx69(
23208
23287
  MatrxDataTable2,
@@ -23212,7 +23291,8 @@ function EntityGrid({ entity, pageSize, drill }) {
23212
23291
  getRowId: (row) => String(row.id),
23213
23292
  isLoading: entity.loading,
23214
23293
  ...pageSize ? { pageSize } : {},
23215
- ...drill ? { drill } : {}
23294
+ ...drill ? { drill } : {},
23295
+ ...embedded ? { appearance: "embedded", hidePagination: true } : {}
23216
23296
  }
23217
23297
  );
23218
23298
  }
@@ -23807,7 +23887,7 @@ import { Badge as Badge11, Button as Button48, Skeleton as Skeleton5, cn as cn39
23807
23887
 
23808
23888
  // src/BookingBuilder.tsx
23809
23889
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
23810
- import { useCallback as useCallback28, useEffect as useEffect51, useMemo as useMemo38, useRef as useRef30, useState as useState63 } from "react";
23890
+ import { useCallback as useCallback28, useEffect as useEffect51, useMemo as useMemo38, useRef as useRef31, useState as useState63 } from "react";
23811
23891
  import { useFields as useFields11, useRecordsClient as useRecordsClient41, useTable as useTable9 } from "@ai-matrx/records/react";
23812
23892
  import { formatDurationMinutes } from "@ai-matrx/kit/format";
23813
23893
  import {
@@ -23944,7 +24024,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
23944
24024
  const [confirmation, setConfirmation] = useState63("");
23945
24025
  const [offer, setOffer] = useState63(null);
23946
24026
  const [formId, setFormId] = useState63(bookingId ?? null);
23947
- const madeRef = useRef30(null);
24027
+ const madeRef = useRef31(null);
23948
24028
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
23949
24029
  const askable = useMemo38(
23950
24030
  () => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
@@ -24014,7 +24094,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
24014
24094
  }),
24015
24095
  [timezone, minutes, buffer, lead, perDay, days, windows]
24016
24096
  );
24017
- const startedAsking = useRef30(false);
24097
+ const startedAsking = useRef31(false);
24018
24098
  useEffect51(() => {
24019
24099
  if (startedAsking.current || !loaded || existing || formId || !fields.data) return;
24020
24100
  startedAsking.current = true;
@@ -26354,7 +26434,7 @@ function Clause({
26354
26434
  }
26355
26435
 
26356
26436
  // src/TableRename.tsx
26357
- import { useCallback as useCallback33, useEffect as useEffect57, useRef as useRef31, useState as useState70 } from "react";
26437
+ import { useCallback as useCallback33, useEffect as useEffect57, useRef as useRef32, useState as useState70 } from "react";
26358
26438
  import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient48 } from "@ai-matrx/records/react";
26359
26439
  import {
26360
26440
  Button as Button53,
@@ -26376,7 +26456,7 @@ function tableNameProblem(typed2) {
26376
26456
  }
26377
26457
  function useRenameFromMenu() {
26378
26458
  const [open, setOpen] = useState70(false);
26379
- const asked3 = useRef31(false);
26459
+ const asked3 = useRef32(false);
26380
26460
  const ask = useCallback33(() => {
26381
26461
  asked3.current = true;
26382
26462
  window.setTimeout(() => setOpen(true), 0);
@@ -26402,8 +26482,8 @@ function TableRenameDialog({
26402
26482
  const [typed2, setTyped] = useState70(name);
26403
26483
  const [busy, setBusy] = useState70(false);
26404
26484
  const [refused, setRefused] = useState70(null);
26405
- const box = useRef31(null);
26406
- const openedAt = useRef31(null);
26485
+ const box = useRef32(null);
26486
+ const openedAt = useRef32(null);
26407
26487
  useEffect57(() => {
26408
26488
  if (!open) return;
26409
26489
  openedAt.current = readTableVersionNow(client, tableId);
@@ -26495,7 +26575,7 @@ function TableRenameDialog({
26495
26575
  }
26496
26576
 
26497
26577
  // src/TableSettings.tsx
26498
- import { useEffect as useEffect62, useRef as useRef32, useState as useState76 } from "react";
26578
+ import { useEffect as useEffect62, useRef as useRef33, useState as useState76 } from "react";
26499
26579
 
26500
26580
  // src/ArchiveDeliberately.tsx
26501
26581
  import { useState as useState71 } from "react";
@@ -27140,8 +27220,8 @@ function TableSettings({
27140
27220
  live = false;
27141
27221
  };
27142
27222
  }, [tableId]);
27143
- const askToArchiveRef = useRef32(null);
27144
- const archiveAskedSeen = useRef32(0);
27223
+ const askToArchiveRef = useRef33(null);
27224
+ const archiveAskedSeen = useRef33(0);
27145
27225
  const panelReady = Boolean(table.data && fields.data && rights.structure);
27146
27226
  useEffect62(() => {
27147
27227
  const ask = askToArchiveRef.current;
@@ -27547,7 +27627,7 @@ function ShareForSomebodyElse({
27547
27627
  }
27548
27628
 
27549
27629
  // src/RecordBody.tsx
27550
- import { useEffect as useEffect65, useRef as useRef33, useState as useState79 } from "react";
27630
+ import { useEffect as useEffect65, useRef as useRef34, useState as useState79 } from "react";
27551
27631
  import { Button as Button60, cn as cn46 } from "@ai-matrx/design-system";
27552
27632
  import { newerKindOf as newerKindOf5 } from "@ai-matrx/records";
27553
27633
  import { tableShapeChanged as tableShapeChanged10, useFieldMutation as useFieldMutation5, useFields as useFields14, useRecord as useRecord2, useRecordsClient as useRecordsClient55, useTable as useTable12 } from "@ai-matrx/records/react";
@@ -27584,9 +27664,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
27584
27664
  const raw = record.data?.document?.[field2.key];
27585
27665
  const stored = typeof raw === "string" ? raw : "";
27586
27666
  const [saving, setSaving] = useState79({ phase: "idle" });
27587
- const lastSaved = useRef33(null);
27588
- const waiting = useRef33(null);
27589
- const timer = useRef33(null);
27667
+ const lastSaved = useRef34(null);
27668
+ const waiting = useRef34(null);
27669
+ const timer = useRef34(null);
27590
27670
  if (lastSaved.current === null && record.data) lastSaved.current = stored;
27591
27671
  const write = async () => {
27592
27672
  if (timer.current) clearTimeout(timer.current);
@@ -27607,7 +27687,7 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
27607
27687
  setSaving({ phase: "refused", error: answered.error });
27608
27688
  }
27609
27689
  };
27610
- const writeRef = useRef33(write);
27690
+ const writeRef = useRef34(write);
27611
27691
  writeRef.current = write;
27612
27692
  useEffect65(
27613
27693
  () => () => {
@@ -28026,7 +28106,7 @@ import {
28026
28106
  import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
28027
28107
 
28028
28108
  // src/Pipeline.tsx
28029
- import { useCallback as useCallback36, useEffect as useEffect67, useMemo as useMemo47, useRef as useRef34, useState as useState83 } from "react";
28109
+ import { useCallback as useCallback36, useEffect as useEffect67, useMemo as useMemo47, useRef as useRef35, useState as useState83 } from "react";
28030
28110
  import {
28031
28111
  mayDrag,
28032
28112
  useFields as useFields17,
@@ -28377,9 +28457,9 @@ function PipelineBoard({
28377
28457
  const [waiting, setWaiting] = useState83(/* @__PURE__ */ new Map());
28378
28458
  const [dragging, setDragging] = useState83(null);
28379
28459
  const [over, setOver] = useState83(null);
28380
- const alive = useRef34(true);
28460
+ const alive = useRef35(true);
28381
28461
  const [selected, setSelected] = useState83(/* @__PURE__ */ new Set());
28382
- const anchor = useRef34(null);
28462
+ const anchor = useRef35(null);
28383
28463
  const [batch, setBatch] = useState83(/* @__PURE__ */ new Map());
28384
28464
  const [batchSaid, setBatchSaid] = useState83(null);
28385
28465
  const [batchError, setBatchError] = useState83(null);
@@ -28413,7 +28493,7 @@ function PipelineBoard({
28413
28493
  void reload();
28414
28494
  }, [reload]);
28415
28495
  const versions = useRecordVersions(client, rows, (r) => mayDrag(r.level));
28416
- const versionsRef = useRef34(versions);
28496
+ const versionsRef = useRef35(versions);
28417
28497
  versionsRef.current = versions;
28418
28498
  const drawnVersion = (id) => versionsRef.current.seen(id);
28419
28499
  const stageKey = definition?.stage_field ?? null;
@@ -29002,13 +29082,13 @@ function batchSentence(moved, waiting, notMoved, label) {
29002
29082
  }
29003
29083
 
29004
29084
  // src/CalendarView.tsx
29005
- import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef36, useState as useState85 } from "react";
29085
+ import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef37, useState as useState85 } from "react";
29006
29086
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
29007
29087
  import { Button as Button64, Select as Select13, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn50 } from "@ai-matrx/design-system";
29008
29088
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
29009
29089
 
29010
29090
  // src/recordMoves.tsx
29011
- import { useCallback as useCallback37, useEffect as useEffect68, useMemo as useMemo48, useRef as useRef35, useState as useState84 } from "react";
29091
+ import { useCallback as useCallback37, useEffect as useEffect68, useMemo as useMemo48, useRef as useRef36, useState as useState84 } from "react";
29012
29092
  import { useRecordsClient as useRecordsClient60 } from "@ai-matrx/records/react";
29013
29093
  import { Button as Button63 } from "@ai-matrx/design-system";
29014
29094
  import { Fragment as Fragment36, jsx as jsx98, jsxs as jsxs88 } from "react/jsx-runtime";
@@ -29087,7 +29167,7 @@ function useRecordMoves({
29087
29167
  [client, undo, onMoved]
29088
29168
  );
29089
29169
  const offering = Boolean(undo.notice);
29090
- const undoRef = useRef35(undo);
29170
+ const undoRef = useRef36(undo);
29091
29171
  undoRef.current = undo;
29092
29172
  useEffect68(() => {
29093
29173
  if (!offering || typeof document === "undefined") return;
@@ -29527,7 +29607,7 @@ function CalendarView({
29527
29607
  }, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
29528
29608
  const titleOf = (row) => cardWords(row, titleField, labels).text;
29529
29609
  const rowById = (id) => rows.find((r) => r.id === id);
29530
- const frame = useRef36(null);
29610
+ const frame = useRef37(null);
29531
29611
  const [focusOn, setFocusOn] = useState85(null);
29532
29612
  useEffect69(() => {
29533
29613
  if (!focusOn) return;
@@ -29576,7 +29656,7 @@ function CalendarView({
29576
29656
  const made = await moves.create({ tableId, data, label: `New record on ${where}` });
29577
29657
  if (made) onOpenRecord?.(made);
29578
29658
  };
29579
- const grabOffset = useRef36(0);
29659
+ const grabOffset = useRef37(0);
29580
29660
  const [resizing, setResizing] = useState85(null);
29581
29661
  const [ghost, setGhost] = useState85(null);
29582
29662
  useEffect69(() => {
@@ -30125,7 +30205,7 @@ function WeekHours({
30125
30205
  render,
30126
30206
  overlay
30127
30207
  }) {
30128
- const frame = useRef36(null);
30208
+ const frame = useRef37(null);
30129
30209
  useEffect69(() => {
30130
30210
  if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
30131
30211
  }, []);
@@ -30172,7 +30252,7 @@ function weekHeading(first) {
30172
30252
  }
30173
30253
 
30174
30254
  // src/TimelineView.tsx
30175
- import { useEffect as useEffect70, useMemo as useMemo51, useRef as useRef37, useState as useState86 } from "react";
30255
+ import { useEffect as useEffect70, useMemo as useMemo51, useRef as useRef38, useState as useState86 } from "react";
30176
30256
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
30177
30257
  import { Button as Button65, Select as Select14, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn51 } from "@ai-matrx/design-system";
30178
30258
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
@@ -30425,10 +30505,10 @@ function TimelineView({
30425
30505
  const width = days * px;
30426
30506
  const scale = useMemo51(() => scaleOf(from, days, zoom), [from, days, zoom]);
30427
30507
  const xOf = (day) => daysBetween(from, day) * px;
30428
- const scroller = useRef37(null);
30508
+ const scroller = useRef38(null);
30429
30509
  const grouped = Boolean(groupField);
30430
30510
  const [scrollX, setScrollX] = useState86(0);
30431
- const frame = useRef37(null);
30511
+ const frame = useRef38(null);
30432
30512
  const onScroll = () => {
30433
30513
  if (frame.current !== null) return;
30434
30514
  frame.current = requestAnimationFrame(() => {
@@ -31356,10 +31436,12 @@ function ViewSwitcher({
31356
31436
  footer,
31357
31437
  embedded,
31358
31438
  sortOverride,
31439
+ searchOverride,
31440
+ onSearchChange,
31359
31441
  newRowLabel,
31360
31442
  className
31361
31443
  }) {
31362
- const pageSize = pageSizeAsked ?? (embedded ? 50 : 200);
31444
+ const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 200);
31363
31445
  const toolbarSlot = useTableToolbarSlot();
31364
31446
  const [layout, setLayout] = useState89(view.layout);
31365
31447
  const hostLayouts = useRecordsUi().layouts ?? [];
@@ -31421,6 +31503,8 @@ function ViewSwitcher({
31421
31503
  ...footer ? { footer } : {},
31422
31504
  ...embedded ? { embedded } : {},
31423
31505
  ...sortOverride !== void 0 ? { sortOverride } : {},
31506
+ ...searchOverride !== void 0 ? { searchOverride } : {},
31507
+ ...onSearchChange ? { onSearchChange } : {},
31424
31508
  ...newRowLabel ? { newRowLabel } : {},
31425
31509
  ...filter ? { filter } : {},
31426
31510
  ...onClearFilter ? { onClearFilter } : {},
@@ -32683,9 +32767,9 @@ import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react"
32683
32767
  import { Badge as Badge14, Button as Button70, Input as Input6, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Skeleton as Skeleton14, cn as cn56 } from "@ai-matrx/design-system";
32684
32768
 
32685
32769
  // src/seedOnce.ts
32686
- import { useCallback as useCallback40, useRef as useRef38 } from "react";
32770
+ import { useCallback as useCallback40, useRef as useRef39 } from "react";
32687
32771
  function useSeedGuard() {
32688
- const claimed = useRef38(/* @__PURE__ */ new Set());
32772
+ const claimed = useRef39(/* @__PURE__ */ new Set());
32689
32773
  return useCallback40((name) => {
32690
32774
  if (claimed.current.has(name)) return false;
32691
32775
  claimed.current.add(name);
@@ -33003,7 +33087,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
33003
33087
  }
33004
33088
 
33005
33089
  // src/ProposalRow.tsx
33006
- import { useEffect as useEffect77, useRef as useRef39, useState as useState93 } from "react";
33090
+ import { useEffect as useEffect77, useRef as useRef40, useState as useState93 } from "react";
33007
33091
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
33008
33092
  import { Badge as Badge15, Button as Button71, cn as cn57 } from "@ai-matrx/design-system";
33009
33093
  import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
@@ -33021,7 +33105,7 @@ function ProposalRow({
33021
33105
  const [settled, setSettled] = useState93(outcome ?? null);
33022
33106
  const [busy, setBusy] = useState93(false);
33023
33107
  const [confirming, setConfirming] = useState93(false);
33024
- const drawnVersion = useRef39(null);
33108
+ const drawnVersion = useRef40(null);
33025
33109
  const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
33026
33110
  useEffect77(() => {
33027
33111
  if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = readVersionNow(client, change.record);
@@ -33111,7 +33195,7 @@ function ProposalRow({
33111
33195
  }
33112
33196
 
33113
33197
  // src/ActionInbox.tsx
33114
- import { useCallback as useCallback43, useEffect as useEffect79, useMemo as useMemo55, useRef as useRef40, useState as useState95 } from "react";
33198
+ import { useCallback as useCallback43, useEffect as useEffect79, useMemo as useMemo55, useRef as useRef41, useState as useState95 } from "react";
33115
33199
  import { useRecordsClient as useRecordsClient68 } from "@ai-matrx/records/react";
33116
33200
  import { Badge as Badge17, Button as Button73, Checkbox as Checkbox11, Skeleton as Skeleton16, cn as cn59 } from "@ai-matrx/design-system";
33117
33201
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
@@ -34016,9 +34100,9 @@ function ActionInbox({
34016
34100
  const [outcome, setOutcome] = useState95({});
34017
34101
  const [busy, setBusy] = useState95(null);
34018
34102
  const [cursor, setCursor] = useState95(0);
34019
- const listRef = useRef40(null);
34103
+ const listRef = useRef41(null);
34020
34104
  const [selected, setSelected] = useState95(/* @__PURE__ */ new Set());
34021
- const anchor = useRef40(null);
34105
+ const anchor = useRef41(null);
34022
34106
  const [deciding, setDeciding] = useState95(false);
34023
34107
  const [batchSaid, setBatchSaid] = useState95(null);
34024
34108
  const [view, setView] = useState95("inbox");
@@ -34082,9 +34166,9 @@ function ActionInbox({
34082
34166
  [client, load]
34083
34167
  );
34084
34168
  const [held, setHeld] = useState95({});
34085
- const holds2 = useRef40(/* @__PURE__ */ new Map());
34086
- const lastHold = useRef40(null);
34087
- const holdSeq = useRef40(0);
34169
+ const holds2 = useRef41(/* @__PURE__ */ new Map());
34170
+ const lastHold = useRef41(null);
34171
+ const holdSeq = useRef41(0);
34088
34172
  const [, tick] = useState95(0);
34089
34173
  useEffect79(() => {
34090
34174
  if (Object.keys(held).length === 0) return;
@@ -34141,7 +34225,7 @@ function ActionInbox({
34141
34225
  flush();
34142
34226
  };
34143
34227
  }, []);
34144
- const resumed = useRef40(false);
34228
+ const resumed = useRef41(false);
34145
34229
  useEffect79(() => {
34146
34230
  if (resumed.current || items === null || view !== "inbox") return;
34147
34231
  resumed.current = true;
@@ -34762,7 +34846,7 @@ function ActionInbox({
34762
34846
  }
34763
34847
 
34764
34848
  // src/HistoryPanel.tsx
34765
- import { useCallback as useCallback44, useEffect as useEffect80, useRef as useRef41, useState as useState96 } from "react";
34849
+ import { useCallback as useCallback44, useEffect as useEffect80, useRef as useRef42, useState as useState96 } from "react";
34766
34850
  import {
34767
34851
  useFields as useFields20,
34768
34852
  useRecordChangeRevision,
@@ -34782,9 +34866,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
34782
34866
  const [error, setError] = useState96(null);
34783
34867
  const [open, setOpen] = useState96(null);
34784
34868
  const [pending, setPending] = useState96({ phase: "idle" });
34785
- const seenAtPreview = useRef41(null);
34869
+ const seenAtPreview = useRef42(null);
34786
34870
  const [said, setSaid] = useState96(null);
34787
- const listRef = useRef41(null);
34871
+ const listRef = useRef42(null);
34788
34872
  const changed = useRecordChangeRevision(recordId);
34789
34873
  const load = useCallback44(async () => {
34790
34874
  const answered = await client.recordHistory({ record_id: recordId });
@@ -35077,7 +35161,7 @@ function say(value, field2) {
35077
35161
  }
35078
35162
 
35079
35163
  // src/CommentThread.tsx
35080
- import { useCallback as useCallback45, useEffect as useEffect81, useMemo as useMemo56, useRef as useRef42, useState as useState97 } from "react";
35164
+ import { useCallback as useCallback45, useEffect as useEffect81, useMemo as useMemo56, useRef as useRef43, useState as useState97 } from "react";
35081
35165
  import {
35082
35166
  useFields as useFields21,
35083
35167
  useRecordsClient as useRecordsClient70,
@@ -35101,7 +35185,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
35101
35185
  const [people, setPeople] = useState97([]);
35102
35186
  const [mentionQuery, setMentionQuery] = useState97(null);
35103
35187
  const [picked, setPicked] = useState97([]);
35104
- const box = useRef42(null);
35188
+ const box = useRef43(null);
35105
35189
  const load = useCallback45(async () => {
35106
35190
  const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
35107
35191
  if (!answered.ok) {
@@ -35321,7 +35405,7 @@ function Line({
35321
35405
  }
35322
35406
 
35323
35407
  // src/FieldHistoryPanel.tsx
35324
- import { useCallback as useCallback46, useEffect as useEffect82, useRef as useRef43, useState as useState98 } from "react";
35408
+ import { useCallback as useCallback46, useEffect as useEffect82, useRef as useRef44, useState as useState98 } from "react";
35325
35409
  import {
35326
35410
  useFields as useFields22,
35327
35411
  useRecordsClient as useRecordsClient71,
@@ -35345,7 +35429,7 @@ function FieldHistoryPanel({
35345
35429
  const [rows, setRows] = useState98(null);
35346
35430
  const [error, setError] = useState98(null);
35347
35431
  const [pending, setPending] = useState98({ phase: "idle" });
35348
- const seenAtPreview = useRef43(null);
35432
+ const seenAtPreview = useRef44(null);
35349
35433
  const [said, setSaid] = useState98(null);
35350
35434
  const load = useCallback46(async () => {
35351
35435
  const answered = await client.fieldHistory(
@@ -35593,7 +35677,7 @@ function submissionStamp(args) {
35593
35677
  }
35594
35678
 
35595
35679
  // src/PortalBuilder.tsx
35596
- import { useCallback as useCallback47, useEffect as useEffect83, useMemo as useMemo57, useRef as useRef44, useState as useState99 } from "react";
35680
+ import { useCallback as useCallback47, useEffect as useEffect83, useMemo as useMemo57, useRef as useRef45, useState as useState99 } from "react";
35597
35681
  import { useRecordsClient as useRecordsClient72, useTables as useTables4 } from "@ai-matrx/records/react";
35598
35682
  import { BasicInput as BasicInput23, Button as Button77, Checkbox as Checkbox12, Label as Label18, Separator as Separator10, Skeleton as Skeleton20, cn as cn63 } from "@ai-matrx/design-system";
35599
35683
  import { Fragment as Fragment44, jsx as jsx115, jsxs as jsxs104 } from "react/jsx-runtime";
@@ -35683,7 +35767,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
35683
35767
  if (on) void loadFields(t.id);
35684
35768
  }
35685
35769
  const [linking, setLinking] = useState99(null);
35686
- const linkingNow = useRef44(null);
35770
+ const linkingNow = useRef45(null);
35687
35771
  async function addLinkBack(id) {
35688
35772
  const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
35689
35773
  if (!clientTableId || !clients) return;
@@ -35710,7 +35794,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
35710
35794
  linkingNow.current = null;
35711
35795
  setLinking(null);
35712
35796
  }
35713
- const autoLinked = useRef44(/* @__PURE__ */ new Set());
35797
+ const autoLinked = useRef45(/* @__PURE__ */ new Set());
35714
35798
  useEffect83(() => {
35715
35799
  if (linking !== null || !clientTableId) return;
35716
35800
  for (const e of Object.values(exposures)) {
@@ -37931,7 +38015,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
37931
38015
 
37932
38016
  // src/FormBuilder.tsx
37933
38017
  import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
37934
- import { useCallback as useCallback54, useEffect as useEffect91, useMemo as useMemo62, useRef as useRef46, useState as useState107 } from "react";
38018
+ import { useCallback as useCallback54, useEffect as useEffect91, useMemo as useMemo62, useRef as useRef47, useState as useState107 } from "react";
37935
38019
  import { useFields as useFields24, useRecordsClient as useRecordsClient79, useTable as useTable26 } from "@ai-matrx/records/react";
37936
38020
  import { publicFormPath } from "@ai-matrx/records";
37937
38021
  import {
@@ -37945,7 +38029,7 @@ import {
37945
38029
  } from "@ai-matrx/design-system";
37946
38030
 
37947
38031
  // src/FormRunner.tsx
37948
- import { useCallback as useCallback52, useEffect as useEffect89, useMemo as useMemo61, useRef as useRef45, useState as useState105 } from "react";
38032
+ import { useCallback as useCallback52, useEffect as useEffect89, useMemo as useMemo61, useRef as useRef46, useState as useState105 } from "react";
37949
38033
  import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
37950
38034
  import { Button as Button83, Progress, Skeleton as Skeleton25, cn as cn72 } from "@ai-matrx/design-system";
37951
38035
  import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
@@ -38046,8 +38130,8 @@ function FormStage({
38046
38130
  const [writing, setWriting] = useState105(false);
38047
38131
  const [done, setDone] = useState105(null);
38048
38132
  const [hidden, setHidden] = useState105({});
38049
- const decoy = useRef45("");
38050
- const stage = useRef45(null);
38133
+ const decoy = useRef46("");
38134
+ const stage = useRef46(null);
38051
38135
  const questions = useMemo61(() => {
38052
38136
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
38053
38137
  return (form.questions ?? []).map((q) => {
@@ -38108,13 +38192,13 @@ function FormStage({
38108
38192
  };
38109
38193
  }, [whichAsked, questions, answers]);
38110
38194
  const live = questions.filter((q) => !hidden[q.key]);
38111
- const told = useRef45(answers);
38195
+ const told = useRef46(answers);
38112
38196
  useEffect89(() => {
38113
38197
  if (told.current === answers) return;
38114
38198
  told.current = answers;
38115
38199
  onAnswersChange?.(answers);
38116
38200
  }, [answers, onAnswersChange]);
38117
- const resumeAt = useRef45(
38201
+ const resumeAt = useRef46(
38118
38202
  resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
38119
38203
  const v = initialAnswers[q.key];
38120
38204
  return v === void 0 || v === null || v === "";
@@ -38707,7 +38791,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
38707
38791
  const [lookUnread, setLookUnread] = useState107(null);
38708
38792
  const [restoredAt, setRestoredAt] = useState107(null);
38709
38793
  const [adding, setAdding] = useState107(false);
38710
- const keysBeforeAdd = useRef46(null);
38794
+ const keysBeforeAdd = useRef47(null);
38711
38795
  const [makeOnMount, setMakeOnMount] = useState107("waiting");
38712
38796
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
38713
38797
  const load = useCallback54(async () => {
@@ -39526,13 +39610,13 @@ function bucketWindow2(groupKey, value) {
39526
39610
  import {
39527
39611
  useEffect as useEffect92,
39528
39612
  useId as useId3,
39529
- useRef as useRef47,
39613
+ useRef as useRef48,
39530
39614
  useState as useState108
39531
39615
  } from "react";
39532
39616
  import { cn as cn75 } from "@ai-matrx/design-system";
39533
39617
  import { jsx as jsx127, jsxs as jsxs116 } from "react/jsx-runtime";
39534
39618
  function useMeasuredWidth(fallback = 480) {
39535
- const ref = useRef47(null);
39619
+ const ref = useRef48(null);
39536
39620
  const [width, setWidth] = useState108(fallback);
39537
39621
  useEffect92(() => {
39538
39622
  const node = ref.current;
@@ -39820,7 +39904,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
39820
39904
  }
39821
39905
 
39822
39906
  // src/DocRender.tsx
39823
- import { useCallback as useCallback56, useEffect as useEffect94, useRef as useRef48, useState as useState110 } from "react";
39907
+ import { useCallback as useCallback56, useEffect as useEffect94, useRef as useRef49, useState as useState110 } from "react";
39824
39908
  import { useRecordsClient as useRecordsClient81 } from "@ai-matrx/records/react";
39825
39909
  import { Button as Button87, Skeleton as Skeleton29, cn as cn77 } from "@ai-matrx/design-system";
39826
39910
  import { jsx as jsx129, jsxs as jsxs118 } from "react/jsx-runtime";
@@ -39831,7 +39915,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
39831
39915
  const [showing, setShowing] = useState110(null);
39832
39916
  const [error, setError] = useState110(null);
39833
39917
  const [busy, setBusy] = useState110(null);
39834
- const paper = useRef48(null);
39918
+ const paper = useRef49(null);
39835
39919
  const load = useCallback56(async () => {
39836
39920
  const [body, held] = await Promise.all([
39837
39921
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -40802,7 +40886,7 @@ import { RecordsProvider as RecordsProvider2, useFields as useFields27, useRecor
40802
40886
  import { Button as Button89, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
40803
40887
 
40804
40888
  // src/RecordsMount.tsx
40805
- import { useRef as useRef49 } from "react";
40889
+ import { useRef as useRef50 } from "react";
40806
40890
  import { RecordsProvider } from "@ai-matrx/records/react";
40807
40891
  import { jsx as jsx133 } from "react/jsx-runtime";
40808
40892
  var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
@@ -40820,7 +40904,7 @@ function RecordsMount({
40820
40904
  return /* @__PURE__ */ jsx133(RecordsProvider, { config, children: /* @__PURE__ */ jsx133(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsx133(RecordLabelProvider, { children }) }) });
40821
40905
  }
40822
40906
  function useShallowStableHost(host) {
40823
- const held = useRef49(null);
40907
+ const held = useRef50(null);
40824
40908
  const next = host ?? {};
40825
40909
  const previous = held.current;
40826
40910
  if (previous !== null && sameParts(previous, next)) return previous;
@@ -41914,7 +41998,7 @@ function TargetControl({
41914
41998
  }
41915
41999
 
41916
42000
  // src/QuestionPanel.tsx
41917
- import { useEffect as useEffect99, useMemo as useMemo68, useRef as useRef50, useState as useState116 } from "react";
42001
+ import { useEffect as useEffect99, useMemo as useMemo68, useRef as useRef51, useState as useState116 } from "react";
41918
42002
  import { Badge as Badge23, BasicInput as BasicInput32, Button as Button92, Checkbox as Checkbox16, Label as Label23, Skeleton as Skeleton32, cn as cn82 } from "@ai-matrx/design-system";
41919
42003
  import { useFields as useFields30, useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
41920
42004
 
@@ -42366,7 +42450,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
42366
42450
  const [saveError, setSaveError] = useState116(null);
42367
42451
  const [saving, setSaving] = useState116(false);
42368
42452
  const [linkMissed, setLinkMissed] = useState116(false);
42369
- const openedFromLink = useRef50(false);
42453
+ const openedFromLink = useRef51(false);
42370
42454
  useEffect99(() => {
42371
42455
  let live = true;
42372
42456
  void questionsOf(client, tableId).then((answer2) => {
@@ -44110,12 +44194,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
44110
44194
  }
44111
44195
 
44112
44196
  // src/CaptureSheet.tsx
44113
- import { useCallback as useCallback62, useEffect as useEffect103, useRef as useRef52, useState as useState121 } from "react";
44197
+ import { useCallback as useCallback62, useEffect as useEffect103, useRef as useRef53, useState as useState121 } from "react";
44114
44198
  import { useFields as useFields33, useRecordsClient as useRecordsClient90, useTable as useTable33 } from "@ai-matrx/records/react";
44115
44199
  import { Button as Button97, Input as Input8, Skeleton as Skeleton37, Textarea as Textarea7, cn as cn86 } from "@ai-matrx/design-system";
44116
44200
 
44117
44201
  // src/CaptureRun.tsx
44118
- import { useCallback as useCallback61, useEffect as useEffect102, useMemo as useMemo70, useRef as useRef51, useState as useState120 } from "react";
44202
+ import { useCallback as useCallback61, useEffect as useEffect102, useMemo as useMemo70, useRef as useRef52, useState as useState120 } from "react";
44119
44203
  import {
44120
44204
  coerceTypedAnswer as coerceTypedAnswer3,
44121
44205
  coercionLabel,
@@ -44173,7 +44257,7 @@ function CaptureRun({ sheetId, face: given, className }) {
44173
44257
  const [items, setItems] = useState120([]);
44174
44258
  const [lastSynced, setLastSynced] = useState120(null);
44175
44259
  const [sending, setSending] = useState120(false);
44176
- const queueRef = useRef51(null);
44260
+ const queueRef = useRef52(null);
44177
44261
  useEffect102(() => {
44178
44262
  const q2 = openCaptureQueue({
44179
44263
  onChange: (c, all) => {
@@ -44553,7 +44637,7 @@ function AdHocCaptureSheet({
44553
44637
  const [error, setError] = useState121(null);
44554
44638
  const [uploadError, setUploadError] = useState121(null);
44555
44639
  const [flushing, setFlushing] = useState121(false);
44556
- const queue = useRef52([]);
44640
+ const queue = useRef53([]);
44557
44641
  const keep = useCallback62(
44558
44642
  async (next) => {
44559
44643
  queue.current = next;
@@ -45093,7 +45177,7 @@ function useEmbedHandshake(args) {
45093
45177
  }
45094
45178
 
45095
45179
  // src/TablePage.tsx
45096
- import { useCallback as useCallback67, useEffect as useEffect109, useMemo as useMemo74, useRef as useRef53, useState as useState131 } from "react";
45180
+ import { useCallback as useCallback67, useEffect as useEffect109, useMemo as useMemo74, useRef as useRef54, useState as useState131 } from "react";
45097
45181
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
45098
45182
  import { useFields as useFields36, useRecordsClient as useRecordsClient95, useTable as useTable35 } from "@ai-matrx/records/react";
45099
45183
  import {
@@ -46067,6 +46151,8 @@ function TablePage({
46067
46151
  tableId,
46068
46152
  presentation: pagePresentation2 = "page",
46069
46153
  newRowLabel,
46154
+ searchOverride,
46155
+ onSearchChange,
46070
46156
  pageSize: pageSizeAsked,
46071
46157
  seedViews,
46072
46158
  onLeave,
@@ -46125,7 +46211,7 @@ function TablePage({
46125
46211
  const [hostLayout, setHostLayout] = useState131(hostFromLink);
46126
46212
  const [views, setViews] = useState131(void 0);
46127
46213
  const [pickedViewId, setPickedViewId] = useState131(savedFromLink);
46128
- const viewSeen = useRef53(null);
46214
+ const viewSeen = useRef54(null);
46129
46215
  const [viewLinkMissed, setViewLinkMissed] = useState131(false);
46130
46216
  const [layoutChosen, setLayoutChosen] = useState131(false);
46131
46217
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
@@ -46160,7 +46246,7 @@ function TablePage({
46160
46246
  const face = tableOpening(view, hostLayouts.map((h) => h.id));
46161
46247
  const designated = face.kind === "designated";
46162
46248
  const embedded = pagePresentation2 === "embedded";
46163
- const pageSize = pageSizeAsked ?? (embedded ? 50 : 100);
46249
+ const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 100);
46164
46250
  const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
46165
46251
  const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
46166
46252
  const controlsInSheet = phone && !designated;
@@ -46196,7 +46282,7 @@ function TablePage({
46196
46282
  lookDiffers: view ? lookDiffers(view, look) : false
46197
46283
  };
46198
46284
  const shownSignature = JSON.stringify(shownReport);
46199
- const reportRef = useRef53(onShownViewChange);
46285
+ const reportRef = useRef54(onShownViewChange);
46200
46286
  reportRef.current = onShownViewChange;
46201
46287
  useEffect109(() => {
46202
46288
  reportRef.current?.(JSON.parse(shownSignature));
@@ -46257,7 +46343,7 @@ function TablePage({
46257
46343
  },
46258
46344
  [client, tableId, view, looks]
46259
46345
  );
46260
- const arrival = useRef53(viewAddress ?? null);
46346
+ const arrival = useRef54(viewAddress ?? null);
46261
46347
  const [gridQuery, setGridQuery] = useState131(null);
46262
46348
  const [addressResetEpoch, setAddressResetEpoch] = useState131(0);
46263
46349
  const reportGrid = useCallback67((q) => {
@@ -46268,7 +46354,7 @@ function TablePage({
46268
46354
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
46269
46355
  [reportGrid, addressResetEpoch]
46270
46356
  );
46271
- const hiddenApplied = useRef53(false);
46357
+ const hiddenApplied = useRef54(false);
46272
46358
  useEffect109(() => {
46273
46359
  const hidden = arrival.current?.hidden;
46274
46360
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
@@ -46289,9 +46375,9 @@ function TablePage({
46289
46375
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
46290
46376
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
46291
46377
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
46292
- const addressReportRef = useRef53(onViewAddressChange);
46378
+ const addressReportRef = useRef54(onViewAddressChange);
46293
46379
  addressReportRef.current = onViewAddressChange;
46294
- const addressSent = useRef53(null);
46380
+ const addressSent = useRef54(null);
46295
46381
  useEffect109(() => {
46296
46382
  if (!addressReady) return;
46297
46383
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
@@ -46546,9 +46632,9 @@ function TablePage({
46546
46632
  }
46547
46633
  });
46548
46634
  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;
46549
- const actionsRef = useRef53(actions);
46635
+ const actionsRef = useRef54(actions);
46550
46636
  actionsRef.current = actions;
46551
- const onActionsRef = useRef53(onActions);
46637
+ const onActionsRef = useRef54(onActions);
46552
46638
  onActionsRef.current = onActions;
46553
46639
  useEffect109(() => {
46554
46640
  onActionsRef.current?.(actionsRef.current);
@@ -46951,6 +47037,8 @@ function TablePage({
46951
47037
  chooser: false,
46952
47038
  ...embedded ? { embedded } : {},
46953
47039
  ...newRowLabel ? { newRowLabel } : {},
47040
+ ...searchOverride !== void 0 ? { searchOverride } : {},
47041
+ ...onSearchChange ? { onSearchChange } : {},
46954
47042
  footer,
46955
47043
  openExport: () => setRail("export"),
46956
47044
  view: {
@@ -47113,6 +47201,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
47113
47201
  }
47114
47202
 
47115
47203
  // src/entityViews.tsx
47204
+ import { MatrxTableCardShowMore as MatrxTableCardShowMore2 } from "@ai-matrx/design-system/data-table";
47116
47205
  import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
47117
47206
  import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn93 } from "@ai-matrx/design-system";
47118
47207
  import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
@@ -47256,7 +47345,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
47256
47345
  function EntityTablePage({
47257
47346
  source,
47258
47347
  presentation = "page",
47259
- pageSize = 100,
47348
+ pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
47260
47349
  layout: opened = "grid",
47261
47350
  onLayoutChange,
47262
47351
  groupBy,
@@ -47340,7 +47429,18 @@ function EntityTablePage({
47340
47429
  ] })
47341
47430
  ] }) : null,
47342
47431
  addRefused ? /* @__PURE__ */ jsx153(ErrorBox9, { 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,
47343
- entity.error ? /* @__PURE__ */ jsx153("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx153(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsx153(EntityGrid, { entity, pageSize, ...drill ? { drill } : {} })
47432
+ entity.error ? /* @__PURE__ */ jsx153("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx153(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs141(Fragment62, { children: [
47433
+ /* @__PURE__ */ jsx153(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
47434
+ presentation === "embedded" && entity.hasMore ? /* @__PURE__ */ jsx153(
47435
+ MatrxTableCardShowMore2,
47436
+ {
47437
+ shown: entity.rows.length,
47438
+ total: entity.total,
47439
+ busy: entity.loadingMore,
47440
+ onShowMore: () => void entity.loadMore()
47441
+ }
47442
+ ) : null
47443
+ ] })
47344
47444
  ] });
47345
47445
  }
47346
47446