@ai-matrx/design-system 0.21.2 → 0.21.4

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/content-transfer.cjs +20 -6
  3. package/dist/content-transfer.cjs.map +1 -1
  4. package/dist/content-transfer.d.cts +38 -4
  5. package/dist/content-transfer.d.ts +38 -4
  6. package/dist/content-transfer.js +20 -6
  7. package/dist/content-transfer.js.map +1 -1
  8. package/dist/data-table/copy-helpers.d.cts +4 -3
  9. package/dist/data-table/copy-helpers.d.ts +4 -3
  10. package/dist/data-table/copy-types.cjs.map +1 -1
  11. package/dist/data-table/copy-types.d.cts +7 -2
  12. package/dist/data-table/copy-types.d.ts +7 -2
  13. package/dist/data-table/data-row-inspector.cjs +26 -6
  14. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  15. package/dist/data-table/data-row-inspector.js +26 -6
  16. package/dist/data-table/data-row-inspector.js.map +1 -1
  17. package/dist/data-table/data-row-window.cjs +26 -6
  18. package/dist/data-table/data-row-window.cjs.map +1 -1
  19. package/dist/data-table/data-row-window.js +26 -6
  20. package/dist/data-table/data-row-window.js.map +1 -1
  21. package/dist/data-table/filter-engine.d.cts +4 -3
  22. package/dist/data-table/filter-engine.d.ts +4 -3
  23. package/dist/data-table/host.cjs +23 -1
  24. package/dist/data-table/host.cjs.map +1 -1
  25. package/dist/data-table/host.d.cts +33 -4
  26. package/dist/data-table/host.d.ts +33 -4
  27. package/dist/data-table/host.js +23 -1
  28. package/dist/data-table/host.js.map +1 -1
  29. package/dist/data-table/index.cjs +890 -751
  30. package/dist/data-table/index.cjs.map +1 -1
  31. package/dist/data-table/index.d.cts +16 -6
  32. package/dist/data-table/index.d.ts +16 -6
  33. package/dist/data-table/index.js +846 -707
  34. package/dist/data-table/index.js.map +1 -1
  35. package/dist/data-table/infer-filter.d.cts +4 -3
  36. package/dist/data-table/infer-filter.d.ts +4 -3
  37. package/dist/data-table/layered-filters.d.cts +4 -3
  38. package/dist/data-table/layered-filters.d.ts +4 -3
  39. package/dist/data-table/pagination.cjs +6 -0
  40. package/dist/data-table/pagination.cjs.map +1 -1
  41. package/dist/data-table/pagination.js +6 -0
  42. package/dist/data-table/pagination.js.map +1 -1
  43. package/dist/data-table/query-control.d.cts +4 -3
  44. package/dist/data-table/query-control.d.ts +4 -3
  45. package/dist/data-table/types.cjs.map +1 -1
  46. package/dist/data-table/types.d.cts +3 -2
  47. package/dist/data-table/types.d.ts +3 -2
  48. package/dist/data-table/url-state.d.cts +4 -3
  49. package/dist/data-table/url-state.d.ts +4 -3
  50. package/dist/data-table/uuid-cell.cjs +6 -0
  51. package/dist/data-table/uuid-cell.cjs.map +1 -1
  52. package/dist/data-table/uuid-cell.js +6 -0
  53. package/dist/data-table/uuid-cell.js.map +1 -1
  54. package/dist/data-table/xlsx.d.cts +4 -3
  55. package/dist/data-table/xlsx.d.ts +4 -3
  56. package/dist/{types-DnnvjGV4.d.ts → types-CbGNfo7r.d.ts} +13 -2
  57. package/dist/{types-Bt-0UhEw.d.cts → types-DRusLYrU.d.cts} +13 -2
  58. package/package.json +1 -1
  59. package/dist/extensions-DCHtNwG3.d.cts +0 -32
  60. package/dist/extensions-DCHtNwG3.d.ts +0 -32
@@ -407,6 +407,12 @@ var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react.createContext)({}
407
407
  function useMatrxDataTableHost() {
408
408
  return (0, import_react.useContext)(HostContext);
409
409
  }
410
+ var ROW_ALCHEMY_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-row-alchemy-context");
411
+ var rowAlchemyRegistry = globalThis;
412
+ var RowAlchemyContext = rowAlchemyRegistry[ROW_ALCHEMY_SLOT] ??= (0, import_react.createContext)(null);
413
+ var ROW_CONTROLS_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-row-controls-context");
414
+ var rowControlsRegistry = globalThis;
415
+ var RowControlsContext = rowControlsRegistry[ROW_CONTROLS_SLOT] ??= (0, import_react.createContext)(null);
410
416
 
411
417
  // src/content-transfer/matrx-copy.tsx
412
418
  var React10 = __toESM(require("react"), 1);
@@ -1404,8 +1410,9 @@ function ContentTransferMenu(props) {
1404
1410
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
1405
1411
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
1406
1412
  }
1407
- function ContentTransferMenuSession({ references = [], referenceActions = [], source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef, icon = "portal", triggerVariant = "transparent", triggerSize = "default" }) {
1413
+ function ContentTransferMenuSession({ references = [], referenceActions = [], source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef, icon = "portal", triggerVariant = "transparent", triggerSize = "default", triggerHidden = false }) {
1408
1414
  const triggerRef = React9.useRef(null);
1415
+ const restoreFocusRef = React9.useRef(null);
1409
1416
  const inherited = React9.useContext(CapabilityContext);
1410
1417
  const nearestSurface = React9.useContext(SurfaceContext);
1411
1418
  const fence = useFence();
@@ -1655,13 +1662,21 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1655
1662
  );
1656
1663
  React9.useImperativeHandle(controllerRef, () => ({
1657
1664
  focusTrigger: () => triggerRef.current?.focus(),
1665
+ preparePrimary: async (options) => {
1666
+ if (!enabled) throw new Error("Alchemy is not enabled for this record.");
1667
+ if (disabled) throw new Error("Alchemy is disabled for this record.");
1668
+ if (hide.includes("prepare")) throw new Error("Alchemy preparation is unavailable for this record.");
1669
+ if (!primary) throw new Error("Alchemy has no source to prepare.");
1670
+ restoreFocusRef.current = options?.restoreFocus ?? null;
1671
+ await openWorkspace(primaryWorkspaceKey, { source: primary, label: sourceLabel });
1672
+ },
1658
1673
  prepare: async (requestedSource, options) => {
1659
1674
  const requestedLabel = options?.label ?? ("label" in requestedSource ? requestedSource.label : "content");
1660
1675
  const requestedKey = `controller:${options?.id ?? "source"}:${materialIdentity(requestedSource)}`;
1661
1676
  externalWorkspaceKeys.current.add(requestedKey);
1662
1677
  await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
1663
1678
  }
1664
- }), [openWorkspace]);
1679
+ }), [disabled, enabled, hide, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
1665
1680
  const runAction = React9.useCallback(async (action) => {
1666
1681
  const { controller, id } = fence.begin();
1667
1682
  try {
@@ -1744,7 +1759,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1744
1759
  ] }, id);
1745
1760
  };
1746
1761
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
1747
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
1762
+ !triggerHidden ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
1748
1763
  setPaletteOpen(open);
1749
1764
  if (open) {
1750
1765
  setMode("copy");
@@ -1853,13 +1868,13 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
1853
1868
  ] }, group) : null;
1854
1869
  })
1855
1870
  ] })
1856
- ] }),
1871
+ ] }) : null,
1857
1872
  notice && triggerRef.current ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-feedback", children: [
1858
1873
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { role: "status", children: notice }),
1859
1874
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ReceiptLink, { target: receiptTarget }),
1860
1875
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
1861
1876
  ] }), triggerRef.current.ownerDocument.body) : null,
1862
- Object.values(workspaces).map((saved) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreparationWorkspace, { restoreFocus: () => triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, scopeLabels: table?.scopeLabels, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, actions: preparedActions, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key)),
1877
+ Object.values(workspaces).map((saved) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreparationWorkspace, { restoreFocus: () => restoreFocusRef.current?.() ?? triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, scopeLabels: table?.scopeLabels, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, actions: preparedActions, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key)),
1863
1878
  emailReview
1864
1879
  ] });
1865
1880
  }
@@ -2666,7 +2681,12 @@ function MatrxCopyMenuSession(props) {
2666
2681
  ...props.referenceActions ? { referenceActions: props.referenceActions } : {},
2667
2682
  ...props.icon !== void 0 ? { icon: props.icon } : {},
2668
2683
  ...props.triggerVariant !== void 0 ? { triggerVariant: props.triggerVariant } : {},
2669
- controllerRef: controller,
2684
+ controllerRef: (value) => {
2685
+ controller.current = value;
2686
+ if (typeof props.controllerRef === "function") props.controllerRef(value);
2687
+ else if (props.controllerRef) props.controllerRef.current = value;
2688
+ },
2689
+ ...props.triggerHidden ? { triggerHidden: true } : {},
2670
2690
  label: props.label,
2671
2691
  variants,
2672
2692
  actions,