@bayonai/mui-design 1.10.0 → 1.10.1
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 +4 -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 +155 -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 +149 -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/package.json +2 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Stack, Typography } from "@mui/material";
|
|
4
|
+
import { METADATA_FIELD_LABEL_SPACING } from "./MetadataFieldGroup.js";
|
|
5
|
+
// Shared recipes preserve the field's label rhythm and underlined value row.
|
|
6
|
+
export const metadataFieldLabelSx = {
|
|
7
|
+
color: "text.secondary",
|
|
8
|
+
fontSize: "0.75rem",
|
|
9
|
+
fontWeight: 700,
|
|
10
|
+
letterSpacing: "0.04em",
|
|
11
|
+
lineHeight: 1.2,
|
|
12
|
+
textTransform: "uppercase",
|
|
13
|
+
};
|
|
14
|
+
export const metadataValueRowSx = {
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
borderBottom: 1,
|
|
17
|
+
borderColor: "divider",
|
|
18
|
+
minHeight: 40,
|
|
19
|
+
minWidth: 0,
|
|
20
|
+
};
|
|
21
|
+
export function MetadataValueField({ label, children, actions, }) {
|
|
22
|
+
return (_jsxs(Stack, { spacing: METADATA_FIELD_LABEL_SPACING, sx: { minWidth: 0 }, children: [_jsx(Typography, { component: "span", variant: "caption", sx: metadataFieldLabelSx, children: label }), _jsxs(Stack, { direction: "row", spacing: 0.5, sx: metadataValueRowSx, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0, overflowWrap: "anywhere" }, children: children }), actions] })] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
4
|
+
import { InputAdornment, Tooltip } from "@mui/material";
|
|
5
|
+
import { LoadingIconButton } from "../actions/LoadingIconButton.js";
|
|
6
|
+
export function SearchInputAction({ label, loadingLabel, loading = false, disabled = false, onSearch, }) {
|
|
7
|
+
return (_jsx(InputAdornment, { position: "end", children: _jsx(Tooltip, { title: loading ? loadingLabel : label, children: _jsx("span", { children: _jsx(LoadingIconButton, { "aria-label": label, loadingLabel: loadingLabel, loading: loading, disabled: disabled, onClick: onSearch, type: "button", edge: "end", children: _jsx(SearchIcon, {}) }) }) }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Chip } from "@mui/material";
|
|
4
|
+
export function TemplateBadge({ label = "Template" }) {
|
|
5
|
+
return (_jsx(Chip, { component: "span", label: label, size: "small", sx: { flex: "0 0 auto", fontSize: "0.68rem", height: 20, ml: 1 } }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogContent, DialogTitle, List, ListItemButton, ListItemText, Stack, TextField, Typography, } from "@mui/material";
|
|
4
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
5
|
+
import { DialogCloseButton } from "../actions/DialogActionButtons.js";
|
|
6
|
+
import { StatusNotice } from "../feedback/StatusNotice.js";
|
|
7
|
+
import { SearchInputAction } from "./SearchInputAction.js";
|
|
8
|
+
import { GoogleMapsAttribution } from "./GoogleMapsAttribution.js";
|
|
9
|
+
const defaultCopy = {
|
|
10
|
+
title: "Choose a venue",
|
|
11
|
+
close: "Close venue search",
|
|
12
|
+
queryLabel: "Venue name",
|
|
13
|
+
queryHelp: "Add a city or country to narrow the matches.",
|
|
14
|
+
queryTooLong: "Use a shorter venue name (up to 200 characters).",
|
|
15
|
+
search: "Search venues",
|
|
16
|
+
searching: "Searching venues",
|
|
17
|
+
loading: "Finding venues…",
|
|
18
|
+
resultsLabel: "Matching venues",
|
|
19
|
+
chooseResult: "Select the right venue, or adjust the name and search again.",
|
|
20
|
+
noResults: "No venues found. Add a city or country to the name and search again.",
|
|
21
|
+
failure: "Couldn't load venues. Your current location is unchanged.",
|
|
22
|
+
};
|
|
23
|
+
export function VenueSearchDialog({ placeName = "", canSearch = true, searchVenues, copy, onClose, onChange, }) {
|
|
24
|
+
const titleId = useId();
|
|
25
|
+
const labels = { ...defaultCopy, ...copy };
|
|
26
|
+
const [query, setQuery] = useState(placeName);
|
|
27
|
+
const [venues, setVenues] = useState(null);
|
|
28
|
+
const [pending, setPending] = useState(false);
|
|
29
|
+
const [message, setMessage] = useState(null);
|
|
30
|
+
const generation = useRef(0);
|
|
31
|
+
const busy = useRef(false);
|
|
32
|
+
useEffect(() => () => {
|
|
33
|
+
generation.current++;
|
|
34
|
+
}, []);
|
|
35
|
+
async function search() {
|
|
36
|
+
const name = query.trim();
|
|
37
|
+
if (busy.current || !canSearch || name.length < 2 || name.length > 200)
|
|
38
|
+
return;
|
|
39
|
+
const current = ++generation.current;
|
|
40
|
+
busy.current = true;
|
|
41
|
+
setPending(true);
|
|
42
|
+
setMessage(null);
|
|
43
|
+
setVenues(null);
|
|
44
|
+
try {
|
|
45
|
+
// A deliberate Search is one billable lookup. Never search per keystroke,
|
|
46
|
+
// auto-select the first prediction, or persist Google's returned address.
|
|
47
|
+
const result = await searchVenues(name);
|
|
48
|
+
if (!Array.isArray(result))
|
|
49
|
+
throw new Error("Venue search returned an invalid result list.");
|
|
50
|
+
// Keep the picker bounded and never allow malformed provider IDs to be selected.
|
|
51
|
+
const choices = result
|
|
52
|
+
.slice(0, 5)
|
|
53
|
+
.filter((venue) => venue &&
|
|
54
|
+
typeof venue.placeId === "string" &&
|
|
55
|
+
venue.placeId.length > 0 &&
|
|
56
|
+
venue.placeId.length <= 512 &&
|
|
57
|
+
!/[\s\u0000-\u001f\u007f]/u.test(venue.placeId) &&
|
|
58
|
+
typeof venue.name === "string" &&
|
|
59
|
+
venue.name.trim().length > 0 &&
|
|
60
|
+
(venue.address === undefined || typeof venue.address === "string"));
|
|
61
|
+
if (current === generation.current)
|
|
62
|
+
setVenues(choices);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (current === generation.current) {
|
|
66
|
+
console.error("[Place venue search] Could not load venue choices; the selected location is unchanged.", { error });
|
|
67
|
+
setMessage(labels.failure);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
if (current === generation.current) {
|
|
72
|
+
busy.current = false;
|
|
73
|
+
setPending(false);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return (_jsxs(Dialog, { open: true, fullWidth: true, maxWidth: "sm", "aria-labelledby": titleId, onClose: onClose, children: [_jsxs(DialogTitle, { sx: { pr: 7 }, children: [_jsx("span", { id: titleId, children: labels.title }), _jsx(GoogleMapsAttribution, {})] }), _jsx(DialogCloseButton, { label: labels.close, onClose: onClose }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 2, sx: { pt: 1 }, children: [_jsx(TextField, { autoFocus: true, fullWidth: true, label: labels.queryLabel, value: query, error: query.trim().length > 200, helperText: query.trim().length > 200 ? labels.queryTooLong : labels.queryHelp, slotProps: {
|
|
78
|
+
htmlInput: { maxLength: 200 },
|
|
79
|
+
input: {
|
|
80
|
+
// Product decision: explicit search lives inside the field;
|
|
81
|
+
// Enter and this icon share one guarded request path.
|
|
82
|
+
endAdornment: (_jsx(SearchInputAction, { label: labels.search, loadingLabel: labels.searching, loading: pending, disabled: !canSearch ||
|
|
83
|
+
query.trim().length < 2 ||
|
|
84
|
+
query.trim().length > 200, onSearch: () => void search() })),
|
|
85
|
+
},
|
|
86
|
+
}, onChange: (event) => {
|
|
87
|
+
generation.current++;
|
|
88
|
+
busy.current = false;
|
|
89
|
+
setPending(false);
|
|
90
|
+
setQuery(event.target.value);
|
|
91
|
+
setVenues(null);
|
|
92
|
+
setMessage(null);
|
|
93
|
+
}, onKeyDown: (event) => {
|
|
94
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
void search();
|
|
97
|
+
}
|
|
98
|
+
} }), message ? _jsx(StatusNotice, { message: message, tone: "error" }) : null, _jsxs("div", { "aria-live": "polite", "aria-busy": pending, children: [pending ? (_jsx(Typography, { variant: "body2", color: "text.secondary", children: labels.loading })) : null, venues !== null ? (_jsx(Stack, { spacing: 1, children: venues.length ? (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body2", children: labels.chooseResult }), _jsx(List, { disablePadding: true, "aria-label": labels.resultsLabel, children: venues.map((venue) => (_jsx(ListItemButton, { component: "button", type: "button", sx: {
|
|
99
|
+
width: "100%",
|
|
100
|
+
textAlign: "left",
|
|
101
|
+
borderRadius: 1,
|
|
102
|
+
}, onClick: () => onChange({
|
|
103
|
+
provider: "google",
|
|
104
|
+
placeId: venue.placeId,
|
|
105
|
+
}), children: _jsx(ListItemText, { primary: venue.name, secondary: venue.address, slotProps: {
|
|
106
|
+
primary: { sx: { overflowWrap: "anywhere" } },
|
|
107
|
+
secondary: { sx: { overflowWrap: "anywhere" } },
|
|
108
|
+
} }) }, venue.placeId))) })] })) : (_jsx(Typography, { variant: "body2", children: labels.noResults })) })) : null] })] }) })] }));
|
|
109
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { VenueSearchDialog, } from "./VenueSearchDialog.js";
|
|
3
|
+
export { SearchInputAction, } from "./SearchInputAction.js";
|
|
4
|
+
export { MetadataValueField, metadataFieldLabelSx, metadataValueRowSx, } from "./MetadataValueField.js";
|
|
5
|
+
export { GeographicLocationField, } from "./GeographicLocationField.js";
|
|
6
|
+
export { TemplateBadge } from "./TemplateBadge.js";
|
|
7
|
+
export { MetadataFieldGroup, METADATA_FIELD_GROUP_SPACING, METADATA_FIELD_LABEL_SPACING, } from "./MetadataFieldGroup.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog, DialogTitle, DialogContent, IconButton, Stack, Tooltip, } from "@mui/material";
|
|
4
|
+
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
export function PendingChangesDialogShell({ children, open, onClose, title, titleIcon, contentHeader, contentTouchHandlers, contentSx, onEntered, closeLabel = "Close pending changes", }) {
|
|
7
|
+
const headerId = useId();
|
|
8
|
+
const titleId = `${headerId}-title`;
|
|
9
|
+
return (_jsxs(Dialog, { open: open, onClose: onClose, fullWidth: true, maxWidth: "sm", "aria-labelledby": titleId, slotProps: { transition: { onEntered } }, children: [_jsx(DialogTitle, { id: headerId, component: "div", children: _jsxs(Stack, { direction: "row", spacing: 1, sx: { alignItems: "center" }, children: [titleIcon, _jsx("span", { id: titleId, style: { flex: 1 }, children: title }), _jsx(Tooltip, { title: closeLabel, children: _jsx(IconButton, { "aria-label": closeLabel, onClick: onClose, sx: { width: 44, height: 44 }, children: _jsx(CloseRoundedIcon, {}) }) })] }) }), contentHeader ? (_jsx("div", { style: { padding: "0 24px 16px" }, children: contentHeader })) : null, _jsx(DialogContent, { ...contentTouchHandlers, sx: contentSx, children: children })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { IconButton, List, ListItem, Pagination, Stack, Typography, Tooltip, } from "@mui/material";
|
|
4
|
+
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
|
|
5
|
+
import DeleteOutlineRoundedIcon from "@mui/icons-material/DeleteOutlineRounded";
|
|
6
|
+
import CloudUploadOutlinedIcon from "@mui/icons-material/CloudUploadOutlined";
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
import { PendingChangesDialogShell } from "./PendingChangesDialogShell.js";
|
|
9
|
+
const pageSize = 10;
|
|
10
|
+
export function PendingChangesDialogView({ groups, open, onClose, title, summary, emptyMessage = "All changes are saved.", accountKey, onOpenItem, onDiscardRequest, discardLabel = "Discard a change", focusGroupKey, navigationError, contentHeader, contentTouchHandlers, shell: Shell = PendingChangesDialogShell, }) {
|
|
11
|
+
const returnItemButton = useRef(null);
|
|
12
|
+
const [page, setPage] = useState(1);
|
|
13
|
+
const [actionPages, setActionPages] = useState({});
|
|
14
|
+
const pages = Math.max(1, Math.ceil(groups.length / pageSize));
|
|
15
|
+
const visiblePage = Math.min(page, pages);
|
|
16
|
+
const [previousGroups, setPreviousGroups] = useState(groups);
|
|
17
|
+
const [previousAccount, setPreviousAccount] = useState(accountKey);
|
|
18
|
+
// Adjust pagination only when the source view changes. Guarded render state
|
|
19
|
+
// keeps the first painted frame bounded and avoids effect-driven page jumps.
|
|
20
|
+
if (previousGroups !== groups || previousAccount !== accountKey) {
|
|
21
|
+
setPreviousGroups(groups);
|
|
22
|
+
setPreviousAccount(accountKey);
|
|
23
|
+
if (previousAccount !== accountKey) {
|
|
24
|
+
setPage(1);
|
|
25
|
+
setActionPages({});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
setPage((current) => Math.min(current, pages));
|
|
29
|
+
setActionPages((current) => {
|
|
30
|
+
const next = {};
|
|
31
|
+
for (const group of groups)
|
|
32
|
+
if (current[group.key] !== undefined)
|
|
33
|
+
next[group.key] = Math.min(current[group.key], Math.max(1, Math.ceil(group.rows.length / pageSize)));
|
|
34
|
+
return Object.keys(next).length === Object.keys(current).length &&
|
|
35
|
+
Object.keys(next).every((key) => next[key] === current[key])
|
|
36
|
+
? current
|
|
37
|
+
: next;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs(Shell, { autoFocusInput: false, closeLabel: "Close pending changes", closeTooltip: "Close pending changes", contentHeader: contentHeader !== null && contentHeader !== void 0 ? contentHeader : (groups.length ? (
|
|
42
|
+
// Product decision: the sync summary remains distinct and visible
|
|
43
|
+
// while the user scrolls through pending groups.
|
|
44
|
+
_jsxs(Stack, { component: "section", "aria-label": "Pending changes summary", direction: "row", spacing: 1, sx: {
|
|
45
|
+
p: 2,
|
|
46
|
+
borderRadius: 1,
|
|
47
|
+
bgcolor: "action.selected",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
}, children: [_jsx(Typography, { variant: "body2", sx: { fontWeight: 600, flex: 1 }, children: summary }), onDiscardRequest ? (_jsx(Tooltip, { title: discardLabel, children: _jsx(IconButton, { "aria-label": discardLabel, onClick: onDiscardRequest, sx: { width: 44, height: 44 }, children: _jsx(DeleteOutlineRoundedIcon, {}) }) })) : null] })) : undefined), contentTouchHandlers: contentTouchHandlers, contentSx: { pt: 0.5, pb: 3, overscrollBehaviorY: "contain" }, exclusive: false, onClose: onClose, onEntered: () => {
|
|
50
|
+
// Entry focus runs after MUI settles its focus trap, including a reopen
|
|
51
|
+
// of the same inspector. A removed group retains the shell's fallback.
|
|
52
|
+
const target = returnItemButton.current;
|
|
53
|
+
if ((target === null || target === void 0 ? void 0 : target.isConnected) && !target.disabled)
|
|
54
|
+
target.focus();
|
|
55
|
+
}, open: open, title: title, titleIcon: _jsx(CloudUploadOutlinedIcon, {}), children: [navigationError ? (_jsx(Typography, { role: "alert", color: "error", variant: "body2", sx: { mb: 1 }, children: navigationError })) : null, groups.length ? (_jsxs(_Fragment, { children: [_jsx(List, { "aria-label": "Pending changes", disablePadding: true, sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: groups
|
|
56
|
+
.slice((visiblePage - 1) * pageSize, visiblePage * pageSize)
|
|
57
|
+
.map((group) => {
|
|
58
|
+
var _a;
|
|
59
|
+
const title = group.title;
|
|
60
|
+
const unavailableReason = group.unavailableReason;
|
|
61
|
+
const actionPageCount = Math.max(1, Math.ceil(group.rows.length / pageSize));
|
|
62
|
+
const actionPage = Math.min((_a = actionPages[group.key]) !== null && _a !== void 0 ? _a : 1, actionPageCount);
|
|
63
|
+
return (_jsx(ListItem, { disableGutters: true, sx: {
|
|
64
|
+
p: 2,
|
|
65
|
+
position: "relative",
|
|
66
|
+
alignItems: "flex-start",
|
|
67
|
+
border: 1,
|
|
68
|
+
borderColor: "divider",
|
|
69
|
+
borderRadius: 1,
|
|
70
|
+
}, children: _jsxs(Stack, { spacing: 0, sx: { minWidth: 0, width: "100%" }, children: [_jsxs(Stack, { direction: "row", spacing: 1, sx: {
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
}, children: [_jsx(Typography, { component: "h3", sx: {
|
|
74
|
+
flex: 1,
|
|
75
|
+
minWidth: 0,
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
overflowWrap: "anywhere",
|
|
78
|
+
}, variant: "body2", children: title }), _jsx(Stack, { direction: "row", spacing: 0.5, sx: {
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
flexShrink: 0,
|
|
81
|
+
}, children: group.openLabel && onOpenItem ? (_jsx(Tooltip, { title: unavailableReason || group.openLabel, children: _jsx("span", { tabIndex: unavailableReason ? 0 : undefined, "aria-label": unavailableReason
|
|
82
|
+
? `${group.openLabel} unavailable. ${unavailableReason}`
|
|
83
|
+
: undefined, children: _jsx(IconButton, { "aria-label": `${group.openLabel}: ${title}`, disabled: Boolean(unavailableReason), ref: focusGroupKey === group.key
|
|
84
|
+
? returnItemButton
|
|
85
|
+
: undefined, onClick: () => onOpenItem(group.key), size: "small", sx: { width: 44, height: 44 }, children: _jsx(ArrowForwardRoundedIcon, { fontSize: "small" }) }) }) })) : null })] }), _jsx(List, { "aria-label": `Changes for ${group.title}`, disablePadding: true, children: group.rows
|
|
86
|
+
.slice((actionPage - 1) * pageSize, actionPage * pageSize)
|
|
87
|
+
.map((item, index) => {
|
|
88
|
+
const presentation = item;
|
|
89
|
+
const exception = item.exception;
|
|
90
|
+
if (!presentation.action &&
|
|
91
|
+
!exception &&
|
|
92
|
+
!presentation.targetLabel &&
|
|
93
|
+
!presentation.elapsedText &&
|
|
94
|
+
presentation.attemptedText === undefined &&
|
|
95
|
+
!presentation.endAction)
|
|
96
|
+
return null;
|
|
97
|
+
return (_jsxs(ListItem, { disableGutters: true, sx: {
|
|
98
|
+
display: "flex",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
gap: 1,
|
|
101
|
+
py: 1,
|
|
102
|
+
borderTop: index > 0 ? 1 : 0,
|
|
103
|
+
borderColor: "divider",
|
|
104
|
+
}, children: [_jsxs(Stack, { spacing: 0.75, sx: { flex: 1, minWidth: 0 }, children: [_jsxs(Stack, { direction: "row", spacing: 1, sx: {
|
|
105
|
+
alignItems: "baseline",
|
|
106
|
+
justifyContent: "space-between",
|
|
107
|
+
flexWrap: "wrap",
|
|
108
|
+
}, children: [presentation.action ? (_jsx(Typography, { component: "h4", color: "text.secondary", variant: "caption", children: presentation.action })) : null, exception ? (_jsx(Typography, { color: item.needsAttention
|
|
109
|
+
? "error"
|
|
110
|
+
: "text.secondary", variant: "caption", children: exception })) : null] }), presentation.elapsedText ? (_jsx(Typography, { variant: "caption", sx: {
|
|
111
|
+
fontSize: "0.6875rem",
|
|
112
|
+
color: "text.primary",
|
|
113
|
+
opacity: 0.78,
|
|
114
|
+
}, children: presentation.elapsedText })) : null, presentation.targetLabel ? (_jsx(Typography, { color: "text.secondary", variant: "caption", sx: {
|
|
115
|
+
overflowWrap: "anywhere",
|
|
116
|
+
whiteSpace: "pre-wrap",
|
|
117
|
+
}, children: presentation.targetLabel })) : null, presentation.attemptedText !== undefined ? (_jsx(Typography, { variant: "body1", sx: {
|
|
118
|
+
whiteSpace: "pre-wrap",
|
|
119
|
+
overflowWrap: "anywhere",
|
|
120
|
+
}, children: presentation.attemptedText })) : null] }), presentation.endAction] }, item.id));
|
|
121
|
+
}) }), actionPageCount > 1 ? (_jsx(Pagination, { "aria-label": `Change pages for ${group.title}`, count: actionPageCount, page: actionPage, onChange: (_event, nextPage) => setActionPages((previous) => ({
|
|
122
|
+
...previous,
|
|
123
|
+
[group.key]: nextPage,
|
|
124
|
+
})), sx: {
|
|
125
|
+
"& .MuiPaginationItem-root": {
|
|
126
|
+
minWidth: 44,
|
|
127
|
+
minHeight: 44,
|
|
128
|
+
},
|
|
129
|
+
} })) : null] }) }, group.key));
|
|
130
|
+
}) }), pages > 1 ? (_jsx(Pagination, { "aria-label": "Pending changes pages", count: pages, onChange: (_event, nextPage) => setPage(nextPage), page: visiblePage, sx: {
|
|
131
|
+
mt: 2,
|
|
132
|
+
"& .MuiPaginationItem-root": { minWidth: 44, minHeight: 44 },
|
|
133
|
+
} })) : null] })) : (_jsx(Typography, { role: "status", sx: { py: 2 }, children: emptyMessage }))] }));
|
|
134
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, IconButton, Tooltip } from "@mui/material";
|
|
4
|
+
import { alpha } from "@mui/material/styles";
|
|
5
|
+
import CloudOffOutlinedIcon from "@mui/icons-material/CloudOffOutlined";
|
|
6
|
+
import CloudUploadOutlinedIcon from "@mui/icons-material/CloudUploadOutlined";
|
|
7
|
+
export function PendingChangesIndicatorView({ count, isOffline = false, label = `${count} pending ${count === 1 ? "change" : "changes"}`, explanation = "View pending changes", onOpen, sx, }) {
|
|
8
|
+
return (_jsx(Tooltip, { title: `${isOffline ? "Offline. " : ""}${label}. ${explanation}`, children: _jsx(IconButton, { "aria-label": `${isOffline ? "Offline. " : ""}${label}. View pending changes`, "aria-haspopup": "dialog", onClick: onOpen, sx: [
|
|
9
|
+
{
|
|
10
|
+
width: 44,
|
|
11
|
+
height: 44,
|
|
12
|
+
borderRadius: "50%",
|
|
13
|
+
color: "primary.main",
|
|
14
|
+
bgcolor: "background.paper",
|
|
15
|
+
"&:hover": {
|
|
16
|
+
bgcolor: (theme) => alpha(theme.palette.primary.main, 0.18),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
...(Array.isArray(sx) ? sx : sx ? [sx] : []),
|
|
20
|
+
], children: _jsx(Badge, { badgeContent: count, color: "primary", max: Number.MAX_SAFE_INTEGER, slotProps: { badge: { "aria-hidden": true } }, children: isOffline ? _jsx(CloudOffOutlinedIcon, {}) : _jsx(CloudUploadOutlinedIcon, {}) }) }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Box, Dialog, DialogContent, DialogTitle, Stack, Typography, } from "@mui/material";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { DialogActionButtons, DialogCloseButton, } from "../actions/DialogActionButtons.js";
|
|
6
|
+
import { DialogChoiceTile } from "../internal/DialogChoiceTile.js";
|
|
7
|
+
export function PlanUpgradeDialog({ title, message, plans, selectedPlanId, confirmLabel, closeLabel = "Close upgrade dialog", onSelectPlan, onViewPlan, onClose, }) {
|
|
8
|
+
const titleId = useId();
|
|
9
|
+
const messageId = useId();
|
|
10
|
+
const radioName = useId();
|
|
11
|
+
return (_jsxs(Dialog, { open: true, fullWidth: true, maxWidth: "sm", onClose: onClose, "aria-labelledby": titleId, "aria-describedby": messageId, children: [_jsxs(DialogTitle, { id: titleId, sx: { pr: 7 }, children: [title, _jsx(DialogCloseButton, { label: closeLabel, onClose: onClose })] }), _jsx(DialogContent, { children: _jsxs(Stack, { spacing: 2, children: [_jsx(Typography, { id: messageId, variant: "body2", color: "text.secondary", children: message }), _jsx(Box, { role: "radiogroup", "aria-label": "Upgrade plan", sx: {
|
|
12
|
+
display: "grid",
|
|
13
|
+
gridTemplateColumns: {
|
|
14
|
+
xs: "1fr",
|
|
15
|
+
sm: "repeat(2, minmax(0, 1fr))",
|
|
16
|
+
},
|
|
17
|
+
gap: 1,
|
|
18
|
+
}, children: plans.map((plan) => (_jsx(DialogChoiceTile, { name: radioName, label: plan.name, description: plan.details.map((detail) => (_jsx(Box, { component: "span", sx: { display: "block" }, children: detail }, detail))), selected: selectedPlanId === plan.id, autoFocus: selectedPlanId === plan.id, onSelect: () => onSelectPlan(plan.id) }, plan.id))) })] }) }), _jsx(DialogActionButtons, { confirmLabel: confirmLabel, confirmText: confirmLabel, onConfirm: () => onViewPlan(selectedPlanId) })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import CheckRoundedIcon from "@mui/icons-material/CheckRounded";
|
|
4
|
+
import { Box, Stack, Typography } from "@mui/material";
|
|
5
|
+
// Product decision: callers own plan content and actions; this component only
|
|
6
|
+
// presents the supplied plans and never determines prices or availability.
|
|
7
|
+
export function PricingTable({ label, plans, className, interactiveClassName, colors, appearance = "default", }) {
|
|
8
|
+
const dark = appearance === "darkComparison";
|
|
9
|
+
return (_jsx(Box, { "aria-label": label, className: className, sx: {
|
|
10
|
+
display: "grid",
|
|
11
|
+
gap: dark ? 2.5 : 1.5,
|
|
12
|
+
gridTemplateColumns: {
|
|
13
|
+
xs: "1fr",
|
|
14
|
+
md: `repeat(${plans.length}, minmax(0, 1fr))`,
|
|
15
|
+
},
|
|
16
|
+
}, children: plans.map((plan) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const highlighted = Boolean(plan.highlighted);
|
|
19
|
+
const secondary = dark ? "#c9c3dc" : highlighted ? "rgba(255,255,255,0.86)" : colors.muted;
|
|
20
|
+
return (_jsxs(Stack, { className: interactiveClassName, component: dark ? "section" : "div", "aria-label": dark ? ((_a = plan.accessibleLabel) !== null && _a !== void 0 ? _a : (typeof plan.label === "string" ? plan.label : plan.id)) : undefined, spacing: dark ? 2 : 2.25, sx: {
|
|
21
|
+
bgcolor: dark ? (highlighted ? "#27204d" : "#151327") : highlighted ? colors.accent : "#FFFFFF",
|
|
22
|
+
boxShadow: dark ? "none" : highlighted
|
|
23
|
+
? "0 8px 18px rgba(23, 106, 168, 0.22)"
|
|
24
|
+
: "none",
|
|
25
|
+
color: dark || highlighted ? "#f5efff" : colors.text,
|
|
26
|
+
minHeight: { md: dark ? 520 : 430 },
|
|
27
|
+
p: dark ? { xs: 2.5, md: 4 } : { xs: 2.5, sm: 3 },
|
|
28
|
+
position: "relative",
|
|
29
|
+
borderRadius: dark ? 2.5 : 2,
|
|
30
|
+
...(dark ? { border: highlighted ? "1px solid #b56ef3" : "1px solid #49405e" } : highlighted
|
|
31
|
+
? {}
|
|
32
|
+
: { border: "1px solid rgba(23, 38, 56, 0.12)" }),
|
|
33
|
+
...(!dark && { "&:hover": {
|
|
34
|
+
...(highlighted
|
|
35
|
+
? { boxShadow: "0 10px 22px rgba(23, 106, 168, 0.28)" }
|
|
36
|
+
: { bgcolor: "#FCFEFF" }),
|
|
37
|
+
transform: "translateY(-2px)",
|
|
38
|
+
} }),
|
|
39
|
+
}, children: [_jsxs(Stack, { direction: "row", spacing: 1, sx: { justifyContent: "space-between" }, children: [_jsx(Typography, { component: dark ? "h2" : "p", sx: { fontSize: dark ? { xs: 26, md: 34 } : 21, fontWeight: 780 }, children: plan.label }), plan.badge] }), _jsx(Typography, { sx: {
|
|
40
|
+
color: secondary,
|
|
41
|
+
fontSize: dark ? { xs: 15, md: 17 } : 14,
|
|
42
|
+
lineHeight: 1.5,
|
|
43
|
+
minHeight: { md: 42 },
|
|
44
|
+
}, children: plan.description }), _jsxs(Stack, { direction: dark ? "row" : "column", spacing: dark ? 1 : 0.25, sx: dark ? { alignItems: "baseline", flexWrap: "wrap" } : undefined, children: [_jsx(Typography, { sx: {
|
|
45
|
+
fontSize: dark ? { xs: 36, md: 56 } : { xs: 25, sm: 28 },
|
|
46
|
+
fontWeight: 780,
|
|
47
|
+
letterSpacing: "-0.03em",
|
|
48
|
+
}, children: plan.price }), _jsx(Typography, { sx: { color: secondary, fontSize: dark ? { xs: 15, md: 18 } : 13 }, children: plan.priceNote })] }), dark && _jsx(Box, { "aria-hidden": "true", sx: { borderTop: "1px solid #514761" } }), _jsx(Stack, { component: "ul", spacing: 1.1, sx: { listStyle: "none", m: 0, p: 0 }, children: plan.features.map((feature, index) => (_jsxs(Stack, { component: "li", direction: "row", spacing: 1, children: [_jsx(CheckRoundedIcon, { "aria-hidden": "true", sx: {
|
|
49
|
+
color: dark ? "#d5b3f9" : highlighted ? "#FFFFFF" : colors.accentDark,
|
|
50
|
+
fontSize: 18,
|
|
51
|
+
mt: "2px",
|
|
52
|
+
} }), _jsx(Typography, { sx: { fontSize: dark ? { xs: 15, md: 18 } : 14, lineHeight: 1.45 }, children: feature })] }, index))) }), _jsx(Box, { sx: { flex: 1 } }), plan.action] }, plan.id));
|
|
53
|
+
}) }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { CacheProvider } from '@emotion/react';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import CssBaseline from '@mui/material/CssBaseline';
|
|
7
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
8
|
+
import { createBayonTheme } from '../theme/createBayonTheme.js';
|
|
9
|
+
import { createBayonEmotionCache } from '../utils/createBayonEmotionCache.js';
|
|
10
|
+
const clientSideEmotionCache = createBayonEmotionCache();
|
|
11
|
+
const defaultStorageKey = 'bayon-theme-mode';
|
|
12
|
+
const themeModeChangeEvent = 'bayon-theme-mode-change';
|
|
13
|
+
const clientModeOverrides = new Map();
|
|
14
|
+
const BayonThemeModeContext = React.createContext(undefined);
|
|
15
|
+
function readStoredMode(storageKey, defaultMode) {
|
|
16
|
+
if (typeof window === 'undefined') {
|
|
17
|
+
return defaultMode;
|
|
18
|
+
}
|
|
19
|
+
const clientOverride = clientModeOverrides.get(storageKey);
|
|
20
|
+
if (clientOverride) {
|
|
21
|
+
return clientOverride;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const storedMode = window.localStorage.getItem(storageKey);
|
|
25
|
+
return storedMode === 'light' || storedMode === 'dark' ? storedMode : defaultMode;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('[bayon-theme] Failed to read the saved theme mode', { error, storageKey });
|
|
29
|
+
clientModeOverrides.set(storageKey, defaultMode);
|
|
30
|
+
return defaultMode;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function subscribeToStoredMode(storageKey, onStoreChange) {
|
|
34
|
+
const handleStorageChange = (event) => {
|
|
35
|
+
if (event.key === storageKey) {
|
|
36
|
+
clientModeOverrides.delete(storageKey);
|
|
37
|
+
onStoreChange();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const handleLocalChange = (event) => {
|
|
41
|
+
if (event instanceof CustomEvent && event.detail === storageKey) {
|
|
42
|
+
onStoreChange();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
window.addEventListener('storage', handleStorageChange);
|
|
46
|
+
window.addEventListener(themeModeChangeEvent, handleLocalChange);
|
|
47
|
+
return () => {
|
|
48
|
+
window.removeEventListener('storage', handleStorageChange);
|
|
49
|
+
window.removeEventListener(themeModeChangeEvent, handleLocalChange);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function useBayonThemeMode() {
|
|
53
|
+
const context = React.useContext(BayonThemeModeContext);
|
|
54
|
+
if (!context) {
|
|
55
|
+
throw new Error('useBayonThemeMode must be used inside BayonThemeProvider.');
|
|
56
|
+
}
|
|
57
|
+
return context;
|
|
58
|
+
}
|
|
59
|
+
class BayonThemeErrorBoundary extends React.Component {
|
|
60
|
+
constructor(props) {
|
|
61
|
+
super(props);
|
|
62
|
+
this.state = { hasError: false };
|
|
63
|
+
}
|
|
64
|
+
static getDerivedStateFromError() {
|
|
65
|
+
return { hasError: true };
|
|
66
|
+
}
|
|
67
|
+
componentDidCatch(error, errorInfo) {
|
|
68
|
+
console.error('Bayon theme error:', error, errorInfo);
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
if (this.state.hasError) {
|
|
72
|
+
return (_jsx(Box, { sx: {
|
|
73
|
+
display: 'flex',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
minHeight: '100vh',
|
|
77
|
+
bgcolor: 'background.default',
|
|
78
|
+
}, children: _jsxs(Box, { sx: { textAlign: 'center' }, children: [_jsx("h1", { children: "Something went wrong with the theme." }), _jsx("p", { children: "Please try refreshing the page or contact support if the problem persists." })] }) }));
|
|
79
|
+
}
|
|
80
|
+
return this.props.children;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function BayonThemeProvider({ children, emotionCache = clientSideEmotionCache, disableEmotionCacheProvider = false, theme, defaultMode = 'dark', storageKey = defaultStorageKey, enableErrorBoundary = true, }) {
|
|
84
|
+
const subscribe = React.useCallback((onStoreChange) => subscribeToStoredMode(storageKey, onStoreChange), [storageKey]);
|
|
85
|
+
const getSnapshot = React.useCallback(() => readStoredMode(storageKey, defaultMode), [defaultMode, storageKey]);
|
|
86
|
+
const getServerSnapshot = React.useCallback(() => defaultMode, [defaultMode]);
|
|
87
|
+
const mode = React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
88
|
+
const setMode = React.useCallback((nextMode) => {
|
|
89
|
+
if (typeof window === 'undefined') {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
clientModeOverrides.set(storageKey, nextMode);
|
|
93
|
+
try {
|
|
94
|
+
window.localStorage.setItem(storageKey, nextMode);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('[bayon-theme] Failed to persist the selected theme mode', {
|
|
98
|
+
error,
|
|
99
|
+
mode: nextMode,
|
|
100
|
+
storageKey,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
window.dispatchEvent(new CustomEvent(themeModeChangeEvent, { detail: storageKey }));
|
|
104
|
+
}, [storageKey]);
|
|
105
|
+
const toggleMode = React.useCallback(() => {
|
|
106
|
+
setMode(mode === 'dark' ? 'light' : 'dark');
|
|
107
|
+
}, [mode, setMode]);
|
|
108
|
+
const activeTheme = React.useMemo(() => theme !== null && theme !== void 0 ? theme : createBayonTheme({ mode }), [mode, theme]);
|
|
109
|
+
const modeContextValue = React.useMemo(() => ({
|
|
110
|
+
mode,
|
|
111
|
+
setMode,
|
|
112
|
+
toggleMode,
|
|
113
|
+
}), [mode, setMode, toggleMode]);
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
document.documentElement.setAttribute('data-theme', mode);
|
|
116
|
+
}, [mode]);
|
|
117
|
+
const content = enableErrorBoundary ? (_jsx(BayonThemeErrorBoundary, { children: children })) : (children);
|
|
118
|
+
const themedContent = (_jsx(ThemeProvider, { theme: activeTheme, children: _jsxs(BayonThemeModeContext.Provider, { value: modeContextValue, children: [_jsx(CssBaseline, { enableColorScheme: true }), content] }) }));
|
|
119
|
+
if (disableEmotionCacheProvider) {
|
|
120
|
+
return themedContent;
|
|
121
|
+
}
|
|
122
|
+
return _jsx(CacheProvider, { value: emotionCache, children: themedContent });
|
|
123
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
4
|
+
import { Box, ButtonBase, Stack } from "@mui/material";
|
|
5
|
+
export function ExpandableSectionToggle({ ariaControls, ariaLabel, children, endAdornment, expanded, onToggle, showExpandIcon = true, sx, }) {
|
|
6
|
+
return (_jsxs(ButtonBase, { "aria-controls": ariaControls, "aria-expanded": expanded, "aria-label": ariaLabel, "data-expandable-section-toggle": "true", onClick: onToggle, sx: {
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
borderRadius: 1,
|
|
9
|
+
color: "text.primary",
|
|
10
|
+
display: "flex",
|
|
11
|
+
gap: 1,
|
|
12
|
+
justifyContent: "space-between",
|
|
13
|
+
minWidth: 0,
|
|
14
|
+
px: 0.75,
|
|
15
|
+
py: 0.5,
|
|
16
|
+
textAlign: "left",
|
|
17
|
+
width: "100%",
|
|
18
|
+
"&:hover": { backgroundColor: "action.hover" },
|
|
19
|
+
"&:focus-visible": {
|
|
20
|
+
outline: "2px solid",
|
|
21
|
+
outlineColor: "primary.main",
|
|
22
|
+
outlineOffset: 2,
|
|
23
|
+
},
|
|
24
|
+
...sx,
|
|
25
|
+
}, type: "button", children: [_jsx(Box, { sx: { flex: "1 1 auto", minWidth: 0 }, children: children }), _jsxs(Stack, { direction: "row", spacing: 0.5, sx: { alignItems: "center", flex: "0 0 auto" }, children: [endAdornment, showExpandIcon ? (_jsx(ExpandMoreIcon, { "aria-hidden": "true", fontSize: "small", sx: { transform: expanded ? "rotate(180deg)" : "none" } })) : null] })] }));
|
|
26
|
+
}
|