@ai-matrx/records-ui 0.102.21 → 0.103.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1696,6 +1696,7 @@ function PickChips({ chips }) {
1696
1696
  ) });
1697
1697
  }
1698
1698
  function PickOrAdd({
1699
+ triggerSize = "field",
1699
1700
  triggerLabel,
1700
1701
  triggerText,
1701
1702
  triggerId,
@@ -1754,7 +1755,7 @@ function PickOrAdd({
1754
1755
  }
1755
1756
  ) : null;
1756
1757
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_design_system5.Popover, { open, onOpenChange, children: [
1757
- anchored ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", "aria-label": triggerLabel, children: triggerText }) }),
1758
+ anchored ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.PopoverAnchor, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "data-pick-anchor": "", className: "flex min-h-6 w-full min-w-0 flex-wrap items-center gap-1", "aria-label": triggerLabel, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_design_system5.Button, { id: triggerId, type: "button", size: "sm", variant: "outline", className: triggerSize === "field" ? "h-9" : void 0, "aria-label": triggerLabel, children: triggerText }) }),
1758
1759
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1759
1760
  import_design_system5.PopoverContent,
1760
1761
  {
@@ -4133,6 +4134,7 @@ function PickOne({
4133
4134
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: (0, import_design_system12.cn)("inline-flex min-w-0", className), "data-records-pick-one": "search", "data-pick-value": value, ...attrs ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4134
4135
  PickOrAdd,
4135
4136
  {
4137
+ triggerSize: "compact",
4136
4138
  triggerLabel: label,
4137
4139
  triggerText: current?.label ?? placeholder ?? "",
4138
4140
  triggerId: id,
@@ -5218,7 +5220,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
5218
5220
  disabled,
5219
5221
  autoComplete: "off",
5220
5222
  "aria-invalid": refusal4 ? true : void 0,
5221
- placeholder: helper === "time" ? "2:30 PM" : helper === "datetime" ? `${(0, import_records12.typedDateText)("2026-10-03")} 2:30 PM` : helper ? (0, import_records12.typedDateText)("2026-10-03") : void 0,
5223
+ placeholder: helper ? typedDatePlaceholder(helper) : void 0,
5222
5224
  onChange: (e) => retype(e.target.value),
5223
5225
  onBlur: () => {
5224
5226
  if (!refusal4) return;
@@ -5232,6 +5234,12 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
5232
5234
  refusal4 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { "data-records-typed-refusal": "", "data-records-cell-note": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal4 }) : null
5233
5235
  ] });
5234
5236
  }
5237
+ function typedDatePlaceholder(helper) {
5238
+ const time = "h:mm AM";
5239
+ if (helper === "time") return time;
5240
+ const pattern = (0, import_records12.typedDateText)("2026-11-22").replace("2026", "YYYY").replace("11", "MM").replace("22", "DD");
5241
+ return helper === "datetime" ? `${pattern} ${time}` : pattern;
5242
+ }
5235
5243
  function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
5236
5244
  const unanswered = value === null || value === void 0;
5237
5245
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -6885,16 +6893,16 @@ function cellMarkSentence(field2, document2, value) {
6885
6893
  const kept = keptAsideFor(document2, field2.key);
6886
6894
  return kept ? keptAsideReason(field2, kept) : null;
6887
6895
  }
6888
- var WORKED_OUT_ERROR_WORD = "#ERROR";
6889
- function WorkedOutError({ field: field2, sentence: sentence2 }) {
6896
+ function WorkedOutError({ field: field2, sentence: sentence2, floated = false }) {
6890
6897
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6891
6898
  "span",
6892
6899
  {
6893
6900
  "data-records-worked-out-error": field2.key,
6901
+ role: "img",
6894
6902
  title: sentence2,
6895
- "aria-label": `Error. ${sentence2}`,
6896
- className: "cursor-help font-medium text-amber-700 dark:text-amber-300",
6897
- children: WORKED_OUT_ERROR_WORD
6903
+ "aria-label": sentence2,
6904
+ className: (floated ? "absolute right-1 top-1/2 z-10 flex -translate-y-1/2 " : "inline-flex align-middle ") + "h-4 w-4 shrink-0 cursor-help items-center justify-center rounded-full bg-destructive text-[10px] font-bold leading-none text-destructive-foreground",
6905
+ children: "!"
6898
6906
  }
6899
6907
  );
6900
6908
  }
@@ -7123,7 +7131,7 @@ function RecordValue({
7123
7131
  if (withheld && (value === null || value === void 0)) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WithheldValue, { field: field2, notice: withheld });
7124
7132
  if (value === null || value === void 0) {
7125
7133
  const failed = workedOutErrorFor(document2, field2.key);
7126
- if (failed) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WorkedOutError, { field: field2, sentence: failed });
7134
+ if (failed) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(WorkedOutError, { field: field2, sentence: failed, floated: Boolean(inCell) });
7127
7135
  }
7128
7136
  if (inCell) {
7129
7137
  const kept = keptAsideFor(document2, field2.key);
@@ -7746,6 +7754,22 @@ function GridCell({
7746
7754
  const open = Boolean(
7747
7755
  editing && editing.editing?.rowId === row.id && editing.editing.key === field2.key
7748
7756
  );
7757
+ const closedControl = (0, import_react38.useRef)(null);
7758
+ const wasOpen = (0, import_react38.useRef)(false);
7759
+ (0, import_react38.useEffect)(() => {
7760
+ if (open) {
7761
+ wasOpen.current = true;
7762
+ return;
7763
+ }
7764
+ if (!wasOpen.current) return;
7765
+ wasOpen.current = false;
7766
+ if (!clickOpens) return;
7767
+ const frame = requestAnimationFrame(() => {
7768
+ const active = document.activeElement;
7769
+ if (!active || active === document.body) closedControl.current?.focus({ preventScroll: true });
7770
+ });
7771
+ return () => cancelAnimationFrame(frame);
7772
+ }, [open, clickOpens]);
7749
7773
  const wasActive = (0, import_react38.useRef)(false);
7750
7774
  const singlePress = (0, import_react38.useRef)(null);
7751
7775
  const cancelSinglePress = () => {
@@ -7889,9 +7913,13 @@ function GridCell({
7889
7913
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7890
7914
  "span",
7891
7915
  {
7916
+ ref: closedControl,
7892
7917
  role: editable ? "button" : void 0,
7893
7918
  "aria-label": editable ? `Edit ${fieldName(field2)}` : void 0,
7894
- title: cellMark ? cellMark : editable ? `${fieldName(field2)} \u2014 double-click or press Enter to edit` : fieldIsEditable(field2) ? (
7919
+ title: cellMark ? cellMark : editable ? (
7920
+ // The words match the gesture (WALK3-FIX): one click opens a record-page field.
7921
+ clickOpens ? `${fieldName(field2)} \u2014 click to edit` : `${fieldName(field2)} \u2014 double-click or press Enter to edit`
7922
+ ) : fieldIsEditable(field2) ? (
7895
7923
  // NOT A DEAD CONTROL AND NOT A SILENT ONE: the cell is plain
7896
7924
  // text, and hovering it says exactly why, in the level's own
7897
7925
  // words. The editor was never offered, so nothing is refused
@@ -9151,6 +9179,7 @@ function ChoiceValue({ field: field2, value, onChange }) {
9151
9179
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex min-w-0", "data-records-condition-choice": "", "data-pick-value": value, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9152
9180
  PickOrAdd,
9153
9181
  {
9182
+ triggerSize: "compact",
9154
9183
  triggerLabel: `Choice for ${field2.label || field2.key}`,
9155
9184
  triggerText: value || "Choose",
9156
9185
  open,
@@ -9374,6 +9403,7 @@ function ConditionGroup({
9374
9403
  onChange,
9375
9404
  emptyLabel = "always",
9376
9405
  allowNesting = true,
9406
+ maxDepth,
9377
9407
  depth = 0,
9378
9408
  onRemove,
9379
9409
  className
@@ -9444,6 +9474,7 @@ function ConditionGroup({
9444
9474
  onChange: (next) => replaceAt(index, next),
9445
9475
  onRemove: () => replaceAt(index, null),
9446
9476
  emptyLabel,
9477
+ maxDepth,
9447
9478
  depth: depth + 1
9448
9479
  }
9449
9480
  ) }, key);
@@ -9487,7 +9518,7 @@ function ConditionGroup({
9487
9518
  children: "Add another condition"
9488
9519
  }
9489
9520
  ),
9490
- allowNesting ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9521
+ allowNesting && (maxDepth === void 0 || depth < maxDepth) ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9491
9522
  import_design_system29.Button,
9492
9523
  {
9493
9524
  size: "sm",
@@ -10520,8 +10551,29 @@ var MEASURE_LABEL = {
10520
10551
  median: "Median",
10521
10552
  filled: "Filled",
10522
10553
  empty: "Empty",
10523
- unique: "Unique"
10554
+ unique: "Unique",
10555
+ percent_empty: "Percent empty",
10556
+ percent_filled: "Percent filled",
10557
+ range: "Range"
10524
10558
  };
10559
+ var NOTION_CALCULATIONS = [
10560
+ { op: "count", menu: "Count all", footer: "Count" },
10561
+ { op: "unique", menu: "Count unique values", footer: "Unique" },
10562
+ { op: "empty", menu: "Count empty", footer: "Empty" },
10563
+ { op: "filled", menu: "Count not empty", footer: "Not empty" },
10564
+ { op: "percent_empty", menu: "Percent empty", footer: "Empty" },
10565
+ { op: "percent_filled", menu: "Percent not empty", footer: "Not empty" },
10566
+ { op: "sum", menu: "Sum", footer: "Sum" },
10567
+ { op: "avg", menu: "Average", footer: "Average" },
10568
+ { op: "median", menu: "Median", footer: "Median" },
10569
+ { op: "min", menu: "Min", footer: "Min" },
10570
+ { op: "max", menu: "Max", footer: "Max" },
10571
+ { op: "range", menu: "Range", footer: "Range" }
10572
+ ];
10573
+ function calculationsFor(field2, storeOps) {
10574
+ const offered = new Set(measuresFor(field2, storeOps, true));
10575
+ return NOTION_CALCULATIONS.filter((c) => offered.has(c.op));
10576
+ }
10525
10577
  var NUMERIC_ONLY = /* @__PURE__ */ new Set(["sum", "avg", "median"]);
10526
10578
  var ARITHMETIC2 = /* @__PURE__ */ new Set([
10527
10579
  "add",
@@ -10539,7 +10591,7 @@ var ARITHMETIC2 = /* @__PURE__ */ new Set([
10539
10591
  "ceiling",
10540
10592
  "floor"
10541
10593
  ]);
10542
- var ORDERED = /* @__PURE__ */ new Set(["min", "max"]);
10594
+ var ORDERED = /* @__PURE__ */ new Set(["min", "max", "range"]);
10543
10595
  function isNumericField(field2) {
10544
10596
  const kind = editorKindFor(field2);
10545
10597
  if (kind === "number" || kind === "currency" || kind === "percent" || kind === "rollup") return true;
@@ -11116,6 +11168,7 @@ function FieldEditor(props) {
11116
11168
  const [formulaWritten, setFormulaWritten] = (0, import_react59.useState)(() => startingFormulaText.trim() !== "" || Boolean(field2));
11117
11169
  const [formulaOk, setFormulaOk] = (0, import_react59.useState)(null);
11118
11170
  const [askingToRemove, setAskingToRemove] = (0, import_react59.useState)(false);
11171
+ const [attempted, setAttempted] = (0, import_react59.useState)(false);
11119
11172
  const [showsAs, setShowsAs] = (0, import_react59.useState)(() => field2 ? startingChoice(field2) : { format: null, retype: null });
11120
11173
  const [backfillError, setBackfillError] = (0, import_react59.useState)(null);
11121
11174
  const [notLanded, setNotLanded] = (0, import_react59.useState)(false);
@@ -11165,6 +11218,8 @@ function FieldEditor(props) {
11165
11218
  const missing = editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
11166
11219
  type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
11167
11220
  ));
11221
+ const missingShown = missing && (attempted || formulaMissing) ? missing : null;
11222
+ const removeConsequence = field2 ? `${archiveConfirmSentence(`the field \u201C${fieldName(field2)}\u201D`)} Its values stay in every record and come back with it.${linkReaders.length > 0 ? ` ${readersSentence(linkReaders.length, farTable.data?.name ?? null)}` : ""}` : "";
11168
11223
  const save = async () => {
11169
11224
  if (missing) return;
11170
11225
  if (editing && field2) {
@@ -11312,8 +11367,8 @@ function FieldEditor(props) {
11312
11367
  const remove = async () => {
11313
11368
  if (!field2) return;
11314
11369
  const gone = await tableMutation.retire({ field_id: field2.id });
11315
- setAskingToRemove(false);
11316
11370
  if (gone) (onRemoved ?? onSaved)?.();
11371
+ else setAskingToRemove(false);
11317
11372
  };
11318
11373
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: (0, import_design_system34.cn)("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
11319
11374
  /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
@@ -11330,7 +11385,12 @@ function FieldEditor(props) {
11330
11385
  autoFocus: true,
11331
11386
  "aria-label": "Field name",
11332
11387
  placeholder: "Day rate",
11333
- onChange: (e) => setLabel(e.target.value)
11388
+ onChange: (e) => setLabel(e.target.value),
11389
+ onBlur: (e) => {
11390
+ const to = e.relatedTarget;
11391
+ if (to?.textContent === "Cancel") return;
11392
+ setAttempted(true);
11393
+ }
11334
11394
  }
11335
11395
  )
11336
11396
  ] }),
@@ -11618,7 +11678,6 @@ function FieldEditor(props) {
11618
11678
  ] }),
11619
11679
  editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FieldRulePreview, { field: field2, tableId, rules: editedRules }) : null,
11620
11680
  mutation.error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefusalNotice, { error: mutation.error }) : null,
11621
- missing ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { id: "field-editor-missing", className: "text-[11px] text-muted-foreground", "data-field-editor-missing": "", children: missing }) : null,
11622
11681
  notLanded ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11623
11682
  RefusalNotice,
11624
11683
  {
@@ -11663,27 +11722,61 @@ function FieldEditor(props) {
11663
11722
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
11664
11723
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefusalNotice, { error: backfillError })
11665
11724
  ] }) : null,
11666
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
11725
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
11667
11726
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11668
11727
  import_design_system34.Button,
11669
11728
  {
11670
11729
  size: "sm",
11671
- disabled: mutation.saving || missing !== null,
11672
- ...missing ? { "aria-describedby": "field-editor-missing" } : {},
11673
- onClick: () => void save(),
11730
+ disabled: mutation.saving || Boolean(formulaMissing),
11731
+ ...missingShown ? { "aria-describedby": "field-editor-missing" } : {},
11732
+ onClick: () => {
11733
+ if (missing) {
11734
+ setAttempted(true);
11735
+ return;
11736
+ }
11737
+ void save();
11738
+ },
11674
11739
  children: mutation.saving ? "Saving\u2026" : field2 ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
11675
11740
  }
11676
11741
  ),
11677
11742
  onCancel ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
11678
- field2 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ml-auto flex items-center gap-2", children: askingToRemove ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
11679
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "text-destructive", children: [
11680
- archiveConfirmSentence(`the field \u201C${fieldName(field2)}\u201D`),
11681
- " Its values stay in every record and come back with it.",
11682
- linkReaders.length > 0 ? ` ${readersSentence(linkReaders.length, farTable.data?.name ?? null)}` : ""
11683
- ] }),
11684
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "destructive", disabled: mutation.saving, onClick: () => void remove(), children: "Remove it" }),
11685
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(false), children: "Keep it" })
11686
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "outline", onClick: () => setAskingToRemove(true), children: "Remove this field" }) }) : null
11743
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11744
+ "span",
11745
+ {
11746
+ id: "field-editor-missing",
11747
+ "data-field-editor-missing": missingShown ? "" : void 0,
11748
+ title: missingShown ?? void 0,
11749
+ className: "min-w-0 flex-1 truncate text-[11px] text-muted-foreground",
11750
+ children: missingShown
11751
+ }
11752
+ ),
11753
+ field2 ? (
11754
+ /* WALK3-FIX (2026-10-07): the confirm appears IN PLACE. Both states share one grid cell,
11755
+ the idle one drawn invisibly under the asking one and the other way round, so the
11756
+ footer is always as wide and as tall as its larger state: opening the confirm moved
11757
+ the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
11758
+ "Remove it" (interface-text: the slot holds a label, never a paragraph). */
11759
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
11760
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: (0, import_design_system34.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
11761
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: (0, import_design_system34.cn)("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
11762
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
11763
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
11764
+ import_design_system34.Button,
11765
+ {
11766
+ size: "sm",
11767
+ variant: "destructive",
11768
+ tabIndex: askingToRemove ? void 0 : -1,
11769
+ disabled: mutation.saving,
11770
+ title: removeConsequence,
11771
+ "aria-description": removeConsequence,
11772
+ onClick: () => void remove(),
11773
+ children: "Remove it"
11774
+ }
11775
+ ),
11776
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system34.Button, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
11777
+ ] })
11778
+ ] })
11779
+ ) : null
11687
11780
  ] })
11688
11781
  ] });
11689
11782
  }
@@ -13769,14 +13862,17 @@ function SummaryCell({
13769
13862
  value,
13770
13863
  rowCount,
13771
13864
  summaries,
13772
- onChoose
13865
+ onChoose,
13866
+ calculate = false
13773
13867
  }) {
13774
13868
  const offered = (0, import_react73.useMemo)(
13775
- () => summaries.operations ? measuresFor(field2, summaries.operations, firstColumn) : null,
13776
- [summaries.operations, field2, firstColumn]
13869
+ () => summaries.operations ? calculate ? calculationsFor(field2, summaries.operations).map((c) => c.op) : measuresFor(field2, summaries.operations, firstColumn) : null,
13870
+ [summaries.operations, field2, firstColumn, calculate]
13777
13871
  );
13778
- const label = chosen ? MEASURE_LABEL[chosen] ?? chosen : null;
13779
- const shown4 = chosen === void 0 ? null : summaries.loading && value === void 0 ? "\u2026" : value === null || value === void 0 ? "\u2014" : chosen === "count" || chosen === "filled" || chosen === "empty" || chosen === "unique" ? String(value) : null;
13872
+ const words2 = (op2, where) => calculate ? NOTION_CALCULATIONS.find((c) => c.op === op2)?.[where] ?? MEASURE_LABEL[op2] ?? op2 : MEASURE_LABEL[op2] ?? op2;
13873
+ const label = chosen ? words2(chosen, "footer") : null;
13874
+ const isDate4 = editorKindFor(field2) === "datetime";
13875
+ const shown4 = chosen === void 0 ? null : summaries.loading && value === void 0 ? "\u2026" : value === null || value === void 0 ? "\u2014" : chosen === "count" || chosen === "filled" || chosen === "empty" || chosen === "unique" ? String(value) : chosen === "percent_empty" || chosen === "percent_filled" ? `${Number(value.toFixed(2))}%` : chosen === "range" && isDate4 ? `${Math.round(value)} day${Math.round(value) === 1 ? "" : "s"}` : null;
13780
13876
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system42.DropdownMenu, { onOpenChange: (open) => open ? summaries.askOperations() : void 0, children: [
13781
13877
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system42.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
13782
13878
  import_design_system42.Button,
@@ -13798,7 +13894,7 @@ function SummaryCell({
13798
13894
  // AGG-WITHHELD: the store withheld this column from her — say so, never a bare dash.
13799
13895
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WithheldValue, { field: field2, notice: summaries.withheld[field2.key] }) })
13800
13896
  ) : shown4 !== null ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-medium tabular-nums", children: shown4 }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-medium tabular-nums", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RecordValue, { field: field2, value, format: formatForField(field2) }) })
13801
- ] }) : "Summarize"
13897
+ ] }) : calculate ? "Calculate" : "Summarize"
13802
13898
  }
13803
13899
  ) }),
13804
13900
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_design_system42.DropdownMenuContent, { align: "start", children: [
@@ -13809,13 +13905,13 @@ function SummaryCell({
13809
13905
  "data-records-summary-choice": op2,
13810
13906
  onSelect: () => onChoose(op2),
13811
13907
  className: (0, import_design_system42.cn)(op2 === chosen && "font-medium"),
13812
- children: MEASURE_LABEL[op2] ?? op2
13908
+ children: words2(op2, "menu")
13813
13909
  },
13814
13910
  op2
13815
13911
  )),
13816
13912
  chosen ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
13817
13913
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system42.DropdownMenuSeparator, {}),
13818
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system42.DropdownMenuItem, { onSelect: () => onChoose(null), children: "No summary" })
13914
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system42.DropdownMenuItem, { onSelect: () => onChoose(null), children: calculate ? "None" : "No summary" })
13819
13915
  ] }) : null
13820
13916
  ] })
13821
13917
  ] });
@@ -14503,6 +14599,13 @@ function useMergedGridControls(args) {
14503
14599
  const tableVersion = useTableVersion(client, tableId, table);
14504
14600
  const mutation = (0, import_react81.useFieldMutation)();
14505
14601
  const [dialog, setDialog] = (0, import_react80.useState)(null);
14602
+ const lastColumnDialog = (0, import_react80.useRef)(null);
14603
+ const insertEpoch = (0, import_react80.useRef)(0);
14604
+ if (dialog?.kind === "settings" || dialog?.kind === "insert") {
14605
+ if (dialog !== lastColumnDialog.current) insertEpoch.current += 1;
14606
+ lastColumnDialog.current = dialog;
14607
+ }
14608
+ const columnDialog = dialog?.kind === "settings" || dialog?.kind === "insert" ? dialog : lastColumnDialog.current;
14506
14609
  const [renameTo, setRenameTo] = (0, import_react80.useState)("");
14507
14610
  const [deleteBusy, setDeleteBusy] = (0, import_react80.useState)(false);
14508
14611
  const [labelling, setLabelling] = (0, import_react80.useState)(false);
@@ -14992,27 +15095,27 @@ function useMergedGridControls(args) {
14992
15095
  },
14993
15096
  children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system46.DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [
14994
15097
  /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_design_system46.DialogHeader, { children: [
14995
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.DialogTitle, { children: dialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(dialog.field)}` : dialog?.kind === "insert" && dialog.anchor ? `Add column ${dialog.side === "left" ? "left" : "right"} of ${fieldOf2(dialog.anchor) ? fieldName(fieldOf2(dialog.anchor)) : dialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
15098
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.DialogTitle, { children: columnDialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(columnDialog.field)}` : columnDialog?.kind === "insert" && columnDialog.anchor ? `Add column ${columnDialog.side === "left" ? "left" : "right"} of ${fieldOf2(columnDialog.anchor) ? fieldName(fieldOf2(columnDialog.anchor)) : columnDialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
14996
15099
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_design_system46.DialogDescription, { className: "sr-only", children: "Name, type and look" })
14997
15100
  ] }),
14998
- dialog?.kind === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
15101
+ columnDialog?.kind === "settings" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
14999
15102
  FieldEditor,
15000
15103
  {
15001
15104
  tableId,
15002
- field: dialog.field,
15105
+ field: columnDialog.field,
15003
15106
  onSaved: () => {
15004
- notify?.success(`${fieldName(dialog.field)} is saved.`);
15107
+ notify?.success(`${fieldName(columnDialog.field)} is saved.`);
15005
15108
  close();
15006
15109
  },
15007
15110
  onRemoved: () => {
15008
- if (args.onColumnRetired) args.onColumnRetired(dialog.field);
15009
- else notify?.success(`${fieldName(dialog.field)} is gone from the table. It can be brought back from Archived.`);
15111
+ if (args.onColumnRetired) args.onColumnRetired(columnDialog.field);
15112
+ else notify?.success(`${fieldName(columnDialog.field)} is gone from the table. It can be brought back from Archived.`);
15010
15113
  close();
15011
15114
  },
15012
15115
  onCancel: close
15013
15116
  },
15014
- dialog.field.id
15015
- ) : dialog?.kind === "insert" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
15117
+ `${columnDialog.field.id}-${insertEpoch.current}`
15118
+ ) : columnDialog?.kind === "insert" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
15016
15119
  FieldEditor,
15017
15120
  {
15018
15121
  tableId,
@@ -15021,10 +15124,11 @@ function useMergedGridControls(args) {
15021
15124
  close();
15022
15125
  },
15023
15126
  onSaved: () => {
15024
- pendingInsert.current = { before: new Set(fieldKeys), anchor: dialog.anchor, side: dialog.side };
15127
+ pendingInsert.current = { before: new Set(fieldKeys), anchor: columnDialog.anchor, side: columnDialog.side };
15025
15128
  close();
15026
15129
  }
15027
- }
15130
+ },
15131
+ `insert-${insertEpoch.current}`
15028
15132
  ) : null
15029
15133
  ] })
15030
15134
  }
@@ -20527,7 +20631,7 @@ function UndoRedoPair({ face, onUndo, onRedo }) {
20527
20631
  )
20528
20632
  ] });
20529
20633
  }
20530
- function UndoNotice({ undo }) {
20634
+ function UndoNotice({ undo, placement = "frame" }) {
20531
20635
  const notice = undo.notice;
20532
20636
  const dismiss = undo.dismiss;
20533
20637
  (0, import_react105.useEffect)(() => {
@@ -20541,7 +20645,8 @@ function UndoNotice({ undo }) {
20541
20645
  {
20542
20646
  role: "status",
20543
20647
  "data-records-undo-notice": notice.refusal ? "refused" : "done",
20544
- className: "pointer-events-auto absolute bottom-3 left-1/2 z-30 flex max-w-[min(36rem,calc(100%-2rem))] -translate-x-1/2 items-center gap-2 rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-lg",
20648
+ "data-records-undo-placement": placement,
20649
+ className: `pointer-events-auto ${placement === "viewport" ? "fixed bottom-4 z-50" : "absolute bottom-3 z-30"} left-1/2 flex max-w-[min(36rem,calc(100%-2rem))] -translate-x-1/2 items-center gap-2 rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-lg`,
20545
20650
  children: [
20546
20651
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { children: notice.says }),
20547
20652
  notice.canUndo && undo.canUndo ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_design_system57.Button, { size: "sm", variant: "outline", className: "ml-auto h-6", "data-records-undo-now": "", onClick: () => void undo.undo(), children: "Undo" }) : null,
@@ -21789,7 +21894,8 @@ function GridBody({
21789
21894
  newRowLabel,
21790
21895
  sortOverride,
21791
21896
  searchOverride,
21792
- onSearchChange
21897
+ onSearchChange,
21898
+ searchBox = true
21793
21899
  }) {
21794
21900
  const toolbarSlot = useTableToolbarSlot();
21795
21901
  const tableCard = (0, import_data_table11.useMatrxTableCard)();
@@ -21885,6 +21991,11 @@ function GridBody({
21885
21991
  page: query.page
21886
21992
  });
21887
21993
  }, [reportQuery, query.sort, query.columnFilters, query.search, query.page, openingKey]);
21994
+ const liveKeys = (0, import_react113.useMemo)(() => fields.data ? new Set(fields.data.map((f) => f.key)) : null, [fields.data]);
21995
+ (0, import_react113.useEffect)(() => {
21996
+ if (!liveKeys) return;
21997
+ setQuery((held) => withoutGoneColumns(held, liveKeys, openingSort));
21998
+ }, [liveKeys]);
21888
21999
  const resetEpoch = address?.resetEpoch ?? 0;
21889
22000
  const resetSeen = (0, import_react113.useRef)(resetEpoch);
21890
22001
  (0, import_react113.useEffect)(() => {
@@ -21938,7 +22049,9 @@ function GridBody({
21938
22049
  page: classicInCard ? 0 : page,
21939
22050
  ...readFilter ? { filter: readFilter } : {}
21940
22051
  });
21941
- const pageAsked = !storePaged || Boolean(fields.data && !table.loading);
22052
+ const pageAskedFor = (0, import_react113.useRef)(null);
22053
+ if (fields.data && !table.loading) pageAskedFor.current = tableId;
22054
+ const pageAsked = !storePaged || Boolean(fields.data) && pageAskedFor.current === tableId;
21942
22055
  const serverRead = (0, import_react114.useRecordPage)(storePaged && pageAsked ? tableId : null, {
21943
22056
  pageSize: query.pageSize,
21944
22057
  page: Math.max(0, query.page - 1),
@@ -22784,6 +22897,7 @@ function GridBody({
22784
22897
  value: summaries.values[columnId2],
22785
22898
  rowCount: summaries.rowCount,
22786
22899
  summaries,
22900
+ calculate: embedded,
22787
22901
  onChoose: (op2) => footerNow.current.choose(columnId2, op2)
22788
22902
  }
22789
22903
  );
@@ -23048,7 +23162,8 @@ function GridBody({
23048
23162
  [storePaged, query, queryTotal, classicInCard, records.data?.total]
23049
23163
  );
23050
23164
  const showAddLine = mayAddRow && rows.length > 0;
23051
- const showSummaryLine = rows.length > 0 && (embedded ? Object.keys(chosenSummaries).length > 0 : !merged || Object.keys(chosenSummaries).length > 0);
23165
+ const showSummaryLine = rows.length > 0 && (embedded || !merged || Object.keys(chosenSummaries).length > 0);
23166
+ const calculationChosen = Object.keys(chosenSummaries).length > 0;
23052
23167
  const footerFace = JSON.stringify([
23053
23168
  showAddLine ? added.busy : null,
23054
23169
  showSummaryLine ? [chosenSummaries, summaries.values, summaries.rowCount, summaries.loading] : null
@@ -23151,10 +23266,11 @@ function GridBody({
23151
23266
  search: !embedded,
23152
23267
  // EMBEDDED: Notion's magnifier — the design system's own search group, a button that
23153
23268
  // opens into a field. It is the same `query.search` the store's read asks.
23154
- ...embedded ? {
23269
+ ...embedded && searchBox ? {
23155
23270
  customSearch: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
23156
23271
  import_design_system60.TapTargetSearchGroup,
23157
23272
  {
23273
+ surface: "solid",
23158
23274
  placeholder: "Search",
23159
23275
  value: searchOverride ?? query.search,
23160
23276
  onValueChange: (term) => {
@@ -23366,7 +23482,8 @@ function GridBody({
23366
23482
  noun,
23367
23483
  embedded,
23368
23484
  searchOverride,
23369
- onSearchChange
23485
+ onSearchChange,
23486
+ searchBox
23370
23487
  ]
23371
23488
  );
23372
23489
  const labelOfField = (0, import_react113.useCallback)(
@@ -23386,7 +23503,7 @@ function GridBody({
23386
23503
  }, [rowsAnswered, rowMemoryKey, rows.length, embedded, tableId]);
23387
23504
  if (table.error) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(RefusalNotice, { error: table.error, className });
23388
23505
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(RefusalNotice, { error: fields.error, className });
23389
- const nothingToShowYet = table.loading || fields.loading || !rights.known || records.loading && rows.length === 0 || // The page read has neither answered nor refused: nothing has been said yet, so nothing is empty.
23506
+ const nothingToShowYet = table.loading && !table.data || fields.loading && !fields.data || !rights.known || records.loading && rows.length === 0 || // The page read has neither answered nor refused: nothing has been said yet, so nothing is empty.
23390
23507
  !records.data && !records.error || countedButNotReturned || manual && hand.loading && rows.length === 0;
23391
23508
  const refreshing = !nothingToShowYet && (records.loading || manual && hand.loading);
23392
23509
  const noColumnsYet = !nothingToShowYet && (fields.data ?? []).length === 0;
@@ -23588,7 +23705,7 @@ function GridBody({
23588
23705
  !look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
23589
23706
  look.fit === "scroll" && "sm:[&>table]:w-max! sm:[&>table]:max-w-none! sm:[&>table]:min-w-full!",
23590
23707
  embedded && EMBEDDED_TABLE_CLASS,
23591
- embedded && !showSummaryLine && EMBEDDED_PLAIN_FOOTER_CLASS
23708
+ embedded && !calculationChosen && EMBEDDED_PLAIN_FOOTER_CLASS
23592
23709
  ),
23593
23710
  footerRows,
23594
23711
  ...embedded ? { copy: false } : copyConfig ? { copy: copyConfig } : {},
@@ -23841,6 +23958,15 @@ function withHeaderMenus(columns, menuFor, filterFor) {
23841
23958
  return filter ? { ...withMenu, ...filter } : withMenu;
23842
23959
  });
23843
23960
  }
23961
+ function withoutGoneColumns(query, liveKeys, openingSort) {
23962
+ const sortGone = Boolean(query.sort && !liveKeys.has(query.sort.id));
23963
+ const goneFilters = Object.keys(query.columnFilters ?? {}).filter((key) => !liveKeys.has(key));
23964
+ if (!sortGone && goneFilters.length === 0) return query;
23965
+ const columnFilters = { ...query.columnFilters };
23966
+ for (const key of goneFilters) delete columnFilters[key];
23967
+ const fallback = openingSort && liveKeys.has(openingSort.id) ? openingSort : null;
23968
+ return { ...query, sort: sortGone ? fallback : query.sort, columnFilters, page: 1 };
23969
+ }
23844
23970
 
23845
23971
  // src/RecordsTableCard.tsx
23846
23972
  var import_data_table13 = require("@ai-matrx/design-system/data-table");
@@ -28998,7 +29124,7 @@ function RecordFieldsInPlace({
28998
29124
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
28999
29125
  "dd",
29000
29126
  {
29001
- className: "min-w-0 rounded hover:bg-muted/50 [&_[data-matrx-cell-editor]_input:not([type=checkbox]):not([type=radio])]:!h-7",
29127
+ className: "min-w-0 rounded hover:bg-muted/50 [&_[data-matrx-cell-editor]_input:not([type=checkbox]):not([type=radio])]:!h-7 [&_[data-pick-anchor]]:!w-fit",
29002
29128
  "data-records-in-place-field": field2.key,
29003
29129
  children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
29004
29130
  GridCell,
@@ -29016,7 +29142,7 @@ function RecordFieldsInPlace({
29016
29142
  )
29017
29143
  ] }, field2.id);
29018
29144
  }) }),
29019
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(UndoNotice, { undo })
29145
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(UndoNotice, { undo, placement: "viewport" })
29020
29146
  ]
29021
29147
  }
29022
29148
  );
@@ -29242,6 +29368,7 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
29242
29368
  if (record.error) return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RefusalNotice, { error: record.error, className });
29243
29369
  if (fields.error) return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(RefusalNotice, { error: fields.error, className });
29244
29370
  const document2 = record.data?.document;
29371
+ const computedShown = computedLinesWorthShowing(record.data?.computed, document2);
29245
29372
  const title = document2 ? recordNameIn(table.data, document2) : "";
29246
29373
  const bodyKey = onPage ? bodyFieldOf(fields.data ?? [])?.key : void 0;
29247
29374
  const shownFields = (fields.data ?? []).filter((field2) => !onPage || !drawnBelowOnPage(field2, bodyKey));
@@ -29341,15 +29468,20 @@ function Peek({ tableId, recordId, onClose, className, onPage = false }) {
29341
29468
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system85.Separator, {}),
29342
29469
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-muted-foreground", children: "Nothing here can say which columns the system worked out for itself: that part of the record is not readable from your seat. Everything above is the record as it stands." })
29343
29470
  ] }) : null,
29344
- record.data?.computed?.length ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
29471
+ computedShown.length ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
29345
29472
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_design_system85.Separator, {}),
29346
29473
  /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex flex-col gap-1", children: [
29347
29474
  /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "font-medium", children: "Worked out by the system" }),
29348
- record.data.computed.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-muted-foreground", children: computedInPlainWords(row, (fields.data ?? []).find((f) => f.key === row.field_key)) }, i))
29475
+ computedShown.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-muted-foreground", children: computedInPlainWords(row, (fields.data ?? []).find((f) => f.key === row.field_key)) }, i))
29349
29476
  ] })
29350
29477
  ] }) : null
29351
29478
  ] });
29352
29479
  }
29480
+ function computedLinesWorthShowing(rows, document2) {
29481
+ return (rows ?? []).filter(
29482
+ (row) => !((row.value === null || row.value === void 0 || row.value === "") && workedOutErrorFor(document2, row.field_key))
29483
+ );
29484
+ }
29353
29485
  function computedInPlainWords(row, field2) {
29354
29486
  const name = field2 ? fieldName(field2) : (0, import_text_case12.humanizeIdentifier)(row.field_key);
29355
29487
  const shown4 = row.value === null || row.value === void 0 || row.value === "" ? "nothing" : field2 ? scalarText(field2, row.value) : String(row.value);
@@ -32943,6 +33075,7 @@ function ViewSwitcher({
32943
33075
  sortOverride,
32944
33076
  searchOverride,
32945
33077
  onSearchChange,
33078
+ searchBox,
32946
33079
  newRowLabel,
32947
33080
  className
32948
33081
  }) {
@@ -33010,6 +33143,7 @@ function ViewSwitcher({
33010
33143
  ...sortOverride !== void 0 ? { sortOverride } : {},
33011
33144
  ...searchOverride !== void 0 ? { searchOverride } : {},
33012
33145
  ...onSearchChange ? { onSearchChange } : {},
33146
+ ...searchBox === false ? { searchBox } : {},
33013
33147
  ...newRowLabel ? { newRowLabel } : {},
33014
33148
  ...filter ? { filter } : {},
33015
33149
  ...onClearFilter ? { onClearFilter } : {},
@@ -36443,7 +36577,8 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
36443
36577
  ref: listRef,
36444
36578
  role: "listbox",
36445
36579
  "aria-label": "Versions of this record, newest first",
36446
- className: "flex min-h-0 flex-col divide-y overflow-y-auto rounded border",
36580
+ "data-records-history-list": "",
36581
+ className: "flex max-h-[9.25rem] min-h-0 flex-col divide-y overflow-y-auto rounded border",
36447
36582
  onKeyDown: (event) => {
36448
36583
  const at = entries.findIndex((e) => e.version === open);
36449
36584
  if (event.key === "ArrowDown" || event.key === "ArrowUp") {
@@ -47661,6 +47796,7 @@ function TablePage({
47661
47796
  newRowLabel,
47662
47797
  searchOverride,
47663
47798
  onSearchChange,
47799
+ searchBox,
47664
47800
  pageSize: pageSizeAsked,
47665
47801
  seedViews,
47666
47802
  onLeave,
@@ -47764,7 +47900,7 @@ function TablePage({
47764
47900
  if (hostFromLink || opened.layout || layoutChosen) return;
47765
47901
  setHostLayout(face.hostLayout);
47766
47902
  }, [face.kind, face.kind === "designated" ? face.hostLayout : null, layoutChosen]);
47767
- const faceUnknown = !hostFromLink && !opened.layout && (views === void 0 || Array.isArray(views) && views.length > 0 && (view === null || looks === void 0));
47903
+ const faceUnknown = !hostFromLink && !opened.layout && (views === void 0 || looks === void 0 || Array.isArray(views) && views.length > 0 && view === null);
47768
47904
  const shownLayout = layoutFromLink ?? shown4?.layout ?? "grid";
47769
47905
  const shownFilter = filter ?? (shown4?.where ? shown4.where : null) ?? (shown4?.filters && Object.keys(shown4.filters).length > 0 ? shown4.filters : null);
47770
47906
  const press = (pressed) => {
@@ -48550,6 +48686,7 @@ function TablePage({
48550
48686
  ...newRowLabel ? { newRowLabel } : {},
48551
48687
  ...searchOverride !== void 0 ? { searchOverride } : {},
48552
48688
  ...onSearchChange ? { onSearchChange } : {},
48689
+ ...searchBox === false ? { searchBox } : {},
48553
48690
  footer,
48554
48691
  openExport: () => setRail("export"),
48555
48692
  view: {
@@ -48856,6 +48993,7 @@ function EntityTablePageBody({
48856
48993
  presentation = "page",
48857
48994
  searchOverride,
48858
48995
  onSearchChange,
48996
+ searchBox = true,
48859
48997
  pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
48860
48998
  layout: opened = "grid",
48861
48999
  onLayoutChange,
@@ -48943,9 +49081,10 @@ function EntityTablePageBody({
48943
49081
  ] }) : null,
48944
49082
  addRefused ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(import_design_system142.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
48945
49083
  entity.error ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(import_jsx_runtime156.Fragment, { children: [
48946
- presentation === "embedded" ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(import_design_system141.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
49084
+ presentation === "embedded" && searchBox ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(import_design_system141.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
48947
49085
  import_design_system141.TapTargetSearchGroup,
48948
49086
  {
49087
+ surface: "solid",
48949
49088
  placeholder: "Search",
48950
49089
  value: term,
48951
49090
  onValueChange: (next) => {
@@ -48982,6 +49121,7 @@ function TablePage2(props) {
48982
49121
  ...rest.pageSize ? { pageSize: rest.pageSize } : {},
48983
49122
  ...rest.searchOverride !== void 0 ? { searchOverride: rest.searchOverride } : {},
48984
49123
  ...rest.onSearchChange ? { onSearchChange: rest.onSearchChange } : {},
49124
+ ...rest.searchBox === false ? { searchBox: false } : {},
48985
49125
  ...layout ? { layout } : {},
48986
49126
  ...onLayoutChange ? { onLayoutChange } : {},
48987
49127
  ...groupBy ? { groupBy } : {},