@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,109 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/cjs/theme/types.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
package/dist/cjs/toasts/Toast.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
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";
|
package/dist/cjs/toasts/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,187 +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.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
|
-
}
|