@bayonai/mui-design 1.10.0 → 1.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/actions/ActionMenu.d.ts +24 -0
- package/dist/cjs/actions/ActionMenu.js +36 -0
- package/dist/cjs/actions/DialogActionButtons.d.ts +23 -0
- package/dist/cjs/actions/DialogActionButtons.js +33 -0
- package/dist/cjs/actions/LoadingIconButton.d.ts +11 -0
- package/dist/cjs/actions/LoadingIconButton.js +10 -0
- package/dist/cjs/actions/StickyActionFooter.d.ts +14 -0
- package/dist/cjs/actions/StickyActionFooter.js +27 -0
- package/dist/cjs/actions/StickySubmitButton.d.ts +10 -0
- package/dist/cjs/actions/StickySubmitButton.js +10 -0
- package/dist/cjs/actions/index.d.ts +5 -0
- package/dist/cjs/actions/index.js +18 -0
- package/dist/cjs/client.d.ts +4 -0
- package/dist/cjs/client.js +21 -0
- package/dist/cjs/components/BayonFlowVisual.d.ts +12 -0
- package/dist/cjs/components/BayonFlowVisual.js +87 -0
- package/dist/cjs/components/BayonThemeModeToggle.d.ts +6 -0
- package/dist/cjs/components/BayonThemeModeToggle.js +34 -0
- package/dist/cjs/components/IconTooltipButton.d.ts +10 -0
- package/dist/cjs/components/IconTooltipButton.js +50 -0
- package/dist/cjs/components/panels.d.ts +37 -0
- package/dist/cjs/components/panels.js +92 -0
- package/dist/cjs/drawers/BottomDrawer.d.ts +16 -0
- package/dist/cjs/drawers/BottomDrawer.js +43 -0
- package/dist/cjs/drawers/MobileBottomDrawer.d.ts +20 -0
- package/dist/cjs/drawers/MobileBottomDrawer.js +102 -0
- package/dist/cjs/drawers/MobileBottomDrawerHeader.d.ts +11 -0
- package/dist/cjs/drawers/MobileBottomDrawerHeader.js +36 -0
- package/dist/cjs/drawers/ResponsiveDrawer.d.ts +25 -0
- package/dist/cjs/drawers/ResponsiveDrawer.js +22 -0
- package/dist/cjs/drawers/WorkspaceSidePane.d.ts +31 -0
- package/dist/cjs/drawers/WorkspaceSidePane.js +228 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/cjs/drawers/WorkspaceSidePaneRoot.js +93 -0
- package/dist/cjs/drawers/drawerAppearance.d.ts +8 -0
- package/dist/cjs/drawers/drawerAppearance.js +10 -0
- package/dist/cjs/drawers/index.d.ts +7 -0
- package/dist/cjs/drawers/index.js +19 -0
- package/dist/cjs/drawers/useVisualViewportBottomInset.d.ts +6 -0
- package/dist/cjs/drawers/useVisualViewportBottomInset.js +33 -0
- package/dist/cjs/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/cjs/drawers/workspaceSidePaneGeometry.js +15 -0
- package/dist/cjs/feedback/StatusNotice.d.ts +13 -0
- package/dist/cjs/feedback/StatusNotice.js +62 -0
- package/dist/cjs/feedback/index.d.ts +1 -0
- package/dist/cjs/feedback/index.js +7 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/cjs/internal/DialogChoiceTile.js +60 -0
- package/dist/cjs/links/LinkAddressPreview.d.ts +21 -0
- package/dist/cjs/links/LinkAddressPreview.js +130 -0
- package/dist/cjs/links/index.d.ts +3 -0
- package/dist/cjs/links/index.js +9 -0
- package/dist/cjs/links/useLinkAddressPreview.d.ts +26 -0
- package/dist/cjs/links/useLinkAddressPreview.js +171 -0
- package/dist/cjs/location/GeographicLocationField.d.ts +26 -0
- package/dist/cjs/location/GeographicLocationField.js +49 -0
- package/dist/cjs/location/GoogleMapsAttribution.d.ts +1 -0
- package/dist/cjs/location/GoogleMapsAttribution.js +12 -0
- package/dist/cjs/location/MetadataFieldGroup.d.ts +5 -0
- package/dist/cjs/location/MetadataFieldGroup.js +13 -0
- package/dist/cjs/location/MetadataValueField.d.ts +23 -0
- package/dist/cjs/location/MetadataValueField.js +27 -0
- package/dist/cjs/location/SearchInputAction.d.ts +9 -0
- package/dist/cjs/location/SearchInputAction.js +14 -0
- package/dist/cjs/location/TemplateBadge.d.ts +5 -0
- package/dist/cjs/location/TemplateBadge.js +9 -0
- package/dist/cjs/location/VenueSearchDialog.d.ts +33 -0
- package/dist/cjs/location/VenueSearchDialog.js +112 -0
- package/dist/cjs/location/index.d.ts +6 -0
- package/dist/cjs/location/index.js +20 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pending/PendingChangesDialogShell.d.ts +2 -0
- package/dist/cjs/pending/PendingChangesDialogShell.js +16 -0
- package/dist/cjs/pending/PendingChangesDialogView.d.ts +2 -0
- package/dist/cjs/pending/PendingChangesDialogView.js +140 -0
- package/dist/cjs/pending/PendingChangesIndicatorView.d.ts +10 -0
- package/dist/cjs/pending/PendingChangesIndicatorView.js +27 -0
- package/dist/cjs/pending/index.d.ts +3 -0
- package/dist/cjs/pending/index.js +9 -0
- package/dist/cjs/pending/types.d.ts +55 -0
- package/dist/cjs/pending/types.js +2 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/cjs/pricing/PlanUpgradeDialog.js +22 -0
- package/dist/cjs/pricing/PricingTable.d.ts +28 -0
- package/dist/cjs/pricing/PricingTable.js +60 -0
- package/dist/cjs/pricing/index.d.ts +3 -0
- package/dist/cjs/pricing/index.js +8 -0
- package/dist/cjs/providers/BayonThemeProvider.d.ts +20 -0
- package/dist/cjs/providers/BayonThemeProvider.js +163 -0
- package/dist/cjs/sections/ExpandableSectionToggle.d.ts +12 -0
- package/dist/cjs/sections/ExpandableSectionToggle.js +32 -0
- package/dist/cjs/sections/index.d.ts +2 -0
- package/dist/cjs/sections/index.js +7 -0
- package/dist/cjs/styles/pageStyles.d.ts +15 -0
- package/dist/cjs/styles/pageStyles.js +103 -0
- package/dist/cjs/swipe/SwipeActionRow.d.ts +8 -0
- package/dist/cjs/swipe/SwipeActionRow.js +123 -0
- package/dist/cjs/swipe/index.d.ts +1 -0
- package/dist/cjs/swipe/index.js +8 -0
- package/dist/cjs/theme/components.d.ts +2 -0
- package/dist/cjs/theme/components.js +123 -0
- package/dist/cjs/theme/createBayonTheme.d.ts +4 -0
- package/dist/cjs/theme/createBayonTheme.js +45 -0
- package/dist/cjs/theme/palette.d.ts +146 -0
- package/dist/cjs/theme/palette.js +109 -0
- package/dist/cjs/theme/shadows.d.ts +2 -0
- package/dist/cjs/theme/shadows.js +21 -0
- package/dist/cjs/theme/types.d.ts +47 -0
- package/dist/cjs/theme/types.js +2 -0
- package/dist/cjs/theme/typography.d.ts +2 -0
- package/dist/cjs/theme/typography.js +58 -0
- package/dist/cjs/toasts/ActionToast.d.ts +11 -0
- package/dist/cjs/toasts/ActionToast.js +12 -0
- package/dist/cjs/toasts/Toast.d.ts +16 -0
- package/dist/cjs/toasts/Toast.js +55 -0
- package/dist/cjs/toasts/index.d.ts +5 -0
- package/dist/cjs/toasts/index.js +12 -0
- package/dist/cjs/toasts/useUpwardToastDismiss.d.ts +15 -0
- package/dist/cjs/toasts/useUpwardToastDismiss.js +73 -0
- package/dist/cjs/uploads/CameraCaptureDialog.d.ts +22 -0
- package/dist/cjs/uploads/CameraCaptureDialog.js +187 -0
- package/dist/cjs/uploads/FileRow.d.ts +10 -0
- package/dist/cjs/uploads/FileRow.js +23 -0
- package/dist/cjs/uploads/FileSwipeActionRow.d.ts +1 -0
- package/dist/cjs/uploads/FileSwipeActionRow.js +11 -0
- package/dist/cjs/uploads/FileThumbnail.d.ts +5 -0
- package/dist/cjs/uploads/FileThumbnail.js +104 -0
- package/dist/cjs/uploads/FileUpload.d.ts +26 -0
- package/dist/cjs/uploads/FileUpload.js +98 -0
- package/dist/cjs/uploads/FileViewer.d.ts +9 -0
- package/dist/cjs/uploads/FileViewer.js +173 -0
- package/dist/cjs/uploads/ImageCropDialog.d.ts +26 -0
- package/dist/cjs/uploads/ImageCropDialog.js +215 -0
- package/dist/cjs/uploads/ImageInfoPanel.d.ts +24 -0
- package/dist/cjs/uploads/ImageInfoPanel.js +41 -0
- package/dist/cjs/uploads/ImageUploadQualityDialog.d.ts +13 -0
- package/dist/cjs/uploads/ImageUploadQualityDialog.js +57 -0
- package/dist/cjs/uploads/UploadProgressRing.d.ts +24 -0
- package/dist/cjs/uploads/UploadProgressRing.js +32 -0
- package/dist/cjs/uploads/cameraCropPresentation.d.ts +2 -0
- package/dist/cjs/uploads/cameraCropPresentation.js +12 -0
- package/dist/cjs/uploads/index.d.ts +12 -0
- package/dist/cjs/uploads/index.js +24 -0
- package/dist/cjs/utils/createBayonEmotionCache.d.ts +1 -0
- package/dist/cjs/utils/createBayonEmotionCache.js +21 -0
- package/dist/esm/actions/ActionMenu.js +30 -0
- package/dist/esm/actions/DialogActionButtons.js +24 -0
- package/dist/esm/actions/LoadingIconButton.js +7 -0
- package/dist/esm/actions/StickyActionFooter.js +24 -0
- package/dist/esm/actions/StickySubmitButton.js +7 -0
- package/dist/esm/actions/index.js +7 -0
- package/dist/esm/client.js +5 -0
- package/dist/esm/components/BayonFlowVisual.js +81 -0
- package/dist/esm/components/BayonThemeModeToggle.js +28 -0
- package/dist/esm/components/IconTooltipButton.js +11 -0
- package/dist/esm/components/panels.js +76 -0
- package/dist/esm/drawers/BottomDrawer.js +37 -0
- package/dist/esm/drawers/MobileBottomDrawer.js +95 -0
- package/dist/esm/drawers/MobileBottomDrawerHeader.js +30 -0
- package/dist/esm/drawers/ResponsiveDrawer.js +19 -0
- package/dist/esm/drawers/WorkspaceSidePane.js +222 -0
- package/dist/esm/drawers/WorkspaceSidePaneRoot.js +90 -0
- package/dist/esm/drawers/drawerAppearance.js +7 -0
- package/dist/esm/drawers/index.js +8 -0
- package/dist/esm/drawers/useVisualViewportBottomInset.js +29 -0
- package/dist/esm/drawers/workspaceSidePaneGeometry.js +11 -0
- package/dist/esm/feedback/StatusNotice.js +56 -0
- package/dist/esm/feedback/index.js +3 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/internal/DialogChoiceTile.js +54 -0
- package/dist/esm/links/LinkAddressPreview.js +91 -0
- package/dist/esm/links/index.js +4 -0
- package/dist/esm/links/useLinkAddressPreview.js +168 -0
- package/dist/esm/location/GeographicLocationField.js +43 -0
- package/dist/esm/location/GoogleMapsAttribution.js +9 -0
- package/dist/esm/location/MetadataFieldGroup.js +9 -0
- package/dist/esm/location/MetadataValueField.js +23 -0
- package/dist/esm/location/SearchInputAction.js +8 -0
- package/dist/esm/location/TemplateBadge.js +6 -0
- package/dist/esm/location/VenueSearchDialog.js +109 -0
- package/dist/esm/location/index.js +7 -0
- package/dist/esm/pending/PendingChangesDialogShell.js +10 -0
- package/dist/esm/pending/PendingChangesDialogView.js +134 -0
- package/dist/esm/pending/PendingChangesIndicatorView.js +21 -0
- package/dist/esm/pending/index.js +4 -0
- package/dist/esm/pending/types.js +1 -0
- package/dist/esm/pricing/PlanUpgradeDialog.js +19 -0
- package/dist/esm/pricing/PricingTable.js +54 -0
- package/dist/esm/pricing/index.js +3 -0
- package/dist/esm/providers/BayonThemeProvider.js +123 -0
- package/dist/esm/sections/ExpandableSectionToggle.js +26 -0
- package/dist/esm/sections/index.js +3 -0
- package/dist/esm/styles/pageStyles.js +100 -0
- package/dist/esm/swipe/SwipeActionRow.js +116 -0
- package/dist/esm/swipe/index.js +3 -0
- package/dist/esm/theme/components.js +120 -0
- package/dist/esm/theme/createBayonTheme.js +41 -0
- package/dist/esm/theme/palette.js +106 -0
- package/dist/esm/theme/shadows.js +18 -0
- package/dist/esm/theme/types.js +1 -0
- package/dist/esm/theme/typography.js +55 -0
- package/dist/esm/toasts/ActionToast.js +9 -0
- package/dist/esm/toasts/Toast.js +52 -0
- package/dist/esm/toasts/index.js +5 -0
- package/dist/esm/toasts/useUpwardToastDismiss.js +69 -0
- package/dist/esm/uploads/CameraCaptureDialog.js +181 -0
- package/dist/esm/uploads/FileRow.js +17 -0
- package/dist/esm/uploads/FileSwipeActionRow.js +7 -0
- package/dist/esm/uploads/FileThumbnail.js +98 -0
- package/dist/esm/uploads/FileUpload.js +92 -0
- package/dist/esm/uploads/FileViewer.js +167 -0
- package/dist/esm/uploads/ImageCropDialog.js +212 -0
- package/dist/esm/uploads/ImageInfoPanel.js +35 -0
- package/dist/esm/uploads/ImageUploadQualityDialog.js +51 -0
- package/dist/esm/uploads/UploadProgressRing.js +29 -0
- package/dist/esm/uploads/cameraCropPresentation.js +5 -0
- package/dist/esm/uploads/index.js +11 -0
- package/dist/esm/utils/createBayonEmotionCache.js +15 -0
- package/dist/types/actions/ActionMenu.d.ts +24 -0
- package/dist/types/actions/DialogActionButtons.d.ts +23 -0
- package/dist/types/actions/LoadingIconButton.d.ts +11 -0
- package/dist/types/actions/StickyActionFooter.d.ts +14 -0
- package/dist/types/actions/StickySubmitButton.d.ts +10 -0
- package/dist/types/actions/index.d.ts +5 -0
- package/dist/types/client.d.ts +4 -0
- package/dist/types/components/BayonFlowVisual.d.ts +12 -0
- package/dist/types/components/BayonThemeModeToggle.d.ts +6 -0
- package/dist/types/components/IconTooltipButton.d.ts +10 -0
- package/dist/types/components/panels.d.ts +37 -0
- package/dist/types/drawers/BottomDrawer.d.ts +16 -0
- package/dist/types/drawers/MobileBottomDrawer.d.ts +20 -0
- package/dist/types/drawers/MobileBottomDrawerHeader.d.ts +11 -0
- package/dist/types/drawers/ResponsiveDrawer.d.ts +25 -0
- package/dist/types/drawers/WorkspaceSidePane.d.ts +31 -0
- package/dist/types/drawers/WorkspaceSidePaneRoot.d.ts +1 -0
- package/dist/types/drawers/drawerAppearance.d.ts +8 -0
- package/dist/types/drawers/index.d.ts +7 -0
- package/dist/types/drawers/useVisualViewportBottomInset.d.ts +6 -0
- package/dist/types/drawers/workspaceSidePaneGeometry.d.ts +11 -0
- package/dist/types/feedback/StatusNotice.d.ts +13 -0
- package/dist/types/feedback/index.d.ts +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/internal/DialogChoiceTile.d.ts +20 -0
- package/dist/types/links/LinkAddressPreview.d.ts +21 -0
- package/dist/types/links/index.d.ts +3 -0
- package/dist/types/links/useLinkAddressPreview.d.ts +26 -0
- package/dist/types/location/GeographicLocationField.d.ts +26 -0
- package/dist/types/location/GoogleMapsAttribution.d.ts +1 -0
- package/dist/types/location/MetadataFieldGroup.d.ts +5 -0
- package/dist/types/location/MetadataValueField.d.ts +23 -0
- package/dist/types/location/SearchInputAction.d.ts +9 -0
- package/dist/types/location/TemplateBadge.d.ts +5 -0
- package/dist/types/location/VenueSearchDialog.d.ts +33 -0
- package/dist/types/location/index.d.ts +6 -0
- package/dist/types/pending/PendingChangesDialogShell.d.ts +2 -0
- package/dist/types/pending/PendingChangesDialogView.d.ts +2 -0
- package/dist/types/pending/PendingChangesIndicatorView.d.ts +10 -0
- package/dist/types/pending/index.d.ts +3 -0
- package/dist/types/pending/types.d.ts +55 -0
- package/dist/types/pricing/PlanUpgradeDialog.d.ts +17 -0
- package/dist/types/pricing/PricingTable.d.ts +28 -0
- package/dist/types/pricing/index.d.ts +3 -0
- package/dist/types/providers/BayonThemeProvider.d.ts +20 -0
- package/dist/types/sections/ExpandableSectionToggle.d.ts +12 -0
- package/dist/types/sections/index.d.ts +2 -0
- package/dist/types/styles/pageStyles.d.ts +15 -0
- package/dist/types/swipe/SwipeActionRow.d.ts +8 -0
- package/dist/types/swipe/index.d.ts +1 -0
- package/dist/types/theme/components.d.ts +2 -0
- package/dist/types/theme/createBayonTheme.d.ts +4 -0
- package/dist/types/theme/palette.d.ts +146 -0
- package/dist/types/theme/shadows.d.ts +2 -0
- package/dist/types/theme/types.d.ts +47 -0
- package/dist/types/theme/typography.d.ts +2 -0
- package/dist/types/toasts/ActionToast.d.ts +11 -0
- package/dist/types/toasts/Toast.d.ts +16 -0
- package/dist/types/toasts/index.d.ts +5 -0
- package/dist/types/toasts/useUpwardToastDismiss.d.ts +15 -0
- package/dist/types/uploads/CameraCaptureDialog.d.ts +22 -0
- package/dist/types/uploads/FileRow.d.ts +10 -0
- package/dist/types/uploads/FileSwipeActionRow.d.ts +1 -0
- package/dist/types/uploads/FileThumbnail.d.ts +5 -0
- package/dist/types/uploads/FileUpload.d.ts +26 -0
- package/dist/types/uploads/FileViewer.d.ts +9 -0
- package/dist/types/uploads/ImageCropDialog.d.ts +26 -0
- package/dist/types/uploads/ImageInfoPanel.d.ts +24 -0
- package/dist/types/uploads/ImageUploadQualityDialog.d.ts +13 -0
- package/dist/types/uploads/UploadProgressRing.d.ts +24 -0
- package/dist/types/uploads/cameraCropPresentation.d.ts +2 -0
- package/dist/types/uploads/index.d.ts +12 -0
- package/dist/types/utils/createBayonEmotionCache.d.ts +1 -0
- package/docs/uploads-contract.md +15 -0
- package/package.json +2 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SxProps, Theme } from "@mui/material/styles";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { type DrawerAppearance } from "./drawerAppearance.js";
|
|
4
|
+
export declare function BottomDrawer({ children, appearance, closeTooltip, closeLabel, contentSx, dataComponent, disablePortal, headerActions, onClose, open, title, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
appearance?: DrawerAppearance;
|
|
7
|
+
closeTooltip?: string;
|
|
8
|
+
closeLabel: string;
|
|
9
|
+
contentSx?: SxProps<Theme>;
|
|
10
|
+
dataComponent?: string;
|
|
11
|
+
disablePortal?: boolean;
|
|
12
|
+
headerActions?: ReactNode;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
open: boolean;
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
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.BottomDrawer = BottomDrawer;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
|
+
const drawerAppearance_js_1 = require("./drawerAppearance.js");
|
|
12
|
+
function BottomDrawer({ children, appearance = drawerAppearance_js_1.defaultDrawerAppearance, closeTooltip, closeLabel, contentSx, dataComponent, disablePortal = false, headerActions, onClose, open, title, }) {
|
|
13
|
+
const paperSlotProps = {
|
|
14
|
+
"data-component": dataComponent,
|
|
15
|
+
sx: {
|
|
16
|
+
bgcolor: appearance.background,
|
|
17
|
+
borderRadius: "16px 16px 0 0",
|
|
18
|
+
boxShadow: appearance.shadow,
|
|
19
|
+
maxHeight: "calc(100dvh - 24px)",
|
|
20
|
+
width: "100%",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Drawer, { anchor: "bottom",
|
|
24
|
+
// Portal ownership belongs to the host because route slots and stacking
|
|
25
|
+
// containers are application concerns rather than drawer presentation.
|
|
26
|
+
ModalProps: { disablePortal }, onClose: onClose, open: open, slotProps: { paper: paperSlotProps }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
borderBottom: 1,
|
|
29
|
+
borderColor: "divider",
|
|
30
|
+
display: "flex",
|
|
31
|
+
flex: "0 0 auto",
|
|
32
|
+
gap: 1,
|
|
33
|
+
minHeight: 64,
|
|
34
|
+
px: 2.5,
|
|
35
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", sx: { flex: 1, fontWeight: 760 }, children: title }), headerActions ? ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { alignItems: "center", display: "flex" }, children: headerActions })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: closeTooltip !== null && closeTooltip !== void 0 ? closeTooltip : "", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": closeLabel, onClick: onClose, sx: {
|
|
36
|
+
minHeight: 40,
|
|
37
|
+
minWidth: 40,
|
|
38
|
+
"& > .MuiSvgIcon-root": { fontSize: 28 },
|
|
39
|
+
}, children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: [
|
|
40
|
+
{ flex: 1, minHeight: 0, overflowY: "auto" },
|
|
41
|
+
...(Array.isArray(contentSx) ? contentSx : [contentSx]),
|
|
42
|
+
], children: children })] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DrawerAppearance } from "./drawerAppearance.js";
|
|
3
|
+
export declare const mobileBottomDrawerDismissDuration = 220;
|
|
4
|
+
export declare function MobileBottomDrawer({ ariaLabel, appearance, closeTooltip, children, contentScrollMode, dataComponent, dismiss, handleBackground, handlePlacement, headerLeft, headerRight, maxHeight, onClose, }: {
|
|
5
|
+
ariaLabel: string;
|
|
6
|
+
appearance?: DrawerAppearance;
|
|
7
|
+
closeTooltip?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Chooses whether the drawer body or its direct child owns vertical scrolling. */
|
|
10
|
+
contentScrollMode?: "container" | "child";
|
|
11
|
+
dataComponent?: string;
|
|
12
|
+
/** Requests the standard dismiss animation before invoking onClose. */
|
|
13
|
+
dismiss?: boolean;
|
|
14
|
+
handleBackground?: "default" | "detailChrome";
|
|
15
|
+
handlePlacement?: "above-content" | "overlay";
|
|
16
|
+
headerLeft?: ReactNode;
|
|
17
|
+
headerRight?: ReactNode;
|
|
18
|
+
maxHeight?: string;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
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.mobileBottomDrawerDismissDuration = void 0;
|
|
8
|
+
exports.MobileBottomDrawer = MobileBottomDrawer;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
|
+
const SwipeableDrawer_1 = __importDefault(require("@mui/material/SwipeableDrawer"));
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const drawerAppearance_js_1 = require("./drawerAppearance.js");
|
|
14
|
+
const MobileBottomDrawerHeader_js_1 = require("./MobileBottomDrawerHeader.js");
|
|
15
|
+
exports.mobileBottomDrawerDismissDuration = 220;
|
|
16
|
+
function MobileBottomDrawer({ ariaLabel, appearance = drawerAppearance_js_1.defaultDrawerAppearance, closeTooltip, children, contentScrollMode = "container", dataComponent, dismiss = false, handleBackground = "default", handlePlacement = "above-content", headerLeft, headerRight, maxHeight = "calc(100dvh - 24px)", onClose, }) {
|
|
17
|
+
const dismissTimer = (0, react_1.useRef)(null);
|
|
18
|
+
const [open, setOpen] = (0, react_1.useState)(true);
|
|
19
|
+
(0, react_1.useEffect)(() => () => {
|
|
20
|
+
if (dismissTimer.current) {
|
|
21
|
+
clearTimeout(dismissTimer.current);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
const requestClose = (0, react_1.useCallback)(() => {
|
|
25
|
+
if (!open || dismissTimer.current) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
setOpen(false);
|
|
29
|
+
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
30
|
+
dismissTimer.current = setTimeout(onClose, prefersReducedMotion ? 0 : exports.mobileBottomDrawerDismissDuration);
|
|
31
|
+
}, [onClose, open]);
|
|
32
|
+
// Product decision: nested dialogs may layer over a retained drawer; the host
|
|
33
|
+
// decides whether closing that dialog also closes its underlying context.
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
if (!dismiss || !open) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
39
|
+
dismissTimer.current = setTimeout(onClose, prefersReducedMotion ? 0 : exports.mobileBottomDrawerDismissDuration);
|
|
40
|
+
return () => {
|
|
41
|
+
if (dismissTimer.current) {
|
|
42
|
+
clearTimeout(dismissTimer.current);
|
|
43
|
+
dismissTimer.current = null;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, [dismiss, onClose, open]);
|
|
47
|
+
const paperSlotProps = {
|
|
48
|
+
"aria-label": ariaLabel,
|
|
49
|
+
"data-component": dataComponent !== null && dataComponent !== void 0 ? dataComponent : "mobile-bottom-drawer",
|
|
50
|
+
sx: {
|
|
51
|
+
backgroundColor: appearance.background,
|
|
52
|
+
borderRadius: "16px 16px 0 0",
|
|
53
|
+
bottom: 0,
|
|
54
|
+
boxShadow: appearance.shadow,
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
height: maxHeight,
|
|
58
|
+
maxHeight,
|
|
59
|
+
overflow: "hidden",
|
|
60
|
+
overscrollBehaviorY: "contain",
|
|
61
|
+
width: "100%",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const drawerHandle = ((0, jsx_runtime_1.jsx)(material_1.Box, { "aria-hidden": true, "data-component": "mobile-bottom-drawer-handle", "data-placement": handlePlacement, "data-swipe-surface": "drawer", sx: {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
bgcolor: handleBackground === "detailChrome"
|
|
67
|
+
? appearance.chrome
|
|
68
|
+
: "transparent",
|
|
69
|
+
display: "flex",
|
|
70
|
+
flex: "0 0 auto",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
minHeight: 44,
|
|
73
|
+
// Product decision: header actions sit above this visual handle while
|
|
74
|
+
// MUI SwipeableDrawer owns a natural pull-down gesture across the
|
|
75
|
+
// entire sheet, including its scroll-aware cancellation behavior.
|
|
76
|
+
pointerEvents: handlePlacement === "overlay" ? "none" : "auto",
|
|
77
|
+
position: handlePlacement === "overlay" ? "absolute" : "relative",
|
|
78
|
+
top: handlePlacement === "overlay" ? 0 : "auto",
|
|
79
|
+
width: "100%",
|
|
80
|
+
zIndex: 0,
|
|
81
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
82
|
+
bgcolor: appearance.handle,
|
|
83
|
+
borderRadius: 999,
|
|
84
|
+
height: 4,
|
|
85
|
+
width: 36,
|
|
86
|
+
} }) }));
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)(SwipeableDrawer_1.default, { anchor: "bottom", disableBackdropTransition: true, disableDiscovery: true, disableSwipeToOpen: true, hysteresis: 0.16, onClose: requestClose, onOpen: () => undefined, open: dismiss ? false : open, slotProps: {
|
|
88
|
+
backdrop: {
|
|
89
|
+
sx: { backgroundColor: "transparent" },
|
|
90
|
+
},
|
|
91
|
+
paper: paperSlotProps,
|
|
92
|
+
}, transitionDuration: exports.mobileBottomDrawerDismissDuration, children: [headerLeft ? ((0, jsx_runtime_1.jsx)(MobileBottomDrawerHeader_js_1.MobileBottomDrawerHeader, { closeLabel: `Close ${ariaLabel}`, closeTooltip: closeTooltip, dragHandle: drawerHandle, left: headerLeft, onClose: requestClose, right: headerRight })) : handlePlacement === "above-content" ? (drawerHandle) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { "data-component": "mobile-bottom-drawer-scroll", sx: {
|
|
93
|
+
display: contentScrollMode === "child" ? "flex" : "block",
|
|
94
|
+
flex: 1,
|
|
95
|
+
minHeight: 0,
|
|
96
|
+
overflowY: contentScrollMode === "child" ? "hidden" : "auto",
|
|
97
|
+
overscrollBehaviorY: "contain",
|
|
98
|
+
pb: appearance.safeAreaBottom,
|
|
99
|
+
position: "relative",
|
|
100
|
+
zIndex: handlePlacement === "overlay" ? 1 : "auto",
|
|
101
|
+
}, children: [handlePlacement === "overlay" ? drawerHandle : null, children] })] }));
|
|
102
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type MobileBottomDrawerHeaderProps = {
|
|
3
|
+
closeLabel: string;
|
|
4
|
+
closeTooltip?: string;
|
|
5
|
+
dragHandle: ReactNode;
|
|
6
|
+
left: ReactNode;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
right?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare function MobileBottomDrawerHeader({ closeLabel, closeTooltip, dragHandle, left, onClose, right, }: MobileBottomDrawerHeaderProps): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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.MobileBottomDrawerHeader = MobileBottomDrawerHeader;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const CloseRounded_1 = __importDefault(require("@mui/icons-material/CloseRounded"));
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
|
+
function MobileBottomDrawerHeader({ closeLabel, closeTooltip, dragHandle, left, onClose, right, }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "header", "data-component": "mobile-bottom-drawer-header", sx: {
|
|
13
|
+
flex: "0 0 auto",
|
|
14
|
+
minHeight: 56,
|
|
15
|
+
position: "relative",
|
|
16
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
17
|
+
inset: 0,
|
|
18
|
+
position: "absolute",
|
|
19
|
+
zIndex: 0,
|
|
20
|
+
}, children: dragHandle }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
display: "flex",
|
|
23
|
+
gap: 1,
|
|
24
|
+
minHeight: 56,
|
|
25
|
+
px: 2,
|
|
26
|
+
// Product decision: title and actions occupy the same compact row as
|
|
27
|
+
// the drag affordance, avoiding a second band that pushes context
|
|
28
|
+
// away from the top edge of the drawer.
|
|
29
|
+
position: "relative",
|
|
30
|
+
zIndex: 1,
|
|
31
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1, minWidth: 0 }, children: left }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { alignItems: "center", display: "flex", gap: 0.5 }, children: [right, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: closeTooltip !== null && closeTooltip !== void 0 ? closeTooltip : "", children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": closeLabel, onClick: onClose, sx: {
|
|
32
|
+
minHeight: 48,
|
|
33
|
+
minWidth: 48,
|
|
34
|
+
"& > .MuiSvgIcon-root": { fontSize: 32 },
|
|
35
|
+
}, children: (0, jsx_runtime_1.jsx)(CloseRounded_1.default, {}) }) })] })] })] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { SxProps, Theme } from "@mui/material/styles";
|
|
3
|
+
import type { DrawerAppearance } from "./drawerAppearance.js";
|
|
4
|
+
type DrawerPresentation = "desktop" | "mobile";
|
|
5
|
+
type ResponsiveDrawerProps = {
|
|
6
|
+
ariaLabel: string;
|
|
7
|
+
appearance?: DrawerAppearance;
|
|
8
|
+
closeTooltip?: string;
|
|
9
|
+
children: (presentation: DrawerPresentation) => ReactNode;
|
|
10
|
+
desktopContentSx?: SxProps<Theme>;
|
|
11
|
+
desktopCloseLabel?: string;
|
|
12
|
+
desktopDataComponent?: string;
|
|
13
|
+
desktopDisablePortal?: boolean;
|
|
14
|
+
desktopOpen?: boolean;
|
|
15
|
+
headerActions?: ReactNode;
|
|
16
|
+
mobileContentScrollMode?: "child" | "container";
|
|
17
|
+
mobileDataComponent?: string;
|
|
18
|
+
mobileDismiss?: boolean;
|
|
19
|
+
mobileOpen?: boolean;
|
|
20
|
+
onDesktopClose: () => void;
|
|
21
|
+
onMobileClose: () => void;
|
|
22
|
+
title: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export declare function ResponsiveDrawer({ ariaLabel, appearance, closeTooltip, children, desktopContentSx, desktopCloseLabel, desktopDataComponent, desktopDisablePortal, desktopOpen, headerActions, mobileContentScrollMode, mobileDataComponent, mobileDismiss, mobileOpen, onDesktopClose, onMobileClose, title, }: ResponsiveDrawerProps): import("react").JSX.Element | null;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ResponsiveDrawer = ResponsiveDrawer;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const MobileBottomDrawer_js_1 = require("./MobileBottomDrawer.js");
|
|
8
|
+
const BottomDrawer_js_1 = require("./BottomDrawer.js");
|
|
9
|
+
// Product decision: consumers share responsive drawer chrome but keep
|
|
10
|
+
// navigation and dismissal policies in their owning feature.
|
|
11
|
+
function ResponsiveDrawer({ ariaLabel, appearance, closeTooltip, children, desktopContentSx, desktopCloseLabel, desktopDataComponent, desktopDisablePortal = false, desktopOpen = true, headerActions, mobileContentScrollMode, mobileDataComponent, mobileDismiss = false, mobileOpen = true, onDesktopClose, onMobileClose, title, }) {
|
|
12
|
+
const isMobileDrawer = (0, material_1.useMediaQuery)("(max-width:899.95px)", {
|
|
13
|
+
noSsr: true,
|
|
14
|
+
});
|
|
15
|
+
if (isMobileDrawer) {
|
|
16
|
+
if (!mobileOpen) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(MobileBottomDrawer_js_1.MobileBottomDrawer, { appearance: appearance, closeTooltip: closeTooltip, ariaLabel: ariaLabel, contentScrollMode: mobileContentScrollMode, dataComponent: mobileDataComponent, dismiss: mobileDismiss, headerLeft: (0, jsx_runtime_1.jsx)(material_1.Typography, { component: "h1", sx: { fontWeight: 760 }, children: title }), headerRight: headerActions, onClose: onMobileClose, children: children("mobile") }));
|
|
20
|
+
}
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(BottomDrawer_js_1.BottomDrawer, { appearance: appearance, closeTooltip: closeTooltip, closeLabel: desktopCloseLabel !== null && desktopCloseLabel !== void 0 ? desktopCloseLabel : `Close ${ariaLabel}`, contentSx: desktopContentSx, dataComponent: desktopDataComponent, disablePortal: desktopDisablePortal, headerActions: headerActions, onClose: onDesktopClose, open: desktopOpen, title: title, children: children("desktop") }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CSSProperties, type MouseEvent, type ReactNode, type RefObject } from "react";
|
|
2
|
+
export interface WorkspaceSidePaneActions {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
paneId: string;
|
|
5
|
+
openFrom: (event: MouseEvent<HTMLButtonElement>, focusTarget?: RefObject<HTMLElement | null>) => void;
|
|
6
|
+
close: (opener?: HTMLButtonElement) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface WorkspaceSidePaneProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Use document scrolling for the docked pane. Defaults to true. */
|
|
12
|
+
pinToViewport?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
paneId?: string;
|
|
16
|
+
headingId: string;
|
|
17
|
+
headingRef: RefObject<HTMLElement | null>;
|
|
18
|
+
workspaceRef?: RefObject<HTMLDivElement | null>;
|
|
19
|
+
actionsLabel: string;
|
|
20
|
+
resizeLabel?: string;
|
|
21
|
+
keepPaneMounted?: boolean;
|
|
22
|
+
/** Preferred docked width in CSS pixels. The available canvas can constrain the displayed width. */
|
|
23
|
+
preferredWidth?: number;
|
|
24
|
+
/** Reports an explicit resize through the pointer or keyboard control. */
|
|
25
|
+
onPreferredWidthChange?: (width: number) => void;
|
|
26
|
+
getOverlaySiblings?: (root: HTMLDivElement) => readonly HTMLElement[];
|
|
27
|
+
renderActions: (actions: WorkspaceSidePaneActions) => ReactNode;
|
|
28
|
+
renderPane: (visible: boolean) => ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/** Keeps the workspace in one slot across docked, modal and closed presentation. */
|
|
31
|
+
export declare function WorkspaceSidePane({ children, enabled, pinToViewport, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel, keepPaneMounted, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }: WorkspaceSidePaneProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,228 @@
|
|
|
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.WorkspaceSidePane = WorkspaceSidePane;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const Collapse_1 = __importDefault(require("@mui/material/Collapse"));
|
|
11
|
+
const Fade_1 = __importDefault(require("@mui/material/Fade"));
|
|
12
|
+
const GlobalStyles_1 = __importDefault(require("@mui/material/GlobalStyles"));
|
|
13
|
+
const useMediaQuery_1 = __importDefault(require("@mui/material/useMediaQuery"));
|
|
14
|
+
const WorkspaceSidePaneRoot_js_1 = require("./WorkspaceSidePaneRoot.js");
|
|
15
|
+
const workspaceSidePaneGeometry_js_1 = require("./workspaceSidePaneGeometry.js");
|
|
16
|
+
const motion = { timeout: { enter: 220, exit: 170 }, easing: "cubic-bezier(0.25, 1, 0.5, 1)" };
|
|
17
|
+
// Clip horizontal overflow so body does not intercept the docked pane's
|
|
18
|
+
// sticky positioning when the document is the scroll container.
|
|
19
|
+
const viewportPinningStyles = {
|
|
20
|
+
'body:has(.workspace-side-pane[data-pin-to-viewport="true"])': { overflowX: "clip" },
|
|
21
|
+
};
|
|
22
|
+
/** Keeps the workspace in one slot across docked, modal and closed presentation. */
|
|
23
|
+
function WorkspaceSidePane({ children, enabled = true, pinToViewport = true, className, style, paneId, headingId, headingRef, workspaceRef, actionsLabel, resizeLabel = "Resize side pane", keepPaneMounted = false, preferredWidth, onPreferredWidthChange, getOverlaySiblings, renderActions, renderPane, }) {
|
|
24
|
+
const generatedId = (0, react_1.useId)();
|
|
25
|
+
const panelId = paneId !== null && paneId !== void 0 ? paneId : generatedId;
|
|
26
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
27
|
+
const internalWorkspaceRef = (0, react_1.useRef)(null);
|
|
28
|
+
const contentRef = workspaceRef !== null && workspaceRef !== void 0 ? workspaceRef : internalWorkspaceRef;
|
|
29
|
+
const groupRef = (0, react_1.useRef)(null);
|
|
30
|
+
const openerRef = (0, react_1.useRef)(null);
|
|
31
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
32
|
+
const [present, setPresent] = (0, react_1.useState)(false);
|
|
33
|
+
const [directResize, setDirectResize] = (0, react_1.useState)(false);
|
|
34
|
+
const reducedMotion = (0, useMediaQuery_1.default)("(prefers-reduced-motion: reduce)", { noSsr: true });
|
|
35
|
+
const duration = reducedMotion ? 0 : motion.timeout;
|
|
36
|
+
const [internalWidth, setWidth] = (0, react_1.useState)(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane);
|
|
37
|
+
const [bounds, setBounds] = (0, react_1.useState)({ width: workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minCanvas + workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail + workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane, top: 0, workspaceInset: 0 });
|
|
38
|
+
const drag = (0, react_1.useRef)(null);
|
|
39
|
+
const dockedMaximum = Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, Math.min(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane, bounds.width - bounds.workspaceInset - workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.rail - workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minCanvas));
|
|
40
|
+
const hasPreferredWidth = typeof preferredWidth === "number" && Number.isFinite(preferredWidth);
|
|
41
|
+
const requestedWidth = hasPreferredWidth
|
|
42
|
+
? Math.min(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane, Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, preferredWidth))
|
|
43
|
+
: internalWidth;
|
|
44
|
+
// A host preference can yield to the canvas without changing the preferred
|
|
45
|
+
// width or turning a workspace that fits the default into a modal.
|
|
46
|
+
const width = hasPreferredWidth && dockedMaximum >= workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane
|
|
47
|
+
? Math.min(requestedWidth, dockedMaximum)
|
|
48
|
+
: requestedWidth;
|
|
49
|
+
const geometry = (0, workspaceSidePaneGeometry_js_1.workspaceSidePaneGeometry)(bounds.width, width, bounds.workspaceInset);
|
|
50
|
+
const presentedWidth = geometry.overlay && hasPreferredWidth
|
|
51
|
+
? (0, workspaceSidePaneGeometry_js_1.workspaceSidePaneGeometry)(bounds.width, workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane, bounds.workspaceInset).paneWidth
|
|
52
|
+
: geometry.paneWidth;
|
|
53
|
+
const visible = enabled && open;
|
|
54
|
+
const overlay = visible && geometry.overlay;
|
|
55
|
+
const visibleRef = (0, react_1.useRef)(visible);
|
|
56
|
+
visibleRef.current = visible;
|
|
57
|
+
// Release modal focus and report closed to the host before visual exit.
|
|
58
|
+
const overlayPresentation = geometry.overlay && (visible || (present && !reducedMotion));
|
|
59
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
60
|
+
if (!enabled) {
|
|
61
|
+
setPresent(false);
|
|
62
|
+
setDirectResize(false);
|
|
63
|
+
drag.current = null;
|
|
64
|
+
}
|
|
65
|
+
else if (visible) {
|
|
66
|
+
setPresent(true);
|
|
67
|
+
}
|
|
68
|
+
}, [enabled, visible]);
|
|
69
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
70
|
+
const element = rootRef.current;
|
|
71
|
+
if (!element)
|
|
72
|
+
return;
|
|
73
|
+
const measure = () => {
|
|
74
|
+
const rect = element.getBoundingClientRect();
|
|
75
|
+
const workspaceStyle = contentRef.current ? getComputedStyle(contentRef.current) : null;
|
|
76
|
+
// Useful canvas excludes its retained page padding; chrome still uses
|
|
77
|
+
// the full root width, including in narrow overlays.
|
|
78
|
+
const workspaceInset = workspaceStyle
|
|
79
|
+
? (parseFloat(workspaceStyle.paddingLeft) || 0) + (parseFloat(workspaceStyle.paddingRight) || 0)
|
|
80
|
+
: 0;
|
|
81
|
+
const next = { width: rect.width || window.innerWidth, top: Math.max(0, rect.top), workspaceInset };
|
|
82
|
+
// Content ResizeObserver notifications also arrive during pane motion;
|
|
83
|
+
// unchanged shell geometry must not rerender pane content per frame.
|
|
84
|
+
setBounds((previous) => previous.width === next.width && previous.top === next.top && previous.workspaceInset === next.workspaceInset ? previous : next);
|
|
85
|
+
};
|
|
86
|
+
measure();
|
|
87
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
88
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(element);
|
|
89
|
+
if (contentRef.current)
|
|
90
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(contentRef.current);
|
|
91
|
+
window.addEventListener("resize", measure);
|
|
92
|
+
return () => {
|
|
93
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
94
|
+
window.removeEventListener("resize", measure);
|
|
95
|
+
};
|
|
96
|
+
}, [enabled, contentRef]);
|
|
97
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
98
|
+
var _a, _b, _c;
|
|
99
|
+
if (!overlay)
|
|
100
|
+
return;
|
|
101
|
+
const content = contentRef.current;
|
|
102
|
+
const root = rootRef.current;
|
|
103
|
+
const siblings = root ? (_a = getOverlaySiblings === null || getOverlaySiblings === void 0 ? void 0 : getOverlaySiblings(root)) !== null && _a !== void 0 ? _a : [] : [];
|
|
104
|
+
const covered = [...new Set([...(content ? [content] : []), ...siblings])];
|
|
105
|
+
const priorInert = covered.map((element) => ({ element, value: element.getAttribute("inert") }));
|
|
106
|
+
// Restore the pre-existing inert state when this overlay releases focus.
|
|
107
|
+
covered.forEach((element) => element.setAttribute("inert", ""));
|
|
108
|
+
const ownerDocument = (_c = (_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument) !== null && _c !== void 0 ? _c : document;
|
|
109
|
+
const focusInside = () => { var _a; return (_a = headingRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
110
|
+
const containsTarget = (target) => { var _a; return Boolean(target && ((_a = groupRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))); };
|
|
111
|
+
const containFocus = (event) => {
|
|
112
|
+
if (!containsTarget(event.target))
|
|
113
|
+
focusInside();
|
|
114
|
+
};
|
|
115
|
+
const containOutsideTab = (event) => {
|
|
116
|
+
if (event.key !== "Tab" || containsTarget(event.target))
|
|
117
|
+
return;
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
focusInside();
|
|
121
|
+
};
|
|
122
|
+
// inert blocks normal background interaction; focusin additionally contains
|
|
123
|
+
// programmatic focus and browsers/environments with incomplete inert support.
|
|
124
|
+
ownerDocument.addEventListener("focusin", containFocus, true);
|
|
125
|
+
ownerDocument.addEventListener("keydown", containOutsideTab, true);
|
|
126
|
+
focusInside();
|
|
127
|
+
return () => {
|
|
128
|
+
ownerDocument.removeEventListener("focusin", containFocus, true);
|
|
129
|
+
ownerDocument.removeEventListener("keydown", containOutsideTab, true);
|
|
130
|
+
priorInert.forEach(({ element, value }) => {
|
|
131
|
+
if (value === null)
|
|
132
|
+
element.removeAttribute("inert");
|
|
133
|
+
else
|
|
134
|
+
element.setAttribute("inert", value);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
}, [overlay, headingId, headingRef, contentRef, getOverlaySiblings]);
|
|
138
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!visible && present)
|
|
141
|
+
(_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
142
|
+
}, [visible, present]);
|
|
143
|
+
const close = (opener) => {
|
|
144
|
+
if (opener)
|
|
145
|
+
openerRef.current = opener;
|
|
146
|
+
setOpen(false);
|
|
147
|
+
setDirectResize(false);
|
|
148
|
+
drag.current = null;
|
|
149
|
+
};
|
|
150
|
+
// Deliberate docked resizing preserves the useful canvas and its focusable
|
|
151
|
+
// control. Only an external viewport/container change may require an overlay.
|
|
152
|
+
const clampWidth = (next, reset = false) => {
|
|
153
|
+
const nextWidth = Math.max(workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, Math.min(dockedMaximum, Math.round(next)));
|
|
154
|
+
if (nextWidth === width && (!reset || nextWidth === requestedWidth))
|
|
155
|
+
return;
|
|
156
|
+
setDirectResize(true);
|
|
157
|
+
setWidth(nextWidth);
|
|
158
|
+
onPreferredWidthChange === null || onPreferredWidthChange === void 0 ? void 0 : onPreferredWidthChange(nextWidth);
|
|
159
|
+
};
|
|
160
|
+
const keyboard = (event) => {
|
|
161
|
+
var _a, _b, _c, _d, _e;
|
|
162
|
+
// Nested native dialogs own their own Escape handling.
|
|
163
|
+
if ((_b = (_a = event.target).closest) === null || _b === void 0 ? void 0 : _b.call(_a, "dialog[open]"))
|
|
164
|
+
return;
|
|
165
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
event.stopPropagation();
|
|
168
|
+
close();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (!overlay || event.key !== "Tab")
|
|
172
|
+
return;
|
|
173
|
+
const controls = [...((_d = (_c = groupRef.current) === null || _c === void 0 ? void 0 : _c.querySelectorAll('button, a[href], input, textarea, select, summary, [tabindex]')) !== null && _d !== void 0 ? _d : [])]
|
|
174
|
+
.filter((element) => element.tabIndex >= 0 && !element.matches(":disabled")
|
|
175
|
+
&& !element.closest('[hidden], [inert], dialog:not([open])')
|
|
176
|
+
&& element.getClientRects().length > 0 && getComputedStyle(element).visibility !== "hidden");
|
|
177
|
+
const first = controls[0], last = controls[controls.length - 1];
|
|
178
|
+
const focused = (_e = groupRef.current) === null || _e === void 0 ? void 0 : _e.ownerDocument.activeElement;
|
|
179
|
+
if (event.shiftKey && (focused === first || focused === headingRef.current)) {
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
last === null || last === void 0 ? void 0 : last.focus();
|
|
182
|
+
}
|
|
183
|
+
else if (!event.shiftKey && focused === last) {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
first === null || first === void 0 ? void 0 : first.focus();
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const openFrom = (event, focusTarget = headingRef) => {
|
|
189
|
+
openerRef.current = event.currentTarget;
|
|
190
|
+
setPresent(true);
|
|
191
|
+
setOpen(true);
|
|
192
|
+
if (event.detail === 0)
|
|
193
|
+
requestAnimationFrame(() => {
|
|
194
|
+
var _a;
|
|
195
|
+
if (visibleRef.current)
|
|
196
|
+
(_a = focusTarget.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
return ((0, jsx_runtime_1.jsxs)(WorkspaceSidePaneRoot_js_1.WorkspaceSidePaneRoot, { ref: rootRef, "data-pin-to-viewport": enabled && pinToViewport ? true : undefined, className: `workspace-side-pane${className ? ` ${className}` : ""}${enabled ? " workspace-side-pane-enabled" : ""}${visible ? " workspace-side-pane-open" : ""}${overlayPresentation ? " workspace-side-pane-overlay" : ""}${directResize && visible ? " workspace-side-pane-direct-resize" : ""}${reducedMotion ? " workspace-side-pane-reduced-motion" : ""}`, style: { ...style, "--workspace-side-pane-width": `${presentedWidth}px`, "--workspace-side-pane-top": `${bounds.top}px` }, children: [enabled && pinToViewport && (0, jsx_runtime_1.jsx)(GlobalStyles_1.default, { styles: viewportPinningStyles }), (0, jsx_runtime_1.jsx)("div", { ref: contentRef, className: "workspace-side-pane-workspace", children: children }), enabled && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Fade_1.default, { in: overlay, timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)("div", { className: "workspace-side-pane-backdrop", "data-active": overlay, style: { pointerEvents: overlay ? "auto" : "none" }, onClick: () => close(), "aria-hidden": "true" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "workspace-side-pane-group", ref: groupRef, role: overlay ? "dialog" : undefined, "aria-modal": overlay ? true : undefined, "aria-labelledby": overlay ? headingId : undefined, onKeyDown: keyboard, children: [(0, jsx_runtime_1.jsxs)("nav", { className: "workspace-side-pane-rail", "aria-label": actionsLabel, children: [renderActions({ visible, paneId: panelId, openFrom, close }), visible && !overlay && ((0, jsx_runtime_1.jsx)("div", { role: "separator", tabIndex: 0, className: "workspace-side-pane-resize", "aria-label": resizeLabel, "aria-orientation": "vertical", "aria-valuemin": workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane, "aria-valuemax": dockedMaximum, "aria-valuenow": width, "aria-valuetext": `${Math.round(geometry.paneWidth)} pixels`, title: "Drag to resize; Left/Right adjusts width; Enter resets", onKeyDown: (event) => {
|
|
200
|
+
const next = event.key === "ArrowLeft"
|
|
201
|
+
? width + 16
|
|
202
|
+
: event.key === "ArrowRight"
|
|
203
|
+
? width - 16
|
|
204
|
+
: event.key === "Home"
|
|
205
|
+
? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.minPane
|
|
206
|
+
: event.key === "End"
|
|
207
|
+
? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.maxPane
|
|
208
|
+
: event.key === "Enter"
|
|
209
|
+
? workspaceSidePaneGeometry_js_1.workspaceSidePaneMetrics.initialPane
|
|
210
|
+
: null;
|
|
211
|
+
if (next !== null) {
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
clampWidth(next, event.key === "Enter");
|
|
215
|
+
}
|
|
216
|
+
}, onPointerDown: (event) => {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
drag.current = { x: event.clientX, width };
|
|
219
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
220
|
+
}, onPointerMove: (event) => {
|
|
221
|
+
if (drag.current)
|
|
222
|
+
clampWidth(drag.current.width + drag.current.x - event.clientX);
|
|
223
|
+
}, onPointerUp: () => {
|
|
224
|
+
drag.current = null;
|
|
225
|
+
}, onPointerCancel: () => {
|
|
226
|
+
drag.current = null;
|
|
227
|
+
} }))] }), (0, jsx_runtime_1.jsx)(Collapse_1.default, { in: visible, orientation: "horizontal", className: "workspace-side-pane-presence", timeout: duration, easing: motion.easing, mountOnEnter: true, unmountOnExit: !keepPaneMounted, onExited: () => setPresent(false), children: (0, jsx_runtime_1.jsx)("aside", { id: panelId, className: "workspace-side-pane-panel", "aria-labelledby": headingId, "aria-hidden": !visible || undefined, inert: !visible, children: renderPane(visible) }) })] })] }))] }));
|
|
228
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WorkspaceSidePaneRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|