@hero-design/rn 7.18.0 → 7.19.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 (311) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/es/index.js +155 -143
  3. package/lib/index.js +155 -143
  4. package/package.json +2 -2
  5. package/src/components/Accordion/AccordionItem.tsx +5 -4
  6. package/src/components/Accordion/__tests__/index.spec.tsx +2 -1
  7. package/src/components/Accordion/index.tsx +3 -2
  8. package/src/components/Alert/StyledAlert.tsx +3 -2
  9. package/src/components/Alert/index.tsx +5 -3
  10. package/src/components/Avatar/index.tsx +2 -2
  11. package/src/components/Badge/Status.tsx +4 -2
  12. package/src/components/Badge/index.tsx +2 -1
  13. package/src/components/BottomNavigation/__tests__/index.spec.tsx +4 -2
  14. package/src/components/BottomNavigation/index.tsx +6 -8
  15. package/src/components/BottomSheet/Footer.tsx +2 -1
  16. package/src/components/BottomSheet/Header.tsx +2 -1
  17. package/src/components/BottomSheet/StyledBottomSheet.tsx +2 -2
  18. package/src/components/BottomSheet/index.tsx +4 -8
  19. package/src/components/Button/Button.tsx +5 -6
  20. package/src/components/Button/IconButton.tsx +4 -7
  21. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +5 -3
  22. package/src/components/Button/LoadingIndicator/index.tsx +2 -8
  23. package/src/components/Button/StyledButton.tsx +4 -5
  24. package/src/components/Button/UtilityButton/index.tsx +5 -4
  25. package/src/components/Button/index.tsx +3 -2
  26. package/src/components/Calendar/StyledCalendar.tsx +2 -1
  27. package/src/components/Card/DataCard/index.tsx +3 -2
  28. package/src/components/Card/index.tsx +3 -2
  29. package/src/components/Checkbox/StyledCheckbox.tsx +44 -14
  30. package/src/components/Checkbox/__tests__/StyledCheckbox.spec.tsx +28 -3
  31. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +95 -9
  32. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +337 -23
  33. package/src/components/Checkbox/__tests__/index.spec.tsx +38 -7
  34. package/src/components/Checkbox/index.tsx +35 -18
  35. package/src/components/Collapse/index.tsx +4 -8
  36. package/src/components/ContentNavigator/index.tsx +1 -1
  37. package/src/components/DatePicker/DatePickerAndroid.tsx +1 -1
  38. package/src/components/DatePicker/DatePickerIOS.tsx +1 -1
  39. package/src/components/DatePicker/StyledDatePicker.tsx +2 -1
  40. package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +1 -2
  41. package/src/components/DatePicker/index.tsx +1 -1
  42. package/src/components/DatePicker/types.ts +1 -1
  43. package/src/components/Divider/index.tsx +1 -1
  44. package/src/components/Drawer/DragableDrawer/index.tsx +3 -2
  45. package/src/components/Drawer/StyledDrawer.tsx +3 -2
  46. package/src/components/Drawer/index.tsx +2 -1
  47. package/src/components/Empty/index.tsx +1 -2
  48. package/src/components/FAB/ActionGroup/ActionItem.tsx +3 -2
  49. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +4 -3
  50. package/src/components/FAB/ActionGroup/StyledActionItem.tsx +4 -2
  51. package/src/components/FAB/ActionGroup/index.tsx +5 -3
  52. package/src/components/FAB/AnimatedFABIcon.tsx +1 -1
  53. package/src/components/FAB/FAB.tsx +2 -2
  54. package/src/components/FAB/StyledFAB.tsx +4 -7
  55. package/src/components/Icon/AnimatedIcon.tsx +2 -1
  56. package/src/components/Icon/index.tsx +1 -1
  57. package/src/components/List/BasicListItem.tsx +3 -3
  58. package/src/components/List/ListItem.tsx +6 -3
  59. package/src/components/List/StyledListItem.tsx +2 -1
  60. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +13 -27
  61. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +2 -0
  62. package/src/components/PinInput/PinCell.tsx +1 -1
  63. package/src/components/PinInput/index.tsx +3 -7
  64. package/src/components/Progress/ProgressBar.tsx +2 -1
  65. package/src/components/Progress/ProgressCircle.tsx +3 -9
  66. package/src/components/Progress/StyledProgressBar.tsx +3 -3
  67. package/src/components/Progress/StyledProgressCircle.tsx +3 -3
  68. package/src/components/Radio/Radio.tsx +20 -14
  69. package/src/components/Radio/RadioGroup.tsx +5 -3
  70. package/src/components/Radio/StyledRadio.tsx +12 -29
  71. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +84 -50
  72. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +124 -73
  73. package/src/components/RichTextEditor/EditorToolbar.tsx +4 -8
  74. package/src/components/RichTextEditor/RichTextEditor.tsx +5 -14
  75. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -6
  76. package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +2 -6
  77. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +4 -7
  78. package/src/components/RichTextEditor/index.tsx +6 -6
  79. package/src/components/SectionHeading/index.tsx +5 -4
  80. package/src/components/Select/MultiSelect/Option.tsx +2 -1
  81. package/src/components/Select/MultiSelect/OptionList.tsx +3 -3
  82. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +605 -585
  83. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +1 -1
  84. package/src/components/Select/MultiSelect/index.tsx +20 -16
  85. package/src/components/Select/SingleSelect/Option.tsx +2 -1
  86. package/src/components/Select/SingleSelect/OptionList.tsx +3 -3
  87. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +602 -582
  88. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +1 -1
  89. package/src/components/Select/SingleSelect/index.tsx +20 -16
  90. package/src/components/Select/StyledOptionList.tsx +11 -9
  91. package/src/components/Select/helpers.tsx +1 -1
  92. package/src/components/Select/index.tsx +6 -4
  93. package/src/components/Select/types.ts +3 -3
  94. package/src/components/Spinner/StyledSpinner.tsx +2 -1
  95. package/src/components/Spinner/index.tsx +3 -3
  96. package/src/components/Switch/StyledSwitch.tsx +10 -26
  97. package/src/components/Switch/__tests__/StyledSwitch.spec.tsx +25 -0
  98. package/src/components/Switch/__tests__/__snapshots__/{StyledHeading.spec.tsx.snap → StyledSwitch.spec.tsx.snap} +45 -18
  99. package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +26 -52
  100. package/src/components/Switch/index.tsx +23 -20
  101. package/src/components/Tabs/ScrollableTabs.tsx +1 -1
  102. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +4 -2
  103. package/src/components/Tabs/__tests__/index.spec.tsx +4 -2
  104. package/src/components/Tabs/index.tsx +7 -13
  105. package/src/components/Tag/index.tsx +1 -1
  106. package/src/components/TextInput/index.tsx +5 -5
  107. package/src/components/TimePicker/StyledTimePicker.tsx +2 -1
  108. package/src/components/TimePicker/TimePickerAndroid.tsx +1 -1
  109. package/src/components/TimePicker/TimePickerIOS.tsx +1 -1
  110. package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +1 -2
  111. package/src/components/TimePicker/index.tsx +1 -1
  112. package/src/components/TimePicker/types.ts +1 -1
  113. package/src/components/Toast/StyledToast.tsx +3 -8
  114. package/src/components/Toast/Toast.tsx +3 -2
  115. package/src/components/Toast/ToastContainer.tsx +2 -2
  116. package/src/components/Toast/ToastContext.ts +1 -1
  117. package/src/components/Toast/ToastProvider.tsx +5 -7
  118. package/src/components/Toast/__tests__/ToastContainer.spec.tsx +1 -1
  119. package/src/components/Toast/types.ts +3 -3
  120. package/src/components/Toolbar/StyledToolbar.tsx +2 -1
  121. package/src/components/Toolbar/ToolbarGroup.tsx +2 -1
  122. package/src/components/Toolbar/ToolbarItem.tsx +2 -1
  123. package/src/components/Toolbar/index.tsx +2 -1
  124. package/src/components/Typography/Text/index.tsx +3 -2
  125. package/src/testHelpers/renderWithTheme.tsx +2 -1
  126. package/src/theme/ThemeProvider.ts +1 -1
  127. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +24 -26
  128. package/src/theme/components/accordion.ts +1 -1
  129. package/src/theme/components/alert.ts +1 -1
  130. package/src/theme/components/avatar.ts +1 -1
  131. package/src/theme/components/badge.ts +1 -1
  132. package/src/theme/components/bottomNavigation.ts +1 -1
  133. package/src/theme/components/bottomSheet.ts +1 -1
  134. package/src/theme/components/button.ts +1 -1
  135. package/src/theme/components/calendar.ts +1 -1
  136. package/src/theme/components/card.ts +1 -1
  137. package/src/theme/components/checkbox.ts +12 -8
  138. package/src/theme/components/contentNavigator.ts +1 -1
  139. package/src/theme/components/divider.ts +1 -1
  140. package/src/theme/components/drawer.ts +1 -1
  141. package/src/theme/components/empty.ts +1 -1
  142. package/src/theme/components/fab.ts +1 -1
  143. package/src/theme/components/icon.ts +1 -1
  144. package/src/theme/components/list.ts +5 -4
  145. package/src/theme/components/pinInput.ts +1 -1
  146. package/src/theme/components/progress.ts +1 -1
  147. package/src/theme/components/radio.ts +3 -11
  148. package/src/theme/components/richTextEditor.ts +1 -1
  149. package/src/theme/components/sectionHeading.ts +1 -1
  150. package/src/theme/components/select.ts +1 -1
  151. package/src/theme/components/spinner.ts +1 -1
  152. package/src/theme/components/switch.ts +7 -8
  153. package/src/theme/components/tabs.ts +1 -1
  154. package/src/theme/components/tag.ts +1 -1
  155. package/src/theme/components/textInput.ts +1 -1
  156. package/src/theme/components/toast.ts +1 -1
  157. package/src/theme/components/toolbar.ts +1 -1
  158. package/src/theme/components/typography.ts +1 -1
  159. package/src/theme/getTheme.ts +4 -11
  160. package/src/theme/global/borders.ts +2 -1
  161. package/src/theme/global/colors/swag.ts +2 -3
  162. package/src/theme/global/colors/work.ts +1 -2
  163. package/src/theme/global/index.ts +6 -11
  164. package/src/theme/global/scale.ts +2 -1
  165. package/src/theme/global/space.ts +2 -1
  166. package/src/theme/global/typography.ts +2 -8
  167. package/src/theme/index.ts +5 -2
  168. package/src/types.ts +9 -10
  169. package/testUtils/setup.tsx +2 -0
  170. package/tsconfig.json +4 -9
  171. package/types/components/Accordion/AccordionItem.d.ts +3 -3
  172. package/types/components/Accordion/index.d.ts +3 -2
  173. package/types/components/Alert/StyledAlert.d.ts +2 -1
  174. package/types/components/Alert/index.d.ts +3 -3
  175. package/types/components/Avatar/index.d.ts +1 -1
  176. package/types/components/Badge/Status.d.ts +2 -2
  177. package/types/components/Badge/index.d.ts +2 -1
  178. package/types/components/BottomNavigation/index.d.ts +3 -3
  179. package/types/components/BottomSheet/Footer.d.ts +1 -1
  180. package/types/components/BottomSheet/Header.d.ts +1 -1
  181. package/types/components/BottomSheet/StyledBottomSheet.d.ts +2 -1
  182. package/types/components/BottomSheet/index.d.ts +2 -2
  183. package/types/components/Button/Button.d.ts +4 -4
  184. package/types/components/Button/IconButton.d.ts +2 -2
  185. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +3 -2
  186. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  187. package/types/components/Button/StyledButton.d.ts +3 -2
  188. package/types/components/Button/UtilityButton/index.d.ts +3 -3
  189. package/types/components/Button/index.d.ts +2 -2
  190. package/types/components/Calendar/StyledCalendar.d.ts +2 -1
  191. package/types/components/Card/DataCard/index.d.ts +2 -2
  192. package/types/components/Card/index.d.ts +2 -2
  193. package/types/components/Checkbox/StyledCheckbox.d.ts +21 -3
  194. package/types/components/Checkbox/index.d.ts +11 -3
  195. package/types/components/Collapse/index.d.ts +2 -2
  196. package/types/components/ContentNavigator/index.d.ts +1 -1
  197. package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
  198. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  199. package/types/components/DatePicker/StyledDatePicker.d.ts +2 -1
  200. package/types/components/DatePicker/index.d.ts +1 -1
  201. package/types/components/DatePicker/types.d.ts +1 -1
  202. package/types/components/Divider/index.d.ts +1 -1
  203. package/types/components/Drawer/DragableDrawer/index.d.ts +1 -1
  204. package/types/components/Drawer/StyledDrawer.d.ts +2 -1
  205. package/types/components/Drawer/index.d.ts +1 -1
  206. package/types/components/Empty/index.d.ts +1 -1
  207. package/types/components/FAB/ActionGroup/ActionItem.d.ts +2 -2
  208. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +3 -2
  209. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +3 -2
  210. package/types/components/FAB/ActionGroup/index.d.ts +3 -3
  211. package/types/components/FAB/AnimatedFABIcon.d.ts +1 -1
  212. package/types/components/FAB/FAB.d.ts +2 -2
  213. package/types/components/FAB/StyledFAB.d.ts +3 -2
  214. package/types/components/Icon/AnimatedIcon.d.ts +1 -1
  215. package/types/components/Icon/index.d.ts +1 -1
  216. package/types/components/List/BasicListItem.d.ts +2 -2
  217. package/types/components/List/ListItem.d.ts +4 -3
  218. package/types/components/PinInput/PinCell.d.ts +1 -1
  219. package/types/components/PinInput/index.d.ts +2 -2
  220. package/types/components/Progress/ProgressBar.d.ts +1 -1
  221. package/types/components/Progress/ProgressCircle.d.ts +1 -1
  222. package/types/components/Progress/StyledProgressBar.d.ts +3 -2
  223. package/types/components/Progress/StyledProgressCircle.d.ts +3 -2
  224. package/types/components/Radio/Radio.d.ts +2 -2
  225. package/types/components/Radio/RadioGroup.d.ts +3 -3
  226. package/types/components/Radio/StyledRadio.d.ts +2 -12
  227. package/types/components/RichTextEditor/RichTextEditor.d.ts +3 -2
  228. package/types/components/RichTextEditor/index.d.ts +3 -2
  229. package/types/components/SectionHeading/index.d.ts +3 -3
  230. package/types/components/Select/MultiSelect/Option.d.ts +1 -1
  231. package/types/components/Select/MultiSelect/OptionList.d.ts +2 -2
  232. package/types/components/Select/MultiSelect/index.d.ts +1 -1
  233. package/types/components/Select/SingleSelect/Option.d.ts +1 -1
  234. package/types/components/Select/SingleSelect/OptionList.d.ts +2 -2
  235. package/types/components/Select/SingleSelect/index.d.ts +1 -1
  236. package/types/components/Select/StyledOptionList.d.ts +4 -4
  237. package/types/components/Select/helpers.d.ts +1 -1
  238. package/types/components/Select/index.d.ts +4 -3
  239. package/types/components/Select/types.d.ts +3 -3
  240. package/types/components/Spinner/StyledSpinner.d.ts +2 -1
  241. package/types/components/Spinner/index.d.ts +2 -2
  242. package/types/components/Switch/StyledSwitch.d.ts +3 -18
  243. package/types/components/{Radio/__tests__/StyledRadio.spec.d.ts → Switch/__tests__/StyledSwitch.spec.d.ts} +0 -0
  244. package/types/components/Switch/index.d.ts +3 -2
  245. package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
  246. package/types/components/Tabs/index.d.ts +3 -3
  247. package/types/components/Tag/index.d.ts +1 -1
  248. package/types/components/TextInput/index.d.ts +3 -3
  249. package/types/components/TimePicker/StyledTimePicker.d.ts +2 -1
  250. package/types/components/TimePicker/TimePickerAndroid.d.ts +1 -1
  251. package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
  252. package/types/components/TimePicker/index.d.ts +1 -1
  253. package/types/components/TimePicker/types.d.ts +1 -1
  254. package/types/components/Toast/StyledToast.d.ts +2 -1
  255. package/types/components/Toast/Toast.d.ts +1 -1
  256. package/types/components/Toast/ToastContainer.d.ts +2 -2
  257. package/types/components/Toast/ToastContext.d.ts +1 -1
  258. package/types/components/Toast/ToastProvider.d.ts +2 -2
  259. package/types/components/Toast/types.d.ts +3 -3
  260. package/types/components/Toolbar/StyledToolbar.d.ts +2 -1
  261. package/types/components/Toolbar/ToolbarGroup.d.ts +1 -1
  262. package/types/components/Toolbar/ToolbarItem.d.ts +1 -1
  263. package/types/components/Toolbar/index.d.ts +1 -1
  264. package/types/components/Typography/Text/index.d.ts +2 -2
  265. package/types/testHelpers/renderWithTheme.d.ts +1 -1
  266. package/types/theme/ThemeProvider.d.ts +1 -1
  267. package/types/theme/components/accordion.d.ts +1 -1
  268. package/types/theme/components/alert.d.ts +1 -1
  269. package/types/theme/components/avatar.d.ts +1 -1
  270. package/types/theme/components/badge.d.ts +1 -1
  271. package/types/theme/components/bottomNavigation.d.ts +1 -1
  272. package/types/theme/components/bottomSheet.d.ts +1 -1
  273. package/types/theme/components/button.d.ts +1 -1
  274. package/types/theme/components/calendar.d.ts +1 -1
  275. package/types/theme/components/card.d.ts +1 -1
  276. package/types/theme/components/checkbox.d.ts +10 -7
  277. package/types/theme/components/contentNavigator.d.ts +1 -1
  278. package/types/theme/components/divider.d.ts +1 -1
  279. package/types/theme/components/drawer.d.ts +1 -1
  280. package/types/theme/components/empty.d.ts +1 -1
  281. package/types/theme/components/fab.d.ts +1 -1
  282. package/types/theme/components/icon.d.ts +1 -1
  283. package/types/theme/components/list.d.ts +8 -7
  284. package/types/theme/components/pinInput.d.ts +1 -1
  285. package/types/theme/components/progress.d.ts +1 -1
  286. package/types/theme/components/radio.d.ts +1 -8
  287. package/types/theme/components/richTextEditor.d.ts +1 -1
  288. package/types/theme/components/sectionHeading.d.ts +1 -1
  289. package/types/theme/components/select.d.ts +1 -1
  290. package/types/theme/components/spinner.d.ts +1 -1
  291. package/types/theme/components/switch.d.ts +7 -6
  292. package/types/theme/components/tabs.d.ts +1 -1
  293. package/types/theme/components/tag.d.ts +1 -1
  294. package/types/theme/components/textInput.d.ts +1 -1
  295. package/types/theme/components/toast.d.ts +1 -1
  296. package/types/theme/components/toolbar.d.ts +1 -1
  297. package/types/theme/components/typography.d.ts +1 -1
  298. package/types/theme/getTheme.d.ts +2 -2
  299. package/types/theme/global/borders.d.ts +2 -1
  300. package/types/theme/global/colors/swag.d.ts +1 -1
  301. package/types/theme/global/colors/work.d.ts +1 -1
  302. package/types/theme/global/index.d.ts +5 -3
  303. package/types/theme/global/scale.d.ts +2 -1
  304. package/types/theme/global/space.d.ts +2 -1
  305. package/types/theme/global/typography.d.ts +2 -1
  306. package/types/theme/index.d.ts +4 -2
  307. package/types/types.d.ts +9 -8
  308. package/src/components/Radio/__tests__/StyledRadio.spec.tsx +0 -43
  309. package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +0 -124
  310. package/src/components/Switch/__tests__/StyledHeading.spec.tsx +0 -42
  311. package/types/components/Switch/__tests__/StyledHeading.spec.d.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Checkbox renders correctly 1`] = `
3
+ exports[`Checkbox renders correctly when checked is false and there is no description 1`] = `
4
4
  <View
5
5
  accessible={true}
6
6
  collapsable={false}
@@ -15,27 +15,166 @@ exports[`Checkbox renders correctly 1`] = `
15
15
  onStartShouldSetResponder={[Function]}
16
16
  style={
17
17
  Object {
18
- "borderColor": "#8505a2",
19
- "borderRadius": 4,
20
- "borderWidth": 2,
21
- "display": "flex",
22
18
  "flexDirection": "row",
23
- "height": 24,
24
- "justifyContent": "center",
25
19
  "opacity": 1,
26
- "overflow": "hidden",
27
- "width": 24,
28
20
  }
29
21
  }
30
- testID="checkbox"
31
- />
22
+ >
23
+ <View
24
+ style={
25
+ Array [
26
+ Object {
27
+ "borderColor": "#001f23",
28
+ "borderRadius": 4,
29
+ "borderWidth": 2,
30
+ "flexDirection": "row",
31
+ "height": 20,
32
+ "justifyContent": "center",
33
+ "overflow": "hidden",
34
+ "width": 20,
35
+ },
36
+ undefined,
37
+ ]
38
+ }
39
+ themeDisabled={false}
40
+ />
41
+ </View>
42
+ `;
43
+
44
+ exports[`Checkbox renders correctly when checked is true and there is no description 1`] = `
45
+ <View
46
+ accessible={true}
47
+ collapsable={false}
48
+ focusable={false}
49
+ nativeID="animatedComponent"
50
+ onClick={[Function]}
51
+ onResponderGrant={[Function]}
52
+ onResponderMove={[Function]}
53
+ onResponderRelease={[Function]}
54
+ onResponderTerminate={[Function]}
55
+ onResponderTerminationRequest={[Function]}
56
+ onStartShouldSetResponder={[Function]}
57
+ style={
58
+ Object {
59
+ "flexDirection": "row",
60
+ "opacity": 1,
61
+ }
62
+ }
63
+ >
64
+ <View
65
+ style={
66
+ Array [
67
+ Object {
68
+ "borderColor": "#001f23",
69
+ "borderRadius": 4,
70
+ "borderWidth": 2,
71
+ "flexDirection": "row",
72
+ "height": 20,
73
+ "justifyContent": "center",
74
+ "overflow": "hidden",
75
+ "width": 20,
76
+ },
77
+ undefined,
78
+ ]
79
+ }
80
+ themeDisabled={false}
81
+ >
82
+ <HeroIcon
83
+ name="box-check"
84
+ style={
85
+ Array [
86
+ Object {
87
+ "color": "#001f23",
88
+ "fontSize": 24,
89
+ },
90
+ Array [
91
+ Object {
92
+ "position": "absolute",
93
+ "top": -3,
94
+ },
95
+ undefined,
96
+ ],
97
+ ]
98
+ }
99
+ testID="check-mark"
100
+ themeIntent="text"
101
+ themeSize="medium"
102
+ />
103
+ </View>
104
+ </View>
105
+ `;
106
+
107
+ exports[`Checkbox renders correctly when disabled is false, withBorder is false 1`] = `
108
+ <View
109
+ accessible={true}
110
+ collapsable={false}
111
+ focusable={false}
112
+ nativeID="animatedComponent"
113
+ onClick={[Function]}
114
+ onResponderGrant={[Function]}
115
+ onResponderMove={[Function]}
116
+ onResponderRelease={[Function]}
117
+ onResponderTerminate={[Function]}
118
+ onResponderTerminationRequest={[Function]}
119
+ onStartShouldSetResponder={[Function]}
120
+ style={
121
+ Object {
122
+ "flexDirection": "row",
123
+ "opacity": 1,
124
+ }
125
+ }
126
+ >
127
+ <Text
128
+ style={
129
+ Array [
130
+ Object {
131
+ "color": "#001f23",
132
+ "fontFamily": "BeVietnamPro-Regular",
133
+ "fontSize": 14,
134
+ "letterSpacing": 0.42,
135
+ "lineHeight": 22,
136
+ },
137
+ Array [
138
+ Object {
139
+ "flex": 1,
140
+ "paddingRight": 12,
141
+ },
142
+ undefined,
143
+ ],
144
+ ]
145
+ }
146
+ themeFontSize="medium"
147
+ themeFontWeight="regular"
148
+ themeIntent="body"
149
+ >
150
+ Please agree to our privacy policy
151
+ </Text>
152
+ <View
153
+ style={
154
+ Array [
155
+ Object {
156
+ "borderColor": "#001f23",
157
+ "borderRadius": 4,
158
+ "borderWidth": 2,
159
+ "flexDirection": "row",
160
+ "height": 20,
161
+ "justifyContent": "center",
162
+ "overflow": "hidden",
163
+ "width": 20,
164
+ },
165
+ undefined,
166
+ ]
167
+ }
168
+ themeDisabled={false}
169
+ />
170
+ </View>
32
171
  `;
33
172
 
34
- exports[`Checkbox trigger press function correctly 1`] = `
173
+ exports[`Checkbox renders correctly when disabled is false, withBorder is true 1`] = `
35
174
  <View
36
175
  accessible={true}
37
176
  collapsable={false}
38
- focusable={true}
177
+ focusable={false}
39
178
  nativeID="animatedComponent"
40
179
  onClick={[Function]}
41
180
  onResponderGrant={[Function]}
@@ -46,18 +185,193 @@ exports[`Checkbox trigger press function correctly 1`] = `
46
185
  onStartShouldSetResponder={[Function]}
47
186
  style={
48
187
  Object {
49
- "borderColor": "#8505a2",
50
- "borderRadius": 4,
51
- "borderWidth": 2,
52
- "display": "flex",
188
+ "borderColor": "#001f23",
189
+ "borderRadius": 8,
190
+ "borderWidth": 1,
53
191
  "flexDirection": "row",
54
- "height": 24,
55
- "justifyContent": "center",
56
192
  "opacity": 1,
57
- "overflow": "hidden",
58
- "width": 24,
193
+ "padding": 16,
59
194
  }
60
195
  }
61
- testID="checkbox"
62
- />
196
+ >
197
+ <Text
198
+ style={
199
+ Array [
200
+ Object {
201
+ "color": "#001f23",
202
+ "fontFamily": "BeVietnamPro-Regular",
203
+ "fontSize": 14,
204
+ "letterSpacing": 0.42,
205
+ "lineHeight": 22,
206
+ },
207
+ Array [
208
+ Object {
209
+ "flex": 1,
210
+ "paddingRight": 12,
211
+ },
212
+ undefined,
213
+ ],
214
+ ]
215
+ }
216
+ themeFontSize="medium"
217
+ themeFontWeight="regular"
218
+ themeIntent="body"
219
+ >
220
+ Please agree to our privacy policy
221
+ </Text>
222
+ <View
223
+ style={
224
+ Array [
225
+ Object {
226
+ "borderColor": "#001f23",
227
+ "borderRadius": 4,
228
+ "borderWidth": 2,
229
+ "flexDirection": "row",
230
+ "height": 20,
231
+ "justifyContent": "center",
232
+ "overflow": "hidden",
233
+ "width": 20,
234
+ },
235
+ undefined,
236
+ ]
237
+ }
238
+ themeDisabled={false}
239
+ />
240
+ </View>
241
+ `;
242
+
243
+ exports[`Checkbox renders correctly when disabled is true, withBorder is false 1`] = `
244
+ <View
245
+ accessible={true}
246
+ collapsable={false}
247
+ focusable={false}
248
+ nativeID="animatedComponent"
249
+ onClick={[Function]}
250
+ onResponderGrant={[Function]}
251
+ onResponderMove={[Function]}
252
+ onResponderRelease={[Function]}
253
+ onResponderTerminate={[Function]}
254
+ onResponderTerminationRequest={[Function]}
255
+ onStartShouldSetResponder={[Function]}
256
+ style={
257
+ Object {
258
+ "flexDirection": "row",
259
+ "opacity": 1,
260
+ }
261
+ }
262
+ >
263
+ <Text
264
+ style={
265
+ Array [
266
+ Object {
267
+ "color": "#808f91",
268
+ "fontFamily": "BeVietnamPro-Regular",
269
+ "fontSize": 14,
270
+ "letterSpacing": 0.42,
271
+ "lineHeight": 22,
272
+ },
273
+ Array [
274
+ Object {
275
+ "flex": 1,
276
+ "paddingRight": 12,
277
+ },
278
+ undefined,
279
+ ],
280
+ ]
281
+ }
282
+ themeFontSize="medium"
283
+ themeFontWeight="regular"
284
+ themeIntent="subdued"
285
+ >
286
+ Please agree to our privacy policy
287
+ </Text>
288
+ <View
289
+ style={
290
+ Array [
291
+ Object {
292
+ "borderColor": "#808f91",
293
+ "borderRadius": 4,
294
+ "borderWidth": 2,
295
+ "flexDirection": "row",
296
+ "height": 20,
297
+ "justifyContent": "center",
298
+ "overflow": "hidden",
299
+ "width": 20,
300
+ },
301
+ undefined,
302
+ ]
303
+ }
304
+ themeDisabled={true}
305
+ />
306
+ </View>
307
+ `;
308
+
309
+ exports[`Checkbox renders correctly when disabled is true, withBorder is true 1`] = `
310
+ <View
311
+ accessible={true}
312
+ collapsable={false}
313
+ focusable={false}
314
+ nativeID="animatedComponent"
315
+ onClick={[Function]}
316
+ onResponderGrant={[Function]}
317
+ onResponderMove={[Function]}
318
+ onResponderRelease={[Function]}
319
+ onResponderTerminate={[Function]}
320
+ onResponderTerminationRequest={[Function]}
321
+ onStartShouldSetResponder={[Function]}
322
+ style={
323
+ Object {
324
+ "borderColor": "#808f91",
325
+ "borderRadius": 8,
326
+ "borderWidth": 1,
327
+ "flexDirection": "row",
328
+ "opacity": 1,
329
+ "padding": 16,
330
+ }
331
+ }
332
+ >
333
+ <Text
334
+ style={
335
+ Array [
336
+ Object {
337
+ "color": "#808f91",
338
+ "fontFamily": "BeVietnamPro-Regular",
339
+ "fontSize": 14,
340
+ "letterSpacing": 0.42,
341
+ "lineHeight": 22,
342
+ },
343
+ Array [
344
+ Object {
345
+ "flex": 1,
346
+ "paddingRight": 12,
347
+ },
348
+ undefined,
349
+ ],
350
+ ]
351
+ }
352
+ themeFontSize="medium"
353
+ themeFontWeight="regular"
354
+ themeIntent="subdued"
355
+ >
356
+ Please agree to our privacy policy
357
+ </Text>
358
+ <View
359
+ style={
360
+ Array [
361
+ Object {
362
+ "borderColor": "#808f91",
363
+ "borderRadius": 4,
364
+ "borderWidth": 2,
365
+ "flexDirection": "row",
366
+ "height": 20,
367
+ "justifyContent": "center",
368
+ "overflow": "hidden",
369
+ "width": 20,
370
+ },
371
+ undefined,
372
+ ]
373
+ }
374
+ themeDisabled={true}
375
+ />
376
+ </View>
63
377
  `;
@@ -5,20 +5,51 @@ import renderWithTheme from '../../../testHelpers/renderWithTheme';
5
5
  import Checkbox from '..';
6
6
 
7
7
  describe('Checkbox', () => {
8
- it('renders correctly', () => {
9
- const wrapper = renderWithTheme(<Checkbox testID="checkbox" />);
10
- expect(wrapper.queryAllByTestId('checkbox')).toHaveLength(1);
11
- expect(wrapper.toJSON()).toMatchSnapshot();
12
- });
8
+ it.each`
9
+ withBorder | disabled
10
+ ${false} | ${false}
11
+ ${false} | ${true}
12
+ ${true} | ${false}
13
+ ${true} | ${true}
14
+ `(
15
+ 'renders correctly when disabled is $disabled, withBorder is $withBorder',
16
+ ({ disabled, withBorder }) => {
17
+ const wrapper = renderWithTheme(
18
+ <Checkbox
19
+ disabled={disabled}
20
+ withBorder={withBorder}
21
+ description="Please agree to our privacy policy"
22
+ />
23
+ );
24
+
25
+ expect(
26
+ wrapper.getByText('Please agree to our privacy policy')
27
+ ).toBeTruthy();
28
+ expect(wrapper.toJSON()).toMatchSnapshot();
29
+ }
30
+ );
31
+
32
+ it.each`
33
+ checked | length
34
+ ${false} | ${0}
35
+ ${true} | ${1}
36
+ `(
37
+ 'renders correctly when checked is $checked and there is no description',
38
+ ({ checked, length }) => {
39
+ const wrapper = renderWithTheme(<Checkbox checked={checked} />);
40
+
41
+ expect(wrapper.queryAllByTestId('check-mark')).toHaveLength(length);
42
+ expect(wrapper.toJSON()).toMatchSnapshot();
43
+ }
44
+ );
13
45
 
14
46
  it('trigger press function correctly', () => {
15
47
  const pressFn = jest.fn();
16
48
  const wrapper = renderWithTheme(
17
49
  <Checkbox testID="checkbox" onPress={pressFn} />
18
50
  );
19
- fireEvent.press(wrapper.getByTestId('checkbox'));
20
51
 
21
- expect(wrapper.toJSON()).toMatchSnapshot();
52
+ fireEvent.press(wrapper.getByTestId('checkbox'));
22
53
  expect(pressFn).toBeCalled();
23
54
  });
24
55
  });
@@ -1,14 +1,25 @@
1
1
  import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import theme from '../../theme';
4
- import Icon from '../Icon';
5
- import { StyledWrapper } from './StyledCheckbox';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ import {
4
+ StyledCheckbox,
5
+ StyledCheckMark,
6
+ StyledDescription,
7
+ StyledWrapper,
8
+ } from './StyledCheckbox';
6
9
 
7
10
  export interface CheckboxProps {
8
11
  /**
9
12
  * Control whether the switch is checked
10
13
  */
11
14
  checked?: boolean;
15
+ /**
16
+ * Checkbox's description.
17
+ */
18
+ description?: string;
19
+ /**
20
+ * Whether the border is shown.
21
+ */
22
+ withBorder?: boolean;
12
23
  /**
13
24
  * Whether the switch is disabled
14
25
  */
@@ -27,9 +38,11 @@ export interface CheckboxProps {
27
38
  testID?: string;
28
39
  }
29
40
 
30
- const CheckBox = ({
41
+ const Checkbox = ({
31
42
  checked,
32
- disabled,
43
+ description,
44
+ withBorder = false,
45
+ disabled = false,
33
46
  onPress,
34
47
  style,
35
48
  testID,
@@ -37,22 +50,26 @@ const CheckBox = ({
37
50
  <StyledWrapper
38
51
  onPress={onPress}
39
52
  disabled={disabled}
53
+ themeDisabled={disabled}
54
+ themeWithBorder={withBorder}
40
55
  style={style}
41
56
  testID={testID}
42
57
  >
43
- {checked && (
44
- <Icon
45
- icon="circle-ok"
46
- intent="primary"
47
- size="large"
48
- style={{
49
- position: 'absolute',
50
- top: theme.__hd__.checkbox.space.iconTop,
51
- ...(disabled ? { color: theme.__hd__.checkbox.colors.disabled } : {}),
52
- }}
53
- />
58
+ {!!description && (
59
+ <StyledDescription intent={disabled ? 'subdued' : 'body'}>
60
+ {description}
61
+ </StyledDescription>
54
62
  )}
63
+ <StyledCheckbox themeDisabled={disabled}>
64
+ {checked && (
65
+ <StyledCheckMark
66
+ icon="box-check"
67
+ intent={disabled ? 'disabled-text' : 'text'}
68
+ testID="check-mark"
69
+ />
70
+ )}
71
+ </StyledCheckbox>
55
72
  </StyledWrapper>
56
73
  );
57
74
 
58
- export default CheckBox;
75
+ export default Checkbox;
@@ -1,11 +1,7 @@
1
- import {
2
- Animated,
3
- Easing,
4
- StyleProp,
5
- ViewProps,
6
- ViewStyle,
7
- } from 'react-native';
8
- import React, { ReactNode, useCallback, useEffect } from 'react';
1
+ import { Animated, Easing } from 'react-native';
2
+ import React, { useCallback, useEffect } from 'react';
3
+ import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
4
+ import type { ReactNode } from 'react';
9
5
  import {
10
6
  StyledChildWrapper,
11
7
  StyledHiddenWrapper,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import { Value, Wrapper } from './StyledContentNavigator';
4
4
  import Button from '../Button';
5
5
 
@@ -4,7 +4,7 @@ import { TouchableOpacity, View } from 'react-native';
4
4
  import formatDate from 'date-fns/fp/format';
5
5
 
6
6
  import TextInput from '../TextInput';
7
- import { DatePickerProps } from './types';
7
+ import type { DatePickerProps } from './types';
8
8
 
9
9
  const DatePickerAndroid = ({
10
10
  value,
@@ -7,7 +7,7 @@ import BottomSheet from '../BottomSheet';
7
7
  import TextInput from '../TextInput';
8
8
  import Typography from '../Typography';
9
9
  import { StyledPickerWrapper } from './StyledDatePicker';
10
- import { DatePickerProps } from './types';
10
+ import type { DatePickerProps } from './types';
11
11
 
12
12
  const DatePickerIOS = ({
13
13
  value,
@@ -1,5 +1,6 @@
1
1
  import styled from '@emotion/native';
2
- import { View, ViewProps } from 'react-native';
2
+ import { View } from 'react-native';
3
+ import type { ViewProps } from 'react-native';
3
4
 
4
5
  const StyledPickerWrapper = styled(View)<ViewProps>(({ theme }) => ({
5
6
  height: theme.__hd__.datePicker.sizes.height,
@@ -1,7 +1,6 @@
1
1
  import { fireEvent } from '@testing-library/react-native';
2
2
  import React from 'react';
3
- import { ModalProps } from 'react-native';
4
-
3
+ import type { ModalProps } from 'react-native';
5
4
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
6
5
  import DatePickerIOS from '../DatePickerIOS';
7
6
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Platform } from 'react-native';
3
3
  import DatePickerAndroid from './DatePickerAndroid';
4
4
  import DatePickerIOS from './DatePickerIOS';
5
- import { DatePickerProps } from './types';
5
+ import type { DatePickerProps } from './types';
6
6
 
7
7
  const DatePicker = (props: DatePickerProps) => {
8
8
  if (Platform.OS === 'ios') {
@@ -1,4 +1,4 @@
1
- import { StyleProp, ViewStyle } from 'react-native';
1
+ import type { StyleProp, ViewStyle } from 'react-native';
2
2
 
3
3
  export interface DatePickerProps {
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
+ import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
3
3
  import { StyledDivider } from './StyledDivider';
4
4
 
5
5
  interface DividerProps extends ViewProps {
@@ -1,6 +1,7 @@
1
- import React, { ReactNode, useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
2
  import { Animated, PanResponder, Easing } from 'react-native';
3
3
 
4
+ import type { ReactNode } from 'react';
4
5
  import {
5
6
  StyledDragableContainer,
6
7
  StyledDragableDrawerContainer,
@@ -11,8 +12,8 @@ import {
11
12
  calculateAnimatedToValue,
12
13
  calculateSnapPointsData,
13
14
  getOffset,
14
- SnapPointsData,
15
15
  } from './helpers';
16
+ import type { SnapPointsData } from './helpers';
16
17
 
17
18
  export interface DragableDrawerProps {
18
19
  /**
@@ -1,6 +1,7 @@
1
1
  import styled from '@emotion/native';
2
- import { ComponentProps } from 'react';
3
- import { Animated, Pressable, StyleSheet, View, ViewProps } from 'react-native';
2
+ import { Animated, Pressable, StyleSheet, View } from 'react-native';
3
+ import type { ComponentProps } from 'react';
4
+ import type { ViewProps } from 'react-native';
4
5
 
5
6
  const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
6
7
 
@@ -1,5 +1,6 @@
1
- import React, { ReactNode, useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
2
  import { Animated, Easing } from 'react-native';
3
+ import type { ReactNode } from 'react';
3
4
  import DragableDrawer from './DragableDrawer';
4
5
 
5
6
  import {
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
-
2
+ import type { StyleProp, ViewStyle } from 'react-native';
4
3
  import {
5
4
  StyledWrapper,
6
5
  StyledIllustration,
@@ -1,5 +1,6 @@
1
- import React, { ComponentProps } from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
1
+ import React from 'react';
2
+ import type { ComponentProps } from 'react';
3
+ import type { StyleProp, ViewStyle } from 'react-native';
3
4
  import Icon from '../../Icon';
4
5
  import {
5
6
  StyledActionItem,
@@ -1,9 +1,10 @@
1
- import { ComponentProps } from 'react';
2
- import { Animated, View, ViewProps } from 'react-native';
1
+ import { Animated, View } from 'react-native';
3
2
  import styled from '@emotion/native';
3
+ import type { ComponentProps } from 'react';
4
+ import type { ViewProps } from 'react-native';
4
5
  import FAB from '../FAB';
5
6
  import Typography from '../../Typography';
6
- import { TextProps } from '../../Typography/Text';
7
+ import type { TextProps } from '../../Typography/Text';
7
8
 
8
9
  const StyledContainer = styled(View)<ViewProps>({
9
10
  position: 'absolute',