@bayonai/mui-design 1.0.0 → 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.
- package/CHANGELOG.md +50 -0
- package/README.md +108 -7
- package/dist/cjs/actions/ActionMenu.js +36 -0
- package/dist/cjs/actions/DialogActionButtons.js +33 -0
- package/dist/cjs/actions/LoadingIconButton.js +10 -0
- package/dist/cjs/actions/StickyActionFooter.js +27 -0
- package/dist/cjs/actions/StickySubmitButton.js +10 -0
- package/dist/cjs/actions/index.js +18 -0
- package/dist/cjs/drawers/BottomDrawer.js +43 -0
- package/dist/cjs/drawers/MobileBottomDrawer.js +102 -0
- package/dist/cjs/drawers/MobileBottomDrawerHeader.js +36 -0
- package/dist/cjs/drawers/ResponsiveDrawer.js +22 -0
- package/dist/cjs/drawers/drawerAppearance.js +10 -0
- package/dist/cjs/drawers/index.js +17 -0
- package/dist/cjs/drawers/useVisualViewportBottomInset.js +33 -0
- package/dist/cjs/feedback/StatusNotice.js +62 -0
- package/dist/cjs/feedback/index.js +7 -0
- package/dist/cjs/links/LinkAddressPreview.js +80 -0
- package/dist/cjs/links/index.js +9 -0
- package/dist/cjs/links/useLinkAddressPreview.js +152 -0
- package/dist/cjs/pending/PendingChangesDialogShell.js +16 -0
- package/dist/cjs/pending/PendingChangesDialogView.js +126 -0
- package/dist/cjs/pending/PendingChangesIndicatorView.js +27 -0
- package/dist/cjs/pending/index.js +9 -0
- package/dist/cjs/pending/types.js +2 -0
- package/dist/cjs/providers/BayonThemeProvider.js +51 -11
- package/dist/cjs/sections/ExpandableSectionToggle.js +32 -0
- package/dist/cjs/sections/index.js +7 -0
- package/dist/cjs/swipe/SwipeActionRow.js +123 -0
- package/dist/cjs/swipe/index.js +8 -0
- package/dist/cjs/toasts/ActionToast.js +12 -0
- package/dist/cjs/toasts/Toast.js +55 -0
- package/dist/cjs/toasts/index.js +12 -0
- package/dist/cjs/toasts/useUpwardToastDismiss.js +73 -0
- package/dist/cjs/uploads/CameraCaptureDialog.js +187 -0
- package/dist/cjs/uploads/FileRow.js +23 -0
- package/dist/cjs/uploads/FileSwipeActionRow.js +11 -0
- package/dist/cjs/uploads/FileThumbnail.js +104 -0
- package/dist/cjs/uploads/FileUpload.js +98 -0
- package/dist/cjs/uploads/FileViewer.js +151 -0
- package/dist/cjs/uploads/ImageCropDialog.js +215 -0
- package/dist/cjs/uploads/UploadProgressRing.js +32 -0
- package/dist/cjs/uploads/cameraCropPresentation.js +12 -0
- package/dist/cjs/uploads/index.js +20 -0
- package/dist/esm/actions/ActionMenu.js +30 -0
- package/dist/esm/actions/DialogActionButtons.js +24 -0
- package/dist/esm/actions/LoadingIconButton.js +7 -0
- package/dist/esm/actions/StickyActionFooter.js +24 -0
- package/dist/esm/actions/StickySubmitButton.js +7 -0
- package/dist/esm/actions/index.js +7 -0
- package/dist/esm/drawers/BottomDrawer.js +37 -0
- package/dist/esm/drawers/MobileBottomDrawer.js +95 -0
- package/dist/esm/drawers/MobileBottomDrawerHeader.js +30 -0
- package/dist/esm/drawers/ResponsiveDrawer.js +19 -0
- package/dist/esm/drawers/drawerAppearance.js +7 -0
- package/dist/esm/drawers/index.js +7 -0
- package/dist/esm/drawers/useVisualViewportBottomInset.js +29 -0
- package/dist/esm/feedback/StatusNotice.js +56 -0
- package/dist/esm/feedback/index.js +3 -0
- package/dist/esm/links/LinkAddressPreview.js +74 -0
- package/dist/esm/links/index.js +4 -0
- package/dist/esm/links/useLinkAddressPreview.js +149 -0
- package/dist/esm/pending/PendingChangesDialogShell.js +10 -0
- package/dist/esm/pending/PendingChangesDialogView.js +120 -0
- package/dist/esm/pending/PendingChangesIndicatorView.js +21 -0
- package/dist/esm/pending/index.js +4 -0
- package/dist/esm/pending/types.js +1 -0
- package/dist/esm/providers/BayonThemeProvider.js +51 -11
- package/dist/esm/sections/ExpandableSectionToggle.js +26 -0
- package/dist/esm/sections/index.js +3 -0
- package/dist/esm/swipe/SwipeActionRow.js +116 -0
- package/dist/esm/swipe/index.js +3 -0
- package/dist/esm/toasts/ActionToast.js +9 -0
- package/dist/esm/toasts/Toast.js +52 -0
- package/dist/esm/toasts/index.js +5 -0
- package/dist/esm/toasts/useUpwardToastDismiss.js +69 -0
- package/dist/esm/uploads/CameraCaptureDialog.js +181 -0
- package/dist/esm/uploads/FileRow.js +17 -0
- package/dist/esm/uploads/FileSwipeActionRow.js +7 -0
- package/dist/esm/uploads/FileThumbnail.js +98 -0
- package/dist/esm/uploads/FileUpload.js +92 -0
- package/dist/esm/uploads/FileViewer.js +145 -0
- package/dist/esm/uploads/ImageCropDialog.js +212 -0
- package/dist/esm/uploads/UploadProgressRing.js +29 -0
- package/dist/esm/uploads/cameraCropPresentation.js +5 -0
- package/dist/esm/uploads/index.js +9 -0
- package/dist/types/actions/ActionMenu.d.ts +24 -0
- package/dist/types/actions/DialogActionButtons.d.ts +22 -0
- package/dist/types/actions/LoadingIconButton.d.ts +11 -0
- package/dist/types/actions/StickyActionFooter.d.ts +14 -0
- package/dist/types/actions/StickySubmitButton.d.ts +10 -0
- package/dist/types/actions/index.d.ts +5 -0
- package/dist/types/drawers/BottomDrawer.d.ts +16 -0
- package/dist/types/drawers/MobileBottomDrawer.d.ts +20 -0
- package/dist/types/drawers/MobileBottomDrawerHeader.d.ts +11 -0
- package/dist/types/drawers/ResponsiveDrawer.d.ts +25 -0
- package/dist/types/drawers/drawerAppearance.d.ts +8 -0
- package/dist/types/drawers/index.d.ts +6 -0
- package/dist/types/drawers/useVisualViewportBottomInset.d.ts +6 -0
- package/dist/types/feedback/StatusNotice.d.ts +13 -0
- package/dist/types/feedback/index.d.ts +1 -0
- package/dist/types/links/LinkAddressPreview.d.ts +19 -0
- package/dist/types/links/index.d.ts +3 -0
- package/dist/types/links/useLinkAddressPreview.d.ts +24 -0
- package/dist/types/pending/PendingChangesDialogShell.d.ts +2 -0
- package/dist/types/pending/PendingChangesDialogView.d.ts +2 -0
- package/dist/types/pending/PendingChangesIndicatorView.d.ts +10 -0
- package/dist/types/pending/index.d.ts +3 -0
- package/dist/types/pending/types.d.ts +48 -0
- package/dist/types/sections/ExpandableSectionToggle.d.ts +12 -0
- package/dist/types/sections/index.d.ts +2 -0
- package/dist/types/swipe/SwipeActionRow.d.ts +8 -0
- package/dist/types/swipe/index.d.ts +1 -0
- package/dist/types/toasts/ActionToast.d.ts +11 -0
- package/dist/types/toasts/Toast.d.ts +16 -0
- package/dist/types/toasts/index.d.ts +5 -0
- package/dist/types/toasts/useUpwardToastDismiss.d.ts +15 -0
- package/dist/types/uploads/CameraCaptureDialog.d.ts +22 -0
- package/dist/types/uploads/FileRow.d.ts +10 -0
- package/dist/types/uploads/FileSwipeActionRow.d.ts +1 -0
- package/dist/types/uploads/FileThumbnail.d.ts +5 -0
- package/dist/types/uploads/FileUpload.d.ts +26 -0
- package/dist/types/uploads/FileViewer.d.ts +9 -0
- package/dist/types/uploads/ImageCropDialog.d.ts +26 -0
- package/dist/types/uploads/UploadProgressRing.d.ts +24 -0
- package/dist/types/uploads/cameraCropPresentation.d.ts +2 -0
- package/dist/types/uploads/index.d.ts +10 -0
- package/docs/camera-crop-contract.md +50 -0
- package/docs/uploads-contract.md +40 -0
- package/package.json +110 -48
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { type ToastProps } from "./Toast.js";
|
|
3
|
+
export type ActionToastProps = Omit<ToastProps, "children"> & {
|
|
4
|
+
message: ReactNode;
|
|
5
|
+
actionLabel: string;
|
|
6
|
+
actionAriaLabel: string;
|
|
7
|
+
onAction: () => void;
|
|
8
|
+
actionDisabled?: boolean;
|
|
9
|
+
ToastComponent?: ComponentType<ToastProps>;
|
|
10
|
+
};
|
|
11
|
+
export declare function ActionToast({ message, actionLabel, actionAriaLabel, onAction, actionDisabled, ToastComponent, ...toastProps }: ActionToastProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SxProps, type Theme } from "@mui/material";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type ToastProps = {
|
|
4
|
+
mobileTopOffset?: number | string;
|
|
5
|
+
mobileBottomOffset?: number | string;
|
|
6
|
+
ariaLive?: "assertive" | "polite";
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
contained?: boolean;
|
|
9
|
+
dataComponent?: string;
|
|
10
|
+
onDismiss?: () => void;
|
|
11
|
+
placement?: "bottom-end" | "top-center";
|
|
12
|
+
role?: "alert" | "status";
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
variant?: "standard" | "unstyled";
|
|
15
|
+
};
|
|
16
|
+
export declare function Toast({ ariaLive, mobileTopOffset, mobileBottomOffset, children, contained, dataComponent, onDismiss, placement, role, sx, variant, }: ToastProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Toast } from "./Toast.js";
|
|
2
|
+
export type { ToastProps } from "./Toast.js";
|
|
3
|
+
export { ActionToast } from "./ActionToast.js";
|
|
4
|
+
export type { ActionToastProps } from "./ActionToast.js";
|
|
5
|
+
export { useUpwardToastDismiss, TOAST_UPWARD_DISMISS_DISTANCE_PX, } from "./useUpwardToastDismiss.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SxProps, Theme } from "@mui/material";
|
|
2
|
+
import { type PointerEvent } from "react";
|
|
3
|
+
export declare const TOAST_UPWARD_DISMISS_DISTANCE_PX = 64;
|
|
4
|
+
export declare function useUpwardToastDismiss({ onDismiss, transform, }: {
|
|
5
|
+
onDismiss?: () => void;
|
|
6
|
+
transform: string;
|
|
7
|
+
}): {
|
|
8
|
+
pointerHandlers: {
|
|
9
|
+
onPointerCancel: () => void;
|
|
10
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
11
|
+
onPointerMove: (event: PointerEvent<HTMLElement>) => void;
|
|
12
|
+
onPointerUp: (event: PointerEvent<HTMLElement>) => void;
|
|
13
|
+
} | undefined;
|
|
14
|
+
sx: SxProps<Theme> | undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CameraCaptureLabels = {
|
|
2
|
+
title: string;
|
|
3
|
+
close: string;
|
|
4
|
+
preview: string;
|
|
5
|
+
capture: string;
|
|
6
|
+
opening: string;
|
|
7
|
+
ready: string;
|
|
8
|
+
denied: string;
|
|
9
|
+
unavailable: string;
|
|
10
|
+
previewError: string;
|
|
11
|
+
captureError: string;
|
|
12
|
+
};
|
|
13
|
+
export type CameraCaptureDialogProps = {
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onCapture: (file: File) => void;
|
|
16
|
+
labels?: Partial<CameraCaptureLabels>;
|
|
17
|
+
facingMode?: VideoFacingModeEnum;
|
|
18
|
+
fileName?: string;
|
|
19
|
+
previewMaxHeight?: string | number;
|
|
20
|
+
};
|
|
21
|
+
/** Owns camera resources only; the host owns crop, upload and persistence. */
|
|
22
|
+
export declare function CameraCaptureDialog({ onClose, onCapture, labels, facingMode, fileName, previewMaxHeight, }: CameraCaptureDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { UploadFile } from "@bayonai/file-uploads";
|
|
3
|
+
export declare function FileRow<T extends UploadFile>({ attachment, canDelete, onDelete, onPreview, thumbnail, sizeLabel, }: {
|
|
4
|
+
attachment: T;
|
|
5
|
+
canDelete: boolean;
|
|
6
|
+
onDelete: (file: T) => void;
|
|
7
|
+
onPreview: (file: T) => void;
|
|
8
|
+
thumbnail: ReactNode;
|
|
9
|
+
sizeLabel: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwipeActionRow } from "../swipe/SwipeActionRow.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode, type ComponentType } from "react";
|
|
2
|
+
import type { UploadFile } from "@bayonai/file-uploads";
|
|
3
|
+
export declare function FileUpload<T extends UploadFile>({ attachments, canUpload, onUploadAttachment, label, accept, errorMessage, renderFile, renderViewer, RowShell, FieldIcon, colors, }: {
|
|
4
|
+
attachments: T[];
|
|
5
|
+
canUpload?: boolean;
|
|
6
|
+
onUploadAttachment: (file: File) => Promise<void> | void;
|
|
7
|
+
label: string;
|
|
8
|
+
accept: string;
|
|
9
|
+
errorMessage: (error: unknown) => string | null;
|
|
10
|
+
renderFile: (file: T, onPreview: (file: T) => void) => ReactNode;
|
|
11
|
+
renderViewer: (file: T | null, onClose: () => void) => ReactNode;
|
|
12
|
+
RowShell: ComponentType<{
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
hasBottomBorder?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
FieldIcon: ComponentType<{
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
onClick?: () => void;
|
|
20
|
+
}>;
|
|
21
|
+
colors: {
|
|
22
|
+
text: string;
|
|
23
|
+
divider: string;
|
|
24
|
+
transition: string;
|
|
25
|
+
};
|
|
26
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LoadFile, UploadFile } from "@bayonai/file-uploads";
|
|
2
|
+
type FileViewerProps<T extends UploadFile> = {
|
|
3
|
+
attachment: T | null;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
loadFile: LoadFile<T>;
|
|
6
|
+
onDownload: (file: T) => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function FileViewer<T extends UploadFile>(props: FileViewerProps<T>): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ImageCrop } from "@bayonai/file-uploads";
|
|
2
|
+
export type ImageCropLabels = {
|
|
3
|
+
title: string;
|
|
4
|
+
close: string;
|
|
5
|
+
preview: string;
|
|
6
|
+
confirm: string;
|
|
7
|
+
opening: string;
|
|
8
|
+
instruction: string;
|
|
9
|
+
zoom: string;
|
|
10
|
+
horizontal: string;
|
|
11
|
+
vertical: string;
|
|
12
|
+
decodeError: string;
|
|
13
|
+
previewError: string;
|
|
14
|
+
};
|
|
15
|
+
export type ImageCropDialogProps = {
|
|
16
|
+
file: File;
|
|
17
|
+
busy: boolean;
|
|
18
|
+
error: string | null;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
onConfirm: (crop: ImageCrop) => Promise<void>;
|
|
21
|
+
labels?: Partial<ImageCropLabels>;
|
|
22
|
+
previewShape?: "circle" | "square";
|
|
23
|
+
previewWidth?: string | number;
|
|
24
|
+
};
|
|
25
|
+
/** Emits orientation-correct decoded-pixel coordinates; the host persists them. */
|
|
26
|
+
export declare function ImageCropDialog({ file, busy, error, onClose, onConfirm, labels, previewShape, previewWidth, }: ImageCropDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SxProps, type Theme } from "@mui/material";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type UploadProgressRingProps = {
|
|
4
|
+
/** The interactive upload target, such as an avatar picker. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** A short accessible description of the in-flight upload. */
|
|
7
|
+
progressLabel: string;
|
|
8
|
+
/** `null` hides the ring; supplied values are clamped to the valid 0–100 range. */
|
|
9
|
+
progress: number | null;
|
|
10
|
+
/** The diameter of the target and progress ring. */
|
|
11
|
+
size?: number;
|
|
12
|
+
/** The MUI circular-progress stroke width. */
|
|
13
|
+
thickness?: number;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Presents determinate upload progress at the object being changed.
|
|
18
|
+
*
|
|
19
|
+
* Product decision: progress belongs with a compact upload target rather than
|
|
20
|
+
* in a separate status row. The host owns file selection, upload lifecycle,
|
|
21
|
+
* validation, errors, and disabled interaction; this primitive only renders
|
|
22
|
+
* the accessible visual state around its child.
|
|
23
|
+
*/
|
|
24
|
+
export declare function UploadProgressRing({ children, progress, progressLabel, size, sx, thickness, }: UploadProgressRingProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { FileUpload } from "./FileUpload.js";
|
|
2
|
+
export { FileRow } from "./FileRow.js";
|
|
3
|
+
export { FileThumbnail } from "./FileThumbnail.js";
|
|
4
|
+
export { FileViewer } from "./FileViewer.js";
|
|
5
|
+
export { UploadProgressRing } from "./UploadProgressRing.js";
|
|
6
|
+
export { useUploadLock } from "@bayonai/file-uploads/hooks";
|
|
7
|
+
export type { UploadFile, LoadFile } from "@bayonai/file-uploads";
|
|
8
|
+
export type { UploadProgressRingProps } from "./UploadProgressRing.js";
|
|
9
|
+
export { CameraCaptureDialog, type CameraCaptureDialogProps, type CameraCaptureLabels } from "./CameraCaptureDialog.js";
|
|
10
|
+
export { ImageCropDialog, type ImageCropDialogProps, type ImageCropLabels } from "./ImageCropDialog.js";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Camera and crop ownership contract
|
|
2
|
+
|
|
3
|
+
TL-M251 moves the existing camera and crop presentation into the client-only
|
|
4
|
+
`@bayonai/mui-design/uploads` entry. This is an ownership/import migration;
|
|
5
|
+
component bodies and behavioral tests are preserved. The unpublished MUI
|
|
6
|
+
candidate stays at 1.1.0 and the paired neutral file-uploads candidate at 0.2.0.
|
|
7
|
+
|
|
8
|
+
## Ownership and migration
|
|
9
|
+
|
|
10
|
+
Replace `@bayonai/file-uploads/react` with `@bayonai/mui-design/uploads` for
|
|
11
|
+
`CameraCaptureDialog`, `ImageCropDialog`, `CameraCaptureDialogProps`,
|
|
12
|
+
`ImageCropDialogProps`, `CameraCaptureLabels` and `ImageCropLabels`.
|
|
13
|
+
The neutral file package removes `/react`. Crop geometry, framing math and
|
|
14
|
+
`ImageCrop` remain in `@bayonai/file-uploads`; React upload locking stays in
|
|
15
|
+
`@bayonai/file-uploads/hooks`. There is no reverse dependency from file-uploads
|
|
16
|
+
into mui-design and no new persistence, transfer or storage policy.
|
|
17
|
+
|
|
18
|
+
## Preserved flows and decisions
|
|
19
|
+
|
|
20
|
+
The camera dialog owns camera resources; the host receives a File and owns
|
|
21
|
+
subsequent crop, upload and persistence. Preserve permission errors, supported
|
|
22
|
+
constraint fallback, preview loading, capture failures, generation fences,
|
|
23
|
+
late-resolving stream disposal, and track cleanup on closure/unmount. Labels,
|
|
24
|
+
facing mode, capture filename and preview sizing retain their existing props.
|
|
25
|
+
|
|
26
|
+
The crop dialog decodes the selected photo, renders a preview and emits
|
|
27
|
+
orientation-correct decoded-pixel coordinates. The host controls busy/error
|
|
28
|
+
state and persistence. Preserve zoom, horizontal/vertical framing, pointer
|
|
29
|
+
capture and drag behavior, stale decode handling, bitmap disposal and object URL
|
|
30
|
+
cleanup. No upload occurs merely by selecting or framing a photo.
|
|
31
|
+
|
|
32
|
+
Both dialogs inherit the host MUI theme. `cameraCropPresentation.ts` delegates to
|
|
33
|
+
canonical `DialogActionButtons`, `DialogActionProgress`, `DialogCloseButton` and
|
|
34
|
+
`StatusNotice`; it contains no duplicate presentation implementation. The public
|
|
35
|
+
entry retains its client boundary and ESM/CommonJS/declaration build paths.
|
|
36
|
+
|
|
37
|
+
## Behavioral evidence and release gates
|
|
38
|
+
|
|
39
|
+
- [Camera suite](../tests/uploads/CameraCaptureDialog.test.tsx): permissions,
|
|
40
|
+
fallback, preview/capture errors, stream lifecycle and stale continuations.
|
|
41
|
+
- [Crop suite](../tests/uploads/ImageCropDialog.test.tsx): accessible framing,
|
|
42
|
+
decoding, confirmation, pointer interaction and resource lifecycle.
|
|
43
|
+
|
|
44
|
+
These are the existing suites moved with import changes only. Release validation
|
|
45
|
+
must run them alongside shared action/feedback and host-theme coverage, package
|
|
46
|
+
build/typechecks, packed ESM/CommonJS/types imports and affected consumers.
|
|
47
|
+
The development archive is `vendor/bayonai-file-uploads-0.2.0-neutral.tgz`.
|
|
48
|
+
External consumers retain existing exact versions until the owner publishes and
|
|
49
|
+
verifies the paired candidates. This relocation authorizes no publication or
|
|
50
|
+
deployment.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Upload presentation ownership (TL-M250)
|
|
2
|
+
|
|
3
|
+
`@bayonai/mui-design/uploads` owns the existing MUI presentation. The five public
|
|
4
|
+
components retain their original props, callbacks and rendering flow. Contracts
|
|
5
|
+
`UploadFile` and `LoadFile` belong to `@bayonai/file-uploads`; `useUploadLock`
|
|
6
|
+
belongs to its React-only `/hooks` entry. Compatibility reexports do not create
|
|
7
|
+
another implementation. Uploads uses the host's MUI/Emotion provider.
|
|
8
|
+
|
|
9
|
+
Source was copied from the preserved Bounded upload snapshot at
|
|
10
|
+
`/Users/snicklet/.codex/backups/bounded-TL-M250-upload-move/bounded/working/packages/ui/src/uploads`.
|
|
11
|
+
The five public component implementations change only import ownership and local
|
|
12
|
+
`.js` specifiers. Keep authenticated blob loading, abort signals, stale-result
|
|
13
|
+
protection, owned object-URL revocation, preview sandboxing, download behavior,
|
|
14
|
+
error handling and accepted upload concurrency semantics intact.
|
|
15
|
+
|
|
16
|
+
The private FileSwipeActionRow delegates the existing MUI SwipeActionRow. The
|
|
17
|
+
previous styled native adapter supplied error.main/common.white delete colors,
|
|
18
|
+
spacing(2), background.paper content, the Delete icon/label, 160ms
|
|
19
|
+
cubic-bezier(0.2, 0, 0, 1) easing and reduced-motion disabling. The existing MUI
|
|
20
|
+
row already supplies each value. Both gesture contracts use 12px direction lock,
|
|
21
|
+
72px deletion distance, 104px maximum travel, pan-y, touch cancellation and click
|
|
22
|
+
suppression. Sharing the MUI implementation preserves these decisions without
|
|
23
|
+
adding gesture code or a dependency on `@bayonai/ui`.
|
|
24
|
+
|
|
25
|
+
Behavioral coverage: `tests/uploads/FileUpload.test.tsx`,
|
|
26
|
+
`FileThumbnail.test.tsx`, `FileViewer.test.tsx`, `FileViewer.lifecycle.test.tsx`,
|
|
27
|
+
`UploadProgressRing.test.tsx`, `uploads.theme.test.tsx`, plus shared
|
|
28
|
+
`tests/swipe/SwipeActionRow.test.tsx`. The theme test verifies host palette values
|
|
29
|
+
on the file swipe surfaces and a host CircularProgress component override.
|
|
30
|
+
Release verification must run these tests and packed ESM/CommonJS/declaration
|
|
31
|
+
checks with file-uploads 0.2.0 before publishing mui-design 1.1.0. External
|
|
32
|
+
consumers migrate only after publication; see README for exact import mapping.
|
|
33
|
+
|
|
34
|
+
## Thumbnail failure recovery (TL-M252)
|
|
35
|
+
|
|
36
|
+
A host loader that throws synchronously or rejects its promise reaches the same
|
|
37
|
+
logged inert thumbnail fallback. A successful current load supersedes any prior
|
|
38
|
+
failure for that source; aborted/stale attempts cannot update presentation or
|
|
39
|
+
create retained preview URLs. The host still owns retry initiation through its
|
|
40
|
+
loader/attachment updates. Regression coverage is in FileThumbnail.test.tsx.
|
package/package.json
CHANGED
|
@@ -1,48 +1,110 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bayonai/mui-design",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Shared Bayon AI Material UI theme, style recipes, and reusable design components.",
|
|
5
|
-
"license": "UNLICENSED",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "./dist/cjs/index.js",
|
|
8
|
-
"module": "./dist/esm/index.js",
|
|
9
|
-
"types": "./dist/types/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./dist/types/index.d.ts",
|
|
13
|
-
"import": "./dist/esm/index.js",
|
|
14
|
-
"require": "./dist/cjs/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./client": {
|
|
17
|
-
"types": "./dist/types/client.d.ts",
|
|
18
|
-
"import": "./dist/esm/client.js",
|
|
19
|
-
"require": "./dist/cjs/client.js"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bayonai/mui-design",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Shared Bayon AI Material UI theme, style recipes, and reusable design components.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/cjs/index.js",
|
|
8
|
+
"module": "./dist/esm/index.js",
|
|
9
|
+
"types": "./dist/types/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"require": "./dist/cjs/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./client": {
|
|
17
|
+
"types": "./dist/types/client.d.ts",
|
|
18
|
+
"import": "./dist/esm/client.js",
|
|
19
|
+
"require": "./dist/cjs/client.js"
|
|
20
|
+
},
|
|
21
|
+
"./actions": {
|
|
22
|
+
"types": "./dist/types/actions/index.d.ts",
|
|
23
|
+
"import": "./dist/esm/actions/index.js",
|
|
24
|
+
"require": "./dist/cjs/actions/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./drawers": {
|
|
27
|
+
"types": "./dist/types/drawers/index.d.ts",
|
|
28
|
+
"import": "./dist/esm/drawers/index.js",
|
|
29
|
+
"require": "./dist/cjs/drawers/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./feedback": {
|
|
32
|
+
"types": "./dist/types/feedback/index.d.ts",
|
|
33
|
+
"import": "./dist/esm/feedback/index.js",
|
|
34
|
+
"require": "./dist/cjs/feedback/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./links": {
|
|
37
|
+
"types": "./dist/types/links/index.d.ts",
|
|
38
|
+
"import": "./dist/esm/links/index.js",
|
|
39
|
+
"require": "./dist/cjs/links/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./pending": {
|
|
42
|
+
"types": "./dist/types/pending/index.d.ts",
|
|
43
|
+
"import": "./dist/esm/pending/index.js",
|
|
44
|
+
"require": "./dist/cjs/pending/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./sections": {
|
|
47
|
+
"types": "./dist/types/sections/index.d.ts",
|
|
48
|
+
"import": "./dist/esm/sections/index.js",
|
|
49
|
+
"require": "./dist/cjs/sections/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./swipe": {
|
|
52
|
+
"types": "./dist/types/swipe/index.d.ts",
|
|
53
|
+
"import": "./dist/esm/swipe/index.js",
|
|
54
|
+
"require": "./dist/cjs/swipe/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./toasts": {
|
|
57
|
+
"types": "./dist/types/toasts/index.d.ts",
|
|
58
|
+
"import": "./dist/esm/toasts/index.js",
|
|
59
|
+
"require": "./dist/cjs/toasts/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./uploads": {
|
|
62
|
+
"types": "./dist/types/uploads/index.d.ts",
|
|
63
|
+
"import": "./dist/esm/uploads/index.js",
|
|
64
|
+
"require": "./dist/cjs/uploads/index.js"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"files": [
|
|
68
|
+
"dist",
|
|
69
|
+
"README.md",
|
|
70
|
+
"CHANGELOG.md",
|
|
71
|
+
"docs",
|
|
72
|
+
"docs/uploads-contract.md"
|
|
73
|
+
],
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
79
|
+
"build": "npm run clean && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && tsc -p tsconfig.types.json && node scripts/rename-cjs.cjs",
|
|
80
|
+
"typecheck": "tsc -p tsconfig.types.json --noEmit",
|
|
81
|
+
"test": "vitest run --config vitest.config.mts"
|
|
82
|
+
},
|
|
83
|
+
"peerDependencies": {
|
|
84
|
+
"@emotion/cache": "^11.14.0",
|
|
85
|
+
"@emotion/react": "^11.14.0",
|
|
86
|
+
"@emotion/styled": "^11.14.0",
|
|
87
|
+
"@mui/icons-material": "^9.2.0",
|
|
88
|
+
"@mui/material": "^9.2.0",
|
|
89
|
+
"react": "^19.0.0",
|
|
90
|
+
"react-dom": "^19.0.0",
|
|
91
|
+
"@bayonai/file-uploads": "^0.2.0"
|
|
92
|
+
},
|
|
93
|
+
"devDependencies": {
|
|
94
|
+
"typescript": "^5",
|
|
95
|
+
"@bayonai/file-uploads": "file:../../vendor/bayonai-file-uploads-0.2.0-neutral.tgz",
|
|
96
|
+
"react": "19.3.1",
|
|
97
|
+
"react-dom": "19.3.1",
|
|
98
|
+
"react-test-renderer": "19.3.1",
|
|
99
|
+
"@types/react": "^19.3.0",
|
|
100
|
+
"@types/react-dom": "^19.3.0",
|
|
101
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
102
|
+
"vitest": "^5.0.5",
|
|
103
|
+
"happy-dom": "^20.14.5"
|
|
104
|
+
},
|
|
105
|
+
"peerDependenciesMeta": {
|
|
106
|
+
"@bayonai/file-uploads": {
|
|
107
|
+
"optional": true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|