@bayonai/mui-design 1.10.0 → 1.10.2
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 +9 -0
- package/dist/cjs/actions/ActionMenu.d.ts +24 -0
- package/dist/cjs/actions/ActionMenu.js +36 -0
- package/dist/cjs/actions/DialogActionButtons.d.ts +23 -0
- package/dist/cjs/actions/DialogActionButtons.js +33 -0
- package/dist/cjs/actions/LoadingIconButton.d.ts +11 -0
- package/dist/cjs/actions/LoadingIconButton.js +10 -0
- package/dist/cjs/actions/StickyActionFooter.d.ts +14 -0
- package/dist/cjs/actions/StickyActionFooter.js +27 -0
- package/dist/cjs/actions/StickySubmitButton.d.ts +10 -0
- package/dist/cjs/actions/StickySubmitButton.js +10 -0
- package/dist/cjs/actions/index.d.ts +5 -0
- package/dist/cjs/actions/index.js +18 -0
- package/dist/cjs/client.d.ts +4 -0
- package/dist/cjs/client.js +21 -0
- package/dist/cjs/components/BayonFlowVisual.d.ts +12 -0
- package/dist/cjs/components/BayonFlowVisual.js +87 -0
- package/dist/cjs/components/BayonThemeModeToggle.d.ts +6 -0
- package/dist/cjs/components/BayonThemeModeToggle.js +34 -0
- package/dist/cjs/components/IconTooltipButton.d.ts +10 -0
- package/dist/cjs/components/IconTooltipButton.js +50 -0
- package/dist/cjs/components/panels.d.ts +37 -0
- package/dist/cjs/components/panels.js +92 -0
- package/dist/cjs/drawers/BottomDrawer.d.ts +16 -0
- package/dist/cjs/drawers/BottomDrawer.js +43 -0
- package/dist/cjs/drawers/MobileBottomDrawer.d.ts +20 -0
- package/dist/cjs/drawers/MobileBottomDrawer.js +102 -0
- package/dist/cjs/drawers/MobileBottomDrawerHeader.d.ts +11 -0
- package/dist/cjs/drawers/MobileBottomDrawerHeader.js +36 -0
- package/dist/cjs/drawers/ResponsiveDrawer.d.ts +25 -0
- package/dist/cjs/drawers/ResponsiveDrawer.js +22 -0
- package/dist/cjs/drawers/WorkspaceSidePane.d.ts +31 -0
- package/dist/cjs/drawers/WorkspaceSidePane.js +228 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.js +93 -0
- package/dist/cjs/drawers/drawerAppearance.d.ts +8 -0
- package/dist/cjs/drawers/drawerAppearance.js +10 -0
- package/dist/cjs/drawers/index.d.ts +7 -0
- package/dist/cjs/drawers/index.js +19 -0
- package/dist/cjs/drawers/useVisualViewportBottomInset.d.ts +6 -0
- package/dist/cjs/drawers/useVisualViewportBottomInset.js +33 -0
- package/dist/cjs/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/cjs/drawers/workspaceSidePaneGeometry.js +15 -0
- package/dist/cjs/feedback/StatusNotice.d.ts +13 -0
- package/dist/cjs/feedback/StatusNotice.js +62 -0
- package/dist/cjs/feedback/index.d.ts +1 -0
- package/dist/cjs/feedback/index.js +7 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/cjs/internal/DialogChoiceTile.js +60 -0
- package/dist/cjs/links/LinkAddressPreview.d.ts +21 -0
- package/dist/cjs/links/LinkAddressPreview.js +130 -0
- package/dist/cjs/links/index.d.ts +3 -0
- package/dist/cjs/links/index.js +9 -0
- package/dist/cjs/links/useLinkAddressPreview.d.ts +26 -0
- package/dist/cjs/links/useLinkAddressPreview.js +171 -0
- package/dist/cjs/location/GeographicLocationField.d.ts +26 -0
- package/dist/cjs/location/GeographicLocationField.js +49 -0
- package/dist/cjs/location/GoogleMapsAttribution.d.ts +1 -0
- package/dist/cjs/location/GoogleMapsAttribution.js +12 -0
- package/dist/cjs/location/MetadataFieldGroup.d.ts +5 -0
- package/dist/cjs/location/MetadataFieldGroup.js +13 -0
- package/dist/cjs/location/MetadataValueField.d.ts +23 -0
- package/dist/cjs/location/MetadataValueField.js +27 -0
- package/dist/cjs/location/SearchInputAction.d.ts +9 -0
- package/dist/cjs/location/SearchInputAction.js +14 -0
- package/dist/cjs/location/TemplateBadge.d.ts +5 -0
- package/dist/cjs/location/TemplateBadge.js +9 -0
- package/dist/cjs/location/VenueSearchDialog.d.ts +33 -0
- package/dist/cjs/location/VenueSearchDialog.js +112 -0
- package/dist/cjs/location/index.d.ts +6 -0
- package/dist/cjs/location/index.js +20 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pending/PendingChangesDialogShell.d.ts +2 -0
- package/dist/cjs/pending/PendingChangesDialogShell.js +16 -0
- package/dist/cjs/pending/PendingChangesDialogView.d.ts +2 -0
- package/dist/cjs/pending/PendingChangesDialogView.js +140 -0
- package/dist/cjs/pending/PendingChangesIndicatorView.d.ts +10 -0
- package/dist/cjs/pending/PendingChangesIndicatorView.js +27 -0
- package/dist/cjs/pending/index.d.ts +3 -0
- package/dist/cjs/pending/index.js +9 -0
- package/dist/cjs/pending/types.d.ts +55 -0
- package/dist/cjs/pending/types.js +2 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.js +22 -0
- package/dist/cjs/pricing/PricingTable.d.ts +28 -0
- package/dist/cjs/pricing/PricingTable.js +60 -0
- package/dist/cjs/pricing/index.d.ts +3 -0
- package/dist/cjs/pricing/index.js +8 -0
- package/dist/cjs/providers/BayonThemeProvider.d.ts +20 -0
- package/dist/cjs/providers/BayonThemeProvider.js +163 -0
- package/dist/cjs/sections/ExpandableSectionToggle.d.ts +12 -0
- package/dist/cjs/sections/ExpandableSectionToggle.js +32 -0
- package/dist/cjs/sections/index.d.ts +2 -0
- package/dist/cjs/sections/index.js +7 -0
- package/dist/cjs/styles/pageStyles.d.ts +15 -0
- package/dist/cjs/styles/pageStyles.js +103 -0
- package/dist/cjs/swipe/SwipeActionRow.d.ts +8 -0
- package/dist/cjs/swipe/SwipeActionRow.js +123 -0
- package/dist/cjs/swipe/index.d.ts +1 -0
- package/dist/cjs/swipe/index.js +8 -0
- package/dist/cjs/theme/components.d.ts +2 -0
- package/dist/cjs/theme/components.js +123 -0
- package/dist/cjs/theme/createBayonTheme.d.ts +4 -0
- package/dist/cjs/theme/createBayonTheme.js +45 -0
- package/dist/cjs/theme/palette.d.ts +146 -0
- package/dist/cjs/theme/palette.js +109 -0
- package/dist/cjs/theme/shadows.d.ts +2 -0
- package/dist/cjs/theme/shadows.js +21 -0
- package/dist/cjs/theme/types.d.ts +47 -0
- package/dist/cjs/theme/types.js +2 -0
- package/dist/cjs/theme/typography.d.ts +2 -0
- package/dist/cjs/theme/typography.js +58 -0
- package/dist/cjs/toasts/ActionToast.d.ts +11 -0
- package/dist/cjs/toasts/ActionToast.js +12 -0
- package/dist/cjs/toasts/Toast.d.ts +16 -0
- package/dist/cjs/toasts/Toast.js +55 -0
- package/dist/cjs/toasts/index.d.ts +5 -0
- package/dist/cjs/toasts/index.js +12 -0
- package/dist/cjs/toasts/useUpwardToastDismiss.d.ts +15 -0
- package/dist/cjs/toasts/useUpwardToastDismiss.js +73 -0
- package/dist/cjs/uploads/CameraCaptureDialog.d.ts +22 -0
- package/dist/cjs/uploads/CameraCaptureDialog.js +187 -0
- package/dist/cjs/uploads/FileRow.d.ts +10 -0
- package/dist/cjs/uploads/FileRow.js +23 -0
- package/dist/cjs/uploads/FileSwipeActionRow.d.ts +1 -0
- package/dist/cjs/uploads/FileSwipeActionRow.js +11 -0
- package/dist/cjs/uploads/FileThumbnail.d.ts +5 -0
- package/dist/cjs/uploads/FileThumbnail.js +104 -0
- package/dist/cjs/uploads/FileUpload.d.ts +26 -0
- package/dist/cjs/uploads/FileUpload.js +98 -0
- package/dist/cjs/uploads/FileViewer.d.ts +9 -0
- package/dist/cjs/uploads/FileViewer.js +173 -0
- package/dist/cjs/uploads/ImageCropDialog.d.ts +26 -0
- package/dist/cjs/uploads/ImageCropDialog.js +215 -0
- package/dist/cjs/uploads/ImageInfoPanel.d.ts +24 -0
- package/dist/cjs/uploads/ImageInfoPanel.js +41 -0
- package/dist/cjs/uploads/ImageUploadQualityDialog.d.ts +13 -0
- package/dist/cjs/uploads/ImageUploadQualityDialog.js +57 -0
- package/dist/cjs/uploads/UploadProgressRing.d.ts +24 -0
- package/dist/cjs/uploads/UploadProgressRing.js +32 -0
- package/dist/cjs/uploads/cameraCropPresentation.d.ts +2 -0
- package/dist/cjs/uploads/cameraCropPresentation.js +12 -0
- package/dist/cjs/uploads/index.d.ts +12 -0
- package/dist/cjs/uploads/index.js +24 -0
- package/dist/cjs/utils/createBayonEmotionCache.d.ts +1 -0
- package/dist/cjs/utils/createBayonEmotionCache.js +21 -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/client.js +5 -0
- package/dist/esm/components/BayonFlowVisual.js +81 -0
- package/dist/esm/components/BayonThemeModeToggle.js +28 -0
- package/dist/esm/components/IconTooltipButton.js +11 -0
- package/dist/esm/components/panels.js +76 -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/WorkspaceSidePane.js +222 -0
- package/dist/esm/drawers/WorkspaceSidePaneRoot.js +90 -0
- package/dist/esm/drawers/drawerAppearance.js +7 -0
- package/dist/esm/drawers/index.js +8 -0
- package/dist/esm/drawers/useVisualViewportBottomInset.js +29 -0
- package/dist/esm/drawers/workspaceSidePaneGeometry.js +11 -0
- package/dist/esm/feedback/StatusNotice.js +56 -0
- package/dist/esm/feedback/index.js +3 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/internal/DialogChoiceTile.js +54 -0
- package/dist/esm/links/LinkAddressPreview.js +91 -0
- package/dist/esm/links/index.js +4 -0
- package/dist/esm/links/useLinkAddressPreview.js +168 -0
- package/dist/esm/location/GeographicLocationField.js +43 -0
- package/dist/esm/location/GoogleMapsAttribution.js +9 -0
- package/dist/esm/location/MetadataFieldGroup.js +9 -0
- package/dist/esm/location/MetadataValueField.js +23 -0
- package/dist/esm/location/SearchInputAction.js +8 -0
- package/dist/esm/location/TemplateBadge.js +6 -0
- package/dist/esm/location/VenueSearchDialog.js +109 -0
- package/dist/esm/location/index.js +7 -0
- package/dist/esm/pending/PendingChangesDialogShell.js +10 -0
- package/dist/esm/pending/PendingChangesDialogView.js +134 -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/pricing/PlanUpgradeDialog.js +19 -0
- package/dist/esm/pricing/PricingTable.js +54 -0
- package/dist/esm/pricing/index.js +3 -0
- package/dist/esm/providers/BayonThemeProvider.js +123 -0
- package/dist/esm/sections/ExpandableSectionToggle.js +26 -0
- package/dist/esm/sections/index.js +3 -0
- package/dist/esm/styles/pageStyles.js +100 -0
- package/dist/esm/swipe/SwipeActionRow.js +116 -0
- package/dist/esm/swipe/index.js +3 -0
- package/dist/esm/theme/components.js +120 -0
- package/dist/esm/theme/createBayonTheme.js +41 -0
- package/dist/esm/theme/palette.js +106 -0
- package/dist/esm/theme/shadows.js +18 -0
- package/dist/esm/theme/types.js +1 -0
- package/dist/esm/theme/typography.js +55 -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 +167 -0
- package/dist/esm/uploads/ImageCropDialog.js +212 -0
- package/dist/esm/uploads/ImageInfoPanel.js +35 -0
- package/dist/esm/uploads/ImageUploadQualityDialog.js +51 -0
- package/dist/esm/uploads/UploadProgressRing.js +29 -0
- package/dist/esm/uploads/cameraCropPresentation.js +5 -0
- package/dist/esm/uploads/index.js +11 -0
- package/dist/esm/utils/createBayonEmotionCache.js +15 -0
- package/dist/types/actions/ActionMenu.d.ts +24 -0
- package/dist/types/actions/DialogActionButtons.d.ts +23 -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/client.d.ts +4 -0
- package/dist/types/components/BayonFlowVisual.d.ts +12 -0
- package/dist/types/components/BayonThemeModeToggle.d.ts +6 -0
- package/dist/types/components/IconTooltipButton.d.ts +10 -0
- package/dist/types/components/panels.d.ts +37 -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/WorkspaceSidePane.d.ts +31 -0
- package/dist/types/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/types/drawers/drawerAppearance.d.ts +8 -0
- package/dist/types/drawers/index.d.ts +7 -0
- package/dist/types/drawers/useVisualViewportBottomInset.d.ts +6 -0
- package/dist/types/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/types/feedback/StatusNotice.d.ts +13 -0
- package/dist/types/feedback/index.d.ts +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/types/links/LinkAddressPreview.d.ts +21 -0
- package/dist/types/links/index.d.ts +3 -0
- package/dist/types/links/useLinkAddressPreview.d.ts +26 -0
- package/dist/types/location/GeographicLocationField.d.ts +26 -0
- package/dist/types/location/GoogleMapsAttribution.d.ts +1 -0
- package/dist/types/location/MetadataFieldGroup.d.ts +5 -0
- package/dist/types/location/MetadataValueField.d.ts +23 -0
- package/dist/types/location/SearchInputAction.d.ts +9 -0
- package/dist/types/location/TemplateBadge.d.ts +5 -0
- package/dist/types/location/VenueSearchDialog.d.ts +33 -0
- package/dist/types/location/index.d.ts +6 -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 +55 -0
- package/dist/types/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/types/pricing/PricingTable.d.ts +28 -0
- package/dist/types/pricing/index.d.ts +3 -0
- package/dist/types/providers/BayonThemeProvider.d.ts +20 -0
- package/dist/types/sections/ExpandableSectionToggle.d.ts +12 -0
- package/dist/types/sections/index.d.ts +2 -0
- package/dist/types/styles/pageStyles.d.ts +15 -0
- package/dist/types/swipe/SwipeActionRow.d.ts +8 -0
- package/dist/types/swipe/index.d.ts +1 -0
- package/dist/types/theme/components.d.ts +2 -0
- package/dist/types/theme/createBayonTheme.d.ts +4 -0
- package/dist/types/theme/palette.d.ts +146 -0
- package/dist/types/theme/shadows.d.ts +2 -0
- package/dist/types/theme/types.d.ts +47 -0
- package/dist/types/theme/typography.d.ts +2 -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/ImageInfoPanel.d.ts +24 -0
- package/dist/types/uploads/ImageUploadQualityDialog.d.ts +13 -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 +12 -0
- package/dist/types/utils/createBayonEmotionCache.d.ts +1 -0
- package/docs/uploads-contract.md +15 -0
- package/package.json +2 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bayonDarkPalette = exports.bayonPalette = exports.bayonSecondary = exports.bayonPrimary = exports.bayonAccent = void 0;
|
|
4
|
+
exports.bayonAccent = {
|
|
5
|
+
teal: '#2DD4BF',
|
|
6
|
+
tealLight: '#5EEAD4',
|
|
7
|
+
tealSoft: '#A7F3D0',
|
|
8
|
+
blue: '#60A5FA',
|
|
9
|
+
yellow: '#FDE047',
|
|
10
|
+
coral: '#FF6B6B',
|
|
11
|
+
night: '#0B1020',
|
|
12
|
+
panel: '#111827',
|
|
13
|
+
ink: '#031B20',
|
|
14
|
+
foreground: '#F8FAFC',
|
|
15
|
+
};
|
|
16
|
+
exports.bayonPrimary = {
|
|
17
|
+
lighter: '#D1E9FC',
|
|
18
|
+
light: '#76B0F1',
|
|
19
|
+
main: '#2065D1',
|
|
20
|
+
dark: '#103996',
|
|
21
|
+
darker: '#061B64',
|
|
22
|
+
contrastText: '#FFFFFF',
|
|
23
|
+
};
|
|
24
|
+
exports.bayonSecondary = {
|
|
25
|
+
lighter: '#D6E4FF',
|
|
26
|
+
light: '#84A9FF',
|
|
27
|
+
main: '#3366FF',
|
|
28
|
+
dark: '#1939B7',
|
|
29
|
+
darker: '#091A7A',
|
|
30
|
+
contrastText: '#FFFFFF',
|
|
31
|
+
};
|
|
32
|
+
exports.bayonPalette = {
|
|
33
|
+
primary: exports.bayonPrimary,
|
|
34
|
+
secondary: exports.bayonSecondary,
|
|
35
|
+
info: {
|
|
36
|
+
lighter: '#D0F2FF',
|
|
37
|
+
light: '#74CAFF',
|
|
38
|
+
main: '#1890FF',
|
|
39
|
+
dark: '#0C53B7',
|
|
40
|
+
darker: '#04297A',
|
|
41
|
+
contrastText: '#FFFFFF',
|
|
42
|
+
},
|
|
43
|
+
success: {
|
|
44
|
+
lighter: '#E9FCD4',
|
|
45
|
+
light: '#AAF27F',
|
|
46
|
+
main: '#54D62C',
|
|
47
|
+
dark: '#229A16',
|
|
48
|
+
darker: '#08660D',
|
|
49
|
+
contrastText: '#FFFFFF',
|
|
50
|
+
},
|
|
51
|
+
warning: {
|
|
52
|
+
lighter: '#FFF7CD',
|
|
53
|
+
light: '#FFE16A',
|
|
54
|
+
main: '#FFC107',
|
|
55
|
+
dark: '#B78103',
|
|
56
|
+
darker: '#7A4F01',
|
|
57
|
+
contrastText: '#212B36',
|
|
58
|
+
},
|
|
59
|
+
error: {
|
|
60
|
+
lighter: '#FFE7D9',
|
|
61
|
+
light: '#FFA48D',
|
|
62
|
+
main: '#FF4842',
|
|
63
|
+
dark: '#B72136',
|
|
64
|
+
darker: '#7A0C2E',
|
|
65
|
+
contrastText: '#FFFFFF',
|
|
66
|
+
},
|
|
67
|
+
grey: {
|
|
68
|
+
0: '#FFFFFF',
|
|
69
|
+
100: '#F9FAFB',
|
|
70
|
+
200: '#F4F6F8',
|
|
71
|
+
300: '#DFE3E8',
|
|
72
|
+
400: '#C4CDD5',
|
|
73
|
+
500: '#919EAB',
|
|
74
|
+
600: '#637381',
|
|
75
|
+
700: '#454F5B',
|
|
76
|
+
800: '#212B36',
|
|
77
|
+
900: '#161C24',
|
|
78
|
+
},
|
|
79
|
+
text: {
|
|
80
|
+
primary: '#212B36',
|
|
81
|
+
secondary: '#637381',
|
|
82
|
+
disabled: '#919EAB',
|
|
83
|
+
},
|
|
84
|
+
background: {
|
|
85
|
+
paper: '#FFFFFF',
|
|
86
|
+
default: '#F9FAFB',
|
|
87
|
+
},
|
|
88
|
+
action: {
|
|
89
|
+
active: '#637381',
|
|
90
|
+
hover: 'rgba(99, 115, 129, 0.08)',
|
|
91
|
+
selected: 'rgba(99, 115, 129, 0.16)',
|
|
92
|
+
disabled: 'rgba(99, 115, 129, 0.8)',
|
|
93
|
+
disabledBackground: 'rgba(99, 115, 129, 0.24)',
|
|
94
|
+
focus: 'rgba(99, 115, 129, 0.24)',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
exports.bayonDarkPalette = {
|
|
98
|
+
...exports.bayonPalette,
|
|
99
|
+
mode: 'dark',
|
|
100
|
+
background: {
|
|
101
|
+
default: exports.bayonAccent.night,
|
|
102
|
+
paper: exports.bayonAccent.panel,
|
|
103
|
+
},
|
|
104
|
+
text: {
|
|
105
|
+
primary: '#FFFFFF',
|
|
106
|
+
secondary: 'rgba(255, 255, 255, 0.72)',
|
|
107
|
+
disabled: 'rgba(255, 255, 255, 0.5)',
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bayonShadows = void 0;
|
|
4
|
+
const palette_js_1 = require("./palette.js");
|
|
5
|
+
exports.bayonShadows = {
|
|
6
|
+
z1: '0px 1px 2px 0px rgba(145, 158, 171, 0.16)',
|
|
7
|
+
z8: '0px 8px 16px 0px rgba(145, 158, 171, 0.16)',
|
|
8
|
+
z12: '0px 12px 24px -4px rgba(145, 158, 171, 0.16)',
|
|
9
|
+
z16: '0px 16px 32px -4px rgba(145, 158, 171, 0.16)',
|
|
10
|
+
z20: '0px 20px 40px -4px rgba(145, 158, 171, 0.16)',
|
|
11
|
+
z24: '0px 20px 48px 0px rgba(145, 158, 171, 0.16)',
|
|
12
|
+
primary: `0 8px 16px 0 ${palette_js_1.bayonPalette.primary.light}33`,
|
|
13
|
+
secondary: `0 8px 16px 0 ${palette_js_1.bayonPalette.secondary.light}33`,
|
|
14
|
+
info: `0 8px 16px 0 ${palette_js_1.bayonPalette.info.light}33`,
|
|
15
|
+
success: `0 8px 16px 0 ${palette_js_1.bayonPalette.success.light}33`,
|
|
16
|
+
warning: `0 8px 16px 0 ${palette_js_1.bayonPalette.warning.light}33`,
|
|
17
|
+
error: `0 8px 16px 0 ${palette_js_1.bayonPalette.error.light}33`,
|
|
18
|
+
card: '0 0 2px 0 rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12)',
|
|
19
|
+
dialog: '-40px 40px 80px -8px rgba(145, 158, 171, 0.24)',
|
|
20
|
+
dropdown: '0 8px 16px 0 rgba(145, 158, 171, 0.16)',
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ThemeOptions } from '@mui/material/styles';
|
|
2
|
+
export type BayonColorScale = {
|
|
3
|
+
lighter: string;
|
|
4
|
+
light: string;
|
|
5
|
+
main: string;
|
|
6
|
+
dark: string;
|
|
7
|
+
darker: string;
|
|
8
|
+
contrastText: string;
|
|
9
|
+
};
|
|
10
|
+
export type BayonCustomShadows = {
|
|
11
|
+
z1: string;
|
|
12
|
+
z8: string;
|
|
13
|
+
z12: string;
|
|
14
|
+
z16: string;
|
|
15
|
+
z20: string;
|
|
16
|
+
z24: string;
|
|
17
|
+
primary: string;
|
|
18
|
+
secondary: string;
|
|
19
|
+
info: string;
|
|
20
|
+
success: string;
|
|
21
|
+
warning: string;
|
|
22
|
+
error: string;
|
|
23
|
+
card: string;
|
|
24
|
+
dialog: string;
|
|
25
|
+
dropdown: string;
|
|
26
|
+
};
|
|
27
|
+
export type BayonThemeMode = 'light' | 'dark';
|
|
28
|
+
export type CreateBayonThemeOptions = {
|
|
29
|
+
mode?: BayonThemeMode;
|
|
30
|
+
overrides?: ThemeOptions;
|
|
31
|
+
};
|
|
32
|
+
declare module '@mui/material/styles' {
|
|
33
|
+
interface PaletteColor {
|
|
34
|
+
lighter?: string;
|
|
35
|
+
darker?: string;
|
|
36
|
+
}
|
|
37
|
+
interface SimplePaletteColorOptions {
|
|
38
|
+
lighter?: string;
|
|
39
|
+
darker?: string;
|
|
40
|
+
}
|
|
41
|
+
interface Theme {
|
|
42
|
+
customShadows: BayonCustomShadows;
|
|
43
|
+
}
|
|
44
|
+
interface ThemeOptions {
|
|
45
|
+
customShadows?: Partial<BayonCustomShadows>;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bayonTypography = void 0;
|
|
4
|
+
exports.bayonTypography = {
|
|
5
|
+
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
6
|
+
h1: {
|
|
7
|
+
fontWeight: 700,
|
|
8
|
+
fontSize: '2.5rem',
|
|
9
|
+
lineHeight: 1.2,
|
|
10
|
+
},
|
|
11
|
+
h2: {
|
|
12
|
+
fontWeight: 700,
|
|
13
|
+
fontSize: '2rem',
|
|
14
|
+
lineHeight: 1.3,
|
|
15
|
+
},
|
|
16
|
+
h3: {
|
|
17
|
+
fontWeight: 700,
|
|
18
|
+
fontSize: '1.75rem',
|
|
19
|
+
lineHeight: 1.4,
|
|
20
|
+
},
|
|
21
|
+
h4: {
|
|
22
|
+
fontWeight: 600,
|
|
23
|
+
fontSize: '1.5rem',
|
|
24
|
+
lineHeight: 1.5,
|
|
25
|
+
},
|
|
26
|
+
h5: {
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
fontSize: '1.25rem',
|
|
29
|
+
lineHeight: 1.5,
|
|
30
|
+
},
|
|
31
|
+
h6: {
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
fontSize: '1.125rem',
|
|
34
|
+
lineHeight: 1.6,
|
|
35
|
+
},
|
|
36
|
+
body1: {
|
|
37
|
+
fontSize: '1rem',
|
|
38
|
+
lineHeight: 1.7,
|
|
39
|
+
},
|
|
40
|
+
body2: {
|
|
41
|
+
fontSize: '0.875rem',
|
|
42
|
+
lineHeight: 1.7,
|
|
43
|
+
},
|
|
44
|
+
subtitle1: {
|
|
45
|
+
fontSize: '1rem',
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
lineHeight: 1.7,
|
|
48
|
+
},
|
|
49
|
+
subtitle2: {
|
|
50
|
+
fontSize: '0.875rem',
|
|
51
|
+
fontWeight: 500,
|
|
52
|
+
lineHeight: 1.7,
|
|
53
|
+
},
|
|
54
|
+
button: {
|
|
55
|
+
textTransform: 'none',
|
|
56
|
+
fontWeight: 500,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -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,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ActionToast = ActionToast;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const Toast_js_1 = require("./Toast.js");
|
|
8
|
+
// The host owns expiry and action semantics: dismissing a notification must
|
|
9
|
+
// never implicitly commit a deletion or cancel a transaction in this package.
|
|
10
|
+
function ActionToast({ message, actionLabel, actionAriaLabel, onAction, actionDisabled = false, ToastComponent = Toast_js_1.Toast, ...toastProps }) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(ToastComponent, { ...toastProps, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", sx: { alignItems: "center", gap: 1, justifyContent: "space-between" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { noWrap: true, sx: { fontSize: 14, fontWeight: 650 }, children: message }), (0, jsx_runtime_1.jsx)(material_1.Button, { "aria-label": actionAriaLabel, disabled: actionDisabled, onClick: onAction, size: "small", sx: { flexShrink: 0, fontWeight: 760, minWidth: 0, px: 1 }, children: actionLabel })] }) }));
|
|
12
|
+
}
|
|
@@ -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,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Toast = Toast;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const useUpwardToastDismiss_js_1 = require("./useUpwardToastDismiss.js");
|
|
8
|
+
function Toast({ ariaLive, mobileTopOffset = 16, mobileBottomOffset = 16, children, contained = false, dataComponent, onDismiss, placement = "bottom-end", role = "status", sx, variant = "standard", }) {
|
|
9
|
+
const topCentered = placement === "top-center";
|
|
10
|
+
const swipeDismiss = (0, useUpwardToastDismiss_js_1.useUpwardToastDismiss)({
|
|
11
|
+
onDismiss,
|
|
12
|
+
transform: topCentered ? "translateX(-50%)" : "",
|
|
13
|
+
});
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { "aria-live": ariaLive, "data-component": dataComponent, "data-presentation": contained ? "workspace-contained" : "viewport", "data-swipe-dismiss": onDismiss ? "up" : undefined, role: role, ...swipeDismiss.pointerHandlers, sx: [
|
|
15
|
+
{
|
|
16
|
+
...(topCentered
|
|
17
|
+
? {
|
|
18
|
+
bottom: { xs: "auto", md: contained ? 24 : "auto" },
|
|
19
|
+
left: "50%",
|
|
20
|
+
maxWidth: { xs: "none", md: 460 },
|
|
21
|
+
position: contained
|
|
22
|
+
? { xs: "fixed", md: "absolute" }
|
|
23
|
+
: "fixed",
|
|
24
|
+
top: { xs: mobileTopOffset, md: contained ? "auto" : 24 },
|
|
25
|
+
transform: "translateX(-50%)",
|
|
26
|
+
width: {
|
|
27
|
+
xs: "calc(100vw - 16px)",
|
|
28
|
+
md: contained ? "calc(100% - 32px)" : "calc(100vw - 32px)",
|
|
29
|
+
},
|
|
30
|
+
zIndex: 1600,
|
|
31
|
+
}
|
|
32
|
+
: {
|
|
33
|
+
bottom: { xs: mobileBottomOffset, md: 24 },
|
|
34
|
+
maxWidth: { xs: "calc(100vw - 32px)", sm: 476 },
|
|
35
|
+
position: "fixed",
|
|
36
|
+
right: { xs: 16, md: 24 },
|
|
37
|
+
zIndex: (theme) => theme.zIndex.snackbar,
|
|
38
|
+
}),
|
|
39
|
+
...(variant === "standard"
|
|
40
|
+
? {
|
|
41
|
+
bgcolor: "background.paper",
|
|
42
|
+
border: 1,
|
|
43
|
+
borderColor: "divider",
|
|
44
|
+
borderRadius: 2,
|
|
45
|
+
boxShadow: 6,
|
|
46
|
+
color: "text.primary",
|
|
47
|
+
px: 1.5,
|
|
48
|
+
py: 1.25,
|
|
49
|
+
}
|
|
50
|
+
: {}),
|
|
51
|
+
},
|
|
52
|
+
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
53
|
+
...(swipeDismiss.sx ? [swipeDismiss.sx] : []),
|
|
54
|
+
], children: children }));
|
|
55
|
+
}
|
|
@@ -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,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TOAST_UPWARD_DISMISS_DISTANCE_PX = exports.useUpwardToastDismiss = exports.ActionToast = exports.Toast = void 0;
|
|
5
|
+
// TL-M249: preserve the established MUI presentation under its owning package.
|
|
6
|
+
var Toast_js_1 = require("./Toast.js");
|
|
7
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Toast_js_1.Toast; } });
|
|
8
|
+
var ActionToast_js_1 = require("./ActionToast.js");
|
|
9
|
+
Object.defineProperty(exports, "ActionToast", { enumerable: true, get: function () { return ActionToast_js_1.ActionToast; } });
|
|
10
|
+
var useUpwardToastDismiss_js_1 = require("./useUpwardToastDismiss.js");
|
|
11
|
+
Object.defineProperty(exports, "useUpwardToastDismiss", { enumerable: true, get: function () { return useUpwardToastDismiss_js_1.useUpwardToastDismiss; } });
|
|
12
|
+
Object.defineProperty(exports, "TOAST_UPWARD_DISMISS_DISTANCE_PX", { enumerable: true, get: function () { return useUpwardToastDismiss_js_1.TOAST_UPWARD_DISMISS_DISTANCE_PX; } });
|
|
@@ -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,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TOAST_UPWARD_DISMISS_DISTANCE_PX = void 0;
|
|
5
|
+
exports.useUpwardToastDismiss = useUpwardToastDismiss;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
exports.TOAST_UPWARD_DISMISS_DISTANCE_PX = 64;
|
|
8
|
+
function useUpwardToastDismiss({ onDismiss, transform, }) {
|
|
9
|
+
const pointerStartYRef = (0, react_1.useRef)(null);
|
|
10
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
11
|
+
const [swipeOffsetY, setSwipeOffsetY] = (0, react_1.useState)(0);
|
|
12
|
+
const resetDrag = (0, react_1.useCallback)(() => {
|
|
13
|
+
pointerStartYRef.current = null;
|
|
14
|
+
setIsDragging(false);
|
|
15
|
+
setSwipeOffsetY(0);
|
|
16
|
+
}, []);
|
|
17
|
+
const onPointerDown = (0, react_1.useCallback)((event) => {
|
|
18
|
+
if (!onDismiss || isInteractiveTarget(event.target)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pointerStartYRef.current = event.clientY;
|
|
22
|
+
setIsDragging(true);
|
|
23
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
24
|
+
}, [onDismiss]);
|
|
25
|
+
const onPointerMove = (0, react_1.useCallback)((event) => {
|
|
26
|
+
if (!onDismiss || pointerStartYRef.current === null) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
setSwipeOffsetY(Math.min(0, event.clientY - pointerStartYRef.current));
|
|
31
|
+
}, [onDismiss]);
|
|
32
|
+
const onPointerUp = (0, react_1.useCallback)((event) => {
|
|
33
|
+
const pointerStartY = pointerStartYRef.current;
|
|
34
|
+
if (!onDismiss || pointerStartY === null) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const upwardDistance = pointerStartY - event.clientY;
|
|
38
|
+
resetDrag();
|
|
39
|
+
if (upwardDistance >= exports.TOAST_UPWARD_DISMISS_DISTANCE_PX) {
|
|
40
|
+
onDismiss();
|
|
41
|
+
}
|
|
42
|
+
}, [onDismiss, resetDrag]);
|
|
43
|
+
const pointerHandlers = (0, react_1.useMemo)(() => onDismiss
|
|
44
|
+
? {
|
|
45
|
+
onPointerCancel: resetDrag,
|
|
46
|
+
onPointerDown,
|
|
47
|
+
onPointerMove,
|
|
48
|
+
onPointerUp,
|
|
49
|
+
}
|
|
50
|
+
: undefined, [onDismiss, onPointerDown, onPointerMove, onPointerUp, resetDrag]);
|
|
51
|
+
const sx = (0, react_1.useMemo)(() => onDismiss
|
|
52
|
+
? {
|
|
53
|
+
// Product decision: direct manipulation is reserved for the toast
|
|
54
|
+
// surface; nested actions such as Undo retain their normal taps.
|
|
55
|
+
animation: isDragging ? "none" : undefined,
|
|
56
|
+
touchAction: "none",
|
|
57
|
+
transform: `${transform ? `${transform} ` : ""}translateY(${swipeOffsetY}px)`,
|
|
58
|
+
transition: isDragging
|
|
59
|
+
? "none"
|
|
60
|
+
: "transform 160ms cubic-bezier(0.2, 0, 0, 1)",
|
|
61
|
+
userSelect: "none",
|
|
62
|
+
WebkitTouchCallout: "none",
|
|
63
|
+
WebkitUserSelect: "none",
|
|
64
|
+
willChange: isDragging ? "transform" : "auto",
|
|
65
|
+
}
|
|
66
|
+
: undefined, [isDragging, onDismiss, swipeOffsetY, transform]);
|
|
67
|
+
return { pointerHandlers, sx };
|
|
68
|
+
}
|
|
69
|
+
function isInteractiveTarget(target) {
|
|
70
|
+
var _a;
|
|
71
|
+
const element = target;
|
|
72
|
+
return Boolean((_a = element === null || element === void 0 ? void 0 : element.closest) === null || _a === void 0 ? void 0 : _a.call(element, "button, a, input, select, textarea, [role='button']"));
|
|
73
|
+
}
|
|
@@ -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,187 @@
|
|
|
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.CameraCaptureDialog = CameraCaptureDialog;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
|
+
const CameraAlt_1 = __importDefault(require("@mui/icons-material/CameraAlt"));
|
|
12
|
+
const cameraCropPresentation_js_1 = require("./cameraCropPresentation.js");
|
|
13
|
+
const cameraCropPresentation_js_2 = require("./cameraCropPresentation.js");
|
|
14
|
+
const DEFAULT_LABELS = {
|
|
15
|
+
title: "Take photo",
|
|
16
|
+
close: "Close camera",
|
|
17
|
+
preview: "Camera preview",
|
|
18
|
+
capture: "Take photo",
|
|
19
|
+
opening: "Opening camera…",
|
|
20
|
+
ready: "Take a photo, then adjust its crop.",
|
|
21
|
+
denied: "Camera access was denied. Allow camera access in your browser, then reopen the camera, or choose a photo.",
|
|
22
|
+
unavailable: "The camera is unavailable. Check that it is connected and not in use, then reopen the camera, or choose a photo.",
|
|
23
|
+
previewError: "The camera preview could not start. Close the camera and try again, or choose a photo.",
|
|
24
|
+
captureError: "The photo could not be captured. Close the camera and try again, or choose a photo.",
|
|
25
|
+
};
|
|
26
|
+
/** Owns camera resources only; the host owns crop, upload and persistence. */
|
|
27
|
+
function CameraCaptureDialog({ onClose, onCapture, labels, facingMode = "user", fileName = "camera.jpg", previewMaxHeight = "50dvh", }) {
|
|
28
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
29
|
+
const copyRef = (0, react_1.useRef)(copy);
|
|
30
|
+
// Publish copy after commit so abandoned renders cannot change async feedback.
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
copyRef.current = copy;
|
|
33
|
+
});
|
|
34
|
+
// Product decision: changing copy must never request camera permission again.
|
|
35
|
+
const initialFacingMode = (0, react_1.useRef)(facingMode);
|
|
36
|
+
const titleId = (0, react_1.useId)();
|
|
37
|
+
const video = (0, react_1.useRef)(null);
|
|
38
|
+
const stream = (0, react_1.useRef)(null);
|
|
39
|
+
const active = (0, react_1.useRef)(true);
|
|
40
|
+
const capturing = (0, react_1.useRef)(false);
|
|
41
|
+
const [ready, setReady] = (0, react_1.useState)(false);
|
|
42
|
+
const [busy, setBusy] = (0, react_1.useState)(false);
|
|
43
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
44
|
+
const attachPreview = (0, react_1.useCallback)((preview) => {
|
|
45
|
+
video.current = preview;
|
|
46
|
+
const acquired = stream.current;
|
|
47
|
+
if (!preview || !acquired || !active.current)
|
|
48
|
+
return;
|
|
49
|
+
// Dialog portals can mount after permission resolves. Attach from both sides
|
|
50
|
+
// of that race so an accepted camera never waits forever for its preview.
|
|
51
|
+
preview.srcObject = acquired;
|
|
52
|
+
void preview
|
|
53
|
+
.play()
|
|
54
|
+
.then(() => {
|
|
55
|
+
if (active.current &&
|
|
56
|
+
stream.current === acquired &&
|
|
57
|
+
video.current === preview &&
|
|
58
|
+
preview.readyState >= 2)
|
|
59
|
+
setReady(true);
|
|
60
|
+
})
|
|
61
|
+
.catch((cause) => {
|
|
62
|
+
if (!active.current ||
|
|
63
|
+
stream.current !== acquired ||
|
|
64
|
+
video.current !== preview)
|
|
65
|
+
return;
|
|
66
|
+
console.error("[CameraCaptureDialog] Could not play camera preview.", {
|
|
67
|
+
cause,
|
|
68
|
+
});
|
|
69
|
+
acquired.getTracks().forEach((track) => track.stop());
|
|
70
|
+
stream.current = null;
|
|
71
|
+
preview.srcObject = null;
|
|
72
|
+
setReady(false);
|
|
73
|
+
setError(copyRef.current.previewError);
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
function stop() {
|
|
77
|
+
var _a;
|
|
78
|
+
(_a = stream.current) === null || _a === void 0 ? void 0 : _a.getTracks().forEach((track) => track.stop());
|
|
79
|
+
stream.current = null;
|
|
80
|
+
if (video.current)
|
|
81
|
+
video.current.srcObject = null;
|
|
82
|
+
}
|
|
83
|
+
function close() {
|
|
84
|
+
active.current = false;
|
|
85
|
+
stop();
|
|
86
|
+
onClose();
|
|
87
|
+
}
|
|
88
|
+
(0, react_1.useEffect)(() => {
|
|
89
|
+
let cancelled = false;
|
|
90
|
+
active.current = true;
|
|
91
|
+
// Camera consent follows the explicit menu action. Every owned stream, including
|
|
92
|
+
// a permission result arriving after dismissal, must stop before leaving capture.
|
|
93
|
+
async function start() {
|
|
94
|
+
var _a;
|
|
95
|
+
try {
|
|
96
|
+
if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia))
|
|
97
|
+
throw new Error("Camera API unavailable");
|
|
98
|
+
const acquired = await navigator.mediaDevices.getUserMedia({
|
|
99
|
+
video: { facingMode: initialFacingMode.current },
|
|
100
|
+
audio: false,
|
|
101
|
+
});
|
|
102
|
+
if (cancelled || !active.current) {
|
|
103
|
+
acquired.getTracks().forEach((track) => track.stop());
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
stream.current = acquired;
|
|
107
|
+
attachPreview(video.current);
|
|
108
|
+
}
|
|
109
|
+
catch (cause) {
|
|
110
|
+
if (cancelled || !active.current)
|
|
111
|
+
return;
|
|
112
|
+
console.error("[CameraCaptureDialog] Could not start camera.", {
|
|
113
|
+
cause,
|
|
114
|
+
});
|
|
115
|
+
stop();
|
|
116
|
+
const denied = cause instanceof DOMException &&
|
|
117
|
+
(cause.name === "NotAllowedError" || cause.name === "SecurityError");
|
|
118
|
+
setError(denied ? copyRef.current.denied : copyRef.current.unavailable);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
void start();
|
|
122
|
+
return () => {
|
|
123
|
+
cancelled = true;
|
|
124
|
+
active.current = false;
|
|
125
|
+
stop();
|
|
126
|
+
};
|
|
127
|
+
}, [attachPreview]);
|
|
128
|
+
function capture() {
|
|
129
|
+
if (!ready || error || capturing.current || !active.current)
|
|
130
|
+
return;
|
|
131
|
+
capturing.current = true;
|
|
132
|
+
setBusy(true);
|
|
133
|
+
try {
|
|
134
|
+
const preview = video.current;
|
|
135
|
+
if (!preview || !preview.videoWidth || !preview.videoHeight)
|
|
136
|
+
throw new Error("Camera frame is not ready");
|
|
137
|
+
const canvas = document.createElement("canvas");
|
|
138
|
+
canvas.width = preview.videoWidth;
|
|
139
|
+
canvas.height = preview.videoHeight;
|
|
140
|
+
const context = canvas.getContext("2d");
|
|
141
|
+
if (!context)
|
|
142
|
+
throw new Error("Camera capture canvas is unavailable");
|
|
143
|
+
context.drawImage(preview, 0, 0);
|
|
144
|
+
canvas.toBlob((blob) => {
|
|
145
|
+
if (!active.current)
|
|
146
|
+
return;
|
|
147
|
+
if (!blob) {
|
|
148
|
+
console.error("[CameraCaptureDialog] Camera capture returned no image.");
|
|
149
|
+
setError(copyRef.current.captureError);
|
|
150
|
+
setBusy(false);
|
|
151
|
+
capturing.current = false;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
active.current = false;
|
|
155
|
+
stop();
|
|
156
|
+
// Capture only prepares the existing crop flow; it never uploads or publishes.
|
|
157
|
+
onCapture(new File([blob], fileName, { type: "image/jpeg" }));
|
|
158
|
+
}, "image/jpeg", 0.92);
|
|
159
|
+
}
|
|
160
|
+
catch (cause) {
|
|
161
|
+
console.error("[CameraCaptureDialog] Could not capture photo.", {
|
|
162
|
+
cause,
|
|
163
|
+
});
|
|
164
|
+
setError(copyRef.current.captureError);
|
|
165
|
+
setBusy(false);
|
|
166
|
+
capturing.current = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, { open: true, fullWidth: true, maxWidth: "xs", onClose: close, "aria-labelledby": titleId, onKeyDown: (event) => {
|
|
170
|
+
if (event.key === "Enter") {
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
if (!(event.target instanceof HTMLButtonElement))
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
}
|
|
175
|
+
}, 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, onClose: close })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "video", ref: attachPreview, autoPlay: true, muted: true, playsInline: true, "aria-label": copy.preview, onLoadedData: () => {
|
|
176
|
+
var _a;
|
|
177
|
+
if (active.current &&
|
|
178
|
+
stream.current &&
|
|
179
|
+
((_a = video.current) === null || _a === void 0 ? void 0 : _a.srcObject) === stream.current)
|
|
180
|
+
setReady(true);
|
|
181
|
+
}, sx: {
|
|
182
|
+
width: "100%",
|
|
183
|
+
maxHeight: previewMaxHeight,
|
|
184
|
+
bgcolor: "action.hover",
|
|
185
|
+
borderRadius: 1,
|
|
186
|
+
} }), error ? ((0, jsx_runtime_1.jsx)(cameraCropPresentation_js_2.StatusNotice, { tone: "error", message: error })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: "text.secondary", role: "status", children: ready ? copy.ready : copy.opening }))] }), (0, jsx_runtime_1.jsx)(cameraCropPresentation_js_1.DialogActionButtons, { confirmLabel: copy.capture, confirmDisabled: !ready || Boolean(error) || busy, confirmIcon: busy ? (0, jsx_runtime_1.jsx)(cameraCropPresentation_js_1.DialogActionProgress, {}) : (0, jsx_runtime_1.jsx)(CameraAlt_1.default, {}), onConfirm: capture })] }));
|
|
187
|
+
}
|