@hero-design/rn 8.23.0 → 8.24.0-alpha.1

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 (300) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/.turbo/turbo-build:types.log +2 -0
  3. package/.turbo/turbo-lint.log +146 -0
  4. package/.turbo/turbo-publish:npm.log +9 -0
  5. package/.turbo/turbo-test.log +451 -0
  6. package/.turbo/turbo-type-check.log +1 -0
  7. package/es/index.js +289 -101
  8. package/lib/index.js +289 -101
  9. package/package.json +1 -1
  10. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +21 -9
  11. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +7 -3
  12. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +7 -3
  13. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +7 -3
  14. package/src/components/RichTextEditor/RichTextEditor.tsx +10 -7
  15. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +10 -8
  16. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +37 -16
  17. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +37 -16
  18. package/src/components/Tabs/ScrollableTabs.tsx +10 -149
  19. package/src/components/Tabs/ScrollableTabsHeader.tsx +214 -0
  20. package/src/components/Tabs/ScrollableTabsV2/SceneView.tsx +61 -0
  21. package/src/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.tsx +120 -0
  22. package/src/components/Tabs/ScrollableTabsV2/__tests__/SceneView.spec.tsx +76 -0
  23. package/src/components/Tabs/ScrollableTabsV2/__tests__/ScrollableTabsV2.spec.tsx +166 -0
  24. package/src/components/Tabs/ScrollableTabsV2/__tests__/__snapshots__/SceneView.spec.tsx.snap +161 -0
  25. package/src/components/Tabs/ScrollableTabsV2/__tests__/__snapshots__/ScrollableTabsV2.spec.tsx.snap +2497 -0
  26. package/src/components/Tabs/ScrollableTabsV2/index.tsx +5 -0
  27. package/src/components/Tabs/__tests__/ScrollableTabsHeader.spec.tsx +80 -0
  28. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +587 -0
  29. package/src/components/Tabs/index.tsx +2 -0
  30. package/src/components/TextInput/StyledTextInput.tsx +40 -29
  31. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +48 -57
  32. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +84 -58
  33. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +326 -74
  34. package/src/components/TextInput/__tests__/index.spec.tsx +16 -4
  35. package/src/components/TextInput/index.tsx +25 -15
  36. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +14 -6
  37. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +14 -6
  38. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +8 -3
  39. package/src/theme/components/textInput.ts +10 -4
  40. package/testUtils/setup.tsx +6 -0
  41. package/types/components/Accordion/AccordionItem.d.ts +0 -0
  42. package/types/components/Accordion/StyledAccordion.d.ts +0 -0
  43. package/types/components/Accordion/index.d.ts +0 -0
  44. package/types/components/Alert/StyledAlert.d.ts +0 -0
  45. package/types/components/Alert/index.d.ts +0 -0
  46. package/types/components/Attachment/StyledAttachment.d.ts +0 -0
  47. package/types/components/Attachment/index.d.ts +0 -0
  48. package/types/components/Avatar/Avatar.d.ts +0 -0
  49. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -0
  50. package/types/components/Avatar/AvatarStack/index.d.ts +0 -0
  51. package/types/components/Avatar/AvatarStack/utils.d.ts +0 -0
  52. package/types/components/Avatar/StyledAvatar.d.ts +0 -0
  53. package/types/components/Avatar/index.d.ts +0 -0
  54. package/types/components/Badge/Status.d.ts +0 -0
  55. package/types/components/Badge/StyledBadge.d.ts +0 -0
  56. package/types/components/Badge/index.d.ts +0 -0
  57. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
  58. package/types/components/BottomNavigation/index.d.ts +0 -0
  59. package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -0
  60. package/types/components/BottomSheet/Footer.d.ts +0 -0
  61. package/types/components/BottomSheet/Header.d.ts +0 -0
  62. package/types/components/BottomSheet/ScrollView.d.ts +0 -0
  63. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
  64. package/types/components/BottomSheet/index.d.ts +0 -0
  65. package/types/components/Box/StyledBox.d.ts +0 -0
  66. package/types/components/Box/config.d.ts +0 -0
  67. package/types/components/Box/index.d.ts +0 -0
  68. package/types/components/Box/types.d.ts +0 -0
  69. package/types/components/Button/Button.d.ts +0 -0
  70. package/types/components/Button/IconButton.d.ts +0 -0
  71. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
  72. package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
  73. package/types/components/Button/StyledButton.d.ts +0 -0
  74. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -0
  75. package/types/components/Button/UtilityButton/index.d.ts +0 -0
  76. package/types/components/Button/index.d.ts +0 -0
  77. package/types/components/Calendar/CalendarRowItem.d.ts +0 -0
  78. package/types/components/Calendar/StyledCalendar.d.ts +0 -0
  79. package/types/components/Calendar/helpers.d.ts +0 -0
  80. package/types/components/Calendar/index.d.ts +0 -0
  81. package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
  82. package/types/components/Card/DataCard/index.d.ts +0 -0
  83. package/types/components/Card/StyledCard.d.ts +0 -0
  84. package/types/components/Card/index.d.ts +0 -0
  85. package/types/components/Carousel/CardCarousel.d.ts +0 -0
  86. package/types/components/Carousel/CarouselItem.d.ts +0 -0
  87. package/types/components/Carousel/StyledCardCarousel.d.ts +0 -0
  88. package/types/components/Carousel/StyledCarousel.d.ts +0 -0
  89. package/types/components/Carousel/contants.d.ts +0 -0
  90. package/types/components/Carousel/index.d.ts +0 -0
  91. package/types/components/Carousel/types.d.ts +0 -0
  92. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
  93. package/types/components/Checkbox/index.d.ts +0 -0
  94. package/types/components/Collapse/StyledCollapse.d.ts +0 -0
  95. package/types/components/Collapse/index.d.ts +0 -0
  96. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
  97. package/types/components/ContentNavigator/index.d.ts +0 -0
  98. package/types/components/DatePicker/DatePickerAndroid.d.ts +0 -0
  99. package/types/components/DatePicker/DatePickerCalendar.d.ts +0 -0
  100. package/types/components/DatePicker/DatePickerIOS.d.ts +0 -0
  101. package/types/components/DatePicker/StyledDatePicker.d.ts +0 -0
  102. package/types/components/DatePicker/index.d.ts +0 -0
  103. package/types/components/DatePicker/types.d.ts +0 -0
  104. package/types/components/Divider/StyledDivider.d.ts +0 -0
  105. package/types/components/Divider/index.d.ts +0 -0
  106. package/types/components/Drawer/DragableDrawer/helpers.d.ts +0 -0
  107. package/types/components/Drawer/DragableDrawer/index.d.ts +0 -0
  108. package/types/components/Drawer/StyledDrawer.d.ts +0 -0
  109. package/types/components/Drawer/index.d.ts +0 -0
  110. package/types/components/Empty/StyledEmpty.d.ts +0 -0
  111. package/types/components/Empty/index.d.ts +0 -0
  112. package/types/components/Error/StyledError.d.ts +0 -0
  113. package/types/components/Error/index.d.ts +0 -0
  114. package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
  115. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
  116. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
  117. package/types/components/FAB/ActionGroup/index.d.ts +0 -0
  118. package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
  119. package/types/components/FAB/FAB.d.ts +0 -0
  120. package/types/components/FAB/StyledFAB.d.ts +0 -0
  121. package/types/components/FAB/index.d.ts +0 -0
  122. package/types/components/Icon/AnimatedIcon.d.ts +0 -0
  123. package/types/components/Icon/HeroIcon/index.d.ts +0 -0
  124. package/types/components/Icon/IconList.d.ts +0 -0
  125. package/types/components/Icon/index.d.ts +0 -0
  126. package/types/components/Icon/utils.d.ts +0 -0
  127. package/types/components/Image/index.d.ts +0 -0
  128. package/types/components/List/BasicListItem.d.ts +0 -0
  129. package/types/components/List/ListItem.d.ts +0 -0
  130. package/types/components/List/StyledBasicListItem.d.ts +0 -0
  131. package/types/components/List/StyledListItem.d.ts +0 -0
  132. package/types/components/List/index.d.ts +0 -0
  133. package/types/components/PageControl/StyledPageControl.d.ts +0 -0
  134. package/types/components/PageControl/index.d.ts +0 -0
  135. package/types/components/PinInput/PinCell.d.ts +0 -0
  136. package/types/components/PinInput/StyledPinInput.d.ts +0 -0
  137. package/types/components/PinInput/index.d.ts +0 -0
  138. package/types/components/Progress/ProgressBar.d.ts +0 -0
  139. package/types/components/Progress/ProgressCircle.d.ts +0 -0
  140. package/types/components/Progress/StyledProgressBar.d.ts +0 -0
  141. package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
  142. package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
  143. package/types/components/Progress/constants.d.ts +0 -0
  144. package/types/components/Progress/index.d.ts +0 -0
  145. package/types/components/Progress/types.d.ts +0 -0
  146. package/types/components/Radio/Radio.d.ts +0 -0
  147. package/types/components/Radio/RadioGroup.d.ts +0 -0
  148. package/types/components/Radio/StyledRadio.d.ts +0 -0
  149. package/types/components/Radio/index.d.ts +0 -0
  150. package/types/components/Radio/types.d.ts +0 -0
  151. package/types/components/RefreshControl/index.d.ts +0 -0
  152. package/types/components/RichTextEditor/EditorEvent.d.ts +0 -0
  153. package/types/components/RichTextEditor/EditorToolbar.d.ts +0 -0
  154. package/types/components/RichTextEditor/MentionList.d.ts +0 -0
  155. package/types/components/RichTextEditor/RichTextEditor.d.ts +0 -0
  156. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -0
  157. package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -0
  158. package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +0 -0
  159. package/types/components/RichTextEditor/constants.d.ts +0 -0
  160. package/types/components/RichTextEditor/heroEditorApp.d.ts +0 -0
  161. package/types/components/RichTextEditor/index.d.ts +0 -0
  162. package/types/components/RichTextEditor/types.d.ts +0 -0
  163. package/types/components/RichTextEditor/utils/events.d.ts +0 -0
  164. package/types/components/RichTextEditor/utils/rnWebView.d.ts +0 -0
  165. package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
  166. package/types/components/SectionHeading/index.d.ts +0 -0
  167. package/types/components/Select/BaseOptionList.d.ts +0 -0
  168. package/types/components/Select/Footer.d.ts +0 -0
  169. package/types/components/Select/MultiSelect/Option.d.ts +0 -0
  170. package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
  171. package/types/components/Select/MultiSelect/index.d.ts +0 -0
  172. package/types/components/Select/SingleSelect/Option.d.ts +0 -0
  173. package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
  174. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -0
  175. package/types/components/Select/SingleSelect/index.d.ts +0 -0
  176. package/types/components/Select/StyledSelect.d.ts +0 -0
  177. package/types/components/Select/helpers.d.ts +0 -0
  178. package/types/components/Select/index.d.ts +0 -0
  179. package/types/components/Select/types.d.ts +0 -0
  180. package/types/components/Skeleton/StyledSkeleton.d.ts +0 -0
  181. package/types/components/Skeleton/index.d.ts +0 -0
  182. package/types/components/Slider/index.d.ts +0 -0
  183. package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
  184. package/types/components/Spinner/StyledSpinner.d.ts +0 -0
  185. package/types/components/Spinner/index.d.ts +0 -0
  186. package/types/components/Success/StyledSuccess.d.ts +0 -0
  187. package/types/components/Success/index.d.ts +0 -0
  188. package/types/components/Swipeable/StyledSwipeable.d.ts +0 -0
  189. package/types/components/Swipeable/SwipeableAction.d.ts +0 -0
  190. package/types/components/Swipeable/index.d.ts +0 -0
  191. package/types/components/Switch/SelectorSwitch/Option.d.ts +0 -0
  192. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -0
  193. package/types/components/Switch/SelectorSwitch/index.d.ts +0 -0
  194. package/types/components/Switch/StyledSwitch.d.ts +0 -0
  195. package/types/components/Switch/index.d.ts +0 -0
  196. package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
  197. package/types/components/Tabs/SceneView.d.ts +9 -0
  198. package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
  199. package/types/components/Tabs/ScrollableTabsHeader.d.ts +35 -0
  200. package/types/components/Tabs/ScrollableTabsV2/SceneView.d.ts +10 -0
  201. package/types/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.d.ts +9 -0
  202. package/types/components/Tabs/ScrollableTabsV2/index.d.ts +4 -0
  203. package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
  204. package/types/components/Tabs/StyledTabs.d.ts +0 -0
  205. package/types/components/Tabs/TabWithBadge.d.ts +0 -0
  206. package/types/components/Tabs/index.d.ts +3 -0
  207. package/types/components/Tabs/utils.d.ts +0 -0
  208. package/types/components/Tag/StyledTag.d.ts +0 -0
  209. package/types/components/Tag/index.d.ts +0 -0
  210. package/types/components/TextInput/StyledTextInput.d.ts +12 -7
  211. package/types/components/TextInput/index.d.ts +8 -4
  212. package/types/components/TimePicker/StyledTimePicker.d.ts +0 -0
  213. package/types/components/TimePicker/TimePickerAndroid.d.ts +0 -0
  214. package/types/components/TimePicker/TimePickerIOS.d.ts +0 -0
  215. package/types/components/TimePicker/index.d.ts +0 -0
  216. package/types/components/TimePicker/types.d.ts +0 -0
  217. package/types/components/Toast/StyledToast.d.ts +0 -0
  218. package/types/components/Toast/Toast.d.ts +0 -0
  219. package/types/components/Toast/ToastContainer.d.ts +0 -0
  220. package/types/components/Toast/ToastContext.d.ts +0 -0
  221. package/types/components/Toast/ToastProvider.d.ts +0 -0
  222. package/types/components/Toast/index.d.ts +0 -0
  223. package/types/components/Toast/types.d.ts +0 -0
  224. package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
  225. package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
  226. package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
  227. package/types/components/Toolbar/index.d.ts +0 -0
  228. package/types/components/Typography/Text/StyledText.d.ts +0 -0
  229. package/types/components/Typography/Text/index.d.ts +0 -0
  230. package/types/components/Typography/index.d.ts +0 -0
  231. package/types/index.d.ts +0 -0
  232. package/types/testHelpers/renderWithTheme.d.ts +0 -0
  233. package/types/theme/ThemeProvider.d.ts +0 -0
  234. package/types/theme/ThemeSwitcher.d.ts +0 -0
  235. package/types/theme/components/accordion.d.ts +0 -0
  236. package/types/theme/components/alert.d.ts +0 -0
  237. package/types/theme/components/attachment.d.ts +0 -0
  238. package/types/theme/components/avatar.d.ts +0 -0
  239. package/types/theme/components/badge.d.ts +0 -0
  240. package/types/theme/components/bottomNavigation.d.ts +0 -0
  241. package/types/theme/components/bottomSheet.d.ts +0 -0
  242. package/types/theme/components/button.d.ts +0 -0
  243. package/types/theme/components/calendar.d.ts +0 -0
  244. package/types/theme/components/card.d.ts +0 -0
  245. package/types/theme/components/cardCarousel.d.ts +0 -0
  246. package/types/theme/components/carousel.d.ts +0 -0
  247. package/types/theme/components/checkbox.d.ts +0 -0
  248. package/types/theme/components/contentNavigator.d.ts +0 -0
  249. package/types/theme/components/datePicker.d.ts +0 -0
  250. package/types/theme/components/divider.d.ts +0 -0
  251. package/types/theme/components/drawer.d.ts +0 -0
  252. package/types/theme/components/empty.d.ts +0 -0
  253. package/types/theme/components/error.d.ts +0 -0
  254. package/types/theme/components/fab.d.ts +0 -0
  255. package/types/theme/components/icon.d.ts +0 -0
  256. package/types/theme/components/image.d.ts +0 -0
  257. package/types/theme/components/list.d.ts +0 -0
  258. package/types/theme/components/pageControl.d.ts +0 -0
  259. package/types/theme/components/pinInput.d.ts +0 -0
  260. package/types/theme/components/progress.d.ts +0 -0
  261. package/types/theme/components/radio.d.ts +0 -0
  262. package/types/theme/components/refreshControl.d.ts +0 -0
  263. package/types/theme/components/richTextEditor.d.ts +0 -0
  264. package/types/theme/components/sectionHeading.d.ts +0 -0
  265. package/types/theme/components/select.d.ts +0 -0
  266. package/types/theme/components/skeleton.d.ts +0 -0
  267. package/types/theme/components/slider.d.ts +0 -0
  268. package/types/theme/components/spinner.d.ts +0 -0
  269. package/types/theme/components/success.d.ts +0 -0
  270. package/types/theme/components/swipeable.d.ts +0 -0
  271. package/types/theme/components/switch.d.ts +0 -0
  272. package/types/theme/components/tabs.d.ts +0 -0
  273. package/types/theme/components/tag.d.ts +0 -0
  274. package/types/theme/components/textInput.d.ts +5 -0
  275. package/types/theme/components/timePicker.d.ts +0 -0
  276. package/types/theme/components/toast.d.ts +0 -0
  277. package/types/theme/components/toolbar.d.ts +0 -0
  278. package/types/theme/components/typography.d.ts +0 -0
  279. package/types/theme/getTheme.d.ts +0 -0
  280. package/types/theme/global/borders.d.ts +0 -0
  281. package/types/theme/global/colors/eBens.d.ts +0 -0
  282. package/types/theme/global/colors/global.d.ts +0 -0
  283. package/types/theme/global/colors/globalDark.d.ts +0 -0
  284. package/types/theme/global/colors/jobs.d.ts +0 -0
  285. package/types/theme/global/colors/swag.d.ts +0 -0
  286. package/types/theme/global/colors/swagDark.d.ts +0 -0
  287. package/types/theme/global/colors/types.d.ts +0 -0
  288. package/types/theme/global/colors/wallet.d.ts +0 -0
  289. package/types/theme/global/colors/work.d.ts +0 -0
  290. package/types/theme/global/index.d.ts +0 -0
  291. package/types/theme/global/scale.d.ts +0 -0
  292. package/types/theme/global/sizes.d.ts +0 -0
  293. package/types/theme/global/space.d.ts +0 -0
  294. package/types/theme/global/typography.d.ts +0 -0
  295. package/types/theme/index.d.ts +0 -0
  296. package/types/types.d.ts +0 -0
  297. package/types/utils/functions.d.ts +0 -0
  298. package/types/utils/helpers.d.ts +0 -0
  299. package/types/utils/hooks.d.ts +0 -0
  300. package/types/utils/scale.d.ts +0 -0
@@ -4,9 +4,9 @@ import { TextInput as RNTextInput } from 'react-native';
4
4
  import { theme } from '../../..';
5
5
  import renderWithTheme from '../../../testHelpers/renderWithTheme';
6
6
  import Icon from '../../Icon';
7
- import TextInput, { getVariant, TextInputHandles } from '../index';
7
+ import TextInput, { getState, TextInputHandles } from '../index';
8
8
 
9
- describe('getVariant', () => {
9
+ describe('getState', () => {
10
10
  it.each`
11
11
  disabled | error | editable | loading | isEmptyValue | expected
12
12
  ${false} | ${undefined} | ${true} | ${false} | ${true} | ${'default'}
@@ -15,10 +15,10 @@ describe('getVariant', () => {
15
15
  ${false} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'error'}
16
16
  ${true} | ${'This field is required'} | ${false} | ${false} | ${true} | ${'disabled'}
17
17
  `(
18
- 'should return the correct variant when disabled $disabled, errorMessage $errorMessage, editable $false, isEmptyValue $isEmptyValue',
18
+ 'should return the correct state when disabled $disabled, errorMessage $errorMessage, editable $false, isEmptyValue $isEmptyValue',
19
19
  ({ disabled, error, editable, loading, isEmptyValue, expected }) => {
20
20
  expect(
21
- getVariant({
21
+ getState({
22
22
  disabled,
23
23
  error,
24
24
  editable,
@@ -483,4 +483,16 @@ describe('TextInput', () => {
483
483
  expect(blurSpy).toHaveBeenCalledTimes(1);
484
484
  });
485
485
  });
486
+
487
+ describe('variants', () => {
488
+ it('renders textarea variant correctly', () => {
489
+ const { toJSON, queryByText, queryByDisplayValue } = renderWithTheme(
490
+ <TextInput label="Amount (AUD)" value="2000" variant="textarea" />
491
+ );
492
+
493
+ expect(toJSON()).toMatchSnapshot();
494
+ expect(queryByText('Amount (AUD)')).toBeTruthy();
495
+ expect(queryByDisplayValue('2000')).toBeTruthy();
496
+ });
497
+ });
486
498
  });
@@ -27,7 +27,7 @@ import {
27
27
  } from './StyledTextInput';
28
28
  import Icon from '../Icon';
29
29
  import { useTheme } from '../../theme';
30
- import type { Variant } from './StyledTextInput';
30
+ import type { State } from './StyledTextInput';
31
31
  import type { IconName } from '../Icon';
32
32
  import { omit, pick } from '../../utils/helpers';
33
33
 
@@ -110,9 +110,13 @@ export interface TextInputProps extends NativeTextInputProps {
110
110
  * Component ref.
111
111
  */
112
112
  ref?: React.Ref<TextInputHandles>;
113
+ /**
114
+ * Component variant.
115
+ */
116
+ variant?: 'text' | 'textarea';
113
117
  }
114
118
 
115
- export const getVariant = ({
119
+ export const getState = ({
116
120
  disabled,
117
121
  error,
118
122
  editable,
@@ -125,7 +129,7 @@ export const getVariant = ({
125
129
  loading: boolean;
126
130
  isFocused?: boolean;
127
131
  isEmptyValue?: boolean;
128
- }): Variant => {
132
+ }): State => {
129
133
  if (disabled) {
130
134
  return 'disabled';
131
135
  }
@@ -167,6 +171,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
167
171
  defaultValue,
168
172
  renderInputValue,
169
173
  allowFontScaling = false,
174
+ variant = 'text',
170
175
  ...nativeProps
171
176
  }: TextInputProps,
172
177
  ref?: React.Ref<TextInputHandles>
@@ -177,7 +182,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
177
182
 
178
183
  const [isFocused, setIsFocused] = React.useState(false);
179
184
 
180
- const variant = getVariant({
185
+ const state = getState({
181
186
  disabled,
182
187
  error,
183
188
  editable,
@@ -252,7 +257,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
252
257
  ]),
253
258
  testID: 'text-input',
254
259
  accessibilityState: {
255
- disabled: variant === 'disabled' || variant === 'readonly',
260
+ disabled: state === 'disabled' || state === 'readonly',
256
261
  },
257
262
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
258
263
  // @ts-ignore
@@ -284,14 +289,14 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
284
289
  <StyledContainer
285
290
  style={styleWithoutBackgroundColor}
286
291
  pointerEvents={
287
- variant === 'disabled' || variant === 'readonly' ? 'none' : 'auto'
292
+ state === 'disabled' || state === 'readonly' ? 'none' : 'auto'
288
293
  }
289
294
  testID={testID}
290
295
  >
291
296
  <StyledTextInputContainer>
292
297
  <StyledBorderBackDrop
293
298
  themeFocused={isFocused}
294
- themeVariant={variant}
299
+ themeState={state}
295
300
  testID="text-input-border"
296
301
  style={[{ backgroundColor }, borderStyle]}
297
302
  />
@@ -302,7 +307,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
302
307
  style={{ backgroundColor }}
303
308
  >
304
309
  {required && (
305
- <StyledAsteriskLabel themeVariant={variant} fontSize="small">
310
+ <StyledAsteriskLabel themeState={state} fontSize="small">
306
311
  *
307
312
  </StyledAsteriskLabel>
308
313
  )}
@@ -311,7 +316,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
311
316
  nativeID={accessibilityLabelledBy}
312
317
  testID="input-label"
313
318
  fontSize="small"
314
- themeVariant={variant}
319
+ themeState={state}
315
320
  style={{ backgroundColor }}
316
321
  >
317
322
  {label}
@@ -321,7 +326,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
321
326
  )}
322
327
  {typeof prefix === 'string' ? (
323
328
  <Icon
324
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
329
+ intent={state === 'disabled' ? 'disabled-text' : 'text'}
325
330
  testID="input-prefix"
326
331
  icon={prefix}
327
332
  size="xsmall"
@@ -331,9 +336,12 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
331
336
  )}
332
337
  <StyledTextInputAndLabelContainer>
333
338
  {!isFocused && isEmptyValue && (
334
- <StyledLabelContainerInsideTextInput pointerEvents="none">
339
+ <StyledLabelContainerInsideTextInput
340
+ themeVariant={variant}
341
+ pointerEvents="none"
342
+ >
335
343
  {required && (
336
- <StyledAsteriskLabelInsideTextInput themeVariant={variant}>
344
+ <StyledAsteriskLabelInsideTextInput themeState={state}>
337
345
  *
338
346
  </StyledAsteriskLabelInsideTextInput>
339
347
  )}
@@ -342,7 +350,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
342
350
  nativeID={accessibilityLabelledBy}
343
351
  testID="input-label"
344
352
  fontSize="medium"
345
- themeVariant={variant}
353
+ themeState={state}
346
354
  >
347
355
  {label}
348
356
  </StyledLabelInsideTextInput>
@@ -354,6 +362,8 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
354
362
  ) : (
355
363
  <StyledTextInput
356
364
  {...nativeInputProps}
365
+ themeVariant={variant}
366
+ multiline={variant === 'textarea' || nativeProps.multiline}
357
367
  ref={(reference) => {
358
368
  innerTextInput.current = reference;
359
369
  }}
@@ -362,7 +372,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
362
372
  </StyledTextInputAndLabelContainer>
363
373
  {typeof actualSuffix === 'string' ? (
364
374
  <Icon
365
- intent={variant === 'disabled' ? 'disabled-text' : 'text'}
375
+ intent={state === 'disabled' ? 'disabled-text' : 'text'}
366
376
  testID="input-suffix"
367
377
  icon={actualSuffix}
368
378
  spin={actualSuffix === 'loading'}
@@ -389,7 +399,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
389
399
  !!helpText && <StyledHelperText>{helpText}</StyledHelperText>
390
400
  )}
391
401
  {shouldShowMaxLength && (
392
- <StyledMaxLengthMessage themeVariant={variant} fontSize="small">
402
+ <StyledMaxLengthMessage themeState={state} fontSize="small">
393
403
  {displayText.length}/{maxLength}
394
404
  </StyledMaxLengthMessage>
395
405
  )}
@@ -76,7 +76,7 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
76
76
  }
77
77
  testID="text-input-border"
78
78
  themeFocused={false}
79
- themeVariant="filled"
79
+ themeState="filled"
80
80
  />
81
81
  <View
82
82
  pointerEvents="none"
@@ -123,8 +123,8 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
123
123
  themeFontSize="small"
124
124
  themeFontWeight="regular"
125
125
  themeIntent="body"
126
+ themeState="filled"
126
127
  themeTypeface="neutral"
127
- themeVariant="filled"
128
128
  >
129
129
  Break time
130
130
  </Text>
@@ -160,8 +160,11 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
160
160
  Object {
161
161
  "alignSelf": "stretch",
162
162
  "flexGrow": 2,
163
- "fontSize": 14,
163
+ "fontFamily": "BeVietnamPro-Regular",
164
+ "fontSize": 16,
165
+ "height": undefined,
164
166
  "marginHorizontal": 8,
167
+ "maxHeight": 144,
165
168
  "paddingVertical": 0,
166
169
  "textAlignVertical": "center",
167
170
  },
@@ -172,6 +175,7 @@ exports[`TimePickerAndroid renders correct with hide suffix 1`] = `
172
175
  ]
173
176
  }
174
177
  testID="text-input"
178
+ themeVariant="text"
175
179
  value="03:24 AM"
176
180
  />
177
181
  </View>
@@ -307,7 +311,7 @@ exports[`TimePickerAndroid renders correctly 1`] = `
307
311
  }
308
312
  testID="text-input-border"
309
313
  themeFocused={false}
310
- themeVariant="filled"
314
+ themeState="filled"
311
315
  />
312
316
  <View
313
317
  pointerEvents="none"
@@ -354,8 +358,8 @@ exports[`TimePickerAndroid renders correctly 1`] = `
354
358
  themeFontSize="small"
355
359
  themeFontWeight="regular"
356
360
  themeIntent="body"
361
+ themeState="filled"
357
362
  themeTypeface="neutral"
358
- themeVariant="filled"
359
363
  >
360
364
  Break time
361
365
  </Text>
@@ -391,8 +395,11 @@ exports[`TimePickerAndroid renders correctly 1`] = `
391
395
  Object {
392
396
  "alignSelf": "stretch",
393
397
  "flexGrow": 2,
394
- "fontSize": 14,
398
+ "fontFamily": "BeVietnamPro-Regular",
399
+ "fontSize": 16,
400
+ "height": undefined,
395
401
  "marginHorizontal": 8,
402
+ "maxHeight": 144,
396
403
  "paddingVertical": 0,
397
404
  "textAlignVertical": "center",
398
405
  },
@@ -403,6 +410,7 @@ exports[`TimePickerAndroid renders correctly 1`] = `
403
410
  ]
404
411
  }
405
412
  testID="text-input"
413
+ themeVariant="text"
406
414
  value="03:24 AM"
407
415
  />
408
416
  </View>
@@ -76,7 +76,7 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
76
76
  }
77
77
  testID="text-input-border"
78
78
  themeFocused={false}
79
- themeVariant="filled"
79
+ themeState="filled"
80
80
  />
81
81
  <View
82
82
  pointerEvents="none"
@@ -123,8 +123,8 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
123
123
  themeFontSize="small"
124
124
  themeFontWeight="regular"
125
125
  themeIntent="body"
126
+ themeState="filled"
126
127
  themeTypeface="neutral"
127
- themeVariant="filled"
128
128
  >
129
129
  Break time
130
130
  </Text>
@@ -160,8 +160,11 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
160
160
  Object {
161
161
  "alignSelf": "stretch",
162
162
  "flexGrow": 2,
163
- "fontSize": 14,
163
+ "fontFamily": "BeVietnamPro-Regular",
164
+ "fontSize": 16,
165
+ "height": undefined,
164
166
  "marginHorizontal": 8,
167
+ "maxHeight": 144,
165
168
  "paddingVertical": 0,
166
169
  "textAlignVertical": "center",
167
170
  },
@@ -172,6 +175,7 @@ exports[`TimePickerIOS renders correct with hide suffix 1`] = `
172
175
  ]
173
176
  }
174
177
  testID="text-input"
178
+ themeVariant="text"
175
179
  value="03:24 AM"
176
180
  />
177
181
  </View>
@@ -307,7 +311,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
307
311
  }
308
312
  testID="text-input-border"
309
313
  themeFocused={false}
310
- themeVariant="filled"
314
+ themeState="filled"
311
315
  />
312
316
  <View
313
317
  pointerEvents="none"
@@ -354,8 +358,8 @@ exports[`TimePickerIOS renders correctly 1`] = `
354
358
  themeFontSize="small"
355
359
  themeFontWeight="regular"
356
360
  themeIntent="body"
361
+ themeState="filled"
357
362
  themeTypeface="neutral"
358
- themeVariant="filled"
359
363
  >
360
364
  Break time
361
365
  </Text>
@@ -391,8 +395,11 @@ exports[`TimePickerIOS renders correctly 1`] = `
391
395
  Object {
392
396
  "alignSelf": "stretch",
393
397
  "flexGrow": 2,
394
- "fontSize": 14,
398
+ "fontFamily": "BeVietnamPro-Regular",
399
+ "fontSize": 16,
400
+ "height": undefined,
395
401
  "marginHorizontal": 8,
402
+ "maxHeight": 144,
396
403
  "paddingVertical": 0,
397
404
  "textAlignVertical": "center",
398
405
  },
@@ -403,6 +410,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
403
410
  ]
404
411
  }
405
412
  testID="text-input"
413
+ themeVariant="text"
406
414
  value="03:24 AM"
407
415
  />
408
416
  </View>
@@ -975,17 +975,22 @@ Object {
975
975
  "text": "#001f23",
976
976
  },
977
977
  "fontSizes": Object {
978
- "asteriskLabel": 14,
978
+ "asteriskLabel": 16,
979
979
  "error": 12,
980
- "labelInsideTextInput": 14,
980
+ "labelInsideTextInput": 16,
981
981
  "maxLength": 12,
982
- "text": 14,
982
+ "text": 16,
983
+ },
984
+ "fonts": Object {
985
+ "text": "BeVietnamPro-Regular",
983
986
  },
984
987
  "radii": Object {
985
988
  "container": 8,
986
989
  },
987
990
  "sizes": Object {
988
991
  "errorAndHelpTextContainerHeight": 16,
992
+ "textInputMaxHeight": 144,
993
+ "textareaHeight": 144,
989
994
  },
990
995
  "space": Object {
991
996
  "containerMarginTop": 8,
@@ -58,12 +58,16 @@ const getTextInputTheme = (theme: GlobalTheme) => {
58
58
  labelInsideTextInputMarginTop: -theme.space.xxsmall,
59
59
  };
60
60
 
61
+ const fonts = {
62
+ text: theme.fonts.neutral.regular,
63
+ };
64
+
61
65
  const fontSizes = {
62
- text: theme.fontSizes.medium,
63
- labelInsideTextInput: theme.fontSizes.medium,
66
+ text: theme.fontSizes.large,
67
+ labelInsideTextInput: theme.fontSizes.large,
64
68
  error: theme.fontSizes.small,
65
69
  maxLength: theme.fontSizes.small,
66
- asteriskLabel: theme.fontSizes.medium,
70
+ asteriskLabel: theme.fontSizes.large,
67
71
  };
68
72
 
69
73
  const borderWidths = {
@@ -79,9 +83,11 @@ const getTextInputTheme = (theme: GlobalTheme) => {
79
83
 
80
84
  const sizes = {
81
85
  errorAndHelpTextContainerHeight: theme.sizes.medium,
86
+ textareaHeight: theme.sizes['15xlarge'],
87
+ textInputMaxHeight: theme.sizes['15xlarge'],
82
88
  };
83
89
 
84
- return { colors, space, fontSizes, borderWidths, radii, sizes };
90
+ return { colors, space, fonts, fontSizes, borderWidths, radii, sizes };
85
91
  };
86
92
 
87
93
  export default getTextInputTheme;
@@ -40,6 +40,12 @@ jest.mock('react-native-pager-view', () => {
40
40
  this.index = Math.max(0, Math.min(page, React.Children.count(children)));
41
41
  };
42
42
 
43
+ setPageWithoutAnimation = (page: number) => {
44
+ const { children } = this.props;
45
+
46
+ this.index = Math.max(0, Math.min(page, React.Children.count(children)));
47
+ };
48
+
43
49
  render() {
44
50
  const { children } = this.props;
45
51
  return <RealComponent>{children}</RealComponent>;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes