@lodev09/react-native-true-sheet 4.0.0-beta.0 → 4.0.0-beta.10

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.
Files changed (430) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +62 -30
  3. package/RNTrueSheet.podspec +10 -2
  4. package/android/build.gradle +24 -2
  5. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +189 -47
  6. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerViewManager.kt +7 -0
  7. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +401 -19
  8. package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +18 -0
  9. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +145 -21
  10. package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterViewManager.kt +14 -0
  11. package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderView.kt +38 -0
  12. package/android/src/main/java/com/lodev09/truesheet/TrueSheetHeaderViewManager.kt +28 -0
  13. package/android/src/main/java/com/lodev09/truesheet/TrueSheetModule.kt +84 -24
  14. package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +106 -0
  15. package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
  16. package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +6 -4
  17. package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekView.kt +72 -0
  18. package/android/src/main/java/com/lodev09/truesheet/TrueSheetPeekViewManager.kt +33 -0
  19. package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +63 -0
  20. package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +564 -226
  21. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +1399 -598
  22. package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +161 -29
  23. package/android/src/main/java/com/lodev09/truesheet/core/RNScreensEventObserver.kt +63 -0
  24. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetBehavior.kt +36 -0
  25. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +255 -0
  26. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +375 -0
  27. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +299 -0
  28. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +162 -0
  29. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetGrabberView.kt +180 -0
  30. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetKeyboardObserver.kt +207 -0
  31. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
  32. package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetStackManager.kt +220 -0
  33. package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetDragEvents.kt +71 -0
  34. package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetFocusEvents.kt +65 -0
  35. package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +127 -0
  36. package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetStateEvents.kt +56 -0
  37. package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +84 -0
  38. package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +93 -67
  39. package/android/src/main/java/com/lodev09/truesheet/utils/TouchEventDeduper.kt +31 -0
  40. package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +42 -0
  41. package/android/src/main/jni/CMakeLists.txt +63 -0
  42. package/android/src/main/jni/TrueSheetSpec.h +20 -0
  43. package/android/src/main/jni/TrueSheetStateUpdater.cpp +96 -0
  44. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +16 -0
  45. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +68 -0
  46. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +33 -0
  47. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +11 -0
  48. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +39 -0
  49. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +24 -0
  50. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +63 -0
  51. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +28 -0
  52. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +11 -0
  53. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +41 -0
  54. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +18 -0
  55. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +16 -0
  56. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +46 -0
  57. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
  58. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
  59. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +36 -0
  60. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +28 -0
  61. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +30 -0
  62. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +45 -0
  63. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +23 -0
  64. package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +52 -0
  65. package/ios/TrueSheetContainerView.h +88 -6
  66. package/ios/TrueSheetContainerView.mm +278 -21
  67. package/ios/TrueSheetContentView.h +54 -1
  68. package/ios/TrueSheetContentView.mm +371 -47
  69. package/ios/TrueSheetFooterView.h +33 -2
  70. package/ios/TrueSheetFooterView.mm +187 -35
  71. package/ios/{events/OnWillDismissEvent.h → TrueSheetHeaderView.h} +10 -7
  72. package/ios/TrueSheetHeaderView.mm +64 -0
  73. package/ios/TrueSheetModule.h +2 -7
  74. package/ios/TrueSheetModule.mm +98 -20
  75. package/ios/TrueSheetOverlayView.h +32 -0
  76. package/ios/TrueSheetOverlayView.mm +161 -0
  77. package/ios/TrueSheetPeekView.h +32 -0
  78. package/ios/TrueSheetPeekView.mm +99 -0
  79. package/ios/TrueSheetView.h +7 -15
  80. package/ios/TrueSheetView.mm +775 -215
  81. package/ios/TrueSheetViewController.h +94 -16
  82. package/ios/TrueSheetViewController.mm +1316 -331
  83. package/ios/core/RNScreensEventObserver.h +46 -0
  84. package/ios/core/RNScreensEventObserver.mm +280 -0
  85. package/ios/core/TrueSheetBlurView.h +27 -0
  86. package/ios/core/TrueSheetBlurView.mm +82 -0
  87. package/ios/core/TrueSheetDetentCalculator.h +107 -0
  88. package/ios/core/TrueSheetDetentCalculator.mm +197 -0
  89. package/ios/core/TrueSheetGrabberView.h +72 -0
  90. package/ios/core/TrueSheetGrabberView.mm +188 -0
  91. package/ios/core/TrueSheetKeyboardObserver.h +39 -0
  92. package/ios/core/TrueSheetKeyboardObserver.mm +112 -0
  93. package/ios/core/TrueSheetOverlayContainerView.h +31 -0
  94. package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
  95. package/ios/events/TrueSheetDragEvents.h +39 -0
  96. package/ios/events/TrueSheetDragEvents.mm +62 -0
  97. package/ios/events/{OnPositionChangeEvent.h → TrueSheetFocusEvents.h} +8 -5
  98. package/ios/events/TrueSheetFocusEvents.mm +49 -0
  99. package/ios/events/TrueSheetLifecycleEvents.h +42 -0
  100. package/ios/events/TrueSheetLifecycleEvents.mm +79 -0
  101. package/ios/events/TrueSheetStateEvents.h +35 -0
  102. package/ios/events/TrueSheetStateEvents.mm +49 -0
  103. package/ios/tvos/TrueSheetStubs.mm +166 -0
  104. package/ios/{events/OnMountEvent.h → utils/BlurUtil.h} +5 -7
  105. package/ios/utils/BlurUtil.mm +69 -0
  106. package/ios/utils/GestureUtil.h +7 -0
  107. package/ios/utils/GestureUtil.mm +12 -0
  108. package/ios/utils/PlatformUtil.h +15 -0
  109. package/ios/utils/UIView+FirstResponder.h +15 -0
  110. package/ios/utils/UIView+FirstResponder.mm +26 -0
  111. package/ios/utils/UIView+ScrollEdgeInteraction.h +26 -0
  112. package/ios/utils/UIView+ScrollEdgeInteraction.mm +84 -0
  113. package/ios/utils/WindowUtil.mm +17 -1
  114. package/lib/module/TrueSheet.js +349 -74
  115. package/lib/module/TrueSheet.js.map +1 -1
  116. package/lib/module/TrueSheet.web.js +1270 -0
  117. package/lib/module/TrueSheet.web.js.map +1 -0
  118. package/lib/module/TrueSheetOverlay.js +30 -0
  119. package/lib/module/TrueSheetOverlay.js.map +1 -0
  120. package/lib/module/TrueSheetOverlay.web.js +35 -0
  121. package/lib/module/TrueSheetOverlay.web.js.map +1 -0
  122. package/lib/module/TrueSheetPeek.js +15 -0
  123. package/lib/module/TrueSheetPeek.js.map +1 -0
  124. package/lib/module/TrueSheetPeek.web.js +55 -0
  125. package/lib/module/TrueSheetPeek.web.js.map +1 -0
  126. package/lib/module/TrueSheetProvider.js +28 -0
  127. package/lib/module/TrueSheetProvider.js.map +1 -0
  128. package/lib/module/TrueSheetProvider.web.js +157 -0
  129. package/lib/module/TrueSheetProvider.web.js.map +1 -0
  130. package/lib/module/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
  131. package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
  132. package/lib/module/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
  133. package/lib/module/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
  134. package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
  135. package/lib/module/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
  136. package/lib/module/fabric/TrueSheetViewNativeComponent.ts +110 -18
  137. package/lib/module/index.js +4 -3
  138. package/lib/module/index.js.map +1 -1
  139. package/lib/module/mocks/index.js +103 -0
  140. package/lib/module/mocks/index.js.map +1 -0
  141. package/lib/module/mocks/navigation.js +95 -0
  142. package/lib/module/mocks/navigation.js.map +1 -0
  143. package/lib/module/mocks/navigationExpoRouter.js +21 -0
  144. package/lib/module/mocks/navigationExpoRouter.js.map +1 -0
  145. package/lib/module/mocks/reanimated.js +91 -0
  146. package/lib/module/mocks/reanimated.js.map +1 -0
  147. package/lib/module/navigation/TrueSheetNavigatorContent.js +73 -0
  148. package/lib/module/navigation/TrueSheetNavigatorContent.js.map +1 -0
  149. package/lib/module/navigation/actions.js +50 -0
  150. package/lib/module/navigation/actions.js.map +1 -0
  151. package/lib/module/navigation/base-types.js +2 -0
  152. package/lib/module/navigation/base-types.js.map +1 -0
  153. package/lib/module/navigation/createTrueSheetRouter.js +157 -0
  154. package/lib/module/navigation/createTrueSheetRouter.js.map +1 -0
  155. package/lib/module/navigation/expo-router/base-types.js +2 -0
  156. package/lib/module/navigation/expo-router/base-types.js.map +1 -0
  157. package/lib/module/navigation/expo-router/index.js +50 -0
  158. package/lib/module/navigation/expo-router/index.js.map +1 -0
  159. package/lib/module/navigation/expo-router/types.js +4 -0
  160. package/lib/module/navigation/expo-router/types.js.map +1 -0
  161. package/lib/module/navigation/index.js +47 -0
  162. package/lib/module/navigation/index.js.map +1 -0
  163. package/lib/module/navigation/navigator.js +10 -0
  164. package/lib/module/navigation/navigator.js.map +1 -0
  165. package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js +56 -0
  166. package/lib/module/navigation/screen/ReanimatedTrueSheetScreen.js.map +1 -0
  167. package/lib/module/navigation/screen/TrueSheetScreen.js +49 -0
  168. package/lib/module/navigation/screen/TrueSheetScreen.js.map +1 -0
  169. package/lib/module/navigation/screen/index.js +5 -0
  170. package/lib/module/navigation/screen/index.js.map +1 -0
  171. package/lib/module/navigation/screen/types.js +4 -0
  172. package/lib/module/navigation/screen/types.js.map +1 -0
  173. package/lib/module/navigation/screen/useSheetScreenState.js +69 -0
  174. package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -0
  175. package/lib/module/navigation/types.js +4 -0
  176. package/lib/module/navigation/types.js.map +1 -0
  177. package/lib/module/navigation/useTrueSheetNavigation.js +24 -0
  178. package/lib/module/navigation/useTrueSheetNavigation.js.map +1 -0
  179. package/lib/module/reanimated/ReanimatedTrueSheet.js +15 -9
  180. package/lib/module/reanimated/ReanimatedTrueSheet.js.map +1 -1
  181. package/lib/module/reanimated/ReanimatedTrueSheet.web.js +81 -0
  182. package/lib/module/reanimated/ReanimatedTrueSheet.web.js.map +1 -0
  183. package/lib/module/reanimated/ReanimatedTrueSheetProvider.js +4 -2
  184. package/lib/module/reanimated/ReanimatedTrueSheetProvider.js.map +1 -1
  185. package/lib/module/reanimated/index.js +2 -2
  186. package/lib/module/reanimated/index.js.map +1 -1
  187. package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js +20 -0
  188. package/lib/module/reanimated/useReanimatedPositionChangeHandler.web.js.map +1 -0
  189. package/lib/module/specs/NativeTrueSheetModule.js.map +1 -1
  190. package/lib/module/web/constants.js +16 -0
  191. package/lib/module/web/constants.js.map +1 -0
  192. package/lib/module/web/dom.js +10 -0
  193. package/lib/module/web/dom.js.map +1 -0
  194. package/lib/module/web/vaul/README.md +9 -0
  195. package/lib/module/web/vaul/browser.js +30 -0
  196. package/lib/module/web/vaul/browser.js.map +1 -0
  197. package/lib/module/web/vaul/constants.js +19 -0
  198. package/lib/module/web/vaul/constants.js.map +1 -0
  199. package/lib/module/web/vaul/context.js +59 -0
  200. package/lib/module/web/vaul/context.js.map +1 -0
  201. package/lib/module/web/vaul/helpers.js +99 -0
  202. package/lib/module/web/vaul/helpers.js.map +1 -0
  203. package/lib/module/web/vaul/index.js +1342 -0
  204. package/lib/module/web/vaul/index.js.map +1 -0
  205. package/lib/module/web/vaul/style.css +287 -0
  206. package/lib/module/web/vaul/style.css.d.js +2 -0
  207. package/lib/module/web/vaul/style.css.d.js.map +1 -0
  208. package/lib/module/web/vaul/types.js +2 -0
  209. package/lib/module/web/vaul/types.js.map +1 -0
  210. package/lib/module/web/vaul/use-composed-refs.js +34 -0
  211. package/lib/module/web/vaul/use-composed-refs.js.map +1 -0
  212. package/lib/module/web/vaul/use-controllable-state.js +54 -0
  213. package/lib/module/web/vaul/use-controllable-state.js.map +1 -0
  214. package/lib/module/web/vaul/use-position-fixed.js +123 -0
  215. package/lib/module/web/vaul/use-position-fixed.js.map +1 -0
  216. package/lib/module/web/vaul/use-prevent-scroll.js +258 -0
  217. package/lib/module/web/vaul/use-prevent-scroll.js.map +1 -0
  218. package/lib/module/web/vaul/use-scale-background.js +57 -0
  219. package/lib/module/web/vaul/use-scale-background.js.map +1 -0
  220. package/lib/module/web/vaul/use-snap-points.js +305 -0
  221. package/lib/module/web/vaul/use-snap-points.js.map +1 -0
  222. package/lib/typescript/src/TrueSheet.d.ts +57 -14
  223. package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
  224. package/lib/typescript/src/TrueSheet.types.d.ts +535 -55
  225. package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
  226. package/lib/typescript/src/TrueSheet.web.d.ts +5 -0
  227. package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -0
  228. package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
  229. package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
  230. package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
  231. package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
  232. package/lib/typescript/src/TrueSheetPeek.d.ts +9 -0
  233. package/lib/typescript/src/TrueSheetPeek.d.ts.map +1 -0
  234. package/lib/typescript/src/TrueSheetPeek.web.d.ts +28 -0
  235. package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -0
  236. package/lib/typescript/src/TrueSheetProvider.d.ts +18 -0
  237. package/lib/typescript/src/TrueSheetProvider.d.ts.map +1 -0
  238. package/lib/typescript/src/TrueSheetProvider.web.d.ts +27 -0
  239. package/lib/typescript/src/TrueSheetProvider.web.d.ts.map +1 -0
  240. package/lib/typescript/src/fabric/TrueSheetContainerViewNativeComponent.d.ts.map +1 -1
  241. package/lib/typescript/src/fabric/TrueSheetContentViewNativeComponent.d.ts.map +1 -1
  242. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts +2 -0
  243. package/lib/typescript/src/fabric/TrueSheetFooterViewNativeComponent.d.ts.map +1 -1
  244. package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts +6 -0
  245. package/lib/typescript/src/fabric/TrueSheetHeaderViewNativeComponent.d.ts.map +1 -0
  246. package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
  247. package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
  248. package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts +6 -0
  249. package/lib/typescript/src/fabric/TrueSheetPeekViewNativeComponent.d.ts.map +1 -0
  250. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +71 -16
  251. package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
  252. package/lib/typescript/src/index.d.ts +3 -2
  253. package/lib/typescript/src/index.d.ts.map +1 -1
  254. package/lib/typescript/src/mocks/index.d.ts +47 -0
  255. package/lib/typescript/src/mocks/index.d.ts.map +1 -0
  256. package/lib/typescript/src/mocks/navigation.d.ts +70 -0
  257. package/lib/typescript/src/mocks/navigation.d.ts.map +1 -0
  258. package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +22 -0
  259. package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -0
  260. package/lib/typescript/src/mocks/reanimated.d.ts +48 -0
  261. package/lib/typescript/src/mocks/reanimated.d.ts.map +1 -0
  262. package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts +5 -0
  263. package/lib/typescript/src/navigation/TrueSheetNavigatorContent.d.ts.map +1 -0
  264. package/lib/typescript/src/navigation/actions.d.ts +71 -0
  265. package/lib/typescript/src/navigation/actions.d.ts.map +1 -0
  266. package/lib/typescript/src/navigation/base-types.d.ts +9 -0
  267. package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
  268. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +3 -0
  269. package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -0
  270. package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
  271. package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
  272. package/lib/typescript/src/navigation/expo-router/index.d.ts +37 -0
  273. package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -0
  274. package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
  275. package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
  276. package/lib/typescript/src/navigation/index.d.ts +45 -0
  277. package/lib/typescript/src/navigation/index.d.ts.map +1 -0
  278. package/lib/typescript/src/navigation/navigator.d.ts +7 -0
  279. package/lib/typescript/src/navigation/navigator.d.ts.map +1 -0
  280. package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts +3 -0
  281. package/lib/typescript/src/navigation/screen/ReanimatedTrueSheetScreen.d.ts.map +1 -0
  282. package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts +3 -0
  283. package/lib/typescript/src/navigation/screen/TrueSheetScreen.d.ts.map +1 -0
  284. package/lib/typescript/src/navigation/screen/index.d.ts +4 -0
  285. package/lib/typescript/src/navigation/screen/index.d.ts.map +1 -0
  286. package/lib/typescript/src/navigation/screen/types.d.ts +14 -0
  287. package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -0
  288. package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +34 -0
  289. package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -0
  290. package/lib/typescript/src/navigation/types.d.ts +213 -0
  291. package/lib/typescript/src/navigation/types.d.ts.map +1 -0
  292. package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +23 -0
  293. package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts.map +1 -0
  294. package/lib/typescript/src/reanimated/ReanimatedTrueSheet.d.ts.map +1 -1
  295. package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts +41 -0
  296. package/lib/typescript/src/reanimated/ReanimatedTrueSheet.web.d.ts.map +1 -0
  297. package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts +8 -2
  298. package/lib/typescript/src/reanimated/ReanimatedTrueSheetProvider.d.ts.map +1 -1
  299. package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts +15 -0
  300. package/lib/typescript/src/reanimated/useReanimatedPositionChangeHandler.web.d.ts.map +1 -0
  301. package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts +25 -3
  302. package/lib/typescript/src/specs/NativeTrueSheetModule.d.ts.map +1 -1
  303. package/lib/typescript/src/web/constants.d.ts +14 -0
  304. package/lib/typescript/src/web/constants.d.ts.map +1 -0
  305. package/lib/typescript/src/web/dom.d.ts +7 -0
  306. package/lib/typescript/src/web/dom.d.ts.map +1 -0
  307. package/lib/typescript/src/web/vaul/browser.d.ts +8 -0
  308. package/lib/typescript/src/web/vaul/browser.d.ts.map +1 -0
  309. package/lib/typescript/src/web/vaul/constants.d.ts +14 -0
  310. package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -0
  311. package/lib/typescript/src/web/vaul/context.d.ts +54 -0
  312. package/lib/typescript/src/web/vaul/context.d.ts.map +1 -0
  313. package/lib/typescript/src/web/vaul/helpers.d.ts +17 -0
  314. package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -0
  315. package/lib/typescript/src/web/vaul/index.d.ts +234 -0
  316. package/lib/typescript/src/web/vaul/index.d.ts.map +1 -0
  317. package/lib/typescript/src/web/vaul/types.d.ts +7 -0
  318. package/lib/typescript/src/web/vaul/types.d.ts.map +1 -0
  319. package/lib/typescript/src/web/vaul/use-composed-refs.d.ts +14 -0
  320. package/lib/typescript/src/web/vaul/use-composed-refs.d.ts.map +1 -0
  321. package/lib/typescript/src/web/vaul/use-controllable-state.d.ts +9 -0
  322. package/lib/typescript/src/web/vaul/use-controllable-state.d.ts.map +1 -0
  323. package/lib/typescript/src/web/vaul/use-position-fixed.d.ts +19 -0
  324. package/lib/typescript/src/web/vaul/use-position-fixed.d.ts.map +1 -0
  325. package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts +18 -0
  326. package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts.map +1 -0
  327. package/lib/typescript/src/web/vaul/use-scale-background.d.ts +2 -0
  328. package/lib/typescript/src/web/vaul/use-scale-background.d.ts.map +1 -0
  329. package/lib/typescript/src/web/vaul/use-snap-points.d.ts +38 -0
  330. package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -0
  331. package/package.json +104 -37
  332. package/react-native.config.js +10 -2
  333. package/src/TrueSheet.tsx +424 -70
  334. package/src/TrueSheet.types.ts +602 -72
  335. package/src/TrueSheet.web.tsx +1437 -0
  336. package/src/TrueSheetOverlay.tsx +24 -0
  337. package/src/TrueSheetOverlay.web.tsx +33 -0
  338. package/src/TrueSheetPeek.tsx +11 -0
  339. package/src/TrueSheetPeek.web.tsx +64 -0
  340. package/src/TrueSheetProvider.tsx +33 -0
  341. package/src/TrueSheetProvider.web.tsx +220 -0
  342. package/src/fabric/TrueSheetContainerViewNativeComponent.ts +1 -1
  343. package/src/fabric/TrueSheetContentViewNativeComponent.ts +5 -1
  344. package/src/fabric/TrueSheetFooterViewNativeComponent.ts +10 -2
  345. package/src/fabric/TrueSheetHeaderViewNativeComponent.ts +8 -0
  346. package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
  347. package/src/fabric/TrueSheetPeekViewNativeComponent.ts +8 -0
  348. package/src/fabric/TrueSheetViewNativeComponent.ts +110 -18
  349. package/src/index.ts +3 -2
  350. package/src/mocks/index.ts +96 -0
  351. package/src/mocks/navigation.ts +79 -0
  352. package/src/mocks/navigationExpoRouter.ts +41 -0
  353. package/src/mocks/reanimated.ts +100 -0
  354. package/src/navigation/TrueSheetNavigatorContent.tsx +106 -0
  355. package/src/navigation/actions.ts +78 -0
  356. package/src/navigation/base-types.ts +20 -0
  357. package/src/navigation/createTrueSheetRouter.ts +194 -0
  358. package/src/navigation/expo-router/base-types.ts +18 -0
  359. package/src/navigation/expo-router/index.ts +90 -0
  360. package/src/navigation/expo-router/types.ts +116 -0
  361. package/src/navigation/index.ts +80 -0
  362. package/src/navigation/navigator.ts +18 -0
  363. package/src/navigation/screen/ReanimatedTrueSheetScreen.tsx +61 -0
  364. package/src/navigation/screen/TrueSheetScreen.tsx +54 -0
  365. package/src/navigation/screen/index.ts +3 -0
  366. package/src/navigation/screen/types.ts +19 -0
  367. package/src/navigation/screen/useSheetScreenState.ts +102 -0
  368. package/src/navigation/types.ts +302 -0
  369. package/src/navigation/useTrueSheetNavigation.ts +26 -0
  370. package/src/reanimated/ReanimatedTrueSheet.tsx +12 -7
  371. package/src/reanimated/ReanimatedTrueSheet.web.tsx +75 -0
  372. package/src/reanimated/ReanimatedTrueSheetProvider.tsx +12 -8
  373. package/src/reanimated/useReanimatedPositionChangeHandler.web.ts +31 -0
  374. package/src/specs/NativeTrueSheetModule.ts +28 -3
  375. package/src/web/constants.ts +13 -0
  376. package/src/web/dom.ts +9 -0
  377. package/src/web/vaul/README.md +9 -0
  378. package/src/web/vaul/browser.ts +38 -0
  379. package/src/web/vaul/constants.ts +24 -0
  380. package/src/web/vaul/context.ts +102 -0
  381. package/src/web/vaul/helpers.ts +131 -0
  382. package/src/web/vaul/index.tsx +1785 -0
  383. package/src/web/vaul/style.css +287 -0
  384. package/src/web/vaul/style.css.d.ts +1 -0
  385. package/src/web/vaul/types.ts +7 -0
  386. package/src/web/vaul/use-composed-refs.ts +35 -0
  387. package/src/web/vaul/use-controllable-state.ts +66 -0
  388. package/src/web/vaul/use-position-fixed.ts +147 -0
  389. package/src/web/vaul/use-prevent-scroll.ts +309 -0
  390. package/src/web/vaul/use-scale-background.ts +64 -0
  391. package/src/web/vaul/use-snap-points.ts +455 -0
  392. package/android/src/main/java/com/lodev09/truesheet/events/DetentChangeEvent.kt +0 -26
  393. package/android/src/main/java/com/lodev09/truesheet/events/DidDismissEvent.kt +0 -20
  394. package/android/src/main/java/com/lodev09/truesheet/events/DidPresentEvent.kt +0 -26
  395. package/android/src/main/java/com/lodev09/truesheet/events/DragBeginEvent.kt +0 -26
  396. package/android/src/main/java/com/lodev09/truesheet/events/DragChangeEvent.kt +0 -26
  397. package/android/src/main/java/com/lodev09/truesheet/events/DragEndEvent.kt +0 -26
  398. package/android/src/main/java/com/lodev09/truesheet/events/MountEvent.kt +0 -20
  399. package/android/src/main/java/com/lodev09/truesheet/events/PositionChangeEvent.kt +0 -32
  400. package/android/src/main/java/com/lodev09/truesheet/events/SizeChangeEvent.kt +0 -27
  401. package/android/src/main/java/com/lodev09/truesheet/events/WillDismissEvent.kt +0 -20
  402. package/android/src/main/java/com/lodev09/truesheet/events/WillPresentEvent.kt +0 -26
  403. package/android/src/main/res/values/styles.xml +0 -8
  404. package/ios/events/OnDetentChangeEvent.h +0 -28
  405. package/ios/events/OnDetentChangeEvent.mm +0 -30
  406. package/ios/events/OnDidDismissEvent.h +0 -26
  407. package/ios/events/OnDidDismissEvent.mm +0 -25
  408. package/ios/events/OnDidPresentEvent.h +0 -28
  409. package/ios/events/OnDidPresentEvent.mm +0 -30
  410. package/ios/events/OnDragBeginEvent.h +0 -28
  411. package/ios/events/OnDragBeginEvent.mm +0 -30
  412. package/ios/events/OnDragChangeEvent.h +0 -28
  413. package/ios/events/OnDragChangeEvent.mm +0 -30
  414. package/ios/events/OnDragEndEvent.h +0 -28
  415. package/ios/events/OnDragEndEvent.mm +0 -30
  416. package/ios/events/OnMountEvent.mm +0 -25
  417. package/ios/events/OnPositionChangeEvent.mm +0 -32
  418. package/ios/events/OnSizeChangeEvent.h +0 -28
  419. package/ios/events/OnSizeChangeEvent.mm +0 -30
  420. package/ios/events/OnWillDismissEvent.mm +0 -25
  421. package/ios/events/OnWillPresentEvent.h +0 -28
  422. package/ios/events/OnWillPresentEvent.mm +0 -30
  423. package/ios/utils/LayoutUtil.h +0 -44
  424. package/ios/utils/LayoutUtil.mm +0 -50
  425. package/lib/module/TrueSheetGrabber.js +0 -51
  426. package/lib/module/TrueSheetGrabber.js.map +0 -1
  427. package/lib/typescript/src/TrueSheetGrabber.d.ts +0 -39
  428. package/lib/typescript/src/TrueSheetGrabber.d.ts.map +0 -1
  429. package/src/TrueSheetGrabber.tsx +0 -82
  430. package/src/__mocks__/index.js +0 -67
@@ -0,0 +1,1342 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ import React from 'react';
5
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
6
+ import { Presence } from '@radix-ui/react-presence';
7
+ import { DrawerContext, useDrawerContext } from "./context.js";
8
+ import './style.css';
9
+ import { isIOS, isMobileFirefox } from "./browser.js";
10
+ import { BORDER_RADIUS, CLOSE_THRESHOLD, DISMISS_ATTEMPT_THRESHOLD, DRAG_CLASS, NESTED_DISPLACEMENT, SCROLL_LOCK_TIMEOUT, TRANSITIONS, VELOCITY_THRESHOLD, WINDOW_TOP_OFFSET } from "./constants.js";
11
+ import { dampenValue, getTranslate, isVertical, reset, set } from "./helpers.js";
12
+ import { useComposedRefs } from "./use-composed-refs.js";
13
+ import { useControllableState } from "./use-controllable-state.js";
14
+ import { usePositionFixed } from "./use-position-fixed.js";
15
+ import { isInput, isScrollable, usePreventScroll } from "./use-prevent-scroll.js";
16
+ import { useScaleBackground } from "./use-scale-background.js";
17
+ import { useSnapPoints } from "./use-snap-points.js";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ export function Root({
20
+ open: openProp,
21
+ onOpenChange,
22
+ children,
23
+ onDrag: onDragProp,
24
+ onRelease: onReleaseProp,
25
+ snapPoints,
26
+ shouldScaleBackground = false,
27
+ setBackgroundColorOnScale = true,
28
+ closeThreshold = CLOSE_THRESHOLD,
29
+ scrollLockTimeout = SCROLL_LOCK_TIMEOUT,
30
+ dismissible = true,
31
+ onDismissAttempt,
32
+ draggable = true,
33
+ handleOnly = false,
34
+ fadeFromIndex = snapPoints && snapPoints.length - 1,
35
+ activeSnapPoint: activeSnapPointProp,
36
+ setActiveSnapPoint: setActiveSnapPointProp,
37
+ fixed,
38
+ modal = true,
39
+ onClose,
40
+ nested,
41
+ noBodyStyles = false,
42
+ direction = 'bottom',
43
+ defaultOpen = false,
44
+ disablePreventScroll = true,
45
+ snapToSequentialPoint = false,
46
+ preventScrollRestoration = false,
47
+ repositionInputs = true,
48
+ onAnimationEnd,
49
+ onPositionChange,
50
+ container,
51
+ autoFocus = false,
52
+ detached = false,
53
+ detachedOffset = 0,
54
+ detachedRadius = 0,
55
+ detachedWrapperStyle,
56
+ maxContentHeight,
57
+ peekHeight,
58
+ initialAnimated = true,
59
+ onContentHeightChange,
60
+ contentHeight: contentHeightProp
61
+ }) {
62
+ const [isOpen = false, setIsOpen] = useControllableState({
63
+ defaultProp: defaultOpen,
64
+ prop: openProp,
65
+ onChange: o => {
66
+ onOpenChange?.(o);
67
+ if (!o && !nested) {
68
+ restorePositionSetting();
69
+ }
70
+ setTimeout(() => {
71
+ onAnimationEnd?.(o);
72
+ }, TRANSITIONS.DURATION * 1000);
73
+ }
74
+ });
75
+ const [hasBeenOpened, setHasBeenOpened] = React.useState(false);
76
+ const [isDragging, setIsDragging] = React.useState(false);
77
+ const [justReleased, setJustReleased] = React.useState(false);
78
+ const overlayRef = React.useRef(null);
79
+ const openTime = React.useRef(null);
80
+ const dragStartTime = React.useRef(null);
81
+ const dragEndTime = React.useRef(null);
82
+ const lastTimeDragPrevented = React.useRef(null);
83
+ const isAllowedToDrag = React.useRef(false);
84
+ const nestedOpenChangeTimer = React.useRef(null);
85
+ const pointerStart = React.useRef(0);
86
+ const dismissAttempted = React.useRef(false);
87
+ const keyboardIsOpen = React.useRef(false);
88
+ const shouldAnimate = React.useRef(!defaultOpen);
89
+ const previousDiffFromInitial = React.useRef(0);
90
+ const drawerRef = React.useRef(null);
91
+ const drawerHeightRef = React.useRef(drawerRef.current?.getBoundingClientRect().height || 0);
92
+ const drawerWidthRef = React.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
93
+ const initialDrawerHeight = React.useRef(0);
94
+ const [measuredContentHeight, setContentHeight] = React.useState(0);
95
+ const contentHeight = contentHeightProp ?? measuredContentHeight;
96
+ const onContentHeightChangeRef = React.useRef(onContentHeightChange);
97
+ React.useEffect(() => {
98
+ onContentHeightChangeRef.current = onContentHeightChange;
99
+ });
100
+ React.useEffect(() => {
101
+ onContentHeightChangeRef.current?.(measuredContentHeight);
102
+ }, [measuredContentHeight]);
103
+ const onSnapPointChange = React.useCallback(activeSnapPointIndex => {
104
+ // Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
105
+ if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
106
+ }, []);
107
+ const {
108
+ activeSnapPoint,
109
+ activeSnapPointIndex,
110
+ setActiveSnapPoint,
111
+ onRelease: onReleaseSnapPoints,
112
+ snapPointsOffset,
113
+ onDrag: onDragSnapPoints,
114
+ shouldFade,
115
+ getPercentageDragged: getSnapPointsPercentageDragged
116
+ } = useSnapPoints({
117
+ snapPoints,
118
+ activeSnapPointProp,
119
+ setActiveSnapPointProp,
120
+ drawerRef,
121
+ fadeFromIndex,
122
+ overlayRef,
123
+ onSnapPointChange,
124
+ direction,
125
+ container,
126
+ snapToSequentialPoint,
127
+ isOpen,
128
+ contentHeight,
129
+ detachedOffset: detached ? detachedOffset : 0,
130
+ maxContentHeight,
131
+ peekHeight,
132
+ initialAnimated
133
+ });
134
+ usePreventScroll({
135
+ isDisabled: !isOpen || isDragging || !modal || justReleased || !hasBeenOpened || !repositionInputs || !disablePreventScroll
136
+ });
137
+ const {
138
+ restorePositionSetting
139
+ } = usePositionFixed({
140
+ isOpen,
141
+ modal,
142
+ nested: nested ?? false,
143
+ hasBeenOpened,
144
+ preventScrollRestoration,
145
+ noBodyStyles
146
+ });
147
+
148
+ // While the sheet itself is being dragged, scrollables in the touched chain
149
+ // are frozen (overflow: hidden). Touch browsers latch the scroll gesture at
150
+ // touchstart and ignore preventDefault once scrolling has started, so making
151
+ // the scroller non-scrollable mid-gesture is the only reliable way to keep
152
+ // the content from panning along with the sheet.
153
+ const frozenScrollablesRef = React.useRef(null);
154
+ function freezeScrollables(target) {
155
+ if (frozenScrollablesRef.current) return;
156
+ const frozen = [];
157
+ let element = target instanceof HTMLElement ? target : null;
158
+ while (element && element !== drawerRef.current) {
159
+ if (isScrollable(element)) {
160
+ frozen.push({
161
+ element,
162
+ overflowX: element.style.overflowX,
163
+ overflowY: element.style.overflowY
164
+ });
165
+ element.style.overflowX = 'hidden';
166
+ element.style.overflowY = 'hidden';
167
+ }
168
+ element = element.parentElement;
169
+ }
170
+ frozenScrollablesRef.current = frozen;
171
+ }
172
+ function unfreezeScrollables() {
173
+ const frozen = frozenScrollablesRef.current;
174
+ if (!frozen) return;
175
+ frozenScrollablesRef.current = null;
176
+ for (const {
177
+ element,
178
+ overflowX,
179
+ overflowY
180
+ } of frozen) {
181
+ element.style.overflowX = overflowX;
182
+ element.style.overflowY = overflowY;
183
+ }
184
+ }
185
+ function getScale() {
186
+ return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
187
+ }
188
+ function onPress(event) {
189
+ if (!draggable) return;
190
+ if (!dismissible && !snapPoints) return;
191
+ if (drawerRef.current && !drawerRef.current.contains(event.target)) return;
192
+ drawerHeightRef.current = drawerRef.current?.getBoundingClientRect().height || 0;
193
+ drawerWidthRef.current = drawerRef.current?.getBoundingClientRect().width || 0;
194
+ setIsDragging(true);
195
+ dragStartTime.current = new Date();
196
+
197
+ // iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging
198
+ if (isIOS()) {
199
+ window.addEventListener('touchend', () => isAllowedToDrag.current = false, {
200
+ once: true
201
+ });
202
+ }
203
+ // Ensure we maintain correct pointer capture even when going outside of the drawer
204
+ event.target.setPointerCapture(event.pointerId);
205
+ pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
206
+ }
207
+ function shouldDrag(el, isDraggingInDirection) {
208
+ let element = el;
209
+ const highlightedText = window.getSelection()?.toString();
210
+ const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;
211
+ const date = new Date();
212
+
213
+ // Fixes https://github.com/emilkowalski/vaul/issues/483
214
+ if (element.tagName === 'SELECT') {
215
+ return false;
216
+ }
217
+ if (element.hasAttribute('data-vaul-no-drag') || element.closest('[data-vaul-no-drag]')) {
218
+ return false;
219
+ }
220
+ if (direction === 'right' || direction === 'left') {
221
+ return true;
222
+ }
223
+
224
+ // Allow scrolling when animating
225
+ if (openTime.current && date.getTime() - openTime.current.getTime() < 500) {
226
+ return false;
227
+ }
228
+ if (swipeAmount !== null) {
229
+ // Translated past the drag threshold → keep dragging. Below the last
230
+ // snap point the threshold is 0, so the sheet always wins over content
231
+ // scrolling. At the last snap point the threshold is its resting
232
+ // translate — which can still be > 0 when the max detent < 1 — so an
233
+ // at-rest sheet falls through to the scroll checks and content
234
+ // scrolling wins, matching native. Mid-drag/mid-animation the sheet is
235
+ // displaced past rest and still wins.
236
+ const atLastSnapPoint = snapPoints && activeSnapPointIndex === snapPoints.length - 1;
237
+ const restOffset = atLastSnapPoint ? snapPointsOffset?.[activeSnapPointIndex] ?? 0 : 0;
238
+ if (direction === 'bottom' ? swipeAmount > restOffset + 1 : swipeAmount < restOffset - 1) {
239
+ return true;
240
+ }
241
+ }
242
+
243
+ // Don't drag if there's highlighted text
244
+ if (highlightedText && highlightedText.length > 0) {
245
+ return false;
246
+ }
247
+
248
+ // Disallow dragging if drawer was scrolled within `scrollLockTimeout`.
249
+ // Don't re-arm the timestamp here — a prevented drag attempt is not a
250
+ // scroll, and re-arming would keep the lock alive for as long as the
251
+ // finger moves, deadening the whole gesture instead of just the first
252
+ // `scrollLockTimeout` ms after the last real scroll.
253
+ if (lastTimeDragPrevented.current && date.getTime() - lastTimeDragPrevented.current.getTime() < scrollLockTimeout && swipeAmount === 0) {
254
+ return false;
255
+ }
256
+ if (isDraggingInDirection) {
257
+ lastTimeDragPrevented.current = date;
258
+
259
+ // We are dragging down so we should allow scrolling
260
+ return false;
261
+ }
262
+
263
+ // Keep climbing up the DOM tree as long as there's a parent
264
+ while (element) {
265
+ // Check if the element is scrollable
266
+ if (element.scrollHeight > element.clientHeight) {
267
+ // `> 0`, not `!== 0`: Safari reports a negative scrollTop during the
268
+ // rubber-band bounce at the top — that's "at the top" for drag
269
+ // purposes, and treating it as scrolled would arm the scroll lock and
270
+ // delay the sheet drag until the bounce fully settles.
271
+ if (element.scrollTop > 0) {
272
+ lastTimeDragPrevented.current = new Date();
273
+
274
+ // The element is scrollable and not scrolled to the top, so don't drag
275
+ return false;
276
+ }
277
+ if (element.getAttribute('role') === 'dialog') {
278
+ return true;
279
+ }
280
+ }
281
+
282
+ // Move up to the parent element
283
+ element = element.parentNode;
284
+ }
285
+
286
+ // No scrollable parents not scrolled to the top found, so drag
287
+ return true;
288
+ }
289
+ function drag(event, pointerEvent) {
290
+ if (!drawerRef.current) {
291
+ return;
292
+ }
293
+
294
+ // We need to know how much of the drawer has been dragged in percentages so that we can transform background accordingly
295
+ if (isDragging) {
296
+ const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;
297
+ const draggedDistance = (pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX)) * directionMultiplier;
298
+ const isDraggingInDirection = draggedDistance > 0;
299
+
300
+ // Pre condition for disallowing dragging in the close direction.
301
+ const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
302
+
303
+ // Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.
304
+ if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) {
305
+ // The drawer stays put. Remember a deliberate pull that would otherwise
306
+ // have dragged it (content at its top) so release() can report it.
307
+ if (-draggedDistance > DISMISS_ATTEMPT_THRESHOLD && (isAllowedToDrag.current || shouldDrag(event.target, isDraggingInDirection))) {
308
+ dismissAttempted.current = true;
309
+ }
310
+ return;
311
+ }
312
+
313
+ // We need to capture last time when drag with scroll was triggered and have a timeout between
314
+ const absDraggedDistance = Math.abs(draggedDistance);
315
+ const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');
316
+ const drawerDimension = direction === 'bottom' || direction === 'top' ? drawerHeightRef.current : drawerWidthRef.current;
317
+
318
+ // Calculate the percentage dragged, where 1 is the closed position
319
+ let percentageDragged = absDraggedDistance / drawerDimension;
320
+ const snapPointPercentageDragged = getSnapPointsPercentageDragged(absDraggedDistance, isDraggingInDirection);
321
+ if (snapPointPercentageDragged !== null) {
322
+ percentageDragged = snapPointPercentageDragged;
323
+ }
324
+
325
+ // Disallow close dragging beyond the smallest snap point.
326
+ if (noCloseSnapPointsPreCondition && percentageDragged >= 1) {
327
+ return;
328
+ }
329
+ if (!isAllowedToDrag.current) {
330
+ if (!shouldDrag(event.target, isDraggingInDirection)) return;
331
+ drawerRef.current.classList.add(DRAG_CLASS);
332
+ // If shouldDrag gave true once after pressing down on the drawer, we set isAllowedToDrag to true and it will remain true until we let go, there's no reason to disable dragging mid way, ever, and that's the solution to it
333
+ isAllowedToDrag.current = true;
334
+ // Touch pans latched onto a scroller would keep scrolling the content
335
+ // along with the sheet drag — freeze them for the drag's duration.
336
+ if (event.pointerType !== 'mouse') freezeScrollables(event.target);
337
+ // Drag can engage mid-gesture (content scrolled back to its top under
338
+ // the same finger, or the scroll lock expiring). Re-anchor and start
339
+ // moving on the next tick so the sheet tracks the finger from here
340
+ // instead of jumping by the distance the gesture already consumed.
341
+ pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
342
+ return;
343
+ }
344
+ set(drawerRef.current, {
345
+ transition: 'none'
346
+ });
347
+ set(overlayRef.current, {
348
+ transition: 'none'
349
+ });
350
+ if (pointerEvent) onDragProp?.(pointerEvent, percentageDragged);
351
+ if (snapPoints) {
352
+ onDragSnapPoints({
353
+ draggedDistance
354
+ });
355
+ }
356
+
357
+ // Run this only if snapPoints are not defined or if we are at the last snap point (highest one)
358
+ if (isDraggingInDirection && !snapPoints) {
359
+ const dampenedDraggedDistance = dampenValue(draggedDistance);
360
+ const translateValue = Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;
361
+ set(drawerRef.current, {
362
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
363
+ });
364
+ return;
365
+ }
366
+ const opacityValue = 1 - percentageDragged;
367
+ if (shouldFade || fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1) {
368
+ set(overlayRef.current, {
369
+ opacity: `${opacityValue}`,
370
+ transition: 'none'
371
+ }, true);
372
+ }
373
+ if (wrapper && overlayRef.current && shouldScaleBackground) {
374
+ // Calculate percentageDragged as a fraction (0 to 1)
375
+ const scaleValue = Math.min(getScale() + percentageDragged * (1 - getScale()), 1);
376
+ const borderRadiusValue = 8 - percentageDragged * 8;
377
+ const translateValue = Math.max(0, 14 - percentageDragged * 14);
378
+ set(wrapper, {
379
+ borderRadius: `${borderRadiusValue}px`,
380
+ transform: isVertical(direction) ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)` : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,
381
+ transition: 'none'
382
+ }, true);
383
+ }
384
+ if (!snapPoints) {
385
+ const translateValue = absDraggedDistance * directionMultiplier;
386
+ set(drawerRef.current, {
387
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
388
+ });
389
+ }
390
+ }
391
+ }
392
+ React.useEffect(() => {
393
+ window.requestAnimationFrame(() => {
394
+ shouldAnimate.current = true;
395
+ });
396
+ }, []);
397
+
398
+ // Reset to the first snap point on every open so a prior session's active snap
399
+ // (kept in state by `useControllableState` after dismissal) doesn't leak into
400
+ // the next present. Skipped when `activeSnapPoint` is controlled externally.
401
+ React.useEffect(() => {
402
+ if (isOpen && snapPoints && activeSnapPointProp === undefined) {
403
+ setActiveSnapPoint(snapPoints[0]);
404
+ }
405
+ }, [isOpen]);
406
+ const onPositionChangeRef = React.useRef(onPositionChange);
407
+ React.useEffect(() => {
408
+ onPositionChangeRef.current = onPositionChange;
409
+ });
410
+ React.useEffect(() => {
411
+ function onVisualViewportChange() {
412
+ if (!drawerRef.current || !repositionInputs) return;
413
+ const focusedElement = document.activeElement;
414
+ if (isInput(focusedElement) || keyboardIsOpen.current) {
415
+ const visualViewportHeight = window.visualViewport?.height || 0;
416
+ const totalHeight = window.innerHeight;
417
+ // This is the height of the keyboard
418
+ let diffFromInitial = totalHeight - visualViewportHeight;
419
+ const drawerHeight = drawerRef.current.getBoundingClientRect().height || 0;
420
+ // Adjust drawer height only if it's tall enough
421
+ const isTallEnough = drawerHeight > totalHeight * 0.8;
422
+ if (!initialDrawerHeight.current) {
423
+ initialDrawerHeight.current = drawerHeight;
424
+ }
425
+ const offsetFromTop = drawerRef.current.getBoundingClientRect().top;
426
+
427
+ // visualViewport height may change due to somq e subtle changes to the keyboard. Checking if the height changed by 60 or more will make sure that they keyboard really changed its open state.
428
+ if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) {
429
+ keyboardIsOpen.current = !keyboardIsOpen.current;
430
+ }
431
+ if (snapPoints && snapPoints.length > 0 && snapPointsOffset && activeSnapPointIndex) {
432
+ const activeSnapPointHeight = snapPointsOffset[activeSnapPointIndex] || 0;
433
+ diffFromInitial += activeSnapPointHeight;
434
+ }
435
+ previousDiffFromInitial.current = diffFromInitial;
436
+ // We don't have to change the height if the input is in view, when we are here we are in the opened keyboard state so we can correctly check if the input is in view
437
+ if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {
438
+ const height = drawerRef.current.getBoundingClientRect().height;
439
+ let newDrawerHeight = height;
440
+ if (height > visualViewportHeight) {
441
+ newDrawerHeight = visualViewportHeight - (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);
442
+ }
443
+ // When fixed, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open
444
+ if (fixed) {
445
+ drawerRef.current.style.height = `${height - Math.max(diffFromInitial, 0)}px`;
446
+ } else {
447
+ drawerRef.current.style.height = `${Math.max(newDrawerHeight, visualViewportHeight - offsetFromTop)}px`;
448
+ }
449
+ } else if (!isMobileFirefox()) {
450
+ drawerRef.current.style.height = `${initialDrawerHeight.current}px`;
451
+ }
452
+ if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {
453
+ drawerRef.current.style.bottom = '0px';
454
+ } else {
455
+ // Negative bottom value would never make sense
456
+ drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;
457
+ }
458
+ }
459
+ }
460
+ window.visualViewport?.addEventListener('resize', onVisualViewportChange);
461
+ return () => window.visualViewport?.removeEventListener('resize', onVisualViewportChange);
462
+ }, [activeSnapPointIndex, snapPoints, snapPointsOffset]);
463
+ function closeDrawer(fromWithin) {
464
+ cancelDrag();
465
+ onClose?.();
466
+ if (!fromWithin) {
467
+ setIsOpen(false);
468
+ }
469
+ }
470
+ function resetDrawer() {
471
+ if (!drawerRef.current) return;
472
+ const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');
473
+ const currentSwipeAmount = getTranslate(drawerRef.current, direction);
474
+ set(drawerRef.current, {
475
+ transform: 'translate3d(0, 0, 0)',
476
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`
477
+ });
478
+ set(overlayRef.current, {
479
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
480
+ opacity: '1'
481
+ });
482
+
483
+ // Don't reset background if swiped upwards
484
+ if (shouldScaleBackground && currentSwipeAmount && currentSwipeAmount > 0 && isOpen) {
485
+ set(wrapper, {
486
+ borderRadius: `${BORDER_RADIUS}px`,
487
+ overflow: 'hidden',
488
+ ...(isVertical(direction) ? {
489
+ transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
490
+ transformOrigin: 'top'
491
+ } : {
492
+ transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
493
+ transformOrigin: 'left'
494
+ }),
495
+ transitionProperty: 'transform, border-radius',
496
+ transitionDuration: `${TRANSITIONS.DURATION}s`,
497
+ transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`
498
+ }, true);
499
+ }
500
+ }
501
+ function cancelDrag() {
502
+ if (!isDragging || !drawerRef.current) return;
503
+ drawerRef.current.classList.remove(DRAG_CLASS);
504
+ isAllowedToDrag.current = false;
505
+ unfreezeScrollables();
506
+ setIsDragging(false);
507
+ dragEndTime.current = new Date();
508
+ }
509
+ function release(event, pointerEvent) {
510
+ if (!isDragging || !drawerRef.current) return;
511
+ drawerRef.current.classList.remove(DRAG_CLASS);
512
+ isAllowedToDrag.current = false;
513
+ unfreezeScrollables();
514
+ setIsDragging(false);
515
+ dragEndTime.current = new Date();
516
+ if (dismissAttempted.current) {
517
+ dismissAttempted.current = false;
518
+ if (isOpen) onDismissAttempt?.();
519
+ }
520
+
521
+ // The press that started this "drag" may have dismissed the drawer (e.g. a
522
+ // back button acting on pointerdown). Snapping now would overwrite the
523
+ // dismiss transform that closeDrawer just wrote and freeze the sheet in
524
+ // place until it unmounts.
525
+ if (!isOpen) {
526
+ if (pointerEvent) onReleaseProp?.(pointerEvent, false);
527
+ return;
528
+ }
529
+ const swipeAmount = getTranslate(drawerRef.current, direction);
530
+
531
+ // Drag overshoot below the lowest snap point translates the detached
532
+ // wrapper while the drawer stays pinned (see onDrag in use-snap-points) —
533
+ // common when a clamped 'auto' puts the lowest snap point at 0. Count the
534
+ // wrapper's translation as movement, or the release is swallowed and the
535
+ // sheet is left stuck at the overshoot position.
536
+ const wrapper = drawerRef.current.closest('[data-vaul-detached-wrapper]');
537
+ const wrapperSwipeAmount = wrapper ? getTranslate(wrapper, direction) : null;
538
+ const hasMoved = Boolean(swipeAmount) || Boolean(wrapperSwipeAmount);
539
+ if (!event || !shouldDrag(event.target, false) || !hasMoved || Number.isNaN(swipeAmount)) return;
540
+ if (dragStartTime.current === null) return;
541
+ const timeTaken = dragEndTime.current.getTime() - dragStartTime.current.getTime();
542
+ const distMoved = pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX);
543
+ const velocity = Math.abs(distMoved) / timeTaken;
544
+ if (velocity > 0.05) {
545
+ // `justReleased` is needed to prevent the drawer from focusing on an input when the drag ends, as it's not the intent most of the time.
546
+ setJustReleased(true);
547
+ setTimeout(() => {
548
+ setJustReleased(false);
549
+ }, 200);
550
+ }
551
+ if (snapPoints) {
552
+ const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;
553
+ onReleaseSnapPoints({
554
+ draggedDistance: distMoved * directionMultiplier,
555
+ closeDrawer,
556
+ velocity,
557
+ dismissible
558
+ });
559
+ if (pointerEvent) onReleaseProp?.(pointerEvent, true);
560
+ return;
561
+ }
562
+
563
+ // Moved upwards, don't do anything
564
+ if (direction === 'bottom' || direction === 'right' ? distMoved > 0 : distMoved < 0) {
565
+ resetDrawer();
566
+ if (pointerEvent) onReleaseProp?.(pointerEvent, true);
567
+ return;
568
+ }
569
+ if (velocity > VELOCITY_THRESHOLD) {
570
+ closeDrawer();
571
+ if (pointerEvent) onReleaseProp?.(pointerEvent, false);
572
+ return;
573
+ }
574
+ const visibleDrawerHeight = Math.min(drawerRef.current.getBoundingClientRect().height ?? 0, window.innerHeight);
575
+ const visibleDrawerWidth = Math.min(drawerRef.current.getBoundingClientRect().width ?? 0, window.innerWidth);
576
+ const isHorizontalSwipe = direction === 'left' || direction === 'right';
577
+ if (Math.abs(swipeAmount ?? 0) >= (isHorizontalSwipe ? visibleDrawerWidth : visibleDrawerHeight) * closeThreshold) {
578
+ closeDrawer();
579
+ if (pointerEvent) onReleaseProp?.(pointerEvent, false);
580
+ return;
581
+ }
582
+ if (pointerEvent) onReleaseProp?.(pointerEvent, true);
583
+ resetDrawer();
584
+ }
585
+ React.useEffect(() => {
586
+ // Trigger enter animation without using CSS animation
587
+ if (isOpen) {
588
+ set(document.documentElement, {
589
+ scrollBehavior: 'auto'
590
+ });
591
+ openTime.current = new Date();
592
+ }
593
+ return () => {
594
+ reset(document.documentElement, 'scrollBehavior');
595
+ };
596
+ }, [isOpen]);
597
+ function onNestedOpenChange(o) {
598
+ const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;
599
+ const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;
600
+ if (nestedOpenChangeTimer.current) {
601
+ window.clearTimeout(nestedOpenChangeTimer.current);
602
+ }
603
+ set(drawerRef.current, {
604
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
605
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`
606
+ });
607
+ if (!o && drawerRef.current) {
608
+ nestedOpenChangeTimer.current = setTimeout(() => {
609
+ const translateValue = getTranslate(drawerRef.current, direction);
610
+ set(drawerRef.current, {
611
+ transition: 'none',
612
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
613
+ });
614
+ }, 500);
615
+ }
616
+ }
617
+ function onNestedDrag(_event, percentageDragged) {
618
+ if (percentageDragged < 0) return;
619
+ const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;
620
+ const newScale = initialScale + percentageDragged * (1 - initialScale);
621
+ const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;
622
+ set(drawerRef.current, {
623
+ transform: isVertical(direction) ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)` : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,
624
+ transition: 'none'
625
+ });
626
+ }
627
+ function onNestedRelease(_event, o) {
628
+ const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
629
+ const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;
630
+ const translate = o ? -NESTED_DISPLACEMENT : 0;
631
+ if (o) {
632
+ set(drawerRef.current, {
633
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
634
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${translate}px, 0)` : `scale(${scale}) translate3d(${translate}px, 0, 0)`
635
+ });
636
+ }
637
+ }
638
+ return /*#__PURE__*/_jsx(DialogPrimitive.Root, {
639
+ defaultOpen: defaultOpen,
640
+ onOpenChange: open => {
641
+ if (!dismissible && !open) return;
642
+ if (open) {
643
+ setHasBeenOpened(true);
644
+ } else {
645
+ closeDrawer(true);
646
+ }
647
+ setIsOpen(open);
648
+ },
649
+ open: isOpen
650
+ // Always non-modal at the Radix level — Radix's modal mode locks
651
+ // body.style.pointerEvents and its restore on layer unmount is buggy
652
+ // (see git history). Vaul's own overlay handles click-trapping; the
653
+ // overlay sets pointer-events: none below fadeFromIndex so clicks
654
+ // pass through to the page (matches native dimmedDetentIndex). Vaul's
655
+ // own `modal` prop still drives overlay rendering and click-outside
656
+ // behavior below.
657
+ ,
658
+ modal: false,
659
+ children: /*#__PURE__*/_jsx(DrawerContext.Provider, {
660
+ value: {
661
+ activeSnapPoint,
662
+ snapPoints,
663
+ setActiveSnapPoint,
664
+ drawerRef,
665
+ overlayRef,
666
+ onOpenChange,
667
+ onPress,
668
+ onRelease: event => release(event, event ?? undefined),
669
+ onDrag: event => drag(event, event),
670
+ onTouchDrag: (event, pointerEvent) => drag(event, pointerEvent),
671
+ onTouchRelease: (event, pointerEvent) => release(event, pointerEvent),
672
+ dismissible,
673
+ onDismissAttempt,
674
+ shouldAnimate,
675
+ handleOnly,
676
+ isOpen,
677
+ isDragging,
678
+ shouldFade,
679
+ closeDrawer,
680
+ onNestedDrag,
681
+ onNestedOpenChange,
682
+ onNestedRelease,
683
+ keyboardIsOpen,
684
+ modal,
685
+ snapPointsOffset,
686
+ activeSnapPointIndex,
687
+ fadeFromIndex,
688
+ direction,
689
+ shouldScaleBackground,
690
+ setBackgroundColorOnScale,
691
+ noBodyStyles,
692
+ container,
693
+ autoFocus,
694
+ onPositionChangeRef,
695
+ setContentHeight,
696
+ detached,
697
+ detachedOffset: detached ? detachedOffset : 0,
698
+ detachedRadius: detached ? detachedRadius : 0,
699
+ detachedWrapperStyle
700
+ },
701
+ children: children
702
+ })
703
+ });
704
+ }
705
+ export const Overlay = /*#__PURE__*/React.forwardRef(({
706
+ style,
707
+ ...rest
708
+ }, ref) => {
709
+ const {
710
+ overlayRef,
711
+ snapPoints,
712
+ onRelease,
713
+ shouldFade,
714
+ isOpen,
715
+ modal,
716
+ shouldAnimate,
717
+ activeSnapPointIndex,
718
+ fadeFromIndex
719
+ } = useDrawerContext();
720
+ const composedRef = useComposedRefs(ref, overlayRef);
721
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
722
+ const [delayedSnapPoints, setDelayedSnapPoints] = React.useState(false);
723
+ const onMouseUp = React.useCallback(event => onRelease(event), [onRelease]);
724
+ React.useEffect(() => {
725
+ if (hasSnapPoints) {
726
+ window.requestAnimationFrame(() => {
727
+ setDelayedSnapPoints(true);
728
+ });
729
+ }
730
+ }, []);
731
+
732
+ // Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog library
733
+ if (!modal) {
734
+ return null;
735
+ }
736
+
737
+ // When the active snap is below fadeFromIndex, the overlay is fully
738
+ // transparent (CSS opacity: 0). Radix's DialogOverlayImpl sets inline
739
+ // `pointer-events: auto` which would still catch clicks on the invisible
740
+ // layer — drive this via React so it stays correct even before
741
+ // `snapToPoint` runs (Presence defers the drawer/overlay mount, leaving
742
+ // refs null on the first open effect pass).
743
+ const isBelowFade = hasSnapPoints && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
744
+
745
+ // Render our own overlay element instead of `DialogPrimitive.Overlay`:
746
+ // Radix's Overlay returns null when the Dialog is non-modal, and we run
747
+ // Radix as `modal={false}` to keep it from locking body pointer-events.
748
+ // `Presence` keeps the node mounted through the closing animation
749
+ // (`fadeOut`) before unmounting.
750
+ return /*#__PURE__*/_jsx(Presence, {
751
+ present: isOpen,
752
+ children: /*#__PURE__*/_jsx("div", {
753
+ onMouseUp: onMouseUp,
754
+ ref: composedRef,
755
+ "data-state": isOpen ? 'open' : 'closed',
756
+ "data-vaul-overlay": "",
757
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? 'true' : 'false',
758
+ "data-vaul-delayed-snap-points": delayedSnapPoints ? 'true' : 'false',
759
+ "data-vaul-snap-points-overlay": isOpen && shouldFade ? 'true' : 'false',
760
+ "data-vaul-animate": shouldAnimate?.current ? 'true' : 'false',
761
+ ...rest,
762
+ style: overlayStyle(style, !!isBelowFade)
763
+ })
764
+ });
765
+ });
766
+ Overlay.displayName = 'Drawer.Overlay';
767
+ const overlayStyle = (style, isBelowFade) => ({
768
+ ...style,
769
+ pointerEvents: isBelowFade ? 'none' : 'auto'
770
+ });
771
+ export const Content = /*#__PURE__*/React.forwardRef(({
772
+ onPointerDownOutside,
773
+ onEscapeKeyDown,
774
+ style,
775
+ onOpenAutoFocus,
776
+ children,
777
+ detachedSiblings,
778
+ ...rest
779
+ }, ref) => {
780
+ const {
781
+ drawerRef,
782
+ onPress,
783
+ onRelease,
784
+ onDrag,
785
+ onTouchDrag,
786
+ onTouchRelease,
787
+ keyboardIsOpen,
788
+ snapPointsOffset,
789
+ activeSnapPointIndex,
790
+ fadeFromIndex,
791
+ modal,
792
+ isOpen,
793
+ isDragging,
794
+ direction,
795
+ snapPoints,
796
+ setActiveSnapPoint,
797
+ dismissible,
798
+ onDismissAttempt,
799
+ container,
800
+ handleOnly,
801
+ shouldAnimate,
802
+ autoFocus,
803
+ onPositionChangeRef,
804
+ setContentHeight,
805
+ detached,
806
+ detachedOffset,
807
+ detachedRadius,
808
+ detachedWrapperStyle: detachedWrapperStyleProp
809
+ } = useDrawerContext();
810
+ // Always measure the inner wrapper's natural height. The drawer itself may
811
+ // be styled to a fixed viewport height, so we measure an inner wrapper
812
+ // instead. Ref callback starts the observer as soon as the node mounts
813
+ // (Radix Presence defers the portal mount past useEffect). The measurement
814
+ // drives the 'auto' snap point and is also exposed via
815
+ // `onContentHeightChange` for callers that size the surrounding card.
816
+ const autoRoRef = React.useRef(null);
817
+ const setAutoSizeNode = React.useCallback(node => {
818
+ autoRoRef.current?.disconnect();
819
+ if (!node) {
820
+ autoRoRef.current = null;
821
+ return;
822
+ }
823
+ const measure = () => setContentHeight(node.offsetHeight);
824
+ measure();
825
+ const ro = new ResizeObserver(measure);
826
+ ro.observe(node);
827
+ autoRoRef.current = ro;
828
+ }, [setContentHeight]);
829
+ const isBelowFade = snapPoints !== undefined && snapPoints !== null && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
830
+ // Needed to use transition instead of animations
831
+ const [delayedSnapPoints, setDelayedSnapPoints] = React.useState(false);
832
+ const composedRef = useComposedRefs(ref, drawerRef);
833
+ const pointerStartRef = React.useRef(null);
834
+ const lastKnownPointerEventRef = React.useRef(null);
835
+ const continuingCanceledTouchRef = React.useRef(false);
836
+ const wasBeyondThePointRef = React.useRef(false);
837
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
838
+ useScaleBackground();
839
+ const isDeltaInDirection = (delta, dir, threshold = 0) => {
840
+ if (wasBeyondThePointRef.current) return true;
841
+ const deltaY = Math.abs(delta.y);
842
+ const deltaX = Math.abs(delta.x);
843
+ const isDeltaX = deltaX > deltaY;
844
+ const dFactor = ['bottom', 'right'].includes(dir) ? 1 : -1;
845
+ if (dir === 'left' || dir === 'right') {
846
+ const isReverseDirection = delta.x * dFactor < 0;
847
+ if (!isReverseDirection && deltaX >= 0 && deltaX <= threshold) {
848
+ return isDeltaX;
849
+ }
850
+ } else {
851
+ const isReverseDirection = delta.y * dFactor < 0;
852
+ if (!isReverseDirection && deltaY >= 0 && deltaY <= threshold) {
853
+ return !isDeltaX;
854
+ }
855
+ }
856
+ wasBeyondThePointRef.current = true;
857
+ return true;
858
+ };
859
+ React.useEffect(() => {
860
+ if (hasSnapPoints) {
861
+ window.requestAnimationFrame(() => {
862
+ setDelayedSnapPoints(true);
863
+ });
864
+ }
865
+ }, []);
866
+
867
+ // Event-driven position tracking. We only tick RAF while the drawer is
868
+ // actually moving (drag / CSS transition / CSS animation). When it's idle at
869
+ // a snap, no frames run at all.
870
+ const positionTrackingRef = React.useRef(null);
871
+ React.useEffect(() => {
872
+ const drawer = drawerRef.current;
873
+ if (!drawer) return;
874
+ const state = {
875
+ rafId: null,
876
+ movingCount: 0,
877
+ lastPosition: Number.NaN,
878
+ start: () => {},
879
+ stop: () => {}
880
+ };
881
+ const emit = () => {
882
+ const cb = onPositionChangeRef.current;
883
+ if (!cb) return;
884
+ const position = drawer.getBoundingClientRect().top;
885
+ if (position !== state.lastPosition) {
886
+ state.lastPosition = position;
887
+ cb(position);
888
+ }
889
+ };
890
+ const tick = () => {
891
+ emit();
892
+ state.rafId = state.movingCount > 0 ? window.requestAnimationFrame(tick) : null;
893
+ };
894
+ state.start = () => {
895
+ state.movingCount += 1;
896
+ if (state.rafId === null) {
897
+ state.rafId = window.requestAnimationFrame(tick);
898
+ }
899
+ };
900
+ state.stop = () => {
901
+ state.movingCount = Math.max(0, state.movingCount - 1);
902
+ // RAF loop will exit on its next tick; emit the settled position now.
903
+ if (state.movingCount === 0) emit();
904
+ };
905
+ const wrapper = drawer.closest('[data-vaul-detached-wrapper]');
906
+
907
+ // Listen on the wrapper too: drag-overshoot snap-back animates the wrapper
908
+ // alone when the drawer's target is unchanged (e.g. snapping back to the
909
+ // same detent). Without this, position goes stale mid-animation because
910
+ // the drawer's `transitionrun` never fires.
911
+ const onTransitionRun = e => {
912
+ if ((e.target === drawer || e.target === wrapper) && e.propertyName === 'transform') state.start();
913
+ };
914
+ const onTransitionDone = e => {
915
+ if ((e.target === drawer || e.target === wrapper) && e.propertyName === 'transform') state.stop();
916
+ };
917
+ const onAnimationStart = e => {
918
+ if (e.target === drawer || e.target === wrapper) state.start();
919
+ };
920
+ const onAnimationDone = e => {
921
+ if (e.target === drawer || e.target === wrapper) state.stop();
922
+ };
923
+ drawer.addEventListener('transitionrun', onTransitionRun);
924
+ drawer.addEventListener('transitionend', onTransitionDone);
925
+ drawer.addEventListener('transitioncancel', onTransitionDone);
926
+ drawer.addEventListener('animationstart', onAnimationStart);
927
+ drawer.addEventListener('animationend', onAnimationDone);
928
+ drawer.addEventListener('animationcancel', onAnimationDone);
929
+ wrapper?.addEventListener('transitionrun', onTransitionRun);
930
+ wrapper?.addEventListener('transitionend', onTransitionDone);
931
+ wrapper?.addEventListener('transitioncancel', onTransitionDone);
932
+ positionTrackingRef.current = state;
933
+ emit();
934
+ return () => {
935
+ drawer.removeEventListener('transitionrun', onTransitionRun);
936
+ drawer.removeEventListener('transitionend', onTransitionDone);
937
+ drawer.removeEventListener('transitioncancel', onTransitionDone);
938
+ drawer.removeEventListener('animationstart', onAnimationStart);
939
+ drawer.removeEventListener('animationend', onAnimationDone);
940
+ drawer.removeEventListener('animationcancel', onAnimationDone);
941
+ wrapper?.removeEventListener('transitionrun', onTransitionRun);
942
+ wrapper?.removeEventListener('transitionend', onTransitionDone);
943
+ wrapper?.removeEventListener('transitioncancel', onTransitionDone);
944
+ if (state.rafId !== null) window.cancelAnimationFrame(state.rafId);
945
+ positionTrackingRef.current = null;
946
+ };
947
+ }, []);
948
+ React.useEffect(() => {
949
+ const state = positionTrackingRef.current;
950
+ if (!state) return;
951
+ if (isDragging) state.start();else state.stop();
952
+ }, [isDragging]);
953
+ function handleOnPointerUp(event) {
954
+ pointerStartRef.current = null;
955
+ wasBeyondThePointRef.current = false;
956
+ onRelease(event);
957
+ }
958
+
959
+ // The drawer always sits inside a fixed clip wrapper. `contain: paint`
960
+ // establishes the wrapper as the containing block so the drawer's own
961
+ // `position: fixed` is constrained here, and `overflow: hidden` keeps any
962
+ // overshoot out of the viewport. When `detached` the wrapper also floats
963
+ // with a bottom gap and rounded bottom corners; otherwise it sits flush.
964
+ // Transform/transition are managed imperatively (via drag overshoot and the
965
+ // dismiss effect) so React doesn't skip DOM writes for values it thinks it
966
+ // already owns.
967
+ const wrapperStyle = React.useMemo(() => ({
968
+ position: 'fixed',
969
+ top: 0,
970
+ left: 0,
971
+ right: 0,
972
+ bottom: detached ? detachedOffset : 0,
973
+ overflow: 'hidden',
974
+ contain: 'paint',
975
+ pointerEvents: 'none',
976
+ borderBottomLeftRadius: detached ? detachedRadius : 0,
977
+ borderBottomRightRadius: detached ? detachedRadius : 0,
978
+ ...detachedWrapperStyleProp
979
+ }), [detached, detachedOffset, detachedRadius, detachedWrapperStyleProp]);
980
+
981
+ // Translate the wrapper off-screen on dismiss so the whole card slides out
982
+ // as one. The reset-then-target pattern on open forces the browser to
983
+ // record a starting value so the transition actually animates.
984
+ // Start at `false` so a mount with `isOpen=true` (autopresent via
985
+ // `initialDetentIndex`) is detected as a false→true transition and runs
986
+ // the slide-up animation instead of snapping straight to rest.
987
+ const wasOpenRef = React.useRef(false);
988
+ React.useEffect(() => {
989
+ if (!drawerRef.current) {
990
+ wasOpenRef.current = isOpen;
991
+ return;
992
+ }
993
+ const wrapper = drawerRef.current.closest('[data-vaul-detached-wrapper]');
994
+ if (wrapper) {
995
+ const transition = `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`;
996
+ const viewportH = typeof window !== 'undefined' ? window.innerHeight : 0;
997
+ if (!isOpen && wasOpenRef.current) {
998
+ wrapper.style.transition = transition;
999
+ wrapper.style.transform = `translate3d(0, ${viewportH}px, 0)`;
1000
+ } else if (isOpen && !wasOpenRef.current) {
1001
+ wrapper.style.transition = 'none';
1002
+ wrapper.style.transform = `translate3d(0, ${viewportH}px, 0)`;
1003
+ // eslint-disable-next-line no-void
1004
+ void wrapper.offsetHeight;
1005
+ wrapper.style.transition = transition;
1006
+ wrapper.style.transform = 'translate3d(0, 0, 0)';
1007
+ }
1008
+ }
1009
+ wasOpenRef.current = isOpen;
1010
+ }, [isOpen, detached, drawerRef]);
1011
+ const contentNode = /*#__PURE__*/_jsx(DialogPrimitive.Content, {
1012
+ "data-vaul-drawer-direction": direction,
1013
+ "data-vaul-drawer": "",
1014
+ "data-vaul-detached": detached ? 'true' : 'false',
1015
+ "data-vaul-delayed-snap-points": delayedSnapPoints ? 'true' : 'false',
1016
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? 'true' : 'false',
1017
+ "data-vaul-custom-container": container ? 'true' : 'false',
1018
+ "data-vaul-animate": shouldAnimate?.current ? 'true' : 'false',
1019
+ ...rest,
1020
+ ref: composedRef,
1021
+ style: snapPointsOffset && snapPointsOffset.length > 0 ? {
1022
+ '--snap-point-height': `${snapPointsOffset[activeSnapPointIndex ?? 0]}px`,
1023
+ ...style,
1024
+ 'pointerEvents': 'auto'
1025
+ } : {
1026
+ ...style,
1027
+ pointerEvents: 'auto'
1028
+ },
1029
+ onPointerDown: event => {
1030
+ if (handleOnly) return;
1031
+ rest.onPointerDown?.(event);
1032
+ continuingCanceledTouchRef.current = false;
1033
+ pointerStartRef.current = {
1034
+ x: event.pageX,
1035
+ y: event.pageY
1036
+ };
1037
+ onPress(event);
1038
+ },
1039
+ onOpenAutoFocus: e => {
1040
+ onOpenAutoFocus?.(e);
1041
+ if (!autoFocus) {
1042
+ e.preventDefault();
1043
+ }
1044
+ },
1045
+ onPointerDownOutside: e => {
1046
+ onPointerDownOutside?.(e);
1047
+ if (!modal || e.defaultPrevented || isBelowFade) {
1048
+ e.preventDefault();
1049
+ return;
1050
+ }
1051
+
1052
+ // Non-dismissible + dimmed: collapse to the highest non-dimmed
1053
+ // snap point instead of silently swallowing the dismiss attempt.
1054
+ // Mirrors the native Android dim-tap behavior.
1055
+ if (!dismissible && hasSnapPoints && fadeFromIndex !== undefined && fadeFromIndex > 0 && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex >= fadeFromIndex) {
1056
+ e.preventDefault();
1057
+ setActiveSnapPoint(snapPoints[fadeFromIndex - 1]);
1058
+ return;
1059
+ }
1060
+ if (keyboardIsOpen.current) {
1061
+ keyboardIsOpen.current = false;
1062
+ }
1063
+ },
1064
+ onEscapeKeyDown: e => {
1065
+ onEscapeKeyDown?.(e);
1066
+ if (e.defaultPrevented) return;
1067
+
1068
+ // Non-dismissible: collapse to the first snap point (if above it)
1069
+ // instead of silently swallowing the dismiss attempt. Mirrors the
1070
+ // native Android back-press behavior.
1071
+ if (!dismissible) {
1072
+ e.preventDefault();
1073
+ if (hasSnapPoints && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex > 0) {
1074
+ setActiveSnapPoint(snapPoints[0]);
1075
+ } else {
1076
+ onDismissAttempt?.();
1077
+ }
1078
+ }
1079
+ },
1080
+ onFocusOutside: e => {
1081
+ // Never auto-dismiss the sheet on focus shifts. Without Radix's
1082
+ // FocusScope trap (we run modal={false}), this fires whenever
1083
+ // focus naturally leaves the drawer — e.g. React Navigation's
1084
+ // web driver hides the previous screen via display:none, which
1085
+ // moves focus off the trigger and dismisses the sheet.
1086
+ e.preventDefault();
1087
+ },
1088
+ onPointerMove: event => {
1089
+ lastKnownPointerEventRef.current = event;
1090
+ if (handleOnly) return;
1091
+ rest.onPointerMove?.(event);
1092
+ if (!pointerStartRef.current) return;
1093
+ const yPosition = event.pageY - pointerStartRef.current.y;
1094
+ const xPosition = event.pageX - pointerStartRef.current.x;
1095
+ const swipeStartThreshold = event.pointerType === 'touch' ? 10 : 2;
1096
+ const delta = {
1097
+ x: xPosition,
1098
+ y: yPosition
1099
+ };
1100
+ const isAllowedToSwipe = isDeltaInDirection(delta, direction, swipeStartThreshold);
1101
+ if (isAllowedToSwipe) onDrag(event);else if (Math.abs(xPosition) > swipeStartThreshold || Math.abs(yPosition) > swipeStartThreshold) {
1102
+ pointerStartRef.current = null;
1103
+ }
1104
+ },
1105
+ onPointerUp: event => {
1106
+ rest.onPointerUp?.(event);
1107
+ continuingCanceledTouchRef.current = false;
1108
+ pointerStartRef.current = null;
1109
+ wasBeyondThePointRef.current = false;
1110
+ onRelease(event);
1111
+ },
1112
+ onPointerCancel: event => {
1113
+ rest.onPointerCancel?.(event);
1114
+ if (event.pointerType === 'touch' && snapPoints && activeSnapPointIndex === snapPoints.length - 1) {
1115
+ continuingCanceledTouchRef.current = true;
1116
+ return;
1117
+ }
1118
+ handleOnPointerUp(null);
1119
+ },
1120
+ onPointerOut: event => {
1121
+ rest.onPointerOut?.(event);
1122
+ if (continuingCanceledTouchRef.current) return;
1123
+ handleOnPointerUp(lastKnownPointerEventRef.current);
1124
+ },
1125
+ onTouchMove: event => {
1126
+ rest.onTouchMove?.(event);
1127
+ if (!continuingCanceledTouchRef.current) return;
1128
+ const touch = event.touches[0];
1129
+ if (!touch) return;
1130
+ onTouchDrag({
1131
+ target: event.target,
1132
+ pageX: touch.pageX,
1133
+ pageY: touch.pageY,
1134
+ pointerType: 'touch'
1135
+ }, lastKnownPointerEventRef.current ?? undefined);
1136
+ },
1137
+ onTouchEnd: event => {
1138
+ rest.onTouchEnd?.(event);
1139
+ if (!continuingCanceledTouchRef.current) return;
1140
+ continuingCanceledTouchRef.current = false;
1141
+ pointerStartRef.current = null;
1142
+ wasBeyondThePointRef.current = false;
1143
+ const touch = event.changedTouches[0];
1144
+ onTouchRelease(touch ? {
1145
+ target: event.target,
1146
+ pageX: touch.pageX,
1147
+ pageY: touch.pageY,
1148
+ pointerType: 'touch'
1149
+ } : null, lastKnownPointerEventRef.current ?? undefined);
1150
+ },
1151
+ onTouchCancel: event => {
1152
+ rest.onTouchCancel?.(event);
1153
+ if (!continuingCanceledTouchRef.current) return;
1154
+ continuingCanceledTouchRef.current = false;
1155
+ handleOnPointerUp(null);
1156
+ },
1157
+ onContextMenu: event => {
1158
+ rest.onContextMenu?.(event);
1159
+ if (lastKnownPointerEventRef.current) {
1160
+ handleOnPointerUp(lastKnownPointerEventRef.current);
1161
+ }
1162
+ },
1163
+ children: /*#__PURE__*/_jsx("div", {
1164
+ ref: setAutoSizeNode,
1165
+ "data-vaul-auto-size-wrapper": "",
1166
+ style: autoSizeWrapperStyle,
1167
+ children: children
1168
+ })
1169
+ });
1170
+ return /*#__PURE__*/_jsxs("div", {
1171
+ "data-vaul-detached-wrapper": "",
1172
+ style: wrapperStyle,
1173
+ children: [contentNode, detachedSiblings]
1174
+ });
1175
+ });
1176
+ Content.displayName = 'Drawer.Content';
1177
+
1178
+ // `flow-root` establishes a new block formatting context so the first child's
1179
+ // margin-top (e.g. a grabber) stays inside the wrapper instead of collapsing
1180
+ // out — otherwise `offsetHeight` under-reports and the drawer positions the
1181
+ // wrapper below where the content actually ends.
1182
+ const autoSizeWrapperStyle = {
1183
+ display: 'flow-root'
1184
+ };
1185
+ const LONG_HANDLE_PRESS_TIMEOUT = 250;
1186
+ const DOUBLE_TAP_TIMEOUT = 120;
1187
+ export const Handle = /*#__PURE__*/React.forwardRef(({
1188
+ preventCycle = false,
1189
+ children,
1190
+ ...rest
1191
+ }, ref) => {
1192
+ const {
1193
+ closeDrawer,
1194
+ isDragging,
1195
+ snapPoints,
1196
+ activeSnapPoint,
1197
+ setActiveSnapPoint,
1198
+ dismissible,
1199
+ onDismissAttempt,
1200
+ handleOnly,
1201
+ isOpen,
1202
+ onPress,
1203
+ onDrag
1204
+ } = useDrawerContext();
1205
+ const closeTimeoutIdRef = React.useRef(null);
1206
+ const shouldCancelInteractionRef = React.useRef(false);
1207
+ function handleStartCycle() {
1208
+ // Stop if this is the second click of a double click
1209
+ if (shouldCancelInteractionRef.current) {
1210
+ handleCancelInteraction();
1211
+ return;
1212
+ }
1213
+ window.setTimeout(() => {
1214
+ handleCycleSnapPoints();
1215
+ }, DOUBLE_TAP_TIMEOUT);
1216
+ }
1217
+ function handleCycleSnapPoints() {
1218
+ // Prevent accidental taps while resizing drawer
1219
+ if (isDragging || preventCycle || shouldCancelInteractionRef.current) {
1220
+ handleCancelInteraction();
1221
+ return;
1222
+ }
1223
+ // Make sure to clear the timeout id if the user releases the handle before the cancel timeout
1224
+ handleCancelInteraction();
1225
+ if (!snapPoints || snapPoints.length === 0) {
1226
+ if (!dismissible) {
1227
+ closeDrawer();
1228
+ }
1229
+ return;
1230
+ }
1231
+ const isLastSnapPoint = activeSnapPoint === snapPoints[snapPoints.length - 1];
1232
+ if (isLastSnapPoint && dismissible) {
1233
+ closeDrawer();
1234
+ return;
1235
+ }
1236
+
1237
+ // Mirrors native: a single-detent sheet's handle tap is a dismiss.
1238
+ if (isLastSnapPoint && snapPoints.length === 1) {
1239
+ onDismissAttempt?.();
1240
+ return;
1241
+ }
1242
+ const currentSnapIndex = snapPoints.findIndex(point => point === activeSnapPoint);
1243
+ if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints
1244
+ const nextSnapPoint = snapPoints[currentSnapIndex + 1];
1245
+ if (nextSnapPoint === undefined) return;
1246
+ setActiveSnapPoint(nextSnapPoint);
1247
+ }
1248
+ function handleStartInteraction() {
1249
+ closeTimeoutIdRef.current = window.setTimeout(() => {
1250
+ // Cancel click interaction on a long press
1251
+ shouldCancelInteractionRef.current = true;
1252
+ }, LONG_HANDLE_PRESS_TIMEOUT);
1253
+ }
1254
+ function handleCancelInteraction() {
1255
+ if (closeTimeoutIdRef.current) {
1256
+ window.clearTimeout(closeTimeoutIdRef.current);
1257
+ }
1258
+ shouldCancelInteractionRef.current = false;
1259
+ }
1260
+ return /*#__PURE__*/_jsx("div", {
1261
+ onClick: handleStartCycle,
1262
+ onPointerCancel: handleCancelInteraction,
1263
+ onPointerDown: e => {
1264
+ if (handleOnly) onPress(e);
1265
+ handleStartInteraction();
1266
+ },
1267
+ onPointerMove: e => {
1268
+ if (handleOnly) onDrag(e);
1269
+ }
1270
+ // onPointerUp is already handled by the content component
1271
+ ,
1272
+ ref: ref,
1273
+ "data-vaul-drawer-visible": isOpen ? 'true' : 'false',
1274
+ "data-vaul-handle": "",
1275
+ "aria-hidden": "true",
1276
+ ...rest,
1277
+ children: /*#__PURE__*/_jsx("span", {
1278
+ "data-vaul-handle-hitarea": "",
1279
+ "aria-hidden": "true",
1280
+ children: children
1281
+ })
1282
+ });
1283
+ });
1284
+ Handle.displayName = 'Drawer.Handle';
1285
+ export function NestedRoot({
1286
+ onDrag,
1287
+ onOpenChange,
1288
+ open: nestedIsOpen,
1289
+ ...rest
1290
+ }) {
1291
+ const {
1292
+ onNestedDrag,
1293
+ onNestedOpenChange,
1294
+ onNestedRelease
1295
+ } = useDrawerContext();
1296
+ if (!onNestedDrag) {
1297
+ throw new Error('Drawer.NestedRoot must be placed in another drawer');
1298
+ }
1299
+ return /*#__PURE__*/_jsx(Root, {
1300
+ nested: true,
1301
+ open: nestedIsOpen,
1302
+ onClose: () => {
1303
+ onNestedOpenChange(false);
1304
+ },
1305
+ onDrag: (e, p) => {
1306
+ onNestedDrag(e, p);
1307
+ onDrag?.(e, p);
1308
+ },
1309
+ onOpenChange: o => {
1310
+ if (o) {
1311
+ onNestedOpenChange(o);
1312
+ }
1313
+ onOpenChange?.(o);
1314
+ },
1315
+ onRelease: onNestedRelease,
1316
+ ...rest
1317
+ });
1318
+ }
1319
+ export function Portal(props) {
1320
+ const context = useDrawerContext();
1321
+ const {
1322
+ container = context.container,
1323
+ ...portalProps
1324
+ } = props;
1325
+ return /*#__PURE__*/_jsx(DialogPrimitive.Portal, {
1326
+ container: container,
1327
+ ...portalProps
1328
+ });
1329
+ }
1330
+ export const Drawer = {
1331
+ Root,
1332
+ NestedRoot,
1333
+ Content,
1334
+ Overlay,
1335
+ Trigger: DialogPrimitive.Trigger,
1336
+ Portal,
1337
+ Handle,
1338
+ Close: DialogPrimitive.Close,
1339
+ Title: DialogPrimitive.Title,
1340
+ Description: DialogPrimitive.Description
1341
+ };
1342
+ //# sourceMappingURL=index.js.map