@bayonai/mui-design 0.2.1 → 1.1.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.
Files changed (147) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +108 -7
  3. package/dist/cjs/actions/ActionMenu.js +36 -0
  4. package/dist/cjs/actions/DialogActionButtons.js +33 -0
  5. package/dist/cjs/actions/LoadingIconButton.js +10 -0
  6. package/dist/cjs/actions/StickyActionFooter.js +27 -0
  7. package/dist/cjs/actions/StickySubmitButton.js +10 -0
  8. package/dist/cjs/actions/index.js +18 -0
  9. package/dist/cjs/client.js +1 -0
  10. package/dist/cjs/components/BayonFlowVisual.js +6 -6
  11. package/dist/cjs/components/BayonThemeModeToggle.js +34 -0
  12. package/dist/cjs/components/panels.js +7 -7
  13. package/dist/cjs/drawers/BottomDrawer.js +43 -0
  14. package/dist/cjs/drawers/MobileBottomDrawer.js +102 -0
  15. package/dist/cjs/drawers/MobileBottomDrawerHeader.js +36 -0
  16. package/dist/cjs/drawers/ResponsiveDrawer.js +22 -0
  17. package/dist/cjs/drawers/drawerAppearance.js +10 -0
  18. package/dist/cjs/drawers/index.js +17 -0
  19. package/dist/cjs/drawers/useVisualViewportBottomInset.js +33 -0
  20. package/dist/cjs/feedback/StatusNotice.js +62 -0
  21. package/dist/cjs/feedback/index.js +7 -0
  22. package/dist/cjs/links/LinkAddressPreview.js +80 -0
  23. package/dist/cjs/links/index.js +9 -0
  24. package/dist/cjs/links/useLinkAddressPreview.js +152 -0
  25. package/dist/cjs/pending/PendingChangesDialogShell.js +16 -0
  26. package/dist/cjs/pending/PendingChangesDialogView.js +126 -0
  27. package/dist/cjs/pending/PendingChangesIndicatorView.js +27 -0
  28. package/dist/cjs/pending/index.js +9 -0
  29. package/dist/cjs/pending/types.js +2 -0
  30. package/dist/cjs/providers/BayonThemeProvider.js +83 -4
  31. package/dist/cjs/sections/ExpandableSectionToggle.js +32 -0
  32. package/dist/cjs/sections/index.js +7 -0
  33. package/dist/cjs/styles/pageStyles.js +17 -17
  34. package/dist/cjs/swipe/SwipeActionRow.js +123 -0
  35. package/dist/cjs/swipe/index.js +8 -0
  36. package/dist/cjs/theme/components.js +60 -0
  37. package/dist/cjs/theme/createBayonTheme.js +23 -2
  38. package/dist/cjs/toasts/ActionToast.js +12 -0
  39. package/dist/cjs/toasts/Toast.js +55 -0
  40. package/dist/cjs/toasts/index.js +12 -0
  41. package/dist/cjs/toasts/useUpwardToastDismiss.js +73 -0
  42. package/dist/cjs/uploads/CameraCaptureDialog.js +187 -0
  43. package/dist/cjs/uploads/FileRow.js +23 -0
  44. package/dist/cjs/uploads/FileSwipeActionRow.js +11 -0
  45. package/dist/cjs/uploads/FileThumbnail.js +104 -0
  46. package/dist/cjs/uploads/FileUpload.js +98 -0
  47. package/dist/cjs/uploads/FileViewer.js +151 -0
  48. package/dist/cjs/uploads/ImageCropDialog.js +215 -0
  49. package/dist/cjs/uploads/UploadProgressRing.js +32 -0
  50. package/dist/cjs/uploads/cameraCropPresentation.js +12 -0
  51. package/dist/cjs/uploads/index.js +20 -0
  52. package/dist/esm/actions/ActionMenu.js +30 -0
  53. package/dist/esm/actions/DialogActionButtons.js +24 -0
  54. package/dist/esm/actions/LoadingIconButton.js +7 -0
  55. package/dist/esm/actions/StickyActionFooter.js +24 -0
  56. package/dist/esm/actions/StickySubmitButton.js +7 -0
  57. package/dist/esm/actions/index.js +7 -0
  58. package/dist/esm/client.js +1 -0
  59. package/dist/esm/components/BayonFlowVisual.js +6 -6
  60. package/dist/esm/components/BayonThemeModeToggle.js +28 -0
  61. package/dist/esm/components/panels.js +7 -7
  62. package/dist/esm/drawers/BottomDrawer.js +37 -0
  63. package/dist/esm/drawers/MobileBottomDrawer.js +95 -0
  64. package/dist/esm/drawers/MobileBottomDrawerHeader.js +30 -0
  65. package/dist/esm/drawers/ResponsiveDrawer.js +19 -0
  66. package/dist/esm/drawers/drawerAppearance.js +7 -0
  67. package/dist/esm/drawers/index.js +7 -0
  68. package/dist/esm/drawers/useVisualViewportBottomInset.js +29 -0
  69. package/dist/esm/feedback/StatusNotice.js +56 -0
  70. package/dist/esm/feedback/index.js +3 -0
  71. package/dist/esm/links/LinkAddressPreview.js +74 -0
  72. package/dist/esm/links/index.js +4 -0
  73. package/dist/esm/links/useLinkAddressPreview.js +149 -0
  74. package/dist/esm/pending/PendingChangesDialogShell.js +10 -0
  75. package/dist/esm/pending/PendingChangesDialogView.js +120 -0
  76. package/dist/esm/pending/PendingChangesIndicatorView.js +21 -0
  77. package/dist/esm/pending/index.js +4 -0
  78. package/dist/esm/pending/types.js +1 -0
  79. package/dist/esm/providers/BayonThemeProvider.js +83 -5
  80. package/dist/esm/sections/ExpandableSectionToggle.js +26 -0
  81. package/dist/esm/sections/index.js +3 -0
  82. package/dist/esm/styles/pageStyles.js +17 -17
  83. package/dist/esm/swipe/SwipeActionRow.js +116 -0
  84. package/dist/esm/swipe/index.js +3 -0
  85. package/dist/esm/theme/components.js +60 -0
  86. package/dist/esm/theme/createBayonTheme.js +23 -2
  87. package/dist/esm/toasts/ActionToast.js +9 -0
  88. package/dist/esm/toasts/Toast.js +52 -0
  89. package/dist/esm/toasts/index.js +5 -0
  90. package/dist/esm/toasts/useUpwardToastDismiss.js +69 -0
  91. package/dist/esm/uploads/CameraCaptureDialog.js +181 -0
  92. package/dist/esm/uploads/FileRow.js +17 -0
  93. package/dist/esm/uploads/FileSwipeActionRow.js +7 -0
  94. package/dist/esm/uploads/FileThumbnail.js +98 -0
  95. package/dist/esm/uploads/FileUpload.js +92 -0
  96. package/dist/esm/uploads/FileViewer.js +145 -0
  97. package/dist/esm/uploads/ImageCropDialog.js +212 -0
  98. package/dist/esm/uploads/UploadProgressRing.js +29 -0
  99. package/dist/esm/uploads/cameraCropPresentation.js +5 -0
  100. package/dist/esm/uploads/index.js +9 -0
  101. package/dist/types/actions/ActionMenu.d.ts +24 -0
  102. package/dist/types/actions/DialogActionButtons.d.ts +22 -0
  103. package/dist/types/actions/LoadingIconButton.d.ts +11 -0
  104. package/dist/types/actions/StickyActionFooter.d.ts +14 -0
  105. package/dist/types/actions/StickySubmitButton.d.ts +10 -0
  106. package/dist/types/actions/index.d.ts +5 -0
  107. package/dist/types/client.d.ts +1 -0
  108. package/dist/types/components/BayonThemeModeToggle.d.ts +6 -0
  109. package/dist/types/drawers/BottomDrawer.d.ts +16 -0
  110. package/dist/types/drawers/MobileBottomDrawer.d.ts +20 -0
  111. package/dist/types/drawers/MobileBottomDrawerHeader.d.ts +11 -0
  112. package/dist/types/drawers/ResponsiveDrawer.d.ts +25 -0
  113. package/dist/types/drawers/drawerAppearance.d.ts +8 -0
  114. package/dist/types/drawers/index.d.ts +6 -0
  115. package/dist/types/drawers/useVisualViewportBottomInset.d.ts +6 -0
  116. package/dist/types/feedback/StatusNotice.d.ts +13 -0
  117. package/dist/types/feedback/index.d.ts +1 -0
  118. package/dist/types/links/LinkAddressPreview.d.ts +19 -0
  119. package/dist/types/links/index.d.ts +3 -0
  120. package/dist/types/links/useLinkAddressPreview.d.ts +24 -0
  121. package/dist/types/pending/PendingChangesDialogShell.d.ts +2 -0
  122. package/dist/types/pending/PendingChangesDialogView.d.ts +2 -0
  123. package/dist/types/pending/PendingChangesIndicatorView.d.ts +10 -0
  124. package/dist/types/pending/index.d.ts +3 -0
  125. package/dist/types/pending/types.d.ts +48 -0
  126. package/dist/types/providers/BayonThemeProvider.d.ts +10 -1
  127. package/dist/types/sections/ExpandableSectionToggle.d.ts +12 -0
  128. package/dist/types/sections/index.d.ts +2 -0
  129. package/dist/types/swipe/SwipeActionRow.d.ts +8 -0
  130. package/dist/types/swipe/index.d.ts +1 -0
  131. package/dist/types/toasts/ActionToast.d.ts +11 -0
  132. package/dist/types/toasts/Toast.d.ts +16 -0
  133. package/dist/types/toasts/index.d.ts +5 -0
  134. package/dist/types/toasts/useUpwardToastDismiss.d.ts +15 -0
  135. package/dist/types/uploads/CameraCaptureDialog.d.ts +22 -0
  136. package/dist/types/uploads/FileRow.d.ts +10 -0
  137. package/dist/types/uploads/FileSwipeActionRow.d.ts +1 -0
  138. package/dist/types/uploads/FileThumbnail.d.ts +5 -0
  139. package/dist/types/uploads/FileUpload.d.ts +26 -0
  140. package/dist/types/uploads/FileViewer.d.ts +9 -0
  141. package/dist/types/uploads/ImageCropDialog.d.ts +26 -0
  142. package/dist/types/uploads/UploadProgressRing.d.ts +24 -0
  143. package/dist/types/uploads/cameraCropPresentation.d.ts +2 -0
  144. package/dist/types/uploads/index.d.ts +10 -0
  145. package/docs/camera-crop-contract.md +50 -0
  146. package/docs/uploads-contract.md +40 -0
  147. package/package.json +70 -8
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef, useState } from "react";
4
+ import { Box, Dialog, DialogContent, DialogTitle, Slider, Stack, Typography, } from "@mui/material";
5
+ import { DialogActionButtons, DialogActionProgress, DialogCloseButton, } from "./cameraCropPresentation.js";
6
+ import { StatusNotice } from "./cameraCropPresentation.js";
7
+ import { getSquareImageCrop, INITIAL_CROP_FRAMING, panSquareImageCrop, } from "@bayonai/file-uploads";
8
+ const DEFAULT_LABELS = {
9
+ title: "Crop photo",
10
+ close: "Close crop photo",
11
+ preview: "Photo crop preview",
12
+ confirm: "Use photo",
13
+ opening: "Opening photo…",
14
+ instruction: "Drag to position your photo",
15
+ zoom: "Zoom",
16
+ horizontal: "Horizontal position",
17
+ vertical: "Vertical position",
18
+ decodeError: "This photo could not be opened. Close this window and choose a JPEG, PNG or WebP photo.",
19
+ previewError: "The photo preview is unavailable. Close this window and choose a different photo.",
20
+ };
21
+ /** Emits orientation-correct decoded-pixel coordinates; the host persists them. */
22
+ export function ImageCropDialog({ file, busy, error, onClose, onConfirm, labels, previewShape = "circle", previewWidth = "min(100%, 280px, 35dvh)", }) {
23
+ const copy = { ...DEFAULT_LABELS, ...labels };
24
+ const copyRef = useRef(copy);
25
+ // Publish copy after commit so abandoned renders cannot change async feedback.
26
+ useEffect(() => {
27
+ copyRef.current = copy;
28
+ });
29
+ const titleId = useId();
30
+ const [decodedImage, setDecodedImage] = useState(null);
31
+ const bitmap = (decodedImage === null || decodedImage === void 0 ? void 0 : decodedImage.file) === file ? decodedImage.bitmap : null;
32
+ const [ownedDecodeError, setOwnedDecodeError] = useState(null);
33
+ const decodeError = (ownedDecodeError === null || ownedDecodeError === void 0 ? void 0 : ownedDecodeError.file) === file ? ownedDecodeError.message : null;
34
+ const [ownedFraming, setOwnedFraming] = useState(null);
35
+ const framing = (ownedFraming === null || ownedFraming === void 0 ? void 0 : ownedFraming.file) === file ? ownedFraming.framing : INITIAL_CROP_FRAMING;
36
+ function setFraming(update) {
37
+ setOwnedFraming((previous) => ({
38
+ file,
39
+ framing: update((previous === null || previous === void 0 ? void 0 : previous.file) === file ? previous.framing : INITIAL_CROP_FRAMING),
40
+ }));
41
+ }
42
+ const canvas = useRef(null);
43
+ const drag = useRef(null);
44
+ const submitting = useRef(false);
45
+ useEffect(() => {
46
+ let active = true;
47
+ let decoded;
48
+ async function decode() {
49
+ try {
50
+ if (typeof createImageBitmap !== "function")
51
+ throw new Error("Browser image decoding is unavailable.");
52
+ decoded = await createImageBitmap(file, {
53
+ imageOrientation: "from-image",
54
+ });
55
+ if (!active) {
56
+ decoded.close();
57
+ return;
58
+ }
59
+ if (!(decoded.width > 0 && decoded.height > 0))
60
+ throw new Error("Decoded photo dimensions are empty.");
61
+ setDecodedImage({ file, bitmap: decoded });
62
+ }
63
+ catch (error) {
64
+ if (!active)
65
+ return;
66
+ console.error("[ImageCropDialog] Could not decode selected photo.", {
67
+ error,
68
+ fileType: file.type,
69
+ });
70
+ setOwnedDecodeError({
71
+ file,
72
+ message: copyRef.current.decodeError,
73
+ });
74
+ }
75
+ }
76
+ void decode();
77
+ return () => {
78
+ active = false;
79
+ drag.current = null;
80
+ decoded === null || decoded === void 0 ? void 0 : decoded.close();
81
+ };
82
+ }, [file]);
83
+ const crop = bitmap ? getSquareImageCrop(bitmap, framing) : null;
84
+ useEffect(() => {
85
+ if (!bitmap || !canvas.current)
86
+ return;
87
+ const previewCrop = getSquareImageCrop(bitmap, framing);
88
+ const frame = requestAnimationFrame(() => {
89
+ var _a;
90
+ try {
91
+ const context = (_a = canvas.current) === null || _a === void 0 ? void 0 : _a.getContext("2d");
92
+ if (!context)
93
+ throw new Error("Canvas preview is unavailable.");
94
+ context.clearRect(0, 0, 512, 512);
95
+ context.drawImage(bitmap, previewCrop.x, previewCrop.y, previewCrop.width, previewCrop.height, 0, 0, 512, 512);
96
+ }
97
+ catch (error) {
98
+ console.error("[ImageCropDialog] Could not render selected crop.", {
99
+ error,
100
+ });
101
+ setOwnedDecodeError({
102
+ file,
103
+ message: copyRef.current.previewError,
104
+ });
105
+ }
106
+ });
107
+ return () => cancelAnimationFrame(frame);
108
+ }, [bitmap, framing, file]);
109
+ function endDrag(event) {
110
+ var _a;
111
+ if (((_a = drag.current) === null || _a === void 0 ? void 0 : _a.id) !== event.pointerId)
112
+ return;
113
+ drag.current = null;
114
+ if (event.currentTarget.hasPointerCapture(event.pointerId))
115
+ event.currentTarget.releasePointerCapture(event.pointerId);
116
+ }
117
+ async function confirm() {
118
+ if (busy || submitting.current || !crop || decodeError)
119
+ return;
120
+ submitting.current = true;
121
+ try {
122
+ await onConfirm(crop);
123
+ }
124
+ finally {
125
+ submitting.current = false;
126
+ }
127
+ }
128
+ const disabled = busy || !bitmap || Boolean(decodeError);
129
+ return (_jsxs(Dialog, { open: true, fullWidth: true, maxWidth: "xs", onClose: () => {
130
+ if (!busy && !submitting.current)
131
+ onClose();
132
+ }, "aria-labelledby": titleId, onKeyDown: (event) => {
133
+ if (event.key === "Enter") {
134
+ if (!(event.target instanceof HTMLButtonElement))
135
+ event.preventDefault();
136
+ event.stopPropagation();
137
+ }
138
+ }, slotProps: {
139
+ paper: {
140
+ sx: {
141
+ maxHeight: "calc(100dvh - 32px)",
142
+ m: 2,
143
+ width: "calc(100% - 32px)",
144
+ },
145
+ },
146
+ }, children: [_jsxs(DialogTitle, { id: titleId, sx: { pr: 7 }, children: [copy.title, _jsx(DialogCloseButton, { label: copy.close, disabled: busy, onClose: () => {
147
+ if (!submitting.current)
148
+ onClose();
149
+ } })] }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 1.5, children: [_jsxs(Box, { role: "img", "aria-label": copy.preview, sx: {
150
+ aspectRatio: "1",
151
+ // Keep framing controls near the preview on short viewports;
152
+ // pointer coordinates still use this element's actual bounds.
153
+ width: previewWidth,
154
+ alignSelf: "center",
155
+ flexShrink: 0,
156
+ position: "relative",
157
+ overflow: "hidden",
158
+ borderRadius: 1,
159
+ bgcolor: "action.hover",
160
+ touchAction: "none",
161
+ cursor: disabled ? "default" : "grab",
162
+ }, onPointerDown: (event) => {
163
+ if (disabled || !event.isPrimary)
164
+ return;
165
+ event.currentTarget.setPointerCapture(event.pointerId);
166
+ drag.current = {
167
+ id: event.pointerId,
168
+ x: event.clientX,
169
+ y: event.clientY,
170
+ };
171
+ }, onPointerMove: (event) => {
172
+ const previous = drag.current;
173
+ if (disabled ||
174
+ !bitmap ||
175
+ !previous ||
176
+ previous.id !== event.pointerId)
177
+ return;
178
+ const size = event.currentTarget.getBoundingClientRect().width;
179
+ setFraming((value) => panSquareImageCrop(bitmap, value, event.clientX - previous.x, event.clientY - previous.y, size));
180
+ drag.current = {
181
+ id: event.pointerId,
182
+ x: event.clientX,
183
+ y: event.clientY,
184
+ };
185
+ }, onPointerUp: endDrag, onPointerCancel: endDrag, onLostPointerCapture: () => {
186
+ drag.current = null;
187
+ }, children: [_jsx("canvas", { ref: canvas, width: 512, height: 512, "aria-hidden": "true", style: { display: "block", width: "100%", height: "100%" } }), _jsx(Box, { "aria-hidden": true, sx: {
188
+ position: "absolute",
189
+ inset: 0,
190
+ borderRadius: previewShape === "circle" ? "50%" : 0,
191
+ border: "2px solid",
192
+ borderColor: "common.white",
193
+ boxShadow: "0 0 0 100vmax rgba(0,0,0,0.45)",
194
+ pointerEvents: "none",
195
+ } })] }), _jsx(Typography, { variant: "body2", color: "text.secondary", children: !bitmap && !decodeError ? copy.opening : copy.instruction }), _jsx(Box, { sx: {
196
+ display: "grid",
197
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
198
+ columnGap: 2,
199
+ }, children: [
200
+ [copy.zoom, "zoom", 1, 4, 0.01],
201
+ [copy.horizontal, "horizontal", 0, 100, 1],
202
+ [copy.vertical, "vertical", 0, 100, 1],
203
+ ].map(([label, key, min, max, step]) => (_jsxs(Box, { sx: {
204
+ minWidth: 0,
205
+ display: "flex",
206
+ flexDirection: "column",
207
+ gridColumn: key === "zoom" ? "1 / -1" : undefined,
208
+ }, children: [_jsx(Typography, { id: `${titleId}-${key}`, variant: "body2", sx: { flex: 1, overflowWrap: "anywhere" }, children: label }), _jsx(Slider, { "aria-label": label, "aria-labelledby": `${titleId}-${key}`, min: min, max: max, step: step, value: framing[key], disabled: disabled, onChange: (_event, value) => {
209
+ if (typeof value === "number")
210
+ setFraming((previous) => ({ ...previous, [key]: value }));
211
+ } })] }, key))) }), decodeError || error ? (_jsx(StatusNotice, { tone: "error", message: decodeError !== null && decodeError !== void 0 ? decodeError : error })) : null] }) }), _jsx(DialogActionButtons, { confirmLabel: copy.confirm, confirmDisabled: disabled, confirmIcon: busy ? _jsx(DialogActionProgress, {}) : undefined, onConfirm: () => void confirm() })] }));
212
+ }
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Box, CircularProgress } from "@mui/material";
4
+ /**
5
+ * Presents determinate upload progress at the object being changed.
6
+ *
7
+ * Product decision: progress belongs with a compact upload target rather than
8
+ * in a separate status row. The host owns file selection, upload lifecycle,
9
+ * validation, errors, and disabled interaction; this primitive only renders
10
+ * the accessible visual state around its child.
11
+ */
12
+ export function UploadProgressRing({ children, progress, progressLabel, size = 88, sx, thickness = 3, }) {
13
+ const isUploading = progress !== null;
14
+ const normalizedProgress = Math.min(100, Math.max(0, progress !== null && progress !== void 0 ? progress : 0));
15
+ return (_jsxs(Box, { "aria-busy": isUploading || undefined, "data-component": "upload-progress-ring", sx: {
16
+ alignItems: "center",
17
+ display: "inline-flex",
18
+ height: size,
19
+ justifyContent: "center",
20
+ position: "relative",
21
+ width: size,
22
+ ...sx,
23
+ }, children: [children, isUploading ? (_jsx(CircularProgress, { "aria-label": progressLabel, size: size, sx: {
24
+ left: 0,
25
+ pointerEvents: "none",
26
+ position: "absolute",
27
+ top: 0,
28
+ }, thickness: thickness, value: normalizedProgress, variant: "determinate" })) : null] }));
29
+ }
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ // Product decision: camera/crop retain their shared host-theme presentation;
3
+ // delegate to the canonical actions/feedback bodies instead of copying them.
4
+ export { DialogActionButtons, DialogActionProgress, DialogCloseButton, } from "../actions/DialogActionButtons.js";
5
+ export { StatusNotice } from "../feedback/StatusNotice.js";
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ export { FileUpload } from "./FileUpload.js";
3
+ export { FileRow } from "./FileRow.js";
4
+ export { FileThumbnail } from "./FileThumbnail.js";
5
+ export { FileViewer } from "./FileViewer.js";
6
+ export { UploadProgressRing } from "./UploadProgressRing.js";
7
+ export { useUploadLock } from "@bayonai/file-uploads/hooks";
8
+ export { CameraCaptureDialog } from "./CameraCaptureDialog.js";
9
+ export { ImageCropDialog } from "./ImageCropDialog.js";
@@ -0,0 +1,24 @@
1
+ import { type SxProps, type Theme } from "@mui/material";
2
+ import { type ReactNode } from "react";
3
+ export type ActionMenuColor = "default" | "primary" | "secondary" | "error";
4
+ export type ActionMenuItem = {
5
+ color?: ActionMenuColor;
6
+ disabled?: boolean;
7
+ icon?: ReactNode;
8
+ label: string;
9
+ onClick: () => void;
10
+ section?: string;
11
+ };
12
+ export type ActionMenuProps = {
13
+ actionColorSx?: Partial<Record<ActionMenuColor, SxProps<Theme>>>;
14
+ actions: ActionMenuItem[];
15
+ buttonSx?: SxProps<Theme>;
16
+ containerSx?: SxProps<Theme>;
17
+ disabled?: boolean;
18
+ label?: string;
19
+ loading?: boolean;
20
+ loadingLabel?: string;
21
+ size?: "small" | "medium" | "large";
22
+ };
23
+ /** A compact, grouped action menu with an optional in-flight trigger state. */
24
+ export declare function ActionMenu({ actionColorSx, actions, buttonSx, containerSx, disabled, label, loading, loadingLabel, size, }: ActionMenuProps): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import type { SxProps, Theme } from "@mui/material/styles";
2
+ import type { ReactNode } from "react";
3
+ export declare const compactDialogPaperSx: SxProps<Theme>;
4
+ export type DialogActionButtonsProps = {
5
+ confirmLabel: string;
6
+ confirmDisabled?: boolean;
7
+ confirmColor?: "error" | "primary" | "secondary" | "success" | "warning";
8
+ confirmIcon?: ReactNode;
9
+ confirmType?: "button" | "submit";
10
+ onConfirm?: () => void;
11
+ sx?: SxProps<Theme>;
12
+ };
13
+ /** 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 DialogActionProgress(): import("react").JSX.Element;
16
+ export type DialogCloseButtonProps = {
17
+ disabled?: boolean;
18
+ label?: string;
19
+ onClose: () => void;
20
+ sx?: SxProps<Theme>;
21
+ };
22
+ export declare function DialogCloseButton({ disabled, label, onClose, sx, }: DialogCloseButtonProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { type IconButtonProps } from "@mui/material";
2
+ import type { ReactNode } from "react";
3
+ export type LoadingIconButtonProps = Omit<IconButtonProps, "aria-label" | "children"> & {
4
+ "aria-label": string;
5
+ children: ReactNode;
6
+ loading?: boolean;
7
+ loadingLabel: string;
8
+ spinnerSize?: number;
9
+ };
10
+ /** Keeps an icon action's footprint while making an in-flight request visible. */
11
+ export declare function LoadingIconButton({ "aria-label": ariaLabel, children, disabled, loading, loadingLabel, spinnerSize, ...props }: LoadingIconButtonProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { type SxProps, type Theme } from "@mui/material";
2
+ import type { ReactNode } from "react";
3
+ export type StickyActionFooterProps = {
4
+ children: ReactNode;
5
+ sx?: SxProps<Theme>;
6
+ };
7
+ /**
8
+ * Keeps the final actions of a long, scrollable form in view.
9
+ *
10
+ * Product decision: this component owns local sticky positioning and neutral
11
+ * footer chrome only. The host owns its scroll container, any edge-to-edge
12
+ * bleed required by a padded surface, action layout, and form submission.
13
+ */
14
+ export declare function StickyActionFooter({ children, sx }: StickyActionFooterProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { type ButtonProps, type SxProps, type Theme } from "@mui/material";
2
+ export type StickySubmitButtonProps = {
3
+ buttonSx?: SxProps<Theme>;
4
+ disabled?: boolean;
5
+ footerSx?: SxProps<Theme>;
6
+ label?: string;
7
+ loading?: boolean;
8
+ variant?: ButtonProps["variant"];
9
+ };
10
+ export declare function StickySubmitButton({ buttonSx, disabled, footerSx, label, loading, variant, }: StickySubmitButtonProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export { ActionMenu, type ActionMenuColor, type ActionMenuItem, type ActionMenuProps, } from "./ActionMenu.js";
2
+ export { LoadingIconButton, type LoadingIconButtonProps, } from "./LoadingIconButton.js";
3
+ export { StickyActionFooter, type StickyActionFooterProps, } from "./StickyActionFooter.js";
4
+ export { StickySubmitButton, type StickySubmitButtonProps, } from "./StickySubmitButton.js";
5
+ export { compactDialogPaperSx, DialogActionButtons, DialogActionProgress, DialogCloseButton, type DialogActionButtonsProps, type DialogCloseButtonProps, } from "./DialogActionButtons.js";
@@ -1,3 +1,4 @@
1
1
  export * from './components/IconTooltipButton.js';
2
2
  export * from './components/BayonFlowVisual.js';
3
+ export * from './components/BayonThemeModeToggle.js';
3
4
  export * from './providers/BayonThemeProvider.js';
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { SxProps, Theme } from '@mui/material/styles';
3
+ export interface BayonThemeModeToggleProps {
4
+ sx?: SxProps<Theme>;
5
+ }
6
+ export declare function BayonThemeModeToggle({ sx }: BayonThemeModeToggleProps): React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { SxProps, Theme } from "@mui/material/styles";
2
+ import type { ReactNode } from "react";
3
+ import { type DrawerAppearance } from "./drawerAppearance.js";
4
+ export declare function BottomDrawer({ children, appearance, closeTooltip, closeLabel, contentSx, dataComponent, disablePortal, headerActions, onClose, open, title, }: {
5
+ children: ReactNode;
6
+ appearance?: DrawerAppearance;
7
+ closeTooltip?: string;
8
+ closeLabel: string;
9
+ contentSx?: SxProps<Theme>;
10
+ dataComponent?: string;
11
+ disablePortal?: boolean;
12
+ headerActions?: ReactNode;
13
+ onClose: () => void;
14
+ open: boolean;
15
+ title: ReactNode;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ import { type DrawerAppearance } from "./drawerAppearance.js";
3
+ export declare const mobileBottomDrawerDismissDuration = 220;
4
+ export declare function MobileBottomDrawer({ ariaLabel, appearance, closeTooltip, children, contentScrollMode, dataComponent, dismiss, handleBackground, handlePlacement, headerLeft, headerRight, maxHeight, onClose, }: {
5
+ ariaLabel: string;
6
+ appearance?: DrawerAppearance;
7
+ closeTooltip?: string;
8
+ children: ReactNode;
9
+ /** Chooses whether the drawer body or its direct child owns vertical scrolling. */
10
+ contentScrollMode?: "container" | "child";
11
+ dataComponent?: string;
12
+ /** Requests the standard dismiss animation before invoking onClose. */
13
+ dismiss?: boolean;
14
+ handleBackground?: "default" | "detailChrome";
15
+ handlePlacement?: "above-content" | "overlay";
16
+ headerLeft?: ReactNode;
17
+ headerRight?: ReactNode;
18
+ maxHeight?: string;
19
+ onClose: () => void;
20
+ }): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from "react";
2
+ type MobileBottomDrawerHeaderProps = {
3
+ closeLabel: string;
4
+ closeTooltip?: string;
5
+ dragHandle: ReactNode;
6
+ left: ReactNode;
7
+ onClose: () => void;
8
+ right?: ReactNode;
9
+ };
10
+ export declare function MobileBottomDrawerHeader({ closeLabel, closeTooltip, dragHandle, left, onClose, right, }: MobileBottomDrawerHeaderProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from "react";
2
+ import type { SxProps, Theme } from "@mui/material/styles";
3
+ import type { DrawerAppearance } from "./drawerAppearance.js";
4
+ type DrawerPresentation = "desktop" | "mobile";
5
+ type ResponsiveDrawerProps = {
6
+ ariaLabel: string;
7
+ appearance?: DrawerAppearance;
8
+ closeTooltip?: string;
9
+ children: (presentation: DrawerPresentation) => ReactNode;
10
+ desktopContentSx?: SxProps<Theme>;
11
+ desktopCloseLabel?: string;
12
+ desktopDataComponent?: string;
13
+ desktopDisablePortal?: boolean;
14
+ desktopOpen?: boolean;
15
+ headerActions?: ReactNode;
16
+ mobileContentScrollMode?: "child" | "container";
17
+ mobileDataComponent?: string;
18
+ mobileDismiss?: boolean;
19
+ mobileOpen?: boolean;
20
+ onDesktopClose: () => void;
21
+ onMobileClose: () => void;
22
+ title: ReactNode;
23
+ };
24
+ export declare function ResponsiveDrawer({ ariaLabel, appearance, closeTooltip, children, desktopContentSx, desktopCloseLabel, desktopDataComponent, desktopDisablePortal, desktopOpen, headerActions, mobileContentScrollMode, mobileDataComponent, mobileDismiss, mobileOpen, onDesktopClose, onMobileClose, title, }: ResponsiveDrawerProps): import("react").JSX.Element | null;
25
+ export {};
@@ -0,0 +1,8 @@
1
+ export type DrawerAppearance = {
2
+ background: string;
3
+ chrome: string;
4
+ handle: string;
5
+ shadow: string;
6
+ safeAreaBottom: string;
7
+ };
8
+ export declare const defaultDrawerAppearance: DrawerAppearance;
@@ -0,0 +1,6 @@
1
+ export { MobileBottomDrawer, mobileBottomDrawerDismissDuration, } from "./MobileBottomDrawer.js";
2
+ export { MobileBottomDrawerHeader } from "./MobileBottomDrawerHeader.js";
3
+ export { BottomDrawer } from "./BottomDrawer.js";
4
+ export { ResponsiveDrawer } from "./ResponsiveDrawer.js";
5
+ export { useVisualViewportBottomInset, getVisualViewportBottomInset, } from "./useVisualViewportBottomInset.js";
6
+ export type { DrawerAppearance } from "./drawerAppearance.js";
@@ -0,0 +1,6 @@
1
+ export declare function getVisualViewportBottomInset({ layoutViewportHeight, visualViewportHeight, visualViewportOffsetTop, }: {
2
+ layoutViewportHeight: number;
3
+ visualViewportHeight: number;
4
+ visualViewportOffsetTop: number;
5
+ }): number;
6
+ export declare function useVisualViewportBottomInset(): number;
@@ -0,0 +1,13 @@
1
+ import { type SxProps, type Theme } from "@mui/material";
2
+ import type { AriaRole, ReactNode } from "react";
3
+ export type StatusNoticeTone = "error" | "info" | "success" | "warning";
4
+ export type StatusNoticeProps = {
5
+ action?: ReactNode;
6
+ compact?: boolean;
7
+ dataComponent?: string;
8
+ message: ReactNode;
9
+ role?: AriaRole;
10
+ sx?: SxProps<Theme>;
11
+ tone?: StatusNoticeTone;
12
+ };
13
+ export declare function StatusNotice({ action, compact, dataComponent, message, role, sx, tone, }: StatusNoticeProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export { StatusNotice, type StatusNoticeProps, type StatusNoticeTone, } from "./StatusNotice.js";
@@ -0,0 +1,19 @@
1
+ import { type SxProps, type Theme } from "@mui/material";
2
+ import type { HTMLAttributes } from "react";
3
+ export type LinkAddressPreviewState = {
4
+ href: string;
5
+ label: string;
6
+ left: number;
7
+ top: number;
8
+ };
9
+ export type LinkAddressPreviewProps = Pick<HTMLAttributes<HTMLElement>, "id" | "className" | "onMouseEnter" | "onMouseLeave" | "onFocusCapture" | "onBlurCapture" | "onKeyDown" | "onClick"> & {
10
+ link: LinkAddressPreviewState;
11
+ ariaLabel?: string;
12
+ openLabel?: string;
13
+ sx?: SxProps<Theme>;
14
+ };
15
+ /**
16
+ * Shared presentation of the editor's destination card. Hosts own validated
17
+ * URLs, placement, portal/lifecycle and navigation policy; no metadata is fetched.
18
+ */
19
+ export declare function LinkAddressPreview({ link, ariaLabel, openLabel, sx, ...events }: LinkAddressPreviewProps): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { LinkAddressPreview } from "./LinkAddressPreview.js";
2
+ export type { LinkAddressPreviewProps, LinkAddressPreviewState, } from "./LinkAddressPreview.js";
3
+ export { useLinkAddressPreview } from "./useLinkAddressPreview.js";
@@ -0,0 +1,24 @@
1
+ import { type FocusEvent, type KeyboardEvent, type MouseEvent } from "react";
2
+ /** Product decision: hosts own link interaction; the shared UI card only displays
3
+ * a validated destination. The source previews/edits; the card navigates. */
4
+ export declare function useLinkAddressPreview(enabled?: boolean, onEdit?: () => void): {
5
+ linkProps(href: string, label: string): {
6
+ "aria-controls": string | undefined;
7
+ "aria-keyshortcuts": string;
8
+ onMouseEnter: (event: MouseEvent<HTMLAnchorElement>) => void;
9
+ onMouseLeave: () => void;
10
+ onFocus: (event: FocusEvent<HTMLAnchorElement>) => void;
11
+ onBlur: (event: FocusEvent<HTMLElement>) => void;
12
+ onKeyDown: (event: KeyboardEvent<HTMLAnchorElement>) => void;
13
+ } | {
14
+ "aria-controls"?: undefined;
15
+ "aria-keyshortcuts"?: undefined;
16
+ onMouseEnter?: undefined;
17
+ onMouseLeave?: undefined;
18
+ onFocus?: undefined;
19
+ onBlur?: undefined;
20
+ onKeyDown?: undefined;
21
+ };
22
+ onClick(event: MouseEvent<HTMLAnchorElement>, href: string, label: string): void;
23
+ card: import("react").ReactPortal | null;
24
+ };
@@ -0,0 +1,2 @@
1
+ import type { PendingChangesDialogShellProps } from "./types.js";
2
+ export declare function PendingChangesDialogShell({ children, open, onClose, title, titleIcon, contentHeader, contentTouchHandlers, contentSx, onEntered, closeLabel, }: PendingChangesDialogShellProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { PendingChangesDialogViewProps } from "./types.js";
2
+ export declare function PendingChangesDialogView({ groups, open, onClose, title, summary, emptyMessage, accountKey, onOpenItem, focusGroupKey, navigationError, contentHeader, contentTouchHandlers, shell: Shell, }: PendingChangesDialogViewProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { type SxProps, type Theme } from "@mui/material/styles";
2
+ export type PendingChangesIndicatorViewProps = {
3
+ count: number;
4
+ isOffline?: boolean;
5
+ label?: string;
6
+ explanation?: string;
7
+ onOpen: () => void;
8
+ sx?: SxProps<Theme>;
9
+ };
10
+ export declare function PendingChangesIndicatorView({ count, isOffline, label, explanation, onOpen, sx, }: PendingChangesIndicatorViewProps): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { PendingChangesDialogView } from "./PendingChangesDialogView.js";
2
+ export { PendingChangesIndicatorView, type PendingChangesIndicatorViewProps, } from "./PendingChangesIndicatorView.js";
3
+ export type { PendingChangeRow, PendingChangeViewGroup, PendingChangesDialogViewProps, PendingChangesDialogShellProps, } from "./types.js";
@@ -0,0 +1,48 @@
1
+ import type { ComponentType, HTMLAttributes, ReactNode } from "react";
2
+ import type { SxProps, Theme } from "@mui/material/styles";
3
+ /** Hosts own domain copy, safe navigation and correction editors. */
4
+ export type PendingChangeRow = {
5
+ id: string;
6
+ action?: string;
7
+ exception?: string;
8
+ needsAttention?: boolean;
9
+ targetLabel?: string;
10
+ attemptedText?: string;
11
+ };
12
+ export type PendingChangeViewGroup = {
13
+ key: string;
14
+ title: string;
15
+ rows: readonly PendingChangeRow[];
16
+ openLabel?: string;
17
+ unavailableReason?: string | null;
18
+ };
19
+ export type PendingChangesDialogShellProps = {
20
+ children: ReactNode;
21
+ open: boolean;
22
+ onClose: () => void;
23
+ title: string;
24
+ titleIcon?: ReactNode;
25
+ contentHeader?: ReactNode;
26
+ contentTouchHandlers?: HTMLAttributes<HTMLDivElement>;
27
+ contentSx?: SxProps<Theme>;
28
+ onEntered?: () => void;
29
+ autoFocusInput?: boolean;
30
+ closeLabel?: string;
31
+ closeTooltip?: string;
32
+ exclusive?: boolean;
33
+ };
34
+ export type PendingChangesDialogViewProps = {
35
+ groups: readonly PendingChangeViewGroup[];
36
+ title: string;
37
+ summary: string;
38
+ emptyMessage?: string;
39
+ open: boolean;
40
+ onClose: () => void;
41
+ accountKey?: string | null;
42
+ onOpenItem?: (groupKey: string) => void;
43
+ focusGroupKey?: string | null;
44
+ navigationError?: string | null;
45
+ contentHeader?: ReactNode;
46
+ contentTouchHandlers?: HTMLAttributes<HTMLDivElement>;
47
+ shell?: ComponentType<PendingChangesDialogShellProps>;
48
+ };
@@ -1,11 +1,20 @@
1
1
  import * as React from 'react';
2
2
  import { type EmotionCache } from '@emotion/react';
3
3
  import { ThemeProvider } from '@mui/material/styles';
4
+ export type BayonThemeMode = 'light' | 'dark';
5
+ export interface BayonThemeModeContextValue {
6
+ mode: BayonThemeMode;
7
+ setMode: (mode: BayonThemeMode) => void;
8
+ toggleMode: () => void;
9
+ }
4
10
  export interface BayonThemeProviderProps {
5
11
  children: React.ReactNode;
6
12
  emotionCache?: EmotionCache;
7
13
  disableEmotionCacheProvider?: boolean;
8
14
  theme?: Parameters<typeof ThemeProvider>[0]['theme'];
15
+ defaultMode?: BayonThemeMode;
16
+ storageKey?: string;
9
17
  enableErrorBoundary?: boolean;
10
18
  }
11
- export declare function BayonThemeProvider({ children, emotionCache, disableEmotionCacheProvider, theme, enableErrorBoundary, }: BayonThemeProviderProps): React.JSX.Element;
19
+ export declare function useBayonThemeMode(): BayonThemeModeContextValue;
20
+ export declare function BayonThemeProvider({ children, emotionCache, disableEmotionCacheProvider, theme, defaultMode, storageKey, enableErrorBoundary, }: BayonThemeProviderProps): React.JSX.Element;