react-modal-sheet 1.11.0 → 2.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/README.md CHANGED
@@ -56,7 +56,6 @@ function Example() {
56
56
  <Sheet.Header />
57
57
  <Sheet.Content>{/* Your sheet content goes here */}</Sheet.Content>
58
58
  </Sheet.Container>
59
-
60
59
  <Sheet.Backdrop />
61
60
  </Sheet>
62
61
  </>
@@ -66,42 +65,30 @@ function Example() {
66
65
 
67
66
  The `Sheet` component follows the [Compound Component pattern](https://kentcdodds.com/blog/compound-components-with-react-hooks) in order to provide a flexible yet powerful API for creating highly customizable bottom sheet components.
68
67
 
69
- Since the final bottom sheet is composed from smaller building blocks (`Container`, `Content`, `Header`, and `Backdrop`) you are in total control over the rendering output. So for example, if you don't want to have any backdrop in your sheet then you can just skip rendering it instead of passing some prop like `renderBackdrop={false}` to the main sheet component. Cool huh? 😎
68
+ Since the final bottom sheet is composed from smaller building blocks (`Container`, `Content`, `Scroller`, `Header`, and `Backdrop`) you are in total control over the rendering output. So for example, if you don't want to have any backdrop in your sheet then you can just skip rendering it instead of passing some prop like `renderBackdrop={false}` to the main sheet component. Cool huh? 😎
70
69
 
71
70
  Also, by constructing the sheet from smaller pieces makes it easier to apply any necessary accessibility related properties to the right components without requiring the main sheet component to be aware of them. You can read more about accessibility in the [Accessibility](#Accessibility) section.
72
71
 
73
72
  ## Props
74
73
 
75
- | Name | Required | Default | Description |
76
- | ---------------------- | -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | `children` | yes | | Use `Sheet.Container/Content/Header/Backdrop` to compose your bottom sheet. |
78
- | `isOpen` | yes | | Boolean that indicates whether the sheet is open or not. |
79
- | `onClose` | yes | | Callback fn that is called when the sheet is closed by the user. |
80
- | `disableDrag` | no | false | Disable drag for the whole sheet. |
81
- | `detent` | no | `'full-height'` | The [detent](https://developer.apple.com/design/human-interface-guidelines/components/presentation/sheets#ios-ipados) in which the sheet should be in when opened. Available values: `'full-height'` or `'content-height'`. |
82
- | `onOpenStart` | no | | Callback fn that is called when the sheet opening animation starts. |
83
- | `onOpenEnd` | no | | Callback fn that is called when the sheet opening animation is completed. |
84
- | `onCloseStart` | no | | Callback fn that is called when the sheet closing animation starts. |
85
- | `onCloseEnd` | no | | Callback fn that is called when the sheet closing animation is completed. |
86
- | `onSnap` | no | | Callback fn that is called with the current snap point index when the sheet snaps to a new snap point. Requires `snapPoints` prop. |
87
- | `snapPoints` | no | | Eg. `[-50, 0.5, 100, 0]` - where positive values are pixels from the bottom of the screen and negative from the top. Values between 0-1 represent percentages, eg. `0.5` means 50% of window height from the bottom of the sceen. |
88
- | `initialSnap` | no | 0 | Initial snap point when sheet is opened (index from `snapPoints`). |
89
- | `rootId` | no | | The id of the element where the main app is mounted, eg. "root". Enables iOS modal effect. |
90
- | `springConfig` | no | `DEFAULT_SPRING` | Overrides the config for the [spring animation](https://www.framer.com/api/motion/types/#spring). |
91
- | `mountPoint` | no | `document.body` | HTML element that should be used as the mount point for the sheet. |
92
- | `prefersReducedMotion` | no | false | Skip sheet animations (sheet instantly snaps to desired location). |
93
-
94
- **`DEFAULT_SPRING`**
95
-
96
- Spring animation happens when the sheet is opened/closed or when it snaps to a snap point.
97
-
98
- ```js
99
- {
100
- stiffness: 300,
101
- damping: 30,
102
- mass: 0.2,
103
- }
104
- ```
74
+ | Name | Required | Default | Description |
75
+ | ---------------------- | -------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
76
+ | `children` | yes | | Use `Sheet.Container/Content/Header/Backdrop` to compose your bottom sheet. |
77
+ | `isOpen` | yes | | Boolean that indicates whether the sheet is open or not. |
78
+ | `onClose` | yes | | Callback fn that is called when the sheet is closed by the user. |
79
+ | `disableDrag` | no | false | Disable drag for the whole sheet. |
80
+ | `detent` | no | `'full-height'` | The [detent](https://developer.apple.com/design/human-interface-guidelines/components/presentation/sheets#ios-ipados) in which the sheet should be in when opened. Available values: `'full-height'` or `'content-height'`. |
81
+ | `onOpenStart` | no | | Callback fn that is called when the sheet opening animation starts. |
82
+ | `onOpenEnd` | no | | Callback fn that is called when the sheet opening animation is completed. |
83
+ | `onCloseStart` | no | | Callback fn that is called when the sheet closing animation starts. |
84
+ | `onCloseEnd` | no | | Callback fn that is called when the sheet closing animation is completed. |
85
+ | `onSnap` | no | | Callback fn that is called with the current snap point index when the sheet snaps to a new snap point. Requires `snapPoints` prop. |
86
+ | `snapPoints` | no | | Eg. `[-50, 0.5, 100, 0]` - where positive values are pixels from the bottom of the screen and negative from the top. Values between 0-1 represent percentages, eg. `0.5` means 50% of window height from the bottom of the sceen. |
87
+ | `initialSnap` | no | 0 | Initial snap point when sheet is opened (index from `snapPoints`). |
88
+ | `rootId` | no | | The id of the element where the main app is mounted, eg. "root". Enables iOS modal effect. |
89
+ | `tweenConfig` | no | `{ ease: 'easeOut', duration: 0.2 }` | Overrides the config for the sheet [tween](https://www.framer.com/motion/transition/#tween) transition when the sheet is opened, closed, or snapped to a point. |
90
+ | `mountPoint` | no | `document.body` | HTML element that should be used as the mount point for the sheet. |
91
+ | `prefersReducedMotion` | no | false | Skip sheet animations (sheet instantly snaps to desired location). |
105
92
 
106
93
  ## Methods and properties
107
94
 
@@ -183,7 +170,9 @@ function Example() {
183
170
  * way to the bottom in every snap point.
184
171
  */}
185
172
  <Sheet.Content style={{ paddingBottom: ref.current?.y }}>
186
- {/* Some content here that makes the sheet content scrollable */}
173
+ <Sheet.Scroller draggableAt="both">
174
+ {/* Some content here that makes the sheet content scrollable */}
175
+ </Sheet.Scroller>
187
176
  </Sheet.Content>
188
177
  </Sheet.Container>
189
178
  </Sheet>
@@ -208,7 +197,9 @@ function Example() {
208
197
  >
209
198
  <Sheet.Container>
210
199
  <Sheet.Content>
211
- <div style={{ height: 200 }}>Some content</div>
200
+ <Sheet.Scroller>
201
+ <div style={{ height: 200 }}>Some content</div>
202
+ </Sheet.Scroller>
212
203
  </Sheet.Content>
213
204
  </Sheet.Container>
214
205
  </Sheet>
@@ -236,9 +227,21 @@ Sheet container is positioned above the sheet backdrop and by default adds a sma
236
227
 
237
228
  > 🖥 Rendered element: `motion.div`.
238
229
 
230
+ ### `Sheet.Header`
231
+
232
+ Sheet header acts as a drag target and has a dragging direction indicator. Rendering any children inside `Sheet.Header` replaces the default header.
233
+
234
+ > 🖥 Rendered element: `motion.div`.
235
+
236
+ #### Header props
237
+
238
+ | Name | Required | Default | Description |
239
+ | ------------- | -------- | ------- | ---------------------------------- |
240
+ | `disableDrag` | no | false | Disable drag for the sheet header. |
241
+
239
242
  ### `Sheet.Content`
240
243
 
241
- Sheet content acts as a drag target and makes sure that content which doesn't fit inside the sheet becomes scrollable.
244
+ Sheet content acts as a drag target and can be used in conjunction with `Sheet.Scroller` to make sure that content which doesn't fit inside the sheet becomes scrollable.
242
245
 
243
246
  > 🖥 Rendered element: `motion.div`.
244
247
 
@@ -248,26 +251,56 @@ Sheet content acts as a drag target and makes sure that content which doesn't fi
248
251
  | ------------- | -------- | ------- | ----------------------------------- |
249
252
  | `disableDrag` | no | false | Disable drag for the sheet content. |
250
253
 
251
- ### `Sheet.Header`
254
+ ### `Sheet.Scroller`
252
255
 
253
- Sheet header acts as a drag target and has a dragging direction indicator. Rendering any children inside `Sheet.Header` replaces the default header.
256
+ Sheet scroller can be used to make the whole sheet content or parts of it scrollable in a way that drag gestures are properly disabled and enabled based on the scroll state. See the [Scrolling on touch devices](#scrolling-on-touch-devices) section for more details.
254
257
 
255
258
  > 🖥 Rendered element: `motion.div`.
256
259
 
257
- #### Header props
260
+ #### Scroller props
258
261
 
259
- | Name | Required | Default | Description |
260
- | ------------- | -------- | ------- | ---------------------------------- |
261
- | `disableDrag` | no | false | Disable drag for the sheet header. |
262
+ | Name | Required | Default | Description |
263
+ | ------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
264
+ | `draggableAt` | no | `"top"` | Should the drag be enabled when the element is scrolled either to the top, bottom, or both. Available values: `top`, `bottom`, `both`. |
262
265
 
263
266
  ### `Sheet.Backdrop`
264
267
 
265
- Sheet backdrop is a translucent overlay that helps to separate the sheet from it's background. By default the backdrop doesn't have any interaction attached to it but if you, for example, want to close the sheet when the backdrop is clicked you can provide click/tap handlers to it which will change the rendered element from `div` to `button`.
268
+ Sheet backdrop is a translucent overlay that helps to separate the sheet from it's background. By default the backdrop doesn't have any interaction attached to it but if you, for example, want to close the sheet when the backdrop is clicked you can provide tap handler to it which will change the rendered element from `div` to `button`.
269
+
270
+ ⚠️ **Note:** as the element is a motion component you need to use [`onTap`](https://www.framer.com/motion/gestures/#tap) instead of `onClick` if you want to add a click handler to it.
266
271
 
267
272
  > 🖥 Rendered element: `motion.div` or `motion.button`.
268
273
 
269
274
  ## Advanced usage
270
275
 
276
+ ### Scrolling on touch devices
277
+
278
+ Scrolling and dragging are **the same** gesture on touch devices which can create problems when you want to have scrollable content inside the sheet. React Modal Sheet provides a `Sheet.Scroller` component that is able to automatically disable and enable dragging inside the `Sheet.Content` component based on the scroll state. There are three modes for the `Sheet.Scroller` reflected in the `draggableAt` prop:
279
+
280
+ 1. Enable dragging when the scroller is not yet scrolled - it is at the `top` position.
281
+ 2. Enable dragging when the scroller is scrolled all the way to the bottom - it is at the `bottom` position.
282
+ 3. Enable dragging in `both` positions.
283
+
284
+ The scroller component is in-between these states when the user has scrolled only some amount. Dragging is always **disabled** in this in-between state in order to avoid it getting mixed with dragging gestures. The `Sheet.Scroller` component applies the special handling only for touch devices.
285
+
286
+ The default value for the `draggableAt` prop is `top` which should be a good default for most use cases. You shouldn't need `bottom` or `both` unless you have scrollable content inside a sheet that also has snap points.
287
+
288
+ ```jsx
289
+ function ScrollableExample() {
290
+ return (
291
+ <Sheet>
292
+ <Sheet.Container>
293
+ <Sheet.Header />
294
+ <Sheet.Content>
295
+ <Sheet.Scroller>{/*...*/}</Sheet.Scroller>
296
+ </Sheet.Content>
297
+ </Sheet.Container>
298
+ <Sheet.Backdrop />
299
+ </Sheet>
300
+ );
301
+ }
302
+ ```
303
+
271
304
  ### iOS Modal View effect
272
305
 
273
306
  In addition to the `Sheet.Backdrop` it's possible to apply a scaling effect to the main app element to highlight the modality of the bottom sheet. This effect mimics the [iOS Modal View](https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/modality/) presentation style to bring more focus to the sheet and add some delight to the user experience.
@@ -302,10 +335,8 @@ function Example() {
302
335
  <Sheet.Header>
303
336
  <YourCustomSheetHeader />
304
337
  </Sheet.Header>
305
-
306
338
  <Sheet.Content>{/*...*/}</Sheet.Content>
307
339
  </Sheet.Container>
308
-
309
340
  <Sheet.Backdrop />
310
341
  </Sheet>
311
342
  );
@@ -339,7 +370,7 @@ You can add your own styles or override the default sheet styles via the exposed
339
370
  #### CSS-in-JS
340
371
 
341
372
  ```jsx
342
- import Sheet from 'react-modal-sheeet';
373
+ import Sheet from 'react-modal-sheet';
343
374
  import styled from 'styled-components';
344
375
  import { useState } from 'react';
345
376
 
@@ -369,12 +400,11 @@ function Example() {
369
400
  <button onClick={() => setOpen(true)}>Open sheet</button>
370
401
 
371
402
  <CustomSheet isOpen={isOpen} onClose={() => setOpen(false)}>
372
- <CustomSheet.Container>
373
- <CustomSheet.Header />
374
- <CustomSheet.Content>{/*...*/}</CustomSheet.Content>
375
- </CustomSheet.Container>
376
-
377
- <CustomSheet.Backdrop />
403
+ <Sheet.Container>
404
+ <Sheet.Header />
405
+ <Sheet.Content>{/*...*/}</Sheet.Content>
406
+ </Sheet.Container>
407
+ <Sheet.Backdrop />
378
408
  </CustomSheet>
379
409
  </>
380
410
  );
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetBackdrop: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & React.RefAttributes<any>>;
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "inherit" | "ignoreStrict" | "className"> & React.RefAttributes<any>>;
5
5
  export default SheetBackdrop;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetContainer: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "drag" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDragStart" | "onDragEnd" | "onDrag" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "inherit" | "ignoreStrict" | "className"> & {
5
5
  children: React.ReactNode;
6
6
  } & React.RefAttributes<any>>;
7
7
  export default SheetContainer;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetContent: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "inherit" | "ignoreStrict" | "className"> & {
5
5
  children?: React.ReactNode;
6
6
  disableDrag?: boolean | undefined;
7
7
  } & React.RefAttributes<any>>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  declare const SheetHeader: React.ForwardRefExoticComponent<Pick<import("framer-motion").MotionProps & {
3
3
  className?: string | undefined;
4
- }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "custom" | "inherit" | "className"> & {
4
+ }, "style" | "transformTemplate" | "transformValues" | "children" | "initial" | "animate" | "exit" | "variants" | "transition" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationStart" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "whileTap" | "whileHover" | "onHoverStart" | "onHoverEnd" | "whileFocus" | "whileInView" | "onViewportEnter" | "onViewportLeave" | "viewport" | "whileDrag" | "dragDirectionLock" | "dragPropagation" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layout" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "inherit" | "ignoreStrict" | "className"> & {
5
5
  children?: React.ReactNode;
6
6
  disableDrag?: boolean | undefined;
7
7
  } & React.RefAttributes<any>>;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ declare const SheetScroller: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
3
+ draggableAt?: "top" | "bottom" | "both" | undefined;
4
+ } & React.RefAttributes<any>>;
5
+ export default SheetScroller;
@@ -1,9 +1,12 @@
1
1
  export declare const MAX_HEIGHT = "calc(100% - env(safe-area-inset-top) - 34px)";
2
2
  export declare const IS_SSR: boolean;
3
- export declare const DEFAULT_SPRING_CONFIG: {
4
- stiffness: number;
5
- damping: number;
6
- mass: number;
3
+ export declare const DEFAULT_TWEEN_CONFIG: {
4
+ ease: string;
5
+ duration: number;
6
+ };
7
+ export declare const REDUCED_MOTION_TWEEN_CONFIG: {
8
+ ease: string;
9
+ duration: number;
7
10
  };
8
11
  export declare const DRAG_CLOSE_THRESHOLD = 0.6;
9
12
  export declare const DRAG_VELOCITY_THRESHOLD = 500;
package/dist/context.d.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  import * as React from 'react';
2
- import { SheetContextType } from './types';
2
+ import { SheetScrollerContextType, SheetContextType } from './types';
3
3
  export declare const SheetContext: React.Context<SheetContextType | undefined>;
4
4
  export declare const useSheetContext: () => SheetContextType;
5
+ export declare const SheetScrollerContext: React.Context<SheetScrollerContextType | undefined>;
6
+ export declare function SheetScrollerContextProvider({ children, }: {
7
+ children: React.ReactNode;
8
+ }): React.JSX.Element;
9
+ export declare const useSheetScrollerContext: () => SheetScrollerContextType;
package/dist/hooks.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { SheetEvents } from './types';
3
3
  export declare const useIsomorphicLayoutEffect: typeof React.useEffect;
4
- export declare const useModalEffect: (isOpen: boolean, rootId?: string | undefined) => void;
5
- export declare const useEventCallbacks: (isOpen: boolean, callbacks: React.MutableRefObject<SheetEvents>) => {
4
+ export declare function useModalEffect(isOpen: boolean, rootId?: string): void;
5
+ export declare function useEventCallbacks(isOpen: boolean, callbacks: React.MutableRefObject<SheetEvents>): {
6
6
  handleAnimationComplete: () => void;
7
7
  };
8
8
  export declare function useWindowHeight(): number;