@bayonai/mui-design 1.9.0 → 1.10.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.1 — 2026-11-27
4
+
5
+ - Build the ESM, CommonJS, and TypeScript declaration files automatically before packing. This restores the runtime files missing from the published 1.10.0 archive.
6
+
7
+ ## 1.10.0 — 2026-11-27
8
+
9
+ - Load the URL preview's optional icons and tooltip on demand through the existing `/links` entry. The destination is usable while they load.
10
+ - Animate the URL preview on open and fade it on dismissal. Dismissed previews stop accepting interaction immediately.
11
+ - Keep the docked `WorkspaceSidePane` and rail pinned during document scrolling by default. Hosts with their own scroll layout can set `pinToViewport={false}`.
12
+
3
13
  ## 1.9.0 — 2026-11-23
4
14
 
5
15
  - Add host-owned width preferences to `WorkspaceSidePane`. Responsive fit and modal presentation preserve the saved preference, and pointer and keyboard resize report user changes.
package/README.md CHANGED
@@ -95,6 +95,13 @@ docked when the workspace can retain 640px of usable content and otherwise
95
95
  opens as a modal overlay. Resize by dragging the docked edge or by focusing
96
96
  its separator and pressing Left, Right, Home, End, or Enter.
97
97
 
98
+ By default the docked pane and rail stay flush with the viewport bottom as
99
+ the document scrolls. While enabled, the component clips horizontal overflow
100
+ on `body` so document scrolling can drive sticky positioning. Keep wrappers
101
+ between the pane and the document free of overflow rules that create a scroll
102
+ container. Pass `pinToViewport={false}` to keep the host's body overflow
103
+ policy, for example when the workspace scrolls inside its own container.
104
+
98
105
  Pass `preferredWidth` and `onPreferredWidthChange` to store the docked width.
99
106
  The component constrains finite preferences to 320–480 CSS pixels, and a
100
107
  workspace that can fit the default width may temporarily render a smaller
@@ -150,6 +157,17 @@ props unchanged. The root theme exports and existing `/client` exports remain
150
157
  unchanged; the new components are available through their explicit subpaths.
151
158
  Each subpath has ESM, CommonJS, and declaration outputs and a client boundary.
152
159
 
160
+ `useLinkAddressPreview` gives the URL card a short opening animation and a
161
+ quicker fade on dismissal, respecting reduced motion. The card loses focus
162
+ and pointer access as soon as dismissal begins. Hosts rendering
163
+ `LinkAddressPreview` directly can use `open` and `onExited` to keep it mounted
164
+ through the fade.
165
+
166
+ The hook renders the card on first activation. The URL and label are available
167
+ immediately, and Arrow Down can focus the destination while the two icons and
168
+ tooltip load independently. The same progressive rendering applies to hosts
169
+ that render `LinkAddressPreview` directly from `/links`.
170
+
153
171
  TL-M250 additionally moves file widgets to the client-only `@bayonai/mui-design/uploads`
154
172
  entry. It exports `FileUpload`, `FileRow`, `FileThumbnail`, `FileViewer`,
155
173
  `UploadProgressRing`, `UploadProgressRingProps`, and compatibility reexports
@@ -8,6 +8,8 @@ export interface WorkspaceSidePaneActions {
8
8
  export interface WorkspaceSidePaneProps {
9
9
  children: ReactNode;
10
10
  enabled?: boolean;
11
+ /** Use document scrolling for the docked pane. Defaults to true. */
12
+ pinToViewport?: boolean;
11
13
  className?: string;
12
14
  style?: CSSProperties;
13
15
  paneId?: string;
@@ -26,4 +28,4 @@ export interface WorkspaceSidePaneProps {
26
28
  renderPane: (visible: boolean) => ReactNode;
27
29
  }
28
30
  /** Keeps the workspace in one slot across docked, modal and closed presentation. */
29
- export declare function WorkspaceSidePane({ children, enabled, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }: WorkspaceSidePaneProps): import("react").JSX.Element;
31
+ export declare function WorkspaceSidePane({ children, enabled, pinToViewport, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }: WorkspaceSidePaneProps): import("react").JSX.Element;
@@ -9,12 +9,18 @@ const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const react_1 = require("react");
10
10
  const Collapse_1 = __importDefault(require("@mui/material/Collapse"));
11
11
  const Fade_1 = __importDefault(require("@mui/material/Fade"));
12
+ const GlobalStyles_1 = __importDefault(require("@mui/material/GlobalStyles"));
12
13
  const useMediaQuery_1 = __importDefault(require("@mui/material/useMediaQuery"));
13
14
  const WorkspaceSidePaneRoot_js_1 = require("./WorkspaceSidePaneRoot.js");
14
15
  const workspaceSidePaneGeometry_js_1 = require("./workspaceSidePaneGeometry.js");
15
16
  const motion = { timeout: { enter: 220, exit: 170 }, easing: "cubic-bezier(0.25, 1, 0.5, 1)" };
17
+ // Clip horizontal overflow so body does not intercept the docked pane's
18
+ // sticky positioning when the document is the scroll container.
19
+ const viewportPinningStyles = {
20
+ 'body:has(.workspace-side-pane[data-pin-to-viewport="true"])': { overflowX: "clip" },
21
+ };
16
22
  /** Keeps the workspace in one slot across docked, modal and closed presentation. */
17
- function WorkspaceSidePane({ children, enabled = true, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel = "Resize side pane", keepPaneMounted = false, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }) {
23
+ function WorkspaceSidePane({ children, enabled = true, pinToViewport = true, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel = "Resize side pane", keepPaneMounted = false, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }) {
18
24
  const generatedId = (0, react_1.useId)();
19
25
  const panelId = paneId !== null && paneId !== void 0 ? paneId : generatedId;
20
26
  const rootRef = (0, react_1.useRef)(null);
@@ -190,7 +196,7 @@ function WorkspaceSidePane({ children, enabled = true, className, style, paneId,
190
196
  (_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
191
197
  });
192
198
  };
193
- return ((0, jsx_runtime_1.jsxs)(WorkspaceSidePaneRoot_js_1.WorkspaceSidePaneRoot, { ref: rootRef, className: `workspace-side-pane${className ? ` ${className}` : ""}${enabled ? " workspace-side-pane-enabled" : ""}${visible ? " workspace-side-pane-open" : ""}${overlayPresentation ? " workspace-side-pane-overlay" : ""}${directResize && visible ? " workspace-side-pane-direct-resize" : ""}${reducedMotion ? " workspace-side-pane-reduced-motion" : ""}`, style: { ...style, "--workspace-side-pane-width": `${presentedWidth}px`, "--workspace-side-pane-top": `${bounds.top}px` }, children: [(0, jsx_runtime_1.jsx)("div", { ref: contentRef, className: "workspace-side-pane-workspace", children: children }), enabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Fade_1.default, { in: overlay, timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)("div", { className: "workspace-side-pane-backdrop", "data-active": overlay, style: { pointerEvents: overlay ? "auto" : "none" }, onClick: () => close(), "aria-hidden": "true" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "workspace-side-pane-group", ref: groupRef, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-labelledby": overlay ? headingId : undefined, onKeyDown: keyboard, children: [(0, jsx_runtime_1.jsxs)("nav", { className: "workspace-side-pane-rail", "aria-label": actionsLabel, children: [renderActions({ visible, paneId: panelId, openFrom, close }), visible && !overlay && ((0, jsx_runtime_1.jsx)("div", { role: "separator", tabIndex: 0, className: "workspace-side-pane-resize", "aria-label": resizeLabel, "aria-orientation": "vertical", "aria-valuemin": workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, "aria-valuemax": dockedMaximum, "aria-valuenow": width, "aria-valuetext": `${Math.round(geometry.paneWidth)} pixels`, title: "Drag to resize; Left/Right adjusts width; Enter resets", onKeyDown: (event) => {
199
+ return ((0, jsx_runtime_1.jsxs)(WorkspaceSidePaneRoot_js_1.WorkspaceSidePaneRoot, { ref: rootRef, "data-pin-to-viewport": enabled && pinToViewport ? true : undefined, className: `workspace-side-pane${className ? ` ${className}` : ""}${enabled ? " workspace-side-pane-enabled" : ""}${visible ? " workspace-side-pane-open" : ""}${overlayPresentation ? " workspace-side-pane-overlay" : ""}${directResize && visible ? " workspace-side-pane-direct-resize" : ""}${reducedMotion ? " workspace-side-pane-reduced-motion" : ""}`, style: { ...style, "--workspace-side-pane-width": `${presentedWidth}px`, "--workspace-side-pane-top": `${bounds.top}px` }, children: [enabled && pinToViewport && (0, jsx_runtime_1.jsx)(GlobalStyles_1.default, { styles: viewportPinningStyles }), (0, jsx_runtime_1.jsx)("div", { ref: contentRef, className: "workspace-side-pane-workspace", children: children }), enabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Fade_1.default, { in: overlay, timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)("div", { className: "workspace-side-pane-backdrop", "data-active": overlay, style: { pointerEvents: overlay ? "auto" : "none" }, onClick: () => close(), "aria-hidden": "true" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "workspace-side-pane-group", ref: groupRef, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-labelledby": overlay ? headingId : undefined, onKeyDown: keyboard, children: [(0, jsx_runtime_1.jsxs)("nav", { className: "workspace-side-pane-rail", "aria-label": actionsLabel, children: [renderActions({ visible, paneId: panelId, openFrom, close }), visible && !overlay && ((0, jsx_runtime_1.jsx)("div", { role: "separator", tabIndex: 0, className: "workspace-side-pane-resize", "aria-label": resizeLabel, "aria-orientation": "vertical", "aria-valuemin": workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, "aria-valuemax": dockedMaximum, "aria-valuenow": width, "aria-valuetext": `${Math.round(geometry.paneWidth)} pixels`, title: "Drag to resize; Left/Right adjusts width; Enter resets", onKeyDown: (event) => {
194
200
  const next = event.key === "ArrowLeft"
195
201
  ? width + 16
196
202
  : event.key === "ArrowRight"
@@ -1,5 +1,5 @@
1
- import { type SxProps, type Theme } from "@mui/material";
2
- import type { HTMLAttributes } from "react";
1
+ import type { SxProps, Theme } from "@mui/material/styles";
2
+ import { type HTMLAttributes } from "react";
3
3
  export type LinkAddressPreviewState = {
4
4
  href: string;
5
5
  label: string;
@@ -10,10 +10,12 @@ export type LinkAddressPreviewProps = Pick<HTMLAttributes<HTMLElement>, "id" | "
10
10
  link: LinkAddressPreviewState;
11
11
  ariaLabel?: string;
12
12
  openLabel?: string;
13
+ open?: boolean;
14
+ onExited?: () => void;
13
15
  sx?: SxProps<Theme>;
14
16
  };
15
17
  /**
16
18
  * Shared presentation of the editor's destination card. Hosts own validated
17
19
  * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
18
20
  */
19
- export declare function LinkAddressPreview({ link, ariaLabel, openLabel, sx, ...events }: LinkAddressPreviewProps): import("react").JSX.Element;
21
+ export declare function LinkAddressPreview({ link, ariaLabel, openLabel, open, onExited, sx, ...events }: LinkAddressPreviewProps): import("react").JSX.Element;
@@ -1,20 +1,72 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
38
  };
6
39
  Object.defineProperty(exports, "__esModule", { value: true });
7
40
  exports.LinkAddressPreview = LinkAddressPreview;
8
41
  const jsx_runtime_1 = require("react/jsx-runtime");
9
- const LinkRounded_1 = __importDefault(require("@mui/icons-material/LinkRounded"));
10
- const OpenInNewRounded_1 = __importDefault(require("@mui/icons-material/OpenInNewRounded"));
11
- const material_1 = require("@mui/material");
42
+ const Box_1 = __importDefault(require("@mui/material/Box"));
43
+ const Fade_1 = __importDefault(require("@mui/material/Fade"));
44
+ const styles_1 = require("@mui/material/styles");
45
+ const react_1 = require("react");
46
+ const LazyLinkIcon = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require("@mui/icons-material/LinkRounded"))));
47
+ const LazyOpenIcon = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require("@mui/icons-material/OpenInNewRounded"))));
48
+ const LazyTooltip = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require("@mui/material/Tooltip"))));
49
+ const previewMotion = { enter: 160, exit: 100 };
50
+ const arrive = (0, styles_1.keyframes) `
51
+ from { transform: translateY(-4px); }
52
+ to { transform: translateY(0); }
53
+ `;
12
54
  /**
13
55
  * Shared presentation of the editor's destination card. Hosts own validated
14
56
  * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
15
57
  */
16
- function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel = `Open ${link.href} in a new tab`, sx, ...events }) {
17
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "a", href: link.href, target: "_blank", rel: "noopener noreferrer", title: openLabel, "aria-label": ariaLabel, "data-link-address-preview": "true", ...events, sx: [
58
+ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel = `Open ${link.href} in a new tab`, open = true, onExited, sx, ...events }) {
59
+ const openIndicator = ((0, jsx_runtime_1.jsx)(Box_1.default, { component: "span", "aria-hidden": "true", "aria-label": openLabel, "data-link-preview-part": "open", sx: {
60
+ display: "inline-flex",
61
+ alignItems: "center",
62
+ justifyContent: "center",
63
+ color: "text.primary",
64
+ flex: "0 0 44px",
65
+ height: 44,
66
+ width: 44,
67
+ borderRadius: "6px",
68
+ }, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: null, children: (0, jsx_runtime_1.jsx)(LazyOpenIcon, { sx: { fontSize: 18 } }) }) }));
69
+ const card = ((0, jsx_runtime_1.jsxs)(Box_1.default, { component: "a", href: link.href, target: "_blank", rel: "noopener noreferrer", title: openLabel, "aria-label": ariaLabel, "aria-hidden": open ? undefined : true, inert: !open, "data-link-address-preview": "true", ...events, sx: [
18
70
  {
19
71
  alignItems: "center",
20
72
  bgcolor: "background.paper",
@@ -26,6 +78,12 @@ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel =
26
78
  display: "flex",
27
79
  textDecoration: "none",
28
80
  cursor: "pointer",
81
+ pointerEvents: open ? undefined : "none",
82
+ "@media (prefers-reduced-motion: no-preference)": {
83
+ animation: open
84
+ ? `${arrive} ${previewMotion.enter}ms cubic-bezier(0.16, 1, 0.3, 1)`
85
+ : undefined,
86
+ },
29
87
  "&:focus-visible": {
30
88
  outline: "2px solid",
31
89
  outlineColor: "primary.main",
@@ -43,7 +101,7 @@ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel =
43
101
  zIndex: (theme) => theme.zIndex.tooltip + 100,
44
102
  },
45
103
  ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
46
- ], children: [(0, jsx_runtime_1.jsx)(material_1.Box, { "aria-hidden": "true", "data-link-preview-part": "icon", sx: {
104
+ ], children: [(0, jsx_runtime_1.jsx)(Box_1.default, { "aria-hidden": "true", "data-link-preview-part": "icon", sx: {
47
105
  alignItems: "center",
48
106
  bgcolor: "action.selected",
49
107
  borderRadius: "8px",
@@ -52,14 +110,14 @@ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel =
52
110
  flex: "0 0 36px",
53
111
  height: 36,
54
112
  justifyContent: "center",
55
- }, children: (0, jsx_runtime_1.jsx)(LinkRounded_1.default, { sx: { fontSize: 16 } }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { flex: 1, minWidth: 0 }, "data-link-preview-part": "text", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", dir: "auto", sx: {
113
+ }, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: null, children: (0, jsx_runtime_1.jsx)(LazyLinkIcon, { sx: { fontSize: 16 } }) }) }), (0, jsx_runtime_1.jsxs)(Box_1.default, { sx: { flex: 1, minWidth: 0 }, "data-link-preview-part": "text", children: [(0, jsx_runtime_1.jsx)(Box_1.default, { component: "div", dir: "auto", sx: {
56
114
  fontSize: "0.92rem",
57
115
  fontWeight: 600,
58
116
  lineHeight: 1.35,
59
117
  overflow: "hidden",
60
118
  textOverflow: "ellipsis",
61
119
  whiteSpace: "nowrap",
62
- }, children: link.label }), (0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", dir: "ltr", title: link.href, sx: {
120
+ }, children: link.label }), (0, jsx_runtime_1.jsx)(Box_1.default, { component: "div", dir: "ltr", title: link.href, sx: {
63
121
  color: "text.secondary",
64
122
  fontSize: "0.8rem",
65
123
  lineHeight: 1.4,
@@ -67,14 +125,6 @@ function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel =
67
125
  textAlign: "start",
68
126
  textOverflow: "ellipsis",
69
127
  whiteSpace: "nowrap",
70
- }, children: link.href })] }), (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: openLabel, children: (0, jsx_runtime_1.jsx)(material_1.Box, { component: "span", "aria-hidden": "true", "data-link-preview-part": "open", sx: {
71
- display: "inline-flex",
72
- alignItems: "center",
73
- justifyContent: "center",
74
- color: "text.primary",
75
- flex: "0 0 44px",
76
- height: 44,
77
- width: 44,
78
- borderRadius: "6px",
79
- }, children: (0, jsx_runtime_1.jsx)(OpenInNewRounded_1.default, { sx: { fontSize: 18 } }) }) })] }));
128
+ }, children: link.href })] }), (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: openIndicator, children: (0, jsx_runtime_1.jsx)(LazyTooltip, { title: openLabel, children: openIndicator }) })] }));
129
+ return ((0, jsx_runtime_1.jsx)(Fade_1.default, { appear: false, in: open, timeout: previewMotion, onExited: onExited, unmountOnExit: true, children: card }));
80
130
  }
@@ -12,22 +12,31 @@ function useLinkAddressPreview(enabled = true, onEdit) {
12
12
  const id = (0, react_1.useId)();
13
13
  const pointerPreview = (0, react_1.useRef)(null);
14
14
  const [preview, setPreview] = (0, react_1.useState)(null);
15
+ const activePreview = enabled && (preview === null || preview === void 0 ? void 0 : preview.open) ? preview : null;
15
16
  const closeTimer = (0, react_1.useRef)(null);
16
17
  const focusFrame = (0, react_1.useRef)(null);
17
- function cancelClose() {
18
+ const cancelClose = (0, react_1.useCallback)(() => {
18
19
  if (closeTimer.current !== null)
19
20
  clearTimeout(closeTimer.current);
20
21
  closeTimer.current = null;
21
- }
22
- function close() {
22
+ }, []);
23
+ const cancelInteraction = (0, react_1.useCallback)(() => {
23
24
  cancelClose();
24
- setPreview(null);
25
25
  pointerPreview.current = null;
26
- }
26
+ if (focusFrame.current !== null)
27
+ cancelAnimationFrame(focusFrame.current);
28
+ focusFrame.current = null;
29
+ }, [cancelClose]);
30
+ const close = (0, react_1.useCallback)(() => {
31
+ cancelInteraction();
32
+ // Keep the last destination mounted for the fade, but end interaction now.
33
+ setPreview((current) => (current === null || current === void 0 ? void 0 : current.open) ? { ...current, open: false } : current);
34
+ }, [cancelInteraction]);
27
35
  function contains(target) {
28
36
  var _a;
29
37
  return (target instanceof Node &&
30
- ((preview === null || preview === void 0 ? void 0 : preview.anchor.contains(target)) ||
38
+ activePreview &&
39
+ (activePreview.anchor.contains(target) ||
31
40
  ((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target))));
32
41
  }
33
42
  function show(anchor, href, label) {
@@ -38,6 +47,7 @@ function useLinkAddressPreview(enabled = true, onEdit) {
38
47
  const width = Math.min(360, window.innerWidth - 24);
39
48
  setPreview({
40
49
  anchor,
50
+ open: true,
41
51
  href,
42
52
  label,
43
53
  left: Math.max(12, Math.min(rect.left, window.innerWidth - width - 12)),
@@ -48,8 +58,9 @@ function useLinkAddressPreview(enabled = true, onEdit) {
48
58
  cancelClose();
49
59
  // Allow pointer travel between the inline link and its portal card.
50
60
  closeTimer.current = setTimeout(() => {
61
+ closeTimer.current = null;
51
62
  if (!contains(document.activeElement))
52
- setPreview(null);
63
+ close();
53
64
  }, 180);
54
65
  }
55
66
  function blur(event) {
@@ -61,46 +72,43 @@ function useLinkAddressPreview(enabled = true, onEdit) {
61
72
  return;
62
73
  event.preventDefault();
63
74
  event.stopPropagation();
64
- preview === null || preview === void 0 ? void 0 : preview.anchor.focus({ preventScroll: true });
75
+ activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor.focus({ preventScroll: true });
65
76
  close();
66
77
  }
67
- (0, react_1.useEffect)(() => () => {
68
- if (closeTimer.current !== null)
69
- clearTimeout(closeTimer.current);
70
- if (focusFrame.current !== null)
71
- cancelAnimationFrame(focusFrame.current);
72
- }, []);
73
78
  (0, react_1.useEffect)(() => {
74
- if (!preview)
79
+ if (enabled)
80
+ return cancelInteraction;
81
+ }, [cancelInteraction, enabled]);
82
+ (0, react_1.useEffect)(() => {
83
+ if (!activePreview)
75
84
  return;
76
- const dismiss = () => setPreview(null);
77
85
  const outside = (event) => {
78
86
  var _a;
79
87
  const target = event.target;
80
88
  if (target instanceof Node &&
81
- !preview.anchor.contains(target) &&
89
+ !activePreview.anchor.contains(target) &&
82
90
  !((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target)))
83
- dismiss();
91
+ close();
84
92
  };
85
- window.addEventListener("resize", dismiss);
86
- window.addEventListener("scroll", dismiss, true);
93
+ window.addEventListener("resize", close);
94
+ window.addEventListener("scroll", close, true);
87
95
  document.addEventListener("pointerdown", outside);
88
96
  return () => {
89
- window.removeEventListener("resize", dismiss);
90
- window.removeEventListener("scroll", dismiss, true);
97
+ window.removeEventListener("resize", close);
98
+ window.removeEventListener("scroll", close, true);
91
99
  document.removeEventListener("pointerdown", outside);
92
100
  };
93
- }, [preview, id]);
101
+ }, [activePreview, close, id]);
94
102
  return {
95
103
  linkProps(href, label) {
96
104
  return enabled
97
105
  ? {
98
- "aria-controls": (preview === null || preview === void 0 ? void 0 : preview.href) === href ? id : undefined,
106
+ "aria-controls": (activePreview === null || activePreview === void 0 ? void 0 : activePreview.href) === href ? id : undefined,
99
107
  "aria-keyshortcuts": "ArrowDown",
100
108
  onPointerDown: (event) => {
101
109
  pointerPreview.current = {
102
110
  anchor: event.currentTarget,
103
- visible: (preview === null || preview === void 0 ? void 0 : preview.anchor) === event.currentTarget,
111
+ visible: (activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor) === event.currentTarget,
104
112
  };
105
113
  },
106
114
  onMouseEnter: (event) => show(event.currentTarget, href, label),
@@ -117,6 +125,7 @@ function useLinkAddressPreview(enabled = true, onEdit) {
117
125
  cancelAnimationFrame(focusFrame.current);
118
126
  focusFrame.current = requestAnimationFrame(() => {
119
127
  var _a;
128
+ focusFrame.current = null;
120
129
  (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.focus();
121
130
  });
122
131
  }
@@ -141,7 +150,7 @@ function useLinkAddressPreview(enabled = true, onEdit) {
141
150
  const wasVisible = event.detail > 0 &&
142
151
  ((_a = pointerPreview.current) === null || _a === void 0 ? void 0 : _a.anchor) === event.currentTarget
143
152
  ? pointerPreview.current.visible
144
- : (preview === null || preview === void 0 ? void 0 : preview.anchor) === event.currentTarget;
153
+ : (activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor) === event.currentTarget;
145
154
  pointerPreview.current = null;
146
155
  event.preventDefault();
147
156
  if (wasVisible && onEdit) {
@@ -153,7 +162,7 @@ function useLinkAddressPreview(enabled = true, onEdit) {
153
162
  }
154
163
  },
155
164
  card: preview
156
- ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(LinkAddressPreview_js_1.LinkAddressPreview, { id: id, link: preview, onMouseEnter: cancelClose, onMouseLeave: scheduleClose, onFocusCapture: cancelClose, onBlurCapture: blur, onKeyDown: (event) => {
165
+ ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(LinkAddressPreview_js_1.LinkAddressPreview, { id: id, link: preview, open: Boolean(activePreview), onExited: () => setPreview((current) => (enabled && (current === null || current === void 0 ? void 0 : current.open) ? current : null)), onMouseEnter: cancelClose, onMouseLeave: scheduleClose, onFocusCapture: cancelClose, onBlurCapture: blur, onKeyDown: (event) => {
157
166
  event.stopPropagation();
158
167
  escape(event);
159
168
  }, onClick: (event) => event.stopPropagation() }), document.body)
@@ -3,12 +3,18 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import Collapse from "@mui/material/Collapse";
5
5
  import Fade from "@mui/material/Fade";
6
+ import GlobalStyles from "@mui/material/GlobalStyles";
6
7
  import useMediaQuery from "@mui/material/useMediaQuery";
7
8
  import { WorkspaceSidePaneRoot } from "./WorkspaceSidePaneRoot.js";
8
9
  import { workspaceSidePaneGeometry, workspaceSidePaneMetrics } from "./workspaceSidePaneGeometry.js";
9
10
  const motion = { timeout: { enter: 220, exit: 170 }, easing: "cubic-bezier(0.25, 1, 0.5, 1)" };
11
+ // Clip horizontal overflow so body does not intercept the docked pane's
12
+ // sticky positioning when the document is the scroll container.
13
+ const viewportPinningStyles = {
14
+ 'body:has(.workspace-side-pane[data-pin-to-viewport="true"])': { overflowX: "clip" },
15
+ };
10
16
  /** Keeps the workspace in one slot across docked, modal and closed presentation. */
11
- export function WorkspaceSidePane({ children, enabled = true, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel = "Resize side pane", keepPaneMounted = false, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }) {
17
+ export function WorkspaceSidePane({ children, enabled = true, pinToViewport = true, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel = "Resize side pane", keepPaneMounted = false, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }) {
12
18
  const generatedId = useId();
13
19
  const panelId = paneId !== null && paneId !== void 0 ? paneId : generatedId;
14
20
  const rootRef = useRef(null);
@@ -184,7 +190,7 @@ export function WorkspaceSidePane({ children, enabled = true, className, style,
184
190
  (_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
185
191
  });
186
192
  };
187
- return (_jsxs(WorkspaceSidePaneRoot, { ref: rootRef, className: `workspace-side-pane${className ? ` ${className}` : ""}${enabled ? " workspace-side-pane-enabled" : ""}${visible ? " workspace-side-pane-open" : ""}${overlayPresentation ? " workspace-side-pane-overlay" : ""}${directResize && visible ? " workspace-side-pane-direct-resize" : ""}${reducedMotion ? " workspace-side-pane-reduced-motion" : ""}`, style: { ...style, "--workspace-side-pane-width": `${presentedWidth}px`, "--workspace-side-pane-top": `${bounds.top}px` }, children: [_jsx("div", { ref: contentRef, className: "workspace-side-pane-workspace", children: children }), enabled && (_jsxs(_Fragment, { children: [_jsx(Fade, { in: overlay, timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: true, children: _jsx("div", { className: "workspace-side-pane-backdrop", "data-active": overlay, style: { pointerEvents: overlay ? "auto" : "none" }, onClick: () => close(), "aria-hidden": "true" }) }), _jsxs("div", { className: "workspace-side-pane-group", ref: groupRef, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-labelledby": overlay ? headingId : undefined, onKeyDown: keyboard, children: [_jsxs("nav", { className: "workspace-side-pane-rail", "aria-label": actionsLabel, children: [renderActions({ visible, paneId: panelId, openFrom, close }), visible && !overlay && (_jsx("div", { role: "separator", tabIndex: 0, className: "workspace-side-pane-resize", "aria-label": resizeLabel, "aria-orientation": "vertical", "aria-valuemin": workspaceSidePaneMetrics.minPane, "aria-valuemax": dockedMaximum, "aria-valuenow": width, "aria-valuetext": `${Math.round(geometry.paneWidth)} pixels`, title: "Drag to resize; Left/Right adjusts width; Enter resets", onKeyDown: (event) => {
193
+ return (_jsxs(WorkspaceSidePaneRoot, { ref: rootRef, "data-pin-to-viewport": enabled && pinToViewport ? true : undefined, className: `workspace-side-pane${className ? ` ${className}` : ""}${enabled ? " workspace-side-pane-enabled" : ""}${visible ? " workspace-side-pane-open" : ""}${overlayPresentation ? " workspace-side-pane-overlay" : ""}${directResize && visible ? " workspace-side-pane-direct-resize" : ""}${reducedMotion ? " workspace-side-pane-reduced-motion" : ""}`, style: { ...style, "--workspace-side-pane-width": `${presentedWidth}px`, "--workspace-side-pane-top": `${bounds.top}px` }, children: [enabled && pinToViewport && _jsx(GlobalStyles, { styles: viewportPinningStyles }), _jsx("div", { ref: contentRef, className: "workspace-side-pane-workspace", children: children }), enabled && (_jsxs(_Fragment, { children: [_jsx(Fade, { in: overlay, timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: true, children: _jsx("div", { className: "workspace-side-pane-backdrop", "data-active": overlay, style: { pointerEvents: overlay ? "auto" : "none" }, onClick: () => close(), "aria-hidden": "true" }) }), _jsxs("div", { className: "workspace-side-pane-group", ref: groupRef, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-labelledby": overlay ? headingId : undefined, onKeyDown: keyboard, children: [_jsxs("nav", { className: "workspace-side-pane-rail", "aria-label": actionsLabel, children: [renderActions({ visible, paneId: panelId, openFrom, close }), visible && !overlay && (_jsx("div", { role: "separator", tabIndex: 0, className: "workspace-side-pane-resize", "aria-label": resizeLabel, "aria-orientation": "vertical", "aria-valuemin": workspaceSidePaneMetrics.minPane, "aria-valuemax": dockedMaximum, "aria-valuenow": width, "aria-valuetext": `${Math.round(geometry.paneWidth)} pixels`, title: "Drag to resize; Left/Right adjusts width; Enter resets", onKeyDown: (event) => {
188
194
  const next = event.key === "ArrowLeft"
189
195
  ? width + 16
190
196
  : event.key === "ArrowRight"
@@ -1,14 +1,33 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import LinkRoundedIcon from "@mui/icons-material/LinkRounded";
4
- import OpenInNewRoundedIcon from "@mui/icons-material/OpenInNewRounded";
5
- import { Box, Tooltip } from "@mui/material";
3
+ import Box from "@mui/material/Box";
4
+ import Fade from "@mui/material/Fade";
5
+ import { keyframes } from "@mui/material/styles";
6
+ import { lazy, Suspense } from "react";
7
+ const LazyLinkIcon = lazy(() => import("@mui/icons-material/LinkRounded"));
8
+ const LazyOpenIcon = lazy(() => import("@mui/icons-material/OpenInNewRounded"));
9
+ const LazyTooltip = lazy(() => import("@mui/material/Tooltip"));
10
+ const previewMotion = { enter: 160, exit: 100 };
11
+ const arrive = keyframes `
12
+ from { transform: translateY(-4px); }
13
+ to { transform: translateY(0); }
14
+ `;
6
15
  /**
7
16
  * Shared presentation of the editor's destination card. Hosts own validated
8
17
  * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
9
18
  */
10
- export function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel = `Open ${link.href} in a new tab`, sx, ...events }) {
11
- return (_jsxs(Box, { component: "a", href: link.href, target: "_blank", rel: "noopener noreferrer", title: openLabel, "aria-label": ariaLabel, "data-link-address-preview": "true", ...events, sx: [
19
+ export function LinkAddressPreview({ link, ariaLabel = "Link destination", openLabel = `Open ${link.href} in a new tab`, open = true, onExited, sx, ...events }) {
20
+ const openIndicator = (_jsx(Box, { component: "span", "aria-hidden": "true", "aria-label": openLabel, "data-link-preview-part": "open", sx: {
21
+ display: "inline-flex",
22
+ alignItems: "center",
23
+ justifyContent: "center",
24
+ color: "text.primary",
25
+ flex: "0 0 44px",
26
+ height: 44,
27
+ width: 44,
28
+ borderRadius: "6px",
29
+ }, children: _jsx(Suspense, { fallback: null, children: _jsx(LazyOpenIcon, { sx: { fontSize: 18 } }) }) }));
30
+ const card = (_jsxs(Box, { component: "a", href: link.href, target: "_blank", rel: "noopener noreferrer", title: openLabel, "aria-label": ariaLabel, "aria-hidden": open ? undefined : true, inert: !open, "data-link-address-preview": "true", ...events, sx: [
12
31
  {
13
32
  alignItems: "center",
14
33
  bgcolor: "background.paper",
@@ -20,6 +39,12 @@ export function LinkAddressPreview({ link, ariaLabel = "Link destination", openL
20
39
  display: "flex",
21
40
  textDecoration: "none",
22
41
  cursor: "pointer",
42
+ pointerEvents: open ? undefined : "none",
43
+ "@media (prefers-reduced-motion: no-preference)": {
44
+ animation: open
45
+ ? `${arrive} ${previewMotion.enter}ms cubic-bezier(0.16, 1, 0.3, 1)`
46
+ : undefined,
47
+ },
23
48
  "&:focus-visible": {
24
49
  outline: "2px solid",
25
50
  outlineColor: "primary.main",
@@ -46,7 +71,7 @@ export function LinkAddressPreview({ link, ariaLabel = "Link destination", openL
46
71
  flex: "0 0 36px",
47
72
  height: 36,
48
73
  justifyContent: "center",
49
- }, children: _jsx(LinkRoundedIcon, { sx: { fontSize: 16 } }) }), _jsxs(Box, { sx: { flex: 1, minWidth: 0 }, "data-link-preview-part": "text", children: [_jsx(Box, { component: "div", dir: "auto", sx: {
74
+ }, children: _jsx(Suspense, { fallback: null, children: _jsx(LazyLinkIcon, { sx: { fontSize: 16 } }) }) }), _jsxs(Box, { sx: { flex: 1, minWidth: 0 }, "data-link-preview-part": "text", children: [_jsx(Box, { component: "div", dir: "auto", sx: {
50
75
  fontSize: "0.92rem",
51
76
  fontWeight: 600,
52
77
  lineHeight: 1.35,
@@ -61,14 +86,6 @@ export function LinkAddressPreview({ link, ariaLabel = "Link destination", openL
61
86
  textAlign: "start",
62
87
  textOverflow: "ellipsis",
63
88
  whiteSpace: "nowrap",
64
- }, children: link.href })] }), _jsx(Tooltip, { title: openLabel, children: _jsx(Box, { component: "span", "aria-hidden": "true", "data-link-preview-part": "open", sx: {
65
- display: "inline-flex",
66
- alignItems: "center",
67
- justifyContent: "center",
68
- color: "text.primary",
69
- flex: "0 0 44px",
70
- height: 44,
71
- width: 44,
72
- borderRadius: "6px",
73
- }, children: _jsx(OpenInNewRoundedIcon, { sx: { fontSize: 18 } }) }) })] }));
89
+ }, children: link.href })] }), _jsx(Suspense, { fallback: openIndicator, children: _jsx(LazyTooltip, { title: openLabel, children: openIndicator }) })] }));
90
+ return (_jsx(Fade, { appear: false, in: open, timeout: previewMotion, onExited: onExited, unmountOnExit: true, children: card }));
74
91
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { LinkAddressPreview, } from "./LinkAddressPreview.js";
4
- import { useEffect, useId, useRef, useState, } from "react";
4
+ import { useCallback, useEffect, useId, useRef, useState, } from "react";
5
5
  import { createPortal } from "react-dom";
6
6
  /** Product decision: hosts own link interaction; the shared UI card only displays
7
7
  * a validated destination. The source previews/edits; the card navigates. */
@@ -9,22 +9,31 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
9
9
  const id = useId();
10
10
  const pointerPreview = useRef(null);
11
11
  const [preview, setPreview] = useState(null);
12
+ const activePreview = enabled && (preview === null || preview === void 0 ? void 0 : preview.open) ? preview : null;
12
13
  const closeTimer = useRef(null);
13
14
  const focusFrame = useRef(null);
14
- function cancelClose() {
15
+ const cancelClose = useCallback(() => {
15
16
  if (closeTimer.current !== null)
16
17
  clearTimeout(closeTimer.current);
17
18
  closeTimer.current = null;
18
- }
19
- function close() {
19
+ }, []);
20
+ const cancelInteraction = useCallback(() => {
20
21
  cancelClose();
21
- setPreview(null);
22
22
  pointerPreview.current = null;
23
- }
23
+ if (focusFrame.current !== null)
24
+ cancelAnimationFrame(focusFrame.current);
25
+ focusFrame.current = null;
26
+ }, [cancelClose]);
27
+ const close = useCallback(() => {
28
+ cancelInteraction();
29
+ // Keep the last destination mounted for the fade, but end interaction now.
30
+ setPreview((current) => (current === null || current === void 0 ? void 0 : current.open) ? { ...current, open: false } : current);
31
+ }, [cancelInteraction]);
24
32
  function contains(target) {
25
33
  var _a;
26
34
  return (target instanceof Node &&
27
- ((preview === null || preview === void 0 ? void 0 : preview.anchor.contains(target)) ||
35
+ activePreview &&
36
+ (activePreview.anchor.contains(target) ||
28
37
  ((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target))));
29
38
  }
30
39
  function show(anchor, href, label) {
@@ -35,6 +44,7 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
35
44
  const width = Math.min(360, window.innerWidth - 24);
36
45
  setPreview({
37
46
  anchor,
47
+ open: true,
38
48
  href,
39
49
  label,
40
50
  left: Math.max(12, Math.min(rect.left, window.innerWidth - width - 12)),
@@ -45,8 +55,9 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
45
55
  cancelClose();
46
56
  // Allow pointer travel between the inline link and its portal card.
47
57
  closeTimer.current = setTimeout(() => {
58
+ closeTimer.current = null;
48
59
  if (!contains(document.activeElement))
49
- setPreview(null);
60
+ close();
50
61
  }, 180);
51
62
  }
52
63
  function blur(event) {
@@ -58,46 +69,43 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
58
69
  return;
59
70
  event.preventDefault();
60
71
  event.stopPropagation();
61
- preview === null || preview === void 0 ? void 0 : preview.anchor.focus({ preventScroll: true });
72
+ activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor.focus({ preventScroll: true });
62
73
  close();
63
74
  }
64
- useEffect(() => () => {
65
- if (closeTimer.current !== null)
66
- clearTimeout(closeTimer.current);
67
- if (focusFrame.current !== null)
68
- cancelAnimationFrame(focusFrame.current);
69
- }, []);
70
75
  useEffect(() => {
71
- if (!preview)
76
+ if (enabled)
77
+ return cancelInteraction;
78
+ }, [cancelInteraction, enabled]);
79
+ useEffect(() => {
80
+ if (!activePreview)
72
81
  return;
73
- const dismiss = () => setPreview(null);
74
82
  const outside = (event) => {
75
83
  var _a;
76
84
  const target = event.target;
77
85
  if (target instanceof Node &&
78
- !preview.anchor.contains(target) &&
86
+ !activePreview.anchor.contains(target) &&
79
87
  !((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.contains(target)))
80
- dismiss();
88
+ close();
81
89
  };
82
- window.addEventListener("resize", dismiss);
83
- window.addEventListener("scroll", dismiss, true);
90
+ window.addEventListener("resize", close);
91
+ window.addEventListener("scroll", close, true);
84
92
  document.addEventListener("pointerdown", outside);
85
93
  return () => {
86
- window.removeEventListener("resize", dismiss);
87
- window.removeEventListener("scroll", dismiss, true);
94
+ window.removeEventListener("resize", close);
95
+ window.removeEventListener("scroll", close, true);
88
96
  document.removeEventListener("pointerdown", outside);
89
97
  };
90
- }, [preview, id]);
98
+ }, [activePreview, close, id]);
91
99
  return {
92
100
  linkProps(href, label) {
93
101
  return enabled
94
102
  ? {
95
- "aria-controls": (preview === null || preview === void 0 ? void 0 : preview.href) === href ? id : undefined,
103
+ "aria-controls": (activePreview === null || activePreview === void 0 ? void 0 : activePreview.href) === href ? id : undefined,
96
104
  "aria-keyshortcuts": "ArrowDown",
97
105
  onPointerDown: (event) => {
98
106
  pointerPreview.current = {
99
107
  anchor: event.currentTarget,
100
- visible: (preview === null || preview === void 0 ? void 0 : preview.anchor) === event.currentTarget,
108
+ visible: (activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor) === event.currentTarget,
101
109
  };
102
110
  },
103
111
  onMouseEnter: (event) => show(event.currentTarget, href, label),
@@ -114,6 +122,7 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
114
122
  cancelAnimationFrame(focusFrame.current);
115
123
  focusFrame.current = requestAnimationFrame(() => {
116
124
  var _a;
125
+ focusFrame.current = null;
117
126
  (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.focus();
118
127
  });
119
128
  }
@@ -138,7 +147,7 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
138
147
  const wasVisible = event.detail > 0 &&
139
148
  ((_a = pointerPreview.current) === null || _a === void 0 ? void 0 : _a.anchor) === event.currentTarget
140
149
  ? pointerPreview.current.visible
141
- : (preview === null || preview === void 0 ? void 0 : preview.anchor) === event.currentTarget;
150
+ : (activePreview === null || activePreview === void 0 ? void 0 : activePreview.anchor) === event.currentTarget;
142
151
  pointerPreview.current = null;
143
152
  event.preventDefault();
144
153
  if (wasVisible && onEdit) {
@@ -150,7 +159,7 @@ export function useLinkAddressPreview(enabled = true, onEdit) {
150
159
  }
151
160
  },
152
161
  card: preview
153
- ? createPortal(_jsx(LinkAddressPreview, { id: id, link: preview, onMouseEnter: cancelClose, onMouseLeave: scheduleClose, onFocusCapture: cancelClose, onBlurCapture: blur, onKeyDown: (event) => {
162
+ ? createPortal(_jsx(LinkAddressPreview, { id: id, link: preview, open: Boolean(activePreview), onExited: () => setPreview((current) => (enabled && (current === null || current === void 0 ? void 0 : current.open) ? current : null)), onMouseEnter: cancelClose, onMouseLeave: scheduleClose, onFocusCapture: cancelClose, onBlurCapture: blur, onKeyDown: (event) => {
154
163
  event.stopPropagation();
155
164
  escape(event);
156
165
  }, onClick: (event) => event.stopPropagation() }), document.body)
@@ -8,6 +8,8 @@ export interface WorkspaceSidePaneActions {
8
8
  export interface WorkspaceSidePaneProps {
9
9
  children: ReactNode;
10
10
  enabled?: boolean;
11
+ /** Use document scrolling for the docked pane. Defaults to true. */
12
+ pinToViewport?: boolean;
11
13
  className?: string;
12
14
  style?: CSSProperties;
13
15
  paneId?: string;
@@ -26,4 +28,4 @@ export interface WorkspaceSidePaneProps {
26
28
  renderPane: (visible: boolean) => ReactNode;
27
29
  }
28
30
  /** Keeps the workspace in one slot across docked, modal and closed presentation. */
29
- export declare function WorkspaceSidePane({ children, enabled, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }: WorkspaceSidePaneProps): import("react").JSX.Element;
31
+ export declare function WorkspaceSidePane({ children, enabled, pinToViewport, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }: WorkspaceSidePaneProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { type SxProps, type Theme } from "@mui/material";
2
- import type { HTMLAttributes } from "react";
1
+ import type { SxProps, Theme } from "@mui/material/styles";
2
+ import { type HTMLAttributes } from "react";
3
3
  export type LinkAddressPreviewState = {
4
4
  href: string;
5
5
  label: string;
@@ -10,10 +10,12 @@ export type LinkAddressPreviewProps = Pick<HTMLAttributes<HTMLElement>, "id" | "
10
10
  link: LinkAddressPreviewState;
11
11
  ariaLabel?: string;
12
12
  openLabel?: string;
13
+ open?: boolean;
14
+ onExited?: () => void;
13
15
  sx?: SxProps<Theme>;
14
16
  };
15
17
  /**
16
18
  * Shared presentation of the editor's destination card. Hosts own validated
17
19
  * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
18
20
  */
19
- export declare function LinkAddressPreview({ link, ariaLabel, openLabel, sx, ...events }: LinkAddressPreviewProps): import("react").JSX.Element;
21
+ export declare function LinkAddressPreview({ link, ariaLabel, openLabel, open, onExited, sx, ...events }: LinkAddressPreviewProps): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bayonai/mui-design",
3
- "version": "1.9.0",
3
+ "version": "1.10.1",
4
4
  "description": "Shared Bayon AI Material UI theme, style recipes, and reusable design components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -166,6 +166,7 @@
166
166
  "scripts": {
167
167
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
168
168
  "build": "npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && node scripts/rename-cjs.cjs",
169
+ "prepack": "npm run build",
169
170
  "typecheck": "tsc -p tsconfig.types.json --noEmit",
170
171
  "test": "vitest run --config vitest.config.mts"
171
172
  },