@ai-matrx/records-ui 0.110.11 → 0.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2860,6 +2860,15 @@ interface FieldEditorCommon {
2860
2860
  /** Called after the store has accepted the removal, so the list can re-read. */
2861
2861
  onRemoved?: (() => void) | undefined;
2862
2862
  className?: string | undefined;
2863
+ /**
2864
+ * A NEW column that starts as this kind (and name) — a host's own type menu (Spaces' "New property"
2865
+ * → Formula / Rollup) opens the panel already on the kind the person picked. Ignored when `field`
2866
+ * or `copyOf` is given.
2867
+ */
2868
+ startAs?: {
2869
+ type: PickableFieldType;
2870
+ label?: string | undefined;
2871
+ } | undefined;
2863
2872
  }
2864
2873
  /**
2865
2874
  * ONE EDITOR FOR BOTH KINDS OF TABLE (lane 7 STANDARD-TABLES, wave 1; Doctrine R13).
package/dist/index.d.ts CHANGED
@@ -2860,6 +2860,15 @@ interface FieldEditorCommon {
2860
2860
  /** Called after the store has accepted the removal, so the list can re-read. */
2861
2861
  onRemoved?: (() => void) | undefined;
2862
2862
  className?: string | undefined;
2863
+ /**
2864
+ * A NEW column that starts as this kind (and name) — a host's own type menu (Spaces' "New property"
2865
+ * → Formula / Rollup) opens the panel already on the kind the person picked. Ignored when `field`
2866
+ * or `copyOf` is given.
2867
+ */
2868
+ startAs?: {
2869
+ type: PickableFieldType;
2870
+ label?: string | undefined;
2871
+ } | undefined;
2863
2872
  }
2864
2873
  /**
2865
2874
  * ONE EDITOR FOR BOTH KINDS OF TABLE (lane 7 STANDARD-TABLES, wave 1; Doctrine R13).
package/dist/index.js CHANGED
@@ -12370,8 +12370,9 @@ function FieldEditor(props) {
12370
12370
  const sensitivities = onEntity ? SENSITIVITIES.filter((row) => row.value === "public" || row.value === "internal") : SENSITIVITIES;
12371
12371
  const copyOf = field2 ? void 0 : props.copyOf;
12372
12372
  const start = field2 ?? copyOf;
12373
- const [label, setLabel] = useState33(field2?.label ?? (copyOf ? `${copyOf.label} (1)` : ""));
12374
- const [type, setType] = useState33(() => startingType(start));
12373
+ const startAs = start ? void 0 : props.startAs;
12374
+ const [label, setLabel] = useState33(field2?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
12375
+ const [type, setType] = useState33(() => startAs ? startAs.type : startingType(start));
12375
12376
  const [required, setRequired] = useState33(start?.required ?? false);
12376
12377
  const [multi, setMulti] = useState33(start?.multi ?? false);
12377
12378
  const [dated, setDated] = useState33(start?.dated ?? false);
@@ -12438,6 +12439,9 @@ function FieldEditor(props) {
12438
12439
  );
12439
12440
  const rollupFilterChanged = JSON.stringify(rollupFilter) !== JSON.stringify(savedRollupFilter);
12440
12441
  const [relationTarget, setRelationTarget] = useState33(String(start?.relation_target ?? ""));
12442
+ const [showOnOther, setShowOnOther] = useState33(true);
12443
+ const [reverseRefused, setReverseRefused] = useState33(null);
12444
+ const otherTable = useTable(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
12441
12445
  const [display, setDisplay] = useState33(start?.display ?? null);
12442
12446
  const [formulaOp, setFormulaOp] = useState33(() => formulaOpOf(start));
12443
12447
  const [formulaFields, setFormulaFields] = useState33(() => formulaFieldIdsOf(start));
@@ -12649,6 +12653,15 @@ function FieldEditor(props) {
12649
12653
  }
12650
12654
  }
12651
12655
  setBackfillError(null);
12656
+ if (type === "relation" && showOnOther && otherTable.data && otherTable.data.id !== tableId) {
12657
+ const made = await client.relationReverseField({ field_id: written });
12658
+ if (!made.ok) {
12659
+ setReverseRefused(made.error);
12660
+ return;
12661
+ }
12662
+ tableShapeChanged4(relationTarget);
12663
+ }
12664
+ setReverseRefused(null);
12652
12665
  onSaved?.();
12653
12666
  };
12654
12667
  const remove = async () => {
@@ -12840,6 +12853,19 @@ function FieldEditor(props) {
12840
12853
  ),
12841
12854
  "Each value has its own date"
12842
12855
  ] }),
12856
+ !field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ jsxs37("label", { className: "flex items-center gap-1.5", children: [
12857
+ /* @__PURE__ */ jsx42(
12858
+ Checkbox6,
12859
+ {
12860
+ checked: showOnOther,
12861
+ "aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
12862
+ onCheckedChange: (v) => setShowOnOther(v === true),
12863
+ "data-records-show-on-other": ""
12864
+ }
12865
+ ),
12866
+ "Show on ",
12867
+ otherTable.data.name ?? "the other table"
12868
+ ] }) : null,
12843
12869
  CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ jsxs37("label", { className: "flex items-center gap-1.5", children: [
12844
12870
  /* @__PURE__ */ jsx42(
12845
12871
  Checkbox6,
@@ -13007,6 +13033,10 @@ function FieldEditor(props) {
13007
13033
  ) : null,
13008
13034
  /* @__PURE__ */ jsx42(Button18, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
13009
13035
  ] }) : null,
13036
+ reverseRefused ? /* @__PURE__ */ jsxs37("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
13037
+ /* @__PURE__ */ jsx42("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
13038
+ /* @__PURE__ */ jsx42(RefusalNotice, { error: reverseRefused })
13039
+ ] }) : null,
13010
13040
  backfillError ? /* @__PURE__ */ jsxs37("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
13011
13041
  /* @__PURE__ */ jsx42("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
13012
13042
  /* @__PURE__ */ jsx42(RefusalNotice, { error: backfillError })
@@ -19215,8 +19245,9 @@ function withTypeMark(field2, header) {
19215
19245
 
19216
19246
  // src/ReverseColumns.tsx
19217
19247
  import { useCallback as useCallback21, useEffect as useEffect43, useMemo as useMemo28, useRef as useRef30, useState as useState52, useSyncExternalStore as useSyncExternalStore3 } from "react";
19218
- import { useFields as useFields6, useReverseColumns as useReverseColumns3, useReverseLinks, useTable as useTable4 } from "@ai-matrx/records/react";
19219
- import { Button as Button35, Dialog as Dialog10, DialogContent as DialogContent10, DialogHeader as DialogHeader10, DialogTitle as DialogTitle10, Separator as Separator4, Skeleton as Skeleton5, cn as cn33 } from "@ai-matrx/design-system";
19248
+ import { isReverseField } from "@ai-matrx/records";
19249
+ import { useFields as useFields6, useOptionalRecordsClient as useOptionalRecordsClient9, useReverseColumns as useReverseColumns3, useReverseLinks, useTable as useTable4 } from "@ai-matrx/records/react";
19250
+ import { Button as Button35, Dialog as Dialog10, DialogContent as DialogContent10, DialogHeader as DialogHeader10, DialogTitle as DialogTitle10, Popover as Popover7, PopoverContent as PopoverContent7, PopoverTrigger as PopoverTrigger7, Separator as Separator4, Skeleton as Skeleton5, cn as cn33 } from "@ai-matrx/design-system";
19220
19251
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
19221
19252
  function reverseColumnId(column) {
19222
19253
  return `${REVERSE_COLUMN_PREFIX}${column.key}`;
@@ -19339,7 +19370,71 @@ function ReverseCell({ held, column, rowId, tableId }) {
19339
19370
  const readReading = () => held.reading;
19340
19371
  const answer = useSyncExternalStore3(subscribe, readAnswer, readAnswer);
19341
19372
  const reading = useSyncExternalStore3(subscribe, readReading, readReading);
19342
- return /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
19373
+ const chips = /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
19374
+ if (column.read_only) return chips;
19375
+ return /* @__PURE__ */ jsxs56("span", { className: "flex min-w-0 items-start gap-1", children: [
19376
+ /* @__PURE__ */ jsx61("span", { className: "min-w-0 flex-1", children: chips }),
19377
+ /* @__PURE__ */ jsx61(ReverseLinksEditPopover, { tableId, recordId: rowId, column })
19378
+ ] });
19379
+ }
19380
+ function useReverseField(tableId, column) {
19381
+ const client = useOptionalRecordsClient9();
19382
+ const [field2, setField] = useState52(null);
19383
+ useEffect43(() => {
19384
+ if (column.read_only || !client) return;
19385
+ let live = true;
19386
+ void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
19387
+ if (live && read.ok) setField(read.data.find((f) => f.key === column.key && isReverseField(f)) ?? null);
19388
+ });
19389
+ return () => {
19390
+ live = false;
19391
+ };
19392
+ }, [client, tableId, column.key, column.read_only]);
19393
+ return field2;
19394
+ }
19395
+ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
19396
+ const client = useOptionalRecordsClient9();
19397
+ const field2 = useReverseField(tableId, column);
19398
+ const ids = useMemo28(() => [recordId], [recordId]);
19399
+ const one = useMemo28(() => [column], [column]);
19400
+ const read = useReverseLinks(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
19401
+ const answer = read.data?.[column.key]?.[recordId];
19402
+ const [refused, setRefused] = useState52(null);
19403
+ if (read.error) return /* @__PURE__ */ jsx61(RefusalNotice, { error: read.error });
19404
+ if (!field2 || !answer || !client) return /* @__PURE__ */ jsx61(Skeleton5, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
19405
+ const current = answer.links.map((l) => l.id);
19406
+ const write = async (next) => {
19407
+ const want = (Array.isArray(next) ? next : next ? [next] : []).map(String);
19408
+ const add = want.filter((id) => !current.includes(id));
19409
+ const remove = current.filter((id) => !want.includes(id));
19410
+ if (add.length === 0 && remove.length === 0) return;
19411
+ const done = await client.relationReverseSet({ record_id: recordId, field_id: field2.id, add, remove });
19412
+ setRefused(done.ok ? null : done.error);
19413
+ if (done.ok) read.reload();
19414
+ };
19415
+ return /* @__PURE__ */ jsxs56("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
19416
+ /* @__PURE__ */ jsx61(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose }),
19417
+ refused ? /* @__PURE__ */ jsx61(RefusalNotice, { error: refused }) : null
19418
+ ] });
19419
+ }
19420
+ var REVERSE_LINKS_EDIT_MAX = 50;
19421
+ function ReverseLinksEditPopover({ tableId, recordId, column }) {
19422
+ const [open, setOpen] = useState52(false);
19423
+ return /* @__PURE__ */ jsxs56(Popover7, { open, onOpenChange: setOpen, children: [
19424
+ /* @__PURE__ */ jsx61(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx61(
19425
+ Button35,
19426
+ {
19427
+ size: "sm",
19428
+ variant: "ghost",
19429
+ className: "h-5 w-5 shrink-0 p-0 text-muted-foreground",
19430
+ "aria-label": `Link ${column.source_table_name}`,
19431
+ title: `Link ${column.source_table_name}`,
19432
+ "data-records-reverse-edit": column.key,
19433
+ children: "+"
19434
+ }
19435
+ ) }),
19436
+ /* @__PURE__ */ jsx61(PopoverContent7, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ jsx61(ReverseLinksEditor, { tableId, recordId, column }) : null })
19437
+ ] });
19343
19438
  }
19344
19439
  var EMPTY_COLUMNS = [];
19345
19440
  function ReverseLinksSections({ tableId, recordId }) {
@@ -19365,7 +19460,7 @@ function ReverseLinksSection({ tableId, recordId, column }) {
19365
19460
  answer && answer.total > 0 ? /* @__PURE__ */ jsx61("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
19366
19461
  /* @__PURE__ */ jsx61(AddLinkedButton, { column, onAdd: () => setAdding(true) })
19367
19462
  ] }),
19368
- first.error ? /* @__PURE__ */ jsx61(RefusalNotice, { error: first.error }) : /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: first.loading }),
19463
+ first.error ? /* @__PURE__ */ jsx61(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ jsx61(ReverseLinksEditor, { tableId, recordId, column }),
19369
19464
  answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ jsxs56(Button35, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
19370
19465
  "Show ",
19371
19466
  Math.min(REVERSE_PANEL_PAGE, answer.total - answer.links.length),
@@ -23281,7 +23376,7 @@ function BulkActions({
23281
23376
  import { useEffect as useEffect51, useMemo as useMemo35, useRef as useRef36, useState as useState60 } from "react";
23282
23377
  import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
23283
23378
  import { stableFilterKey as stableFilterKey2 } from "@ai-matrx/records";
23284
- import { Button as Button41, ConfirmDialog as ConfirmDialog4, Popover as Popover7, PopoverContent as PopoverContent7, PopoverTrigger as PopoverTrigger7, cn as cn35 } from "@ai-matrx/design-system";
23379
+ import { Button as Button41, ConfirmDialog as ConfirmDialog4, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, cn as cn35 } from "@ai-matrx/design-system";
23285
23380
  import { jsx as jsx71, jsxs as jsxs64 } from "react/jsx-runtime";
23286
23381
  function sortArrow(direction) {
23287
23382
  return direction === "asc" ? "\u2191" : "\u2193";
@@ -23307,8 +23402,8 @@ function SortGlyph() {
23307
23402
  }
23308
23403
  function SortStateControl({ label, line, attention = false, actions = [], mode }) {
23309
23404
  const [open, setOpen] = useState60(false);
23310
- return /* @__PURE__ */ jsxs64(Popover7, { open, onOpenChange: setOpen, children: [
23311
- /* @__PURE__ */ jsx71(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsxs64(
23405
+ return /* @__PURE__ */ jsxs64(Popover8, { open, onOpenChange: setOpen, children: [
23406
+ /* @__PURE__ */ jsx71(PopoverTrigger8, { asChild: true, children: /* @__PURE__ */ jsxs64(
23312
23407
  Button41,
23313
23408
  {
23314
23409
  size: "sm",
@@ -23331,7 +23426,7 @@ function SortStateControl({ label, line, attention = false, actions = [], mode }
23331
23426
  ]
23332
23427
  }
23333
23428
  ) }),
23334
- /* @__PURE__ */ jsxs64(PopoverContent7, { sizing: "content", align: "start", className: "w-72 p-2", "data-sort-state": "", children: [
23429
+ /* @__PURE__ */ jsxs64(PopoverContent8, { sizing: "content", align: "start", className: "w-72 p-2", "data-sort-state": "", children: [
23335
23430
  /* @__PURE__ */ jsx71("p", { className: "px-1 pb-2 text-xs text-foreground", children: line }),
23336
23431
  actions.length > 0 ? /* @__PURE__ */ jsx71("div", { className: "flex flex-wrap justify-end gap-1", children: actions.map((action3) => /* @__PURE__ */ jsx71(
23337
23432
  Button41,
@@ -25768,7 +25863,7 @@ function sortIgnoredOf(answer) {
25768
25863
  // src/RecordsTableCard.tsx
25769
25864
  import { MatrxTableCard, MatrxTableCardEmpty, MatrxTableCardShowMore as MatrxTableCardShowMore2, TABLE_CARD_DEFAULT_INITIAL_ROWS } from "@ai-matrx/design-system/data-table";
25770
25865
  import { Button as Button43 } from "@ai-matrx/design-system";
25771
- import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable7 } from "@ai-matrx/records/react";
25866
+ import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient10, useTable as useTable7 } from "@ai-matrx/records/react";
25772
25867
 
25773
25868
  // src/entityTable.tsx
25774
25869
  import { useId as useId2, useMemo as useMemo38 } from "react";
@@ -26002,7 +26097,7 @@ function EntityGrid({
26002
26097
  // src/RecordsTableCard.tsx
26003
26098
  import { Fragment as Fragment27, jsx as jsx74, jsxs as jsxs66 } from "react/jsx-runtime";
26004
26099
  function RecordsTableCard(props) {
26005
- const client = useOptionalRecordsClient9();
26100
+ const client = useOptionalRecordsClient10();
26006
26101
  if (!client) {
26007
26102
  return /* @__PURE__ */ jsx74(MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ jsx74(MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
26008
26103
  }
@@ -27883,7 +27978,7 @@ function nextInWords(page) {
27883
27978
  import { useEffect as useEffect58, useState as useState68 } from "react";
27884
27979
  import { moveConsequence } from "@ai-matrx/records";
27885
27980
  import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
27886
- import { Button as Button50, ErrorBox as ErrorBox4, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8 } from "@ai-matrx/design-system";
27981
+ import { Button as Button50, ErrorBox as ErrorBox4, Popover as Popover9, PopoverContent as PopoverContent9, PopoverTrigger as PopoverTrigger9 } from "@ai-matrx/design-system";
27887
27982
  import { jsx as jsx84, jsxs as jsxs75 } from "react/jsx-runtime";
27888
27983
  function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "header", openAsked = 0 }) {
27889
27984
  const client = useRecordsClient46();
@@ -27944,7 +28039,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
27944
28039
  onMoved?.(moved.data.to);
27945
28040
  }
27946
28041
  return /* @__PURE__ */ jsxs75(
27947
- Popover8,
28042
+ Popover9,
27948
28043
  {
27949
28044
  open,
27950
28045
  onOpenChange: (next) => {
@@ -27956,7 +28051,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
27956
28051
  setOpen(next);
27957
28052
  },
27958
28053
  children: [
27959
- /* @__PURE__ */ jsx84(PopoverTrigger8, { asChild: true, children: variant === "anchor" ? /* @__PURE__ */ jsx84("span", { "aria-hidden": true, className: "pointer-events-none inline-block h-0 w-0", "data-where-it-lives-anchor": tableId }) : /* @__PURE__ */ jsxs75(
28054
+ /* @__PURE__ */ jsx84(PopoverTrigger9, { asChild: true, children: variant === "anchor" ? /* @__PURE__ */ jsx84("span", { "aria-hidden": true, className: "pointer-events-none inline-block h-0 w-0", "data-where-it-lives-anchor": tableId }) : /* @__PURE__ */ jsxs75(
27960
28055
  "button",
27961
28056
  {
27962
28057
  type: "button",
@@ -27975,7 +28070,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
27975
28070
  }
27976
28071
  ) }),
27977
28072
  /* @__PURE__ */ jsx84(
27978
- PopoverContent8,
28073
+ PopoverContent9,
27979
28074
  {
27980
28075
  align: "start",
27981
28076
  className: "w-80 p-3 text-xs",
@@ -30281,7 +30376,7 @@ function RecordFieldsInPlace({
30281
30376
  // src/ShareControl.tsx
30282
30377
  import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
30283
30378
  import { useEffect as useEffect67, useState as useState79 } from "react";
30284
- import { Button as Button59, Popover as Popover9, PopoverContent as PopoverContent9, PopoverTrigger as PopoverTrigger9 } from "@ai-matrx/design-system";
30379
+ import { Button as Button59, Popover as Popover10, PopoverContent as PopoverContent10, PopoverTrigger as PopoverTrigger10 } from "@ai-matrx/design-system";
30285
30380
  import { Fragment as Fragment35, jsx as jsx96, jsxs as jsxs87 } from "react/jsx-runtime";
30286
30381
  function useCanShare() {
30287
30382
  return typeof useRecordsUi().share === "function";
@@ -30348,9 +30443,9 @@ function ShareForSomebodyElse({
30348
30443
  setCopied("no");
30349
30444
  }
30350
30445
  };
30351
- return /* @__PURE__ */ jsxs87(Popover9, { onOpenChange: (open) => open ? null : setCopied(null), children: [
30352
- /* @__PURE__ */ jsx96(PopoverTrigger9, { asChild: true, children: /* @__PURE__ */ jsx96(Button59, { size, variant, className, title: kind === "table" ? "Who can share this table" : "Who can share this record", "data-share-for-somebody-else": "", children: "Share" }) }),
30353
- /* @__PURE__ */ jsxs87(PopoverContent9, { align: "end", className: "w-72 space-y-2 p-3 text-sm", children: [
30446
+ return /* @__PURE__ */ jsxs87(Popover10, { onOpenChange: (open) => open ? null : setCopied(null), children: [
30447
+ /* @__PURE__ */ jsx96(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsx96(Button59, { size, variant, className, title: kind === "table" ? "Who can share this table" : "Who can share this record", "data-share-for-somebody-else": "", children: "Share" }) }),
30448
+ /* @__PURE__ */ jsxs87(PopoverContent10, { align: "end", className: "w-72 space-y-2 p-3 text-sm", children: [
30354
30449
  /* @__PURE__ */ jsx96("p", { children: whyNot }),
30355
30450
  /* @__PURE__ */ jsxs87("p", { className: "text-xs text-muted-foreground", children: [
30356
30451
  "The link opens this ",
@@ -33790,7 +33885,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
33790
33885
 
33791
33886
  // src/GalleryCover.tsx
33792
33887
  import { useEffect as useEffect76, useState as useState89 } from "react";
33793
- import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
33888
+ import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
33794
33889
  import { Fragment as Fragment43, jsx as jsx107 } from "react/jsx-runtime";
33795
33890
  function isImageAddress(value) {
33796
33891
  return typeof value === "string" && /^(https?:\/\/|\/|data:image\/)/i.test(value.trim());
@@ -33808,7 +33903,7 @@ function GalleryCover({ field: field2, value }) {
33808
33903
  return null;
33809
33904
  }
33810
33905
  function FileCover({ recordId }) {
33811
- const client = useOptionalRecordsClient10();
33906
+ const client = useOptionalRecordsClient11();
33812
33907
  const host = useRecordsUi();
33813
33908
  const [read, setRead] = useState89(null);
33814
33909
  useEffect76(() => {
@@ -35482,7 +35577,7 @@ function ArchivedPortals({
35482
35577
  // src/ViewBar.tsx
35483
35578
  import { useCallback as useCallback43, useEffect as useEffect80, useRef as useRef49, useState as useState93 } from "react";
35484
35579
  import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
35485
- import { Badge as Badge14, Button as Button70, Input as Input6, Popover as Popover10, PopoverContent as PopoverContent10, PopoverTrigger as PopoverTrigger10, Skeleton as Skeleton15, cn as cn58 } from "@ai-matrx/design-system";
35580
+ import { Badge as Badge14, Button as Button70, Input as Input6, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Skeleton as Skeleton15, cn as cn58 } from "@ai-matrx/design-system";
35486
35581
 
35487
35582
  // src/seedOnce.ts
35488
35583
  import { useCallback as useCallback42, useRef as useRef48 } from "react";
@@ -35687,8 +35782,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
35687
35782
  if (error) return /* @__PURE__ */ jsx112(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx112(Button70, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
35688
35783
  if (views === null) return /* @__PURE__ */ jsx112(Skeleton15, { className: cn58("h-8 w-28 shrink-0", className) });
35689
35784
  const current = views.find((v) => v.id === active) ?? null;
35690
- return /* @__PURE__ */ jsxs102(Popover10, { open, onOpenChange: setOpen, children: [
35691
- /* @__PURE__ */ jsx112(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsxs102(
35785
+ return /* @__PURE__ */ jsxs102(Popover11, { open, onOpenChange: setOpen, children: [
35786
+ /* @__PURE__ */ jsx112(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsxs102(
35692
35787
  Button70,
35693
35788
  {
35694
35789
  size: "sm",
@@ -35702,7 +35797,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
35702
35797
  ]
35703
35798
  }
35704
35799
  ) }),
35705
- /* @__PURE__ */ jsxs102(PopoverContent10, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
35800
+ /* @__PURE__ */ jsxs102(PopoverContent11, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
35706
35801
  /* @__PURE__ */ jsxs102("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
35707
35802
  views.map((view) => /* @__PURE__ */ jsxs102(
35708
35803
  "button",
@@ -38562,7 +38657,7 @@ function submissionStamp(args) {
38562
38657
 
38563
38658
  // src/FormResultsPanel.tsx
38564
38659
  import { useEffect as useEffect90, useMemo as useMemo62, useState as useState103 } from "react";
38565
- import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
38660
+ import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient14 } from "@ai-matrx/records/react";
38566
38661
  import { Button as Button77, Skeleton as Skeleton21, cn as cn67 } from "@ai-matrx/design-system";
38567
38662
 
38568
38663
  // src/ChartBlock.tsx
@@ -38591,7 +38686,7 @@ import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
38591
38686
 
38592
38687
  // src/linkWords.ts
38593
38688
  import { useEffect as useEffect87, useMemo as useMemo60, useState as useState100 } from "react";
38594
- import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
38689
+ import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
38595
38690
 
38596
38691
  // src/charts.ts
38597
38692
  var CHART_KIND_LABEL = {
@@ -38801,7 +38896,7 @@ function bucketWindow2(groupKey, value) {
38801
38896
 
38802
38897
  // src/linkWords.ts
38803
38898
  function useLinkGroupNamer(block, tableId) {
38804
- const client = useOptionalRecordsClient11();
38899
+ const client = useOptionalRecordsClient12();
38805
38900
  const groupBy = block.kind === "stuck" ? [] : block.group_by ?? [];
38806
38901
  const rows = block.kind === "stuck" ? [] : block.rows ?? [];
38807
38902
  const ask = JSON.stringify([tableId, groupBy, rows.map((r) => r.groups ?? null)]);
@@ -38852,7 +38947,7 @@ function useLinkGroupNamer(block, tableId) {
38852
38947
 
38853
38948
  // src/measureWords.ts
38854
38949
  import { useEffect as useEffect88, useState as useState101 } from "react";
38855
- import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
38950
+ import { useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
38856
38951
  import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
38857
38952
  var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
38858
38953
  function measureWords(key, fields) {
@@ -38867,7 +38962,7 @@ function measureWords(key, fields) {
38867
38962
  return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier17(op2)} ${name}`;
38868
38963
  }
38869
38964
  function useMeasureWords(key, tableId) {
38870
- const client = useOptionalRecordsClient12();
38965
+ const client = useOptionalRecordsClient13();
38871
38966
  const [fields, setFields] = useState101(null);
38872
38967
  const needs = key !== "count";
38873
38968
  useEffect88(() => {
@@ -39522,7 +39617,7 @@ function answersBlock(question, title) {
39522
39617
  };
39523
39618
  }
39524
39619
  function FormResultsPanel({ form, className }) {
39525
- const client = useOptionalRecordsClient13();
39620
+ const client = useOptionalRecordsClient14();
39526
39621
  const fields = useFields23(form.subject);
39527
39622
  const [results, setResults] = useState103(null);
39528
39623
  const [error, setError] = useState103(null);
@@ -42234,7 +42329,7 @@ function EmbedSnippets({ url, label }) {
42234
42329
 
42235
42330
  // src/FormRunner.tsx
42236
42331
  import { useCallback as useCallback54, useEffect as useEffect97, useMemo as useMemo67, useRef as useRef57, useState as useState111 } from "react";
42237
- import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient14 } from "@ai-matrx/records/react";
42332
+ import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient15 } from "@ai-matrx/records/react";
42238
42333
  import { Button as Button85, Label as Label22, Progress, Skeleton as Skeleton27, cn as cn77, formThemeClasses } from "@ai-matrx/design-system";
42239
42334
  import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
42240
42335
  import { Fragment as Fragment53, jsx as jsx132, jsxs as jsxs122 } from "react/jsx-runtime";
@@ -42248,7 +42343,7 @@ function FormRunner(props) {
42248
42343
  return /* @__PURE__ */ jsx132(ConnectedFormRunner, { ...props });
42249
42344
  }
42250
42345
  function ConnectedFormRunner(props) {
42251
- const client = useOptionalRecordsClient14();
42346
+ const client = useOptionalRecordsClient15();
42252
42347
  const fields = useFields24(props.form.subject);
42253
42348
  const { form, className } = props;
42254
42349
  const submit = useCallback54(
@@ -44632,9 +44727,9 @@ import { useFields as useFields30, useRecordsClient as useRecordsClient86, useTa
44632
44727
  import {
44633
44728
  BasicInput as BasicInput31,
44634
44729
  Button as Button93,
44635
- Popover as Popover11,
44636
- PopoverContent as PopoverContent11,
44637
- PopoverTrigger as PopoverTrigger11,
44730
+ Popover as Popover12,
44731
+ PopoverContent as PopoverContent12,
44732
+ PopoverTrigger as PopoverTrigger12,
44638
44733
  Select as Select18,
44639
44734
  SelectContent as SelectContent18,
44640
44735
  SelectItem as SelectItem18,
@@ -45658,8 +45753,8 @@ function BlockSettingsMenu({
45658
45753
  title,
45659
45754
  onChange
45660
45755
  }) {
45661
- return /* @__PURE__ */ jsxs131(Popover11, { children: [
45662
- /* @__PURE__ */ jsx142(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsx142(
45756
+ return /* @__PURE__ */ jsxs131(Popover12, { children: [
45757
+ /* @__PURE__ */ jsx142(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx142(
45663
45758
  Button93,
45664
45759
  {
45665
45760
  type: "button",
@@ -45672,7 +45767,7 @@ function BlockSettingsMenu({
45672
45767
  children: /* @__PURE__ */ jsx142("span", { "aria-hidden": true, className: "text-sm leading-none", children: "\u22EF" })
45673
45768
  }
45674
45769
  ) }),
45675
- /* @__PURE__ */ jsx142(PopoverContent11, { align: "end", width: "lg", padding: "sm", "data-dashboard-block-settings": "", children: /* @__PURE__ */ jsx142(BlockSettings, { spec, title, onChange }) })
45770
+ /* @__PURE__ */ jsx142(PopoverContent12, { align: "end", width: "lg", padding: "sm", "data-dashboard-block-settings": "", children: /* @__PURE__ */ jsx142(BlockSettings, { spec, title, onChange }) })
45676
45771
  ] });
45677
45772
  }
45678
45773
  function BlockSettings({
@@ -46877,7 +46972,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
46877
46972
 
46878
46973
  // src/TableAsk.tsx
46879
46974
  import { useState as useState121 } from "react";
46880
- import { BasicInput as BasicInput33, Button as Button95, Popover as Popover12, PopoverContent as PopoverContent12, PopoverTrigger as PopoverTrigger12, Skeleton as Skeleton35 } from "@ai-matrx/design-system";
46975
+ import { BasicInput as BasicInput33, Button as Button95, Popover as Popover13, PopoverContent as PopoverContent13, PopoverTrigger as PopoverTrigger13, Skeleton as Skeleton35 } from "@ai-matrx/design-system";
46881
46976
  import { optionLabel as optionLabel4 } from "@ai-matrx/records";
46882
46977
  import { useFields as useFields32, useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
46883
46978
 
@@ -47117,9 +47212,9 @@ function TableAsk({ tableId, onOpenInQuestions }) {
47117
47212
  const answered = await askQuestion(client, tableId, read.spec, all);
47118
47213
  setSaid(answered.ok ? { kind: "answer", reads: read.reads, spec: read.spec, answer: answered.data } : { kind: "refused", error: answered.error });
47119
47214
  };
47120
- return /* @__PURE__ */ jsxs133(Popover12, { open, onOpenChange: setOpen, children: [
47121
- /* @__PURE__ */ jsx144(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx144(Button95, { size: "sm", variant: "ghost", title: "Ask this table", "data-table-ask": "", children: "Ask" }) }),
47122
- /* @__PURE__ */ jsxs133(PopoverContent12, { align: "end", className: "flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-2 p-2 text-xs", "data-table-ask-panel": "", children: [
47215
+ return /* @__PURE__ */ jsxs133(Popover13, { open, onOpenChange: setOpen, children: [
47216
+ /* @__PURE__ */ jsx144(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsx144(Button95, { size: "sm", variant: "ghost", title: "Ask this table", "data-table-ask": "", children: "Ask" }) }),
47217
+ /* @__PURE__ */ jsxs133(PopoverContent13, { align: "end", className: "flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-2 p-2 text-xs", "data-table-ask-panel": "", children: [
47123
47218
  /* @__PURE__ */ jsxs133(
47124
47219
  "form",
47125
47220
  {
@@ -49514,7 +49609,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
49514
49609
 
49515
49610
  // src/ViewFilter.tsx
49516
49611
  import { useEffect as useEffect113, useMemo as useMemo77, useState as useState133 } from "react";
49517
- import { Button as Button106, Popover as Popover13, PopoverContent as PopoverContent13, PopoverTrigger as PopoverTrigger13 } from "@ai-matrx/design-system";
49612
+ import { Button as Button106, Popover as Popover14, PopoverContent as PopoverContent14, PopoverTrigger as PopoverTrigger14 } from "@ai-matrx/design-system";
49518
49613
  import { useFields as useFields36 } from "@ai-matrx/records/react";
49519
49614
  import { jsx as jsx156, jsxs as jsxs145 } from "react/jsx-runtime";
49520
49615
  function conditionCount(expr) {
@@ -49545,7 +49640,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
49545
49640
  // THE BUILDER FLOATS OVER THE TABLE (STABLE-TABLES; Notion's filter popover): drawn inside the
49546
49641
  // toolbar row it grew the row and pushed the whole table down (0.13 + 0.13 layout shift).
49547
49642
  /* @__PURE__ */ jsxs145(
49548
- Popover13,
49643
+ Popover14,
49549
49644
  {
49550
49645
  open,
49551
49646
  onOpenChange: (next) => {
@@ -49553,7 +49648,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
49553
49648
  setOpen(next);
49554
49649
  },
49555
49650
  children: [
49556
- /* @__PURE__ */ jsx156(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsx156(
49651
+ /* @__PURE__ */ jsx156(PopoverTrigger14, { asChild: true, children: /* @__PURE__ */ jsx156(
49557
49652
  Button106,
49558
49653
  {
49559
49654
  size: "sm",
@@ -49565,7 +49660,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
49565
49660
  children: count > 0 ? `Filter \xB7 ${count}` : "Filter"
49566
49661
  }
49567
49662
  ) }),
49568
- /* @__PURE__ */ jsx156(PopoverContent13, { sizing: "content", align: "start", className: "w-auto max-w-[min(42rem,calc(100vw-2rem))] p-2", children: /* @__PURE__ */ jsxs145(
49663
+ /* @__PURE__ */ jsx156(PopoverContent14, { sizing: "content", align: "start", className: "w-auto max-w-[min(42rem,calc(100vw-2rem))] p-2", children: /* @__PURE__ */ jsxs145(
49569
49664
  "div",
49570
49665
  {
49571
49666
  className: "flex flex-col gap-2 text-xs",