@bayonai/mui-design 1.8.0 → 1.10.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 +10 -0
- package/README.md +26 -0
- package/package.json +1 -1
- package/dist/cjs/actions/ActionMenu.d.ts +0 -24
- package/dist/cjs/actions/ActionMenu.js +0 -36
- package/dist/cjs/actions/DialogActionButtons.d.ts +0 -23
- package/dist/cjs/actions/DialogActionButtons.js +0 -33
- package/dist/cjs/actions/LoadingIconButton.d.ts +0 -11
- package/dist/cjs/actions/LoadingIconButton.js +0 -10
- package/dist/cjs/actions/StickyActionFooter.d.ts +0 -14
- package/dist/cjs/actions/StickyActionFooter.js +0 -27
- package/dist/cjs/actions/StickySubmitButton.d.ts +0 -10
- package/dist/cjs/actions/StickySubmitButton.js +0 -10
- package/dist/cjs/actions/index.d.ts +0 -5
- package/dist/cjs/actions/index.js +0 -18
- package/dist/cjs/client.d.ts +0 -4
- package/dist/cjs/client.js +0 -21
- package/dist/cjs/components/BayonFlowVisual.d.ts +0 -12
- package/dist/cjs/components/BayonFlowVisual.js +0 -87
- package/dist/cjs/components/BayonThemeModeToggle.d.ts +0 -6
- package/dist/cjs/components/BayonThemeModeToggle.js +0 -34
- package/dist/cjs/components/IconTooltipButton.d.ts +0 -10
- package/dist/cjs/components/IconTooltipButton.js +0 -50
- package/dist/cjs/components/panels.d.ts +0 -37
- package/dist/cjs/components/panels.js +0 -92
- package/dist/cjs/drawers/BottomDrawer.d.ts +0 -16
- package/dist/cjs/drawers/BottomDrawer.js +0 -43
- package/dist/cjs/drawers/MobileBottomDrawer.d.ts +0 -20
- package/dist/cjs/drawers/MobileBottomDrawer.js +0 -102
- package/dist/cjs/drawers/MobileBottomDrawerHeader.d.ts +0 -11
- package/dist/cjs/drawers/MobileBottomDrawerHeader.js +0 -36
- package/dist/cjs/drawers/ResponsiveDrawer.d.ts +0 -25
- package/dist/cjs/drawers/ResponsiveDrawer.js +0 -22
- package/dist/cjs/drawers/WorkspaceSidePane.d.ts +0 -25
- package/dist/cjs/drawers/WorkspaceSidePane.js +0 -206
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.d.ts +0 -1
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.js +0 -93
- package/dist/cjs/drawers/drawerAppearance.d.ts +0 -8
- package/dist/cjs/drawers/drawerAppearance.js +0 -10
- package/dist/cjs/drawers/index.d.ts +0 -7
- package/dist/cjs/drawers/index.js +0 -19
- package/dist/cjs/drawers/useVisualViewportBottomInset.d.ts +0 -6
- package/dist/cjs/drawers/useVisualViewportBottomInset.js +0 -33
- package/dist/cjs/drawers/workspaceSidePaneGeometry.d.ts +0 -11
- package/dist/cjs/drawers/workspaceSidePaneGeometry.js +0 -15
- package/dist/cjs/feedback/StatusNotice.d.ts +0 -13
- package/dist/cjs/feedback/StatusNotice.js +0 -62
- package/dist/cjs/feedback/index.d.ts +0 -1
- package/dist/cjs/feedback/index.js +0 -7
- package/dist/cjs/index.d.ts +0 -9
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/internal/DialogChoiceTile.d.ts +0 -20
- package/dist/cjs/internal/DialogChoiceTile.js +0 -60
- package/dist/cjs/links/LinkAddressPreview.d.ts +0 -19
- package/dist/cjs/links/LinkAddressPreview.js +0 -80
- package/dist/cjs/links/index.d.ts +0 -3
- package/dist/cjs/links/index.js +0 -9
- package/dist/cjs/links/useLinkAddressPreview.d.ts +0 -26
- package/dist/cjs/links/useLinkAddressPreview.js +0 -162
- package/dist/cjs/location/GeographicLocationField.d.ts +0 -26
- package/dist/cjs/location/GeographicLocationField.js +0 -49
- package/dist/cjs/location/GoogleMapsAttribution.d.ts +0 -1
- package/dist/cjs/location/GoogleMapsAttribution.js +0 -12
- package/dist/cjs/location/MetadataFieldGroup.d.ts +0 -5
- package/dist/cjs/location/MetadataFieldGroup.js +0 -13
- package/dist/cjs/location/MetadataValueField.d.ts +0 -23
- package/dist/cjs/location/MetadataValueField.js +0 -27
- package/dist/cjs/location/SearchInputAction.d.ts +0 -9
- package/dist/cjs/location/SearchInputAction.js +0 -14
- package/dist/cjs/location/TemplateBadge.d.ts +0 -5
- package/dist/cjs/location/TemplateBadge.js +0 -9
- package/dist/cjs/location/VenueSearchDialog.d.ts +0 -33
- package/dist/cjs/location/VenueSearchDialog.js +0 -112
- package/dist/cjs/location/index.d.ts +0 -6
- package/dist/cjs/location/index.js +0 -20
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/pending/PendingChangesDialogShell.d.ts +0 -2
- package/dist/cjs/pending/PendingChangesDialogShell.js +0 -16
- package/dist/cjs/pending/PendingChangesDialogView.d.ts +0 -2
- package/dist/cjs/pending/PendingChangesDialogView.js +0 -140
- package/dist/cjs/pending/PendingChangesIndicatorView.d.ts +0 -10
- package/dist/cjs/pending/PendingChangesIndicatorView.js +0 -27
- package/dist/cjs/pending/index.d.ts +0 -3
- package/dist/cjs/pending/index.js +0 -9
- package/dist/cjs/pending/types.d.ts +0 -55
- package/dist/cjs/pending/types.js +0 -2
- package/dist/cjs/pricing/PlanUpgradeDialog.d.ts +0 -17
- package/dist/cjs/pricing/PlanUpgradeDialog.js +0 -22
- package/dist/cjs/pricing/PricingTable.d.ts +0 -28
- package/dist/cjs/pricing/PricingTable.js +0 -60
- package/dist/cjs/pricing/index.d.ts +0 -3
- package/dist/cjs/pricing/index.js +0 -8
- package/dist/cjs/providers/BayonThemeProvider.d.ts +0 -20
- package/dist/cjs/providers/BayonThemeProvider.js +0 -163
- package/dist/cjs/sections/ExpandableSectionToggle.d.ts +0 -12
- package/dist/cjs/sections/ExpandableSectionToggle.js +0 -32
- package/dist/cjs/sections/index.d.ts +0 -2
- package/dist/cjs/sections/index.js +0 -7
- package/dist/cjs/styles/pageStyles.d.ts +0 -15
- package/dist/cjs/styles/pageStyles.js +0 -103
- package/dist/cjs/swipe/SwipeActionRow.d.ts +0 -8
- package/dist/cjs/swipe/SwipeActionRow.js +0 -123
- package/dist/cjs/swipe/index.d.ts +0 -1
- package/dist/cjs/swipe/index.js +0 -8
- package/dist/cjs/theme/components.d.ts +0 -2
- package/dist/cjs/theme/components.js +0 -123
- package/dist/cjs/theme/createBayonTheme.d.ts +0 -4
- package/dist/cjs/theme/createBayonTheme.js +0 -45
- package/dist/cjs/theme/palette.d.ts +0 -146
- package/dist/cjs/theme/palette.js +0 -109
- package/dist/cjs/theme/shadows.d.ts +0 -2
- package/dist/cjs/theme/shadows.js +0 -21
- package/dist/cjs/theme/types.d.ts +0 -47
- package/dist/cjs/theme/types.js +0 -2
- package/dist/cjs/theme/typography.d.ts +0 -2
- package/dist/cjs/theme/typography.js +0 -58
- package/dist/cjs/toasts/ActionToast.d.ts +0 -11
- package/dist/cjs/toasts/ActionToast.js +0 -12
- package/dist/cjs/toasts/Toast.d.ts +0 -16
- package/dist/cjs/toasts/Toast.js +0 -55
- package/dist/cjs/toasts/index.d.ts +0 -5
- package/dist/cjs/toasts/index.js +0 -12
- package/dist/cjs/toasts/useUpwardToastDismiss.d.ts +0 -15
- package/dist/cjs/toasts/useUpwardToastDismiss.js +0 -73
- package/dist/cjs/uploads/CameraCaptureDialog.d.ts +0 -22
- package/dist/cjs/uploads/CameraCaptureDialog.js +0 -187
- package/dist/cjs/uploads/FileRow.d.ts +0 -10
- package/dist/cjs/uploads/FileRow.js +0 -23
- package/dist/cjs/uploads/FileSwipeActionRow.d.ts +0 -1
- package/dist/cjs/uploads/FileSwipeActionRow.js +0 -11
- package/dist/cjs/uploads/FileThumbnail.d.ts +0 -5
- package/dist/cjs/uploads/FileThumbnail.js +0 -104
- package/dist/cjs/uploads/FileUpload.d.ts +0 -26
- package/dist/cjs/uploads/FileUpload.js +0 -98
- package/dist/cjs/uploads/FileViewer.d.ts +0 -9
- package/dist/cjs/uploads/FileViewer.js +0 -155
- package/dist/cjs/uploads/ImageCropDialog.d.ts +0 -26
- package/dist/cjs/uploads/ImageCropDialog.js +0 -215
- package/dist/cjs/uploads/ImageInfoPanel.d.ts +0 -24
- package/dist/cjs/uploads/ImageInfoPanel.js +0 -41
- package/dist/cjs/uploads/ImageUploadQualityDialog.d.ts +0 -13
- package/dist/cjs/uploads/ImageUploadQualityDialog.js +0 -57
- package/dist/cjs/uploads/UploadProgressRing.d.ts +0 -24
- package/dist/cjs/uploads/UploadProgressRing.js +0 -32
- package/dist/cjs/uploads/cameraCropPresentation.d.ts +0 -2
- package/dist/cjs/uploads/cameraCropPresentation.js +0 -12
- package/dist/cjs/uploads/index.d.ts +0 -12
- package/dist/cjs/uploads/index.js +0 -24
- package/dist/cjs/utils/createBayonEmotionCache.d.ts +0 -1
- package/dist/cjs/utils/createBayonEmotionCache.js +0 -21
- package/dist/esm/actions/ActionMenu.js +0 -30
- package/dist/esm/actions/DialogActionButtons.js +0 -24
- package/dist/esm/actions/LoadingIconButton.js +0 -7
- package/dist/esm/actions/StickyActionFooter.js +0 -24
- package/dist/esm/actions/StickySubmitButton.js +0 -7
- package/dist/esm/actions/index.js +0 -7
- package/dist/esm/client.js +0 -5
- package/dist/esm/components/BayonFlowVisual.js +0 -81
- package/dist/esm/components/BayonThemeModeToggle.js +0 -28
- package/dist/esm/components/IconTooltipButton.js +0 -11
- package/dist/esm/components/panels.js +0 -76
- package/dist/esm/drawers/BottomDrawer.js +0 -37
- package/dist/esm/drawers/MobileBottomDrawer.js +0 -95
- package/dist/esm/drawers/MobileBottomDrawerHeader.js +0 -30
- package/dist/esm/drawers/ResponsiveDrawer.js +0 -19
- package/dist/esm/drawers/WorkspaceSidePane.js +0 -200
- package/dist/esm/drawers/WorkspaceSidePaneRoot.js +0 -90
- package/dist/esm/drawers/drawerAppearance.js +0 -7
- package/dist/esm/drawers/index.js +0 -8
- package/dist/esm/drawers/useVisualViewportBottomInset.js +0 -29
- package/dist/esm/drawers/workspaceSidePaneGeometry.js +0 -11
- package/dist/esm/feedback/StatusNotice.js +0 -56
- package/dist/esm/feedback/index.js +0 -3
- package/dist/esm/index.js +0 -9
- package/dist/esm/internal/DialogChoiceTile.js +0 -54
- package/dist/esm/links/LinkAddressPreview.js +0 -74
- package/dist/esm/links/index.js +0 -4
- package/dist/esm/links/useLinkAddressPreview.js +0 -159
- package/dist/esm/location/GeographicLocationField.js +0 -43
- package/dist/esm/location/GoogleMapsAttribution.js +0 -9
- package/dist/esm/location/MetadataFieldGroup.js +0 -9
- package/dist/esm/location/MetadataValueField.js +0 -23
- package/dist/esm/location/SearchInputAction.js +0 -8
- package/dist/esm/location/TemplateBadge.js +0 -6
- package/dist/esm/location/VenueSearchDialog.js +0 -109
- package/dist/esm/location/index.js +0 -7
- package/dist/esm/pending/PendingChangesDialogShell.js +0 -10
- package/dist/esm/pending/PendingChangesDialogView.js +0 -134
- package/dist/esm/pending/PendingChangesIndicatorView.js +0 -21
- package/dist/esm/pending/index.js +0 -4
- package/dist/esm/pending/types.js +0 -1
- package/dist/esm/pricing/PlanUpgradeDialog.js +0 -19
- package/dist/esm/pricing/PricingTable.js +0 -54
- package/dist/esm/pricing/index.js +0 -3
- package/dist/esm/providers/BayonThemeProvider.js +0 -123
- package/dist/esm/sections/ExpandableSectionToggle.js +0 -26
- package/dist/esm/sections/index.js +0 -3
- package/dist/esm/styles/pageStyles.js +0 -100
- package/dist/esm/swipe/SwipeActionRow.js +0 -116
- package/dist/esm/swipe/index.js +0 -3
- package/dist/esm/theme/components.js +0 -120
- package/dist/esm/theme/createBayonTheme.js +0 -41
- package/dist/esm/theme/palette.js +0 -106
- package/dist/esm/theme/shadows.js +0 -18
- package/dist/esm/theme/types.js +0 -1
- package/dist/esm/theme/typography.js +0 -55
- package/dist/esm/toasts/ActionToast.js +0 -9
- package/dist/esm/toasts/Toast.js +0 -52
- package/dist/esm/toasts/index.js +0 -5
- package/dist/esm/toasts/useUpwardToastDismiss.js +0 -69
- package/dist/esm/uploads/CameraCaptureDialog.js +0 -181
- package/dist/esm/uploads/FileRow.js +0 -17
- package/dist/esm/uploads/FileSwipeActionRow.js +0 -7
- package/dist/esm/uploads/FileThumbnail.js +0 -98
- package/dist/esm/uploads/FileUpload.js +0 -92
- package/dist/esm/uploads/FileViewer.js +0 -149
- package/dist/esm/uploads/ImageCropDialog.js +0 -212
- package/dist/esm/uploads/ImageInfoPanel.js +0 -35
- package/dist/esm/uploads/ImageUploadQualityDialog.js +0 -51
- package/dist/esm/uploads/UploadProgressRing.js +0 -29
- package/dist/esm/uploads/cameraCropPresentation.js +0 -5
- package/dist/esm/uploads/index.js +0 -11
- package/dist/esm/utils/createBayonEmotionCache.js +0 -15
- package/dist/types/actions/ActionMenu.d.ts +0 -24
- package/dist/types/actions/DialogActionButtons.d.ts +0 -23
- package/dist/types/actions/LoadingIconButton.d.ts +0 -11
- package/dist/types/actions/StickyActionFooter.d.ts +0 -14
- package/dist/types/actions/StickySubmitButton.d.ts +0 -10
- package/dist/types/actions/index.d.ts +0 -5
- package/dist/types/client.d.ts +0 -4
- package/dist/types/components/BayonFlowVisual.d.ts +0 -12
- package/dist/types/components/BayonThemeModeToggle.d.ts +0 -6
- package/dist/types/components/IconTooltipButton.d.ts +0 -10
- package/dist/types/components/panels.d.ts +0 -37
- package/dist/types/drawers/BottomDrawer.d.ts +0 -16
- package/dist/types/drawers/MobileBottomDrawer.d.ts +0 -20
- package/dist/types/drawers/MobileBottomDrawerHeader.d.ts +0 -11
- package/dist/types/drawers/ResponsiveDrawer.d.ts +0 -25
- package/dist/types/drawers/WorkspaceSidePane.d.ts +0 -25
- package/dist/types/drawers/WorkspaceSidePaneRoot.d.ts +0 -1
- package/dist/types/drawers/drawerAppearance.d.ts +0 -8
- package/dist/types/drawers/index.d.ts +0 -7
- package/dist/types/drawers/useVisualViewportBottomInset.d.ts +0 -6
- package/dist/types/drawers/workspaceSidePaneGeometry.d.ts +0 -11
- package/dist/types/feedback/StatusNotice.d.ts +0 -13
- package/dist/types/feedback/index.d.ts +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/internal/DialogChoiceTile.d.ts +0 -20
- package/dist/types/links/LinkAddressPreview.d.ts +0 -19
- package/dist/types/links/index.d.ts +0 -3
- package/dist/types/links/useLinkAddressPreview.d.ts +0 -26
- package/dist/types/location/GeographicLocationField.d.ts +0 -26
- package/dist/types/location/GoogleMapsAttribution.d.ts +0 -1
- package/dist/types/location/MetadataFieldGroup.d.ts +0 -5
- package/dist/types/location/MetadataValueField.d.ts +0 -23
- package/dist/types/location/SearchInputAction.d.ts +0 -9
- package/dist/types/location/TemplateBadge.d.ts +0 -5
- package/dist/types/location/VenueSearchDialog.d.ts +0 -33
- package/dist/types/location/index.d.ts +0 -6
- package/dist/types/pending/PendingChangesDialogShell.d.ts +0 -2
- package/dist/types/pending/PendingChangesDialogView.d.ts +0 -2
- package/dist/types/pending/PendingChangesIndicatorView.d.ts +0 -10
- package/dist/types/pending/index.d.ts +0 -3
- package/dist/types/pending/types.d.ts +0 -55
- package/dist/types/pricing/PlanUpgradeDialog.d.ts +0 -17
- package/dist/types/pricing/PricingTable.d.ts +0 -28
- package/dist/types/pricing/index.d.ts +0 -3
- package/dist/types/providers/BayonThemeProvider.d.ts +0 -20
- package/dist/types/sections/ExpandableSectionToggle.d.ts +0 -12
- package/dist/types/sections/index.d.ts +0 -2
- package/dist/types/styles/pageStyles.d.ts +0 -15
- package/dist/types/swipe/SwipeActionRow.d.ts +0 -8
- package/dist/types/swipe/index.d.ts +0 -1
- package/dist/types/theme/components.d.ts +0 -2
- package/dist/types/theme/createBayonTheme.d.ts +0 -4
- package/dist/types/theme/palette.d.ts +0 -146
- package/dist/types/theme/shadows.d.ts +0 -2
- package/dist/types/theme/types.d.ts +0 -47
- package/dist/types/theme/typography.d.ts +0 -2
- package/dist/types/toasts/ActionToast.d.ts +0 -11
- package/dist/types/toasts/Toast.d.ts +0 -16
- package/dist/types/toasts/index.d.ts +0 -5
- package/dist/types/toasts/useUpwardToastDismiss.d.ts +0 -15
- package/dist/types/uploads/CameraCaptureDialog.d.ts +0 -22
- package/dist/types/uploads/FileRow.d.ts +0 -10
- package/dist/types/uploads/FileSwipeActionRow.d.ts +0 -1
- package/dist/types/uploads/FileThumbnail.d.ts +0 -5
- package/dist/types/uploads/FileUpload.d.ts +0 -26
- package/dist/types/uploads/FileViewer.d.ts +0 -9
- package/dist/types/uploads/ImageCropDialog.d.ts +0 -26
- package/dist/types/uploads/ImageInfoPanel.d.ts +0 -24
- package/dist/types/uploads/ImageUploadQualityDialog.d.ts +0 -13
- package/dist/types/uploads/UploadProgressRing.d.ts +0 -24
- package/dist/types/uploads/cameraCropPresentation.d.ts +0 -2
- package/dist/types/uploads/index.d.ts +0 -12
- package/dist/types/utils/createBayonEmotionCache.d.ts +0 -1
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ImageCropDialog = ImageCropDialog;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const cameraCropPresentation_js_1 = require("./cameraCropPresentation.js");
|
|
9
|
-
const cameraCropPresentation_js_2 = require("./cameraCropPresentation.js");
|
|
10
|
-
const file_uploads_1 = require("@bayonai/file-uploads");
|
|
11
|
-
const DEFAULT_LABELS = {
|
|
12
|
-
title: "Crop photo",
|
|
13
|
-
close: "Close crop photo",
|
|
14
|
-
preview: "Photo crop preview",
|
|
15
|
-
confirm: "Use photo",
|
|
16
|
-
opening: "Opening photo…",
|
|
17
|
-
instruction: "Drag to position your photo",
|
|
18
|
-
zoom: "Zoom",
|
|
19
|
-
horizontal: "Horizontal position",
|
|
20
|
-
vertical: "Vertical position",
|
|
21
|
-
decodeError: "This photo could not be opened. Close this window and choose a JPEG, PNG or WebP photo.",
|
|
22
|
-
previewError: "The photo preview is unavailable. Close this window and choose a different photo.",
|
|
23
|
-
};
|
|
24
|
-
/** Emits orientation-correct decoded-pixel coordinates; the host persists them. */
|
|
25
|
-
function ImageCropDialog({ file, busy, error, onClose, onConfirm, labels, previewShape = "circle", previewWidth = "min(100%, 280px, 35dvh)", }) {
|
|
26
|
-
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
27
|
-
const copyRef = (0, react_1.useRef)(copy);
|
|
28
|
-
// Publish copy after commit so abandoned renders cannot change async feedback.
|
|
29
|
-
(0, react_1.useEffect)(() => {
|
|
30
|
-
copyRef.current = copy;
|
|
31
|
-
});
|
|
32
|
-
const titleId = (0, react_1.useId)();
|
|
33
|
-
const [decodedImage, setDecodedImage] = (0, react_1.useState)(null);
|
|
34
|
-
const bitmap = (decodedImage === null || decodedImage === void 0 ? void 0 : decodedImage.file) === file ? decodedImage.bitmap : null;
|
|
35
|
-
const [ownedDecodeError, setOwnedDecodeError] = (0, react_1.useState)(null);
|
|
36
|
-
const decodeError = (ownedDecodeError === null || ownedDecodeError === void 0 ? void 0 : ownedDecodeError.file) === file ? ownedDecodeError.message : null;
|
|
37
|
-
const [ownedFraming, setOwnedFraming] = (0, react_1.useState)(null);
|
|
38
|
-
const framing = (ownedFraming === null || ownedFraming === void 0 ? void 0 : ownedFraming.file) === file ? ownedFraming.framing : file_uploads_1.INITIAL_CROP_FRAMING;
|
|
39
|
-
function setFraming(update) {
|
|
40
|
-
setOwnedFraming((previous) => ({
|
|
41
|
-
file,
|
|
42
|
-
framing: update((previous === null || previous === void 0 ? void 0 : previous.file) === file ? previous.framing : file_uploads_1.INITIAL_CROP_FRAMING),
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
const canvas = (0, react_1.useRef)(null);
|
|
46
|
-
const drag = (0, react_1.useRef)(null);
|
|
47
|
-
const submitting = (0, react_1.useRef)(false);
|
|
48
|
-
(0, react_1.useEffect)(() => {
|
|
49
|
-
let active = true;
|
|
50
|
-
let decoded;
|
|
51
|
-
async function decode() {
|
|
52
|
-
try {
|
|
53
|
-
if (typeof createImageBitmap !== "function")
|
|
54
|
-
throw new Error("Browser image decoding is unavailable.");
|
|
55
|
-
decoded = await createImageBitmap(file, {
|
|
56
|
-
imageOrientation: "from-image",
|
|
57
|
-
});
|
|
58
|
-
if (!active) {
|
|
59
|
-
decoded.close();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!(decoded.width > 0 && decoded.height > 0))
|
|
63
|
-
throw new Error("Decoded photo dimensions are empty.");
|
|
64
|
-
setDecodedImage({ file, bitmap: decoded });
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
if (!active)
|
|
68
|
-
return;
|
|
69
|
-
console.error("[ImageCropDialog] Could not decode selected photo.", {
|
|
70
|
-
error,
|
|
71
|
-
fileType: file.type,
|
|
72
|
-
});
|
|
73
|
-
setOwnedDecodeError({
|
|
74
|
-
file,
|
|
75
|
-
message: copyRef.current.decodeError,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
void decode();
|
|
80
|
-
return () => {
|
|
81
|
-
active = false;
|
|
82
|
-
drag.current = null;
|
|
83
|
-
decoded === null || decoded === void 0 ? void 0 : decoded.close();
|
|
84
|
-
};
|
|
85
|
-
}, [file]);
|
|
86
|
-
const crop = bitmap ? (0, file_uploads_1.getSquareImageCrop)(bitmap, framing) : null;
|
|
87
|
-
(0, react_1.useEffect)(() => {
|
|
88
|
-
if (!bitmap || !canvas.current)
|
|
89
|
-
return;
|
|
90
|
-
const previewCrop = (0, file_uploads_1.getSquareImageCrop)(bitmap, framing);
|
|
91
|
-
const frame = requestAnimationFrame(() => {
|
|
92
|
-
var _a;
|
|
93
|
-
try {
|
|
94
|
-
const context = (_a = canvas.current) === null || _a === void 0 ? void 0 : _a.getContext("2d");
|
|
95
|
-
if (!context)
|
|
96
|
-
throw new Error("Canvas preview is unavailable.");
|
|
97
|
-
context.clearRect(0, 0, 512, 512);
|
|
98
|
-
context.drawImage(bitmap, previewCrop.x, previewCrop.y, previewCrop.width, previewCrop.height, 0, 0, 512, 512);
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
console.error("[ImageCropDialog] Could not render selected crop.", {
|
|
102
|
-
error,
|
|
103
|
-
});
|
|
104
|
-
setOwnedDecodeError({
|
|
105
|
-
file,
|
|
106
|
-
message: copyRef.current.previewError,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return () => cancelAnimationFrame(frame);
|
|
111
|
-
}, [bitmap, framing, file]);
|
|
112
|
-
function endDrag(event) {
|
|
113
|
-
var _a;
|
|
114
|
-
if (((_a = drag.current) === null || _a === void 0 ? void 0 : _a.id) !== event.pointerId)
|
|
115
|
-
return;
|
|
116
|
-
drag.current = null;
|
|
117
|
-
if (event.currentTarget.hasPointerCapture(event.pointerId))
|
|
118
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
119
|
-
}
|
|
120
|
-
async function confirm() {
|
|
121
|
-
if (busy || submitting.current || !crop || decodeError)
|
|
122
|
-
return;
|
|
123
|
-
submitting.current = true;
|
|
124
|
-
try {
|
|
125
|
-
await onConfirm(crop);
|
|
126
|
-
}
|
|
127
|
-
finally {
|
|
128
|
-
submitting.current = false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const disabled = busy || !bitmap || Boolean(decodeError);
|
|
132
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, { open: true, fullWidth: true, maxWidth: "xs", onClose: () => {
|
|
133
|
-
if (!busy && !submitting.current)
|
|
134
|
-
onClose();
|
|
135
|
-
}, "aria-labelledby": titleId, onKeyDown: (event) => {
|
|
136
|
-
if (event.key === "Enter") {
|
|
137
|
-
if (!(event.target instanceof HTMLButtonElement))
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
event.stopPropagation();
|
|
140
|
-
}
|
|
141
|
-
}, slotProps: {
|
|
142
|
-
paper: {
|
|
143
|
-
sx: {
|
|
144
|
-
maxHeight: "calc(100dvh - 32px)",
|
|
145
|
-
m: 2,
|
|
146
|
-
width: "calc(100% - 32px)",
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
}, children: [(0, jsx_runtime_1.jsxs)(material_1.DialogTitle, { id: titleId, sx: { pr: 7 }, children: [copy.title, (0, jsx_runtime_1.jsx)(cameraCropPresentation_js_1.DialogCloseButton, { label: copy.close, disabled: busy, onClose: () => {
|
|
150
|
-
if (!submitting.current)
|
|
151
|
-
onClose();
|
|
152
|
-
} })] }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 1.5, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { role: "img", "aria-label": copy.preview, sx: {
|
|
153
|
-
aspectRatio: "1",
|
|
154
|
-
// Keep framing controls near the preview on short viewports;
|
|
155
|
-
// pointer coordinates still use this element's actual bounds.
|
|
156
|
-
width: previewWidth,
|
|
157
|
-
alignSelf: "center",
|
|
158
|
-
flexShrink: 0,
|
|
159
|
-
position: "relative",
|
|
160
|
-
overflow: "hidden",
|
|
161
|
-
borderRadius: 1,
|
|
162
|
-
bgcolor: "action.hover",
|
|
163
|
-
touchAction: "none",
|
|
164
|
-
cursor: disabled ? "default" : "grab",
|
|
165
|
-
}, onPointerDown: (event) => {
|
|
166
|
-
if (disabled || !event.isPrimary)
|
|
167
|
-
return;
|
|
168
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
169
|
-
drag.current = {
|
|
170
|
-
id: event.pointerId,
|
|
171
|
-
x: event.clientX,
|
|
172
|
-
y: event.clientY,
|
|
173
|
-
};
|
|
174
|
-
}, onPointerMove: (event) => {
|
|
175
|
-
const previous = drag.current;
|
|
176
|
-
if (disabled ||
|
|
177
|
-
!bitmap ||
|
|
178
|
-
!previous ||
|
|
179
|
-
previous.id !== event.pointerId)
|
|
180
|
-
return;
|
|
181
|
-
const size = event.currentTarget.getBoundingClientRect().width;
|
|
182
|
-
setFraming((value) => (0, file_uploads_1.panSquareImageCrop)(bitmap, value, event.clientX - previous.x, event.clientY - previous.y, size));
|
|
183
|
-
drag.current = {
|
|
184
|
-
id: event.pointerId,
|
|
185
|
-
x: event.clientX,
|
|
186
|
-
y: event.clientY,
|
|
187
|
-
};
|
|
188
|
-
}, onPointerUp: endDrag, onPointerCancel: endDrag, onLostPointerCapture: () => {
|
|
189
|
-
drag.current = null;
|
|
190
|
-
}, children: [(0, jsx_runtime_1.jsx)("canvas", { ref: canvas, width: 512, height: 512, "aria-hidden": "true", style: { display: "block", width: "100%", height: "100%" } }), (0, jsx_runtime_1.jsx)(material_1.Box, { "aria-hidden": true, sx: {
|
|
191
|
-
position: "absolute",
|
|
192
|
-
inset: 0,
|
|
193
|
-
borderRadius: previewShape === "circle" ? "50%" : 0,
|
|
194
|
-
border: "2px solid",
|
|
195
|
-
borderColor: "common.white",
|
|
196
|
-
boxShadow: "0 0 0 100vmax rgba(0,0,0,0.45)",
|
|
197
|
-
pointerEvents: "none",
|
|
198
|
-
} })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", children: !bitmap && !decodeError ? copy.opening : copy.instruction }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
199
|
-
display: "grid",
|
|
200
|
-
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
201
|
-
columnGap: 2,
|
|
202
|
-
}, children: [
|
|
203
|
-
[copy.zoom, "zoom", 1, 4, 0.01],
|
|
204
|
-
[copy.horizontal, "horizontal", 0, 100, 1],
|
|
205
|
-
[copy.vertical, "vertical", 0, 100, 1],
|
|
206
|
-
].map(([label, key, min, max, step]) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
207
|
-
minWidth: 0,
|
|
208
|
-
display: "flex",
|
|
209
|
-
flexDirection: "column",
|
|
210
|
-
gridColumn: key === "zoom" ? "1 / -1" : undefined,
|
|
211
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { id: `${titleId}-${key}`, variant: "body2", sx: { flex: 1, overflowWrap: "anywhere" }, children: label }), (0, jsx_runtime_1.jsx)(material_1.Slider, { "aria-label": label, "aria-labelledby": `${titleId}-${key}`, min: min, max: max, step: step, value: framing[key], disabled: disabled, onChange: (_event, value) => {
|
|
212
|
-
if (typeof value === "number")
|
|
213
|
-
setFraming((previous) => ({ ...previous, [key]: value }));
|
|
214
|
-
} })] }, key))) }), decodeError || error ? ((0, jsx_runtime_1.jsx)(cameraCropPresentation_js_2.StatusNotice, { tone: "error", message: decodeError !== null && decodeError !== void 0 ? decodeError : error })) : null] }) }), (0, jsx_runtime_1.jsx)(cameraCropPresentation_js_1.DialogActionButtons, { confirmLabel: copy.confirm, confirmDisabled: disabled, confirmIcon: busy ? (0, jsx_runtime_1.jsx)(cameraCropPresentation_js_1.DialogActionProgress, {}) : undefined, onConfirm: () => void confirm() })] }));
|
|
215
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type SxProps, type Theme } from "@mui/material";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
export type ImageDimensions = {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
};
|
|
7
|
-
export type ImageInfoPanelProps = {
|
|
8
|
-
id: string;
|
|
9
|
-
dimensions?: ImageDimensions;
|
|
10
|
-
captureTime?: string;
|
|
11
|
-
captureOffset?: string;
|
|
12
|
-
camera?: string;
|
|
13
|
-
location?: {
|
|
14
|
-
coordinates: string;
|
|
15
|
-
approximateName?: string;
|
|
16
|
-
action?: ReactNode;
|
|
17
|
-
};
|
|
18
|
-
loading: boolean;
|
|
19
|
-
failed: boolean;
|
|
20
|
-
onClose: () => void;
|
|
21
|
-
sx?: SxProps<Theme>;
|
|
22
|
-
};
|
|
23
|
-
/** Read-only image facts. The host supplies data and any map action. */
|
|
24
|
-
export declare function ImageInfoPanel({ id, dimensions, captureTime, captureOffset, camera, location, loading, failed, onClose, sx, }: ImageInfoPanelProps): import("react").JSX.Element;
|
|
@@ -1,41 +0,0 @@
|
|
|
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.ImageInfoPanel = ImageInfoPanel;
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
10
|
-
const material_1 = require("@mui/material");
|
|
11
|
-
/** Read-only image facts. The host supplies data and any map action. */
|
|
12
|
-
function ImageInfoPanel({ id, dimensions, captureTime, captureOffset, camera, location, loading, failed, onClose, sx = [], }) {
|
|
13
|
-
var _a;
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "section", id: id, "aria-labelledby": `${id}-title`, sx: [{
|
|
15
|
-
minHeight: 0,
|
|
16
|
-
minWidth: 0,
|
|
17
|
-
overflow: "auto",
|
|
18
|
-
bgcolor: "background.paper",
|
|
19
|
-
borderColor: "divider",
|
|
20
|
-
borderTop: { xs: 1, sm: 0 },
|
|
21
|
-
borderLeft: { xs: 0, sm: 1 },
|
|
22
|
-
borderTopLeftRadius: { xs: 3, sm: 0 },
|
|
23
|
-
borderTopRightRadius: { xs: 3, sm: 0 },
|
|
24
|
-
px: { xs: 2, sm: 3 },
|
|
25
|
-
pt: 1.5,
|
|
26
|
-
pb: "max(16px, env(safe-area-inset-bottom))",
|
|
27
|
-
}, ...(Array.isArray(sx) ? sx : [sx])], children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", sx: { alignItems: "center", justifyContent: "space-between" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { id: `${id}-title`, component: "h2", variant: "h6", sx: { fontWeight: 700 }, children: "Image info" }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": "Close image info", onClick: onClose, children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { component: "dl", sx: {
|
|
28
|
-
m: 0,
|
|
29
|
-
"& > :not(:last-child)": { borderBottom: 1, borderColor: "divider" },
|
|
30
|
-
}, children: [dimensions && ((0, jsx_runtime_1.jsxs)(InfoRow, { label: "Dimensions", children: [dimensions.width, " \u00D7 ", dimensions.height, " px"] })), captureTime && ((0, jsx_runtime_1.jsx)(InfoRow, { label: "Date taken", detail: captureOffset, children: captureTime })), camera && (0, jsx_runtime_1.jsx)(InfoRow, { label: "Camera", children: camera }), location && ((0, jsx_runtime_1.jsx)(InfoRow, { label: "Location", action: location.action, detail: location.approximateName ? location.coordinates : undefined, children: (_a = location.approximateName) !== null && _a !== void 0 ? _a : location.coordinates }))] }), loading || failed ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { role: "status", variant: "body2", color: "text.secondary", sx: { py: 1 }, children: loading
|
|
31
|
-
? "Reading image metadata…"
|
|
32
|
-
: "Could not read image metadata." })) : null, !loading &&
|
|
33
|
-
!failed &&
|
|
34
|
-
!dimensions &&
|
|
35
|
-
!captureTime &&
|
|
36
|
-
!camera &&
|
|
37
|
-
!location ? ((0, jsx_runtime_1.jsx)(material_1.Typography, { role: "status", variant: "body2", color: "text.secondary", sx: { py: 1 }, children: "No image details available." })) : null] }));
|
|
38
|
-
}
|
|
39
|
-
function InfoRow({ label, children, action, detail, }) {
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { py: { xs: 1.25, sm: 1.5 }, minWidth: 0 }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "dt", variant: "body2", color: "text.secondary", children: label }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { component: "dd", direction: "row", spacing: 1, sx: { m: 0, alignItems: "center", justifyContent: "space-between" }, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", sx: { fontWeight: 650, overflowWrap: "anywhere", minWidth: 0 }, children: [children, detail && ((0, jsx_runtime_1.jsx)(material_1.Typography, { component: "span", sx: { display: "block" }, color: "text.secondary", variant: "body2", children: detail }))] }), action] })] }));
|
|
41
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type ImageUploadQuality = "compressed" | "high";
|
|
2
|
-
export type ImageUploadQualityDialogProps = {
|
|
3
|
-
file: File;
|
|
4
|
-
quality: ImageUploadQuality;
|
|
5
|
-
highQualityAccess: "available" | "locked" | "unavailable";
|
|
6
|
-
focusLockedChoice?: boolean;
|
|
7
|
-
hint?: string;
|
|
8
|
-
onQualityChange: (quality: ImageUploadQuality) => void;
|
|
9
|
-
onLockedChoice: () => void;
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
onConfirm: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function ImageUploadQualityDialog({ file, quality, highQualityAccess, focusLockedChoice, hint, onQualityChange, onLockedChoice, onClose, onConfirm, }: ImageUploadQualityDialogProps): import("react").JSX.Element;
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.UploadProgressRing = UploadProgressRing;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const material_1 = require("@mui/material");
|
|
7
|
-
/**
|
|
8
|
-
* Presents determinate upload progress at the object being changed.
|
|
9
|
-
*
|
|
10
|
-
* Product decision: progress belongs with a compact upload target rather than
|
|
11
|
-
* in a separate status row. The host owns file selection, upload lifecycle,
|
|
12
|
-
* validation, errors, and disabled interaction; this primitive only renders
|
|
13
|
-
* the accessible visual state around its child.
|
|
14
|
-
*/
|
|
15
|
-
function UploadProgressRing({ children, progress, progressLabel, size = 88, sx, thickness = 3, }) {
|
|
16
|
-
const isUploading = progress !== null;
|
|
17
|
-
const normalizedProgress = Math.min(100, Math.max(0, progress !== null && progress !== void 0 ? progress : 0));
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { "aria-busy": isUploading || undefined, "data-component": "upload-progress-ring", sx: {
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
display: "inline-flex",
|
|
21
|
-
height: size,
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
position: "relative",
|
|
24
|
-
width: size,
|
|
25
|
-
...sx,
|
|
26
|
-
}, children: [children, isUploading ? ((0, jsx_runtime_1.jsx)(material_1.CircularProgress, { "aria-label": progressLabel, size: size, sx: {
|
|
27
|
-
left: 0,
|
|
28
|
-
pointerEvents: "none",
|
|
29
|
-
position: "absolute",
|
|
30
|
-
top: 0,
|
|
31
|
-
}, thickness: thickness, value: normalizedProgress, variant: "determinate" })) : null] }));
|
|
32
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.StatusNotice = exports.DialogCloseButton = exports.DialogActionProgress = exports.DialogActionButtons = void 0;
|
|
5
|
-
// Product decision: camera/crop retain their shared host-theme presentation;
|
|
6
|
-
// delegate to the canonical actions/feedback bodies instead of copying them.
|
|
7
|
-
var DialogActionButtons_js_1 = require("../actions/DialogActionButtons.js");
|
|
8
|
-
Object.defineProperty(exports, "DialogActionButtons", { enumerable: true, get: function () { return DialogActionButtons_js_1.DialogActionButtons; } });
|
|
9
|
-
Object.defineProperty(exports, "DialogActionProgress", { enumerable: true, get: function () { return DialogActionButtons_js_1.DialogActionProgress; } });
|
|
10
|
-
Object.defineProperty(exports, "DialogCloseButton", { enumerable: true, get: function () { return DialogActionButtons_js_1.DialogCloseButton; } });
|
|
11
|
-
var StatusNotice_js_1 = require("../feedback/StatusNotice.js");
|
|
12
|
-
Object.defineProperty(exports, "StatusNotice", { enumerable: true, get: function () { return StatusNotice_js_1.StatusNotice; } });
|
|
@@ -1,12 +0,0 @@
|
|
|
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 { ImageInfoPanel, type ImageDimensions, type ImageInfoPanelProps } from "./ImageInfoPanel.js";
|
|
6
|
-
export { UploadProgressRing } from "./UploadProgressRing.js";
|
|
7
|
-
export { useUploadLock } from "@bayonai/file-uploads/hooks";
|
|
8
|
-
export type { UploadFile, LoadFile } from "@bayonai/file-uploads";
|
|
9
|
-
export type { UploadProgressRingProps } from "./UploadProgressRing.js";
|
|
10
|
-
export { CameraCaptureDialog, type CameraCaptureDialogProps, type CameraCaptureLabels } from "./CameraCaptureDialog.js";
|
|
11
|
-
export { ImageCropDialog, type ImageCropDialogProps, type ImageCropLabels } from "./ImageCropDialog.js";
|
|
12
|
-
export { ImageUploadQualityDialog, type ImageUploadQuality, type ImageUploadQualityDialogProps } from "./ImageUploadQualityDialog.js";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ImageUploadQualityDialog = exports.ImageCropDialog = exports.CameraCaptureDialog = exports.useUploadLock = exports.UploadProgressRing = exports.ImageInfoPanel = exports.FileViewer = exports.FileThumbnail = exports.FileRow = exports.FileUpload = void 0;
|
|
5
|
-
var FileUpload_js_1 = require("./FileUpload.js");
|
|
6
|
-
Object.defineProperty(exports, "FileUpload", { enumerable: true, get: function () { return FileUpload_js_1.FileUpload; } });
|
|
7
|
-
var FileRow_js_1 = require("./FileRow.js");
|
|
8
|
-
Object.defineProperty(exports, "FileRow", { enumerable: true, get: function () { return FileRow_js_1.FileRow; } });
|
|
9
|
-
var FileThumbnail_js_1 = require("./FileThumbnail.js");
|
|
10
|
-
Object.defineProperty(exports, "FileThumbnail", { enumerable: true, get: function () { return FileThumbnail_js_1.FileThumbnail; } });
|
|
11
|
-
var FileViewer_js_1 = require("./FileViewer.js");
|
|
12
|
-
Object.defineProperty(exports, "FileViewer", { enumerable: true, get: function () { return FileViewer_js_1.FileViewer; } });
|
|
13
|
-
var ImageInfoPanel_js_1 = require("./ImageInfoPanel.js");
|
|
14
|
-
Object.defineProperty(exports, "ImageInfoPanel", { enumerable: true, get: function () { return ImageInfoPanel_js_1.ImageInfoPanel; } });
|
|
15
|
-
var UploadProgressRing_js_1 = require("./UploadProgressRing.js");
|
|
16
|
-
Object.defineProperty(exports, "UploadProgressRing", { enumerable: true, get: function () { return UploadProgressRing_js_1.UploadProgressRing; } });
|
|
17
|
-
var hooks_1 = require("@bayonai/file-uploads/hooks");
|
|
18
|
-
Object.defineProperty(exports, "useUploadLock", { enumerable: true, get: function () { return hooks_1.useUploadLock; } });
|
|
19
|
-
var CameraCaptureDialog_js_1 = require("./CameraCaptureDialog.js");
|
|
20
|
-
Object.defineProperty(exports, "CameraCaptureDialog", { enumerable: true, get: function () { return CameraCaptureDialog_js_1.CameraCaptureDialog; } });
|
|
21
|
-
var ImageCropDialog_js_1 = require("./ImageCropDialog.js");
|
|
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; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createBayonEmotionCache(key?: string): import("@emotion/cache").EmotionCache;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createBayonEmotionCache = createBayonEmotionCache;
|
|
7
|
-
const cache_1 = __importDefault(require("@emotion/cache"));
|
|
8
|
-
const isBrowser = typeof document !== 'undefined';
|
|
9
|
-
function createBayonEmotionCache(key = 'css') {
|
|
10
|
-
let insertionPoint;
|
|
11
|
-
if (isBrowser) {
|
|
12
|
-
const emotionInsertionPoint = document.querySelector('meta[name="emotion-insertion-point"]');
|
|
13
|
-
insertionPoint = emotionInsertionPoint !== null && emotionInsertionPoint !== void 0 ? emotionInsertionPoint : undefined;
|
|
14
|
-
}
|
|
15
|
-
return (0, cache_1.default)({
|
|
16
|
-
key,
|
|
17
|
-
prepend: true,
|
|
18
|
-
insertionPoint,
|
|
19
|
-
speedy: typeof process !== 'undefined' && process.env.NODE_ENV === 'production',
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
|
|
4
|
-
import { Box, ListItemIcon, ListSubheader, Menu, MenuItem, Tooltip, } from "@mui/material";
|
|
5
|
-
import { Fragment, useId, useState } from "react";
|
|
6
|
-
import { LoadingIconButton } from "./LoadingIconButton.js";
|
|
7
|
-
/** A compact, grouped action menu with an optional in-flight trigger state. */
|
|
8
|
-
export function ActionMenu({ actionColorSx, actions, buttonSx, containerSx, disabled = false, label = "Actions", loading = false, loadingLabel = `${label} loading`, size = "small", }) {
|
|
9
|
-
const menuId = useId();
|
|
10
|
-
const [anchorElement, setAnchorElement] = useState(null);
|
|
11
|
-
const open = Boolean(anchorElement);
|
|
12
|
-
function handleAction(action) {
|
|
13
|
-
setAnchorElement(null);
|
|
14
|
-
action.onClick();
|
|
15
|
-
}
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx(Tooltip, { title: loading ? loadingLabel : label, children: _jsx(Box, { component: "span", sx: containerSx, children: _jsx(LoadingIconButton, { "aria-controls": open ? menuId : undefined, "aria-expanded": open ? "true" : undefined, "aria-haspopup": "menu", "aria-label": label, disabled: disabled, loading: loading, loadingLabel: loadingLabel, onClick: (event) => setAnchorElement(event.currentTarget), size: size, sx: buttonSx, children: _jsx(MoreHorizIcon, { fontSize: size === "large" ? "medium" : "small" }) }) }) }), _jsx(Menu, { anchorEl: anchorElement, anchorOrigin: { horizontal: "right", vertical: "bottom" }, disableScrollLock: true, id: menuId, onClose: () => setAnchorElement(null), open: open, transformOrigin: { horizontal: "right", vertical: "top" }, children: actions.map((action, index) => {
|
|
17
|
-
var _a, _b, _c, _d;
|
|
18
|
-
return (_jsxs(Fragment, { children: [action.section &&
|
|
19
|
-
action.section !== ((_a = actions[index - 1]) === null || _a === void 0 ? void 0 : _a.section) ? (_jsx(ListSubheader, { children: action.section })) : null, _jsxs(MenuItem, { disabled: action.disabled, onClick: () => handleAction(action), sx: (_c = actionColorSx === null || actionColorSx === void 0 ? void 0 : actionColorSx[(_b = action.color) !== null && _b !== void 0 ? _b : "default"]) !== null && _c !== void 0 ? _c : getDefaultActionColorSx(action.color), children: [action.icon ? _jsx(ListItemIcon, { children: action.icon }) : null, action.label] })] }, `${(_d = action.section) !== null && _d !== void 0 ? _d : "default"}:${action.label}`));
|
|
20
|
-
}) })] }));
|
|
21
|
-
}
|
|
22
|
-
function getDefaultActionColorSx(color) {
|
|
23
|
-
if (color === "primary")
|
|
24
|
-
return { color: "primary.main" };
|
|
25
|
-
if (color === "secondary")
|
|
26
|
-
return { color: "secondary.main" };
|
|
27
|
-
if (color === "error")
|
|
28
|
-
return { color: "error.main" };
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import CheckIcon from "@mui/icons-material/Check";
|
|
4
|
-
import CloseIcon from "@mui/icons-material/Close";
|
|
5
|
-
import { Button, CircularProgress, DialogActions, IconButton, Stack, Tooltip, } from "@mui/material";
|
|
6
|
-
// Product decision: concise decisions/info fit content above a readable 320px floor.
|
|
7
|
-
// Keep MUI's readable maxWidth/viewport cap; forms and previews own their sizing.
|
|
8
|
-
export const compactDialogPaperSx = {
|
|
9
|
-
width: "fit-content",
|
|
10
|
-
// Preserve MUI's 32px margins even when the viewport is narrower than the floor.
|
|
11
|
-
minWidth: "min(320px, calc(100% - 64px))",
|
|
12
|
-
overflowWrap: "anywhere",
|
|
13
|
-
};
|
|
14
|
-
/** Keeps the modal's primary decision compact and explicitly labelled. */
|
|
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
|
-
}
|
|
18
|
-
export function DialogActionProgress() {
|
|
19
|
-
return _jsx(CircularProgress, { color: "inherit", size: 20 });
|
|
20
|
-
}
|
|
21
|
-
export function DialogCloseButton({ disabled = false, label = "Close", onClose, sx, }) {
|
|
22
|
-
// Product decision: dismissible dialogs have one close action in the title's top-right corner.
|
|
23
|
-
return (_jsx(Stack, { sx: { position: "absolute", right: 16, top: 16, ...sx }, children: _jsx(Tooltip, { title: label, children: _jsx("span", { children: _jsx(IconButton, { "aria-label": label, disabled: disabled, onClick: onClose, size: "small", type: "button", children: _jsx(CloseIcon, { fontSize: "small" }) }) }) }) }));
|
|
24
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { CircularProgress, IconButton, } from "@mui/material";
|
|
4
|
-
/** Keeps an icon action's footprint while making an in-flight request visible. */
|
|
5
|
-
export function LoadingIconButton({ "aria-label": ariaLabel, children, disabled, loading = false, loadingLabel, spinnerSize = 20, ...props }) {
|
|
6
|
-
return (_jsx(IconButton, { ...props, "aria-busy": loading || undefined, "aria-label": loading ? loadingLabel : ariaLabel, disabled: disabled || loading, children: loading ? (_jsx(CircularProgress, { "aria-label": loadingLabel, color: "inherit", size: spinnerSize })) : (children) }));
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Box } from "@mui/material";
|
|
4
|
-
/**
|
|
5
|
-
* Keeps the final actions of a long, scrollable form in view.
|
|
6
|
-
*
|
|
7
|
-
* Product decision: this component owns local sticky positioning and neutral
|
|
8
|
-
* footer chrome only. The host owns its scroll container, any edge-to-edge
|
|
9
|
-
* bleed required by a padded surface, action layout, and form submission.
|
|
10
|
-
*/
|
|
11
|
-
export function StickyActionFooter({ children, sx }) {
|
|
12
|
-
return (_jsx(Box, { component: "footer", "data-component": "sticky-action-footer", sx: {
|
|
13
|
-
backgroundColor: "background.paper",
|
|
14
|
-
borderColor: "divider",
|
|
15
|
-
borderTop: 1,
|
|
16
|
-
bottom: 0,
|
|
17
|
-
mt: 1,
|
|
18
|
-
p: 2,
|
|
19
|
-
position: "sticky",
|
|
20
|
-
// Local stacking keeps the footer above fields without escaping its form.
|
|
21
|
-
zIndex: 1,
|
|
22
|
-
...sx,
|
|
23
|
-
}, children: children }));
|
|
24
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Button, } from "@mui/material";
|
|
4
|
-
import { StickyActionFooter } from "./StickyActionFooter.js";
|
|
5
|
-
export function StickySubmitButton({ buttonSx, disabled = false, footerSx, label = "Save", loading = false, variant = "contained", }) {
|
|
6
|
-
return (_jsx(StickyActionFooter, { sx: footerSx, children: _jsx(Button, { color: "secondary", disabled: disabled, fullWidth: true, loading: loading, sx: { minHeight: 44, ...buttonSx }, type: "submit", variant: variant, children: label }) }));
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
// TL-M249: preserve the established MUI presentation under its owning package.
|
|
3
|
-
export { ActionMenu, } from "./ActionMenu.js";
|
|
4
|
-
export { LoadingIconButton, } from "./LoadingIconButton.js";
|
|
5
|
-
export { StickyActionFooter, } from "./StickyActionFooter.js";
|
|
6
|
-
export { StickySubmitButton, } from "./StickySubmitButton.js";
|
|
7
|
-
export { compactDialogPaperSx, DialogActionButtons, DialogActionProgress, DialogCloseButton, } from "./DialogActionButtons.js";
|