@ai-matrx/records-ui 0.101.31 → 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
@@ -1844,10 +1844,10 @@ function shown(value) {
1844
1844
  if (typeof value === "number" || typeof value === "boolean") return String(value);
1845
1845
  return null;
1846
1846
  }
1847
- function tellApart(rows, nameOf) {
1847
+ function tellApart(rows, nameOf2) {
1848
1848
  const byName = /* @__PURE__ */ new Map();
1849
1849
  for (const row of rows) {
1850
- const name = nameOf(row.id).trim().toLowerCase();
1850
+ const name = nameOf2(row.id).trim().toLowerCase();
1851
1851
  byName.set(name, [...byName.get(name) ?? [], row]);
1852
1852
  }
1853
1853
  const out = /* @__PURE__ */ new Map();
@@ -2455,6 +2455,7 @@ function RecordLabelProvider({ children }) {
2455
2455
  const client = useRecordsClient3();
2456
2456
  const [names, setNames] = useState7({});
2457
2457
  const [archivedRefs, setArchivedRefs] = useState7({});
2458
+ const [iconsOf, setIconsOf] = useState7({});
2458
2459
  const [settled, setSettled] = useState7({});
2459
2460
  const [waitingLines, setWaitingLines] = useState7({});
2460
2461
  const asked3 = useRef3(/* @__PURE__ */ new Set());
@@ -2537,6 +2538,7 @@ function RecordLabelProvider({ children }) {
2537
2538
  void (async () => {
2538
2539
  const learned = {};
2539
2540
  const archivedNow = {};
2541
+ const iconsNow = {};
2540
2542
  await Promise.all(
2541
2543
  batch.map(async ({ field: field2, ids }) => {
2542
2544
  const wanted = [...ids];
@@ -2549,10 +2551,12 @@ function RecordLabelProvider({ children }) {
2549
2551
  learned[id] = !result.ok ? UNREAD_RECORD_LABEL : typeof words2 === "string" && words2 !== "" ? words2 : WITHHELD_RECORD_LABEL;
2550
2552
  }
2551
2553
  if (result.ok) for (const id of result.archived ?? []) archivedNow[`${field2.id}:${id}`] = true;
2554
+ if (result.ok) for (const [id, pair] of Object.entries(result.icons ?? {})) iconsNow[id] = pair;
2552
2555
  })
2553
2556
  );
2554
2557
  setNames((current) => ({ ...current, ...learned }));
2555
2558
  if (Object.keys(archivedNow).length > 0) setArchivedRefs((current) => ({ ...current, ...archivedNow }));
2559
+ if (Object.keys(iconsNow).length > 0) setIconsOf((current) => ({ ...current, ...iconsNow }));
2556
2560
  for (const { field: field2 } of batch) stopWaitClock(field2.id);
2557
2561
  })();
2558
2562
  }, [client, stopWaitClock]);
@@ -2600,9 +2604,10 @@ function RecordLabelProvider({ children }) {
2600
2604
  () => {
2601
2605
  const answer = ((field2, id) => lookupWords(field2, id));
2602
2606
  answer.archived = (field2, id) => archivedRefs[`${field2.id}:${id}`] === true;
2607
+ answer.icons = (_field, id) => iconsOf[id];
2603
2608
  return answer;
2604
2609
  },
2605
- [lookupWords, archivedRefs]
2610
+ [lookupWords, archivedRefs, iconsOf]
2606
2611
  );
2607
2612
  const waiting = useCallback2((field2) => waitingLines[field2.id] ?? null, [waitingLines]);
2608
2613
  const value = useMemo5(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
@@ -5174,6 +5179,7 @@ var EMBEDDED_TABLE_CLASS = [
5174
5179
  "[&_thead_th:last-child]:border-r-0"
5175
5180
  ].join(" ");
5176
5181
  var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
5182
+ var EMBEDDED_PAGE_SIZE = 50;
5177
5183
 
5178
5184
  // src/enumLabels.ts
5179
5185
  function exhaustiveValuesOf() {
@@ -5466,6 +5472,20 @@ function kindLabel(kind) {
5466
5472
 
5467
5473
  // src/ReferenceChips.tsx
5468
5474
  import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5475
+ function glyphOf(icon) {
5476
+ const text = (icon ?? "").trim();
5477
+ return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
5478
+ }
5479
+ function nameOf(icon) {
5480
+ const text = (icon ?? "").trim();
5481
+ return /^[A-Za-z][A-Za-z0-9_-]{1,40}$/.test(text) ? text : null;
5482
+ }
5483
+ function iconOf(pair) {
5484
+ const own3 = glyphOf(pair?.icon) ?? nameOf(pair?.icon);
5485
+ const table = glyphOf(pair?.tableIcon) ?? nameOf(pair?.tableIcon);
5486
+ const chosen = own3 ?? table;
5487
+ return chosen ? { icon: chosen } : {};
5488
+ }
5469
5489
  function referencesOf(field2, value, kind, labels) {
5470
5490
  if (kind === "entity_reference") {
5471
5491
  return entityRefsOf2(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
@@ -5477,6 +5497,7 @@ function referencesOf(field2, value, kind, labels) {
5477
5497
  id,
5478
5498
  label: labels?.(field2, id) ?? null,
5479
5499
  tableId,
5500
+ ...iconOf(labels?.icons?.(field2, id)),
5480
5501
  ...labels?.archived?.(field2, id) ? { archived: true } : {}
5481
5502
  }));
5482
5503
  }
@@ -5508,7 +5529,7 @@ function ReferenceChip({ reference, waiting }) {
5508
5529
  "data-records-reference-archived": reference.archived ? "" : void 0,
5509
5530
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words2,
5510
5531
  children: [
5511
- /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: reference.icon ? /* @__PURE__ */ jsx22("span", { className: "text-sm leading-none", children: reference.icon }) : /* @__PURE__ */ jsx22(PageGlyph, {}) }),
5532
+ /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ jsx22("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ jsx22(PageGlyph, {}) }),
5512
5533
  drawn ?? /* @__PURE__ */ jsx22("span", { className: "truncate", children: words2 }),
5513
5534
  reference.archived ? /* @__PURE__ */ jsx22("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
5514
5535
  ]
@@ -13298,7 +13319,7 @@ function backLinkSentence(column, readers = [], tableName2 = null) {
13298
13319
  }
13299
13320
 
13300
13321
  // src/Grid.tsx
13301
- 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";
13302
13323
 
13303
13324
  // src/gridAddRow.tsx
13304
13325
  import { useCallback as useCallback16, useEffect as useEffect34, useMemo as useMemo22, useRef as useRef23, useState as useState43 } from "react";
@@ -16154,7 +16175,7 @@ function opensOnKey(event) {
16154
16175
  }
16155
16176
  return true;
16156
16177
  }
16157
- function withOpenRecord(columns, onOpen, nameOf, place = "end", hrefOf) {
16178
+ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf) {
16158
16179
  if (!onOpen) return columns;
16159
16180
  return columns.map((column, index) => {
16160
16181
  const original = column.cell;
@@ -16164,8 +16185,8 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end", hrefOf) {
16164
16185
  {
16165
16186
  type: "button",
16166
16187
  "data-records-open-record": row.id,
16167
- "aria-label": openRecordLabel(nameOf(row)),
16168
- title: `${openRecordLabel(nameOf(row))} (Space)`,
16188
+ "aria-label": openRecordLabel(nameOf2(row)),
16189
+ title: `${openRecordLabel(nameOf2(row))} (Space)`,
16169
16190
  className: "shrink-0 rounded px-1 text-xs leading-5 text-muted-foreground opacity-40 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100",
16170
16191
  onClick: (event) => {
16171
16192
  event.stopPropagation();
@@ -21079,7 +21100,9 @@ function GridBody({
21079
21100
  onAskWhoChanged,
21080
21101
  embedded = false,
21081
21102
  newRowLabel,
21082
- sortOverride
21103
+ sortOverride,
21104
+ searchOverride,
21105
+ onSearchChange
21083
21106
  }) {
21084
21107
  const toolbarSlot = useTableToolbarSlot();
21085
21108
  const tableCard = useMatrxTableCard();
@@ -21156,6 +21179,14 @@ function GridBody({
21156
21179
  page: 1
21157
21180
  }));
21158
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]);
21159
21190
  const reportQuery = address?.report;
21160
21191
  useEffect47(() => {
21161
21192
  if (!reportQuery) return;
@@ -21239,7 +21270,32 @@ function GridBody({
21239
21270
  filter: readFilter ?? null,
21240
21271
  version: records.data
21241
21272
  });
21242
- 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]);
21243
21299
  const added = useAddedRows({
21244
21300
  tableId,
21245
21301
  enabled: merged,
@@ -22419,6 +22475,21 @@ function GridBody({
22419
22475
  const tableToolbar = useMemo35(
22420
22476
  () => ({
22421
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
+ } : {},
22422
22493
  // The host (Spaces) has its own Properties menu: an embedded table draws no Columns button.
22423
22494
  ...embedded ? { columns: false } : {},
22424
22495
  searchPlaceholder: "Search records",
@@ -22619,7 +22690,9 @@ function GridBody({
22619
22690
  sheetExtras,
22620
22691
  tableId,
22621
22692
  noun,
22622
- embedded
22693
+ embedded,
22694
+ searchOverride,
22695
+ onSearchChange
22623
22696
  ]
22624
22697
  );
22625
22698
  const labelOfField = useCallback25(
@@ -22825,7 +22898,7 @@ function GridBody({
22825
22898
  pageSize,
22826
22899
  query: tableQuery,
22827
22900
  ...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
22828
- ...classicInCard ? { hidePagination: true } : {},
22901
+ ...classicInCard || embeddedMore ? { hidePagination: true } : {},
22829
22902
  ...embedded ? { appearance: "embedded" } : {},
22830
22903
  tableClassName: cn34(
22831
22904
  !look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
@@ -22930,7 +23003,15 @@ function GridBody({
22930
23003
  onShowMore: () => setCardExtraRows((extra) => extra + pageSize)
22931
23004
  }
22932
23005
  ) : null
22933
- ) : 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(
22934
23015
  Pager,
22935
23016
  {
22936
23017
  page,
@@ -23081,7 +23162,7 @@ import { MatrxTableCard, MatrxTableCardEmpty, TABLE_CARD_DEFAULT_INITIAL_ROWS }
23081
23162
  import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable7 } from "@ai-matrx/records/react";
23082
23163
 
23083
23164
  // src/entitySource.tsx
23084
- 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";
23085
23166
  import { MatrxDataTable as MatrxDataTable2 } from "@ai-matrx/design-system/data-table";
23086
23167
  import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
23087
23168
  import { jsx as jsx69 } from "react/jsx-runtime";
@@ -23089,6 +23170,8 @@ function useEntitySource(token, options = {}) {
23089
23170
  const client = useRecordsClient38();
23090
23171
  const limit = options.limit ?? 50;
23091
23172
  const [tick, setTick] = useState60(0);
23173
+ const held = useRef30(0);
23174
+ const [loadingMore, setLoadingMore] = useState60(false);
23092
23175
  const [state, setState] = useState60({
23093
23176
  label: null,
23094
23177
  columns: [],
@@ -23101,7 +23184,7 @@ function useEntitySource(token, options = {}) {
23101
23184
  useEffect48(() => {
23102
23185
  let cancelled = false;
23103
23186
  const source = { kind: "entity", token };
23104
- 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(
23105
23188
  ([def, page]) => {
23106
23189
  if (cancelled) return;
23107
23190
  if (!def.ok) return setState((s) => ({ ...s, loading: false, error: refusalSentence(def.error) || "This table could not be read." }));
@@ -23109,6 +23192,7 @@ function useEntitySource(token, options = {}) {
23109
23192
  const api = def.data.api;
23110
23193
  const shown4 = new Set(page.data.columns instanceof Array ? page.data.columns.filter((c) => typeof c === "string") : []);
23111
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;
23112
23196
  setState({
23113
23197
  label: api?.label ?? def.data.label ?? token,
23114
23198
  columns,
@@ -23152,7 +23236,22 @@ function useEntitySource(token, options = {}) {
23152
23236
  },
23153
23237
  [client, token]
23154
23238
  );
23155
- 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 };
23156
23255
  }
23157
23256
  function entityValueText(column, v) {
23158
23257
  if (v === null || v === void 0 || v === "") return "";
@@ -23182,7 +23281,7 @@ function entityTableColumns(columns) {
23182
23281
  ...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
23183
23282
  }));
23184
23283
  }
23185
- function EntityGrid({ entity, pageSize, drill }) {
23284
+ function EntityGrid({ entity, pageSize, drill, embedded }) {
23186
23285
  const columns = useMemo36(() => entityTableColumns(entity.columns), [entity.columns]);
23187
23286
  return /* @__PURE__ */ jsx69(
23188
23287
  MatrxDataTable2,
@@ -23192,7 +23291,8 @@ function EntityGrid({ entity, pageSize, drill }) {
23192
23291
  getRowId: (row) => String(row.id),
23193
23292
  isLoading: entity.loading,
23194
23293
  ...pageSize ? { pageSize } : {},
23195
- ...drill ? { drill } : {}
23294
+ ...drill ? { drill } : {},
23295
+ ...embedded ? { appearance: "embedded", hidePagination: true } : {}
23196
23296
  }
23197
23297
  );
23198
23298
  }
@@ -23787,7 +23887,7 @@ import { Badge as Badge11, Button as Button48, Skeleton as Skeleton5, cn as cn39
23787
23887
 
23788
23888
  // src/BookingBuilder.tsx
23789
23889
  import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
23790
- 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";
23791
23891
  import { useFields as useFields11, useRecordsClient as useRecordsClient41, useTable as useTable9 } from "@ai-matrx/records/react";
23792
23892
  import { formatDurationMinutes } from "@ai-matrx/kit/format";
23793
23893
  import {
@@ -23924,7 +24024,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
23924
24024
  const [confirmation, setConfirmation] = useState63("");
23925
24025
  const [offer, setOffer] = useState63(null);
23926
24026
  const [formId, setFormId] = useState63(bookingId ?? null);
23927
- const madeRef = useRef30(null);
24027
+ const madeRef = useRef31(null);
23928
24028
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
23929
24029
  const askable = useMemo38(
23930
24030
  () => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
@@ -23994,7 +24094,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
23994
24094
  }),
23995
24095
  [timezone, minutes, buffer, lead, perDay, days, windows]
23996
24096
  );
23997
- const startedAsking = useRef30(false);
24097
+ const startedAsking = useRef31(false);
23998
24098
  useEffect51(() => {
23999
24099
  if (startedAsking.current || !loaded || existing || formId || !fields.data) return;
24000
24100
  startedAsking.current = true;
@@ -26334,7 +26434,7 @@ function Clause({
26334
26434
  }
26335
26435
 
26336
26436
  // src/TableRename.tsx
26337
- 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";
26338
26438
  import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient48 } from "@ai-matrx/records/react";
26339
26439
  import {
26340
26440
  Button as Button53,
@@ -26356,7 +26456,7 @@ function tableNameProblem(typed2) {
26356
26456
  }
26357
26457
  function useRenameFromMenu() {
26358
26458
  const [open, setOpen] = useState70(false);
26359
- const asked3 = useRef31(false);
26459
+ const asked3 = useRef32(false);
26360
26460
  const ask = useCallback33(() => {
26361
26461
  asked3.current = true;
26362
26462
  window.setTimeout(() => setOpen(true), 0);
@@ -26382,8 +26482,8 @@ function TableRenameDialog({
26382
26482
  const [typed2, setTyped] = useState70(name);
26383
26483
  const [busy, setBusy] = useState70(false);
26384
26484
  const [refused, setRefused] = useState70(null);
26385
- const box = useRef31(null);
26386
- const openedAt = useRef31(null);
26485
+ const box = useRef32(null);
26486
+ const openedAt = useRef32(null);
26387
26487
  useEffect57(() => {
26388
26488
  if (!open) return;
26389
26489
  openedAt.current = readTableVersionNow(client, tableId);
@@ -26475,7 +26575,7 @@ function TableRenameDialog({
26475
26575
  }
26476
26576
 
26477
26577
  // src/TableSettings.tsx
26478
- 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";
26479
26579
 
26480
26580
  // src/ArchiveDeliberately.tsx
26481
26581
  import { useState as useState71 } from "react";
@@ -27120,8 +27220,8 @@ function TableSettings({
27120
27220
  live = false;
27121
27221
  };
27122
27222
  }, [tableId]);
27123
- const askToArchiveRef = useRef32(null);
27124
- const archiveAskedSeen = useRef32(0);
27223
+ const askToArchiveRef = useRef33(null);
27224
+ const archiveAskedSeen = useRef33(0);
27125
27225
  const panelReady = Boolean(table.data && fields.data && rights.structure);
27126
27226
  useEffect62(() => {
27127
27227
  const ask = askToArchiveRef.current;
@@ -27527,7 +27627,7 @@ function ShareForSomebodyElse({
27527
27627
  }
27528
27628
 
27529
27629
  // src/RecordBody.tsx
27530
- 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";
27531
27631
  import { Button as Button60, cn as cn46 } from "@ai-matrx/design-system";
27532
27632
  import { newerKindOf as newerKindOf5 } from "@ai-matrx/records";
27533
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";
@@ -27564,9 +27664,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
27564
27664
  const raw = record.data?.document?.[field2.key];
27565
27665
  const stored = typeof raw === "string" ? raw : "";
27566
27666
  const [saving, setSaving] = useState79({ phase: "idle" });
27567
- const lastSaved = useRef33(null);
27568
- const waiting = useRef33(null);
27569
- const timer = useRef33(null);
27667
+ const lastSaved = useRef34(null);
27668
+ const waiting = useRef34(null);
27669
+ const timer = useRef34(null);
27570
27670
  if (lastSaved.current === null && record.data) lastSaved.current = stored;
27571
27671
  const write = async () => {
27572
27672
  if (timer.current) clearTimeout(timer.current);
@@ -27587,7 +27687,7 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
27587
27687
  setSaving({ phase: "refused", error: answered.error });
27588
27688
  }
27589
27689
  };
27590
- const writeRef = useRef33(write);
27690
+ const writeRef = useRef34(write);
27591
27691
  writeRef.current = write;
27592
27692
  useEffect65(
27593
27693
  () => () => {
@@ -28006,7 +28106,7 @@ import {
28006
28106
  import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
28007
28107
 
28008
28108
  // src/Pipeline.tsx
28009
- 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";
28010
28110
  import {
28011
28111
  mayDrag,
28012
28112
  useFields as useFields17,
@@ -28357,9 +28457,9 @@ function PipelineBoard({
28357
28457
  const [waiting, setWaiting] = useState83(/* @__PURE__ */ new Map());
28358
28458
  const [dragging, setDragging] = useState83(null);
28359
28459
  const [over, setOver] = useState83(null);
28360
- const alive = useRef34(true);
28460
+ const alive = useRef35(true);
28361
28461
  const [selected, setSelected] = useState83(/* @__PURE__ */ new Set());
28362
- const anchor = useRef34(null);
28462
+ const anchor = useRef35(null);
28363
28463
  const [batch, setBatch] = useState83(/* @__PURE__ */ new Map());
28364
28464
  const [batchSaid, setBatchSaid] = useState83(null);
28365
28465
  const [batchError, setBatchError] = useState83(null);
@@ -28393,7 +28493,7 @@ function PipelineBoard({
28393
28493
  void reload();
28394
28494
  }, [reload]);
28395
28495
  const versions = useRecordVersions(client, rows, (r) => mayDrag(r.level));
28396
- const versionsRef = useRef34(versions);
28496
+ const versionsRef = useRef35(versions);
28397
28497
  versionsRef.current = versions;
28398
28498
  const drawnVersion = (id) => versionsRef.current.seen(id);
28399
28499
  const stageKey = definition?.stage_field ?? null;
@@ -28982,13 +29082,13 @@ function batchSentence(moved, waiting, notMoved, label) {
28982
29082
  }
28983
29083
 
28984
29084
  // src/CalendarView.tsx
28985
- 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";
28986
29086
  import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
28987
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";
28988
29088
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
28989
29089
 
28990
29090
  // src/recordMoves.tsx
28991
- 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";
28992
29092
  import { useRecordsClient as useRecordsClient60 } from "@ai-matrx/records/react";
28993
29093
  import { Button as Button63 } from "@ai-matrx/design-system";
28994
29094
  import { Fragment as Fragment36, jsx as jsx98, jsxs as jsxs88 } from "react/jsx-runtime";
@@ -29067,7 +29167,7 @@ function useRecordMoves({
29067
29167
  [client, undo, onMoved]
29068
29168
  );
29069
29169
  const offering = Boolean(undo.notice);
29070
- const undoRef = useRef35(undo);
29170
+ const undoRef = useRef36(undo);
29071
29171
  undoRef.current = undo;
29072
29172
  useEffect68(() => {
29073
29173
  if (!offering || typeof document === "undefined") return;
@@ -29507,7 +29607,7 @@ function CalendarView({
29507
29607
  }, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
29508
29608
  const titleOf = (row) => cardWords(row, titleField, labels).text;
29509
29609
  const rowById = (id) => rows.find((r) => r.id === id);
29510
- const frame = useRef36(null);
29610
+ const frame = useRef37(null);
29511
29611
  const [focusOn, setFocusOn] = useState85(null);
29512
29612
  useEffect69(() => {
29513
29613
  if (!focusOn) return;
@@ -29556,7 +29656,7 @@ function CalendarView({
29556
29656
  const made = await moves.create({ tableId, data, label: `New record on ${where}` });
29557
29657
  if (made) onOpenRecord?.(made);
29558
29658
  };
29559
- const grabOffset = useRef36(0);
29659
+ const grabOffset = useRef37(0);
29560
29660
  const [resizing, setResizing] = useState85(null);
29561
29661
  const [ghost, setGhost] = useState85(null);
29562
29662
  useEffect69(() => {
@@ -30105,7 +30205,7 @@ function WeekHours({
30105
30205
  render,
30106
30206
  overlay
30107
30207
  }) {
30108
- const frame = useRef36(null);
30208
+ const frame = useRef37(null);
30109
30209
  useEffect69(() => {
30110
30210
  if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
30111
30211
  }, []);
@@ -30152,7 +30252,7 @@ function weekHeading(first) {
30152
30252
  }
30153
30253
 
30154
30254
  // src/TimelineView.tsx
30155
- 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";
30156
30256
  import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
30157
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";
30158
30258
  import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
@@ -30405,10 +30505,10 @@ function TimelineView({
30405
30505
  const width = days * px;
30406
30506
  const scale = useMemo51(() => scaleOf(from, days, zoom), [from, days, zoom]);
30407
30507
  const xOf = (day) => daysBetween(from, day) * px;
30408
- const scroller = useRef37(null);
30508
+ const scroller = useRef38(null);
30409
30509
  const grouped = Boolean(groupField);
30410
30510
  const [scrollX, setScrollX] = useState86(0);
30411
- const frame = useRef37(null);
30511
+ const frame = useRef38(null);
30412
30512
  const onScroll = () => {
30413
30513
  if (frame.current !== null) return;
30414
30514
  frame.current = requestAnimationFrame(() => {
@@ -31336,10 +31436,12 @@ function ViewSwitcher({
31336
31436
  footer,
31337
31437
  embedded,
31338
31438
  sortOverride,
31439
+ searchOverride,
31440
+ onSearchChange,
31339
31441
  newRowLabel,
31340
31442
  className
31341
31443
  }) {
31342
- const pageSize = pageSizeAsked ?? (embedded ? 50 : 200);
31444
+ const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 200);
31343
31445
  const toolbarSlot = useTableToolbarSlot();
31344
31446
  const [layout, setLayout] = useState89(view.layout);
31345
31447
  const hostLayouts = useRecordsUi().layouts ?? [];
@@ -31401,6 +31503,8 @@ function ViewSwitcher({
31401
31503
  ...footer ? { footer } : {},
31402
31504
  ...embedded ? { embedded } : {},
31403
31505
  ...sortOverride !== void 0 ? { sortOverride } : {},
31506
+ ...searchOverride !== void 0 ? { searchOverride } : {},
31507
+ ...onSearchChange ? { onSearchChange } : {},
31404
31508
  ...newRowLabel ? { newRowLabel } : {},
31405
31509
  ...filter ? { filter } : {},
31406
31510
  ...onClearFilter ? { onClearFilter } : {},
@@ -32663,9 +32767,9 @@ import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react"
32663
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";
32664
32768
 
32665
32769
  // src/seedOnce.ts
32666
- import { useCallback as useCallback40, useRef as useRef38 } from "react";
32770
+ import { useCallback as useCallback40, useRef as useRef39 } from "react";
32667
32771
  function useSeedGuard() {
32668
- const claimed = useRef38(/* @__PURE__ */ new Set());
32772
+ const claimed = useRef39(/* @__PURE__ */ new Set());
32669
32773
  return useCallback40((name) => {
32670
32774
  if (claimed.current.has(name)) return false;
32671
32775
  claimed.current.add(name);
@@ -32983,7 +33087,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
32983
33087
  }
32984
33088
 
32985
33089
  // src/ProposalRow.tsx
32986
- 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";
32987
33091
  import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
32988
33092
  import { Badge as Badge15, Button as Button71, cn as cn57 } from "@ai-matrx/design-system";
32989
33093
  import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
@@ -33001,7 +33105,7 @@ function ProposalRow({
33001
33105
  const [settled, setSettled] = useState93(outcome ?? null);
33002
33106
  const [busy, setBusy] = useState93(false);
33003
33107
  const [confirming, setConfirming] = useState93(false);
33004
- const drawnVersion = useRef39(null);
33108
+ const drawnVersion = useRef40(null);
33005
33109
  const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
33006
33110
  useEffect77(() => {
33007
33111
  if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = readVersionNow(client, change.record);
@@ -33091,7 +33195,7 @@ function ProposalRow({
33091
33195
  }
33092
33196
 
33093
33197
  // src/ActionInbox.tsx
33094
- 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";
33095
33199
  import { useRecordsClient as useRecordsClient68 } from "@ai-matrx/records/react";
33096
33200
  import { Badge as Badge17, Button as Button73, Checkbox as Checkbox11, Skeleton as Skeleton16, cn as cn59 } from "@ai-matrx/design-system";
33097
33201
  import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
@@ -33996,9 +34100,9 @@ function ActionInbox({
33996
34100
  const [outcome, setOutcome] = useState95({});
33997
34101
  const [busy, setBusy] = useState95(null);
33998
34102
  const [cursor, setCursor] = useState95(0);
33999
- const listRef = useRef40(null);
34103
+ const listRef = useRef41(null);
34000
34104
  const [selected, setSelected] = useState95(/* @__PURE__ */ new Set());
34001
- const anchor = useRef40(null);
34105
+ const anchor = useRef41(null);
34002
34106
  const [deciding, setDeciding] = useState95(false);
34003
34107
  const [batchSaid, setBatchSaid] = useState95(null);
34004
34108
  const [view, setView] = useState95("inbox");
@@ -34062,9 +34166,9 @@ function ActionInbox({
34062
34166
  [client, load]
34063
34167
  );
34064
34168
  const [held, setHeld] = useState95({});
34065
- const holds2 = useRef40(/* @__PURE__ */ new Map());
34066
- const lastHold = useRef40(null);
34067
- const holdSeq = useRef40(0);
34169
+ const holds2 = useRef41(/* @__PURE__ */ new Map());
34170
+ const lastHold = useRef41(null);
34171
+ const holdSeq = useRef41(0);
34068
34172
  const [, tick] = useState95(0);
34069
34173
  useEffect79(() => {
34070
34174
  if (Object.keys(held).length === 0) return;
@@ -34121,7 +34225,7 @@ function ActionInbox({
34121
34225
  flush();
34122
34226
  };
34123
34227
  }, []);
34124
- const resumed = useRef40(false);
34228
+ const resumed = useRef41(false);
34125
34229
  useEffect79(() => {
34126
34230
  if (resumed.current || items === null || view !== "inbox") return;
34127
34231
  resumed.current = true;
@@ -34742,7 +34846,7 @@ function ActionInbox({
34742
34846
  }
34743
34847
 
34744
34848
  // src/HistoryPanel.tsx
34745
- 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";
34746
34850
  import {
34747
34851
  useFields as useFields20,
34748
34852
  useRecordChangeRevision,
@@ -34762,9 +34866,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
34762
34866
  const [error, setError] = useState96(null);
34763
34867
  const [open, setOpen] = useState96(null);
34764
34868
  const [pending, setPending] = useState96({ phase: "idle" });
34765
- const seenAtPreview = useRef41(null);
34869
+ const seenAtPreview = useRef42(null);
34766
34870
  const [said, setSaid] = useState96(null);
34767
- const listRef = useRef41(null);
34871
+ const listRef = useRef42(null);
34768
34872
  const changed = useRecordChangeRevision(recordId);
34769
34873
  const load = useCallback44(async () => {
34770
34874
  const answered = await client.recordHistory({ record_id: recordId });
@@ -35057,7 +35161,7 @@ function say(value, field2) {
35057
35161
  }
35058
35162
 
35059
35163
  // src/CommentThread.tsx
35060
- 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";
35061
35165
  import {
35062
35166
  useFields as useFields21,
35063
35167
  useRecordsClient as useRecordsClient70,
@@ -35081,7 +35185,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
35081
35185
  const [people, setPeople] = useState97([]);
35082
35186
  const [mentionQuery, setMentionQuery] = useState97(null);
35083
35187
  const [picked, setPicked] = useState97([]);
35084
- const box = useRef42(null);
35188
+ const box = useRef43(null);
35085
35189
  const load = useCallback45(async () => {
35086
35190
  const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
35087
35191
  if (!answered.ok) {
@@ -35301,7 +35405,7 @@ function Line({
35301
35405
  }
35302
35406
 
35303
35407
  // src/FieldHistoryPanel.tsx
35304
- 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";
35305
35409
  import {
35306
35410
  useFields as useFields22,
35307
35411
  useRecordsClient as useRecordsClient71,
@@ -35325,7 +35429,7 @@ function FieldHistoryPanel({
35325
35429
  const [rows, setRows] = useState98(null);
35326
35430
  const [error, setError] = useState98(null);
35327
35431
  const [pending, setPending] = useState98({ phase: "idle" });
35328
- const seenAtPreview = useRef43(null);
35432
+ const seenAtPreview = useRef44(null);
35329
35433
  const [said, setSaid] = useState98(null);
35330
35434
  const load = useCallback46(async () => {
35331
35435
  const answered = await client.fieldHistory(
@@ -35573,7 +35677,7 @@ function submissionStamp(args) {
35573
35677
  }
35574
35678
 
35575
35679
  // src/PortalBuilder.tsx
35576
- 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";
35577
35681
  import { useRecordsClient as useRecordsClient72, useTables as useTables4 } from "@ai-matrx/records/react";
35578
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";
35579
35683
  import { Fragment as Fragment44, jsx as jsx115, jsxs as jsxs104 } from "react/jsx-runtime";
@@ -35663,7 +35767,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
35663
35767
  if (on) void loadFields(t.id);
35664
35768
  }
35665
35769
  const [linking, setLinking] = useState99(null);
35666
- const linkingNow = useRef44(null);
35770
+ const linkingNow = useRef45(null);
35667
35771
  async function addLinkBack(id) {
35668
35772
  const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
35669
35773
  if (!clientTableId || !clients) return;
@@ -35690,7 +35794,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
35690
35794
  linkingNow.current = null;
35691
35795
  setLinking(null);
35692
35796
  }
35693
- const autoLinked = useRef44(/* @__PURE__ */ new Set());
35797
+ const autoLinked = useRef45(/* @__PURE__ */ new Set());
35694
35798
  useEffect83(() => {
35695
35799
  if (linking !== null || !clientTableId) return;
35696
35800
  for (const e of Object.values(exposures)) {
@@ -37911,7 +38015,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
37911
38015
 
37912
38016
  // src/FormBuilder.tsx
37913
38017
  import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
37914
- 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";
37915
38019
  import { useFields as useFields24, useRecordsClient as useRecordsClient79, useTable as useTable26 } from "@ai-matrx/records/react";
37916
38020
  import { publicFormPath } from "@ai-matrx/records";
37917
38021
  import {
@@ -37925,7 +38029,7 @@ import {
37925
38029
  } from "@ai-matrx/design-system";
37926
38030
 
37927
38031
  // src/FormRunner.tsx
37928
- 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";
37929
38033
  import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
37930
38034
  import { Button as Button83, Progress, Skeleton as Skeleton25, cn as cn72 } from "@ai-matrx/design-system";
37931
38035
  import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
@@ -38026,8 +38130,8 @@ function FormStage({
38026
38130
  const [writing, setWriting] = useState105(false);
38027
38131
  const [done, setDone] = useState105(null);
38028
38132
  const [hidden, setHidden] = useState105({});
38029
- const decoy = useRef45("");
38030
- const stage = useRef45(null);
38133
+ const decoy = useRef46("");
38134
+ const stage = useRef46(null);
38031
38135
  const questions = useMemo61(() => {
38032
38136
  const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
38033
38137
  return (form.questions ?? []).map((q) => {
@@ -38088,13 +38192,13 @@ function FormStage({
38088
38192
  };
38089
38193
  }, [whichAsked, questions, answers]);
38090
38194
  const live = questions.filter((q) => !hidden[q.key]);
38091
- const told = useRef45(answers);
38195
+ const told = useRef46(answers);
38092
38196
  useEffect89(() => {
38093
38197
  if (told.current === answers) return;
38094
38198
  told.current = answers;
38095
38199
  onAnswersChange?.(answers);
38096
38200
  }, [answers, onAnswersChange]);
38097
- const resumeAt = useRef45(
38201
+ const resumeAt = useRef46(
38098
38202
  resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
38099
38203
  const v = initialAnswers[q.key];
38100
38204
  return v === void 0 || v === null || v === "";
@@ -38687,7 +38791,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
38687
38791
  const [lookUnread, setLookUnread] = useState107(null);
38688
38792
  const [restoredAt, setRestoredAt] = useState107(null);
38689
38793
  const [adding, setAdding] = useState107(false);
38690
- const keysBeforeAdd = useRef46(null);
38794
+ const keysBeforeAdd = useRef47(null);
38691
38795
  const [makeOnMount, setMakeOnMount] = useState107("waiting");
38692
38796
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
38693
38797
  const load = useCallback54(async () => {
@@ -39506,13 +39610,13 @@ function bucketWindow2(groupKey, value) {
39506
39610
  import {
39507
39611
  useEffect as useEffect92,
39508
39612
  useId as useId3,
39509
- useRef as useRef47,
39613
+ useRef as useRef48,
39510
39614
  useState as useState108
39511
39615
  } from "react";
39512
39616
  import { cn as cn75 } from "@ai-matrx/design-system";
39513
39617
  import { jsx as jsx127, jsxs as jsxs116 } from "react/jsx-runtime";
39514
39618
  function useMeasuredWidth(fallback = 480) {
39515
- const ref = useRef47(null);
39619
+ const ref = useRef48(null);
39516
39620
  const [width, setWidth] = useState108(fallback);
39517
39621
  useEffect92(() => {
39518
39622
  const node = ref.current;
@@ -39800,7 +39904,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
39800
39904
  }
39801
39905
 
39802
39906
  // src/DocRender.tsx
39803
- 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";
39804
39908
  import { useRecordsClient as useRecordsClient81 } from "@ai-matrx/records/react";
39805
39909
  import { Button as Button87, Skeleton as Skeleton29, cn as cn77 } from "@ai-matrx/design-system";
39806
39910
  import { jsx as jsx129, jsxs as jsxs118 } from "react/jsx-runtime";
@@ -39811,7 +39915,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
39811
39915
  const [showing, setShowing] = useState110(null);
39812
39916
  const [error, setError] = useState110(null);
39813
39917
  const [busy, setBusy] = useState110(null);
39814
- const paper = useRef48(null);
39918
+ const paper = useRef49(null);
39815
39919
  const load = useCallback56(async () => {
39816
39920
  const [body, held] = await Promise.all([
39817
39921
  client.docRenderBody({ template_id: templateId, record_id: recordId }),
@@ -40782,7 +40886,7 @@ import { RecordsProvider as RecordsProvider2, useFields as useFields27, useRecor
40782
40886
  import { Button as Button89, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
40783
40887
 
40784
40888
  // src/RecordsMount.tsx
40785
- import { useRef as useRef49 } from "react";
40889
+ import { useRef as useRef50 } from "react";
40786
40890
  import { RecordsProvider } from "@ai-matrx/records/react";
40787
40891
  import { jsx as jsx133 } from "react/jsx-runtime";
40788
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.";
@@ -40800,7 +40904,7 @@ function RecordsMount({
40800
40904
  return /* @__PURE__ */ jsx133(RecordsProvider, { config, children: /* @__PURE__ */ jsx133(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsx133(RecordLabelProvider, { children }) }) });
40801
40905
  }
40802
40906
  function useShallowStableHost(host) {
40803
- const held = useRef49(null);
40907
+ const held = useRef50(null);
40804
40908
  const next = host ?? {};
40805
40909
  const previous = held.current;
40806
40910
  if (previous !== null && sameParts(previous, next)) return previous;
@@ -41894,7 +41998,7 @@ function TargetControl({
41894
41998
  }
41895
41999
 
41896
42000
  // src/QuestionPanel.tsx
41897
- 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";
41898
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";
41899
42003
  import { useFields as useFields30, useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
41900
42004
 
@@ -42346,7 +42450,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
42346
42450
  const [saveError, setSaveError] = useState116(null);
42347
42451
  const [saving, setSaving] = useState116(false);
42348
42452
  const [linkMissed, setLinkMissed] = useState116(false);
42349
- const openedFromLink = useRef50(false);
42453
+ const openedFromLink = useRef51(false);
42350
42454
  useEffect99(() => {
42351
42455
  let live = true;
42352
42456
  void questionsOf(client, tableId).then((answer2) => {
@@ -44090,12 +44194,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
44090
44194
  }
44091
44195
 
44092
44196
  // src/CaptureSheet.tsx
44093
- 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";
44094
44198
  import { useFields as useFields33, useRecordsClient as useRecordsClient90, useTable as useTable33 } from "@ai-matrx/records/react";
44095
44199
  import { Button as Button97, Input as Input8, Skeleton as Skeleton37, Textarea as Textarea7, cn as cn86 } from "@ai-matrx/design-system";
44096
44200
 
44097
44201
  // src/CaptureRun.tsx
44098
- 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";
44099
44203
  import {
44100
44204
  coerceTypedAnswer as coerceTypedAnswer3,
44101
44205
  coercionLabel,
@@ -44153,7 +44257,7 @@ function CaptureRun({ sheetId, face: given, className }) {
44153
44257
  const [items, setItems] = useState120([]);
44154
44258
  const [lastSynced, setLastSynced] = useState120(null);
44155
44259
  const [sending, setSending] = useState120(false);
44156
- const queueRef = useRef51(null);
44260
+ const queueRef = useRef52(null);
44157
44261
  useEffect102(() => {
44158
44262
  const q2 = openCaptureQueue({
44159
44263
  onChange: (c, all) => {
@@ -44533,7 +44637,7 @@ function AdHocCaptureSheet({
44533
44637
  const [error, setError] = useState121(null);
44534
44638
  const [uploadError, setUploadError] = useState121(null);
44535
44639
  const [flushing, setFlushing] = useState121(false);
44536
- const queue = useRef52([]);
44640
+ const queue = useRef53([]);
44537
44641
  const keep = useCallback62(
44538
44642
  async (next) => {
44539
44643
  queue.current = next;
@@ -45073,7 +45177,7 @@ function useEmbedHandshake(args) {
45073
45177
  }
45074
45178
 
45075
45179
  // src/TablePage.tsx
45076
- 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";
45077
45181
  import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
45078
45182
  import { useFields as useFields36, useRecordsClient as useRecordsClient95, useTable as useTable35 } from "@ai-matrx/records/react";
45079
45183
  import {
@@ -45832,22 +45936,22 @@ function RailFrame({
45832
45936
  return /* @__PURE__ */ jsx152("aside", { "data-rail-column": "", className: "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3", children });
45833
45937
  }
45834
45938
  function filterInWords(filter, fields) {
45835
- const nameOf = (key) => {
45939
+ const nameOf2 = (key) => {
45836
45940
  const field2 = fields.find((f) => f.key === key);
45837
45941
  return field2 ? fieldName(field2) : humanizeIdentifier17(key);
45838
45942
  };
45839
45943
  const parts = Object.keys(filter).map((key) => {
45840
45944
  const value = filter[key];
45841
- if (value === null || value === void 0) return `${nameOf(key)} is not filled in`;
45945
+ if (value === null || value === void 0) return `${nameOf2(key)} is not filled in`;
45842
45946
  if (typeof value === "object") {
45843
45947
  const from = (value.from ?? "").toString().trim();
45844
45948
  const to = (value.to ?? "").toString().trim();
45845
- if (from !== "" && to !== "") return `${nameOf(key)} from ${from} up to ${to}`;
45846
- if (from !== "") return `${nameOf(key)} from ${from} onwards`;
45847
- if (to !== "") return `${nameOf(key)} up to ${to}`;
45848
- return `${nameOf(key)} in a period nobody named`;
45949
+ if (from !== "" && to !== "") return `${nameOf2(key)} from ${from} up to ${to}`;
45950
+ if (from !== "") return `${nameOf2(key)} from ${from} onwards`;
45951
+ if (to !== "") return `${nameOf2(key)} up to ${to}`;
45952
+ return `${nameOf2(key)} in a period nobody named`;
45849
45953
  }
45850
- return `${nameOf(key)} is ${String(value)}`;
45954
+ return `${nameOf2(key)} is ${String(value)}`;
45851
45955
  });
45852
45956
  if (parts.length === 0) return "";
45853
45957
  if (parts.length === 1) return parts[0];
@@ -46047,6 +46151,8 @@ function TablePage({
46047
46151
  tableId,
46048
46152
  presentation: pagePresentation2 = "page",
46049
46153
  newRowLabel,
46154
+ searchOverride,
46155
+ onSearchChange,
46050
46156
  pageSize: pageSizeAsked,
46051
46157
  seedViews,
46052
46158
  onLeave,
@@ -46105,7 +46211,7 @@ function TablePage({
46105
46211
  const [hostLayout, setHostLayout] = useState131(hostFromLink);
46106
46212
  const [views, setViews] = useState131(void 0);
46107
46213
  const [pickedViewId, setPickedViewId] = useState131(savedFromLink);
46108
- const viewSeen = useRef53(null);
46214
+ const viewSeen = useRef54(null);
46109
46215
  const [viewLinkMissed, setViewLinkMissed] = useState131(false);
46110
46216
  const [layoutChosen, setLayoutChosen] = useState131(false);
46111
46217
  const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
@@ -46140,7 +46246,7 @@ function TablePage({
46140
46246
  const face = tableOpening(view, hostLayouts.map((h) => h.id));
46141
46247
  const designated = face.kind === "designated";
46142
46248
  const embedded = pagePresentation2 === "embedded";
46143
- const pageSize = pageSizeAsked ?? (embedded ? 50 : 100);
46249
+ const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 100);
46144
46250
  const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
46145
46251
  const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
46146
46252
  const controlsInSheet = phone && !designated;
@@ -46176,7 +46282,7 @@ function TablePage({
46176
46282
  lookDiffers: view ? lookDiffers(view, look) : false
46177
46283
  };
46178
46284
  const shownSignature = JSON.stringify(shownReport);
46179
- const reportRef = useRef53(onShownViewChange);
46285
+ const reportRef = useRef54(onShownViewChange);
46180
46286
  reportRef.current = onShownViewChange;
46181
46287
  useEffect109(() => {
46182
46288
  reportRef.current?.(JSON.parse(shownSignature));
@@ -46237,7 +46343,7 @@ function TablePage({
46237
46343
  },
46238
46344
  [client, tableId, view, looks]
46239
46345
  );
46240
- const arrival = useRef53(viewAddress ?? null);
46346
+ const arrival = useRef54(viewAddress ?? null);
46241
46347
  const [gridQuery, setGridQuery] = useState131(null);
46242
46348
  const [addressResetEpoch, setAddressResetEpoch] = useState131(0);
46243
46349
  const reportGrid = useCallback67((q) => {
@@ -46248,7 +46354,7 @@ function TablePage({
46248
46354
  () => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
46249
46355
  [reportGrid, addressResetEpoch]
46250
46356
  );
46251
- const hiddenApplied = useRef53(false);
46357
+ const hiddenApplied = useRef54(false);
46252
46358
  useEffect109(() => {
46253
46359
  const hidden = arrival.current?.hidden;
46254
46360
  if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
@@ -46269,9 +46375,9 @@ function TablePage({
46269
46375
  const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
46270
46376
  const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
46271
46377
  const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
46272
- const addressReportRef = useRef53(onViewAddressChange);
46378
+ const addressReportRef = useRef54(onViewAddressChange);
46273
46379
  addressReportRef.current = onViewAddressChange;
46274
- const addressSent = useRef53(null);
46380
+ const addressSent = useRef54(null);
46275
46381
  useEffect109(() => {
46276
46382
  if (!addressReady) return;
46277
46383
  if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
@@ -46526,9 +46632,9 @@ function TablePage({
46526
46632
  }
46527
46633
  });
46528
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;
46529
- const actionsRef = useRef53(actions);
46635
+ const actionsRef = useRef54(actions);
46530
46636
  actionsRef.current = actions;
46531
- const onActionsRef = useRef53(onActions);
46637
+ const onActionsRef = useRef54(onActions);
46532
46638
  onActionsRef.current = onActions;
46533
46639
  useEffect109(() => {
46534
46640
  onActionsRef.current?.(actionsRef.current);
@@ -46931,6 +47037,8 @@ function TablePage({
46931
47037
  chooser: false,
46932
47038
  ...embedded ? { embedded } : {},
46933
47039
  ...newRowLabel ? { newRowLabel } : {},
47040
+ ...searchOverride !== void 0 ? { searchOverride } : {},
47041
+ ...onSearchChange ? { onSearchChange } : {},
46934
47042
  footer,
46935
47043
  openExport: () => setRail("export"),
46936
47044
  view: {
@@ -47093,6 +47201,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
47093
47201
  }
47094
47202
 
47095
47203
  // src/entityViews.tsx
47204
+ import { MatrxTableCardShowMore as MatrxTableCardShowMore2 } from "@ai-matrx/design-system/data-table";
47096
47205
  import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
47097
47206
  import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn93 } from "@ai-matrx/design-system";
47098
47207
  import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
@@ -47236,7 +47345,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
47236
47345
  function EntityTablePage({
47237
47346
  source,
47238
47347
  presentation = "page",
47239
- pageSize = 100,
47348
+ pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
47240
47349
  layout: opened = "grid",
47241
47350
  onLayoutChange,
47242
47351
  groupBy,
@@ -47320,7 +47429,18 @@ function EntityTablePage({
47320
47429
  ] })
47321
47430
  ] }) : null,
47322
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,
47323
- 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
+ ] })
47324
47444
  ] });
47325
47445
  }
47326
47446