|
| 1 | +import { FC, ReactElement } from 'react'; |
| 2 | +export interface bottomSheetOptions { |
| 3 | + /** |
| 4 | + * Show backdrop that darkens as the sheet is pulled up. Defaults to true. |
| 5 | + * |
| 6 | + * @default true |
| 7 | + */ |
| 8 | + backdrop?: boolean; |
| 9 | + /** |
| 10 | + * Background component behind sheet. Requires at least two `peekHeights`. |
| 11 | + * @default null |
| 12 | + */ |
| 13 | + background?: ReactElement; |
| 14 | + /** |
| 15 | + * Current peek index if you want to control the component. |
| 16 | + * @default 0; |
| 17 | + */ |
| 18 | + currentIndex?: number; |
| 19 | + /** |
| 20 | + * Sheet height when in closed state. |
| 21 | + * @default 100 |
| 22 | + */ |
| 23 | + defaultHeight: number; |
| 24 | + /** |
| 25 | + * Whether to go allow sheet to go full screen. If false, sheet will max out at largest peekHeight. |
| 26 | + * @default true |
| 27 | + */ |
| 28 | + fullHeight: boolean; |
| 29 | + /** |
| 30 | + * Completely hides the sheet when true. |
| 31 | + * @default false |
| 32 | + */ |
| 33 | + hidden: boolean | number; |
| 34 | + /** |
| 35 | + * Called when the user interacts and moves the bottomsheet to a new peek height |
| 36 | + */ |
| 37 | + onIndexChange?: (index: number) => void; |
| 38 | + /** |
| 39 | + * Sheet will stop at certain heights to reveal more info. |
| 40 | + * @default [] |
| 41 | + */ |
| 42 | + peekHeights?: number[]; |
| 43 | + /** |
| 44 | + * Which spring config to use for snapping the sheet |
| 45 | + * @default config.stiff |
| 46 | + */ |
| 47 | + springConfig: Record<string, any>; |
| 48 | + /** |
| 49 | + * User styles for root, background and backdrop. |
| 50 | + * @default {root:{},background:{},backdrop:{}} |
| 51 | + */ |
| 52 | + styles?: bottomSheetStyles; |
| 53 | + /** |
| 54 | + * Threshold for over-dragging the sheet before snapping to closest height. |
| 55 | + * @default 70 |
| 56 | + */ |
| 57 | + threshold: number; |
| 58 | + /** |
| 59 | + * Prevents the sheet from being totally closed |
| 60 | + * @default false |
| 61 | + */ |
| 62 | + disabledClosing: boolean; |
| 63 | + /** |
| 64 | + * Defines how the sheet should be anchored on the snap point |
| 65 | + * @default false |
| 66 | + */ |
| 67 | + snapPointSeekerMode: string; |
| 68 | + /** |
| 69 | + * Remove animations |
| 70 | + * @default false |
| 71 | + */ |
| 72 | + skipAnimation: boolean; |
| 73 | +} |
| 74 | +export interface BottomSheetProps extends Partial<bottomSheetOptions> { |
| 75 | +} |
| 76 | +export interface bottomSheetStyles { |
| 77 | + backdrop?: Record<string, any>; |
| 78 | + background?: Record<string, any>; |
| 79 | + root?: Record<string, any>; |
| 80 | +} |
| 81 | +/** Some sensible defaults */ |
| 82 | +export declare const defaultOptions: { |
| 83 | + backdrop: boolean; |
| 84 | + background: null; |
| 85 | + defaultHeight: number; |
| 86 | + fullHeight: boolean; |
| 87 | + hidden: boolean; |
| 88 | + peekHeights: never[]; |
| 89 | + springConfig: { |
| 90 | + readonly tension: 210; |
| 91 | + readonly friction: 20; |
| 92 | + }; |
| 93 | + styles: { |
| 94 | + root: {}; |
| 95 | + backdrop: {}; |
| 96 | + background: {}; |
| 97 | + }; |
| 98 | + threshold: number; |
| 99 | + disabledClosing: boolean; |
| 100 | + snapPointSeekerMode: string; |
| 101 | + skipAnimation: boolean; |
| 102 | +}; |
| 103 | +export declare const BottomSheet: FC<BottomSheetProps>; |
0 commit comments