@ai-matrx/design-system 0.20.2 → 0.20.6

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.
@@ -2825,7 +2825,7 @@ var useContentTransferCapabilities = () => React14.useContext(CapabilityContext)
2825
2825
  var SurfaceContext = React14.createContext(null);
2826
2826
  function MenuPresentation({ label, hint, icon: Icon3 }) {
2827
2827
  return /* @__PURE__ */ jsxs16(Fragment2, { children: [
2828
- Icon3 ? /* @__PURE__ */ jsx24(Icon3, { className: "matrx-alchemy-menu-icon" }) : null,
2828
+ Icon3 ? /* @__PURE__ */ jsx24(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx24(PaletteGlyph, { file: true }),
2829
2829
  /* @__PURE__ */ jsxs16("span", { children: [
2830
2830
  label,
2831
2831
  hint ? /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
@@ -2847,8 +2847,11 @@ function DestinationPresentation({ action }) {
2847
2847
  };
2848
2848
  const path2 = paths[action.id.replace(/^matrx:/, "")];
2849
2849
  return /* @__PURE__ */ jsxs16(Fragment2, { children: [
2850
- !action.icon ? path2 ? /* @__PURE__ */ jsx24("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: path2 }) }) : /* @__PURE__ */ jsx24(PaletteGlyph, { file: true }) : null,
2851
- /* @__PURE__ */ jsx24(MenuPresentation, { ...action })
2850
+ action.icon ? /* @__PURE__ */ jsx24(action.icon, { className: "matrx-alchemy-menu-icon" }) : path2 ? /* @__PURE__ */ jsx24("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: path2 }) }) : /* @__PURE__ */ jsx24(PaletteGlyph, { file: true }),
2851
+ /* @__PURE__ */ jsxs16("span", { children: [
2852
+ action.label,
2853
+ action.hint ? /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: action.hint }) : null
2854
+ ] })
2852
2855
  ] });
2853
2856
  }
2854
2857
  function ReceiptLink({ target }) {
@@ -2858,6 +2861,11 @@ function ReceiptLink({ target }) {
2858
2861
  ] }) : null;
2859
2862
  }
2860
2863
  function PaletteGlyph({ format, ai = false, file = false, kind }) {
2864
+ if (kind === "link") return /* @__PURE__ */ jsx24("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: "M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-2 2M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l2-2" }) });
2865
+ if (kind === "surface") return /* @__PURE__ */ jsxs16("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
2866
+ /* @__PURE__ */ jsx24("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2867
+ /* @__PURE__ */ jsx24("path", { d: "M3 9h18M9 9v12" })
2868
+ ] });
2861
2869
  if (kind === "ai-copy") return /* @__PURE__ */ jsxs16("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
2862
2870
  /* @__PURE__ */ jsx24("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
2863
2871
  /* @__PURE__ */ jsx24("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
@@ -3338,7 +3346,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3338
3346
  const presentation = options.action;
3339
3347
  const Icon3 = presentation?.icon;
3340
3348
  const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
3341
- return /* @__PURE__ */ jsxs16("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
3349
+ return /* @__PURE__ */ jsxs16("button", { type: "button", className: "matrx-alchemy-palette-tile", title: id === "table-data" ? "JSON using column display names" : id === "table-schema" ? "Table schema and rows" : label2, "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
3342
3350
  closePalette();
3343
3351
  onClick();
3344
3352
  }, children: [
@@ -3400,7 +3408,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3400
3408
  /* @__PURE__ */ jsx24(PaletteGlyph, { kind: "ai-copy" }),
3401
3409
  /* @__PURE__ */ jsxs16("span", { children: [
3402
3410
  "Copy with AI context",
3403
- /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
3411
+ /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
3404
3412
  ] })
3405
3413
  ] }) : null, items: quickVariants("ai"), onRun: (variant) => {
3406
3414
  closePalette();
@@ -3413,32 +3421,44 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3413
3421
  /* @__PURE__ */ jsx24(PaletteGlyph, { kind: "sliders" }),
3414
3422
  /* @__PURE__ */ jsxs16("span", { children: [
3415
3423
  "Prepare for AI",
3416
- /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
3424
+ /* @__PURE__ */ jsx24("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
3417
3425
  ] })
3418
3426
  ] }) })
3419
3427
  ] }) : null,
3420
3428
  prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx24(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs16(Fragment2, { children: [
3421
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx24("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
3429
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsxs16("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
3422
3430
  closePalette();
3423
3431
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
3424
- }, children: /* @__PURE__ */ jsx24("span", { children: "Prepare this surface" }) }) : null,
3432
+ }, children: [
3433
+ /* @__PURE__ */ jsx24(PaletteGlyph, { kind: "surface" }),
3434
+ /* @__PURE__ */ jsx24("span", { children: "Prepare this page" })
3435
+ ] }) : null,
3425
3436
  variants.map((variant) => /* @__PURE__ */ jsx24("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
3426
3437
  closePalette();
3427
3438
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
3428
3439
  }, children: /* @__PURE__ */ jsx24(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
3429
3440
  ] }) }) : null,
3430
3441
  references.length || referenceActions.length ? /* @__PURE__ */ jsxs16("section", { className: "matrx-alchemy-palette-section", children: [
3431
- /* @__PURE__ */ jsx24("h3", { children: "Live references" }),
3432
- /* @__PURE__ */ jsx24("p", { className: "matrx-alchemy-menu-hint", children: "Pointers to saved data, independent of filters and edits." }),
3433
- references.map((reference) => /* @__PURE__ */ jsx24("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void copyReference(reference), children: /* @__PURE__ */ jsx24("span", { children: reference.label }) }, reference.id)),
3434
- referenceActions.map((action) => /* @__PURE__ */ jsx24("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: /* @__PURE__ */ jsx24("span", { children: action.label }) }, action.id))
3442
+ /* @__PURE__ */ jsx24("h3", { children: "References" }),
3443
+ referenceActions.map((action) => /* @__PURE__ */ jsxs16("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
3444
+ /* @__PURE__ */ jsx24(PaletteGlyph, { kind: "link" }),
3445
+ /* @__PURE__ */ jsx24("span", { children: action.label }),
3446
+ /* @__PURE__ */ jsx24("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: "m6 4 4 4-4 4" }) })
3447
+ ] }, action.id)),
3448
+ references.map((reference) => /* @__PURE__ */ jsxs16("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
3449
+ /* @__PURE__ */ jsx24(PaletteGlyph, { kind: "link" }),
3450
+ /* @__PURE__ */ jsx24("span", { children: reference.label })
3451
+ ] }, reference.id))
3435
3452
  ] }) : null,
3436
3453
  ["save", "chat", "email", "other"].map((group) => {
3437
3454
  const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
3438
3455
  return entries.length ? /* @__PURE__ */ jsxs16("details", { className: "matrx-alchemy-palette-destinations", children: [
3439
3456
  /* @__PURE__ */ jsxs16("summary", { children: [
3440
3457
  group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
3441
- /* @__PURE__ */ jsx24("span", { children: entries.length })
3458
+ /* @__PURE__ */ jsxs16("span", { className: "matrx-alchemy-disclosure-meta", children: [
3459
+ /* @__PURE__ */ jsx24("span", { children: entries.length }),
3460
+ /* @__PURE__ */ jsx24("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: "m6 4 4 4-4 4" }) })
3461
+ ] })
3442
3462
  ] }),
3443
3463
  /* @__PURE__ */ jsx24("div", { children: entries.map((action) => /* @__PURE__ */ jsx24("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
3444
3464
  closePalette();
@@ -6871,6 +6891,17 @@ function tokenFromColumnName(name) {
6871
6891
  return name.endsWith("_id") ? name.slice(0, -3) : null;
6872
6892
  }
6873
6893
 
6894
+ // src/data-table/display-value.ts
6895
+ function formatTableDisplayValue(value) {
6896
+ if (typeof value === "number") return value.toLocaleString(void 0, { maximumFractionDigits: 12 });
6897
+ if (value instanceof Date) return value.toLocaleString();
6898
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(value) && !Number.isNaN(Date.parse(value))) {
6899
+ return new Date(value).toLocaleString();
6900
+ }
6901
+ if (typeof value === "boolean") return value ? "Yes" : "No";
6902
+ return stringifyCellValue(value) || "\u2014";
6903
+ }
6904
+
6874
6905
  // src/data-table/DataRowInspector.tsx
6875
6906
  import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
6876
6907
  var noFieldToken = () => null;
@@ -6943,7 +6974,7 @@ function DataRowInspector({
6943
6974
  key
6944
6975
  );
6945
6976
  }
6946
- const formatted = formatValue(value);
6977
+ const formatted = value !== null && typeof value === "object" && !(value instanceof Date) ? formatValue(value) : formatTableDisplayValue(value);
6947
6978
  const multiline = formatted.includes("\n") || formatted.length > 80;
6948
6979
  return /* @__PURE__ */ jsxs23(
6949
6980
  "div",
@@ -7072,6 +7103,22 @@ function TabButton({
7072
7103
  );
7073
7104
  }
7074
7105
 
7106
+ // src/data-table/row-title.ts
7107
+ function defaultRowTitle(row, columns) {
7108
+ const values = columns.map((column) => ({
7109
+ id: columnId(column),
7110
+ value: getCellValue(row, column)
7111
+ })).filter(
7112
+ (entry) => typeof entry.value === "string" && entry.value.trim().length > 0
7113
+ );
7114
+ const named = values.find(
7115
+ ({ id, value: value2 }) => inferTableSearchRole(id) === "name" && !isUuidValue(value2)
7116
+ );
7117
+ const identity = values.find(({ id }) => id === "id" || id === "uuid") ?? values.find(({ id }) => inferTableSearchRole(id) === "id");
7118
+ const value = (named ?? identity ?? values[0])?.value.trim();
7119
+ return value ? isUuidValue(value) ? value.slice(0, 8) : value : "Details";
7120
+ }
7121
+
7075
7122
  // src/data-table/DirtySavePill.tsx
7076
7123
  import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
7077
7124
  function DirtySavePill({
@@ -8565,25 +8612,6 @@ function MatrxDataTableCore({
8565
8612
  ...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
8566
8613
  });
8567
8614
  const rootRef = useRef10(null);
8568
- const setDiagnosticBoundaryRef = useCallback6((node) => {
8569
- rootRef.current = node;
8570
- if (!node) return;
8571
- node.style.setProperty("outline", "2px solid #2563eb", "important");
8572
- node.style.setProperty("outline-offset", "-2px", "important");
8573
- node.style.setProperty("isolation", "isolate", "important");
8574
- const position = window.getComputedStyle(node).position;
8575
- if (position === "" || position === "static") {
8576
- node.style.setProperty("position", "relative", "important");
8577
- }
8578
- const boundary = node.querySelector(":scope > [data-matrx-table-boundary]");
8579
- if (!boundary) return;
8580
- boundary.style.setProperty("position", "absolute", "important");
8581
- boundary.style.setProperty("inset", "0", "important");
8582
- boundary.style.setProperty("pointer-events", "none", "important");
8583
- boundary.style.setProperty("z-index", "2147483647", "important");
8584
- boundary.style.setProperty("box-sizing", "border-box", "important");
8585
- boundary.style.setProperty("border", "2px solid #2563eb", "important");
8586
- }, []);
8587
8615
  useClippedContentGuard(rootRef, {
8588
8616
  label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
8589
8617
  });
@@ -9624,7 +9652,7 @@ function MatrxDataTableCore({
9624
9652
  /* @__PURE__ */ jsxs29(
9625
9653
  "div",
9626
9654
  {
9627
- ref: setDiagnosticBoundaryRef,
9655
+ ref: rootRef,
9628
9656
  "data-matrx-table": true,
9629
9657
  "data-matrx-table-density": resolvedDensity,
9630
9658
  "data-url-state-table": urlState?.id,
@@ -9633,7 +9661,6 @@ function MatrxDataTableCore({
9633
9661
  className
9634
9662
  ),
9635
9663
  children: [
9636
- /* @__PURE__ */ jsx39("span", { "aria-hidden": "true", "data-matrx-table-boundary": true }),
9637
9664
  notice,
9638
9665
  savedViewError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
9639
9666
  toolbarActionError ? /* @__PURE__ */ jsx39("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
@@ -10712,7 +10739,7 @@ function MatrxDataTableCore({
10712
10739
  {
10713
10740
  title: resolveStringTitle(
10714
10741
  detail?.title?.(selectedRow),
10715
- defaultRowTitle(selectedRow, visibleColumns)
10742
+ defaultRowTitle(selectedRow, columns)
10716
10743
  ),
10717
10744
  titleNode: detail?.title?.(selectedRow),
10718
10745
  description: detail?.description?.(selectedRow),
@@ -10779,7 +10806,7 @@ function MatrxDataTableCore({
10779
10806
  {
10780
10807
  isOpen: true,
10781
10808
  onClose: closeWindow,
10782
- title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow, visibleColumns),
10809
+ title: windowConfig?.title?.(windowRow) ?? defaultRowTitle(windowRow, columns),
10783
10810
  row: windowRow,
10784
10811
  width: windowConfig?.width,
10785
10812
  height: windowConfig?.height,
@@ -11111,7 +11138,8 @@ function normalizeColumnWidthsForColumns(widths, columns) {
11111
11138
  }
11112
11139
  function columnWidthVar(width, resizedWidth, id, resizable) {
11113
11140
  if (width === void 0 && resizedWidth === void 0 && !resizable) return void 0;
11114
- const fallback = resizedWidth === void 0 ? width === void 0 ? "auto" : typeof width === "number" ? `${width}px` : width : `${resizedWidth}px`;
11141
+ const inferredWidth = resizable && inferTableSearchRole(id) === "name" ? "12rem" : "auto";
11142
+ const fallback = resizedWidth === void 0 ? width === void 0 ? inferredWidth : typeof width === "number" ? `${width}px` : width : `${resizedWidth}px`;
11115
11143
  return {
11116
11144
  "--matrx-col-w": resizable ? `var(${columnResizeCssVar(id)}, ${fallback})` : fallback
11117
11145
  };
@@ -11161,19 +11189,12 @@ function renderCell(row, col, index) {
11161
11189
  if (typeof raw === "boolean") {
11162
11190
  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" });
11163
11191
  }
11164
- 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";
11192
+ const formatted = formatTableDisplayValue(raw);
11165
11193
  return /* @__PURE__ */ jsxs29(Tooltip, { children: [
11166
11194
  /* @__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 }) }),
11167
11195
  /* @__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 })
11168
11196
  ] });
11169
11197
  }
11170
- function defaultRowTitle(row, columns) {
11171
- for (const col of columns) {
11172
- const v = getCellValue(row, col);
11173
- if (typeof v === "string" && v.trim()) return v;
11174
- }
11175
- return "Details";
11176
- }
11177
11198
  function resolveStringTitle(title, fallback) {
11178
11199
  if (typeof title === "string" && title.trim()) return title;
11179
11200
  if (typeof title === "number") return String(title);