@ai-matrx/records-ui 0.115.70 → 0.115.71

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/pickers.cjs CHANGED
@@ -61,11 +61,11 @@ var import_react = require("react");
61
61
  var import_records2 = require("@ai-matrx/records");
62
62
  var import_react2 = require("@ai-matrx/records/react");
63
63
  var import_design_system = require("@ai-matrx/design-system");
64
- var import_data_table2 = require("@ai-matrx/design-system/data-table");
64
+ var import_data_table = require("@ai-matrx/design-system/data-table");
65
65
 
66
66
  // src/choiceLooks.ts
67
67
  var import_records = require("@ai-matrx/records");
68
- var import_data_table = require("@ai-matrx/design-system/data-table");
68
+ var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
69
69
  function displayFormatOf(field) {
70
70
  const raw = field.display_format;
71
71
  if (!raw || typeof raw !== "object") return null;
@@ -75,7 +75,7 @@ function displayFormatOf(field) {
75
75
  return { id, options: options && typeof options === "object" ? options : {} };
76
76
  }
77
77
  function isStyleColor(v) {
78
- return typeof v === "string" && import_data_table.STYLE_COLORS.includes(v);
78
+ return typeof v === "string" && import_table_style.STYLE_COLORS.includes(v);
79
79
  }
80
80
  function choiceLooksOf(field) {
81
81
  const display = displayFormatOf(field);
@@ -132,9 +132,9 @@ function nextChoiceColor(worn) {
132
132
  function choiceChipLookOf(field, ...words) {
133
133
  for (const word of words) {
134
134
  const color = storedChoiceColor(field, word);
135
- if (color) return { className: import_data_table.CHOICE_CHIP_CLASS[color], color };
135
+ if (color) return { className: import_table_style.CHOICE_CHIP_CLASS[color], color };
136
136
  }
137
- return { className: import_data_table.NEUTRAL_CHIP_CLASS, color: null };
137
+ return { className: import_table_style.NEUTRAL_CHIP_CLASS, color: null };
138
138
  }
139
139
 
140
140
  // src/plainWords.ts
@@ -536,12 +536,12 @@ function ChoiceSwatch({ words, color, onColor }) {
536
536
  "button",
537
537
  {
538
538
  type: "button",
539
- "aria-label": `Colour for ${words}: ${color ? import_data_table2.STYLE_COLOR_LABELS[color] : "none"}`,
540
- title: color ? import_data_table2.STYLE_COLOR_LABELS[color] : "No colour",
539
+ "aria-label": `Colour for ${words}: ${color ? import_data_table.STYLE_COLOR_LABELS[color] : "none"}`,
540
+ title: color ? import_data_table.STYLE_COLOR_LABELS[color] : "No colour",
541
541
  "data-records-choice-swatch": color ?? "none",
542
542
  className: (0, import_design_system.cn)(
543
543
  "h-4 w-4 shrink-0 rounded-full",
544
- color ? import_data_table2.SWATCH_CLASS[color] : "border border-border bg-background"
544
+ color ? import_data_table.SWATCH_CLASS[color] : "border border-border bg-background"
545
545
  )
546
546
  }
547
547
  ) }),
@@ -558,17 +558,17 @@ function ChoiceSwatch({ words, color, onColor }) {
558
558
  className: (0, import_design_system.cn)("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
559
559
  }
560
560
  ),
561
- import_data_table2.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
561
+ import_data_table.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
562
562
  "button",
563
563
  {
564
564
  type: "button",
565
565
  role: "radio",
566
566
  "aria-checked": color === c,
567
- "aria-label": import_data_table2.STYLE_COLOR_LABELS[c],
568
- title: import_data_table2.STYLE_COLOR_LABELS[c],
567
+ "aria-label": import_data_table.STYLE_COLOR_LABELS[c],
568
+ title: import_data_table.STYLE_COLOR_LABELS[c],
569
569
  "data-records-choice-color": `${words}:${c}`,
570
570
  onClick: () => pick(c),
571
- className: (0, import_design_system.cn)("h-5 w-5 rounded-full", import_data_table2.SWATCH_CLASS[c], color === c && "ring-2 ring-ring ring-offset-1")
571
+ className: (0, import_design_system.cn)("h-5 w-5 rounded-full", import_data_table.SWATCH_CLASS[c], color === c && "ring-2 ring-ring ring-offset-1")
572
572
  },
573
573
  c
574
574
  ))
@@ -667,8 +667,7 @@ function lockedStructure(base) {
667
667
  return { ...base, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base.why(what) };
668
668
  }
669
669
 
670
- // src/host.tsx
671
- var import_jsx_runtime2 = require("react/jsx-runtime");
670
+ // src/tableRights.ts
672
671
  function tableRights(may, overallReason) {
673
672
  return {
674
673
  ...may,
@@ -677,6 +676,9 @@ function tableRights(may, overallReason) {
677
676
  };
678
677
  }
679
678
  var NO_RIGHTS = tableRights(NOT_ANSWERED_YET);
679
+
680
+ // src/host.tsx
681
+ var import_jsx_runtime2 = require("react/jsx-runtime");
680
682
  var NO_MEMBERS_REASON = "This app cannot offer the people in your organization on this screen yet, so there is nobody to pick. Type the person's name into a text field for now, and tell us \u2014 it is on our list, not yours.";
681
683
  var NO_UPLOAD_REASON = "This screen cannot take a file yet, so there is no chooser here rather than one that loses what you pick. Put a link to the file in a text field for now. It is on our list, not yours.";
682
684
  var HostContext = (0, import_react3.createContext)(null);
@@ -2024,7 +2026,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
2024
2026
  // src/buttonCell.tsx
2025
2027
  var import_react46 = require("react");
2026
2028
  var import_design_system30 = require("@ai-matrx/design-system");
2027
- var import_data_table8 = require("@ai-matrx/design-system/data-table");
2029
+ var import_data_table6 = require("@ai-matrx/design-system/data-table");
2028
2030
  var import_records26 = require("@ai-matrx/records");
2029
2031
  var import_react47 = require("@ai-matrx/records/react");
2030
2032
 
@@ -2082,7 +2084,8 @@ var import_react12 = require("react");
2082
2084
  var import_records9 = require("@ai-matrx/records");
2083
2085
  var import_react13 = require("@ai-matrx/records/react");
2084
2086
  var import_design_system9 = require("@ai-matrx/design-system");
2085
- var import_jsx_runtime10 = require("react/jsx-runtime");
2087
+
2088
+ // src/tablePickerEntries.ts
2086
2089
  var PLATFORM_TABLE_PREFIX = "records_ui_";
2087
2090
  function keptByPlatform(table) {
2088
2091
  return table.platform_owned === true || table.kept_by_the_app === true;
@@ -2126,6 +2129,9 @@ function madeOn(stamp) {
2126
2129
  if (Number.isNaN(at.getTime())) return null;
2127
2130
  return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
2128
2131
  }
2132
+
2133
+ // src/tablePicking.tsx
2134
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2129
2135
  function usePickerTables() {
2130
2136
  const client = (0, import_react13.useRecordsClient)();
2131
2137
  const tables = (0, import_react13.useTables)();
@@ -2771,7 +2777,7 @@ var import_design_system22 = require("@ai-matrx/design-system");
2771
2777
  var import_react34 = require("@ai-matrx/records/react");
2772
2778
 
2773
2779
  // src/values.tsx
2774
- var import_data_table5 = require("@ai-matrx/design-system/data-table");
2780
+ var import_data_table3 = require("@ai-matrx/design-system/data-table");
2775
2781
  var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
2776
2782
  var import_design_system21 = require("@ai-matrx/design-system");
2777
2783
 
@@ -2779,8 +2785,7 @@ var import_design_system21 = require("@ai-matrx/design-system");
2779
2785
  var import_react20 = require("react");
2780
2786
 
2781
2787
  // src/presentation.ts
2782
- var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
2783
- var import_data_table3 = require("@ai-matrx/design-system/data-table");
2788
+ var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
2784
2789
  var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
2785
2790
  var import_records11 = require("@ai-matrx/records");
2786
2791
  var DRAWN_KINDS = /* @__PURE__ */ new Set(["select", "multi_select", "relation", "member", "person", "attachment", "file", "entity_reference", "checkbox", "boolean", "signature", "json"]);
@@ -3694,7 +3699,7 @@ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
3694
3699
 
3695
3700
  // src/formattedValue.tsx
3696
3701
  var import_react29 = require("react");
3697
- var import_data_table4 = require("@ai-matrx/design-system/data-table");
3702
+ var import_data_table2 = require("@ai-matrx/design-system/data-table");
3698
3703
  var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
3699
3704
  var import_design_system17 = require("@ai-matrx/design-system");
3700
3705
  var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
@@ -3831,8 +3836,8 @@ function FormattedValue({
3831
3836
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
3832
3837
  }
3833
3838
  const result = (0, import_field_formats3.formatFieldValue)(value, format);
3834
- if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_data_table4.FormattedCell, { result });
3835
- return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_data_table4.FormattedCell, { result });
3839
+ if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_data_table2.FormattedCell, { result });
3840
+ return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_data_table2.FormattedCell, { result });
3836
3841
  }
3837
3842
  function linkChipText(raw) {
3838
3843
  try {
@@ -4320,8 +4325,8 @@ function formulaSourceArchived(field, document2) {
4320
4325
  const keys = (field.config ?? {})[FORMULA_INPUT_KEYS];
4321
4326
  if (!Array.isArray(keys) || !document2) return null;
4322
4327
  for (const key of keys) {
4323
- const state = (0, import_records16.sourceArchivedOf)(document2[String(key)]);
4324
- if (state) return state;
4328
+ const state2 = (0, import_records16.sourceArchivedOf)(document2[String(key)]);
4329
+ if (state2) return state2;
4325
4330
  }
4326
4331
  return null;
4327
4332
  }
@@ -4373,12 +4378,12 @@ function computedEmptyOf(field, document2) {
4373
4378
  return { kind: "formula" };
4374
4379
  }
4375
4380
  var SOURCE_ARCHIVED_WORDS = "Source archived";
4376
- function sourceArchivedSentence(state) {
4377
- if (!state.label) return "A column it reads is archived";
4378
- return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
4381
+ function sourceArchivedSentence(state2) {
4382
+ if (!state2.label) return "A column it reads is archived";
4383
+ return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
4379
4384
  }
4380
- function SourceArchivedValue({ state }) {
4381
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4385
+ function SourceArchivedValue({ state: state2 }) {
4386
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
4382
4387
  }
4383
4388
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
4384
4389
  function renderValue(field, value, document2, labels, stillWaitingFor, look) {
@@ -4423,7 +4428,7 @@ function renderValue(field, value, document2, labels, stillWaitingFor, look) {
4423
4428
  const chosen = kind === "select" || kind === "multi_select";
4424
4429
  const chipOf = (item) => {
4425
4430
  const chipLook = choiceChipLookOf(field, item, scalarText(field, item, labels));
4426
- return { className: chipLook.className, tinted: chipLook.color !== null, dot: import_data_table5.SWATCH_CLASS[chipLook.color ?? "gray"] };
4431
+ return { className: chipLook.className, tinted: chipLook.color !== null, dot: import_data_table3.SWATCH_CLASS[chipLook.color ?? "gray"] };
4427
4432
  };
4428
4433
  if (chosen) {
4429
4434
  const items = Array.isArray(value) ? value : [value];
@@ -4530,12 +4535,12 @@ function scalarText(field, value, labels, stillWaitingFor) {
4530
4535
 
4531
4536
  // src/SourceArchivedNotice.tsx
4532
4537
  var import_jsx_runtime24 = require("react/jsx-runtime");
4533
- function bringBackLabel(state) {
4534
- return state.label ? `Bring back ${state.label}` : "Bring it back";
4538
+ function bringBackLabel(state2) {
4539
+ return state2.label ? `Bring back ${state2.label}` : "Bring it back";
4535
4540
  }
4536
4541
  function SourceArchivedNotice({ fieldId, tableId }) {
4537
4542
  const client = (0, import_react34.useRecordsClient)();
4538
- const [state, setState] = (0, import_react33.useState)(null);
4543
+ const [state2, setState] = (0, import_react33.useState)(null);
4539
4544
  const [busy, setBusy] = (0, import_react33.useState)(false);
4540
4545
  const [refused, setRefused] = (0, import_react33.useState)(null);
4541
4546
  const read = (0, import_react33.useCallback)(async () => {
@@ -4546,19 +4551,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
4546
4551
  (0, import_react33.useEffect)(() => {
4547
4552
  void read();
4548
4553
  }, [read]);
4549
- if (refused && !state) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RefusalNotice, { error: refused });
4550
- if (!state) return null;
4554
+ if (refused && !state2) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RefusalNotice, { error: refused });
4555
+ if (!state2) return null;
4551
4556
  const restore = async () => {
4552
- if (!state.field_id) return;
4557
+ if (!state2.field_id) return;
4553
4558
  setBusy(true);
4554
4559
  setRefused(null);
4555
- const done = await client.fieldRestore({ field_id: state.field_id });
4560
+ const done = await client.fieldRestore({ field_id: state2.field_id });
4556
4561
  setBusy(false);
4557
4562
  if (!done.ok) {
4558
4563
  setRefused(done.error);
4559
4564
  return;
4560
4565
  }
4561
- if (state.table_id) (0, import_react34.tableShapeChanged)(state.table_id);
4566
+ if (state2.table_id) (0, import_react34.tableShapeChanged)(state2.table_id);
4562
4567
  (0, import_react34.tableShapeChanged)(tableId);
4563
4568
  await read();
4564
4569
  };
@@ -4567,13 +4572,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
4567
4572
  {
4568
4573
  className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
4569
4574
  "data-testid": "source-archived-notice",
4570
- "data-field-id": state.field_id ?? "",
4575
+ "data-field-id": state2.field_id ?? "",
4571
4576
  children: [
4572
4577
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4573
4578
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
4574
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state) })
4579
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
4575
4580
  ] }),
4576
- state.field_id ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system22.Button, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state) }) : null,
4581
+ state2.field_id ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_design_system22.Button, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
4577
4582
  refused ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RefusalNotice, { error: refused, className: "basis-full" }) : null
4578
4583
  ]
4579
4584
  }
@@ -4588,23 +4593,25 @@ var import_react37 = require("@ai-matrx/records/react");
4588
4593
 
4589
4594
  // src/personTime.ts
4590
4595
  var import_react35 = require("react");
4591
- var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
4592
- var zone = null;
4593
- var listeners = /* @__PURE__ */ new Set();
4596
+
4597
+ // src/personZone.ts
4598
+ var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
4599
+ var import_global_slot = require("@ai-matrx/kit/global-slot");
4600
+ var state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
4601
+ zone: null,
4602
+ listeners: /* @__PURE__ */ new Set()
4603
+ }));
4594
4604
  function getPersonTimeZone() {
4595
- return zone;
4605
+ return state.zone;
4596
4606
  }
4597
- function usePersonTimeZone() {
4598
- return (0, import_react35.useSyncExternalStore)(
4599
- (cb) => {
4600
- listeners.add(cb);
4601
- return () => listeners.delete(cb);
4602
- },
4603
- () => zone,
4604
- () => null
4605
- );
4607
+ function subscribePersonTimeZone(listener) {
4608
+ state.listeners.add(listener);
4609
+ return () => {
4610
+ state.listeners.delete(listener);
4611
+ };
4606
4612
  }
4607
4613
  function personWallNow(at = /* @__PURE__ */ new Date()) {
4614
+ const zone = state.zone;
4608
4615
  if (!zone) return at;
4609
4616
  const parts = new Intl.DateTimeFormat("en-US", {
4610
4617
  timeZone: zone,
@@ -4620,6 +4627,15 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
4620
4627
  return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
4621
4628
  }
4622
4629
 
4630
+ // src/personTime.ts
4631
+ function usePersonTimeZone() {
4632
+ return (0, import_react35.useSyncExternalStore)(
4633
+ subscribePersonTimeZone,
4634
+ getPersonTimeZone,
4635
+ () => null
4636
+ );
4637
+ }
4638
+
4623
4639
  // src/Condition.tsx
4624
4640
  var import_jsx_runtime25 = require("react/jsx-runtime");
4625
4641
  var CONDITION_OPS = [
@@ -4647,10 +4663,10 @@ var RELATIVE_DAY_TERMS = [
4647
4663
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
4648
4664
  ];
4649
4665
  function relativeDayNode(fieldId, kind, days) {
4650
- const zone2 = getPersonTimeZone();
4666
+ const zone = getPersonTimeZone();
4651
4667
  const window2 = { relative: kind };
4652
4668
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
4653
- if (zone2) window2["tz"] = zone2;
4669
+ if (zone) window2["tz"] = zone;
4654
4670
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
4655
4671
  }
4656
4672
  function relativeDayOf(expr) {
@@ -5829,14 +5845,14 @@ var import_records24 = require("@ai-matrx/records");
5829
5845
  // src/ButtonSettings.tsx
5830
5846
  var import_react42 = require("react");
5831
5847
  var import_design_system28 = require("@ai-matrx/design-system");
5832
- var import_data_table7 = require("@ai-matrx/design-system/data-table");
5848
+ var import_data_table5 = require("@ai-matrx/design-system/data-table");
5833
5849
  var import_records23 = require("@ai-matrx/records");
5834
5850
  var import_react43 = require("@ai-matrx/records/react");
5835
5851
 
5836
5852
  // src/AccentSwatches.tsx
5837
5853
  var import_records22 = require("@ai-matrx/records");
5838
5854
  var import_design_system27 = require("@ai-matrx/design-system");
5839
- var import_data_table6 = require("@ai-matrx/design-system/data-table");
5855
+ var import_data_table4 = require("@ai-matrx/design-system/data-table");
5840
5856
  var import_jsx_runtime30 = require("react/jsx-runtime");
5841
5857
  function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACCENTS, noneLabel = "App colour" }) {
5842
5858
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
@@ -5860,10 +5876,10 @@ function AccentSwatches({ value, onChange, options = import_records22.PORTAL_ACC
5860
5876
  type: "button",
5861
5877
  role: "radio",
5862
5878
  "aria-checked": value === c,
5863
- "aria-label": import_data_table6.STYLE_COLOR_LABELS[c],
5864
- title: import_data_table6.STYLE_COLOR_LABELS[c],
5879
+ "aria-label": import_data_table4.STYLE_COLOR_LABELS[c],
5880
+ title: import_data_table4.STYLE_COLOR_LABELS[c],
5865
5881
  onClick: () => onChange(c),
5866
- className: (0, import_design_system27.cn)("h-7 w-7 rounded-full border-2", import_data_table6.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
5882
+ className: (0, import_design_system27.cn)("h-7 w-7 rounded-full border-2", import_data_table4.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
5867
5883
  },
5868
5884
  c
5869
5885
  ))
@@ -5943,7 +5959,7 @@ function ButtonSettingsEditor({
5943
5959
  AccentSwatches,
5944
5960
  {
5945
5961
  value: value.color ?? "",
5946
- options: import_data_table7.STYLE_COLORS,
5962
+ options: import_data_table5.STYLE_COLORS,
5947
5963
  noneLabel: "Plain",
5948
5964
  onChange: (next) => set({ color: next === "" ? void 0 : next })
5949
5965
  }
@@ -7008,12 +7024,12 @@ function sourceKindOf(field) {
7008
7024
  if (kind === "attachment") return "file";
7009
7025
  return null;
7010
7026
  }
7011
- function whatIsMissing(state) {
7012
- const noun = state.noun ?? "column";
7013
- const { type, label, via, pick, agg, of, relations, formulaFields } = state;
7014
- const relationTarget = state.relationTarget ?? "";
7027
+ function whatIsMissing(state2) {
7028
+ const noun = state2.noun ?? "column";
7029
+ const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
7030
+ const relationTarget = state2.relationTarget ?? "";
7015
7031
  if (label.trim() === "") return `Give the ${noun} a name.`;
7016
- if (type === "entity_reference") return whatIsMissingForEntityReference(state.allowedTypes ?? []);
7032
+ if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
7017
7033
  if (type === "relation") {
7018
7034
  if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
7019
7035
  return null;
@@ -7388,7 +7404,7 @@ function ButtonValue({ field, recordId, inCell }) {
7388
7404
  const [said2, setSaid] = (0, import_react46.useState)(null);
7389
7405
  const [settingUp, setSettingUp] = (0, import_react46.useState)(false);
7390
7406
  if (!b) return null;
7391
- const color = (0, import_data_table8.isStyleColor)(b.color) ? import_data_table8.CHOICE_CHIP_CLASS[b.color] : import_data_table8.NEUTRAL_CHIP_CLASS;
7407
+ const color = (0, import_data_table6.isStyleColor)(b.color) ? import_data_table6.CHOICE_CHIP_CLASS[b.color] : import_data_table6.NEUTRAL_CHIP_CLASS;
7392
7408
  const needs = (0, import_records26.buttonNeeds)(b);
7393
7409
  const tableId = field.entity_definition_id;
7394
7410
  const press = async () => {
@@ -8951,11 +8967,17 @@ function ChoiceAnswer({
8951
8967
 
8952
8968
  // src/RecordsMount.tsx
8953
8969
  var import_react57 = require("react");
8954
- var import_react58 = require("@ai-matrx/records/react");
8955
- var import_jsx_runtime39 = require("react/jsx-runtime");
8970
+
8971
+ // src/dataSource.ts
8972
+ var import_global_slot2 = require("@ai-matrx/kit/global-slot");
8956
8973
  function personActor(userId) {
8957
8974
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
8958
8975
  }
8976
+ var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
8977
+
8978
+ // src/RecordsMount.tsx
8979
+ var import_react58 = require("@ai-matrx/records/react");
8980
+ var import_jsx_runtime39 = require("react/jsx-runtime");
8959
8981
 
8960
8982
  // src/TablePickers.tsx
8961
8983
  var import_jsx_runtime40 = require("react/jsx-runtime");
@@ -8990,7 +9012,7 @@ function readTablesAnywhere(dataSource) {
8990
9012
  return read;
8991
9013
  }
8992
9014
  function useTablesAnywhere(dataSource) {
8993
- const [state, setState] = (0, import_react59.useState)({ loading: true, error: null, rows: [] });
9015
+ const [state2, setState] = (0, import_react59.useState)({ loading: true, error: null, rows: [] });
8994
9016
  (0, import_react59.useEffect)(() => {
8995
9017
  let live = true;
8996
9018
  void readTablesAnywhere(dataSource).then((result) => {
@@ -9000,7 +9022,7 @@ function useTablesAnywhere(dataSource) {
9000
9022
  live = false;
9001
9023
  };
9002
9024
  }, [dataSource]);
9003
- return state;
9025
+ return state2;
9004
9026
  }
9005
9027
  function TablePicker({ dataSource, value, onChange, disabled, tables }) {
9006
9028
  const own3 = useTablesAnywhere(dataSource);