Skip to content

Commit 3dc4c2a

Browse files
authored
Merge pull request #4 from cozy/fix/multiple
fix: No click throw or drag if not inside the bottom sheet
2 parents 91e0007 + 69cdd00 commit 3dc4c2a

12 files changed

+972
-2
lines changed

dist/BottomSheet.d.ts

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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>;

dist/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './BottomSheet';

dist/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
'use strict'
3+
4+
if (process.env.NODE_ENV === 'production') {
5+
module.exports = require('./mui-bottom-sheet.cjs.production.min.js')
6+
} else {
7+
module.exports = require('./mui-bottom-sheet.cjs.development.js')
8+
}

0 commit comments

Comments
 (0)