@hero-design/rn 7.23.0 → 7.25.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 (276) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/assets/fonts/hero-icons.ttf +0 -0
  3. package/es/index.js +1364 -9239
  4. package/lib/assets/fonts/hero-icons.ttf +0 -0
  5. package/lib/index.js +1368 -9238
  6. package/package.json +7 -4
  7. package/rollup.config.js +1 -0
  8. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +4 -4
  9. package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  10. package/src/components/Attachment/StyledAttachment.tsx +44 -0
  11. package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +158 -0
  12. package/src/components/Attachment/__tests__/index.spec.tsx +59 -0
  13. package/src/components/Attachment/index.tsx +77 -0
  14. package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -3
  15. package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  16. package/src/components/Badge/Status.tsx +1 -1
  17. package/src/components/Badge/StyledBadge.tsx +8 -1
  18. package/src/components/Badge/__tests__/Badge.spec.tsx +9 -0
  19. package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +44 -0
  20. package/src/components/Badge/index.tsx +1 -1
  21. package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  22. package/src/components/BottomSheet/Header.tsx +2 -1
  23. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +52 -52
  24. package/src/components/BottomSheet/index.tsx +4 -4
  25. package/src/components/Button/Button.tsx +0 -11
  26. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +4 -4
  27. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  28. package/src/components/Button/LoadingIndicator/index.tsx +1 -1
  29. package/src/components/Button/StyledButton.tsx +24 -63
  30. package/src/components/Button/UtilityButton/__tests__/index.spec.tsx +2 -2
  31. package/src/components/Button/__tests__/Button.spec.tsx +10 -5
  32. package/src/components/Button/__tests__/StyledButton.spec.tsx +0 -70
  33. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +301 -1206
  34. package/src/components/Calendar/CalendarRowItem.tsx +1 -4
  35. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +5 -5
  36. package/src/components/Calendar/index.tsx +4 -3
  37. package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +1 -1
  38. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
  39. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  40. package/src/components/Checkbox/StyledCheckbox.tsx +7 -5
  41. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -12
  42. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +95 -42
  43. package/src/components/Checkbox/index.tsx +4 -2
  44. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  45. package/src/components/ContentNavigator/index.tsx +14 -9
  46. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +2 -0
  47. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +29 -27
  48. package/src/components/Drawer/DragableDrawer/index.tsx +0 -2
  49. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  50. package/src/components/Empty/index.tsx +1 -2
  51. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  52. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +1 -1
  53. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  54. package/src/components/Icon/HeroIcon/fonts/hero-icons.ttf +0 -0
  55. package/src/components/Icon/HeroIcon/glyphMap.json +1 -0
  56. package/src/components/Icon/HeroIcon/index.tsx +3 -7
  57. package/src/components/Icon/IconList.ts +36 -6
  58. package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  59. package/src/components/Icon/index.tsx +1 -0
  60. package/src/components/List/BasicListItem.tsx +13 -8
  61. package/src/components/List/ListItem.tsx +8 -6
  62. package/src/components/List/StyledBasicListItem.tsx +2 -2
  63. package/src/components/List/StyledListItem.tsx +2 -2
  64. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +24 -36
  65. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +39 -59
  66. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +40 -44
  67. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +50 -50
  68. package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +6 -6
  69. package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +21 -21
  70. package/src/components/Progress/ProgressBar.tsx +1 -1
  71. package/src/components/Progress/ProgressCircle.tsx +1 -1
  72. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +10 -10
  73. package/src/components/Progress/types.ts +7 -1
  74. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +20 -32
  75. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +30 -48
  76. package/src/components/RefreshControl/__tests__/index.spec.tsx +1 -3
  77. package/src/components/RefreshControl/index.tsx +4 -2
  78. package/src/components/RichTextEditor/MentionList.tsx +12 -3
  79. package/src/components/RichTextEditor/RichTextEditor.tsx +4 -8
  80. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +6 -4
  81. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  82. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +13 -20
  83. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +154 -238
  84. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +435 -650
  85. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +11 -18
  86. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +144 -228
  87. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +414 -629
  88. package/src/components/Select/StyledOptionList.tsx +0 -1
  89. package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +1 -1
  90. package/src/components/Spinner/AnimatedSpinner.tsx +22 -7
  91. package/src/components/Spinner/StyledSpinner.tsx +15 -11
  92. package/src/components/Spinner/__tests__/AnimatedSpinner.spec.tsx +3 -1
  93. package/src/components/Spinner/__tests__/StyledSpinner.spec.tsx +42 -31
  94. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +12 -8
  95. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +543 -83
  96. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +12 -8
  97. package/src/components/Spinner/index.tsx +6 -1
  98. package/src/components/Swipeable/StyledSwipeable.tsx +11 -0
  99. package/src/components/Swipeable/SwipeableAction.tsx +45 -0
  100. package/src/components/Swipeable/__tests__/SwipeableAction.spec.tsx +37 -0
  101. package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +130 -0
  102. package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +33 -0
  103. package/src/components/Swipeable/__tests__/index.spec.tsx +34 -0
  104. package/src/components/Swipeable/index.tsx +160 -0
  105. package/src/components/Switch/SelectorSwitch/Option.tsx +1 -5
  106. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +3 -3
  107. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  108. package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +1 -0
  109. package/src/components/Switch/SelectorSwitch/index.tsx +4 -1
  110. package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +1 -1
  111. package/src/components/Tabs/StyledTabs.tsx +1 -1
  112. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +1 -1
  113. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
  114. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +2 -2
  115. package/src/components/TextInput/StyledTextInput.tsx +7 -12
  116. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +12 -6
  117. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +31 -146
  118. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +40 -14
  119. package/src/components/TextInput/__tests__/index.spec.tsx +114 -124
  120. package/src/components/TextInput/index.tsx +8 -6
  121. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +2 -0
  122. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +29 -27
  123. package/src/components/Toast/Toast.tsx +0 -3
  124. package/src/components/Toast/ToastProvider.tsx +1 -0
  125. package/src/components/Toast/__tests__/index.spec.tsx +1 -1
  126. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -12
  127. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +6 -6
  128. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +4 -4
  129. package/src/emotion.d.ts +1 -0
  130. package/src/index.ts +10 -0
  131. package/src/theme/ThemeSwitcher.tsx +7 -1
  132. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +96 -78
  133. package/src/theme/__tests__/ensureCompatibleWithV7.spec.tsx +13 -0
  134. package/src/theme/components/alert.ts +1 -1
  135. package/src/theme/components/attachment.ts +28 -0
  136. package/src/theme/components/avatar.ts +1 -1
  137. package/src/theme/components/badge.ts +2 -1
  138. package/src/theme/components/bottomNavigation.ts +1 -1
  139. package/src/theme/components/bottomSheet.ts +2 -2
  140. package/src/theme/components/button.ts +4 -20
  141. package/src/theme/components/calendar.ts +3 -3
  142. package/src/theme/components/card.ts +1 -1
  143. package/src/theme/components/checkbox.ts +2 -2
  144. package/src/theme/components/divider.ts +1 -1
  145. package/src/theme/components/drawer.ts +2 -2
  146. package/src/theme/components/empty.ts +3 -3
  147. package/src/theme/components/fab.ts +7 -7
  148. package/src/theme/components/icon.ts +4 -4
  149. package/src/theme/components/list.ts +0 -2
  150. package/src/theme/components/pinInput.ts +4 -4
  151. package/src/theme/components/progress.ts +6 -5
  152. package/src/theme/components/radio.ts +1 -1
  153. package/src/theme/components/richTextEditor.ts +2 -2
  154. package/src/theme/components/slider.ts +2 -2
  155. package/src/theme/components/spinner.ts +4 -1
  156. package/src/theme/components/swipeable.ts +13 -0
  157. package/src/theme/components/switch.ts +4 -4
  158. package/src/theme/components/tabs.ts +6 -5
  159. package/src/theme/components/tag.ts +2 -2
  160. package/src/theme/components/textInput.ts +23 -33
  161. package/src/theme/components/toast.ts +3 -3
  162. package/src/theme/components/toolbar.ts +3 -3
  163. package/src/theme/components/typography.ts +7 -7
  164. package/src/theme/getTheme.ts +7 -1
  165. package/src/theme/global/colors/eBens.ts +23 -0
  166. package/src/theme/global/colors/global.ts +15 -6
  167. package/src/theme/global/colors/jobs.ts +15 -10
  168. package/src/theme/global/colors/legacySystemPalette.ts +6 -6
  169. package/src/theme/global/colors/swag.ts +32 -53
  170. package/src/theme/global/colors/types.ts +35 -15
  171. package/src/theme/global/colors/wallet.ts +23 -0
  172. package/src/theme/global/colors/work.ts +15 -11
  173. package/src/theme/global/index.ts +4 -0
  174. package/src/theme/index.ts +4 -0
  175. package/src/types.ts +2 -0
  176. package/src/utils/functions.ts +2 -0
  177. package/src/utils/scale.ts +1 -1
  178. package/testUtils/setup.tsx +13 -0
  179. package/tsconfig.json +8 -2
  180. package/types/components/Accordion/StyledAccordion.d.ts +14 -14
  181. package/types/components/Alert/StyledAlert.d.ts +15 -15
  182. package/types/components/Attachment/StyledAttachment.d.ts +28 -0
  183. package/types/components/Attachment/index.d.ts +37 -0
  184. package/types/components/Avatar/StyledAvatar.d.ts +15 -15
  185. package/types/components/Avatar/index.d.ts +1 -1
  186. package/types/components/Badge/Status.d.ts +1 -1
  187. package/types/components/Badge/StyledBadge.d.ts +8 -8
  188. package/types/components/Badge/index.d.ts +1 -1
  189. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +21 -21
  190. package/types/components/BottomSheet/Header.d.ts +1 -1
  191. package/types/components/BottomSheet/StyledBottomSheet.d.ts +22 -22
  192. package/types/components/Box/StyledBox.d.ts +4 -4
  193. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +7 -7
  194. package/types/components/Button/StyledButton.d.ts +15 -18
  195. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +8 -8
  196. package/types/components/Calendar/StyledCalendar.d.ts +25 -25
  197. package/types/components/Calendar/helpers.d.ts +2 -2
  198. package/types/components/Card/DataCard/StyledDataCard.d.ts +6 -6
  199. package/types/components/Card/StyledCard.d.ts +7 -7
  200. package/types/components/Checkbox/StyledCheckbox.d.ts +16 -10
  201. package/types/components/Collapse/StyledCollapse.d.ts +8 -8
  202. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +5 -5
  203. package/types/components/ContentNavigator/index.d.ts +2 -1
  204. package/types/components/DatePicker/StyledDatePicker.d.ts +3 -3
  205. package/types/components/Divider/StyledDivider.d.ts +5 -5
  206. package/types/components/Drawer/StyledDrawer.d.ts +19 -19
  207. package/types/components/Empty/StyledEmpty.d.ts +9 -9
  208. package/types/components/Empty/index.d.ts +1 -2
  209. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +11 -11
  210. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +7 -7
  211. package/types/components/FAB/StyledFAB.d.ts +8 -8
  212. package/types/components/Icon/HeroIcon/index.d.ts +3 -3
  213. package/types/components/Icon/IconList.d.ts +1 -1
  214. package/types/components/Icon/index.d.ts +4 -1
  215. package/types/components/Icon/utils.d.ts +1 -1
  216. package/types/components/List/StyledBasicListItem.d.ts +16 -16
  217. package/types/components/List/StyledListItem.d.ts +25 -25
  218. package/types/components/PinInput/StyledPinInput.d.ts +30 -30
  219. package/types/components/Progress/ProgressBar.d.ts +1 -1
  220. package/types/components/Progress/ProgressCircle.d.ts +1 -1
  221. package/types/components/Progress/StyledProgressBar.d.ts +5 -5
  222. package/types/components/Progress/StyledProgressCircle.d.ts +18 -18
  223. package/types/components/Progress/types.d.ts +1 -1
  224. package/types/components/Radio/StyledRadio.d.ts +9 -9
  225. package/types/components/RefreshControl/index.d.ts +1 -2
  226. package/types/components/RichTextEditor/EditorToolbar.d.ts +1 -1
  227. package/types/components/RichTextEditor/MentionList.d.ts +1 -1
  228. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +6 -6
  229. package/types/components/RichTextEditor/StyledToolbar.d.ts +9 -9
  230. package/types/components/RichTextEditor/index.d.ts +2 -2
  231. package/types/components/SectionHeading/StyledHeading.d.ts +9 -9
  232. package/types/components/Select/MultiSelect/Option.d.ts +1 -1
  233. package/types/components/Select/SingleSelect/Option.d.ts +1 -1
  234. package/types/components/Select/StyledSelect.d.ts +11 -11
  235. package/types/components/Select/helpers.d.ts +1 -1
  236. package/types/components/Spinner/AnimatedSpinner.d.ts +2 -1
  237. package/types/components/Spinner/StyledSpinner.d.ts +13 -12
  238. package/types/components/Spinner/index.d.ts +5 -1
  239. package/types/components/Swipeable/StyledSwipeable.d.ts +10 -0
  240. package/types/components/Swipeable/SwipeableAction.d.ts +27 -0
  241. package/types/components/Swipeable/index.d.ts +45 -0
  242. package/types/components/Switch/SelectorSwitch/Option.d.ts +3 -1
  243. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +9 -9
  244. package/types/components/Switch/StyledSwitch.d.ts +5 -5
  245. package/types/components/Tabs/StyledScrollableTabs.d.ts +23 -23
  246. package/types/components/Tabs/StyledTabs.d.ts +22 -22
  247. package/types/components/Tag/StyledTag.d.ts +6 -6
  248. package/types/components/TextInput/StyledTextInput.d.ts +46 -45
  249. package/types/components/TextInput/index.d.ts +6 -6
  250. package/types/components/TimePicker/StyledTimePicker.d.ts +3 -3
  251. package/types/components/Toast/StyledToast.d.ts +17 -17
  252. package/types/components/Toolbar/StyledToolbar.d.ts +9 -9
  253. package/types/components/Typography/Text/StyledText.d.ts +3 -3
  254. package/types/index.d.ts +4 -2
  255. package/types/testHelpers/renderWithTheme.d.ts +1 -1
  256. package/types/theme/ThemeSwitcher.d.ts +2 -2
  257. package/types/theme/components/attachment.d.ts +21 -0
  258. package/types/theme/components/badge.d.ts +1 -0
  259. package/types/theme/components/button.d.ts +0 -15
  260. package/types/theme/components/list.d.ts +0 -1
  261. package/types/theme/components/progress.d.ts +1 -0
  262. package/types/theme/components/spinner.d.ts +4 -1
  263. package/types/theme/components/swipeable.d.ts +9 -0
  264. package/types/theme/components/tabs.d.ts +1 -0
  265. package/types/theme/components/tag.d.ts +2 -2
  266. package/types/theme/components/textInput.d.ts +0 -10
  267. package/types/theme/getTheme.d.ts +4 -0
  268. package/types/theme/global/colors/eBens.d.ts +3 -0
  269. package/types/theme/global/colors/types.d.ts +23 -16
  270. package/types/theme/global/colors/wallet.d.ts +3 -0
  271. package/types/theme/global/index.d.ts +26 -12
  272. package/types/theme/index.d.ts +2 -2
  273. package/types/types.d.ts +2 -1
  274. package/types/utils/functions.d.ts +1 -0
  275. package/types/utils/hooks.d.ts +1 -1
  276. package/src/components/Icon/HeroIcon/selection.json +0 -7029
@@ -56,15 +56,16 @@ exports[`Spinner renders correctly 1`] = `
56
56
  style={
57
57
  Array [
58
58
  Object {
59
- "backgroundColor": "#001f23",
59
+ "backgroundColor": "#401960",
60
60
  "borderRadius": 999,
61
61
  "height": 16,
62
- "opacity": 1,
62
+ "opacity": 0.9,
63
63
  "width": 16,
64
64
  },
65
65
  Object {},
66
66
  ]
67
67
  }
68
+ themeIntent="primary"
68
69
  themePosition="topLeft"
69
70
  themeSize="medium"
70
71
  />
@@ -74,16 +75,17 @@ exports[`Spinner renders correctly 1`] = `
74
75
  style={
75
76
  Array [
76
77
  Object {
77
- "backgroundColor": "#001f23",
78
+ "backgroundColor": "#401960",
78
79
  "borderRadius": 999,
79
80
  "height": 16,
80
81
  "marginLeft": 8,
81
- "opacity": 0.75,
82
+ "opacity": 0.675,
82
83
  "width": 16,
83
84
  },
84
85
  Object {},
85
86
  ]
86
87
  }
88
+ themeIntent="primary"
87
89
  themePosition="topRight"
88
90
  themeSize="medium"
89
91
  />
@@ -109,15 +111,16 @@ exports[`Spinner renders correctly 1`] = `
109
111
  style={
110
112
  Array [
111
113
  Object {
112
- "backgroundColor": "#001f23",
114
+ "backgroundColor": "#401960",
113
115
  "borderRadius": 999,
114
116
  "height": 16,
115
- "opacity": 0.5,
117
+ "opacity": 0.45,
116
118
  "width": 16,
117
119
  },
118
120
  Object {},
119
121
  ]
120
122
  }
123
+ themeIntent="primary"
121
124
  themePosition="bottomLeft"
122
125
  themeSize="medium"
123
126
  />
@@ -127,16 +130,17 @@ exports[`Spinner renders correctly 1`] = `
127
130
  style={
128
131
  Array [
129
132
  Object {
130
- "backgroundColor": "#001f23",
133
+ "backgroundColor": "#401960",
131
134
  "borderRadius": 999,
132
135
  "height": 16,
133
136
  "marginLeft": 8,
134
- "opacity": 0.25,
137
+ "opacity": 0.225,
135
138
  "width": 16,
136
139
  },
137
140
  Object {},
138
141
  ]
139
142
  }
143
+ themeIntent="primary"
140
144
  themePosition="bottomRight"
141
145
  themeSize="medium"
142
146
  />
@@ -9,6 +9,10 @@ interface SpinnerProps extends ViewProps {
9
9
  * Size of Spinner.
10
10
  */
11
11
  size?: 'small' | 'medium';
12
+ /**
13
+ * Spinner's variant.
14
+ */
15
+ intent?: 'primary' | 'inverted';
12
16
  /**
13
17
  * Testing id of the component.
14
18
  */
@@ -18,11 +22,12 @@ interface SpinnerProps extends ViewProps {
18
22
  const Spinner = ({
19
23
  testID,
20
24
  size = 'medium',
25
+ intent = 'primary',
21
26
  ...nativeProps
22
27
  }: SpinnerProps): ReactElement => (
23
28
  <StyledView {...nativeProps}>
24
29
  <StyledSpinnerContainer testID={testID}>
25
- <AnimatedSpinner size={size} />
30
+ <AnimatedSpinner size={size} intent={intent} />
26
31
  </StyledSpinnerContainer>
27
32
  </StyledView>
28
33
  );
@@ -0,0 +1,11 @@
1
+ import styled from '@emotion/native';
2
+ import { TouchableOpacity } from 'react-native';
3
+
4
+ export type ActionIntent = 'primary' | 'success' | 'danger';
5
+
6
+ export const StyledRectButton = styled(TouchableOpacity)<{
7
+ themeIntent: ActionIntent;
8
+ }>(({ theme, themeIntent }) => ({
9
+ flex: 1,
10
+ backgroundColor: theme.__hd__.swipeable.colors[themeIntent],
11
+ }));
@@ -0,0 +1,45 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { ActionIntent, StyledRectButton } from './StyledSwipeable';
4
+
5
+ export interface SwipeableActionProps {
6
+ /**
7
+ * Visual intent color applied to action.
8
+ */
9
+ intent?: ActionIntent;
10
+ /**
11
+ * Callback when the action button is pressed.
12
+ */
13
+ onPress?: () => void;
14
+ /**
15
+ * Action button's content
16
+ */
17
+ children?: ReactNode;
18
+ /**
19
+ * Additional style.
20
+ */
21
+ style?: StyleProp<ViewStyle>;
22
+ /**
23
+ * Testing id of the component.
24
+ */
25
+ testID?: string;
26
+ }
27
+
28
+ const SwipeableAction = ({
29
+ intent = 'primary',
30
+ onPress,
31
+ style,
32
+ children,
33
+ testID,
34
+ }: SwipeableActionProps) => (
35
+ <StyledRectButton
36
+ onPress={onPress}
37
+ themeIntent={intent}
38
+ style={style}
39
+ testID={testID}
40
+ >
41
+ {children}
42
+ </StyledRectButton>
43
+ );
44
+
45
+ export default SwipeableAction;
@@ -0,0 +1,37 @@
1
+ import { fireEvent } from '@testing-library/react-native';
2
+ import React from 'react';
3
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
4
+ import Typography from '../../Typography';
5
+ import SwipeableAction from '../SwipeableAction';
6
+
7
+ describe('rendering', () => {
8
+ it.each`
9
+ intent
10
+ ${'primary'}
11
+ ${'success'}
12
+ ${'danger'}
13
+ `('renders correctly when intent is $intent', ({ intent }) => {
14
+ const { toJSON, getByText } = renderWithTheme(
15
+ <SwipeableAction intent={intent}>
16
+ <Typography.Text>Action title</Typography.Text>
17
+ </SwipeableAction>
18
+ );
19
+
20
+ expect(getByText('Action title')).toBeDefined();
21
+ expect(toJSON()).toMatchSnapshot();
22
+ });
23
+ });
24
+
25
+ describe('behavior', () => {
26
+ it('calls onPress', () => {
27
+ const onPress = jest.fn();
28
+ const { getByText } = renderWithTheme(
29
+ <SwipeableAction onPress={onPress}>
30
+ <Typography.Text>Action title</Typography.Text>
31
+ </SwipeableAction>
32
+ );
33
+
34
+ fireEvent.press(getByText('Action title'));
35
+ expect(onPress).toBeCalledTimes(1);
36
+ });
37
+ });
@@ -0,0 +1,130 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`rendering renders correctly when intent is danger 1`] = `
4
+ <View
5
+ accessible={true}
6
+ collapsable={false}
7
+ focusable={false}
8
+ nativeID="animatedComponent"
9
+ onClick={[Function]}
10
+ onResponderGrant={[Function]}
11
+ onResponderMove={[Function]}
12
+ onResponderRelease={[Function]}
13
+ onResponderTerminate={[Function]}
14
+ onResponderTerminationRequest={[Function]}
15
+ onStartShouldSetResponder={[Function]}
16
+ style={
17
+ Object {
18
+ "backgroundColor": "#f46363",
19
+ "flex": 1,
20
+ "opacity": 1,
21
+ }
22
+ }
23
+ >
24
+ <Text
25
+ style={
26
+ Array [
27
+ Object {
28
+ "color": "#001f23",
29
+ "fontFamily": "BeVietnamPro-Regular",
30
+ "fontSize": 14,
31
+ "letterSpacing": 0.42,
32
+ "lineHeight": 22,
33
+ },
34
+ undefined,
35
+ ]
36
+ }
37
+ themeFontSize="medium"
38
+ themeFontWeight="regular"
39
+ themeIntent="body"
40
+ >
41
+ Action title
42
+ </Text>
43
+ </View>
44
+ `;
45
+
46
+ exports[`rendering renders correctly when intent is primary 1`] = `
47
+ <View
48
+ accessible={true}
49
+ collapsable={false}
50
+ focusable={false}
51
+ nativeID="animatedComponent"
52
+ onClick={[Function]}
53
+ onResponderGrant={[Function]}
54
+ onResponderMove={[Function]}
55
+ onResponderRelease={[Function]}
56
+ onResponderTerminate={[Function]}
57
+ onResponderTerminationRequest={[Function]}
58
+ onStartShouldSetResponder={[Function]}
59
+ style={
60
+ Object {
61
+ "backgroundColor": "#401960",
62
+ "flex": 1,
63
+ "opacity": 1,
64
+ }
65
+ }
66
+ >
67
+ <Text
68
+ style={
69
+ Array [
70
+ Object {
71
+ "color": "#001f23",
72
+ "fontFamily": "BeVietnamPro-Regular",
73
+ "fontSize": 14,
74
+ "letterSpacing": 0.42,
75
+ "lineHeight": 22,
76
+ },
77
+ undefined,
78
+ ]
79
+ }
80
+ themeFontSize="medium"
81
+ themeFontWeight="regular"
82
+ themeIntent="body"
83
+ >
84
+ Action title
85
+ </Text>
86
+ </View>
87
+ `;
88
+
89
+ exports[`rendering renders correctly when intent is success 1`] = `
90
+ <View
91
+ accessible={true}
92
+ collapsable={false}
93
+ focusable={false}
94
+ nativeID="animatedComponent"
95
+ onClick={[Function]}
96
+ onResponderGrant={[Function]}
97
+ onResponderMove={[Function]}
98
+ onResponderRelease={[Function]}
99
+ onResponderTerminate={[Function]}
100
+ onResponderTerminationRequest={[Function]}
101
+ onStartShouldSetResponder={[Function]}
102
+ style={
103
+ Object {
104
+ "backgroundColor": "#5ace7d",
105
+ "flex": 1,
106
+ "opacity": 1,
107
+ }
108
+ }
109
+ >
110
+ <Text
111
+ style={
112
+ Array [
113
+ Object {
114
+ "color": "#001f23",
115
+ "fontFamily": "BeVietnamPro-Regular",
116
+ "fontSize": 14,
117
+ "letterSpacing": 0.42,
118
+ "lineHeight": 22,
119
+ },
120
+ undefined,
121
+ ]
122
+ }
123
+ themeFontSize="medium"
124
+ themeFontWeight="regular"
125
+ themeIntent="body"
126
+ >
127
+ Action title
128
+ </Text>
129
+ </View>
130
+ `;
@@ -0,0 +1,33 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Swipeable renders correctly 1`] = `
4
+ <View>
5
+ <View
6
+ onSwipeableClose={[Function]}
7
+ onSwipeableLeftOpen={[Function]}
8
+ onSwipeableRightOpen={[Function]}
9
+ renderLeftActions={[Function]}
10
+ renderRightActions={[Function]}
11
+ >
12
+ <Text
13
+ style={
14
+ Array [
15
+ Object {
16
+ "color": "#001f23",
17
+ "fontFamily": "BeVietnamPro-Regular",
18
+ "fontSize": 14,
19
+ "letterSpacing": 0.42,
20
+ "lineHeight": 22,
21
+ },
22
+ undefined,
23
+ ]
24
+ }
25
+ themeFontSize="medium"
26
+ themeFontWeight="regular"
27
+ themeIntent="body"
28
+ >
29
+ Swipeable Item
30
+ </Text>
31
+ </View>
32
+ </View>
33
+ `;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import Typography from '../../Typography';
4
+ import Swipeable from '..';
5
+
6
+ describe('Swipeable', () => {
7
+ it('renders correctly', () => {
8
+ const { toJSON, getByText } = renderWithTheme(
9
+ <Swipeable
10
+ leftActions={
11
+ <Swipeable.Action intent="primary">
12
+ <Typography.Text intent="inverted">Archived</Typography.Text>
13
+ </Swipeable.Action>
14
+ }
15
+ rightActions={
16
+ <>
17
+ <Swipeable.Action intent="success">
18
+ <Typography.Text>Approve</Typography.Text>
19
+ </Swipeable.Action>
20
+ <Swipeable.Action intent="danger">
21
+ <Typography.Text>Decline</Typography.Text>
22
+ </Swipeable.Action>
23
+ </>
24
+ }
25
+ rightActionsWidth={168}
26
+ >
27
+ <Typography.Text>Swipeable Item</Typography.Text>
28
+ </Swipeable>
29
+ );
30
+
31
+ expect(getByText('Swipeable Item')).toBeDefined();
32
+ expect(toJSON()).toMatchSnapshot();
33
+ });
34
+ });
@@ -0,0 +1,160 @@
1
+ import React, {
2
+ ComponentProps,
3
+ ReactNode,
4
+ useCallback,
5
+ useEffect,
6
+ useRef,
7
+ } from 'react';
8
+ import { Animated, useWindowDimensions } from 'react-native';
9
+ import {
10
+ Swipeable as RnghSwipeable,
11
+ GestureHandlerRootView,
12
+ RectButton,
13
+ } from 'react-native-gesture-handler';
14
+ import SwipeableAction from './SwipeableAction';
15
+
16
+ type State = 'closed' | 'leftOpen' | 'rightOpen';
17
+ // We are supporting both v1 and v2 of RNGH at the same time.
18
+ // SwipeableProps is only exported in v2, so we have to use ComponentProps.
19
+ type RnghSwipeableProps = ComponentProps<typeof RnghSwipeable>;
20
+ export interface SwipeableProps
21
+ extends Pick<
22
+ RnghSwipeableProps,
23
+ | 'enableTrackpadTwoFingerGesture'
24
+ | 'friction'
25
+ | 'leftThreshold'
26
+ | 'rightThreshold'
27
+ | 'overshootLeft'
28
+ | 'overshootRight'
29
+ | 'overshootFriction'
30
+ | 'useNativeAnimations'
31
+ | 'containerStyle'
32
+ | 'childrenContainerStyle'
33
+ > {
34
+ /**
35
+ * React node that is swipeable.
36
+ */
37
+ children: ReactNode;
38
+ /**
39
+ * State of the component.
40
+ */
41
+ state?: 'closed' | 'leftOpen' | 'rightOpen';
42
+ /**
43
+ * Callback when the state of the component changes.
44
+ */
45
+ onStateChange?: (state: State) => void;
46
+ /**
47
+ * Action panel that is going to be revealed from the left side when user swipes right.
48
+ */
49
+ leftActions?: ReactNode;
50
+ /**
51
+ * Width of the left action panel.
52
+ * By default, it will take up the whole width of the device.
53
+ */
54
+ leftActionsWidth?: number;
55
+ /**
56
+ * Action panel that is going to be revealed from the right side when user swipes left.
57
+ */
58
+ rightActions?: ReactNode;
59
+ /**
60
+ * Width of the right action panel.
61
+ * By default, it will take up the whole width of the device.
62
+ */
63
+ rightActionsWidth?: number;
64
+ /**
65
+ * Testing ID of the component
66
+ */
67
+ testID?: string;
68
+ }
69
+
70
+ const renderActions = (
71
+ actions: ReactNode,
72
+ width: number,
73
+ progress: Animated.AnimatedInterpolation,
74
+ direction: 'left' | 'right'
75
+ ) => {
76
+ const trans = progress.interpolate({
77
+ inputRange: [0, 1],
78
+ outputRange: direction === 'left' ? [-width, 0] : [width, 0],
79
+ extrapolate: 'clamp',
80
+ });
81
+
82
+ return (
83
+ <Animated.View
84
+ style={{
85
+ width,
86
+ flexDirection: 'row',
87
+ transform: [{ translateX: trans }],
88
+ }}
89
+ >
90
+ {actions}
91
+ </Animated.View>
92
+ );
93
+ };
94
+
95
+ const Swipeable = ({
96
+ children,
97
+ state,
98
+ onStateChange,
99
+ leftActions,
100
+ leftActionsWidth,
101
+ rightActions,
102
+ rightActionsWidth,
103
+ ...swipeableProps
104
+ }: SwipeableProps) => {
105
+ const { width } = useWindowDimensions();
106
+ const swipeableRef = useRef<RnghSwipeable>(null);
107
+
108
+ const renderLeftActions = useCallback(
109
+ (progress: Animated.AnimatedInterpolation) =>
110
+ renderActions(leftActions, leftActionsWidth || width, progress, 'left'),
111
+ [leftActions, leftActionsWidth, width]
112
+ );
113
+ const renderRightActions = useCallback(
114
+ (progress: Animated.AnimatedInterpolation) =>
115
+ renderActions(
116
+ rightActions,
117
+ rightActionsWidth || width,
118
+ progress,
119
+ 'right'
120
+ ),
121
+ [rightActions, rightActionsWidth, width]
122
+ );
123
+
124
+ useEffect(() => {
125
+ if (swipeableRef.current === null) return;
126
+
127
+ switch (state) {
128
+ case 'leftOpen':
129
+ swipeableRef.current.openLeft();
130
+ break;
131
+ case 'rightOpen':
132
+ swipeableRef.current.openRight();
133
+ break;
134
+ case 'closed':
135
+ swipeableRef.current.close();
136
+ break;
137
+ }
138
+ }, [state]);
139
+
140
+ return (
141
+ <GestureHandlerRootView>
142
+ <RnghSwipeable
143
+ {...swipeableProps}
144
+ ref={swipeableRef}
145
+ {...(leftActions !== undefined && { renderLeftActions })}
146
+ {...(rightActions !== undefined && { renderRightActions })}
147
+ onSwipeableLeftOpen={() => onStateChange?.('leftOpen')}
148
+ onSwipeableRightOpen={() => onStateChange?.('rightOpen')}
149
+ onSwipeableClose={() => onStateChange?.('closed')}
150
+ >
151
+ {children}
152
+ </RnghSwipeable>
153
+ </GestureHandlerRootView>
154
+ );
155
+ };
156
+
157
+ export default Object.assign(Swipeable, {
158
+ Action: SwipeableAction,
159
+ Content: RectButton,
160
+ });
@@ -46,11 +46,7 @@ const Option = <T,>({
46
46
  return (
47
47
  <StyledTextWrapper>
48
48
  <OptionContent
49
- content={
50
- <Typography.Text fontSize="large" intent="inverted">
51
- {text}
52
- </Typography.Text>
53
- }
49
+ content={<Typography.Text fontSize="large">{text}</Typography.Text>}
54
50
  badge={badge}
55
51
  />
56
52
  </StyledTextWrapper>
@@ -67,7 +67,7 @@ exports[`Option renders correctly when selected 1`] = `
67
67
  Array [
68
68
  Object {
69
69
  "alignItems": "center",
70
- "backgroundColor": "#401960",
70
+ "backgroundColor": "#ffffff",
71
71
  "borderRadius": 999,
72
72
  "flex": 1,
73
73
  "justifyContent": "center",
@@ -88,7 +88,7 @@ exports[`Option renders correctly when selected 1`] = `
88
88
  style={
89
89
  Array [
90
90
  Object {
91
- "color": "#ffffff",
91
+ "color": "#001f23",
92
92
  "fontFamily": "BeVietnamPro-Regular",
93
93
  "fontSize": 16,
94
94
  "letterSpacing": 0.48,
@@ -99,7 +99,7 @@ exports[`Option renders correctly when selected 1`] = `
99
99
  }
100
100
  themeFontSize="large"
101
101
  themeFontWeight="regular"
102
- themeIntent="inverted"
102
+ themeIntent="body"
103
103
  >
104
104
  My Dashboard
105
105
  </Text>
@@ -30,7 +30,7 @@ exports[`SelectorSwitch renders correctly 1`] = `
30
30
  Array [
31
31
  Object {
32
32
  "alignItems": "center",
33
- "backgroundColor": "#401960",
33
+ "backgroundColor": "#ffffff",
34
34
  "borderRadius": 999,
35
35
  "flex": 1,
36
36
  "justifyContent": "center",
@@ -43,7 +43,7 @@ exports[`SelectorSwitch renders correctly 1`] = `
43
43
  style={
44
44
  Array [
45
45
  Object {
46
- "color": "#ffffff",
46
+ "color": "#001f23",
47
47
  "fontFamily": "BeVietnamPro-Regular",
48
48
  "fontSize": 16,
49
49
  "letterSpacing": 0.48,
@@ -54,7 +54,7 @@ exports[`SelectorSwitch renders correctly 1`] = `
54
54
  }
55
55
  themeFontSize="large"
56
56
  themeFontWeight="regular"
57
- themeIntent="inverted"
57
+ themeIntent="body"
58
58
  >
59
59
  My Dashboard
60
60
  </Text>
@@ -23,6 +23,7 @@ describe('SelectorSwitch', () => {
23
23
  },
24
24
  ]}
25
25
  value="employee"
26
+ onPress={jest.fn()}
26
27
  />
27
28
  );
28
29
 
@@ -47,7 +47,10 @@ const SelectorSwitch = <T,>({
47
47
  style,
48
48
  testID,
49
49
  }: SelectorSwitchProps<T>): ReactElement => (
50
- <TouchableWithoutFeedback onPress={() => onPress(value)} testID={testID}>
50
+ <TouchableWithoutFeedback
51
+ onPress={onPress !== undefined ? () => onPress(value) : undefined}
52
+ testID={testID}
53
+ >
51
54
  <StyledWrapper style={style}>
52
55
  {options.map((opt, index) => (
53
56
  // eslint-disable-next-line react/no-array-index-key
@@ -42,7 +42,7 @@ exports[`StyledWrapper renders correct style with variant disabled-checked 1`] =
42
42
  style={
43
43
  Array [
44
44
  Object {
45
- "backgroundColor": "#a08cb0",
45
+ "backgroundColor": "#ece8ef",
46
46
  "borderRadius": 999,
47
47
  "display": "flex",
48
48
  "height": 32,
@@ -39,7 +39,7 @@ const StyledIndicator = styled(Animated.View)<{ themeWidth: number }>(
39
39
  ({ theme, themeWidth }) => ({
40
40
  width: themeWidth,
41
41
  height: theme.__hd__.tabs.sizes.indicator,
42
- backgroundColor: theme.__hd__.tabs.colors.text,
42
+ backgroundColor: theme.__hd__.tabs.colors.indicator,
43
43
  position: 'absolute',
44
44
  bottom: 0,
45
45
  })
@@ -239,7 +239,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
239
239
  nativeID="animatedComponent"
240
240
  style={
241
241
  Object {
242
- "backgroundColor": "#e6e9e9",
242
+ "backgroundColor": "#ccd2d3",
243
243
  "borderRadius": 8,
244
244
  "flex": 1,
245
245
  "transform": Array [
@@ -405,7 +405,7 @@ exports[`Tabs renders correctly 1`] = `
405
405
  nativeID="animatedComponent"
406
406
  style={
407
407
  Object {
408
- "backgroundColor": "#001f23",
408
+ "backgroundColor": "#401960",
409
409
  "bottom": 0,
410
410
  "height": 2,
411
411
  "position": "absolute",