@ai-matrx/design-system 0.20.5 → 0.20.8

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 (37) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/content-transfer.cjs +35 -15
  3. package/dist/content-transfer.cjs.map +1 -1
  4. package/dist/content-transfer.css +10 -2
  5. package/dist/content-transfer.js +35 -15
  6. package/dist/content-transfer.js.map +1 -1
  7. package/dist/data-table/copy-helpers.cjs.map +1 -1
  8. package/dist/data-table/copy-helpers.js.map +1 -1
  9. package/dist/data-table/data-row-inspector.cjs +33 -13
  10. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  11. package/dist/data-table/data-row-inspector.js +33 -13
  12. package/dist/data-table/data-row-inspector.js.map +1 -1
  13. package/dist/data-table/data-row-window.cjs +33 -13
  14. package/dist/data-table/data-row-window.cjs.map +1 -1
  15. package/dist/data-table/data-row-window.js +33 -13
  16. package/dist/data-table/data-row-window.js.map +1 -1
  17. package/dist/data-table/filter-engine.cjs +6 -2
  18. package/dist/data-table/filter-engine.cjs.map +1 -1
  19. package/dist/data-table/filter-engine.d.cts +3 -1
  20. package/dist/data-table/filter-engine.d.ts +3 -1
  21. package/dist/data-table/filter-engine.js +6 -2
  22. package/dist/data-table/filter-engine.js.map +1 -1
  23. package/dist/data-table/index.cjs +294 -228
  24. package/dist/data-table/index.cjs.map +1 -1
  25. package/dist/data-table/index.js +136 -70
  26. package/dist/data-table/index.js.map +1 -1
  27. package/dist/data-table/infer-filter.cjs +11 -7
  28. package/dist/data-table/infer-filter.cjs.map +1 -1
  29. package/dist/data-table/infer-filter.js +11 -7
  30. package/dist/data-table/infer-filter.js.map +1 -1
  31. package/dist/data-table/query-control.cjs +11 -7
  32. package/dist/data-table/query-control.cjs.map +1 -1
  33. package/dist/data-table/query-control.js +11 -7
  34. package/dist/data-table/query-control.js.map +1 -1
  35. package/dist/data-table/xlsx.cjs.map +1 -1
  36. package/dist/data-table/xlsx.js.map +1 -1
  37. package/package.json +1 -1
@@ -59,7 +59,7 @@ __export(data_table_exports, {
59
59
  module.exports = __toCommonJS(data_table_exports);
60
60
 
61
61
  // src/data-table/MatrxDataTable.tsx
62
- var import_react17 = require("react");
62
+ var import_react18 = require("react");
63
63
  var import_core3 = require("@dnd-kit/core");
64
64
 
65
65
  // src/data-table/icons.tsx
@@ -219,6 +219,46 @@ var Button = React.forwardRef(
219
219
  );
220
220
  Button.displayName = "Button";
221
221
 
222
+ // src/data-table/use-column-reorder-animation.ts
223
+ var import_react = require("react");
224
+ function useColumnReorderAnimation(tableRef, order, dragging) {
225
+ const previous = (0, import_react.useRef)({ positions: /* @__PURE__ */ new Map(), dragging: false });
226
+ const animations = (0, import_react.useRef)([]);
227
+ (0, import_react.useLayoutEffect)(() => {
228
+ const table = tableRef.current;
229
+ if (!table) return;
230
+ const headers = Array.from(table.querySelectorAll("th[data-matrx-table-column-id]"));
231
+ const positions = new Map(headers.map((header) => [header.dataset.matrxTableColumnId, header.offsetLeft]));
232
+ const prefersReducedMotion = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
233
+ const shouldAnimate = (dragging || previous.current.dragging) && !prefersReducedMotion;
234
+ const offsets = /* @__PURE__ */ new Map();
235
+ for (const header of headers) {
236
+ const id = header.dataset.matrxTableColumnId;
237
+ const oldLeft = previous.current.positions.get(id);
238
+ if (oldLeft === void 0) continue;
239
+ const transform = getComputedStyle(header).transform;
240
+ const remaining = transform && transform !== "none" ? new DOMMatrixReadOnly(transform).m41 : 0;
241
+ offsets.set(id, oldLeft - header.offsetLeft + remaining);
242
+ }
243
+ animations.current.forEach((animation) => animation.cancel());
244
+ animations.current = [];
245
+ if (shouldAnimate) {
246
+ for (const cell of Array.from(table.querySelectorAll("[data-matrx-table-column-id]"))) {
247
+ const offset = offsets.get(cell.dataset.matrxTableColumnId);
248
+ if (!offset || typeof cell.animate !== "function") continue;
249
+ animations.current.push(cell.animate(
250
+ [{ transform: `translateX(${offset}px)` }, { transform: "translateX(0)" }],
251
+ { duration: 180, easing: "cubic-bezier(0.2, 0.8, 0.2, 1)" }
252
+ ));
253
+ }
254
+ }
255
+ previous.current = { positions, dragging };
256
+ }, [tableRef, order, dragging]);
257
+ (0, import_react.useLayoutEffect)(() => () => {
258
+ animations.current.forEach((animation) => animation.cancel());
259
+ }, []);
260
+ }
261
+
222
262
  // src/data-table/MatrxDataTable.tsx
223
263
  var import_format3 = require("@ai-matrx/kit/format");
224
264
 
@@ -964,7 +1004,7 @@ function TableTitleRow({
964
1004
  }
965
1005
 
966
1006
  // src/data-table/TableSearch.tsx
967
- var import_react = require("react");
1007
+ var import_react2 = require("react");
968
1008
 
969
1009
  // src/tooltip.tsx
970
1010
  var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
@@ -995,8 +1035,8 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
995
1035
  // src/data-table/TableSearch.tsx
996
1036
  var import_jsx_runtime13 = require("react/jsx-runtime");
997
1037
  function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholder = "Search\u2026" }) {
998
- const [expanded, setExpanded] = (0, import_react.useState)(false);
999
- const inputRef = (0, import_react.useRef)(null);
1038
+ const [expanded, setExpanded] = (0, import_react2.useState)(false);
1039
+ const inputRef = (0, import_react2.useRef)(null);
1000
1040
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-matrx-table-search": true, className: "h-11 min-w-0 w-full sm:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1001
1041
  "div",
1002
1042
  {
@@ -1042,7 +1082,7 @@ function TableSearch({ value, onChange, scope, onScopeChange, scopes, placeholde
1042
1082
  }
1043
1083
 
1044
1084
  // src/data-table/useScrollPagination.ts
1045
- var import_react2 = require("react");
1085
+ var import_react3 = require("react");
1046
1086
  var DEFAULT_THRESHOLD_PX = 96;
1047
1087
  var DEFAULT_INTENT_TIMEOUT_MS = 1200;
1048
1088
  function resolveContainer(container) {
@@ -1113,8 +1153,8 @@ function useScrollPagination({
1113
1153
  intentTimeoutMs = DEFAULT_INTENT_TIMEOUT_MS,
1114
1154
  enabled = true
1115
1155
  }) {
1116
- const [requestError, setRequestError] = (0, import_react2.useState)(null);
1117
- const latestRef = (0, import_react2.useRef)({
1156
+ const [requestError, setRequestError] = (0, import_react3.useState)(null);
1157
+ const latestRef = (0, import_react3.useRef)({
1118
1158
  queryKey,
1119
1159
  hasNextPage,
1120
1160
  isFetchingNextPage,
@@ -1136,16 +1176,16 @@ function useScrollPagination({
1136
1176
  thresholdPx,
1137
1177
  enabled
1138
1178
  };
1139
- const intentRef = (0, import_react2.useRef)(null);
1140
- const inputSequenceRef = (0, import_react2.useRef)(0);
1141
- const consumedSequenceRef = (0, import_react2.useRef)(0);
1142
- const requestGenerationRef = (0, import_react2.useRef)(0);
1143
- const inFlightGenerationRef = (0, import_react2.useRef)(null);
1144
- const requestErrorRef = (0, import_react2.useRef)(null);
1145
- const mountedRef = (0, import_react2.useRef)(false);
1146
- const observedTopRef = (0, import_react2.useRef)(/* @__PURE__ */ new WeakMap());
1179
+ const intentRef = (0, import_react3.useRef)(null);
1180
+ const inputSequenceRef = (0, import_react3.useRef)(0);
1181
+ const consumedSequenceRef = (0, import_react3.useRef)(0);
1182
+ const requestGenerationRef = (0, import_react3.useRef)(0);
1183
+ const inFlightGenerationRef = (0, import_react3.useRef)(null);
1184
+ const requestErrorRef = (0, import_react3.useRef)(null);
1185
+ const mountedRef = (0, import_react3.useRef)(false);
1186
+ const observedTopRef = (0, import_react3.useRef)(/* @__PURE__ */ new WeakMap());
1147
1187
  const effectiveError = error ?? requestError;
1148
- (0, import_react2.useEffect)(() => {
1188
+ (0, import_react3.useEffect)(() => {
1149
1189
  mountedRef.current = true;
1150
1190
  return () => {
1151
1191
  mountedRef.current = false;
@@ -1175,7 +1215,7 @@ function useScrollPagination({
1175
1215
  }
1176
1216
  }
1177
1217
  };
1178
- (0, import_react2.useEffect)(() => {
1218
+ (0, import_react3.useEffect)(() => {
1179
1219
  intentRef.current = null;
1180
1220
  observedTopRef.current = /* @__PURE__ */ new WeakMap();
1181
1221
  consumedSequenceRef.current = inputSequenceRef.current;
@@ -1184,7 +1224,7 @@ function useScrollPagination({
1184
1224
  inFlightGenerationRef.current = null;
1185
1225
  requestGenerationRef.current += 1;
1186
1226
  }, [queryKey]);
1187
- (0, import_react2.useEffect)(() => {
1227
+ (0, import_react3.useEffect)(() => {
1188
1228
  if (mode !== "scroll" || !enabled || typeof window === "undefined") return;
1189
1229
  const attachable = containers.map(resolveContainer).filter((container) => container !== null);
1190
1230
  const ownerCleanups = /* @__PURE__ */ new Map();
@@ -1280,7 +1320,7 @@ function useScrollPagination({
1280
1320
  }
1281
1321
 
1282
1322
  // src/data-table/useProgressiveTableRows.ts
1283
- var import_react3 = require("react");
1323
+ var import_react4 = require("react");
1284
1324
  function safePageSize(pageSize) {
1285
1325
  return Number.isFinite(pageSize) && pageSize > 0 ? Math.floor(pageSize) : 0;
1286
1326
  }
@@ -1303,15 +1343,15 @@ function useProgressiveTableRows({
1303
1343
  const pageSize = safePageSize(rawPageSize);
1304
1344
  const hasExplicitRequestedPage = rawRequestedPage !== void 0;
1305
1345
  const requestedPage = safeRequestedPage(rawRequestedPage);
1306
- const initialRequestedPageRef = (0, import_react3.useRef)(requestedPage);
1307
- const latestRequestedPageRef = (0, import_react3.useRef)(requestedPage);
1308
- const optimisticAdvancePageRef = (0, import_react3.useRef)(null);
1346
+ const initialRequestedPageRef = (0, import_react4.useRef)(requestedPage);
1347
+ const latestRequestedPageRef = (0, import_react4.useRef)(requestedPage);
1348
+ const optimisticAdvancePageRef = (0, import_react4.useRef)(null);
1309
1349
  latestRequestedPageRef.current = requestedPage;
1310
1350
  const progressionKey = `${queryKey}\0${pageSize}`;
1311
1351
  const initialShownCount = startCount(pageSize, initialRequestedPageRef.current);
1312
1352
  const resetShownCount = startCount(pageSize, 1);
1313
1353
  const queryStartShownCount = hasExplicitRequestedPage ? startCount(pageSize, requestedPage) : resetShownCount;
1314
- const [progression, setProgression] = (0, import_react3.useState)(() => ({
1354
+ const [progression, setProgression] = (0, import_react4.useState)(() => ({
1315
1355
  key: progressionKey,
1316
1356
  shownCount: initialShownCount,
1317
1357
  requestedPage
@@ -1322,7 +1362,7 @@ function useProgressiveTableRows({
1322
1362
  const shownCount = progression.key !== progressionKey ? queryStartShownCount : externallyRequestedPage ? startCount(pageSize, requestedPage) : Math.max(progression.shownCount, resetShownCount);
1323
1363
  const visibleCount = Math.min(rows.length, shownCount);
1324
1364
  const hasMore = enabled && pageSize > 0 && visibleCount < rows.length;
1325
- (0, import_react3.useEffect)(() => {
1365
+ (0, import_react4.useEffect)(() => {
1326
1366
  setProgression((current) => {
1327
1367
  if (current.key !== progressionKey) {
1328
1368
  optimisticAdvancePageRef.current = null;
@@ -1370,7 +1410,7 @@ function useProgressiveTableRows({
1370
1410
  ...thresholdPx === void 0 ? {} : { thresholdPx }
1371
1411
  });
1372
1412
  return {
1373
- rows: (0, import_react3.useMemo)(() => rows.slice(0, visibleCount), [rows, visibleCount]),
1413
+ rows: (0, import_react4.useMemo)(() => rows.slice(0, visibleCount), [rows, visibleCount]),
1374
1414
  shownCount: visibleCount,
1375
1415
  hasMore,
1376
1416
  showMore: scroll.requestNextPage
@@ -1805,26 +1845,26 @@ function DefaultTableWindow({ title, onClose, width = 720, height = 560, actions
1805
1845
  }
1806
1846
 
1807
1847
  // src/data-table/useTableNotice.tsx
1808
- var import_react5 = require("react");
1848
+ var import_react6 = require("react");
1809
1849
 
1810
1850
  // src/data-table/host.tsx
1811
- var import_react4 = require("react");
1851
+ var import_react5 = require("react");
1812
1852
  var import_jsx_runtime18 = require("react/jsx-runtime");
1813
1853
  var HOST_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-host-context");
1814
1854
  var hostRegistry = globalThis;
1815
- var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react4.createContext)({});
1855
+ var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react5.createContext)({});
1816
1856
  function MatrxDataTableProvider({ value, children }) {
1817
1857
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(HostContext.Provider, { value, children });
1818
1858
  }
1819
1859
  function useMatrxDataTableHost() {
1820
- return (0, import_react4.useContext)(HostContext);
1860
+ return (0, import_react5.useContext)(HostContext);
1821
1861
  }
1822
1862
 
1823
1863
  // src/data-table/useTableNotice.tsx
1824
1864
  var import_jsx_runtime19 = require("react/jsx-runtime");
1825
1865
  function useTableNotice() {
1826
1866
  const host = useMatrxDataTableHost();
1827
- const [message, setMessage] = (0, import_react5.useState)(null);
1867
+ const [message, setMessage] = (0, import_react6.useState)(null);
1828
1868
  const notify = {
1829
1869
  success(text) {
1830
1870
  if (host.notify) host.notify.success(text);
@@ -2303,7 +2343,7 @@ var PopoverContent = React13.forwardRef(
2303
2343
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
2304
2344
 
2305
2345
  // src/tap-target/tap-target-button.tsx
2306
- var import_react6 = require("react");
2346
+ var import_react7 = require("react");
2307
2347
 
2308
2348
  // src/tap-target/cn.ts
2309
2349
  function cn2(...values) {
@@ -2328,8 +2368,8 @@ function IconContent({
2328
2368
  className
2329
2369
  }) {
2330
2370
  if (icon) {
2331
- if ((0, import_react6.isValidElement)(icon)) {
2332
- return (0, import_react6.cloneElement)(icon, {
2371
+ if ((0, import_react7.isValidElement)(icon)) {
2372
+ return (0, import_react7.cloneElement)(icon, {
2333
2373
  className: cn2(className, icon.props.className)
2334
2374
  });
2335
2375
  }
@@ -2572,7 +2612,7 @@ function withTooltip(trigger, {
2572
2612
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: label })
2573
2613
  ] });
2574
2614
  }
2575
- var TapTargetButton = (0, import_react6.forwardRef)(function TapTargetButton2({
2615
+ var TapTargetButton = (0, import_react7.forwardRef)(function TapTargetButton2({
2576
2616
  icon,
2577
2617
  children,
2578
2618
  strokeWidth = 2,
@@ -2620,7 +2660,7 @@ var TapTargetButton = (0, import_react6.forwardRef)(function TapTargetButton2({
2620
2660
  buttonRef: ref
2621
2661
  });
2622
2662
  });
2623
- var TapTargetButtonTransparent = (0, import_react6.forwardRef)(function TapTargetButtonTransparent2({
2663
+ var TapTargetButtonTransparent = (0, import_react7.forwardRef)(function TapTargetButtonTransparent2({
2624
2664
  icon,
2625
2665
  children,
2626
2666
  strokeWidth = 2,
@@ -2668,7 +2708,7 @@ var TapTargetButtonTransparent = (0, import_react6.forwardRef)(function TapTarge
2668
2708
  buttonRef: ref
2669
2709
  });
2670
2710
  });
2671
- var TapTargetButtonSolid = (0, import_react6.forwardRef)(function TapTargetButtonSolid2({
2711
+ var TapTargetButtonSolid = (0, import_react7.forwardRef)(function TapTargetButtonSolid2({
2672
2712
  icon,
2673
2713
  children,
2674
2714
  strokeWidth = 2,
@@ -2719,7 +2759,7 @@ var TapTargetButtonSolid = (0, import_react6.forwardRef)(function TapTargetButto
2719
2759
  buttonRef: ref
2720
2760
  });
2721
2761
  });
2722
- var TapTargetButtonDestructive = (0, import_react6.forwardRef)(function TapTargetButtonDestructive2({
2762
+ var TapTargetButtonDestructive = (0, import_react7.forwardRef)(function TapTargetButtonDestructive2({
2723
2763
  bgColor = "bg-destructive",
2724
2764
  iconColor = "text-destructive-foreground",
2725
2765
  hoverBgColor = "hover:bg-destructive/90",
@@ -2736,7 +2776,7 @@ var TapTargetButtonDestructive = (0, import_react6.forwardRef)(function TapTarge
2736
2776
  }
2737
2777
  );
2738
2778
  });
2739
- var TapTargetButtonForGroup = (0, import_react6.forwardRef)(function TapTargetButtonForGroup2({
2779
+ var TapTargetButtonForGroup = (0, import_react7.forwardRef)(function TapTargetButtonForGroup2({
2740
2780
  icon,
2741
2781
  children,
2742
2782
  strokeWidth = 2,
@@ -2825,7 +2865,7 @@ var useContentTransferCapabilities = () => React14.useContext(CapabilityContext)
2825
2865
  var SurfaceContext = React14.createContext(null);
2826
2866
  function MenuPresentation({ label, hint, icon: Icon3 }) {
2827
2867
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2828
- Icon3 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon3, { className: "matrx-alchemy-menu-icon" }) : null,
2868
+ Icon3 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { file: true }),
2829
2869
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
2830
2870
  label,
2831
2871
  hint ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
@@ -2847,8 +2887,11 @@ function DestinationPresentation({ action }) {
2847
2887
  };
2848
2888
  const path2 = paths[action.id.replace(/^matrx:/, "")];
2849
2889
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2850
- !action.icon ? path2 ? /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("path", { d: path2 }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { file: true }) : null,
2851
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MenuPresentation, { ...action })
2890
+ action.icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(action.icon, { className: "matrx-alchemy-menu-icon" }) : path2 ? /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("path", { d: path2 }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { file: true }),
2891
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
2892
+ action.label,
2893
+ action.hint ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: action.hint }) : null
2894
+ ] })
2852
2895
  ] });
2853
2896
  }
2854
2897
  function ReceiptLink({ target }) {
@@ -2858,6 +2901,11 @@ function ReceiptLink({ target }) {
2858
2901
  ] }) : null;
2859
2902
  }
2860
2903
  function PaletteGlyph({ format, ai = false, file = false, kind }) {
2904
+ if (kind === "link") return /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.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" }) });
2905
+ if (kind === "surface") return /* @__PURE__ */ (0, import_jsx_runtime24.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: [
2906
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2907
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M3 9h18M9 9v12" })
2908
+ ] });
2861
2909
  if (kind === "ai-copy") return /* @__PURE__ */ (0, import_jsx_runtime24.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: [
2862
2910
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
2863
2911
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
@@ -3338,7 +3386,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3338
3386
  const presentation = options.action;
3339
3387
  const Icon3 = presentation?.icon;
3340
3388
  const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
3341
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
3389
+ return /* @__PURE__ */ (0, import_jsx_runtime24.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: () => {
3342
3390
  closePalette();
3343
3391
  onClick();
3344
3392
  }, children: [
@@ -3400,7 +3448,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3400
3448
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { kind: "ai-copy" }),
3401
3449
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3402
3450
  "Copy with AI context",
3403
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
3451
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
3404
3452
  ] })
3405
3453
  ] }) : null, items: quickVariants("ai"), onRun: (variant) => {
3406
3454
  closePalette();
@@ -3413,32 +3461,44 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
3413
3461
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { kind: "sliders" }),
3414
3462
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
3415
3463
  "Prepare for AI",
3416
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
3464
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
3417
3465
  ] })
3418
3466
  ] }) })
3419
3467
  ] }) : null,
3420
3468
  prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
3421
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
3469
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
3422
3470
  closePalette();
3423
3471
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
3424
- }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Prepare this surface" }) }) : null,
3472
+ }, children: [
3473
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { kind: "surface" }),
3474
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Prepare this page" })
3475
+ ] }) : null,
3425
3476
  variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
3426
3477
  closePalette();
3427
3478
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
3428
3479
  }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
3429
3480
  ] }) }) : null,
3430
3481
  references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
3431
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { children: "Live references" }),
3432
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "matrx-alchemy-menu-hint", children: "Pointers to saved data, independent of filters and edits." }),
3433
- references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void copyReference(reference), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: reference.label }) }, reference.id)),
3434
- referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: action.label }) }, action.id))
3482
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { children: "References" }),
3483
+ referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
3484
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { kind: "link" }),
3485
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: action.label }),
3486
+ /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("path", { d: "m6 4 4 4-4 4" }) })
3487
+ ] }, action.id)),
3488
+ references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
3489
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PaletteGlyph, { kind: "link" }),
3490
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: reference.label })
3491
+ ] }, reference.id))
3435
3492
  ] }) : null,
3436
3493
  ["save", "chat", "email", "other"].map((group) => {
3437
3494
  const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
3438
3495
  return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
3439
3496
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("summary", { children: [
3440
3497
  group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
3441
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: entries.length })
3498
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
3499
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: entries.length }),
3500
+ /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)("path", { d: "m6 4 4 4-4 4" }) })
3501
+ ] })
3442
3502
  ] }),
3443
3503
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
3444
3504
  closePalette();
@@ -4586,7 +4646,7 @@ function CopyButtons(props) {
4586
4646
  }
4587
4647
 
4588
4648
  // src/data-table/CopySubset.tsx
4589
- var import_react7 = require("react");
4649
+ var import_react8 = require("react");
4590
4650
  var import_clipboard = require("@ai-matrx/kit/clipboard");
4591
4651
 
4592
4652
  // src/data-table/layered-filters.ts
@@ -4799,6 +4859,9 @@ function compareValues(a, b) {
4799
4859
  sensitivity: "base"
4800
4860
  });
4801
4861
  }
4862
+ function selectCellValues(value) {
4863
+ return (Array.isArray(value) ? value : [value]).map(stringifyCellValue).filter((item) => item !== "");
4864
+ }
4802
4865
  function passesColumnFilter(value, filter) {
4803
4866
  const matches = (() => {
4804
4867
  switch (filter.kind) {
@@ -4815,9 +4878,9 @@ function passesColumnFilter(value, filter) {
4815
4878
  case "select": {
4816
4879
  const selected = filter.values ?? (filter.value && filter.value !== "__all__" ? [filter.value] : []);
4817
4880
  if (selected.length === 0) return true;
4818
- const s = stringifyCellValue(value);
4881
+ const values = selectCellValues(value);
4819
4882
  return selected.some(
4820
- (v) => v === SELECT_EMPTY_VALUE ? s === "" : v === SELECT_NOT_EMPTY_VALUE ? s !== "" : s === v
4883
+ (v) => v === SELECT_EMPTY_VALUE ? values.length === 0 : v === SELECT_NOT_EMPTY_VALUE ? values.length > 0 : values.includes(v)
4821
4884
  );
4822
4885
  }
4823
4886
  case "boolean": {
@@ -5072,11 +5135,11 @@ function buildViewHuman(config, visible, columns) {
5072
5135
  // src/data-table/CopySubset.tsx
5073
5136
  var import_jsx_runtime27 = require("react/jsx-runtime");
5074
5137
  function CopySubsetDialog({ source, onClose }) {
5075
- const [rows] = (0, import_react7.useState)(() => [...source.rows]);
5076
- const [hidden, setHidden] = (0, import_react7.useState)(() => new Set(source.columns.filter((c) => c.hidden).map((c) => c.id)));
5077
- const [selectedIds, setSelectedIds] = (0, import_react7.useState)([]);
5078
- const [format, setFormat] = (0, import_react7.useState)("ai");
5079
- const [query, setQuery] = (0, import_react7.useState)({ page: 1, pageSize: 50, search: "", anyOf: "", columnFilters: {}, sort: null });
5138
+ const [rows] = (0, import_react8.useState)(() => [...source.rows]);
5139
+ const [hidden, setHidden] = (0, import_react8.useState)(() => new Set(source.columns.filter((c) => c.hidden).map((c) => c.id)));
5140
+ const [selectedIds, setSelectedIds] = (0, import_react8.useState)([]);
5141
+ const [format, setFormat] = (0, import_react8.useState)("ai");
5142
+ const [query, setQuery] = (0, import_react8.useState)({ page: 1, pageSize: 50, search: "", anyOf: "", columnFilters: {}, sort: null });
5080
5143
  const { notify, notice } = useTableNotice();
5081
5144
  const clipboard = (0, import_clipboard.useClipboard)({ notify: (message, kind) => notify[kind](message) });
5082
5145
  const columns = source.columns.filter((c) => !hidden.has(c.id));
@@ -5141,9 +5204,9 @@ function useCopySubsetVariant() {
5141
5204
  }
5142
5205
 
5143
5206
  // src/data-table/clipping.ts
5144
- var import_react8 = require("react");
5207
+ var import_react9 = require("react");
5145
5208
  function useClippedContentGuard(ref, options) {
5146
- (0, import_react8.useEffect)(() => {
5209
+ (0, import_react9.useEffect)(() => {
5147
5210
  if (!options.enabled || !ref.current) return;
5148
5211
  const node = ref.current;
5149
5212
  const check = () => {
@@ -5157,7 +5220,7 @@ function useClippedContentGuard(ref, options) {
5157
5220
  }
5158
5221
 
5159
5222
  // src/data-table/url-state.ts
5160
- var import_react9 = require("react");
5223
+ var import_react10 = require("react");
5161
5224
  var import_url_state = require("@ai-matrx/kit/url-state");
5162
5225
  function parseSort(raw) {
5163
5226
  if (!raw) return null;
@@ -5209,11 +5272,11 @@ function useTableUrlState(options) {
5209
5272
  textHistory = "session"
5210
5273
  } = options;
5211
5274
  const prefix = tableUrlParamPrefix(tableId);
5212
- const key = (0, import_react9.useCallback)((name) => `${prefix}.${name}`, [prefix]);
5275
+ const key = (0, import_react10.useCallback)((name) => `${prefix}.${name}`, [prefix]);
5213
5276
  const defaultSortId = defaultSort?.id;
5214
5277
  const defaultSortDirection = defaultSort?.direction;
5215
5278
  const searchParams = (0, import_url_state.useUrlSearchParams)();
5216
- const readState = (0, import_react9.useCallback)(
5279
+ const readState = (0, import_react10.useCallback)(
5217
5280
  (params) => {
5218
5281
  const initialSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
5219
5282
  return {
@@ -5234,9 +5297,9 @@ function useTableUrlState(options) {
5234
5297
  [defaultPageSize, defaultSortDirection, defaultSortId, key]
5235
5298
  );
5236
5299
  const state = readState(searchParams);
5237
- const lastTextWriteAt = (0, import_react9.useRef)(0);
5238
- const [debouncedSearch, setDebouncedSearch] = (0, import_react9.useState)(state.search);
5239
- (0, import_react9.useEffect)(() => {
5300
+ const lastTextWriteAt = (0, import_react10.useRef)(0);
5301
+ const [debouncedSearch, setDebouncedSearch] = (0, import_react10.useState)(state.search);
5302
+ (0, import_react10.useEffect)(() => {
5240
5303
  if (state.search === debouncedSearch) return;
5241
5304
  const timer = window.setTimeout(
5242
5305
  () => setDebouncedSearch(state.search),
@@ -5244,7 +5307,7 @@ function useTableUrlState(options) {
5244
5307
  );
5245
5308
  return () => window.clearTimeout(timer);
5246
5309
  }, [state.search, debouncedSearch, searchDebounceMs]);
5247
- const writeState = (0, import_react9.useCallback)(
5310
+ const writeState = (0, import_react10.useCallback)(
5248
5311
  (nextState, mode = history) => {
5249
5312
  const params = new URLSearchParams(window.location.search);
5250
5313
  const setOrDelete = (name, value) => {
@@ -5295,7 +5358,7 @@ function useTableUrlState(options) {
5295
5358
  },
5296
5359
  [defaultPageSize, defaultSortDirection, defaultSortId, history, key]
5297
5360
  );
5298
- const onStateChange = (0, import_react9.useCallback)(
5361
+ const onStateChange = (0, import_react10.useCallback)(
5299
5362
  (next) => {
5300
5363
  const changed = Object.keys(next).filter(
5301
5364
  (name) => JSON.stringify(next[name]) !== JSON.stringify(state[name])
@@ -5313,7 +5376,7 @@ function useTableUrlState(options) {
5313
5376
  },
5314
5377
  [history, state, textHistory, writeState]
5315
5378
  );
5316
- const reset = (0, import_react9.useCallback)(() => {
5379
+ const reset = (0, import_react10.useCallback)(() => {
5317
5380
  const dSort = defaultSortId && defaultSortDirection ? { id: defaultSortId, direction: defaultSortDirection } : null;
5318
5381
  const next = {
5319
5382
  page: 1,
@@ -5329,7 +5392,7 @@ function useTableUrlState(options) {
5329
5392
  writeState(next);
5330
5393
  setDebouncedSearch("");
5331
5394
  }, [defaultPageSize, defaultSortDirection, defaultSortId, writeState]);
5332
- const queryState = (0, import_react9.useMemo)(
5395
+ const queryState = (0, import_react10.useMemo)(
5333
5396
  () => state.search === debouncedSearch ? state : { ...state, search: debouncedSearch, page: 1 },
5334
5397
  [state, debouncedSearch]
5335
5398
  );
@@ -5340,7 +5403,7 @@ function useTableUrlState(options) {
5340
5403
  var import_url_state3 = require("@ai-matrx/kit/url-state");
5341
5404
 
5342
5405
  // src/data-table/ColumnHeaderCell.tsx
5343
- var import_react10 = require("react");
5406
+ var import_react11 = require("react");
5344
5407
  var import_core = require("@dnd-kit/core");
5345
5408
 
5346
5409
  // src/command.tsx
@@ -5488,7 +5551,7 @@ CommandShortcut.displayName = "CommandShortcut";
5488
5551
 
5489
5552
  // src/data-table/ColumnHeaderCell.tsx
5490
5553
  var import_jsx_runtime29 = require("react/jsx-runtime");
5491
- var HeaderButton = (0, import_react10.forwardRef)(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
5554
+ var HeaderButton = (0, import_react11.forwardRef)(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
5492
5555
  const descriptions = [tooltipDescription, dragDescription].filter((value) => Boolean(value)).join(" ");
5493
5556
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5494
5557
  "button",
@@ -5548,9 +5611,9 @@ function ColumnHeaderCell({
5548
5611
  const reorderClass = reorderEnabled ? "touch-none cursor-grab active:cursor-grabbing" : void 0;
5549
5612
  const filterActive = isColumnFilterActive(filterValue);
5550
5613
  const deferredFilter = filterApplyLabel !== void 0 || filterShowCancel || filterFooterHint !== void 0;
5551
- const [filterOpen, setFilterOpen] = (0, import_react10.useState)(false);
5552
- const [draftFilter, setDraftFilter] = (0, import_react10.useState)(filterValue);
5553
- (0, import_react10.useEffect)(() => {
5614
+ const [filterOpen, setFilterOpen] = (0, import_react11.useState)(false);
5615
+ const [draftFilter, setDraftFilter] = (0, import_react11.useState)(filterValue);
5616
+ (0, import_react11.useEffect)(() => {
5554
5617
  if (!filterOpen) setDraftFilter(filterValue);
5555
5618
  }, [filterOpen, filterValue]);
5556
5619
  const applyFilter = () => {
@@ -5955,8 +6018,8 @@ function SearchableSelectFilter({
5955
6018
  onChange,
5956
6019
  single = false
5957
6020
  }) {
5958
- const [query, setQuery] = (0, import_react10.useState)("");
5959
- const filtered = (0, import_react10.useMemo)(() => {
6021
+ const [query, setQuery] = (0, import_react11.useState)("");
6022
+ const filtered = (0, import_react11.useMemo)(() => {
5960
6023
  const q = query.trim().toLowerCase();
5961
6024
  if (!q) return options;
5962
6025
  return options.filter(
@@ -6054,8 +6117,8 @@ function NumberFilterBody({
6054
6117
  }) {
6055
6118
  const min = value?.kind === "number" ? value.min : void 0;
6056
6119
  const max = value?.kind === "number" ? value.max : void 0;
6057
- const [minText, setMinText] = (0, import_react10.useState)(min !== void 0 ? String(min) : "");
6058
- const [maxText, setMaxText] = (0, import_react10.useState)(max !== void 0 ? String(max) : "");
6120
+ const [minText, setMinText] = (0, import_react11.useState)(min !== void 0 ? String(min) : "");
6121
+ const [maxText, setMaxText] = (0, import_react11.useState)(max !== void 0 ? String(max) : "");
6059
6122
  const commit = (raw, which) => {
6060
6123
  const nextMin = which === "min" ? parseOptionalNumber(raw) : min;
6061
6124
  const nextMax = which === "max" ? parseOptionalNumber(raw) : max;
@@ -6123,7 +6186,7 @@ function parseOptionalNumber(raw) {
6123
6186
  }
6124
6187
 
6125
6188
  // src/data-table/ColumnResizeHandle.tsx
6126
- var import_react11 = require("react");
6189
+ var import_react12 = require("react");
6127
6190
 
6128
6191
  // src/data-table/column-resize.ts
6129
6192
  var DEFAULT_COLUMN_MIN_WIDTH = 80;
@@ -6165,24 +6228,24 @@ function ColumnResizeHandle({
6165
6228
  onResizeCancel,
6166
6229
  onResizeCommit
6167
6230
  }) {
6168
- const handleRef = (0, import_react11.useRef)(null);
6169
- const activeResizeRef = (0, import_react11.useRef)(null);
6170
- const previewRafRef = (0, import_react11.useRef)(null);
6171
- const queuedWidthRef = (0, import_react11.useRef)(null);
6172
- const keyboardWidthRef = (0, import_react11.useRef)(null);
6173
- const [announcedWidth, setAnnouncedWidth] = (0, import_react11.useState)(null);
6231
+ const handleRef = (0, import_react12.useRef)(null);
6232
+ const activeResizeRef = (0, import_react12.useRef)(null);
6233
+ const previewRafRef = (0, import_react12.useRef)(null);
6234
+ const queuedWidthRef = (0, import_react12.useRef)(null);
6235
+ const keyboardWidthRef = (0, import_react12.useRef)(null);
6236
+ const [announcedWidth, setAnnouncedWidth] = (0, import_react12.useState)(null);
6174
6237
  const bounds = resolveColumnResizeBounds(minWidth, maxWidth);
6175
6238
  const cssVar = columnResizeCssVar(columnId2);
6176
- const readWidth = (0, import_react11.useCallback)(() => {
6239
+ const readWidth = (0, import_react12.useCallback)(() => {
6177
6240
  const header = handleRef.current?.closest("th");
6178
6241
  const measured = header?.getBoundingClientRect().width ?? 0;
6179
6242
  const computed = header ? Number.parseFloat(getComputedStyle(header).width) : 0;
6180
6243
  return clampColumnWidth(measured || computed || keyboardWidthRef.current || bounds.minWidth, bounds);
6181
6244
  }, [bounds]);
6182
- const writePreview = (0, import_react11.useCallback)((width) => {
6245
+ const writePreview = (0, import_react12.useCallback)((width) => {
6183
6246
  tableRef.current?.style.setProperty(cssVar, `${width}px`);
6184
6247
  }, [cssVar, tableRef]);
6185
- const queuePreview = (0, import_react11.useCallback)((width) => {
6248
+ const queuePreview = (0, import_react12.useCallback)((width) => {
6186
6249
  queuedWidthRef.current = width;
6187
6250
  if (previewRafRef.current !== null) return;
6188
6251
  previewRafRef.current = requestAnimationFrame(() => {
@@ -6192,12 +6255,12 @@ function ColumnResizeHandle({
6192
6255
  if (nextWidth !== null) writePreview(nextWidth);
6193
6256
  });
6194
6257
  }, [writePreview]);
6195
- const clearQueuedPreview = (0, import_react11.useCallback)(() => {
6258
+ const clearQueuedPreview = (0, import_react12.useCallback)(() => {
6196
6259
  if (previewRafRef.current !== null) cancelAnimationFrame(previewRafRef.current);
6197
6260
  previewRafRef.current = null;
6198
6261
  queuedWidthRef.current = null;
6199
6262
  }, []);
6200
- const finishPointerResize = (0, import_react11.useCallback)((commit) => {
6263
+ const finishPointerResize = (0, import_react12.useCallback)((commit) => {
6201
6264
  const active = activeResizeRef.current;
6202
6265
  if (!active) return;
6203
6266
  activeResizeRef.current = null;
@@ -6217,7 +6280,7 @@ function ColumnResizeHandle({
6217
6280
  handleRef.current.releasePointerCapture(active.pointerId);
6218
6281
  }
6219
6282
  }, [clearQueuedPreview, columnId2, cssVar, onResizeCancel, onResizeCommit, tableRef, writePreview]);
6220
- (0, import_react11.useEffect)(() => () => clearQueuedPreview(), [clearQueuedPreview]);
6283
+ (0, import_react12.useEffect)(() => () => clearQueuedPreview(), [clearQueuedPreview]);
6221
6284
  const onPointerDown = (event) => {
6222
6285
  if (disabled || event.button !== 0 || !event.isPrimary) return;
6223
6286
  event.preventDefault();
@@ -6372,7 +6435,7 @@ function rankTableSearchRows(rows, columns, query, options = {}, extraText) {
6372
6435
  }
6373
6436
 
6374
6437
  // src/data-table/ColumnManager.tsx
6375
- var import_react12 = require("react");
6438
+ var import_react13 = require("react");
6376
6439
  var import_core2 = require("@dnd-kit/core");
6377
6440
  var import_jsx_runtime31 = require("react/jsx-runtime");
6378
6441
  function ColumnManager({
@@ -6383,15 +6446,15 @@ function ColumnManager({
6383
6446
  hidden,
6384
6447
  onApply
6385
6448
  }) {
6386
- const byId = (0, import_react12.useMemo)(
6449
+ const byId = (0, import_react13.useMemo)(
6387
6450
  () => new Map(columns.map((column) => [columnId(column), column])),
6388
6451
  [columns]
6389
6452
  );
6390
- const [draftOrder, setDraftOrder] = (0, import_react12.useState)(order);
6391
- const [draftHidden, setDraftHidden] = (0, import_react12.useState)(() => new Set(hidden));
6392
- const [draggedColumnId, setDraggedColumnId] = (0, import_react12.useState)(null);
6393
- const [dropTarget, setDropTarget] = (0, import_react12.useState)(null);
6394
- (0, import_react12.useEffect)(() => {
6453
+ const [draftOrder, setDraftOrder] = (0, import_react13.useState)(order);
6454
+ const [draftHidden, setDraftHidden] = (0, import_react13.useState)(() => new Set(hidden));
6455
+ const [draggedColumnId, setDraggedColumnId] = (0, import_react13.useState)(null);
6456
+ const [dropTarget, setDropTarget] = (0, import_react13.useState)(null);
6457
+ (0, import_react13.useEffect)(() => {
6395
6458
  if (!open) return;
6396
6459
  setDraftOrder(order);
6397
6460
  setDraftHidden(new Set(hidden));
@@ -6624,7 +6687,7 @@ function parseTableViewSnapshot(raw) {
6624
6687
  }
6625
6688
 
6626
6689
  // src/data-table/MatrxUuidCell.tsx
6627
- var import_react13 = require("react");
6690
+ var import_react14 = require("react");
6628
6691
  var import_jsx_runtime32 = require("react/jsx-runtime");
6629
6692
  var SHORT_LEN = 8;
6630
6693
  function shortUuid(id, len = SHORT_LEN) {
@@ -6664,11 +6727,11 @@ function MatrxUuidCell({
6664
6727
  }) {
6665
6728
  const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();
6666
6729
  const { notify, notice } = useTableNotice();
6667
- const [copied, setCopied] = (0, import_react13.useState)(false);
6668
- const [opening, setOpening] = (0, import_react13.useState)(false);
6669
- const [peekOpen, setPeekOpen] = (0, import_react13.useState)(false);
6670
- const timer = (0, import_react13.useRef)(null);
6671
- (0, import_react13.useEffect)(
6730
+ const [copied, setCopied] = (0, import_react14.useState)(false);
6731
+ const [opening, setOpening] = (0, import_react14.useState)(false);
6732
+ const [peekOpen, setPeekOpen] = (0, import_react14.useState)(false);
6733
+ const timer = (0, import_react14.useRef)(null);
6734
+ (0, import_react14.useEffect)(
6672
6735
  () => () => {
6673
6736
  if (timer.current) clearTimeout(timer.current);
6674
6737
  },
@@ -6963,7 +7026,7 @@ function DataRowInspector({
6963
7026
  }
6964
7027
 
6965
7028
  // src/data-table/DataRowWindow.tsx
6966
- var import_react14 = require("react");
7029
+ var import_react15 = require("react");
6967
7030
  var import_jsx_runtime34 = require("react/jsx-runtime");
6968
7031
  function DataRowWindow({
6969
7032
  isOpen,
@@ -6984,8 +7047,8 @@ function DataRowWindow({
6984
7047
  const hasEdit = editContent != null;
6985
7048
  const hasTabs = hasEdit && children == null;
6986
7049
  const initialTab = defaultTab ?? (hasEdit ? "edit" : "view");
6987
- const [tab, setTab] = (0, import_react14.useState)(initialTab);
6988
- (0, import_react14.useEffect)(() => {
7050
+ const [tab, setTab] = (0, import_react15.useState)(initialTab);
7051
+ (0, import_react15.useEffect)(() => {
6989
7052
  if (!isOpen) return;
6990
7053
  setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
6991
7054
  }, [isOpen, windowId, hasEdit, defaultTab]);
@@ -7136,7 +7199,7 @@ function DirtySavePill({
7136
7199
  }
7137
7200
 
7138
7201
  // src/data-table/EditableTableCell.tsx
7139
- var import_react15 = require("react");
7202
+ var import_react16 = require("react");
7140
7203
  var import_jsx_runtime36 = require("react/jsx-runtime");
7141
7204
  function CellEditShell({
7142
7205
  href,
@@ -7185,7 +7248,7 @@ function EditableTableCell({
7185
7248
  href,
7186
7249
  editTrigger = "click"
7187
7250
  }) {
7188
- const [open, setOpen] = (0, import_react15.useState)(false);
7251
+ const [open, setOpen] = (0, import_react16.useState)(false);
7189
7252
  const usePencil = Boolean(href) || editTrigger === "pencil";
7190
7253
  if (editType === "string") {
7191
7254
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -7274,8 +7337,8 @@ function InlineStringEditor({
7274
7337
  href,
7275
7338
  usePencil
7276
7339
  }) {
7277
- const [editing, setEditing] = (0, import_react15.useState)(false);
7278
- const [draft, setDraft] = (0, import_react15.useState)(value);
7340
+ const [editing, setEditing] = (0, import_react16.useState)(false);
7341
+ const [draft, setDraft] = (0, import_react16.useState)(value);
7279
7342
  if (!editing) {
7280
7343
  if (usePencil) {
7281
7344
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -7426,8 +7489,8 @@ function TagsEditor({
7426
7489
  onCommit,
7427
7490
  onCancel
7428
7491
  }) {
7429
- const [tags, setTags] = (0, import_react15.useState)(value);
7430
- const [draft, setDraft] = (0, import_react15.useState)("");
7492
+ const [tags, setTags] = (0, import_react16.useState)(value);
7493
+ const [draft, setDraft] = (0, import_react16.useState)("");
7431
7494
  const add = (raw) => {
7432
7495
  const next = raw.trim();
7433
7496
  if (!next || tags.includes(next)) return;
@@ -7524,7 +7587,7 @@ function NumberEditor({
7524
7587
  onCommit,
7525
7588
  onCancel
7526
7589
  }) {
7527
- const [draft, setDraft] = (0, import_react15.useState)(String(value));
7590
+ const [draft, setDraft] = (0, import_react16.useState)(String(value));
7528
7591
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col gap-2", children: [
7529
7592
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
7530
7593
  Input,
@@ -7651,7 +7714,7 @@ function resetToolbarFacets(facets) {
7651
7714
  }
7652
7715
 
7653
7716
  // src/data-table/LayeredFilterBuilder.tsx
7654
- var import_react16 = require("react");
7717
+ var import_react17 = require("react");
7655
7718
  var import_jsx_runtime38 = require("react/jsx-runtime");
7656
7719
  function moveRule(rules, from, to) {
7657
7720
  if (from === to || to < 0 || to >= rules.length) return [...rules];
@@ -7668,8 +7731,8 @@ function LayeredFilterBuilder({
7668
7731
  maxRules = 20,
7669
7732
  label = "Advanced filters"
7670
7733
  }) {
7671
- const [open, setOpen] = (0, import_react16.useState)(false);
7672
- const [draggedIndex, setDraggedIndex] = (0, import_react16.useState)(null);
7734
+ const [open, setOpen] = (0, import_react17.useState)(false);
7735
+ const [draggedIndex, setDraggedIndex] = (0, import_react17.useState)(null);
7673
7736
  if (fields.length === 0) return null;
7674
7737
  const updateRule = (index, patch) => {
7675
7738
  onChange(
@@ -8030,7 +8093,7 @@ function resolveFilterKind(col, sampleRows) {
8030
8093
  if (values.every((v) => typeof v === "number" && Number.isFinite(v))) {
8031
8094
  return "number";
8032
8095
  }
8033
- const strings = values.map(stringifyCellValue);
8096
+ const strings = values.flatMap(selectCellValues);
8034
8097
  const unique = new Set(strings);
8035
8098
  if (unique.size >= 1 && unique.size <= SELECT_CARDINALITY_CAP && unique.size < strings.length * 0.6) {
8036
8099
  return "select";
@@ -8042,15 +8105,16 @@ function collectSelectOptions(col, rows) {
8042
8105
  const options = [];
8043
8106
  let hasEmpty = false;
8044
8107
  for (const row of rows) {
8045
- const raw = getCellValue(row, col);
8046
- const value = raw == null ? "" : stringifyCellValue(raw);
8047
- if (!value) {
8108
+ const values = selectCellValues(getCellValue(row, col));
8109
+ if (values.length === 0) {
8048
8110
  hasEmpty = true;
8049
8111
  continue;
8050
8112
  }
8051
- if (col.filterOptions?.length || seen.has(value)) continue;
8052
- seen.add(value);
8053
- options.push({ value, label: value });
8113
+ for (const value of values) {
8114
+ if (col.filterOptions?.length || seen.has(value)) continue;
8115
+ seen.add(value);
8116
+ options.push({ value, label: value });
8117
+ }
8054
8118
  }
8055
8119
  const base = col.filterOptions?.length ? [...col.filterOptions] : options.sort((a, b) => a.label.localeCompare(b.label));
8056
8120
  if (hasEmpty) {
@@ -8124,7 +8188,7 @@ function TableToolbarAction({
8124
8188
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HostAction, { ariaLabel, tooltip, disabled, busy, onClick, children }) });
8125
8189
  }
8126
8190
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Tooltip, { children: [
8127
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: "h-11 w-11 [&_svg]:size-5", "aria-label": ariaLabel, "aria-busy": busy || void 0, disabled, onClick, children: (0, import_react17.isValidElement)(children) ? (0, import_react17.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children }) }) }),
8191
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "data-matrx-table-toolbar-action": true, className: "inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "ghost", size: "icon", className: "h-11 w-11 [&_svg]:size-5", "aria-label": ariaLabel, "aria-busy": busy || void 0, disabled, onClick, children: (0, import_react18.isValidElement)(children) ? (0, import_react18.cloneElement)(children, { className: cn("h-5 w-5", children.props.className) }) : children }) }) }),
8128
8192
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TooltipContent, { children: tooltip ?? ariaLabel })
8129
8193
  ] });
8130
8194
  }
@@ -8181,7 +8245,7 @@ function MatrxDataTableWithUrlState({
8181
8245
  ...urlState.history === void 0 ? {} : { history: urlState.history },
8182
8246
  ...urlState.textHistory === void 0 ? {} : { textHistory: urlState.textHistory }
8183
8247
  });
8184
- (0, import_react17.useEffect)(() => {
8248
+ (0, import_react18.useEffect)(() => {
8185
8249
  if (activeUrlTableIds.has(urlState.id)) {
8186
8250
  throw new Error(
8187
8251
  `Duplicate MatrxDataTable urlState.id "${urlState.id}" on one page. Give every table a unique stable id.`
@@ -8302,7 +8366,7 @@ function MatrxDataTableCore({
8302
8366
  }) {
8303
8367
  const appendQuery = query?.mode === "controlled-append" ? query : null;
8304
8368
  const appendQueryKey = appendQuery?.pagination.queryKey ?? null;
8305
- const committedAppendQueryKey = (0, import_react17.useRef)(appendQueryKey);
8369
+ const committedAppendQueryKey = (0, import_react18.useRef)(appendQueryKey);
8306
8370
  const appendSourceChanged = appendQuery !== null && committedAppendQueryKey.current !== appendQueryKey;
8307
8371
  const data = appendQuery ? appendQuery.pagination.rows : suppliedData;
8308
8372
  const isLoading = appendQuery ? appendQuery.pagination.loading : suppliedLoading;
@@ -8313,10 +8377,10 @@ function MatrxDataTableCore({
8313
8377
  const Link = host.Link ?? DefaultTableLink;
8314
8378
  const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
8315
8379
  const { notify: toast, notice } = useTableNotice();
8316
- const [savedViewError, setSavedViewError] = (0, import_react17.useState)(null);
8317
- const [toolbarActionError, setToolbarActionError] = (0, import_react17.useState)(null);
8318
- const [toolbarActionPending, setToolbarActionPending] = (0, import_react17.useState)({ refresh: false, add: false });
8319
- const toolbarActionPendingRef = (0, import_react17.useRef)({ refresh: false, add: false });
8380
+ const [savedViewError, setSavedViewError] = (0, import_react18.useState)(null);
8381
+ const [toolbarActionError, setToolbarActionError] = (0, import_react18.useState)(null);
8382
+ const [toolbarActionPending, setToolbarActionPending] = (0, import_react18.useState)({ refresh: false, add: false });
8383
+ const toolbarActionPendingRef = (0, import_react18.useRef)({ refresh: false, add: false });
8320
8384
  const CHECKBOX_TAP_AREA = "h-4 w-4 touch-manipulation";
8321
8385
  const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
8322
8386
  const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
@@ -8329,7 +8393,7 @@ function MatrxDataTableCore({
8329
8393
  const sourceOwnsIntelligentSearch = sourceProcessing?.intelligentSearch === "source";
8330
8394
  const sourceOwnsSearch = remoteQuery?.mode === "controlled" || appendQuery !== null && sourceProcessing === void 0 || sourceProcessing?.search === "source" || sourceOwnsIntelligentSearch;
8331
8395
  const intelligentSearchEnabled = toolbar?.intelligentSearch !== void 0 && (sourceOwnsIntelligentSearch || remoteQuery === null && !sourceOwnsSearch);
8332
- const emitControlledQueryChange = (0, import_react17.useCallback)(
8396
+ const emitControlledQueryChange = (0, import_react18.useCallback)(
8333
8397
  (patch, options) => {
8334
8398
  if (!controlledQuery) return;
8335
8399
  controlledQuery.onStateChange(
@@ -8338,8 +8402,8 @@ function MatrxDataTableCore({
8338
8402
  },
8339
8403
  [controlledQuery]
8340
8404
  );
8341
- const [internalSearch, setInternalSearch] = (0, import_react17.useState)("");
8342
- const [draggedRowId, setDraggedRowId] = (0, import_react17.useState)(null);
8405
+ const [internalSearch, setInternalSearch] = (0, import_react18.useState)("");
8406
+ const [draggedRowId, setDraggedRowId] = (0, import_react18.useState)(null);
8343
8407
  const hierarchySensors = (0, import_core3.useSensors)(
8344
8408
  (0, import_core3.useSensor)(import_core3.PointerSensor, {
8345
8409
  activationConstraint: { distance: COLUMN_REORDER_ACTIVATION_DISTANCE }
@@ -8355,7 +8419,7 @@ function MatrxDataTableCore({
8355
8419
  }
8356
8420
  toolbar?.onSearchChange?.(v);
8357
8421
  };
8358
- const [internalSearchMatchMode, setInternalSearchMatchMode] = (0, import_react17.useState)(
8422
+ const [internalSearchMatchMode, setInternalSearchMatchMode] = (0, import_react18.useState)(
8359
8423
  toolbar?.searchMatch?.defaultMode ?? "contains"
8360
8424
  );
8361
8425
  const searchMatchMode = controlledQuery ? controlledQuery.state.searchMatchMode ?? toolbar?.searchMatch?.defaultMode ?? "contains" : internalSearchMatchMode;
@@ -8366,7 +8430,7 @@ function MatrxDataTableCore({
8366
8430
  }
8367
8431
  setInternalSearchMatchMode(mode);
8368
8432
  };
8369
- const [internalSearchScope, setInternalSearchScope] = (0, import_react17.useState)("all");
8433
+ const [internalSearchScope, setInternalSearchScope] = (0, import_react18.useState)("all");
8370
8434
  const searchScope = controlledQuery ? controlledQuery.state.searchScope ?? "all" : internalSearchScope;
8371
8435
  const setSearchScope = (scope) => {
8372
8436
  if (controlledQuery) {
@@ -8375,7 +8439,7 @@ function MatrxDataTableCore({
8375
8439
  }
8376
8440
  setInternalSearchScope(scope);
8377
8441
  };
8378
- const [internalAnyOf, setInternalAnyOf] = (0, import_react17.useState)("");
8442
+ const [internalAnyOf, setInternalAnyOf] = (0, import_react18.useState)("");
8379
8443
  const toolbarAnyOfControlled = toolbar?.anyOf?.value !== void 0;
8380
8444
  const anyOfValue = controlledQuery ? controlledQuery.state.anyOf : toolbarAnyOfControlled ? toolbar?.anyOf?.value ?? "" : internalAnyOf;
8381
8445
  const setAnyOfValue = (v) => {
@@ -8386,7 +8450,7 @@ function MatrxDataTableCore({
8386
8450
  }
8387
8451
  toolbar?.anyOf?.onChange?.(v);
8388
8452
  };
8389
- const [internalLayeredFilters, setInternalLayeredFilters] = (0, import_react17.useState)([]);
8453
+ const [internalLayeredFilters, setInternalLayeredFilters] = (0, import_react18.useState)([]);
8390
8454
  const layeredFilters = controlledQuery ? controlledQuery.state.layeredFilters ?? [] : internalLayeredFilters;
8391
8455
  const setLayeredFilters = (next) => {
8392
8456
  if (controlledQuery) {
@@ -8395,7 +8459,7 @@ function MatrxDataTableCore({
8395
8459
  }
8396
8460
  setInternalLayeredFilters(next);
8397
8461
  };
8398
- const [internalColumnFilters, setInternalColumnFilters] = (0, import_react17.useState)({});
8462
+ const [internalColumnFilters, setInternalColumnFilters] = (0, import_react18.useState)({});
8399
8463
  const columnFilters = controlledQuery ? controlledQuery.state.columnFilters : internalColumnFilters;
8400
8464
  const setColumnFilter = (id, next) => {
8401
8465
  const nextFilters = { ...columnFilters, [id]: next };
@@ -8408,7 +8472,7 @@ function MatrxDataTableCore({
8408
8472
  }
8409
8473
  setInternalColumnFilters(nextFilters);
8410
8474
  };
8411
- const [internalSort, setInternalSort] = (0, import_react17.useState)(defaultSort);
8475
+ const [internalSort, setInternalSort] = (0, import_react18.useState)(defaultSort);
8412
8476
  const sort = controlledQuery ? controlledQuery.state.sort : internalSort;
8413
8477
  const setSort = (next) => {
8414
8478
  if (controlledQuery) {
@@ -8417,7 +8481,7 @@ function MatrxDataTableCore({
8417
8481
  }
8418
8482
  setInternalSort(next);
8419
8483
  };
8420
- const [internalPage, setInternalPage] = (0, import_react17.useState)(1);
8484
+ const [internalPage, setInternalPage] = (0, import_react18.useState)(1);
8421
8485
  const page = controlledQuery ? controlledQuery.state.page : internalPage;
8422
8486
  const setPage = (next) => {
8423
8487
  if (controlledQuery) {
@@ -8426,7 +8490,7 @@ function MatrxDataTableCore({
8426
8490
  }
8427
8491
  setInternalPage(next);
8428
8492
  };
8429
- const [internalPageSize, setInternalPageSize] = (0, import_react17.useState)(
8493
+ const [internalPageSize, setInternalPageSize] = (0, import_react18.useState)(
8430
8494
  defaultPageSize === 0 ? Math.max(data.length, 1) : defaultPageSize
8431
8495
  );
8432
8496
  const pageSize = controlledQuery ? controlledQuery.state.pageSize : internalPageSize;
@@ -8437,26 +8501,26 @@ function MatrxDataTableCore({
8437
8501
  }
8438
8502
  setInternalPageSize(next);
8439
8503
  };
8440
- const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react17.useState)(null);
8504
+ const [uncontrolledSelectedId, setUncontrolledSelectedId] = (0, import_react18.useState)(null);
8441
8505
  const rawSelectedId = controlledSelectedId !== void 0 ? controlledSelectedId : uncontrolledSelectedId;
8442
8506
  const selectedId = appendSourceChanged ? null : rawSelectedId;
8443
8507
  const setSelectedId = (id) => {
8444
8508
  if (controlledSelectedId === void 0) setUncontrolledSelectedId(id);
8445
8509
  onSelectedIdChange?.(id);
8446
8510
  };
8447
- const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0, import_react17.useState)(null);
8511
+ const [uncontrolledWindowRowId, setUncontrolledWindowRowId] = (0, import_react18.useState)(null);
8448
8512
  const rawWindowRowId = controlledWindowRowId !== void 0 ? controlledWindowRowId : uncontrolledWindowRowId;
8449
8513
  const windowRowId = appendSourceChanged ? null : rawWindowRowId;
8450
8514
  const setWindowRowId = (id) => {
8451
8515
  if (controlledWindowRowId === void 0) setUncontrolledWindowRowId(id);
8452
8516
  onWindowRowIdChange?.(id);
8453
8517
  };
8454
- const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react17.useState)(null);
8518
+ const [windowRowSnapshot, setWindowRowSnapshot] = (0, import_react18.useState)(null);
8455
8519
  const editScopeKey = appendQueryKey === null ? "\0local" : `append:${appendQueryKey}`;
8456
- const [editsByScope, setEditsByScope] = (0, import_react17.useState)({});
8457
- const editRevisionRef = (0, import_react17.useRef)({});
8458
- const [savingByScope, setSavingByScope] = (0, import_react17.useState)({});
8459
- const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react17.useState)(false);
8520
+ const [editsByScope, setEditsByScope] = (0, import_react18.useState)({});
8521
+ const editRevisionRef = (0, import_react18.useRef)({});
8522
+ const [savingByScope, setSavingByScope] = (0, import_react18.useState)({});
8523
+ const [confirmForeignDraftDiscard, setConfirmForeignDraftDiscard] = (0, import_react18.useState)(false);
8460
8524
  const edits = editsByScope[editScopeKey]?.values ?? {};
8461
8525
  const saving = (savingByScope[editScopeKey] ?? 0) > 0;
8462
8526
  const setEdits = (next) => {
@@ -8523,7 +8587,7 @@ function MatrxDataTableCore({
8523
8587
  rows: Object.entries(draft.values).map(([rowId, columns2]) => ({ rowId, columns: columns2 }))
8524
8588
  }));
8525
8589
  const selection = appendSourceChanged && selectionConfig ? { ...selectionConfig, selectedIds: [] } : selectionConfig;
8526
- (0, import_react17.useEffect)(() => {
8590
+ (0, import_react18.useEffect)(() => {
8527
8591
  const previous = committedAppendQueryKey.current;
8528
8592
  committedAppendQueryKey.current = appendQueryKey;
8529
8593
  if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
@@ -8541,11 +8605,11 @@ function MatrxDataTableCore({
8541
8605
  onWindowRowIdChange,
8542
8606
  selectionConfig
8543
8607
  ]);
8544
- const scrollRef = (0, import_react17.useRef)(null);
8545
- const tableRef = (0, import_react17.useRef)(null);
8546
- const cardsScrollRef = (0, import_react17.useRef)(null);
8547
- const previousAppendKeyForScrollReset = (0, import_react17.useRef)(appendQueryKey);
8548
- (0, import_react17.useLayoutEffect)(() => {
8608
+ const scrollRef = (0, import_react18.useRef)(null);
8609
+ const tableRef = (0, import_react18.useRef)(null);
8610
+ const cardsScrollRef = (0, import_react18.useRef)(null);
8611
+ const previousAppendKeyForScrollReset = (0, import_react18.useRef)(appendQueryKey);
8612
+ (0, import_react18.useLayoutEffect)(() => {
8549
8613
  const previous = previousAppendKeyForScrollReset.current;
8550
8614
  previousAppendKeyForScrollReset.current = appendQueryKey;
8551
8615
  if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
@@ -8570,13 +8634,13 @@ function MatrxDataTableCore({
8570
8634
  ...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.thresholdPx !== void 0 ? { thresholdPx: appendScrollPolicy.thresholdPx } : {},
8571
8635
  ...appendScrollPolicy?.mode === "scroll" && appendScrollPolicy.intentTimeoutMs !== void 0 ? { intentTimeoutMs: appendScrollPolicy.intentTimeoutMs } : {}
8572
8636
  });
8573
- const rootRef = (0, import_react17.useRef)(null);
8637
+ const rootRef = (0, import_react18.useRef)(null);
8574
8638
  useClippedContentGuard(rootRef, {
8575
8639
  label: typeof copy === "object" && copy.listLabel ? `Table: ${copy.listLabel}` : "MatrxDataTable"
8576
8640
  });
8577
- const [scrollHintRight, setScrollHintRight] = (0, import_react17.useState)(false);
8578
- const [scrollHintLeft, setScrollHintLeft] = (0, import_react17.useState)(false);
8579
- const updateScrollHint = (0, import_react17.useCallback)(() => {
8641
+ const [scrollHintRight, setScrollHintRight] = (0, import_react18.useState)(false);
8642
+ const [scrollHintLeft, setScrollHintLeft] = (0, import_react18.useState)(false);
8643
+ const updateScrollHint = (0, import_react18.useCallback)(() => {
8580
8644
  const el = scrollRef.current;
8581
8645
  if (!el) return;
8582
8646
  setScrollHintRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 2);
@@ -8590,7 +8654,7 @@ function MatrxDataTableCore({
8590
8654
  behavior: "smooth"
8591
8655
  });
8592
8656
  };
8593
- (0, import_react17.useEffect)(() => {
8657
+ (0, import_react18.useEffect)(() => {
8594
8658
  updateScrollHint();
8595
8659
  window.addEventListener("resize", updateScrollHint);
8596
8660
  const el = scrollRef.current;
@@ -8605,30 +8669,30 @@ function MatrxDataTableCore({
8605
8669
  observer?.disconnect();
8606
8670
  };
8607
8671
  }, [updateScrollHint, data, columns]);
8608
- const [columnOrder, setColumnOrder] = (0, import_react17.useState)(() => columnState?.order ?? columns.map(columnId));
8609
- const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react17.useState)(
8672
+ const [columnOrder, setColumnOrder] = (0, import_react18.useState)(() => columnState?.order ?? columns.map(columnId));
8673
+ const [hiddenColumnIds, setHiddenColumnIds] = (0, import_react18.useState)(
8610
8674
  () => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
8611
8675
  );
8612
- const [columnWidths, setColumnWidths] = (0, import_react17.useState)(
8676
+ const [columnWidths, setColumnWidths] = (0, import_react18.useState)(
8613
8677
  () => normalizeColumnWidthsForColumns(columnState?.widths, columns)
8614
8678
  );
8615
- const [fixedTableGeometry, setFixedTableGeometry] = (0, import_react17.useState)(null);
8616
- const knownColumnIds = (0, import_react17.useRef)(new Set(columns.map(columnId)));
8617
- const draggedColumnId = (0, import_react17.useRef)(null);
8618
- const columnDragActive = (0, import_react17.useRef)(false);
8619
- const columnDragRaf = (0, import_react17.useRef)(null);
8620
- const columnDragScrollDirection = (0, import_react17.useRef)(0);
8621
- const [columnDragPreview, setColumnDragPreview] = (0, import_react17.useState)(null);
8622
- const stopColumnDragScroll = (0, import_react17.useCallback)(() => {
8679
+ const [fixedTableGeometry, setFixedTableGeometry] = (0, import_react18.useState)(null);
8680
+ const knownColumnIds = (0, import_react18.useRef)(new Set(columns.map(columnId)));
8681
+ const draggedColumnId = (0, import_react18.useRef)(null);
8682
+ const columnDragActive = (0, import_react18.useRef)(false);
8683
+ const columnDragRaf = (0, import_react18.useRef)(null);
8684
+ const columnDragScrollDirection = (0, import_react18.useRef)(0);
8685
+ const [columnDragPreview, setColumnDragPreview] = (0, import_react18.useState)(null);
8686
+ const stopColumnDragScroll = (0, import_react18.useCallback)(() => {
8623
8687
  if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
8624
8688
  columnDragRaf.current = null;
8625
8689
  columnDragScrollDirection.current = 0;
8626
8690
  }, []);
8627
- (0, import_react17.useEffect)(() => () => {
8691
+ (0, import_react18.useEffect)(() => () => {
8628
8692
  columnDragActive.current = false;
8629
8693
  stopColumnDragScroll();
8630
8694
  }, [stopColumnDragScroll]);
8631
- const startColumnDragScroll = (0, import_react17.useCallback)(() => {
8695
+ const startColumnDragScroll = (0, import_react18.useCallback)(() => {
8632
8696
  if (!columnDragActive.current || columnDragRaf.current !== null) return;
8633
8697
  const scrollStep = () => {
8634
8698
  const scroll = scrollRef.current;
@@ -8655,25 +8719,25 @@ function MatrxDataTableCore({
8655
8719
  };
8656
8720
  columnDragRaf.current = requestAnimationFrame(scrollStep);
8657
8721
  }, []);
8658
- const commitColumnState = (0, import_react17.useCallback)((order, hidden) => {
8722
+ const commitColumnState = (0, import_react18.useCallback)((order, hidden) => {
8659
8723
  if (columnState) columnState.onChange({ order, hidden: [...hidden] });
8660
8724
  else {
8661
8725
  setColumnOrder(order);
8662
8726
  setHiddenColumnIds(hidden);
8663
8727
  }
8664
8728
  }, [columnState]);
8665
- const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0, import_react17.useState)(false);
8729
+ const [internalColumnManagerOpen, setInternalColumnManagerOpen] = (0, import_react18.useState)(false);
8666
8730
  const columnManagerOpen = controlledColumnManager?.open ?? internalColumnManagerOpen;
8667
8731
  const setColumnManagerOpen = controlledColumnManager?.onOpenChange ?? setInternalColumnManagerOpen;
8668
- const columnIds = (0, import_react17.useMemo)(() => columns.map(columnId), [columns]);
8669
- const effectiveColumnOrder = (0, import_react17.useMemo)(() => columnState ? [...columnState.order.filter((id, index, values) => columnIds.includes(id) && values.indexOf(id) === index), ...columnIds.filter((id) => !columnState.order.includes(id))] : columnOrder, [columnIds, columnOrder, columnState]);
8670
- const effectiveHiddenColumnIds = (0, import_react17.useMemo)(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
8671
- const effectiveColumnWidths = (0, import_react17.useMemo)(
8732
+ const columnIds = (0, import_react18.useMemo)(() => columns.map(columnId), [columns]);
8733
+ const effectiveColumnOrder = (0, import_react18.useMemo)(() => columnState ? [...columnState.order.filter((id, index, values) => columnIds.includes(id) && values.indexOf(id) === index), ...columnIds.filter((id) => !columnState.order.includes(id))] : columnOrder, [columnIds, columnOrder, columnState]);
8734
+ const effectiveHiddenColumnIds = (0, import_react18.useMemo)(() => columnState ? new Set(columnState.hidden.filter((id) => columnIds.includes(id))) : hiddenColumnIds, [columnIds, columnState, hiddenColumnIds]);
8735
+ const effectiveColumnWidths = (0, import_react18.useMemo)(
8672
8736
  () => normalizeColumnWidthsForColumns(columnState?.widths ?? columnWidths, columns),
8673
8737
  [columns, columnState?.widths, columnWidths]
8674
8738
  );
8675
- const resizeGestureSnapshotRef = (0, import_react17.useRef)(null);
8676
- const measureVisibleColumnWidths = (0, import_react17.useCallback)(() => {
8739
+ const resizeGestureSnapshotRef = (0, import_react18.useRef)(null);
8740
+ const measureVisibleColumnWidths = (0, import_react18.useCallback)(() => {
8677
8741
  const measured = {};
8678
8742
  const headers = tableRef.current ? Array.from(tableRef.current.querySelectorAll(
8679
8743
  "thead th[data-matrx-table-column-id]"
@@ -8687,7 +8751,7 @@ function MatrxDataTableCore({
8687
8751
  }
8688
8752
  return normalizeColumnWidthsForColumns(measured, columns);
8689
8753
  }, [columns]);
8690
- const measureFixedTableGeometry = (0, import_react17.useCallback)(() => {
8754
+ const measureFixedTableGeometry = (0, import_react18.useCallback)(() => {
8691
8755
  const table = tableRef.current;
8692
8756
  const headers = table ? Array.from(table.querySelectorAll("thead th")) : [];
8693
8757
  const widthFor = (selector) => {
@@ -8717,16 +8781,16 @@ function MatrxDataTableCore({
8717
8781
  ...actionsWidth === void 0 ? {} : { actionsWidth }
8718
8782
  };
8719
8783
  }, [resolvedDensity]);
8720
- const captureResizeGestureSnapshot = (0, import_react17.useCallback)(() => {
8784
+ const captureResizeGestureSnapshot = (0, import_react18.useCallback)(() => {
8721
8785
  resizeGestureSnapshotRef.current = {
8722
8786
  widths: measureVisibleColumnWidths(),
8723
8787
  geometry: measureFixedTableGeometry()
8724
8788
  };
8725
8789
  }, [measureFixedTableGeometry, measureVisibleColumnWidths]);
8726
- const clearResizeGestureSnapshot = (0, import_react17.useCallback)(() => {
8790
+ const clearResizeGestureSnapshot = (0, import_react18.useCallback)(() => {
8727
8791
  resizeGestureSnapshotRef.current = null;
8728
8792
  }, []);
8729
- const commitColumnWidths = (0, import_react17.useCallback)((next, captureInitialWidths = false) => {
8793
+ const commitColumnWidths = (0, import_react18.useCallback)((next, captureInitialWidths = false) => {
8730
8794
  const gestureSnapshot = captureInitialWidths ? resizeGestureSnapshotRef.current : null;
8731
8795
  resizeGestureSnapshotRef.current = null;
8732
8796
  const normalized = normalizeColumnWidthsForColumns(
@@ -8745,7 +8809,7 @@ function MatrxDataTableCore({
8745
8809
  }
8746
8810
  setColumnWidths(normalized);
8747
8811
  }, [columnIds, columnState, columns, measureFixedTableGeometry, measureVisibleColumnWidths]);
8748
- (0, import_react17.useEffect)(() => {
8812
+ (0, import_react18.useEffect)(() => {
8749
8813
  const ids = columns.map(columnId);
8750
8814
  if (columnState) return;
8751
8815
  const previousIds = knownColumnIds.current;
@@ -8764,30 +8828,31 @@ function MatrxDataTableCore({
8764
8828
  setColumnWidths((current) => normalizeColumnWidthsForColumns(current, columns));
8765
8829
  knownColumnIds.current = new Set(ids);
8766
8830
  }, [columns, columnState]);
8767
- (0, import_react17.useLayoutEffect)(() => {
8831
+ (0, import_react18.useLayoutEffect)(() => {
8768
8832
  for (const id of columnIds) {
8769
8833
  tableRef.current?.style.removeProperty(columnResizeCssVar(id));
8770
8834
  }
8771
8835
  });
8772
- const previewColumnOrder = (0, import_react17.useMemo)(
8836
+ const previewColumnOrder = (0, import_react18.useMemo)(
8773
8837
  () => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
8774
8838
  [columnDragPreview, effectiveColumnOrder]
8775
8839
  );
8776
- const visibleColumns = (0, import_react17.useMemo)(() => {
8840
+ useColumnReorderAnimation(tableRef, previewColumnOrder.join("\0"), columnDragPreview !== null);
8841
+ const visibleColumns = (0, import_react18.useMemo)(() => {
8777
8842
  const byId = new Map(columns.map((column) => [columnId(column), column]));
8778
8843
  return previewColumnOrder.map((id) => byId.get(id)).filter(
8779
8844
  (column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
8780
8845
  );
8781
8846
  }, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
8782
8847
  const usesMeasuredFixedLayout = visibleColumns.length > 0 && visibleColumns.every((column) => effectiveColumnWidths[columnId(column)] !== void 0);
8783
- (0, import_react17.useLayoutEffect)(() => {
8848
+ (0, import_react18.useLayoutEffect)(() => {
8784
8849
  if (!usesMeasuredFixedLayout) {
8785
8850
  if (fixedTableGeometry !== null) setFixedTableGeometry(null);
8786
8851
  return;
8787
8852
  }
8788
8853
  if (fixedTableGeometry === null) setFixedTableGeometry(measureFixedTableGeometry());
8789
8854
  }, [fixedTableGeometry, measureFixedTableGeometry, usesMeasuredFixedLayout]);
8790
- (0, import_react17.useLayoutEffect)(() => {
8855
+ (0, import_react18.useLayoutEffect)(() => {
8791
8856
  if (!usesMeasuredFixedLayout) return;
8792
8857
  const table = tableRef.current;
8793
8858
  if (!table) return;
@@ -8809,14 +8874,14 @@ function MatrxDataTableCore({
8809
8874
  setFixedTableGeometry(geometry);
8810
8875
  }, [resolvedDensity, measureFixedTableGeometry, usesMeasuredFixedLayout]);
8811
8876
  const fixedLayoutActive = usesMeasuredFixedLayout && fixedTableGeometry !== null;
8812
- const declaredVisibleCopyColumns = (0, import_react17.useMemo)(
8877
+ const declaredVisibleCopyColumns = (0, import_react18.useMemo)(
8813
8878
  () => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
8814
8879
  [visibleColumns]
8815
8880
  );
8816
- const tableCopySourceNamespace = (0, import_react17.useId)();
8817
- const tableDndContextId = (0, import_react17.useId)();
8881
+ const tableCopySourceNamespace = (0, import_react18.useId)();
8882
+ const tableDndContextId = (0, import_react18.useId)();
8818
8883
  const defaultCopyTitle = toolbar?.title || "Table";
8819
- const defaultCopy = (0, import_react17.useMemo)(() => ({
8884
+ const defaultCopy = (0, import_react18.useMemo)(() => ({
8820
8885
  label: defaultCopyTitle,
8821
8886
  listLabel: defaultCopyTitle,
8822
8887
  location: defaultCopyTitle,
@@ -8851,7 +8916,7 @@ function MatrxDataTableCore({
8851
8916
  serializer: (shaped) => buildViewAgentInput(effectiveCopy, shaped, data, { scope: "custom" })
8852
8917
  }))
8853
8918
  ] : [];
8854
- const filterMeta = (0, import_react17.useMemo)(() => {
8919
+ const filterMeta = (0, import_react18.useMemo)(() => {
8855
8920
  const meta = /* @__PURE__ */ new Map();
8856
8921
  for (const col of visibleColumns) {
8857
8922
  const id = columnId(col);
@@ -8859,14 +8924,14 @@ function MatrxDataTableCore({
8859
8924
  }
8860
8925
  return meta;
8861
8926
  }, [visibleColumns, data, remoteQuery]);
8862
- const intelligentSearchScopes = (0, import_react17.useMemo)(
8927
+ const intelligentSearchScopes = (0, import_react18.useMemo)(
8863
8928
  () => resolveTableSearchScopes(data, columns, {
8864
8929
  ...toolbar?.intelligentSearch?.roles === void 0 ? {} : { roles: toolbar.intelligentSearch.roles },
8865
8930
  ...toolbar?.intelligentSearch?.scopes === void 0 ? {} : { scopes: toolbar.intelligentSearch.scopes }
8866
8931
  }),
8867
8932
  [columns, data, toolbar?.intelligentSearch?.roles, toolbar?.intelligentSearch?.scopes]
8868
8933
  );
8869
- const processed = (0, import_react17.useMemo)(() => {
8934
+ const processed = (0, import_react18.useMemo)(() => {
8870
8935
  if (remoteQuery && !appendUsesLocalProcessing) return data;
8871
8936
  if (processLocalRows) {
8872
8937
  return processLocalRows(data, {
@@ -8928,8 +8993,8 @@ function MatrxDataTableCore({
8928
8993
  intelligentSearchEnabled,
8929
8994
  searchScope
8930
8995
  ]);
8931
- const lastNotifiedViewRows = (0, import_react17.useRef)(null);
8932
- (0, import_react17.useEffect)(() => {
8996
+ const lastNotifiedViewRows = (0, import_react18.useRef)(null);
8997
+ (0, import_react18.useEffect)(() => {
8933
8998
  if (!onViewChange) {
8934
8999
  lastNotifiedViewRows.current = null;
8935
9000
  return;
@@ -8938,7 +9003,7 @@ function MatrxDataTableCore({
8938
9003
  lastNotifiedViewRows.current = processed;
8939
9004
  if (changed) onViewChange(processed);
8940
9005
  }, [processed, onViewChange]);
8941
- (0, import_react17.useEffect)(() => {
9006
+ (0, import_react18.useEffect)(() => {
8942
9007
  if (controlledQuery) return;
8943
9008
  setInternalPage(1);
8944
9009
  }, [
@@ -8977,7 +9042,7 @@ function MatrxDataTableCore({
8977
9042
  enabled: localProgressiveEnabled,
8978
9043
  onPageAdvance: setPage
8979
9044
  });
8980
- const paginated = (0, import_react17.useMemo)(() => {
9045
+ const paginated = (0, import_react18.useMemo)(() => {
8981
9046
  if (remoteQuery) return processed;
8982
9047
  if (hidePagination) return processed;
8983
9048
  if (localProgressiveEnabled) return [...progressiveRows.rows];
@@ -8985,15 +9050,15 @@ function MatrxDataTableCore({
8985
9050
  const start = (safePage - 1) * effectivePageSize;
8986
9051
  return processed.slice(start, start + effectivePageSize);
8987
9052
  }, [processed, safePage, effectivePageSize, pageSize, remoteQuery, hidePagination, localProgressiveEnabled, progressiveRows.rows]);
8988
- (0, import_react17.useEffect)(() => {
9053
+ (0, import_react18.useEffect)(() => {
8989
9054
  if (!controlledQuery || controlledQuery.state.page === safePage) return;
8990
9055
  emitControlledQueryChange({ page: safePage });
8991
9056
  }, [controlledQuery, emitControlledQueryChange, safePage]);
8992
- const selectedRow = (0, import_react17.useMemo)(() => {
9057
+ const selectedRow = (0, import_react18.useMemo)(() => {
8993
9058
  if (!selectedId) return null;
8994
9059
  return data.find((r) => getRowId(r) === selectedId) ?? null;
8995
9060
  }, [data, selectedId, getRowId]);
8996
- const windowRow = (0, import_react17.useMemo)(() => {
9061
+ const windowRow = (0, import_react18.useMemo)(() => {
8997
9062
  if (!windowRowId) return null;
8998
9063
  return data.find((r) => getRowId(r) === windowRowId) ?? (windowRowSnapshot && windowRowSnapshot.queryKey === appendQueryKey && getRowId(windowRowSnapshot.row) === windowRowId ? windowRowSnapshot.row : null);
8999
9064
  }, [data, windowRowId, windowRowSnapshot, getRowId, appendQueryKey]);
@@ -9012,7 +9077,7 @@ function MatrxDataTableCore({
9012
9077
  return def !== void 0 && f.value !== def;
9013
9078
  });
9014
9079
  const hasActiveFilters = activeFilterCount > 0 || Boolean(searchValue.trim()) || intelligentSearchEnabled && searchScope !== "all" || Boolean(anyOfValue.trim()) || completeLayeredFilterRules(layeredFilters).length > 0 || facetActive;
9015
- const changeCount = (0, import_react17.useMemo)(() => {
9080
+ const changeCount = (0, import_react18.useMemo)(() => {
9016
9081
  let n = 0;
9017
9082
  for (const fields of Object.values(edits)) {
9018
9083
  n += Object.keys(fields).length;
@@ -9114,7 +9179,7 @@ function MatrxDataTableCore({
9114
9179
  };
9115
9180
  const hierarchyRows = hierarchy?.rows ?? data;
9116
9181
  const hierarchyGetParentId = hierarchy?.getParentId;
9117
- const hierarchyIndex = (0, import_react17.useMemo)(() => {
9182
+ const hierarchyIndex = (0, import_react18.useMemo)(() => {
9118
9183
  if (!hierarchyGetParentId) return null;
9119
9184
  const byId = /* @__PURE__ */ new Map();
9120
9185
  const parentById = /* @__PURE__ */ new Map();
@@ -9146,7 +9211,7 @@ function MatrxDataTableCore({
9146
9211
  return { byId, parentById, depthById };
9147
9212
  }, [hierarchyGetParentId, hierarchyRows, getRowId]);
9148
9213
  const draggedRow = draggedRowId && hierarchyIndex ? hierarchyIndex.byId.get(draggedRowId) : void 0;
9149
- const hierarchyBlockedIds = (0, import_react17.useMemo)(() => {
9214
+ const hierarchyBlockedIds = (0, import_react18.useMemo)(() => {
9150
9215
  if (!draggedRowId || !hierarchyIndex) return null;
9151
9216
  const childrenById = /* @__PURE__ */ new Map();
9152
9217
  for (const [id, parentId] of hierarchyIndex.parentById) {
@@ -9326,7 +9391,7 @@ function MatrxDataTableCore({
9326
9391
  edit?.onCancel?.();
9327
9392
  };
9328
9393
  const showActionsCol = windowEnabled || Boolean(rowActions) || showRowCopy;
9329
- const selectedIdSet = (0, import_react17.useMemo)(
9394
+ const selectedIdSet = (0, import_react18.useMemo)(
9330
9395
  () => new Set(selection?.selectedIds ?? []),
9331
9396
  [selection?.selectedIds]
9332
9397
  );
@@ -9338,11 +9403,11 @@ function MatrxDataTableCore({
9338
9403
  );
9339
9404
  const allOnPageSelected = selectableRows.length > 0 && selectedOnPage.length === selectableRows.length;
9340
9405
  const someOnPageSelected = selectedOnPage.length > 0 && !allOnPageSelected;
9341
- const selectedRows = (0, import_react17.useMemo)(
9406
+ const selectedRows = (0, import_react18.useMemo)(
9342
9407
  () => data.filter((row) => selectedIdSet.has(getRowId(row))),
9343
9408
  [data, selectedIdSet, getRowId]
9344
9409
  );
9345
- const lastToggledIndex = (0, import_react17.useRef)(null);
9410
+ const lastToggledIndex = (0, import_react18.useRef)(null);
9346
9411
  const setSelectedIds = (next) => selection?.onSelectedIdsChange([...next]);
9347
9412
  const toggleRowSelected = (index, shiftKey) => {
9348
9413
  if (!selection) return;
@@ -9411,7 +9476,7 @@ function MatrxDataTableCore({
9411
9476
  }
9412
9477
  return href ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Link, { href, onClick: (event) => event.stopPropagation(), className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring", children: display }) : display;
9413
9478
  };
9414
- const currentViewSnapshot = (0, import_react17.useMemo)(
9479
+ const currentViewSnapshot = (0, import_react18.useMemo)(
9415
9480
  () => ({
9416
9481
  __kind: "matrx-table-view",
9417
9482
  version: 1,
@@ -9446,7 +9511,7 @@ function MatrxDataTableCore({
9446
9511
  sort
9447
9512
  ]
9448
9513
  );
9449
- const declaredDefaultViewSnapshot = (0, import_react17.useMemo)(
9514
+ const declaredDefaultViewSnapshot = (0, import_react18.useMemo)(
9450
9515
  () => defaultViewSnapshot ?? {
9451
9516
  __kind: "matrx-table-view",
9452
9517
  version: 1,
@@ -9465,7 +9530,7 @@ function MatrxDataTableCore({
9465
9530
  },
9466
9531
  [columns, defaultPageSize, defaultSort, defaultViewSnapshot]
9467
9532
  );
9468
- const applySavedView = (0, import_react17.useCallback)(
9533
+ const applySavedView = (0, import_react18.useCallback)(
9469
9534
  (rawSnapshot) => {
9470
9535
  const snapshot = parseTableViewSnapshot(rawSnapshot);
9471
9536
  if (!snapshot) {
@@ -9995,7 +10060,7 @@ function MatrxDataTableCore({
9995
10060
  const id = getRowId(row);
9996
10061
  const displayRow = applyRowEdits(row, edits[id]);
9997
10062
  const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
9998
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react17.Fragment, { children: mobileCards(displayRow, index, {
10063
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Fragment, { children: mobileCards(displayRow, index, {
9999
10064
  renderCell: (columnKey) => {
10000
10065
  const column = columns.find((candidate) => columnId(candidate) === columnKey);
10001
10066
  return column ? renderRecordCell(row, column, index) : null;
@@ -10346,6 +10411,7 @@ function MatrxDataTableCore({
10346
10411
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10347
10412
  "td",
10348
10413
  {
10414
+ "data-matrx-table-column-id": columnId(col),
10349
10415
  "data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
10350
10416
  className: cn(
10351
10417
  "py-1.5 align-middle lg:py-0.5",
@@ -10464,7 +10530,7 @@ function MatrxDataTableCore({
10464
10530
  children: wrappedRow
10465
10531
  },
10466
10532
  id
10467
- ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react17.Fragment, { children: wrappedRow }, id);
10533
+ ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react18.Fragment, { children: wrappedRow }, id);
10468
10534
  }),
10469
10535
  appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
10470
10536
  "td",
@@ -10958,7 +11024,7 @@ function HierarchyDragIndicatorLayer({
10958
11024
  scrollRef,
10959
11025
  resolve: resolve2
10960
11026
  }) {
10961
- const [indicator, setIndicator] = (0, import_react17.useState)(
11027
+ const [indicator, setIndicator] = (0, import_react18.useState)(
10962
11028
  null
10963
11029
  );
10964
11030
  (0, import_core3.useDndMonitor)({
@@ -11062,9 +11128,9 @@ function HierarchyDroppableRow({
11062
11128
  children
11063
11129
  }) {
11064
11130
  const { setNodeRef } = (0, import_core3.useDroppable)({ id, disabled });
11065
- if (!(0, import_react17.isValidElement)(children) || children.type !== "tr") return children;
11131
+ if (!(0, import_react18.isValidElement)(children) || children.type !== "tr") return children;
11066
11132
  const row = children;
11067
- return (0, import_react17.cloneElement)(row, {
11133
+ return (0, import_react18.cloneElement)(row, {
11068
11134
  ref: setNodeRef,
11069
11135
  className: row.props.className
11070
11136
  });
@@ -11104,7 +11170,7 @@ function columnWidthVar(width, resizedWidth, id, resizable) {
11104
11170
  };
11105
11171
  }
11106
11172
  function DefaultJsonCell({ value }) {
11107
- const [open, setOpen] = (0, import_react17.useState)(false);
11173
+ const [open, setOpen] = (0, import_react18.useState)(false);
11108
11174
  const host = useMatrxDataTableHost();
11109
11175
  const Viewer = host.JsonViewer;
11110
11176
  const text = JSON.stringify(value, null, 2);
@@ -11161,7 +11227,7 @@ function resolveStringTitle(title, fallback) {
11161
11227
  }
11162
11228
 
11163
11229
  // src/data-table/SavedViewsControl.tsx
11164
- var import_react18 = require("react");
11230
+ var import_react19 = require("react");
11165
11231
 
11166
11232
  // src/dropdown-menu.tsx
11167
11233
  var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
@@ -11304,11 +11370,11 @@ function SavedViewsControl({
11304
11370
  onUpdate,
11305
11371
  onReload
11306
11372
  }) {
11307
- const unsavedChangesId = (0, import_react18.useId)();
11308
- const [saveOpen, setSaveOpen] = (0, import_react18.useState)(false);
11309
- const [name, setName] = (0, import_react18.useState)("");
11310
- const [saving, setSaving] = (0, import_react18.useState)(false);
11311
- const [actionError, setActionError] = (0, import_react18.useState)(null);
11373
+ const unsavedChangesId = (0, import_react19.useId)();
11374
+ const [saveOpen, setSaveOpen] = (0, import_react19.useState)(false);
11375
+ const [name, setName] = (0, import_react19.useState)("");
11376
+ const [saving, setSaving] = (0, import_react19.useState)(false);
11377
+ const [actionError, setActionError] = (0, import_react19.useState)(null);
11312
11378
  const visibleError = actionError ?? error;
11313
11379
  const save = async () => {
11314
11380
  const next = name.trim();