react-modal-sheet 1.11.1 → 2.1.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 +81 -50
- package/dist/SheetBackdrop.d.ts +1 -1
- package/dist/SheetContainer.d.ts +1 -1
- package/dist/SheetContent.d.ts +1 -1
- package/dist/SheetHeader.d.ts +1 -1
- package/dist/SheetScroller.d.ts +5 -0
- package/dist/constants.d.ts +7 -4
- package/dist/context.d.ts +6 -1
- package/dist/hooks.d.ts +2 -2
- package/dist/react-modal-sheet.cjs.development.js +231 -238
- package/dist/react-modal-sheet.cjs.development.js.map +1 -1
- package/dist/react-modal-sheet.cjs.production.min.js +1 -1
- package/dist/react-modal-sheet.cjs.production.min.js.map +1 -1
- package/dist/react-modal-sheet.esm.js +232 -239
- package/dist/react-modal-sheet.esm.js.map +1 -1
- package/dist/sheet.d.ts +2 -1
- package/dist/types.d.ts +18 -2
- package/dist/utils.d.ts +1 -0
- package/package.json +2 -3
- package/src/SheetContent.tsx +9 -4
- package/src/SheetScroller.tsx +59 -0
- package/src/constants.ts +8 -4
- package/src/context.tsx +38 -1
- package/src/hooks.tsx +5 -5
- package/src/index.tsx +2 -0
- package/src/sheet.tsx +18 -11
- package/src/styles.ts +9 -3
- package/src/types.tsx +25 -3
- package/src/utils.ts +8 -23
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,31 @@ 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
|
|
76
|
-
| ---------------------- | -------- |
|
|
77
|
-
| `children` | yes |
|
|
78
|
-
| `isOpen` | yes |
|
|
79
|
-
| `onClose` | yes |
|
|
80
|
-
| `disableDrag` | no | false
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
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
|
+
| `disableScrollLocking` | no | false | Disable's scroll locking for the documents `body` element while sheet is opened. Can be useful if you face issues with input elements and the iOS software keyboard. See [this Issue](https://github.com/Temzasse/react-modal-sheet/issues/135) |
|
|
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
|
+
| `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. |
|
|
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). |
|
|
105
93
|
|
|
106
94
|
## Methods and properties
|
|
107
95
|
|
|
@@ -183,7 +171,9 @@ function Example() {
|
|
|
183
171
|
* way to the bottom in every snap point.
|
|
184
172
|
*/}
|
|
185
173
|
<Sheet.Content style={{ paddingBottom: ref.current?.y }}>
|
|
186
|
-
|
|
174
|
+
<Sheet.Scroller draggableAt="both">
|
|
175
|
+
{/* Some content here that makes the sheet content scrollable */}
|
|
176
|
+
</Sheet.Scroller>
|
|
187
177
|
</Sheet.Content>
|
|
188
178
|
</Sheet.Container>
|
|
189
179
|
</Sheet>
|
|
@@ -208,7 +198,9 @@ function Example() {
|
|
|
208
198
|
>
|
|
209
199
|
<Sheet.Container>
|
|
210
200
|
<Sheet.Content>
|
|
211
|
-
<
|
|
201
|
+
<Sheet.Scroller>
|
|
202
|
+
<div style={{ height: 200 }}>Some content</div>
|
|
203
|
+
</Sheet.Scroller>
|
|
212
204
|
</Sheet.Content>
|
|
213
205
|
</Sheet.Container>
|
|
214
206
|
</Sheet>
|
|
@@ -236,9 +228,21 @@ Sheet container is positioned above the sheet backdrop and by default adds a sma
|
|
|
236
228
|
|
|
237
229
|
> 🖥 Rendered element: `motion.div`.
|
|
238
230
|
|
|
231
|
+
### `Sheet.Header`
|
|
232
|
+
|
|
233
|
+
Sheet header acts as a drag target and has a dragging direction indicator. Rendering any children inside `Sheet.Header` replaces the default header.
|
|
234
|
+
|
|
235
|
+
> 🖥 Rendered element: `motion.div`.
|
|
236
|
+
|
|
237
|
+
#### Header props
|
|
238
|
+
|
|
239
|
+
| Name | Required | Default | Description |
|
|
240
|
+
| ------------- | -------- | ------- | ---------------------------------- |
|
|
241
|
+
| `disableDrag` | no | false | Disable drag for the sheet header. |
|
|
242
|
+
|
|
239
243
|
### `Sheet.Content`
|
|
240
244
|
|
|
241
|
-
Sheet content acts as a drag target and
|
|
245
|
+
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
246
|
|
|
243
247
|
> 🖥 Rendered element: `motion.div`.
|
|
244
248
|
|
|
@@ -248,26 +252,56 @@ Sheet content acts as a drag target and makes sure that content which doesn't fi
|
|
|
248
252
|
| ------------- | -------- | ------- | ----------------------------------- |
|
|
249
253
|
| `disableDrag` | no | false | Disable drag for the sheet content. |
|
|
250
254
|
|
|
251
|
-
### `Sheet.
|
|
255
|
+
### `Sheet.Scroller`
|
|
252
256
|
|
|
253
|
-
Sheet
|
|
257
|
+
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
258
|
|
|
255
259
|
> 🖥 Rendered element: `motion.div`.
|
|
256
260
|
|
|
257
|
-
####
|
|
261
|
+
#### Scroller props
|
|
258
262
|
|
|
259
|
-
| Name | Required | Default | Description
|
|
260
|
-
| ------------- | -------- | ------- |
|
|
261
|
-
| `
|
|
263
|
+
| Name | Required | Default | Description |
|
|
264
|
+
| ------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
265
|
+
| `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
266
|
|
|
263
267
|
### `Sheet.Backdrop`
|
|
264
268
|
|
|
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
|
|
269
|
+
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`.
|
|
270
|
+
|
|
271
|
+
⚠️ **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
272
|
|
|
267
273
|
> 🖥 Rendered element: `motion.div` or `motion.button`.
|
|
268
274
|
|
|
269
275
|
## Advanced usage
|
|
270
276
|
|
|
277
|
+
### Scrolling on touch devices
|
|
278
|
+
|
|
279
|
+
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:
|
|
280
|
+
|
|
281
|
+
1. Enable dragging when the scroller is not yet scrolled - it is at the `top` position.
|
|
282
|
+
2. Enable dragging when the scroller is scrolled all the way to the bottom - it is at the `bottom` position.
|
|
283
|
+
3. Enable dragging in `both` positions.
|
|
284
|
+
|
|
285
|
+
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.
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
```jsx
|
|
290
|
+
function ScrollableExample() {
|
|
291
|
+
return (
|
|
292
|
+
<Sheet>
|
|
293
|
+
<Sheet.Container>
|
|
294
|
+
<Sheet.Header />
|
|
295
|
+
<Sheet.Content>
|
|
296
|
+
<Sheet.Scroller>{/*...*/}</Sheet.Scroller>
|
|
297
|
+
</Sheet.Content>
|
|
298
|
+
</Sheet.Container>
|
|
299
|
+
<Sheet.Backdrop />
|
|
300
|
+
</Sheet>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
271
305
|
### iOS Modal View effect
|
|
272
306
|
|
|
273
307
|
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 +336,8 @@ function Example() {
|
|
|
302
336
|
<Sheet.Header>
|
|
303
337
|
<YourCustomSheetHeader />
|
|
304
338
|
</Sheet.Header>
|
|
305
|
-
|
|
306
339
|
<Sheet.Content>{/*...*/}</Sheet.Content>
|
|
307
340
|
</Sheet.Container>
|
|
308
|
-
|
|
309
341
|
<Sheet.Backdrop />
|
|
310
342
|
</Sheet>
|
|
311
343
|
);
|
|
@@ -369,12 +401,11 @@ function Example() {
|
|
|
369
401
|
<button onClick={() => setOpen(true)}>Open sheet</button>
|
|
370
402
|
|
|
371
403
|
<CustomSheet isOpen={isOpen} onClose={() => setOpen(false)}>
|
|
372
|
-
<
|
|
373
|
-
<
|
|
374
|
-
<
|
|
375
|
-
</
|
|
376
|
-
|
|
377
|
-
<CustomSheet.Backdrop />
|
|
404
|
+
<Sheet.Container>
|
|
405
|
+
<Sheet.Header />
|
|
406
|
+
<Sheet.Content>{/*...*/}</Sheet.Content>
|
|
407
|
+
</Sheet.Container>
|
|
408
|
+
<Sheet.Backdrop />
|
|
378
409
|
</CustomSheet>
|
|
379
410
|
</>
|
|
380
411
|
);
|
package/dist/SheetBackdrop.d.ts
CHANGED
|
@@ -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;
|
package/dist/SheetContainer.d.ts
CHANGED
|
@@ -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;
|
package/dist/SheetContent.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/SheetHeader.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
5
|
-
export declare
|
|
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;
|