@metamask-previews/design-system-react-native 0.11.0-preview.9c677c4 → 0.13.0-preview.69c659c

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 (237) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/dist/components/AvatarNetwork/AvatarNetwork.types.cjs.map +1 -1
  3. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts +7 -9
  4. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.cts.map +1 -1
  5. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts +7 -9
  6. package/dist/components/AvatarNetwork/AvatarNetwork.types.d.mts.map +1 -1
  7. package/dist/components/AvatarNetwork/AvatarNetwork.types.mjs.map +1 -1
  8. package/dist/components/BadgeWrapper/BadgeWrapper.cjs +8 -8
  9. package/dist/components/BadgeWrapper/BadgeWrapper.cjs.map +1 -1
  10. package/dist/components/BadgeWrapper/BadgeWrapper.d.cts.map +1 -1
  11. package/dist/components/BadgeWrapper/BadgeWrapper.d.mts.map +1 -1
  12. package/dist/components/BadgeWrapper/BadgeWrapper.mjs +1 -1
  13. package/dist/components/BadgeWrapper/BadgeWrapper.mjs.map +1 -1
  14. package/dist/components/BadgeWrapper/BadgeWrapper.types.cjs.map +1 -1
  15. package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts +4 -51
  16. package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts.map +1 -1
  17. package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts +4 -51
  18. package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts.map +1 -1
  19. package/dist/components/BadgeWrapper/BadgeWrapper.types.mjs.map +1 -1
  20. package/dist/components/BadgeWrapper/index.cjs +3 -3
  21. package/dist/components/BadgeWrapper/index.cjs.map +1 -1
  22. package/dist/components/BadgeWrapper/index.d.cts +1 -2
  23. package/dist/components/BadgeWrapper/index.d.cts.map +1 -1
  24. package/dist/components/BadgeWrapper/index.d.mts +1 -2
  25. package/dist/components/BadgeWrapper/index.d.mts.map +1 -1
  26. package/dist/components/BadgeWrapper/index.mjs +1 -1
  27. package/dist/components/BadgeWrapper/index.mjs.map +1 -1
  28. package/dist/components/BannerAlert/BannerAlert.constants.cjs +8 -8
  29. package/dist/components/BannerAlert/BannerAlert.constants.cjs.map +1 -1
  30. package/dist/components/BannerAlert/BannerAlert.constants.d.cts +2 -2
  31. package/dist/components/BannerAlert/BannerAlert.constants.d.cts.map +1 -1
  32. package/dist/components/BannerAlert/BannerAlert.constants.d.mts +2 -2
  33. package/dist/components/BannerAlert/BannerAlert.constants.d.mts.map +1 -1
  34. package/dist/components/BannerAlert/BannerAlert.constants.mjs +2 -2
  35. package/dist/components/BannerAlert/BannerAlert.constants.mjs.map +1 -1
  36. package/dist/components/BannerBase/BannerBase.cjs +2 -1
  37. package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
  38. package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
  39. package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
  40. package/dist/components/BannerBase/BannerBase.mjs +2 -1
  41. package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
  42. package/dist/components/BottomSheet/BottomSheet.cjs +2 -2
  43. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  44. package/dist/components/BottomSheet/BottomSheet.d.cts +30 -0
  45. package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -1
  46. package/dist/components/BottomSheet/BottomSheet.d.mts +30 -0
  47. package/dist/components/BottomSheet/BottomSheet.d.mts.map +1 -1
  48. package/dist/components/BottomSheet/BottomSheet.mjs +2 -2
  49. package/dist/components/BottomSheet/BottomSheet.mjs.map +1 -1
  50. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +2 -2
  51. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
  52. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts +30 -0
  53. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts.map +1 -1
  54. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts +30 -0
  55. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts.map +1 -1
  56. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +2 -2
  57. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
  58. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.cjs.map +1 -1
  59. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts +7 -0
  60. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts.map +1 -1
  61. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts +7 -0
  62. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts.map +1 -1
  63. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.mjs.map +1 -1
  64. package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs +2 -2
  65. package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs.map +1 -1
  66. package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs +2 -2
  67. package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs.map +1 -1
  68. package/dist/components/Box/Box.constants.cjs.map +1 -1
  69. package/dist/components/Box/Box.constants.d.cts +1 -1
  70. package/dist/components/Box/Box.constants.d.cts.map +1 -1
  71. package/dist/components/Box/Box.constants.d.mts +1 -1
  72. package/dist/components/Box/Box.constants.d.mts.map +1 -1
  73. package/dist/components/Box/Box.constants.mjs.map +1 -1
  74. package/dist/components/Box/Box.types.cjs.map +1 -1
  75. package/dist/components/Box/Box.types.d.cts +3 -107
  76. package/dist/components/Box/Box.types.d.cts.map +1 -1
  77. package/dist/components/Box/Box.types.d.mts +3 -107
  78. package/dist/components/Box/Box.types.d.mts.map +1 -1
  79. package/dist/components/Box/Box.types.mjs.map +1 -1
  80. package/dist/components/Box/index.cjs +7 -7
  81. package/dist/components/Box/index.cjs.map +1 -1
  82. package/dist/components/Box/index.d.cts +1 -2
  83. package/dist/components/Box/index.d.cts.map +1 -1
  84. package/dist/components/Box/index.d.mts +1 -2
  85. package/dist/components/Box/index.d.mts.map +1 -1
  86. package/dist/components/Box/index.mjs +1 -1
  87. package/dist/components/Box/index.mjs.map +1 -1
  88. package/dist/components/BoxHorizontal/BoxHorizontal.cjs +18 -0
  89. package/dist/components/BoxHorizontal/BoxHorizontal.cjs.map +1 -0
  90. package/dist/components/BoxHorizontal/BoxHorizontal.d.cts +7 -0
  91. package/dist/components/BoxHorizontal/BoxHorizontal.d.cts.map +1 -0
  92. package/dist/components/BoxHorizontal/BoxHorizontal.d.mts +7 -0
  93. package/dist/components/BoxHorizontal/BoxHorizontal.d.mts.map +1 -0
  94. package/dist/components/BoxHorizontal/BoxHorizontal.mjs +18 -0
  95. package/dist/components/BoxHorizontal/BoxHorizontal.mjs.map +1 -0
  96. package/dist/components/BoxHorizontal/BoxHorizontal.types.cjs +3 -0
  97. package/dist/components/BoxHorizontal/BoxHorizontal.types.cjs.map +1 -0
  98. package/dist/components/BoxHorizontal/BoxHorizontal.types.d.cts +13 -0
  99. package/dist/components/BoxHorizontal/BoxHorizontal.types.d.cts.map +1 -0
  100. package/dist/components/BoxHorizontal/BoxHorizontal.types.d.mts +13 -0
  101. package/dist/components/BoxHorizontal/BoxHorizontal.types.d.mts.map +1 -0
  102. package/dist/components/BoxHorizontal/BoxHorizontal.types.mjs +2 -0
  103. package/dist/components/BoxHorizontal/BoxHorizontal.types.mjs.map +1 -0
  104. package/dist/components/BoxHorizontal/index.cjs +6 -0
  105. package/dist/components/BoxHorizontal/index.cjs.map +1 -0
  106. package/dist/components/BoxHorizontal/index.d.cts +3 -0
  107. package/dist/components/BoxHorizontal/index.d.cts.map +1 -0
  108. package/dist/components/BoxHorizontal/index.d.mts +3 -0
  109. package/dist/components/BoxHorizontal/index.d.mts.map +1 -0
  110. package/dist/components/BoxHorizontal/index.mjs +2 -0
  111. package/dist/components/BoxHorizontal/index.mjs.map +1 -0
  112. package/dist/components/BoxVertical/BoxVertical.cjs +18 -0
  113. package/dist/components/BoxVertical/BoxVertical.cjs.map +1 -0
  114. package/dist/components/BoxVertical/BoxVertical.d.cts +7 -0
  115. package/dist/components/BoxVertical/BoxVertical.d.cts.map +1 -0
  116. package/dist/components/BoxVertical/BoxVertical.d.mts +7 -0
  117. package/dist/components/BoxVertical/BoxVertical.d.mts.map +1 -0
  118. package/dist/components/BoxVertical/BoxVertical.mjs +18 -0
  119. package/dist/components/BoxVertical/BoxVertical.mjs.map +1 -0
  120. package/dist/components/BoxVertical/BoxVertical.types.cjs +3 -0
  121. package/dist/components/BoxVertical/BoxVertical.types.cjs.map +1 -0
  122. package/dist/components/BoxVertical/BoxVertical.types.d.cts +13 -0
  123. package/dist/components/BoxVertical/BoxVertical.types.d.cts.map +1 -0
  124. package/dist/components/BoxVertical/BoxVertical.types.d.mts +13 -0
  125. package/dist/components/BoxVertical/BoxVertical.types.d.mts.map +1 -0
  126. package/dist/components/BoxVertical/BoxVertical.types.mjs +2 -0
  127. package/dist/components/BoxVertical/BoxVertical.types.mjs.map +1 -0
  128. package/dist/components/BoxVertical/index.cjs +6 -0
  129. package/dist/components/BoxVertical/index.cjs.map +1 -0
  130. package/dist/components/BoxVertical/index.d.cts +3 -0
  131. package/dist/components/BoxVertical/index.d.cts.map +1 -0
  132. package/dist/components/BoxVertical/index.d.mts +3 -0
  133. package/dist/components/BoxVertical/index.d.mts.map +1 -0
  134. package/dist/components/BoxVertical/index.mjs +2 -0
  135. package/dist/components/BoxVertical/index.mjs.map +1 -0
  136. package/dist/components/Icon/assets/candlestick.svg +1 -1
  137. package/dist/components/Input/Input.cjs +4 -3
  138. package/dist/components/Input/Input.cjs.map +1 -1
  139. package/dist/components/Input/Input.constants.cjs +69 -0
  140. package/dist/components/Input/Input.constants.cjs.map +1 -0
  141. package/dist/components/Input/Input.constants.d.cts +11 -0
  142. package/dist/components/Input/Input.constants.d.cts.map +1 -0
  143. package/dist/components/Input/Input.constants.d.mts +11 -0
  144. package/dist/components/Input/Input.constants.d.mts.map +1 -0
  145. package/dist/components/Input/Input.constants.mjs +66 -0
  146. package/dist/components/Input/Input.constants.mjs.map +1 -0
  147. package/dist/components/Input/Input.d.cts.map +1 -1
  148. package/dist/components/Input/Input.d.mts.map +1 -1
  149. package/dist/components/Input/Input.mjs +4 -3
  150. package/dist/components/Input/Input.mjs.map +1 -1
  151. package/dist/components/Text/Text.types.cjs.map +1 -1
  152. package/dist/components/Text/Text.types.d.cts +1 -1
  153. package/dist/components/Text/Text.types.d.mts +1 -1
  154. package/dist/components/Text/Text.types.mjs.map +1 -1
  155. package/dist/components/TextButton/TextButton.cjs +12 -36
  156. package/dist/components/TextButton/TextButton.cjs.map +1 -1
  157. package/dist/components/TextButton/TextButton.d.cts.map +1 -1
  158. package/dist/components/TextButton/TextButton.d.mts.map +1 -1
  159. package/dist/components/TextButton/TextButton.mjs +14 -38
  160. package/dist/components/TextButton/TextButton.mjs.map +1 -1
  161. package/dist/components/TextButton/TextButton.types.cjs.map +1 -1
  162. package/dist/components/TextButton/TextButton.types.d.cts +8 -60
  163. package/dist/components/TextButton/TextButton.types.d.cts.map +1 -1
  164. package/dist/components/TextButton/TextButton.types.d.mts +8 -60
  165. package/dist/components/TextButton/TextButton.types.d.mts.map +1 -1
  166. package/dist/components/TextButton/TextButton.types.mjs.map +1 -1
  167. package/dist/components/TextButton/index.cjs +1 -3
  168. package/dist/components/TextButton/index.cjs.map +1 -1
  169. package/dist/components/TextButton/index.d.cts +0 -1
  170. package/dist/components/TextButton/index.d.cts.map +1 -1
  171. package/dist/components/TextButton/index.d.mts +0 -1
  172. package/dist/components/TextButton/index.d.mts.map +1 -1
  173. package/dist/components/TextButton/index.mjs +0 -1
  174. package/dist/components/TextButton/index.mjs.map +1 -1
  175. package/dist/components/TextField/TextField.cjs +22 -8
  176. package/dist/components/TextField/TextField.cjs.map +1 -1
  177. package/dist/components/TextField/TextField.d.cts +0 -2
  178. package/dist/components/TextField/TextField.d.cts.map +1 -1
  179. package/dist/components/TextField/TextField.d.mts +0 -2
  180. package/dist/components/TextField/TextField.d.mts.map +1 -1
  181. package/dist/components/TextField/TextField.mjs +22 -8
  182. package/dist/components/TextField/TextField.mjs.map +1 -1
  183. package/dist/components/TextField/TextField.types.cjs +0 -10
  184. package/dist/components/TextField/TextField.types.cjs.map +1 -1
  185. package/dist/components/TextField/TextField.types.d.cts +0 -14
  186. package/dist/components/TextField/TextField.types.d.cts.map +1 -1
  187. package/dist/components/TextField/TextField.types.d.mts +0 -14
  188. package/dist/components/TextField/TextField.types.d.mts.map +1 -1
  189. package/dist/components/TextField/TextField.types.mjs +1 -9
  190. package/dist/components/TextField/TextField.types.mjs.map +1 -1
  191. package/dist/components/TextField/index.cjs +1 -3
  192. package/dist/components/TextField/index.cjs.map +1 -1
  193. package/dist/components/TextField/index.d.cts +0 -1
  194. package/dist/components/TextField/index.d.cts.map +1 -1
  195. package/dist/components/TextField/index.d.mts +0 -1
  196. package/dist/components/TextField/index.d.mts.map +1 -1
  197. package/dist/components/TextField/index.mjs +0 -1
  198. package/dist/components/TextField/index.mjs.map +1 -1
  199. package/dist/components/index.cjs +6 -4
  200. package/dist/components/index.cjs.map +1 -1
  201. package/dist/components/index.d.cts +6 -2
  202. package/dist/components/index.d.cts.map +1 -1
  203. package/dist/components/index.d.mts +6 -2
  204. package/dist/components/index.d.mts.map +1 -1
  205. package/dist/components/index.mjs +4 -2
  206. package/dist/components/index.mjs.map +1 -1
  207. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.cjs.map +1 -1
  208. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.cts +2 -5
  209. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.cts.map +1 -1
  210. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.mts +2 -5
  211. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.d.mts.map +1 -1
  212. package/dist/components/temp-components/TextOrChildren/TextOrChildren.types.mjs.map +1 -1
  213. package/dist/types/index.cjs +3 -203
  214. package/dist/types/index.cjs.map +1 -1
  215. package/dist/types/index.d.cts +2 -210
  216. package/dist/types/index.d.cts.map +1 -1
  217. package/dist/types/index.d.mts +2 -210
  218. package/dist/types/index.d.mts.map +1 -1
  219. package/dist/types/index.mjs +2 -202
  220. package/dist/types/index.mjs.map +1 -1
  221. package/package.json +5 -6
  222. package/dist/components/TextButton/TextButton.constants.cjs +0 -12
  223. package/dist/components/TextButton/TextButton.constants.cjs.map +0 -1
  224. package/dist/components/TextButton/TextButton.constants.d.cts +0 -4
  225. package/dist/components/TextButton/TextButton.constants.d.cts.map +0 -1
  226. package/dist/components/TextButton/TextButton.constants.d.mts +0 -4
  227. package/dist/components/TextButton/TextButton.constants.d.mts.map +0 -1
  228. package/dist/components/TextButton/TextButton.constants.mjs +0 -9
  229. package/dist/components/TextButton/TextButton.constants.mjs.map +0 -1
  230. package/dist/components/TextField/TextField.constants.cjs +0 -13
  231. package/dist/components/TextField/TextField.constants.cjs.map +0 -1
  232. package/dist/components/TextField/TextField.constants.d.cts +0 -6
  233. package/dist/components/TextField/TextField.constants.d.cts.map +0 -1
  234. package/dist/components/TextField/TextField.constants.d.mts +0 -6
  235. package/dist/components/TextField/TextField.constants.d.mts.map +0 -1
  236. package/dist/components/TextField/TextField.constants.mjs +0 -10
  237. package/dist/components/TextField/TextField.constants.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BannerAlert.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gDAAgD;AAE9E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAAoB;AAErB,eAAO,MAAM,mCAAmC,EAAE,MAAM,CACtD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,QAAQ,CAMT,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,SAAS,CAMV,CAAC;AAEF,eAAO,MAAM,0CAA0C,EAAE,MAAM,CAC7D,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,kBAAkB,CAMnB,CAAC;AAEF,eAAO,MAAM,sCAAsC,EAAE,MAAM,CACzD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,cAAc,CAMf,CAAC"}
1
+ {"version":3,"file":"BannerAlert.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,gDAAgD;AAEjD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAoB;AAElD,eAAO,MAAM,mCAAmC,EAAE,MAAM,CACtD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,QAAQ,CAMT,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,SAAS,CAMV,CAAC;AAEF,eAAO,MAAM,0CAA0C,EAAE,MAAM,CAC7D,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,kBAAkB,CAMnB,CAAC;AAEF,eAAO,MAAM,sCAAsC,EAAE,MAAM,CACzD,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAC9D,cAAc,CAMf,CAAC"}
@@ -1,5 +1,5 @@
1
- import { BannerAlertSeverity } from "@metamask-previews/design-system-shared";
2
- import { BoxBackgroundColor, BoxBorderColor, IconColor, IconName } from "../../types/index.mjs";
1
+ import { BannerAlertSeverity, BoxBackgroundColor, BoxBorderColor } from "@metamask-previews/design-system-shared";
2
+ import { IconColor, IconName } from "../../types/index.mjs";
3
3
  export const MAP_BANNER_ALERT_SEVERITY_ICON_NAME = {
4
4
  info: IconName.Info,
5
5
  success: IconName.Confirmation,
@@ -1 +1 @@
1
- {"version":3,"file":"BannerAlert.constants.mjs","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gDAAgD;AAE9E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,QAAQ,EACT,8BAAoB;AAErB,MAAM,CAAC,MAAM,mCAAmC,GAG5C;IACF,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,OAAO,EAAE,QAAQ,CAAC,YAAY;IAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM;IACxB,MAAM,EAAE,QAAQ,CAAC,MAAM;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAG7C;IACF,IAAI,EAAE,SAAS,CAAC,cAAc;IAC9B,OAAO,EAAE,SAAS,CAAC,cAAc;IACjC,OAAO,EAAE,SAAS,CAAC,cAAc;IACjC,MAAM,EAAE,SAAS,CAAC,YAAY;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAGnD;IACF,IAAI,EAAE,kBAAkB,CAAC,YAAY;IACrC,OAAO,EAAE,kBAAkB,CAAC,YAAY;IACxC,OAAO,EAAE,kBAAkB,CAAC,YAAY;IACxC,MAAM,EAAE,kBAAkB,CAAC,UAAU;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAG/C;IACF,IAAI,EAAE,cAAc,CAAC,cAAc;IACnC,OAAO,EAAE,cAAc,CAAC,cAAc;IACtC,OAAO,EAAE,cAAc,CAAC,cAAc;IACtC,MAAM,EAAE,cAAc,CAAC,YAAY;CACpC,CAAC","sourcesContent":["import { BannerAlertSeverity } from '@metamask-previews/design-system-shared';\n\nimport {\n BoxBackgroundColor,\n BoxBorderColor,\n IconColor,\n IconName,\n} from '../../types';\n\nexport const MAP_BANNER_ALERT_SEVERITY_ICON_NAME: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n IconName\n> = {\n info: IconName.Info,\n success: IconName.Confirmation,\n warning: IconName.Danger,\n danger: IconName.Danger,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_ICON_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n IconColor\n> = {\n info: IconColor.PrimaryDefault,\n success: IconColor.SuccessDefault,\n warning: IconColor.WarningDefault,\n danger: IconColor.ErrorDefault,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_BACKGROUND_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n BoxBackgroundColor\n> = {\n info: BoxBackgroundColor.PrimaryMuted,\n success: BoxBackgroundColor.SuccessMuted,\n warning: BoxBackgroundColor.WarningMuted,\n danger: BoxBackgroundColor.ErrorMuted,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_BORDER_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n BoxBorderColor\n> = {\n info: BoxBorderColor.PrimaryDefault,\n success: BoxBorderColor.SuccessDefault,\n warning: BoxBorderColor.WarningDefault,\n danger: BoxBorderColor.ErrorDefault,\n};\n"]}
1
+ {"version":3,"file":"BannerAlert.constants.mjs","sourceRoot":"","sources":["../../../src/components/BannerAlert/BannerAlert.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,gDAAgD;AAEjD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAoB;AAElD,MAAM,CAAC,MAAM,mCAAmC,GAG5C;IACF,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,OAAO,EAAE,QAAQ,CAAC,YAAY;IAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM;IACxB,MAAM,EAAE,QAAQ,CAAC,MAAM;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAG7C;IACF,IAAI,EAAE,SAAS,CAAC,cAAc;IAC9B,OAAO,EAAE,SAAS,CAAC,cAAc;IACjC,OAAO,EAAE,SAAS,CAAC,cAAc;IACjC,MAAM,EAAE,SAAS,CAAC,YAAY;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAGnD;IACF,IAAI,EAAE,kBAAkB,CAAC,YAAY;IACrC,OAAO,EAAE,kBAAkB,CAAC,YAAY;IACxC,OAAO,EAAE,kBAAkB,CAAC,YAAY;IACxC,MAAM,EAAE,kBAAkB,CAAC,UAAU;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAG/C;IACF,IAAI,EAAE,cAAc,CAAC,cAAc;IACnC,OAAO,EAAE,cAAc,CAAC,cAAc;IACtC,OAAO,EAAE,cAAc,CAAC,cAAc;IACtC,MAAM,EAAE,cAAc,CAAC,YAAY;CACpC,CAAC","sourcesContent":["import {\n BannerAlertSeverity,\n BoxBackgroundColor,\n BoxBorderColor,\n} from '@metamask-previews/design-system-shared';\n\nimport { IconColor, IconName } from '../../types';\n\nexport const MAP_BANNER_ALERT_SEVERITY_ICON_NAME: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n IconName\n> = {\n info: IconName.Info,\n success: IconName.Confirmation,\n warning: IconName.Danger,\n danger: IconName.Danger,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_ICON_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n IconColor\n> = {\n info: IconColor.PrimaryDefault,\n success: IconColor.SuccessDefault,\n warning: IconColor.WarningDefault,\n danger: IconColor.ErrorDefault,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_BACKGROUND_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n BoxBackgroundColor\n> = {\n info: BoxBackgroundColor.PrimaryMuted,\n success: BoxBackgroundColor.SuccessMuted,\n warning: BoxBackgroundColor.WarningMuted,\n danger: BoxBackgroundColor.ErrorMuted,\n};\n\nexport const MAP_BANNER_ALERT_SEVERITY_BORDER_COLOR: Record<\n (typeof BannerAlertSeverity)[keyof typeof BannerAlertSeverity],\n BoxBorderColor\n> = {\n info: BoxBorderColor.PrimaryDefault,\n success: BoxBorderColor.SuccessDefault,\n warning: BoxBorderColor.WarningDefault,\n danger: BoxBorderColor.ErrorDefault,\n};\n"]}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BannerBase = void 0;
7
+ const design_system_shared_1 = require("@metamask-previews/design-system-shared");
7
8
  const react_1 = __importDefault(require("react"));
8
9
  const types_1 = require("../../types/index.cjs");
9
10
  const Box_1 = require("../Box/index.cjs");
@@ -29,7 +30,7 @@ const BannerBase = ({ title, titleProps, description, descriptionProps, children
29
30
  const mergedCloseButtonTwClassName = closeButtonTwClassName
30
31
  ? `ml-3 ${closeButtonTwClassName}`
31
32
  : 'ml-3';
32
- return (<Box_1.Box flexDirection={types_1.BoxFlexDirection.Row} alignItems={types_1.BoxAlignItems.Start} gap={2} backgroundColor={types_1.BoxBackgroundColor.BackgroundDefault} padding={3} twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'} {...props}>
33
+ return (<Box_1.Box flexDirection={design_system_shared_1.BoxFlexDirection.Row} alignItems={design_system_shared_1.BoxAlignItems.Start} gap={2} backgroundColor={design_system_shared_1.BoxBackgroundColor.BackgroundDefault} padding={3} twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'} {...props}>
33
34
  {startAccessory}
34
35
 
35
36
  <Box_1.Box twClassName="flex-1">
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"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CACH;UAAA,EAAE,SAAG,CAAC,CACP,CAED;;QAAA,CAAC,UAAU,CAAC,QAAQ,CAAC;YACnB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC,WAAI,CAAC,OAAO,CAAC,CAAC,mBAAW,CAAC,MAAM,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAC1D;cAAA,CAAC,QAAQ,CACX;YAAA,EAAE,WAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC,CAEJ;;QAAA,CAAC,sBAAsB,IAAI,CACzB,CAAC,SAAG,CAAC,WAAW,CAAC,MAAM,CACrB;YAAA,CAAC,eAAM,CACL,IAAI,CAAC,CAAC,kBAAU,CAAC,EAAE,CAAC,CACpB,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAC7B,IAAI,yBAAyB,CAAC,CAE9B;cAAA,CAAC,iBAAiB,CACpB;YAAA,EAAE,eAAM,CACV;UAAA,EAAE,SAAG,CAAC,CACP,CACH;MAAA,EAAE,SAAG,CAEL;;MAAA,CAAC,qBAAqB,IAAI,CACxB,CAAC,uBAAU,CACT,WAAW,CAAC,CAAC,4BAA4B,CAAC,CAC1C,QAAQ,CAAC,CAAC,gBAAQ,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,CAAC,sBAAc,CAAC,EAAE,CAAC,CACxB,kBAAkB,CAAC,CAAC,6BAA6B,CAAC,CAClD,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,SAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,UAAU,cAmHrB","sourcesContent":["import React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n BoxAlignItems,\n BoxBackgroundColor,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n BoxFlexDirection,\n IconName,\n TextVariant,\n} from '../../types';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box twClassName={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
1
+ {"version":3,"file":"BannerBase.cjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAIiD;AACjD,kDAA0B;AAG1B,iDAMqB;AACrB,0CAA6B;AAC7B,gDAAmC;AACnC,wDAA2C;AAC3C,4CAA+B;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAErC,MAAM,UAAU,GAA8B,CAAC,EACpD,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,yBAAyB,GAAG,iBAAiB,IAAI,EAAE,CAAC;IAE1D,MAAM,EACJ,kBAAkB,EAAE,6BA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EL;;MAAA,CAAC,qBAAqB,IAAI,CACxB,CAAC,uBAAU,CACT,WAAW,CAAC,CAAC,4BAA4B,CAAC,CAC1C,QAAQ,CAAC,CAAC,gBAAQ,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,CAAC,sBAAc,CAAC,EAAE,CAAC,CACxB,kBAAkB,CAAC,CAAC,6BAA6B,CAAC,CAClD,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,SAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,UAAU,cAmHrB","sourcesContent":["import {\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '../../types';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box twClassName={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAkB1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
1
+ {"version":3,"file":"BannerBase.d.cts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,cAAc;AAe1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAkB1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
1
+ {"version":3,"file":"BannerBase.d.mts","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,cAAc;AAe1B,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAQ1D,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHhD,CAAC"}
@@ -4,9 +4,10 @@ function $importDefault(module) {
4
4
  }
5
5
  return module;
6
6
  }
7
+ import { BoxAlignItems, BoxBackgroundColor, BoxFlexDirection } from "@metamask-previews/design-system-shared";
7
8
  import $React from "react";
8
9
  const React = $importDefault($React);
9
- import { BoxAlignItems, BoxBackgroundColor, ButtonIconSize, ButtonSize, FontWeight, BoxFlexDirection, IconName, TextVariant } from "../../types/index.mjs";
10
+ import { ButtonIconSize, ButtonSize, FontWeight, IconName, TextVariant } from "../../types/index.mjs";
10
11
  import { Box } from "../Box/index.mjs";
11
12
  import { Button } from "../Button/index.mjs";
12
13
  import { ButtonIcon } from "../ButtonIcon/index.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAG1B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACZ,8BAAoB;AACrB,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,aAAa,GAAG,CAAC,OAAwB,EAA8B,EAAE,CAC7E,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC;AAE7D,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC9C,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EACpD,KAAK,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,yBAAyB,GAAG,iBAAiB,IAAI,EAAE,CAAC;IAE1D,MAAM,EACJ,kBAAkB,EAAE,6BAA6B,GAAG,cAAc,EAClE,OAAO,EAAE,uBAAuB,EAChC,WAAW,EAAE,sBAAsB,EACnC,GAAG,wBAAwB,EAC5B,GAAG,gBAAgB,IAAI,EAAE,CAAC;IAE3B,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,CAAC;IACnE,MAAM,sBAAsB,GAAG,OAAO,CAAC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AAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n BoxAlignItems,\n BoxBackgroundColor,\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n BoxFlexDirection,\n IconName,\n TextVariant,\n} from '../../types';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box twClassName={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
1
+ {"version":3,"file":"BannerBase.mjs","sourceRoot":"","sources":["../../../src/components/BannerBase/BannerBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EACjB,gDAAgD;AACjD,OAAO,MAAK,cAAc;;AAG1B,OAAO,EACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,8BAAoB;AACrB,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,aAAa,GA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CAAC,CAAC,CACzB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAC1D;cAAA,CAAC,QAAQ,CACX;YAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CAAC,CAEJ;;QAAA,CAAC,sBAAsB,IAAI,CACzB,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CACrB;YAAA,CAAC,MAAM,CACL,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,CACpB,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAC7B,IAAI,yBAAyB,CAAC,CAE9B;cAAA,CAAC,iBAAiB,CACpB;YAAA,EAAE,MAAM,CACV;UAAA,EAAE,GAAG,CAAC,CACP,CACH;MAAA,EAAE,GAAG,CAEL;;MAAA,CAAC,qBAAqB,IAAI,CACxB,CAAC,UAAU,CACT,WAAW,CAAC,CAAC,4BAA4B,CAAC,CAC1C,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,kBAAkB,CAAC,CAAC,6BAA6B,CAAC,CAClD,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,wBAAwB,CAAC,EAC7B,CACH,CACH;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n BoxAlignItems,\n BoxBackgroundColor,\n BoxFlexDirection,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\nimport { GestureResponderEvent } from 'react-native';\n\nimport {\n ButtonIconSize,\n ButtonSize,\n FontWeight,\n IconName,\n TextVariant,\n} from '../../types';\nimport { Box } from '../Box';\nimport { Button } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text } from '../Text';\n\nimport type { BannerBaseProps } from './BannerBase.types';\n\nconst isTextContent = (content: React.ReactNode): content is string | number =>\n typeof content === 'string' || typeof content === 'number';\n\nconst hasContent = (content: React.ReactNode) =>\n content !== null && content !== undefined;\n\nexport const BannerBase: React.FC<BannerBaseProps> = ({\n title,\n titleProps,\n description,\n descriptionProps,\n children,\n childrenWrapperProps,\n actionButtonLabel,\n actionButtonOnPress,\n actionButtonProps,\n startAccessory,\n onClose,\n closeButtonProps,\n twClassName,\n ...props\n}) => {\n const resolvedActionButtonProps = actionButtonProps ?? {};\n\n const {\n accessibilityLabel: closeButtonAccessibilityLabel = 'Close banner',\n onPress: closeButtonPropsOnPress,\n twClassName: closeButtonTwClassName,\n ...resolvedCloseButtonProps\n } = closeButtonProps ?? {};\n\n const shouldShowCloseButton = Boolean(onClose || closeButtonProps);\n const shouldShowActionButton = Boolean(actionButtonOnPress);\n\n const handleClosePress =\n onClose || closeButtonPropsOnPress\n ? (event: GestureResponderEvent) => {\n if (onClose) {\n onClose();\n return;\n }\n closeButtonPropsOnPress?.(event);\n }\n : undefined;\n\n const mergedCloseButtonTwClassName = closeButtonTwClassName\n ? `ml-3 ${closeButtonTwClassName}`\n : 'ml-3';\n\n return (\n <Box\n flexDirection={BoxFlexDirection.Row}\n alignItems={BoxAlignItems.Start}\n gap={2}\n backgroundColor={BoxBackgroundColor.BackgroundDefault}\n padding={3}\n twClassName={twClassName ? `rounded-sm ${twClassName}` : 'rounded-sm'}\n {...props}\n >\n {startAccessory}\n\n <Box twClassName=\"flex-1\">\n {hasContent(title) &&\n (isTextContent(title) ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n {...titleProps}\n >\n {title}\n </Text>\n ) : (\n title\n ))}\n\n {hasContent(description) && (\n <Box twClassName={hasContent(title) ? 'mt-1' : undefined}>\n {isTextContent(description) ? (\n <Text variant={TextVariant.BodySm} {...descriptionProps}>\n {description}\n </Text>\n ) : (\n description\n )}\n </Box>\n )}\n\n {hasContent(children) &&\n (isTextContent(children) ? (\n <Text variant={TextVariant.BodyMd} {...childrenWrapperProps}>\n {children}\n </Text>\n ) : (\n children\n ))}\n\n {shouldShowActionButton && (\n <Box twClassName=\"mt-4\">\n <Button\n size={ButtonSize.Md}\n onPress={actionButtonOnPress}\n {...resolvedActionButtonProps}\n >\n {actionButtonLabel}\n </Button>\n </Box>\n )}\n </Box>\n\n {shouldShowCloseButton && (\n <ButtonIcon\n twClassName={mergedCloseButtonTwClassName}\n iconName={IconName.Close}\n size={ButtonIconSize.Sm}\n accessibilityLabel={closeButtonAccessibilityLabel}\n onPress={handleClosePress}\n {...resolvedCloseButtonProps}\n />\n )}\n </Box>\n );\n};\n"]}
@@ -33,7 +33,7 @@ const react_native_1 = require("react-native/index.js");
33
33
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
34
34
  const BottomSheetDialog_1 = __importDefault(require("../BottomSheetDialog/index.cjs"));
35
35
  const BottomSheetOverlay_1 = require("../BottomSheetOverlay/BottomSheetOverlay.cjs");
36
- exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBack, style, twClassName, isInteractable = true, shouldNavigateBack = true, isFullscreen = false, keyboardAvoidingViewEnabled = true, ...props }, ref) => {
36
+ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBack, style, twClassName, isInteractable = true, shouldNavigateBack = true, isFullscreen = false, keyboardAvoidingViewEnabled = true, panGestureHandlerProps, ...props }, ref) => {
37
37
  const tw = (0, design_system_twrnc_preset_1.useTailwind)();
38
38
  const { bottom: screenBottomPadding } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
39
39
  const { y: frameY } = (0, react_native_safe_area_context_1.useSafeAreaFrame)();
@@ -100,7 +100,7 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
100
100
  <BottomSheetOverlay_1.BottomSheetOverlay onPress={isInteractable
101
101
  ? () => bottomSheetDialogRef.current?.onCloseDialog()
102
102
  : undefined}/>
103
- <BottomSheetDialog_1.default isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
103
+ <BottomSheetDialog_1.default isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled} panGestureHandlerProps={panGestureHandlerProps}>
104
104
  {children}
105
105
  </BottomSheetDialog_1.default>
106
106
  </react_native_1.KeyboardAvoidingView>);
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AACf,wDAA2E;AAC3E,mFAGwC;AAExC,uFAAqD;AAErD,qFAA8E;AAQjE,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EACE,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,WAAW,EACX,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,IAAI,EACzB,YAAY,GAAG,KAAK,EACpB,2BAA2B,GAAG,IAAI,EAClC,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IACzC,MAAM,YAAY,GAAG,IAAA,cAAM,GAA2B,CAAC;IACvD,MAAM,oBAAoB,GAAG,IAAA,cAAM,EAAuB,IAAI,CAAC,CAAC;IAChE,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,IAAA,cAAM,EAAC,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AC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,KAAK,CAAC,CAAC,CACzD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,uCAAkB,CACjB,OAAO,CAAC,CACN,cAAc;YACZ,CAAC,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,2BAAiB,CAChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CAEzD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,2BAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport BottomSheetDialog from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n shouldNavigateBack = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback>();\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (shouldNavigateBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose, shouldNavigateBack]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n BackHandler.addEventListener('hardwareBackPress', hardwareBackPress);\n return () => {\n BackHandler.removeEventListener('hardwareBackPress', hardwareBackPress);\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
1
+ {"version":3,"file":"BottomSheet.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AACf,wDAA2E;AAC3E,mFAGwC;AAExC,uFAAqD;AAErD,qFAA8E;AAQjE,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EACE,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,WAAW,EACX,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,IAAI,EACzB,YAAY,GAAG,KAAK,EACpB,2BAA2B,GAAG,IAAI,EAClC,sBAAsB,EACtB,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IACzC,M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CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,sBAAsB,CAAC,CACrB,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,KAAK,CAAC,CAAC,CACzD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,uCAAkB,CACjB,OAAO,CAAC,CACN,cAAc;YACZ,CAAC,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,2BAAiB,CAChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CACzD,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAE/C;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,2BAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport BottomSheetDialog from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n shouldNavigateBack = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n panGestureHandlerProps,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback>();\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (shouldNavigateBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose, shouldNavigateBack]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n BackHandler.addEventListener('hardwareBackPress', hardwareBackPress);\n return () => {\n BackHandler.removeEventListener('hardwareBackPress', hardwareBackPress);\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n panGestureHandlerProps={panGestureHandlerProps}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
@@ -11,6 +11,36 @@ export declare const BottomSheet: React.ForwardRefExoticComponent<{
11
11
  keyboardAvoidingViewEnabled?: boolean | undefined;
12
12
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
13
13
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
14
+ panGestureHandlerProps?: {
15
+ children?: React.ReactNode;
16
+ hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop | undefined;
17
+ id?: string | undefined;
18
+ testID?: string | undefined;
19
+ activeOffsetY?: number | number[] | undefined;
20
+ activeOffsetX?: number | number[] | undefined;
21
+ failOffsetY?: number | number[] | undefined;
22
+ failOffsetX?: number | number[] | undefined;
23
+ shouldCancelWhenOutside?: boolean | undefined;
24
+ userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
25
+ waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
26
+ simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
27
+ cancelsTouchesInView?: boolean | undefined;
28
+ onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
29
+ onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
30
+ onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
31
+ onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
32
+ onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
33
+ onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
34
+ minDist?: number | undefined;
35
+ avgTouches?: boolean | undefined;
36
+ enableTrackpadTwoFingerGesture?: boolean | undefined;
37
+ minPointers?: number | undefined;
38
+ maxPointers?: number | undefined;
39
+ minVelocity?: number | undefined;
40
+ minVelocityX?: number | undefined;
41
+ minVelocityY?: number | undefined;
42
+ activateAfterLongPress?: number | undefined;
43
+ } | undefined;
14
44
  twClassName?: string | undefined;
15
45
  } & import("react-native").ViewProps & React.RefAttributes<BottomSheetRef>>;
16
46
  //# sourceMappingURL=BottomSheet.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;2EAuHvB,CAAC"}
1
+ {"version":3,"file":"BottomSheet.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAyHvB,CAAC"}
@@ -11,6 +11,36 @@ export declare const BottomSheet: React.ForwardRefExoticComponent<{
11
11
  keyboardAvoidingViewEnabled?: boolean | undefined;
12
12
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
13
13
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
14
+ panGestureHandlerProps?: {
15
+ children?: React.ReactNode;
16
+ hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop | undefined;
17
+ id?: string | undefined;
18
+ testID?: string | undefined;
19
+ activeOffsetY?: number | number[] | undefined;
20
+ activeOffsetX?: number | number[] | undefined;
21
+ failOffsetY?: number | number[] | undefined;
22
+ failOffsetX?: number | number[] | undefined;
23
+ shouldCancelWhenOutside?: boolean | undefined;
24
+ userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
25
+ waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
26
+ simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
27
+ cancelsTouchesInView?: boolean | undefined;
28
+ onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
29
+ onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
30
+ onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
31
+ onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
32
+ onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
33
+ onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
34
+ minDist?: number | undefined;
35
+ avgTouches?: boolean | undefined;
36
+ enableTrackpadTwoFingerGesture?: boolean | undefined;
37
+ minPointers?: number | undefined;
38
+ maxPointers?: number | undefined;
39
+ minVelocity?: number | undefined;
40
+ minVelocityX?: number | undefined;
41
+ minVelocityY?: number | undefined;
42
+ activateAfterLongPress?: number | undefined;
43
+ } | undefined;
14
44
  twClassName?: string | undefined;
15
45
  } & import("react-native").ViewProps & React.RefAttributes<BottomSheetRef>>;
16
46
  //# sourceMappingURL=BottomSheet.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;2EAuHvB,CAAC"}
1
+ {"version":3,"file":"BottomSheet.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAyHvB,CAAC"}
@@ -11,7 +11,7 @@ import { BackHandler, KeyboardAvoidingView, Platform } from "react-native/index.
11
11
  import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context";
12
12
  import BottomSheetDialog from "../BottomSheetDialog/index.mjs";
13
13
  import { BottomSheetOverlay } from "../BottomSheetOverlay/BottomSheetOverlay.mjs";
14
- export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, style, twClassName, isInteractable = true, shouldNavigateBack = true, isFullscreen = false, keyboardAvoidingViewEnabled = true, ...props }, ref) => {
14
+ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, style, twClassName, isInteractable = true, shouldNavigateBack = true, isFullscreen = false, keyboardAvoidingViewEnabled = true, panGestureHandlerProps, ...props }, ref) => {
15
15
  const tw = useTailwind();
16
16
  const { bottom: screenBottomPadding } = useSafeAreaInsets();
17
17
  const { y: frameY } = useSafeAreaFrame();
@@ -78,7 +78,7 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
78
78
  <BottomSheetOverlay onPress={isInteractable
79
79
  ? () => bottomSheetDialogRef.current?.onCloseDialog()
80
80
  : undefined}/>
81
- <BottomSheetDialog isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
81
+ <BottomSheetDialog isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled} panGestureHandlerProps={panGestureHandlerProps}>
82
82
  {children}
83
83
  </BottomSheetDialog>
84
84
  </KeyboardAvoidingView>);
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,MAAM,EACP,cAAc;;AACf,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,8BAAqB;AAC3E,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAClB,uCA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zB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CAEzD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,iBAAiB,CACrB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport BottomSheetDialog from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n shouldNavigateBack = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback>();\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (shouldNavigateBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose, shouldNavigateBack]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n BackHandler.addEventListener('hardwareBackPress', hardwareBackPress);\n return () => {\n BackHandler.removeEventListener('hardwareBackPress', hardwareBackPress);\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
1
+ {"version":3,"file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C,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,iBAAiB,CAChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CACzD,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAE/C;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,iBAAiB,CACrB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport BottomSheetDialog from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n shouldNavigateBack = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n panGestureHandlerProps,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback>();\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (shouldNavigateBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose, shouldNavigateBack]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n BackHandler.addEventListener('hardwareBackPress', hardwareBackPress);\n return () => {\n BackHandler.removeEventListener('hardwareBackPress', hardwareBackPress);\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n panGestureHandlerProps={panGestureHandlerProps}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
@@ -34,7 +34,7 @@ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"
34
34
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
35
35
  // Internal dependencies.
36
36
  const BottomSheetDialog_constants_1 = require("./BottomSheetDialog.constants.cjs");
37
- const BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, style, twClassName, ...props }, ref) => {
37
+ const BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, panGestureHandlerProps, style, twClassName, ...props }, ref) => {
38
38
  const tw = (0, design_system_twrnc_preset_1.useTailwind)();
39
39
  const currentTheme = (0, design_system_twrnc_preset_1.useTheme)();
40
40
  const shadowLg = currentTheme === design_system_twrnc_preset_1.Theme.Light
@@ -193,7 +193,7 @@ const BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen = fa
193
193
  onCloseDialog,
194
194
  }));
195
195
  return (<react_native_1.KeyboardAvoidingView style={tw.style('absolute bottom-0 inset-x-0')} behavior={react_native_1.Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={react_native_1.Platform.OS === 'ios' ? -screenBottomPadding : frameY} enabled={keyboardAvoidingViewEnabled} {...props}>
196
- <react_native_gesture_handler_1.PanGestureHandler enabled={isInteractable} onGestureEvent={gestureHandler}>
196
+ <react_native_gesture_handler_1.PanGestureHandler {...panGestureHandlerProps} enabled={isInteractable} onGestureEvent={gestureHandler}>
197
197
  <react_native_reanimated_1.default.View onLayout={updateSheetHeight} style={combinedSheetStyle}>
198
198
  {isInteractable && (<react_native_1.View style={tw.style('self-stretch items-center p-1')}>
199
199
  <react_native_1.View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')}/>
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,mCAAkC;AAClC,+CAOe;AACf,wDAKsB;AACtB,+EAGsC;AACtC,4CAA4C;AAC5C,mFAMiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAMvC,MAAM,iBAAiB,GAAG,IAAA,kBAAU,EAIlC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EAClC,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,YAAY,GAAG,IAAA,qCAAQ,GAAE,CAAC;IAChC,MAAM,QAAQ,GACZ,YAAY,KAAK,kCAAK,CAAC,KAAK;QAC1B,CAAC,CAAC,0BAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC5B,CAAC,CAAC,yBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAC1D,IAAA,kDAAiB,GAAE,CAAC;IACtB,MAA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QAC9B,YAAY;QACZ,aAAa;KACd,CAAC,CAAC,CAAC;IAEJ,OAAO,CACL,CAAC,mCAAoB,CACnB,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAC/C,QAAQ,CAAC,CAAC,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,sBAAsB,CAAC,CACrB,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,gDAAiB,CAChB,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,cAAc,CAAC,CAAC,cAAc,CAAC,CAE/B;UAAA,CAAC,iCAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,gDAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,iBAAiB,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport {\n PanGestureHandler,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\n// eslint-disable-next-line import-x/default\nimport Animated, {\n runOnJS,\n useAnimatedGestureHandler,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nconst BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n { startY: number }\n >({\n onStart: (_, ctx) => {\n // Starts tracking vertical position of gesture\n ctx.startY = currentYOffset.value;\n },\n onActive: (event, ctx) => {\n const { translationY } = event;\n currentYOffset.value = ctx.startY + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n },\n onEnd: (event, ctx) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = ctx.startY + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n },\n });\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-default rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <PanGestureHandler\n enabled={isInteractable}\n onGestureEvent={gestureHandler}\n >\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </PanGestureHandler>\n </KeyboardAvoidingView>\n );\n },\n);\n\nexport default BottomSheetDialog;\n"]}
1
+ {"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,mCAAkC;AAClC,+CAOe;AACf,wDAKsB;AACtB,+EAGsC;AACtC,4CAA4C;AAC5C,mFAMiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAMvC,MAAM,iBAAiB,GAAG,IAAA,kBAAU,EAIlC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EACl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C,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,gDAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,iBAAiB,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport {\n PanGestureHandler,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\n// eslint-disable-next-line import-x/default\nimport Animated, {\n runOnJS,\n useAnimatedGestureHandler,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nconst BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n panGestureHandlerProps,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n { startY: number }\n >({\n onStart: (_, ctx) => {\n // Starts tracking vertical position of gesture\n ctx.startY = currentYOffset.value;\n },\n onActive: (event, ctx) => {\n const { translationY } = event;\n currentYOffset.value = ctx.startY + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n },\n onEnd: (event, ctx) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = ctx.startY + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n },\n });\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-default rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <PanGestureHandler\n {...panGestureHandlerProps}\n enabled={isInteractable}\n onGestureEvent={gestureHandler}\n >\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </PanGestureHandler>\n </KeyboardAvoidingView>\n );\n },\n);\n\nexport default BottomSheetDialog;\n"]}
@@ -7,6 +7,36 @@ declare const BottomSheetDialog: React.ForwardRefExoticComponent<{
7
7
  keyboardAvoidingViewEnabled?: boolean | undefined;
8
8
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
9
9
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
10
+ panGestureHandlerProps?: {
11
+ children?: React.ReactNode;
12
+ hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop | undefined;
13
+ id?: string | undefined;
14
+ testID?: string | undefined;
15
+ activeOffsetY?: number | number[] | undefined;
16
+ activeOffsetX?: number | number[] | undefined;
17
+ failOffsetY?: number | number[] | undefined;
18
+ failOffsetX?: number | number[] | undefined;
19
+ shouldCancelWhenOutside?: boolean | undefined;
20
+ userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
21
+ waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
22
+ simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
23
+ cancelsTouchesInView?: boolean | undefined;
24
+ onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
25
+ onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
26
+ onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
27
+ onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
28
+ onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
29
+ onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
30
+ minDist?: number | undefined;
31
+ avgTouches?: boolean | undefined;
32
+ enableTrackpadTwoFingerGesture?: boolean | undefined;
33
+ minPointers?: number | undefined;
34
+ maxPointers?: number | undefined;
35
+ minVelocity?: number | undefined;
36
+ minVelocityX?: number | undefined;
37
+ minVelocityY?: number | undefined;
38
+ activateAfterLongPress?: number | undefined;
39
+ } | undefined;
10
40
  twClassName?: string | undefined;
11
41
  } & import("react-native").ViewProps & React.RefAttributes<BottomSheetDialogRef>>;
12
42
  export default BottomSheetDialog;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AA8Bf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,QAAA,MAAM,iBAAiB;;;;;;;;iFA4PtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AA8Bf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFA8PtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -7,6 +7,36 @@ declare const BottomSheetDialog: React.ForwardRefExoticComponent<{
7
7
  keyboardAvoidingViewEnabled?: boolean | undefined;
8
8
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
9
9
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
10
+ panGestureHandlerProps?: {
11
+ children?: React.ReactNode;
12
+ hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop | undefined;
13
+ id?: string | undefined;
14
+ testID?: string | undefined;
15
+ activeOffsetY?: number | number[] | undefined;
16
+ activeOffsetX?: number | number[] | undefined;
17
+ failOffsetY?: number | number[] | undefined;
18
+ failOffsetX?: number | number[] | undefined;
19
+ shouldCancelWhenOutside?: boolean | undefined;
20
+ userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
21
+ waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
22
+ simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
23
+ cancelsTouchesInView?: boolean | undefined;
24
+ onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
25
+ onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
26
+ onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
27
+ onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
28
+ onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
29
+ onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
30
+ minDist?: number | undefined;
31
+ avgTouches?: boolean | undefined;
32
+ enableTrackpadTwoFingerGesture?: boolean | undefined;
33
+ minPointers?: number | undefined;
34
+ maxPointers?: number | undefined;
35
+ minVelocity?: number | undefined;
36
+ minVelocityX?: number | undefined;
37
+ minVelocityY?: number | undefined;
38
+ activateAfterLongPress?: number | undefined;
39
+ } | undefined;
10
40
  twClassName?: string | undefined;
11
41
  } & import("react-native").ViewProps & React.RefAttributes<BottomSheetDialogRef>>;
12
42
  export default BottomSheetDialog;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AA8Bf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,QAAA,MAAM,iBAAiB;;;;;;;;iFA4PtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AA8Bf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFA8PtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -17,7 +17,7 @@ import Animated, { runOnJS, useAnimatedGestureHandler, useAnimatedStyle, useShar
17
17
  import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context";
18
18
  // Internal dependencies.
19
19
  import { DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION, DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD, DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION } from "./BottomSheetDialog.constants.mjs";
20
- const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, style, twClassName, ...props }, ref) => {
20
+ const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, panGestureHandlerProps, style, twClassName, ...props }, ref) => {
21
21
  const tw = useTailwind();
22
22
  const currentTheme = useTheme();
23
23
  const shadowLg = currentTheme === Theme.Light
@@ -176,7 +176,7 @@ const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, isIntera
176
176
  onCloseDialog,
177
177
  }));
178
178
  return (<KeyboardAvoidingView style={tw.style('absolute bottom-0 inset-x-0')} behavior={Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={Platform.OS === 'ios' ? -screenBottomPadding : frameY} enabled={keyboardAvoidingViewEnabled} {...props}>
179
- <PanGestureHandler enabled={isInteractable} onGestureEvent={gestureHandler}>
179
+ <PanGestureHandler {...panGestureHandlerProps} enabled={isInteractable} onGestureEvent={gestureHandler}>
180
180
  <Animated.View onLayout={updateSheetHeight} style={combinedSheetStyle}>
181
181
  {isInteractable && (<View style={tw.style('self-stretch items-center p-1')}>
182
182
  <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')}/>