@hanzogui/sheet 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (347) hide show
  1. package/LICENSE +21 -0
  2. package/controller/index.cjs +2 -0
  3. package/controller/index.d.ts +5 -0
  4. package/controller/index.js +2 -0
  5. package/controller/index.native.cjs +2 -0
  6. package/controller/index.native.js +2 -0
  7. package/dist/cjs/GestureDetectorWrapper.cjs +48 -0
  8. package/dist/cjs/GestureDetectorWrapper.native.js +53 -0
  9. package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -0
  10. package/dist/cjs/GestureSheetContext.cjs +52 -0
  11. package/dist/cjs/GestureSheetContext.native.js +56 -0
  12. package/dist/cjs/GestureSheetContext.native.js.map +1 -0
  13. package/dist/cjs/Sheet.cjs +117 -0
  14. package/dist/cjs/Sheet.native.js +120 -0
  15. package/dist/cjs/Sheet.native.js.map +1 -0
  16. package/dist/cjs/SheetContext.cjs +32 -0
  17. package/dist/cjs/SheetContext.native.js +35 -0
  18. package/dist/cjs/SheetContext.native.js.map +1 -0
  19. package/dist/cjs/SheetController.cjs +65 -0
  20. package/dist/cjs/SheetController.native.js +71 -0
  21. package/dist/cjs/SheetController.native.js.map +1 -0
  22. package/dist/cjs/SheetImplementationCustom.cjs +472 -0
  23. package/dist/cjs/SheetImplementationCustom.native.js +524 -0
  24. package/dist/cjs/SheetImplementationCustom.native.js.map +1 -0
  25. package/dist/cjs/SheetScrollView.cjs +180 -0
  26. package/dist/cjs/SheetScrollView.native.js +197 -0
  27. package/dist/cjs/SheetScrollView.native.js.map +1 -0
  28. package/dist/cjs/constants.cjs +32 -0
  29. package/dist/cjs/constants.native.js +35 -0
  30. package/dist/cjs/constants.native.js.map +1 -0
  31. package/dist/cjs/contexts.cjs +42 -0
  32. package/dist/cjs/contexts.native.js +45 -0
  33. package/dist/cjs/contexts.native.js.map +1 -0
  34. package/dist/cjs/controller.cjs +29 -0
  35. package/dist/cjs/controller.native.js +32 -0
  36. package/dist/cjs/controller.native.js.map +1 -0
  37. package/dist/cjs/createSheet.cjs +191 -0
  38. package/dist/cjs/createSheet.native.js +208 -0
  39. package/dist/cjs/createSheet.native.js.map +1 -0
  40. package/dist/cjs/gestureState.cjs +39 -0
  41. package/dist/cjs/gestureState.native.js +42 -0
  42. package/dist/cjs/gestureState.native.js.map +1 -0
  43. package/dist/cjs/helpers.cjs +31 -0
  44. package/dist/cjs/helpers.native.js +35 -0
  45. package/dist/cjs/helpers.native.js.map +1 -0
  46. package/dist/cjs/index.cjs +28 -0
  47. package/dist/cjs/index.native.js +31 -0
  48. package/dist/cjs/index.native.js.map +1 -0
  49. package/dist/cjs/nativeSheet.cjs +87 -0
  50. package/dist/cjs/nativeSheet.native.js +101 -0
  51. package/dist/cjs/nativeSheet.native.js.map +1 -0
  52. package/dist/cjs/setupGestureHandler.cjs +46 -0
  53. package/dist/cjs/setupGestureHandler.native.js +50 -0
  54. package/dist/cjs/setupGestureHandler.native.js.map +1 -0
  55. package/dist/cjs/types.cjs +16 -0
  56. package/dist/cjs/types.native.js +19 -0
  57. package/dist/cjs/types.native.js.map +1 -0
  58. package/dist/cjs/useGestureHandlerPan.cjs +136 -0
  59. package/dist/cjs/useGestureHandlerPan.native.js +145 -0
  60. package/dist/cjs/useGestureHandlerPan.native.js.map +1 -0
  61. package/dist/cjs/useKeyboardControllerSheet.cjs +38 -0
  62. package/dist/cjs/useKeyboardControllerSheet.native.js +114 -0
  63. package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -0
  64. package/dist/cjs/useSheet.cjs +27 -0
  65. package/dist/cjs/useSheet.native.js +32 -0
  66. package/dist/cjs/useSheet.native.js.map +1 -0
  67. package/dist/cjs/useSheetController.cjs +50 -0
  68. package/dist/cjs/useSheetController.native.js +53 -0
  69. package/dist/cjs/useSheetController.native.js.map +1 -0
  70. package/dist/cjs/useSheetOffscreenSize.cjs +51 -0
  71. package/dist/cjs/useSheetOffscreenSize.native.js +61 -0
  72. package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -0
  73. package/dist/cjs/useSheetOpenState.cjs +49 -0
  74. package/dist/cjs/useSheetOpenState.native.js +56 -0
  75. package/dist/cjs/useSheetOpenState.native.js.map +1 -0
  76. package/dist/cjs/useSheetProviderProps.cjs +133 -0
  77. package/dist/cjs/useSheetProviderProps.native.js +153 -0
  78. package/dist/cjs/useSheetProviderProps.native.js.map +1 -0
  79. package/dist/cjs/useSheetScrollViewGestures.cjs +123 -0
  80. package/dist/cjs/useSheetScrollViewGestures.native.js +110 -0
  81. package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -0
  82. package/dist/esm/GestureDetectorWrapper.mjs +25 -0
  83. package/dist/esm/GestureDetectorWrapper.mjs.map +1 -0
  84. package/dist/esm/GestureDetectorWrapper.native.js +27 -0
  85. package/dist/esm/GestureDetectorWrapper.native.js.map +1 -0
  86. package/dist/esm/GestureSheetContext.mjs +28 -0
  87. package/dist/esm/GestureSheetContext.mjs.map +1 -0
  88. package/dist/esm/GestureSheetContext.native.js +29 -0
  89. package/dist/esm/GestureSheetContext.native.js.map +1 -0
  90. package/dist/esm/Sheet.mjs +89 -0
  91. package/dist/esm/Sheet.mjs.map +1 -0
  92. package/dist/esm/Sheet.native.js +89 -0
  93. package/dist/esm/Sheet.native.js.map +1 -0
  94. package/dist/esm/SheetContext.mjs +6 -0
  95. package/dist/esm/SheetContext.mjs.map +1 -0
  96. package/dist/esm/SheetContext.native.js +6 -0
  97. package/dist/esm/SheetContext.native.js.map +1 -0
  98. package/dist/esm/SheetController.mjs +31 -0
  99. package/dist/esm/SheetController.mjs.map +1 -0
  100. package/dist/esm/SheetController.native.js +34 -0
  101. package/dist/esm/SheetController.native.js.map +1 -0
  102. package/dist/esm/SheetImplementationCustom.mjs +437 -0
  103. package/dist/esm/SheetImplementationCustom.mjs.map +1 -0
  104. package/dist/esm/SheetImplementationCustom.native.js +487 -0
  105. package/dist/esm/SheetImplementationCustom.native.js.map +1 -0
  106. package/dist/esm/SheetScrollView.mjs +146 -0
  107. package/dist/esm/SheetScrollView.mjs.map +1 -0
  108. package/dist/esm/SheetScrollView.native.js +160 -0
  109. package/dist/esm/SheetScrollView.native.js.map +1 -0
  110. package/dist/esm/constants.mjs +6 -0
  111. package/dist/esm/constants.mjs.map +1 -0
  112. package/dist/esm/constants.native.js +6 -0
  113. package/dist/esm/constants.native.js.map +1 -0
  114. package/dist/esm/contexts.mjs +7 -0
  115. package/dist/esm/contexts.mjs.map +1 -0
  116. package/dist/esm/contexts.native.js +7 -0
  117. package/dist/esm/contexts.native.js.map +1 -0
  118. package/dist/esm/controller.mjs +4 -0
  119. package/dist/esm/controller.mjs.map +1 -0
  120. package/dist/esm/controller.native.js +4 -0
  121. package/dist/esm/controller.native.js.map +1 -0
  122. package/dist/esm/createSheet.mjs +168 -0
  123. package/dist/esm/createSheet.mjs.map +1 -0
  124. package/dist/esm/createSheet.native.js +182 -0
  125. package/dist/esm/createSheet.native.js.map +1 -0
  126. package/dist/esm/gestureState.mjs +13 -0
  127. package/dist/esm/gestureState.mjs.map +1 -0
  128. package/dist/esm/gestureState.native.js +13 -0
  129. package/dist/esm/gestureState.native.js.map +1 -0
  130. package/dist/esm/helpers.mjs +8 -0
  131. package/dist/esm/helpers.mjs.map +1 -0
  132. package/dist/esm/helpers.native.js +9 -0
  133. package/dist/esm/helpers.native.js.map +1 -0
  134. package/dist/esm/index.js +12 -0
  135. package/dist/esm/index.js.map +1 -0
  136. package/dist/esm/index.mjs +12 -0
  137. package/dist/esm/index.mjs.map +1 -0
  138. package/dist/esm/index.native.js +12 -0
  139. package/dist/esm/index.native.js.map +1 -0
  140. package/dist/esm/nativeSheet.mjs +63 -0
  141. package/dist/esm/nativeSheet.mjs.map +1 -0
  142. package/dist/esm/nativeSheet.native.js +74 -0
  143. package/dist/esm/nativeSheet.native.js.map +1 -0
  144. package/dist/esm/setupGestureHandler.mjs +22 -0
  145. package/dist/esm/setupGestureHandler.mjs.map +1 -0
  146. package/dist/esm/setupGestureHandler.native.js +23 -0
  147. package/dist/esm/setupGestureHandler.native.js.map +1 -0
  148. package/dist/esm/types.mjs +2 -0
  149. package/dist/esm/types.mjs.map +1 -0
  150. package/dist/esm/types.native.js +2 -0
  151. package/dist/esm/types.native.js.map +1 -0
  152. package/dist/esm/useGestureHandlerPan.mjs +113 -0
  153. package/dist/esm/useGestureHandlerPan.mjs.map +1 -0
  154. package/dist/esm/useGestureHandlerPan.native.js +119 -0
  155. package/dist/esm/useGestureHandlerPan.native.js.map +1 -0
  156. package/dist/esm/useKeyboardControllerSheet.mjs +15 -0
  157. package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -0
  158. package/dist/esm/useKeyboardControllerSheet.native.js +88 -0
  159. package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -0
  160. package/dist/esm/useSheet.mjs +4 -0
  161. package/dist/esm/useSheet.mjs.map +1 -0
  162. package/dist/esm/useSheet.native.js +6 -0
  163. package/dist/esm/useSheet.native.js.map +1 -0
  164. package/dist/esm/useSheetController.mjs +15 -0
  165. package/dist/esm/useSheetController.mjs.map +1 -0
  166. package/dist/esm/useSheetController.native.js +15 -0
  167. package/dist/esm/useSheetController.native.js.map +1 -0
  168. package/dist/esm/useSheetOffscreenSize.mjs +28 -0
  169. package/dist/esm/useSheetOffscreenSize.mjs.map +1 -0
  170. package/dist/esm/useSheetOffscreenSize.native.js +35 -0
  171. package/dist/esm/useSheetOffscreenSize.native.js.map +1 -0
  172. package/dist/esm/useSheetOpenState.mjs +26 -0
  173. package/dist/esm/useSheetOpenState.mjs.map +1 -0
  174. package/dist/esm/useSheetOpenState.native.js +30 -0
  175. package/dist/esm/useSheetOpenState.native.js.map +1 -0
  176. package/dist/esm/useSheetProviderProps.mjs +99 -0
  177. package/dist/esm/useSheetProviderProps.mjs.map +1 -0
  178. package/dist/esm/useSheetProviderProps.native.js +116 -0
  179. package/dist/esm/useSheetProviderProps.native.js.map +1 -0
  180. package/dist/esm/useSheetScrollViewGestures.mjs +100 -0
  181. package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -0
  182. package/dist/esm/useSheetScrollViewGestures.native.js +84 -0
  183. package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -0
  184. package/dist/jsx/GestureDetectorWrapper.mjs +25 -0
  185. package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -0
  186. package/dist/jsx/GestureDetectorWrapper.native.js +53 -0
  187. package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -0
  188. package/dist/jsx/GestureSheetContext.mjs +28 -0
  189. package/dist/jsx/GestureSheetContext.mjs.map +1 -0
  190. package/dist/jsx/GestureSheetContext.native.js +56 -0
  191. package/dist/jsx/GestureSheetContext.native.js.map +1 -0
  192. package/dist/jsx/Sheet.mjs +89 -0
  193. package/dist/jsx/Sheet.mjs.map +1 -0
  194. package/dist/jsx/Sheet.native.js +120 -0
  195. package/dist/jsx/Sheet.native.js.map +1 -0
  196. package/dist/jsx/SheetContext.mjs +6 -0
  197. package/dist/jsx/SheetContext.mjs.map +1 -0
  198. package/dist/jsx/SheetContext.native.js +35 -0
  199. package/dist/jsx/SheetContext.native.js.map +1 -0
  200. package/dist/jsx/SheetController.mjs +31 -0
  201. package/dist/jsx/SheetController.mjs.map +1 -0
  202. package/dist/jsx/SheetController.native.js +71 -0
  203. package/dist/jsx/SheetController.native.js.map +1 -0
  204. package/dist/jsx/SheetImplementationCustom.mjs +437 -0
  205. package/dist/jsx/SheetImplementationCustom.mjs.map +1 -0
  206. package/dist/jsx/SheetImplementationCustom.native.js +524 -0
  207. package/dist/jsx/SheetImplementationCustom.native.js.map +1 -0
  208. package/dist/jsx/SheetScrollView.mjs +146 -0
  209. package/dist/jsx/SheetScrollView.mjs.map +1 -0
  210. package/dist/jsx/SheetScrollView.native.js +197 -0
  211. package/dist/jsx/SheetScrollView.native.js.map +1 -0
  212. package/dist/jsx/constants.mjs +6 -0
  213. package/dist/jsx/constants.mjs.map +1 -0
  214. package/dist/jsx/constants.native.js +35 -0
  215. package/dist/jsx/constants.native.js.map +1 -0
  216. package/dist/jsx/contexts.mjs +7 -0
  217. package/dist/jsx/contexts.mjs.map +1 -0
  218. package/dist/jsx/contexts.native.js +45 -0
  219. package/dist/jsx/contexts.native.js.map +1 -0
  220. package/dist/jsx/controller.mjs +4 -0
  221. package/dist/jsx/controller.mjs.map +1 -0
  222. package/dist/jsx/controller.native.js +32 -0
  223. package/dist/jsx/controller.native.js.map +1 -0
  224. package/dist/jsx/createSheet.mjs +168 -0
  225. package/dist/jsx/createSheet.mjs.map +1 -0
  226. package/dist/jsx/createSheet.native.js +208 -0
  227. package/dist/jsx/createSheet.native.js.map +1 -0
  228. package/dist/jsx/gestureState.mjs +13 -0
  229. package/dist/jsx/gestureState.mjs.map +1 -0
  230. package/dist/jsx/gestureState.native.js +42 -0
  231. package/dist/jsx/gestureState.native.js.map +1 -0
  232. package/dist/jsx/helpers.mjs +8 -0
  233. package/dist/jsx/helpers.mjs.map +1 -0
  234. package/dist/jsx/helpers.native.js +35 -0
  235. package/dist/jsx/helpers.native.js.map +1 -0
  236. package/dist/jsx/index.js +12 -0
  237. package/dist/jsx/index.js.map +1 -0
  238. package/dist/jsx/index.mjs +12 -0
  239. package/dist/jsx/index.mjs.map +1 -0
  240. package/dist/jsx/index.native.js +31 -0
  241. package/dist/jsx/index.native.js.map +1 -0
  242. package/dist/jsx/nativeSheet.mjs +63 -0
  243. package/dist/jsx/nativeSheet.mjs.map +1 -0
  244. package/dist/jsx/nativeSheet.native.js +101 -0
  245. package/dist/jsx/nativeSheet.native.js.map +1 -0
  246. package/dist/jsx/setupGestureHandler.mjs +22 -0
  247. package/dist/jsx/setupGestureHandler.mjs.map +1 -0
  248. package/dist/jsx/setupGestureHandler.native.js +50 -0
  249. package/dist/jsx/setupGestureHandler.native.js.map +1 -0
  250. package/dist/jsx/types.mjs +2 -0
  251. package/dist/jsx/types.mjs.map +1 -0
  252. package/dist/jsx/types.native.js +19 -0
  253. package/dist/jsx/types.native.js.map +1 -0
  254. package/dist/jsx/useGestureHandlerPan.mjs +113 -0
  255. package/dist/jsx/useGestureHandlerPan.mjs.map +1 -0
  256. package/dist/jsx/useGestureHandlerPan.native.js +145 -0
  257. package/dist/jsx/useGestureHandlerPan.native.js.map +1 -0
  258. package/dist/jsx/useKeyboardControllerSheet.mjs +15 -0
  259. package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -0
  260. package/dist/jsx/useKeyboardControllerSheet.native.js +114 -0
  261. package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -0
  262. package/dist/jsx/useSheet.mjs +4 -0
  263. package/dist/jsx/useSheet.mjs.map +1 -0
  264. package/dist/jsx/useSheet.native.js +32 -0
  265. package/dist/jsx/useSheet.native.js.map +1 -0
  266. package/dist/jsx/useSheetController.mjs +15 -0
  267. package/dist/jsx/useSheetController.mjs.map +1 -0
  268. package/dist/jsx/useSheetController.native.js +53 -0
  269. package/dist/jsx/useSheetController.native.js.map +1 -0
  270. package/dist/jsx/useSheetOffscreenSize.mjs +28 -0
  271. package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -0
  272. package/dist/jsx/useSheetOffscreenSize.native.js +61 -0
  273. package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -0
  274. package/dist/jsx/useSheetOpenState.mjs +26 -0
  275. package/dist/jsx/useSheetOpenState.mjs.map +1 -0
  276. package/dist/jsx/useSheetOpenState.native.js +56 -0
  277. package/dist/jsx/useSheetOpenState.native.js.map +1 -0
  278. package/dist/jsx/useSheetProviderProps.mjs +99 -0
  279. package/dist/jsx/useSheetProviderProps.mjs.map +1 -0
  280. package/dist/jsx/useSheetProviderProps.native.js +153 -0
  281. package/dist/jsx/useSheetProviderProps.native.js.map +1 -0
  282. package/dist/jsx/useSheetScrollViewGestures.mjs +100 -0
  283. package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -0
  284. package/dist/jsx/useSheetScrollViewGestures.native.js +110 -0
  285. package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -0
  286. package/next.md +78 -0
  287. package/package.json +96 -0
  288. package/setup-gesture-handler/index.cjs +2 -0
  289. package/setup-gesture-handler/index.js +2 -0
  290. package/setup-gesture-handler/index.native.cjs +2 -0
  291. package/setup-gesture-handler/index.native.js +2 -0
  292. package/setup-gesture-handler.cjs +1 -0
  293. package/src/GestureDetectorWrapper.tsx +41 -0
  294. package/src/GestureSheetContext.tsx +62 -0
  295. package/src/Sheet.tsx +114 -0
  296. package/src/SheetContext.tsx +11 -0
  297. package/src/SheetController.tsx +44 -0
  298. package/src/SheetImplementationCustom.tsx +868 -0
  299. package/src/SheetScrollView.tsx +195 -0
  300. package/src/constants.tsx +5 -0
  301. package/src/contexts.ts +9 -0
  302. package/src/controller.ts +9 -0
  303. package/src/createSheet.tsx +296 -0
  304. package/src/gestureState.ts +24 -0
  305. package/src/helpers.tsx +31 -0
  306. package/src/index.ts +11 -0
  307. package/src/nativeSheet.tsx +89 -0
  308. package/src/setupGestureHandler.ts +34 -0
  309. package/src/types.tsx +181 -0
  310. package/src/useGestureHandlerPan.tsx +364 -0
  311. package/src/useKeyboardControllerSheet.native.ts +136 -0
  312. package/src/useKeyboardControllerSheet.ts +26 -0
  313. package/src/useSheet.tsx +3 -0
  314. package/src/useSheetController.tsx +27 -0
  315. package/src/useSheetOffscreenSize.tsx +49 -0
  316. package/src/useSheetOpenState.tsx +33 -0
  317. package/src/useSheetProviderProps.tsx +223 -0
  318. package/src/useSheetScrollViewGestures.native.ts +163 -0
  319. package/src/useSheetScrollViewGestures.ts +194 -0
  320. package/tsconfig.json +56 -0
  321. package/types/GestureDetectorWrapper.d.ts +14 -0
  322. package/types/GestureSheetContext.d.ts +36 -0
  323. package/types/Sheet.d.ts +183 -0
  324. package/types/SheetContext.d.ts +43 -0
  325. package/types/SheetController.d.ts +6 -0
  326. package/types/SheetImplementationCustom.d.ts +36 -0
  327. package/types/SheetScrollView.d.ts +40 -0
  328. package/types/constants.d.ts +5 -0
  329. package/types/contexts.d.ts +6 -0
  330. package/types/controller.d.ts +3 -0
  331. package/types/createSheet.d.ts +194 -0
  332. package/types/gestureState.d.ts +11 -0
  333. package/types/helpers.d.ts +2 -0
  334. package/types/index.d.ts +12 -0
  335. package/types/nativeSheet.d.ts +10 -0
  336. package/types/setupGestureHandler.d.ts +11 -0
  337. package/types/types.d.ts +147 -0
  338. package/types/useGestureHandlerPan.d.ts +44 -0
  339. package/types/useKeyboardControllerSheet.d.ts +7 -0
  340. package/types/useKeyboardControllerSheet.native.d.ts +13 -0
  341. package/types/useSheet.d.ts +2 -0
  342. package/types/useSheetController.d.ts +17 -0
  343. package/types/useSheetOffscreenSize.d.ts +3 -0
  344. package/types/useSheetOpenState.d.ts +9 -0
  345. package/types/useSheetProviderProps.d.ts +36 -0
  346. package/types/useSheetScrollViewGestures.d.ts +12 -0
  347. package/types/useSheetScrollViewGestures.native.d.ts +21 -0
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var SheetController_exports = {};
35
+ __export(SheetController_exports, {
36
+ SheetController: () => SheetController
37
+ });
38
+ module.exports = __toCommonJS(SheetController_exports);
39
+ var import_jsx_runtime = require("react/jsx-runtime"),
40
+ import_react = __toESM(require("react"), 1),
41
+ import_gui_core = require("@hanzo/gui-core"),
42
+ import_useSheetController = require("./useSheetController.native.js"),
43
+ SheetController = function (param) {
44
+ var {
45
+ children,
46
+ onOpenChange: onOpenChangeProp,
47
+ open,
48
+ hidden,
49
+ disableDrag
50
+ } = param,
51
+ onOpenChange = (0, import_gui_core.useEvent)(onOpenChangeProp),
52
+ id = (0, import_react.useId)(),
53
+ wasHiddenRef = (0, import_react.useRef)(hidden),
54
+ skipNextAnimation = !1;
55
+ wasHiddenRef.current && !hidden && open && (skipNextAnimation = !0), wasHiddenRef.current = hidden;
56
+ var memoValue = import_react.default.useMemo(function () {
57
+ return {
58
+ id,
59
+ open,
60
+ hidden,
61
+ disableDrag,
62
+ onOpenChange,
63
+ skipNextAnimation
64
+ };
65
+ }, [id, onOpenChange, open, hidden, disableDrag, skipNextAnimation]);
66
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_useSheetController.SheetControllerContext.Provider, {
67
+ value: memoValue,
68
+ children
69
+ });
70
+ };
71
+ //# sourceMappingURL=SheetController.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","SheetController_exports","__export","SheetController","module","exports","import_jsx_runtime","require","import_react","__toESM","import_gui_core","import_useSheetController","param","children","onOpenChange","onOpenChangeProp","open","hidden","disableDrag","useEvent","id","useId","wasHiddenRef","useRef","skipNextAnimation","current","memoValue","default","useMemo","jsx","SheetControllerContext","Provider"],"sources":["../../src/SheetController.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAqC,CAAAK,uBACrC;AAMO,IAAAK,kBAAM,GAAmBC,OAAA;EAAAC,YAAA,GAAAC,OAAA,CAAAF,OAAA;EAAAG,eAAA,GAAAH,OAAA;EAAAI,yBAAA,GAAAJ,OAAA;EAAAJ,eAAA,YAAAA,CAAAS,KAAA;IAC9B;QAAAC,QAAA;QAAAC,YAAA,EAAAC,gBAAA;QAAAC,IAAA;QAAAC,MAAA;QAAAC;MAAA,IAAAN,KAAA;MAAAE,YAAA,OAAAJ,eAAA,CAAAS,QAAA,EAAAJ,gBAAA;MAAAK,EAAA,OAAAZ,YAAA,CAAAa,KAAA;MAAAC,YAAA,OAAAd,YAAA,CAAAe,MAAA,EAAAN,MAAA;MAAAO,iBAAA;IACAF,YAAA,CAAAG,OAAc,KAAAR,MAAA,IAAAD,IAAA,KAAAQ,iBAAA,QAAAF,YAAA,CAAAG,OAAA,GAAAR,MAAA;IACd,IAAAS,SAAA,GAAAlB,YAAA,CAAAmB,OAAA,CAAAC,OAAA;MACA;QACAR,EAAA;QACqEJ,IAAA;QACrEC,MAAM;QAMFC,WAAA;QACAJ,YAAa;QAKjBU;MACE;IAAO,IACLJ,EACA,EAAAN,YACA,EAAAE,IACA,EAAAC,MACA,EAAAC,WACA,EACFM,iBAAA,EACA;IACF,0BAAAlB,kBAAA,CAAAuB,GAAA,EAAAlB,yBAAA,CAAAmB,sBAAA,CAAAC,QAAA;MAEA/B,KACE,EAAA0B,SAAA;MAIJb","ignoreList":[]}
@@ -0,0 +1,472 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var SheetImplementationCustom_exports = {};
33
+ __export(SheetImplementationCustom_exports, {
34
+ SheetImplementationCustom: () => SheetImplementationCustom
35
+ });
36
+ module.exports = __toCommonJS(SheetImplementationCustom_exports);
37
+ var import_gui_adapt = require("@hanzo/gui-adapt"),
38
+ import_gui_animate_presence = require("@hanzo/gui-animate-presence"),
39
+ import_gui_compose_refs = require("@hanzo/gui-compose-refs"),
40
+ import_gui_constants = require("@hanzo/gui-constants"),
41
+ import_gui_core = require("@hanzo/gui-core"),
42
+ import_gui_native = require("@hanzo/gui-native"),
43
+ import_gui_portal = require("@hanzo/gui-portal"),
44
+ import_react = __toESM(require("react"), 1),
45
+ import_react_native = require("react-native-web"),
46
+ import_contexts = require("./contexts.cjs"),
47
+ import_GestureDetectorWrapper = require("./GestureDetectorWrapper.cjs"),
48
+ import_GestureSheetContext = require("./GestureSheetContext.cjs"),
49
+ import_helpers = require("./helpers.cjs"),
50
+ import_SheetContext = require("./SheetContext.cjs"),
51
+ import_useGestureHandlerPan = require("./useGestureHandlerPan.cjs"),
52
+ import_useKeyboardControllerSheet = require("./useKeyboardControllerSheet.cjs"),
53
+ import_useSheetOpenState = require("./useSheetOpenState.cjs"),
54
+ import_useSheetProviderProps = require("./useSheetProviderProps.cjs"),
55
+ import_jsx_runtime = require("react/jsx-runtime");
56
+ const hiddenSize = 10000.1;
57
+ let _cachedSafeAreaTop;
58
+ function getSafeAreaTopInset() {
59
+ return _cachedSafeAreaTop !== void 0 || (_cachedSafeAreaTop = (0, import_gui_native.getSafeArea)().getInsets().top), _cachedSafeAreaTop;
60
+ }
61
+ let sheetHiddenStyleSheet = null;
62
+ const relativeDimensionTo = import_gui_constants.isWeb ? "window" : "screen",
63
+ SheetImplementationCustom = import_react.default.forwardRef(function (props, forwardedRef) {
64
+ const parentSheet = import_react.default.useContext(import_contexts.ParentSheetContext),
65
+ {
66
+ transition,
67
+ transitionConfig: transitionConfigProp,
68
+ modal = !1,
69
+ zIndex = parentSheet.zIndex + 1,
70
+ moveOnKeyboardChange = !1,
71
+ unmountChildrenWhenHidden = !1,
72
+ portalProps,
73
+ containerComponent: ContainerComponent = import_react.default.Fragment,
74
+ onAnimationComplete
75
+ } = props,
76
+ state = (0, import_useSheetOpenState.useSheetOpenState)(props),
77
+ [overlayComponent, setOverlayComponent] = import_react.default.useState(null),
78
+ providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state, {
79
+ onOverlayComponent: setOverlayComponent
80
+ }),
81
+ {
82
+ frameSize,
83
+ setFrameSize,
84
+ snapPoints,
85
+ snapPointsMode,
86
+ hasFit,
87
+ position,
88
+ setPosition,
89
+ scrollBridge,
90
+ screenSize,
91
+ setMaxContentSize,
92
+ maxSnapPoint
93
+ } = providerProps,
94
+ {
95
+ open,
96
+ controller,
97
+ isHidden
98
+ } = state,
99
+ openRef = import_react.default.useRef(open);
100
+ openRef.current = open;
101
+ const sheetRef = import_react.default.useRef(void 0),
102
+ ref = (0, import_gui_compose_refs.useComposedRefs)(forwardedRef, sheetRef, providerProps.contentRef),
103
+ {
104
+ animationDriver
105
+ } = (0, import_gui_core.useConfiguration)();
106
+ if (!animationDriver) throw new Error("Sheet requires an animation driver to be set");
107
+ const transitionConfig = (() => {
108
+ if (transitionConfigProp) return transitionConfigProp;
109
+ const [animationProp, animationPropConfig] = transition ? Array.isArray(transition) ? transition : [transition] : [];
110
+ return animationProp && animationDriver.animations?.[animationProp] ? {
111
+ ...animationDriver.animations[animationProp],
112
+ ...animationPropConfig
113
+ } : null;
114
+ })(),
115
+ [isShowingInnerSheet, setIsShowingInnerSheet] = import_react.default.useState(!1),
116
+ shouldHideParentSheet = !import_gui_constants.isWeb && modal && isShowingInnerSheet && (0, import_gui_portal.needsPortalRepropagation)(),
117
+ sheetInsideSheet = import_react.default.useContext(import_contexts.SheetInsideSheetContext),
118
+ onInnerSheet = import_react.default.useCallback(hasChild => {
119
+ setIsShowingInnerSheet(hasChild);
120
+ }, []),
121
+ stableFrameSize = import_react.default.useRef(frameSize);
122
+ import_react.default.useEffect(() => {
123
+ open && frameSize && (stableFrameSize.current = frameSize);
124
+ }, [open, frameSize]);
125
+ const effectiveFrameSize = open ? frameSize : stableFrameSize.current || frameSize,
126
+ positions = import_react.default.useMemo(() => snapPoints.map(point => getYPositions(snapPointsMode, point, screenSize, effectiveFrameSize)), [screenSize, effectiveFrameSize, snapPoints, snapPointsMode]),
127
+ {
128
+ keyboardHeight,
129
+ isKeyboardVisible,
130
+ dismissKeyboard,
131
+ pauseKeyboardHandler,
132
+ flushPendingHide
133
+ } = (0, import_useKeyboardControllerSheet.useKeyboardControllerSheet)({
134
+ enabled: !import_gui_constants.isWeb && !!moveOnKeyboardChange
135
+ }),
136
+ [isDragging, setIsDragging_] = import_react.default.useState(!1),
137
+ isDraggingRef = import_react.default.useRef(!1),
138
+ setIsDragging = import_react.default.useCallback(val => {
139
+ isDraggingRef.current = val, pauseKeyboardHandler.current = val, setIsDragging_(val), val || flushPendingHide();
140
+ }, [pauseKeyboardHandler, flushPendingHide]),
141
+ activePositionsRef = import_react.default.useRef(positions),
142
+ activePositions = import_react.default.useMemo(() => {
143
+ if (isDragging || isDraggingRef.current) return activePositionsRef.current;
144
+ let result;
145
+ if (!isKeyboardVisible || keyboardHeight <= 0) result = positions;else {
146
+ const safeAreaTop = import_gui_constants.isWeb ? 0 : getSafeAreaTopInset();
147
+ result = positions.map(p => screenSize && p >= screenSize ? p : Math.max(safeAreaTop, p - keyboardHeight));
148
+ }
149
+ return activePositionsRef.current = result, result;
150
+ }, [positions, isKeyboardVisible, keyboardHeight, screenSize, isDragging]),
151
+ {
152
+ useAnimatedNumber,
153
+ useAnimatedNumberStyle,
154
+ useAnimatedNumberReaction
155
+ } = animationDriver,
156
+ AnimatedView = animationDriver.View ?? import_gui_core.View;
157
+ (0, import_gui_constants.useIsomorphicLayoutEffect)(() => {
158
+ if (sheetInsideSheet && open) return sheetInsideSheet(!0), () => {
159
+ sheetInsideSheet(!1);
160
+ };
161
+ }, [sheetInsideSheet, open]);
162
+ const nextParentContext = import_react.default.useMemo(() => ({
163
+ zIndex
164
+ }), [zIndex]),
165
+ startPosition = (0, import_gui_core.useDidFinishSSR)() && screenSize ? screenSize : hiddenSize,
166
+ animatedNumber = useAnimatedNumber(startPosition),
167
+ at = import_react.default.useRef(startPosition),
168
+ hasntMeasured = at.current === hiddenSize,
169
+ [disableAnimation, setDisableAnimation] = (0, import_react.useState)(hasntMeasured),
170
+ skipAdaptAnimation = import_react.default.useRef(!1);
171
+ controller?.skipNextAnimation && (skipAdaptAnimation.current = !0);
172
+ const hasScrollView = import_react.default.useRef(!1),
173
+ opacityFallbackTimer = import_react.default.useRef(null);
174
+ useAnimatedNumberReaction({
175
+ value: animatedNumber,
176
+ hostRef: sheetRef
177
+ }, import_react.default.useCallback(value => {
178
+ at.current = value, scrollBridge.paneY = value;
179
+ const minY = activePositions[0],
180
+ wasAtTop = scrollBridge.isAtTop,
181
+ nowAtTop = value <= minY + 5;
182
+ wasAtTop !== nowAtTop && (scrollBridge.isAtTop = nowAtTop, nowAtTop ? (scrollBridge.y > 0 && (scrollBridge.forceScrollTo?.(0), scrollBridge.y = 0), scrollBridge.scrollLockY = void 0, scrollBridge.setScrollEnabled?.(!0)) : (scrollBridge.scrollLockY = 0, scrollBridge.setScrollEnabled?.(!1)));
183
+ }, [animationDriver, activePositions]));
184
+ function stopSpring() {
185
+ animatedNumber.stop(), scrollBridge.onFinishAnimate && (scrollBridge.onFinishAnimate(), scrollBridge.onFinishAnimate = void 0);
186
+ }
187
+ const animateTo = (0, import_gui_core.useEvent)((position2, animationOverride) => {
188
+ if (frameSize === 0) return;
189
+ let toValue = isHidden || position2 === -1 ? screenSize : activePositions[position2];
190
+ if (at.current === toValue) return;
191
+ at.current = toValue, stopSpring();
192
+ const isOpenAnimation = position2 !== -1 && !isHidden;
193
+ opacityFallbackTimer.current && (clearTimeout(opacityFallbackTimer.current), opacityFallbackTimer.current = null);
194
+ const animationCompleteCallback = () => {
195
+ opacityFallbackTimer.current && (clearTimeout(opacityFallbackTimer.current), opacityFallbackTimer.current = null), !isOpenAnimation && !open && setOpacity(0), onAnimationComplete?.({
196
+ open: isOpenAnimation
197
+ });
198
+ };
199
+ if (isOpenAnimation || (opacityFallbackTimer.current = setTimeout(() => {
200
+ opacityFallbackTimer.current = null, openRef.current || setOpacity(0);
201
+ }, 1e3)), skipAdaptAnimation.current) {
202
+ skipAdaptAnimation.current = !1, animatedNumber.setValue(toValue, {
203
+ type: "timing",
204
+ duration: 0
205
+ }, animationCompleteCallback);
206
+ return;
207
+ }
208
+ animatedNumber.setValue(toValue, animationOverride || {
209
+ type: "spring",
210
+ ...transitionConfig
211
+ }, animationCompleteCallback);
212
+ });
213
+ (0, import_gui_constants.useIsomorphicLayoutEffect)(() => {
214
+ if (hasntMeasured && screenSize && frameSize) {
215
+ at.current = screenSize, animatedNumber.setValue(screenSize, {
216
+ type: "timing",
217
+ duration: 0
218
+ }, () => {
219
+ setTimeout(() => {
220
+ setDisableAnimation(!1);
221
+ }, 10);
222
+ });
223
+ return;
224
+ }
225
+ if (!disableAnimation && !(!frameSize || !screenSize || isHidden || hasntMeasured && !open) && (animateTo(position), position === -1 && (scrollBridge.scrollLock = !1, scrollBridge.scrollStartY = -1), open && position >= 0)) {
226
+ const isTopPosition = position === 0;
227
+ scrollBridge.isAtTop = isTopPosition, isTopPosition ? (scrollBridge.scrollLockY = void 0, scrollBridge.setScrollEnabled?.(!0)) : (scrollBridge.scrollLockY = 0, scrollBridge.setScrollEnabled?.(!1));
228
+ }
229
+ }, [hasntMeasured, disableAnimation, isHidden, frameSize, screenSize, open, position]);
230
+ const disableDrag = props.disableDrag ?? controller?.disableDrag,
231
+ themeName = (0, import_gui_core.useThemeName)(),
232
+ [blockPan, setBlockPan] = import_react.default.useState(!1),
233
+ panResponder = import_react.default.useMemo(() => {
234
+ if (disableDrag || !frameSize || isShowingInnerSheet) return;
235
+ const minY = positions[0];
236
+ scrollBridge.paneMinY = minY;
237
+ let startY = at.current;
238
+ function setPanning(val) {
239
+ setIsDragging(val), sheetHiddenStyleSheet || (sheetHiddenStyleSheet = document.createElement("style"), typeof document.head < "u" && document.head.appendChild(sheetHiddenStyleSheet)), val ? sheetHiddenStyleSheet.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }" : sheetHiddenStyleSheet.innerText = "";
240
+ }
241
+ const release = ({
242
+ vy
243
+ }) => {
244
+ if (scrollBridge.setParentDragging(!1), scrollBridge.scrollLock) return;
245
+ isExternalDrag = !1, previouslyScrolling = !1, setPanning(!1);
246
+ const end = at.current + frameSize * vy * 0.2;
247
+ let closestPoint = 0,
248
+ dist = Number.POSITIVE_INFINITY;
249
+ for (let i = 0; i < positions.length; i++) {
250
+ const position2 = positions[i],
251
+ curDist = end > position2 ? end - position2 : position2 - end;
252
+ curDist < dist && (dist = curDist, closestPoint = i);
253
+ }
254
+ setPosition(closestPoint), animateTo(closestPoint);
255
+ },
256
+ finish = (_e, state2) => {
257
+ release({
258
+ vy: state2.vy,
259
+ dragAt: state2.dy
260
+ });
261
+ };
262
+ let previouslyScrolling = !1;
263
+ const onMoveShouldSet = (e, {
264
+ dy
265
+ }) => {
266
+ function getShouldSet() {
267
+ if (e.target === providerProps.handleRef.current) return !0;
268
+ if (scrollBridge.hasScrollableContent === !0) {
269
+ if (scrollBridge.scrollLock) return !1;
270
+ const isScrolled = scrollBridge.y !== 0,
271
+ isDraggingUp = dy < 0,
272
+ isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
273
+ if (isScrolled) return previouslyScrolling = !0, !1;
274
+ if (isNearTop && hasScrollView.current && isDraggingUp) return !1;
275
+ }
276
+ return Math.abs(dy) > 10;
277
+ }
278
+ const granted = getShouldSet();
279
+ return granted && scrollBridge.setParentDragging(!0), granted;
280
+ },
281
+ grant = () => {
282
+ setPanning(!0), stopSpring(), startY = at.current;
283
+ };
284
+ let isExternalDrag = !1;
285
+ return scrollBridge.drag = dy => {
286
+ isExternalDrag || (isExternalDrag = !0, grant());
287
+ const to = dy + startY;
288
+ animatedNumber.setValue((0, import_helpers.resisted)(to, minY), {
289
+ type: "direct"
290
+ });
291
+ }, scrollBridge.release = release, scrollBridge.snapToPosition = positionIndex => {
292
+ isExternalDrag = !1, previouslyScrolling = !1, setPanning(!1), setPosition(positionIndex), animateTo(positionIndex);
293
+ }, import_react_native.PanResponder.create({
294
+ onMoveShouldSetPanResponder: onMoveShouldSet,
295
+ onPanResponderGrant: grant,
296
+ onPanResponderMove: (_e, {
297
+ dy
298
+ }) => {
299
+ const toFull = dy + startY,
300
+ to = (0, import_helpers.resisted)(toFull, minY);
301
+ to <= minY ? scrollBridge.setParentDragging(!1) : scrollBridge.setParentDragging(!0), animatedNumber.setValue(to, {
302
+ type: "direct"
303
+ });
304
+ },
305
+ onPanResponderEnd: finish,
306
+ onPanResponderTerminate: finish,
307
+ onPanResponderRelease: finish
308
+ });
309
+ }, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]);
310
+ import_react.default.useEffect(() => {
311
+ isDragging || isHidden || !open || disableAnimation || !frameSize || !screenSize || animateTo(position, {
312
+ type: "timing",
313
+ duration: 250
314
+ });
315
+ }, [isKeyboardVisible, keyboardHeight]);
316
+ const wasDragging = import_react.default.useRef(!1);
317
+ import_react.default.useEffect(() => {
318
+ if (isDragging) {
319
+ wasDragging.current = !0;
320
+ return;
321
+ }
322
+ wasDragging.current && (wasDragging.current = !1, !(!frameSize || !screenSize || isHidden || !open) && animateTo(position));
323
+ }, [isDragging]), import_react.default.useEffect(() => {
324
+ !open && isKeyboardVisible && dismissKeyboard();
325
+ }, [open]);
326
+ const {
327
+ panGesture,
328
+ panGestureRef,
329
+ gestureHandlerEnabled
330
+ } = (0, import_useGestureHandlerPan.useGestureHandlerPan)({
331
+ positions: activePositions,
332
+ frameSize,
333
+ setPosition,
334
+ animateTo,
335
+ stopSpring,
336
+ scrollBridge,
337
+ setIsDragging,
338
+ getCurrentPosition: () => at.current,
339
+ resisted: import_helpers.resisted,
340
+ disableDrag,
341
+ isShowingInnerSheet,
342
+ setAnimatedPosition: val => {
343
+ at.current = val, animatedNumber.setValue(val, {
344
+ type: "direct"
345
+ });
346
+ },
347
+ pauseKeyboardHandler
348
+ }),
349
+ handleAnimationViewLayout = (0, import_gui_core.useEvent)(e => {
350
+ if (!open && stableFrameSize.current !== 0) return;
351
+ const layoutHeight = e.nativeEvent?.layout.height,
352
+ next = modal ? Math.min(layoutHeight, import_react_native.Dimensions.get(relativeDimensionTo).height) : layoutHeight;
353
+ next && setFrameSize(next);
354
+ }),
355
+ handleMaxContentViewLayout = import_react.default.useCallback(e => {
356
+ const next = Math.min(e.nativeEvent?.layout.height, import_react_native.Dimensions.get(relativeDimensionTo).height);
357
+ next && setMaxContentSize(next);
358
+ }, []),
359
+ animatedStyle = useAnimatedNumberStyle(animatedNumber, val => {
360
+ "worklet";
361
+
362
+ return {
363
+ transform: [{
364
+ translateY: frameSize === 0 ? hiddenSize : val
365
+ }]
366
+ };
367
+ }),
368
+ [opacity, setOpacity] = import_react.default.useState(open ? 1 : 0);
369
+ open && opacity === 0 && (setOpacity(1), opacityFallbackTimer.current && (clearTimeout(opacityFallbackTimer.current), opacityFallbackTimer.current = null));
370
+ const forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ?
371
+ // Use dvh for modal (viewport-relative), % for inline (container-relative)
372
+ `${maxSnapPoint}${import_gui_constants.isWeb && modal ? "dvh" : "%"}` : maxSnapPoint,
373
+ setHasScrollView = import_react.default.useCallback(val => {
374
+ hasScrollView.current = val;
375
+ }, []);
376
+ let contents = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_core.LayoutMeasurementController, {
377
+ disable: !open,
378
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_contexts.ParentSheetContext.Provider, {
379
+ value: nextParentContext,
380
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_SheetContext.SheetProvider, {
381
+ ...providerProps,
382
+ setHasScrollView,
383
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_GestureSheetContext.GestureSheetProvider, {
384
+ isDragging,
385
+ blockPan,
386
+ setBlockPan,
387
+ panGesture,
388
+ panGestureRef,
389
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_animate_presence.AnimatePresence, {
390
+ custom: {
391
+ open
392
+ },
393
+ children: shouldHideParentSheet || !open ? null : overlayComponent
394
+ }), snapPointsMode !== "percent" && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
395
+ style: {
396
+ opacity: 0,
397
+ position: "absolute",
398
+ top: 0,
399
+ left: 0,
400
+ right: 0,
401
+ bottom: 0,
402
+ pointerEvents: "none"
403
+ },
404
+ onLayout: handleMaxContentViewLayout
405
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(AnimatedView, {
406
+ ref,
407
+ onLayout: handleAnimationViewLayout,
408
+ transition: isDragging || disableAnimation ? null : transition,
409
+ disableClassName: !0,
410
+ style: [{
411
+ position: "absolute",
412
+ zIndex,
413
+ width: "100%",
414
+ height: forcedContentHeight,
415
+ minHeight: forcedContentHeight,
416
+ opacity: shouldHideParentSheet ? 0 : opacity,
417
+ ...((shouldHideParentSheet || !open) && {
418
+ pointerEvents: "none"
419
+ })
420
+ }, animatedStyle],
421
+ children: gestureHandlerEnabled && panGesture ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GestureDetectorWrapper.GestureDetectorWrapper, {
422
+ gesture: panGesture,
423
+ style: {
424
+ flex: 1
425
+ },
426
+ children: props.children
427
+ }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_native.View, {
428
+ ...panResponder?.panHandlers,
429
+ style: {
430
+ flex: 1,
431
+ width: "100%",
432
+ height: "100%"
433
+ },
434
+ children: props.children
435
+ })
436
+ })]
437
+ })
438
+ })
439
+ })
440
+ });
441
+ const shouldMountChildren = unmountChildrenWhenHidden ? !!opacity : !0;
442
+ if (modal) {
443
+ const modalContents = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_portal.Portal, {
444
+ stackZIndex: zIndex,
445
+ ...portalProps,
446
+ children: shouldMountChildren && /* @__PURE__ */(0, import_jsx_runtime.jsx)(ContainerComponent, {
447
+ children: contents
448
+ })
449
+ });
450
+ return import_gui_constants.isWeb ? modalContents : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_contexts.SheetInsideSheetContext.Provider, {
451
+ value: onInnerSheet,
452
+ children: modalContents
453
+ });
454
+ }
455
+ return contents;
456
+ });
457
+ function getYPositions(mode, point, screenSize, frameSize) {
458
+ if (!screenSize || !frameSize) return 0;
459
+ if (mode === "mixed") {
460
+ if (typeof point == "number") return screenSize - Math.min(screenSize, Math.max(0, point));
461
+ if (point === "fit") return screenSize - Math.min(screenSize, frameSize);
462
+ if (point.endsWith("%")) {
463
+ const pct2 = Math.min(100, Math.max(0, Number(point.slice(0, -1)))) / 100;
464
+ return Number.isNaN(pct2) ? (console.warn("Invalid snapPoint percentage string"), 0) : Math.round(screenSize - pct2 * screenSize);
465
+ }
466
+ return console.warn("Invalid snapPoint unknown value"), 0;
467
+ }
468
+ if (mode === "fit") return point === 0 ? screenSize : screenSize - Math.min(screenSize, frameSize);
469
+ if (mode === "constant" && typeof point == "number") return screenSize - Math.min(screenSize, Math.max(0, point));
470
+ const pct = Math.min(100, Math.max(0, Number(point))) / 100;
471
+ return Number.isNaN(pct) ? (console.warn("Invalid snapPoint percentage"), 0) : Math.round(screenSize - pct * screenSize);
472
+ }