@bug-on/m3-expressive 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/README.md +110 -0
- package/dist/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
- package/dist/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/dist/assets/loading-indicator.svg +19 -0
- package/dist/assets/material-symbols-cdn.css +65 -0
- package/dist/assets/material-symbols-self-hosted.css +94 -0
- package/dist/buttons.d.mts +180 -0
- package/dist/buttons.d.ts +180 -0
- package/dist/buttons.js +4282 -0
- package/dist/buttons.js.map +1 -0
- package/dist/buttons.mjs +4227 -0
- package/dist/buttons.mjs.map +1 -0
- package/dist/core.d.mts +422 -0
- package/dist/core.d.ts +422 -0
- package/dist/core.js +2581 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +2547 -0
- package/dist/core.mjs.map +1 -0
- package/dist/feedback.d.mts +600 -0
- package/dist/feedback.d.ts +600 -0
- package/dist/feedback.js +2357 -0
- package/dist/feedback.js.map +1 -0
- package/dist/feedback.mjs +2321 -0
- package/dist/feedback.mjs.map +1 -0
- package/dist/forms.d.mts +40 -0
- package/dist/forms.d.ts +40 -0
- package/dist/forms.js +4263 -0
- package/dist/forms.js.map +1 -0
- package/dist/forms.mjs +4228 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/icon-button-D-gs0gfj.d.mts +136 -0
- package/dist/icon-button-D-gs0gfj.d.ts +136 -0
- package/dist/index.css +309 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +23972 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +23668 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layout.d.mts +610 -0
- package/dist/layout.d.ts +610 -0
- package/dist/layout.js +5091 -0
- package/dist/layout.js.map +1 -0
- package/dist/layout.mjs +5042 -0
- package/dist/layout.mjs.map +1 -0
- package/dist/material-symbols-cdn.css +65 -0
- package/dist/material-symbols-cdn.css.d.ts +2 -0
- package/dist/material-symbols-self-hosted.css +94 -0
- package/dist/material-symbols-self-hosted.css.d.ts +2 -0
- package/dist/md3-DFhj-NZj.d.mts +17 -0
- package/dist/md3-DFhj-NZj.d.ts +17 -0
- package/dist/navigation.d.mts +2766 -0
- package/dist/navigation.d.ts +2766 -0
- package/dist/navigation.js +6684 -0
- package/dist/navigation.js.map +1 -0
- package/dist/navigation.mjs +6573 -0
- package/dist/navigation.mjs.map +1 -0
- package/dist/overlays.d.mts +161 -0
- package/dist/overlays.d.ts +161 -0
- package/dist/overlays.js +3298 -0
- package/dist/overlays.js.map +1 -0
- package/dist/overlays.mjs +3244 -0
- package/dist/overlays.mjs.map +1 -0
- package/dist/pickers.d.mts +1074 -0
- package/dist/pickers.d.ts +1074 -0
- package/dist/pickers.js +4240 -0
- package/dist/pickers.js.map +1 -0
- package/dist/pickers.mjs +4200 -0
- package/dist/pickers.mjs.map +1 -0
- package/dist/plugin.d.mts +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +13 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +3 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/scroll-area-CVS6HyLl.d.mts +33 -0
- package/dist/scroll-area-CVS6HyLl.d.ts +33 -0
- package/dist/shapes.d.mts +1119 -0
- package/dist/shapes.d.ts +1119 -0
- package/dist/shapes.js +2941 -0
- package/dist/shapes.js.map +1 -0
- package/dist/shapes.mjs +2889 -0
- package/dist/shapes.mjs.map +1 -0
- package/dist/side-sheet-modal-BY6VCC8p.d.mts +553 -0
- package/dist/side-sheet-modal-CglP6KYA.d.ts +553 -0
- package/dist/split-button-trailing-uncheckable-C5CLCIKP.d.ts +731 -0
- package/dist/split-button-trailing-uncheckable-MXj_kyNt.d.mts +731 -0
- package/dist/text-field-eAIpz9z1.d.mts +1038 -0
- package/dist/text-field-eAIpz9z1.d.ts +1038 -0
- package/dist/typography-339RV6v7.d.mts +486 -0
- package/dist/typography-339RV6v7.d.ts +486 -0
- package/dist/typography.css +22 -0
- package/dist/typography.css.d.ts +2 -0
- package/package.json +207 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { W as SheetValue } from './side-sheet-modal-BY6VCC8p.mjs';
|
|
2
|
+
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger, S as Scrim, L as ScrimProps, M as SheetEdge, N as SheetState, O as SideSheet, P as SideSheetModal, Q as SideSheetModalProps, R as SideSheetProps, U as UseBottomSheetOptions, T as UseBottomSheetReturn, V as useBottomSheet } from './side-sheet-modal-BY6VCC8p.mjs';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import { useMotionValue, PanInfo } from 'motion/react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import '@radix-ui/react-dialog';
|
|
7
|
+
import './scroll-area-CVS6HyLl.mjs';
|
|
8
|
+
import '@radix-ui/react-scroll-area';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @file sheets/bottom-sheet/bottom-sheet-scaffold.tsx
|
|
12
|
+
*
|
|
13
|
+
* Standard Bottom Sheet Scaffold — persistent sheet layout component.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors Android Jetpack Compose `BottomSheetScaffold`:
|
|
16
|
+
* - Sheet is always visible at minimum `sheetPeekHeight` (no hidden/dismiss state)
|
|
17
|
+
* - Body content lives above the sheet peek via `paddingBottom`
|
|
18
|
+
* - Optional `topBar` slot
|
|
19
|
+
* - Drag to expand (full container height) / collapse (peek height only)
|
|
20
|
+
* - No scrim (standard sheet, not modal)
|
|
21
|
+
* - Drag handle keyboard accessible: click/Space/Enter toggles state
|
|
22
|
+
*
|
|
23
|
+
* API (Option A — matches Kotlin):
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <BottomSheetScaffold sheetContent={<SheetBody />}>
|
|
26
|
+
* {(paddingBottom) => <PageBody style={{ paddingBottom }} />}
|
|
27
|
+
* </BottomSheetScaffold>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see https://m3.material.io/components/sheets-bottom/overview#standard
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
interface BottomSheetScaffoldProps {
|
|
34
|
+
/**
|
|
35
|
+
* Content rendered inside the bottom sheet panel.
|
|
36
|
+
* Equivalent to Kotlin's `sheetContent: @Composable ColumnScope.() -> Unit`.
|
|
37
|
+
*/
|
|
38
|
+
sheetContent: React$1.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Body content of the page. Receives `paddingBottom` string to push
|
|
41
|
+
* content above the visible sheet peek area.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* {(paddingBottom) => <main style={{ paddingBottom }}>{page}</main>}
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
children: (paddingBottom: string) => React$1.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Visible height of the sheet when collapsed.
|
|
51
|
+
* Default: `"var(--m3-bottom-sheet-peek-height, 56px)"`
|
|
52
|
+
*/
|
|
53
|
+
sheetPeekHeight?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum width of the sheet.
|
|
56
|
+
* Default: `"var(--m3-bottom-sheet-max-width, 640px)"`
|
|
57
|
+
*/
|
|
58
|
+
sheetMaxWidth?: string | number;
|
|
59
|
+
/**
|
|
60
|
+
* Custom drag handle. Pass `null` to hide the handle entirely.
|
|
61
|
+
* Default: MD3 drag handle indicator bar.
|
|
62
|
+
*/
|
|
63
|
+
sheetDragHandle?: React$1.ReactNode | null;
|
|
64
|
+
/**
|
|
65
|
+
* Enable/disable swipe gestures on the sheet.
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
sheetSwipeEnabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Optional top app bar slot rendered above the page body.
|
|
71
|
+
*/
|
|
72
|
+
topBar?: React$1.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Background color of the sheet panel.
|
|
75
|
+
* Defaults to `surfaceContainerLow` token.
|
|
76
|
+
*/
|
|
77
|
+
sheetContainerColor?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Called when the sheet transitions between states.
|
|
80
|
+
*/
|
|
81
|
+
onSheetStateChange?: (state: Extract<SheetValue, "partiallyExpanded" | "expanded">) => void;
|
|
82
|
+
/** Initial state of the sheet. @default "partiallyExpanded" */
|
|
83
|
+
initialSheetState?: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
84
|
+
/** Additional CSS class for the outer scaffold container. */
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Standard Bottom Sheet Scaffold.
|
|
89
|
+
*
|
|
90
|
+
* Renders a persistent bottom sheet that stays on screen (never fully hidden).
|
|
91
|
+
* The body content is offset by `sheetPeekHeight` so it is never obscured.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <BottomSheetScaffold
|
|
96
|
+
* sheetContent={<p>Player controls</p>}
|
|
97
|
+
* topBar={<AppBar />}
|
|
98
|
+
* >
|
|
99
|
+
* {(paddingBottom) => (
|
|
100
|
+
* <AlbumList style={{ paddingBottom }} />
|
|
101
|
+
* )}
|
|
102
|
+
* </BottomSheetScaffold>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare const BottomSheetScaffold: React$1.ForwardRefExoticComponent<BottomSheetScaffoldProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @file sheets/bottom-sheet/use-bottom-sheet-scaffold.ts
|
|
109
|
+
*
|
|
110
|
+
* Core logic for `BottomSheetScaffold` — the standard (non-modal, persistent)
|
|
111
|
+
* bottom sheet layout component.
|
|
112
|
+
*
|
|
113
|
+
* Mirrors Android's `BottomSheetScaffoldState` / `BottomSheetState`:
|
|
114
|
+
* - 2-state machine: `partiallyExpanded` ↔ `expanded` (no `hidden` state)
|
|
115
|
+
* - Sheet is ALWAYS visible at minimum `peekHeight`
|
|
116
|
+
* - Velocity-based fling + nearest-snap logic on drag-end
|
|
117
|
+
* - BoundaryDampeningZone prevents over-flinging
|
|
118
|
+
*
|
|
119
|
+
* @see https://m3.material.io/components/sheets-bottom/overview#standard
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
interface UseBottomSheetScaffoldOptions {
|
|
123
|
+
/** Visible height when partially collapsed. Default: 56px. */
|
|
124
|
+
peekHeight?: number;
|
|
125
|
+
/** Whether swipe gestures are enabled. Default: true. */
|
|
126
|
+
swipeEnabled?: boolean;
|
|
127
|
+
/** Called when the sheet state changes. */
|
|
128
|
+
onStateChange?: (state: Extract<SheetValue, "partiallyExpanded" | "expanded">) => void;
|
|
129
|
+
/** Initial state. Default: "partiallyExpanded". */
|
|
130
|
+
initialState?: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
131
|
+
}
|
|
132
|
+
interface UseBottomSheetScaffoldReturn {
|
|
133
|
+
/** Current discrete sheet state. */
|
|
134
|
+
sheetState: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
135
|
+
/** Y MotionValue of the sheet panel (absolute from top of scaffold container). */
|
|
136
|
+
y: ReturnType<typeof useMotionValue<number>>;
|
|
137
|
+
/** Expand to full height. */
|
|
138
|
+
expand: () => void;
|
|
139
|
+
/** Collapse to peek height. */
|
|
140
|
+
partialExpand: () => void;
|
|
141
|
+
/** Toggle between partiallyExpanded and expanded. */
|
|
142
|
+
toggle: () => void;
|
|
143
|
+
/** Whether drag is allowed. */
|
|
144
|
+
isDragEnabled: boolean;
|
|
145
|
+
/** Drag constraints for m.div. */
|
|
146
|
+
dragConstraints: {
|
|
147
|
+
top: number;
|
|
148
|
+
bottom: number;
|
|
149
|
+
};
|
|
150
|
+
/** Drag-end handler — snaps to closest anchor. */
|
|
151
|
+
handleDragEnd: (e: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
|
|
152
|
+
/** Scroll handler for nested content. */
|
|
153
|
+
handleContentScroll: (e: React.UIEvent<HTMLElement>) => void;
|
|
154
|
+
/** Height of the content area above the sheet peek. */
|
|
155
|
+
contentPaddingBottom: string;
|
|
156
|
+
/** Callback ref for the scaffold's container element. */
|
|
157
|
+
containerRef: React.RefCallback<HTMLDivElement | null>;
|
|
158
|
+
}
|
|
159
|
+
declare function useBottomSheetScaffold({ peekHeight, swipeEnabled, onStateChange, initialState, }?: UseBottomSheetScaffoldOptions): UseBottomSheetScaffoldReturn;
|
|
160
|
+
|
|
161
|
+
export { BottomSheetScaffold, type BottomSheetScaffoldProps, SheetValue, type UseBottomSheetScaffoldOptions, type UseBottomSheetScaffoldReturn, useBottomSheetScaffold };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { W as SheetValue } from './side-sheet-modal-CglP6KYA.js';
|
|
2
|
+
export { B as BaseSheetProps, a as BottomSheet, b as BottomSheetHandle, c as BottomSheetModal, d as BottomSheetModalProps, e as BottomSheetProps, f as BottomSheetSnapPoint, D as Dialog, g as DialogBody, h as DialogClose, i as DialogContent, j as DialogContentProps, k as DialogDescription, l as DialogFooter, m as DialogFullScreenContent, n as DialogFullScreenContentProps, o as DialogHeader, p as DialogIcon, q as DialogOverlay, r as DialogPortal, s as DialogProps, t as DialogTitle, u as DialogTrigger, v as DragHandle, w as DragHandleProps, x as Drawer, y as DrawerClose, z as DrawerContent, A as DrawerContentProps, C as DrawerDescription, E as DrawerFooter, F as DrawerHeader, G as DrawerOverlay, H as DrawerPortal, I as DrawerProps, J as DrawerTitle, K as DrawerTrigger, S as Scrim, L as ScrimProps, M as SheetEdge, N as SheetState, O as SideSheet, P as SideSheetModal, Q as SideSheetModalProps, R as SideSheetProps, U as UseBottomSheetOptions, T as UseBottomSheetReturn, V as useBottomSheet } from './side-sheet-modal-CglP6KYA.js';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import { useMotionValue, PanInfo } from 'motion/react';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import '@radix-ui/react-dialog';
|
|
7
|
+
import './scroll-area-CVS6HyLl.js';
|
|
8
|
+
import '@radix-ui/react-scroll-area';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @file sheets/bottom-sheet/bottom-sheet-scaffold.tsx
|
|
12
|
+
*
|
|
13
|
+
* Standard Bottom Sheet Scaffold — persistent sheet layout component.
|
|
14
|
+
*
|
|
15
|
+
* Mirrors Android Jetpack Compose `BottomSheetScaffold`:
|
|
16
|
+
* - Sheet is always visible at minimum `sheetPeekHeight` (no hidden/dismiss state)
|
|
17
|
+
* - Body content lives above the sheet peek via `paddingBottom`
|
|
18
|
+
* - Optional `topBar` slot
|
|
19
|
+
* - Drag to expand (full container height) / collapse (peek height only)
|
|
20
|
+
* - No scrim (standard sheet, not modal)
|
|
21
|
+
* - Drag handle keyboard accessible: click/Space/Enter toggles state
|
|
22
|
+
*
|
|
23
|
+
* API (Option A — matches Kotlin):
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <BottomSheetScaffold sheetContent={<SheetBody />}>
|
|
26
|
+
* {(paddingBottom) => <PageBody style={{ paddingBottom }} />}
|
|
27
|
+
* </BottomSheetScaffold>
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see https://m3.material.io/components/sheets-bottom/overview#standard
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
interface BottomSheetScaffoldProps {
|
|
34
|
+
/**
|
|
35
|
+
* Content rendered inside the bottom sheet panel.
|
|
36
|
+
* Equivalent to Kotlin's `sheetContent: @Composable ColumnScope.() -> Unit`.
|
|
37
|
+
*/
|
|
38
|
+
sheetContent: React$1.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Body content of the page. Receives `paddingBottom` string to push
|
|
41
|
+
* content above the visible sheet peek area.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* {(paddingBottom) => <main style={{ paddingBottom }}>{page}</main>}
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
children: (paddingBottom: string) => React$1.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Visible height of the sheet when collapsed.
|
|
51
|
+
* Default: `"var(--m3-bottom-sheet-peek-height, 56px)"`
|
|
52
|
+
*/
|
|
53
|
+
sheetPeekHeight?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Maximum width of the sheet.
|
|
56
|
+
* Default: `"var(--m3-bottom-sheet-max-width, 640px)"`
|
|
57
|
+
*/
|
|
58
|
+
sheetMaxWidth?: string | number;
|
|
59
|
+
/**
|
|
60
|
+
* Custom drag handle. Pass `null` to hide the handle entirely.
|
|
61
|
+
* Default: MD3 drag handle indicator bar.
|
|
62
|
+
*/
|
|
63
|
+
sheetDragHandle?: React$1.ReactNode | null;
|
|
64
|
+
/**
|
|
65
|
+
* Enable/disable swipe gestures on the sheet.
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
sheetSwipeEnabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Optional top app bar slot rendered above the page body.
|
|
71
|
+
*/
|
|
72
|
+
topBar?: React$1.ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Background color of the sheet panel.
|
|
75
|
+
* Defaults to `surfaceContainerLow` token.
|
|
76
|
+
*/
|
|
77
|
+
sheetContainerColor?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Called when the sheet transitions between states.
|
|
80
|
+
*/
|
|
81
|
+
onSheetStateChange?: (state: Extract<SheetValue, "partiallyExpanded" | "expanded">) => void;
|
|
82
|
+
/** Initial state of the sheet. @default "partiallyExpanded" */
|
|
83
|
+
initialSheetState?: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
84
|
+
/** Additional CSS class for the outer scaffold container. */
|
|
85
|
+
className?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Standard Bottom Sheet Scaffold.
|
|
89
|
+
*
|
|
90
|
+
* Renders a persistent bottom sheet that stays on screen (never fully hidden).
|
|
91
|
+
* The body content is offset by `sheetPeekHeight` so it is never obscured.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <BottomSheetScaffold
|
|
96
|
+
* sheetContent={<p>Player controls</p>}
|
|
97
|
+
* topBar={<AppBar />}
|
|
98
|
+
* >
|
|
99
|
+
* {(paddingBottom) => (
|
|
100
|
+
* <AlbumList style={{ paddingBottom }} />
|
|
101
|
+
* )}
|
|
102
|
+
* </BottomSheetScaffold>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare const BottomSheetScaffold: React$1.ForwardRefExoticComponent<BottomSheetScaffoldProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @file sheets/bottom-sheet/use-bottom-sheet-scaffold.ts
|
|
109
|
+
*
|
|
110
|
+
* Core logic for `BottomSheetScaffold` — the standard (non-modal, persistent)
|
|
111
|
+
* bottom sheet layout component.
|
|
112
|
+
*
|
|
113
|
+
* Mirrors Android's `BottomSheetScaffoldState` / `BottomSheetState`:
|
|
114
|
+
* - 2-state machine: `partiallyExpanded` ↔ `expanded` (no `hidden` state)
|
|
115
|
+
* - Sheet is ALWAYS visible at minimum `peekHeight`
|
|
116
|
+
* - Velocity-based fling + nearest-snap logic on drag-end
|
|
117
|
+
* - BoundaryDampeningZone prevents over-flinging
|
|
118
|
+
*
|
|
119
|
+
* @see https://m3.material.io/components/sheets-bottom/overview#standard
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
interface UseBottomSheetScaffoldOptions {
|
|
123
|
+
/** Visible height when partially collapsed. Default: 56px. */
|
|
124
|
+
peekHeight?: number;
|
|
125
|
+
/** Whether swipe gestures are enabled. Default: true. */
|
|
126
|
+
swipeEnabled?: boolean;
|
|
127
|
+
/** Called when the sheet state changes. */
|
|
128
|
+
onStateChange?: (state: Extract<SheetValue, "partiallyExpanded" | "expanded">) => void;
|
|
129
|
+
/** Initial state. Default: "partiallyExpanded". */
|
|
130
|
+
initialState?: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
131
|
+
}
|
|
132
|
+
interface UseBottomSheetScaffoldReturn {
|
|
133
|
+
/** Current discrete sheet state. */
|
|
134
|
+
sheetState: Extract<SheetValue, "partiallyExpanded" | "expanded">;
|
|
135
|
+
/** Y MotionValue of the sheet panel (absolute from top of scaffold container). */
|
|
136
|
+
y: ReturnType<typeof useMotionValue<number>>;
|
|
137
|
+
/** Expand to full height. */
|
|
138
|
+
expand: () => void;
|
|
139
|
+
/** Collapse to peek height. */
|
|
140
|
+
partialExpand: () => void;
|
|
141
|
+
/** Toggle between partiallyExpanded and expanded. */
|
|
142
|
+
toggle: () => void;
|
|
143
|
+
/** Whether drag is allowed. */
|
|
144
|
+
isDragEnabled: boolean;
|
|
145
|
+
/** Drag constraints for m.div. */
|
|
146
|
+
dragConstraints: {
|
|
147
|
+
top: number;
|
|
148
|
+
bottom: number;
|
|
149
|
+
};
|
|
150
|
+
/** Drag-end handler — snaps to closest anchor. */
|
|
151
|
+
handleDragEnd: (e: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
|
|
152
|
+
/** Scroll handler for nested content. */
|
|
153
|
+
handleContentScroll: (e: React.UIEvent<HTMLElement>) => void;
|
|
154
|
+
/** Height of the content area above the sheet peek. */
|
|
155
|
+
contentPaddingBottom: string;
|
|
156
|
+
/** Callback ref for the scaffold's container element. */
|
|
157
|
+
containerRef: React.RefCallback<HTMLDivElement | null>;
|
|
158
|
+
}
|
|
159
|
+
declare function useBottomSheetScaffold({ peekHeight, swipeEnabled, onStateChange, initialState, }?: UseBottomSheetScaffoldOptions): UseBottomSheetScaffoldReturn;
|
|
160
|
+
|
|
161
|
+
export { BottomSheetScaffold, type BottomSheetScaffoldProps, SheetValue, type UseBottomSheetScaffoldOptions, type UseBottomSheetScaffoldReturn, useBottomSheetScaffold };
|