@ai-matrx/design-system 0.37.1 → 0.38.1
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.
- package/CHANGELOG.md +21 -0
- package/dist/content-transfer.cjs +84 -18
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +84 -18
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +84 -18
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +86 -20
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +84 -18
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +86 -20
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +85 -19
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +181 -115
- package/dist/data-table/index.js.map +1 -1
- package/dist/index.cjs +84 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +94 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1613,12 +1613,14 @@ function useIsMobile() {
|
|
|
1613
1613
|
|
|
1614
1614
|
// src/dialog.tsx
|
|
1615
1615
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1616
|
+
var DialogWindowedByDefaultContext = React10.createContext(false);
|
|
1616
1617
|
var Dialog = ({
|
|
1617
1618
|
children,
|
|
1618
1619
|
...props
|
|
1619
1620
|
}) => {
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1621
|
+
const isMobile = useIsMobile();
|
|
1622
|
+
const modal = props.modal ?? isMobile;
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogWindowedByDefaultContext.Provider, { value: props.modal === void 0, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RadixDialogModalProvider, { modal, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogPrimitive.Root, { ...props, modal, children }) }) });
|
|
1622
1624
|
};
|
|
1623
1625
|
Dialog.displayName = "Dialog";
|
|
1624
1626
|
var DialogPortal = ({
|
|
@@ -1663,6 +1665,11 @@ DialogContentPrimitive.displayName = "DialogContentPrimitive";
|
|
|
1663
1665
|
var DIALOG_DESKTOP_CLASSES = "matrx-dialog-card fixed inset-0 z-[10000] m-auto grid h-fit min-w-0 w-full max-w-lg gap-4 max-h-[85dvh] overflow-y-auto overscroll-contain [--dialog-pad:1.5rem] overflow-x-clip border bg-background p-6 shadow-lg [overflow-wrap:anywhere] [&>*]:min-w-0 [&>*]:max-w-full sm:rounded-lg";
|
|
1664
1666
|
var DIALOG_MOBILE_SHEET_CLASSES = "matrx-mobile-sheet matrx-dialog-card 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] gap-4 [--dialog-pad:1rem] 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";
|
|
1665
1667
|
var DIALOG_MOBILE_SHEET_OVERRIDE = "inset-x-0 bottom-0 left-0 right-0 top-auto translate-none w-full max-w-full max-h-[90dvh] rounded-b-none rounded-t-2xl overflow-y-auto";
|
|
1668
|
+
var DialogWindowHandleContext = React10.createContext(null);
|
|
1669
|
+
var WINDOW_KEEP_VISIBLE = 80;
|
|
1670
|
+
function isInteractiveTarget(target) {
|
|
1671
|
+
return target instanceof Element && Boolean(target.closest("button, a, input, textarea, select, [role='button'], [contenteditable='true']"));
|
|
1672
|
+
}
|
|
1666
1673
|
var DialogContent = React10.forwardRef(
|
|
1667
1674
|
({
|
|
1668
1675
|
className,
|
|
@@ -1671,15 +1678,51 @@ var DialogContent = React10.forwardRef(
|
|
|
1671
1678
|
animated = true,
|
|
1672
1679
|
showCloseButton = true,
|
|
1673
1680
|
container,
|
|
1681
|
+
dismissOnOutsideClick = false,
|
|
1682
|
+
onInteractOutside,
|
|
1683
|
+
onEscapeKeyDown,
|
|
1684
|
+
style,
|
|
1674
1685
|
...props
|
|
1675
1686
|
}, ref) => {
|
|
1676
1687
|
const isMobile = useIsMobile();
|
|
1677
1688
|
const isModal = useRadixDialogModal();
|
|
1678
1689
|
const injectedContainer = usePortalContainer(container);
|
|
1679
1690
|
const asSheet = mobileSheet && isMobile;
|
|
1691
|
+
const windowed = !isModal && !asSheet;
|
|
1692
|
+
const windowedByDefault = React10.useContext(DialogWindowedByDefaultContext);
|
|
1680
1693
|
const [containerEl, setContainerEl] = React10.useState(
|
|
1681
1694
|
null
|
|
1682
1695
|
);
|
|
1696
|
+
const [offset, setOffset] = React10.useState({ x: 0, y: 0 });
|
|
1697
|
+
const dragRef = React10.useRef(null);
|
|
1698
|
+
const handle = React10.useMemo(() => {
|
|
1699
|
+
if (!windowed) return null;
|
|
1700
|
+
const clamp = (value, limit) => Math.max(-limit, Math.min(limit, value));
|
|
1701
|
+
return {
|
|
1702
|
+
onPointerDown: (event) => {
|
|
1703
|
+
if (event.button !== 0 || isInteractiveTarget(event.target)) return;
|
|
1704
|
+
dragRef.current = { x: event.clientX, y: event.clientY, baseX: offset.x, baseY: offset.y };
|
|
1705
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1706
|
+
},
|
|
1707
|
+
onPointerMove: (event) => {
|
|
1708
|
+
const start = dragRef.current;
|
|
1709
|
+
if (!start) return;
|
|
1710
|
+
setOffset({
|
|
1711
|
+
x: clamp(start.baseX + event.clientX - start.x, window.innerWidth / 2 - WINDOW_KEEP_VISIBLE / 2),
|
|
1712
|
+
y: clamp(start.baseY + event.clientY - start.y, window.innerHeight / 2 - WINDOW_KEEP_VISIBLE / 2)
|
|
1713
|
+
});
|
|
1714
|
+
},
|
|
1715
|
+
onPointerUp: (event) => {
|
|
1716
|
+
if (!dragRef.current) return;
|
|
1717
|
+
dragRef.current = null;
|
|
1718
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
1719
|
+
},
|
|
1720
|
+
onPointerCancel: () => {
|
|
1721
|
+
dragRef.current = null;
|
|
1722
|
+
},
|
|
1723
|
+
onDoubleClick: () => setOffset({ x: 0, y: 0 })
|
|
1724
|
+
};
|
|
1725
|
+
}, [windowed, offset.x, offset.y]);
|
|
1683
1726
|
const mergedRef = React10.useCallback(
|
|
1684
1727
|
(node) => {
|
|
1685
1728
|
setContainerEl(node);
|
|
@@ -1707,19 +1750,33 @@ var DialogContent = React10.forwardRef(
|
|
|
1707
1750
|
// can sit beside a host's floating window manager (which starts at
|
|
1708
1751
|
// z=1000); staying below that boundary makes a newly focused window
|
|
1709
1752
|
// usable without coupling the two systems.
|
|
1710
|
-
!isModal && "z-[900]"
|
|
1753
|
+
!isModal && !windowedByDefault && "z-[900]",
|
|
1754
|
+
// Without an overlay the card needs its own separation from the page.
|
|
1755
|
+
windowed && "shadow-2xl ring-1 ring-border/60"
|
|
1711
1756
|
),
|
|
1757
|
+
style: windowed && (offset.x !== 0 || offset.y !== 0) ? { ...style, translate: `${offset.x}px ${offset.y}px` } : style,
|
|
1758
|
+
onInteractOutside: (event) => {
|
|
1759
|
+
onInteractOutside?.(event);
|
|
1760
|
+
if (windowed && !dismissOnOutsideClick) event.preventDefault();
|
|
1761
|
+
},
|
|
1762
|
+
onEscapeKeyDown: (event) => {
|
|
1763
|
+
onEscapeKeyDown?.(event);
|
|
1764
|
+
const pressedIn = event.target instanceof Node && event.target !== document.body ? event.target : document.activeElement;
|
|
1765
|
+
if (windowed && containerEl && !(pressedIn && containerEl.contains(pressedIn))) {
|
|
1766
|
+
event.preventDefault();
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1712
1769
|
...hasDescription ? {} : { "aria-describedby": void 0 },
|
|
1713
1770
|
...props,
|
|
1714
1771
|
children: [
|
|
1715
1772
|
hasTitle ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VisuallyHidden.Root, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogPrimitive.Title, { children: "Dialog" }) }),
|
|
1716
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogContainerContext.Provider, { value: containerEl, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1773
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogContainerContext.Provider, { value: containerEl, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DialogWindowHandleContext.Provider, { value: handle, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1717
1774
|
PortalContainerProvider,
|
|
1718
1775
|
{
|
|
1719
1776
|
container: containerEl ?? injectedContainer ?? null,
|
|
1720
1777
|
children
|
|
1721
1778
|
}
|
|
1722
|
-
) }),
|
|
1779
|
+
) }) }),
|
|
1723
1780
|
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1724
1781
|
DialogPrimitive.Close,
|
|
1725
1782
|
{
|
|
@@ -1742,19 +1799,28 @@ DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
|
1742
1799
|
var DialogHeader = ({
|
|
1743
1800
|
className,
|
|
1744
1801
|
...props
|
|
1745
|
-
}) =>
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
"
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1802
|
+
}) => {
|
|
1803
|
+
const handle = React10.useContext(DialogWindowHandleContext);
|
|
1804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1805
|
+
"div",
|
|
1806
|
+
{
|
|
1807
|
+
"data-slot": "dialog-header",
|
|
1808
|
+
...handle ? {
|
|
1809
|
+
...handle,
|
|
1810
|
+
"data-window-handle": "",
|
|
1811
|
+
title: "Drag to move \xB7 double-click to recenter"
|
|
1812
|
+
} : {},
|
|
1813
|
+
className: cn(
|
|
1814
|
+
// DialogContent owns an absolute close control. Reserve its hit area in
|
|
1815
|
+
// every header so trailing actions never render underneath it.
|
|
1816
|
+
"flex flex-col space-y-1.5 pr-12 text-center sm:text-left",
|
|
1817
|
+
handle && "cursor-grab select-none active:cursor-grabbing",
|
|
1818
|
+
className
|
|
1819
|
+
),
|
|
1820
|
+
...props
|
|
1821
|
+
}
|
|
1822
|
+
);
|
|
1823
|
+
};
|
|
1758
1824
|
DialogHeader.displayName = "DialogHeader";
|
|
1759
1825
|
var DialogFooter = ({
|
|
1760
1826
|
className,
|
|
@@ -16380,7 +16446,7 @@ function SavedViewsControl({
|
|
|
16380
16446
|
] })
|
|
16381
16447
|
] }),
|
|
16382
16448
|
dirty ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { id: unsavedChangesId, className: "sr-only", children: "This table view has unsaved changes. Open the view menu to save or update it." }) : null,
|
|
16383
|
-
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
|
|
16449
|
+
visibleError && !saveOpen ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "basis-full break-words text-xs text-destructive", children: visibleError }) : null,
|
|
16384
16450
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Dialog, { open: saveOpen, onOpenChange: setSaveOpen, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DialogContent, { children: [
|
|
16385
16451
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DialogTitle, { children: "Save current view" }) }),
|
|
16386
16452
|
visibleError ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { role: "alert", className: "text-sm text-destructive", children: visibleError }) : null,
|