@ai-matrx/records-ui 0.115.39 → 0.115.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5503,9 +5503,12 @@ function withheldNoticeOf(hidden, key) {
5503
5503
  return notice && typeof notice === "object" ? notice : null;
5504
5504
  }
5505
5505
  function withheldSentence(field2, notice) {
5506
- const says = notice.says;
5507
- if (typeof says === "string" && says.trim() !== "") return says.trim();
5506
+ const extra = notice;
5507
+ if (typeof extra.says === "string" && extra.says.trim() !== "") return extra.says.trim();
5508
5508
  const name = fieldName(field2);
5509
+ if (typeof extra.part === "string" && extra.part.trim() !== "" && typeof extra.who === "string" && extra.who.trim() !== "") {
5510
+ return `${name} is in ${extra.part.trim()} \u2014 ${extra.who.trim()} see it.`;
5511
+ }
5509
5512
  const reason = notice.reason ? ` It is ${notice.reason}` : "";
5510
5513
  const needs = notice.needs ? `${reason ? "," : " It"} and reading it needs ${notice.needs}` : "";
5511
5514
  const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
@@ -16618,6 +16621,7 @@ function useMergedGridControls(args) {
16618
16621
  } = args;
16619
16622
  const client = useRecordsClient27();
16620
16623
  const linkRecord = useRecordsUi().linkRecord;
16624
+ const columnAccess = useRecordsUi().columnAccess;
16621
16625
  const hrefForRecord = useRecordsUi().hrefForRecord;
16622
16626
  const tableVersion = (0, recordVersions_exports.useTableVersion)(client, tableId, table);
16623
16627
  const mutation = useFieldMutation2();
@@ -16799,6 +16803,14 @@ function useMergedGridControls(args) {
16799
16803
  writeLook({ ...rest, ...next.size > 0 ? { wrapColumns: [...next] } : {} });
16800
16804
  }
16801
16805
  });
16806
+ if (columnAccess) {
16807
+ out.push({
16808
+ id: "col-access",
16809
+ label: "Who can see and edit\u2026",
16810
+ disabledReason: rights.structure ? void 0 : rights.why("structure"),
16811
+ onSelect: () => setDialog({ kind: "access", field: field2 })
16812
+ });
16813
+ }
16802
16814
  out.push({
16803
16815
  id: "col-duplicate",
16804
16816
  label: "Duplicate property",
@@ -17080,6 +17092,7 @@ function useMergedGridControls(args) {
17080
17092
  }
17081
17093
  };
17082
17094
  }, [
17095
+ columnAccess,
17083
17096
  args,
17084
17097
  colours,
17085
17098
  fieldKeys,
@@ -17130,6 +17143,13 @@ function useMergedGridControls(args) {
17130
17143
  const close = () => setDialog(null);
17131
17144
  const dialogs = !enabled ? null : /* @__PURE__ */ jsxs57(Fragment17, { children: [
17132
17145
  colours.dialogs,
17146
+ dialog?.kind === "access" && columnAccess ? columnAccess({
17147
+ tableId,
17148
+ fieldId: dialog.field.id,
17149
+ name: fieldName(dialog.field),
17150
+ onClose: () => setDialog(null),
17151
+ onChanged: () => tableShapeChanged5(tableId)
17152
+ }) : null,
17133
17153
  /* @__PURE__ */ jsx63(RowActionsDialog, { tableId, open: rowActionsOpen, onOpenChange: setRowActionsOpen }),
17134
17154
  /* @__PURE__ */ jsx63(
17135
17155
  RowLabelPicker,
@@ -19727,10 +19747,30 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
19727
19747
  children: "\u27F3"
19728
19748
  }
19729
19749
  ) : null;
19730
- const withSynced = (header) => syncedMark ? /* @__PURE__ */ jsxs63("span", { className: "inline-flex items-center gap-1", children: [
19731
- syncedMark,
19732
- header
19733
- ] }) : header;
19750
+ const restricted = field2.sensitivity === "confidential" || field2.sensitivity === "restricted";
19751
+ const lockMark = restricted ? /* @__PURE__ */ jsx69(
19752
+ "span",
19753
+ {
19754
+ "data-records-restricted": field2.key,
19755
+ title: "Fewer people see this column",
19756
+ "aria-label": "Fewer people see this column",
19757
+ className: "inline-flex text-muted-foreground",
19758
+ children: /* @__PURE__ */ jsxs63("svg", { viewBox: "0 0 24 24", width: "11", height: "11", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
19759
+ /* @__PURE__ */ jsx69("rect", { x: "4", y: "11", width: "16", height: "10", rx: "2" }),
19760
+ /* @__PURE__ */ jsx69("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })
19761
+ ] })
19762
+ }
19763
+ ) : null;
19764
+ const withSynced = (inner2) => {
19765
+ const header = lockMark ? /* @__PURE__ */ jsxs63("span", { className: "inline-flex items-center gap-1", children: [
19766
+ inner2,
19767
+ lockMark
19768
+ ] }) : inner2;
19769
+ return syncedMark ? /* @__PURE__ */ jsxs63("span", { className: "inline-flex items-center gap-1", children: [
19770
+ syncedMark,
19771
+ header
19772
+ ] }) : header;
19773
+ };
19734
19774
  return {
19735
19775
  id: field2.key,
19736
19776
  /*
@@ -20982,7 +21022,7 @@ function columnsSentence(mapped, total, unmapped) {
20982
21022
  if (unmapped === "ignore") return `${mapped} of ${total} columns go into this table \xB7 ${rest} left out`;
20983
21023
  return `${mapped} of ${total} go in now \xB7 ${rest} wait for approval with their values`;
20984
21024
  }
20985
- function ImportWizard({ tableId, source, onDone, onWrote, className }) {
21025
+ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className }) {
20986
21026
  const client = useRecordsClient35();
20987
21027
  const table = useTable8(tableId);
20988
21028
  const fields = useFields10(tableId);
@@ -21604,6 +21644,13 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
21604
21644
  const refusedByRules = ruleVerdicts.reduce((n, v) => n + v.refused, 0);
21605
21645
  const [goAheadAnyway, setGoAheadAnyway] = useState61(false);
21606
21646
  useEffect46(() => setGoAheadAnyway(false), [ruleVerdicts]);
21647
+ const [autoRan, setAutoRan] = useState61(false);
21648
+ useEffect46(() => {
21649
+ if (!autoRun || autoRan || !source || phase !== "ready" || !plan) return;
21650
+ if (busy || !rights.write || rows.length === 0 || titleMissing || ruleVerdicts.length > 0) return;
21651
+ setAutoRan(true);
21652
+ void run();
21653
+ }, [autoRun, autoRan, source, phase, plan, busy, rights.write, rows.length, titleMissing, ruleVerdicts, run]);
21607
21654
  const afterWrite = !busy && (phase === "done" || alreadyRan !== null || ledger !== null && ledger.seen > 0);
21608
21655
  return /* @__PURE__ */ jsxs68("div", { className: cn37("flex min-w-0 flex-col gap-2 text-xs", className), children: [
21609
21656
  /* @__PURE__ */ jsxs68("div", { className: "flex items-center gap-2", children: [
@@ -24312,6 +24359,8 @@ import {
24312
24359
  designateView,
24313
24360
  viewPatchFor,
24314
24361
  groupViewsBySection,
24362
+ planViewDrop,
24363
+ sectionDropId,
24315
24364
  sectionNames,
24316
24365
  sectionNameOk,
24317
24366
  reassignSection
@@ -28231,7 +28280,7 @@ function NewTableStart({
28231
28280
  /* @__PURE__ */ jsx89(Button53, { disabled: !importReady || busy, onClick: () => void continueImport(), "data-new-table-continue": "", children: busy ? "Creating\u2026" : "Next: columns" })
28232
28281
  ] });
28233
28282
  } else {
28234
- body = /* @__PURE__ */ jsx89("div", { "data-new-table-wizard": "", children: /* @__PURE__ */ jsx89(ImportWizard, { tableId: step2.tableId, source: step2.source, onDone: () => onOpenTable?.(step2.tableId) }) });
28283
+ body = /* @__PURE__ */ jsx89("div", { "data-new-table-wizard": "", children: /* @__PURE__ */ jsx89(ImportWizard, { tableId: step2.tableId, source: step2.source, autoRun: step2.made, onDone: () => onOpenTable?.(step2.tableId) }) });
28235
28284
  footer = /* @__PURE__ */ jsxs79(Fragment30, { children: [
28236
28285
  !step2.made ? /* @__PURE__ */ jsx89(Button53, { variant: "ghost", className: "mr-auto", onClick: () => setStep({ at: "import" }), children: "Back" }) : null,
28237
28286
  /* @__PURE__ */ jsx89(Button53, { variant: "outline", onClick: () => onOpenTable?.(step2.tableId), "data-new-table-open": "", children: "Open the table" })
@@ -35076,6 +35125,7 @@ function TimelineView({
35076
35125
  const [dragging, setDragging] = useState99(null);
35077
35126
  const [linking, setLinking] = useState99(null);
35078
35127
  const [ganttBusy, setGanttBusy] = useState99(false);
35128
+ const [linkTarget, setLinkTarget] = useState99(null);
35079
35129
  const { placed, unscheduled } = useMemo57(() => {
35080
35130
  const out = [];
35081
35131
  const without = [];
@@ -35244,6 +35294,18 @@ function TimelineView({
35244
35294
  label: `${titleOf(target)} now waits on ${titleOf(source)}`
35245
35295
  });
35246
35296
  };
35297
+ const taskRowAt = (x, y) => {
35298
+ const canvas = scroller.current?.querySelector("[data-timeline-canvas]");
35299
+ const body2 = scroller.current;
35300
+ if (!canvas || !body2) return null;
35301
+ const box = canvas.getBoundingClientRect();
35302
+ const frame2 = body2.getBoundingClientRect();
35303
+ if (frame2.width === 0 || x < frame2.left || x > frame2.right) return null;
35304
+ const index = Math.floor((y - box.top - LANE_PAD / 2) / ROW_PX);
35305
+ if (index < 0) return null;
35306
+ const lane = laneRows[0];
35307
+ return lane?.packed.find((b) => b.row === index)?.p.row.id ?? null;
35308
+ };
35247
35309
  const beginLink = (p) => (e) => {
35248
35310
  if (e.button !== void 0 && e.button !== 0) return;
35249
35311
  e.stopPropagation();
@@ -35252,13 +35314,21 @@ function TimelineView({
35252
35314
  const x1 = box.left + box.width / 2;
35253
35315
  const y1 = box.top + box.height / 2;
35254
35316
  setLinking({ id: p.row.id, x1, y1, x2: e.clientX, y2: e.clientY });
35255
- const onMove = (ev) => setLinking((l) => l ? { ...l, x2: ev.clientX, y2: ev.clientY } : l);
35317
+ const onMove = (ev) => {
35318
+ const x = ev.clientX;
35319
+ const y = ev.clientY;
35320
+ setLinking((l) => l ? { ...l, x2: x, y2: y } : l);
35321
+ const over = taskRowAt(x, y);
35322
+ setLinkTarget(over && over !== p.row.id ? over : null);
35323
+ };
35256
35324
  const onUp = (ev) => {
35257
35325
  window.removeEventListener("pointermove", onMove);
35258
35326
  window.removeEventListener("pointerup", onUp);
35259
35327
  setLinking(null);
35328
+ setLinkTarget(null);
35329
+ const at = ev;
35260
35330
  const hit = ev.target?.closest?.("[data-timeline-bar]");
35261
- const id = hit?.getAttribute("data-timeline-bar");
35331
+ const id = taskRowAt(at.clientX, at.clientY) ?? hit?.getAttribute("data-timeline-bar");
35262
35332
  if (id && id !== p.row.id) connect(p.row.id, id);
35263
35333
  };
35264
35334
  window.addEventListener("pointermove", onMove);
@@ -35489,6 +35559,7 @@ function TimelineView({
35489
35559
  "data-timeline-span": `${first}..${last}`,
35490
35560
  ...p.marker ? { "data-timeline-marker": "" } : {},
35491
35561
  ...milestone ? { "data-timeline-milestone": "" } : {},
35562
+ ...linkTarget === p.row.id ? { "data-timeline-drop-target": "" } : {},
35492
35563
  ...onCritical ? { "data-timeline-critical": "" } : {},
35493
35564
  ...slip !== null ? { "data-timeline-slip": slip } : {},
35494
35565
  ...may ? {} : { "data-timeline-locked": "" },
@@ -35502,6 +35573,7 @@ function TimelineView({
35502
35573
  outside ? "overflow-visible" : "overflow-hidden",
35503
35574
  milestone ? "border-transparent bg-transparent" : color ? CHOICE_CHIP_CLASS4[color] : "bg-muted",
35504
35575
  onCritical ? "ring-2 ring-amber-500" : void 0,
35576
+ linkTarget === p.row.id ? "ring-2 ring-primary" : void 0,
35505
35577
  may ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
35506
35578
  dragging?.id === p.row.id ? "z-20 shadow-md" : "z-10",
35507
35579
  refused ? "ring-2 ring-destructive" : void 0
@@ -35583,7 +35655,7 @@ function TimelineView({
35583
35655
  /* @__PURE__ */ jsxs109("div", { className: "ml-auto flex flex-wrap items-center gap-2", children: [
35584
35656
  settings,
35585
35657
  /* @__PURE__ */ jsxs109(DropdownMenu8, { children: [
35586
- /* @__PURE__ */ jsx120(DropdownMenuTrigger8, { asChild: true, children: /* @__PURE__ */ jsx120(Button75, { size: "sm", variant: ganttOn ? "secondary" : "outline", "aria-label": "Gantt options", "data-timeline-gantt-menu": "", children: "Gantt" }) }),
35658
+ /* @__PURE__ */ jsx120(DropdownMenuTrigger8, { asChild: true, children: /* @__PURE__ */ jsx120(Button75, { size: "sm", variant: "outline", className: ganttOn ? "bg-secondary" : void 0, "aria-label": "Gantt options", "data-timeline-gantt-menu": "", children: "Gantt" }) }),
35587
35659
  /* @__PURE__ */ jsxs109(DropdownMenuContent8, { align: "end", className: "min-w-48", children: [
35588
35660
  /* @__PURE__ */ jsx120(DropdownMenuCheckboxItem2, { checked: ganttOn, onCheckedChange: (on) => setGantt({ mode: on === true }), children: "Gantt view" }),
35589
35661
  ganttOn ? /* @__PURE__ */ jsxs109(Fragment45, { children: [
@@ -35661,6 +35733,7 @@ function TimelineView({
35661
35733
  const ghost = baselineOf(b.p.row);
35662
35734
  const at = shown5(b.p);
35663
35735
  return /* @__PURE__ */ jsxs109("div", { children: [
35736
+ linkTarget === b.p.row.id ? /* @__PURE__ */ jsx120("div", { "aria-hidden": "true", "data-timeline-drop-band": b.p.row.id, className: "pointer-events-none absolute inset-x-0 bg-primary/10", style: { top: LANE_PAD / 2 + b.row * ROW_PX, height: ROW_PX } }) : null,
35664
35737
  ghost ? /* @__PURE__ */ jsx120(
35665
35738
  "div",
35666
35739
  {
@@ -38995,6 +39068,9 @@ function ArchivedPortals({
38995
39068
  import { useCallback as useCallback43, useEffect as useEffect89, useRef as useRef50, useState as useState109 } from "react";
38996
39069
  import { useRecordsClient as useRecordsClient74 } from "@ai-matrx/records/react";
38997
39070
  import { Badge as Badge15, Button as Button80, Input as Input6, Popover as Popover16, PopoverContent as PopoverContent16, PopoverTrigger as PopoverTrigger16, Skeleton as Skeleton18, cn as cn65 } from "@ai-matrx/design-system";
39071
+ import { DndContext, PointerSensor, closestCenter, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
39072
+ import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
39073
+ import { CSS as CSS2 } from "@dnd-kit/utilities";
38998
39074
 
38999
39075
  // src/seedOnce.ts
39000
39076
  import { useCallback as useCallback42, useRef as useRef49 } from "react";
@@ -39016,7 +39092,7 @@ var NOOP3 = () => {
39016
39092
  };
39017
39093
  function viewActions(whyNot, host, locked = false, personal = false) {
39018
39094
  const one = (base2, run) => {
39019
- if (whyNot !== null) return { ...base2, disabledReason: whyNot, run: NOOP3 };
39095
+ if (whyNot !== null) return { ...base2, disabledReason: locked && base2.id !== "duplicate" && base2.id !== "lock" ? VIEW_LOCKED_REASON : whyNot, run: NOOP3 };
39020
39096
  if (!run) return { ...base2, disabledReason: ACTION_NOT_HERE_REASON, run: NOOP3 };
39021
39097
  return { ...base2, run };
39022
39098
  };
@@ -39059,6 +39135,25 @@ function seedIsSatisfied(seed, views) {
39059
39135
  if (views.some((v) => v.name === seed.name)) return true;
39060
39136
  return seed.isDefault === true && views.some((v) => v.isDefault);
39061
39137
  }
39138
+ function SectionBox({ id, children, ...rest }) {
39139
+ const { setNodeRef, isOver } = useDroppable({ id });
39140
+ return /* @__PURE__ */ jsx131("div", { ref: setNodeRef, className: cn65("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
39141
+ }
39142
+ function SortableRow({ id, disabled, children }) {
39143
+ const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = useSortable({ id, disabled });
39144
+ return /* @__PURE__ */ jsx131(
39145
+ "div",
39146
+ {
39147
+ ref: setNodeRef,
39148
+ style: { transform: CSS2.Transform.toString(transform), transition },
39149
+ className: cn65(isDragging && "relative z-10 opacity-80"),
39150
+ "data-view-row": id,
39151
+ ...disabled ? {} : attributes,
39152
+ ...disabled ? {} : listeners2,
39153
+ children
39154
+ }
39155
+ );
39156
+ }
39062
39157
  function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews, initialViews, className }) {
39063
39158
  const client = useRecordsClient74();
39064
39159
  const claimSeed = useSeedGuard();
@@ -39090,6 +39185,26 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
39090
39185
  }
39091
39186
  });
39092
39187
  const [renamingSection, setRenamingSection] = useState109(null);
39188
+ const [dragging, setDragging] = useState109(false);
39189
+ const justDragged = useRef50(false);
39190
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 6 } }));
39191
+ async function dropped(event) {
39192
+ setDragging(false);
39193
+ justDragged.current = true;
39194
+ setTimeout(() => {
39195
+ justDragged.current = false;
39196
+ }, 250);
39197
+ if (!event.over || !views) return;
39198
+ const writes = planViewDrop(views, String(event.active.id), String(event.over.id));
39199
+ for (const w of writes) {
39200
+ const written = await saveViewPatch(client, tableId, w.id, { position: w.position, ..."section" in w ? { section: w.section ?? null } : {} });
39201
+ if (!written.ok) {
39202
+ setError(written.error);
39203
+ break;
39204
+ }
39205
+ }
39206
+ if (writes.length > 0) await load();
39207
+ }
39093
39208
  const toggleShut = (name) => {
39094
39209
  setShut((all) => {
39095
39210
  const next = all.includes(name) ? all.filter((n) => n !== name) : [...all, name];
@@ -39302,83 +39417,89 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
39302
39417
  ) }),
39303
39418
  /* @__PURE__ */ jsxs119(PopoverContent16, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
39304
39419
  /* @__PURE__ */ jsxs119("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
39305
- groupViewsBySection(views).map((group) => /* @__PURE__ */ jsxs119("div", { role: "group", "aria-label": group.name ?? "Views", "data-view-section": group.name ?? "", children: [
39306
- group.name !== null ? renamingSection?.from === group.name ? /* @__PURE__ */ jsxs119(
39307
- "form",
39308
- {
39309
- className: "flex items-center gap-1 px-1 py-1",
39310
- onSubmit: (e) => {
39311
- e.preventDefault();
39312
- void renameSection(group.name, renamingSection.draft);
39313
- },
39314
- children: [
39315
- /* @__PURE__ */ jsx131(
39316
- Input6,
39317
- {
39318
- autoFocus: true,
39319
- "aria-label": "New name for this section",
39320
- value: renamingSection.draft,
39321
- onChange: (e) => setRenamingSection({ from: group.name, draft: e.target.value }),
39322
- onKeyDown: (e) => {
39323
- if (e.key === "Escape") {
39324
- e.preventDefault();
39325
- e.stopPropagation();
39326
- setRenamingSection(null);
39327
- }
39328
- },
39329
- className: "h-7 min-w-0 flex-1 text-xs"
39330
- }
39331
- ),
39332
- /* @__PURE__ */ jsx131(Button80, { size: "sm", type: "submit", className: "h-7", children: "Save" })
39333
- ]
39334
- }
39335
- ) : /* @__PURE__ */ jsxs119("div", { className: "group flex min-h-7 items-center gap-1 px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: [
39336
- /* @__PURE__ */ jsxs119(
39420
+ /* @__PURE__ */ jsx131(DndContext, { sensors, collisionDetection: closestCenter, onDragStart: () => setDragging(true), onDragCancel: () => setDragging(false), onDragEnd: (e) => void dropped(e), children: (() => {
39421
+ const groups = groupViewsBySection(views);
39422
+ return groups.some((g) => g.name === null) || !dragging ? groups : [{ name: null, views: [] }, ...groups];
39423
+ })().map((group) => /* @__PURE__ */ jsxs119(SectionBox, { id: sectionDropId(group.name), role: "group", "aria-label": group.name ?? "Views", "data-view-section": group.name ?? "", children: [
39424
+ group.name === null && group.views.length === 0 ? /* @__PURE__ */ jsx131("span", { className: "block px-2 py-1.5 text-[11px] text-muted-foreground", children: "No section" }) : null,
39425
+ /* @__PURE__ */ jsxs119(SortableContext, { items: group.views.map((v) => v.id), strategy: verticalListSortingStrategy, children: [
39426
+ group.name !== null ? renamingSection?.from === group.name ? /* @__PURE__ */ jsxs119(
39427
+ "form",
39428
+ {
39429
+ className: "flex items-center gap-1 px-1 py-1",
39430
+ onSubmit: (e) => {
39431
+ e.preventDefault();
39432
+ void renameSection(group.name, renamingSection.draft);
39433
+ },
39434
+ children: [
39435
+ /* @__PURE__ */ jsx131(
39436
+ Input6,
39437
+ {
39438
+ autoFocus: true,
39439
+ "aria-label": "New name for this section",
39440
+ value: renamingSection.draft,
39441
+ onChange: (e) => setRenamingSection({ from: group.name, draft: e.target.value }),
39442
+ onKeyDown: (e) => {
39443
+ if (e.key === "Escape") {
39444
+ e.preventDefault();
39445
+ e.stopPropagation();
39446
+ setRenamingSection(null);
39447
+ }
39448
+ },
39449
+ className: "h-7 min-w-0 flex-1 text-xs"
39450
+ }
39451
+ ),
39452
+ /* @__PURE__ */ jsx131(Button80, { size: "sm", type: "submit", className: "h-7", children: "Save" })
39453
+ ]
39454
+ }
39455
+ ) : /* @__PURE__ */ jsxs119("div", { className: "group flex min-h-7 items-center gap-1 px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: [
39456
+ /* @__PURE__ */ jsxs119(
39457
+ "button",
39458
+ {
39459
+ type: "button",
39460
+ className: "flex min-w-0 flex-1 items-center gap-1 text-left",
39461
+ "aria-expanded": !shut.includes(group.name),
39462
+ "data-view-section-toggle": "",
39463
+ onClick: () => toggleShut(group.name),
39464
+ children: [
39465
+ /* @__PURE__ */ jsx131("svg", { viewBox: "0 0 24 24", className: cn65("h-3 w-3 shrink-0", shut.includes(group.name) && "-rotate-90"), fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx131("path", { d: "m6 9 6 6 6-6" }) }),
39466
+ /* @__PURE__ */ jsx131("span", { className: "truncate", children: group.name }),
39467
+ /* @__PURE__ */ jsx131("span", { className: "shrink-0 font-normal normal-case", children: group.views.length })
39468
+ ]
39469
+ }
39470
+ ),
39471
+ rights.admin ? /* @__PURE__ */ jsxs119(Fragment49, { children: [
39472
+ /* @__PURE__ */ jsx131("button", { type: "button", className: "shrink-0 normal-case hover:text-foreground", "data-view-section-rename": "", onClick: () => setRenamingSection({ from: group.name, draft: group.name }), children: "Rename" }),
39473
+ /* @__PURE__ */ jsx131("button", { type: "button", className: "shrink-0 normal-case hover:text-destructive", "data-view-section-delete": "", title: "The views stay; they leave the section", onClick: () => void renameSection(group.name, null), children: "Delete" })
39474
+ ] }) : null
39475
+ ] }) : null,
39476
+ group.name !== null && shut.includes(group.name) && !group.views.some((v) => v.id === active) ? null : group.views.map((view) => /* @__PURE__ */ jsx131(SortableRow, { id: view.id, disabled: !(rights.admin || view.personal) || view.presentation?.locked === true, children: /* @__PURE__ */ jsxs119(
39337
39477
  "button",
39338
39478
  {
39339
39479
  type: "button",
39340
- className: "flex min-w-0 flex-1 items-center gap-1 text-left",
39341
- "aria-expanded": !shut.includes(group.name),
39342
- "data-view-section-toggle": "",
39343
- onClick: () => toggleShut(group.name),
39480
+ "aria-pressed": view.id === active,
39481
+ className: cn65(
39482
+ "flex min-h-8 w-full items-center gap-2 rounded-sm px-2 text-left text-xs text-popover-foreground hover:bg-accent hover:text-accent-foreground",
39483
+ group.name !== null && "pl-4",
39484
+ view.id === active && "font-medium"
39485
+ ),
39486
+ onClick: () => {
39487
+ if (justDragged.current) return;
39488
+ setActive(view.id);
39489
+ onActiveView?.(view);
39490
+ setOpen(false);
39491
+ },
39492
+ title: view.ruleId ? "Membership is this view's Rule" : "The whole table",
39344
39493
  children: [
39345
- /* @__PURE__ */ jsx131("svg", { viewBox: "0 0 24 24", className: cn65("h-3 w-3 shrink-0", shut.includes(group.name) && "-rotate-90"), fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx131("path", { d: "m6 9 6 6 6-6" }) }),
39346
- /* @__PURE__ */ jsx131("span", { className: "truncate", children: group.name }),
39347
- /* @__PURE__ */ jsx131("span", { className: "shrink-0 font-normal normal-case", children: group.views.length })
39494
+ /* @__PURE__ */ jsx131("span", { className: "min-w-0 flex-1 truncate", children: view.name }),
39495
+ view.presentation?.locked === true ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-locked": "", title: VIEW_LOCKED_REASON, children: "Locked" }) : null,
39496
+ view.personal ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-personal": "", title: "Only you see this view", children: "Personal" }) : null,
39497
+ view.isDefault ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-default": "", children: "Default" }) : null
39348
39498
  ]
39349
39499
  }
39350
- ),
39351
- rights.admin ? /* @__PURE__ */ jsxs119(Fragment49, { children: [
39352
- /* @__PURE__ */ jsx131("button", { type: "button", className: "shrink-0 normal-case hover:text-foreground", "data-view-section-rename": "", onClick: () => setRenamingSection({ from: group.name, draft: group.name }), children: "Rename" }),
39353
- /* @__PURE__ */ jsx131("button", { type: "button", className: "shrink-0 normal-case hover:text-destructive", "data-view-section-delete": "", title: "The views stay; they leave the section", onClick: () => void renameSection(group.name, null), children: "Delete" })
39354
- ] }) : null
39355
- ] }) : null,
39356
- group.name !== null && shut.includes(group.name) && !group.views.some((v) => v.id === active) ? null : group.views.map((view) => /* @__PURE__ */ jsxs119(
39357
- "button",
39358
- {
39359
- type: "button",
39360
- "aria-pressed": view.id === active,
39361
- className: cn65(
39362
- "flex min-h-8 w-full items-center gap-2 rounded-sm px-2 text-left text-xs text-popover-foreground hover:bg-accent hover:text-accent-foreground",
39363
- group.name !== null && "pl-4",
39364
- view.id === active && "font-medium"
39365
- ),
39366
- onClick: () => {
39367
- setActive(view.id);
39368
- onActiveView?.(view);
39369
- setOpen(false);
39370
- },
39371
- title: view.ruleId ? "Membership is this view's Rule" : "The whole table",
39372
- children: [
39373
- /* @__PURE__ */ jsx131("span", { className: "min-w-0 flex-1 truncate", children: view.name }),
39374
- view.presentation?.locked === true ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-locked": "", title: VIEW_LOCKED_REASON, children: "Locked" }) : null,
39375
- view.personal ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-personal": "", title: "Only you see this view", children: "Personal" }) : null,
39376
- view.isDefault ? /* @__PURE__ */ jsx131(Badge15, { variant: "neutral", className: "shrink-0 px-1.5 py-0 text-[10px]", "data-view-default": "", children: "Default" }) : null
39377
- ]
39378
- },
39379
- view.id
39380
- ))
39381
- ] }, group.name ?? "__loose")),
39500
+ ) }, view.id))
39501
+ ] })
39502
+ ] }, group.name ?? "__loose")) }),
39382
39503
  views.length === 0 && !rights.admin ? /* @__PURE__ */ jsx131("span", { className: "px-2 py-1 text-xs text-muted-foreground", children: rights.why("structure") }) : null
39383
39504
  ] }),
39384
39505
  /* @__PURE__ */ jsx131("div", { className: "mt-1 border-t border-border pt-1", children: naming ? /* @__PURE__ */ jsxs119(
@@ -44678,9 +44799,9 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
44678
44799
  import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
44679
44800
  import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
44680
44801
  import { useCallback as useCallback56, useEffect as useEffect106, useMemo as useMemo73, useRef as useRef58, useState as useState127 } from "react";
44681
- import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
44682
- import { SortableContext, arrayMove, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
44683
- import { CSS as CSS2 } from "@dnd-kit/utilities";
44802
+ import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
44803
+ import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
44804
+ import { CSS as CSS3 } from "@dnd-kit/utilities";
44684
44805
  import { useFields as useFields28, useRecordsClient as useRecordsClient89, useTable as useTable30 } from "@ai-matrx/records/react";
44685
44806
  import { publicFormPath } from "@ai-matrx/records";
44686
44807
  import {
@@ -46337,9 +46458,9 @@ function QuestionList({
46337
46458
  onQuestions,
46338
46459
  onQuestion
46339
46460
  }) {
46340
- const sensors = useSensors(
46341
- useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
46342
- useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
46461
+ const sensors = useSensors2(
46462
+ useSensor2(PointerSensor2, { activationConstraint: { distance: 4 } }),
46463
+ useSensor2(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
46343
46464
  );
46344
46465
  const askable = askableFields([...fields]);
46345
46466
  const unasked = askable.filter((f) => !draft.questions.some((q) => q.field === f.key));
@@ -46361,7 +46482,7 @@ function QuestionList({
46361
46482
  /* @__PURE__ */ jsx151("span", { className: "font-medium text-foreground", children: "Questions" }),
46362
46483
  /* @__PURE__ */ jsx151("span", { className: "tabular-nums", children: draft.questions.length })
46363
46484
  ] }),
46364
- /* @__PURE__ */ jsx151(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: dragEnd, children: /* @__PURE__ */ jsx151(SortableContext, { items: draft.questions.map((q) => q.field), strategy: verticalListSortingStrategy, children: draft.questions.map((question, index) => /* @__PURE__ */ jsx151(
46485
+ /* @__PURE__ */ jsx151(DndContext2, { sensors, collisionDetection: closestCenter2, onDragEnd: dragEnd, children: /* @__PURE__ */ jsx151(SortableContext2, { items: draft.questions.map((q) => q.field), strategy: verticalListSortingStrategy2, children: draft.questions.map((question, index) => /* @__PURE__ */ jsx151(
46365
46486
  QuestionRow,
46366
46487
  {
46367
46488
  index,
@@ -46414,14 +46535,14 @@ function QuestionRow({
46414
46535
  onChange,
46415
46536
  onRemove
46416
46537
  }) {
46417
- const sortable = useSortable({ id: question.field });
46538
+ const sortable = useSortable2({ id: question.field });
46418
46539
  const [open, setOpen] = useState127(true);
46419
46540
  const name = field2 ? fieldName(field2) : question.field;
46420
46541
  return /* @__PURE__ */ jsxs139(
46421
46542
  "div",
46422
46543
  {
46423
46544
  ref: sortable.setNodeRef,
46424
- style: { transform: CSS2.Transform.toString(sortable.transform), transition: sortable.transition },
46545
+ style: { transform: CSS3.Transform.toString(sortable.transform), transition: sortable.transition },
46425
46546
  className: cn84("rounded border bg-background px-2 py-1.5", sortable.isDragging && "z-10 shadow-md"),
46426
46547
  "data-records-form-question-row": question.field,
46427
46548
  children: [
@@ -47371,20 +47492,20 @@ import {
47371
47492
 
47372
47493
  // src/DashboardGrid.tsx
47373
47494
  import {
47374
- DndContext as DndContext2,
47495
+ DndContext as DndContext3,
47375
47496
  KeyboardSensor as KeyboardSensor2,
47376
- PointerSensor as PointerSensor2,
47497
+ PointerSensor as PointerSensor3,
47377
47498
  pointerWithin,
47378
- useSensor as useSensor2,
47379
- useSensors as useSensors2
47499
+ useSensor as useSensor3,
47500
+ useSensors as useSensors3
47380
47501
  } from "@dnd-kit/core";
47381
47502
  import {
47382
- SortableContext as SortableContext2,
47503
+ SortableContext as SortableContext3,
47383
47504
  rectSortingStrategy,
47384
47505
  sortableKeyboardCoordinates as sortableKeyboardCoordinates2,
47385
- useSortable as useSortable2
47506
+ useSortable as useSortable3
47386
47507
  } from "@dnd-kit/sortable";
47387
- import { CSS as CSS3 } from "@dnd-kit/utilities";
47508
+ import { CSS as CSS4 } from "@dnd-kit/utilities";
47388
47509
  import { cn as cn89 } from "@ai-matrx/design-system";
47389
47510
 
47390
47511
  // src/dashboardLayout.ts
@@ -47448,9 +47569,9 @@ var dashboardCollision = (args) => {
47448
47569
  }).sort((a, b) => a.data.value - b.data.value);
47449
47570
  };
47450
47571
  function DashboardGrid({ items, arranging, onMove, onSpan }) {
47451
- const sensors = useSensors2(
47452
- useSensor2(PointerSensor2, { activationConstraint: { distance: 4 } }),
47453
- useSensor2(KeyboardSensor2, { coordinateGetter: sortableKeyboardCoordinates2 })
47572
+ const sensors = useSensors3(
47573
+ useSensor3(PointerSensor3, { activationConstraint: { distance: 4 } }),
47574
+ useSensor3(KeyboardSensor2, { coordinateGetter: sortableKeyboardCoordinates2 })
47454
47575
  );
47455
47576
  const ids = items.map((item) => item.id);
47456
47577
  function dragEnd(event) {
@@ -47460,7 +47581,7 @@ function DashboardGrid({ items, arranging, onMove, onSpan }) {
47460
47581
  }
47461
47582
  const grid = /* @__PURE__ */ jsx156("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-12", children: items.map((item, index) => /* @__PURE__ */ jsx156(GridCell2, { item, index, arranging, onSpan }, item.id)) });
47462
47583
  if (!arranging) return grid;
47463
- return /* @__PURE__ */ jsx156(DndContext2, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ jsx156(SortableContext2, { items: ids, strategy: rectSortingStrategy, children: grid }) });
47584
+ return /* @__PURE__ */ jsx156(DndContext3, { sensors, collisionDetection: dashboardCollision, onDragEnd: dragEnd, children: /* @__PURE__ */ jsx156(SortableContext3, { items: ids, strategy: rectSortingStrategy, children: grid }) });
47464
47585
  }
47465
47586
  function GridCell2({
47466
47587
  item,
@@ -47468,8 +47589,8 @@ function GridCell2({
47468
47589
  arranging,
47469
47590
  onSpan
47470
47591
  }) {
47471
- const sortable = useSortable2({ id: item.id, disabled: !arranging });
47472
- const style = arranging ? { transform: CSS3.Transform.toString(sortable.transform), transition: sortable.transition } : void 0;
47592
+ const sortable = useSortable3({ id: item.id, disabled: !arranging });
47593
+ const style = arranging ? { transform: CSS4.Transform.toString(sortable.transform), transition: sortable.transition } : void 0;
47473
47594
  return /* @__PURE__ */ jsxs144(
47474
47595
  "div",
47475
47596
  {