@aws-amplify/ui-react-native 0.0.0-fileuploader-41bde68-20221115171326

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 (332) hide show
  1. package/.eslintrc.js +100 -0
  2. package/.lintstagedrc.js +6 -0
  3. package/.turbo/turbo-build.log +3 -0
  4. package/CHANGELOG.md +22 -0
  5. package/LICENSE +201 -0
  6. package/README.md +23 -0
  7. package/babel.config.js +3 -0
  8. package/dist/InAppMessaging/components/BannerMessage/BannerMessage.d.ts +2 -0
  9. package/dist/InAppMessaging/components/BannerMessage/BannerMessage.js +16 -0
  10. package/dist/InAppMessaging/components/BannerMessage/index.d.ts +2 -0
  11. package/dist/InAppMessaging/components/BannerMessage/index.js +1 -0
  12. package/dist/InAppMessaging/components/BannerMessage/styles.d.ts +7 -0
  13. package/dist/InAppMessaging/components/BannerMessage/styles.js +77 -0
  14. package/dist/InAppMessaging/components/BannerMessage/types.d.ts +12 -0
  15. package/dist/InAppMessaging/components/BannerMessage/types.js +1 -0
  16. package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.d.ts +2 -0
  17. package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.js +20 -0
  18. package/dist/InAppMessaging/components/CarouselMessage/CarouselMessageItem.d.ts +2 -0
  19. package/dist/InAppMessaging/components/CarouselMessage/CarouselMessageItem.js +18 -0
  20. package/dist/InAppMessaging/components/CarouselMessage/index.d.ts +2 -0
  21. package/dist/InAppMessaging/components/CarouselMessage/index.js +1 -0
  22. package/dist/InAppMessaging/components/CarouselMessage/styles.d.ts +5 -0
  23. package/dist/InAppMessaging/components/CarouselMessage/styles.js +98 -0
  24. package/dist/InAppMessaging/components/CarouselMessage/types.d.ts +18 -0
  25. package/dist/InAppMessaging/components/CarouselMessage/types.js +1 -0
  26. package/dist/InAppMessaging/components/FullScreenMessage/FullScreenMessage.d.ts +2 -0
  27. package/dist/InAppMessaging/components/FullScreenMessage/FullScreenMessage.js +18 -0
  28. package/dist/InAppMessaging/components/FullScreenMessage/index.d.ts +2 -0
  29. package/dist/InAppMessaging/components/FullScreenMessage/index.js +1 -0
  30. package/dist/InAppMessaging/components/FullScreenMessage/styles.d.ts +3 -0
  31. package/dist/InAppMessaging/components/FullScreenMessage/styles.js +86 -0
  32. package/dist/InAppMessaging/components/FullScreenMessage/types.d.ts +6 -0
  33. package/dist/InAppMessaging/components/FullScreenMessage/types.js +1 -0
  34. package/dist/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.d.ts +9 -0
  35. package/dist/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.js +29 -0
  36. package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.d.ts +3 -0
  37. package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +24 -0
  38. package/dist/InAppMessaging/components/InAppMessageDisplay/index.d.ts +2 -0
  39. package/dist/InAppMessaging/components/InAppMessageDisplay/index.js +1 -0
  40. package/dist/InAppMessaging/components/InAppMessageDisplay/types.d.ts +24 -0
  41. package/dist/InAppMessaging/components/InAppMessageDisplay/types.js +1 -0
  42. package/dist/InAppMessaging/components/MessageLayout/MessageLayout.d.ts +2 -0
  43. package/dist/InAppMessaging/components/MessageLayout/MessageLayout.js +34 -0
  44. package/dist/InAppMessaging/components/MessageLayout/index.d.ts +1 -0
  45. package/dist/InAppMessaging/components/MessageLayout/index.js +1 -0
  46. package/dist/InAppMessaging/components/MessageLayout/types.d.ts +7 -0
  47. package/dist/InAppMessaging/components/MessageLayout/types.js +1 -0
  48. package/dist/InAppMessaging/components/MessageWrapper/MessageWrapper.d.ts +2 -0
  49. package/dist/InAppMessaging/components/MessageWrapper/MessageWrapper.js +20 -0
  50. package/dist/InAppMessaging/components/MessageWrapper/index.d.ts +2 -0
  51. package/dist/InAppMessaging/components/MessageWrapper/index.js +1 -0
  52. package/dist/InAppMessaging/components/MessageWrapper/styles.d.ts +2 -0
  53. package/dist/InAppMessaging/components/MessageWrapper/styles.js +5 -0
  54. package/dist/InAppMessaging/components/MessageWrapper/types.d.ts +10 -0
  55. package/dist/InAppMessaging/components/MessageWrapper/types.js +1 -0
  56. package/dist/InAppMessaging/components/ModalMessage/ModalMessage.d.ts +2 -0
  57. package/dist/InAppMessaging/components/ModalMessage/ModalMessage.js +18 -0
  58. package/dist/InAppMessaging/components/ModalMessage/index.d.ts +2 -0
  59. package/dist/InAppMessaging/components/ModalMessage/index.js +1 -0
  60. package/dist/InAppMessaging/components/ModalMessage/styles.d.ts +4 -0
  61. package/dist/InAppMessaging/components/ModalMessage/styles.js +99 -0
  62. package/dist/InAppMessaging/components/ModalMessage/types.d.ts +6 -0
  63. package/dist/InAppMessaging/components/ModalMessage/types.js +1 -0
  64. package/dist/InAppMessaging/components/index.d.ts +6 -0
  65. package/dist/InAppMessaging/components/index.js +2 -0
  66. package/dist/InAppMessaging/components/withInAppMessaging/index.d.ts +1 -0
  67. package/dist/InAppMessaging/components/withInAppMessaging/index.js +1 -0
  68. package/dist/InAppMessaging/components/withInAppMessaging/withInAppMessaging.d.ts +5 -0
  69. package/dist/InAppMessaging/components/withInAppMessaging/withInAppMessaging.js +11 -0
  70. package/dist/InAppMessaging/constants.d.ts +32 -0
  71. package/dist/InAppMessaging/constants.js +44 -0
  72. package/dist/InAppMessaging/hooks/index.d.ts +2 -0
  73. package/dist/InAppMessaging/hooks/index.js +2 -0
  74. package/dist/InAppMessaging/hooks/useMessageImage/constants.d.ts +8 -0
  75. package/dist/InAppMessaging/hooks/useMessageImage/constants.js +18 -0
  76. package/dist/InAppMessaging/hooks/useMessageImage/index.d.ts +2 -0
  77. package/dist/InAppMessaging/hooks/useMessageImage/index.js +1 -0
  78. package/dist/InAppMessaging/hooks/useMessageImage/types.d.ts +15 -0
  79. package/dist/InAppMessaging/hooks/useMessageImage/types.js +6 -0
  80. package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +10 -0
  81. package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.js +50 -0
  82. package/dist/InAppMessaging/hooks/useMessageImage/utils.d.ts +4 -0
  83. package/dist/InAppMessaging/hooks/useMessageImage/utils.js +56 -0
  84. package/dist/InAppMessaging/hooks/useMessageProps/index.d.ts +2 -0
  85. package/dist/InAppMessaging/hooks/useMessageProps/index.js +1 -0
  86. package/dist/InAppMessaging/hooks/useMessageProps/types.d.ts +109 -0
  87. package/dist/InAppMessaging/hooks/useMessageProps/types.js +1 -0
  88. package/dist/InAppMessaging/hooks/useMessageProps/useMessageProps.d.ts +12 -0
  89. package/dist/InAppMessaging/hooks/useMessageProps/useMessageProps.js +49 -0
  90. package/dist/InAppMessaging/hooks/useMessageProps/utils.d.ts +43 -0
  91. package/dist/InAppMessaging/hooks/useMessageProps/utils.js +192 -0
  92. package/dist/InAppMessaging/index.d.ts +2 -0
  93. package/dist/InAppMessaging/index.js +2 -0
  94. package/dist/__mocks__/@react-native-async-storage/async-storage.d.ts +1 -0
  95. package/dist/__mocks__/@react-native-async-storage/async-storage.js +2 -0
  96. package/dist/__mocks__/@react-native-community/netinfo.d.ts +1 -0
  97. package/dist/__mocks__/@react-native-community/netinfo.js +2 -0
  98. package/dist/__mocks__/react-native-safe-area-context.d.ts +3 -0
  99. package/dist/__mocks__/react-native-safe-area-context.js +4 -0
  100. package/dist/assets/icons/checkboxFilled.png +0 -0
  101. package/dist/assets/icons/checkboxOutline.png +0 -0
  102. package/dist/assets/icons/close.png +0 -0
  103. package/dist/assets/icons/index.d.ts +7 -0
  104. package/dist/assets/icons/index.js +6 -0
  105. package/dist/assets/icons/index.ts +9 -0
  106. package/dist/assets/index.d.ts +1 -0
  107. package/dist/assets/index.js +1 -0
  108. package/dist/assets/index.ts +1 -0
  109. package/dist/hooks/index.d.ts +1 -0
  110. package/dist/hooks/index.js +1 -0
  111. package/dist/hooks/useDeviceOrientation/index.d.ts +1 -0
  112. package/dist/hooks/useDeviceOrientation/index.js +1 -0
  113. package/dist/hooks/useDeviceOrientation/useDeviceOrientation.d.ts +6 -0
  114. package/dist/hooks/useDeviceOrientation/useDeviceOrientation.js +33 -0
  115. package/dist/index.d.ts +1 -0
  116. package/dist/index.js +1 -0
  117. package/dist/primitives/Button/Button.d.ts +2 -0
  118. package/dist/primitives/Button/Button.js +8 -0
  119. package/dist/primitives/Button/index.d.ts +2 -0
  120. package/dist/primitives/Button/index.js +1 -0
  121. package/dist/primitives/Button/styles.d.ts +2 -0
  122. package/dist/primitives/Button/styles.js +4 -0
  123. package/dist/primitives/Button/types.d.ts +7 -0
  124. package/dist/primitives/Button/types.js +1 -0
  125. package/dist/primitives/Carousel/Carousel.d.ts +2 -0
  126. package/dist/primitives/Carousel/Carousel.js +58 -0
  127. package/dist/primitives/Carousel/CarouselPageIndicator.d.ts +2 -0
  128. package/dist/primitives/Carousel/CarouselPageIndicator.js +10 -0
  129. package/dist/primitives/Carousel/constants.d.ts +9 -0
  130. package/dist/primitives/Carousel/constants.js +18 -0
  131. package/dist/primitives/Carousel/index.d.ts +3 -0
  132. package/dist/primitives/Carousel/index.js +2 -0
  133. package/dist/primitives/Carousel/styles.d.ts +2 -0
  134. package/dist/primitives/Carousel/styles.js +11 -0
  135. package/dist/primitives/Carousel/types.d.ts +19 -0
  136. package/dist/primitives/Carousel/types.js +1 -0
  137. package/dist/primitives/Checkbox/Checkbox.d.ts +2 -0
  138. package/dist/primitives/Checkbox/Checkbox.js +23 -0
  139. package/dist/primitives/Checkbox/index.d.ts +2 -0
  140. package/dist/primitives/Checkbox/index.js +1 -0
  141. package/dist/primitives/Checkbox/styles.d.ts +2 -0
  142. package/dist/primitives/Checkbox/styles.js +6 -0
  143. package/dist/primitives/Checkbox/types.d.ts +18 -0
  144. package/dist/primitives/Checkbox/types.js +1 -0
  145. package/dist/primitives/Heading/Heading.d.ts +2 -0
  146. package/dist/primitives/Heading/Heading.js +8 -0
  147. package/dist/primitives/Heading/index.d.ts +2 -0
  148. package/dist/primitives/Heading/index.js +1 -0
  149. package/dist/primitives/Heading/styles.d.ts +2 -0
  150. package/dist/primitives/Heading/styles.js +14 -0
  151. package/dist/primitives/Heading/types.d.ts +11 -0
  152. package/dist/primitives/Heading/types.js +1 -0
  153. package/dist/primitives/Icon/Icon.d.ts +2 -0
  154. package/dist/primitives/Icon/Icon.js +10 -0
  155. package/dist/primitives/Icon/index.d.ts +2 -0
  156. package/dist/primitives/Icon/index.js +1 -0
  157. package/dist/primitives/Icon/styles.d.ts +2 -0
  158. package/dist/primitives/Icon/styles.js +9 -0
  159. package/dist/primitives/Icon/types.d.ts +18 -0
  160. package/dist/primitives/Icon/types.js +1 -0
  161. package/dist/primitives/IconButton/IconButton.d.ts +2 -0
  162. package/dist/primitives/IconButton/IconButton.js +8 -0
  163. package/dist/primitives/IconButton/index.d.ts +2 -0
  164. package/dist/primitives/IconButton/index.js +1 -0
  165. package/dist/primitives/IconButton/styles.d.ts +0 -0
  166. package/dist/primitives/IconButton/styles.js +1 -0
  167. package/dist/primitives/IconButton/types.d.ts +22 -0
  168. package/dist/primitives/IconButton/types.js +1 -0
  169. package/dist/primitives/Label/Label.d.ts +2 -0
  170. package/dist/primitives/Label/Label.js +8 -0
  171. package/dist/primitives/Label/index.d.ts +2 -0
  172. package/dist/primitives/Label/index.js +1 -0
  173. package/dist/primitives/Label/styles.d.ts +2 -0
  174. package/dist/primitives/Label/styles.js +4 -0
  175. package/dist/primitives/Label/types.d.ts +7 -0
  176. package/dist/primitives/Label/types.js +1 -0
  177. package/dist/primitives/Label/utils.d.ts +17 -0
  178. package/dist/primitives/Label/utils.js +21 -0
  179. package/dist/primitives/Radio/Radio.d.ts +2 -0
  180. package/dist/primitives/Radio/Radio.js +29 -0
  181. package/dist/primitives/Radio/getRadioDimensions.d.ts +18 -0
  182. package/dist/primitives/Radio/getRadioDimensions.js +27 -0
  183. package/dist/primitives/Radio/index.d.ts +2 -0
  184. package/dist/primitives/Radio/index.js +1 -0
  185. package/dist/primitives/Radio/styles.d.ts +2 -0
  186. package/dist/primitives/Radio/styles.js +46 -0
  187. package/dist/primitives/Radio/types.d.ts +28 -0
  188. package/dist/primitives/Radio/types.js +1 -0
  189. package/dist/primitives/index.d.ts +8 -0
  190. package/dist/primitives/index.js +8 -0
  191. package/dist/utils/index.d.ts +2 -0
  192. package/dist/utils/index.js +7 -0
  193. package/jest.config.js +20 -0
  194. package/package.json +57 -0
  195. package/src/InAppMessaging/components/BannerMessage/BannerMessage.tsx +37 -0
  196. package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +138 -0
  197. package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +230 -0
  198. package/src/InAppMessaging/components/BannerMessage/index.ts +2 -0
  199. package/src/InAppMessaging/components/BannerMessage/styles.ts +106 -0
  200. package/src/InAppMessaging/components/BannerMessage/types.ts +15 -0
  201. package/src/InAppMessaging/components/CarouselMessage/CarouselMessage.tsx +42 -0
  202. package/src/InAppMessaging/components/CarouselMessage/CarouselMessageItem.tsx +37 -0
  203. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +55 -0
  204. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +56 -0
  205. package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +86 -0
  206. package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessageItem.spec.tsx.snap +248 -0
  207. package/src/InAppMessaging/components/CarouselMessage/index.ts +2 -0
  208. package/src/InAppMessaging/components/CarouselMessage/styles.ts +126 -0
  209. package/src/InAppMessaging/components/CarouselMessage/types.ts +28 -0
  210. package/src/InAppMessaging/components/FullScreenMessage/FullScreenMessage.tsx +38 -0
  211. package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +53 -0
  212. package/src/InAppMessaging/components/FullScreenMessage/__tests__/__snapshots__/FullScreenMessage.spec.tsx.snap +236 -0
  213. package/src/InAppMessaging/components/FullScreenMessage/index.ts +2 -0
  214. package/src/InAppMessaging/components/FullScreenMessage/styles.ts +107 -0
  215. package/src/InAppMessaging/components/FullScreenMessage/types.ts +7 -0
  216. package/src/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.tsx +48 -0
  217. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +31 -0
  218. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/__snapshots__/InAppMessageDisplay.spec.tsx.snap +9 -0
  219. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/handleMessageLinkAction.spec.ts +51 -0
  220. package/src/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.ts +30 -0
  221. package/src/InAppMessaging/components/InAppMessageDisplay/index.ts +2 -0
  222. package/src/InAppMessaging/components/InAppMessageDisplay/types.ts +32 -0
  223. package/src/InAppMessaging/components/MessageLayout/MessageLayout.tsx +102 -0
  224. package/src/InAppMessaging/components/MessageLayout/index.ts +1 -0
  225. package/src/InAppMessaging/components/MessageLayout/types.ts +15 -0
  226. package/src/InAppMessaging/components/MessageWrapper/MessageWrapper.tsx +34 -0
  227. package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +19 -0
  228. package/src/InAppMessaging/components/MessageWrapper/__tests__/__snapshots__/MessageWrapper.spec.tsx.snap +35 -0
  229. package/src/InAppMessaging/components/MessageWrapper/index.ts +2 -0
  230. package/src/InAppMessaging/components/MessageWrapper/styles.ts +7 -0
  231. package/src/InAppMessaging/components/MessageWrapper/types.ts +12 -0
  232. package/src/InAppMessaging/components/ModalMessage/ModalMessage.tsx +37 -0
  233. package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +155 -0
  234. package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +332 -0
  235. package/src/InAppMessaging/components/ModalMessage/index.ts +2 -0
  236. package/src/InAppMessaging/components/ModalMessage/styles.ts +133 -0
  237. package/src/InAppMessaging/components/ModalMessage/types.ts +8 -0
  238. package/src/InAppMessaging/components/index.ts +6 -0
  239. package/src/InAppMessaging/components/withInAppMessaging/__tests__/__snapshots__/withInAppMessaging.spec.tsx.snap +3 -0
  240. package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +15 -0
  241. package/src/InAppMessaging/components/withInAppMessaging/index.ts +1 -0
  242. package/src/InAppMessaging/components/withInAppMessaging/withInAppMessaging.tsx +18 -0
  243. package/src/InAppMessaging/constants.ts +57 -0
  244. package/src/InAppMessaging/hooks/index.ts +9 -0
  245. package/src/InAppMessaging/hooks/useMessageImage/__tests__/useMessageImage.spec.ts +141 -0
  246. package/src/InAppMessaging/hooks/useMessageImage/__tests__/utils.spec.ts +107 -0
  247. package/src/InAppMessaging/hooks/useMessageImage/constants.ts +27 -0
  248. package/src/InAppMessaging/hooks/useMessageImage/index.ts +2 -0
  249. package/src/InAppMessaging/hooks/useMessageImage/types.ts +18 -0
  250. package/src/InAppMessaging/hooks/useMessageImage/useMessageImage.ts +74 -0
  251. package/src/InAppMessaging/hooks/useMessageImage/utils.ts +80 -0
  252. package/src/InAppMessaging/hooks/useMessageProps/__tests__/__snapshots__/utils.spec.ts.snap +223 -0
  253. package/src/InAppMessaging/hooks/useMessageProps/__tests__/useMessageProps.spec.ts +162 -0
  254. package/src/InAppMessaging/hooks/useMessageProps/__tests__/utils.spec.ts +354 -0
  255. package/src/InAppMessaging/hooks/useMessageProps/index.ts +8 -0
  256. package/src/InAppMessaging/hooks/useMessageProps/types.ts +131 -0
  257. package/src/InAppMessaging/hooks/useMessageProps/useMessageProps.ts +70 -0
  258. package/src/InAppMessaging/hooks/useMessageProps/utils.ts +274 -0
  259. package/src/InAppMessaging/index.ts +14 -0
  260. package/src/__mocks__/@react-native-async-storage/async-storage.ts +2 -0
  261. package/src/__mocks__/@react-native-community/netinfo.ts +2 -0
  262. package/src/__mocks__/react-native-safe-area-context.ts +6 -0
  263. package/src/__tests__/__snapshots__/index.spec.ts.snap +15 -0
  264. package/src/__tests__/index.spec.ts +8 -0
  265. package/src/assets/icons/checkboxFilled.png +0 -0
  266. package/src/assets/icons/checkboxOutline.png +0 -0
  267. package/src/assets/icons/close.png +0 -0
  268. package/src/assets/icons/index.ts +9 -0
  269. package/src/assets/index.ts +1 -0
  270. package/src/hooks/index.ts +4 -0
  271. package/src/hooks/useDeviceOrientation/__tests__/useDeviceOrientation.spec.ts +87 -0
  272. package/src/hooks/useDeviceOrientation/index.ts +4 -0
  273. package/src/hooks/useDeviceOrientation/useDeviceOrientation.ts +47 -0
  274. package/src/index.ts +1 -0
  275. package/src/primitives/Button/Button.tsx +21 -0
  276. package/src/primitives/Button/__tests__/Button.spec.tsx +24 -0
  277. package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +52 -0
  278. package/src/primitives/Button/index.ts +2 -0
  279. package/src/primitives/Button/styles.ts +6 -0
  280. package/src/primitives/Button/types.ts +9 -0
  281. package/src/primitives/Carousel/Carousel.tsx +115 -0
  282. package/src/primitives/Carousel/CarouselPageIndicator.tsx +39 -0
  283. package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +185 -0
  284. package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +71 -0
  285. package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +216 -0
  286. package/src/primitives/Carousel/__tests__/__snapshots__/CarouselPageIndicator.spec.tsx.snap +191 -0
  287. package/src/primitives/Carousel/constants.ts +25 -0
  288. package/src/primitives/Carousel/index.ts +3 -0
  289. package/src/primitives/Carousel/styles.ts +14 -0
  290. package/src/primitives/Carousel/types.ts +22 -0
  291. package/src/primitives/Checkbox/Checkbox.tsx +57 -0
  292. package/src/primitives/Checkbox/__tests__/Checkbox.spec.tsx +50 -0
  293. package/src/primitives/Checkbox/__tests__/__snapshots__/Checkbox.spec.tsx.snap +198 -0
  294. package/src/primitives/Checkbox/index.ts +2 -0
  295. package/src/primitives/Checkbox/styles.ts +8 -0
  296. package/src/primitives/Checkbox/types.ts +20 -0
  297. package/src/primitives/Heading/Heading.tsx +22 -0
  298. package/src/primitives/Heading/__tests__/Heading.spec.tsx +36 -0
  299. package/src/primitives/Heading/__tests__/__snapshots__/Heading.spec.tsx.snap +150 -0
  300. package/src/primitives/Heading/index.ts +2 -0
  301. package/src/primitives/Heading/styles.ts +16 -0
  302. package/src/primitives/Heading/types.ts +13 -0
  303. package/src/primitives/Icon/Icon.tsx +20 -0
  304. package/src/primitives/Icon/__tests__/Icon.spec.tsx +25 -0
  305. package/src/primitives/Icon/__tests__/__snapshots__/Icon.spec.tsx.snap +64 -0
  306. package/src/primitives/Icon/index.ts +2 -0
  307. package/src/primitives/Icon/styles.ts +16 -0
  308. package/src/primitives/Icon/types.ts +22 -0
  309. package/src/primitives/IconButton/IconButton.tsx +19 -0
  310. package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +23 -0
  311. package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +75 -0
  312. package/src/primitives/IconButton/index.ts +2 -0
  313. package/src/primitives/IconButton/styles.ts +0 -0
  314. package/src/primitives/IconButton/types.ts +33 -0
  315. package/src/primitives/Label/Label.tsx +21 -0
  316. package/src/primitives/Label/__tests__/Label.spec.tsx +22 -0
  317. package/src/primitives/Label/__tests__/__snapshots__/Label.spec.tsx.snap +39 -0
  318. package/src/primitives/Label/index.ts +2 -0
  319. package/src/primitives/Label/styles.ts +7 -0
  320. package/src/primitives/Label/types.ts +8 -0
  321. package/src/primitives/Label/utils.ts +27 -0
  322. package/src/primitives/Radio/Radio.tsx +75 -0
  323. package/src/primitives/Radio/__tests__/Radio.spec.tsx +70 -0
  324. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +555 -0
  325. package/src/primitives/Radio/getRadioDimensions.ts +38 -0
  326. package/src/primitives/Radio/index.ts +2 -0
  327. package/src/primitives/Radio/styles.ts +50 -0
  328. package/src/primitives/Radio/types.ts +32 -0
  329. package/src/primitives/index.ts +8 -0
  330. package/src/utils/index.ts +10 -0
  331. package/tsconfig.dist.json +4 -0
  332. package/tsconfig.json +21 -0
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Modal, ModalPropsIOS } from 'react-native';
3
+ import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
4
+
5
+ import { styles } from './styles';
6
+ import { MessageWrapperProps } from './types';
7
+
8
+ const SUPPORTED_ORIENTATIONS: ModalPropsIOS['supportedOrientations'] = [
9
+ 'portrait',
10
+ 'portrait-upside-down',
11
+ 'landscape',
12
+ 'landscape-left',
13
+ 'landscape-right',
14
+ ];
15
+
16
+ export default function MessageWrapper({
17
+ children,
18
+ disableSafeAreaView,
19
+ style,
20
+ }: MessageWrapperProps): JSX.Element {
21
+ return (
22
+ <Modal transparent visible supportedOrientations={SUPPORTED_ORIENTATIONS}>
23
+ <SafeAreaProvider>
24
+ {disableSafeAreaView ? (
25
+ children
26
+ ) : (
27
+ <SafeAreaView style={[styles.messageWrapper, style]}>
28
+ {children}
29
+ </SafeAreaView>
30
+ )}
31
+ </SafeAreaProvider>
32
+ </Modal>
33
+ );
34
+ }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import TestRenderer from 'react-test-renderer';
3
+ import { Text } from 'react-native';
4
+
5
+ import MessageWrapper from '../MessageWrapper';
6
+
7
+ const Children = () => <Text>Children</Text>;
8
+
9
+ describe('MessageWrapper', () => {
10
+ it('renders as expected', () => {
11
+ const renderer = TestRenderer.create(
12
+ <MessageWrapper>
13
+ <Children />
14
+ </MessageWrapper>
15
+ );
16
+
17
+ expect(renderer.toJSON()).toMatchSnapshot();
18
+ });
19
+ });
@@ -0,0 +1,35 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`MessageWrapper renders as expected 1`] = `
4
+ <Modal
5
+ hardwareAccelerated={false}
6
+ supportedOrientations={
7
+ Array [
8
+ "portrait",
9
+ "portrait-upside-down",
10
+ "landscape",
11
+ "landscape-left",
12
+ "landscape-right",
13
+ ]
14
+ }
15
+ transparent={true}
16
+ visible={true}
17
+ >
18
+ <SafeAreaProvider>
19
+ <SafeAreaView
20
+ style={
21
+ Array [
22
+ Object {
23
+ "flex": 1,
24
+ },
25
+ undefined,
26
+ ]
27
+ }
28
+ >
29
+ <Text>
30
+ Children
31
+ </Text>
32
+ </SafeAreaView>
33
+ </SafeAreaProvider>
34
+ </Modal>
35
+ `;
@@ -0,0 +1,2 @@
1
+ export { default as MessageWrapper } from './MessageWrapper';
2
+ export { MessageWrapperProps, MessageWrapperStyle } from './types';
@@ -0,0 +1,7 @@
1
+ import { MessageWrapperStyle } from './types';
2
+
3
+ export const styles: MessageWrapperStyle = {
4
+ messageWrapper: {
5
+ flex: 1,
6
+ },
7
+ };
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ export interface MessageWrapperProps {
5
+ children: ReactNode;
6
+ disableSafeAreaView?: boolean;
7
+ style?: StyleProp<ViewStyle>;
8
+ }
9
+
10
+ export interface MessageWrapperStyle {
11
+ messageWrapper: ViewStyle;
12
+ }
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+
3
+ import { useDeviceOrientation } from '../../../hooks';
4
+ import { useMessageProps } from '../../hooks';
5
+ import { MessageLayout } from '../MessageLayout';
6
+ import { MessageWrapper } from '../MessageWrapper';
7
+
8
+ import { getLandscapeStyles, getPortraitStyles } from './styles';
9
+ import { ModalMessageProps } from './types';
10
+
11
+ export default function ModalMessage(
12
+ props: ModalMessageProps
13
+ ): JSX.Element | null {
14
+ const { deviceOrientation, isPortraitMode } = useDeviceOrientation();
15
+ const messageProps = useMessageProps(
16
+ props,
17
+ isPortraitMode ? getPortraitStyles : getLandscapeStyles
18
+ );
19
+ const { shouldRenderMessage, styles } = messageProps;
20
+
21
+ if (!shouldRenderMessage) {
22
+ return null;
23
+ }
24
+
25
+ const { wrapper, ...messageStyles } = styles!;
26
+
27
+ return (
28
+ <MessageWrapper style={wrapper}>
29
+ <MessageLayout
30
+ {...props}
31
+ {...messageProps}
32
+ orientation={deviceOrientation}
33
+ styles={messageStyles}
34
+ />
35
+ </MessageWrapper>
36
+ );
37
+ }
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import TestRenderer from 'react-test-renderer';
3
+
4
+ import { IN_APP_MESSAGING_TEST_ID } from '../../../constants';
5
+ import { useDeviceOrientation } from '../../../../hooks';
6
+ import { useMessageImage } from '../../../hooks';
7
+
8
+ import ModalMessage from '../ModalMessage';
9
+
10
+ jest.mock('../../../../hooks');
11
+ jest.mock('../../../hooks/useMessageImage');
12
+ jest.mock('../../MessageWrapper', () => ({ MessageWrapper: 'MessageWrapper' }));
13
+
14
+ const mockUseMessageImage = useMessageImage as jest.Mock;
15
+ const onAction = jest.fn();
16
+ const onClose = jest.fn();
17
+
18
+ const baseProps = { layout: 'MODAL' as const, onClose };
19
+
20
+ describe('ModalMessage', () => {
21
+ beforeEach(() => {
22
+ jest.clearAllMocks();
23
+ });
24
+
25
+ it.each([
26
+ ['landscape', false],
27
+ ['portrait', true],
28
+ ])('renders as expected in %s mode', (deviceOrientation, isPortraitMode) => {
29
+ (useDeviceOrientation as jest.Mock).mockReturnValue({
30
+ deviceOrientation,
31
+ isPortraitMode,
32
+ });
33
+ mockUseMessageImage.mockReturnValueOnce({
34
+ hasRenderableImage: false,
35
+ imageDimensions: { height: null, width: null },
36
+ isImageFetching: false,
37
+ });
38
+
39
+ const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
40
+
41
+ expect(renderer.toJSON()).toMatchSnapshot();
42
+ });
43
+
44
+ it('renders a message as expected with an image', () => {
45
+ (useDeviceOrientation as jest.Mock).mockReturnValue({
46
+ deviceOrientation: 'portrait',
47
+ isPortraitMode: true,
48
+ });
49
+ mockUseMessageImage.mockReturnValueOnce({
50
+ hasRenderableImage: true,
51
+ imageDimensions: { height: 100, width: 100 },
52
+ isImageFetching: false,
53
+ });
54
+
55
+ const src = 'asset.png';
56
+ const props = { ...baseProps, image: { src } };
57
+
58
+ const renderer = TestRenderer.create(<ModalMessage {...props} />);
59
+
60
+ const image = renderer.root.findByProps({
61
+ testID: IN_APP_MESSAGING_TEST_ID.IMAGE,
62
+ });
63
+
64
+ expect(image.props).toEqual(
65
+ expect.objectContaining({ source: { uri: src } })
66
+ );
67
+ expect(renderer.toJSON()).toMatchSnapshot();
68
+ });
69
+
70
+ it('returns null while an image is fetching', () => {
71
+ (useDeviceOrientation as jest.Mock).mockReturnValue({
72
+ deviceOrientation: 'portrait',
73
+ isPortraitMode: true,
74
+ });
75
+ mockUseMessageImage.mockReturnValueOnce({
76
+ hasRenderableImage: false,
77
+ imageDimensions: { height: null, width: null },
78
+ isImageFetching: true,
79
+ });
80
+
81
+ const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
82
+
83
+ expect(renderer.toJSON()).toBeNull();
84
+ });
85
+
86
+ it.each([
87
+ [
88
+ 'header',
89
+ IN_APP_MESSAGING_TEST_ID.HEADER,
90
+ {
91
+ testProps: { content: 'header content' },
92
+ expectedProps: { children: 'header content' },
93
+ },
94
+ ],
95
+ [
96
+ 'body',
97
+ IN_APP_MESSAGING_TEST_ID.BODY,
98
+ {
99
+ testProps: { content: 'body content' },
100
+ expectedProps: { children: 'body content' },
101
+ },
102
+ ],
103
+ [
104
+ 'primaryButton',
105
+ IN_APP_MESSAGING_TEST_ID.PRIMARY_BUTTON,
106
+ {
107
+ testProps: { onAction, title: 'primary button' },
108
+ expectedProps: { children: 'primary button', onPress: onAction },
109
+ },
110
+ ],
111
+ [
112
+ 'secondaryButton',
113
+ IN_APP_MESSAGING_TEST_ID.SECONDARY_BUTTON,
114
+ {
115
+ testProps: { onAction, title: 'secondary button' },
116
+ expectedProps: { children: 'secondary button', onPress: onAction },
117
+ },
118
+ ],
119
+ ])(
120
+ 'correctly handles a %s prop',
121
+ (key, testID, { testProps, expectedProps }) => {
122
+ mockUseMessageImage.mockReturnValueOnce({
123
+ hasRenderableImage: false,
124
+ imageDimensions: { height: null, width: null },
125
+ isImageFetching: false,
126
+ });
127
+
128
+ const props = { ...baseProps, [key]: testProps };
129
+
130
+ const renderer = TestRenderer.create(<ModalMessage {...props} />);
131
+ const testElement = renderer.root.findByProps({ testID });
132
+
133
+ expect(testElement.props).toEqual(expect.objectContaining(expectedProps));
134
+ }
135
+ );
136
+
137
+ it('calls onClose when the close button is pressed', () => {
138
+ mockUseMessageImage.mockReturnValueOnce({
139
+ hasRenderableImage: false,
140
+ imageDimensions: { height: null, width: null },
141
+ isImageFetching: false,
142
+ });
143
+
144
+ const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
145
+ const closeButton = renderer.root.findByProps({
146
+ testID: IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON,
147
+ });
148
+
149
+ TestRenderer.act(() => {
150
+ (closeButton.props as { onPress: () => void }).onPress();
151
+ });
152
+
153
+ expect(onClose).toHaveBeenCalledTimes(1);
154
+ });
155
+ });
@@ -0,0 +1,332 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ModalMessage renders a message as expected with an image 1`] = `
4
+ <MessageWrapper
5
+ style={
6
+ Object {
7
+ "flex": 1,
8
+ "justifyContent": "center",
9
+ }
10
+ }
11
+ >
12
+ <View
13
+ style={
14
+ Array [
15
+ Object {
16
+ "backgroundColor": "#fff",
17
+ "elevation": 3,
18
+ "margin": 16,
19
+ "minHeight": "40%",
20
+ "shadowColor": "#000",
21
+ "shadowOffset": Object {
22
+ "height": 2,
23
+ "width": 2,
24
+ },
25
+ "shadowOpacity": 0.1,
26
+ "shadowRadius": 2,
27
+ },
28
+ Object {},
29
+ Object {},
30
+ ]
31
+ }
32
+ >
33
+ <View
34
+ style={
35
+ Object {
36
+ "padding": 12,
37
+ }
38
+ }
39
+ >
40
+ <View
41
+ accessible={true}
42
+ collapsable={false}
43
+ focusable={true}
44
+ hitSlop={
45
+ Object {
46
+ "bottom": 10,
47
+ "left": 10,
48
+ "right": 10,
49
+ "top": 10,
50
+ }
51
+ }
52
+ onBlur={[Function]}
53
+ onClick={[Function]}
54
+ onFocus={[Function]}
55
+ onResponderGrant={[Function]}
56
+ onResponderMove={[Function]}
57
+ onResponderRelease={[Function]}
58
+ onResponderTerminate={[Function]}
59
+ onResponderTerminationRequest={[Function]}
60
+ onStartShouldSetResponder={[Function]}
61
+ style={
62
+ Array [
63
+ Object {
64
+ "alignSelf": "flex-start",
65
+ "marginLeft": "auto",
66
+ },
67
+ undefined,
68
+ ]
69
+ }
70
+ testID="in-app-messaging--close-button"
71
+ >
72
+ <Image
73
+ source={
74
+ Object {
75
+ "testUri": "../../../src/assets/icons/close.png",
76
+ }
77
+ }
78
+ style={
79
+ Array [
80
+ Object {
81
+ "height": 20,
82
+ "resizeMode": "contain",
83
+ "tintColor": undefined,
84
+ "width": 20,
85
+ },
86
+ undefined,
87
+ ]
88
+ }
89
+ />
90
+ </View>
91
+ <View
92
+ style={
93
+ Object {
94
+ "alignItems": "center",
95
+ "margin": 12,
96
+ }
97
+ }
98
+ >
99
+ <Image
100
+ source={
101
+ Object {
102
+ "uri": "asset.png",
103
+ }
104
+ }
105
+ style={
106
+ Array [
107
+ Object {
108
+ "height": 100,
109
+ "width": 100,
110
+ },
111
+ undefined,
112
+ ]
113
+ }
114
+ testID="in-app-messaging--image"
115
+ />
116
+ </View>
117
+ <View
118
+ style={
119
+ Object {
120
+ "marginTop": 12,
121
+ }
122
+ }
123
+ />
124
+ </View>
125
+ </View>
126
+ </MessageWrapper>
127
+ `;
128
+
129
+ exports[`ModalMessage renders as expected in landscape mode 1`] = `
130
+ <MessageWrapper
131
+ style={
132
+ Object {
133
+ "flex": 1,
134
+ "justifyContent": "center",
135
+ }
136
+ }
137
+ >
138
+ <View
139
+ style={
140
+ Array [
141
+ Object {
142
+ "backgroundColor": "#fff",
143
+ "elevation": 3,
144
+ "flex": 1,
145
+ "margin": 16,
146
+ "padding": 16,
147
+ "shadowColor": "#000",
148
+ "shadowOffset": Object {
149
+ "height": 2,
150
+ "width": 2,
151
+ },
152
+ "shadowOpacity": 0.1,
153
+ "shadowRadius": 2,
154
+ },
155
+ Object {},
156
+ Object {},
157
+ ]
158
+ }
159
+ >
160
+ <View
161
+ style={
162
+ Object {
163
+ "flex": 1,
164
+ "flexDirection": "row",
165
+ }
166
+ }
167
+ >
168
+ <View
169
+ style={
170
+ Object {
171
+ "flex": 1,
172
+ "justifyContent": "center",
173
+ "paddingHorizontal": 8,
174
+ }
175
+ }
176
+ />
177
+ <View
178
+ accessible={true}
179
+ collapsable={false}
180
+ focusable={true}
181
+ hitSlop={
182
+ Object {
183
+ "bottom": 10,
184
+ "left": 10,
185
+ "right": 10,
186
+ "top": 10,
187
+ }
188
+ }
189
+ onBlur={[Function]}
190
+ onClick={[Function]}
191
+ onFocus={[Function]}
192
+ onResponderGrant={[Function]}
193
+ onResponderMove={[Function]}
194
+ onResponderRelease={[Function]}
195
+ onResponderTerminate={[Function]}
196
+ onResponderTerminationRequest={[Function]}
197
+ onStartShouldSetResponder={[Function]}
198
+ style={
199
+ Array [
200
+ Object {
201
+ "alignSelf": "flex-start",
202
+ "marginLeft": "auto",
203
+ "marginRight": 8,
204
+ },
205
+ undefined,
206
+ ]
207
+ }
208
+ testID="in-app-messaging--close-button"
209
+ >
210
+ <Image
211
+ source={
212
+ Object {
213
+ "testUri": "../../../src/assets/icons/close.png",
214
+ }
215
+ }
216
+ style={
217
+ Array [
218
+ Object {
219
+ "height": 20,
220
+ "resizeMode": "contain",
221
+ "tintColor": undefined,
222
+ "width": 20,
223
+ },
224
+ undefined,
225
+ ]
226
+ }
227
+ />
228
+ </View>
229
+ </View>
230
+ </View>
231
+ </MessageWrapper>
232
+ `;
233
+
234
+ exports[`ModalMessage renders as expected in portrait mode 1`] = `
235
+ <MessageWrapper
236
+ style={
237
+ Object {
238
+ "flex": 1,
239
+ "justifyContent": "center",
240
+ }
241
+ }
242
+ >
243
+ <View
244
+ style={
245
+ Array [
246
+ Object {
247
+ "backgroundColor": "#fff",
248
+ "elevation": 3,
249
+ "margin": 16,
250
+ "minHeight": "40%",
251
+ "shadowColor": "#000",
252
+ "shadowOffset": Object {
253
+ "height": 2,
254
+ "width": 2,
255
+ },
256
+ "shadowOpacity": 0.1,
257
+ "shadowRadius": 2,
258
+ },
259
+ Object {},
260
+ Object {},
261
+ ]
262
+ }
263
+ >
264
+ <View
265
+ style={
266
+ Object {
267
+ "padding": 12,
268
+ }
269
+ }
270
+ >
271
+ <View
272
+ accessible={true}
273
+ collapsable={false}
274
+ focusable={true}
275
+ hitSlop={
276
+ Object {
277
+ "bottom": 10,
278
+ "left": 10,
279
+ "right": 10,
280
+ "top": 10,
281
+ }
282
+ }
283
+ onBlur={[Function]}
284
+ onClick={[Function]}
285
+ onFocus={[Function]}
286
+ onResponderGrant={[Function]}
287
+ onResponderMove={[Function]}
288
+ onResponderRelease={[Function]}
289
+ onResponderTerminate={[Function]}
290
+ onResponderTerminationRequest={[Function]}
291
+ onStartShouldSetResponder={[Function]}
292
+ style={
293
+ Array [
294
+ Object {
295
+ "alignSelf": "flex-start",
296
+ "marginLeft": "auto",
297
+ },
298
+ undefined,
299
+ ]
300
+ }
301
+ testID="in-app-messaging--close-button"
302
+ >
303
+ <Image
304
+ source={
305
+ Object {
306
+ "testUri": "../../../src/assets/icons/close.png",
307
+ }
308
+ }
309
+ style={
310
+ Array [
311
+ Object {
312
+ "height": 20,
313
+ "resizeMode": "contain",
314
+ "tintColor": undefined,
315
+ "width": 20,
316
+ },
317
+ undefined,
318
+ ]
319
+ }
320
+ />
321
+ </View>
322
+ <View
323
+ style={
324
+ Object {
325
+ "marginTop": 12,
326
+ }
327
+ }
328
+ />
329
+ </View>
330
+ </View>
331
+ </MessageWrapper>
332
+ `;
@@ -0,0 +1,2 @@
1
+ export { default as ModalMessage } from './ModalMessage';
2
+ export { ModalMessageProps } from './types';