@hero-design/rn 8.22.0-alpha.0 → 8.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/.turbo/turbo-publish:npm.log +0 -9
  3. package/es/index.js +283 -91
  4. package/lib/index.js +283 -90
  5. package/package.json +5 -5
  6. package/src/components/Alert/index.tsx +6 -0
  7. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  8. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +5 -5
  9. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +180 -138
  10. package/src/components/FAB/FAB.tsx +17 -12
  11. package/src/components/FAB/StyledFAB.tsx +13 -4
  12. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +13 -21
  13. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +214 -151
  14. package/src/components/List/ListItem.tsx +12 -8
  15. package/src/components/Success/StyledSuccess.tsx +87 -0
  16. package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +497 -0
  17. package/src/components/Success/__tests__/index.spec.tsx +78 -0
  18. package/src/components/Success/index.tsx +129 -0
  19. package/src/components/Tag/StyledTag.tsx +1 -1
  20. package/src/components/Tag/__tests__/Tag.spec.tsx +22 -71
  21. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +106 -53
  22. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +265 -0
  23. package/src/components/TextInput/__tests__/index.spec.tsx +29 -0
  24. package/src/components/TextInput/index.tsx +6 -1
  25. package/src/index.ts +2 -0
  26. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +43 -3
  27. package/src/theme/components/empty.ts +1 -1
  28. package/src/theme/components/error.ts +1 -1
  29. package/src/theme/components/fab.ts +18 -1
  30. package/src/theme/components/success.ts +40 -0
  31. package/src/theme/components/tag.ts +1 -1
  32. package/src/theme/getTheme.ts +3 -0
  33. package/src/theme/global/colors/__tests__/__snapshots__/globalDark.spec.ts.snap +19 -19
  34. package/src/theme/global/colors/__tests__/__snapshots__/swagDark.spec.ts.snap +19 -19
  35. package/src/theme/global/colors/globalDark.ts +24 -24
  36. package/src/utils/hooks.ts +1 -1
  37. package/types/components/Accordion/AccordionItem.d.ts +0 -0
  38. package/types/components/Accordion/StyledAccordion.d.ts +0 -0
  39. package/types/components/Accordion/index.d.ts +0 -0
  40. package/types/components/Alert/StyledAlert.d.ts +0 -0
  41. package/types/components/Alert/index.d.ts +0 -0
  42. package/types/components/Attachment/StyledAttachment.d.ts +0 -0
  43. package/types/components/Attachment/index.d.ts +0 -0
  44. package/types/components/Avatar/Avatar.d.ts +0 -0
  45. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -0
  46. package/types/components/Avatar/AvatarStack/index.d.ts +0 -0
  47. package/types/components/Avatar/AvatarStack/utils.d.ts +0 -0
  48. package/types/components/Avatar/StyledAvatar.d.ts +0 -0
  49. package/types/components/Avatar/index.d.ts +0 -0
  50. package/types/components/Badge/Status.d.ts +0 -0
  51. package/types/components/Badge/StyledBadge.d.ts +0 -0
  52. package/types/components/Badge/index.d.ts +0 -0
  53. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
  54. package/types/components/BottomNavigation/index.d.ts +0 -0
  55. package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -0
  56. package/types/components/BottomSheet/Footer.d.ts +0 -0
  57. package/types/components/BottomSheet/Header.d.ts +0 -0
  58. package/types/components/BottomSheet/ScrollView.d.ts +0 -0
  59. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
  60. package/types/components/BottomSheet/index.d.ts +0 -0
  61. package/types/components/Box/StyledBox.d.ts +0 -0
  62. package/types/components/Box/config.d.ts +0 -0
  63. package/types/components/Box/index.d.ts +0 -0
  64. package/types/components/Box/types.d.ts +0 -0
  65. package/types/components/Button/Button.d.ts +0 -0
  66. package/types/components/Button/IconButton.d.ts +0 -0
  67. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
  68. package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
  69. package/types/components/Button/StyledButton.d.ts +0 -0
  70. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -0
  71. package/types/components/Button/UtilityButton/index.d.ts +0 -0
  72. package/types/components/Button/index.d.ts +0 -0
  73. package/types/components/Calendar/CalendarRowItem.d.ts +0 -0
  74. package/types/components/Calendar/StyledCalendar.d.ts +0 -0
  75. package/types/components/Calendar/helpers.d.ts +0 -0
  76. package/types/components/Calendar/index.d.ts +0 -0
  77. package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
  78. package/types/components/Card/DataCard/index.d.ts +0 -0
  79. package/types/components/Card/StyledCard.d.ts +0 -0
  80. package/types/components/Card/index.d.ts +0 -0
  81. package/types/components/Carousel/CardCarousel.d.ts +0 -0
  82. package/types/components/Carousel/CarouselItem.d.ts +0 -0
  83. package/types/components/Carousel/StyledCardCarousel.d.ts +0 -0
  84. package/types/components/Carousel/StyledCarousel.d.ts +0 -0
  85. package/types/components/Carousel/contants.d.ts +0 -0
  86. package/types/components/Carousel/index.d.ts +0 -0
  87. package/types/components/Carousel/types.d.ts +0 -0
  88. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
  89. package/types/components/Checkbox/index.d.ts +0 -0
  90. package/types/components/Collapse/StyledCollapse.d.ts +0 -0
  91. package/types/components/Collapse/index.d.ts +0 -0
  92. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
  93. package/types/components/ContentNavigator/index.d.ts +0 -0
  94. package/types/components/DatePicker/DatePickerAndroid.d.ts +0 -0
  95. package/types/components/DatePicker/DatePickerCalendar.d.ts +0 -0
  96. package/types/components/DatePicker/DatePickerIOS.d.ts +0 -0
  97. package/types/components/DatePicker/StyledDatePicker.d.ts +0 -0
  98. package/types/components/DatePicker/index.d.ts +0 -0
  99. package/types/components/DatePicker/types.d.ts +0 -0
  100. package/types/components/Divider/StyledDivider.d.ts +0 -0
  101. package/types/components/Divider/index.d.ts +0 -0
  102. package/types/components/Drawer/DragableDrawer/helpers.d.ts +0 -0
  103. package/types/components/Drawer/DragableDrawer/index.d.ts +0 -0
  104. package/types/components/Drawer/StyledDrawer.d.ts +0 -0
  105. package/types/components/Drawer/index.d.ts +0 -0
  106. package/types/components/Empty/StyledEmpty.d.ts +0 -0
  107. package/types/components/Empty/index.d.ts +0 -0
  108. package/types/components/Error/StyledError.d.ts +0 -0
  109. package/types/components/Error/index.d.ts +0 -0
  110. package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
  111. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
  112. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
  113. package/types/components/FAB/ActionGroup/index.d.ts +0 -0
  114. package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
  115. package/types/components/FAB/FAB.d.ts +0 -0
  116. package/types/components/FAB/StyledFAB.d.ts +7 -3
  117. package/types/components/FAB/index.d.ts +0 -0
  118. package/types/components/Icon/AnimatedIcon.d.ts +0 -0
  119. package/types/components/Icon/HeroIcon/index.d.ts +0 -0
  120. package/types/components/Icon/IconList.d.ts +0 -0
  121. package/types/components/Icon/index.d.ts +0 -0
  122. package/types/components/Icon/utils.d.ts +0 -0
  123. package/types/components/Image/index.d.ts +0 -0
  124. package/types/components/List/BasicListItem.d.ts +0 -0
  125. package/types/components/List/ListItem.d.ts +0 -0
  126. package/types/components/List/StyledBasicListItem.d.ts +0 -0
  127. package/types/components/List/StyledListItem.d.ts +0 -0
  128. package/types/components/List/index.d.ts +0 -0
  129. package/types/components/PageControl/StyledPageControl.d.ts +0 -0
  130. package/types/components/PageControl/index.d.ts +0 -0
  131. package/types/components/PinInput/PinCell.d.ts +0 -0
  132. package/types/components/PinInput/StyledPinInput.d.ts +0 -0
  133. package/types/components/PinInput/index.d.ts +0 -0
  134. package/types/components/Progress/ProgressBar.d.ts +0 -0
  135. package/types/components/Progress/ProgressCircle.d.ts +0 -0
  136. package/types/components/Progress/StyledProgressBar.d.ts +0 -0
  137. package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
  138. package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
  139. package/types/components/Progress/constants.d.ts +0 -0
  140. package/types/components/Progress/index.d.ts +0 -0
  141. package/types/components/Progress/types.d.ts +0 -0
  142. package/types/components/Radio/Radio.d.ts +0 -0
  143. package/types/components/Radio/RadioGroup.d.ts +0 -0
  144. package/types/components/Radio/StyledRadio.d.ts +0 -0
  145. package/types/components/Radio/index.d.ts +0 -0
  146. package/types/components/Radio/types.d.ts +0 -0
  147. package/types/components/RefreshControl/index.d.ts +0 -0
  148. package/types/components/RichTextEditor/EditorEvent.d.ts +0 -0
  149. package/types/components/RichTextEditor/EditorToolbar.d.ts +0 -0
  150. package/types/components/RichTextEditor/MentionList.d.ts +0 -0
  151. package/types/components/RichTextEditor/RichTextEditor.d.ts +0 -0
  152. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -0
  153. package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -0
  154. package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +0 -0
  155. package/types/components/RichTextEditor/constants.d.ts +0 -0
  156. package/types/components/RichTextEditor/heroEditorApp.d.ts +0 -0
  157. package/types/components/RichTextEditor/index.d.ts +0 -0
  158. package/types/components/RichTextEditor/types.d.ts +0 -0
  159. package/types/components/RichTextEditor/utils/events.d.ts +0 -0
  160. package/types/components/RichTextEditor/utils/rnWebView.d.ts +0 -0
  161. package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
  162. package/types/components/SectionHeading/index.d.ts +0 -0
  163. package/types/components/Select/BaseOptionList.d.ts +0 -0
  164. package/types/components/Select/Footer.d.ts +0 -0
  165. package/types/components/Select/MultiSelect/Option.d.ts +0 -0
  166. package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
  167. package/types/components/Select/MultiSelect/index.d.ts +0 -0
  168. package/types/components/Select/SingleSelect/Option.d.ts +0 -0
  169. package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
  170. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -0
  171. package/types/components/Select/SingleSelect/index.d.ts +0 -0
  172. package/types/components/Select/StyledSelect.d.ts +0 -0
  173. package/types/components/Select/helpers.d.ts +0 -0
  174. package/types/components/Select/index.d.ts +0 -0
  175. package/types/components/Select/types.d.ts +0 -0
  176. package/types/components/Skeleton/StyledSkeleton.d.ts +0 -0
  177. package/types/components/Skeleton/index.d.ts +0 -0
  178. package/types/components/Slider/index.d.ts +0 -0
  179. package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
  180. package/types/components/Spinner/StyledSpinner.d.ts +0 -0
  181. package/types/components/Spinner/index.d.ts +0 -0
  182. package/types/components/Success/StyledSuccess.d.ts +54 -0
  183. package/types/components/Success/index.d.ts +42 -0
  184. package/types/components/Swipeable/StyledSwipeable.d.ts +0 -0
  185. package/types/components/Swipeable/SwipeableAction.d.ts +0 -0
  186. package/types/components/Swipeable/index.d.ts +0 -0
  187. package/types/components/Switch/SelectorSwitch/Option.d.ts +0 -0
  188. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -0
  189. package/types/components/Switch/SelectorSwitch/index.d.ts +0 -0
  190. package/types/components/Switch/StyledSwitch.d.ts +0 -0
  191. package/types/components/Switch/index.d.ts +0 -0
  192. package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
  193. package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
  194. package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
  195. package/types/components/Tabs/StyledTabs.d.ts +0 -0
  196. package/types/components/Tabs/TabWithBadge.d.ts +0 -0
  197. package/types/components/Tabs/index.d.ts +0 -0
  198. package/types/components/Tabs/utils.d.ts +0 -0
  199. package/types/components/Tag/StyledTag.d.ts +0 -0
  200. package/types/components/Tag/index.d.ts +0 -0
  201. package/types/components/TextInput/StyledTextInput.d.ts +0 -0
  202. package/types/components/TextInput/index.d.ts +5 -1
  203. package/types/components/TimePicker/StyledTimePicker.d.ts +0 -0
  204. package/types/components/TimePicker/TimePickerAndroid.d.ts +0 -0
  205. package/types/components/TimePicker/TimePickerIOS.d.ts +0 -0
  206. package/types/components/TimePicker/index.d.ts +0 -0
  207. package/types/components/TimePicker/types.d.ts +0 -0
  208. package/types/components/Toast/StyledToast.d.ts +0 -0
  209. package/types/components/Toast/Toast.d.ts +0 -0
  210. package/types/components/Toast/ToastContainer.d.ts +0 -0
  211. package/types/components/Toast/ToastContext.d.ts +0 -0
  212. package/types/components/Toast/ToastProvider.d.ts +0 -0
  213. package/types/components/Toast/index.d.ts +0 -0
  214. package/types/components/Toast/types.d.ts +0 -0
  215. package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
  216. package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
  217. package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
  218. package/types/components/Toolbar/index.d.ts +0 -0
  219. package/types/components/Typography/Text/StyledText.d.ts +0 -0
  220. package/types/components/Typography/Text/index.d.ts +0 -0
  221. package/types/components/Typography/index.d.ts +0 -0
  222. package/types/index.d.ts +2 -1
  223. package/types/testHelpers/renderWithTheme.d.ts +0 -0
  224. package/types/theme/ThemeProvider.d.ts +0 -0
  225. package/types/theme/ThemeSwitcher.d.ts +0 -0
  226. package/types/theme/components/accordion.d.ts +0 -0
  227. package/types/theme/components/alert.d.ts +0 -0
  228. package/types/theme/components/attachment.d.ts +0 -0
  229. package/types/theme/components/avatar.d.ts +0 -0
  230. package/types/theme/components/badge.d.ts +0 -0
  231. package/types/theme/components/bottomNavigation.d.ts +0 -0
  232. package/types/theme/components/bottomSheet.d.ts +0 -0
  233. package/types/theme/components/button.d.ts +0 -0
  234. package/types/theme/components/calendar.d.ts +0 -0
  235. package/types/theme/components/card.d.ts +0 -0
  236. package/types/theme/components/cardCarousel.d.ts +0 -0
  237. package/types/theme/components/carousel.d.ts +0 -0
  238. package/types/theme/components/checkbox.d.ts +0 -0
  239. package/types/theme/components/contentNavigator.d.ts +0 -0
  240. package/types/theme/components/datePicker.d.ts +0 -0
  241. package/types/theme/components/divider.d.ts +0 -0
  242. package/types/theme/components/drawer.d.ts +0 -0
  243. package/types/theme/components/empty.d.ts +0 -0
  244. package/types/theme/components/error.d.ts +0 -0
  245. package/types/theme/components/fab.d.ts +10 -0
  246. package/types/theme/components/icon.d.ts +0 -0
  247. package/types/theme/components/image.d.ts +0 -0
  248. package/types/theme/components/list.d.ts +0 -0
  249. package/types/theme/components/pageControl.d.ts +0 -0
  250. package/types/theme/components/pinInput.d.ts +0 -0
  251. package/types/theme/components/progress.d.ts +0 -0
  252. package/types/theme/components/radio.d.ts +0 -0
  253. package/types/theme/components/refreshControl.d.ts +0 -0
  254. package/types/theme/components/richTextEditor.d.ts +0 -0
  255. package/types/theme/components/sectionHeading.d.ts +0 -0
  256. package/types/theme/components/select.d.ts +0 -0
  257. package/types/theme/components/skeleton.d.ts +0 -0
  258. package/types/theme/components/slider.d.ts +0 -0
  259. package/types/theme/components/spinner.d.ts +0 -0
  260. package/types/theme/components/success.d.ts +32 -0
  261. package/types/theme/components/swipeable.d.ts +0 -0
  262. package/types/theme/components/switch.d.ts +0 -0
  263. package/types/theme/components/tabs.d.ts +0 -0
  264. package/types/theme/components/tag.d.ts +0 -0
  265. package/types/theme/components/textInput.d.ts +0 -0
  266. package/types/theme/components/timePicker.d.ts +0 -0
  267. package/types/theme/components/toast.d.ts +0 -0
  268. package/types/theme/components/toolbar.d.ts +0 -0
  269. package/types/theme/components/typography.d.ts +0 -0
  270. package/types/theme/getTheme.d.ts +2 -0
  271. package/types/theme/global/borders.d.ts +0 -0
  272. package/types/theme/global/colors/eBens.d.ts +0 -0
  273. package/types/theme/global/colors/global.d.ts +0 -0
  274. package/types/theme/global/colors/globalDark.d.ts +0 -0
  275. package/types/theme/global/colors/jobs.d.ts +0 -0
  276. package/types/theme/global/colors/swag.d.ts +0 -0
  277. package/types/theme/global/colors/swagDark.d.ts +0 -0
  278. package/types/theme/global/colors/types.d.ts +0 -0
  279. package/types/theme/global/colors/wallet.d.ts +0 -0
  280. package/types/theme/global/colors/work.d.ts +0 -0
  281. package/types/theme/global/index.d.ts +0 -0
  282. package/types/theme/global/scale.d.ts +0 -0
  283. package/types/theme/global/sizes.d.ts +0 -0
  284. package/types/theme/global/space.d.ts +0 -0
  285. package/types/theme/global/typography.d.ts +0 -0
  286. package/types/theme/index.d.ts +0 -0
  287. package/types/types.d.ts +0 -0
  288. package/types/utils/functions.d.ts +0 -0
  289. package/types/utils/helpers.d.ts +0 -0
  290. package/types/utils/hooks.d.ts +0 -0
  291. package/types/utils/scale.d.ts +0 -0
  292. package/.turbo/turbo-build:types.log +0 -2
  293. package/.turbo/turbo-lint.log +0 -146
  294. package/.turbo/turbo-test.log +0 -451
  295. package/.turbo/turbo-type-check.log +0 -2
@@ -0,0 +1,497 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Success renders full screen success page correctly 1`] = `
4
+ <Modal
5
+ animationType="slide"
6
+ hardwareAccelerated={false}
7
+ style={
8
+ Array [
9
+ Object {
10
+ "height": "100%",
11
+ "width": "100%",
12
+ },
13
+ undefined,
14
+ ]
15
+ }
16
+ visible={true}
17
+ >
18
+ <View
19
+ style={
20
+ Array [
21
+ Object {
22
+ "backgroundColor": "#ccd2d3",
23
+ "display": "flex",
24
+ "flex": 1,
25
+ "flexDirection": "column",
26
+ },
27
+ undefined,
28
+ ]
29
+ }
30
+ themeVariant="full-screen"
31
+ >
32
+ <View
33
+ style={
34
+ Array [
35
+ Object {
36
+ "alignItems": "center",
37
+ "display": "flex",
38
+ "flex": 1,
39
+ "flexDirection": "column",
40
+ "justifyContent": "center",
41
+ "padding": 24,
42
+ },
43
+ undefined,
44
+ ]
45
+ }
46
+ >
47
+ <View
48
+ style={
49
+ Array [
50
+ Object {
51
+ "height": 176,
52
+ "marginBottom": 32,
53
+ "width": 176,
54
+ },
55
+ undefined,
56
+ ]
57
+ }
58
+ >
59
+ <Image
60
+ source={
61
+ Object {
62
+ "uri": "path_to_image",
63
+ }
64
+ }
65
+ style={
66
+ Array [
67
+ Object {
68
+ "borderRadius": 0,
69
+ "height": 72,
70
+ "width": 72,
71
+ },
72
+ Array [
73
+ Object {
74
+ "height": 176,
75
+ "marginBottom": 32,
76
+ "resizeMode": "contain",
77
+ "width": 176,
78
+ },
79
+ undefined,
80
+ ],
81
+ ]
82
+ }
83
+ testID="success-image"
84
+ />
85
+ </View>
86
+ <Text
87
+ allowFontScaling={false}
88
+ style={
89
+ Array [
90
+ Object {
91
+ "color": "#001f23",
92
+ "fontFamily": "BeVietnamPro-Regular",
93
+ "fontSize": 14,
94
+ "letterSpacing": 0.42,
95
+ "lineHeight": 22,
96
+ },
97
+ Array [
98
+ Object {
99
+ "color": "#001f23",
100
+ "fontFamily": "RebondGrotesque-SemiBold",
101
+ "fontSize": 24,
102
+ "marginBottom": 8,
103
+ "textAlign": "center",
104
+ },
105
+ undefined,
106
+ ],
107
+ ]
108
+ }
109
+ themeFontSize="medium"
110
+ themeFontWeight="regular"
111
+ themeIntent="body"
112
+ themeTypeface="neutral"
113
+ >
114
+ We’re sorry, something went wrong
115
+ </Text>
116
+ <Text
117
+ allowFontScaling={false}
118
+ style={
119
+ Array [
120
+ Object {
121
+ "color": "#001f23",
122
+ "fontFamily": "BeVietnamPro-Regular",
123
+ "fontSize": 14,
124
+ "letterSpacing": 0.42,
125
+ "lineHeight": 22,
126
+ },
127
+ Array [
128
+ Object {
129
+ "color": "#4d6265",
130
+ "fontFamily": "RebondGrotesque",
131
+ "fontSize": 18,
132
+ "textAlign": "center",
133
+ },
134
+ undefined,
135
+ ],
136
+ ]
137
+ }
138
+ themeFontSize="medium"
139
+ themeFontWeight="regular"
140
+ themeIntent="body"
141
+ themeTypeface="neutral"
142
+ >
143
+ Please try again later
144
+ </Text>
145
+ </View>
146
+ </View>
147
+ </Modal>
148
+ `;
149
+
150
+ exports[`Success renders succe screen with custom image element correctly 1`] = `
151
+ <View
152
+ style={
153
+ Array [
154
+ Object {
155
+ "backgroundColor": "#f6f6f7",
156
+ "display": "flex",
157
+ "flex": 1,
158
+ "flexDirection": "column",
159
+ },
160
+ undefined,
161
+ ]
162
+ }
163
+ themeVariant="in-page"
164
+ >
165
+ <View
166
+ style={
167
+ Array [
168
+ Object {
169
+ "alignItems": "center",
170
+ "display": "flex",
171
+ "flex": 1,
172
+ "flexDirection": "column",
173
+ "justifyContent": "center",
174
+ "padding": 24,
175
+ },
176
+ undefined,
177
+ ]
178
+ }
179
+ >
180
+ <View
181
+ style={
182
+ Array [
183
+ Object {
184
+ "height": 176,
185
+ "marginBottom": 32,
186
+ "width": 176,
187
+ },
188
+ undefined,
189
+ ]
190
+ }
191
+ >
192
+ <Image
193
+ source={
194
+ Object {
195
+ "uri": "path_to_image",
196
+ }
197
+ }
198
+ style={
199
+ Array [
200
+ Object {
201
+ "borderRadius": 0,
202
+ "height": 72,
203
+ "width": 72,
204
+ },
205
+ undefined,
206
+ ]
207
+ }
208
+ testID="success-image"
209
+ />
210
+ </View>
211
+ <Text
212
+ allowFontScaling={false}
213
+ style={
214
+ Array [
215
+ Object {
216
+ "color": "#001f23",
217
+ "fontFamily": "BeVietnamPro-Regular",
218
+ "fontSize": 14,
219
+ "letterSpacing": 0.42,
220
+ "lineHeight": 22,
221
+ },
222
+ Array [
223
+ Object {
224
+ "color": "#001f23",
225
+ "fontFamily": "RebondGrotesque-SemiBold",
226
+ "fontSize": 24,
227
+ "marginBottom": 8,
228
+ "textAlign": "center",
229
+ },
230
+ undefined,
231
+ ],
232
+ ]
233
+ }
234
+ themeFontSize="medium"
235
+ themeFontWeight="regular"
236
+ themeIntent="body"
237
+ themeTypeface="neutral"
238
+ >
239
+ We’re sorry, something went wrong
240
+ </Text>
241
+ <Text
242
+ allowFontScaling={false}
243
+ style={
244
+ Array [
245
+ Object {
246
+ "color": "#001f23",
247
+ "fontFamily": "BeVietnamPro-Regular",
248
+ "fontSize": 14,
249
+ "letterSpacing": 0.42,
250
+ "lineHeight": 22,
251
+ },
252
+ Array [
253
+ Object {
254
+ "color": "#4d6265",
255
+ "fontFamily": "RebondGrotesque",
256
+ "fontSize": 18,
257
+ "textAlign": "center",
258
+ },
259
+ undefined,
260
+ ],
261
+ ]
262
+ }
263
+ themeFontSize="medium"
264
+ themeFontWeight="regular"
265
+ themeIntent="body"
266
+ themeTypeface="neutral"
267
+ >
268
+ Please try again later
269
+ </Text>
270
+ </View>
271
+ </View>
272
+ `;
273
+
274
+ exports[`Success renders success screen with image correctly 1`] = `
275
+ <View
276
+ style={
277
+ Array [
278
+ Object {
279
+ "backgroundColor": "#f6f6f7",
280
+ "display": "flex",
281
+ "flex": 1,
282
+ "flexDirection": "column",
283
+ },
284
+ undefined,
285
+ ]
286
+ }
287
+ themeVariant="in-page"
288
+ >
289
+ <View
290
+ style={
291
+ Array [
292
+ Object {
293
+ "alignItems": "center",
294
+ "display": "flex",
295
+ "flex": 1,
296
+ "flexDirection": "column",
297
+ "justifyContent": "center",
298
+ "padding": 24,
299
+ },
300
+ undefined,
301
+ ]
302
+ }
303
+ >
304
+ <View
305
+ style={
306
+ Array [
307
+ Object {
308
+ "height": 176,
309
+ "marginBottom": 32,
310
+ "width": 176,
311
+ },
312
+ undefined,
313
+ ]
314
+ }
315
+ >
316
+ <Image
317
+ source={
318
+ Object {
319
+ "uri": "path_to_image",
320
+ }
321
+ }
322
+ style={
323
+ Array [
324
+ Object {
325
+ "borderRadius": 0,
326
+ "height": 72,
327
+ "width": 72,
328
+ },
329
+ Array [
330
+ Object {
331
+ "height": 176,
332
+ "marginBottom": 32,
333
+ "resizeMode": "contain",
334
+ "width": 176,
335
+ },
336
+ undefined,
337
+ ],
338
+ ]
339
+ }
340
+ testID="success-image"
341
+ />
342
+ </View>
343
+ <Text
344
+ allowFontScaling={false}
345
+ style={
346
+ Array [
347
+ Object {
348
+ "color": "#001f23",
349
+ "fontFamily": "BeVietnamPro-Regular",
350
+ "fontSize": 14,
351
+ "letterSpacing": 0.42,
352
+ "lineHeight": 22,
353
+ },
354
+ Array [
355
+ Object {
356
+ "color": "#001f23",
357
+ "fontFamily": "RebondGrotesque-SemiBold",
358
+ "fontSize": 24,
359
+ "marginBottom": 8,
360
+ "textAlign": "center",
361
+ },
362
+ undefined,
363
+ ],
364
+ ]
365
+ }
366
+ themeFontSize="medium"
367
+ themeFontWeight="regular"
368
+ themeIntent="body"
369
+ themeTypeface="neutral"
370
+ >
371
+ We’re sorry, something went wrong
372
+ </Text>
373
+ <Text
374
+ allowFontScaling={false}
375
+ style={
376
+ Array [
377
+ Object {
378
+ "color": "#001f23",
379
+ "fontFamily": "BeVietnamPro-Regular",
380
+ "fontSize": 14,
381
+ "letterSpacing": 0.42,
382
+ "lineHeight": 22,
383
+ },
384
+ Array [
385
+ Object {
386
+ "color": "#4d6265",
387
+ "fontFamily": "RebondGrotesque",
388
+ "fontSize": 18,
389
+ "textAlign": "center",
390
+ },
391
+ undefined,
392
+ ],
393
+ ]
394
+ }
395
+ themeFontSize="medium"
396
+ themeFontWeight="regular"
397
+ themeIntent="body"
398
+ themeTypeface="neutral"
399
+ >
400
+ Please try again later
401
+ </Text>
402
+ </View>
403
+ </View>
404
+ `;
405
+
406
+ exports[`Success renders title only correctly 1`] = `
407
+ <View
408
+ style={
409
+ Array [
410
+ Object {
411
+ "backgroundColor": "#f6f6f7",
412
+ "display": "flex",
413
+ "flex": 1,
414
+ "flexDirection": "column",
415
+ },
416
+ undefined,
417
+ ]
418
+ }
419
+ themeVariant="in-page"
420
+ >
421
+ <View
422
+ style={
423
+ Array [
424
+ Object {
425
+ "alignItems": "center",
426
+ "display": "flex",
427
+ "flex": 1,
428
+ "flexDirection": "column",
429
+ "justifyContent": "center",
430
+ "padding": 24,
431
+ },
432
+ undefined,
433
+ ]
434
+ }
435
+ >
436
+ <Text
437
+ allowFontScaling={false}
438
+ style={
439
+ Array [
440
+ Object {
441
+ "color": "#001f23",
442
+ "fontFamily": "BeVietnamPro-Regular",
443
+ "fontSize": 14,
444
+ "letterSpacing": 0.42,
445
+ "lineHeight": 22,
446
+ },
447
+ Array [
448
+ Object {
449
+ "color": "#001f23",
450
+ "fontFamily": "RebondGrotesque-SemiBold",
451
+ "fontSize": 24,
452
+ "marginBottom": 8,
453
+ "textAlign": "center",
454
+ },
455
+ undefined,
456
+ ],
457
+ ]
458
+ }
459
+ themeFontSize="medium"
460
+ themeFontWeight="regular"
461
+ themeIntent="body"
462
+ themeTypeface="neutral"
463
+ >
464
+ We’re sorry, something went wrong
465
+ </Text>
466
+ <Text
467
+ allowFontScaling={false}
468
+ style={
469
+ Array [
470
+ Object {
471
+ "color": "#001f23",
472
+ "fontFamily": "BeVietnamPro-Regular",
473
+ "fontSize": 14,
474
+ "letterSpacing": 0.42,
475
+ "lineHeight": 22,
476
+ },
477
+ Array [
478
+ Object {
479
+ "color": "#4d6265",
480
+ "fontFamily": "RebondGrotesque",
481
+ "fontSize": 18,
482
+ "textAlign": "center",
483
+ },
484
+ undefined,
485
+ ],
486
+ ]
487
+ }
488
+ themeFontSize="medium"
489
+ themeFontWeight="regular"
490
+ themeIntent="body"
491
+ themeTypeface="neutral"
492
+ >
493
+ Please try again later
494
+ </Text>
495
+ </View>
496
+ </View>
497
+ `;
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+ import { fireEvent } from '@testing-library/react-native';
3
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
4
+ import Success from '..';
5
+ import Image from '../../Image';
6
+
7
+ const title = `We’re sorry, something went wrong`;
8
+ const description = 'Please try again later';
9
+
10
+ describe('Success', () => {
11
+ it('renders title only correctly', () => {
12
+ const { toJSON, getByText } = renderWithTheme(
13
+ <Success title={title} description={description} />
14
+ );
15
+
16
+ expect(getByText(title)).toBeTruthy();
17
+ expect(getByText(description)).toBeTruthy();
18
+ expect(toJSON()).toMatchSnapshot();
19
+ });
20
+ it('renders success screen with image correctly', () => {
21
+ const { toJSON, getByText, getByTestId } = renderWithTheme(
22
+ <Success title={title} description={description} image="path_to_image" />
23
+ );
24
+
25
+ expect(getByText(title)).toBeTruthy();
26
+ expect(getByText(description)).toBeTruthy();
27
+ expect(getByTestId('success-image')).toBeTruthy();
28
+ expect(toJSON()).toMatchSnapshot();
29
+ });
30
+ it('renders succe screen with custom image element correctly', () => {
31
+ const image = (
32
+ <Image
33
+ source={{
34
+ uri: 'path_to_image',
35
+ }}
36
+ />
37
+ );
38
+ const { toJSON, getByText, getByTestId } = renderWithTheme(
39
+ <Success title={title} description={description} image={image} />
40
+ );
41
+
42
+ expect(getByText(title)).toBeTruthy();
43
+ expect(getByText(description)).toBeTruthy();
44
+ expect(getByTestId('success-image')).toBeTruthy();
45
+ expect(toJSON()).toMatchSnapshot();
46
+ });
47
+ it('renders full screen success page correctly', () => {
48
+ const { toJSON, getByText, getByTestId } = renderWithTheme(
49
+ <Success
50
+ variant="full-screen"
51
+ title={title}
52
+ description={description}
53
+ image="path_to_image"
54
+ />
55
+ );
56
+
57
+ expect(getByText(title)).toBeTruthy();
58
+ expect(getByText(description)).toBeTruthy();
59
+ expect(getByTestId('success-image')).toBeTruthy();
60
+ expect(toJSON()).toMatchSnapshot();
61
+ });
62
+ it('handles CTA press correctly', () => {
63
+ const onCtaPress = jest.fn();
64
+ const { getByText } = renderWithTheme(
65
+ <Success
66
+ title={title}
67
+ description={description}
68
+ image="path_to_image"
69
+ ctaText="CTA Text"
70
+ onCtaPress={onCtaPress}
71
+ />
72
+ );
73
+
74
+ const CTA = getByText('CTA Text');
75
+ fireEvent.press(CTA);
76
+ expect(onCtaPress).toBeCalledTimes(1);
77
+ });
78
+ });
@@ -0,0 +1,129 @@
1
+ import React, { ReactElement, isValidElement } from 'react';
2
+ import type {
3
+ ViewProps,
4
+ ImageSourcePropType,
5
+ ImageProps as RNImageProps,
6
+ } from 'react-native';
7
+ import {
8
+ SuccessVariant,
9
+ StyledSuccessImage,
10
+ StyledSuccessContainer,
11
+ StyledSuccessContent,
12
+ StyledSuccessImageContainer,
13
+ StyledSuccessTitle,
14
+ StyledSuccessDescription,
15
+ StyledSuccessButtonContainer,
16
+ StyledSuccessButtonPrimary,
17
+ StyledSuccessModal,
18
+ } from './StyledSuccess';
19
+ import { ImageProps } from '../Image';
20
+ import { noop } from '../../utils/functions';
21
+
22
+ export interface SuccessProps extends ViewProps {
23
+ /**
24
+ * Image to be displayed.
25
+ */
26
+ image?:
27
+ | ReactElement<ImageProps | RNImageProps>
28
+ | ImageSourcePropType
29
+ | string;
30
+ /**
31
+ * Success's title.
32
+ */
33
+ title: string;
34
+ /**
35
+ * Success's description.
36
+ */
37
+ description?: string;
38
+ /**
39
+ * Success's variant.
40
+ */
41
+ variant?: SuccessVariant;
42
+ /**
43
+ * Action button text
44
+ */
45
+ ctaText?: string;
46
+ /**
47
+ * Callback when the action button is pressed.
48
+ */
49
+ onCtaPress?: () => void;
50
+ /**
51
+ * Testing id of the component.
52
+ */
53
+ testID?: string;
54
+ }
55
+
56
+ const renderImage = (
57
+ image: ReactElement<ImageProps | RNImageProps> | ImageSourcePropType | string
58
+ ) => {
59
+ if (isValidElement(image)) {
60
+ return React.cloneElement(image, {
61
+ testID: 'success-image',
62
+ });
63
+ }
64
+
65
+ return (
66
+ <StyledSuccessImage
67
+ source={typeof image === 'string' ? { uri: image } : image}
68
+ testID="success-image"
69
+ />
70
+ );
71
+ };
72
+
73
+ const SuccessPage = ({
74
+ variant = 'in-page',
75
+ title,
76
+ description,
77
+ image,
78
+ testID,
79
+ ctaText,
80
+ onCtaPress = noop,
81
+ ...nativeProps
82
+ }: SuccessProps): ReactElement => {
83
+ return (
84
+ <StyledSuccessContainer
85
+ testID={testID}
86
+ themeVariant={variant}
87
+ {...nativeProps}
88
+ >
89
+ <StyledSuccessContent>
90
+ {!!image && (
91
+ <StyledSuccessImageContainer>
92
+ {renderImage(image)}
93
+ </StyledSuccessImageContainer>
94
+ )}
95
+ <StyledSuccessTitle>{title}</StyledSuccessTitle>
96
+
97
+ {!!description && (
98
+ <StyledSuccessDescription>{description}</StyledSuccessDescription>
99
+ )}
100
+ </StyledSuccessContent>
101
+
102
+ {!!ctaText && (
103
+ <StyledSuccessButtonContainer>
104
+ <StyledSuccessButtonPrimary text={ctaText} onPress={onCtaPress} />
105
+ </StyledSuccessButtonContainer>
106
+ )}
107
+ </StyledSuccessContainer>
108
+ );
109
+ };
110
+
111
+ /**
112
+ * Renders success page
113
+ *
114
+ * @param {SuccessProps} props
115
+ * @return {*} {ReactElement}
116
+ */
117
+ const Success = (props: SuccessProps): ReactElement => {
118
+ const { variant } = props;
119
+ if (variant === 'full-screen') {
120
+ return (
121
+ <StyledSuccessModal animationType="slide">
122
+ <SuccessPage {...props} />
123
+ </StyledSuccessModal>
124
+ );
125
+ }
126
+
127
+ return <SuccessPage {...props} />;
128
+ };
129
+ export default Success;
@@ -14,7 +14,7 @@ type ThemeIntent =
14
14
  type ThemeVariant = 'filled' | 'outlined';
15
15
 
16
16
  const getFilledStyles = (themeIntent: ThemeIntent, theme: Theme) => ({
17
- textColor: theme.__hd__.tag.colors.text,
17
+ textColor: theme.__hd__.tag.colors[themeIntent],
18
18
  borderColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
19
19
  backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
20
20
  });