@ai-matrx/design-system 0.18.9 → 0.18.10

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 (58) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/content-transfer.cjs +163 -202
  3. package/dist/content-transfer.cjs.map +1 -1
  4. package/dist/content-transfer.css +43 -30
  5. package/dist/content-transfer.d.cts +4 -0
  6. package/dist/content-transfer.d.ts +4 -0
  7. package/dist/content-transfer.js +225 -264
  8. package/dist/content-transfer.js.map +1 -1
  9. package/dist/data-table/copy-helpers.d.cts +1 -1
  10. package/dist/data-table/copy-helpers.d.ts +1 -1
  11. package/dist/data-table/data-row-inspector.cjs +163 -202
  12. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  13. package/dist/data-table/data-row-inspector.js +245 -284
  14. package/dist/data-table/data-row-inspector.js.map +1 -1
  15. package/dist/data-table/data-row-window.cjs +163 -202
  16. package/dist/data-table/data-row-window.cjs.map +1 -1
  17. package/dist/data-table/data-row-window.js +245 -284
  18. package/dist/data-table/data-row-window.js.map +1 -1
  19. package/dist/data-table/filter-engine.d.cts +1 -1
  20. package/dist/data-table/filter-engine.d.ts +1 -1
  21. package/dist/data-table/host.cjs.map +1 -1
  22. package/dist/data-table/host.d.cts +2 -0
  23. package/dist/data-table/host.d.ts +2 -0
  24. package/dist/data-table/host.js.map +1 -1
  25. package/dist/data-table/index.cjs +1192 -732
  26. package/dist/data-table/index.cjs.map +1 -1
  27. package/dist/data-table/index.d.cts +24 -3
  28. package/dist/data-table/index.d.ts +24 -3
  29. package/dist/data-table/index.js +1264 -804
  30. package/dist/data-table/index.js.map +1 -1
  31. package/dist/data-table/infer-filter.d.cts +1 -1
  32. package/dist/data-table/infer-filter.d.ts +1 -1
  33. package/dist/data-table/layered-filters.d.cts +1 -1
  34. package/dist/data-table/layered-filters.d.ts +1 -1
  35. package/dist/data-table/pagination.cjs +5 -5
  36. package/dist/data-table/pagination.cjs.map +1 -1
  37. package/dist/data-table/pagination.js +5 -5
  38. package/dist/data-table/pagination.js.map +1 -1
  39. package/dist/data-table/query-control.d.cts +1 -1
  40. package/dist/data-table/query-control.d.ts +1 -1
  41. package/dist/data-table/types.cjs.map +1 -1
  42. package/dist/data-table/types.d.cts +1 -1
  43. package/dist/data-table/types.d.ts +1 -1
  44. package/dist/data-table/url-state.d.cts +1 -1
  45. package/dist/data-table/url-state.d.ts +1 -1
  46. package/dist/data-table/uuid-cell.cjs.map +1 -1
  47. package/dist/data-table/uuid-cell.js.map +1 -1
  48. package/dist/data-table/xlsx.d.cts +1 -1
  49. package/dist/data-table/xlsx.d.ts +1 -1
  50. package/dist/index.cjs +5 -5
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.js +5 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/styles.css +4 -0
  55. package/dist/tokens.css +2 -0
  56. package/dist/{types-cH8oLqUx.d.ts → types-C2xN6W_q.d.ts} +46 -3
  57. package/dist/{types-0CNCWvdK.d.cts → types-D_tpuk6m.d.cts} +46 -3
  58. package/package.json +1 -1
@@ -763,7 +763,7 @@ var SelectContent = React6.forwardRef(
763
763
  {
764
764
  ref,
765
765
  className: cn(
766
- "relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
766
+ "relative z-[10001] max-h-96 min-w-[8rem] max-w-[calc(100vw-2rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
767
767
  animated && MOTION_POPPER,
768
768
  // The resting gap from the trigger. It is the `translate` property
769
769
  // (POPPER_OFFSET), never Tailwind translate utilities: those compose
@@ -781,7 +781,7 @@ var SelectContent = React6.forwardRef(
781
781
  SelectPrimitive.Viewport,
782
782
  {
783
783
  className: cn(
784
- "p-0.5 overflow-y-auto",
784
+ "max-w-full overflow-y-auto p-0.5",
785
785
  position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
786
786
  ),
787
787
  children
@@ -808,15 +808,15 @@ var SelectItem = React6.forwardRef(({ className, children, description, ...props
808
808
  {
809
809
  ref,
810
810
  className: cn(
811
- "relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
811
+ "relative flex w-full min-w-0 cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
812
812
  description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
813
813
  className
814
814
  ),
815
815
  ...props,
816
816
  children: [
817
817
  /* @__PURE__ */ jsx9("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx9(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx9(CheckIcon, { className: "h-4 w-4" }) }) }),
818
- /* @__PURE__ */ jsx9(SelectPrimitive.ItemText, { children }),
819
- description ? /* @__PURE__ */ jsx9("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
818
+ /* @__PURE__ */ jsx9("span", { className: "min-w-0 whitespace-normal break-words [overflow-wrap:anywhere]", children: /* @__PURE__ */ jsx9(SelectPrimitive.ItemText, { children }) }),
819
+ description ? /* @__PURE__ */ jsx9("span", { className: "block min-w-0 break-words text-xs leading-snug text-muted-foreground [overflow-wrap:anywhere]", children: description }) : null
820
820
  ]
821
821
  }
822
822
  ));
@@ -866,7 +866,7 @@ function TableTitleRow({
866
866
  {
867
867
  "data-matrx-table-toolbar": true,
868
868
  className: cn(
869
- "flex min-w-0 shrink-0 flex-wrap items-center gap-2",
869
+ "flex min-w-0 shrink-0 flex-wrap items-center gap-2 border-t border-border pt-2",
870
870
  className
871
871
  ),
872
872
  children: [
@@ -1899,137 +1899,50 @@ import {
1899
1899
  undoDraft
1900
1900
  } from "@ai-matrx/kit/content-transfer";
1901
1901
 
1902
- // src/dropdown-menu.tsx
1903
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
1902
+ // src/popover.tsx
1903
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
1904
1904
  import * as React12 from "react";
1905
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
1906
- var DropdownMenu = DropdownMenuPrimitive.Root;
1907
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
1908
- var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
1909
- var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
1910
- var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
1911
- var DropdownMenuSubTrigger = React12.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs13(
1912
- DropdownMenuPrimitive.SubTrigger,
1913
- {
1914
- ref,
1915
- "data-slot": "dropdown-menu-sub-trigger",
1916
- className: cn(
1917
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
1918
- inset && "pl-8",
1919
- className
1920
- ),
1921
- ...props,
1922
- children: [
1923
- children,
1924
- /* @__PURE__ */ jsx20(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
1925
- ]
1926
- }
1927
- ));
1928
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
1929
- var DropdownMenuSubContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
1930
- DropdownMenuPrimitive.SubContent,
1931
- {
1932
- ref,
1933
- "data-slot": "dropdown-menu-sub-content",
1934
- className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
1935
- ...props
1936
- }
1937
- ));
1938
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
1939
- var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
1940
- const portalContainer = usePortalContainer(container);
1941
- return /* @__PURE__ */ jsx20(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx20(
1942
- DropdownMenuPrimitive.Content,
1943
- {
1944
- ref,
1945
- "data-slot": "dropdown-menu-content",
1946
- sideOffset,
1947
- className: cn(
1948
- MENU_SURFACE_CLASS,
1949
- "shadow-md",
1950
- MOTION_POPPER,
1951
- className
1952
- ),
1953
- ...props
1954
- }
1955
- ) });
1956
- });
1957
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
1958
- var DropdownMenuItem = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx20(
1959
- DropdownMenuPrimitive.Item,
1960
- {
1961
- ref,
1962
- "data-slot": "dropdown-menu-item",
1963
- className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
1964
- ...props
1965
- }
1966
- ));
1967
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
1968
- var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(
1969
- DropdownMenuPrimitive.CheckboxItem,
1970
- {
1971
- ref,
1972
- "data-slot": "dropdown-menu-checkbox-item",
1973
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
1974
- ...props,
1975
- children: [
1976
- /* @__PURE__ */ jsx20("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx20(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx20(CheckIcon, { className: "h-4 w-4" }) }) }),
1977
- children
1978
- ]
1979
- }
1980
- ));
1981
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
1982
- var DropdownMenuRadioItem = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(
1983
- DropdownMenuPrimitive.RadioItem,
1984
- {
1985
- ref,
1986
- "data-slot": "dropdown-menu-radio-item",
1987
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
1988
- ...props,
1989
- children: [
1990
- /* @__PURE__ */ jsx20("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx20(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx20(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
1991
- children
1992
- ]
1993
- }
1994
- ));
1995
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
1996
- var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx20(
1997
- DropdownMenuPrimitive.Label,
1998
- {
1999
- ref,
2000
- "data-slot": "dropdown-menu-label",
2001
- className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
2002
- ...props
2003
- }
2004
- ));
2005
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
2006
- var DropdownMenuSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
2007
- DropdownMenuPrimitive.Separator,
2008
- {
2009
- ref,
2010
- "data-slot": "dropdown-menu-separator",
2011
- className: cn("-mx-1 my-1 h-px bg-muted", className),
2012
- ...props
2013
- }
2014
- ));
2015
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
2016
- var DropdownMenuShortcut = ({
2017
- className,
2018
- ...props
2019
- }) => /* @__PURE__ */ jsx20(
2020
- "span",
2021
- {
2022
- "data-slot": "dropdown-menu-shortcut",
2023
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
1905
+ import { jsx as jsx20 } from "react/jsx-runtime";
1906
+ var Popover = PopoverPrimitive.Root;
1907
+ var PopoverTrigger = PopoverPrimitive.Trigger;
1908
+ var PopoverContent = React12.forwardRef(
1909
+ ({
1910
+ className,
1911
+ align = "center",
1912
+ sideOffset = 4,
1913
+ container,
1914
+ animated = true,
2024
1915
  ...props
1916
+ }, ref) => {
1917
+ const portalContainer = usePortalContainer(container);
1918
+ return /* @__PURE__ */ jsx20(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx20(
1919
+ PopoverPrimitive.Content,
1920
+ {
1921
+ ref,
1922
+ align,
1923
+ sideOffset,
1924
+ className: cn(
1925
+ // Cap to the viewport space Radix measured and scroll — a popover taller
1926
+ // than the screen must never trap the user with unreachable content.
1927
+ // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
1928
+ // z, DOM portal order decides, so a dialog opened FROM a popover stacks
1929
+ // above it, and a popover opened from a dialog still stacks above the
1930
+ // dialog. z-[10001] buried dialogs behind fullscreen popovers.
1931
+ "z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
1932
+ animated && MOTION_POPPER,
1933
+ className
1934
+ ),
1935
+ ...props
1936
+ }
1937
+ ) });
2025
1938
  }
2026
1939
  );
2027
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
1940
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
2028
1941
 
2029
1942
  // src/content-transfer/index.tsx
2030
- import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
1943
+ import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
2031
1944
  function AlchemyGlyph(props) {
2032
- return /* @__PURE__ */ jsxs14("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
1945
+ return /* @__PURE__ */ jsxs13("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
2033
1946
  /* @__PURE__ */ jsx21("path", { d: "M4.5 5.5h8v11h-8z" }),
2034
1947
  /* @__PURE__ */ jsx21("path", { d: "M8.5 9.5h8v9h-8z" }),
2035
1948
  /* @__PURE__ */ jsx21("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
@@ -2039,14 +1952,61 @@ var CapabilityContext = React13.createContext({});
2039
1952
  var useContentTransferCapabilities = () => React13.useContext(CapabilityContext);
2040
1953
  var SurfaceContext = React13.createContext(null);
2041
1954
  function MenuPresentation({ label, hint, icon: Icon3 }) {
2042
- return /* @__PURE__ */ jsxs14(Fragment2, { children: [
1955
+ return /* @__PURE__ */ jsxs13(Fragment2, { children: [
2043
1956
  Icon3 ? /* @__PURE__ */ jsx21(Icon3, { className: "matrx-alchemy-menu-icon" }) : null,
2044
- /* @__PURE__ */ jsxs14("span", { children: [
1957
+ /* @__PURE__ */ jsxs13("span", { children: [
2045
1958
  label,
2046
1959
  hint ? /* @__PURE__ */ jsx21("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
2047
1960
  ] })
2048
1961
  ] });
2049
1962
  }
1963
+ function PaletteGlyph({ format, ai = false, file = false }) {
1964
+ if (ai) return /* @__PURE__ */ jsxs13("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: [
1965
+ /* @__PURE__ */ jsx21("path", { d: "M12 5a3 3 0 1 0-5.997.125A4 4 0 0 0 3.5 10.9a4 4 0 0 0 .556 6.588A4 4 0 0 0 12 19" }),
1966
+ /* @__PURE__ */ jsx21("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.503 5.775 4 4 0 0 1-.556 6.588A4 4 0 0 1 12 19" }),
1967
+ /* @__PURE__ */ jsx21("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
1968
+ ] });
1969
+ if (file) return /* @__PURE__ */ jsxs13("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: [
1970
+ /* @__PURE__ */ jsx21("path", { d: "M6 3h8l4 4v14H6z" }),
1971
+ /* @__PURE__ */ jsx21("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
1972
+ ] });
1973
+ const path2 = format === "json" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1974
+ /* @__PURE__ */ jsx21("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
1975
+ /* @__PURE__ */ jsx21("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
1976
+ ] }) : format === "compact-json" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1977
+ /* @__PURE__ */ jsx21("path", { d: "m14 10 7-7" }),
1978
+ /* @__PURE__ */ jsx21("path", { d: "M20 10h-6V4" }),
1979
+ /* @__PURE__ */ jsx21("path", { d: "m3 21 7-7" }),
1980
+ /* @__PURE__ */ jsx21("path", { d: "M4 14h6v6" })
1981
+ ] }) : format === "csv" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1982
+ /* @__PURE__ */ jsx21("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
1983
+ /* @__PURE__ */ jsx21("path", { d: "M4 10h16M10 4v16" })
1984
+ ] }) : format === "tsv" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1985
+ /* @__PURE__ */ jsx21("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1986
+ /* @__PURE__ */ jsx21("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
1987
+ ] }) : format === "xlsx" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1988
+ /* @__PURE__ */ jsx21("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1989
+ /* @__PURE__ */ jsx21("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
1990
+ ] }) : format === "markdown" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
1991
+ /* @__PURE__ */ jsx21("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
1992
+ /* @__PURE__ */ jsx21("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
1993
+ ] }) : format === "html" ? /* @__PURE__ */ jsx21(Fragment2, { children: /* @__PURE__ */ jsx21("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx21(Fragment2, { children: /* @__PURE__ */ jsx21("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
1994
+ return /* @__PURE__ */ jsx21("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: path2 });
1995
+ }
1996
+ function PaletteRows({ title, items, onRun, extra, ai = false }) {
1997
+ if (!items.length && !extra) return null;
1998
+ return /* @__PURE__ */ jsxs13("section", { className: "matrx-alchemy-palette-section", children: [
1999
+ /* @__PURE__ */ jsx21("h3", { children: title }),
2000
+ items.map((item) => /* @__PURE__ */ jsxs13("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
2001
+ item.icon ? /* @__PURE__ */ jsx21(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx21(PaletteGlyph, { ai }),
2002
+ /* @__PURE__ */ jsxs13("span", { children: [
2003
+ item.copyLabel ?? item.label,
2004
+ item.hint ? /* @__PURE__ */ jsx21("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
2005
+ ] })
2006
+ ] }, item.id)),
2007
+ extra
2008
+ ] });
2009
+ }
2050
2010
  var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
2051
2011
  var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
2052
2012
  var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
@@ -2135,7 +2095,7 @@ function ContentTransferMenu(props) {
2135
2095
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
2136
2096
  return /* @__PURE__ */ jsx21(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
2137
2097
  }
2138
- function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
2098
+ function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
2139
2099
  const triggerRef = React13.useRef(null);
2140
2100
  const inherited = React13.useContext(CapabilityContext);
2141
2101
  const nearestSurface = React13.useContext(SurfaceContext);
@@ -2148,6 +2108,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
2148
2108
  const workspaceCaptures = React13.useRef(/* @__PURE__ */ new Map());
2149
2109
  const externalWorkspaceKeys = React13.useRef(/* @__PURE__ */ new Set());
2150
2110
  const [notice, setNotice] = React13.useState(null);
2111
+ const [paletteOpen, setPaletteOpen] = React13.useState(false);
2112
+ const [mode, setMode] = React13.useState("copy");
2151
2113
  const scopes = React13.useMemo(() => table?.availableScopes ?? ["target"], [table]);
2152
2114
  const initialScope = table?.initialScope ?? "target";
2153
2115
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
@@ -2399,48 +2361,87 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
2399
2361
  }, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
2400
2362
  if (!enabled) return null;
2401
2363
  const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
2402
- const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section).map((v) => /* @__PURE__ */ jsx21(DropdownMenuItem, { "aria-label": v.ariaLabel, onSelect: () => void transfer("markdown", false, v), children: /* @__PURE__ */ jsx21(MenuPresentation, { ...v, label: v.copyLabel }) }, `copy:${v.id}`));
2403
- const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
2404
- const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
2405
- const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
2364
+ const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
2365
+ const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
2366
+ const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
2367
+ const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
2406
2368
  const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
2407
- return /* @__PURE__ */ jsxs14("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
2408
- /* @__PURE__ */ jsxs14(DropdownMenu, { onOpenChange: (open) => {
2409
- if (open) void preflight();
2369
+ const downloadActions = visibleActions.filter((action) => action.placement === "download");
2370
+ const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
2371
+ const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
2372
+ const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
2373
+ const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
2374
+ const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
2375
+ const closePalette = () => setPaletteOpen(false);
2376
+ const tile = (id, label2, onClick, options = {}) => {
2377
+ const presentation = options.action;
2378
+ const Icon3 = presentation?.icon;
2379
+ const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
2380
+ return /* @__PURE__ */ jsxs13("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
2381
+ closePalette();
2382
+ onClick();
2410
2383
  }, children: [
2411
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ jsx21(AlchemyGlyph, {}) }) }),
2412
- /* @__PURE__ */ jsxs14(DropdownMenuContent, { align: "end", className: "matrx-alchemy-menu", children: [
2413
- menuStatus === "loading" ? /* @__PURE__ */ jsx21(DropdownMenuItem, { disabled: true, children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx21(DropdownMenuItem, { disabled: true, children: menuStatus }) : null,
2414
- !hide.includes("copy") ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
2415
- /* @__PURE__ */ jsx21(DropdownMenuLabel, { children: "Copy" }),
2416
- quickVariants("copy"),
2417
- visibleCopies.map((format) => /* @__PURE__ */ jsx21(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
2418
- visibleAdapters.map((adapter) => /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
2419
- "Copy ",
2420
- adapter.label
2421
- ] }, adapter.id))
2422
- ] }) : null,
2423
- !hide.includes("prepare") ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
2424
- /* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
2425
- quickVariants("ai"),
2426
- /* @__PURE__ */ jsx21(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
2427
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx21(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
2428
- variants.map((variant) => /* @__PURE__ */ jsx21(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ jsx21(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
2384
+ Icon3 ? /* @__PURE__ */ jsx21(Icon3, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx21(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
2385
+ /* @__PURE__ */ jsxs13("span", { children: [
2386
+ label2,
2387
+ presentation?.hint ? /* @__PURE__ */ jsx21("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
2388
+ ] })
2389
+ ] }, id);
2390
+ };
2391
+ return /* @__PURE__ */ jsxs13("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
2392
+ /* @__PURE__ */ jsxs13(Popover, { open: paletteOpen, onOpenChange: (open) => {
2393
+ setPaletteOpen(open);
2394
+ if (open) {
2395
+ setMode("copy");
2396
+ void preflight();
2397
+ }
2398
+ }, children: [
2399
+ /* @__PURE__ */ jsx21(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ jsx21(AlchemyGlyph, {}) }) }),
2400
+ /* @__PURE__ */ jsxs13(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
2401
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
2402
+ /* @__PURE__ */ jsx21("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
2403
+ /* @__PURE__ */ jsx21("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
2429
2404
  ] }) : null,
2430
- !hide.includes("download") ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
2431
- /* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
2432
- /* @__PURE__ */ jsx21(DropdownMenuLabel, { children: "Download" }),
2433
- visibleDownloads.map((format) => /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => void transfer(format, true), children: [
2434
- "Download ",
2435
- LABEL[format]
2436
- ] }, format)),
2437
- visibleAdapters.map((adapter) => /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => void transfer(adapter, true), children: [
2438
- "Download ",
2439
- adapter.label
2440
- ] }, `download:${adapter.id}`))
2405
+ menuStatus === "loading" ? /* @__PURE__ */ jsx21("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx21("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
2406
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
2407
+ /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-palette-grid", children: [
2408
+ visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
2409
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
2410
+ ] }),
2411
+ quickVariants("copy").length ? /* @__PURE__ */ jsx21(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
2412
+ closePalette();
2413
+ void transfer("markdown", false, variant);
2414
+ } }) : null
2441
2415
  ] }) : null,
2442
- visibleActions.length ? /* @__PURE__ */ jsx21(DropdownMenuSeparator, {}) : null,
2443
- visibleActions.map((action) => /* @__PURE__ */ jsx21(DropdownMenuItem, { "aria-label": action.ariaLabel, onSelect: () => void runAction(action), children: /* @__PURE__ */ jsx21(MenuPresentation, { ...action, label: action.label }) }, action.id))
2416
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx21(Fragment2, { children: /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-palette-grid", children: [
2417
+ visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
2418
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
2419
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
2420
+ ] }) }) : null,
2421
+ prepareAvailable ? /* @__PURE__ */ jsx21(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
2422
+ closePalette();
2423
+ void transfer("markdown", false, variant);
2424
+ }, extra: /* @__PURE__ */ jsxs13("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
2425
+ closePalette();
2426
+ void openWorkspace();
2427
+ }, children: [
2428
+ /* @__PURE__ */ jsx21(PaletteGlyph, { ai: true }),
2429
+ /* @__PURE__ */ jsx21("span", { children: "Prepare for AI\u2026" })
2430
+ ] }) }) : null,
2431
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx21(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ jsxs13(Fragment2, { children: [
2432
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx21("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
2433
+ closePalette();
2434
+ void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
2435
+ }, children: /* @__PURE__ */ jsx21("span", { children: "Prepare this surface\u2026" }) }) : null,
2436
+ variants.map((variant) => /* @__PURE__ */ jsx21("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
2437
+ closePalette();
2438
+ void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
2439
+ }, children: /* @__PURE__ */ jsx21(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
2440
+ ] }) }) : null,
2441
+ ordinaryActions.length ? /* @__PURE__ */ jsx21(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ jsx21("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
2442
+ closePalette();
2443
+ void runAction(action);
2444
+ }, children: /* @__PURE__ */ jsx21(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
2444
2445
  ] })
2445
2446
  ] }),
2446
2447
  notice ? /* @__PURE__ */ jsx21("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
@@ -2703,31 +2704,31 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2703
2704
  const limitText = Object.entries(state.preferences.limits).filter(([, value]) => value != null).map(([key, value]) => `${key.replace(/^max/, "max ")} ${Number(value).toLocaleString()}`).join(" \xB7 ");
2704
2705
  return /* @__PURE__ */ jsx21(Dialog, { open, onOpenChange: (next) => {
2705
2706
  if (!next) close();
2706
- }, children: /* @__PURE__ */ jsxs14(DialogContent, { onCloseAutoFocus: (event) => {
2707
+ }, children: /* @__PURE__ */ jsxs13(DialogContent, { onCloseAutoFocus: (event) => {
2707
2708
  event.preventDefault();
2708
2709
  restoreFocus();
2709
2710
  }, className: "matrx-alchemy-workspace max-w-5xl", "aria-busy": busy !== null, children: [
2710
- /* @__PURE__ */ jsxs14(DialogHeader, { children: [
2711
- /* @__PURE__ */ jsxs14(DialogTitle, { children: [
2711
+ /* @__PURE__ */ jsxs13(DialogHeader, { children: [
2712
+ /* @__PURE__ */ jsxs13(DialogTitle, { children: [
2712
2713
  "Prepare ",
2713
2714
  state.snapshot.label
2714
2715
  ] }),
2715
- /* @__PURE__ */ jsxs14(DialogDescription, { children: [
2716
+ /* @__PURE__ */ jsxs13(DialogDescription, { children: [
2716
2717
  "Captured ",
2717
2718
  state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
2718
2719
  ". Your source is never edited."
2719
2720
  ] })
2720
2721
  ] }),
2721
- /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-workspace-grid", children: [
2722
- /* @__PURE__ */ jsxs14("section", { className: "matrx-alchemy-main", children: [
2723
- /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-toolbar", children: [
2724
- scopes.length > 1 ? /* @__PURE__ */ jsxs14("label", { children: [
2722
+ /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-workspace-grid", children: [
2723
+ /* @__PURE__ */ jsxs13("section", { className: "matrx-alchemy-main", children: [
2724
+ /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-toolbar", children: [
2725
+ scopes.length > 1 ? /* @__PURE__ */ jsxs13("label", { children: [
2725
2726
  "Scope",
2726
2727
  /* @__PURE__ */ jsx21("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx21("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
2727
2728
  ] }) : null,
2728
- /* @__PURE__ */ jsxs14("label", { children: [
2729
+ /* @__PURE__ */ jsxs13("label", { children: [
2729
2730
  "Detail",
2730
- /* @__PURE__ */ jsxs14("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
2731
+ /* @__PURE__ */ jsxs13("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
2731
2732
  /* @__PURE__ */ jsx21("option", { value: "full", children: "Full" }),
2732
2733
  /* @__PURE__ */ jsx21("option", { value: "compact", children: "Compact" }),
2733
2734
  /* @__PURE__ */ jsx21("option", { value: "brief", children: "Brief" }),
@@ -2753,24 +2754,24 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2753
2754
  }, children: "Reset" }),
2754
2755
  /* @__PURE__ */ jsx21(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
2755
2756
  ] }),
2756
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs14("fieldset", { className: "matrx-alchemy-options", children: [
2757
+ controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs13("fieldset", { className: "matrx-alchemy-options", children: [
2757
2758
  /* @__PURE__ */ jsx21("legend", { children: "JSON limits" }),
2758
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs14("label", { children: [
2759
+ [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs13("label", { children: [
2759
2760
  text,
2760
2761
  /* @__PURE__ */ jsx21("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
2761
2762
  ] }, key))
2762
2763
  ] }) : null,
2763
2764
  rows ? /* @__PURE__ */ jsx21(RowControls, { rows, controls, change: changeControls }) : null,
2764
- state.snapshot.sections.length ? /* @__PURE__ */ jsxs14("fieldset", { className: "matrx-alchemy-options", children: [
2765
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs13("fieldset", { className: "matrx-alchemy-options", children: [
2765
2766
  /* @__PURE__ */ jsx21("legend", { children: "Sections" }),
2766
- state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs14("label", { children: [
2767
+ state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs13("label", { children: [
2767
2768
  /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
2768
2769
  " ",
2769
2770
  section.label
2770
2771
  ] }, section.id))
2771
2772
  ] }) : null,
2772
- /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-coverage", children: [
2773
- /* @__PURE__ */ jsxs14("span", { children: [
2773
+ /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-coverage", children: [
2774
+ /* @__PURE__ */ jsxs13("span", { children: [
2774
2775
  state.snapshot.coverage.included.toLocaleString(),
2775
2776
  " included",
2776
2777
  state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
@@ -2778,16 +2779,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2778
2779
  state.snapshot.coverage.status
2779
2780
  ] }),
2780
2781
  state.snapshot.coverage.reason ? /* @__PURE__ */ jsx21("span", { children: state.snapshot.coverage.reason }) : null,
2781
- limitText ? /* @__PURE__ */ jsxs14("span", { children: [
2782
+ limitText ? /* @__PURE__ */ jsxs13("span", { children: [
2782
2783
  "Limits: ",
2783
2784
  limitText
2784
2785
  ] }) : null,
2785
- displayedOmissions.length ? /* @__PURE__ */ jsxs14("details", { children: [
2786
- /* @__PURE__ */ jsxs14("summary", { children: [
2786
+ displayedOmissions.length ? /* @__PURE__ */ jsxs13("details", { children: [
2787
+ /* @__PURE__ */ jsxs13("summary", { children: [
2787
2788
  displayedOmissions.length,
2788
2789
  " omissions or adjustments"
2789
2790
  ] }),
2790
- /* @__PURE__ */ jsx21("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs14("li", { children: [
2791
+ /* @__PURE__ */ jsx21("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs13("li", { children: [
2791
2792
  o.path || "/",
2792
2793
  ": ",
2793
2794
  o.reason,
@@ -2795,9 +2796,9 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2795
2796
  ] }, `${o.path}-${o.reason}-${i}`)) })
2796
2797
  ] }) : null
2797
2798
  ] }),
2798
- /* @__PURE__ */ jsxs14("label", { className: "matrx-alchemy-preview-label", children: [
2799
+ /* @__PURE__ */ jsxs13("label", { className: "matrx-alchemy-preview-label", children: [
2799
2800
  "Output format",
2800
- /* @__PURE__ */ jsxs14("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
2801
+ /* @__PURE__ */ jsxs13("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
2801
2802
  formats.map((f) => /* @__PURE__ */ jsx21("option", { value: f, children: LABEL[f] }, f)),
2802
2803
  state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx21("option", { value: "xlsx", children: "Excel workbook" }) : null,
2803
2804
  workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx21("option", { value: adapter.id, children: adapter.label }, adapter.id))
@@ -2813,9 +2814,9 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2813
2814
  setFormat("plain");
2814
2815
  }, children: "Use invalid JSON as plain text" }) : null
2815
2816
  ] }),
2816
- ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs14("aside", { children: [
2817
- ai ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
2818
- /* @__PURE__ */ jsxs14("label", { children: [
2817
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs13("aside", { children: [
2818
+ ai ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
2819
+ /* @__PURE__ */ jsxs13("label", { children: [
2819
2820
  "AI instruction",
2820
2821
  /* @__PURE__ */ jsx21("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
2821
2822
  ] }),
@@ -2832,20 +2833,20 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2832
2833
  state.error ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
2833
2834
  ] }) : null
2834
2835
  ] }),
2835
- pendingControls ? /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2836
+ pendingControls ? /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2836
2837
  /* @__PURE__ */ jsx21("p", { children: "This control would replace your manual edit." }),
2837
2838
  /* @__PURE__ */ jsx21(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
2838
2839
  /* @__PURE__ */ jsx21(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
2839
2840
  ] }) : null,
2840
2841
  state.sourceStale ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
2841
- state.pending ? /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2842
+ state.pending ? /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2842
2843
  /* @__PURE__ */ jsx21("p", { children: "A fresh source snapshot is ready." }),
2843
2844
  /* @__PURE__ */ jsx21(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
2844
2845
  /* @__PURE__ */ jsx21(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
2845
2846
  ] }) : null,
2846
2847
  deliveryNotice ? /* @__PURE__ */ jsx21("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
2847
- /* @__PURE__ */ jsxs14(DialogFooter, { children: [
2848
- /* @__PURE__ */ jsxs14("span", { className: "matrx-alchemy-meta", children: [
2848
+ /* @__PURE__ */ jsxs13(DialogFooter, { children: [
2849
+ /* @__PURE__ */ jsxs13("span", { className: "matrx-alchemy-meta", children: [
2849
2850
  buffer.length.toLocaleString(),
2850
2851
  " characters \xB7 ~",
2851
2852
  estimateTokens(buffer).toLocaleString(),
@@ -2858,35 +2859,35 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
2858
2859
  ] }) });
2859
2860
  }
2860
2861
  function RowControls({ rows, controls, change }) {
2861
- return /* @__PURE__ */ jsxs14(Fragment2, { children: [
2862
- /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-toolbar", children: [
2863
- /* @__PURE__ */ jsxs14("label", { children: [
2862
+ return /* @__PURE__ */ jsxs13(Fragment2, { children: [
2863
+ /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-toolbar", children: [
2864
+ /* @__PURE__ */ jsxs13("label", { children: [
2864
2865
  "Search",
2865
2866
  /* @__PURE__ */ jsx21("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
2866
2867
  ] }),
2867
- /* @__PURE__ */ jsxs14("label", { children: [
2868
+ /* @__PURE__ */ jsxs13("label", { children: [
2868
2869
  "Sort",
2869
- /* @__PURE__ */ jsxs14("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
2870
+ /* @__PURE__ */ jsxs13("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
2870
2871
  /* @__PURE__ */ jsx21("option", { value: "", children: "None" }),
2871
2872
  rows.columns.map((column) => /* @__PURE__ */ jsx21("option", { value: column.id, children: column.label }, column.id))
2872
2873
  ] })
2873
2874
  ] }),
2874
- /* @__PURE__ */ jsxs14("label", { children: [
2875
+ /* @__PURE__ */ jsxs13("label", { children: [
2875
2876
  "Direction",
2876
- /* @__PURE__ */ jsxs14("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
2877
+ /* @__PURE__ */ jsxs13("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
2877
2878
  /* @__PURE__ */ jsx21("option", { value: "asc", children: "Ascending" }),
2878
2879
  /* @__PURE__ */ jsx21("option", { value: "desc", children: "Descending" })
2879
2880
  ] })
2880
2881
  ] }),
2881
- /* @__PURE__ */ jsxs14("label", { children: [
2882
+ /* @__PURE__ */ jsxs13("label", { children: [
2882
2883
  "Top rows",
2883
2884
  /* @__PURE__ */ jsx21("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
2884
2885
  ] })
2885
2886
  ] }),
2886
- /* @__PURE__ */ jsxs14("fieldset", { className: "matrx-alchemy-options", children: [
2887
+ /* @__PURE__ */ jsxs13("fieldset", { className: "matrx-alchemy-options", children: [
2887
2888
  /* @__PURE__ */ jsx21("legend", { children: "Columns and filters" }),
2888
- rows.columns.map((column) => /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-column", children: [
2889
- /* @__PURE__ */ jsxs14("label", { children: [
2889
+ rows.columns.map((column) => /* @__PURE__ */ jsxs13("div", { className: "matrx-alchemy-column", children: [
2890
+ /* @__PURE__ */ jsxs13("label", { children: [
2890
2891
  /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: controls.visibleColumns.includes(column.id), onChange: (e) => change({ ...controls, visibleColumns: e.target.checked ? [...controls.visibleColumns, column.id] : controls.visibleColumns.filter((id) => id !== column.id) }) }),
2891
2892
  " ",
2892
2893
  column.label
@@ -2894,15 +2895,15 @@ function RowControls({ rows, controls, change }) {
2894
2895
  /* @__PURE__ */ jsx21("input", { "aria-label": `Filter ${column.label}`, placeholder: "Filter", value: controls.filters[column.id] ?? "", onChange: (e) => change({ ...controls, filters: { ...controls.filters, [column.id]: e.target.value } }) })
2895
2896
  ] }, column.id))
2896
2897
  ] }),
2897
- /* @__PURE__ */ jsxs14("fieldset", { className: "matrx-alchemy-options", children: [
2898
+ /* @__PURE__ */ jsxs13("fieldset", { className: "matrx-alchemy-options", children: [
2898
2899
  /* @__PURE__ */ jsx21("legend", { children: "Rows" }),
2899
- /* @__PURE__ */ jsxs14("label", { children: [
2900
+ /* @__PURE__ */ jsxs13("label", { children: [
2900
2901
  /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
2901
2902
  " Only selected rows"
2902
2903
  ] }),
2903
2904
  /* @__PURE__ */ jsx21("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
2904
2905
  const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
2905
- return /* @__PURE__ */ jsxs14("label", { children: [
2906
+ return /* @__PURE__ */ jsxs13("label", { children: [
2906
2907
  /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
2907
2908
  " Row ",
2908
2909
  index + 1,
@@ -2914,7 +2915,7 @@ function RowControls({ rows, controls, change }) {
2914
2915
  }
2915
2916
 
2916
2917
  // src/content-transfer/matrx-copy.tsx
2917
- import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
2918
+ import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
2918
2919
  var resolve = (value) => typeof value === "function" ? value() : value;
2919
2920
  var asPayload = (value) => ({
2920
2921
  kind: "markdown",
@@ -3085,6 +3086,7 @@ function MatrxCopyMenuSession(props) {
3085
3086
  label: item.label,
3086
3087
  supports: () => true,
3087
3088
  ...item.build && !item.onSelect ? {
3089
+ placement: "download",
3088
3090
  source: make(
3089
3091
  `export:${item.id}`,
3090
3092
  async () => {
@@ -3156,7 +3158,7 @@ function MatrxCopyMenuSession(props) {
3156
3158
  const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
3157
3159
  if (!source && !actions.length) return null;
3158
3160
  const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
3159
- return /* @__PURE__ */ jsxs15(Fragment3, { children: [
3161
+ return /* @__PURE__ */ jsxs14(Fragment3, { children: [
3160
3162
  /* @__PURE__ */ jsx22(
3161
3163
  ContentTransferMenu,
3162
3164
  {
@@ -3165,10 +3167,11 @@ function MatrxCopyMenuSession(props) {
3165
3167
  label: props.label,
3166
3168
  variants,
3167
3169
  actions,
3170
+ sourceFormats: Boolean(source),
3168
3171
  hide: [
3169
3172
  ...!copyVisible || !source ? ["copy"] : [],
3170
3173
  ...!aiVisible || !source ? ["prepare"] : [],
3171
- ...!exportVisible || !source ? ["download"] : []
3174
+ ...!exportVisible ? ["download"] : []
3172
3175
  ],
3173
3176
  formatSources: {
3174
3177
  ...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
@@ -3277,7 +3280,7 @@ function SourceConfiguration({
3277
3280
  onOpenChange: (open) => {
3278
3281
  if (!open && !busy) onClose();
3279
3282
  },
3280
- children: /* @__PURE__ */ jsxs15(
3283
+ children: /* @__PURE__ */ jsxs14(
3281
3284
  DialogContent,
3282
3285
  {
3283
3286
  onCloseAutoFocus: (event) => {
@@ -3286,12 +3289,12 @@ function SourceConfiguration({
3286
3289
  },
3287
3290
  className: "matrx-alchemy-workspace",
3288
3291
  children: [
3289
- /* @__PURE__ */ jsxs15(DialogHeader, { children: [
3292
+ /* @__PURE__ */ jsxs14(DialogHeader, { children: [
3290
3293
  /* @__PURE__ */ jsx22(DialogTitle, { children: title }),
3291
3294
  /* @__PURE__ */ jsx22(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
3292
3295
  ] }),
3293
- /* @__PURE__ */ jsxs15("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
3294
- custom?.options.map((option) => /* @__PURE__ */ jsxs15("label", { children: [
3296
+ /* @__PURE__ */ jsxs14("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
3297
+ custom?.options.map((option) => /* @__PURE__ */ jsxs14("label", { children: [
3295
3298
  option.label,
3296
3299
  "hint" in option && option.hint ? /* @__PURE__ */ jsx22("small", { children: option.hint }) : null,
3297
3300
  option.kind === "toggle" ? /* @__PURE__ */ jsx22(
@@ -3311,7 +3314,7 @@ function SourceConfiguration({
3311
3314
  }),
3312
3315
  children: option.options.map((choice) => /* @__PURE__ */ jsx22("option", { value: choice.value, children: choice.label }, choice.value))
3313
3316
  }
3314
- ) : option.kind === "slider" ? /* @__PURE__ */ jsxs15(Fragment3, { children: [
3317
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
3315
3318
  /* @__PURE__ */ jsx22(
3316
3319
  "input",
3317
3320
  {
@@ -3327,7 +3330,7 @@ function SourceConfiguration({
3327
3330
  }
3328
3331
  ),
3329
3332
  /* @__PURE__ */ jsx22("span", { children: option.formatValue(Number(values[option.key])) })
3330
- ] }) : /* @__PURE__ */ jsxs15(Fragment3, { children: [
3333
+ ] }) : /* @__PURE__ */ jsxs14(Fragment3, { children: [
3331
3334
  /* @__PURE__ */ jsx22(
3332
3335
  "input",
3333
3336
  {
@@ -3353,7 +3356,7 @@ function SourceConfiguration({
3353
3356
  ))
3354
3357
  ] })
3355
3358
  ] }, option.key)),
3356
- groomer ? /* @__PURE__ */ jsxs15(Fragment3, { children: [
3359
+ groomer ? /* @__PURE__ */ jsxs14(Fragment3, { children: [
3357
3360
  /* @__PURE__ */ jsx22("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx22(
3358
3361
  Button,
3359
3362
  {
@@ -3371,9 +3374,9 @@ function SourceConfiguration({
3371
3374
  },
3372
3375
  level
3373
3376
  )) }),
3374
- groomer.sections.map((section) => /* @__PURE__ */ jsxs15("label", { children: [
3377
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs14("label", { children: [
3375
3378
  section.title,
3376
- /* @__PURE__ */ jsxs15(
3379
+ /* @__PURE__ */ jsxs14(
3377
3380
  "select",
3378
3381
  {
3379
3382
  value: sections[section.id],
@@ -3391,7 +3394,7 @@ function SourceConfiguration({
3391
3394
  ] }, section.id))
3392
3395
  ] }) : null
3393
3396
  ] }),
3394
- /* @__PURE__ */ jsxs15("p", { children: [
3397
+ /* @__PURE__ */ jsxs14("p", { children: [
3395
3398
  text.length.toLocaleString(),
3396
3399
  " characters \xB7 approximately",
3397
3400
  " ",
@@ -3399,7 +3402,7 @@ function SourceConfiguration({
3399
3402
  " tokens"
3400
3403
  ] }),
3401
3404
  error || buildError ? /* @__PURE__ */ jsx22("p", { role: "alert", children: error ?? buildError }) : null,
3402
- /* @__PURE__ */ jsxs15(DialogFooter, { children: [
3405
+ /* @__PURE__ */ jsxs14(DialogFooter, { children: [
3403
3406
  /* @__PURE__ */ jsx22(
3404
3407
  Button,
3405
3408
  {
@@ -3963,7 +3966,7 @@ function buildViewHuman(config, visible, columns) {
3963
3966
  }
3964
3967
 
3965
3968
  // src/data-table/CopySubset.tsx
3966
- import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
3969
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
3967
3970
  function CopySubsetDialog({ source, onClose }) {
3968
3971
  const [rows] = useState7(() => [...source.rows]);
3969
3972
  const [hidden, setHidden] = useState7(() => new Set(source.columns.filter((c) => c.hidden).map((c) => c.id)));
@@ -3986,11 +3989,11 @@ function CopySubsetDialog({ source, onClose }) {
3986
3989
  }
3987
3990
  return /* @__PURE__ */ jsx24(Dialog, { open: true, onOpenChange: (open) => {
3988
3991
  if (!open) onClose();
3989
- }, children: /* @__PURE__ */ jsxs16(DialogContent, { className: "flex h-[80dvh] max-w-5xl flex-col overflow-hidden", children: [
3992
+ }, children: /* @__PURE__ */ jsxs15(DialogContent, { className: "flex h-[80dvh] max-w-5xl flex-col overflow-hidden", children: [
3990
3993
  /* @__PURE__ */ jsx24(DialogHeader, { children: /* @__PURE__ */ jsx24(DialogTitle, { children: "Filter & sort before copying" }) }),
3991
- /* @__PURE__ */ jsxs16("fieldset", { className: "max-h-24 shrink-0 overflow-auto text-xs", children: [
3994
+ /* @__PURE__ */ jsxs15("fieldset", { className: "max-h-24 shrink-0 overflow-auto text-xs", children: [
3992
3995
  /* @__PURE__ */ jsx24("legend", { children: "Visible columns" }),
3993
- source.columns.map((column) => /* @__PURE__ */ jsxs16("label", { className: "mr-3 inline-flex items-center gap-1", children: [
3996
+ source.columns.map((column) => /* @__PURE__ */ jsxs15("label", { className: "mr-3 inline-flex items-center gap-1", children: [
3994
3997
  /* @__PURE__ */ jsx24("input", { type: "checkbox", checked: !hidden.has(column.id), onChange: () => setHidden((current) => {
3995
3998
  const next = new Set(current);
3996
3999
  next.has(column.id) ? next.delete(column.id) : next.add(column.id);
@@ -4002,17 +4005,17 @@ function CopySubsetDialog({ source, onClose }) {
4002
4005
  columns.length ? /* @__PURE__ */ jsx24("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsx24(MatrxDataTable, { data: rows, columns, getRowId: source.getRowId, query: { mode: "controlled-local", state: query, onStateChange: setQuery }, selection: { selectedIds, onSelectedIdsChange: setSelectedIds }, detail: { enabled: false }, window: { enabled: false }, toolbar: { searchMatch: {} } }) }) : /* @__PURE__ */ jsx24("p", { children: "Show at least one column to copy." }),
4003
4006
  buildError ? /* @__PURE__ */ jsx24("p", { role: "alert", className: "text-destructive", children: buildError }) : null,
4004
4007
  notice,
4005
- /* @__PURE__ */ jsxs16(DialogFooter, { children: [
4006
- /* @__PURE__ */ jsxs16("label", { className: "flex items-center gap-2 text-sm", children: [
4008
+ /* @__PURE__ */ jsxs15(DialogFooter, { children: [
4009
+ /* @__PURE__ */ jsxs15("label", { className: "flex items-center gap-2 text-sm", children: [
4007
4010
  "Format",
4008
- /* @__PURE__ */ jsxs16("select", { "aria-label": "Copy format", value: format, onChange: (event) => setFormat(event.target.value), children: [
4011
+ /* @__PURE__ */ jsxs15("select", { "aria-label": "Copy format", value: format, onChange: (event) => setFormat(event.target.value), children: [
4009
4012
  /* @__PURE__ */ jsx24("option", { value: "ai", children: "For AI" }),
4010
4013
  /* @__PURE__ */ jsx24("option", { value: "markdown", children: "Markdown" }),
4011
4014
  /* @__PURE__ */ jsx24("option", { value: "csv", children: "CSV" }),
4012
4015
  /* @__PURE__ */ jsx24("option", { value: "json", children: "JSON" })
4013
4016
  ] })
4014
4017
  ] }),
4015
- /* @__PURE__ */ jsxs16("span", { role: "status", className: "text-xs", children: [
4018
+ /* @__PURE__ */ jsxs15("span", { role: "status", className: "text-xs", children: [
4016
4019
  shaped.length,
4017
4020
  " of ",
4018
4021
  rows.length,
@@ -4233,59 +4236,19 @@ import {
4233
4236
 
4234
4237
  // src/data-table/ColumnHeaderCell.tsx
4235
4238
  import {
4236
- forwardRef as forwardRef12,
4239
+ forwardRef as forwardRef11,
4237
4240
  useEffect as useEffect6,
4238
4241
  useMemo as useMemo3,
4239
4242
  useState as useState9
4240
4243
  } from "react";
4241
4244
  import { useDraggable } from "@dnd-kit/core";
4242
4245
 
4243
- // src/popover.tsx
4244
- import * as PopoverPrimitive from "@radix-ui/react-popover";
4245
- import * as React15 from "react";
4246
- import { jsx as jsx25 } from "react/jsx-runtime";
4247
- var Popover = PopoverPrimitive.Root;
4248
- var PopoverTrigger = PopoverPrimitive.Trigger;
4249
- var PopoverContent = React15.forwardRef(
4250
- ({
4251
- className,
4252
- align = "center",
4253
- sideOffset = 4,
4254
- container,
4255
- animated = true,
4256
- ...props
4257
- }, ref) => {
4258
- const portalContainer = usePortalContainer(container);
4259
- return /* @__PURE__ */ jsx25(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx25(
4260
- PopoverPrimitive.Content,
4261
- {
4262
- ref,
4263
- align,
4264
- sideOffset,
4265
- className: cn(
4266
- // Cap to the viewport space Radix measured and scroll — a popover taller
4267
- // than the screen must never trap the user with unreachable content.
4268
- // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
4269
- // z, DOM portal order decides, so a dialog opened FROM a popover stacks
4270
- // above it, and a popover opened from a dialog still stacks above the
4271
- // dialog. z-[10001] buried dialogs behind fullscreen popovers.
4272
- "z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
4273
- animated && MOTION_POPPER,
4274
- className
4275
- ),
4276
- ...props
4277
- }
4278
- ) });
4279
- }
4280
- );
4281
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
4282
-
4283
4246
  // src/command.tsx
4284
4247
  import * as DialogPrimitive2 from "@radix-ui/react-dialog";
4285
4248
  import { Command as CommandPrimitive } from "cmdk";
4286
- import * as React16 from "react";
4287
- import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
4288
- var Command = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
4249
+ import * as React15 from "react";
4250
+ import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
4251
+ var Command = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4289
4252
  CommandPrimitive,
4290
4253
  {
4291
4254
  ref,
@@ -4300,12 +4263,12 @@ Command.displayName = CommandPrimitive.displayName;
4300
4263
  var DIALOG_DESKTOP_CLASSES2 = `fixed left-[50%] top-[50%] z-[10000] grid min-w-0 w-full max-w-lg ${CENTERED_DIALOG} gap-4 overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg`;
4301
4264
  var DIALOG_MOBILE_SHEET_CLASSES2 = "fixed inset-x-0 bottom-0 left-0 right-0 top-auto z-[10000] flex min-w-0 flex-col w-full max-w-full max-h-[90dvh] translate-x-0 translate-y-0 gap-4 overflow-x-clip border-t bg-background p-4 pb-safe shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full rounded-t-2xl rounded-b-none overflow-y-auto overscroll-contain";
4302
4265
  var DIALOG_MOBILE_SHEET_OVERRIDE2 = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-x-0 translate-y-0 w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
4303
- var CommandDialogContent = React16.forwardRef(({ className, children, container, ...props }, ref) => {
4266
+ var CommandDialogContent = React15.forwardRef(({ className, children, container, ...props }, ref) => {
4304
4267
  const isMobile = useIsMobile();
4305
4268
  const isModal = useRadixDialogModal();
4306
4269
  const portalContainer = usePortalContainer(container);
4307
- return /* @__PURE__ */ jsxs17(DialogPrimitive2.Portal, { container: portalContainer, children: [
4308
- isModal ? /* @__PURE__ */ jsx26(
4270
+ return /* @__PURE__ */ jsxs16(DialogPrimitive2.Portal, { container: portalContainer, children: [
4271
+ isModal ? /* @__PURE__ */ jsx25(
4309
4272
  DialogPrimitive2.Overlay,
4310
4273
  {
4311
4274
  className: cn(
@@ -4314,7 +4277,7 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
4314
4277
  )
4315
4278
  }
4316
4279
  ) : null,
4317
- /* @__PURE__ */ jsxs17(
4280
+ /* @__PURE__ */ jsxs16(
4318
4281
  DialogPrimitive2.Content,
4319
4282
  {
4320
4283
  ref,
@@ -4330,9 +4293,9 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
4330
4293
  ...props,
4331
4294
  children: [
4332
4295
  children,
4333
- /* @__PURE__ */ jsxs17(DialogPrimitive2.Close, { className: "absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4", children: [
4334
- /* @__PURE__ */ jsx26(XIcon, { className: "h-4 w-4" }),
4335
- /* @__PURE__ */ jsx26("span", { className: "sr-only", children: "Close" })
4296
+ /* @__PURE__ */ jsxs16(DialogPrimitive2.Close, { className: "absolute right-2 top-4 flex h-10 w-10 items-center justify-center rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground sm:right-4", children: [
4297
+ /* @__PURE__ */ jsx25(XIcon, { className: "h-4 w-4" }),
4298
+ /* @__PURE__ */ jsx25("span", { className: "sr-only", children: "Close" })
4336
4299
  ] })
4337
4300
  ]
4338
4301
  }
@@ -4340,9 +4303,9 @@ var CommandDialogContent = React16.forwardRef(({ className, children, container,
4340
4303
  ] });
4341
4304
  });
4342
4305
  CommandDialogContent.displayName = "CommandDialogContent";
4343
- var CommandInput = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs17("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
4344
- /* @__PURE__ */ jsx26(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
4345
- /* @__PURE__ */ jsx26(
4306
+ var CommandInput = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs16("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
4307
+ /* @__PURE__ */ jsx25(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
4308
+ /* @__PURE__ */ jsx25(
4346
4309
  CommandPrimitive.Input,
4347
4310
  {
4348
4311
  ref,
@@ -4355,7 +4318,7 @@ var CommandInput = React16.forwardRef(({ className, ...props }, ref) => /* @__PU
4355
4318
  )
4356
4319
  ] }));
4357
4320
  CommandInput.displayName = CommandPrimitive.Input.displayName;
4358
- var CommandList = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
4321
+ var CommandList = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4359
4322
  CommandPrimitive.List,
4360
4323
  {
4361
4324
  ref,
@@ -4364,7 +4327,7 @@ var CommandList = React16.forwardRef(({ className, ...props }, ref) => /* @__PUR
4364
4327
  }
4365
4328
  ));
4366
4329
  CommandList.displayName = CommandPrimitive.List.displayName;
4367
- var CommandEmpty = React16.forwardRef((props, ref) => /* @__PURE__ */ jsx26(
4330
+ var CommandEmpty = React15.forwardRef((props, ref) => /* @__PURE__ */ jsx25(
4368
4331
  CommandPrimitive.Empty,
4369
4332
  {
4370
4333
  ref,
@@ -4373,7 +4336,7 @@ var CommandEmpty = React16.forwardRef((props, ref) => /* @__PURE__ */ jsx26(
4373
4336
  }
4374
4337
  ));
4375
4338
  CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
4376
- var CommandGroup = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
4339
+ var CommandGroup = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4377
4340
  CommandPrimitive.Group,
4378
4341
  {
4379
4342
  ref,
@@ -4385,7 +4348,7 @@ var CommandGroup = React16.forwardRef(({ className, ...props }, ref) => /* @__PU
4385
4348
  }
4386
4349
  ));
4387
4350
  CommandGroup.displayName = CommandPrimitive.Group.displayName;
4388
- var CommandSeparator = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
4351
+ var CommandSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4389
4352
  CommandPrimitive.Separator,
4390
4353
  {
4391
4354
  ref,
@@ -4394,7 +4357,7 @@ var CommandSeparator = React16.forwardRef(({ className, ...props }, ref) => /* @
4394
4357
  }
4395
4358
  ));
4396
4359
  CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
4397
- var CommandItem = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
4360
+ var CommandItem = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx25(
4398
4361
  CommandPrimitive.Item,
4399
4362
  {
4400
4363
  ref,
@@ -4410,7 +4373,7 @@ var CommandShortcut = ({
4410
4373
  className,
4411
4374
  ...props
4412
4375
  }) => {
4413
- return /* @__PURE__ */ jsx26(
4376
+ return /* @__PURE__ */ jsx25(
4414
4377
  "span",
4415
4378
  {
4416
4379
  className: cn(
@@ -4424,10 +4387,10 @@ var CommandShortcut = ({
4424
4387
  CommandShortcut.displayName = "CommandShortcut";
4425
4388
 
4426
4389
  // src/data-table/ColumnHeaderCell.tsx
4427
- import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
4428
- var HeaderButton = forwardRef12(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
4390
+ import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
4391
+ var HeaderButton = forwardRef11(({ dragDescription, "aria-describedby": tooltipDescription, ...props }, ref) => {
4429
4392
  const descriptions = [tooltipDescription, dragDescription].filter((value) => Boolean(value)).join(" ");
4430
- return /* @__PURE__ */ jsx27(
4393
+ return /* @__PURE__ */ jsx26(
4431
4394
  "button",
4432
4395
  {
4433
4396
  ref,
@@ -4507,7 +4470,7 @@ function ColumnHeaderCell({
4507
4470
  else onFilterChange(next);
4508
4471
  };
4509
4472
  const menuLabel = labelText ? `Sort or filter ${labelText}` : "Sort or filter column";
4510
- const menuContent = /* @__PURE__ */ jsxs18(
4473
+ const menuContent = /* @__PURE__ */ jsxs17(
4511
4474
  PopoverContent,
4512
4475
  {
4513
4476
  align: "start",
@@ -4524,9 +4487,9 @@ function ColumnHeaderCell({
4524
4487
  input.focus();
4525
4488
  },
4526
4489
  children: [
4527
- sortable ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
4528
- /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-0.5 pb-2", children: [
4529
- /* @__PURE__ */ jsxs18(
4490
+ sortable ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
4491
+ /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-0.5 pb-2", children: [
4492
+ /* @__PURE__ */ jsxs17(
4530
4493
  Button,
4531
4494
  {
4532
4495
  variant: isSorted && sortDirection === "asc" ? "secondary" : "ghost",
@@ -4534,12 +4497,12 @@ function ColumnHeaderCell({
4534
4497
  className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
4535
4498
  onClick: onSortAsc,
4536
4499
  children: [
4537
- /* @__PURE__ */ jsx27(ArrowUp, { className: "h-3.5 w-3.5" }),
4500
+ /* @__PURE__ */ jsx26(ArrowUp, { className: "h-3.5 w-3.5" }),
4538
4501
  "Sort ascending"
4539
4502
  ]
4540
4503
  }
4541
4504
  ),
4542
- /* @__PURE__ */ jsxs18(
4505
+ /* @__PURE__ */ jsxs17(
4543
4506
  Button,
4544
4507
  {
4545
4508
  variant: isSorted && sortDirection === "desc" ? "secondary" : "ghost",
@@ -4547,12 +4510,12 @@ function ColumnHeaderCell({
4547
4510
  className: "h-8 justify-start gap-2 px-2 text-xs font-normal",
4548
4511
  onClick: onSortDesc,
4549
4512
  children: [
4550
- /* @__PURE__ */ jsx27(ArrowDown, { className: "h-3.5 w-3.5" }),
4513
+ /* @__PURE__ */ jsx26(ArrowDown, { className: "h-3.5 w-3.5" }),
4551
4514
  "Sort descending"
4552
4515
  ]
4553
4516
  }
4554
4517
  ),
4555
- isSorted ? /* @__PURE__ */ jsxs18(
4518
+ isSorted ? /* @__PURE__ */ jsxs17(
4556
4519
  Button,
4557
4520
  {
4558
4521
  variant: "ghost",
@@ -4560,15 +4523,15 @@ function ColumnHeaderCell({
4560
4523
  className: "h-8 justify-start gap-2 px-2 text-xs font-normal text-muted-foreground",
4561
4524
  onClick: onClearSort,
4562
4525
  children: [
4563
- /* @__PURE__ */ jsx27(ListX, { className: "h-3.5 w-3.5" }),
4526
+ /* @__PURE__ */ jsx26(ListX, { className: "h-3.5 w-3.5" }),
4564
4527
  "Clear sort"
4565
4528
  ]
4566
4529
  }
4567
4530
  ) : null
4568
4531
  ] }),
4569
- filterKind ? /* @__PURE__ */ jsx27("div", { className: "mb-2 h-px bg-border" }) : null
4532
+ filterKind ? /* @__PURE__ */ jsx26("div", { className: "mb-2 h-px bg-border" }) : null
4570
4533
  ] }) : null,
4571
- filterKind ? /* @__PURE__ */ jsx27(
4534
+ filterKind ? /* @__PURE__ */ jsx26(
4572
4535
  FilterBody,
4573
4536
  {
4574
4537
  kind: filterKind,
@@ -4583,10 +4546,10 @@ function ColumnHeaderCell({
4583
4546
  allowNullModes
4584
4547
  }
4585
4548
  ) : null,
4586
- filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ jsxs18("div", { className: "mt-2 border-t border-border pt-2", children: [
4587
- /* @__PURE__ */ jsx27("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Match mode" }),
4588
- /* @__PURE__ */ jsxs18("div", { className: "grid grid-cols-2 gap-1 rounded-md border p-0.5", children: [
4589
- /* @__PURE__ */ jsx27(
4549
+ filterKind && visibleFilter && allowNegation ? /* @__PURE__ */ jsxs17("div", { className: "mt-2 border-t border-border pt-2", children: [
4550
+ /* @__PURE__ */ jsx26("p", { className: "mb-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Match mode" }),
4551
+ /* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-1 rounded-md border p-0.5", children: [
4552
+ /* @__PURE__ */ jsx26(
4590
4553
  "button",
4591
4554
  {
4592
4555
  type: "button",
@@ -4599,7 +4562,7 @@ function ColumnHeaderCell({
4599
4562
  children: "Include"
4600
4563
  }
4601
4564
  ),
4602
- /* @__PURE__ */ jsx27(
4565
+ /* @__PURE__ */ jsx26(
4603
4566
  "button",
4604
4567
  {
4605
4568
  type: "button",
@@ -4614,11 +4577,11 @@ function ColumnHeaderCell({
4614
4577
  )
4615
4578
  ] })
4616
4579
  ] }) : null,
4617
- filterKind && deferredFilter ? /* @__PURE__ */ jsxs18("div", { className: "mt-2 border-t border-border pt-2", children: [
4618
- filterFooterHint ? /* @__PURE__ */ jsx27("div", { className: "mb-2 text-xs text-muted-foreground", children: filterFooterHint }) : null,
4619
- /* @__PURE__ */ jsxs18("div", { className: "flex justify-end gap-2", children: [
4620
- filterShowCancel ? /* @__PURE__ */ jsx27(Button, { type: "button", variant: "ghost", size: "sm", onClick: cancelFilter, children: "Cancel" }) : null,
4621
- /* @__PURE__ */ jsx27(Button, { type: "button", size: "sm", onClick: applyFilter, children: filterApplyLabel ?? "Apply" })
4580
+ filterKind && deferredFilter ? /* @__PURE__ */ jsxs17("div", { className: "mt-2 border-t border-border pt-2", children: [
4581
+ filterFooterHint ? /* @__PURE__ */ jsx26("div", { className: "mb-2 text-xs text-muted-foreground", children: filterFooterHint }) : null,
4582
+ /* @__PURE__ */ jsxs17("div", { className: "flex justify-end gap-2", children: [
4583
+ filterShowCancel ? /* @__PURE__ */ jsx26(Button, { type: "button", variant: "ghost", size: "sm", onClick: cancelFilter, children: "Cancel" }) : null,
4584
+ /* @__PURE__ */ jsx26(Button, { type: "button", size: "sm", onClick: applyFilter, children: filterApplyLabel ?? "Apply" })
4622
4585
  ] })
4623
4586
  ] }) : null
4624
4587
  ]
@@ -4627,10 +4590,10 @@ function ColumnHeaderCell({
4627
4590
  if (compact) {
4628
4591
  if (!sortable && !filterKind) {
4629
4592
  if (!reorderEnabled) {
4630
- return /* @__PURE__ */ jsx27("div", { className: cn("flex items-center justify-center", className), children: label });
4593
+ return /* @__PURE__ */ jsx26("div", { className: cn("flex items-center justify-center", className), children: label });
4631
4594
  }
4632
- return /* @__PURE__ */ jsx27("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ jsxs18(Tooltip, { children: [
4633
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(
4595
+ return /* @__PURE__ */ jsx26("div", { className: cn("flex items-center justify-center", className), children: /* @__PURE__ */ jsxs17(Tooltip, { children: [
4596
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(
4634
4597
  HeaderButton,
4635
4598
  {
4636
4599
  type: "button",
@@ -4642,14 +4605,14 @@ function ColumnHeaderCell({
4642
4605
  children: label
4643
4606
  }
4644
4607
  ) }),
4645
- /* @__PURE__ */ jsxs18(TooltipContent, { children: [
4608
+ /* @__PURE__ */ jsxs17(TooltipContent, { children: [
4646
4609
  "Drag to reorder ",
4647
4610
  reorderLabel,
4648
4611
  "."
4649
4612
  ] })
4650
4613
  ] }) });
4651
4614
  }
4652
- return /* @__PURE__ */ jsx27(
4615
+ return /* @__PURE__ */ jsx26(
4653
4616
  "div",
4654
4617
  {
4655
4618
  className: cn(
@@ -4657,9 +4620,9 @@ function ColumnHeaderCell({
4657
4620
  align === "right" ? "justify-end" : "justify-center",
4658
4621
  className
4659
4622
  ),
4660
- children: /* @__PURE__ */ jsxs18(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
4661
- /* @__PURE__ */ jsxs18(Tooltip, { children: [
4662
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs18(
4623
+ children: /* @__PURE__ */ jsxs17(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
4624
+ /* @__PURE__ */ jsxs17(Tooltip, { children: [
4625
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(
4663
4626
  HeaderButton,
4664
4627
  {
4665
4628
  type: "button",
@@ -4675,8 +4638,8 @@ function ColumnHeaderCell({
4675
4638
  ),
4676
4639
  children: [
4677
4640
  label,
4678
- isSorted ? sortDirection === "asc" ? /* @__PURE__ */ jsx27(ArrowUp, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : /* @__PURE__ */ jsx27(ArrowDown, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : null,
4679
- filterActive ? /* @__PURE__ */ jsx27(
4641
+ isSorted ? sortDirection === "asc" ? /* @__PURE__ */ jsx26(ArrowUp, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : /* @__PURE__ */ jsx26(ArrowDown, { className: "absolute -top-1 right-0 h-2 w-2 text-primary" }) : null,
4642
+ filterActive ? /* @__PURE__ */ jsx26(
4680
4643
  "span",
4681
4644
  {
4682
4645
  "aria-hidden": true,
@@ -4686,14 +4649,14 @@ function ColumnHeaderCell({
4686
4649
  ]
4687
4650
  }
4688
4651
  ) }) }),
4689
- /* @__PURE__ */ jsx27(TooltipContent, { children: menuLabel })
4652
+ /* @__PURE__ */ jsx26(TooltipContent, { children: menuLabel })
4690
4653
  ] }),
4691
4654
  menuContent
4692
4655
  ] })
4693
4656
  }
4694
4657
  );
4695
4658
  }
4696
- return /* @__PURE__ */ jsxs18(
4659
+ return /* @__PURE__ */ jsxs17(
4697
4660
  "div",
4698
4661
  {
4699
4662
  className: cn(
@@ -4703,8 +4666,8 @@ function ColumnHeaderCell({
4703
4666
  className
4704
4667
  ),
4705
4668
  children: [
4706
- sortable ? /* @__PURE__ */ jsxs18(Tooltip, { children: [
4707
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs18(
4669
+ sortable ? /* @__PURE__ */ jsxs17(Tooltip, { children: [
4670
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(
4708
4671
  HeaderButton,
4709
4672
  {
4710
4673
  type: "button",
@@ -4716,14 +4679,14 @@ function ColumnHeaderCell({
4716
4679
  isSorted ? "text-foreground" : "text-muted-foreground hover:text-foreground"
4717
4680
  ),
4718
4681
  children: [
4719
- /* @__PURE__ */ jsx27("span", { className: "truncate", children: label }),
4720
- isSorted ? sortDirection === "asc" ? /* @__PURE__ */ jsx27(ArrowUp, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ jsx27(ArrowDown, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ jsx27(ArrowUpDown, { className: "h-3 w-3 shrink-0 opacity-40" })
4682
+ /* @__PURE__ */ jsx26("span", { className: "truncate", children: label }),
4683
+ isSorted ? sortDirection === "asc" ? /* @__PURE__ */ jsx26(ArrowUp, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ jsx26(ArrowDown, { className: "h-3 w-3 shrink-0 text-primary" }) : /* @__PURE__ */ jsx26(ArrowUpDown, { className: "h-3 w-3 shrink-0 opacity-40" })
4721
4684
  ]
4722
4685
  }
4723
4686
  ) }),
4724
- /* @__PURE__ */ jsx27(TooltipContent, { children: reorderEnabled ? `Drag to reorder ${reorderLabel}.` : labelText ?? "Sort column" })
4725
- ] }) : reorderEnabled ? /* @__PURE__ */ jsxs18(Tooltip, { children: [
4726
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(
4687
+ /* @__PURE__ */ jsx26(TooltipContent, { children: reorderEnabled ? `Drag to reorder ${reorderLabel}.` : labelText ?? "Sort column" })
4688
+ ] }) : reorderEnabled ? /* @__PURE__ */ jsxs17(Tooltip, { children: [
4689
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(
4727
4690
  HeaderButton,
4728
4691
  {
4729
4692
  type: "button",
@@ -4735,16 +4698,16 @@ function ColumnHeaderCell({
4735
4698
  children: label
4736
4699
  }
4737
4700
  ) }),
4738
- /* @__PURE__ */ jsxs18(TooltipContent, { children: [
4701
+ /* @__PURE__ */ jsxs17(TooltipContent, { children: [
4739
4702
  "Drag to reorder ",
4740
4703
  reorderLabel,
4741
4704
  "."
4742
4705
  ] })
4743
- ] }) : /* @__PURE__ */ jsx27("span", { className: "truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
4744
- filterKind ? /* @__PURE__ */ jsxs18("div", { className: "inline-flex items-center", children: [
4745
- /* @__PURE__ */ jsxs18(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
4746
- /* @__PURE__ */ jsxs18(Tooltip, { children: [
4747
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(
4706
+ ] }) : /* @__PURE__ */ jsx26("span", { className: "truncate text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: label }),
4707
+ filterKind ? /* @__PURE__ */ jsxs17("div", { className: "inline-flex items-center", children: [
4708
+ /* @__PURE__ */ jsxs17(Popover, { open: filterOpen, onOpenChange: setFilterOpen, children: [
4709
+ /* @__PURE__ */ jsxs17(Tooltip, { children: [
4710
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(
4748
4711
  "button",
4749
4712
  {
4750
4713
  type: "button",
@@ -4754,7 +4717,7 @@ function ColumnHeaderCell({
4754
4717
  "rounded p-0.5 transition-colors",
4755
4718
  filterActive ? "text-primary hover:text-primary/80" : "text-muted-foreground/40 hover:text-muted-foreground"
4756
4719
  ),
4757
- children: /* @__PURE__ */ jsx27(
4720
+ children: /* @__PURE__ */ jsx26(
4758
4721
  ListFilter,
4759
4722
  {
4760
4723
  className: cn("h-3 w-3", filterActive && "fill-primary/20")
@@ -4762,12 +4725,12 @@ function ColumnHeaderCell({
4762
4725
  )
4763
4726
  }
4764
4727
  ) }) }),
4765
- /* @__PURE__ */ jsx27(TooltipContent, { children: menuLabel })
4728
+ /* @__PURE__ */ jsx26(TooltipContent, { children: menuLabel })
4766
4729
  ] }),
4767
4730
  menuContent
4768
4731
  ] }),
4769
- filterActive ? /* @__PURE__ */ jsxs18(Tooltip, { children: [
4770
- /* @__PURE__ */ jsx27(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(
4732
+ filterActive ? /* @__PURE__ */ jsxs17(Tooltip, { children: [
4733
+ /* @__PURE__ */ jsx26(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(
4771
4734
  "button",
4772
4735
  {
4773
4736
  type: "button",
@@ -4777,10 +4740,10 @@ function ColumnHeaderCell({
4777
4740
  onFilterChange(void 0);
4778
4741
  },
4779
4742
  className: "rounded p-0.5 text-primary hover:bg-muted hover:text-foreground",
4780
- children: /* @__PURE__ */ jsx27(X, { className: "h-3 w-3" })
4743
+ children: /* @__PURE__ */ jsx26(X, { className: "h-3 w-3" })
4781
4744
  }
4782
4745
  ) }),
4783
- /* @__PURE__ */ jsx27(TooltipContent, { children: labelText ? `Clear ${labelText} filter` : "Clear this filter" })
4746
+ /* @__PURE__ */ jsx26(TooltipContent, { children: labelText ? `Clear ${labelText} filter` : "Clear this filter" })
4784
4747
  ] }) : null
4785
4748
  ] }) : null
4786
4749
  ]
@@ -4805,14 +4768,14 @@ function FilterBody({
4805
4768
  onChange({ kind: "text", value: "", mode: next });
4806
4769
  }
4807
4770
  };
4808
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-1.5 px-1", children: [
4809
- /* @__PURE__ */ jsx27("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
4810
- /* @__PURE__ */ jsx27("div", { className: "flex gap-1", children: [
4771
+ return /* @__PURE__ */ jsxs17("div", { className: "space-y-1.5 px-1", children: [
4772
+ /* @__PURE__ */ jsx26("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
4773
+ /* @__PURE__ */ jsx26("div", { className: "flex gap-1", children: [
4811
4774
  ["contains", "Contains"],
4812
4775
  ["empty", "(empty)"],
4813
4776
  ["not_empty", "(not empty)"],
4814
4777
  ...allowNullModes ? [["null", "(null)"], ["not_null", "(not null)"]] : []
4815
- ].map(([m, label]) => /* @__PURE__ */ jsx27(
4778
+ ].map(([m, label]) => /* @__PURE__ */ jsx26(
4816
4779
  "button",
4817
4780
  {
4818
4781
  type: "button",
@@ -4826,8 +4789,8 @@ function FilterBody({
4826
4789
  },
4827
4790
  m
4828
4791
  )) }),
4829
- mode === "contains" && /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
4830
- /* @__PURE__ */ jsx27(
4792
+ mode === "contains" && /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
4793
+ /* @__PURE__ */ jsx26(
4831
4794
  Input,
4832
4795
  {
4833
4796
  "data-matrx-filter-autofocus": true,
@@ -4840,14 +4803,14 @@ function FilterBody({
4840
4803
  style: { fontSize: "16px" }
4841
4804
  }
4842
4805
  ),
4843
- text ? /* @__PURE__ */ jsx27(
4806
+ text ? /* @__PURE__ */ jsx26(
4844
4807
  "button",
4845
4808
  {
4846
4809
  type: "button",
4847
4810
  "aria-label": "Clear filter text",
4848
4811
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
4849
4812
  onClick: () => onChange(void 0),
4850
- children: /* @__PURE__ */ jsx27(X, { className: "h-3.5 w-3.5" })
4813
+ children: /* @__PURE__ */ jsx26(X, { className: "h-3.5 w-3.5" })
4851
4814
  }
4852
4815
  ) : null
4853
4816
  ] })
@@ -4855,7 +4818,7 @@ function FilterBody({
4855
4818
  }
4856
4819
  if (kind === "select") {
4857
4820
  const selected = value?.kind === "select" ? value.values ?? (value.value && value.value !== "__all__" ? [value.value] : []) : [];
4858
- return /* @__PURE__ */ jsx27(
4821
+ return /* @__PURE__ */ jsx26(
4859
4822
  SearchableSelectFilter,
4860
4823
  {
4861
4824
  selected,
@@ -4867,9 +4830,9 @@ function FilterBody({
4867
4830
  }
4868
4831
  if (kind === "boolean") {
4869
4832
  const current = value?.kind === "boolean" ? value.value : "__all__";
4870
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-1.5 px-1", children: [
4871
- /* @__PURE__ */ jsx27("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
4872
- /* @__PURE__ */ jsxs18(
4833
+ return /* @__PURE__ */ jsxs17("div", { className: "space-y-1.5 px-1", children: [
4834
+ /* @__PURE__ */ jsx26("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Filter" }),
4835
+ /* @__PURE__ */ jsxs17(
4873
4836
  Select,
4874
4837
  {
4875
4838
  value: current === "__all__" ? "__all__" : current ? "true" : "false",
@@ -4878,18 +4841,18 @@ function FilterBody({
4878
4841
  else onChange({ kind: "boolean", value: v === "true" });
4879
4842
  },
4880
4843
  children: [
4881
- /* @__PURE__ */ jsx27(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx27(SelectValue, {}) }),
4882
- /* @__PURE__ */ jsxs18(SelectContent, { children: [
4883
- /* @__PURE__ */ jsx27(SelectItem, { value: "__all__", children: "All" }),
4884
- /* @__PURE__ */ jsx27(SelectItem, { value: "true", children: "Yes" }),
4885
- /* @__PURE__ */ jsx27(SelectItem, { value: "false", children: "No" })
4844
+ /* @__PURE__ */ jsx26(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx26(SelectValue, {}) }),
4845
+ /* @__PURE__ */ jsxs17(SelectContent, { children: [
4846
+ /* @__PURE__ */ jsx26(SelectItem, { value: "__all__", children: "All" }),
4847
+ /* @__PURE__ */ jsx26(SelectItem, { value: "true", children: "Yes" }),
4848
+ /* @__PURE__ */ jsx26(SelectItem, { value: "false", children: "No" })
4886
4849
  ] })
4887
4850
  ]
4888
4851
  }
4889
4852
  )
4890
4853
  ] });
4891
4854
  }
4892
- return /* @__PURE__ */ jsx27(NumberFilterBody, { value, onChange });
4855
+ return /* @__PURE__ */ jsx26(NumberFilterBody, { value, onChange });
4893
4856
  }
4894
4857
  function SearchableSelectFilter({
4895
4858
  selected,
@@ -4917,13 +4880,13 @@ function SearchableSelectFilter({
4917
4880
  next.length === 0 ? void 0 : { kind: "select", value: next[0] ?? "", values: next }
4918
4881
  );
4919
4882
  };
4920
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-1 px-0", children: [
4921
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between px-1 pb-1", children: [
4922
- /* @__PURE__ */ jsxs18("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: [
4883
+ return /* @__PURE__ */ jsxs17("div", { className: "space-y-1 px-0", children: [
4884
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between px-1 pb-1", children: [
4885
+ /* @__PURE__ */ jsxs17("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: [
4923
4886
  "Filter",
4924
4887
  selected.length > 1 ? ` (any of ${selected.length})` : ""
4925
4888
  ] }),
4926
- selected.length > 0 ? /* @__PURE__ */ jsx27(
4889
+ selected.length > 0 ? /* @__PURE__ */ jsx26(
4927
4890
  "button",
4928
4891
  {
4929
4892
  type: "button",
@@ -4933,8 +4896,8 @@ function SearchableSelectFilter({
4933
4896
  }
4934
4897
  ) : null
4935
4898
  ] }),
4936
- /* @__PURE__ */ jsxs18(Command, { className: "rounded-md border border-border", shouldFilter: false, children: [
4937
- /* @__PURE__ */ jsx27(
4899
+ /* @__PURE__ */ jsxs17(Command, { className: "rounded-md border border-border", shouldFilter: false, children: [
4900
+ /* @__PURE__ */ jsx26(
4938
4901
  CommandInput,
4939
4902
  {
4940
4903
  "data-matrx-filter-autofocus": true,
@@ -4944,10 +4907,10 @@ function SearchableSelectFilter({
4944
4907
  className: "h-8 text-sm"
4945
4908
  }
4946
4909
  ),
4947
- /* @__PURE__ */ jsxs18(CommandList, { className: "max-h-48", children: [
4948
- /* @__PURE__ */ jsx27(CommandEmpty, { className: "py-3 text-xs text-muted-foreground", children: "No matches" }),
4949
- /* @__PURE__ */ jsxs18(CommandGroup, { children: [
4950
- /* @__PURE__ */ jsx27(
4910
+ /* @__PURE__ */ jsxs17(CommandList, { className: "max-h-48", children: [
4911
+ /* @__PURE__ */ jsx26(CommandEmpty, { className: "py-3 text-xs text-muted-foreground", children: "No matches" }),
4912
+ /* @__PURE__ */ jsxs17(CommandGroup, { children: [
4913
+ /* @__PURE__ */ jsx26(
4951
4914
  CommandItem,
4952
4915
  {
4953
4916
  value: "__all__",
@@ -4958,7 +4921,7 @@ function SearchableSelectFilter({
4958
4921
  ),
4959
4922
  filtered.map((o) => {
4960
4923
  const active = selected.includes(o.value);
4961
- return /* @__PURE__ */ jsxs18(
4924
+ return /* @__PURE__ */ jsxs17(
4962
4925
  CommandItem,
4963
4926
  {
4964
4927
  value: o.value,
@@ -4968,7 +4931,7 @@ function SearchableSelectFilter({
4968
4931
  active && "bg-accent text-accent-foreground"
4969
4932
  ),
4970
4933
  children: [
4971
- /* @__PURE__ */ jsx27(
4934
+ /* @__PURE__ */ jsx26(
4972
4935
  "span",
4973
4936
  {
4974
4937
  className: cn(
@@ -4976,7 +4939,7 @@ function SearchableSelectFilter({
4976
4939
  single ? "rounded-full" : "rounded-sm",
4977
4940
  active ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground/40"
4978
4941
  ),
4979
- children: active && /* @__PURE__ */ jsx27(Check, { className: "h-2.5 w-2.5" })
4942
+ children: active && /* @__PURE__ */ jsx26(Check, { className: "h-2.5 w-2.5" })
4980
4943
  }
4981
4944
  ),
4982
4945
  o.label
@@ -5007,10 +4970,10 @@ function NumberFilterBody({
5007
4970
  }
5008
4971
  onChange({ kind: "number", min: nextMin, max: nextMax });
5009
4972
  };
5010
- return /* @__PURE__ */ jsxs18("div", { className: "space-y-1.5 px-1", children: [
5011
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between", children: [
5012
- /* @__PURE__ */ jsx27("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Range" }),
5013
- (min !== void 0 || max !== void 0) && /* @__PURE__ */ jsx27(
4973
+ return /* @__PURE__ */ jsxs17("div", { className: "space-y-1.5 px-1", children: [
4974
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
4975
+ /* @__PURE__ */ jsx26("p", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground", children: "Range" }),
4976
+ (min !== void 0 || max !== void 0) && /* @__PURE__ */ jsx26(
5014
4977
  "button",
5015
4978
  {
5016
4979
  type: "button",
@@ -5024,8 +4987,8 @@ function NumberFilterBody({
5024
4987
  }
5025
4988
  )
5026
4989
  ] }),
5027
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1.5", children: [
5028
- /* @__PURE__ */ jsx27(
4990
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1.5", children: [
4991
+ /* @__PURE__ */ jsx26(
5029
4992
  Input,
5030
4993
  {
5031
4994
  "data-matrx-filter-autofocus": true,
@@ -5040,8 +5003,8 @@ function NumberFilterBody({
5040
5003
  style: { fontSize: "16px" }
5041
5004
  }
5042
5005
  ),
5043
- /* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: "\u2013" }),
5044
- /* @__PURE__ */ jsx27(
5006
+ /* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: "\u2013" }),
5007
+ /* @__PURE__ */ jsx26(
5045
5008
  Input,
5046
5009
  {
5047
5010
  value: maxText,
@@ -5064,10 +5027,23 @@ function parseOptionalNumber(raw) {
5064
5027
  return Number.isFinite(n) ? n : void 0;
5065
5028
  }
5066
5029
 
5030
+ // src/data-table/column-drag-preview.ts
5031
+ function projectColumnDragOrder(orderedIds, preview2) {
5032
+ const order = [...orderedIds];
5033
+ if (!preview2?.targetId || preview2.draggedId === preview2.targetId) return order;
5034
+ const draggedIndex = order.indexOf(preview2.draggedId);
5035
+ const targetIndex = order.indexOf(preview2.targetId);
5036
+ if (draggedIndex < 0 || targetIndex < 0) return order;
5037
+ order.splice(draggedIndex, 1);
5038
+ const insertion = order.indexOf(preview2.targetId) + (preview2.after ? 1 : 0);
5039
+ order.splice(insertion, 0, preview2.draggedId);
5040
+ return order;
5041
+ }
5042
+
5067
5043
  // src/data-table/ColumnManager.tsx
5068
5044
  import { useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
5069
5045
  import { useDndMonitor, useDraggable as useDraggable2, useDroppable } from "@dnd-kit/core";
5070
- import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
5046
+ import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
5071
5047
  function ColumnManager({
5072
5048
  open,
5073
5049
  onOpenChange,
@@ -5141,18 +5117,18 @@ function ColumnManager({
5141
5117
  if (target) moveTo(dragged, String(target));
5142
5118
  }
5143
5119
  });
5144
- return /* @__PURE__ */ jsx28(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs19(DialogContent, { className: "max-w-md", children: [
5145
- /* @__PURE__ */ jsxs19(DialogHeader, { children: [
5146
- /* @__PURE__ */ jsx28(DialogTitle, { children: "Columns" }),
5147
- /* @__PURE__ */ jsx28(DialogDescription, { children: "Choose the columns to show and set their order." })
5120
+ return /* @__PURE__ */ jsx27(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs18(DialogContent, { className: "max-w-md", children: [
5121
+ /* @__PURE__ */ jsxs18(DialogHeader, { children: [
5122
+ /* @__PURE__ */ jsx27(DialogTitle, { children: "Columns" }),
5123
+ /* @__PURE__ */ jsx27(DialogDescription, { children: "Choose the columns to show and set their order." })
5148
5124
  ] }),
5149
- /* @__PURE__ */ jsx28("div", { className: "max-h-[55dvh] divide-y overflow-y-auto rounded-md border", children: draftOrder.map((id, index) => {
5125
+ /* @__PURE__ */ jsx27("div", { className: "max-h-[55dvh] divide-y overflow-y-auto rounded-md border", children: draftOrder.map((id, index) => {
5150
5126
  const column = byId.get(id);
5151
5127
  if (!column) return null;
5152
5128
  const label = typeof column.header === "string" ? column.header : id;
5153
5129
  const hideable = column.hideable !== false;
5154
5130
  const visible = !draftHidden.has(id);
5155
- return /* @__PURE__ */ jsxs19(
5131
+ return /* @__PURE__ */ jsxs18(
5156
5132
  ColumnManagerDropTarget,
5157
5133
  {
5158
5134
  id,
@@ -5162,8 +5138,8 @@ function ColumnManager({
5162
5138
  dropTarget === id && draggedColumnId !== id && "border-t-2 border-primary"
5163
5139
  ),
5164
5140
  children: [
5165
- /* @__PURE__ */ jsx28(ColumnManagerDragHandle, { id, label }),
5166
- /* @__PURE__ */ jsx28(
5141
+ /* @__PURE__ */ jsx27(ColumnManagerDragHandle, { id, label }),
5142
+ /* @__PURE__ */ jsx27(
5167
5143
  Checkbox,
5168
5144
  {
5169
5145
  checked: visible,
@@ -5180,8 +5156,8 @@ function ColumnManager({
5180
5156
  }
5181
5157
  }
5182
5158
  ),
5183
- /* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 truncate text-sm", children: label }),
5184
- /* @__PURE__ */ jsx28(
5159
+ /* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 truncate text-sm", children: label }),
5160
+ /* @__PURE__ */ jsx27(
5185
5161
  Button,
5186
5162
  {
5187
5163
  type: "button",
@@ -5191,10 +5167,10 @@ function ColumnManager({
5191
5167
  "aria-label": `Move ${label} earlier`,
5192
5168
  disabled: index === 0,
5193
5169
  onClick: () => move(id, -1),
5194
- children: /* @__PURE__ */ jsx28(ArrowUp, { className: "h-4 w-4" })
5170
+ children: /* @__PURE__ */ jsx27(ArrowUp, { className: "h-4 w-4" })
5195
5171
  }
5196
5172
  ),
5197
- /* @__PURE__ */ jsx28(
5173
+ /* @__PURE__ */ jsx27(
5198
5174
  Button,
5199
5175
  {
5200
5176
  type: "button",
@@ -5204,7 +5180,7 @@ function ColumnManager({
5204
5180
  "aria-label": `Move ${label} later`,
5205
5181
  disabled: index === draftOrder.length - 1,
5206
5182
  onClick: () => move(id, 1),
5207
- children: /* @__PURE__ */ jsx28(ArrowDown, { className: "h-4 w-4" })
5183
+ children: /* @__PURE__ */ jsx27(ArrowDown, { className: "h-4 w-4" })
5208
5184
  }
5209
5185
  )
5210
5186
  ]
@@ -5212,9 +5188,9 @@ function ColumnManager({
5212
5188
  id
5213
5189
  );
5214
5190
  }) }),
5215
- /* @__PURE__ */ jsxs19(DialogFooter, { children: [
5216
- /* @__PURE__ */ jsx28(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
5217
- /* @__PURE__ */ jsx28(
5191
+ /* @__PURE__ */ jsxs18(DialogFooter, { children: [
5192
+ /* @__PURE__ */ jsx27(Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
5193
+ /* @__PURE__ */ jsx27(
5218
5194
  Button,
5219
5195
  {
5220
5196
  type: "button",
@@ -5237,14 +5213,14 @@ function ColumnManagerDropTarget({
5237
5213
  id: `matrx-column-manager:${id}`,
5238
5214
  data: { matrxDragKind: "column-manager", columnId: id }
5239
5215
  });
5240
- return /* @__PURE__ */ jsx28("div", { ref: setNodeRef, "data-matrx-column-manager-drop-target": id, className, children });
5216
+ return /* @__PURE__ */ jsx27("div", { ref: setNodeRef, "data-matrx-column-manager-drop-target": id, className, children });
5241
5217
  }
5242
5218
  function ColumnManagerDragHandle({ id, label }) {
5243
5219
  const { attributes, listeners, setNodeRef } = useDraggable2({
5244
5220
  id: `matrx-column-manager:${id}`,
5245
5221
  data: { matrxDragKind: "column-manager", columnId: id }
5246
5222
  });
5247
- return /* @__PURE__ */ jsx28(
5223
+ return /* @__PURE__ */ jsx27(
5248
5224
  "button",
5249
5225
  {
5250
5226
  ref: setNodeRef,
@@ -5254,18 +5230,69 @@ function ColumnManagerDragHandle({ id, label }) {
5254
5230
  title: `Drag to reorder ${label}`,
5255
5231
  ...attributes,
5256
5232
  ...listeners,
5257
- children: /* @__PURE__ */ jsx28(GripVertical, { className: "h-4 w-4" })
5233
+ children: /* @__PURE__ */ jsx27(GripVertical, { className: "h-4 w-4" })
5258
5234
  }
5259
5235
  );
5260
5236
  }
5261
5237
 
5238
+ // src/data-table/saved-view-snapshot.ts
5239
+ import { z as z2 } from "zod";
5240
+ var filterSchema = z2.union([
5241
+ z2.object({ kind: z2.literal("text"), value: z2.string(), mode: z2.enum(["contains", "empty", "not_empty", "null", "not_null"]).optional(), negated: z2.boolean().optional() }),
5242
+ z2.object({ kind: z2.literal("select"), value: z2.string(), values: z2.array(z2.string()).optional(), negated: z2.boolean().optional() }),
5243
+ z2.object({ kind: z2.literal("boolean"), value: z2.boolean(), negated: z2.boolean().optional() }),
5244
+ z2.object({ kind: z2.literal("number"), min: z2.number().optional(), max: z2.number().optional(), negated: z2.boolean().optional() })
5245
+ ]);
5246
+ var layeredRuleSchema = z2.object({ id: z2.string().min(1), field: z2.string().min(1), operator: z2.enum(LAYERED_FILTER_OPERATORS), value: z2.string(), valueTo: z2.string().optional() });
5247
+ var snapshotSchema = z2.object({
5248
+ __kind: z2.literal("matrx-table-view"),
5249
+ version: z2.literal(1),
5250
+ query: z2.object({ pageSize: z2.number().int().positive(), search: z2.string(), searchMatchMode: z2.enum(["contains", "whole_words"]).optional(), anyOf: z2.string(), layeredFilters: z2.array(layeredRuleSchema).optional(), columnFilters: z2.record(z2.string(), filterSchema.optional()), sort: z2.object({ id: z2.string().min(1), direction: z2.enum(["asc", "desc"]) }).nullable() }),
5251
+ columns: z2.object({
5252
+ order: z2.array(z2.string().min(1)).refine((order) => new Set(order).size === order.length, {
5253
+ message: "Column order must not contain duplicate IDs"
5254
+ }),
5255
+ hidden: z2.array(z2.string().min(1))
5256
+ })
5257
+ });
5258
+ function normalizeFilters(raw) {
5259
+ const filters = {};
5260
+ for (const [id, value] of Object.entries(raw)) {
5261
+ if (value === void 0) continue;
5262
+ if (value.kind === "text") filters[id] = { kind: "text", value: value.value, ...value.mode === void 0 ? {} : { mode: value.mode }, ...value.negated === void 0 ? {} : { negated: value.negated } };
5263
+ else if (value.kind === "select") filters[id] = { kind: "select", value: value.value, ...value.values === void 0 ? {} : { values: value.values }, ...value.negated === void 0 ? {} : { negated: value.negated } };
5264
+ else if (value.kind === "boolean") filters[id] = { kind: "boolean", value: value.value, ...value.negated === void 0 ? {} : { negated: value.negated } };
5265
+ else filters[id] = { kind: "number", ...value.min === void 0 ? {} : { min: value.min }, ...value.max === void 0 ? {} : { max: value.max }, ...value.negated === void 0 ? {} : { negated: value.negated } };
5266
+ }
5267
+ return filters;
5268
+ }
5269
+ function parseTableViewSnapshot(raw) {
5270
+ const parsed = snapshotSchema.safeParse(raw);
5271
+ if (!parsed.success) return null;
5272
+ const { query, columns } = parsed.data;
5273
+ return {
5274
+ __kind: "matrx-table-view",
5275
+ version: 1,
5276
+ query: {
5277
+ pageSize: query.pageSize,
5278
+ search: query.search,
5279
+ ...query.searchMatchMode === void 0 ? {} : { searchMatchMode: query.searchMatchMode },
5280
+ anyOf: query.anyOf,
5281
+ ...query.layeredFilters === void 0 ? {} : { layeredFilters: query.layeredFilters },
5282
+ columnFilters: normalizeFilters(query.columnFilters),
5283
+ sort: query.sort
5284
+ },
5285
+ columns: { order: columns.order, hidden: columns.hidden }
5286
+ };
5287
+ }
5288
+
5262
5289
  // src/data-table/MatrxUuidCell.tsx
5263
5290
  import {
5264
5291
  useEffect as useEffect8,
5265
5292
  useRef as useRef5,
5266
5293
  useState as useState11
5267
5294
  } from "react";
5268
- import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
5295
+ import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
5269
5296
  var SHORT_LEN = 8;
5270
5297
  function shortUuid(id, len = SHORT_LEN) {
5271
5298
  return id.slice(0, len);
@@ -5315,7 +5342,7 @@ function MatrxUuidCell({
5315
5342
  []
5316
5343
  );
5317
5344
  if (!value) {
5318
- return /* @__PURE__ */ jsx29("span", { className: "text-muted-foreground/40", children: "\u2014" });
5345
+ return /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground/40", children: "\u2014" });
5319
5346
  }
5320
5347
  const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;
5321
5348
  const resolvedHref = doors?.href ?? href ?? null;
@@ -5358,13 +5385,13 @@ function MatrxUuidCell({
5358
5385
  };
5359
5386
  const idNode = (() => {
5360
5387
  if (forbidden) {
5361
- return /* @__PURE__ */ jsxs20("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
5362
- /* @__PURE__ */ jsx29("span", { className: "min-w-0 truncate", children: display }),
5363
- /* @__PURE__ */ jsx29(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
5388
+ return /* @__PURE__ */ jsxs19("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
5389
+ /* @__PURE__ */ jsx28("span", { className: "min-w-0 truncate", children: display }),
5390
+ /* @__PURE__ */ jsx28(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
5364
5391
  ] });
5365
5392
  }
5366
5393
  if (onOpen) {
5367
- return /* @__PURE__ */ jsxs20(
5394
+ return /* @__PURE__ */ jsxs19(
5368
5395
  "button",
5369
5396
  {
5370
5397
  type: "button",
@@ -5373,14 +5400,14 @@ function MatrxUuidCell({
5373
5400
  disabled: opening,
5374
5401
  className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60",
5375
5402
  children: [
5376
- /* @__PURE__ */ jsx29("span", { className: "min-w-0 truncate tabular-nums", children: display }),
5377
- /* @__PURE__ */ jsx29(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
5403
+ /* @__PURE__ */ jsx28("span", { className: "min-w-0 truncate tabular-nums", children: display }),
5404
+ /* @__PURE__ */ jsx28(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
5378
5405
  ]
5379
5406
  }
5380
5407
  );
5381
5408
  }
5382
5409
  if (resolvedHref) {
5383
- return /* @__PURE__ */ jsxs20(
5410
+ return /* @__PURE__ */ jsxs19(
5384
5411
  "a",
5385
5412
  {
5386
5413
  href: resolvedHref,
@@ -5390,15 +5417,15 @@ function MatrxUuidCell({
5390
5417
  onClick: stop,
5391
5418
  className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400",
5392
5419
  children: [
5393
- /* @__PURE__ */ jsx29("span", { className: "min-w-0 truncate tabular-nums", children: display }),
5394
- /* @__PURE__ */ jsx29(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
5420
+ /* @__PURE__ */ jsx28("span", { className: "min-w-0 truncate tabular-nums", children: display }),
5421
+ /* @__PURE__ */ jsx28(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
5395
5422
  ]
5396
5423
  }
5397
5424
  );
5398
5425
  }
5399
- return /* @__PURE__ */ jsx29("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
5426
+ return /* @__PURE__ */ jsx28("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
5400
5427
  })();
5401
- return /* @__PURE__ */ jsx29(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs20(
5428
+ return /* @__PURE__ */ jsx28(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs19(
5402
5429
  "span",
5403
5430
  {
5404
5431
  "data-matrx-cell-control": true,
@@ -5408,12 +5435,12 @@ function MatrxUuidCell({
5408
5435
  ),
5409
5436
  onClick: stop,
5410
5437
  children: [
5411
- /* @__PURE__ */ jsxs20(Tooltip, { children: [
5412
- /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx29("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
5413
- /* @__PURE__ */ jsx29(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
5438
+ /* @__PURE__ */ jsxs19(Tooltip, { children: [
5439
+ /* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
5440
+ /* @__PURE__ */ jsx28(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
5414
5441
  ] }),
5415
- /* @__PURE__ */ jsxs20(Tooltip, { children: [
5416
- /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx29(
5442
+ /* @__PURE__ */ jsxs19(Tooltip, { children: [
5443
+ /* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(
5417
5444
  "button",
5418
5445
  {
5419
5446
  type: "button",
@@ -5423,13 +5450,13 @@ function MatrxUuidCell({
5423
5450
  "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
5424
5451
  copied && "text-primary"
5425
5452
  ),
5426
- children: copied ? /* @__PURE__ */ jsx29(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx29(Copy, { className: "h-3 w-3" })
5453
+ children: copied ? /* @__PURE__ */ jsx28(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx28(Copy, { className: "h-3 w-3" })
5427
5454
  }
5428
5455
  ) }),
5429
- /* @__PURE__ */ jsx29(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
5456
+ /* @__PURE__ */ jsx28(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
5430
5457
  ] }),
5431
- canPeek ? /* @__PURE__ */ jsxs20(Tooltip, { children: [
5432
- /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx29(
5458
+ canPeek ? /* @__PURE__ */ jsxs19(Tooltip, { children: [
5459
+ /* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(
5433
5460
  "button",
5434
5461
  {
5435
5462
  type: "button",
@@ -5439,16 +5466,16 @@ function MatrxUuidCell({
5439
5466
  },
5440
5467
  "aria-label": `Quick look at ${label ?? "record"}`,
5441
5468
  className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
5442
- children: /* @__PURE__ */ jsx29(Lightbulb, { className: "h-3 w-3" })
5469
+ children: /* @__PURE__ */ jsx28(Lightbulb, { className: "h-3 w-3" })
5443
5470
  }
5444
5471
  ) }),
5445
- /* @__PURE__ */ jsxs20(TooltipContent, { side: "top", children: [
5472
+ /* @__PURE__ */ jsxs19(TooltipContent, { side: "top", children: [
5446
5473
  "Quick look at ",
5447
5474
  label ?? "record"
5448
5475
  ] })
5449
5476
  ] }) : null,
5450
- onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs20(Tooltip, { children: [
5451
- /* @__PURE__ */ jsx29(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx29(
5477
+ onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs19(Tooltip, { children: [
5478
+ /* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28(
5452
5479
  "a",
5453
5480
  {
5454
5481
  href: resolvedHref,
@@ -5457,10 +5484,10 @@ function MatrxUuidCell({
5457
5484
  onClick: stop,
5458
5485
  "aria-label": `Open ${label ?? "record"} in a new tab`,
5459
5486
  className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
5460
- children: /* @__PURE__ */ jsx29(ExternalLink, { className: "h-3 w-3" })
5487
+ children: /* @__PURE__ */ jsx28(ExternalLink, { className: "h-3 w-3" })
5461
5488
  }
5462
5489
  ) }),
5463
- /* @__PURE__ */ jsxs20(TooltipContent, { side: "top", children: [
5490
+ /* @__PURE__ */ jsxs19(TooltipContent, { side: "top", children: [
5464
5491
  "Open ",
5465
5492
  label ?? "record",
5466
5493
  " in a new tab"
@@ -5468,7 +5495,7 @@ function MatrxUuidCell({
5468
5495
  ] }) : null,
5469
5496
  trailing,
5470
5497
  notice,
5471
- canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx29(
5498
+ canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx28(
5472
5499
  ResourcePeek,
5473
5500
  {
5474
5501
  kind: doors?.peekKind ?? token ?? "record",
@@ -5491,7 +5518,7 @@ function tokenFromColumnName(name) {
5491
5518
  }
5492
5519
 
5493
5520
  // src/data-table/DataRowInspector.tsx
5494
- import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
5521
+ import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
5495
5522
  var noFieldToken = () => null;
5496
5523
  function formatValue(value) {
5497
5524
  if (value == null) return "\u2014";
@@ -5520,7 +5547,7 @@ function DataRowInspector({
5520
5547
  tokenForField = noFieldToken
5521
5548
  }) {
5522
5549
  const entries = isPlainObject(row) ? Object.entries(row) : [["value", row]];
5523
- const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ jsx30("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ jsx30(
5550
+ const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ jsx29("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ jsx29(
5524
5551
  CopyButtons,
5525
5552
  {
5526
5553
  size: "xs",
@@ -5535,21 +5562,21 @@ function DataRowInspector({
5535
5562
  })
5536
5563
  }
5537
5564
  ) }) : null;
5538
- return /* @__PURE__ */ jsxs21(
5565
+ return /* @__PURE__ */ jsxs20(
5539
5566
  "div",
5540
5567
  {
5541
5568
  className: cn("flex h-full min-h-0 flex-col overflow-hidden", className),
5542
5569
  children: [
5543
- title ? /* @__PURE__ */ jsx30("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
5544
- /* @__PURE__ */ jsx30("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ jsx30("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
5570
+ title ? /* @__PURE__ */ jsx29("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
5571
+ /* @__PURE__ */ jsx29("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ jsx29("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
5545
5572
  if (isUuidValue(value)) {
5546
- return /* @__PURE__ */ jsxs21(
5573
+ return /* @__PURE__ */ jsxs20(
5547
5574
  "div",
5548
5575
  {
5549
5576
  className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2",
5550
5577
  children: [
5551
- /* @__PURE__ */ jsx30("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
5552
- /* @__PURE__ */ jsx30("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx30(
5578
+ /* @__PURE__ */ jsx29("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
5579
+ /* @__PURE__ */ jsx29("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx29(
5553
5580
  MatrxUuidCell,
5554
5581
  {
5555
5582
  value,
@@ -5564,13 +5591,13 @@ function DataRowInspector({
5564
5591
  }
5565
5592
  const formatted = formatValue(value);
5566
5593
  const multiline = formatted.includes("\n") || formatted.length > 80;
5567
- return /* @__PURE__ */ jsxs21(
5594
+ return /* @__PURE__ */ jsxs20(
5568
5595
  "div",
5569
5596
  {
5570
5597
  className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 py-2 pl-2.5 pr-12",
5571
5598
  children: [
5572
- /* @__PURE__ */ jsx30("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
5573
- /* @__PURE__ */ jsx30(
5599
+ /* @__PURE__ */ jsx29("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
5600
+ /* @__PURE__ */ jsx29(
5574
5601
  "dd",
5575
5602
  {
5576
5603
  className: cn(
@@ -5593,7 +5620,7 @@ function DataRowInspector({
5593
5620
 
5594
5621
  // src/data-table/DataRowWindow.tsx
5595
5622
  import { useEffect as useEffect9, useState as useState12 } from "react";
5596
- import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
5623
+ import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
5597
5624
  function DataRowWindow({
5598
5625
  isOpen,
5599
5626
  onClose,
@@ -5619,9 +5646,9 @@ function DataRowWindow({
5619
5646
  setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
5620
5647
  }, [isOpen, windowId, hasEdit, defaultTab]);
5621
5648
  if (!isOpen) return null;
5622
- const viewBody = viewContent ?? /* @__PURE__ */ jsx31(DataRowInspector, { row });
5623
- const body = children ?? /* @__PURE__ */ jsx31("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ jsx31("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ jsx31("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ jsx31("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
5624
- return /* @__PURE__ */ jsx31(
5649
+ const viewBody = viewContent ?? /* @__PURE__ */ jsx30(DataRowInspector, { row });
5650
+ const body = children ?? /* @__PURE__ */ jsx30("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ jsx30("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ jsx30("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ jsx30("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
5651
+ return /* @__PURE__ */ jsx30(
5625
5652
  WindowPanel,
5626
5653
  {
5627
5654
  id: windowId,
@@ -5635,26 +5662,26 @@ function DataRowWindow({
5635
5662
  bodyClassName: "flex min-h-0 flex-1 flex-col overflow-hidden p-0",
5636
5663
  sidebarDefaultSize: 140,
5637
5664
  sidebarMinSize: 110,
5638
- sidebar: hasTabs ? /* @__PURE__ */ jsxs22(
5665
+ sidebar: hasTabs ? /* @__PURE__ */ jsxs21(
5639
5666
  "nav",
5640
5667
  {
5641
5668
  "aria-label": "Row window tabs",
5642
5669
  className: "flex h-full flex-col gap-0.5 overflow-y-auto p-1.5",
5643
5670
  children: [
5644
- /* @__PURE__ */ jsx31(
5671
+ /* @__PURE__ */ jsx30(
5645
5672
  TabButton,
5646
5673
  {
5647
5674
  active: tab === "view",
5648
- icon: /* @__PURE__ */ jsx31(Eye, { className: "h-4 w-4 shrink-0" }),
5675
+ icon: /* @__PURE__ */ jsx30(Eye, { className: "h-4 w-4 shrink-0" }),
5649
5676
  label: "View",
5650
5677
  onClick: () => setTab("view")
5651
5678
  }
5652
5679
  ),
5653
- /* @__PURE__ */ jsx31(
5680
+ /* @__PURE__ */ jsx30(
5654
5681
  TabButton,
5655
5682
  {
5656
5683
  active: tab === "edit",
5657
- icon: /* @__PURE__ */ jsx31(Pencil, { className: "h-4 w-4 shrink-0" }),
5684
+ icon: /* @__PURE__ */ jsx30(Pencil, { className: "h-4 w-4 shrink-0" }),
5658
5685
  label: "Edit",
5659
5686
  onClick: () => setTab("edit")
5660
5687
  }
@@ -5672,7 +5699,7 @@ function TabButton({
5672
5699
  label,
5673
5700
  onClick
5674
5701
  }) {
5675
- return /* @__PURE__ */ jsxs22(
5702
+ return /* @__PURE__ */ jsxs21(
5676
5703
  "button",
5677
5704
  {
5678
5705
  type: "button",
@@ -5685,14 +5712,14 @@ function TabButton({
5685
5712
  ),
5686
5713
  children: [
5687
5714
  icon,
5688
- /* @__PURE__ */ jsx31("span", { className: "min-w-0 flex-1 truncate", children: label })
5715
+ /* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1 truncate", children: label })
5689
5716
  ]
5690
5717
  }
5691
5718
  );
5692
5719
  }
5693
5720
 
5694
5721
  // src/data-table/DirtySavePill.tsx
5695
- import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
5722
+ import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
5696
5723
  function DirtySavePill({
5697
5724
  changeCount,
5698
5725
  saving,
@@ -5701,20 +5728,20 @@ function DirtySavePill({
5701
5728
  className
5702
5729
  }) {
5703
5730
  if (changeCount <= 0) return null;
5704
- return /* @__PURE__ */ jsx32(
5731
+ return /* @__PURE__ */ jsx31(
5705
5732
  "div",
5706
5733
  {
5707
5734
  className: cn(
5708
5735
  "pointer-events-none fixed inset-x-0 bottom-6 z-50 flex justify-center pb-safe",
5709
5736
  className
5710
5737
  ),
5711
- children: /* @__PURE__ */ jsxs23("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
5712
- /* @__PURE__ */ jsxs23("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
5738
+ children: /* @__PURE__ */ jsxs22("div", { className: "pointer-events-auto flex items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg elevation-2", children: [
5739
+ /* @__PURE__ */ jsxs22("span", { className: "px-1 text-xs font-medium text-muted-foreground", children: [
5713
5740
  changeCount,
5714
5741
  " unsaved change",
5715
5742
  changeCount === 1 ? "" : "s"
5716
5743
  ] }),
5717
- /* @__PURE__ */ jsxs23(
5744
+ /* @__PURE__ */ jsxs22(
5718
5745
  Button,
5719
5746
  {
5720
5747
  type: "button",
@@ -5724,12 +5751,12 @@ function DirtySavePill({
5724
5751
  disabled: saving,
5725
5752
  onClick: onCancel,
5726
5753
  children: [
5727
- /* @__PURE__ */ jsx32(X, { className: "h-3.5 w-3.5" }),
5754
+ /* @__PURE__ */ jsx31(X, { className: "h-3.5 w-3.5" }),
5728
5755
  "Cancel"
5729
5756
  ]
5730
5757
  }
5731
5758
  ),
5732
- /* @__PURE__ */ jsxs23(
5759
+ /* @__PURE__ */ jsxs22(
5733
5760
  Button,
5734
5761
  {
5735
5762
  type: "button",
@@ -5738,7 +5765,7 @@ function DirtySavePill({
5738
5765
  disabled: saving,
5739
5766
  onClick: onSave,
5740
5767
  children: [
5741
- saving ? /* @__PURE__ */ jsx32(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx32(Save, { className: "h-3.5 w-3.5" }),
5768
+ saving ? /* @__PURE__ */ jsx31(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx31(Save, { className: "h-3.5 w-3.5" }),
5742
5769
  "Save"
5743
5770
  ]
5744
5771
  }
@@ -5750,7 +5777,7 @@ function DirtySavePill({
5750
5777
 
5751
5778
  // src/data-table/EditableTableCell.tsx
5752
5779
  import { useState as useState13 } from "react";
5753
- import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
5780
+ import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
5754
5781
  function CellEditShell({
5755
5782
  href,
5756
5783
  display,
@@ -5759,8 +5786,8 @@ function CellEditShell({
5759
5786
  editButton
5760
5787
  }) {
5761
5788
  const { Link: HostLink } = useMatrxDataTableHost();
5762
- const Link = HostLink ?? ((props) => /* @__PURE__ */ jsx33("a", { ...props }));
5763
- return /* @__PURE__ */ jsxs24(
5789
+ const Link = HostLink ?? ((props) => /* @__PURE__ */ jsx32("a", { ...props }));
5790
+ return /* @__PURE__ */ jsxs23(
5764
5791
  "span",
5765
5792
  {
5766
5793
  className: cn(
@@ -5772,7 +5799,7 @@ function CellEditShell({
5772
5799
  className
5773
5800
  ),
5774
5801
  children: [
5775
- href ? /* @__PURE__ */ jsx33(
5802
+ href ? /* @__PURE__ */ jsx32(
5776
5803
  Link,
5777
5804
  {
5778
5805
  href,
@@ -5780,13 +5807,13 @@ function CellEditShell({
5780
5807
  className: "min-w-0 flex-1 overflow-hidden truncate rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
5781
5808
  children: display
5782
5809
  }
5783
- ) : /* @__PURE__ */ jsx33("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
5810
+ ) : /* @__PURE__ */ jsx32("span", { className: "block min-w-0 flex-1 overflow-hidden", children: display }),
5784
5811
  editButton
5785
5812
  ]
5786
5813
  }
5787
5814
  );
5788
5815
  }
5789
- var CELL_PENCIL_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-muted/60 focus-visible:opacity-100 group-hover/cell-link:opacity-100";
5816
+ var CELL_PENCIL_CLASS = "shrink-0 rounded p-0.5 text-muted-foreground opacity-100 transition-opacity hover:bg-muted/60 focus-visible:opacity-100 lg:opacity-0 group-hover/cell-link:opacity-100";
5790
5817
  function EditableTableCell({
5791
5818
  value,
5792
5819
  editType,
@@ -5801,7 +5828,7 @@ function EditableTableCell({
5801
5828
  const [open, setOpen] = useState13(false);
5802
5829
  const usePencil = Boolean(href) || editTrigger === "pencil";
5803
5830
  if (editType === "string") {
5804
- return /* @__PURE__ */ jsx33(
5831
+ return /* @__PURE__ */ jsx32(
5805
5832
  InlineStringEditor,
5806
5833
  {
5807
5834
  value: stringifyCellValue(value),
@@ -5814,30 +5841,30 @@ function EditableTableCell({
5814
5841
  }
5815
5842
  );
5816
5843
  }
5817
- return /* @__PURE__ */ jsxs24(Popover, { open, onOpenChange: setOpen, children: [
5818
- usePencil ? /* @__PURE__ */ jsx33(
5844
+ return /* @__PURE__ */ jsxs23(Popover, { open, onOpenChange: setOpen, children: [
5845
+ usePencil ? /* @__PURE__ */ jsx32(
5819
5846
  CellEditShell,
5820
5847
  {
5821
5848
  ...href === void 0 ? {} : { href },
5822
5849
  display,
5823
5850
  ...dirty === void 0 ? {} : { dirty },
5824
5851
  ...className === void 0 ? {} : { className },
5825
- editButton: /* @__PURE__ */ jsxs24(Tooltip, { children: [
5826
- /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(
5852
+ editButton: /* @__PURE__ */ jsxs23(Tooltip, { children: [
5853
+ /* @__PURE__ */ jsx32(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx32(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx32(
5827
5854
  "button",
5828
5855
  {
5829
5856
  type: "button",
5830
5857
  "aria-label": "Edit",
5831
5858
  onClick: (e) => e.stopPropagation(),
5832
5859
  className: CELL_PENCIL_CLASS,
5833
- children: /* @__PURE__ */ jsx33(Pencil, { className: "h-3 w-3" })
5860
+ children: /* @__PURE__ */ jsx32(Pencil, { className: "h-3 w-3" })
5834
5861
  }
5835
5862
  ) }) }),
5836
- /* @__PURE__ */ jsx33(TooltipContent, { children: "Edit" })
5863
+ /* @__PURE__ */ jsx32(TooltipContent, { children: "Edit" })
5837
5864
  ] })
5838
5865
  }
5839
- ) : /* @__PURE__ */ jsxs24(Tooltip, { children: [
5840
- /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs24(
5866
+ ) : /* @__PURE__ */ jsxs23(Tooltip, { children: [
5867
+ /* @__PURE__ */ jsx32(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx32(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs23(
5841
5868
  "button",
5842
5869
  {
5843
5870
  type: "button",
@@ -5848,20 +5875,20 @@ function EditableTableCell({
5848
5875
  className
5849
5876
  ),
5850
5877
  children: [
5851
- /* @__PURE__ */ jsx33("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
5852
- editType === "select" ? /* @__PURE__ */ jsx33(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
5878
+ /* @__PURE__ */ jsx32("span", { className: "min-w-0 flex-1 overflow-hidden", children: display }),
5879
+ editType === "select" ? /* @__PURE__ */ jsx32(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground/70 transition-colors group-hover/cell-select:text-foreground" }) : null
5853
5880
  ]
5854
5881
  }
5855
5882
  ) }) }),
5856
- /* @__PURE__ */ jsx33(TooltipContent, { children: "Edit value" })
5883
+ /* @__PURE__ */ jsx32(TooltipContent, { children: "Edit value" })
5857
5884
  ] }),
5858
- /* @__PURE__ */ jsx33(
5885
+ /* @__PURE__ */ jsx32(
5859
5886
  PopoverContent,
5860
5887
  {
5861
5888
  align: "start",
5862
5889
  className: "w-56 p-2",
5863
5890
  onClick: (e) => e.stopPropagation(),
5864
- children: /* @__PURE__ */ jsx33(
5891
+ children: /* @__PURE__ */ jsx32(
5865
5892
  TypedEditor,
5866
5893
  {
5867
5894
  editType,
@@ -5891,15 +5918,15 @@ function InlineStringEditor({
5891
5918
  const [draft, setDraft] = useState13(value);
5892
5919
  if (!editing) {
5893
5920
  if (usePencil) {
5894
- return /* @__PURE__ */ jsx33(
5921
+ return /* @__PURE__ */ jsx32(
5895
5922
  CellEditShell,
5896
5923
  {
5897
5924
  ...href === void 0 ? {} : { href },
5898
5925
  display,
5899
5926
  ...dirty === void 0 ? {} : { dirty },
5900
5927
  ...className === void 0 ? {} : { className },
5901
- editButton: /* @__PURE__ */ jsxs24(Tooltip, { children: [
5902
- /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(
5928
+ editButton: /* @__PURE__ */ jsxs23(Tooltip, { children: [
5929
+ /* @__PURE__ */ jsx32(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx32(
5903
5930
  "button",
5904
5931
  {
5905
5932
  type: "button",
@@ -5910,16 +5937,16 @@ function InlineStringEditor({
5910
5937
  setEditing(true);
5911
5938
  },
5912
5939
  className: CELL_PENCIL_CLASS,
5913
- children: /* @__PURE__ */ jsx33(Pencil, { className: "h-3 w-3" })
5940
+ children: /* @__PURE__ */ jsx32(Pencil, { className: "h-3 w-3" })
5914
5941
  }
5915
5942
  ) }),
5916
- /* @__PURE__ */ jsx33(TooltipContent, { children: "Edit" })
5943
+ /* @__PURE__ */ jsx32(TooltipContent, { children: "Edit" })
5917
5944
  ] })
5918
5945
  }
5919
5946
  );
5920
5947
  }
5921
- return /* @__PURE__ */ jsxs24(Tooltip, { children: [
5922
- /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(
5948
+ return /* @__PURE__ */ jsxs23(Tooltip, { children: [
5949
+ /* @__PURE__ */ jsx32(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx32(
5923
5950
  "button",
5924
5951
  {
5925
5952
  type: "button",
@@ -5936,10 +5963,10 @@ function InlineStringEditor({
5936
5963
  children: display
5937
5964
  }
5938
5965
  ) }),
5939
- /* @__PURE__ */ jsx33(TooltipContent, { children: "Click to edit" })
5966
+ /* @__PURE__ */ jsx32(TooltipContent, { children: "Click to edit" })
5940
5967
  ] });
5941
5968
  }
5942
- return /* @__PURE__ */ jsx33(
5969
+ return /* @__PURE__ */ jsx32(
5943
5970
  Input,
5944
5971
  {
5945
5972
  autoFocus: true,
@@ -5975,9 +6002,9 @@ function TypedEditor({
5975
6002
  }) {
5976
6003
  if (editType === "boolean") {
5977
6004
  const checked = Boolean(value);
5978
- return /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-2", children: [
5979
- /* @__PURE__ */ jsx33("span", { className: "text-xs font-medium", children: "Value" }),
5980
- /* @__PURE__ */ jsx33(
6005
+ return /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between gap-2", children: [
6006
+ /* @__PURE__ */ jsx32("span", { className: "text-xs font-medium", children: "Value" }),
6007
+ /* @__PURE__ */ jsx32(
5981
6008
  Checkbox,
5982
6009
  {
5983
6010
  checked,
@@ -5987,7 +6014,7 @@ function TypedEditor({
5987
6014
  ] });
5988
6015
  }
5989
6016
  if (editType === "number") {
5990
- return /* @__PURE__ */ jsx33(
6017
+ return /* @__PURE__ */ jsx32(
5991
6018
  NumberEditor,
5992
6019
  {
5993
6020
  value: typeof value === "number" ? value : Number(value) || 0,
@@ -5997,7 +6024,7 @@ function TypedEditor({
5997
6024
  );
5998
6025
  }
5999
6026
  if (editType === "tags") {
6000
- return /* @__PURE__ */ jsx33(
6027
+ return /* @__PURE__ */ jsx32(
6001
6028
  TagsEditor,
6002
6029
  {
6003
6030
  value: Array.isArray(value) ? value.map(String) : [],
@@ -6008,19 +6035,19 @@ function TypedEditor({
6008
6035
  );
6009
6036
  }
6010
6037
  if (editType === "select") {
6011
- return /* @__PURE__ */ jsxs24(
6038
+ return /* @__PURE__ */ jsxs23(
6012
6039
  Select,
6013
6040
  {
6014
6041
  value: stringifyCellValue(value),
6015
6042
  onValueChange: (v) => onCommit(v),
6016
6043
  children: [
6017
- /* @__PURE__ */ jsx33(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx33(SelectValue, {}) }),
6018
- /* @__PURE__ */ jsx33(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ jsx33(SelectItem, { value: o.value, children: o.label }, o.value)) })
6044
+ /* @__PURE__ */ jsx32(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx32(SelectValue, {}) }),
6045
+ /* @__PURE__ */ jsx32(SelectContent, { children: editOptions.map((o) => /* @__PURE__ */ jsx32(SelectItem, { value: o.value, children: o.label }, o.value)) })
6019
6046
  ]
6020
6047
  }
6021
6048
  );
6022
6049
  }
6023
- return /* @__PURE__ */ jsx33(
6050
+ return /* @__PURE__ */ jsx32(
6024
6051
  Input,
6025
6052
  {
6026
6053
  type: "date",
@@ -6050,11 +6077,11 @@ function TagsEditor({
6050
6077
  const matches = suggestions.filter(
6051
6078
  (s) => !tags.includes(s.value) && s.value !== "__none__" && (!draft || s.label.toLowerCase().includes(draft.trim().toLowerCase()))
6052
6079
  ).slice(0, 6);
6053
- return /* @__PURE__ */ jsxs24("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
6054
- /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap gap-1", children: [
6055
- tags.length === 0 && /* @__PURE__ */ jsx33("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
6056
- tags.map((tag) => /* @__PURE__ */ jsxs24(Tooltip, { children: [
6057
- /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs24(
6080
+ return /* @__PURE__ */ jsxs23("div", { className: "space-y-2", onClick: (e) => e.stopPropagation(), children: [
6081
+ /* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-1", children: [
6082
+ tags.length === 0 && /* @__PURE__ */ jsx32("span", { className: "text-xs text-muted-foreground", children: "No tags" }),
6083
+ tags.map((tag) => /* @__PURE__ */ jsxs23(Tooltip, { children: [
6084
+ /* @__PURE__ */ jsx32(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs23(
6058
6085
  "button",
6059
6086
  {
6060
6087
  type: "button",
@@ -6063,17 +6090,17 @@ function TagsEditor({
6063
6090
  className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px] hover:border-destructive hover:text-destructive",
6064
6091
  children: [
6065
6092
  tag,
6066
- /* @__PURE__ */ jsx33(X, { className: "h-2.5 w-2.5" })
6093
+ /* @__PURE__ */ jsx32(X, { className: "h-2.5 w-2.5" })
6067
6094
  ]
6068
6095
  }
6069
6096
  ) }),
6070
- /* @__PURE__ */ jsxs24(TooltipContent, { children: [
6097
+ /* @__PURE__ */ jsxs23(TooltipContent, { children: [
6071
6098
  "Remove ",
6072
6099
  tag
6073
6100
  ] })
6074
6101
  ] }, tag))
6075
6102
  ] }),
6076
- /* @__PURE__ */ jsx33(
6103
+ /* @__PURE__ */ jsx32(
6077
6104
  Input,
6078
6105
  {
6079
6106
  autoFocus: true,
@@ -6094,7 +6121,7 @@ function TagsEditor({
6094
6121
  className: "h-8 text-xs"
6095
6122
  }
6096
6123
  ),
6097
- matches.length > 0 && /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ jsxs24(
6124
+ matches.length > 0 && /* @__PURE__ */ jsx32("div", { className: "flex flex-wrap gap-1", children: matches.map((s) => /* @__PURE__ */ jsxs23(
6098
6125
  "button",
6099
6126
  {
6100
6127
  type: "button",
@@ -6107,8 +6134,8 @@ function TagsEditor({
6107
6134
  },
6108
6135
  s.value
6109
6136
  )) }),
6110
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-end gap-1 pt-1", children: [
6111
- /* @__PURE__ */ jsx33(
6137
+ /* @__PURE__ */ jsxs23("div", { className: "flex justify-end gap-1 pt-1", children: [
6138
+ /* @__PURE__ */ jsx32(
6112
6139
  Button,
6113
6140
  {
6114
6141
  size: "sm",
@@ -6116,17 +6143,17 @@ function TagsEditor({
6116
6143
  className: "h-7 px-2",
6117
6144
  "aria-label": "Cancel edit",
6118
6145
  onClick: onCancel,
6119
- children: /* @__PURE__ */ jsx33(X, { className: "h-3.5 w-3.5" })
6146
+ children: /* @__PURE__ */ jsx32(X, { className: "h-3.5 w-3.5" })
6120
6147
  }
6121
6148
  ),
6122
- /* @__PURE__ */ jsx33(
6149
+ /* @__PURE__ */ jsx32(
6123
6150
  Button,
6124
6151
  {
6125
6152
  size: "sm",
6126
6153
  className: "h-7 px-2",
6127
6154
  "aria-label": "Apply tags",
6128
6155
  onClick: () => onCommit(tags),
6129
- children: /* @__PURE__ */ jsx33(Check, { className: "h-3.5 w-3.5" })
6156
+ children: /* @__PURE__ */ jsx32(Check, { className: "h-3.5 w-3.5" })
6130
6157
  }
6131
6158
  )
6132
6159
  ] })
@@ -6138,8 +6165,8 @@ function NumberEditor({
6138
6165
  onCancel
6139
6166
  }) {
6140
6167
  const [draft, setDraft] = useState13(String(value));
6141
- return /* @__PURE__ */ jsxs24("div", { className: "flex flex-col gap-2", children: [
6142
- /* @__PURE__ */ jsx33(
6168
+ return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-2", children: [
6169
+ /* @__PURE__ */ jsx32(
6143
6170
  Input,
6144
6171
  {
6145
6172
  autoFocus: true,
@@ -6156,8 +6183,8 @@ function NumberEditor({
6156
6183
  }
6157
6184
  }
6158
6185
  ),
6159
- /* @__PURE__ */ jsxs24("div", { className: "flex justify-end gap-1", children: [
6160
- /* @__PURE__ */ jsx33(
6186
+ /* @__PURE__ */ jsxs23("div", { className: "flex justify-end gap-1", children: [
6187
+ /* @__PURE__ */ jsx32(
6161
6188
  Button,
6162
6189
  {
6163
6190
  type: "button",
@@ -6166,10 +6193,10 @@ function NumberEditor({
6166
6193
  className: "h-7",
6167
6194
  "aria-label": "Cancel edit",
6168
6195
  onClick: onCancel,
6169
- children: /* @__PURE__ */ jsx33(X, { className: "h-3.5 w-3.5" })
6196
+ children: /* @__PURE__ */ jsx32(X, { className: "h-3.5 w-3.5" })
6170
6197
  }
6171
6198
  ),
6172
- /* @__PURE__ */ jsx33(
6199
+ /* @__PURE__ */ jsx32(
6173
6200
  Button,
6174
6201
  {
6175
6202
  type: "button",
@@ -6180,7 +6207,7 @@ function NumberEditor({
6180
6207
  const n = Number(draft);
6181
6208
  if (Number.isFinite(n)) onCommit(n);
6182
6209
  },
6183
- children: /* @__PURE__ */ jsx33(Check, { className: "h-3.5 w-3.5" })
6210
+ children: /* @__PURE__ */ jsx32(Check, { className: "h-3.5 w-3.5" })
6184
6211
  }
6185
6212
  )
6186
6213
  ] })
@@ -6188,24 +6215,24 @@ function NumberEditor({
6188
6215
  }
6189
6216
 
6190
6217
  // src/data-table/ToolbarFacets.tsx
6191
- import { jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
6218
+ import { jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
6192
6219
  function ToolbarFacets({ facets }) {
6193
6220
  if (facets.length === 0) return null;
6194
- return /* @__PURE__ */ jsx34("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
6221
+ return /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap items-center gap-2", children: facets.map((facet) => {
6195
6222
  if (facet.type === "custom") {
6196
- return /* @__PURE__ */ jsx34("div", { children: facet.render() }, facet.id);
6223
+ return /* @__PURE__ */ jsx33("div", { children: facet.render() }, facet.id);
6197
6224
  }
6198
6225
  const defaultValue = facet.defaultValue ?? facet.options[0]?.value ?? "";
6199
6226
  const isNonDefault = facet.value !== defaultValue;
6200
- return /* @__PURE__ */ jsxs25(
6227
+ return /* @__PURE__ */ jsxs24(
6201
6228
  "div",
6202
6229
  {
6203
6230
  className: "flex flex-wrap items-center gap-1.5 max-sm:grid max-sm:w-full max-sm:grid-cols-3",
6204
6231
  children: [
6205
- facet.label ? /* @__PURE__ */ jsx34("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
6232
+ facet.label ? /* @__PURE__ */ jsx33("span", { className: "mr-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: facet.label }) : null,
6206
6233
  facet.options.map((opt) => {
6207
6234
  const active = facet.value === opt.value;
6208
- return /* @__PURE__ */ jsxs25(
6235
+ return /* @__PURE__ */ jsxs24(
6209
6236
  Button,
6210
6237
  {
6211
6238
  type: "button",
@@ -6219,8 +6246,8 @@ function ToolbarFacets({ facets }) {
6219
6246
  children: [
6220
6247
  opt.icon,
6221
6248
  opt.label,
6222
- active && isNonDefault ? /* @__PURE__ */ jsx34(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs25(Tooltip, { children: [
6223
- /* @__PURE__ */ jsx34(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx34(
6249
+ active && isNonDefault ? /* @__PURE__ */ jsx33(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs24(Tooltip, { children: [
6250
+ /* @__PURE__ */ jsx33(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx33(
6224
6251
  "span",
6225
6252
  {
6226
6253
  role: "button",
@@ -6238,10 +6265,10 @@ function ToolbarFacets({ facets }) {
6238
6265
  facet.onChange(defaultValue);
6239
6266
  }
6240
6267
  },
6241
- children: /* @__PURE__ */ jsx34(X, { className: "h-3 w-3" })
6268
+ children: /* @__PURE__ */ jsx33(X, { className: "h-3 w-3" })
6242
6269
  }
6243
6270
  ) }),
6244
- /* @__PURE__ */ jsx34(TooltipContent, { side: "top", children: "Clear this filter" })
6271
+ /* @__PURE__ */ jsx33(TooltipContent, { side: "top", children: "Clear this filter" })
6245
6272
  ] }) }) : null
6246
6273
  ]
6247
6274
  },
@@ -6265,7 +6292,7 @@ function resetToolbarFacets(facets) {
6265
6292
 
6266
6293
  // src/data-table/LayeredFilterBuilder.tsx
6267
6294
  import { useState as useState14 } from "react";
6268
- import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
6295
+ import { Fragment as Fragment5, jsx as jsx34, jsxs as jsxs25 } from "react/jsx-runtime";
6269
6296
  function moveRule(rules, from, to) {
6270
6297
  if (from === to || to < 0 || to >= rules.length) return [...rules];
6271
6298
  const next = [...rules];
@@ -6311,8 +6338,8 @@ function LayeredFilterBuilder({
6311
6338
  const reorder = (from, to) => {
6312
6339
  onChange(moveRule(rules, from, to));
6313
6340
  };
6314
- return /* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
6315
- /* @__PURE__ */ jsxs26(
6341
+ return /* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-wrap items-center gap-1", children: [
6342
+ /* @__PURE__ */ jsxs25(
6316
6343
  Popover,
6317
6344
  {
6318
6345
  open,
@@ -6324,7 +6351,7 @@ function LayeredFilterBuilder({
6324
6351
  }
6325
6352
  },
6326
6353
  children: [
6327
- /* @__PURE__ */ jsx35(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs26(
6354
+ /* @__PURE__ */ jsx34(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs25(
6328
6355
  Button,
6329
6356
  {
6330
6357
  type: "button",
@@ -6333,25 +6360,25 @@ function LayeredFilterBuilder({
6333
6360
  className: "h-8 gap-1.5 px-2 text-xs",
6334
6361
  "aria-label": label,
6335
6362
  children: [
6336
- /* @__PURE__ */ jsx35(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
6337
- /* @__PURE__ */ jsx35("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
6338
- rules.length > 0 ? /* @__PURE__ */ jsx35("span", { className: "sm:hidden", children: rules.length }) : null
6363
+ /* @__PURE__ */ jsx34(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
6364
+ /* @__PURE__ */ jsx34("span", { className: "hidden sm:inline", children: rules.length > 0 ? `${rules.length} layers` : "Advanced" }),
6365
+ rules.length > 0 ? /* @__PURE__ */ jsx34("span", { className: "sm:hidden", children: rules.length }) : null
6339
6366
  ]
6340
6367
  }
6341
6368
  ) }),
6342
- /* @__PURE__ */ jsxs26(
6369
+ /* @__PURE__ */ jsxs25(
6343
6370
  PopoverContent,
6344
6371
  {
6345
6372
  align: "start",
6346
6373
  sideOffset: 6,
6347
6374
  className: "w-[min(46rem,calc(100vw-1rem))] p-0",
6348
6375
  children: [
6349
- /* @__PURE__ */ jsxs26("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
6350
- /* @__PURE__ */ jsxs26("div", { children: [
6351
- /* @__PURE__ */ jsx35("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
6352
- /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
6376
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5", children: [
6377
+ /* @__PURE__ */ jsxs25("div", { children: [
6378
+ /* @__PURE__ */ jsx34("p", { className: "text-sm font-semibold text-foreground", children: "Narrow these results" }),
6379
+ /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: "Every layer must match. Drag layers to put them in the order that makes sense to you." })
6353
6380
  ] }),
6354
- rules.length > 0 ? /* @__PURE__ */ jsx35(
6381
+ rules.length > 0 ? /* @__PURE__ */ jsx34(
6355
6382
  Button,
6356
6383
  {
6357
6384
  type: "button",
@@ -6363,10 +6390,10 @@ function LayeredFilterBuilder({
6363
6390
  }
6364
6391
  ) : null
6365
6392
  ] }),
6366
- /* @__PURE__ */ jsx35("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ jsxs26("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
6367
- /* @__PURE__ */ jsx35("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
6368
- /* @__PURE__ */ jsx35("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
6369
- ] }) : rules.map((rule, index) => /* @__PURE__ */ jsx35(
6393
+ /* @__PURE__ */ jsx34("div", { className: "max-h-[min(28rem,65dvh)] space-y-1.5 overflow-y-auto p-2.5 scrollbar-thin", children: rules.length === 0 ? /* @__PURE__ */ jsxs25("div", { className: "rounded-md border border-dashed border-border px-3 py-5 text-center", children: [
6394
+ /* @__PURE__ */ jsx34("p", { className: "text-sm font-medium text-foreground", children: "Start with one simple layer" }),
6395
+ /* @__PURE__ */ jsx34("p", { className: "mt-1 text-xs text-muted-foreground", children: "For example: Keyword contains ITAD, then Keyword doesn't have the word \u201Cwhat\u201D." })
6396
+ ] }) : rules.map((rule, index) => /* @__PURE__ */ jsx34(
6370
6397
  LayeredRuleRow,
6371
6398
  {
6372
6399
  index,
@@ -6386,9 +6413,9 @@ function LayeredFilterBuilder({
6386
6413
  },
6387
6414
  rule.id
6388
6415
  )) }),
6389
- /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
6390
- /* @__PURE__ */ jsx35("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
6391
- /* @__PURE__ */ jsxs26(
6416
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between gap-2 border-t border-border px-3 py-2", children: [
6417
+ /* @__PURE__ */ jsx34("p", { className: "text-[11px] text-muted-foreground", children: "The regular search still works and is applied before these layers." }),
6418
+ /* @__PURE__ */ jsxs25(
6392
6419
  Button,
6393
6420
  {
6394
6421
  type: "button",
@@ -6398,7 +6425,7 @@ function LayeredFilterBuilder({
6398
6425
  disabled: rules.length >= maxRules,
6399
6426
  onClick: addRule,
6400
6427
  children: [
6401
- /* @__PURE__ */ jsx35(Plus, { className: "h-3.5 w-3.5" }),
6428
+ /* @__PURE__ */ jsx34(Plus, { className: "h-3.5 w-3.5" }),
6402
6429
  " Add layer"
6403
6430
  ]
6404
6431
  }
@@ -6410,7 +6437,7 @@ function LayeredFilterBuilder({
6410
6437
  ]
6411
6438
  }
6412
6439
  ),
6413
- rules.map((rule, index) => /* @__PURE__ */ jsxs26(
6440
+ rules.map((rule, index) => /* @__PURE__ */ jsxs25(
6414
6441
  "span",
6415
6442
  {
6416
6443
  className: cn(
@@ -6418,7 +6445,7 @@ function LayeredFilterBuilder({
6418
6445
  isCompleteLayeredFilterRule(rule) ? "border-border bg-muted/50 text-foreground" : "border-dashed border-warning/50 bg-warning/10 text-warning"
6419
6446
  ),
6420
6447
  children: [
6421
- /* @__PURE__ */ jsxs26(
6448
+ /* @__PURE__ */ jsxs25(
6422
6449
  "button",
6423
6450
  {
6424
6451
  type: "button",
@@ -6426,19 +6453,19 @@ function LayeredFilterBuilder({
6426
6453
  onClick: () => setOpen(true),
6427
6454
  title: isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : `Layer ${index + 1} needs a value`,
6428
6455
  children: [
6429
- /* @__PURE__ */ jsx35("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
6456
+ /* @__PURE__ */ jsx34("span", { className: "mr-1 text-muted-foreground", children: index + 1 }),
6430
6457
  isCompleteLayeredFilterRule(rule) ? layeredFilterRuleSummary(rule, fields) : "Choose a value"
6431
6458
  ]
6432
6459
  }
6433
6460
  ),
6434
- /* @__PURE__ */ jsx35(
6461
+ /* @__PURE__ */ jsx34(
6435
6462
  "button",
6436
6463
  {
6437
6464
  type: "button",
6438
6465
  className: "shrink-0 rounded-full p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
6439
6466
  "aria-label": `Remove filter layer ${index + 1}`,
6440
6467
  onClick: () => removeRule(index),
6441
- children: /* @__PURE__ */ jsx35(X, { className: "h-3 w-3" })
6468
+ children: /* @__PURE__ */ jsx34(X, { className: "h-3 w-3" })
6442
6469
  }
6443
6470
  )
6444
6471
  ]
@@ -6468,7 +6495,7 @@ function LayeredRuleRow({
6468
6495
  event.preventDefault();
6469
6496
  onKeyboardMove(event.key === "ArrowUp" ? -1 : 1);
6470
6497
  };
6471
- return /* @__PURE__ */ jsxs26(
6498
+ return /* @__PURE__ */ jsxs25(
6472
6499
  "div",
6473
6500
  {
6474
6501
  className: cn(
@@ -6481,7 +6508,7 @@ function LayeredRuleRow({
6481
6508
  onDrop(index);
6482
6509
  },
6483
6510
  children: [
6484
- /* @__PURE__ */ jsx35(
6511
+ /* @__PURE__ */ jsx34(
6485
6512
  "button",
6486
6513
  {
6487
6514
  type: "button",
@@ -6495,10 +6522,10 @@ function LayeredRuleRow({
6495
6522
  },
6496
6523
  onDragEnd,
6497
6524
  onKeyDown: handleMoveKey,
6498
- children: /* @__PURE__ */ jsx35(GripVertical, { className: "h-3.5 w-3.5" })
6525
+ children: /* @__PURE__ */ jsx34(GripVertical, { className: "h-3.5 w-3.5" })
6499
6526
  }
6500
6527
  ),
6501
- /* @__PURE__ */ jsxs26(
6528
+ /* @__PURE__ */ jsxs25(
6502
6529
  Select,
6503
6530
  {
6504
6531
  value: field.id,
@@ -6516,16 +6543,16 @@ function LayeredRuleRow({
6516
6543
  });
6517
6544
  },
6518
6545
  children: [
6519
- /* @__PURE__ */ jsx35(
6546
+ /* @__PURE__ */ jsx34(
6520
6547
  SelectTrigger,
6521
6548
  {
6522
6549
  size: "sm",
6523
6550
  className: "h-7 w-full text-xs max-sm:col-span-1",
6524
6551
  "aria-label": `Filter layer ${index + 1} field`,
6525
- children: /* @__PURE__ */ jsx35(SelectValue, {})
6552
+ children: /* @__PURE__ */ jsx34(SelectValue, {})
6526
6553
  }
6527
6554
  ),
6528
- /* @__PURE__ */ jsx35(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ jsx35(
6555
+ /* @__PURE__ */ jsx34(SelectContent, { children: fields.map((candidate) => /* @__PURE__ */ jsx34(
6529
6556
  SelectItem,
6530
6557
  {
6531
6558
  value: candidate.id,
@@ -6537,7 +6564,7 @@ function LayeredRuleRow({
6537
6564
  ]
6538
6565
  }
6539
6566
  ),
6540
- /* @__PURE__ */ jsxs26(
6567
+ /* @__PURE__ */ jsxs25(
6541
6568
  Select,
6542
6569
  {
6543
6570
  value: rule.operator,
@@ -6549,35 +6576,35 @@ function LayeredRuleRow({
6549
6576
  });
6550
6577
  },
6551
6578
  children: [
6552
- /* @__PURE__ */ jsx35(
6579
+ /* @__PURE__ */ jsx34(
6553
6580
  SelectTrigger,
6554
6581
  {
6555
6582
  size: "sm",
6556
6583
  className: "h-7 w-full text-xs max-sm:col-start-2",
6557
6584
  "aria-label": `Filter layer ${index + 1} operator`,
6558
- children: /* @__PURE__ */ jsx35(SelectValue, {})
6585
+ children: /* @__PURE__ */ jsx34(SelectValue, {})
6559
6586
  }
6560
6587
  ),
6561
- /* @__PURE__ */ jsx35(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ jsx35(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
6588
+ /* @__PURE__ */ jsx34(SelectContent, { children: operators.map((operator) => /* @__PURE__ */ jsx34(SelectItem, { value: operator, className: "text-xs", children: LAYERED_FILTER_OPERATOR_LABELS[operator] }, operator)) })
6562
6589
  ]
6563
6590
  }
6564
6591
  ),
6565
- /* @__PURE__ */ jsx35("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ jsx35("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ jsxs26(
6592
+ /* @__PURE__ */ jsx34("div", { className: "min-w-0 max-sm:col-span-3 max-sm:col-start-1", children: !needsValue ? /* @__PURE__ */ jsx34("span", { className: "flex h-7 items-center px-2 text-xs text-muted-foreground", children: "No value needed" }) : field.kind === "select" ? /* @__PURE__ */ jsxs25(
6566
6593
  Select,
6567
6594
  {
6568
6595
  value: rule.value,
6569
6596
  onValueChange: (value) => onChange({ value }),
6570
6597
  children: [
6571
- /* @__PURE__ */ jsx35(
6598
+ /* @__PURE__ */ jsx34(
6572
6599
  SelectTrigger,
6573
6600
  {
6574
6601
  size: "sm",
6575
6602
  className: "h-7 w-full text-xs",
6576
6603
  "aria-label": `Filter layer ${index + 1} value`,
6577
- children: /* @__PURE__ */ jsx35(SelectValue, {})
6604
+ children: /* @__PURE__ */ jsx34(SelectValue, {})
6578
6605
  }
6579
6606
  ),
6580
- /* @__PURE__ */ jsx35(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ jsx35(
6607
+ /* @__PURE__ */ jsx34(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ jsx34(
6581
6608
  SelectItem,
6582
6609
  {
6583
6610
  value: option.value,
@@ -6588,8 +6615,8 @@ function LayeredRuleRow({
6588
6615
  )) })
6589
6616
  ]
6590
6617
  }
6591
- ) : /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-1", children: [
6592
- /* @__PURE__ */ jsx35(
6618
+ ) : /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
6619
+ /* @__PURE__ */ jsx34(
6593
6620
  Input,
6594
6621
  {
6595
6622
  value: rule.value,
@@ -6600,9 +6627,9 @@ function LayeredRuleRow({
6600
6627
  "aria-label": `Filter layer ${index + 1} value`
6601
6628
  }
6602
6629
  ),
6603
- rule.operator === "between" ? /* @__PURE__ */ jsxs26(Fragment5, { children: [
6604
- /* @__PURE__ */ jsx35("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
6605
- /* @__PURE__ */ jsx35(
6630
+ rule.operator === "between" ? /* @__PURE__ */ jsxs25(Fragment5, { children: [
6631
+ /* @__PURE__ */ jsx34("span", { className: "text-[11px] text-muted-foreground", children: "and" }),
6632
+ /* @__PURE__ */ jsx34(
6606
6633
  Input,
6607
6634
  {
6608
6635
  value: rule.valueTo ?? "",
@@ -6615,7 +6642,7 @@ function LayeredRuleRow({
6615
6642
  )
6616
6643
  ] }) : null
6617
6644
  ] }) }),
6618
- /* @__PURE__ */ jsx35(
6645
+ /* @__PURE__ */ jsx34(
6619
6646
  Button,
6620
6647
  {
6621
6648
  type: "button",
@@ -6624,7 +6651,7 @@ function LayeredRuleRow({
6624
6651
  className: "h-7 w-7 p-0 text-muted-foreground hover:text-destructive max-sm:col-start-3 max-sm:row-start-1",
6625
6652
  "aria-label": `Remove filter layer ${index + 1}`,
6626
6653
  onClick: onRemove,
6627
- children: /* @__PURE__ */ jsx35(Trash2, { className: "h-3.5 w-3.5" })
6654
+ children: /* @__PURE__ */ jsx34(Trash2, { className: "h-3.5 w-3.5" })
6628
6655
  }
6629
6656
  )
6630
6657
  ]
@@ -6723,7 +6750,7 @@ function safeQueryPage(requestedPage, totalItems, pageSize) {
6723
6750
  }
6724
6751
 
6725
6752
  // src/data-table/MatrxDataTable.tsx
6726
- import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
6753
+ import { Fragment as Fragment7, jsx as jsx35, jsxs as jsxs26 } from "react/jsx-runtime";
6727
6754
  function hasSameRowReferences(previous, next) {
6728
6755
  return previous.length === next.length && previous.every((row, index) => row === next[index]);
6729
6756
  }
@@ -6734,7 +6761,7 @@ function TableRowCopyControl({
6734
6761
  sourceId,
6735
6762
  defaultColumns
6736
6763
  }) {
6737
- return /* @__PURE__ */ jsx36(
6764
+ return /* @__PURE__ */ jsx35(
6738
6765
  CopyButtons,
6739
6766
  {
6740
6767
  size,
@@ -6756,8 +6783,8 @@ function isStringArray(value) {
6756
6783
  }
6757
6784
  var activeUrlTableIds = /* @__PURE__ */ new Set();
6758
6785
  function MatrxDataTable(props) {
6759
- if (!props.urlState) return /* @__PURE__ */ jsx36(MatrxDataTableCore, { ...props });
6760
- return /* @__PURE__ */ jsx36(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
6786
+ if (!props.urlState) return /* @__PURE__ */ jsx35(MatrxDataTableCore, { ...props });
6787
+ return /* @__PURE__ */ jsx35(MatrxDataTableWithUrlState, { ...props, urlState: props.urlState });
6761
6788
  }
6762
6789
  function MatrxDataTableWithUrlState({
6763
6790
  urlState,
@@ -6812,7 +6839,7 @@ function MatrxDataTableWithUrlState({
6812
6839
  props.selection?.onSelectedIdsChange(ids);
6813
6840
  }
6814
6841
  } : props.selection;
6815
- return /* @__PURE__ */ jsx36(
6842
+ return /* @__PURE__ */ jsx35(
6816
6843
  MatrxDataTableCore,
6817
6844
  {
6818
6845
  ...props,
@@ -6848,8 +6875,10 @@ var COLUMN_REORDER_ACTIVATION_DISTANCE = 6;
6848
6875
  function MatrxDataTableCore({
6849
6876
  data: suppliedData,
6850
6877
  columns,
6878
+ tableId,
6879
+ defaultViewSnapshot,
6851
6880
  columnState,
6852
- reorderableColumns = false,
6881
+ reorderableColumns = true,
6853
6882
  columnManager: controlledColumnManager,
6854
6883
  getRowId,
6855
6884
  searchText,
@@ -6897,9 +6926,14 @@ function MatrxDataTableCore({
6897
6926
  const isLoading = appendQuery ? appendQuery.pagination.loading : suppliedLoading;
6898
6927
  const isFetching = appendQuery ? appendQuery.pagination.isFetchingNextPage : suppliedFetching;
6899
6928
  const host = useMatrxDataTableHost();
6929
+ const SavedViews = host.SavedViews;
6900
6930
  const Link = host.Link ?? DefaultTableLink;
6901
6931
  const SidePanelSurface = host.SidePanelSurface ?? DefaultTableSidePanel;
6902
6932
  const { notify: toast, notice } = useTableNotice();
6933
+ const [savedViewError, setSavedViewError] = useState15(null);
6934
+ const [toolbarActionError, setToolbarActionError] = useState15(null);
6935
+ const [toolbarActionPending, setToolbarActionPending] = useState15({ refresh: false, add: false });
6936
+ const toolbarActionPendingRef = useRef6({ refresh: false, add: false });
6903
6937
  const CHECKBOX_TAP_AREA = "relative max-lg:before:absolute max-lg:before:left-1/2 max-lg:before:top-1/2 max-lg:before:h-11 max-lg:before:w-11 max-lg:before:-translate-x-1/2 max-lg:before:-translate-y-1/2 max-lg:before:content-['']";
6904
6938
  const mobileCardsClass = mobileCardsBreakpoint === "lg" ? "lg:hidden" : "sm:hidden";
6905
6939
  const tableWithCardsClass = mobileCardsBreakpoint === "lg" ? "max-lg:hidden" : "max-sm:hidden";
@@ -7170,11 +7204,12 @@ function MatrxDataTableCore({
7170
7204
  const [hiddenColumnIds, setHiddenColumnIds] = useState15(
7171
7205
  () => new Set(columnState?.hidden ?? columns.filter((column) => column.hidden).map(columnId))
7172
7206
  );
7207
+ const knownColumnIds = useRef6(new Set(columns.map(columnId)));
7173
7208
  const draggedColumnId = useRef6(null);
7174
7209
  const columnDragActive = useRef6(false);
7175
7210
  const columnDragRaf = useRef6(null);
7176
7211
  const columnDragScrollDirection = useRef6(0);
7177
- const [columnDropTarget, setColumnDropTarget] = useState15(null);
7212
+ const [columnDragPreview, setColumnDragPreview] = useState15(null);
7178
7213
  const stopColumnDragScroll = useCallback4(() => {
7179
7214
  if (columnDragRaf.current !== null) cancelAnimationFrame(columnDragRaf.current);
7180
7215
  columnDragRaf.current = null;
@@ -7227,6 +7262,7 @@ function MatrxDataTableCore({
7227
7262
  useEffect10(() => {
7228
7263
  const ids = columns.map(columnId);
7229
7264
  if (columnState) return;
7265
+ const previousIds = knownColumnIds.current;
7230
7266
  setColumnOrder((current) => [
7231
7267
  ...current.filter((id) => ids.includes(id)),
7232
7268
  ...ids.filter((id) => !current.includes(id))
@@ -7234,17 +7270,23 @@ function MatrxDataTableCore({
7234
7270
  setHiddenColumnIds((current) => {
7235
7271
  const next = new Set([...current].filter((id) => ids.includes(id)));
7236
7272
  for (const column of columns) {
7237
- if (column.hidden) next.add(columnId(column));
7273
+ const id = columnId(column);
7274
+ if (column.hidden && !previousIds.has(id)) next.add(id);
7238
7275
  }
7239
7276
  return next;
7240
7277
  });
7278
+ knownColumnIds.current = new Set(ids);
7241
7279
  }, [columns, columnState]);
7280
+ const previewColumnOrder = useMemo5(
7281
+ () => projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
7282
+ [columnDragPreview, effectiveColumnOrder]
7283
+ );
7242
7284
  const visibleColumns = useMemo5(() => {
7243
7285
  const byId = new Map(columns.map((column) => [columnId(column), column]));
7244
- return effectiveColumnOrder.map((id) => byId.get(id)).filter(
7286
+ return previewColumnOrder.map((id) => byId.get(id)).filter(
7245
7287
  (column) => column !== void 0 && !effectiveHiddenColumnIds.has(columnId(column))
7246
7288
  );
7247
- }, [columns, effectiveColumnOrder, effectiveHiddenColumnIds]);
7289
+ }, [columns, effectiveHiddenColumnIds, previewColumnOrder]);
7248
7290
  const declaredVisibleCopyColumns = useMemo5(
7249
7291
  () => visibleColumns.filter((column) => column.accessorFn !== void 0 || column.accessorKey !== void 0),
7250
7292
  [visibleColumns]
@@ -7781,7 +7823,121 @@ function MatrxDataTableCore({
7781
7823
  }
7782
7824
  } : facet
7783
7825
  ) : toolbar?.facets;
7784
- return /* @__PURE__ */ jsx36(TooltipProvider, { children: /* @__PURE__ */ jsxs27(
7826
+ const renderRecordCell = (row, col, index) => {
7827
+ const id = getRowId(row);
7828
+ const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
7829
+ const rowEdits = edits[id];
7830
+ const display = renderCell(applyRowEdits(row, rowEdits), col, index);
7831
+ const href = col.href?.(row) ?? void 0;
7832
+ if (editEnabled && col.editable && (col.editableIf?.(row) ?? true)) {
7833
+ return /* @__PURE__ */ jsx35(
7834
+ EditableTableCell,
7835
+ {
7836
+ value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
7837
+ editType: col.editable,
7838
+ ...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
7839
+ display,
7840
+ dirty: Boolean(rowEdits && field in rowEdits),
7841
+ onCommit: (next) => commitCell(id, field, next),
7842
+ ...href === void 0 ? {} : { href },
7843
+ ...col.editTrigger === void 0 ? {} : { editTrigger: col.editTrigger }
7844
+ }
7845
+ );
7846
+ }
7847
+ return href ? /* @__PURE__ */ jsx35(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;
7848
+ };
7849
+ const currentViewSnapshot = useMemo5(
7850
+ () => ({
7851
+ __kind: "matrx-table-view",
7852
+ version: 1,
7853
+ query: {
7854
+ pageSize,
7855
+ search: searchValue,
7856
+ ...searchMatchMode === "contains" ? {} : { searchMatchMode },
7857
+ anyOf: anyOfValue,
7858
+ ...layeredFilters.length ? { layeredFilters } : {},
7859
+ columnFilters,
7860
+ sort
7861
+ },
7862
+ columns: {
7863
+ order: effectiveColumnOrder,
7864
+ hidden: [...effectiveHiddenColumnIds]
7865
+ }
7866
+ }),
7867
+ [
7868
+ anyOfValue,
7869
+ columnFilters,
7870
+ effectiveColumnOrder,
7871
+ effectiveHiddenColumnIds,
7872
+ layeredFilters,
7873
+ pageSize,
7874
+ searchMatchMode,
7875
+ searchValue,
7876
+ sort
7877
+ ]
7878
+ );
7879
+ const declaredDefaultViewSnapshot = useMemo5(
7880
+ () => defaultViewSnapshot ?? {
7881
+ __kind: "matrx-table-view",
7882
+ version: 1,
7883
+ query: {
7884
+ pageSize: defaultPageSize,
7885
+ search: "",
7886
+ anyOf: "",
7887
+ layeredFilters: [],
7888
+ columnFilters: {},
7889
+ sort: defaultSort
7890
+ },
7891
+ columns: {
7892
+ order: columns.map(columnId),
7893
+ hidden: columns.filter((column) => column.hidden).map(columnId)
7894
+ }
7895
+ },
7896
+ [columns, defaultPageSize, defaultSort, defaultViewSnapshot]
7897
+ );
7898
+ const applySavedView = useCallback4(
7899
+ (rawSnapshot) => {
7900
+ const snapshot = parseTableViewSnapshot(rawSnapshot);
7901
+ if (!snapshot) {
7902
+ const message = "This saved view has an unsupported format. The current table was left unchanged.";
7903
+ setSavedViewError(message);
7904
+ throw new Error(message);
7905
+ }
7906
+ const knownColumns = new Set(columns.map(columnId));
7907
+ const unknown = [
7908
+ ...snapshot.columns.order,
7909
+ ...snapshot.columns.hidden,
7910
+ ...Object.keys(snapshot.query.columnFilters),
7911
+ ...snapshot.query.sort ? [snapshot.query.sort.id] : [],
7912
+ ...snapshot.query.layeredFilters?.map((rule) => rule.field) ?? []
7913
+ ].filter((id, index, values) => !knownColumns.has(id) && values.indexOf(id) === index);
7914
+ if (unknown.length > 0) {
7915
+ const message = `This saved view refers to unavailable columns: ${unknown.join(", ")}. The current table was left unchanged.`;
7916
+ setSavedViewError(message);
7917
+ throw new Error(message);
7918
+ }
7919
+ setSavedViewError(null);
7920
+ const nextQuery = { ...snapshot.query, page: 1 };
7921
+ const nextOrder = [...snapshot.columns.order, ...columns.map(columnId).filter((id) => !snapshot.columns.order.includes(id))];
7922
+ if (controlledQuery) {
7923
+ controlledQuery.onStateChange(nextQuery);
7924
+ toolbar?.onSearchChange?.(nextQuery.search);
7925
+ toolbar?.anyOf?.onChange?.(nextQuery.anyOf);
7926
+ } else {
7927
+ setSearchValue(nextQuery.search);
7928
+ setInternalSearchMatchMode(nextQuery.searchMatchMode ?? "contains");
7929
+ setAnyOfValue(nextQuery.anyOf);
7930
+ setInternalLayeredFilters(nextQuery.layeredFilters ?? []);
7931
+ setInternalColumnFilters(nextQuery.columnFilters);
7932
+ setInternalSort(nextQuery.sort);
7933
+ setInternalPageSize(nextQuery.pageSize);
7934
+ setInternalPage(1);
7935
+ }
7936
+ commitColumnState(nextOrder, new Set(snapshot.columns.hidden));
7937
+ },
7938
+ [columns, commitColumnState, controlledQuery, toolbar]
7939
+ );
7940
+ return /* @__PURE__ */ jsx35(TooltipProvider, { children: /* @__PURE__ */ jsxs26(
7785
7941
  DndContext,
7786
7942
  {
7787
7943
  id: tableDndContextId,
@@ -7796,8 +7952,10 @@ function MatrxDataTableCore({
7796
7952
  onDragStart: (event) => {
7797
7953
  const kind = event.active.data.current?.matrxDragKind;
7798
7954
  if (kind === "column-header") {
7799
- draggedColumnId.current = String(event.active.data.current?.columnId);
7955
+ const draggedId = String(event.active.data.current?.columnId);
7956
+ draggedColumnId.current = draggedId;
7800
7957
  columnDragActive.current = true;
7958
+ setColumnDragPreview({ draggedId, targetId: null, after: false });
7801
7959
  return;
7802
7960
  }
7803
7961
  if (kind === "column-manager") return;
@@ -7810,13 +7968,18 @@ function MatrxDataTableCore({
7810
7968
  const activeRect = event.active.rect.current.translated;
7811
7969
  const overRect = event.over?.rect;
7812
7970
  if (!overId || !activeRect || !overRect) {
7813
- setColumnDropTarget(null);
7971
+ setColumnDragPreview(
7972
+ (current) => current?.targetId === null ? current : current ? { ...current, targetId: null } : current
7973
+ );
7814
7974
  columnDragScrollDirection.current = 0;
7815
7975
  stopColumnDragScroll();
7816
7976
  return;
7817
7977
  }
7818
7978
  const after = activeRect.left + activeRect.width / 2 >= overRect.left + overRect.width / 2;
7819
- setColumnDropTarget({ id: String(overId), after });
7979
+ setColumnDragPreview((current) => {
7980
+ if (!current) return current;
7981
+ return current.targetId === overId && current.after === after ? current : { ...current, targetId: String(overId), after };
7982
+ });
7820
7983
  const scroll = scrollRef.current;
7821
7984
  if (!scroll) return;
7822
7985
  const bounds = scroll.getBoundingClientRect();
@@ -7828,7 +7991,7 @@ function MatrxDataTableCore({
7828
7991
  onDragCancel: () => {
7829
7992
  columnDragActive.current = false;
7830
7993
  draggedColumnId.current = null;
7831
- setColumnDropTarget(null);
7994
+ setColumnDragPreview(null);
7832
7995
  stopColumnDragScroll();
7833
7996
  setDraggedRowId(null);
7834
7997
  },
@@ -7846,8 +8009,15 @@ function MatrxDataTableCore({
7846
8009
  const overRect = event.over?.rect;
7847
8010
  columnDragActive.current = false;
7848
8011
  draggedColumnId.current = null;
7849
- setColumnDropTarget(null);
8012
+ setColumnDragPreview(null);
7850
8013
  stopColumnDragScroll();
8014
+ if (columnDragPreview?.draggedId === from && columnDragPreview.targetId !== null && columnDragPreview.targetId !== from) {
8015
+ commitColumnState(
8016
+ projectColumnDragOrder(effectiveColumnOrder, columnDragPreview),
8017
+ effectiveHiddenColumnIds
8018
+ );
8019
+ return;
8020
+ }
7851
8021
  if (!target || from === target || !activeRect || !overRect) return;
7852
8022
  const order = [...effectiveColumnOrder];
7853
8023
  const fromIndex = order.indexOf(from);
@@ -7860,10 +8030,11 @@ function MatrxDataTableCore({
7860
8030
  commitColumnState(order, effectiveHiddenColumnIds);
7861
8031
  },
7862
8032
  children: [
7863
- /* @__PURE__ */ jsxs27(
8033
+ /* @__PURE__ */ jsxs26(
7864
8034
  "div",
7865
8035
  {
7866
8036
  ref: rootRef,
8037
+ "data-matrx-table": true,
7867
8038
  "data-url-state-table": urlState?.id,
7868
8039
  className: cn(
7869
8040
  // The touch-target floor deliberately SKIPS checkboxes, radios and
@@ -7878,11 +8049,22 @@ function MatrxDataTableCore({
7878
8049
  ),
7879
8050
  children: [
7880
8051
  notice,
7881
- !hideToolbar && (toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ jsxs27(
8052
+ savedViewError ? /* @__PURE__ */ jsx35("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: savedViewError }) : null,
8053
+ toolbarActionError ? /* @__PURE__ */ jsx35("p", { role: "alert", className: "shrink-0 text-xs text-destructive", children: toolbarActionError }) : null,
8054
+ !hideToolbar && (toolbar?.title || showSearch || toolbar?.anyOf || toolbar?.layeredFilters || toolbar?.facets && toolbar.facets.length > 0 || toolbar?.leading || toolbar?.actions || toolbar?.refresh || toolbar?.add || tableId && SavedViews || hasActiveFilters || showToolbarCopy || columns.length > 0) && /* @__PURE__ */ jsxs26(
7882
8055
  TableTitleRow,
7883
8056
  {
7884
8057
  ...toolbar?.title === void 0 ? {} : { title: toolbar.title },
7885
- search: showSearch ? /* @__PURE__ */ jsxs27(
8058
+ context: tableId && SavedViews ? /* @__PURE__ */ jsx35(
8059
+ SavedViews,
8060
+ {
8061
+ tableId,
8062
+ snapshot: currentViewSnapshot,
8063
+ defaultSnapshot: declaredDefaultViewSnapshot,
8064
+ onApply: applySavedView
8065
+ }
8066
+ ) : void 0,
8067
+ search: showSearch ? /* @__PURE__ */ jsxs26(
7886
8068
  "div",
7887
8069
  {
7888
8070
  "data-matrx-table-search": true,
@@ -7891,9 +8073,9 @@ function MatrxDataTableCore({
7891
8073
  toolbar?.searchMatch ? "sm:max-w-md" : "sm:max-w-xs"
7892
8074
  ),
7893
8075
  children: [
7894
- /* @__PURE__ */ jsxs27("div", { className: "relative min-w-0 flex-1", children: [
7895
- /* @__PURE__ */ jsx36(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
7896
- /* @__PURE__ */ jsx36(
8076
+ /* @__PURE__ */ jsxs26("div", { className: "relative min-w-0 flex-1", children: [
8077
+ /* @__PURE__ */ jsx35(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
8078
+ /* @__PURE__ */ jsx35(
7897
8079
  Input,
7898
8080
  {
7899
8081
  value: searchValue,
@@ -7906,22 +8088,22 @@ function MatrxDataTableCore({
7906
8088
  style: { fontSize: "16px" }
7907
8089
  }
7908
8090
  ),
7909
- searchValue ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
7910
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
8091
+ searchValue ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8092
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
7911
8093
  "button",
7912
8094
  {
7913
8095
  type: "button",
7914
8096
  "aria-label": "Clear search",
7915
8097
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
7916
8098
  onClick: () => setSearchValue(""),
7917
- children: /* @__PURE__ */ jsx36(X, { className: "h-3.5 w-3.5" })
8099
+ children: /* @__PURE__ */ jsx35(X, { className: "h-3.5 w-3.5" })
7918
8100
  }
7919
8101
  ) }),
7920
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Clear search" })
8102
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "Clear search" })
7921
8103
  ] }) : null
7922
8104
  ] }),
7923
- toolbar?.searchMatch ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
7924
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs27(
8105
+ toolbar?.searchMatch ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8106
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs26(
7925
8107
  Button,
7926
8108
  {
7927
8109
  type: "button",
@@ -7934,18 +8116,18 @@ function MatrxDataTableCore({
7934
8116
  searchMatchMode === "whole_words" ? "contains" : "whole_words"
7935
8117
  ),
7936
8118
  children: [
7937
- /* @__PURE__ */ jsx36(WholeWord, { className: "h-3.5 w-3.5" }),
8119
+ /* @__PURE__ */ jsx35(WholeWord, { className: "h-3.5 w-3.5" }),
7938
8120
  searchMatchMode === "whole_words" ? "Whole words" : "Contains"
7939
8121
  ]
7940
8122
  }
7941
8123
  ) }),
7942
- /* @__PURE__ */ jsx36(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
8124
+ /* @__PURE__ */ jsx35(TooltipContent, { children: searchMatchMode === "whole_words" ? "Whole words \u2014 click to match text anywhere" : "Contains text \u2014 click to require whole words" })
7943
8125
  ] }) : null
7944
8126
  ]
7945
8127
  }
7946
8128
  ) : null,
7947
8129
  children: [
7948
- toolbar?.layeredFilters ? /* @__PURE__ */ jsx36(
8130
+ toolbar?.layeredFilters ? /* @__PURE__ */ jsx35(
7949
8131
  LayeredFilterBuilder,
7950
8132
  {
7951
8133
  fields: toolbar.layeredFilters.fields,
@@ -7955,9 +8137,9 @@ function MatrxDataTableCore({
7955
8137
  label: toolbar.layeredFilters.label
7956
8138
  }
7957
8139
  ) : null,
7958
- toolbar?.anyOf ? /* @__PURE__ */ jsxs27("div", { className: "relative w-full max-w-xs", children: [
7959
- /* @__PURE__ */ jsx36(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
7960
- /* @__PURE__ */ jsx36(
8140
+ toolbar?.anyOf ? /* @__PURE__ */ jsxs26("div", { className: "relative w-full max-w-xs", children: [
8141
+ /* @__PURE__ */ jsx35(Search, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
8142
+ /* @__PURE__ */ jsx35(
7961
8143
  Input,
7962
8144
  {
7963
8145
  value: anyOfValue,
@@ -7967,29 +8149,29 @@ function MatrxDataTableCore({
7967
8149
  style: { fontSize: "16px" }
7968
8150
  }
7969
8151
  ),
7970
- anyOfValue ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
7971
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
8152
+ anyOfValue ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8153
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
7972
8154
  "button",
7973
8155
  {
7974
8156
  type: "button",
7975
8157
  "aria-label": "Clear match-any search",
7976
8158
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 rounded p-0.5 text-muted-foreground hover:text-foreground",
7977
8159
  onClick: () => setAnyOfValue(""),
7978
- children: /* @__PURE__ */ jsx36(X, { className: "h-3.5 w-3.5" })
8160
+ children: /* @__PURE__ */ jsx35(X, { className: "h-3.5 w-3.5" })
7979
8161
  }
7980
8162
  ) }),
7981
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Clear match-any search" })
8163
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "Clear match-any search" })
7982
8164
  ] }) : null
7983
8165
  ] }) : null,
7984
- renderedFacets ? /* @__PURE__ */ jsx36(ToolbarFacets, { facets: renderedFacets }) : null,
8166
+ renderedFacets ? /* @__PURE__ */ jsx35(ToolbarFacets, { facets: renderedFacets }) : null,
7985
8167
  toolbar?.leading,
7986
- /* @__PURE__ */ jsxs27(
8168
+ /* @__PURE__ */ jsxs26(
7987
8169
  "div",
7988
8170
  {
7989
8171
  "data-matrx-table-actions": true,
7990
8172
  className: "ml-auto flex min-w-0 flex-wrap items-center gap-2",
7991
8173
  children: [
7992
- sourceTotal !== void 0 ? /* @__PURE__ */ jsxs27(
8174
+ sourceTotal !== void 0 ? /* @__PURE__ */ jsxs26(
7993
8175
  "span",
7994
8176
  {
7995
8177
  "data-matrx-table-source-total": true,
@@ -8006,8 +8188,8 @@ function MatrxDataTableCore({
8006
8188
  ]
8007
8189
  }
8008
8190
  ) : null,
8009
- hasActiveFilters ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8010
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs27(
8191
+ /* @__PURE__ */ jsxs26(Tooltip, { children: [
8192
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35("span", { className: "inline-flex", children: /* @__PURE__ */ jsxs26(
8011
8193
  Button,
8012
8194
  {
8013
8195
  type: "button",
@@ -8015,16 +8197,17 @@ function MatrxDataTableCore({
8015
8197
  size: "sm",
8016
8198
  className: "h-7 gap-1 px-2 text-xs text-muted-foreground",
8017
8199
  onClick: clearAllFilters,
8200
+ disabled: !hasActiveFilters,
8018
8201
  "aria-label": "Clear all filters",
8019
8202
  children: [
8020
- /* @__PURE__ */ jsx36(Eraser, { className: "h-3.5 w-3.5" }),
8021
- /* @__PURE__ */ jsx36("span", { className: "max-sm:sr-only", children: "Clear all" })
8203
+ /* @__PURE__ */ jsx35(Eraser, { className: "h-3.5 w-3.5" }),
8204
+ /* @__PURE__ */ jsx35("span", { className: "max-sm:sr-only", children: "Clear all" })
8022
8205
  ]
8023
8206
  }
8024
- ) }),
8025
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Clear search and filters; keep columns and sort" })
8026
- ] }) : null,
8027
- showToolbarCopy && effectiveCopy ? /* @__PURE__ */ jsx36(
8207
+ ) }) }),
8208
+ /* @__PURE__ */ jsx35(TooltipContent, { children: hasActiveFilters ? "Clear search and filters; keep columns and sort" : "No search or filters to clear" })
8209
+ ] }),
8210
+ showToolbarCopy && effectiveCopy ? /* @__PURE__ */ jsx35(
8028
8211
  CopyButtons,
8029
8212
  {
8030
8213
  size: "icon",
@@ -8064,8 +8247,8 @@ function MatrxDataTableCore({
8064
8247
  }
8065
8248
  }
8066
8249
  ) : null,
8067
- columns.length > 0 ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8068
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs27(
8250
+ columns.length > 0 ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8251
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs26(
8069
8252
  Button,
8070
8253
  {
8071
8254
  type: "button",
@@ -8075,15 +8258,80 @@ function MatrxDataTableCore({
8075
8258
  className: "h-8 w-8",
8076
8259
  onClick: () => setColumnManagerOpen(true),
8077
8260
  children: [
8078
- /* @__PURE__ */ jsx36(SlidersHorizontal, { className: "h-4 w-4" }),
8079
- effectiveHiddenColumnIds.size > 0 ? /* @__PURE__ */ jsxs27("span", { className: "sr-only", children: [
8261
+ /* @__PURE__ */ jsx35(SlidersHorizontal, { className: "h-4 w-4" }),
8262
+ effectiveHiddenColumnIds.size > 0 ? /* @__PURE__ */ jsxs26("span", { className: "sr-only", children: [
8080
8263
  effectiveHiddenColumnIds.size,
8081
8264
  " hidden"
8082
8265
  ] }) : null
8083
8266
  ]
8084
8267
  }
8085
8268
  ) }),
8086
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Show, hide, or reorder columns" })
8269
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "Show, hide, or reorder columns" })
8270
+ ] }) : null,
8271
+ toolbar?.refresh ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8272
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35("span", { className: "inline-flex", children: /* @__PURE__ */ jsx35(
8273
+ Button,
8274
+ {
8275
+ type: "button",
8276
+ variant: "ghost",
8277
+ size: "icon",
8278
+ className: "h-8 w-8",
8279
+ "aria-label": toolbar.refresh.label ?? "Refresh",
8280
+ disabled: isFetching || toolbarActionPending.refresh,
8281
+ onClick: () => {
8282
+ if (toolbarActionPendingRef.current.refresh) return;
8283
+ toolbarActionPendingRef.current.refresh = true;
8284
+ setToolbarActionPending((current) => ({ ...current, refresh: true }));
8285
+ setToolbarActionError(null);
8286
+ void Promise.resolve().then(() => toolbar.refresh?.onRefresh()).catch((cause) => {
8287
+ const message = cause instanceof Error ? cause.message : String(cause);
8288
+ setToolbarActionError(`Refresh failed: ${message}`);
8289
+ toast.error(`Refresh failed: ${message}`);
8290
+ }).finally(() => {
8291
+ toolbarActionPendingRef.current.refresh = false;
8292
+ setToolbarActionPending((current) => ({ ...current, refresh: false }));
8293
+ });
8294
+ },
8295
+ children: /* @__PURE__ */ jsx35(
8296
+ Loader2,
8297
+ {
8298
+ className: cn(
8299
+ "h-4 w-4",
8300
+ (isFetching || toolbarActionPending.refresh) && "animate-spin"
8301
+ )
8302
+ }
8303
+ )
8304
+ }
8305
+ ) }) }),
8306
+ /* @__PURE__ */ jsx35(TooltipContent, { children: isFetching ? "Refreshing table data" : toolbar.refresh.label ?? "Refresh" })
8307
+ ] }) : null,
8308
+ toolbar?.add ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8309
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35("span", { className: "inline-flex", children: /* @__PURE__ */ jsx35(
8310
+ Button,
8311
+ {
8312
+ type: "button",
8313
+ size: "icon",
8314
+ className: "h-8 w-8",
8315
+ "aria-label": "Add",
8316
+ disabled: toolbar.add.disabled || toolbarActionPending.add,
8317
+ onClick: () => {
8318
+ if (toolbarActionPendingRef.current.add) return;
8319
+ toolbarActionPendingRef.current.add = true;
8320
+ setToolbarActionPending((current) => ({ ...current, add: true }));
8321
+ setToolbarActionError(null);
8322
+ void Promise.resolve().then(() => toolbar.add?.onAdd()).catch((cause) => {
8323
+ const message = cause instanceof Error ? cause.message : String(cause);
8324
+ setToolbarActionError(`Add failed: ${message}`);
8325
+ toast.error(`Add failed: ${message}`);
8326
+ }).finally(() => {
8327
+ toolbarActionPendingRef.current.add = false;
8328
+ setToolbarActionPending((current) => ({ ...current, add: false }));
8329
+ });
8330
+ },
8331
+ children: /* @__PURE__ */ jsx35(Plus, { className: "h-4 w-4" })
8332
+ }
8333
+ ) }) }),
8334
+ /* @__PURE__ */ jsx35(TooltipContent, { children: toolbar.add.disabled ? toolbar.add.disabledReason ?? "Add unavailable" : "Add" })
8087
8335
  ] }) : null,
8088
8336
  toolbar?.actions
8089
8337
  ]
@@ -8092,15 +8340,15 @@ function MatrxDataTableCore({
8092
8340
  ]
8093
8341
  }
8094
8342
  ),
8095
- selection && selectionCount > 0 ? /* @__PURE__ */ jsxs27("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
8096
- /* @__PURE__ */ jsxs27("span", { className: "text-xs font-medium text-foreground", children: [
8343
+ selection && selectionCount > 0 ? /* @__PURE__ */ jsxs26("div", { className: "flex shrink-0 flex-wrap items-center gap-2 rounded-md border border-primary/30 bg-primary/5 px-2 py-1.5", children: [
8344
+ /* @__PURE__ */ jsxs26("span", { className: "text-xs font-medium text-foreground", children: [
8097
8345
  selectionCount.toLocaleString(),
8098
8346
  " ",
8099
8347
  selectionNoun,
8100
8348
  selectionCount === 1 ? "" : "s",
8101
8349
  " selected"
8102
8350
  ] }),
8103
- /* @__PURE__ */ jsxs27(
8351
+ /* @__PURE__ */ jsxs26(
8104
8352
  Button,
8105
8353
  {
8106
8354
  type: "button",
@@ -8112,13 +8360,13 @@ function MatrxDataTableCore({
8112
8360
  selection.onSelectedIdsChange([]);
8113
8361
  },
8114
8362
  children: [
8115
- /* @__PURE__ */ jsx36(X, { className: "h-3.5 w-3.5" }),
8363
+ /* @__PURE__ */ jsx35(X, { className: "h-3.5 w-3.5" }),
8116
8364
  "Clear"
8117
8365
  ]
8118
8366
  }
8119
8367
  ),
8120
- /* @__PURE__ */ jsxs27("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
8121
- effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ jsx36(
8368
+ /* @__PURE__ */ jsxs26("div", { className: "ml-auto flex flex-wrap items-center gap-1.5", children: [
8369
+ effectiveCopy && selectedRows.length > 0 ? /* @__PURE__ */ jsx35(
8122
8370
  CopyButtons,
8123
8371
  {
8124
8372
  size: "icon",
@@ -8148,9 +8396,9 @@ function MatrxDataTableCore({
8148
8396
  selection.actions?.(selectedRows, selection.selectedIds)
8149
8397
  ] })
8150
8398
  ] }) : null,
8151
- /* @__PURE__ */ jsxs27("div", { className: "flex min-h-0 flex-1 flex-col", children: [
8152
- /* @__PURE__ */ jsxs27("div", { className: "relative min-h-0 flex-1", children: [
8153
- mobileCards ? /* @__PURE__ */ jsxs27(
8399
+ /* @__PURE__ */ jsxs26("div", { className: "flex min-h-0 flex-1 flex-col", children: [
8400
+ /* @__PURE__ */ jsxs26("div", { className: "relative min-h-0 flex-1", children: [
8401
+ mobileCards ? /* @__PURE__ */ jsxs26(
8154
8402
  "div",
8155
8403
  {
8156
8404
  ref: cardsScrollRef,
@@ -8162,33 +8410,37 @@ function MatrxDataTableCore({
8162
8410
  mobileCardsClass
8163
8411
  ),
8164
8412
  children: [
8165
- isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs27(
8413
+ isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs26(
8166
8414
  "div",
8167
8415
  {
8168
8416
  role: "status",
8169
8417
  className: "h-0.5 shrink-0 overflow-hidden rounded-full bg-primary/15",
8170
8418
  children: [
8171
- /* @__PURE__ */ jsx36("div", { className: "h-full w-full animate-pulse bg-primary" }),
8172
- /* @__PURE__ */ jsx36("span", { className: "sr-only", children: "Refreshing table data" })
8419
+ /* @__PURE__ */ jsx35("div", { className: "h-full w-full animate-pulse bg-primary" }),
8420
+ /* @__PURE__ */ jsx35("span", { className: "sr-only", children: "Refreshing table data" })
8173
8421
  ]
8174
8422
  }
8175
8423
  ) : null,
8176
- isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ jsx36(
8424
+ isLoading ? Array.from({ length: 4 }).map((_, index) => /* @__PURE__ */ jsx35(
8177
8425
  Skeleton,
8178
8426
  {
8179
8427
  className: "h-52 w-full shrink-0 rounded-lg"
8180
8428
  },
8181
8429
  `mobile-card-sk-${index}`
8182
- )) : paginated.length === 0 ? /* @__PURE__ */ jsx36("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ jsxs27("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
8430
+ )) : paginated.length === 0 ? /* @__PURE__ */ jsx35("div", { className: "flex min-h-48 flex-1 items-center justify-center px-4 py-12 text-center", children: /* @__PURE__ */ jsxs26("div", { className: "flex max-w-sm flex-col items-center gap-2", children: [
8183
8431
  emptyState?.icon,
8184
- /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
8185
- emptyState?.description ? /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
8432
+ /* @__PURE__ */ jsx35("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
8433
+ emptyState?.description ? /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
8186
8434
  emptyState?.action
8187
8435
  ] }) }) : paginated.map((row, index) => {
8188
8436
  const id = getRowId(row);
8189
8437
  const displayRow = applyRowEdits(row, edits[id]);
8190
8438
  const selectable = selection?.isRowSelectable?.(row) ?? Boolean(selection);
8191
- return /* @__PURE__ */ jsx36(Fragment6, { children: mobileCards(displayRow, index, {
8439
+ return /* @__PURE__ */ jsx35(Fragment6, { children: mobileCards(displayRow, index, {
8440
+ renderCell: (columnKey) => {
8441
+ const column = columns.find((candidate) => columnId(candidate) === columnKey);
8442
+ return column ? renderRecordCell(row, column, index) : null;
8443
+ },
8192
8444
  selected: selectedIdSet.has(id),
8193
8445
  selectable,
8194
8446
  onSelectedChange: (nextSelected) => {
@@ -8200,13 +8452,13 @@ function MatrxDataTableCore({
8200
8452
  else next.delete(id);
8201
8453
  setSelectedIds(next);
8202
8454
  },
8203
- actions: showRowCopy || rowActions ? /* @__PURE__ */ jsxs27(
8455
+ actions: showRowCopy || rowActions ? /* @__PURE__ */ jsxs26(
8204
8456
  "div",
8205
8457
  {
8206
8458
  className: "inline-flex items-center gap-1",
8207
8459
  onClick: (event) => event.stopPropagation(),
8208
8460
  children: [
8209
- showRowCopy && effectiveCopy ? /* @__PURE__ */ jsx36(
8461
+ showRowCopy && effectiveCopy ? /* @__PURE__ */ jsx35(
8210
8462
  TableRowCopyControl,
8211
8463
  {
8212
8464
  size: "xs",
@@ -8229,7 +8481,7 @@ function MatrxDataTableCore({
8229
8481
  ) : null
8230
8482
  }) }, id);
8231
8483
  }),
8232
- appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ jsxs27(
8484
+ appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ jsxs26(
8233
8485
  "div",
8234
8486
  {
8235
8487
  "data-matrx-table-append-loading-card": true,
@@ -8237,7 +8489,7 @@ function MatrxDataTableCore({
8237
8489
  "aria-live": "polite",
8238
8490
  className: "sticky bottom-0 z-20 flex h-16 w-full max-w-[100cqw] shrink-0 items-center justify-center gap-2 rounded-md border border-border bg-card/95 px-3 text-sm font-medium text-foreground shadow-sm backdrop-blur-sm",
8239
8491
  children: [
8240
- /* @__PURE__ */ jsx36(
8492
+ /* @__PURE__ */ jsx35(
8241
8493
  Loader2,
8242
8494
  {
8243
8495
  "aria-hidden": "true",
@@ -8251,7 +8503,7 @@ function MatrxDataTableCore({
8251
8503
  ]
8252
8504
  }
8253
8505
  ) : null,
8254
- /* @__PURE__ */ jsxs27(
8506
+ /* @__PURE__ */ jsxs26(
8255
8507
  "div",
8256
8508
  {
8257
8509
  ref: scrollRef,
@@ -8265,34 +8517,34 @@ function MatrxDataTableCore({
8265
8517
  tableClassName
8266
8518
  ),
8267
8519
  children: [
8268
- hierarchy && draggedRow ? /* @__PURE__ */ jsx36(
8520
+ hierarchy && draggedRow ? /* @__PURE__ */ jsx35(
8269
8521
  HierarchyRootDropTarget,
8270
8522
  {
8271
8523
  label: hierarchy.rootDropLabel ?? "Drop here to move to the top level",
8272
8524
  draggedLabel: hierarchy.itemLabel?.(draggedRow) ?? "Moving row"
8273
8525
  }
8274
8526
  ) : null,
8275
- hierarchy && draggedRowId ? /* @__PURE__ */ jsx36(
8527
+ hierarchy && draggedRowId ? /* @__PURE__ */ jsx35(
8276
8528
  HierarchyDragIndicatorLayer,
8277
8529
  {
8278
8530
  scrollRef,
8279
8531
  resolve: resolveHierarchyMove
8280
8532
  }
8281
8533
  ) : null,
8282
- isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs27(
8534
+ isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs26(
8283
8535
  "div",
8284
8536
  {
8285
8537
  role: "status",
8286
8538
  className: "sticky left-0 top-0 z-20 h-0.5 w-full overflow-hidden bg-primary/15",
8287
8539
  children: [
8288
- /* @__PURE__ */ jsx36("div", { className: "h-full w-full animate-pulse bg-primary" }),
8289
- /* @__PURE__ */ jsx36("span", { className: "sr-only", children: "Refreshing table data" })
8540
+ /* @__PURE__ */ jsx35("div", { className: "h-full w-full animate-pulse bg-primary" }),
8541
+ /* @__PURE__ */ jsx35("span", { className: "sr-only", children: "Refreshing table data" })
8290
8542
  ]
8291
8543
  }
8292
8544
  ) : null,
8293
- /* @__PURE__ */ jsxs27("table", { className: "table w-max min-w-full max-w-none caption-bottom overflow-visible text-sm sm:w-full sm:min-w-0 sm:max-w-full", children: [
8294
- /* @__PURE__ */ jsx36("thead", { className: "sticky top-0 z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm", children: /* @__PURE__ */ jsxs27("tr", { children: [
8295
- selection ? /* @__PURE__ */ jsx36("th", { className: "h-9 w-9 px-2 text-left align-middle", children: /* @__PURE__ */ jsx36(
8545
+ /* @__PURE__ */ jsxs26("table", { className: "table w-max min-w-full max-w-none caption-bottom overflow-visible text-sm sm:w-full sm:min-w-0 sm:max-w-full", children: [
8546
+ /* @__PURE__ */ jsx35("thead", { className: "sticky top-0 z-10 border-b border-border bg-muted/90 shadow-[0_1px_0_0_var(--border)] backdrop-blur-sm", children: /* @__PURE__ */ jsxs26("tr", { children: [
8547
+ selection ? /* @__PURE__ */ jsx35("th", { className: "h-9 w-9 px-2 text-left align-middle", children: /* @__PURE__ */ jsx35(
8296
8548
  Checkbox,
8297
8549
  {
8298
8550
  className: CHECKBOX_TAP_AREA,
@@ -8308,9 +8560,11 @@ function MatrxDataTableCore({
8308
8560
  const isSorted = sort?.id === id;
8309
8561
  const headerLabel = col.label ?? (typeof col.header === "string" ? col.header : id);
8310
8562
  const defaultSortDirection = col.defaultSortDirection ?? "asc";
8311
- return /* @__PURE__ */ jsx36(
8563
+ const isColumnDragShadow = columnDragPreview?.draggedId === id && columnDragPreview.targetId !== null;
8564
+ return /* @__PURE__ */ jsx35(
8312
8565
  "th",
8313
8566
  {
8567
+ "data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
8314
8568
  "aria-sort": isSorted ? sort?.direction === "asc" ? "ascending" : "descending" : void 0,
8315
8569
  className: cn(
8316
8570
  "h-9 text-left align-middle max-sm:whitespace-nowrap",
@@ -8330,12 +8584,12 @@ function MatrxDataTableCore({
8330
8584
  // horizontal-scroll surface.
8331
8585
  col.width !== void 0 && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)]",
8332
8586
  col.headerClassName,
8333
- columnDropTarget?.id === id && (columnDropTarget.after ? "border-r-2 border-primary" : "border-l-2 border-primary"),
8587
+ isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
8334
8588
  col.align === "center" && "text-center",
8335
8589
  col.align === "right" && "text-right"
8336
8590
  ),
8337
8591
  style: columnWidthVar(col.width),
8338
- children: /* @__PURE__ */ jsx36(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ jsx36(
8592
+ children: /* @__PURE__ */ jsx35(ColumnHeaderDropZone, { id, enabled: reorderableColumns, children: /* @__PURE__ */ jsx35(
8339
8593
  ColumnHeaderCell,
8340
8594
  {
8341
8595
  label: col.header,
@@ -8376,12 +8630,12 @@ function MatrxDataTableCore({
8376
8630
  id
8377
8631
  );
8378
8632
  }),
8379
- showActionsCol && /* @__PURE__ */ jsx36("th", { className: "h-9 w-28 px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Actions" })
8633
+ showActionsCol && /* @__PURE__ */ jsx35("th", { className: "h-9 w-28 px-2 text-right align-middle text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Actions" })
8380
8634
  ] }) }),
8381
- /* @__PURE__ */ jsxs27("tbody", { children: [
8382
- isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxs27("tr", { className: "border-b border-border/60", children: [
8383
- selection ? /* @__PURE__ */ jsx36("td", { className: "px-2 py-2", children: /* @__PURE__ */ jsx36(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
8384
- visibleColumns.map((col) => /* @__PURE__ */ jsx36(
8635
+ /* @__PURE__ */ jsxs26("tbody", { children: [
8636
+ isLoading ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxs26("tr", { className: "border-b border-border/60", children: [
8637
+ selection ? /* @__PURE__ */ jsx35("td", { className: "px-2 py-2", children: /* @__PURE__ */ jsx35(Skeleton, { className: "h-3.5 w-3.5" }) }) : null,
8638
+ visibleColumns.map((col) => /* @__PURE__ */ jsx35(
8385
8639
  "td",
8386
8640
  {
8387
8641
  className: cn(
@@ -8389,20 +8643,20 @@ function MatrxDataTableCore({
8389
8643
  col.compact ? "px-1" : "px-2",
8390
8644
  col.mobileHidden && "max-sm:hidden"
8391
8645
  ),
8392
- children: /* @__PURE__ */ jsx36(Skeleton, { className: "h-5 w-full" })
8646
+ children: /* @__PURE__ */ jsx35(Skeleton, { className: "h-5 w-full" })
8393
8647
  },
8394
8648
  columnId(col)
8395
8649
  )),
8396
- showActionsCol && /* @__PURE__ */ jsx36("td", { className: "px-2 py-2", children: /* @__PURE__ */ jsx36(Skeleton, { className: "ml-auto h-5 w-10" }) })
8397
- ] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ jsx36("tr", { children: /* @__PURE__ */ jsx36(
8650
+ showActionsCol && /* @__PURE__ */ jsx35("td", { className: "px-2 py-2", children: /* @__PURE__ */ jsx35(Skeleton, { className: "ml-auto h-5 w-10" }) })
8651
+ ] }, `sk-${i}`)) : paginated.length === 0 ? /* @__PURE__ */ jsx35("tr", { children: /* @__PURE__ */ jsx35(
8398
8652
  "td",
8399
8653
  {
8400
8654
  colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
8401
8655
  className: "px-4 py-12 text-center",
8402
- children: /* @__PURE__ */ jsxs27("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2", children: [
8656
+ children: /* @__PURE__ */ jsxs26("div", { className: "mx-auto flex max-w-sm flex-col items-center gap-2", children: [
8403
8657
  emptyState?.icon,
8404
- /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
8405
- emptyState?.description ? /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
8658
+ /* @__PURE__ */ jsx35("p", { className: "text-sm font-medium text-foreground", children: emptyState?.title ?? "No rows" }),
8659
+ emptyState?.description ? /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: emptyState.description }) : null,
8406
8660
  emptyState?.action
8407
8661
  ] })
8408
8662
  }
@@ -8412,7 +8666,7 @@ function MatrxDataTableCore({
8412
8666
  const rowEdits = edits[id];
8413
8667
  const displayRow = applyRowEdits(row, rowEdits);
8414
8668
  const isChecked = selectedIdSet.has(id);
8415
- const rowNode = /* @__PURE__ */ jsxs27(
8669
+ const rowNode = /* @__PURE__ */ jsxs26(
8416
8670
  "tr",
8417
8671
  {
8418
8672
  "data-row-id": id,
@@ -8435,12 +8689,12 @@ function MatrxDataTableCore({
8435
8689
  zebra && index % 2 === 1 && !isSelected && !isChecked && "sm:bg-muted/20"
8436
8690
  ),
8437
8691
  children: [
8438
- selection ? /* @__PURE__ */ jsx36(
8692
+ selection ? /* @__PURE__ */ jsx35(
8439
8693
  "td",
8440
8694
  {
8441
8695
  className: "px-2 py-1.5 align-middle lg:py-0.5",
8442
8696
  onClick: (e) => e.stopPropagation(),
8443
- children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ jsx36(
8697
+ children: selection.isRowSelectable?.(row) ?? true ? /* @__PURE__ */ jsx35(
8444
8698
  Checkbox,
8445
8699
  {
8446
8700
  className: CHECKBOX_TAP_AREA,
@@ -8452,18 +8706,11 @@ function MatrxDataTableCore({
8452
8706
  }
8453
8707
  ) : null,
8454
8708
  visibleColumns.map((col, colIdx) => {
8455
- const field = col.accessorKey ? String(col.accessorKey) : columnId(col);
8456
- const display = renderCell(displayRow, col, index);
8457
- const editable = Boolean(
8458
- editEnabled && col.editable && (col.editableIf?.(row) ?? true)
8459
- );
8460
- const dirty = Boolean(
8461
- rowEdits && field in rowEdits
8462
- );
8463
- const cellHref = col.href?.(row) ?? void 0;
8464
- return /* @__PURE__ */ jsx36(
8709
+ const isColumnDragShadow = columnDragPreview?.draggedId === columnId(col) && columnDragPreview.targetId !== null;
8710
+ return /* @__PURE__ */ jsx35(
8465
8711
  "td",
8466
8712
  {
8713
+ "data-matrx-column-drag-shadow": isColumnDragShadow ? "true" : void 0,
8467
8714
  className: cn(
8468
8715
  "py-1.5 align-middle lg:py-0.5",
8469
8716
  col.compact ? "px-1" : "px-2",
@@ -8473,18 +8720,19 @@ function MatrxDataTableCore({
8473
8720
  col.mobileHidden && "max-sm:hidden",
8474
8721
  col.width !== void 0 && "sm:w-[var(--matrx-col-w)] sm:min-w-[var(--matrx-col-w)] sm:max-w-[var(--matrx-col-w)]",
8475
8722
  col.className,
8723
+ isColumnDragShadow && "bg-primary/10 shadow-[inset_2px_0_0_var(--primary),inset_-2px_0_0_var(--primary)]",
8476
8724
  col.align === "center" && "text-center",
8477
8725
  col.align === "right" && "text-right"
8478
8726
  ),
8479
8727
  style: columnWidthVar(col.width),
8480
- children: /* @__PURE__ */ jsxs27(
8728
+ children: /* @__PURE__ */ jsxs26(
8481
8729
  "div",
8482
8730
  {
8483
8731
  className: cn(
8484
8732
  colIdx === 0 && hierarchy && "flex min-w-0 items-center"
8485
8733
  ),
8486
8734
  children: [
8487
- colIdx === 0 && hierarchy ? /* @__PURE__ */ jsx36(
8735
+ colIdx === 0 && hierarchy ? /* @__PURE__ */ jsx35(
8488
8736
  HierarchyDragHandle,
8489
8737
  {
8490
8738
  id,
@@ -8492,32 +8740,12 @@ function MatrxDataTableCore({
8492
8740
  disabled: !(hierarchy.canReparent?.(row) ?? true)
8493
8741
  }
8494
8742
  ) : null,
8495
- /* @__PURE__ */ jsx36(
8743
+ /* @__PURE__ */ jsx35(
8496
8744
  "div",
8497
8745
  {
8498
8746
  "data-matrx-cell-content": true,
8499
8747
  className: "min-w-0 max-w-full flex-1 whitespace-normal break-words [overflow-wrap:anywhere] sm:[&_*]:min-w-0 sm:[&_*]:max-w-full sm:[&_*]:whitespace-normal sm:[&_*]:[overflow-wrap:anywhere] sm:[&_[data-matrx-cell-control]]:w-max sm:[&_[data-matrx-cell-control]]:min-w-max sm:[&_[data-matrx-cell-control]]:max-w-none sm:[&_[data-matrx-cell-control]]:whitespace-nowrap sm:[&_[data-matrx-cell-control]]:[overflow-wrap:normal] sm:[&_[data-matrx-cell-control]_*]:whitespace-nowrap sm:[&_[data-matrx-cell-control]_*]:[overflow-wrap:normal]",
8500
- children: editable && col.editable ? /* @__PURE__ */ jsx36(
8501
- EditableTableCell,
8502
- {
8503
- value: rowEdits && field in rowEdits ? rowEdits[field] : getCellValue(row, col),
8504
- editType: col.editable,
8505
- ...col.editOptions === void 0 ? {} : { editOptions: col.editOptions },
8506
- display,
8507
- dirty,
8508
- onCommit: (next) => commitCell(id, field, next),
8509
- ...cellHref === void 0 ? {} : { href: cellHref },
8510
- ...col.editTrigger === void 0 ? {} : { editTrigger: col.editTrigger }
8511
- }
8512
- ) : cellHref ? /* @__PURE__ */ jsx36(
8513
- Link,
8514
- {
8515
- href: cellHref,
8516
- onClick: (e) => e.stopPropagation(),
8517
- className: "block w-full min-w-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
8518
- children: display
8519
- }
8520
- ) : display
8748
+ children: renderRecordCell(row, col, index)
8521
8749
  }
8522
8750
  )
8523
8751
  ]
@@ -8527,13 +8755,13 @@ function MatrxDataTableCore({
8527
8755
  columnId(col)
8528
8756
  );
8529
8757
  }),
8530
- showActionsCol && /* @__PURE__ */ jsx36("td", { className: "px-2 py-1.5 text-right align-middle lg:py-0.5", children: /* @__PURE__ */ jsxs27(
8758
+ showActionsCol && /* @__PURE__ */ jsx35("td", { className: "px-2 py-1.5 text-right align-middle lg:py-0.5", children: /* @__PURE__ */ jsxs26(
8531
8759
  "div",
8532
8760
  {
8533
8761
  className: "inline-flex items-center justify-end gap-0.5",
8534
8762
  onClick: (e) => e.stopPropagation(),
8535
8763
  children: [
8536
- showRowCopy && effectiveCopy ? /* @__PURE__ */ jsx36(
8764
+ showRowCopy && effectiveCopy ? /* @__PURE__ */ jsx35(
8537
8765
  TableRowCopyControl,
8538
8766
  {
8539
8767
  size: "xs",
@@ -8551,8 +8779,8 @@ function MatrxDataTableCore({
8551
8779
  hasPendingEdits: Boolean(rowEdits),
8552
8780
  discardPendingEdits: () => discardRowEdits(id)
8553
8781
  }),
8554
- windowEnabled ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8555
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
8782
+ windowEnabled ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8783
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
8556
8784
  Button,
8557
8785
  {
8558
8786
  type: "button",
@@ -8568,10 +8796,10 @@ function MatrxDataTableCore({
8568
8796
  openWindow(row);
8569
8797
  }
8570
8798
  },
8571
- children: opensWindowOnRowClick ? /* @__PURE__ */ jsx36(PanelRightOpen, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx36(PanelRight, { className: "h-3.5 w-3.5" })
8799
+ children: opensWindowOnRowClick ? /* @__PURE__ */ jsx35(PanelRightOpen, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx35(PanelRight, { className: "h-3.5 w-3.5" })
8572
8800
  }
8573
8801
  ) }),
8574
- /* @__PURE__ */ jsx36(TooltipContent, { children: opensWindowOnRowClick ? "Open in side panel" : "Open in window" })
8802
+ /* @__PURE__ */ jsx35(TooltipContent, { children: opensWindowOnRowClick ? "Open in side panel" : "Open in window" })
8575
8803
  ] }) : null
8576
8804
  ]
8577
8805
  }
@@ -8581,7 +8809,7 @@ function MatrxDataTableCore({
8581
8809
  id
8582
8810
  );
8583
8811
  const wrappedRow = rowWrapper ? rowWrapper(row, rowNode) : rowNode;
8584
- return hierarchy ? /* @__PURE__ */ jsx36(
8812
+ return hierarchy ? /* @__PURE__ */ jsx35(
8585
8813
  HierarchyDroppableRow,
8586
8814
  {
8587
8815
  id,
@@ -8589,21 +8817,21 @@ function MatrxDataTableCore({
8589
8817
  children: wrappedRow
8590
8818
  },
8591
8819
  id
8592
- ) : /* @__PURE__ */ jsx36(Fragment6, { children: wrappedRow }, id);
8820
+ ) : /* @__PURE__ */ jsx35(Fragment6, { children: wrappedRow }, id);
8593
8821
  }),
8594
- appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ jsx36("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ jsx36(
8822
+ appendQuery !== null && isFetching && !isLoading ? /* @__PURE__ */ jsx35("tr", { "data-matrx-table-append-loading-row": true, children: /* @__PURE__ */ jsx35(
8595
8823
  "td",
8596
8824
  {
8597
8825
  colSpan: visibleColumns.length + leadingCols + (showActionsCol ? 1 : 0),
8598
8826
  className: "sticky bottom-0 z-20 h-16 border-y border-border bg-card/95 px-0 py-0 text-left shadow-sm backdrop-blur-sm",
8599
- children: /* @__PURE__ */ jsxs27(
8827
+ children: /* @__PURE__ */ jsxs26(
8600
8828
  "div",
8601
8829
  {
8602
8830
  role: "status",
8603
8831
  "aria-live": "polite",
8604
8832
  className: "sticky left-0 flex h-16 w-fit max-w-[100cqw] items-center justify-center gap-2 px-3 text-sm font-medium text-foreground",
8605
8833
  children: [
8606
- /* @__PURE__ */ jsx36(
8834
+ /* @__PURE__ */ jsx35(
8607
8835
  Loader2,
8608
8836
  {
8609
8837
  "aria-hidden": "true",
@@ -8617,9 +8845,9 @@ function MatrxDataTableCore({
8617
8845
  }
8618
8846
  ) }) : null
8619
8847
  ] }),
8620
- footerRows.length > 0 ? /* @__PURE__ */ jsx36("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ jsxs27("tr", { children: [
8621
- selection ? /* @__PURE__ */ jsx36("td", { className: "px-2 py-2" }) : null,
8622
- visibleColumns.map((column) => /* @__PURE__ */ jsx36(
8848
+ footerRows.length > 0 ? /* @__PURE__ */ jsx35("tfoot", { className: "border-t-2 border-border bg-muted/50 font-semibold", children: footerRows.map((row, index) => /* @__PURE__ */ jsxs26("tr", { children: [
8849
+ selection ? /* @__PURE__ */ jsx35("td", { className: "px-2 py-2" }) : null,
8850
+ visibleColumns.map((column) => /* @__PURE__ */ jsx35(
8623
8851
  "td",
8624
8852
  {
8625
8853
  className: cn(
@@ -8634,14 +8862,14 @@ function MatrxDataTableCore({
8634
8862
  },
8635
8863
  columnId(column)
8636
8864
  )),
8637
- showActionsCol ? /* @__PURE__ */ jsx36("td", { className: "px-2 py-2" }) : null
8865
+ showActionsCol ? /* @__PURE__ */ jsx35("td", { className: "px-2 py-2" }) : null
8638
8866
  ] }, `footer-${index}`)) }) : null
8639
8867
  ] })
8640
8868
  ]
8641
8869
  }
8642
8870
  ),
8643
- scrollHintLeft ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8644
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
8871
+ scrollHintLeft ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8872
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
8645
8873
  Button,
8646
8874
  {
8647
8875
  type: "button",
@@ -8651,13 +8879,13 @@ function MatrxDataTableCore({
8651
8879
  "data-matrx-table-scroll-control": "left",
8652
8880
  className: "absolute left-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
8653
8881
  onClick: () => scrollTableHorizontally("left"),
8654
- children: /* @__PURE__ */ jsx36(ChevronLeft, { className: "h-5 w-5" })
8882
+ children: /* @__PURE__ */ jsx35(ChevronLeft, { className: "h-5 w-5" })
8655
8883
  }
8656
8884
  ) }),
8657
- /* @__PURE__ */ jsx36(TooltipContent, { children: "More columns to the left" })
8885
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "More columns to the left" })
8658
8886
  ] }) : null,
8659
- scrollHintRight ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8660
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
8887
+ scrollHintRight ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
8888
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
8661
8889
  Button,
8662
8890
  {
8663
8891
  type: "button",
@@ -8667,26 +8895,26 @@ function MatrxDataTableCore({
8667
8895
  "data-matrx-table-scroll-control": "right",
8668
8896
  className: "absolute right-1.5 top-1/2 z-30 hidden h-11 w-11 -translate-y-1/2 rounded-full border border-glass-edge bg-glass p-0 text-foreground shadow-glass backdrop-blur-glass backdrop-saturate-glass hover:bg-glass-hover active:bg-glass-active sm:inline-flex",
8669
8897
  onClick: () => scrollTableHorizontally("right"),
8670
- children: /* @__PURE__ */ jsx36(ChevronRight, { className: "h-5 w-5" })
8898
+ children: /* @__PURE__ */ jsx35(ChevronRight, { className: "h-5 w-5" })
8671
8899
  }
8672
8900
  ) }),
8673
- /* @__PURE__ */ jsx36(TooltipContent, { children: "More columns to the right" })
8901
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "More columns to the right" })
8674
8902
  ] }) : null
8675
8903
  ] }),
8676
- appendQuery ? /* @__PURE__ */ jsxs27(
8904
+ appendQuery ? /* @__PURE__ */ jsxs26(
8677
8905
  "div",
8678
8906
  {
8679
8907
  "data-matrx-table-footer": true,
8680
8908
  className: "flex min-h-16 shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border px-3 py-2",
8681
8909
  "aria-busy": isLoading || isFetching,
8682
8910
  children: [
8683
- /* @__PURE__ */ jsxs27(
8911
+ /* @__PURE__ */ jsxs26(
8684
8912
  "div",
8685
8913
  {
8686
8914
  ...isFetching && !isLoading ? {} : { role: "status", "aria-live": "polite" },
8687
8915
  className: "flex w-full min-w-0 flex-none items-center gap-2 text-xs text-muted-foreground sm:w-auto sm:flex-1",
8688
8916
  children: [
8689
- isLoading ? /* @__PURE__ */ jsx36(
8917
+ isLoading ? /* @__PURE__ */ jsx35(
8690
8918
  Loader2,
8691
8919
  {
8692
8920
  "data-matrx-table-append-loader": true,
@@ -8694,40 +8922,40 @@ function MatrxDataTableCore({
8694
8922
  className: "h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none"
8695
8923
  }
8696
8924
  ) : null,
8697
- /* @__PURE__ */ jsxs27("div", { className: "min-w-0", children: [
8698
- /* @__PURE__ */ jsx36("p", { className: "break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : `${data.length.toLocaleString()} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${appendQuery.pagination.totalItems.toLocaleString()}`}` }),
8699
- appendQuery.pagination.sourceUntil ? /* @__PURE__ */ jsxs27("p", { children: [
8925
+ /* @__PURE__ */ jsxs26("div", { className: "min-w-0", children: [
8926
+ /* @__PURE__ */ jsx35("p", { className: "break-words font-medium text-foreground", children: isLoading ? "Loading rows\u2026" : `${data.length.toLocaleString()} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${appendQuery.pagination.totalItems.toLocaleString()}`}` }),
8927
+ appendQuery.pagination.sourceUntil ? /* @__PURE__ */ jsxs26("p", { children: [
8700
8928
  "Source fixed through",
8701
8929
  " ",
8702
8930
  new Date(appendQuery.pagination.sourceUntil).toLocaleString(),
8703
8931
  "."
8704
8932
  ] }) : null,
8705
- !isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ jsx36("p", { children: "All source rows are loaded." }) : appendUsesLocalProcessing ? /* @__PURE__ */ jsx36("p", { children: "Local search and filters cover loaded rows." }) : null,
8706
- scrollPagination.error ? /* @__PURE__ */ jsx36("p", { role: "alert", className: "break-words text-destructive", children: scrollPagination.error.message }) : null
8933
+ !isLoading && !isFetching && !appendQuery.pagination.loadAll?.isLoading && !scrollPagination.error && !appendQuery.pagination.hasNextPage && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ jsx35("p", { children: "All source rows are loaded." }) : appendUsesLocalProcessing ? /* @__PURE__ */ jsx35("p", { children: "Local search and filters cover loaded rows." }) : null,
8934
+ scrollPagination.error ? /* @__PURE__ */ jsx35("p", { role: "alert", className: "break-words text-destructive", children: scrollPagination.error.message }) : null
8707
8935
  ] })
8708
8936
  ]
8709
8937
  }
8710
8938
  ),
8711
- appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ jsxs27(
8939
+ appendQuery.pagination.sourcePageSize ? /* @__PURE__ */ jsxs26(
8712
8940
  Select,
8713
8941
  {
8714
8942
  value: String(appendQuery.pagination.sourcePageSize.value),
8715
8943
  onValueChange: (value) => appendQuery.pagination.sourcePageSize?.onChange(Number(value)),
8716
8944
  children: [
8717
- /* @__PURE__ */ jsx36(
8945
+ /* @__PURE__ */ jsx35(
8718
8946
  SelectTrigger,
8719
8947
  {
8720
8948
  "aria-label": "Rows per load",
8721
8949
  className: "h-8 w-20 shrink-0 text-xs sm:w-24",
8722
8950
  disabled: isLoading || isFetching || appendQuery.pagination.loadAll?.isLoading,
8723
- children: /* @__PURE__ */ jsx36(SelectValue, {})
8951
+ children: /* @__PURE__ */ jsx35(SelectValue, {})
8724
8952
  }
8725
8953
  ),
8726
- /* @__PURE__ */ jsx36(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ jsx36(SelectItem, { value: String(size), children: size }, size)) })
8954
+ /* @__PURE__ */ jsx35(SelectContent, { children: appendQuery.pagination.sourcePageSize.options.map((size) => /* @__PURE__ */ jsx35(SelectItem, { value: String(size), children: size }, size)) })
8727
8955
  ]
8728
8956
  }
8729
8957
  ) : null,
8730
- appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ jsx36(
8958
+ appendQuery.pagination.loadAll?.isLoading ? /* @__PURE__ */ jsx35(
8731
8959
  Button,
8732
8960
  {
8733
8961
  type: "button",
@@ -8735,7 +8963,7 @@ function MatrxDataTableCore({
8735
8963
  onClick: appendQuery.pagination.loadAll.stop,
8736
8964
  children: "Stop loading"
8737
8965
  }
8738
- ) : scrollPagination.error ? /* @__PURE__ */ jsx36(
8966
+ ) : scrollPagination.error ? /* @__PURE__ */ jsx35(
8739
8967
  Button,
8740
8968
  {
8741
8969
  type: "button",
@@ -8743,8 +8971,8 @@ function MatrxDataTableCore({
8743
8971
  onClick: appendQuery.pagination.retrySource ?? (appendQuery.pagination.hasNextPage ? appendQuery.pagination.loadNextPage : appendQuery.pagination.refresh),
8744
8972
  children: appendQuery.pagination.retrySource ? "Retry source" : appendQuery.pagination.hasNextPage ? "Retry" : "Reload rows"
8745
8973
  }
8746
- ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap gap-1", children: [
8747
- /* @__PURE__ */ jsx36(
8974
+ ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap gap-1", children: [
8975
+ /* @__PURE__ */ jsx35(
8748
8976
  Button,
8749
8977
  {
8750
8978
  type: "button",
@@ -8755,7 +8983,7 @@ function MatrxDataTableCore({
8755
8983
  children: "Load more"
8756
8984
  }
8757
8985
  ),
8758
- appendQuery.pagination.loadAll ? /* @__PURE__ */ jsx36(
8986
+ appendQuery.pagination.loadAll ? /* @__PURE__ */ jsx35(
8759
8987
  Button,
8760
8988
  {
8761
8989
  type: "button",
@@ -8766,10 +8994,10 @@ function MatrxDataTableCore({
8766
8994
  children: "Load all"
8767
8995
  }
8768
8996
  ) : null
8769
- ] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ jsx36("span", { className: "text-xs text-muted-foreground", children: "All rows loaded" }) : null
8997
+ ] }) : !isLoading && appendQuery.pagination.totalItems !== void 0 && data.length === appendQuery.pagination.totalItems ? /* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: "All rows loaded" }) : null
8770
8998
  ]
8771
8999
  }
8772
- ) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ jsx36("div", { className: "shrink-0", children: /* @__PURE__ */ jsx36(
9000
+ ) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ jsx35("div", { className: "shrink-0", children: /* @__PURE__ */ jsx35(
8773
9001
  GenericTablePagination,
8774
9002
  {
8775
9003
  totalItems,
@@ -8789,7 +9017,7 @@ function MatrxDataTableCore({
8789
9017
  }
8790
9018
  ) }) : null
8791
9019
  ] }),
8792
- /* @__PURE__ */ jsx36(
9020
+ /* @__PURE__ */ jsx35(
8793
9021
  ColumnManager,
8794
9022
  {
8795
9023
  open: columnManagerOpen,
@@ -8800,7 +9028,7 @@ function MatrxDataTableCore({
8800
9028
  onApply: commitColumnState
8801
9029
  }
8802
9030
  ),
8803
- detailEnabled && selectedRow ? /* @__PURE__ */ jsx36(
9031
+ detailEnabled && selectedRow ? /* @__PURE__ */ jsx35(
8804
9032
  SidePanelSurface,
8805
9033
  {
8806
9034
  title: resolveStringTitle(
@@ -8811,8 +9039,8 @@ function MatrxDataTableCore({
8811
9039
  description: detail?.description?.(selectedRow),
8812
9040
  onClose: () => setSelectedId(null),
8813
9041
  defaultWidth: detail?.defaultWidth ?? 480,
8814
- headerActions: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
8815
- effectiveCopy && showRowCopy ? /* @__PURE__ */ jsx36(
9042
+ headerActions: /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-1", children: [
9043
+ effectiveCopy && showRowCopy ? /* @__PURE__ */ jsx35(
8816
9044
  TableRowCopyControl,
8817
9045
  {
8818
9046
  size: "icon",
@@ -8823,8 +9051,8 @@ function MatrxDataTableCore({
8823
9051
  }
8824
9052
  ) : null,
8825
9053
  detail?.headerActions?.(selectedRow),
8826
- windowEnabled ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8827
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
9054
+ windowEnabled ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
9055
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
8828
9056
  Button,
8829
9057
  {
8830
9058
  type: "button",
@@ -8833,10 +9061,10 @@ function MatrxDataTableCore({
8833
9061
  className: "h-7 w-7",
8834
9062
  "aria-label": "Open in window",
8835
9063
  onClick: () => openWindow(selectedRow),
8836
- children: /* @__PURE__ */ jsx36(PanelRight, { className: "h-3.5 w-3.5" })
9064
+ children: /* @__PURE__ */ jsx35(PanelRight, { className: "h-3.5 w-3.5" })
8837
9065
  }
8838
9066
  ) }),
8839
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Open in window" })
9067
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "Open in window" })
8840
9068
  ] }) : null
8841
9069
  ] }),
8842
9070
  children: detail?.render ? (
@@ -8847,7 +9075,7 @@ function MatrxDataTableCore({
8847
9075
  // fixes the whole class at once — a custom body that already
8848
9076
  // scrolls (`h-full` + `overflow-y-auto` root) still resolves to
8849
9077
  // this container's height, so no second scrollbar appears.
8850
- /* @__PURE__ */ jsx36("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
9078
+ /* @__PURE__ */ jsx35("div", { className: "h-full min-h-0 overflow-y-auto", children: detail.render(selectedRow, {
8851
9079
  closeDetail: () => setSelectedId(null),
8852
9080
  openDetail: () => openDetail(selectedRow),
8853
9081
  openWindow: () => openWindow(selectedRow),
@@ -8855,7 +9083,7 @@ function MatrxDataTableCore({
8855
9083
  hasPendingEdits: Boolean(edits[getRowId(selectedRow)]),
8856
9084
  discardPendingEdits: () => discardRowEdits(getRowId(selectedRow))
8857
9085
  }) })
8858
- ) : /* @__PURE__ */ jsx36(
9086
+ ) : /* @__PURE__ */ jsx35(
8859
9087
  DataRowInspector,
8860
9088
  {
8861
9089
  row: selectedRow,
@@ -8867,7 +9095,7 @@ function MatrxDataTableCore({
8867
9095
  )
8868
9096
  }
8869
9097
  ) : null,
8870
- windowRow ? /* @__PURE__ */ jsx36(
9098
+ windowRow ? /* @__PURE__ */ jsx35(
8871
9099
  DataRowWindow,
8872
9100
  {
8873
9101
  isOpen: true,
@@ -8878,9 +9106,9 @@ function MatrxDataTableCore({
8878
9106
  height: windowConfig?.height,
8879
9107
  windowId: `matrx-data-row-${urlState?.id ?? "local"}-${getRowId(windowRow)}`,
8880
9108
  defaultTab: windowConfig?.defaultTab,
8881
- headerActions: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
8882
- opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ jsxs27(Tooltip, { children: [
8883
- /* @__PURE__ */ jsx36(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx36(
9109
+ headerActions: /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-1", children: [
9110
+ opensWindowOnRowClick && detailEnabled ? /* @__PURE__ */ jsxs26(Tooltip, { children: [
9111
+ /* @__PURE__ */ jsx35(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx35(
8884
9112
  Button,
8885
9113
  {
8886
9114
  type: "button",
@@ -8892,12 +9120,12 @@ function MatrxDataTableCore({
8892
9120
  closeWindow();
8893
9121
  openDetail(windowRow);
8894
9122
  },
8895
- children: /* @__PURE__ */ jsx36(PanelRightOpen, { className: "h-3.5 w-3.5" })
9123
+ children: /* @__PURE__ */ jsx35(PanelRightOpen, { className: "h-3.5 w-3.5" })
8896
9124
  }
8897
9125
  ) }),
8898
- /* @__PURE__ */ jsx36(TooltipContent, { children: "Open in side panel" })
9126
+ /* @__PURE__ */ jsx35(TooltipContent, { children: "Open in side panel" })
8899
9127
  ] }) : null,
8900
- effectiveCopy && showRowCopy ? /* @__PURE__ */ jsx36(
9128
+ effectiveCopy && showRowCopy ? /* @__PURE__ */ jsx35(
8901
9129
  TableRowCopyControl,
8902
9130
  {
8903
9131
  size: "icon",
@@ -8915,7 +9143,7 @@ function MatrxDataTableCore({
8915
9143
  closeWindow,
8916
9144
  hasPendingEdits: Boolean(edits[getRowId(windowRow)]),
8917
9145
  discardPendingEdits: () => discardRowEdits(getRowId(windowRow))
8918
- }) ?? /* @__PURE__ */ jsx36(
9146
+ }) ?? /* @__PURE__ */ jsx35(
8919
9147
  DataRowInspector,
8920
9148
  {
8921
9149
  row: windowRow,
@@ -8951,15 +9179,15 @@ function MatrxDataTableCore({
8951
9179
  })
8952
9180
  }
8953
9181
  ) : null,
8954
- editEnabled ? /* @__PURE__ */ jsxs27(Fragment7, { children: [
8955
- foreignDrafts.length > 0 ? /* @__PURE__ */ jsxs27(
9182
+ editEnabled ? /* @__PURE__ */ jsxs26(Fragment7, { children: [
9183
+ foreignDrafts.length > 0 ? /* @__PURE__ */ jsxs26(
8956
9184
  "div",
8957
9185
  {
8958
9186
  "data-matrx-foreign-drafts": true,
8959
9187
  className: "fixed inset-x-3 bottom-20 z-50 flex flex-wrap items-center justify-center gap-2 rounded-lg border border-amber-500/40 bg-card px-3 py-2 text-xs shadow-lg sm:inset-x-auto sm:left-1/2 sm:-translate-x-1/2 sm:flex-nowrap",
8960
9188
  children: [
8961
- /* @__PURE__ */ jsx36("span", { children: "Unsaved edits from previous results" }),
8962
- /* @__PURE__ */ jsx36(
9189
+ /* @__PURE__ */ jsx35("span", { children: "Unsaved edits from previous results" }),
9190
+ /* @__PURE__ */ jsx35(
8963
9191
  CopyButtons,
8964
9192
  {
8965
9193
  size: "xs",
@@ -8968,11 +9196,11 @@ function MatrxDataTableCore({
8968
9196
  json: () => foreignDraftPayload
8969
9197
  }
8970
9198
  ),
8971
- /* @__PURE__ */ jsx36(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
9199
+ /* @__PURE__ */ jsx35(Button, { type: "button", size: "sm", variant: "ghost", className: "h-7 text-xs text-destructive", onClick: () => setConfirmForeignDraftDiscard(true), children: "Discard drafts" })
8972
9200
  ]
8973
9201
  }
8974
9202
  ) : null,
8975
- /* @__PURE__ */ jsx36(
9203
+ /* @__PURE__ */ jsx35(
8976
9204
  ConfirmDialog,
8977
9205
  {
8978
9206
  open: confirmForeignDraftDiscard,
@@ -8992,7 +9220,7 @@ function MatrxDataTableCore({
8992
9220
  }
8993
9221
  }
8994
9222
  ),
8995
- /* @__PURE__ */ jsx36(
9223
+ /* @__PURE__ */ jsx35(
8996
9224
  DirtySavePill,
8997
9225
  {
8998
9226
  changeCount,
@@ -9005,11 +9233,11 @@ function MatrxDataTableCore({
9005
9233
  ]
9006
9234
  }
9007
9235
  ),
9008
- /* @__PURE__ */ jsx36(DragOverlay, { children: draggedRow ? (
9236
+ /* @__PURE__ */ jsx35(DragOverlay, { children: draggedRow ? (
9009
9237
  // w-max: the overlay inherits the ACTIVE node's size, and the active
9010
9238
  // node is the 16px grip handle — without it the label wraps to one
9011
9239
  // character per line.
9012
- /* @__PURE__ */ jsx36("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
9240
+ /* @__PURE__ */ jsx35("div", { className: "w-max max-w-xs truncate rounded border border-border bg-card px-2.5 py-1.5 text-sm font-medium text-foreground shadow-md", children: hierarchy?.itemLabel?.(draggedRow) ?? "Moving row" })
9013
9241
  ) : null })
9014
9242
  ]
9015
9243
  }
@@ -9024,7 +9252,7 @@ function HierarchyDragHandle({
9024
9252
  id,
9025
9253
  disabled
9026
9254
  });
9027
- return /* @__PURE__ */ jsx36(
9255
+ return /* @__PURE__ */ jsx35(
9028
9256
  "button",
9029
9257
  {
9030
9258
  ref: setNodeRef,
@@ -9036,7 +9264,7 @@ function HierarchyDragHandle({
9036
9264
  onClick: (event) => event.stopPropagation(),
9037
9265
  ...attributes,
9038
9266
  ...listeners,
9039
- children: /* @__PURE__ */ jsx36(GripVertical, { className: "h-3.5 w-3.5" })
9267
+ children: /* @__PURE__ */ jsx35(GripVertical, { className: "h-3.5 w-3.5" })
9040
9268
  }
9041
9269
  );
9042
9270
  }
@@ -9045,7 +9273,7 @@ function HierarchyRootDropTarget({
9045
9273
  draggedLabel
9046
9274
  }) {
9047
9275
  const { isOver, setNodeRef } = useDroppable2({ id: "__root__" });
9048
- return /* @__PURE__ */ jsxs27(
9276
+ return /* @__PURE__ */ jsxs26(
9049
9277
  "div",
9050
9278
  {
9051
9279
  ref: setNodeRef,
@@ -9055,8 +9283,8 @@ function HierarchyRootDropTarget({
9055
9283
  isOver && "border-solid bg-primary/20 shadow-md shadow-primary/25"
9056
9284
  ),
9057
9285
  children: [
9058
- /* @__PURE__ */ jsx36("span", { className: "truncate", children: draggedLabel }),
9059
- /* @__PURE__ */ jsx36("span", { className: "text-primary/75", children: label })
9286
+ /* @__PURE__ */ jsx35("span", { className: "truncate", children: draggedLabel }),
9287
+ /* @__PURE__ */ jsx35("span", { className: "text-primary/75", children: label })
9060
9288
  ]
9061
9289
  }
9062
9290
  );
@@ -9105,7 +9333,7 @@ function HierarchyDragIndicatorLayer({
9105
9333
  const { preview: preview2 } = indicator;
9106
9334
  const indent = indicator.left + 10 + preview2.depth * 12;
9107
9335
  if (preview2.position === "inside") {
9108
- return /* @__PURE__ */ jsx36(
9336
+ return /* @__PURE__ */ jsx35(
9109
9337
  "div",
9110
9338
  {
9111
9339
  "aria-hidden": "true",
@@ -9117,7 +9345,7 @@ function HierarchyDragIndicatorLayer({
9117
9345
  width: Math.max(0, indicator.width - 4),
9118
9346
  height: indicator.height
9119
9347
  },
9120
- children: /* @__PURE__ */ jsxs27(
9348
+ children: /* @__PURE__ */ jsxs26(
9121
9349
  "span",
9122
9350
  {
9123
9351
  className: "absolute top-1/2 -translate-y-1/2 whitespace-nowrap rounded bg-card/95 px-1.5 py-0.5 text-[10px] font-medium text-primary",
@@ -9132,7 +9360,7 @@ function HierarchyDragIndicatorLayer({
9132
9360
  );
9133
9361
  }
9134
9362
  const lineTop = preview2.position === "before" ? indicator.top - 1 : indicator.top + indicator.height - 1;
9135
- return /* @__PURE__ */ jsx36(
9363
+ return /* @__PURE__ */ jsx35(
9136
9364
  "div",
9137
9365
  {
9138
9366
  "aria-hidden": "true",
@@ -9143,9 +9371,9 @@ function HierarchyDragIndicatorLayer({
9143
9371
  left: indent,
9144
9372
  width: Math.max(0, indicator.left + indicator.width - indent - 8)
9145
9373
  },
9146
- children: /* @__PURE__ */ jsxs27("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
9147
- /* @__PURE__ */ jsx36("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
9148
- /* @__PURE__ */ jsxs27(
9374
+ children: /* @__PURE__ */ jsxs26("div", { className: "relative h-0.5 rounded-full bg-primary", children: [
9375
+ /* @__PURE__ */ jsx35("span", { className: "absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rounded-full border-2 border-primary bg-card" }),
9376
+ /* @__PURE__ */ jsxs26(
9149
9377
  "span",
9150
9378
  {
9151
9379
  className: cn(
@@ -9186,7 +9414,7 @@ function ColumnHeaderDropZone({
9186
9414
  disabled: !enabled,
9187
9415
  data: { matrxDragKind: "column-header", columnId: id }
9188
9416
  });
9189
- return /* @__PURE__ */ jsx36("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
9417
+ return /* @__PURE__ */ jsx35("div", { ref: setNodeRef, className: "flex min-w-0 items-center", children });
9190
9418
  }
9191
9419
  function columnWidthVar(width) {
9192
9420
  if (width === void 0) return void 0;
@@ -9202,7 +9430,7 @@ function renderCell(row, col, index) {
9202
9430
  if (asUuid && typeof raw === "string") {
9203
9431
  const forbidden = typeof col.fk?.forbidden === "function" ? col.fk.forbidden(raw, row) : Boolean(col.fk?.forbidden);
9204
9432
  const declaredToken = typeof col.fk?.token === "function" ? col.fk.token(row) : col.fk?.token;
9205
- return /* @__PURE__ */ jsx36(
9433
+ return /* @__PURE__ */ jsx35(
9206
9434
  MatrxUuidCell,
9207
9435
  {
9208
9436
  value: raw,
@@ -9214,7 +9442,7 @@ function renderCell(row, col, index) {
9214
9442
  }
9215
9443
  );
9216
9444
  }
9217
- return /* @__PURE__ */ jsx36("span", { className: "text-sm text-foreground", children: stringifyCellValue(raw) || "\u2014" });
9445
+ return /* @__PURE__ */ jsx35("span", { className: "text-sm text-foreground", children: stringifyCellValue(raw) || "\u2014" });
9218
9446
  }
9219
9447
  function defaultRowTitle(row, columns) {
9220
9448
  for (const col of columns) {
@@ -9229,6 +9457,236 @@ function resolveStringTitle(title, fallback) {
9229
9457
  return fallback;
9230
9458
  }
9231
9459
 
9460
+ // src/data-table/SavedViewsControl.tsx
9461
+ import { useState as useState16 } from "react";
9462
+
9463
+ // src/dropdown-menu.tsx
9464
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
9465
+ import * as React16 from "react";
9466
+ import { jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
9467
+ var DropdownMenu = DropdownMenuPrimitive.Root;
9468
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
9469
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
9470
+ var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
9471
+ var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
9472
+ var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
9473
+ var DropdownMenuSubTrigger = React16.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs27(
9474
+ DropdownMenuPrimitive.SubTrigger,
9475
+ {
9476
+ ref,
9477
+ "data-slot": "dropdown-menu-sub-trigger",
9478
+ className: cn(
9479
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
9480
+ inset && "pl-8",
9481
+ className
9482
+ ),
9483
+ ...props,
9484
+ children: [
9485
+ children,
9486
+ /* @__PURE__ */ jsx36(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
9487
+ ]
9488
+ }
9489
+ ));
9490
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
9491
+ var DropdownMenuSubContent = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx36(
9492
+ DropdownMenuPrimitive.SubContent,
9493
+ {
9494
+ ref,
9495
+ "data-slot": "dropdown-menu-sub-content",
9496
+ className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
9497
+ ...props
9498
+ }
9499
+ ));
9500
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
9501
+ var DropdownMenuContent = React16.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
9502
+ const portalContainer = usePortalContainer(container);
9503
+ return /* @__PURE__ */ jsx36(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx36(
9504
+ DropdownMenuPrimitive.Content,
9505
+ {
9506
+ ref,
9507
+ "data-slot": "dropdown-menu-content",
9508
+ sideOffset,
9509
+ className: cn(
9510
+ MENU_SURFACE_CLASS,
9511
+ "shadow-md",
9512
+ MOTION_POPPER,
9513
+ className
9514
+ ),
9515
+ ...props
9516
+ }
9517
+ ) });
9518
+ });
9519
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
9520
+ var DropdownMenuItem = React16.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx36(
9521
+ DropdownMenuPrimitive.Item,
9522
+ {
9523
+ ref,
9524
+ "data-slot": "dropdown-menu-item",
9525
+ className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
9526
+ ...props
9527
+ }
9528
+ ));
9529
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
9530
+ var DropdownMenuCheckboxItem = React16.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs27(
9531
+ DropdownMenuPrimitive.CheckboxItem,
9532
+ {
9533
+ ref,
9534
+ "data-slot": "dropdown-menu-checkbox-item",
9535
+ className: cn(MENU_INDICATOR_ITEM_CLASS, className),
9536
+ ...props,
9537
+ children: [
9538
+ /* @__PURE__ */ jsx36("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx36(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx36(CheckIcon, { className: "h-4 w-4" }) }) }),
9539
+ children
9540
+ ]
9541
+ }
9542
+ ));
9543
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
9544
+ var DropdownMenuRadioItem = React16.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs27(
9545
+ DropdownMenuPrimitive.RadioItem,
9546
+ {
9547
+ ref,
9548
+ "data-slot": "dropdown-menu-radio-item",
9549
+ className: cn(MENU_INDICATOR_ITEM_CLASS, className),
9550
+ ...props,
9551
+ children: [
9552
+ /* @__PURE__ */ jsx36("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx36(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx36(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
9553
+ children
9554
+ ]
9555
+ }
9556
+ ));
9557
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
9558
+ var DropdownMenuLabel = React16.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx36(
9559
+ DropdownMenuPrimitive.Label,
9560
+ {
9561
+ ref,
9562
+ "data-slot": "dropdown-menu-label",
9563
+ className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
9564
+ ...props
9565
+ }
9566
+ ));
9567
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
9568
+ var DropdownMenuSeparator = React16.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx36(
9569
+ DropdownMenuPrimitive.Separator,
9570
+ {
9571
+ ref,
9572
+ "data-slot": "dropdown-menu-separator",
9573
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
9574
+ ...props
9575
+ }
9576
+ ));
9577
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
9578
+ var DropdownMenuShortcut = ({
9579
+ className,
9580
+ ...props
9581
+ }) => /* @__PURE__ */ jsx36(
9582
+ "span",
9583
+ {
9584
+ "data-slot": "dropdown-menu-shortcut",
9585
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
9586
+ ...props
9587
+ }
9588
+ );
9589
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
9590
+
9591
+ // src/data-table/SavedViewsControl.tsx
9592
+ import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
9593
+ function SavedViewsControl({
9594
+ views,
9595
+ activeId = null,
9596
+ loading = false,
9597
+ error,
9598
+ dirty = false,
9599
+ onSelect,
9600
+ onSaveNew,
9601
+ onUpdate,
9602
+ onReload
9603
+ }) {
9604
+ const [saveOpen, setSaveOpen] = useState16(false);
9605
+ const [name, setName] = useState16("");
9606
+ const [saving, setSaving] = useState16(false);
9607
+ const [actionError, setActionError] = useState16(null);
9608
+ const visibleError = actionError ?? error;
9609
+ const save = async () => {
9610
+ const next = name.trim();
9611
+ if (!next) return;
9612
+ setSaving(true);
9613
+ setActionError(null);
9614
+ try {
9615
+ await onSaveNew(next);
9616
+ setName("");
9617
+ setSaveOpen(false);
9618
+ } catch (cause) {
9619
+ setActionError(cause instanceof Error ? cause.message : String(cause));
9620
+ } finally {
9621
+ setSaving(false);
9622
+ }
9623
+ };
9624
+ const update = async () => {
9625
+ if (!onUpdate) return;
9626
+ setSaving(true);
9627
+ setActionError(null);
9628
+ try {
9629
+ await onUpdate();
9630
+ } catch (cause) {
9631
+ setActionError(cause instanceof Error ? cause.message : String(cause));
9632
+ } finally {
9633
+ setSaving(false);
9634
+ }
9635
+ };
9636
+ const reload = async () => {
9637
+ if (!onReload) return;
9638
+ setSaving(true);
9639
+ setActionError(null);
9640
+ try {
9641
+ await onReload();
9642
+ } catch (cause) {
9643
+ setActionError(cause instanceof Error ? cause.message : String(cause));
9644
+ } finally {
9645
+ setSaving(false);
9646
+ }
9647
+ };
9648
+ const activeName = activeId ? views.find((view) => view.id === activeId)?.name : void 0;
9649
+ return /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-1", "data-matrx-table-saved-views": true, children: [
9650
+ /* @__PURE__ */ jsxs28(DropdownMenu, { children: [
9651
+ /* @__PURE__ */ jsxs28(Tooltip, { children: [
9652
+ /* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(Button, { type: "button", variant: "outline", size: "sm", className: "h-8 max-w-40 truncate text-xs", "aria-label": "Saved views", disabled: saving, children: loading ? "Loading views\u2026" : `${activeName ?? "Default view"}${dirty ? " \u2022" : ""}` }) }) }),
9653
+ /* @__PURE__ */ jsx37(TooltipContent, { children: "Choose or save a table view" })
9654
+ ] }),
9655
+ /* @__PURE__ */ jsxs28(DropdownMenuContent, { align: "end", children: [
9656
+ /* @__PURE__ */ jsx37(DropdownMenuLabel, { children: "Views" }),
9657
+ /* @__PURE__ */ jsxs28(DropdownMenuRadioGroup, { value: activeId ?? "__default__", onValueChange: (value) => onSelect(value === "__default__" ? null : value), children: [
9658
+ /* @__PURE__ */ jsx37(DropdownMenuRadioItem, { value: "__default__", children: "Default view" }),
9659
+ views.map((view) => /* @__PURE__ */ jsx37(DropdownMenuRadioItem, { value: view.id, children: view.name }, view.id))
9660
+ ] }),
9661
+ /* @__PURE__ */ jsx37(DropdownMenuSeparator, {}),
9662
+ /* @__PURE__ */ jsx37(DropdownMenuItem, { disabled: saving, onSelect: () => {
9663
+ setActionError(null);
9664
+ setSaveOpen(true);
9665
+ }, children: "Save current view\u2026" }),
9666
+ activeId && onUpdate ? /* @__PURE__ */ jsx37(DropdownMenuItem, { disabled: saving, onSelect: () => void update(), children: "Update current view" }) : null,
9667
+ onReload ? /* @__PURE__ */ jsx37(DropdownMenuItem, { disabled: saving || loading, onSelect: () => void reload(), children: "Reload views" }) : null
9668
+ ] })
9669
+ ] }),
9670
+ /* @__PURE__ */ jsxs28(Tooltip, { children: [
9671
+ /* @__PURE__ */ jsx37(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx37(Button, { type: "button", variant: "ghost", size: "icon", className: "h-8 w-8", "aria-label": "Save current view", disabled: saving, onClick: () => {
9672
+ setActionError(null);
9673
+ setSaveOpen(true);
9674
+ }, children: /* @__PURE__ */ jsx37(Save, { className: "h-4 w-4" }) }) }),
9675
+ /* @__PURE__ */ jsx37(TooltipContent, { children: "Save current view" })
9676
+ ] }),
9677
+ visibleError ? /* @__PURE__ */ jsx37("p", { role: "alert", className: "basis-full text-xs text-destructive", children: visibleError }) : null,
9678
+ /* @__PURE__ */ jsx37(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ jsxs28(DialogContent, { children: [
9679
+ /* @__PURE__ */ jsx37(DialogHeader, { children: /* @__PURE__ */ jsx37(DialogTitle, { children: "Save current view" }) }),
9680
+ visibleError ? /* @__PURE__ */ jsx37("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
9681
+ /* @__PURE__ */ jsx37(Input, { "aria-label": "View name", value: name, onChange: (event) => setName(event.target.value), placeholder: "View name", autoFocus: true }),
9682
+ /* @__PURE__ */ jsxs28(DialogFooter, { children: [
9683
+ /* @__PURE__ */ jsx37(Button, { type: "button", variant: "outline", onClick: () => setSaveOpen(false), children: "Cancel" }),
9684
+ /* @__PURE__ */ jsx37(Button, { type: "button", disabled: !name.trim() || saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save view" })
9685
+ ] })
9686
+ ] }) })
9687
+ ] });
9688
+ }
9689
+
9232
9690
  // src/data-table/tableXlsx.ts
9233
9691
  import * as XLSX from "xlsx";
9234
9692
  function downloadTableAsXlsx({
@@ -9271,6 +9729,7 @@ export {
9271
9729
  MatrxDataTable,
9272
9730
  MatrxDataTableProvider,
9273
9731
  MatrxUuidCell,
9732
+ SavedViewsControl,
9274
9733
  TableTitleRow,
9275
9734
  buildRowAgentInput,
9276
9735
  buildViewAgentInput,
@@ -9278,6 +9737,7 @@ export {
9278
9737
  collectSelectOptions,
9279
9738
  downloadTableAsXlsx,
9280
9739
  filterKindLabel,
9740
+ parseTableViewSnapshot,
9281
9741
  resolveFilterKind,
9282
9742
  rowsToCsvFromColumns,
9283
9743
  rowsToMarkdownTable,