@aws-amplify/ui-react-native 1.2.21 → 1.2.23

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 (359) hide show
  1. package/dist/Authenticator/common/DefaultContent/styles.js +1 -2
  2. package/dist/primitives/Heading/styles.js +5 -5
  3. package/dist/primitives/Label/styles.js +2 -2
  4. package/dist/primitives/TextField/styles.js +3 -3
  5. package/dist/version.d.ts +1 -1
  6. package/dist/version.js +1 -1
  7. package/lib/Authenticator/Authenticator.js +72 -0
  8. package/lib/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.js +43 -0
  9. package/lib/Authenticator/Defaults/ConfirmResetPassword/index.js +8 -0
  10. package/lib/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.js +42 -0
  11. package/lib/Authenticator/Defaults/ConfirmSignIn/index.js +8 -0
  12. package/lib/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.js +43 -0
  13. package/lib/Authenticator/Defaults/ConfirmSignUp/index.js +8 -0
  14. package/lib/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.js +42 -0
  15. package/lib/Authenticator/Defaults/ConfirmVerifyUser/index.js +8 -0
  16. package/lib/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.js +45 -0
  17. package/lib/Authenticator/Defaults/ForceNewPassword/index.js +8 -0
  18. package/lib/Authenticator/Defaults/ResetPassword/ResetPassword.js +42 -0
  19. package/lib/Authenticator/Defaults/ResetPassword/index.js +8 -0
  20. package/lib/Authenticator/Defaults/SetupTOTP/SetupTOTP.js +52 -0
  21. package/lib/Authenticator/Defaults/SetupTOTP/index.js +8 -0
  22. package/lib/Authenticator/Defaults/SetupTOTP/styles.js +8 -0
  23. package/lib/Authenticator/Defaults/SignIn/SignIn.js +50 -0
  24. package/lib/Authenticator/Defaults/SignIn/index.js +8 -0
  25. package/lib/Authenticator/Defaults/SignUp/SignUp.js +48 -0
  26. package/lib/Authenticator/Defaults/SignUp/index.js +8 -0
  27. package/lib/Authenticator/Defaults/VerifyUser/VerifyUser.js +33 -0
  28. package/lib/Authenticator/Defaults/VerifyUser/index.js +8 -0
  29. package/lib/Authenticator/Defaults/index.js +23 -0
  30. package/lib/Authenticator/Defaults/types.js +2 -0
  31. package/lib/Authenticator/common/DefaultContainer/DefaultContainer.js +37 -0
  32. package/lib/Authenticator/common/DefaultContainer/InnerContainer.js +15 -0
  33. package/lib/Authenticator/common/DefaultContainer/index.js +10 -0
  34. package/lib/Authenticator/common/DefaultContainer/styles.js +31 -0
  35. package/lib/Authenticator/common/DefaultContainer/types.js +2 -0
  36. package/lib/Authenticator/common/DefaultContent/DefaultContent.js +33 -0
  37. package/lib/Authenticator/common/DefaultContent/index.js +8 -0
  38. package/lib/Authenticator/common/DefaultContent/styles.js +54 -0
  39. package/lib/Authenticator/common/DefaultContent/types.js +2 -0
  40. package/lib/Authenticator/common/DefaultFooter/DefaultFooter.js +9 -0
  41. package/lib/Authenticator/common/DefaultFooter/index.js +8 -0
  42. package/lib/Authenticator/common/DefaultFooter/types.js +2 -0
  43. package/lib/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +28 -0
  44. package/lib/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +21 -0
  45. package/lib/Authenticator/common/DefaultFormFields/Field.js +37 -0
  46. package/lib/Authenticator/common/DefaultFormFields/FieldErrors.js +17 -0
  47. package/lib/Authenticator/common/DefaultFormFields/index.js +10 -0
  48. package/lib/Authenticator/common/DefaultFormFields/types.js +2 -0
  49. package/lib/Authenticator/common/DefaultHeader/DefaultHeader.js +11 -0
  50. package/lib/Authenticator/common/DefaultHeader/index.js +8 -0
  51. package/lib/Authenticator/common/DefaultHeader/types.js +2 -0
  52. package/lib/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +18 -0
  53. package/lib/Authenticator/common/FederatedProviderButton/index.js +8 -0
  54. package/lib/Authenticator/common/FederatedProviderButton/styles.js +21 -0
  55. package/lib/Authenticator/common/FederatedProviderButton/types.js +2 -0
  56. package/lib/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +26 -0
  57. package/lib/Authenticator/common/FederatedProviderButtons/index.js +8 -0
  58. package/lib/Authenticator/common/FederatedProviderButtons/styles.js +8 -0
  59. package/lib/Authenticator/common/FederatedProviderButtons/types.js +2 -0
  60. package/lib/Authenticator/common/index.js +10 -0
  61. package/lib/Authenticator/hooks/index.js +5 -0
  62. package/lib/Authenticator/hooks/types.js +2 -0
  63. package/lib/Authenticator/hooks/useFieldValues/constants.js +11 -0
  64. package/lib/Authenticator/hooks/useFieldValues/index.js +10 -0
  65. package/lib/Authenticator/hooks/useFieldValues/types.js +2 -0
  66. package/lib/Authenticator/hooks/useFieldValues/useFieldValues.js +101 -0
  67. package/lib/Authenticator/hooks/useFieldValues/utils.js +139 -0
  68. package/lib/Authenticator/index.js +13 -0
  69. package/lib/Authenticator/types.js +2 -0
  70. package/lib/Authenticator/withAuthenticator.js +15 -0
  71. package/lib/InAppMessaging/components/BannerMessage/BannerMessage.js +20 -0
  72. package/lib/InAppMessaging/components/BannerMessage/index.js +8 -0
  73. package/lib/InAppMessaging/components/BannerMessage/styles.js +81 -0
  74. package/lib/InAppMessaging/components/BannerMessage/types.js +2 -0
  75. package/lib/InAppMessaging/components/CarouselMessage/CarouselMessage.js +25 -0
  76. package/lib/InAppMessaging/components/CarouselMessage/CarouselMessageItem.js +22 -0
  77. package/lib/InAppMessaging/components/CarouselMessage/index.js +8 -0
  78. package/lib/InAppMessaging/components/CarouselMessage/styles.js +103 -0
  79. package/lib/InAppMessaging/components/CarouselMessage/types.js +2 -0
  80. package/lib/InAppMessaging/components/FullScreenMessage/FullScreenMessage.js +22 -0
  81. package/lib/InAppMessaging/components/FullScreenMessage/index.js +8 -0
  82. package/lib/InAppMessaging/components/FullScreenMessage/styles.js +91 -0
  83. package/lib/InAppMessaging/components/FullScreenMessage/types.js +2 -0
  84. package/lib/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.js +32 -0
  85. package/lib/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +26 -0
  86. package/lib/InAppMessaging/components/InAppMessageDisplay/index.js +8 -0
  87. package/lib/InAppMessaging/components/InAppMessageDisplay/types.js +2 -0
  88. package/lib/InAppMessaging/components/MessageLayout/MessageLayout.js +38 -0
  89. package/lib/InAppMessaging/components/MessageLayout/index.js +8 -0
  90. package/lib/InAppMessaging/components/MessageLayout/types.js +2 -0
  91. package/lib/InAppMessaging/components/MessageWrapper/MessageWrapper.js +24 -0
  92. package/lib/InAppMessaging/components/MessageWrapper/index.js +8 -0
  93. package/lib/InAppMessaging/components/MessageWrapper/styles.js +8 -0
  94. package/lib/InAppMessaging/components/MessageWrapper/types.js +2 -0
  95. package/lib/InAppMessaging/components/ModalMessage/ModalMessage.js +22 -0
  96. package/lib/InAppMessaging/components/ModalMessage/index.js +8 -0
  97. package/lib/InAppMessaging/components/ModalMessage/styles.js +104 -0
  98. package/lib/InAppMessaging/components/ModalMessage/types.js +2 -0
  99. package/lib/InAppMessaging/components/index.js +7 -0
  100. package/lib/InAppMessaging/components/withInAppMessaging/index.js +8 -0
  101. package/lib/InAppMessaging/components/withInAppMessaging/withInAppMessaging.js +15 -0
  102. package/lib/InAppMessaging/constants.js +48 -0
  103. package/lib/InAppMessaging/hooks/index.js +7 -0
  104. package/lib/InAppMessaging/hooks/useMessageImage/constants.js +21 -0
  105. package/lib/InAppMessaging/hooks/useMessageImage/index.js +8 -0
  106. package/lib/InAppMessaging/hooks/useMessageImage/types.js +9 -0
  107. package/lib/InAppMessaging/hooks/useMessageImage/useMessageImage.js +53 -0
  108. package/lib/InAppMessaging/hooks/useMessageImage/utils.js +61 -0
  109. package/lib/InAppMessaging/hooks/useMessageProps/index.js +8 -0
  110. package/lib/InAppMessaging/hooks/useMessageProps/types.js +2 -0
  111. package/lib/InAppMessaging/hooks/useMessageProps/useMessageProps.js +52 -0
  112. package/lib/InAppMessaging/hooks/useMessageProps/utils.js +201 -0
  113. package/lib/InAppMessaging/index.js +9 -0
  114. package/lib/assets/icons/amazonLogo.png +0 -0
  115. package/lib/assets/icons/amazonLogo@2x.png +0 -0
  116. package/lib/assets/icons/amazonLogo@3x.png +0 -0
  117. package/lib/assets/icons/appleLogo.png +0 -0
  118. package/lib/assets/icons/appleLogo@2x.png +0 -0
  119. package/lib/assets/icons/appleLogo@3x.png +0 -0
  120. package/lib/assets/icons/checkboxFilled.png +0 -0
  121. package/lib/assets/icons/checkboxFilled@2x.png +0 -0
  122. package/lib/assets/icons/checkboxFilled@3x.png +0 -0
  123. package/lib/assets/icons/checkboxOutline.png +0 -0
  124. package/lib/assets/icons/checkboxOutline@2x.png +0 -0
  125. package/lib/assets/icons/checkboxOutline@3x.png +0 -0
  126. package/lib/assets/icons/close.png +0 -0
  127. package/lib/assets/icons/close@2x.png +0 -0
  128. package/lib/assets/icons/close@3x.png +0 -0
  129. package/lib/assets/icons/copy.png +0 -0
  130. package/lib/assets/icons/copy@2x.png +0 -0
  131. package/lib/assets/icons/copy@3x.png +0 -0
  132. package/lib/assets/icons/error.png +0 -0
  133. package/lib/assets/icons/error@2x.png +0 -0
  134. package/lib/assets/icons/error@3x.png +0 -0
  135. package/lib/assets/icons/facebookLogo.png +0 -0
  136. package/lib/assets/icons/facebookLogo@2x.png +0 -0
  137. package/lib/assets/icons/facebookLogo@3x.png +0 -0
  138. package/lib/assets/icons/googleLogo.png +0 -0
  139. package/lib/assets/icons/googleLogo@2x.png +0 -0
  140. package/lib/assets/icons/googleLogo@3x.png +0 -0
  141. package/lib/assets/icons/index.js +16 -0
  142. package/lib/assets/icons/index.ts +17 -0
  143. package/lib/assets/icons/visibilityOff.png +0 -0
  144. package/lib/assets/icons/visibilityOff@2x.png +0 -0
  145. package/lib/assets/icons/visibilityOff@3x.png +0 -0
  146. package/lib/assets/icons/visibilityOn.png +0 -0
  147. package/lib/assets/icons/visibilityOn@2x.png +0 -0
  148. package/lib/assets/icons/visibilityOn@3x.png +0 -0
  149. package/lib/assets/index.js +8 -0
  150. package/lib/hooks/index.js +9 -0
  151. package/lib/hooks/useDeprecationWarning/index.js +8 -0
  152. package/lib/hooks/useDeprecationWarning/useDeprecationWarning.js +13 -0
  153. package/lib/hooks/useDeviceOrientation/index.js +8 -0
  154. package/lib/hooks/useDeviceOrientation/useDeviceOrientation.js +37 -0
  155. package/lib/hooks/usePressableContainerStyles/index.js +5 -0
  156. package/lib/hooks/usePressableContainerStyles/usePressableContainerStyles.js +19 -0
  157. package/lib/index.js +14 -0
  158. package/lib/primitives/Button/Button.js +31 -0
  159. package/lib/primitives/Button/index.js +8 -0
  160. package/lib/primitives/Button/styles.js +55 -0
  161. package/lib/primitives/Button/types.js +2 -0
  162. package/lib/primitives/Carousel/Carousel.js +63 -0
  163. package/lib/primitives/Carousel/CarouselPageIndicator.js +14 -0
  164. package/lib/primitives/Carousel/constants.js +21 -0
  165. package/lib/primitives/Carousel/index.js +10 -0
  166. package/lib/primitives/Carousel/styles.js +14 -0
  167. package/lib/primitives/Carousel/types.js +2 -0
  168. package/lib/primitives/Checkbox/Checkbox.js +28 -0
  169. package/lib/primitives/Checkbox/index.js +8 -0
  170. package/lib/primitives/Checkbox/styles.js +28 -0
  171. package/lib/primitives/Checkbox/types.js +2 -0
  172. package/lib/primitives/Divider/Divider.js +22 -0
  173. package/lib/primitives/Divider/index.js +8 -0
  174. package/lib/primitives/Divider/styles.js +28 -0
  175. package/lib/primitives/Divider/types.js +2 -0
  176. package/lib/primitives/ErrorMessage/ErrorMessage.js +22 -0
  177. package/lib/primitives/ErrorMessage/index.js +8 -0
  178. package/lib/primitives/ErrorMessage/styles.js +30 -0
  179. package/lib/primitives/ErrorMessage/types.js +2 -0
  180. package/lib/primitives/Heading/Heading.js +15 -0
  181. package/lib/primitives/Heading/index.js +8 -0
  182. package/lib/primitives/Heading/styles.js +51 -0
  183. package/lib/primitives/Heading/types.js +2 -0
  184. package/lib/primitives/Icon/Icon.js +21 -0
  185. package/lib/primitives/Icon/constants.js +10 -0
  186. package/lib/primitives/Icon/index.js +10 -0
  187. package/lib/primitives/Icon/styles.js +34 -0
  188. package/lib/primitives/Icon/types.js +2 -0
  189. package/lib/primitives/IconButton/IconButton.js +26 -0
  190. package/lib/primitives/IconButton/index.js +8 -0
  191. package/lib/primitives/IconButton/styles.js +21 -0
  192. package/lib/primitives/IconButton/types.js +2 -0
  193. package/lib/primitives/Label/Label.js +16 -0
  194. package/lib/primitives/Label/index.js +8 -0
  195. package/lib/primitives/Label/styles.js +45 -0
  196. package/lib/primitives/Label/types.js +2 -0
  197. package/lib/primitives/Label/utils.js +25 -0
  198. package/lib/primitives/PasswordField/PasswordField.js +24 -0
  199. package/lib/primitives/PasswordField/index.js +8 -0
  200. package/lib/primitives/PasswordField/styles.js +17 -0
  201. package/lib/primitives/PasswordField/types.js +2 -0
  202. package/lib/primitives/PhoneNumberField/PhoneNumberField.js +13 -0
  203. package/lib/primitives/PhoneNumberField/index.js +8 -0
  204. package/lib/primitives/PhoneNumberField/styles.js +22 -0
  205. package/lib/primitives/PhoneNumberField/types.js +2 -0
  206. package/lib/primitives/Radio/Radio.js +46 -0
  207. package/lib/primitives/Radio/getRadioDimensions.js +43 -0
  208. package/lib/primitives/Radio/index.js +8 -0
  209. package/lib/primitives/Radio/styles.js +68 -0
  210. package/lib/primitives/Radio/types.js +2 -0
  211. package/lib/primitives/RadioGroup/RadioGroup.js +55 -0
  212. package/lib/primitives/RadioGroup/index.js +8 -0
  213. package/lib/primitives/RadioGroup/styles.js +20 -0
  214. package/lib/primitives/RadioGroup/types.js +2 -0
  215. package/lib/primitives/Tabs/Tab.js +27 -0
  216. package/lib/primitives/Tabs/Tabs.js +29 -0
  217. package/lib/primitives/Tabs/index.js +10 -0
  218. package/lib/primitives/Tabs/styles.js +58 -0
  219. package/lib/primitives/Tabs/types.js +2 -0
  220. package/lib/primitives/TextField/TextField.js +31 -0
  221. package/lib/primitives/TextField/index.js +8 -0
  222. package/lib/primitives/TextField/styles.js +46 -0
  223. package/lib/primitives/TextField/types.js +2 -0
  224. package/lib/primitives/index.js +18 -0
  225. package/lib/theme/ThemeContext.js +9 -0
  226. package/lib/theme/ThemeProvider.js +12 -0
  227. package/lib/theme/createTheme.js +113 -0
  228. package/lib/theme/defaultTheme.js +11 -0
  229. package/lib/theme/index.js +12 -0
  230. package/lib/theme/types.js +2 -0
  231. package/lib/theme/useTheme.js +11 -0
  232. package/lib/utils/font.js +8 -0
  233. package/lib/utils/index.js +10 -0
  234. package/lib/utils/platform.js +21 -0
  235. package/lib/version.js +4 -0
  236. package/package.json +19 -10
  237. package/src/Authenticator/common/DefaultContent/styles.ts +1 -2
  238. package/src/primitives/Heading/styles.ts +5 -5
  239. package/src/primitives/Label/styles.ts +2 -2
  240. package/src/primitives/TextField/styles.ts +3 -3
  241. package/src/version.ts +1 -1
  242. package/.eslintrc.js +0 -12
  243. package/.lintstagedrc.js +0 -6
  244. package/.turbo/turbo-build.log +0 -3
  245. package/CHANGELOG.md +0 -321
  246. package/babel.config.js +0 -3
  247. package/dist/assets/index.ts +0 -1
  248. package/jest.config.js +0 -22
  249. package/jest.setup.js +0 -3
  250. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/ConfirmResetPassword.spec.tsx +0 -89
  251. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +0 -1086
  252. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/ConfirmSignIn.spec.tsx +0 -78
  253. package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +0 -512
  254. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/ConfirmSignUp.spec.tsx +0 -64
  255. package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +0 -531
  256. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/ConfirmVerifyUser.spec.tsx +0 -71
  257. package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +0 -495
  258. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/ForceNewPassword.spec.tsx +0 -79
  259. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +0 -893
  260. package/src/Authenticator/Defaults/ResetPassword/__tests__/ResetPassword.spec.tsx +0 -78
  261. package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +0 -512
  262. package/src/Authenticator/Defaults/SetupTOTP/__tests__/SetupTOTP.spec.tsx +0 -85
  263. package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +0 -602
  264. package/src/Authenticator/Defaults/SignIn/__tests__/SignIn.spec.tsx +0 -67
  265. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +0 -1278
  266. package/src/Authenticator/Defaults/SignUp/__tests__/SignUp.spec.tsx +0 -102
  267. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +0 -3107
  268. package/src/Authenticator/Defaults/VerifyUser/__tests__/VerifyUser.spec.tsx +0 -107
  269. package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +0 -694
  270. package/src/Authenticator/__tests__/Authenticator.spec.tsx +0 -131
  271. package/src/Authenticator/__tests__/__snapshots__/Authenticator.spec.tsx.snap +0 -90
  272. package/src/Authenticator/__tests__/__snapshots__/withAuthenticator.spec.tsx.snap +0 -68
  273. package/src/Authenticator/__tests__/withAuthenticator.spec.tsx +0 -73
  274. package/src/Authenticator/common/DefaultContainer/__tests__/DefaultContainer.spec.tsx +0 -19
  275. package/src/Authenticator/common/DefaultContainer/__tests__/__snapshots__/DefaultContainer.spec.tsx.snap +0 -83
  276. package/src/Authenticator/common/DefaultFooter/__tests__/DefaultFooter.spec.tsx +0 -26
  277. package/src/Authenticator/common/DefaultFooter/__tests__/__snapshots__/DefaultFooter.spec.tsx.snap +0 -40
  278. package/src/Authenticator/common/DefaultFormFields/__tests__/DefaultFormFields.spec.tsx +0 -15
  279. package/src/Authenticator/common/DefaultFormFields/__tests__/FieldErrors.spec.tsx +0 -29
  280. package/src/Authenticator/common/DefaultFormFields/__tests__/__snapshots__/DefaultFormFields.spec.tsx.snap +0 -3
  281. package/src/Authenticator/common/DefaultFormFields/__tests__/__snapshots__/FieldErrors.spec.tsx.snap +0 -32
  282. package/src/Authenticator/common/DefaultHeader/__tests__/DefaultHeader.spec.tsx +0 -23
  283. package/src/Authenticator/common/DefaultHeader/__tests__/__snapshots__/DefaultHeader.spec.tsx.snap +0 -24
  284. package/src/Authenticator/common/FederatedProviderButton/__tests__/FederatedProviderButton.spec.tsx +0 -67
  285. package/src/Authenticator/common/FederatedProviderButton/__tests__/__snapshots__/FederatedProviderButton.spec.tsx.snap +0 -185
  286. package/src/Authenticator/common/FederatedProviderButtons/__tests__/FederatedProviderButtons.spec.tsx +0 -55
  287. package/src/Authenticator/common/FederatedProviderButtons/__tests__/__snapshots__/FederatedProviderButtons.spec.tsx.snap +0 -167
  288. package/src/Authenticator/hooks/useFieldValues/__tests__/useFieldValues.spec.ts +0 -399
  289. package/src/Authenticator/hooks/useFieldValues/__tests__/utils.spec.ts +0 -282
  290. package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +0 -151
  291. package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +0 -618
  292. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +0 -92
  293. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +0 -50
  294. package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +0 -124
  295. package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessageItem.spec.tsx.snap +0 -248
  296. package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +0 -53
  297. package/src/InAppMessaging/components/FullScreenMessage/__tests__/__snapshots__/FullScreenMessage.spec.tsx.snap +0 -238
  298. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +0 -34
  299. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/__snapshots__/InAppMessageDisplay.spec.tsx.snap +0 -9
  300. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/handleMessageLinkAction.spec.ts +0 -51
  301. package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +0 -19
  302. package/src/InAppMessaging/components/MessageWrapper/__tests__/__snapshots__/MessageWrapper.spec.tsx.snap +0 -35
  303. package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +0 -169
  304. package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +0 -727
  305. package/src/InAppMessaging/components/withInAppMessaging/__tests__/__snapshots__/withInAppMessaging.spec.tsx.snap +0 -3
  306. package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +0 -15
  307. package/src/InAppMessaging/hooks/useMessageImage/__tests__/useMessageImage.spec.ts +0 -141
  308. package/src/InAppMessaging/hooks/useMessageImage/__tests__/utils.spec.ts +0 -107
  309. package/src/InAppMessaging/hooks/useMessageProps/__tests__/__snapshots__/utils.spec.ts.snap +0 -223
  310. package/src/InAppMessaging/hooks/useMessageProps/__tests__/useMessageProps.spec.ts +0 -162
  311. package/src/InAppMessaging/hooks/useMessageProps/__tests__/utils.spec.ts +0 -355
  312. package/src/__mocks__/@react-native-async-storage/async-storage.ts +0 -2
  313. package/src/__mocks__/@react-native-community/netinfo.ts +0 -3
  314. package/src/__mocks__/react-native-safe-area-context.ts +0 -9
  315. package/src/__tests__/__snapshots__/index.spec.ts.snap +0 -26
  316. package/src/__tests__/index.spec.ts +0 -8
  317. package/src/hooks/useDeprecationWarning/__tests__/useDeprecationWarning.spec.ts +0 -42
  318. package/src/hooks/useDeviceOrientation/__tests__/useDeviceOrientation.spec.ts +0 -89
  319. package/src/hooks/usePressableContainerStyles/__tests__/usePressableContainerStyles.spec.ts +0 -68
  320. package/src/primitives/Button/__tests__/Button.spec.tsx +0 -92
  321. package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +0 -143
  322. package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +0 -174
  323. package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +0 -73
  324. package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +0 -310
  325. package/src/primitives/Carousel/__tests__/__snapshots__/CarouselPageIndicator.spec.tsx.snap +0 -191
  326. package/src/primitives/Checkbox/__tests__/Checkbox.spec.tsx +0 -150
  327. package/src/primitives/Checkbox/__tests__/__snapshots__/Checkbox.spec.tsx.snap +0 -527
  328. package/src/primitives/Divider/__tests__/Divider.spec.tsx +0 -50
  329. package/src/primitives/Divider/__tests__/__snapshots__/Divider.spec.tsx.snap +0 -165
  330. package/src/primitives/ErrorMessage/__tests__/ErrorMessage.spec.tsx +0 -60
  331. package/src/primitives/ErrorMessage/__tests__/__snapshots__/ErrorMessage.spec.tsx.snap +0 -123
  332. package/src/primitives/Heading/__tests__/Heading.spec.tsx +0 -73
  333. package/src/primitives/Heading/__tests__/__snapshots__/Heading.spec.tsx.snap +0 -171
  334. package/src/primitives/Icon/__tests__/Icon.spec.tsx +0 -100
  335. package/src/primitives/Icon/__tests__/__snapshots__/Icon.spec.tsx.snap +0 -139
  336. package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +0 -71
  337. package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +0 -192
  338. package/src/primitives/Label/__tests__/Label.spec.tsx +0 -75
  339. package/src/primitives/Label/__tests__/__snapshots__/Label.spec.tsx.snap +0 -91
  340. package/src/primitives/PasswordField/__tests__/PasswordField.spec.tsx +0 -110
  341. package/src/primitives/PasswordField/__tests__/__snapshots__/PasswordField.spec.tsx.snap +0 -620
  342. package/src/primitives/PhoneNumberField/__tests__/PhoneNumberField.spec.tsx +0 -53
  343. package/src/primitives/PhoneNumberField/__tests__/__snapshots__/PhoneNumberField.spec.tsx.snap +0 -182
  344. package/src/primitives/Radio/__tests__/Radio.spec.tsx +0 -166
  345. package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +0 -678
  346. package/src/primitives/RadioGroup/__tests__/RadioGroup.spec.tsx +0 -183
  347. package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +0 -1789
  348. package/src/primitives/Tabs/__tests__/Tab.spec.tsx +0 -75
  349. package/src/primitives/Tabs/__tests__/Tabs.spec.tsx +0 -81
  350. package/src/primitives/Tabs/__tests__/__snapshots__/Tab.spec.tsx.snap +0 -278
  351. package/src/primitives/Tabs/__tests__/__snapshots__/Tabs.spec.tsx.snap +0 -163
  352. package/src/primitives/TextField/__tests__/TextField.spec.tsx +0 -202
  353. package/src/primitives/TextField/__tests__/__snapshots__/TextField.spec.tsx.snap +0 -501
  354. package/src/theme/__tests__/ThemeProvider.spec.tsx +0 -23
  355. package/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap +0 -226
  356. package/src/theme/__tests__/createTheme.spec.ts +0 -244
  357. package/src/theme/__tests__/useTheme.spec.tsx +0 -51
  358. package/tsconfig.dist.json +0 -4
  359. package/tsconfig.json +0 -9
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLayoutImageDimensions = exports.prefetchNetworkImage = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const core_1 = require("@aws-amplify/core");
6
+ const constants_1 = require("./constants");
7
+ const logger = new core_1.ConsoleLogger('Notifications.InAppMessaging');
8
+ const inAppMessageImageSizes = {
9
+ BOTTOM_BANNER: constants_1.BANNER_IMAGE_SCREEN_SIZE,
10
+ MIDDLE_BANNER: constants_1.BANNER_IMAGE_SCREEN_SIZE,
11
+ TOP_BANNER: constants_1.BANNER_IMAGE_SCREEN_SIZE,
12
+ CAROUSEL: constants_1.CAROUSEL_IMAGE_SCREEN_SIZE,
13
+ FULL_SCREEN: constants_1.FULL_SCREEN_IMAGE_SCREEN_SIZE,
14
+ MODAL: constants_1.MODAL_IMAGE_SCREEN_SIZE,
15
+ };
16
+ const prefetchNetworkImage = async (url) => {
17
+ try {
18
+ const loaded = await react_native_1.Image.prefetch(url);
19
+ if (loaded) {
20
+ return 'loaded';
21
+ }
22
+ logger.error(`Image failed to load: ${url}`);
23
+ return 'failed';
24
+ }
25
+ catch (e) {
26
+ logger.error(`Image.prefetch failed: ${e}`);
27
+ return 'failed';
28
+ }
29
+ };
30
+ exports.prefetchNetworkImage = prefetchNetworkImage;
31
+ const getLayoutImageDimensions = (imageHeight, imageWidth, layout) => {
32
+ // determine aspect ratio for scaling rendered image
33
+ const aspectRatio = imageWidth / imageHeight;
34
+ const isSquare = aspectRatio === 1;
35
+ const isPortrait = imageHeight > imageWidth;
36
+ const isLandscape = imageWidth > imageHeight;
37
+ // an image that has smaller dimensions than the max image dimension (e.g. 10px x 10px)
38
+ // will be scaled up in size to match the size the message component expects.
39
+ // While this could lead to pixelated images, it was ultimately a product decision,
40
+ // ideally the message creator would follow the image guidelines in the pinpoint console
41
+ const maxImageDimension = inAppMessageImageSizes[layout];
42
+ let height = undefined;
43
+ let width = undefined;
44
+ // set square image dimensions
45
+ if (isSquare) {
46
+ height = maxImageDimension;
47
+ width = maxImageDimension;
48
+ }
49
+ // set portrait image dimensions
50
+ if (isPortrait) {
51
+ height = maxImageDimension;
52
+ width = maxImageDimension * aspectRatio;
53
+ }
54
+ // set landscape image dimensions
55
+ if (isLandscape) {
56
+ height = maxImageDimension / aspectRatio;
57
+ width = maxImageDimension;
58
+ }
59
+ return { height, width };
60
+ };
61
+ exports.getLayoutImageDimensions = getLayoutImageDimensions;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useMessageProps = void 0;
7
+ var useMessageProps_1 = require("./useMessageProps");
8
+ Object.defineProperty(exports, "useMessageProps", { enumerable: true, get: function () { return __importDefault(useMessageProps_1).default; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const ui_1 = require("@aws-amplify/ui");
5
+ const useMessageImage_1 = require("../useMessageImage");
6
+ const utils_1 = require("./utils");
7
+ /**
8
+ * Handle common message UI component prop logic including setting of image dimensions,
9
+ * render booleans, and style resolving
10
+ *
11
+ * @param {MessageComponentBaseProps} props - message UI component props
12
+ * @param {GetDefaultStyle} getDefaultStyle - returns default UI component style
13
+ *
14
+ * @returns {UseMessageProps} message UI component render related booleans and styles
15
+ */
16
+ function useMessageProps(props, getDefaultStyle) {
17
+ const { image, layout, onDisplay, primaryButton, secondaryButton } = props;
18
+ const hasDisplayed = (0, react_1.useRef)(false);
19
+ const { hasRenderableImage, imageDimensions, isImageFetching } = (0, useMessageImage_1.useMessageImage)(image, layout);
20
+ const shouldRenderMessage = !isImageFetching;
21
+ (0, react_1.useEffect)(() => {
22
+ if (!hasDisplayed.current && shouldRenderMessage) {
23
+ onDisplay?.();
24
+ hasDisplayed.current = true;
25
+ }
26
+ }, [onDisplay, shouldRenderMessage]);
27
+ const hasPrimaryButton = !(0, ui_1.isEmpty)(primaryButton);
28
+ const hasSecondaryButton = !(0, ui_1.isEmpty)(secondaryButton);
29
+ const hasButtons = hasPrimaryButton || hasSecondaryButton;
30
+ const styles = (0, react_1.useMemo)(() => {
31
+ // prevent generating style if message rendering is delayed
32
+ if (!shouldRenderMessage) {
33
+ return null;
34
+ }
35
+ const defaultStyle = getDefaultStyle(imageDimensions);
36
+ const payloadStyle = (0, utils_1.getPayloadStyle)(props);
37
+ const overrideStyle = props.style;
38
+ return (0, utils_1.getMessageStyles)({
39
+ styleParams: { defaultStyle, payloadStyle, overrideStyle },
40
+ layout,
41
+ });
42
+ }, [getDefaultStyle, layout, imageDimensions, props, shouldRenderMessage]);
43
+ return {
44
+ hasButtons,
45
+ hasPrimaryButton,
46
+ hasRenderableImage,
47
+ hasSecondaryButton,
48
+ shouldRenderMessage,
49
+ styles,
50
+ };
51
+ }
52
+ exports.default = useMessageProps;
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMessageStyles = exports.getPayloadStyle = exports.getContainerAndWrapperStyle = exports.shouldFillDeviceScreen = exports.getComponentButtonStyle = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const ui_1 = require("@aws-amplify/ui");
6
+ const primitives_1 = require("../../../primitives");
7
+ const constants_1 = require("../../constants");
8
+ // Carousel page indicator size + margins
9
+ const DEFAULT_CAROUSEL_INDICATOR_PADDING = (primitives_1.DEFAULT_CAROUSEL_INDICATOR_SIZE * 5) / 3;
10
+ /**
11
+ * Parse and assign appropriate button container and text style from style objects params
12
+ *
13
+ * @param {MessageButtonStyleParams} params - message styleParams and button type
14
+ * @returns {MessageButtonStyleProps} resolved button container and text style arrays
15
+ */
16
+ const getComponentButtonStyle = ({ styleParams, buttonType, }) => {
17
+ const { defaultStyle, payloadStyle, overrideStyle } = styleParams;
18
+ // default component styles defined at the UI component level
19
+ const { buttonContainer: containerDefaultStyle = {}, buttonText: textDefaultStyle = {}, } = defaultStyle ?? {};
20
+ // message specific styles in the in-app message payload, overrides default component styles
21
+ const { backgroundColor, borderRadius, color } = payloadStyle?.[buttonType] ?? {};
22
+ const containePayloadStyle = {
23
+ ...(backgroundColor ? { backgroundColor } : null),
24
+ ...(borderRadius ? { borderRadius } : null),
25
+ };
26
+ const textMessageStyle = { ...(color ? { color } : null) };
27
+ // custom component override styles passed as style prop, overrides all previous styles
28
+ const { container: containerOverrideStyle = {}, text: textOverrideStyle = {}, } = overrideStyle?.[buttonType] ?? {};
29
+ return {
30
+ // the style prop of the React Native Pressable component used in the message UI accepts either a ViewStyle array
31
+ // or a function receiving a boolean reflecting whether the component is currently pressed, returning a ViewStyle
32
+ // array. Utilizing the latter, we add an opacity value to the UI message button style during press events
33
+ container: ({ pressed } = { pressed: false }) => {
34
+ // default button press interaction opacity
35
+ const pressedOpacity = pressed ? { opacity: constants_1.BUTTON_PRESSED_OPACITY } : {};
36
+ // pass `pressed` to containerOverrideStyle and evaluate if the consumer passed a function for custom
37
+ // button style
38
+ const containerOverrideFinalStyle = (0, ui_1.isFunction)(containerOverrideStyle)
39
+ ? containerOverrideStyle({ pressed })
40
+ : containerOverrideStyle;
41
+ return [
42
+ pressedOpacity,
43
+ containerDefaultStyle,
44
+ containePayloadStyle,
45
+ containerOverrideFinalStyle,
46
+ ];
47
+ },
48
+ text: [textDefaultStyle, textMessageStyle, textOverrideStyle],
49
+ };
50
+ };
51
+ exports.getComponentButtonStyle = getComponentButtonStyle;
52
+ /**
53
+ * Utility for determining if the provided layout requires filling the entire device screen.
54
+ *
55
+ * @param {InAppMessageLayout} layout - message layout
56
+ * @returns {Boolean} boolean indicating whether entire screen should be filled
57
+ */
58
+ const shouldFillDeviceScreen = (layout) => {
59
+ switch (layout) {
60
+ case 'CAROUSEL':
61
+ case 'FULL_SCREEN': {
62
+ return true;
63
+ }
64
+ case 'MODAL':
65
+ case 'TOP_BANNER':
66
+ case 'MIDDLE_BANNER':
67
+ case 'BOTTOM_BANNER':
68
+ default: {
69
+ return false;
70
+ }
71
+ }
72
+ };
73
+ exports.shouldFillDeviceScreen = shouldFillDeviceScreen;
74
+ /**
75
+ * Parse and assign appropriate message container and wrapper style from style params
76
+ *
77
+ * @param {MessageStyleParams} params - message styleParams, layout, and device orientation
78
+ * @returns {ContainerAndWrapperStyle} resolved containerStyle and wrapperStyle
79
+ */
80
+ const getContainerAndWrapperStyle = ({ styleParams, layout, }) => {
81
+ const { defaultStyle, payloadStyle, overrideStyle } = styleParams;
82
+ const containerDefaultStyle = defaultStyle?.container ?? {};
83
+ const containerPayloadStyle = payloadStyle?.container ?? {};
84
+ const containerOverrideStyle = overrideStyle?.container ?? {};
85
+ const wrapperDefaultStyle = defaultStyle?.wrapper ?? {};
86
+ if (!(0, exports.shouldFillDeviceScreen)(layout)) {
87
+ return {
88
+ wrapper: wrapperDefaultStyle,
89
+ container: [
90
+ containerDefaultStyle,
91
+ containerPayloadStyle,
92
+ containerOverrideStyle,
93
+ ],
94
+ };
95
+ }
96
+ // in non-banner and landscape modal layouts container backgroundColor values should be applied as
97
+ // wrapper style to ensure that the backgroundColor is applied to the entire screen
98
+ const { backgroundColor: defaultBackgroundColor, ...restContainerDefaultStyle } = containerDefaultStyle;
99
+ const { backgroundColor: messageBackgroundColor, ...restContainerPayloadStyle } = containerPayloadStyle;
100
+ // flatten overrideStyle to access override backgroundColor
101
+ const { backgroundColor: overrideBackgroundColor, ...restContainerOverrideStyle } = react_native_1.StyleSheet.flatten(containerOverrideStyle);
102
+ // all non-backgroundColor container override style are applied to the container View
103
+ const container = [
104
+ restContainerDefaultStyle,
105
+ restContainerPayloadStyle,
106
+ restContainerOverrideStyle,
107
+ ];
108
+ // use ternaries to prevent passing backgroundColor object with undefined or null value
109
+ const wrapper = [
110
+ wrapperDefaultStyle,
111
+ defaultBackgroundColor ? { backgroundColor: defaultBackgroundColor } : {},
112
+ messageBackgroundColor ? { backgroundColor: messageBackgroundColor } : {},
113
+ overrideBackgroundColor ? { backgroundColor: overrideBackgroundColor } : {},
114
+ ];
115
+ return { wrapper, container };
116
+ };
117
+ exports.getContainerAndWrapperStyle = getContainerAndWrapperStyle;
118
+ /**
119
+ * Utility for extracting message payload style
120
+ *
121
+ * @param {MessageComponentBaseProps} props - message props
122
+ * @returns {Object} message payload specific style
123
+ */
124
+ const getPayloadStyle = ({ body, container, header, primaryButton, secondaryButton, }) => ({
125
+ body: body?.style ?? {},
126
+ container: container?.style ?? {},
127
+ header: header?.style ?? {},
128
+ primaryButton: primaryButton?.style ?? {},
129
+ secondaryButton: secondaryButton?.style ?? {},
130
+ });
131
+ exports.getPayloadStyle = getPayloadStyle;
132
+ /**
133
+ * Receives message styling and returns style property values for use with in-app message
134
+ * UI components. Handles resolvement style precedence between default, payload, and custom style
135
+ *
136
+ * Style param resolve precedence from lowest to highest:
137
+ * 1. defaultStyle
138
+ * 2. messageStyle
139
+ * 3. overrideStyle
140
+ *
141
+ * @param {MessageStyleParams} params - message style params, layout, and device orientation
142
+ * @returns {MessageStyles} message style props
143
+ */
144
+ function getMessageStyles({ styleParams, layout, }) {
145
+ // view style applied to the wrapper and primary container views
146
+ const { wrapper, container } = (0, exports.getContainerAndWrapperStyle)({
147
+ styleParams,
148
+ layout,
149
+ });
150
+ // primary and secondary button container and text style
151
+ const primaryButton = (0, exports.getComponentButtonStyle)({
152
+ styleParams,
153
+ buttonType: 'primaryButton',
154
+ });
155
+ const secondaryButton = (0, exports.getComponentButtonStyle)({
156
+ styleParams,
157
+ buttonType: 'secondaryButton',
158
+ });
159
+ const { defaultStyle, payloadStyle, overrideStyle } = styleParams;
160
+ // image style composed of default and override style
161
+ const image = [defaultStyle?.image, overrideStyle?.image];
162
+ const iconButton = {
163
+ // view style applied to icon button
164
+ container: [defaultStyle?.iconButton, overrideStyle?.closeIconButton],
165
+ // close icon color, only specified as an overrideStyle
166
+ iconColor: overrideStyle?.closeIconColor,
167
+ };
168
+ // text style applied to message body and header respectively
169
+ const body = [defaultStyle?.body, payloadStyle?.body, overrideStyle?.body];
170
+ const header = [
171
+ defaultStyle?.header,
172
+ payloadStyle?.header,
173
+ overrideStyle?.header,
174
+ ];
175
+ const { buttonsContainer, contentContainer, imageContainer, textContainer } = defaultStyle ?? {};
176
+ const styleProps = {
177
+ body,
178
+ buttonsContainer,
179
+ wrapper,
180
+ contentContainer,
181
+ container,
182
+ header,
183
+ iconButton,
184
+ image,
185
+ imageContainer,
186
+ primaryButton,
187
+ secondaryButton,
188
+ textContainer,
189
+ };
190
+ if (layout === 'CAROUSEL') {
191
+ styleProps.container = [
192
+ styleProps.container,
193
+ // Add bottom padding for carousel page indicators
194
+ {
195
+ paddingBottom: constants_1.SPACING_EXTRA_LARGE + DEFAULT_CAROUSEL_INDICATOR_PADDING,
196
+ },
197
+ ];
198
+ }
199
+ return styleProps;
200
+ }
201
+ exports.getMessageStyles = getMessageStyles;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withInAppMessaging = exports.InAppMessageDisplay = exports.useInAppMessaging = exports.InAppMessagingProvider = void 0;
4
+ var ui_react_core_notifications_1 = require("@aws-amplify/ui-react-core-notifications");
5
+ Object.defineProperty(exports, "InAppMessagingProvider", { enumerable: true, get: function () { return ui_react_core_notifications_1.InAppMessagingProvider; } });
6
+ Object.defineProperty(exports, "useInAppMessaging", { enumerable: true, get: function () { return ui_react_core_notifications_1.useInAppMessaging; } });
7
+ var components_1 = require("./components");
8
+ Object.defineProperty(exports, "InAppMessageDisplay", { enumerable: true, get: function () { return components_1.InAppMessageDisplay; } });
9
+ Object.defineProperty(exports, "withInAppMessaging", { enumerable: true, get: function () { return components_1.withInAppMessaging; } });
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const icons = {
4
+ amazonLogo: require('./amazonLogo.png'),
5
+ appleLogo: require('./appleLogo.png'),
6
+ checkboxFilled: require('./checkboxFilled.png'),
7
+ checkboxOutline: require('./checkboxOutline.png'),
8
+ close: require('./close.png'),
9
+ copy: require('./copy.png'),
10
+ error: require('./error.png'),
11
+ facebookLogo: require('./facebookLogo.png'),
12
+ googleLogo: require('./googleLogo.png'),
13
+ visibilityOn: require('./visibilityOn.png'),
14
+ visibilityOff: require('./visibilityOff.png'),
15
+ };
16
+ exports.default = icons;
@@ -0,0 +1,17 @@
1
+ import { ImageSourcePropType } from 'react-native';
2
+
3
+ const icons = {
4
+ amazonLogo: require('./amazonLogo.png') as ImageSourcePropType,
5
+ appleLogo: require('./appleLogo.png') as ImageSourcePropType,
6
+ checkboxFilled: require('./checkboxFilled.png') as ImageSourcePropType,
7
+ checkboxOutline: require('./checkboxOutline.png') as ImageSourcePropType,
8
+ close: require('./close.png') as ImageSourcePropType,
9
+ copy: require('./copy.png') as ImageSourcePropType,
10
+ error: require('./error.png') as ImageSourcePropType,
11
+ facebookLogo: require('./facebookLogo.png') as ImageSourcePropType,
12
+ googleLogo: require('./googleLogo.png') as ImageSourcePropType,
13
+ visibilityOn: require('./visibilityOn.png') as ImageSourcePropType,
14
+ visibilityOff: require('./visibilityOff.png') as ImageSourcePropType,
15
+ };
16
+
17
+ export default icons;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.icons = void 0;
7
+ var icons_1 = require("./icons");
8
+ Object.defineProperty(exports, "icons", { enumerable: true, get: function () { return __importDefault(icons_1).default; } });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePressableContainerStyles = exports.useDeviceOrientation = exports.useDeprecationWarning = void 0;
4
+ var useDeprecationWarning_1 = require("./useDeprecationWarning");
5
+ Object.defineProperty(exports, "useDeprecationWarning", { enumerable: true, get: function () { return useDeprecationWarning_1.useDeprecationWarning; } });
6
+ var useDeviceOrientation_1 = require("./useDeviceOrientation");
7
+ Object.defineProperty(exports, "useDeviceOrientation", { enumerable: true, get: function () { return useDeviceOrientation_1.useDeviceOrientation; } });
8
+ var usePressableContainerStyles_1 = require("./usePressableContainerStyles");
9
+ Object.defineProperty(exports, "usePressableContainerStyles", { enumerable: true, get: function () { return usePressableContainerStyles_1.usePressableContainerStyles; } });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeprecationWarning = void 0;
7
+ var useDeprecationWarning_1 = require("./useDeprecationWarning");
8
+ Object.defineProperty(exports, "useDeprecationWarning", { enumerable: true, get: function () { return __importDefault(useDeprecationWarning_1).default; } });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ui_react_core_1 = require("@aws-amplify/ui-react-core");
4
+ const utils_1 = require("../../utils");
5
+ /**
6
+ * Logs a deprecation warning `message` to the console.
7
+ */
8
+ const useDeprecationWarning = ({ message, shouldWarn: _shouldWarn, }) => {
9
+ // only log warnings in dev
10
+ const shouldWarn = _shouldWarn && utils_1.platform.IS_DEV;
11
+ (0, ui_react_core_1.useDeprecationWarning)({ message, shouldWarn });
12
+ };
13
+ exports.default = useDeprecationWarning;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeviceOrientation = void 0;
7
+ var useDeviceOrientation_1 = require("./useDeviceOrientation");
8
+ Object.defineProperty(exports, "useDeviceOrientation", { enumerable: true, get: function () { return __importDefault(useDeviceOrientation_1).default; } });
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const ui_1 = require("@aws-amplify/ui");
6
+ const getDeviceOrientation = () => {
7
+ const { height, width } = react_native_1.Dimensions.get('screen');
8
+ return height >= width ? 'portrait' : 'landscape';
9
+ };
10
+ function useDeviceOrientation() {
11
+ const [deviceOrientation, setDeviceOrientation] = (0, react_1.useState)(getDeviceOrientation);
12
+ const isLandscapeMode = deviceOrientation === 'landscape';
13
+ const isPortraitMode = deviceOrientation === 'portrait';
14
+ (0, react_1.useEffect)(() => {
15
+ const handler = () => {
16
+ setDeviceOrientation(getDeviceOrientation);
17
+ };
18
+ // The below cast and conditional unsubscribe handling is due to subscription removal variation
19
+ // between `Dimensions.addEventListener` in React Native prior to and after v0.65.
20
+ //
21
+ // Beginning with v0.65, `Dimensions.addEventListener` returns an `EventSubscription` object,
22
+ // which includes a `remove` method for removing the subscription. Prior versions return
23
+ // `undefined`, and subscription removal is handled by `Dimensions.removeEventListener`,
24
+ // which is deprecated in v0.65
25
+ const subscription = react_native_1.Dimensions.addEventListener('change', handler);
26
+ return () => {
27
+ if ((0, ui_1.isFunction)(subscription?.remove)) {
28
+ subscription.remove();
29
+ }
30
+ else {
31
+ react_native_1.Dimensions.removeEventListener('change', handler);
32
+ }
33
+ };
34
+ }, []);
35
+ return { deviceOrientation, isLandscapeMode, isPortraitMode };
36
+ }
37
+ exports.default = useDeviceOrientation;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePressableContainerStyles = void 0;
4
+ var usePressableContainerStyles_1 = require("./usePressableContainerStyles");
5
+ Object.defineProperty(exports, "usePressableContainerStyles", { enumerable: true, get: function () { return usePressableContainerStyles_1.usePressableContainerStyles; } });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePressableContainerStyles = void 0;
4
+ const react_1 = require("react");
5
+ const ui_1 = require("@aws-amplify/ui");
6
+ const usePressableContainerStyles = ({ overrideStyle, containerStyle, pressedStyle, }) => {
7
+ return (0, react_1.useCallback)(({ pressed }) => {
8
+ const pressedOverrideStyle = (0, ui_1.isFunction)(overrideStyle)
9
+ ? overrideStyle({ pressed })
10
+ : overrideStyle;
11
+ return [
12
+ containerStyle,
13
+ pressed ? pressedStyle : undefined,
14
+ // include last to override other styles
15
+ pressedOverrideStyle,
16
+ ];
17
+ }, [containerStyle, overrideStyle, pressedStyle]);
18
+ };
19
+ exports.usePressableContainerStyles = usePressableContainerStyles;
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTheme = exports.defaultTheme = exports.defaultDarkModeOverride = exports.ThemeProvider = exports.withAuthenticator = exports.useAuthenticator = exports.Authenticator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ var Authenticator_1 = require("./Authenticator");
6
+ Object.defineProperty(exports, "Authenticator", { enumerable: true, get: function () { return Authenticator_1.Authenticator; } });
7
+ Object.defineProperty(exports, "useAuthenticator", { enumerable: true, get: function () { return Authenticator_1.useAuthenticator; } });
8
+ Object.defineProperty(exports, "withAuthenticator", { enumerable: true, get: function () { return Authenticator_1.withAuthenticator; } });
9
+ tslib_1.__exportStar(require("./InAppMessaging"), exports);
10
+ var theme_1 = require("./theme");
11
+ Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_1.ThemeProvider; } });
12
+ Object.defineProperty(exports, "defaultDarkModeOverride", { enumerable: true, get: function () { return theme_1.defaultDarkModeOverride; } });
13
+ Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return theme_1.defaultTheme; } });
14
+ Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return theme_1.useTheme; } });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const react_native_1 = require("react-native");
6
+ const ui_1 = require("@aws-amplify/ui");
7
+ const hooks_1 = require("../../hooks");
8
+ const theme_1 = require("../../theme");
9
+ const styles_1 = require("./styles");
10
+ function Button({ accessibilityRole = 'button', children, disabled, style, textStyle, variant = 'default', ...rest }) {
11
+ const theme = (0, theme_1.useTheme)();
12
+ const themedStyle = (0, styles_1.getThemedStyles)(theme);
13
+ const containerStyle = (0, react_1.useMemo)(() => ({
14
+ ...themedStyle.container,
15
+ ...themedStyle[`container${(0, ui_1.capitalize)(variant)}`],
16
+ ...(disabled && themedStyle.disabled),
17
+ }), [disabled, themedStyle, variant]);
18
+ const pressableStyle = (0, hooks_1.usePressableContainerStyles)({
19
+ overrideStyle: style,
20
+ containerStyle,
21
+ pressedStyle: themedStyle.pressed,
22
+ });
23
+ const buttonTextStyle = (0, react_1.useMemo)(() => ({
24
+ ...themedStyle.text,
25
+ ...themedStyle[`text${(0, ui_1.capitalize)(variant)}`],
26
+ }), [themedStyle, variant]);
27
+ return (<react_native_1.Pressable {...rest} accessibilityRole={accessibilityRole} disabled={disabled} style={pressableStyle}>
28
+ {typeof children === 'string' ? (<react_native_1.Text style={[buttonTextStyle, textStyle]}>{children}</react_native_1.Text>) : (children)}
29
+ </react_native_1.Pressable>);
30
+ }
31
+ exports.default = Button;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Button = void 0;
7
+ var Button_1 = require("./Button");
8
+ Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return __importDefault(Button_1).default; } });