@bayonai/mui-design 1.6.0 → 1.8.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 +16 -0
- package/README.md +29 -0
- package/dist/cjs/actions/DialogActionButtons.d.ts +2 -1
- package/dist/cjs/actions/DialogActionButtons.js +2 -2
- package/dist/cjs/drawers/WorkspaceSidePane.d.ts +25 -0
- package/dist/cjs/drawers/WorkspaceSidePane.js +206 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.js +93 -0
- package/dist/cjs/drawers/index.d.ts +1 -0
- package/dist/cjs/drawers/index.js +3 -1
- package/dist/cjs/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/cjs/drawers/workspaceSidePaneGeometry.js +15 -0
- package/dist/cjs/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/cjs/internal/DialogChoiceTile.js +60 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.js +22 -0
- package/dist/cjs/pricing/index.d.ts +1 -0
- package/dist/cjs/pricing/index.js +3 -1
- package/dist/cjs/uploads/ImageUploadQualityDialog.d.ts +13 -0
- package/dist/cjs/uploads/ImageUploadQualityDialog.js +57 -0
- package/dist/cjs/uploads/index.d.ts +1 -0
- package/dist/cjs/uploads/index.js +3 -1
- package/dist/esm/actions/DialogActionButtons.js +3 -3
- package/dist/esm/drawers/WorkspaceSidePane.js +200 -0
- package/dist/esm/drawers/WorkspaceSidePaneRoot.js +90 -0
- package/dist/esm/drawers/index.js +1 -0
- package/dist/esm/drawers/workspaceSidePaneGeometry.js +11 -0
- package/dist/esm/internal/DialogChoiceTile.js +54 -0
- package/dist/esm/pricing/PlanUpgradeDialog.js +19 -0
- package/dist/esm/pricing/index.js +1 -0
- package/dist/esm/uploads/ImageUploadQualityDialog.js +51 -0
- package/dist/esm/uploads/index.js +1 -0
- package/dist/types/actions/DialogActionButtons.d.ts +2 -1
- package/dist/types/drawers/WorkspaceSidePane.d.ts +25 -0
- package/dist/types/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/types/drawers/index.d.ts +1 -0
- package/dist/types/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/types/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/types/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/types/pricing/index.d.ts +1 -0
- package/dist/types/uploads/ImageUploadQualityDialog.d.ts +13 -0
- package/dist/types/uploads/index.d.ts +1 -0
- package/drawers.js +4 -0
- package/package.json +2 -1
|
@@ -0,0 +1,57 @@
|
|
|
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.ImageUploadQualityDialog = ImageUploadQualityDialog;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const Compress_1 = __importDefault(require("@mui/icons-material/Compress"));
|
|
10
|
+
const ImageSearch_1 = __importDefault(require("@mui/icons-material/ImageSearch"));
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const DialogActionButtons_js_1 = require("../actions/DialogActionButtons.js");
|
|
14
|
+
const DialogChoiceTile_js_1 = require("../internal/DialogChoiceTile.js");
|
|
15
|
+
function ImageUploadQualityDialog({ file, quality, highQualityAccess, focusLockedChoice = false, hint, onQualityChange, onLockedChoice, onClose, onConfirm, }) {
|
|
16
|
+
const titleId = (0, react_1.useId)();
|
|
17
|
+
const hintId = (0, react_1.useId)();
|
|
18
|
+
const radioName = (0, react_1.useId)();
|
|
19
|
+
const [preview, setPreview] = (0, react_1.useState)();
|
|
20
|
+
const [failedFile, setFailedFile] = (0, react_1.useState)();
|
|
21
|
+
const previewFailed = failedFile === file;
|
|
22
|
+
const url = (preview === null || preview === void 0 ? void 0 : preview.file) === file && !previewFailed ? preview.url : undefined;
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
if (previewFailed)
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
const url = URL.createObjectURL(file);
|
|
28
|
+
setPreview({ file, url });
|
|
29
|
+
return () => URL.revokeObjectURL(url);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("[ImageUploadQualityDialog] Could not open a preview for the selected file.", error);
|
|
33
|
+
setFailedFile(file);
|
|
34
|
+
}
|
|
35
|
+
}, [file, previewFailed]);
|
|
36
|
+
const highQualityTile = {
|
|
37
|
+
label: "High quality",
|
|
38
|
+
description: "Original file",
|
|
39
|
+
icon: (0, jsx_runtime_1.jsx)(ImageSearch_1.default, {}),
|
|
40
|
+
selected: quality === "high",
|
|
41
|
+
};
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, { open: true, onClose: onClose, fullWidth: true, maxWidth: "xs", "aria-labelledby": titleId, children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, { id: titleId, sx: { pr: 7 }, children: ["Upload image", (0, jsx_runtime_1.jsx)(DialogActionButtons_js_1.DialogCloseButton, { label: "Cancel image upload", onClose: onClose })] }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 1.5, children: [url ? ((0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: url, alt: "Selected image preview", onError: () => {
|
|
43
|
+
console.warn("[ImageUploadQualityDialog] Could not display the selected image preview.", { type: file.type });
|
|
44
|
+
setFailedFile(file);
|
|
45
|
+
}, sx: {
|
|
46
|
+
display: "block",
|
|
47
|
+
width: "100%",
|
|
48
|
+
maxHeight: "min(32dvh, 230px)",
|
|
49
|
+
objectFit: "contain",
|
|
50
|
+
borderRadius: 2,
|
|
51
|
+
} })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", sx: { overflowWrap: "anywhere" }, children: file.name }), previewFailed ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: "text.secondary", children: "Preview unavailable." })) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { role: highQualityAccess === "locked" ? "group" : "radiogroup", "aria-label": "Image quality", "aria-describedby": hint ? hintId : undefined, sx: {
|
|
52
|
+
display: "grid",
|
|
53
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
54
|
+
"@media (max-width: 350px)": { gridTemplateColumns: "1fr" },
|
|
55
|
+
gap: 1,
|
|
56
|
+
}, children: [(0, jsx_runtime_1.jsx)(DialogChoiceTile_js_1.DialogChoiceTile, { label: "Compressed", description: "Smaller file", icon: (0, jsx_runtime_1.jsx)(Compress_1.default, {}), name: radioName, selected: quality === "compressed", autoFocus: !focusLockedChoice, onSelect: () => onQualityChange("compressed") }), highQualityAccess === "locked" ? ((0, jsx_runtime_1.jsx)(DialogChoiceTile_js_1.DialogChoiceTile, { ...highQualityTile, autoFocus: focusLockedChoice, onLockedClick: onLockedChoice })) : ((0, jsx_runtime_1.jsx)(DialogChoiceTile_js_1.DialogChoiceTile, { ...highQualityTile, name: radioName, disabled: highQualityAccess === "unavailable", onSelect: () => onQualityChange("high") }))] }), hint ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { id: hintId, variant: "caption", color: "text.secondary", children: hint })) : null] }) }), (0, jsx_runtime_1.jsx)(DialogActionButtons_js_1.DialogActionButtons, { confirmLabel: "Upload image", confirmText: "Upload", onConfirm: onConfirm })] }));
|
|
57
|
+
}
|
|
@@ -9,3 +9,4 @@ export type { UploadFile, LoadFile } from "@bayonai/file-uploads";
|
|
|
9
9
|
export type { UploadProgressRingProps } from "./UploadProgressRing.js";
|
|
10
10
|
export { CameraCaptureDialog, type CameraCaptureDialogProps, type CameraCaptureLabels } from "./CameraCaptureDialog.js";
|
|
11
11
|
export { ImageCropDialog, type ImageCropDialogProps, type ImageCropLabels } from "./ImageCropDialog.js";
|
|
12
|
+
export { ImageUploadQualityDialog, type ImageUploadQuality, type ImageUploadQualityDialogProps } from "./ImageUploadQualityDialog.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ImageCropDialog = exports.CameraCaptureDialog = exports.useUploadLock = exports.UploadProgressRing = exports.ImageInfoPanel = exports.FileViewer = exports.FileThumbnail = exports.FileRow = exports.FileUpload = void 0;
|
|
4
|
+
exports.ImageUploadQualityDialog = exports.ImageCropDialog = exports.CameraCaptureDialog = exports.useUploadLock = exports.UploadProgressRing = exports.ImageInfoPanel = exports.FileViewer = exports.FileThumbnail = exports.FileRow = exports.FileUpload = void 0;
|
|
5
5
|
var FileUpload_js_1 = require("./FileUpload.js");
|
|
6
6
|
Object.defineProperty(exports, "FileUpload", { enumerable: true, get: function () { return FileUpload_js_1.FileUpload; } });
|
|
7
7
|
var FileRow_js_1 = require("./FileRow.js");
|
|
@@ -20,3 +20,5 @@ var CameraCaptureDialog_js_1 = require("./CameraCaptureDialog.js");
|
|
|
20
20
|
Object.defineProperty(exports, "CameraCaptureDialog", { enumerable: true, get: function () { return CameraCaptureDialog_js_1.CameraCaptureDialog; } });
|
|
21
21
|
var ImageCropDialog_js_1 = require("./ImageCropDialog.js");
|
|
22
22
|
Object.defineProperty(exports, "ImageCropDialog", { enumerable: true, get: function () { return ImageCropDialog_js_1.ImageCropDialog; } });
|
|
23
|
+
var ImageUploadQualityDialog_js_1 = require("./ImageUploadQualityDialog.js");
|
|
24
|
+
Object.defineProperty(exports, "ImageUploadQualityDialog", { enumerable: true, get: function () { return ImageUploadQualityDialog_js_1.ImageUploadQualityDialog; } });
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import CheckIcon from "@mui/icons-material/Check";
|
|
4
4
|
import CloseIcon from "@mui/icons-material/Close";
|
|
5
|
-
import { CircularProgress, DialogActions, IconButton, Stack, Tooltip, } from "@mui/material";
|
|
5
|
+
import { Button, CircularProgress, DialogActions, IconButton, Stack, Tooltip, } from "@mui/material";
|
|
6
6
|
// Product decision: concise decisions/info fit content above a readable 320px floor.
|
|
7
7
|
// Keep MUI's readable maxWidth/viewport cap; forms and previews own their sizing.
|
|
8
8
|
export const compactDialogPaperSx = {
|
|
@@ -12,8 +12,8 @@ export const compactDialogPaperSx = {
|
|
|
12
12
|
overflowWrap: "anywhere",
|
|
13
13
|
};
|
|
14
14
|
/** Keeps the modal's primary decision compact and explicitly labelled. */
|
|
15
|
-
export function DialogActionButtons({ confirmColor = "success", confirmDisabled = false, confirmIcon, confirmLabel, confirmType = "button", onConfirm, sx, }) {
|
|
16
|
-
return (_jsx(DialogActions, { sx: sx, children: _jsx(Stack, { direction: "row", spacing: 1, children: _jsx(Tooltip, { title: confirmLabel, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": confirmLabel, color: confirmColor, disabled: confirmDisabled, onClick: confirmType === "submit" ? undefined : onConfirm, type: confirmType, children: confirmIcon !== null && confirmIcon !== void 0 ? confirmIcon : _jsx(CheckIcon, {}) }) }) }) }) }));
|
|
15
|
+
export function DialogActionButtons({ confirmColor = "success", confirmDisabled = false, confirmIcon, confirmLabel, confirmText, confirmType = "button", onConfirm, sx, }) {
|
|
16
|
+
return (_jsx(DialogActions, { sx: sx, children: confirmText ? (_jsx(Button, { "aria-label": confirmLabel, color: confirmColor, disabled: confirmDisabled, onClick: confirmType === "submit" ? undefined : onConfirm, startIcon: confirmIcon, type: confirmType, variant: "contained", children: confirmText })) : (_jsx(Stack, { direction: "row", spacing: 1, children: _jsx(Tooltip, { title: confirmLabel, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": confirmLabel, color: confirmColor, disabled: confirmDisabled, onClick: confirmType === "submit" ? undefined : onConfirm, type: confirmType, children: confirmIcon !== null && confirmIcon !== void 0 ? confirmIcon : _jsx(CheckIcon, {}) }) }) }) })) }));
|
|
17
17
|
}
|
|
18
18
|
export function DialogActionProgress() {
|
|
19
19
|
return _jsx(CircularProgress, { color: "inherit", size: 20 });
|
|
@@ -0,0 +1,200 @@
|
|
|
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, 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 [width, 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 geometry = workspaceSidePaneGeometry(bounds.width, width, bounds.workspaceInset);
|
|
28
|
+
const visible = enabled && open;
|
|
29
|
+
const overlay = visible && geometry.overlay;
|
|
30
|
+
const visibleRef = useRef(visible);
|
|
31
|
+
visibleRef.current = visible;
|
|
32
|
+
// Release modal focus and report closed to the host before visual exit.
|
|
33
|
+
const overlayPresentation = geometry.overlay && (visible || (present && !reducedMotion));
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
if (!enabled) {
|
|
36
|
+
setPresent(false);
|
|
37
|
+
setDirectResize(false);
|
|
38
|
+
drag.current = null;
|
|
39
|
+
}
|
|
40
|
+
else if (visible) {
|
|
41
|
+
setPresent(true);
|
|
42
|
+
}
|
|
43
|
+
}, [enabled, visible]);
|
|
44
|
+
useLayoutEffect(() => {
|
|
45
|
+
const element = rootRef.current;
|
|
46
|
+
if (!element)
|
|
47
|
+
return;
|
|
48
|
+
const measure = () => {
|
|
49
|
+
const rect = element.getBoundingClientRect();
|
|
50
|
+
const workspaceStyle = contentRef.current ? getComputedStyle(contentRef.current) : null;
|
|
51
|
+
// Useful canvas excludes its retained page padding; chrome still uses
|
|
52
|
+
// the full root width, including in narrow overlays.
|
|
53
|
+
const workspaceInset = workspaceStyle
|
|
54
|
+
? (parseFloat(workspaceStyle.paddingLeft) || 0) + (parseFloat(workspaceStyle.paddingRight) || 0)
|
|
55
|
+
: 0;
|
|
56
|
+
const next = { width: rect.width || window.innerWidth, top: Math.max(0, rect.top), workspaceInset };
|
|
57
|
+
// Content ResizeObserver notifications also arrive during pane motion;
|
|
58
|
+
// unchanged shell geometry must not rerender pane content per frame.
|
|
59
|
+
setBounds((previous) => previous.width === next.width && previous.top === next.top && previous.workspaceInset === next.workspaceInset ? previous : next);
|
|
60
|
+
};
|
|
61
|
+
measure();
|
|
62
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
63
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(element);
|
|
64
|
+
if (contentRef.current)
|
|
65
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(contentRef.current);
|
|
66
|
+
window.addEventListener("resize", measure);
|
|
67
|
+
return () => {
|
|
68
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
69
|
+
window.removeEventListener("resize", measure);
|
|
70
|
+
};
|
|
71
|
+
}, [enabled, contentRef]);
|
|
72
|
+
useLayoutEffect(() => {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
if (!overlay)
|
|
75
|
+
return;
|
|
76
|
+
const content = contentRef.current;
|
|
77
|
+
const root = rootRef.current;
|
|
78
|
+
const siblings = root ? (_a = getOverlaySiblings === null || getOverlaySiblings === void 0 ? void 0 : getOverlaySiblings(root)) !== null && _a !== void 0 ? _a : [] : [];
|
|
79
|
+
const covered = [...new Set([...(content ? [content] : []), ...siblings])];
|
|
80
|
+
const priorInert = covered.map((element) => ({ element, value: element.getAttribute("inert") }));
|
|
81
|
+
// Restore the pre-existing inert state when this overlay releases focus.
|
|
82
|
+
covered.forEach((element) => element.setAttribute("inert", ""));
|
|
83
|
+
const ownerDocument = (_c = (_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument) !== null && _c !== void 0 ? _c : document;
|
|
84
|
+
const focusInside = () => { var _a; return (_a = headingRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
85
|
+
const containsTarget = (target) => { var _a; return Boolean(target && ((_a = groupRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))); };
|
|
86
|
+
const containFocus = (event) => {
|
|
87
|
+
if (!containsTarget(event.target))
|
|
88
|
+
focusInside();
|
|
89
|
+
};
|
|
90
|
+
const containOutsideTab = (event) => {
|
|
91
|
+
if (event.key !== "Tab" || containsTarget(event.target))
|
|
92
|
+
return;
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
focusInside();
|
|
96
|
+
};
|
|
97
|
+
// inert blocks normal background interaction; focusin additionally contains
|
|
98
|
+
// programmatic focus and browsers/environments with incomplete inert support.
|
|
99
|
+
ownerDocument.addEventListener("focusin", containFocus, true);
|
|
100
|
+
ownerDocument.addEventListener("keydown", containOutsideTab, true);
|
|
101
|
+
focusInside();
|
|
102
|
+
return () => {
|
|
103
|
+
ownerDocument.removeEventListener("focusin", containFocus, true);
|
|
104
|
+
ownerDocument.removeEventListener("keydown", containOutsideTab, true);
|
|
105
|
+
priorInert.forEach(({ element, value }) => {
|
|
106
|
+
if (value === null)
|
|
107
|
+
element.removeAttribute("inert");
|
|
108
|
+
else
|
|
109
|
+
element.setAttribute("inert", value);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}, [overlay, headingId, headingRef, contentRef, getOverlaySiblings]);
|
|
113
|
+
useLayoutEffect(() => {
|
|
114
|
+
var _a;
|
|
115
|
+
if (!visible && present)
|
|
116
|
+
(_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
117
|
+
}, [visible, present]);
|
|
118
|
+
const close = (opener) => {
|
|
119
|
+
if (opener)
|
|
120
|
+
openerRef.current = opener;
|
|
121
|
+
setOpen(false);
|
|
122
|
+
setDirectResize(false);
|
|
123
|
+
drag.current = null;
|
|
124
|
+
};
|
|
125
|
+
// Deliberate docked resizing preserves the useful canvas and its focusable
|
|
126
|
+
// control. Only an external viewport/container change may require an overlay.
|
|
127
|
+
const dockedMaximum = Math.max(workspaceSidePaneMetrics.minPane, Math.min(workspaceSidePaneMetrics.maxPane, bounds.width - bounds.workspaceInset - workspaceSidePaneMetrics.rail - workspaceSidePaneMetrics.minCanvas));
|
|
128
|
+
const clampWidth = (next) => {
|
|
129
|
+
setDirectResize(true);
|
|
130
|
+
setWidth(Math.max(workspaceSidePaneMetrics.minPane, Math.min(dockedMaximum, next)));
|
|
131
|
+
};
|
|
132
|
+
const keyboard = (event) => {
|
|
133
|
+
var _a, _b, _c, _d, _e;
|
|
134
|
+
// Nested native dialogs own their own Escape handling.
|
|
135
|
+
if ((_b = (_a = event.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, "dialog[open]"))
|
|
136
|
+
return;
|
|
137
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
event.stopPropagation();
|
|
140
|
+
close();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (!overlay || event.key !== "Tab")
|
|
144
|
+
return;
|
|
145
|
+
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 : [])]
|
|
146
|
+
.filter((element) => element.tabIndex >= 0 && !element.matches(":disabled")
|
|
147
|
+
&& !element.closest('[hidden], [inert], dialog:not([open])')
|
|
148
|
+
&& element.getClientRects().length > 0 && getComputedStyle(element).visibility !== "hidden");
|
|
149
|
+
const first = controls[0], last = controls[controls.length - 1];
|
|
150
|
+
const focused = (_e = groupRef.current) === null || _e === void 0 ? void 0 : _e.ownerDocument.activeElement;
|
|
151
|
+
if (event.shiftKey && (focused === first || focused === headingRef.current)) {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
last === null || last === void 0 ? void 0 : last.focus();
|
|
154
|
+
}
|
|
155
|
+
else if (!event.shiftKey && focused === last) {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
first === null || first === void 0 ? void 0 : first.focus();
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const openFrom = (event, focusTarget = headingRef) => {
|
|
161
|
+
openerRef.current = event.currentTarget;
|
|
162
|
+
setPresent(true);
|
|
163
|
+
setOpen(true);
|
|
164
|
+
if (event.detail === 0)
|
|
165
|
+
requestAnimationFrame(() => {
|
|
166
|
+
var _a;
|
|
167
|
+
if (visibleRef.current)
|
|
168
|
+
(_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
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": `${geometry.paneWidth}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) => {
|
|
172
|
+
const next = event.key === "ArrowLeft"
|
|
173
|
+
? width + 16
|
|
174
|
+
: event.key === "ArrowRight"
|
|
175
|
+
? width - 16
|
|
176
|
+
: event.key === "Home"
|
|
177
|
+
? workspaceSidePaneMetrics.minPane
|
|
178
|
+
: event.key === "End"
|
|
179
|
+
? workspaceSidePaneMetrics.maxPane
|
|
180
|
+
: event.key === "Enter"
|
|
181
|
+
? workspaceSidePaneMetrics.initialPane
|
|
182
|
+
: null;
|
|
183
|
+
if (next !== null) {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
clampWidth(next);
|
|
187
|
+
}
|
|
188
|
+
}, onPointerDown: (event) => {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
drag.current = { x: event.clientX, width };
|
|
191
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
192
|
+
}, onPointerMove: (event) => {
|
|
193
|
+
if (drag.current)
|
|
194
|
+
clampWidth(drag.current.width + drag.current.x - event.clientX);
|
|
195
|
+
}, onPointerUp: () => {
|
|
196
|
+
drag.current = null;
|
|
197
|
+
}, onPointerCancel: () => {
|
|
198
|
+
drag.current = null;
|
|
199
|
+
} }))] }), _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) }) })] })] }))] }));
|
|
200
|
+
}
|
|
@@ -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,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
|
4
|
+
import LockOutlinedIcon from "@mui/icons-material/LockOutlined";
|
|
5
|
+
import { Box, ButtonBase, Typography } from "@mui/material";
|
|
6
|
+
export function DialogChoiceTile(props) {
|
|
7
|
+
const { label, description, icon, selected, autoFocus } = props;
|
|
8
|
+
const sx = {
|
|
9
|
+
position: "relative",
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
alignItems: icon ? "center" : "flex-start",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
textAlign: icon ? "center" : "start",
|
|
15
|
+
gap: 0.5,
|
|
16
|
+
p: 1.5,
|
|
17
|
+
minWidth: 0,
|
|
18
|
+
minHeight: 80,
|
|
19
|
+
border: "1px solid",
|
|
20
|
+
borderColor: selected ? "success.main" : "divider",
|
|
21
|
+
borderRadius: 2,
|
|
22
|
+
backgroundColor: selected ? "action.selected" : "background.paper",
|
|
23
|
+
overflowWrap: "anywhere",
|
|
24
|
+
"&:hover": { backgroundColor: "action.hover" },
|
|
25
|
+
"&:has(input:focus-visible), &.Mui-focusVisible": {
|
|
26
|
+
outline: "2px solid",
|
|
27
|
+
outlineColor: "success.main",
|
|
28
|
+
outlineOffset: 2,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const content = (_jsxs(_Fragment, { children: [selected || props.onLockedClick ? (_jsx(Box, { "aria-hidden": true, sx: {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
top: 8,
|
|
34
|
+
right: 8,
|
|
35
|
+
color: selected ? "success.main" : "text.secondary",
|
|
36
|
+
lineHeight: 0,
|
|
37
|
+
}, children: selected ? (_jsx(CheckCircleIcon, { fontSize: "small" })) : (_jsx(LockOutlinedIcon, { fontSize: "small" })) })) : null, icon ? (_jsx(Box, { "aria-hidden": true, sx: { lineHeight: 0 }, children: icon })) : null, _jsx(Typography, { component: "span", variant: "subtitle2", sx: { pr: icon ? 0 : 3 }, children: label }), description ? (_jsx(Typography, { component: "span", variant: "body2", color: "text.secondary", children: description })) : null] }));
|
|
38
|
+
if (props.onLockedClick) {
|
|
39
|
+
return (_jsx(ButtonBase, { "aria-label": label, "aria-haspopup": "dialog", autoFocus: autoFocus, onClick: props.onLockedClick, sx: sx, type: "button", children: content }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs(Box, { component: "label", sx: {
|
|
42
|
+
...sx,
|
|
43
|
+
cursor: props.disabled ? "default" : "pointer",
|
|
44
|
+
opacity: props.disabled ? 0.6 : 1,
|
|
45
|
+
}, children: [_jsx(Box, { component: "input", type: "radio", name: props.name, "aria-label": label, autoFocus: autoFocus, checked: selected, disabled: props.disabled, onChange: props.onSelect, sx: {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
inset: 0,
|
|
48
|
+
opacity: 0,
|
|
49
|
+
width: "100%",
|
|
50
|
+
height: "100%",
|
|
51
|
+
m: 0,
|
|
52
|
+
cursor: "inherit",
|
|
53
|
+
} }), content] }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Dialog, DialogContent, DialogTitle, Stack, Typography, } from "@mui/material";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { DialogActionButtons, DialogCloseButton, } from "../actions/DialogActionButtons.js";
|
|
6
|
+
import { DialogChoiceTile } from "../internal/DialogChoiceTile.js";
|
|
7
|
+
export function PlanUpgradeDialog({ title, message, plans, selectedPlanId, confirmLabel, closeLabel = "Close upgrade dialog", onSelectPlan, onViewPlan, onClose, }) {
|
|
8
|
+
const titleId = useId();
|
|
9
|
+
const messageId = useId();
|
|
10
|
+
const radioName = useId();
|
|
11
|
+
return (_jsxs(Dialog, { open: true, fullWidth: true, maxWidth: "sm", onClose: onClose, "aria-labelledby": titleId, "aria-describedby": messageId, children: [_jsxs(DialogTitle, { id: titleId, sx: { pr: 7 }, children: [title, _jsx(DialogCloseButton, { label: closeLabel, onClose: onClose })] }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 2, children: [_jsx(Typography, { id: messageId, variant: "body2", color: "text.secondary", children: message }), _jsx(Box, { role: "radiogroup", "aria-label": "Upgrade plan", sx: {
|
|
12
|
+
display: "grid",
|
|
13
|
+
gridTemplateColumns: {
|
|
14
|
+
xs: "1fr",
|
|
15
|
+
sm: "repeat(2, minmax(0, 1fr))",
|
|
16
|
+
},
|
|
17
|
+
gap: 1,
|
|
18
|
+
}, children: plans.map((plan) => (_jsx(DialogChoiceTile, { name: radioName, label: plan.name, description: plan.details.map((detail) => (_jsx(Box, { component: "span", sx: { display: "block" }, children: detail }, detail))), selected: selectedPlanId === plan.id, autoFocus: selectedPlanId === plan.id, onSelect: () => onSelectPlan(plan.id) }, plan.id))) })] }) }), _jsx(DialogActionButtons, { confirmLabel: confirmLabel, confirmText: confirmLabel, onConfirm: () => onViewPlan(selectedPlanId) })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import CompressIcon from "@mui/icons-material/Compress";
|
|
4
|
+
import ImageSearchIcon from "@mui/icons-material/ImageSearch";
|
|
5
|
+
import { Box, Dialog, DialogContent, DialogTitle, Stack, Typography, } from "@mui/material";
|
|
6
|
+
import { useEffect, useId, useState } from "react";
|
|
7
|
+
import { DialogActionButtons, DialogCloseButton, } from "../actions/DialogActionButtons.js";
|
|
8
|
+
import { DialogChoiceTile } from "../internal/DialogChoiceTile.js";
|
|
9
|
+
export function ImageUploadQualityDialog({ file, quality, highQualityAccess, focusLockedChoice = false, hint, onQualityChange, onLockedChoice, onClose, onConfirm, }) {
|
|
10
|
+
const titleId = useId();
|
|
11
|
+
const hintId = useId();
|
|
12
|
+
const radioName = useId();
|
|
13
|
+
const [preview, setPreview] = useState();
|
|
14
|
+
const [failedFile, setFailedFile] = useState();
|
|
15
|
+
const previewFailed = failedFile === file;
|
|
16
|
+
const url = (preview === null || preview === void 0 ? void 0 : preview.file) === file && !previewFailed ? preview.url : undefined;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (previewFailed)
|
|
19
|
+
return;
|
|
20
|
+
try {
|
|
21
|
+
const url = URL.createObjectURL(file);
|
|
22
|
+
setPreview({ file, url });
|
|
23
|
+
return () => URL.revokeObjectURL(url);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error("[ImageUploadQualityDialog] Could not open a preview for the selected file.", error);
|
|
27
|
+
setFailedFile(file);
|
|
28
|
+
}
|
|
29
|
+
}, [file, previewFailed]);
|
|
30
|
+
const highQualityTile = {
|
|
31
|
+
label: "High quality",
|
|
32
|
+
description: "Original file",
|
|
33
|
+
icon: _jsx(ImageSearchIcon, {}),
|
|
34
|
+
selected: quality === "high",
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs(Dialog, { open: true, onClose: onClose, fullWidth: true, maxWidth: "xs", "aria-labelledby": titleId, children: [_jsxs(DialogTitle, { id: titleId, sx: { pr: 7 }, children: ["Upload image", _jsx(DialogCloseButton, { label: "Cancel image upload", onClose: onClose })] }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 1.5, children: [url ? (_jsx(Box, { component: "img", src: url, alt: "Selected image preview", onError: () => {
|
|
37
|
+
console.warn("[ImageUploadQualityDialog] Could not display the selected image preview.", { type: file.type });
|
|
38
|
+
setFailedFile(file);
|
|
39
|
+
}, sx: {
|
|
40
|
+
display: "block",
|
|
41
|
+
width: "100%",
|
|
42
|
+
maxHeight: "min(32dvh, 230px)",
|
|
43
|
+
objectFit: "contain",
|
|
44
|
+
borderRadius: 2,
|
|
45
|
+
} })) : null, _jsx(Typography, { variant: "body2", sx: { overflowWrap: "anywhere" }, children: file.name }), previewFailed ? (_jsx(Typography, { variant: "caption", color: "text.secondary", children: "Preview unavailable." })) : null, _jsxs(Box, { role: highQualityAccess === "locked" ? "group" : "radiogroup", "aria-label": "Image quality", "aria-describedby": hint ? hintId : undefined, sx: {
|
|
46
|
+
display: "grid",
|
|
47
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
48
|
+
"@media (max-width: 350px)": { gridTemplateColumns: "1fr" },
|
|
49
|
+
gap: 1,
|
|
50
|
+
}, children: [_jsx(DialogChoiceTile, { label: "Compressed", description: "Smaller file", icon: _jsx(CompressIcon, {}), name: radioName, selected: quality === "compressed", autoFocus: !focusLockedChoice, onSelect: () => onQualityChange("compressed") }), highQualityAccess === "locked" ? (_jsx(DialogChoiceTile, { ...highQualityTile, autoFocus: focusLockedChoice, onLockedClick: onLockedChoice })) : (_jsx(DialogChoiceTile, { ...highQualityTile, name: radioName, disabled: highQualityAccess === "unavailable", onSelect: () => onQualityChange("high") }))] }), hint ? (_jsx(Typography, { id: hintId, variant: "caption", color: "text.secondary", children: hint })) : null] }) }), _jsx(DialogActionButtons, { confirmLabel: "Upload image", confirmText: "Upload", onConfirm: onConfirm })] }));
|
|
51
|
+
}
|
|
@@ -8,3 +8,4 @@ export { UploadProgressRing } from "./UploadProgressRing.js";
|
|
|
8
8
|
export { useUploadLock } from "@bayonai/file-uploads/hooks";
|
|
9
9
|
export { CameraCaptureDialog } from "./CameraCaptureDialog.js";
|
|
10
10
|
export { ImageCropDialog } from "./ImageCropDialog.js";
|
|
11
|
+
export { ImageUploadQualityDialog } from "./ImageUploadQualityDialog.js";
|
|
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
export declare const compactDialogPaperSx: SxProps<Theme>;
|
|
4
4
|
export type DialogActionButtonsProps = {
|
|
5
5
|
confirmLabel: string;
|
|
6
|
+
confirmText?: string;
|
|
6
7
|
confirmDisabled?: boolean;
|
|
7
8
|
confirmColor?: "error" | "primary" | "secondary" | "success" | "warning";
|
|
8
9
|
confirmIcon?: ReactNode;
|
|
@@ -11,7 +12,7 @@ export type DialogActionButtonsProps = {
|
|
|
11
12
|
sx?: SxProps<Theme>;
|
|
12
13
|
};
|
|
13
14
|
/** Keeps the modal's primary decision compact and explicitly labelled. */
|
|
14
|
-
export declare function DialogActionButtons({ confirmColor, confirmDisabled, confirmIcon, confirmLabel, confirmType, onConfirm, sx, }: DialogActionButtonsProps): import("react").JSX.Element;
|
|
15
|
+
export declare function DialogActionButtons({ confirmColor, confirmDisabled, confirmIcon, confirmLabel, confirmText, confirmType, onConfirm, sx, }: DialogActionButtonsProps): import("react").JSX.Element;
|
|
15
16
|
export declare function DialogActionProgress(): import("react").JSX.Element;
|
|
16
17
|
export type DialogCloseButtonProps = {
|
|
17
18
|
disabled?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
getOverlaySiblings?: (root: HTMLDivElement) => readonly HTMLElement[];
|
|
21
|
+
renderActions: (actions: WorkspaceSidePaneActions) => ReactNode;
|
|
22
|
+
renderPane: (visible: boolean) => ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/** Keeps the workspace in one slot across docked, modal and closed presentation. */
|
|
25
|
+
export declare function WorkspaceSidePane({ children, enabled, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, 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
|
+
};
|