@bayonai/mui-design 1.7.0 → 1.9.0

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0 — 2026-11-23
4
+
5
+ - Add host-owned width preferences to `WorkspaceSidePane`. Responsive fit and modal presentation preserve the saved preference, and pointer and keyboard resize report user changes.
6
+
7
+ ## 1.8.0 — 2026-11-21 (candidate)
8
+
9
+ - Add `WorkspaceSidePane` to the drawers entry for a docked, resizable workspace pane that becomes a modal on narrow layouts.
10
+
3
11
  ## 1.7.0 — 2026-11-20
4
12
 
5
13
  - Add a controlled image quality dialog with a local preview and quality tiles.
@@ -20,6 +28,12 @@ All notable changes to `@bayonai/mui-design` will be documented in this file.
20
28
  - Give plan sections accessible names with an optional host override.
21
29
  - Use the published file-uploads package for local upload component development.
22
30
 
31
+ ## 1.5.0 - 2026-11-19
32
+
33
+ - Add the optional dark comparison appearance for pricing tables.
34
+ - Give plan sections accessible names with an optional host override.
35
+ - Use the published file-uploads package for local upload component development.
36
+
23
37
  ## 1.4.0 - 2026-11-12
24
38
 
25
39
  - Add reusable metadata value-row/group spacing, neutral template badge, and explicit venue-search presentation.
package/README.md CHANGED
@@ -86,6 +86,43 @@ The main website consumes this package through the local npm workspace while the
86
86
  npm publish --workspace @bayonai/mui-design
87
87
  ```
88
88
 
89
+ ## Workspace side pane
90
+
91
+ `WorkspaceSidePane` is available from `@bayonai/mui-design/drawers`.
92
+ Place it in the right-aligned workspace and provide the working content as
93
+ children. The rail sits between the workspace and the pane. The pane opens
94
+ docked when the workspace can retain 640px of usable content and otherwise
95
+ opens as a modal overlay. Resize by dragging the docked edge or by focusing
96
+ its separator and pressing Left, Right, Home, End, or Enter.
97
+
98
+ Pass `preferredWidth` and `onPreferredWidthChange` to store the docked width.
99
+ The component constrains finite preferences to 320–480 CSS pixels, and a
100
+ workspace that can fit the default width may temporarily render a smaller
101
+ pane without changing its preference. Modal presentation uses the default
102
+ geometry. The callback reports explicit pointer and keyboard resize changes.
103
+ Without a finite host preference, the component tracks its own width.
104
+ Hosts choose where to store the preference and feed the new value back.
105
+
106
+ Pass a heading ID and ref for naming the pane and directing focus. Render
107
+ rail buttons with `renderActions`, connecting `aria-controls` to `paneId` and
108
+ `aria-expanded` to `visible`. Call `openFrom(event)` from the opener and
109
+ `close(event.currentTarget)` when the active button closes the pane. If a
110
+ button switches to a different heading, pass its ref to `openFrom`.
111
+ `renderPane(visible)` receives `false` as soon as dismissal starts. Use it to
112
+ stop protected reads or clear interactive content immediately.
113
+ `keepPaneMounted` can retain a pane draft across close and reopen.
114
+
115
+ Hosts provide rail actions, view selection, data access, and workspace
116
+ padding. `getOverlaySiblings` can identify additional background elements,
117
+ such as sibling navigation, to make inert during the modal. `workspaceRef`
118
+ optionally exposes the working slot. The layout respects reduced motion and
119
+ restores focus to the opener on close. The package includes a physical drawers
120
+ entry for bundlers that resolve subpaths without reading the export map. CSS custom properties
121
+ `--workspace-side-pane-background`, `--workspace-side-pane-rail-background`,
122
+ `--workspace-side-pane-border`, `--workspace-side-pane-text`,
123
+ `--workspace-side-pane-focus`, and `--workspace-side-pane-z-index` let the
124
+ host match its theme and stacking order.
125
+
89
126
  ## Preserved application primitives (1.1.0 candidate)
90
127
 
91
128
  TL-M249 makes this package the owner of the existing MUI presentation previously
@@ -0,0 +1,29 @@
1
+ import { type CSSProperties, type MouseEvent, type ReactNode, type RefObject } from "react";
2
+ export interface WorkspaceSidePaneActions {
3
+ visible: boolean;
4
+ paneId: string;
5
+ openFrom: (event: MouseEvent<HTMLButtonElement>, focusTarget?: RefObject<HTMLElement | null>) => void;
6
+ close: (opener?: HTMLButtonElement) => void;
7
+ }
8
+ export interface WorkspaceSidePaneProps {
9
+ children: ReactNode;
10
+ enabled?: boolean;
11
+ className?: string;
12
+ style?: CSSProperties;
13
+ paneId?: string;
14
+ headingId: string;
15
+ headingRef: RefObject<HTMLElement | null>;
16
+ workspaceRef?: RefObject<HTMLDivElement | null>;
17
+ actionsLabel: string;
18
+ resizeLabel?: string;
19
+ keepPaneMounted?: boolean;
20
+ /** Preferred docked width in CSS pixels. The available canvas can constrain the displayed width. */
21
+ preferredWidth?: number;
22
+ /** Reports an explicit resize through the pointer or keyboard control. */
23
+ onPreferredWidthChange?: (width: number) => void;
24
+ getOverlaySiblings?: (root: HTMLDivElement) => readonly HTMLElement[];
25
+ renderActions: (actions: WorkspaceSidePaneActions) => ReactNode;
26
+ renderPane: (visible: boolean) => ReactNode;
27
+ }
28
+ /** 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;
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.WorkspaceSidePane = WorkspaceSidePane;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const react_1 = require("react");
10
+ const Collapse_1 = __importDefault(require("@mui/material/Collapse"));
11
+ const Fade_1 = __importDefault(require("@mui/material/Fade"));
12
+ const useMediaQuery_1 = __importDefault(require("@mui/material/useMediaQuery"));
13
+ const WorkspaceSidePaneRoot_js_1 = require("./WorkspaceSidePaneRoot.js");
14
+ const workspaceSidePaneGeometry_js_1 = require("./workspaceSidePaneGeometry.js");
15
+ const motion = { timeout: { enter: 220, exit: 170 }, easing: "cubic-bezier(0.25, 1, 0.5, 1)" };
16
+ /** 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, }) {
18
+ const generatedId = (0, react_1.useId)();
19
+ const panelId = paneId !== null && paneId !== void 0 ? paneId : generatedId;
20
+ const rootRef = (0, react_1.useRef)(null);
21
+ const internalWorkspaceRef = (0, react_1.useRef)(null);
22
+ const contentRef = workspaceRef !== null && workspaceRef !== void 0 ? workspaceRef : internalWorkspaceRef;
23
+ const groupRef = (0, react_1.useRef)(null);
24
+ const openerRef = (0, react_1.useRef)(null);
25
+ const [open, setOpen] = (0, react_1.useState)(false);
26
+ const [present, setPresent] = (0, react_1.useState)(false);
27
+ const [directResize, setDirectResize] = (0, react_1.useState)(false);
28
+ const reducedMotion = (0, useMediaQuery_1.default)("(prefers-reduced-motion: reduce)", { noSsr: true });
29
+ const duration = reducedMotion ? 0 : motion.timeout;
30
+ const [internalWidth, setWidth] = (0, react_1.useState)(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane);
31
+ const [bounds, setBounds] = (0, react_1.useState)({ width: workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minCanvas + workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail + workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane, top: 0, workspaceInset: 0 });
32
+ const drag = (0, react_1.useRef)(null);
33
+ const dockedMaximum = Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, Math.min(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane, bounds.width - bounds.workspaceInset - workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail - workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minCanvas));
34
+ const hasPreferredWidth = typeof preferredWidth === "number" && Number.isFinite(preferredWidth);
35
+ const requestedWidth = hasPreferredWidth
36
+ ? Math.min(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane, Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, preferredWidth))
37
+ : internalWidth;
38
+ // A host preference can yield to the canvas without changing the preferred
39
+ // width or turning a workspace that fits the default into a modal.
40
+ const width = hasPreferredWidth && dockedMaximum >= workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane
41
+ ? Math.min(requestedWidth, dockedMaximum)
42
+ : requestedWidth;
43
+ const geometry = (0, workspaceSidePaneGeometry_js_1.workspaceSidePaneGeometry)(bounds.width, width, bounds.workspaceInset);
44
+ const presentedWidth = geometry.overlay && hasPreferredWidth
45
+ ? (0, workspaceSidePaneGeometry_js_1.workspaceSidePaneGeometry)(bounds.width, workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane, bounds.workspaceInset).paneWidth
46
+ : geometry.paneWidth;
47
+ const visible = enabled && open;
48
+ const overlay = visible && geometry.overlay;
49
+ const visibleRef = (0, react_1.useRef)(visible);
50
+ visibleRef.current = visible;
51
+ // Release modal focus and report closed to the host before visual exit.
52
+ const overlayPresentation = geometry.overlay && (visible || (present && !reducedMotion));
53
+ (0, react_1.useLayoutEffect)(() => {
54
+ if (!enabled) {
55
+ setPresent(false);
56
+ setDirectResize(false);
57
+ drag.current = null;
58
+ }
59
+ else if (visible) {
60
+ setPresent(true);
61
+ }
62
+ }, [enabled, visible]);
63
+ (0, react_1.useLayoutEffect)(() => {
64
+ const element = rootRef.current;
65
+ if (!element)
66
+ return;
67
+ const measure = () => {
68
+ const rect = element.getBoundingClientRect();
69
+ const workspaceStyle = contentRef.current ? getComputedStyle(contentRef.current) : null;
70
+ // Useful canvas excludes its retained page padding; chrome still uses
71
+ // the full root width, including in narrow overlays.
72
+ const workspaceInset = workspaceStyle
73
+ ? (parseFloat(workspaceStyle.paddingLeft) || 0) + (parseFloat(workspaceStyle.paddingRight) || 0)
74
+ : 0;
75
+ const next = { width: rect.width || window.innerWidth, top: Math.max(0, rect.top), workspaceInset };
76
+ // Content ResizeObserver notifications also arrive during pane motion;
77
+ // unchanged shell geometry must not rerender pane content per frame.
78
+ setBounds((previous) => previous.width === next.width && previous.top === next.top && previous.workspaceInset === next.workspaceInset ? previous : next);
79
+ };
80
+ measure();
81
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
82
+ observer === null || observer === void 0 ? void 0 : observer.observe(element);
83
+ if (contentRef.current)
84
+ observer === null || observer === void 0 ? void 0 : observer.observe(contentRef.current);
85
+ window.addEventListener("resize", measure);
86
+ return () => {
87
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
88
+ window.removeEventListener("resize", measure);
89
+ };
90
+ }, [enabled, contentRef]);
91
+ (0, react_1.useLayoutEffect)(() => {
92
+ var _a, _b, _c;
93
+ if (!overlay)
94
+ return;
95
+ const content = contentRef.current;
96
+ const root = rootRef.current;
97
+ const siblings = root ? (_a = getOverlaySiblings === null || getOverlaySiblings === void 0 ? void 0 : getOverlaySiblings(root)) !== null && _a !== void 0 ? _a : [] : [];
98
+ const covered = [...new Set([...(content ? [content] : []), ...siblings])];
99
+ const priorInert = covered.map((element) => ({ element, value: element.getAttribute("inert") }));
100
+ // Restore the pre-existing inert state when this overlay releases focus.
101
+ covered.forEach((element) => element.setAttribute("inert", ""));
102
+ const ownerDocument = (_c = (_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument) !== null && _c !== void 0 ? _c : document;
103
+ const focusInside = () => { var _a; return (_a = headingRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
104
+ const containsTarget = (target) => { var _a; return Boolean(target && ((_a = groupRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))); };
105
+ const containFocus = (event) => {
106
+ if (!containsTarget(event.target))
107
+ focusInside();
108
+ };
109
+ const containOutsideTab = (event) => {
110
+ if (event.key !== "Tab" || containsTarget(event.target))
111
+ return;
112
+ event.preventDefault();
113
+ event.stopPropagation();
114
+ focusInside();
115
+ };
116
+ // inert blocks normal background interaction; focusin additionally contains
117
+ // programmatic focus and browsers/environments with incomplete inert support.
118
+ ownerDocument.addEventListener("focusin", containFocus, true);
119
+ ownerDocument.addEventListener("keydown", containOutsideTab, true);
120
+ focusInside();
121
+ return () => {
122
+ ownerDocument.removeEventListener("focusin", containFocus, true);
123
+ ownerDocument.removeEventListener("keydown", containOutsideTab, true);
124
+ priorInert.forEach(({ element, value }) => {
125
+ if (value === null)
126
+ element.removeAttribute("inert");
127
+ else
128
+ element.setAttribute("inert", value);
129
+ });
130
+ };
131
+ }, [overlay, headingId, headingRef, contentRef, getOverlaySiblings]);
132
+ (0, react_1.useLayoutEffect)(() => {
133
+ var _a;
134
+ if (!visible && present)
135
+ (_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
136
+ }, [visible, present]);
137
+ const close = (opener) => {
138
+ if (opener)
139
+ openerRef.current = opener;
140
+ setOpen(false);
141
+ setDirectResize(false);
142
+ drag.current = null;
143
+ };
144
+ // Deliberate docked resizing preserves the useful canvas and its focusable
145
+ // control. Only an external viewport/container change may require an overlay.
146
+ const clampWidth = (next, reset = false) => {
147
+ const nextWidth = Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, Math.min(dockedMaximum, Math.round(next)));
148
+ if (nextWidth === width && (!reset || nextWidth === requestedWidth))
149
+ return;
150
+ setDirectResize(true);
151
+ setWidth(nextWidth);
152
+ onPreferredWidthChange === null || onPreferredWidthChange === void 0 ? void 0 : onPreferredWidthChange(nextWidth);
153
+ };
154
+ const keyboard = (event) => {
155
+ var _a, _b, _c, _d, _e;
156
+ // Nested native dialogs own their own Escape handling.
157
+ if ((_b = (_a = event.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, "dialog[open]"))
158
+ return;
159
+ if (event.key === "Escape" && !event.defaultPrevented) {
160
+ event.preventDefault();
161
+ event.stopPropagation();
162
+ close();
163
+ return;
164
+ }
165
+ if (!overlay || event.key !== "Tab")
166
+ return;
167
+ const controls = [...((_d = (_c = groupRef.current) === null || _c === void 0 ? void 0 : _c.querySelectorAll('button, a[href], input, textarea, select, summary, [tabindex]')) !== null && _d !== void 0 ? _d : [])]
168
+ .filter((element) => element.tabIndex >= 0 && !element.matches(":disabled")
169
+ && !element.closest('[hidden], [inert], dialog:not([open])')
170
+ && element.getClientRects().length > 0 && getComputedStyle(element).visibility !== "hidden");
171
+ const first = controls[0], last = controls[controls.length - 1];
172
+ const focused = (_e = groupRef.current) === null || _e === void 0 ? void 0 : _e.ownerDocument.activeElement;
173
+ if (event.shiftKey && (focused === first || focused === headingRef.current)) {
174
+ event.preventDefault();
175
+ last === null || last === void 0 ? void 0 : last.focus();
176
+ }
177
+ else if (!event.shiftKey && focused === last) {
178
+ event.preventDefault();
179
+ first === null || first === void 0 ? void 0 : first.focus();
180
+ }
181
+ };
182
+ const openFrom = (event, focusTarget = headingRef) => {
183
+ openerRef.current = event.currentTarget;
184
+ setPresent(true);
185
+ setOpen(true);
186
+ if (event.detail === 0)
187
+ requestAnimationFrame(() => {
188
+ var _a;
189
+ if (visibleRef.current)
190
+ (_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
191
+ });
192
+ };
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) => {
194
+ const next = event.key === "ArrowLeft"
195
+ ? width + 16
196
+ : event.key === "ArrowRight"
197
+ ? width - 16
198
+ : event.key === "Home"
199
+ ? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane
200
+ : event.key === "End"
201
+ ? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane
202
+ : event.key === "Enter"
203
+ ? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane
204
+ : null;
205
+ if (next !== null) {
206
+ event.preventDefault();
207
+ event.stopPropagation();
208
+ clampWidth(next, event.key === "Enter");
209
+ }
210
+ }, onPointerDown: (event) => {
211
+ var _a, _b;
212
+ drag.current = { x: event.clientX, width };
213
+ (_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
214
+ }, onPointerMove: (event) => {
215
+ if (drag.current)
216
+ clampWidth(drag.current.width + drag.current.x - event.clientX);
217
+ }, onPointerUp: () => {
218
+ drag.current = null;
219
+ }, onPointerCancel: () => {
220
+ drag.current = null;
221
+ } }))] }), (0, jsx_runtime_1.jsx)(Collapse_1.default, { in: visible, orientation: "horizontal", className: "workspace-side-pane-presence", timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: !keepPaneMounted, onExited: () => setPresent(false), children: (0, jsx_runtime_1.jsx)("aside", { id: panelId, className: "workspace-side-pane-panel", "aria-labelledby": headingId, "aria-hidden": !visible || undefined, inert: !visible, children: renderPane(visible) }) })] })] }))] }));
222
+ }
@@ -0,0 +1 @@
1
+ export declare const WorkspaceSidePaneRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.WorkspaceSidePaneRoot = void 0;
5
+ const styles_1 = require("@mui/material/styles");
6
+ const workspaceSidePaneGeometry_js_1 = require("./workspaceSidePaneGeometry.js");
7
+ const width = "var(--workspace-side-pane-width)";
8
+ const top = "var(--workspace-side-pane-top)";
9
+ const layer = "var(--workspace-side-pane-z-index, 1250)";
10
+ exports.WorkspaceSidePaneRoot = (0, styles_1.styled)("div")(({ theme }) => ({
11
+ minWidth: 0,
12
+ minHeight: "100%",
13
+ "&.workspace-side-pane-enabled": {
14
+ display: "flex",
15
+ alignItems: "flex-start",
16
+ gap: 0,
17
+ position: "relative",
18
+ },
19
+ "& .workspace-side-pane-workspace": { minWidth: 0, flex: "1 1 auto" },
20
+ "& .workspace-side-pane-group": {
21
+ display: "flex",
22
+ flex: "0 0 auto",
23
+ position: "sticky",
24
+ top: 0,
25
+ alignSelf: "flex-start",
26
+ color: "var(--workspace-side-pane-text, " + theme.palette.text.primary + ")",
27
+ },
28
+ "& .workspace-side-pane-rail": {
29
+ boxSizing: "border-box",
30
+ width: workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail,
31
+ flex: `0 0 ${workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail}px`,
32
+ display: "flex",
33
+ alignItems: "center",
34
+ flexDirection: "column",
35
+ gap: 8,
36
+ padding: "8px 0",
37
+ background: "var(--workspace-side-pane-rail-background, " + theme.palette.background.default + ")",
38
+ borderInline: "1px solid var(--workspace-side-pane-border, " + theme.palette.divider + ")",
39
+ minHeight: "100dvh",
40
+ },
41
+ "& .workspace-side-pane-group :is(button, [tabindex], summary):focus-visible": {
42
+ outline: "2px solid var(--workspace-side-pane-focus, " + theme.palette.primary.main + ")",
43
+ outlineOffset: -2,
44
+ },
45
+ "& .workspace-side-pane-resize": {
46
+ position: "absolute", left: -5, top: 0, bottom: 0, width: 10, zIndex: 2,
47
+ cursor: "ew-resize", touchAction: "none",
48
+ },
49
+ "& .workspace-side-pane-panel": {
50
+ boxSizing: "border-box",
51
+ width,
52
+ height: "100dvh",
53
+ maxHeight: `calc(100dvh - ${top})`,
54
+ background: "var(--workspace-side-pane-background, " + theme.palette.background.paper + ")",
55
+ display: "flex",
56
+ flexDirection: "column",
57
+ minWidth: 0,
58
+ minHeight: 0,
59
+ overflow: "hidden",
60
+ borderRight: "1px solid var(--workspace-side-pane-border, " + theme.palette.divider + ")",
61
+ },
62
+ "& .workspace-side-pane-backdrop": {
63
+ position: "fixed", inset: `${top} 0 0`, background: "rgba(0, 0, 0, 0.45)", zIndex: layer,
64
+ },
65
+ "&.workspace-side-pane-overlay .workspace-side-pane-group": {
66
+ position: "fixed", top, right: 0, bottom: 0, width: "max-content", maxWidth: "100%",
67
+ height: `calc(100dvh - ${top})`, minHeight: 0, zIndex: layer,
68
+ },
69
+ "&.workspace-side-pane-overlay :is(.workspace-side-pane-panel, .workspace-side-pane-rail)": {
70
+ height: "100%", maxHeight: "100%", minHeight: 0,
71
+ },
72
+ // Open/close animates the allocation. Explicit resizing responds immediately.
73
+ "& .workspace-side-pane-presence": { flex: "0 0 auto" },
74
+ "&.workspace-side-pane-direct-resize .workspace-side-pane-presence": {
75
+ transition: "none !important", width: `${width} !important`,
76
+ },
77
+ // A live motion preference change snaps the layout during an existing transition.
78
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-presence": {
79
+ transition: "none !important", width: "0 !important", overflow: "hidden !important",
80
+ },
81
+ "&.workspace-side-pane-reduced-motion.workspace-side-pane-open .workspace-side-pane-presence": {
82
+ width: `${width} !important`,
83
+ },
84
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-backdrop": {
85
+ transition: "none !important", opacity: "0 !important",
86
+ },
87
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-backdrop[data-active='true']": {
88
+ opacity: "1 !important",
89
+ },
90
+ "@media (max-width: 480px)": {
91
+ "& .workspace-side-pane-panel": { paddingBottom: "env(safe-area-inset-bottom)" },
92
+ },
93
+ }));
@@ -4,3 +4,4 @@ export { BottomDrawer } from "./BottomDrawer.js";
4
4
  export { ResponsiveDrawer } from "./ResponsiveDrawer.js";
5
5
  export { useVisualViewportBottomInset, getVisualViewportBottomInset, } from "./useVisualViewportBottomInset.js";
6
6
  export type { DrawerAppearance } from "./drawerAppearance.js";
7
+ export { WorkspaceSidePane, type WorkspaceSidePaneActions, type WorkspaceSidePaneProps, } from "./WorkspaceSidePane.js";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getVisualViewportBottomInset = exports.useVisualViewportBottomInset = exports.ResponsiveDrawer = exports.BottomDrawer = exports.MobileBottomDrawerHeader = exports.mobileBottomDrawerDismissDuration = exports.MobileBottomDrawer = void 0;
4
+ exports.WorkspaceSidePane = exports.getVisualViewportBottomInset = exports.useVisualViewportBottomInset = exports.ResponsiveDrawer = exports.BottomDrawer = exports.MobileBottomDrawerHeader = exports.mobileBottomDrawerDismissDuration = exports.MobileBottomDrawer = void 0;
5
5
  // TL-M249: preserve the established MUI presentation under its owning package.
6
6
  var MobileBottomDrawer_js_1 = require("./MobileBottomDrawer.js");
7
7
  Object.defineProperty(exports, "MobileBottomDrawer", { enumerable: true, get: function () { return MobileBottomDrawer_js_1.MobileBottomDrawer; } });
@@ -15,3 +15,5 @@ Object.defineProperty(exports, "ResponsiveDrawer", { enumerable: true, get: func
15
15
  var useVisualViewportBottomInset_js_1 = require("./useVisualViewportBottomInset.js");
16
16
  Object.defineProperty(exports, "useVisualViewportBottomInset", { enumerable: true, get: function () { return useVisualViewportBottomInset_js_1.useVisualViewportBottomInset; } });
17
17
  Object.defineProperty(exports, "getVisualViewportBottomInset", { enumerable: true, get: function () { return useVisualViewportBottomInset_js_1.getVisualViewportBottomInset; } });
18
+ var WorkspaceSidePane_js_1 = require("./WorkspaceSidePane.js");
19
+ Object.defineProperty(exports, "WorkspaceSidePane", { enumerable: true, get: function () { return WorkspaceSidePane_js_1.WorkspaceSidePane; } });
@@ -0,0 +1,11 @@
1
+ export declare const workspaceSidePaneMetrics: {
2
+ readonly rail: 56;
3
+ readonly initialPane: 384;
4
+ readonly minPane: 320;
5
+ readonly maxPane: 480;
6
+ readonly minCanvas: 640;
7
+ };
8
+ export declare function workspaceSidePaneGeometry(available: number, requested: number, workspaceInset?: number): {
9
+ overlay: boolean;
10
+ paneWidth: number;
11
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workspaceSidePaneMetrics = void 0;
4
+ exports.workspaceSidePaneGeometry = workspaceSidePaneGeometry;
5
+ exports.workspaceSidePaneMetrics = { rail: 56, initialPane: 384, minPane: 320, maxPane: 480, minCanvas: 640 };
6
+ function workspaceSidePaneGeometry(available, requested, workspaceInset = 0) {
7
+ const preferred = Math.min(exports.workspaceSidePaneMetrics.maxPane, Math.max(exports.workspaceSidePaneMetrics.minPane, requested));
8
+ const overlay = available < exports.workspaceSidePaneMetrics.minCanvas + workspaceInset + exports.workspaceSidePaneMetrics.rail + preferred;
9
+ return {
10
+ overlay,
11
+ paneWidth: Math.max(0, available < exports.workspaceSidePaneMetrics.minCanvas + workspaceInset + exports.workspaceSidePaneMetrics.rail
12
+ ? available - exports.workspaceSidePaneMetrics.rail
13
+ : Math.min(preferred, available - exports.workspaceSidePaneMetrics.rail)),
14
+ };
15
+ }
@@ -0,0 +1,216 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useId, useLayoutEffect, useRef, useState } from "react";
4
+ import Collapse from "@mui/material/Collapse";
5
+ import Fade from "@mui/material/Fade";
6
+ import useMediaQuery from "@mui/material/useMediaQuery";
7
+ import { WorkspaceSidePaneRoot } from "./WorkspaceSidePaneRoot.js";
8
+ import { workspaceSidePaneGeometry, workspaceSidePaneMetrics } from "./workspaceSidePaneGeometry.js";
9
+ const motion = { timeout: { enter: 220, exit: 170 }, easing: "cubic-bezier(0.25, 1, 0.5, 1)" };
10
+ /** 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, }) {
12
+ const generatedId = useId();
13
+ const panelId = paneId !== null && paneId !== void 0 ? paneId : generatedId;
14
+ const rootRef = useRef(null);
15
+ const internalWorkspaceRef = useRef(null);
16
+ const contentRef = workspaceRef !== null && workspaceRef !== void 0 ? workspaceRef : internalWorkspaceRef;
17
+ const groupRef = useRef(null);
18
+ const openerRef = useRef(null);
19
+ const [open, setOpen] = useState(false);
20
+ const [present, setPresent] = useState(false);
21
+ const [directResize, setDirectResize] = useState(false);
22
+ const reducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)", { noSsr: true });
23
+ const duration = reducedMotion ? 0 : motion.timeout;
24
+ const [internalWidth, setWidth] = useState(workspaceSidePaneMetrics.initialPane);
25
+ const [bounds, setBounds] = useState({ width: workspaceSidePaneMetrics.minCanvas + workspaceSidePaneMetrics.rail + workspaceSidePaneMetrics.initialPane, top: 0, workspaceInset: 0 });
26
+ const drag = useRef(null);
27
+ const dockedMaximum = Math.max(workspaceSidePaneMetrics.minPane, Math.min(workspaceSidePaneMetrics.maxPane, bounds.width - bounds.workspaceInset - workspaceSidePaneMetrics.rail - workspaceSidePaneMetrics.minCanvas));
28
+ const hasPreferredWidth = typeof preferredWidth === "number" && Number.isFinite(preferredWidth);
29
+ const requestedWidth = hasPreferredWidth
30
+ ? Math.min(workspaceSidePaneMetrics.maxPane, Math.max(workspaceSidePaneMetrics.minPane, preferredWidth))
31
+ : internalWidth;
32
+ // A host preference can yield to the canvas without changing the preferred
33
+ // width or turning a workspace that fits the default into a modal.
34
+ const width = hasPreferredWidth && dockedMaximum >= workspaceSidePaneMetrics.initialPane
35
+ ? Math.min(requestedWidth, dockedMaximum)
36
+ : requestedWidth;
37
+ const geometry = workspaceSidePaneGeometry(bounds.width, width, bounds.workspaceInset);
38
+ const presentedWidth = geometry.overlay && hasPreferredWidth
39
+ ? workspaceSidePaneGeometry(bounds.width, workspaceSidePaneMetrics.initialPane, bounds.workspaceInset).paneWidth
40
+ : geometry.paneWidth;
41
+ const visible = enabled && open;
42
+ const overlay = visible && geometry.overlay;
43
+ const visibleRef = useRef(visible);
44
+ visibleRef.current = visible;
45
+ // Release modal focus and report closed to the host before visual exit.
46
+ const overlayPresentation = geometry.overlay && (visible || (present && !reducedMotion));
47
+ useLayoutEffect(() => {
48
+ if (!enabled) {
49
+ setPresent(false);
50
+ setDirectResize(false);
51
+ drag.current = null;
52
+ }
53
+ else if (visible) {
54
+ setPresent(true);
55
+ }
56
+ }, [enabled, visible]);
57
+ useLayoutEffect(() => {
58
+ const element = rootRef.current;
59
+ if (!element)
60
+ return;
61
+ const measure = () => {
62
+ const rect = element.getBoundingClientRect();
63
+ const workspaceStyle = contentRef.current ? getComputedStyle(contentRef.current) : null;
64
+ // Useful canvas excludes its retained page padding; chrome still uses
65
+ // the full root width, including in narrow overlays.
66
+ const workspaceInset = workspaceStyle
67
+ ? (parseFloat(workspaceStyle.paddingLeft) || 0) + (parseFloat(workspaceStyle.paddingRight) || 0)
68
+ : 0;
69
+ const next = { width: rect.width || window.innerWidth, top: Math.max(0, rect.top), workspaceInset };
70
+ // Content ResizeObserver notifications also arrive during pane motion;
71
+ // unchanged shell geometry must not rerender pane content per frame.
72
+ setBounds((previous) => previous.width === next.width && previous.top === next.top && previous.workspaceInset === next.workspaceInset ? previous : next);
73
+ };
74
+ measure();
75
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
76
+ observer === null || observer === void 0 ? void 0 : observer.observe(element);
77
+ if (contentRef.current)
78
+ observer === null || observer === void 0 ? void 0 : observer.observe(contentRef.current);
79
+ window.addEventListener("resize", measure);
80
+ return () => {
81
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
82
+ window.removeEventListener("resize", measure);
83
+ };
84
+ }, [enabled, contentRef]);
85
+ useLayoutEffect(() => {
86
+ var _a, _b, _c;
87
+ if (!overlay)
88
+ return;
89
+ const content = contentRef.current;
90
+ const root = rootRef.current;
91
+ const siblings = root ? (_a = getOverlaySiblings === null || getOverlaySiblings === void 0 ? void 0 : getOverlaySiblings(root)) !== null && _a !== void 0 ? _a : [] : [];
92
+ const covered = [...new Set([...(content ? [content] : []), ...siblings])];
93
+ const priorInert = covered.map((element) => ({ element, value: element.getAttribute("inert") }));
94
+ // Restore the pre-existing inert state when this overlay releases focus.
95
+ covered.forEach((element) => element.setAttribute("inert", ""));
96
+ const ownerDocument = (_c = (_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument) !== null && _c !== void 0 ? _c : document;
97
+ const focusInside = () => { var _a; return (_a = headingRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
98
+ const containsTarget = (target) => { var _a; return Boolean(target && ((_a = groupRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))); };
99
+ const containFocus = (event) => {
100
+ if (!containsTarget(event.target))
101
+ focusInside();
102
+ };
103
+ const containOutsideTab = (event) => {
104
+ if (event.key !== "Tab" || containsTarget(event.target))
105
+ return;
106
+ event.preventDefault();
107
+ event.stopPropagation();
108
+ focusInside();
109
+ };
110
+ // inert blocks normal background interaction; focusin additionally contains
111
+ // programmatic focus and browsers/environments with incomplete inert support.
112
+ ownerDocument.addEventListener("focusin", containFocus, true);
113
+ ownerDocument.addEventListener("keydown", containOutsideTab, true);
114
+ focusInside();
115
+ return () => {
116
+ ownerDocument.removeEventListener("focusin", containFocus, true);
117
+ ownerDocument.removeEventListener("keydown", containOutsideTab, true);
118
+ priorInert.forEach(({ element, value }) => {
119
+ if (value === null)
120
+ element.removeAttribute("inert");
121
+ else
122
+ element.setAttribute("inert", value);
123
+ });
124
+ };
125
+ }, [overlay, headingId, headingRef, contentRef, getOverlaySiblings]);
126
+ useLayoutEffect(() => {
127
+ var _a;
128
+ if (!visible && present)
129
+ (_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
130
+ }, [visible, present]);
131
+ const close = (opener) => {
132
+ if (opener)
133
+ openerRef.current = opener;
134
+ setOpen(false);
135
+ setDirectResize(false);
136
+ drag.current = null;
137
+ };
138
+ // Deliberate docked resizing preserves the useful canvas and its focusable
139
+ // control. Only an external viewport/container change may require an overlay.
140
+ const clampWidth = (next, reset = false) => {
141
+ const nextWidth = Math.max(workspaceSidePaneMetrics.minPane, Math.min(dockedMaximum, Math.round(next)));
142
+ if (nextWidth === width && (!reset || nextWidth === requestedWidth))
143
+ return;
144
+ setDirectResize(true);
145
+ setWidth(nextWidth);
146
+ onPreferredWidthChange === null || onPreferredWidthChange === void 0 ? void 0 : onPreferredWidthChange(nextWidth);
147
+ };
148
+ const keyboard = (event) => {
149
+ var _a, _b, _c, _d, _e;
150
+ // Nested native dialogs own their own Escape handling.
151
+ if ((_b = (_a = event.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, "dialog[open]"))
152
+ return;
153
+ if (event.key === "Escape" && !event.defaultPrevented) {
154
+ event.preventDefault();
155
+ event.stopPropagation();
156
+ close();
157
+ return;
158
+ }
159
+ if (!overlay || event.key !== "Tab")
160
+ return;
161
+ const controls = [...((_d = (_c = groupRef.current) === null || _c === void 0 ? void 0 : _c.querySelectorAll('button, a[href], input, textarea, select, summary, [tabindex]')) !== null && _d !== void 0 ? _d : [])]
162
+ .filter((element) => element.tabIndex >= 0 && !element.matches(":disabled")
163
+ && !element.closest('[hidden], [inert], dialog:not([open])')
164
+ && element.getClientRects().length > 0 && getComputedStyle(element).visibility !== "hidden");
165
+ const first = controls[0], last = controls[controls.length - 1];
166
+ const focused = (_e = groupRef.current) === null || _e === void 0 ? void 0 : _e.ownerDocument.activeElement;
167
+ if (event.shiftKey && (focused === first || focused === headingRef.current)) {
168
+ event.preventDefault();
169
+ last === null || last === void 0 ? void 0 : last.focus();
170
+ }
171
+ else if (!event.shiftKey && focused === last) {
172
+ event.preventDefault();
173
+ first === null || first === void 0 ? void 0 : first.focus();
174
+ }
175
+ };
176
+ const openFrom = (event, focusTarget = headingRef) => {
177
+ openerRef.current = event.currentTarget;
178
+ setPresent(true);
179
+ setOpen(true);
180
+ if (event.detail === 0)
181
+ requestAnimationFrame(() => {
182
+ var _a;
183
+ if (visibleRef.current)
184
+ (_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
185
+ });
186
+ };
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) => {
188
+ const next = event.key === "ArrowLeft"
189
+ ? width + 16
190
+ : event.key === "ArrowRight"
191
+ ? width - 16
192
+ : event.key === "Home"
193
+ ? workspaceSidePaneMetrics.minPane
194
+ : event.key === "End"
195
+ ? workspaceSidePaneMetrics.maxPane
196
+ : event.key === "Enter"
197
+ ? workspaceSidePaneMetrics.initialPane
198
+ : null;
199
+ if (next !== null) {
200
+ event.preventDefault();
201
+ event.stopPropagation();
202
+ clampWidth(next, event.key === "Enter");
203
+ }
204
+ }, onPointerDown: (event) => {
205
+ var _a, _b;
206
+ drag.current = { x: event.clientX, width };
207
+ (_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
208
+ }, onPointerMove: (event) => {
209
+ if (drag.current)
210
+ clampWidth(drag.current.width + drag.current.x - event.clientX);
211
+ }, onPointerUp: () => {
212
+ drag.current = null;
213
+ }, onPointerCancel: () => {
214
+ drag.current = null;
215
+ } }))] }), _jsx(Collapse, { in: visible, orientation: "horizontal", className: "workspace-side-pane-presence", timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: !keepPaneMounted, onExited: () => setPresent(false), children: _jsx("aside", { id: panelId, className: "workspace-side-pane-panel", "aria-labelledby": headingId, "aria-hidden": !visible || undefined, inert: !visible, children: renderPane(visible) }) })] })] }))] }));
216
+ }
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { styled } from "@mui/material/styles";
3
+ import { workspaceSidePaneMetrics } from "./workspaceSidePaneGeometry.js";
4
+ const width = "var(--workspace-side-pane-width)";
5
+ const top = "var(--workspace-side-pane-top)";
6
+ const layer = "var(--workspace-side-pane-z-index, 1250)";
7
+ export const WorkspaceSidePaneRoot = styled("div")(({ theme }) => ({
8
+ minWidth: 0,
9
+ minHeight: "100%",
10
+ "&.workspace-side-pane-enabled": {
11
+ display: "flex",
12
+ alignItems: "flex-start",
13
+ gap: 0,
14
+ position: "relative",
15
+ },
16
+ "& .workspace-side-pane-workspace": { minWidth: 0, flex: "1 1 auto" },
17
+ "& .workspace-side-pane-group": {
18
+ display: "flex",
19
+ flex: "0 0 auto",
20
+ position: "sticky",
21
+ top: 0,
22
+ alignSelf: "flex-start",
23
+ color: "var(--workspace-side-pane-text, " + theme.palette.text.primary + ")",
24
+ },
25
+ "& .workspace-side-pane-rail": {
26
+ boxSizing: "border-box",
27
+ width: workspaceSidePaneMetrics.rail,
28
+ flex: `0 0 ${workspaceSidePaneMetrics.rail}px`,
29
+ display: "flex",
30
+ alignItems: "center",
31
+ flexDirection: "column",
32
+ gap: 8,
33
+ padding: "8px 0",
34
+ background: "var(--workspace-side-pane-rail-background, " + theme.palette.background.default + ")",
35
+ borderInline: "1px solid var(--workspace-side-pane-border, " + theme.palette.divider + ")",
36
+ minHeight: "100dvh",
37
+ },
38
+ "& .workspace-side-pane-group :is(button, [tabindex], summary):focus-visible": {
39
+ outline: "2px solid var(--workspace-side-pane-focus, " + theme.palette.primary.main + ")",
40
+ outlineOffset: -2,
41
+ },
42
+ "& .workspace-side-pane-resize": {
43
+ position: "absolute", left: -5, top: 0, bottom: 0, width: 10, zIndex: 2,
44
+ cursor: "ew-resize", touchAction: "none",
45
+ },
46
+ "& .workspace-side-pane-panel": {
47
+ boxSizing: "border-box",
48
+ width,
49
+ height: "100dvh",
50
+ maxHeight: `calc(100dvh - ${top})`,
51
+ background: "var(--workspace-side-pane-background, " + theme.palette.background.paper + ")",
52
+ display: "flex",
53
+ flexDirection: "column",
54
+ minWidth: 0,
55
+ minHeight: 0,
56
+ overflow: "hidden",
57
+ borderRight: "1px solid var(--workspace-side-pane-border, " + theme.palette.divider + ")",
58
+ },
59
+ "& .workspace-side-pane-backdrop": {
60
+ position: "fixed", inset: `${top} 0 0`, background: "rgba(0, 0, 0, 0.45)", zIndex: layer,
61
+ },
62
+ "&.workspace-side-pane-overlay .workspace-side-pane-group": {
63
+ position: "fixed", top, right: 0, bottom: 0, width: "max-content", maxWidth: "100%",
64
+ height: `calc(100dvh - ${top})`, minHeight: 0, zIndex: layer,
65
+ },
66
+ "&.workspace-side-pane-overlay :is(.workspace-side-pane-panel, .workspace-side-pane-rail)": {
67
+ height: "100%", maxHeight: "100%", minHeight: 0,
68
+ },
69
+ // Open/close animates the allocation. Explicit resizing responds immediately.
70
+ "& .workspace-side-pane-presence": { flex: "0 0 auto" },
71
+ "&.workspace-side-pane-direct-resize .workspace-side-pane-presence": {
72
+ transition: "none !important", width: `${width} !important`,
73
+ },
74
+ // A live motion preference change snaps the layout during an existing transition.
75
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-presence": {
76
+ transition: "none !important", width: "0 !important", overflow: "hidden !important",
77
+ },
78
+ "&.workspace-side-pane-reduced-motion.workspace-side-pane-open .workspace-side-pane-presence": {
79
+ width: `${width} !important`,
80
+ },
81
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-backdrop": {
82
+ transition: "none !important", opacity: "0 !important",
83
+ },
84
+ "&.workspace-side-pane-reduced-motion .workspace-side-pane-backdrop[data-active='true']": {
85
+ opacity: "1 !important",
86
+ },
87
+ "@media (max-width: 480px)": {
88
+ "& .workspace-side-pane-panel": { paddingBottom: "env(safe-area-inset-bottom)" },
89
+ },
90
+ }));
@@ -5,3 +5,4 @@ export { MobileBottomDrawerHeader } from "./MobileBottomDrawerHeader.js";
5
5
  export { BottomDrawer } from "./BottomDrawer.js";
6
6
  export { ResponsiveDrawer } from "./ResponsiveDrawer.js";
7
7
  export { useVisualViewportBottomInset, getVisualViewportBottomInset, } from "./useVisualViewportBottomInset.js";
8
+ export { WorkspaceSidePane, } from "./WorkspaceSidePane.js";
@@ -0,0 +1,11 @@
1
+ export const workspaceSidePaneMetrics = { rail: 56, initialPane: 384, minPane: 320, maxPane: 480, minCanvas: 640 };
2
+ export function workspaceSidePaneGeometry(available, requested, workspaceInset = 0) {
3
+ const preferred = Math.min(workspaceSidePaneMetrics.maxPane, Math.max(workspaceSidePaneMetrics.minPane, requested));
4
+ const overlay = available < workspaceSidePaneMetrics.minCanvas + workspaceInset + workspaceSidePaneMetrics.rail + preferred;
5
+ return {
6
+ overlay,
7
+ paneWidth: Math.max(0, available < workspaceSidePaneMetrics.minCanvas + workspaceInset + workspaceSidePaneMetrics.rail
8
+ ? available - workspaceSidePaneMetrics.rail
9
+ : Math.min(preferred, available - workspaceSidePaneMetrics.rail)),
10
+ };
11
+ }
@@ -0,0 +1,29 @@
1
+ import { type CSSProperties, type MouseEvent, type ReactNode, type RefObject } from "react";
2
+ export interface WorkspaceSidePaneActions {
3
+ visible: boolean;
4
+ paneId: string;
5
+ openFrom: (event: MouseEvent<HTMLButtonElement>, focusTarget?: RefObject<HTMLElement | null>) => void;
6
+ close: (opener?: HTMLButtonElement) => void;
7
+ }
8
+ export interface WorkspaceSidePaneProps {
9
+ children: ReactNode;
10
+ enabled?: boolean;
11
+ className?: string;
12
+ style?: CSSProperties;
13
+ paneId?: string;
14
+ headingId: string;
15
+ headingRef: RefObject<HTMLElement | null>;
16
+ workspaceRef?: RefObject<HTMLDivElement | null>;
17
+ actionsLabel: string;
18
+ resizeLabel?: string;
19
+ keepPaneMounted?: boolean;
20
+ /** Preferred docked width in CSS pixels. The available canvas can constrain the displayed width. */
21
+ preferredWidth?: number;
22
+ /** Reports an explicit resize through the pointer or keyboard control. */
23
+ onPreferredWidthChange?: (width: number) => void;
24
+ getOverlaySiblings?: (root: HTMLDivElement) => readonly HTMLElement[];
25
+ renderActions: (actions: WorkspaceSidePaneActions) => ReactNode;
26
+ renderPane: (visible: boolean) => ReactNode;
27
+ }
28
+ /** 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;
@@ -0,0 +1 @@
1
+ export declare const WorkspaceSidePaneRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -4,3 +4,4 @@ export { BottomDrawer } from "./BottomDrawer.js";
4
4
  export { ResponsiveDrawer } from "./ResponsiveDrawer.js";
5
5
  export { useVisualViewportBottomInset, getVisualViewportBottomInset, } from "./useVisualViewportBottomInset.js";
6
6
  export type { DrawerAppearance } from "./drawerAppearance.js";
7
+ export { WorkspaceSidePane, type WorkspaceSidePaneActions, type WorkspaceSidePaneProps, } from "./WorkspaceSidePane.js";
@@ -0,0 +1,11 @@
1
+ export declare const workspaceSidePaneMetrics: {
2
+ readonly rail: 56;
3
+ readonly initialPane: 384;
4
+ readonly minPane: 320;
5
+ readonly maxPane: 480;
6
+ readonly minCanvas: 640;
7
+ };
8
+ export declare function workspaceSidePaneGeometry(available: number, requested: number, workspaceInset?: number): {
9
+ overlay: boolean;
10
+ paneWidth: number;
11
+ };
package/drawers.js ADDED
@@ -0,0 +1,4 @@
1
+ "use client";
2
+
3
+ // Bundlers that resolve physical subpaths still use the compiled drawers entry.
4
+ export * from "./dist/esm/drawers/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bayonai/mui-design",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Shared Bayon AI Material UI theme, style recipes, and reusable design components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -154,6 +154,7 @@
154
154
  },
155
155
  "files": [
156
156
  "dist",
157
+ "drawers.js",
157
158
  "README.md",
158
159
  "CHANGELOG.md",
159
160
  "docs",