@hero-design/rn 7.3.0 → 7.4.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 (320) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +1997 -1123
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +2001 -1121
  6. package/package.json +11 -9
  7. package/playground/.detoxrc.json +49 -0
  8. package/playground/.prettierrc.json +8 -0
  9. package/playground/app.json +9 -0
  10. package/playground/babel.config.js +63 -0
  11. package/playground/e2e/config.json +9 -0
  12. package/playground/e2e/environment.js +23 -0
  13. package/playground/e2e/firstTest.e2e.js +16 -0
  14. package/{expoEntry.js → playground/expoEntry.js} +1 -1
  15. package/playground/fonts/be-vietnam-pro-light.ttf +0 -0
  16. package/playground/fonts/be-vietnam-pro-regular.ttf +0 -0
  17. package/playground/fonts/be-vietnam-pro-semibold.ttf +0 -0
  18. package/playground/fonts/hero-icons.ttf +0 -0
  19. package/playground/index.js +7 -0
  20. package/playground/ios/MobileHeroDesignPlayground/AppDelegate.h +9 -0
  21. package/playground/ios/MobileHeroDesignPlayground/AppDelegate.m +75 -0
  22. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
  23. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/Contents.json +6 -0
  24. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/Contents.json +21 -0
  25. package/playground/ios/MobileHeroDesignPlayground/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  26. package/playground/ios/MobileHeroDesignPlayground/Info.plist +85 -0
  27. package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground-Bridging-Header.h +3 -0
  28. package/playground/ios/MobileHeroDesignPlayground/MobileHeroDesignPlayground.entitlements +8 -0
  29. package/playground/ios/MobileHeroDesignPlayground/SplashScreen.storyboard +40 -0
  30. package/playground/ios/MobileHeroDesignPlayground/Supporting/Expo.plist +16 -0
  31. package/playground/ios/MobileHeroDesignPlayground/main.m +10 -0
  32. package/playground/ios/MobileHeroDesignPlayground/noop-file.swift +4 -0
  33. package/playground/ios/MobileHeroDesignPlayground.xcodeproj/project.pbxproj +515 -0
  34. package/playground/ios/MobileHeroDesignPlayground.xcodeproj/xcshareddata/xcschemes/MobileHeroDesignPlayground.xcscheme +88 -0
  35. package/playground/ios/MobileHeroDesignPlayground.xcworkspace/contents.xcworkspacedata +10 -0
  36. package/playground/ios/MobileHeroDesignPlayground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  37. package/playground/ios/Podfile +49 -0
  38. package/playground/ios/Podfile.lock +478 -0
  39. package/playground/ios/Podfile.properties.json +3 -0
  40. package/{metro.config.js → playground/metro.config.js} +10 -2
  41. package/playground/package.json +63 -0
  42. package/playground/{index.tsx → src/App.tsx} +57 -29
  43. package/playground/{components → src}/Avatar.tsx +1 -1
  44. package/playground/{components → src}/Badge.tsx +1 -1
  45. package/playground/{components → src}/BottomNavigation.tsx +1 -1
  46. package/playground/src/BottomSheet.tsx +43 -0
  47. package/playground/src/Button.tsx +170 -0
  48. package/playground/{components/Button.tsx → src/Button.tsx~origin_master} +0 -0
  49. package/playground/{components → src}/Card.tsx +1 -1
  50. package/playground/{components → src}/Collapse.tsx +1 -1
  51. package/playground/src/ContentNavigator.tsx +65 -0
  52. package/playground/{components → src}/Divider.tsx +1 -1
  53. package/playground/{components → src}/Drawer.tsx +1 -1
  54. package/playground/{components → src}/FAB.tsx +1 -1
  55. package/playground/{components → src}/Icon.tsx +7 -3
  56. package/playground/{components → src}/IconButton.tsx +12 -1
  57. package/playground/{components → src}/Progress.tsx +1 -1
  58. package/playground/src/Radio.tsx +25 -0
  59. package/playground/src/SectionHeading.tsx +68 -0
  60. package/playground/src/Spinner.tsx +19 -0
  61. package/playground/{components → src}/Tabs.tsx +1 -1
  62. package/playground/{components → src}/Tag.tsx +1 -1
  63. package/playground/src/TextInput.tsx +14 -0
  64. package/playground/{components → src}/Typography.tsx +1 -1
  65. package/playground/src/emotion.d.ts +7 -0
  66. package/playground/tsconfig.json +21 -0
  67. package/src/components/BottomSheet/Footer.tsx +19 -0
  68. package/src/components/BottomSheet/Header.tsx +49 -0
  69. package/src/components/BottomSheet/StyledBottomSheet.tsx +75 -0
  70. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +531 -0
  71. package/src/components/BottomSheet/__tests__/index.spec.tsx +107 -0
  72. package/src/components/BottomSheet/index.tsx +171 -0
  73. package/src/components/Button/IconButton.tsx +11 -1
  74. package/src/components/Card/index.tsx +1 -1
  75. package/src/components/Collapse/StyledCollapse.tsx +11 -2
  76. package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +36 -31
  77. package/src/components/Collapse/__tests__/index.spec.tsx +1 -13
  78. package/src/components/Collapse/index.tsx +20 -50
  79. package/src/components/ContentNavigator/StyledContentNavigator.tsx +15 -0
  80. package/src/components/ContentNavigator/__tests__/StyledContentNavigator.spec.tsx +19 -0
  81. package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +43 -0
  82. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +217 -0
  83. package/src/components/ContentNavigator/__tests__/index.spec.tsx +74 -0
  84. package/src/components/ContentNavigator/index.tsx +65 -0
  85. package/src/components/Icon/HeroIcon/index.tsx +13 -2
  86. package/src/components/Icon/HeroIcon/selection.json +1 -1
  87. package/src/components/Icon/IconList.ts +6 -0
  88. package/src/components/Icon/index.tsx +8 -1
  89. package/src/components/Radio/Radio.tsx +51 -0
  90. package/src/components/Radio/RadioGroup.tsx +50 -0
  91. package/src/components/Radio/StyledRadio.tsx +42 -0
  92. package/src/components/Radio/__tests__/Radio.spec.tsx +38 -0
  93. package/src/components/Radio/__tests__/RadioGroup.spec.tsx +36 -0
  94. package/src/components/Radio/__tests__/StyledRadio.spec.tsx +43 -0
  95. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +160 -0
  96. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +248 -0
  97. package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +124 -0
  98. package/src/components/Radio/index.tsx +5 -0
  99. package/src/components/SectionHeading/StyledHeading.tsx +24 -0
  100. package/src/components/SectionHeading/__tests__/StyledHeading.tsx +28 -0
  101. package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.tsx.snap +48 -0
  102. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +208 -0
  103. package/src/components/SectionHeading/__tests__/index.spec.tsx +39 -0
  104. package/src/components/SectionHeading/index.tsx +93 -0
  105. package/src/components/Spinner/AnimatedSpinner.tsx +55 -0
  106. package/src/components/Spinner/StyledSpinner.tsx +59 -0
  107. package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +11 -0
  108. package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +56 -0
  109. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +118 -0
  110. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +235 -0
  111. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +141 -0
  112. package/src/components/Spinner/__tests__/index.spec.tsx +12 -0
  113. package/src/components/Spinner/index.tsx +22 -0
  114. package/src/components/TextInput/StyledTextInput.tsx +34 -0
  115. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +33 -0
  116. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +88 -0
  117. package/src/components/TextInput/__tests__/index.spec.tsx +16 -0
  118. package/src/components/TextInput/index.tsx +61 -0
  119. package/src/index.ts +12 -0
  120. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +95 -0
  121. package/src/theme/components/bottomSheet.ts +34 -0
  122. package/src/theme/components/contentNavigator.ts +11 -0
  123. package/src/theme/components/icon.ts +1 -0
  124. package/src/theme/components/radio.ts +34 -0
  125. package/src/theme/components/spinner.ts +21 -0
  126. package/src/theme/components/textInput.ts +32 -0
  127. package/src/theme/global/borders.ts +6 -0
  128. package/src/theme/global/colors.ts +1 -0
  129. package/src/theme/index.ts +22 -7
  130. package/tsconfig.json +11 -3
  131. package/types/components/Avatar/StyledAvatar.d.ts +45 -0
  132. package/types/components/Avatar/__tests__/StyledAvatar.spec.d.ts +1 -0
  133. package/types/components/Avatar/__tests__/index.spec.d.ts +1 -0
  134. package/types/components/Avatar/index.d.ts +25 -0
  135. package/types/components/Badge/Status.d.ts +24 -0
  136. package/types/components/Badge/StyledBadge.d.ts +27 -0
  137. package/types/components/Badge/__tests__/Badge.spec.d.ts +1 -0
  138. package/types/components/Badge/__tests__/Status.spec.d.ts +1 -0
  139. package/types/components/Badge/index.d.ts +32 -0
  140. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +51 -0
  141. package/types/components/BottomNavigation/__tests__/index.spec.d.ts +1 -0
  142. package/types/components/BottomNavigation/index.d.ts +45 -0
  143. package/types/components/BottomSheet/Footer.d.ts +6 -0
  144. package/types/components/BottomSheet/Header.d.ts +8 -0
  145. package/types/components/BottomSheet/StyledBottomSheet.d.ts +46 -0
  146. package/types/components/BottomSheet/__tests__/index.spec.d.ts +1 -0
  147. package/types/components/BottomSheet/index.d.ts +51 -0
  148. package/types/components/Button/Button.d.ts +57 -0
  149. package/types/components/Button/IconButton.d.ts +38 -0
  150. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +19 -0
  151. package/types/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +1 -0
  152. package/types/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +1 -0
  153. package/types/components/Button/LoadingIndicator/index.d.ts +26 -0
  154. package/types/components/Button/StyledButton.d.ts +39 -0
  155. package/types/components/Button/__tests__/Button.spec.d.ts +1 -0
  156. package/types/components/Button/__tests__/IconButton.spec.d.ts +1 -0
  157. package/types/components/Button/__tests__/StyledButton.spec.d.ts +1 -0
  158. package/types/components/Button/index.d.ts +8 -0
  159. package/types/components/Card/StyledCard.d.ts +16 -0
  160. package/types/components/Card/__tests__/StyledCard.spec.d.ts +1 -0
  161. package/types/components/Card/__tests__/index.spec.d.ts +1 -0
  162. package/types/components/Card/index.d.ts +22 -0
  163. package/types/components/Collapse/StyledCollapse.d.ts +25 -0
  164. package/types/components/Collapse/__tests__/StyledCollapse.spec.d.ts +1 -0
  165. package/types/components/Collapse/__tests__/index.spec.d.ts +1 -0
  166. package/types/components/Collapse/index.d.ts +19 -0
  167. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +12 -0
  168. package/types/components/ContentNavigator/__tests__/StyledContentNavigator.spec.d.ts +1 -0
  169. package/types/components/ContentNavigator/__tests__/index.spec.d.ts +1 -0
  170. package/types/components/ContentNavigator/index.d.ts +33 -0
  171. package/types/components/Divider/StyledDivider.d.ts +12 -0
  172. package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +1 -0
  173. package/types/components/Divider/index.d.ts +21 -0
  174. package/types/components/Drawer/StyledDrawer.d.ts +24 -0
  175. package/types/components/Drawer/__tests__/index.spec.d.ts +1 -0
  176. package/types/components/Drawer/index.d.ts +25 -0
  177. package/types/components/FAB/ActionGroup/ActionItem.d.ts +12 -0
  178. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +29 -0
  179. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +12 -0
  180. package/types/components/FAB/ActionGroup/__tests__/index.spec.d.ts +1 -0
  181. package/types/components/FAB/ActionGroup/index.d.ts +34 -0
  182. package/types/components/FAB/AnimatedFABIcon.d.ts +6 -0
  183. package/types/components/FAB/FAB.d.ts +34 -0
  184. package/types/components/FAB/StyledFAB.d.ts +19 -0
  185. package/types/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +1 -0
  186. package/types/components/FAB/__tests__/StyledFAB.spec.d.ts +1 -0
  187. package/types/components/FAB/__tests__/index.spec.d.ts +1 -0
  188. package/types/components/FAB/index.d.ts +4 -0
  189. package/types/components/Icon/HeroIcon/index.d.ts +12 -0
  190. package/types/components/Icon/IconList.d.ts +2 -0
  191. package/types/components/Icon/__tests__/index.spec.d.ts +1 -0
  192. package/types/components/Icon/index.d.ts +27 -0
  193. package/types/components/Icon/utils.d.ts +2 -0
  194. package/types/components/Progress/ProgressBar.d.ts +18 -0
  195. package/types/components/Progress/ProgressCircle.d.ts +18 -0
  196. package/types/components/Progress/StyledProgressBar.d.ts +17 -0
  197. package/types/components/Progress/StyledProgressCircle.d.ts +37 -0
  198. package/types/components/Progress/__tests__/index.spec.d.ts +1 -0
  199. package/types/components/Progress/index.d.ts +5 -0
  200. package/types/components/Progress/types.d.ts +1 -0
  201. package/types/components/Radio/Radio.d.ts +26 -0
  202. package/types/components/Radio/RadioGroup.d.ts +29 -0
  203. package/types/components/Radio/StyledRadio.d.ts +30 -0
  204. package/types/components/Radio/__tests__/Radio.spec.d.ts +1 -0
  205. package/types/components/Radio/__tests__/RadioGroup.spec.d.ts +1 -0
  206. package/types/components/Radio/__tests__/StyledRadio.spec.d.ts +1 -0
  207. package/types/components/Radio/index.d.ts +4 -0
  208. package/types/components/SectionHeading/StyledHeading.d.ts +20 -0
  209. package/types/components/SectionHeading/__tests__/StyledHeading.d.ts +1 -0
  210. package/types/components/SectionHeading/__tests__/index.spec.d.ts +1 -0
  211. package/types/components/SectionHeading/index.d.ts +39 -0
  212. package/types/components/Spinner/AnimatedSpinner.d.ts +2 -0
  213. package/types/components/Spinner/StyledSpinner.d.ts +30 -0
  214. package/types/components/Spinner/__tests__/AnimatedSpinner.spec.d.ts +1 -0
  215. package/types/components/Spinner/__tests__/StyledSpinner.spec.d.ts +1 -0
  216. package/types/components/Spinner/__tests__/index.spec.d.ts +1 -0
  217. package/types/components/Spinner/index.d.ts +10 -0
  218. package/types/components/Tabs/ActiveTabIndicator.d.ts +8 -0
  219. package/types/components/Tabs/ScrollableTabs.d.ts +3 -0
  220. package/types/components/Tabs/StyledScrollableTabs.d.ts +60 -0
  221. package/types/components/Tabs/StyledTabs.d.ts +54 -0
  222. package/types/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +1 -0
  223. package/types/components/Tabs/__tests__/index.spec.d.ts +1 -0
  224. package/types/components/Tabs/index.d.ts +54 -0
  225. package/types/components/Tabs/utils.d.ts +2 -0
  226. package/types/components/Tag/StyledTag.d.ts +19 -0
  227. package/types/components/Tag/__tests__/Tag.spec.d.ts +1 -0
  228. package/types/components/Tag/index.d.ts +21 -0
  229. package/types/components/TextInput/StyledTextInput.d.ts +22 -0
  230. package/types/components/TextInput/__tests__/StyledTextInput.spec.d.ts +1 -0
  231. package/types/components/TextInput/__tests__/index.spec.d.ts +1 -0
  232. package/types/components/TextInput/index.d.ts +26 -0
  233. package/types/components/Typography/Text/StyledText.d.ts +12 -0
  234. package/types/components/Typography/Text/__tests__/StyledText.spec.d.ts +1 -0
  235. package/types/components/Typography/Text/__tests__/index.spec.d.ts +1 -0
  236. package/types/components/Typography/Text/index.d.ts +30 -0
  237. package/types/components/Typography/index.d.ts +6 -0
  238. package/types/index.d.ts +25 -0
  239. package/types/playground/components/Avatar.d.ts +0 -0
  240. package/types/playground/components/Collapse.d.ts +0 -0
  241. package/types/playground/components/Drawer.d.ts +0 -0
  242. package/types/playground/components/IconButton.d.ts +0 -0
  243. package/types/playground/components/Progress.d.ts +0 -0
  244. package/types/playground/components/Tag.d.ts +0 -0
  245. package/types/src/components/Avatar/StyledAvatar.d.ts +0 -0
  246. package/types/src/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -0
  247. package/types/src/components/Avatar/__tests__/index.spec.d.ts +0 -0
  248. package/types/src/components/Avatar/index.d.ts +0 -0
  249. package/types/src/components/Badge/Status.d.ts +0 -0
  250. package/types/src/components/Badge/__tests__/Status.spec.d.ts +0 -0
  251. package/types/src/components/Button/Button.d.ts +0 -0
  252. package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
  253. package/types/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -0
  254. package/types/src/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -0
  255. package/types/src/components/Button/LoadingIndicator/index.d.ts +0 -0
  256. package/types/src/components/Button/StyledButton.d.ts +0 -0
  257. package/types/src/components/Button/__tests__/Button.spec.d.ts +0 -0
  258. package/types/src/components/Button/__tests__/IconButton.spec.d.ts +0 -0
  259. package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +0 -0
  260. package/types/src/components/Collapse/StyledCollapse.d.ts +0 -0
  261. package/types/src/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -0
  262. package/types/src/components/Collapse/__tests__/index.spec.d.ts +0 -0
  263. package/types/src/components/Collapse/index.d.ts +0 -0
  264. package/types/src/components/Drawer/StyledDrawer.d.ts +0 -0
  265. package/types/src/components/Drawer/__tests__/index.spec.d.ts +0 -0
  266. package/types/src/components/Drawer/index.d.ts +0 -0
  267. package/types/src/components/Progress/ProgressBar.d.ts +0 -0
  268. package/types/src/components/Progress/ProgressCircle.d.ts +0 -0
  269. package/types/src/components/Progress/StyledProgressBar.d.ts +0 -0
  270. package/types/src/components/Progress/StyledProgressCircle.d.ts +0 -0
  271. package/types/src/components/Progress/__tests__/index.spec.d.ts +0 -0
  272. package/types/src/components/Progress/index.d.ts +0 -0
  273. package/types/src/components/Progress/types.d.ts +0 -0
  274. package/types/src/components/Tabs/ActiveTabIndicator.d.ts +0 -0
  275. package/types/src/components/Tabs/ScrollableTabs.d.ts +0 -0
  276. package/types/src/components/Tabs/StyledScrollableTabs.d.ts +0 -0
  277. package/types/src/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -0
  278. package/types/src/components/Tabs/utils.d.ts +0 -0
  279. package/types/src/components/Tag/StyledTag.d.ts +0 -0
  280. package/types/src/components/Tag/__tests__/Tag.spec.d.ts +0 -0
  281. package/types/src/components/Tag/index.d.ts +0 -0
  282. package/types/src/theme/components/avatar.d.ts +0 -0
  283. package/types/src/theme/components/button.d.ts +0 -0
  284. package/types/src/theme/components/drawer.d.ts +0 -0
  285. package/types/src/theme/components/progress.d.ts +0 -0
  286. package/types/src/theme/components/tag.d.ts +0 -0
  287. package/types/src/utils/hooks.d.ts +0 -0
  288. package/types/testHelpers/renderWithTheme.d.ts +3 -0
  289. package/types/theme/__tests__/index.spec.d.ts +1 -0
  290. package/types/theme/components/avatar.d.ts +32 -0
  291. package/types/theme/components/badge.d.ts +29 -0
  292. package/types/theme/components/bottomNavigation.d.ts +23 -0
  293. package/types/theme/components/bottomSheet.d.ts +29 -0
  294. package/types/theme/components/button.d.ts +37 -0
  295. package/types/theme/components/card.d.ts +10 -0
  296. package/types/theme/components/contentNavigator.d.ts +7 -0
  297. package/types/theme/components/divider.d.ts +17 -0
  298. package/types/theme/components/drawer.d.ts +21 -0
  299. package/types/theme/components/fab.d.ts +51 -0
  300. package/types/theme/components/icon.d.ts +20 -0
  301. package/types/theme/components/progress.d.ts +21 -0
  302. package/types/theme/components/radio.d.ts +25 -0
  303. package/types/theme/components/spinner.d.ts +15 -0
  304. package/types/theme/components/tabs.d.ts +27 -0
  305. package/types/theme/components/tag.d.ts +30 -0
  306. package/types/theme/components/textInput.d.ts +24 -0
  307. package/types/theme/components/typography.d.ts +26 -0
  308. package/types/theme/global/borders.d.ts +14 -0
  309. package/types/theme/global/colors.d.ts +32 -0
  310. package/types/theme/global/index.d.ts +42 -0
  311. package/types/theme/global/scale.d.ts +9 -0
  312. package/types/theme/global/space.d.ts +13 -0
  313. package/types/theme/global/typography.d.ts +21 -0
  314. package/types/theme/index.d.ts +45 -0
  315. package/types/types.d.ts +5 -0
  316. package/types/utils/__tests__/scale.spec.d.ts +1 -0
  317. package/types/utils/helpers.d.ts +2 -0
  318. package/types/utils/hooks.d.ts +1 -0
  319. package/types/utils/scale.d.ts +3 -0
  320. package/app.json +0 -8
@@ -0,0 +1,217 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`rendering renders correctly 1`] = `
4
+ <View
5
+ style={
6
+ Array [
7
+ Object {
8
+ "flex": 1,
9
+ "flexDirection": "row",
10
+ "justifyContent": "space-between",
11
+ },
12
+ undefined,
13
+ ]
14
+ }
15
+ >
16
+ <View
17
+ accessible={true}
18
+ collapsable={false}
19
+ focusable={true}
20
+ nativeID="animatedComponent"
21
+ onClick={[Function]}
22
+ onResponderGrant={[Function]}
23
+ onResponderMove={[Function]}
24
+ onResponderRelease={[Function]}
25
+ onResponderTerminate={[Function]}
26
+ onResponderTerminationRequest={[Function]}
27
+ onStartShouldSetResponder={[Function]}
28
+ style={
29
+ Object {
30
+ "opacity": 1,
31
+ }
32
+ }
33
+ testID="previous-icon-button"
34
+ >
35
+ <HeroIcon
36
+ name="arrow-left"
37
+ style={
38
+ Array [
39
+ Object {
40
+ "color": "#292a2b",
41
+ "fontSize": 24,
42
+ },
43
+ undefined,
44
+ ]
45
+ }
46
+ themeIntent="text"
47
+ themeSize="medium"
48
+ />
49
+ </View>
50
+ <Text
51
+ style={
52
+ Array [
53
+ Object {
54
+ "color": "#292a2b",
55
+ "fontFamily": "BeVietnamPro-SemiBold",
56
+ "fontSize": 14,
57
+ "letterSpacing": 0.42,
58
+ "lineHeight": 22,
59
+ },
60
+ Array [
61
+ Object {
62
+ "paddingHorizontal": 8,
63
+ },
64
+ undefined,
65
+ ],
66
+ ]
67
+ }
68
+ themeFontSize="medium"
69
+ themeFontWeight="semi-bold"
70
+ themeIntent="body"
71
+ >
72
+ 20
73
+ </Text>
74
+ <View
75
+ accessible={true}
76
+ collapsable={false}
77
+ focusable={true}
78
+ nativeID="animatedComponent"
79
+ onClick={[Function]}
80
+ onResponderGrant={[Function]}
81
+ onResponderMove={[Function]}
82
+ onResponderRelease={[Function]}
83
+ onResponderTerminate={[Function]}
84
+ onResponderTerminationRequest={[Function]}
85
+ onStartShouldSetResponder={[Function]}
86
+ style={
87
+ Object {
88
+ "opacity": 1,
89
+ }
90
+ }
91
+ testID="next-icon-button"
92
+ >
93
+ <HeroIcon
94
+ name="arrow-right"
95
+ style={
96
+ Array [
97
+ Object {
98
+ "color": "#292a2b",
99
+ "fontSize": 24,
100
+ },
101
+ undefined,
102
+ ]
103
+ }
104
+ themeIntent="text"
105
+ themeSize="medium"
106
+ />
107
+ </View>
108
+ </View>
109
+ `;
110
+
111
+ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
112
+ <View
113
+ style={
114
+ Array [
115
+ Object {
116
+ "flex": 1,
117
+ "flexDirection": "row",
118
+ "justifyContent": "space-between",
119
+ },
120
+ undefined,
121
+ ]
122
+ }
123
+ >
124
+ <View
125
+ accessible={true}
126
+ collapsable={false}
127
+ focusable={true}
128
+ nativeID="animatedComponent"
129
+ onClick={[Function]}
130
+ onResponderGrant={[Function]}
131
+ onResponderMove={[Function]}
132
+ onResponderRelease={[Function]}
133
+ onResponderTerminate={[Function]}
134
+ onResponderTerminationRequest={[Function]}
135
+ onStartShouldSetResponder={[Function]}
136
+ style={
137
+ Object {
138
+ "opacity": 1,
139
+ }
140
+ }
141
+ testID="previous-icon-button"
142
+ >
143
+ <HeroIcon
144
+ name="arrow-left"
145
+ style={
146
+ Array [
147
+ Object {
148
+ "color": "#8b8d92",
149
+ "fontSize": 24,
150
+ },
151
+ undefined,
152
+ ]
153
+ }
154
+ themeIntent="disabled-text"
155
+ themeSize="medium"
156
+ />
157
+ </View>
158
+ <Text
159
+ style={
160
+ Array [
161
+ Object {
162
+ "color": "#292a2b",
163
+ "fontFamily": "BeVietnamPro-SemiBold",
164
+ "fontSize": 14,
165
+ "letterSpacing": 0.42,
166
+ "lineHeight": 22,
167
+ },
168
+ Array [
169
+ Object {
170
+ "paddingHorizontal": 8,
171
+ },
172
+ undefined,
173
+ ],
174
+ ]
175
+ }
176
+ themeFontSize="medium"
177
+ themeFontWeight="semi-bold"
178
+ themeIntent="body"
179
+ >
180
+ 20
181
+ </Text>
182
+ <View
183
+ accessible={true}
184
+ collapsable={false}
185
+ focusable={true}
186
+ nativeID="animatedComponent"
187
+ onClick={[Function]}
188
+ onResponderGrant={[Function]}
189
+ onResponderMove={[Function]}
190
+ onResponderRelease={[Function]}
191
+ onResponderTerminate={[Function]}
192
+ onResponderTerminationRequest={[Function]}
193
+ onStartShouldSetResponder={[Function]}
194
+ style={
195
+ Object {
196
+ "opacity": 1,
197
+ }
198
+ }
199
+ testID="next-icon-button"
200
+ >
201
+ <HeroIcon
202
+ name="arrow-right"
203
+ style={
204
+ Array [
205
+ Object {
206
+ "color": "#8b8d92",
207
+ "fontSize": 24,
208
+ },
209
+ undefined,
210
+ ]
211
+ }
212
+ themeIntent="disabled-text"
213
+ themeSize="medium"
214
+ />
215
+ </View>
216
+ </View>
217
+ `;
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { fireEvent } from '@testing-library/react-native';
3
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
4
+ import ContentNavigator from '..';
5
+
6
+ describe('rendering', () => {
7
+ it('renders correctly', () => {
8
+ const { toJSON, getByText, queryAllByTestId } = renderWithTheme(
9
+ <ContentNavigator
10
+ value={20}
11
+ onPreviousPress={jest.fn()}
12
+ onNextPress={jest.fn()}
13
+ />
14
+ );
15
+
16
+ expect(getByText('20')).toBeDefined();
17
+ expect(toJSON()).toMatchSnapshot();
18
+ expect(queryAllByTestId('previous-icon-button')).toHaveLength(1);
19
+ expect(queryAllByTestId('next-icon-button')).toHaveLength(1);
20
+ });
21
+
22
+ it('renders correctly when icon buttons are disabled', () => {
23
+ const { toJSON, getByText } = renderWithTheme(
24
+ <ContentNavigator
25
+ value="20"
26
+ onPreviousPress={jest.fn()}
27
+ onNextPress={jest.fn()}
28
+ previousDisabled
29
+ nextDisabled
30
+ />
31
+ );
32
+
33
+ expect(getByText('20')).toBeDefined();
34
+ expect(toJSON()).toMatchSnapshot();
35
+ });
36
+ });
37
+
38
+ describe('behavior', () => {
39
+ it('calls press handlers', () => {
40
+ const prevHandler = jest.fn();
41
+ const nextHandler = jest.fn();
42
+ const { getByTestId } = renderWithTheme(
43
+ <ContentNavigator
44
+ value={20}
45
+ onPreviousPress={prevHandler}
46
+ onNextPress={nextHandler}
47
+ />
48
+ );
49
+
50
+ fireEvent.press(getByTestId('previous-icon-button'));
51
+ expect(prevHandler).toBeCalledTimes(1);
52
+ fireEvent.press(getByTestId('next-icon-button'));
53
+ expect(prevHandler).toBeCalledTimes(1);
54
+ });
55
+
56
+ it('does NOT call press handlers when icon buttons are disabled', () => {
57
+ const prevHandler = jest.fn();
58
+ const nextHandler = jest.fn();
59
+ const { getByTestId } = renderWithTheme(
60
+ <ContentNavigator
61
+ value={20}
62
+ onPreviousPress={prevHandler}
63
+ onNextPress={nextHandler}
64
+ previousDisabled
65
+ nextDisabled
66
+ />
67
+ );
68
+
69
+ fireEvent.press(getByTestId('previous-icon-button'));
70
+ expect(prevHandler).toBeCalledTimes(0);
71
+ fireEvent.press(getByTestId('next-icon-button'));
72
+ expect(prevHandler).toBeCalledTimes(0);
73
+ });
74
+ });
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { Value, Wrapper } from './StyledContentNavigator';
4
+ import Button from '../Button';
5
+
6
+ interface ContentNavigatorProps {
7
+ /**
8
+ * The navigator's content value.
9
+ */
10
+ value: number | string;
11
+ /**
12
+ * Handler to handle press event of previous icon.
13
+ */
14
+ onPreviousPress: () => void;
15
+ /**
16
+ * Handler to handle press event of next icon.
17
+ */
18
+ onNextPress: () => void;
19
+ /**
20
+ * Whether the previous icon is disabled.
21
+ */
22
+ previousDisabled?: boolean;
23
+ /**
24
+ * Whether the next icon is disabled.
25
+ */
26
+ nextDisabled?: boolean;
27
+ /**
28
+ * Additional style.
29
+ */
30
+ style?: StyleProp<ViewStyle>;
31
+ /**
32
+ * Testing id of the component.
33
+ */
34
+ testID?: string;
35
+ }
36
+
37
+ function ContentNavigator({
38
+ onPreviousPress,
39
+ onNextPress,
40
+ value,
41
+ previousDisabled = false,
42
+ nextDisabled = false,
43
+ testID,
44
+ style,
45
+ }: ContentNavigatorProps) {
46
+ return (
47
+ <Wrapper testID={testID} style={style}>
48
+ <Button.Icon
49
+ icon="arrow-left"
50
+ onPress={onPreviousPress}
51
+ disabled={previousDisabled}
52
+ testID="previous-icon-button"
53
+ />
54
+ <Value fontWeight="semi-bold">{value}</Value>
55
+ <Button.Icon
56
+ icon="arrow-right"
57
+ onPress={onNextPress}
58
+ disabled={nextDisabled}
59
+ testID="next-icon-button"
60
+ />
61
+ </Wrapper>
62
+ );
63
+ }
64
+
65
+ export default ContentNavigator;
@@ -9,7 +9,8 @@ type ThemeIntent =
9
9
  | 'info'
10
10
  | 'danger'
11
11
  | 'success'
12
- | 'warning';
12
+ | 'warning'
13
+ | 'disabled-text';
13
14
 
14
15
  const HeroIcon = createIconSetFromIcoMoon(
15
16
  heroIconConfig,
@@ -17,11 +18,21 @@ const HeroIcon = createIconSetFromIcoMoon(
17
18
  'hero-icons.ttf'
18
19
  );
19
20
 
21
+ const COLOR_INTENTS = {
22
+ text: 'text',
23
+ primary: 'primary',
24
+ info: 'info',
25
+ danger: 'danger',
26
+ success: 'success',
27
+ warning: 'warning',
28
+ 'disabled-text': 'disabledText',
29
+ } as const;
30
+
20
31
  const StyledHeroIcon = styled(HeroIcon)<{
21
32
  themeSize: ThemeSize;
22
33
  themeIntent: ThemeIntent;
23
34
  }>(({ themeIntent, themeSize, theme }) => ({
24
- color: theme.__hd__.icon.colors[themeIntent],
35
+ color: theme.__hd__.icon.colors[COLOR_INTENTS[themeIntent]],
25
36
  fontSize: theme.__hd__.icon.sizes[themeSize],
26
37
  }));
27
38