@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.
@@ -1145,7 +1145,7 @@ var useContentTransferCapabilities = () => React9.useContext(CapabilityContext);
1145
1145
  var SurfaceContext = React9.createContext(null);
1146
1146
  function MenuPresentation({ label, hint, icon: Icon2 }) {
1147
1147
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1148
- Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : null,
1148
+ Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { file: true }),
1149
1149
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1150
1150
  label,
1151
1151
  hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
@@ -1167,8 +1167,11 @@ function DestinationPresentation({ action }) {
1167
1167
  };
1168
1168
  const path = paths[action.id.replace(/^matrx:/, "")];
1169
1169
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1170
- !action.icon ? path ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("path", { d: path }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { file: true }) : null,
1171
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...action })
1170
+ action.icon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(action.icon, { className: "matrx-alchemy-menu-icon" }) : path ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("path", { d: path }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { file: true }),
1171
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1172
+ action.label,
1173
+ action.hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: action.hint }) : null
1174
+ ] })
1172
1175
  ] });
1173
1176
  }
1174
1177
  function ReceiptLink({ target }) {
@@ -1178,6 +1181,11 @@ function ReceiptLink({ target }) {
1178
1181
  ] }) : null;
1179
1182
  }
1180
1183
  function PaletteGlyph({ format, ai = false, file = false, kind }) {
1184
+ if (kind === "link") return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsx)("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" }) });
1185
+ if (kind === "surface") return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("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: [
1186
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M3 9h18M9 9v12" })
1188
+ ] });
1181
1189
  if (kind === "ai-copy") return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("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: [
1182
1190
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
1183
1191
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
@@ -1658,7 +1666,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1658
1666
  const presentation = options.action;
1659
1667
  const Icon2 = presentation?.icon;
1660
1668
  const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
1661
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
1669
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("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: () => {
1662
1670
  closePalette();
1663
1671
  onClick();
1664
1672
  }, children: [
@@ -1720,7 +1728,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1720
1728
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "ai-copy" }),
1721
1729
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1722
1730
  "Copy with AI context",
1723
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
1731
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
1724
1732
  ] })
1725
1733
  ] }) : null, items: quickVariants("ai"), onRun: (variant) => {
1726
1734
  closePalette();
@@ -1733,32 +1741,44 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1733
1741
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "sliders" }),
1734
1742
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1735
1743
  "Prepare for AI",
1736
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
1744
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
1737
1745
  ] })
1738
1746
  ] }) })
1739
1747
  ] }) : null,
1740
1748
  prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1741
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1749
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1742
1750
  closePalette();
1743
1751
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
1744
- }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Prepare this surface" }) }) : null,
1752
+ }, children: [
1753
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "surface" }),
1754
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Prepare this page" })
1755
+ ] }) : null,
1745
1756
  variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1746
1757
  closePalette();
1747
1758
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
1748
1759
  }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
1749
1760
  ] }) }) : null,
1750
1761
  references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
1751
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: "Live references" }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-menu-hint", children: "Pointers to saved data, independent of filters and edits." }),
1753
- references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void copyReference(reference), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: reference.label }) }, reference.id)),
1754
- referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: action.label }) }, action.id))
1762
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: "References" }),
1763
+ referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
1764
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "link" }),
1765
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: action.label }),
1766
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m6 4 4 4-4 4" }) })
1767
+ ] }, action.id)),
1768
+ references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
1769
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "link" }),
1770
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: reference.label })
1771
+ ] }, reference.id))
1755
1772
  ] }) : null,
1756
1773
  ["save", "chat", "email", "other"].map((group) => {
1757
1774
  const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
1758
1775
  return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
1759
1776
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
1760
1777
  group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
1761
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: entries.length })
1778
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
1779
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: entries.length }),
1780
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m6 4 4 4-4 4" }) })
1781
+ ] })
1762
1782
  ] }),
1763
1783
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1764
1784
  closePalette();
@@ -3155,6 +3175,32 @@ function isUuidValue(value) {
3155
3175
  return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
3156
3176
  }
3157
3177
 
3178
+ // src/data-table/filter-engine.ts
3179
+ function stringifyCellValue(value) {
3180
+ if (value == null) return "";
3181
+ if (typeof value === "string") return value;
3182
+ if (typeof value === "number" || typeof value === "boolean") {
3183
+ return String(value);
3184
+ }
3185
+ if (value instanceof Date) return value.toISOString();
3186
+ try {
3187
+ return JSON.stringify(value);
3188
+ } catch {
3189
+ return String(value);
3190
+ }
3191
+ }
3192
+
3193
+ // src/data-table/display-value.ts
3194
+ function formatTableDisplayValue(value) {
3195
+ if (typeof value === "number") return value.toLocaleString(void 0, { maximumFractionDigits: 12 });
3196
+ if (value instanceof Date) return value.toLocaleString();
3197
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(value) && !Number.isNaN(Date.parse(value))) {
3198
+ return new Date(value).toLocaleString();
3199
+ }
3200
+ if (typeof value === "boolean") return value ? "Yes" : "No";
3201
+ return stringifyCellValue(value) || "\u2014";
3202
+ }
3203
+
3158
3204
  // src/data-table/DataRowInspector.tsx
3159
3205
  var import_jsx_runtime17 = require("react/jsx-runtime");
3160
3206
  var noFieldToken = () => null;
@@ -3227,7 +3273,7 @@ function DataRowInspector({
3227
3273
  key
3228
3274
  );
3229
3275
  }
3230
- const formatted = formatValue(value);
3276
+ const formatted = value !== null && typeof value === "object" && !(value instanceof Date) ? formatValue(value) : formatTableDisplayValue(value);
3231
3277
  const multiline = formatted.includes("\n") || formatted.length > 80;
3232
3278
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
3233
3279
  "div",