@bigbinary/neeto-atoms 1.0.6 → 1.0.7

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 (501) hide show
  1. package/dist/DataTable-Y4POx0WN.js +3737 -0
  2. package/dist/DataTable-Y4POx0WN.js.map +1 -0
  3. package/dist/button-COIbN8dg.js +40 -0
  4. package/dist/button-COIbN8dg.js.map +1 -0
  5. package/dist/check-Cpkv29p1.js +15 -0
  6. package/dist/check-Cpkv29p1.js.map +1 -0
  7. package/dist/chevron-down-BNi0ntys.js +15 -0
  8. package/dist/chevron-down-BNi0ntys.js.map +1 -0
  9. package/dist/chevron-left-BDoT8E2-.js +15 -0
  10. package/dist/chevron-left-BDoT8E2-.js.map +1 -0
  11. package/dist/chevron-right-DQnrO-ek.js +15 -0
  12. package/dist/chevron-right-DQnrO-ek.js.map +1 -0
  13. package/dist/chevron-up-Bf2G3AAU.js +15 -0
  14. package/dist/chevron-up-Bf2G3AAU.js.map +1 -0
  15. package/dist/cjs/DataTable-DJw2SZ7b.js +3764 -0
  16. package/dist/cjs/DataTable-DJw2SZ7b.js.map +1 -0
  17. package/dist/cjs/button-B8XGl69v.js +63 -0
  18. package/dist/cjs/button-B8XGl69v.js.map +1 -0
  19. package/dist/cjs/check-BQgcDXys.js +17 -0
  20. package/dist/cjs/check-BQgcDXys.js.map +1 -0
  21. package/dist/cjs/chevron-down-CPsWSS51.js +17 -0
  22. package/dist/cjs/chevron-down-CPsWSS51.js.map +1 -0
  23. package/dist/cjs/chevron-left-BldoOh5p.js +17 -0
  24. package/dist/cjs/chevron-left-BldoOh5p.js.map +1 -0
  25. package/dist/cjs/chevron-right-0jNdwX2Q.js +17 -0
  26. package/dist/cjs/chevron-right-0jNdwX2Q.js.map +1 -0
  27. package/dist/cjs/chevron-up-BpwpBnZU.js +17 -0
  28. package/dist/cjs/chevron-up-BpwpBnZU.js.map +1 -0
  29. package/dist/cjs/components/DataTable.js +53 -0
  30. package/dist/cjs/components/DataTable.js.map +1 -0
  31. package/dist/cjs/createLucideIcon-D0tRgV6l.js +149 -0
  32. package/dist/cjs/createLucideIcon-D0tRgV6l.js.map +1 -0
  33. package/dist/cjs/dialog-DzNWLbJ6.js +50 -0
  34. package/dist/cjs/dialog-DzNWLbJ6.js.map +1 -0
  35. package/dist/cjs/ellipsis-4aubOI2n.js +21 -0
  36. package/dist/cjs/ellipsis-4aubOI2n.js.map +1 -0
  37. package/dist/cjs/floating-ui.react-dom-B4Aw6O7R.js +2293 -0
  38. package/dist/cjs/floating-ui.react-dom-B4Aw6O7R.js.map +1 -0
  39. package/dist/cjs/index-9jC1advf.js +34 -0
  40. package/dist/cjs/index-9jC1advf.js.map +1 -0
  41. package/dist/cjs/index-BZhTddX0.js +47 -0
  42. package/dist/cjs/index-BZhTddX0.js.map +1 -0
  43. package/dist/cjs/index-Bf0WsHta.js +63 -0
  44. package/dist/cjs/index-Bf0WsHta.js.map +1 -0
  45. package/dist/cjs/index-BqCr1H3u.js +173 -0
  46. package/dist/cjs/index-BqCr1H3u.js.map +1 -0
  47. package/dist/cjs/index-BrpkRQoS.js +99 -0
  48. package/dist/cjs/index-BrpkRQoS.js.map +1 -0
  49. package/dist/cjs/index-Bvu9MiFi.js +247 -0
  50. package/dist/cjs/index-Bvu9MiFi.js.map +1 -0
  51. package/dist/cjs/index-BwAq9ba8.js +38 -0
  52. package/dist/cjs/index-BwAq9ba8.js.map +1 -0
  53. package/dist/cjs/index-C9ICrOhM.js +328 -0
  54. package/dist/cjs/index-C9ICrOhM.js.map +1 -0
  55. package/dist/cjs/index-CB9xFokC.js +59 -0
  56. package/dist/cjs/index-CB9xFokC.js.map +1 -0
  57. package/dist/cjs/index-CCdG4z4E.js +30 -0
  58. package/dist/cjs/index-CCdG4z4E.js.map +1 -0
  59. package/dist/cjs/index-CF951Pw9.js +38 -0
  60. package/dist/cjs/index-CF951Pw9.js.map +1 -0
  61. package/dist/cjs/index-CGUGhyIp.js +103 -0
  62. package/dist/cjs/index-CGUGhyIp.js.map +1 -0
  63. package/dist/cjs/index-CGet1HH4.js +953 -0
  64. package/dist/cjs/index-CGet1HH4.js.map +1 -0
  65. package/dist/cjs/index-COPkC3I5.js +14 -0
  66. package/dist/cjs/index-COPkC3I5.js.map +1 -0
  67. package/dist/cjs/index-Ch55j1or.js +176 -0
  68. package/dist/cjs/index-Ch55j1or.js.map +1 -0
  69. package/dist/cjs/index-ChSOMM8b.js +1153 -0
  70. package/dist/cjs/index-ChSOMM8b.js.map +1 -0
  71. package/dist/cjs/index-CyrAgb4H.js +93 -0
  72. package/dist/cjs/index-CyrAgb4H.js.map +1 -0
  73. package/dist/cjs/index-D-iDn9RI.js +63 -0
  74. package/dist/cjs/index-D-iDn9RI.js.map +1 -0
  75. package/dist/cjs/index-DAds6mf_.js +433 -0
  76. package/dist/cjs/index-DAds6mf_.js.map +1 -0
  77. package/dist/cjs/index-DMbj7vXd.js +152 -0
  78. package/dist/cjs/index-DMbj7vXd.js.map +1 -0
  79. package/dist/cjs/index-DR7GJU4J.js +248 -0
  80. package/dist/cjs/index-DR7GJU4J.js.map +1 -0
  81. package/dist/cjs/index-DcCSSgb7.js +153 -0
  82. package/dist/cjs/index-DcCSSgb7.js.map +1 -0
  83. package/dist/cjs/index-Df-Ffa3s.js +43 -0
  84. package/dist/cjs/index-Df-Ffa3s.js.map +1 -0
  85. package/dist/cjs/index-DnKJmaCq.js +8 -0
  86. package/dist/cjs/index-DnKJmaCq.js.map +1 -0
  87. package/dist/cjs/index-DuNgWCXZ.js +113 -0
  88. package/dist/cjs/index-DuNgWCXZ.js.map +1 -0
  89. package/dist/cjs/index-EyWRfsCG.js +9 -0
  90. package/dist/cjs/index-EyWRfsCG.js.map +1 -0
  91. package/dist/cjs/index-lWVw05cs.js +35 -0
  92. package/dist/cjs/index-lWVw05cs.js.map +1 -0
  93. package/dist/cjs/index.js +53 -66844
  94. package/dist/cjs/index.js.map +1 -1
  95. package/dist/cjs/input-CgKPISj_.js +11 -0
  96. package/dist/cjs/input-CgKPISj_.js.map +1 -0
  97. package/dist/cjs/input-group-DoK0-4fL.js +66 -0
  98. package/dist/cjs/input-group-DoK0-4fL.js.map +1 -0
  99. package/dist/cjs/label-Bdc9ytTI.js +52 -0
  100. package/dist/cjs/label-Bdc9ytTI.js.map +1 -0
  101. package/dist/cjs/loader-circle-Bw7zP2Gn.js +17 -0
  102. package/dist/cjs/loader-circle-Bw7zP2Gn.js.map +1 -0
  103. package/dist/cjs/primitives/Accordion.js +340 -0
  104. package/dist/cjs/primitives/Accordion.js.map +1 -0
  105. package/dist/cjs/primitives/Alert.js +40 -0
  106. package/dist/cjs/primitives/Alert.js.map +1 -0
  107. package/dist/cjs/primitives/AlertDialog.js +256 -0
  108. package/dist/cjs/primitives/AlertDialog.js.map +1 -0
  109. package/dist/cjs/primitives/AspectRatio.js +75 -0
  110. package/dist/cjs/primitives/AspectRatio.js.map +1 -0
  111. package/dist/cjs/primitives/Avatar.js +189 -0
  112. package/dist/cjs/primitives/Avatar.js.map +1 -0
  113. package/dist/cjs/primitives/Badge.js +34 -0
  114. package/dist/cjs/primitives/Badge.js.map +1 -0
  115. package/dist/cjs/primitives/Breadcrumb.js +50 -0
  116. package/dist/cjs/primitives/Breadcrumb.js.map +1 -0
  117. package/dist/cjs/primitives/Button.js +16 -0
  118. package/dist/cjs/primitives/Button.js.map +1 -0
  119. package/dist/cjs/primitives/ButtonGroup.js +43 -0
  120. package/dist/cjs/primitives/ButtonGroup.js.map +1 -0
  121. package/dist/cjs/primitives/Calendar.js +8030 -0
  122. package/dist/cjs/primitives/Calendar.js.map +1 -0
  123. package/dist/cjs/primitives/Card.js +43 -0
  124. package/dist/cjs/primitives/Card.js.map +1 -0
  125. package/dist/cjs/primitives/Carousel.js +1867 -0
  126. package/dist/cjs/primitives/Carousel.js.map +1 -0
  127. package/dist/cjs/primitives/Chart.js +18787 -0
  128. package/dist/cjs/primitives/Chart.js.map +1 -0
  129. package/dist/cjs/primitives/Checkbox.js +304 -0
  130. package/dist/cjs/primitives/Checkbox.js.map +1 -0
  131. package/dist/cjs/primitives/Collapsible.js +33 -0
  132. package/dist/cjs/primitives/Collapsible.js.map +1 -0
  133. package/dist/cjs/primitives/Combobox.js +10288 -0
  134. package/dist/cjs/primitives/Combobox.js.map +1 -0
  135. package/dist/cjs/primitives/Command.js +248 -0
  136. package/dist/cjs/primitives/Command.js.map +1 -0
  137. package/dist/cjs/primitives/ContextMenu.js +404 -0
  138. package/dist/cjs/primitives/ContextMenu.js.map +1 -0
  139. package/dist/cjs/primitives/Dialog.js +48 -0
  140. package/dist/cjs/primitives/Dialog.js.map +1 -0
  141. package/dist/cjs/primitives/Drawer.js +1715 -0
  142. package/dist/cjs/primitives/Drawer.js.map +1 -0
  143. package/dist/cjs/primitives/DropdownMenu.js +383 -0
  144. package/dist/cjs/primitives/DropdownMenu.js.map +1 -0
  145. package/dist/cjs/primitives/Empty.js +50 -0
  146. package/dist/cjs/primitives/Empty.js.map +1 -0
  147. package/dist/cjs/primitives/Field.js +95 -0
  148. package/dist/cjs/primitives/Field.js.map +1 -0
  149. package/dist/cjs/primitives/HoverCard.js +291 -0
  150. package/dist/cjs/primitives/HoverCard.js.map +1 -0
  151. package/dist/cjs/primitives/Input.js +10 -0
  152. package/dist/cjs/primitives/Input.js.map +1 -0
  153. package/dist/cjs/primitives/InputGroup.js +27 -0
  154. package/dist/cjs/primitives/InputGroup.js.map +1 -0
  155. package/dist/cjs/primitives/InputOTP.js +84 -0
  156. package/dist/cjs/primitives/InputOTP.js.map +1 -0
  157. package/dist/cjs/primitives/Item.js +96 -0
  158. package/dist/cjs/primitives/Item.js.map +1 -0
  159. package/dist/cjs/primitives/Kbd.js +18 -0
  160. package/dist/cjs/primitives/Kbd.js.map +1 -0
  161. package/dist/cjs/primitives/Label.js +14 -0
  162. package/dist/cjs/primitives/Label.js.map +1 -0
  163. package/dist/cjs/primitives/Menubar.js +547 -0
  164. package/dist/cjs/primitives/Menubar.js.map +1 -0
  165. package/dist/cjs/primitives/NativeSelect.js +26 -0
  166. package/dist/cjs/primitives/NativeSelect.js.map +1 -0
  167. package/dist/cjs/primitives/NavigationMenu.js +856 -0
  168. package/dist/cjs/primitives/NavigationMenu.js.map +1 -0
  169. package/dist/cjs/primitives/Pagination.js +52 -0
  170. package/dist/cjs/primitives/Pagination.js.map +1 -0
  171. package/dist/cjs/primitives/Popover.js +444 -0
  172. package/dist/cjs/primitives/Popover.js.map +1 -0
  173. package/dist/cjs/primitives/Progress.js +125 -0
  174. package/dist/cjs/primitives/Progress.js.map +1 -0
  175. package/dist/cjs/primitives/RadioGroup.js +322 -0
  176. package/dist/cjs/primitives/RadioGroup.js.map +1 -0
  177. package/dist/cjs/primitives/Resizable.js +2051 -0
  178. package/dist/cjs/primitives/Resizable.js.map +1 -0
  179. package/dist/cjs/primitives/ScrollArea.js +754 -0
  180. package/dist/cjs/primitives/ScrollArea.js.map +1 -0
  181. package/dist/cjs/primitives/Select.js +1318 -0
  182. package/dist/cjs/primitives/Select.js.map +1 -0
  183. package/dist/cjs/primitives/Separator.js +14 -0
  184. package/dist/cjs/primitives/Separator.js.map +1 -0
  185. package/dist/cjs/primitives/Sheet.js +44 -0
  186. package/dist/cjs/primitives/Sheet.js.map +1 -0
  187. package/dist/cjs/primitives/Sidebar.js +310 -0
  188. package/dist/cjs/primitives/Sidebar.js.map +1 -0
  189. package/dist/cjs/primitives/Skeleton.js +10 -0
  190. package/dist/cjs/primitives/Skeleton.js.map +1 -0
  191. package/dist/cjs/primitives/Slider.js +591 -0
  192. package/dist/cjs/primitives/Slider.js.map +1 -0
  193. package/dist/cjs/primitives/Sonner.js +1260 -0
  194. package/dist/cjs/primitives/Sonner.js.map +1 -0
  195. package/dist/cjs/primitives/Spinner.js +16 -0
  196. package/dist/cjs/primitives/Spinner.js.map +1 -0
  197. package/dist/cjs/primitives/Switch.js +184 -0
  198. package/dist/cjs/primitives/Switch.js.map +1 -0
  199. package/dist/cjs/primitives/Table.js +45 -0
  200. package/dist/cjs/primitives/Table.js.map +1 -0
  201. package/dist/cjs/primitives/Tabs.js +250 -0
  202. package/dist/cjs/primitives/Tabs.js.map +1 -0
  203. package/dist/cjs/primitives/Textarea.js +10 -0
  204. package/dist/cjs/primitives/Textarea.js.map +1 -0
  205. package/dist/cjs/primitives/Toggle.js +19 -0
  206. package/dist/cjs/primitives/Toggle.js.map +1 -0
  207. package/dist/cjs/primitives/ToggleGroup.js +221 -0
  208. package/dist/cjs/primitives/ToggleGroup.js.map +1 -0
  209. package/dist/cjs/primitives/Tooltip.js +33 -0
  210. package/dist/cjs/primitives/Tooltip.js.map +1 -0
  211. package/dist/cjs/primitives/Typography.js +105 -0
  212. package/dist/cjs/primitives/Typography.js.map +1 -0
  213. package/dist/cjs/primitives/index.js +422 -0
  214. package/dist/cjs/primitives/index.js.map +1 -0
  215. package/dist/cjs/reselect-CeyIIDM-.js +457 -0
  216. package/dist/cjs/reselect-CeyIIDM-.js.map +1 -0
  217. package/dist/cjs/separator-CPy2gyg1.js +58 -0
  218. package/dist/cjs/separator-CPy2gyg1.js.map +1 -0
  219. package/dist/cjs/sheet-nHSYZxAA.js +48 -0
  220. package/dist/cjs/sheet-nHSYZxAA.js.map +1 -0
  221. package/dist/cjs/skeleton-DffZ8bV7.js +11 -0
  222. package/dist/cjs/skeleton-DffZ8bV7.js.map +1 -0
  223. package/dist/cjs/textarea-CZSSY75H.js +11 -0
  224. package/dist/cjs/textarea-CZSSY75H.js.map +1 -0
  225. package/dist/cjs/toggle-CaqzT8dI.js +84 -0
  226. package/dist/cjs/toggle-CaqzT8dI.js.map +1 -0
  227. package/dist/cjs/tooltip-CRkOMh1b.js +542 -0
  228. package/dist/cjs/tooltip-CRkOMh1b.js.map +1 -0
  229. package/dist/cjs/use-mobile-B-UYxtqX.js +41 -0
  230. package/dist/cjs/use-mobile-B-UYxtqX.js.map +1 -0
  231. package/dist/cjs/utils-CTr7wn5d.js +3210 -0
  232. package/dist/cjs/utils-CTr7wn5d.js.map +1 -0
  233. package/dist/cjs/x-Brw3FJst.js +20 -0
  234. package/dist/cjs/x-Brw3FJst.js.map +1 -0
  235. package/dist/components/DataTable.js +41 -0
  236. package/dist/components/DataTable.js.map +1 -0
  237. package/dist/createLucideIcon-C8ycilSN.js +147 -0
  238. package/dist/createLucideIcon-C8ycilSN.js.map +1 -0
  239. package/dist/dialog-C97DOTvO.js +39 -0
  240. package/dist/dialog-C97DOTvO.js.map +1 -0
  241. package/dist/ellipsis-lb8Ws6br.js +19 -0
  242. package/dist/ellipsis-lb8Ws6br.js.map +1 -0
  243. package/dist/floating-ui.react-dom-CcGbtPEK.js +2243 -0
  244. package/dist/floating-ui.react-dom-CcGbtPEK.js.map +1 -0
  245. package/dist/index-0o2E3Cnw.js +146 -0
  246. package/dist/index-0o2E3Cnw.js.map +1 -0
  247. package/dist/index-30QpKM0j.js +16 -0
  248. package/dist/index-30QpKM0j.js.map +1 -0
  249. package/dist/index-B4_fVWDx.js +1129 -0
  250. package/dist/index-B4_fVWDx.js.map +1 -0
  251. package/dist/index-BA158WEj.js +12 -0
  252. package/dist/index-BA158WEj.js.map +1 -0
  253. package/dist/index-BNPynZWM.js +225 -0
  254. package/dist/index-BNPynZWM.js.map +1 -0
  255. package/dist/index-BYZaLNq1.js +41 -0
  256. package/dist/index-BYZaLNq1.js.map +1 -0
  257. package/dist/index-BfAAoDv6.js +7 -0
  258. package/dist/index-BfAAoDv6.js.map +1 -0
  259. package/dist/index-BtkPdosV.js +40 -0
  260. package/dist/index-BtkPdosV.js.map +1 -0
  261. package/dist/index-BwxI_qgh.js +915 -0
  262. package/dist/index-BwxI_qgh.js.map +1 -0
  263. package/dist/index-ByEpUy7w.js +302 -0
  264. package/dist/index-ByEpUy7w.js.map +1 -0
  265. package/dist/index-CSMSzzKM.js +93 -0
  266. package/dist/index-CSMSzzKM.js.map +1 -0
  267. package/dist/index-CSUSJzOJ.js +13 -0
  268. package/dist/index-CSUSJzOJ.js.map +1 -0
  269. package/dist/index-CSggBaQF.js +36 -0
  270. package/dist/index-CSggBaQF.js.map +1 -0
  271. package/dist/index-CfriMyrd.js +91 -0
  272. package/dist/index-CfriMyrd.js.map +1 -0
  273. package/dist/index-CiyxEyB0.js +80 -0
  274. package/dist/index-CiyxEyB0.js.map +1 -0
  275. package/dist/index-Cor698lu.js +71 -0
  276. package/dist/index-Cor698lu.js.map +1 -0
  277. package/dist/index-D7Zy7P05.js +45 -0
  278. package/dist/index-D7Zy7P05.js.map +1 -0
  279. package/dist/index-DNzunGHb.js +12 -0
  280. package/dist/index-DNzunGHb.js.map +1 -0
  281. package/dist/index-DOzu5J1s.js +8 -0
  282. package/dist/index-DOzu5J1s.js.map +1 -0
  283. package/dist/index-DZXbzIgC.js +6 -0
  284. package/dist/index-DZXbzIgC.js.map +1 -0
  285. package/dist/index-Dd1i1d2M.js +155 -0
  286. package/dist/index-Dd1i1d2M.js.map +1 -0
  287. package/dist/index-DhnfW8wQ.js +128 -0
  288. package/dist/index-DhnfW8wQ.js.map +1 -0
  289. package/dist/index-PF0ms7Xn.js +402 -0
  290. package/dist/index-PF0ms7Xn.js.map +1 -0
  291. package/dist/index-fV_U4ZJM.js +18 -0
  292. package/dist/index-fV_U4ZJM.js.map +1 -0
  293. package/dist/index-j_qxDBFl.js +224 -0
  294. package/dist/index-j_qxDBFl.js.map +1 -0
  295. package/dist/index-yFgkK_AM.js +131 -0
  296. package/dist/index-yFgkK_AM.js.map +1 -0
  297. package/dist/index-zW4GjM5L.js +16 -0
  298. package/dist/index-zW4GjM5L.js.map +1 -0
  299. package/dist/index.d.ts +0 -55
  300. package/dist/index.js +41 -66510
  301. package/dist/index.js.map +1 -1
  302. package/dist/input-GLCCE2kT.js +9 -0
  303. package/dist/input-GLCCE2kT.js.map +1 -0
  304. package/dist/input-group-CDBpz6Pb.js +59 -0
  305. package/dist/input-group-CDBpz6Pb.js.map +1 -0
  306. package/dist/label-B4qDF3W1.js +30 -0
  307. package/dist/label-B4qDF3W1.js.map +1 -0
  308. package/dist/loader-circle-DycHUAWN.js +15 -0
  309. package/dist/loader-circle-DycHUAWN.js.map +1 -0
  310. package/dist/primitives/Accordion.js +331 -0
  311. package/dist/primitives/Accordion.js.map +1 -0
  312. package/dist/primitives/Alert.js +35 -0
  313. package/dist/primitives/Alert.js.map +1 -0
  314. package/dist/primitives/AlertDialog.js +223 -0
  315. package/dist/primitives/AlertDialog.js.map +1 -0
  316. package/dist/primitives/AspectRatio.js +53 -0
  317. package/dist/primitives/AspectRatio.js.map +1 -0
  318. package/dist/primitives/Avatar.js +162 -0
  319. package/dist/primitives/Avatar.js.map +1 -0
  320. package/dist/primitives/Badge.js +31 -0
  321. package/dist/primitives/Badge.js.map +1 -0
  322. package/dist/primitives/Breadcrumb.js +42 -0
  323. package/dist/primitives/Breadcrumb.js.map +1 -0
  324. package/dist/{components → primitives}/Button.d.ts +1 -1
  325. package/dist/primitives/Button.js +14 -0
  326. package/dist/primitives/Button.js.map +1 -0
  327. package/dist/primitives/ButtonGroup.js +38 -0
  328. package/dist/primitives/ButtonGroup.js.map +1 -0
  329. package/dist/primitives/Calendar.js +8008 -0
  330. package/dist/primitives/Calendar.js.map +1 -0
  331. package/dist/primitives/Card.js +35 -0
  332. package/dist/primitives/Card.js.map +1 -0
  333. package/dist/{components → primitives}/Carousel.d.ts +1 -1
  334. package/dist/primitives/Carousel.js +1841 -0
  335. package/dist/primitives/Carousel.js.map +1 -0
  336. package/dist/primitives/Chart.js +18761 -0
  337. package/dist/primitives/Chart.js.map +1 -0
  338. package/dist/primitives/Checkbox.js +282 -0
  339. package/dist/primitives/Checkbox.js.map +1 -0
  340. package/dist/primitives/Collapsible.js +29 -0
  341. package/dist/primitives/Collapsible.js.map +1 -0
  342. package/dist/primitives/Combobox.js +10251 -0
  343. package/dist/primitives/Combobox.js.map +1 -0
  344. package/dist/primitives/Command.js +218 -0
  345. package/dist/primitives/Command.js.map +1 -0
  346. package/dist/primitives/ContextMenu.js +368 -0
  347. package/dist/primitives/ContextMenu.js.map +1 -0
  348. package/dist/primitives/Dialog.js +37 -0
  349. package/dist/primitives/Dialog.js.map +1 -0
  350. package/dist/primitives/Drawer.js +1685 -0
  351. package/dist/primitives/Drawer.js.map +1 -0
  352. package/dist/primitives/DropdownMenu.js +347 -0
  353. package/dist/primitives/DropdownMenu.js.map +1 -0
  354. package/dist/primitives/Empty.js +43 -0
  355. package/dist/primitives/Empty.js.map +1 -0
  356. package/dist/primitives/Field.js +84 -0
  357. package/dist/primitives/Field.js.map +1 -0
  358. package/dist/primitives/HoverCard.js +267 -0
  359. package/dist/primitives/HoverCard.js.map +1 -0
  360. package/dist/primitives/Input.js +8 -0
  361. package/dist/primitives/Input.js.map +1 -0
  362. package/dist/primitives/InputGroup.js +20 -0
  363. package/dist/primitives/InputGroup.js.map +1 -0
  364. package/dist/primitives/InputOTP.js +59 -0
  365. package/dist/primitives/InputOTP.js.map +1 -0
  366. package/dist/primitives/Item.js +85 -0
  367. package/dist/primitives/Item.js.map +1 -0
  368. package/dist/primitives/Kbd.js +15 -0
  369. package/dist/primitives/Kbd.js.map +1 -0
  370. package/dist/primitives/Label.js +12 -0
  371. package/dist/primitives/Label.js.map +1 -0
  372. package/dist/primitives/Menubar.js +510 -0
  373. package/dist/primitives/Menubar.js.map +1 -0
  374. package/dist/primitives/NativeSelect.js +22 -0
  375. package/dist/primitives/NativeSelect.js.map +1 -0
  376. package/dist/primitives/NavigationMenu.js +823 -0
  377. package/dist/primitives/NavigationMenu.js.map +1 -0
  378. package/dist/primitives/Pagination.js +44 -0
  379. package/dist/primitives/Pagination.js.map +1 -0
  380. package/dist/primitives/Popover.js +416 -0
  381. package/dist/primitives/Popover.js.map +1 -0
  382. package/dist/primitives/Progress.js +103 -0
  383. package/dist/primitives/Progress.js.map +1 -0
  384. package/dist/primitives/RadioGroup.js +299 -0
  385. package/dist/primitives/RadioGroup.js.map +1 -0
  386. package/dist/primitives/Resizable.js +2047 -0
  387. package/dist/primitives/Resizable.js.map +1 -0
  388. package/dist/primitives/ScrollArea.js +731 -0
  389. package/dist/primitives/ScrollArea.js.map +1 -0
  390. package/dist/primitives/Select.js +1286 -0
  391. package/dist/primitives/Select.js.map +1 -0
  392. package/dist/primitives/Separator.js +12 -0
  393. package/dist/primitives/Separator.js.map +1 -0
  394. package/dist/primitives/Sheet.js +35 -0
  395. package/dist/primitives/Sheet.js.map +1 -0
  396. package/dist/primitives/Sidebar.js +265 -0
  397. package/dist/primitives/Sidebar.js.map +1 -0
  398. package/dist/primitives/Skeleton.js +8 -0
  399. package/dist/primitives/Skeleton.js.map +1 -0
  400. package/dist/primitives/Slider.js +569 -0
  401. package/dist/primitives/Slider.js.map +1 -0
  402. package/dist/primitives/Sonner.js +1236 -0
  403. package/dist/primitives/Sonner.js.map +1 -0
  404. package/dist/primitives/Spinner.js +14 -0
  405. package/dist/primitives/Spinner.js.map +1 -0
  406. package/dist/primitives/Switch.js +162 -0
  407. package/dist/primitives/Switch.js.map +1 -0
  408. package/dist/primitives/Table.js +36 -0
  409. package/dist/primitives/Table.js.map +1 -0
  410. package/dist/primitives/Tabs.js +224 -0
  411. package/dist/primitives/Tabs.js.map +1 -0
  412. package/dist/primitives/Textarea.js +8 -0
  413. package/dist/primitives/Textarea.js.map +1 -0
  414. package/dist/primitives/Toggle.js +17 -0
  415. package/dist/primitives/Toggle.js.map +1 -0
  416. package/dist/primitives/ToggleGroup.js +199 -0
  417. package/dist/primitives/ToggleGroup.js.map +1 -0
  418. package/dist/primitives/Tooltip.js +28 -0
  419. package/dist/primitives/Tooltip.js.map +1 -0
  420. package/dist/{components → primitives}/Typography.d.ts +1 -1
  421. package/dist/primitives/Typography.js +83 -0
  422. package/dist/primitives/Typography.js.map +1 -0
  423. package/dist/primitives/index.d.ts +55 -0
  424. package/dist/primitives/index.js +110 -0
  425. package/dist/primitives/index.js.map +1 -0
  426. package/dist/reselect-CABQm5hA.js +448 -0
  427. package/dist/reselect-CABQm5hA.js.map +1 -0
  428. package/dist/separator-BbhgePmX.js +36 -0
  429. package/dist/separator-BbhgePmX.js.map +1 -0
  430. package/dist/shadcn/components/badge.d.ts +1 -1
  431. package/dist/shadcn/components/button.d.ts +2 -2
  432. package/dist/shadcn/components/typography.d.ts +2 -2
  433. package/dist/sheet-D1ngftfX.js +39 -0
  434. package/dist/sheet-D1ngftfX.js.map +1 -0
  435. package/dist/skeleton-AR83txPr.js +9 -0
  436. package/dist/skeleton-AR83txPr.js.map +1 -0
  437. package/dist/textarea-BSZwxzjQ.js +9 -0
  438. package/dist/textarea-BSZwxzjQ.js.map +1 -0
  439. package/dist/toggle-2k9K8a5c.js +60 -0
  440. package/dist/toggle-2k9K8a5c.js.map +1 -0
  441. package/dist/tooltip-D5soNrAP.js +517 -0
  442. package/dist/tooltip-D5soNrAP.js.map +1 -0
  443. package/dist/use-mobile-IRjN_mlT.js +19 -0
  444. package/dist/use-mobile-IRjN_mlT.js.map +1 -0
  445. package/dist/utils-DdHUxIdC.js +3207 -0
  446. package/dist/utils-DdHUxIdC.js.map +1 -0
  447. package/dist/x-_o2T3n6D.js +18 -0
  448. package/dist/x-_o2T3n6D.js.map +1 -0
  449. package/package.json +16 -1
  450. /package/dist/{components → primitives}/Accordion.d.ts +0 -0
  451. /package/dist/{components → primitives}/Alert.d.ts +0 -0
  452. /package/dist/{components → primitives}/AlertDialog.d.ts +0 -0
  453. /package/dist/{components → primitives}/AspectRatio.d.ts +0 -0
  454. /package/dist/{components → primitives}/Avatar.d.ts +0 -0
  455. /package/dist/{components → primitives}/Badge.d.ts +0 -0
  456. /package/dist/{components → primitives}/Breadcrumb.d.ts +0 -0
  457. /package/dist/{components → primitives}/ButtonGroup.d.ts +0 -0
  458. /package/dist/{components → primitives}/Calendar.d.ts +0 -0
  459. /package/dist/{components → primitives}/Card.d.ts +0 -0
  460. /package/dist/{components → primitives}/Chart.d.ts +0 -0
  461. /package/dist/{components → primitives}/Checkbox.d.ts +0 -0
  462. /package/dist/{components → primitives}/Collapsible.d.ts +0 -0
  463. /package/dist/{components → primitives}/Combobox.d.ts +0 -0
  464. /package/dist/{components → primitives}/Command.d.ts +0 -0
  465. /package/dist/{components → primitives}/ContextMenu.d.ts +0 -0
  466. /package/dist/{components → primitives}/Dialog.d.ts +0 -0
  467. /package/dist/{components → primitives}/Drawer.d.ts +0 -0
  468. /package/dist/{components → primitives}/DropdownMenu.d.ts +0 -0
  469. /package/dist/{components → primitives}/Empty.d.ts +0 -0
  470. /package/dist/{components → primitives}/Field.d.ts +0 -0
  471. /package/dist/{components → primitives}/HoverCard.d.ts +0 -0
  472. /package/dist/{components → primitives}/Input.d.ts +0 -0
  473. /package/dist/{components → primitives}/InputGroup.d.ts +0 -0
  474. /package/dist/{components → primitives}/InputOTP.d.ts +0 -0
  475. /package/dist/{components → primitives}/Item.d.ts +0 -0
  476. /package/dist/{components → primitives}/Kbd.d.ts +0 -0
  477. /package/dist/{components → primitives}/Label.d.ts +0 -0
  478. /package/dist/{components → primitives}/Menubar.d.ts +0 -0
  479. /package/dist/{components → primitives}/NativeSelect.d.ts +0 -0
  480. /package/dist/{components → primitives}/NavigationMenu.d.ts +0 -0
  481. /package/dist/{components → primitives}/Pagination.d.ts +0 -0
  482. /package/dist/{components → primitives}/Popover.d.ts +0 -0
  483. /package/dist/{components → primitives}/Progress.d.ts +0 -0
  484. /package/dist/{components → primitives}/RadioGroup.d.ts +0 -0
  485. /package/dist/{components → primitives}/Resizable.d.ts +0 -0
  486. /package/dist/{components → primitives}/ScrollArea.d.ts +0 -0
  487. /package/dist/{components → primitives}/Select.d.ts +0 -0
  488. /package/dist/{components → primitives}/Separator.d.ts +0 -0
  489. /package/dist/{components → primitives}/Sheet.d.ts +0 -0
  490. /package/dist/{components → primitives}/Sidebar.d.ts +0 -0
  491. /package/dist/{components → primitives}/Skeleton.d.ts +0 -0
  492. /package/dist/{components → primitives}/Slider.d.ts +0 -0
  493. /package/dist/{components → primitives}/Sonner.d.ts +0 -0
  494. /package/dist/{components → primitives}/Spinner.d.ts +0 -0
  495. /package/dist/{components → primitives}/Switch.d.ts +0 -0
  496. /package/dist/{components → primitives}/Table.d.ts +0 -0
  497. /package/dist/{components → primitives}/Tabs.d.ts +0 -0
  498. /package/dist/{components → primitives}/Textarea.d.ts +0 -0
  499. /package/dist/{components → primitives}/Toggle.d.ts +0 -0
  500. /package/dist/{components → primitives}/ToggleGroup.d.ts +0 -0
  501. /package/dist/{components → primitives}/Tooltip.d.ts +0 -0
@@ -0,0 +1,1685 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { O as Overlay$1, a as Content$1, C as Close, D as Description, T as Title, b as Trigger, R as Root$1, P as Portal$1 } from '../index-PF0ms7Xn.js';
3
+ import * as React from 'react';
4
+ import React__default, { useMemo, useLayoutEffect, useEffect } from 'react';
5
+ import { c as cn } from '../utils-DdHUxIdC.js';
6
+ import '../index-DNzunGHb.js';
7
+ import '../index-BtkPdosV.js';
8
+ import '../index-CiyxEyB0.js';
9
+ import '../index-zW4GjM5L.js';
10
+ import '../index-DOzu5J1s.js';
11
+ import '../index-Cor698lu.js';
12
+ import '../index-BNPynZWM.js';
13
+ import '../index-DhnfW8wQ.js';
14
+ import 'react-dom';
15
+ import '../index-CSUSJzOJ.js';
16
+ import '../index-B4_fVWDx.js';
17
+ import '../index-fV_U4ZJM.js';
18
+ import '../index-yFgkK_AM.js';
19
+
20
+ function __insertCSS(code) {
21
+ if (typeof document == 'undefined') return
22
+ let head = document.head || document.getElementsByTagName('head')[0];
23
+ let style = document.createElement('style');
24
+ style.type = 'text/css';
25
+ head.appendChild(style)
26
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
27
+ }
28
+
29
+ const DrawerContext = React__default.createContext({
30
+ drawerRef: {
31
+ current: null
32
+ },
33
+ overlayRef: {
34
+ current: null
35
+ },
36
+ onPress: ()=>{},
37
+ onRelease: ()=>{},
38
+ onDrag: ()=>{},
39
+ onNestedDrag: ()=>{},
40
+ onNestedOpenChange: ()=>{},
41
+ onNestedRelease: ()=>{},
42
+ openProp: undefined,
43
+ dismissible: false,
44
+ isOpen: false,
45
+ isDragging: false,
46
+ keyboardIsOpen: {
47
+ current: false
48
+ },
49
+ snapPointsOffset: null,
50
+ snapPoints: null,
51
+ handleOnly: false,
52
+ modal: false,
53
+ shouldFade: false,
54
+ activeSnapPoint: null,
55
+ onOpenChange: ()=>{},
56
+ setActiveSnapPoint: ()=>{},
57
+ closeDrawer: ()=>{},
58
+ direction: 'bottom',
59
+ shouldAnimate: {
60
+ current: true
61
+ },
62
+ shouldScaleBackground: false,
63
+ setBackgroundColorOnScale: true,
64
+ noBodyStyles: false,
65
+ container: null,
66
+ autoFocus: false
67
+ });
68
+ const useDrawerContext = ()=>{
69
+ const context = React__default.useContext(DrawerContext);
70
+ if (!context) {
71
+ throw new Error('useDrawerContext must be used within a Drawer.Root');
72
+ }
73
+ return context;
74
+ };
75
+
76
+ __insertCSS("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");
77
+
78
+ function isMobileFirefox() {
79
+ const userAgent = navigator.userAgent;
80
+ return typeof window !== 'undefined' && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) || // Android Firefox
81
+ /FxiOS/.test(userAgent) // iOS Firefox
82
+ );
83
+ }
84
+ function isMac() {
85
+ return testPlatform(/^Mac/);
86
+ }
87
+ function isIPhone() {
88
+ return testPlatform(/^iPhone/);
89
+ }
90
+ function isSafari() {
91
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
92
+ }
93
+ function isIPad() {
94
+ return testPlatform(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
95
+ isMac() && navigator.maxTouchPoints > 1;
96
+ }
97
+ function isIOS() {
98
+ return isIPhone() || isIPad();
99
+ }
100
+ function testPlatform(re) {
101
+ return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : undefined;
102
+ }
103
+
104
+ // This code comes from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/usePreventScroll.ts
105
+ const KEYBOARD_BUFFER = 24;
106
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
107
+ function chain$1(...callbacks) {
108
+ return (...args)=>{
109
+ for (let callback of callbacks){
110
+ if (typeof callback === 'function') {
111
+ callback(...args);
112
+ }
113
+ }
114
+ };
115
+ }
116
+ // @ts-ignore
117
+ const visualViewport = typeof document !== 'undefined' && window.visualViewport;
118
+ function isScrollable(node) {
119
+ let style = window.getComputedStyle(node);
120
+ return /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
121
+ }
122
+ function getScrollParent(node) {
123
+ if (isScrollable(node)) {
124
+ node = node.parentElement;
125
+ }
126
+ while(node && !isScrollable(node)){
127
+ node = node.parentElement;
128
+ }
129
+ return node || document.scrollingElement || document.documentElement;
130
+ }
131
+ // HTML input types that do not cause the software keyboard to appear.
132
+ const nonTextInputTypes = new Set([
133
+ 'checkbox',
134
+ 'radio',
135
+ 'range',
136
+ 'color',
137
+ 'file',
138
+ 'image',
139
+ 'button',
140
+ 'submit',
141
+ 'reset'
142
+ ]);
143
+ // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
144
+ let preventScrollCount = 0;
145
+ let restore;
146
+ /**
147
+ * Prevents scrolling on the document body on mount, and
148
+ * restores it on unmount. Also ensures that content does not
149
+ * shift due to the scrollbars disappearing.
150
+ */ function usePreventScroll(options = {}) {
151
+ let { isDisabled } = options;
152
+ useIsomorphicLayoutEffect(()=>{
153
+ if (isDisabled) {
154
+ return;
155
+ }
156
+ preventScrollCount++;
157
+ if (preventScrollCount === 1) {
158
+ if (isIOS()) {
159
+ restore = preventScrollMobileSafari();
160
+ }
161
+ }
162
+ return ()=>{
163
+ preventScrollCount--;
164
+ if (preventScrollCount === 0) {
165
+ restore == null ? void 0 : restore();
166
+ }
167
+ };
168
+ }, [
169
+ isDisabled
170
+ ]);
171
+ }
172
+ // Mobile Safari is a whole different beast. Even with overflow: hidden,
173
+ // it still scrolls the page in many situations:
174
+ //
175
+ // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
176
+ // 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
177
+ // it, so it becomes scrollable.
178
+ // 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
179
+ // This may cause even fixed position elements to scroll off the screen.
180
+ // 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
181
+ // scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
182
+ //
183
+ // In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
184
+ //
185
+ // 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
186
+ // on the window.
187
+ // 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the
188
+ // top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.
189
+ // 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
190
+ // 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
191
+ // of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
192
+ // into view ourselves, without scrolling the whole page.
193
+ // 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
194
+ // same visually, but makes the actual scroll position always zero. This is required to make all of the
195
+ // above work or Safari will still try to scroll the page when focusing an input.
196
+ // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
197
+ // to navigate to an input with the next/previous buttons that's outside a modal.
198
+ function preventScrollMobileSafari() {
199
+ let scrollable;
200
+ let lastY = 0;
201
+ let onTouchStart = (e)=>{
202
+ // Store the nearest scrollable parent element from the element that the user touched.
203
+ scrollable = getScrollParent(e.target);
204
+ if (scrollable === document.documentElement && scrollable === document.body) {
205
+ return;
206
+ }
207
+ lastY = e.changedTouches[0].pageY;
208
+ };
209
+ let onTouchMove = (e)=>{
210
+ // Prevent scrolling the window.
211
+ if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
212
+ e.preventDefault();
213
+ return;
214
+ }
215
+ // Prevent scrolling up when at the top and scrolling down when at the bottom
216
+ // of a nested scrollable area, otherwise mobile Safari will start scrolling
217
+ // the window instead. Unfortunately, this disables bounce scrolling when at
218
+ // the top but it's the best we can do.
219
+ let y = e.changedTouches[0].pageY;
220
+ let scrollTop = scrollable.scrollTop;
221
+ let bottom = scrollable.scrollHeight - scrollable.clientHeight;
222
+ if (bottom === 0) {
223
+ return;
224
+ }
225
+ if (scrollTop <= 0 && y > lastY || scrollTop >= bottom && y < lastY) {
226
+ e.preventDefault();
227
+ }
228
+ lastY = y;
229
+ };
230
+ let onTouchEnd = (e)=>{
231
+ let target = e.target;
232
+ // Apply this change if we're not already focused on the target element
233
+ if (isInput(target) && target !== document.activeElement) {
234
+ e.preventDefault();
235
+ // Apply a transform to trick Safari into thinking the input is at the top of the page
236
+ // so it doesn't try to scroll it into view. When tapping on an input, this needs to
237
+ // be done before the "focus" event, so we have to focus the element ourselves.
238
+ target.style.transform = 'translateY(-2000px)';
239
+ target.focus();
240
+ requestAnimationFrame(()=>{
241
+ target.style.transform = '';
242
+ });
243
+ }
244
+ };
245
+ let onFocus = (e)=>{
246
+ let target = e.target;
247
+ if (isInput(target)) {
248
+ // Transform also needs to be applied in the focus event in cases where focus moves
249
+ // other than tapping on an input directly, e.g. the next/previous buttons in the
250
+ // software keyboard. In these cases, it seems applying the transform in the focus event
251
+ // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
252
+ target.style.transform = 'translateY(-2000px)';
253
+ requestAnimationFrame(()=>{
254
+ target.style.transform = '';
255
+ // This will have prevented the browser from scrolling the focused element into view,
256
+ // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
257
+ if (visualViewport) {
258
+ if (visualViewport.height < window.innerHeight) {
259
+ // If the keyboard is already visible, do this after one additional frame
260
+ // to wait for the transform to be removed.
261
+ requestAnimationFrame(()=>{
262
+ scrollIntoView(target);
263
+ });
264
+ } else {
265
+ // Otherwise, wait for the visual viewport to resize before scrolling so we can
266
+ // measure the correct position to scroll to.
267
+ visualViewport.addEventListener('resize', ()=>scrollIntoView(target), {
268
+ once: true
269
+ });
270
+ }
271
+ }
272
+ });
273
+ }
274
+ };
275
+ let onWindowScroll = ()=>{
276
+ // Last resort. If the window scrolled, scroll it back to the top.
277
+ // It should always be at the top because the body will have a negative margin (see below).
278
+ window.scrollTo(0, 0);
279
+ };
280
+ // Record the original scroll position so we can restore it.
281
+ // Then apply a negative margin to the body to offset it by the scroll position. This will
282
+ // enable us to scroll the window to the top, which is required for the rest of this to work.
283
+ let scrollX = window.pageXOffset;
284
+ let scrollY = window.pageYOffset;
285
+ let restoreStyles = chain$1(setStyle(document.documentElement, 'paddingRight', `${window.innerWidth - document.documentElement.clientWidth}px`));
286
+ // Scroll to the top. The negative margin on the body will make this appear the same.
287
+ window.scrollTo(0, 0);
288
+ let removeEvents = chain$1(addEvent(document, 'touchstart', onTouchStart, {
289
+ passive: false,
290
+ capture: true
291
+ }), addEvent(document, 'touchmove', onTouchMove, {
292
+ passive: false,
293
+ capture: true
294
+ }), addEvent(document, 'touchend', onTouchEnd, {
295
+ passive: false,
296
+ capture: true
297
+ }), addEvent(document, 'focus', onFocus, true), addEvent(window, 'scroll', onWindowScroll));
298
+ return ()=>{
299
+ // Restore styles and scroll the page back to where it was.
300
+ restoreStyles();
301
+ removeEvents();
302
+ window.scrollTo(scrollX, scrollY);
303
+ };
304
+ }
305
+ // Sets a CSS property on an element, and returns a function to revert it to the previous value.
306
+ function setStyle(element, style, value) {
307
+ // https://github.com/microsoft/TypeScript/issues/17827#issuecomment-391663310
308
+ // @ts-ignore
309
+ let cur = element.style[style];
310
+ // @ts-ignore
311
+ element.style[style] = value;
312
+ return ()=>{
313
+ // @ts-ignore
314
+ element.style[style] = cur;
315
+ };
316
+ }
317
+ // Adds an event listener to an element, and returns a function to remove it.
318
+ function addEvent(target, event, handler, options) {
319
+ // @ts-ignore
320
+ target.addEventListener(event, handler, options);
321
+ return ()=>{
322
+ // @ts-ignore
323
+ target.removeEventListener(event, handler, options);
324
+ };
325
+ }
326
+ function scrollIntoView(target) {
327
+ let root = document.scrollingElement || document.documentElement;
328
+ while(target && target !== root){
329
+ // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
330
+ let scrollable = getScrollParent(target);
331
+ if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
332
+ let scrollableTop = scrollable.getBoundingClientRect().top;
333
+ let targetTop = target.getBoundingClientRect().top;
334
+ let targetBottom = target.getBoundingClientRect().bottom;
335
+ // Buffer is needed for some edge cases
336
+ const keyboardHeight = scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER;
337
+ if (targetBottom > keyboardHeight) {
338
+ scrollable.scrollTop += targetTop - scrollableTop;
339
+ }
340
+ }
341
+ // @ts-ignore
342
+ target = scrollable.parentElement;
343
+ }
344
+ }
345
+ function isInput(target) {
346
+ return target instanceof HTMLInputElement && !nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
347
+ }
348
+
349
+ // This code comes from https://github.com/radix-ui/primitives/tree/main/packages/react/compose-refs
350
+ /**
351
+ * Set a given ref to a given value
352
+ * This utility takes care of different types of refs: callback refs and RefObject(s)
353
+ */ function setRef(ref, value) {
354
+ if (typeof ref === 'function') {
355
+ ref(value);
356
+ } else if (ref !== null && ref !== undefined) {
357
+ ref.current = value;
358
+ }
359
+ }
360
+ /**
361
+ * A utility to compose multiple refs together
362
+ * Accepts callback refs and RefObject(s)
363
+ */ function composeRefs(...refs) {
364
+ return (node)=>refs.forEach((ref)=>setRef(ref, node));
365
+ }
366
+ /**
367
+ * A custom hook that composes multiple refs
368
+ * Accepts callback refs and RefObject(s)
369
+ */ function useComposedRefs(...refs) {
370
+ // eslint-disable-next-line react-hooks/exhaustive-deps
371
+ return React.useCallback(composeRefs(...refs), refs);
372
+ }
373
+
374
+ const cache = new WeakMap();
375
+ function set(el, styles, ignoreCache = false) {
376
+ if (!el || !(el instanceof HTMLElement)) return;
377
+ let originalStyles = {};
378
+ Object.entries(styles).forEach(([key, value])=>{
379
+ if (key.startsWith('--')) {
380
+ el.style.setProperty(key, value);
381
+ return;
382
+ }
383
+ originalStyles[key] = el.style[key];
384
+ el.style[key] = value;
385
+ });
386
+ if (ignoreCache) return;
387
+ cache.set(el, originalStyles);
388
+ }
389
+ function reset(el, prop) {
390
+ if (!el || !(el instanceof HTMLElement)) return;
391
+ let originalStyles = cache.get(el);
392
+ if (!originalStyles) {
393
+ return;
394
+ }
395
+ {
396
+ el.style[prop] = originalStyles[prop];
397
+ }
398
+ }
399
+ const isVertical = (direction)=>{
400
+ switch(direction){
401
+ case 'top':
402
+ case 'bottom':
403
+ return true;
404
+ case 'left':
405
+ case 'right':
406
+ return false;
407
+ default:
408
+ return direction;
409
+ }
410
+ };
411
+ function getTranslate(element, direction) {
412
+ if (!element) {
413
+ return null;
414
+ }
415
+ const style = window.getComputedStyle(element);
416
+ const transform = // @ts-ignore
417
+ style.transform || style.webkitTransform || style.mozTransform;
418
+ let mat = transform.match(/^matrix3d\((.+)\)$/);
419
+ if (mat) {
420
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d
421
+ return parseFloat(mat[1].split(', ')[isVertical(direction) ? 13 : 12]);
422
+ }
423
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix
424
+ mat = transform.match(/^matrix\((.+)\)$/);
425
+ return mat ? parseFloat(mat[1].split(', ')[isVertical(direction) ? 5 : 4]) : null;
426
+ }
427
+ function dampenValue(v) {
428
+ return 8 * (Math.log(v + 1) - 2);
429
+ }
430
+ function assignStyle(element, style) {
431
+ if (!element) return ()=>{};
432
+ const prevStyle = element.style.cssText;
433
+ Object.assign(element.style, style);
434
+ return ()=>{
435
+ element.style.cssText = prevStyle;
436
+ };
437
+ }
438
+ /**
439
+ * Receives functions as arguments and returns a new function that calls all.
440
+ */ function chain(...fns) {
441
+ return (...args)=>{
442
+ for (const fn of fns){
443
+ if (typeof fn === 'function') {
444
+ // @ts-ignore
445
+ fn(...args);
446
+ }
447
+ }
448
+ };
449
+ }
450
+
451
+ const TRANSITIONS = {
452
+ DURATION: 0.5,
453
+ EASE: [
454
+ 0.32,
455
+ 0.72,
456
+ 0,
457
+ 1
458
+ ]
459
+ };
460
+ const VELOCITY_THRESHOLD = 0.4;
461
+ const CLOSE_THRESHOLD = 0.25;
462
+ const SCROLL_LOCK_TIMEOUT = 100;
463
+ const BORDER_RADIUS = 8;
464
+ const NESTED_DISPLACEMENT = 16;
465
+ const WINDOW_TOP_OFFSET = 26;
466
+ const DRAG_CLASS = 'vaul-dragging';
467
+
468
+ // This code comes from https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx
469
+ function useCallbackRef(callback) {
470
+ const callbackRef = React__default.useRef(callback);
471
+ React__default.useEffect(()=>{
472
+ callbackRef.current = callback;
473
+ });
474
+ // https://github.com/facebook/react/issues/19240
475
+ return React__default.useMemo(()=>(...args)=>callbackRef.current == null ? void 0 : callbackRef.current.call(callbackRef, ...args), []);
476
+ }
477
+ function useUncontrolledState({ defaultProp, onChange }) {
478
+ const uncontrolledState = React__default.useState(defaultProp);
479
+ const [value] = uncontrolledState;
480
+ const prevValueRef = React__default.useRef(value);
481
+ const handleChange = useCallbackRef(onChange);
482
+ React__default.useEffect(()=>{
483
+ if (prevValueRef.current !== value) {
484
+ handleChange(value);
485
+ prevValueRef.current = value;
486
+ }
487
+ }, [
488
+ value,
489
+ prevValueRef,
490
+ handleChange
491
+ ]);
492
+ return uncontrolledState;
493
+ }
494
+ function useControllableState({ prop, defaultProp, onChange = ()=>{} }) {
495
+ const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
496
+ defaultProp,
497
+ onChange
498
+ });
499
+ const isControlled = prop !== undefined;
500
+ const value = isControlled ? prop : uncontrolledProp;
501
+ const handleChange = useCallbackRef(onChange);
502
+ const setValue = React__default.useCallback((nextValue)=>{
503
+ if (isControlled) {
504
+ const setter = nextValue;
505
+ const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
506
+ if (value !== prop) handleChange(value);
507
+ } else {
508
+ setUncontrolledProp(nextValue);
509
+ }
510
+ }, [
511
+ isControlled,
512
+ prop,
513
+ setUncontrolledProp,
514
+ handleChange
515
+ ]);
516
+ return [
517
+ value,
518
+ setValue
519
+ ];
520
+ }
521
+
522
+ function useSnapPoints({ activeSnapPointProp, setActiveSnapPointProp, snapPoints, drawerRef, overlayRef, fadeFromIndex, onSnapPointChange, direction = 'bottom', container, snapToSequentialPoint }) {
523
+ const [activeSnapPoint, setActiveSnapPoint] = useControllableState({
524
+ prop: activeSnapPointProp,
525
+ defaultProp: snapPoints == null ? void 0 : snapPoints[0],
526
+ onChange: setActiveSnapPointProp
527
+ });
528
+ const [windowDimensions, setWindowDimensions] = React__default.useState(typeof window !== 'undefined' ? {
529
+ innerWidth: window.innerWidth,
530
+ innerHeight: window.innerHeight
531
+ } : undefined);
532
+ React__default.useEffect(()=>{
533
+ function onResize() {
534
+ setWindowDimensions({
535
+ innerWidth: window.innerWidth,
536
+ innerHeight: window.innerHeight
537
+ });
538
+ }
539
+ window.addEventListener('resize', onResize);
540
+ return ()=>window.removeEventListener('resize', onResize);
541
+ }, []);
542
+ const isLastSnapPoint = React__default.useMemo(()=>activeSnapPoint === (snapPoints == null ? void 0 : snapPoints[snapPoints.length - 1]) || null, [
543
+ snapPoints,
544
+ activeSnapPoint
545
+ ]);
546
+ const activeSnapPointIndex = React__default.useMemo(()=>{
547
+ var _snapPoints_findIndex;
548
+ return (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint)=>snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : null;
549
+ }, [
550
+ snapPoints,
551
+ activeSnapPoint
552
+ ]);
553
+ const shouldFade = snapPoints && snapPoints.length > 0 && (fadeFromIndex || fadeFromIndex === 0) && !Number.isNaN(fadeFromIndex) && snapPoints[fadeFromIndex] === activeSnapPoint || !snapPoints;
554
+ const snapPointsOffset = React__default.useMemo(()=>{
555
+ const containerSize = container ? {
556
+ width: container.getBoundingClientRect().width,
557
+ height: container.getBoundingClientRect().height
558
+ } : typeof window !== 'undefined' ? {
559
+ width: window.innerWidth,
560
+ height: window.innerHeight
561
+ } : {
562
+ width: 0,
563
+ height: 0
564
+ };
565
+ var _snapPoints_map;
566
+ return (_snapPoints_map = snapPoints == null ? void 0 : snapPoints.map((snapPoint)=>{
567
+ const isPx = typeof snapPoint === 'string';
568
+ let snapPointAsNumber = 0;
569
+ if (isPx) {
570
+ snapPointAsNumber = parseInt(snapPoint, 10);
571
+ }
572
+ if (isVertical(direction)) {
573
+ const height = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.height : 0;
574
+ if (windowDimensions) {
575
+ return direction === 'bottom' ? containerSize.height - height : -containerSize.height + height;
576
+ }
577
+ return height;
578
+ }
579
+ const width = isPx ? snapPointAsNumber : windowDimensions ? snapPoint * containerSize.width : 0;
580
+ if (windowDimensions) {
581
+ return direction === 'right' ? containerSize.width - width : -containerSize.width + width;
582
+ }
583
+ return width;
584
+ })) != null ? _snapPoints_map : [];
585
+ }, [
586
+ snapPoints,
587
+ windowDimensions,
588
+ container
589
+ ]);
590
+ const activeSnapPointOffset = React__default.useMemo(()=>activeSnapPointIndex !== null ? snapPointsOffset == null ? void 0 : snapPointsOffset[activeSnapPointIndex] : null, [
591
+ snapPointsOffset,
592
+ activeSnapPointIndex
593
+ ]);
594
+ const snapToPoint = React__default.useCallback((dimension)=>{
595
+ var _snapPointsOffset_findIndex;
596
+ const newSnapPointIndex = (_snapPointsOffset_findIndex = snapPointsOffset == null ? void 0 : snapPointsOffset.findIndex((snapPointDim)=>snapPointDim === dimension)) != null ? _snapPointsOffset_findIndex : null;
597
+ onSnapPointChange(newSnapPointIndex);
598
+ set(drawerRef.current, {
599
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
600
+ transform: isVertical(direction) ? `translate3d(0, ${dimension}px, 0)` : `translate3d(${dimension}px, 0, 0)`
601
+ });
602
+ if (snapPointsOffset && newSnapPointIndex !== snapPointsOffset.length - 1 && fadeFromIndex !== undefined && newSnapPointIndex !== fadeFromIndex && newSnapPointIndex < fadeFromIndex) {
603
+ set(overlayRef.current, {
604
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
605
+ opacity: '0'
606
+ });
607
+ } else {
608
+ set(overlayRef.current, {
609
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
610
+ opacity: '1'
611
+ });
612
+ }
613
+ setActiveSnapPoint(snapPoints == null ? void 0 : snapPoints[Math.max(newSnapPointIndex, 0)]);
614
+ }, [
615
+ drawerRef.current,
616
+ snapPoints,
617
+ snapPointsOffset,
618
+ fadeFromIndex,
619
+ overlayRef,
620
+ setActiveSnapPoint
621
+ ]);
622
+ React__default.useEffect(()=>{
623
+ if (activeSnapPoint || activeSnapPointProp) {
624
+ var _snapPoints_findIndex;
625
+ const newIndex = (_snapPoints_findIndex = snapPoints == null ? void 0 : snapPoints.findIndex((snapPoint)=>snapPoint === activeSnapPointProp || snapPoint === activeSnapPoint)) != null ? _snapPoints_findIndex : -1;
626
+ if (snapPointsOffset && newIndex !== -1 && typeof snapPointsOffset[newIndex] === 'number') {
627
+ snapToPoint(snapPointsOffset[newIndex]);
628
+ }
629
+ }
630
+ }, [
631
+ activeSnapPoint,
632
+ activeSnapPointProp,
633
+ snapPoints,
634
+ snapPointsOffset,
635
+ snapToPoint
636
+ ]);
637
+ function onRelease({ draggedDistance, closeDrawer, velocity, dismissible }) {
638
+ if (fadeFromIndex === undefined) return;
639
+ const currentPosition = direction === 'bottom' || direction === 'right' ? (activeSnapPointOffset != null ? activeSnapPointOffset : 0) - draggedDistance : (activeSnapPointOffset != null ? activeSnapPointOffset : 0) + draggedDistance;
640
+ const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
641
+ const isFirst = activeSnapPointIndex === 0;
642
+ const hasDraggedUp = draggedDistance > 0;
643
+ if (isOverlaySnapPoint) {
644
+ set(overlayRef.current, {
645
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`
646
+ });
647
+ }
648
+ if (!snapToSequentialPoint && velocity > 2 && !hasDraggedUp) {
649
+ if (dismissible) closeDrawer();
650
+ else snapToPoint(snapPointsOffset[0]); // snap to initial point
651
+ return;
652
+ }
653
+ if (!snapToSequentialPoint && velocity > 2 && hasDraggedUp && snapPointsOffset && snapPoints) {
654
+ snapToPoint(snapPointsOffset[snapPoints.length - 1]);
655
+ return;
656
+ }
657
+ // Find the closest snap point to the current position
658
+ const closestSnapPoint = snapPointsOffset == null ? void 0 : snapPointsOffset.reduce((prev, curr)=>{
659
+ if (typeof prev !== 'number' || typeof curr !== 'number') return prev;
660
+ return Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition) ? curr : prev;
661
+ });
662
+ const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
663
+ if (velocity > VELOCITY_THRESHOLD && Math.abs(draggedDistance) < dim * 0.4) {
664
+ const dragDirection = hasDraggedUp ? 1 : -1; // 1 = up, -1 = down
665
+ // Don't do anything if we swipe upwards while being on the last snap point
666
+ if (dragDirection > 0 && isLastSnapPoint && snapPoints) {
667
+ snapToPoint(snapPointsOffset[snapPoints.length - 1]);
668
+ return;
669
+ }
670
+ if (isFirst && dragDirection < 0 && dismissible) {
671
+ closeDrawer();
672
+ }
673
+ if (activeSnapPointIndex === null) return;
674
+ snapToPoint(snapPointsOffset[activeSnapPointIndex + dragDirection]);
675
+ return;
676
+ }
677
+ snapToPoint(closestSnapPoint);
678
+ }
679
+ function onDrag({ draggedDistance }) {
680
+ if (activeSnapPointOffset === null) return;
681
+ const newValue = direction === 'bottom' || direction === 'right' ? activeSnapPointOffset - draggedDistance : activeSnapPointOffset + draggedDistance;
682
+ // Don't do anything if we exceed the last(biggest) snap point
683
+ if ((direction === 'bottom' || direction === 'right') && newValue < snapPointsOffset[snapPointsOffset.length - 1]) {
684
+ return;
685
+ }
686
+ if ((direction === 'top' || direction === 'left') && newValue > snapPointsOffset[snapPointsOffset.length - 1]) {
687
+ return;
688
+ }
689
+ set(drawerRef.current, {
690
+ transform: isVertical(direction) ? `translate3d(0, ${newValue}px, 0)` : `translate3d(${newValue}px, 0, 0)`
691
+ });
692
+ }
693
+ function getPercentageDragged(absDraggedDistance, isDraggingDown) {
694
+ if (!snapPoints || typeof activeSnapPointIndex !== 'number' || !snapPointsOffset || fadeFromIndex === undefined) return null;
695
+ // If this is true we are dragging to a snap point that is supposed to have an overlay
696
+ const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;
697
+ const isOverlaySnapPointOrHigher = activeSnapPointIndex >= fadeFromIndex;
698
+ if (isOverlaySnapPointOrHigher && isDraggingDown) {
699
+ return 0;
700
+ }
701
+ // Don't animate, but still use this one if we are dragging away from the overlaySnapPoint
702
+ if (isOverlaySnapPoint && !isDraggingDown) return 1;
703
+ if (!shouldFade && !isOverlaySnapPoint) return null;
704
+ // Either fadeFrom index or the one before
705
+ const targetSnapPointIndex = isOverlaySnapPoint ? activeSnapPointIndex + 1 : activeSnapPointIndex - 1;
706
+ // Get the distance from overlaySnapPoint to the one before or vice-versa to calculate the opacity percentage accordingly
707
+ const snapPointDistance = isOverlaySnapPoint ? snapPointsOffset[targetSnapPointIndex] - snapPointsOffset[targetSnapPointIndex - 1] : snapPointsOffset[targetSnapPointIndex + 1] - snapPointsOffset[targetSnapPointIndex];
708
+ const percentageDragged = absDraggedDistance / Math.abs(snapPointDistance);
709
+ if (isOverlaySnapPoint) {
710
+ return 1 - percentageDragged;
711
+ } else {
712
+ return percentageDragged;
713
+ }
714
+ }
715
+ return {
716
+ isLastSnapPoint,
717
+ activeSnapPoint,
718
+ shouldFade,
719
+ getPercentageDragged,
720
+ setActiveSnapPoint,
721
+ activeSnapPointIndex,
722
+ onRelease,
723
+ onDrag,
724
+ snapPointsOffset
725
+ };
726
+ }
727
+
728
+ const noop = ()=>()=>{};
729
+ function useScaleBackground() {
730
+ const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();
731
+ const timeoutIdRef = React__default.useRef(null);
732
+ const initialBackgroundColor = useMemo(()=>document.body.style.backgroundColor, []);
733
+ function getScale() {
734
+ return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
735
+ }
736
+ React__default.useEffect(()=>{
737
+ if (isOpen && shouldScaleBackground) {
738
+ if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);
739
+ const wrapper = document.querySelector('[data-vaul-drawer-wrapper]') || document.querySelector('[vaul-drawer-wrapper]');
740
+ if (!wrapper) return;
741
+ chain(setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, {
742
+ background: 'black'
743
+ }) : noop, assignStyle(wrapper, {
744
+ transformOrigin: isVertical(direction) ? 'top' : 'left',
745
+ transitionProperty: 'transform, border-radius',
746
+ transitionDuration: `${TRANSITIONS.DURATION}s`,
747
+ transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`
748
+ }));
749
+ const wrapperStylesCleanup = assignStyle(wrapper, {
750
+ borderRadius: `${BORDER_RADIUS}px`,
751
+ overflow: 'hidden',
752
+ ...isVertical(direction) ? {
753
+ transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
754
+ } : {
755
+ transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
756
+ }
757
+ });
758
+ return ()=>{
759
+ wrapperStylesCleanup();
760
+ timeoutIdRef.current = window.setTimeout(()=>{
761
+ if (initialBackgroundColor) {
762
+ document.body.style.background = initialBackgroundColor;
763
+ } else {
764
+ document.body.style.removeProperty('background');
765
+ }
766
+ }, TRANSITIONS.DURATION * 1000);
767
+ };
768
+ }
769
+ }, [
770
+ isOpen,
771
+ shouldScaleBackground,
772
+ initialBackgroundColor
773
+ ]);
774
+ }
775
+
776
+ let previousBodyPosition = null;
777
+ /**
778
+ * This hook is necessary to prevent buggy behavior on iOS devices (need to test on Android).
779
+ * I won't get into too much detail about what bugs it solves, but so far I've found that setting the body to `position: fixed` is the most reliable way to prevent those bugs.
780
+ * Issues that this hook solves:
781
+ * https://github.com/emilkowalski/vaul/issues/435
782
+ * https://github.com/emilkowalski/vaul/issues/433
783
+ * And more that I discovered, but were just not reported.
784
+ */ function usePositionFixed({ isOpen, modal, nested, hasBeenOpened, preventScrollRestoration, noBodyStyles }) {
785
+ const [activeUrl, setActiveUrl] = React__default.useState(()=>typeof window !== 'undefined' ? window.location.href : '');
786
+ const scrollPos = React__default.useRef(0);
787
+ const setPositionFixed = React__default.useCallback(()=>{
788
+ // All browsers on iOS will return true here.
789
+ if (!isSafari()) return;
790
+ // If previousBodyPosition is already set, don't set it again.
791
+ if (previousBodyPosition === null && isOpen && !noBodyStyles) {
792
+ previousBodyPosition = {
793
+ position: document.body.style.position,
794
+ top: document.body.style.top,
795
+ left: document.body.style.left,
796
+ height: document.body.style.height,
797
+ right: 'unset'
798
+ };
799
+ // Update the dom inside an animation frame
800
+ const { scrollX, innerHeight } = window;
801
+ document.body.style.setProperty('position', 'fixed', 'important');
802
+ Object.assign(document.body.style, {
803
+ top: `${-scrollPos.current}px`,
804
+ left: `${-scrollX}px`,
805
+ right: '0px',
806
+ height: 'auto'
807
+ });
808
+ window.setTimeout(()=>window.requestAnimationFrame(()=>{
809
+ // Attempt to check if the bottom bar appeared due to the position change
810
+ const bottomBarHeight = innerHeight - window.innerHeight;
811
+ if (bottomBarHeight && scrollPos.current >= innerHeight) {
812
+ // Move the content further up so that the bottom bar doesn't hide it
813
+ document.body.style.top = `${-(scrollPos.current + bottomBarHeight)}px`;
814
+ }
815
+ }), 300);
816
+ }
817
+ }, [
818
+ isOpen
819
+ ]);
820
+ const restorePositionSetting = React__default.useCallback(()=>{
821
+ // All browsers on iOS will return true here.
822
+ if (!isSafari()) return;
823
+ if (previousBodyPosition !== null && !noBodyStyles) {
824
+ // Convert the position from "px" to Int
825
+ const y = -parseInt(document.body.style.top, 10);
826
+ const x = -parseInt(document.body.style.left, 10);
827
+ // Restore styles
828
+ Object.assign(document.body.style, previousBodyPosition);
829
+ window.requestAnimationFrame(()=>{
830
+ if (preventScrollRestoration && activeUrl !== window.location.href) {
831
+ setActiveUrl(window.location.href);
832
+ return;
833
+ }
834
+ window.scrollTo(x, y);
835
+ });
836
+ previousBodyPosition = null;
837
+ }
838
+ }, [
839
+ activeUrl
840
+ ]);
841
+ React__default.useEffect(()=>{
842
+ function onScroll() {
843
+ scrollPos.current = window.scrollY;
844
+ }
845
+ onScroll();
846
+ window.addEventListener('scroll', onScroll);
847
+ return ()=>{
848
+ window.removeEventListener('scroll', onScroll);
849
+ };
850
+ }, []);
851
+ React__default.useEffect(()=>{
852
+ if (!modal) return;
853
+ return ()=>{
854
+ if (typeof document === 'undefined') return;
855
+ // Another drawer is opened, safe to ignore the execution
856
+ const hasDrawerOpened = !!document.querySelector('[data-vaul-drawer]');
857
+ if (hasDrawerOpened) return;
858
+ restorePositionSetting();
859
+ };
860
+ }, [
861
+ modal,
862
+ restorePositionSetting
863
+ ]);
864
+ React__default.useEffect(()=>{
865
+ if (nested || !hasBeenOpened) return;
866
+ // This is needed to force Safari toolbar to show **before** the drawer starts animating to prevent a gnarly shift from happening
867
+ if (isOpen) {
868
+ // avoid for standalone mode (PWA)
869
+ const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
870
+ !isStandalone && setPositionFixed();
871
+ if (!modal) {
872
+ window.setTimeout(()=>{
873
+ restorePositionSetting();
874
+ }, 500);
875
+ }
876
+ } else {
877
+ restorePositionSetting();
878
+ }
879
+ }, [
880
+ isOpen,
881
+ hasBeenOpened,
882
+ activeUrl,
883
+ modal,
884
+ nested,
885
+ setPositionFixed,
886
+ restorePositionSetting
887
+ ]);
888
+ return {
889
+ restorePositionSetting
890
+ };
891
+ }
892
+
893
+ function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground = false, setBackgroundColorOnScale = true, closeThreshold = CLOSE_THRESHOLD, scrollLockTimeout = SCROLL_LOCK_TIMEOUT, dismissible = true, handleOnly = false, fadeFromIndex = snapPoints && snapPoints.length - 1, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal = true, onClose, nested, noBodyStyles = false, direction = 'bottom', defaultOpen = false, disablePreventScroll = true, snapToSequentialPoint = false, preventScrollRestoration = false, repositionInputs = true, onAnimationEnd, container, autoFocus = false }) {
894
+ var _drawerRef_current, _drawerRef_current1;
895
+ const [isOpen = false, setIsOpen] = useControllableState({
896
+ defaultProp: defaultOpen,
897
+ prop: openProp,
898
+ onChange: (o)=>{
899
+ onOpenChange == null ? void 0 : onOpenChange(o);
900
+ if (!o && !nested) {
901
+ restorePositionSetting();
902
+ }
903
+ setTimeout(()=>{
904
+ onAnimationEnd == null ? void 0 : onAnimationEnd(o);
905
+ }, TRANSITIONS.DURATION * 1000);
906
+ if (o && !modal) {
907
+ if (typeof window !== 'undefined') {
908
+ window.requestAnimationFrame(()=>{
909
+ document.body.style.pointerEvents = 'auto';
910
+ });
911
+ }
912
+ }
913
+ if (!o) {
914
+ // This will be removed when the exit animation ends (`500ms`)
915
+ document.body.style.pointerEvents = 'auto';
916
+ }
917
+ }
918
+ });
919
+ const [hasBeenOpened, setHasBeenOpened] = React__default.useState(false);
920
+ const [isDragging, setIsDragging] = React__default.useState(false);
921
+ const [justReleased, setJustReleased] = React__default.useState(false);
922
+ const overlayRef = React__default.useRef(null);
923
+ const openTime = React__default.useRef(null);
924
+ const dragStartTime = React__default.useRef(null);
925
+ const dragEndTime = React__default.useRef(null);
926
+ const lastTimeDragPrevented = React__default.useRef(null);
927
+ const isAllowedToDrag = React__default.useRef(false);
928
+ const nestedOpenChangeTimer = React__default.useRef(null);
929
+ const pointerStart = React__default.useRef(0);
930
+ const keyboardIsOpen = React__default.useRef(false);
931
+ const shouldAnimate = React__default.useRef(!defaultOpen);
932
+ const previousDiffFromInitial = React__default.useRef(0);
933
+ const drawerRef = React__default.useRef(null);
934
+ const drawerHeightRef = React__default.useRef(((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0);
935
+ const drawerWidthRef = React__default.useRef(((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0);
936
+ const initialDrawerHeight = React__default.useRef(0);
937
+ const onSnapPointChange = React__default.useCallback((activeSnapPointIndex)=>{
938
+ // Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
939
+ if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
940
+ }, []);
941
+ const { activeSnapPoint, activeSnapPointIndex, setActiveSnapPoint, onRelease: onReleaseSnapPoints, snapPointsOffset, onDrag: onDragSnapPoints, shouldFade, getPercentageDragged: getSnapPointsPercentageDragged } = useSnapPoints({
942
+ snapPoints,
943
+ activeSnapPointProp,
944
+ setActiveSnapPointProp,
945
+ drawerRef,
946
+ fadeFromIndex,
947
+ overlayRef,
948
+ onSnapPointChange,
949
+ direction,
950
+ container,
951
+ snapToSequentialPoint
952
+ });
953
+ usePreventScroll({
954
+ isDisabled: !isOpen || isDragging || !modal || justReleased || !hasBeenOpened || !repositionInputs || !disablePreventScroll
955
+ });
956
+ const { restorePositionSetting } = usePositionFixed({
957
+ isOpen,
958
+ modal,
959
+ nested: nested != null ? nested : false,
960
+ hasBeenOpened,
961
+ preventScrollRestoration,
962
+ noBodyStyles
963
+ });
964
+ function getScale() {
965
+ return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
966
+ }
967
+ function onPress(event) {
968
+ var _drawerRef_current, _drawerRef_current1;
969
+ if (!dismissible && !snapPoints) return;
970
+ if (drawerRef.current && !drawerRef.current.contains(event.target)) return;
971
+ drawerHeightRef.current = ((_drawerRef_current = drawerRef.current) == null ? void 0 : _drawerRef_current.getBoundingClientRect().height) || 0;
972
+ drawerWidthRef.current = ((_drawerRef_current1 = drawerRef.current) == null ? void 0 : _drawerRef_current1.getBoundingClientRect().width) || 0;
973
+ setIsDragging(true);
974
+ dragStartTime.current = new Date();
975
+ // iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging
976
+ if (isIOS()) {
977
+ window.addEventListener('touchend', ()=>isAllowedToDrag.current = false, {
978
+ once: true
979
+ });
980
+ }
981
+ // Ensure we maintain correct pointer capture even when going outside of the drawer
982
+ event.target.setPointerCapture(event.pointerId);
983
+ pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
984
+ }
985
+ function shouldDrag(el, isDraggingInDirection) {
986
+ var _window_getSelection;
987
+ let element = el;
988
+ const highlightedText = (_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString();
989
+ const swipeAmount = drawerRef.current ? getTranslate(drawerRef.current, direction) : null;
990
+ const date = new Date();
991
+ // Fixes https://github.com/emilkowalski/vaul/issues/483
992
+ if (element.tagName === 'SELECT') {
993
+ return false;
994
+ }
995
+ if (element.hasAttribute('data-vaul-no-drag') || element.closest('[data-vaul-no-drag]')) {
996
+ return false;
997
+ }
998
+ if (direction === 'right' || direction === 'left') {
999
+ return true;
1000
+ }
1001
+ // Allow scrolling when animating
1002
+ if (openTime.current && date.getTime() - openTime.current.getTime() < 500) {
1003
+ return false;
1004
+ }
1005
+ if (swipeAmount !== null) {
1006
+ if (direction === 'bottom' ? swipeAmount > 0 : swipeAmount < 0) {
1007
+ return true;
1008
+ }
1009
+ }
1010
+ // Don't drag if there's highlighted text
1011
+ if (highlightedText && highlightedText.length > 0) {
1012
+ return false;
1013
+ }
1014
+ // Disallow dragging if drawer was scrolled within `scrollLockTimeout`
1015
+ if (lastTimeDragPrevented.current && date.getTime() - lastTimeDragPrevented.current.getTime() < scrollLockTimeout && swipeAmount === 0) {
1016
+ lastTimeDragPrevented.current = date;
1017
+ return false;
1018
+ }
1019
+ if (isDraggingInDirection) {
1020
+ lastTimeDragPrevented.current = date;
1021
+ // We are dragging down so we should allow scrolling
1022
+ return false;
1023
+ }
1024
+ // Keep climbing up the DOM tree as long as there's a parent
1025
+ while(element){
1026
+ // Check if the element is scrollable
1027
+ if (element.scrollHeight > element.clientHeight) {
1028
+ if (element.scrollTop !== 0) {
1029
+ lastTimeDragPrevented.current = new Date();
1030
+ // The element is scrollable and not scrolled to the top, so don't drag
1031
+ return false;
1032
+ }
1033
+ if (element.getAttribute('role') === 'dialog') {
1034
+ return true;
1035
+ }
1036
+ }
1037
+ // Move up to the parent element
1038
+ element = element.parentNode;
1039
+ }
1040
+ // No scrollable parents not scrolled to the top found, so drag
1041
+ return true;
1042
+ }
1043
+ function onDrag(event) {
1044
+ if (!drawerRef.current) {
1045
+ return;
1046
+ }
1047
+ // We need to know how much of the drawer has been dragged in percentages so that we can transform background accordingly
1048
+ if (isDragging) {
1049
+ const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;
1050
+ const draggedDistance = (pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX)) * directionMultiplier;
1051
+ const isDraggingInDirection = draggedDistance > 0;
1052
+ // Pre condition for disallowing dragging in the close direction.
1053
+ const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
1054
+ // Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.
1055
+ if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) return;
1056
+ // We need to capture last time when drag with scroll was triggered and have a timeout between
1057
+ const absDraggedDistance = Math.abs(draggedDistance);
1058
+ const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');
1059
+ const drawerDimension = direction === 'bottom' || direction === 'top' ? drawerHeightRef.current : drawerWidthRef.current;
1060
+ // Calculate the percentage dragged, where 1 is the closed position
1061
+ let percentageDragged = absDraggedDistance / drawerDimension;
1062
+ const snapPointPercentageDragged = getSnapPointsPercentageDragged(absDraggedDistance, isDraggingInDirection);
1063
+ if (snapPointPercentageDragged !== null) {
1064
+ percentageDragged = snapPointPercentageDragged;
1065
+ }
1066
+ // Disallow close dragging beyond the smallest snap point.
1067
+ if (noCloseSnapPointsPreCondition && percentageDragged >= 1) {
1068
+ return;
1069
+ }
1070
+ if (!isAllowedToDrag.current && !shouldDrag(event.target, isDraggingInDirection)) return;
1071
+ drawerRef.current.classList.add(DRAG_CLASS);
1072
+ // 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
1073
+ isAllowedToDrag.current = true;
1074
+ set(drawerRef.current, {
1075
+ transition: 'none'
1076
+ });
1077
+ set(overlayRef.current, {
1078
+ transition: 'none'
1079
+ });
1080
+ if (snapPoints) {
1081
+ onDragSnapPoints({
1082
+ draggedDistance
1083
+ });
1084
+ }
1085
+ // Run this only if snapPoints are not defined or if we are at the last snap point (highest one)
1086
+ if (isDraggingInDirection && !snapPoints) {
1087
+ const dampenedDraggedDistance = dampenValue(draggedDistance);
1088
+ const translateValue = Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;
1089
+ set(drawerRef.current, {
1090
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
1091
+ });
1092
+ return;
1093
+ }
1094
+ const opacityValue = 1 - percentageDragged;
1095
+ if (shouldFade || fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1) {
1096
+ onDragProp == null ? void 0 : onDragProp(event, percentageDragged);
1097
+ set(overlayRef.current, {
1098
+ opacity: `${opacityValue}`,
1099
+ transition: 'none'
1100
+ }, true);
1101
+ }
1102
+ if (wrapper && overlayRef.current && shouldScaleBackground) {
1103
+ // Calculate percentageDragged as a fraction (0 to 1)
1104
+ const scaleValue = Math.min(getScale() + percentageDragged * (1 - getScale()), 1);
1105
+ const borderRadiusValue = 8 - percentageDragged * 8;
1106
+ const translateValue = Math.max(0, 14 - percentageDragged * 14);
1107
+ set(wrapper, {
1108
+ borderRadius: `${borderRadiusValue}px`,
1109
+ transform: isVertical(direction) ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)` : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,
1110
+ transition: 'none'
1111
+ }, true);
1112
+ }
1113
+ if (!snapPoints) {
1114
+ const translateValue = absDraggedDistance * directionMultiplier;
1115
+ set(drawerRef.current, {
1116
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
1117
+ });
1118
+ }
1119
+ }
1120
+ }
1121
+ React__default.useEffect(()=>{
1122
+ window.requestAnimationFrame(()=>{
1123
+ shouldAnimate.current = true;
1124
+ });
1125
+ }, []);
1126
+ React__default.useEffect(()=>{
1127
+ var _window_visualViewport;
1128
+ function onVisualViewportChange() {
1129
+ if (!drawerRef.current || !repositionInputs) return;
1130
+ const focusedElement = document.activeElement;
1131
+ if (isInput(focusedElement) || keyboardIsOpen.current) {
1132
+ var _window_visualViewport;
1133
+ const visualViewportHeight = ((_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.height) || 0;
1134
+ const totalHeight = window.innerHeight;
1135
+ // This is the height of the keyboard
1136
+ let diffFromInitial = totalHeight - visualViewportHeight;
1137
+ const drawerHeight = drawerRef.current.getBoundingClientRect().height || 0;
1138
+ // Adjust drawer height only if it's tall enough
1139
+ const isTallEnough = drawerHeight > totalHeight * 0.8;
1140
+ if (!initialDrawerHeight.current) {
1141
+ initialDrawerHeight.current = drawerHeight;
1142
+ }
1143
+ const offsetFromTop = drawerRef.current.getBoundingClientRect().top;
1144
+ // 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.
1145
+ if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) {
1146
+ keyboardIsOpen.current = !keyboardIsOpen.current;
1147
+ }
1148
+ if (snapPoints && snapPoints.length > 0 && snapPointsOffset && activeSnapPointIndex) {
1149
+ const activeSnapPointHeight = snapPointsOffset[activeSnapPointIndex] || 0;
1150
+ diffFromInitial += activeSnapPointHeight;
1151
+ }
1152
+ previousDiffFromInitial.current = diffFromInitial;
1153
+ // 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
1154
+ if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {
1155
+ const height = drawerRef.current.getBoundingClientRect().height;
1156
+ let newDrawerHeight = height;
1157
+ if (height > visualViewportHeight) {
1158
+ newDrawerHeight = visualViewportHeight - (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);
1159
+ }
1160
+ // 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
1161
+ if (fixed) {
1162
+ drawerRef.current.style.height = `${height - Math.max(diffFromInitial, 0)}px`;
1163
+ } else {
1164
+ drawerRef.current.style.height = `${Math.max(newDrawerHeight, visualViewportHeight - offsetFromTop)}px`;
1165
+ }
1166
+ } else if (!isMobileFirefox()) {
1167
+ drawerRef.current.style.height = `${initialDrawerHeight.current}px`;
1168
+ }
1169
+ if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {
1170
+ drawerRef.current.style.bottom = `0px`;
1171
+ } else {
1172
+ // Negative bottom value would never make sense
1173
+ drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;
1174
+ }
1175
+ }
1176
+ }
1177
+ (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.addEventListener('resize', onVisualViewportChange);
1178
+ return ()=>{
1179
+ var _window_visualViewport;
1180
+ return (_window_visualViewport = window.visualViewport) == null ? void 0 : _window_visualViewport.removeEventListener('resize', onVisualViewportChange);
1181
+ };
1182
+ }, [
1183
+ activeSnapPointIndex,
1184
+ snapPoints,
1185
+ snapPointsOffset
1186
+ ]);
1187
+ function closeDrawer(fromWithin) {
1188
+ cancelDrag();
1189
+ onClose == null ? void 0 : onClose();
1190
+ if (!fromWithin) {
1191
+ setIsOpen(false);
1192
+ }
1193
+ setTimeout(()=>{
1194
+ if (snapPoints) {
1195
+ setActiveSnapPoint(snapPoints[0]);
1196
+ }
1197
+ }, TRANSITIONS.DURATION * 1000); // seconds to ms
1198
+ }
1199
+ function resetDrawer() {
1200
+ if (!drawerRef.current) return;
1201
+ const wrapper = document.querySelector('[data-vaul-drawer-wrapper]');
1202
+ const currentSwipeAmount = getTranslate(drawerRef.current, direction);
1203
+ set(drawerRef.current, {
1204
+ transform: 'translate3d(0, 0, 0)',
1205
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`
1206
+ });
1207
+ set(overlayRef.current, {
1208
+ transition: `opacity ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
1209
+ opacity: '1'
1210
+ });
1211
+ // Don't reset background if swiped upwards
1212
+ if (shouldScaleBackground && currentSwipeAmount && currentSwipeAmount > 0 && isOpen) {
1213
+ set(wrapper, {
1214
+ borderRadius: `${BORDER_RADIUS}px`,
1215
+ overflow: 'hidden',
1216
+ ...isVertical(direction) ? {
1217
+ transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
1218
+ transformOrigin: 'top'
1219
+ } : {
1220
+ transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
1221
+ transformOrigin: 'left'
1222
+ },
1223
+ transitionProperty: 'transform, border-radius',
1224
+ transitionDuration: `${TRANSITIONS.DURATION}s`,
1225
+ transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`
1226
+ }, true);
1227
+ }
1228
+ }
1229
+ function cancelDrag() {
1230
+ if (!isDragging || !drawerRef.current) return;
1231
+ drawerRef.current.classList.remove(DRAG_CLASS);
1232
+ isAllowedToDrag.current = false;
1233
+ setIsDragging(false);
1234
+ dragEndTime.current = new Date();
1235
+ }
1236
+ function onRelease(event) {
1237
+ if (!isDragging || !drawerRef.current) return;
1238
+ drawerRef.current.classList.remove(DRAG_CLASS);
1239
+ isAllowedToDrag.current = false;
1240
+ setIsDragging(false);
1241
+ dragEndTime.current = new Date();
1242
+ const swipeAmount = getTranslate(drawerRef.current, direction);
1243
+ if (!event || !shouldDrag(event.target, false) || !swipeAmount || Number.isNaN(swipeAmount)) return;
1244
+ if (dragStartTime.current === null) return;
1245
+ const timeTaken = dragEndTime.current.getTime() - dragStartTime.current.getTime();
1246
+ const distMoved = pointerStart.current - (isVertical(direction) ? event.pageY : event.pageX);
1247
+ const velocity = Math.abs(distMoved) / timeTaken;
1248
+ if (velocity > 0.05) {
1249
+ // `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.
1250
+ setJustReleased(true);
1251
+ setTimeout(()=>{
1252
+ setJustReleased(false);
1253
+ }, 200);
1254
+ }
1255
+ if (snapPoints) {
1256
+ const directionMultiplier = direction === 'bottom' || direction === 'right' ? 1 : -1;
1257
+ onReleaseSnapPoints({
1258
+ draggedDistance: distMoved * directionMultiplier,
1259
+ closeDrawer,
1260
+ velocity,
1261
+ dismissible
1262
+ });
1263
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
1264
+ return;
1265
+ }
1266
+ // Moved upwards, don't do anything
1267
+ if (direction === 'bottom' || direction === 'right' ? distMoved > 0 : distMoved < 0) {
1268
+ resetDrawer();
1269
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
1270
+ return;
1271
+ }
1272
+ if (velocity > VELOCITY_THRESHOLD) {
1273
+ closeDrawer();
1274
+ onReleaseProp == null ? void 0 : onReleaseProp(event, false);
1275
+ return;
1276
+ }
1277
+ var _drawerRef_current_getBoundingClientRect_height;
1278
+ const visibleDrawerHeight = Math.min((_drawerRef_current_getBoundingClientRect_height = drawerRef.current.getBoundingClientRect().height) != null ? _drawerRef_current_getBoundingClientRect_height : 0, window.innerHeight);
1279
+ var _drawerRef_current_getBoundingClientRect_width;
1280
+ const visibleDrawerWidth = Math.min((_drawerRef_current_getBoundingClientRect_width = drawerRef.current.getBoundingClientRect().width) != null ? _drawerRef_current_getBoundingClientRect_width : 0, window.innerWidth);
1281
+ const isHorizontalSwipe = direction === 'left' || direction === 'right';
1282
+ if (Math.abs(swipeAmount) >= (isHorizontalSwipe ? visibleDrawerWidth : visibleDrawerHeight) * closeThreshold) {
1283
+ closeDrawer();
1284
+ onReleaseProp == null ? void 0 : onReleaseProp(event, false);
1285
+ return;
1286
+ }
1287
+ onReleaseProp == null ? void 0 : onReleaseProp(event, true);
1288
+ resetDrawer();
1289
+ }
1290
+ React__default.useEffect(()=>{
1291
+ // Trigger enter animation without using CSS animation
1292
+ if (isOpen) {
1293
+ set(document.documentElement, {
1294
+ scrollBehavior: 'auto'
1295
+ });
1296
+ openTime.current = new Date();
1297
+ }
1298
+ return ()=>{
1299
+ reset(document.documentElement, 'scrollBehavior');
1300
+ };
1301
+ }, [
1302
+ isOpen
1303
+ ]);
1304
+ function onNestedOpenChange(o) {
1305
+ const scale = o ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth : 1;
1306
+ const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;
1307
+ if (nestedOpenChangeTimer.current) {
1308
+ window.clearTimeout(nestedOpenChangeTimer.current);
1309
+ }
1310
+ set(drawerRef.current, {
1311
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
1312
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)` : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`
1313
+ });
1314
+ if (!o && drawerRef.current) {
1315
+ nestedOpenChangeTimer.current = setTimeout(()=>{
1316
+ const translateValue = getTranslate(drawerRef.current, direction);
1317
+ set(drawerRef.current, {
1318
+ transition: 'none',
1319
+ transform: isVertical(direction) ? `translate3d(0, ${translateValue}px, 0)` : `translate3d(${translateValue}px, 0, 0)`
1320
+ });
1321
+ }, 500);
1322
+ }
1323
+ }
1324
+ function onNestedDrag(_event, percentageDragged) {
1325
+ if (percentageDragged < 0) return;
1326
+ const initialScale = (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;
1327
+ const newScale = initialScale + percentageDragged * (1 - initialScale);
1328
+ const newTranslate = -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;
1329
+ set(drawerRef.current, {
1330
+ transform: isVertical(direction) ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)` : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,
1331
+ transition: 'none'
1332
+ });
1333
+ }
1334
+ function onNestedRelease(_event, o) {
1335
+ const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;
1336
+ const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;
1337
+ const translate = o ? -NESTED_DISPLACEMENT : 0;
1338
+ if (o) {
1339
+ set(drawerRef.current, {
1340
+ transition: `transform ${TRANSITIONS.DURATION}s cubic-bezier(${TRANSITIONS.EASE.join(',')})`,
1341
+ transform: isVertical(direction) ? `scale(${scale}) translate3d(0, ${translate}px, 0)` : `scale(${scale}) translate3d(${translate}px, 0, 0)`
1342
+ });
1343
+ }
1344
+ }
1345
+ React__default.useEffect(()=>{
1346
+ if (!modal) {
1347
+ // Need to do this manually unfortunately
1348
+ window.requestAnimationFrame(()=>{
1349
+ document.body.style.pointerEvents = 'auto';
1350
+ });
1351
+ }
1352
+ }, [
1353
+ modal
1354
+ ]);
1355
+ return /*#__PURE__*/ React__default.createElement(Root$1, {
1356
+ defaultOpen: defaultOpen,
1357
+ onOpenChange: (open)=>{
1358
+ if (!dismissible && !open) return;
1359
+ if (open) {
1360
+ setHasBeenOpened(true);
1361
+ } else {
1362
+ closeDrawer(true);
1363
+ }
1364
+ setIsOpen(open);
1365
+ },
1366
+ open: isOpen
1367
+ }, /*#__PURE__*/ React__default.createElement(DrawerContext.Provider, {
1368
+ value: {
1369
+ activeSnapPoint,
1370
+ snapPoints,
1371
+ setActiveSnapPoint,
1372
+ drawerRef,
1373
+ overlayRef,
1374
+ onOpenChange,
1375
+ onPress,
1376
+ onRelease,
1377
+ onDrag,
1378
+ dismissible,
1379
+ shouldAnimate,
1380
+ handleOnly,
1381
+ isOpen,
1382
+ isDragging,
1383
+ shouldFade,
1384
+ closeDrawer,
1385
+ onNestedDrag,
1386
+ onNestedOpenChange,
1387
+ onNestedRelease,
1388
+ keyboardIsOpen,
1389
+ modal,
1390
+ snapPointsOffset,
1391
+ activeSnapPointIndex,
1392
+ direction,
1393
+ shouldScaleBackground,
1394
+ setBackgroundColorOnScale,
1395
+ noBodyStyles,
1396
+ container,
1397
+ autoFocus
1398
+ }
1399
+ }, children));
1400
+ }
1401
+ const Overlay = /*#__PURE__*/ React__default.forwardRef(function({ ...rest }, ref) {
1402
+ const { overlayRef, snapPoints, onRelease, shouldFade, isOpen, modal, shouldAnimate } = useDrawerContext();
1403
+ const composedRef = useComposedRefs(ref, overlayRef);
1404
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
1405
+ // Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog library
1406
+ if (!modal) {
1407
+ return null;
1408
+ }
1409
+ const onMouseUp = React__default.useCallback((event)=>onRelease(event), [
1410
+ onRelease
1411
+ ]);
1412
+ return /*#__PURE__*/ React__default.createElement(Overlay$1, {
1413
+ onMouseUp: onMouseUp,
1414
+ ref: composedRef,
1415
+ "data-vaul-overlay": "",
1416
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? 'true' : 'false',
1417
+ "data-vaul-snap-points-overlay": isOpen && shouldFade ? 'true' : 'false',
1418
+ "data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? 'true' : 'false',
1419
+ ...rest
1420
+ });
1421
+ });
1422
+ Overlay.displayName = 'Drawer.Overlay';
1423
+ const Content = /*#__PURE__*/ React__default.forwardRef(function({ onPointerDownOutside, style, onOpenAutoFocus, ...rest }, ref) {
1424
+ const { drawerRef, onPress, onRelease, onDrag, keyboardIsOpen, snapPointsOffset, activeSnapPointIndex, modal, isOpen, direction, snapPoints, container, handleOnly, shouldAnimate, autoFocus } = useDrawerContext();
1425
+ // Needed to use transition instead of animations
1426
+ const [delayedSnapPoints, setDelayedSnapPoints] = React__default.useState(false);
1427
+ const composedRef = useComposedRefs(ref, drawerRef);
1428
+ const pointerStartRef = React__default.useRef(null);
1429
+ const lastKnownPointerEventRef = React__default.useRef(null);
1430
+ const wasBeyondThePointRef = React__default.useRef(false);
1431
+ const hasSnapPoints = snapPoints && snapPoints.length > 0;
1432
+ useScaleBackground();
1433
+ const isDeltaInDirection = (delta, direction, threshold = 0)=>{
1434
+ if (wasBeyondThePointRef.current) return true;
1435
+ const deltaY = Math.abs(delta.y);
1436
+ const deltaX = Math.abs(delta.x);
1437
+ const isDeltaX = deltaX > deltaY;
1438
+ const dFactor = [
1439
+ 'bottom',
1440
+ 'right'
1441
+ ].includes(direction) ? 1 : -1;
1442
+ if (direction === 'left' || direction === 'right') {
1443
+ const isReverseDirection = delta.x * dFactor < 0;
1444
+ if (!isReverseDirection && deltaX >= 0 && deltaX <= threshold) {
1445
+ return isDeltaX;
1446
+ }
1447
+ } else {
1448
+ const isReverseDirection = delta.y * dFactor < 0;
1449
+ if (!isReverseDirection && deltaY >= 0 && deltaY <= threshold) {
1450
+ return !isDeltaX;
1451
+ }
1452
+ }
1453
+ wasBeyondThePointRef.current = true;
1454
+ return true;
1455
+ };
1456
+ React__default.useEffect(()=>{
1457
+ if (hasSnapPoints) {
1458
+ window.requestAnimationFrame(()=>{
1459
+ setDelayedSnapPoints(true);
1460
+ });
1461
+ }
1462
+ }, []);
1463
+ function handleOnPointerUp(event) {
1464
+ pointerStartRef.current = null;
1465
+ wasBeyondThePointRef.current = false;
1466
+ onRelease(event);
1467
+ }
1468
+ return /*#__PURE__*/ React__default.createElement(Content$1, {
1469
+ "data-vaul-drawer-direction": direction,
1470
+ "data-vaul-drawer": "",
1471
+ "data-vaul-delayed-snap-points": delayedSnapPoints ? 'true' : 'false',
1472
+ "data-vaul-snap-points": isOpen && hasSnapPoints ? 'true' : 'false',
1473
+ "data-vaul-custom-container": container ? 'true' : 'false',
1474
+ "data-vaul-animate": (shouldAnimate == null ? void 0 : shouldAnimate.current) ? 'true' : 'false',
1475
+ ...rest,
1476
+ ref: composedRef,
1477
+ style: snapPointsOffset && snapPointsOffset.length > 0 ? {
1478
+ '--snap-point-height': `${snapPointsOffset[activeSnapPointIndex != null ? activeSnapPointIndex : 0]}px`,
1479
+ ...style
1480
+ } : style,
1481
+ onPointerDown: (event)=>{
1482
+ if (handleOnly) return;
1483
+ rest.onPointerDown == null ? void 0 : rest.onPointerDown.call(rest, event);
1484
+ pointerStartRef.current = {
1485
+ x: event.pageX,
1486
+ y: event.pageY
1487
+ };
1488
+ onPress(event);
1489
+ },
1490
+ onOpenAutoFocus: (e)=>{
1491
+ onOpenAutoFocus == null ? void 0 : onOpenAutoFocus(e);
1492
+ if (!autoFocus) {
1493
+ e.preventDefault();
1494
+ }
1495
+ },
1496
+ onPointerDownOutside: (e)=>{
1497
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(e);
1498
+ if (!modal || e.defaultPrevented) {
1499
+ e.preventDefault();
1500
+ return;
1501
+ }
1502
+ if (keyboardIsOpen.current) {
1503
+ keyboardIsOpen.current = false;
1504
+ }
1505
+ },
1506
+ onFocusOutside: (e)=>{
1507
+ if (!modal) {
1508
+ e.preventDefault();
1509
+ return;
1510
+ }
1511
+ },
1512
+ onPointerMove: (event)=>{
1513
+ lastKnownPointerEventRef.current = event;
1514
+ if (handleOnly) return;
1515
+ rest.onPointerMove == null ? void 0 : rest.onPointerMove.call(rest, event);
1516
+ if (!pointerStartRef.current) return;
1517
+ const yPosition = event.pageY - pointerStartRef.current.y;
1518
+ const xPosition = event.pageX - pointerStartRef.current.x;
1519
+ const swipeStartThreshold = event.pointerType === 'touch' ? 10 : 2;
1520
+ const delta = {
1521
+ x: xPosition,
1522
+ y: yPosition
1523
+ };
1524
+ const isAllowedToSwipe = isDeltaInDirection(delta, direction, swipeStartThreshold);
1525
+ if (isAllowedToSwipe) onDrag(event);
1526
+ else if (Math.abs(xPosition) > swipeStartThreshold || Math.abs(yPosition) > swipeStartThreshold) {
1527
+ pointerStartRef.current = null;
1528
+ }
1529
+ },
1530
+ onPointerUp: (event)=>{
1531
+ rest.onPointerUp == null ? void 0 : rest.onPointerUp.call(rest, event);
1532
+ pointerStartRef.current = null;
1533
+ wasBeyondThePointRef.current = false;
1534
+ onRelease(event);
1535
+ },
1536
+ onPointerOut: (event)=>{
1537
+ rest.onPointerOut == null ? void 0 : rest.onPointerOut.call(rest, event);
1538
+ handleOnPointerUp(lastKnownPointerEventRef.current);
1539
+ },
1540
+ onContextMenu: (event)=>{
1541
+ rest.onContextMenu == null ? void 0 : rest.onContextMenu.call(rest, event);
1542
+ if (lastKnownPointerEventRef.current) {
1543
+ handleOnPointerUp(lastKnownPointerEventRef.current);
1544
+ }
1545
+ }
1546
+ });
1547
+ });
1548
+ Content.displayName = 'Drawer.Content';
1549
+ const LONG_HANDLE_PRESS_TIMEOUT = 250;
1550
+ const DOUBLE_TAP_TIMEOUT = 120;
1551
+ const Handle = /*#__PURE__*/ React__default.forwardRef(function({ preventCycle = false, children, ...rest }, ref) {
1552
+ const { closeDrawer, isDragging, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, handleOnly, isOpen, onPress, onDrag } = useDrawerContext();
1553
+ const closeTimeoutIdRef = React__default.useRef(null);
1554
+ const shouldCancelInteractionRef = React__default.useRef(false);
1555
+ function handleStartCycle() {
1556
+ // Stop if this is the second click of a double click
1557
+ if (shouldCancelInteractionRef.current) {
1558
+ handleCancelInteraction();
1559
+ return;
1560
+ }
1561
+ window.setTimeout(()=>{
1562
+ handleCycleSnapPoints();
1563
+ }, DOUBLE_TAP_TIMEOUT);
1564
+ }
1565
+ function handleCycleSnapPoints() {
1566
+ // Prevent accidental taps while resizing drawer
1567
+ if (isDragging || preventCycle || shouldCancelInteractionRef.current) {
1568
+ handleCancelInteraction();
1569
+ return;
1570
+ }
1571
+ // Make sure to clear the timeout id if the user releases the handle before the cancel timeout
1572
+ handleCancelInteraction();
1573
+ if (!snapPoints || snapPoints.length === 0) {
1574
+ if (!dismissible) {
1575
+ closeDrawer();
1576
+ }
1577
+ return;
1578
+ }
1579
+ const isLastSnapPoint = activeSnapPoint === snapPoints[snapPoints.length - 1];
1580
+ if (isLastSnapPoint && dismissible) {
1581
+ closeDrawer();
1582
+ return;
1583
+ }
1584
+ const currentSnapIndex = snapPoints.findIndex((point)=>point === activeSnapPoint);
1585
+ if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints
1586
+ const nextSnapPoint = snapPoints[currentSnapIndex + 1];
1587
+ setActiveSnapPoint(nextSnapPoint);
1588
+ }
1589
+ function handleStartInteraction() {
1590
+ closeTimeoutIdRef.current = window.setTimeout(()=>{
1591
+ // Cancel click interaction on a long press
1592
+ shouldCancelInteractionRef.current = true;
1593
+ }, LONG_HANDLE_PRESS_TIMEOUT);
1594
+ }
1595
+ function handleCancelInteraction() {
1596
+ if (closeTimeoutIdRef.current) {
1597
+ window.clearTimeout(closeTimeoutIdRef.current);
1598
+ }
1599
+ shouldCancelInteractionRef.current = false;
1600
+ }
1601
+ return /*#__PURE__*/ React__default.createElement("div", {
1602
+ onClick: handleStartCycle,
1603
+ onPointerCancel: handleCancelInteraction,
1604
+ onPointerDown: (e)=>{
1605
+ if (handleOnly) onPress(e);
1606
+ handleStartInteraction();
1607
+ },
1608
+ onPointerMove: (e)=>{
1609
+ if (handleOnly) onDrag(e);
1610
+ },
1611
+ // onPointerUp is already handled by the content component
1612
+ ref: ref,
1613
+ "data-vaul-drawer-visible": isOpen ? 'true' : 'false',
1614
+ "data-vaul-handle": "",
1615
+ "aria-hidden": "true",
1616
+ ...rest
1617
+ }, /*#__PURE__*/ React__default.createElement("span", {
1618
+ "data-vaul-handle-hitarea": "",
1619
+ "aria-hidden": "true"
1620
+ }, children));
1621
+ });
1622
+ Handle.displayName = 'Drawer.Handle';
1623
+ function Portal(props) {
1624
+ const context = useDrawerContext();
1625
+ const { container = context.container, ...portalProps } = props;
1626
+ return /*#__PURE__*/ React__default.createElement(Portal$1, {
1627
+ container: container,
1628
+ ...portalProps
1629
+ });
1630
+ }
1631
+ const Drawer$2 = {
1632
+ Root,
1633
+ Content,
1634
+ Overlay,
1635
+ Trigger: Trigger,
1636
+ Portal,
1637
+ Close: Close,
1638
+ Title: Title,
1639
+ Description: Description
1640
+ };
1641
+
1642
+ function Drawer$1({ ...props }) {
1643
+ return jsx(Drawer$2.Root, { "data-slot": "drawer", ...props });
1644
+ }
1645
+ function DrawerTrigger$1({ ...props }) {
1646
+ return jsx(Drawer$2.Trigger, { "data-slot": "drawer-trigger", ...props });
1647
+ }
1648
+ function DrawerPortal$1({ ...props }) {
1649
+ return jsx(Drawer$2.Portal, { "data-slot": "drawer-portal", ...props });
1650
+ }
1651
+ function DrawerClose$1({ ...props }) {
1652
+ return jsx(Drawer$2.Close, { "data-slot": "drawer-close", ...props });
1653
+ }
1654
+ function DrawerOverlay$1({ className, ...props }) {
1655
+ return (jsx(Drawer$2.Overlay, { "data-slot": "drawer-overlay", className: cn("fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
1656
+ }
1657
+ function DrawerContent$1({ className, children, ...props }) {
1658
+ return (jsxs(DrawerPortal$1, { "data-slot": "drawer-portal", children: [jsx(DrawerOverlay$1, {}), jsxs(Drawer$2.Content, { "data-slot": "drawer-content", className: cn("group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:start-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-e-xl data-[vaul-drawer-direction=left]:border-e data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:end-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-s-xl data-[vaul-drawer-direction=right]:border-s data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm", className), ...props, children: [jsx("div", { className: "mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), children] })] }));
1659
+ }
1660
+ function DrawerHeader$1({ className, ...props }) {
1661
+ return (jsx("div", { "data-slot": "drawer-header", className: cn("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-start", className), ...props }));
1662
+ }
1663
+ function DrawerFooter$1({ className, ...props }) {
1664
+ return (jsx("div", { "data-slot": "drawer-footer", className: cn("mt-auto flex flex-col gap-2 p-4", className), ...props }));
1665
+ }
1666
+ function DrawerTitle$1({ className, ...props }) {
1667
+ return (jsx(Drawer$2.Title, { "data-slot": "drawer-title", className: cn("text-base font-medium text-foreground", className), ...props }));
1668
+ }
1669
+ function DrawerDescription$1({ className, ...props }) {
1670
+ return (jsx(Drawer$2.Description, { "data-slot": "drawer-description", className: cn("text-sm text-muted-foreground", className), ...props }));
1671
+ }
1672
+
1673
+ const Drawer = (props) => (jsx(Drawer$1, { ...props }));
1674
+ const DrawerPortal = (props) => jsx(DrawerPortal$1, { ...props });
1675
+ const DrawerOverlay = (props) => jsx(DrawerOverlay$1, { ...props });
1676
+ const DrawerTrigger = (props) => jsx(DrawerTrigger$1, { ...props });
1677
+ const DrawerClose = (props) => (jsx(DrawerClose$1, { ...props }));
1678
+ const DrawerContent = (props) => jsx(DrawerContent$1, { ...props });
1679
+ const DrawerHeader = (props) => jsx(DrawerHeader$1, { ...props });
1680
+ const DrawerFooter = (props) => jsx(DrawerFooter$1, { ...props });
1681
+ const DrawerTitle = (props) => (jsx(DrawerTitle$1, { ...props }));
1682
+ const DrawerDescription = (props) => jsx(DrawerDescription$1, { ...props });
1683
+
1684
+ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger };
1685
+ //# sourceMappingURL=Drawer.js.map