@ai-matrx/design-system 0.20.1 → 0.20.5

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.
@@ -2876,9 +2876,14 @@ function PaletteGlyph({ format, ai = false, file = false, kind }) {
2876
2876
  /* @__PURE__ */ jsx24("path", { d: "M6 3h8l4 4v14H6z" }),
2877
2877
  /* @__PURE__ */ jsx24("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
2878
2878
  ] });
2879
- const path2 = format === "json" ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
2879
+ const path2 = format === "json" || format === "table-data" ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
2880
2880
  /* @__PURE__ */ jsx24("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
2881
2881
  /* @__PURE__ */ jsx24("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
2882
+ ] }) : format === "table-schema" ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
2883
+ /* @__PURE__ */ jsx24("rect", { x: "8", y: "3", width: "8", height: "5", rx: "1" }),
2884
+ /* @__PURE__ */ jsx24("rect", { x: "2", y: "16", width: "8", height: "5", rx: "1" }),
2885
+ /* @__PURE__ */ jsx24("rect", { x: "14", y: "16", width: "8", height: "5", rx: "1" }),
2886
+ /* @__PURE__ */ jsx24("path", { d: "M12 8v4M6 16v-4h12v4" })
2882
2887
  ] }) : format === "compact-json" ? /* @__PURE__ */ jsxs16(Fragment2, { children: [
2883
2888
  /* @__PURE__ */ jsx24("path", { d: "m14 10 7-7" }),
2884
2889
  /* @__PURE__ */ jsx24("path", { d: "M20 10h-6V4" }),
@@ -3337,7 +3342,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3337
3342
  closePalette();
3338
3343
  onClick();
3339
3344
  }, children: [
3340
- Icon3 ? /* @__PURE__ */ jsx24(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx24(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
3345
+ Icon3 ? /* @__PURE__ */ jsx24(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx24(PaletteGlyph, { format: id, ai: Boolean(options.ai), file: options.file || Boolean(options.custom && id !== "table-data" && id !== "table-schema") }),
3341
3346
  /* @__PURE__ */ jsxs16("span", { children: [
3342
3347
  label2,
3343
3348
  presentation?.hint ? /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
@@ -6866,6 +6871,17 @@ function tokenFromColumnName(name) {
6866
6871
  return name.endsWith("_id") ? name.slice(0, -3) : null;
6867
6872
  }
6868
6873
 
6874
+ // src/data-table/display-value.ts
6875
+ function formatTableDisplayValue(value) {
6876
+ if (typeof value === "number") return value.toLocaleString(void 0, { maximumFractionDigits: 12 });
6877
+ if (value instanceof Date) return value.toLocaleString();
6878
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(value) && !Number.isNaN(Date.parse(value))) {
6879
+ return new Date(value).toLocaleString();
6880
+ }
6881
+ if (typeof value === "boolean") return value ? "Yes" : "No";
6882
+ return stringifyCellValue(value) || "\u2014";
6883
+ }
6884
+
6869
6885
  // src/data-table/DataRowInspector.tsx
6870
6886
  import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
6871
6887
  var noFieldToken = () => null;
@@ -6938,7 +6954,7 @@ function DataRowInspector({
6938
6954
  key
6939
6955
  );
6940
6956
  }
6941
- const formatted = formatValue(value);
6957
+ const formatted = value !== null && typeof value === "object" && !(value instanceof Date) ? formatValue(value) : formatTableDisplayValue(value);
6942
6958
  const multiline = formatted.includes("\n") || formatted.length > 80;
6943
6959
  return /* @__PURE__ */ jsxs23(
6944
6960
  "div",
@@ -7067,6 +7083,22 @@ function TabButton({
7067
7083
  );
7068
7084
  }
7069
7085
 
7086
+ // src/data-table/row-title.ts
7087
+ function defaultRowTitle(row, columns) {
7088
+ const values = columns.map((column) => ({
7089
+ id: columnId(column),
7090
+ value: getCellValue(row, column)
7091
+ })).filter(
7092
+ (entry) => typeof entry.value === "string" && entry.value.trim().length > 0
7093
+ );
7094
+ const named = values.find(
7095
+ ({ id, value: value2 }) => inferTableSearchRole(id) === "name" && !isUuidValue(value2)
7096
+ );
7097
+ const identity = values.find(({ id }) => id === "id" || id === "uuid") ?? values.find(({ id }) => inferTableSearchRole(id) === "id");
7098
+ const value = (named ?? identity ?? values[0])?.value.trim();
7099
+ return value ? isUuidValue(value) ? value.slice(0, 8) : value : "Details";
7100
+ }
7101
+
7070
7102
  // src/data-table/DirtySavePill.tsx
7071
7103
  import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
7072
7104
  function DirtySavePill({
@@ -8560,25 +8592,6 @@ function MatrxDataTableCore({
8560
8592
  ...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
8561
8593
  });
8562
8594
  const rootRef = useRef10(null);
8563
- const setDiagnosticBoundaryRef = useCallback6((node) => {
8564
- rootRef.current = node;
8565
- if (!node) return;
8566
- node.style.setProperty("outline", "2px solid #2563eb", "important");
8567
- node.style.setProperty("outline-offset", "-2px", "important");
8568
- node.style.setProperty("isolation", "isolate", "important");
8569
- const position = window.getComputedStyle(node).position;
8570
- if (position === "" || position === "static") {
8571
- node.style.setProperty("position", "relative", "important");
8572
- }
8573
- const boundary = node.querySelector(":scope > [data-matrx-table-boundary]");
8574
- if (!boundary) return;
8575
- boundary.style.setProperty("position", "absolute", "important");
8576
- boundary.style.setProperty("inset", "0", "important");
8577
- boundary.style.setProperty("pointer-events", "none", "important");
8578
- boundary.style.setProperty("z-index", "2147483647", "important");
8579
- boundary.style.setProperty("box-sizing", "border-box", "important");
8580
- boundary.style.setProperty("border", "2px solid #2563eb", "important");
8581
- }, []);
8582
8595
  useClippedContentGuard(rootRef, {
8583
8596
  label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
8584
8597
  });
@@ -9619,7 +9632,7 @@ function MatrxDataTableCore({
9619
9632
  /* @__PURE__ */ jsxs29(
9620
9633
  "div",
9621
9634
  {
9622
- ref: setDiagnosticBoundaryRef,
9635
+ ref: rootRef,
9623
9636
  "data-matrx-table": true,
9624
9637
  "data-matrx-table-density": resolvedDensity,
9625
9638
  "data-url-state-table": urlState?.id,
@@ -9628,7 +9641,6 @@ function MatrxDataTableCore({
9628
9641
  className
9629
9642
  ),
9630
9643
  children: [
9631
- /* @__PURE__ */ jsx39("span", { "aria-hidden": "true", "data-matrx-table-boundary": true }),
9632
9644
  notice,
9633
9645
  savedViewError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
9634
9646
  toolbarActionError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
@@ -10707,7 +10719,7 @@ function MatrxDataTableCore({
10707
10719
  {
10708
10720
  title: resolveStringTitle(
10709
10721
  detail?.title?.(selectedRow),
10710
- defaultRowTitle(selectedRow, visibleColumns)
10722
+ defaultRowTitle(selectedRow, columns)
10711
10723
  ),
10712
10724
  titleNode: detail?.title?.(selectedRow),
10713
10725
  description: detail?.description?.(selectedRow),
@@ -10774,7 +10786,7 @@ function MatrxDataTableCore({
10774
10786
  {
10775
10787
  isOpen: true,
10776
10788
  onClose: closeWindow,
10777
- title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow, visibleColumns),
10789
+ title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow, columns),
10778
10790
  row: windowRow,
10779
10791
  width: windowConfig?.width,
10780
10792
  height: windowConfig?.height,
@@ -11106,7 +11118,8 @@ function normalizeColumnWidthsForColumns(widths, columns) {
11106
11118
  }
11107
11119
  function columnWidthVar(width, resizedWidth, id, resizable) {
11108
11120
  if (width === void 0 && resizedWidth === void 0 && !resizable) return void 0;
11109
- const fallback = resizedWidth === void 0 ? width === void 0 ? "auto" : typeof width === "number" ? `${width}px` : width : `${resizedWidth}px`;
11121
+ const inferredWidth = resizable && inferTableSearchRole(id) === "name" ? "12rem" : "auto";
11122
+ const fallback = resizedWidth === void 0 ? width === void 0 ? inferredWidth : typeof width === "number" ? `${width}px` : width : `${resizedWidth}px`;
11110
11123
  return {
11111
11124
  "--matrx-col-w": resizable ? `var(${columnResizeCssVar(id)}, ${fallback})` : fallback
11112
11125
  };
@@ -11156,19 +11169,12 @@ function renderCell(row, col, index) {
11156
11169
  if (typeof raw === "boolean") {
11157
11170
  return /* @__PURE__ */ jsx39("span", { className: raw ? "rounded bg-emerald-500/10 px-1.5 py-0.5 text-xs text-emerald-600" : "rounded bg-slate-500/10 px-1.5 py-0.5 text-xs text-muted-foreground", children: raw ? "Yes" : "No" });
11158
11171
  }
11159
- const formatted = typeof raw === "number" ? raw.toLocaleString(void 0, { maximumFractionDigits: 12 }) : raw instanceof Date ? raw.toLocaleString() : typeof raw === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(raw) && !Number.isNaN(Date.parse(raw)) ? new Date(raw).toLocaleString() : stringifyCellValue(raw) || "\u2014";
11172
+ const formatted = formatTableDisplayValue(raw);
11160
11173
  return /* @__PURE__ */ jsxs29(Tooltip, { children: [
11161
11174
  /* @__PURE__ */ jsx39(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx39("span", { className: "block text-sm text-foreground", style: { display: "-webkit-box", WebkitLineClamp: 2, WebkitBoxOrient: "vertical", overflow: "hidden", overflowWrap: "anywhere" }, children: formatted }) }),
11162
11175
  /* @__PURE__ */ jsx39(TooltipContent, { className: "max-w-md whitespace-pre-wrap break-words max-h-80 overflow-auto", children: typeof raw === "object" && raw !== null ? JSON.stringify(raw, null, 2) : formatted })
11163
11176
  ] });
11164
11177
  }
11165
- function defaultRowTitle(row, columns) {
11166
- for (const col of columns) {
11167
- const v = getCellValue(row, col);
11168
- if (typeof v === "string" && v.trim()) return v;
11169
- }
11170
- return "Details";
11171
- }
11172
11178
  function resolveStringTitle(title, fallback) {
11173
11179
  if (typeof title === "string" && title.trim()) return title;
11174
11180
  if (typeof title === "number") return String(title);