@hero-design/rn 8.44.0-alpha.0 → 8.44.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 (281) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +36 -0
  3. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  4. package/es/index.js +2852 -2683
  5. package/jest-setup.ts +2 -0
  6. package/lib/assets/fonts/hero-icons-mobile.ttf +0 -0
  7. package/lib/index.js +2855 -2687
  8. package/package.json +23 -24
  9. package/rollup.config.js +0 -1
  10. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +564 -384
  11. package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +76 -20
  12. package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +791 -605
  13. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +848 -567
  14. package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +172 -110
  15. package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +138 -70
  16. package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +745 -581
  17. package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +158 -57
  18. package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +273 -153
  19. package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +391 -223
  20. package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +119 -63
  21. package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +306 -242
  22. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +317 -183
  23. package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +1042 -454
  24. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +6 -10
  25. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +400 -140
  26. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +1090 -880
  27. package/src/components/Button/StyledButton.tsx +4 -0
  28. package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +196 -106
  29. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1675 -1125
  30. package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +71 -26
  31. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +1651 -665
  32. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +555 -330
  33. package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +265 -69
  34. package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +205 -65
  35. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +36 -8
  36. package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +292 -124
  37. package/src/components/Carousel/CardCarousel.tsx +10 -7
  38. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +486 -406
  39. package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +197 -70
  40. package/src/components/Carousel/__tests__/__snapshots__/StyledCarousel.spec.tsx.snap +41 -13
  41. package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +1742 -1526
  42. package/src/components/Carousel/__tests__/index.spec.tsx +50 -3
  43. package/src/components/Carousel/index.tsx +16 -22
  44. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +404 -112
  45. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +574 -334
  46. package/src/components/Chip/StyledChip.tsx +121 -0
  47. package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +1483 -0
  48. package/src/components/Chip/__tests__/index.spec.tsx +136 -0
  49. package/src/components/Chip/index.tsx +82 -0
  50. package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +73 -17
  51. package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +94 -38
  52. package/src/components/Collapse/index.tsx +1 -1
  53. package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +37 -9
  54. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +424 -268
  55. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +622 -457
  56. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +212 -157
  57. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +204 -149
  58. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +483 -386
  59. package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +464 -128
  60. package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +97 -69
  61. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +327 -192
  62. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +169 -113
  63. package/src/components/Error/StyledError.tsx +2 -1
  64. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +390 -262
  65. package/src/components/Error/__tests__/index.spec.tsx +9 -6
  66. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +860 -723
  67. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +98 -42
  68. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +199 -99
  69. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +293 -185
  70. package/src/components/HeroDesignProvider/__tests__/__snapshots__/index.spec.tsx.snap +45 -17
  71. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  72. package/src/components/Icon/IconList.ts +3 -0
  73. package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +158 -46
  74. package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +164 -52
  75. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +242 -170
  76. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +760 -588
  77. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +272 -128
  78. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +477 -193
  79. package/src/components/Modal/__tests__/__snapshots__/index.spec.tsx.snap +169 -0
  80. package/src/components/Modal/__tests__/index.spec.tsx +99 -0
  81. package/src/components/Modal/index.tsx +178 -82
  82. package/src/components/PageControl/__tests__/__snapshots__/index.spec.tsx.snap +84 -41
  83. package/src/components/PageControl/index.tsx +1 -0
  84. package/src/components/PinInput/__tests__/StyledPinInput.spec.tsx +9 -4
  85. package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +293 -153
  86. package/src/components/PinInput/__tests__/__snapshots__/StyledPinInput.spec.tsx.snap +15 -48
  87. package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +809 -697
  88. package/src/components/Portal/__tests__/PortalHost.spec.tsx +12 -14
  89. package/src/components/Portal/__tests__/__snapshots__/index.spec.tsx.snap +43 -15
  90. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +743 -603
  91. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +188 -116
  92. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +257 -205
  93. package/src/components/Rate/__tests__/__snapshots__/index.spec.tsx.snap +864 -600
  94. package/src/components/RefreshControl/__tests__/__snapshots__/index.spec.tsx.snap +128 -44
  95. package/src/components/RichTextEditor/RichTextEditor.tsx +76 -38
  96. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +5 -2
  97. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +3 -3
  98. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +413 -266
  99. package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +64 -35
  100. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +403 -305
  101. package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +158 -46
  102. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +394 -226
  103. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +93 -57
  104. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +2387 -2151
  105. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +856 -174
  106. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +7 -6
  107. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +73 -37
  108. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +2321 -2085
  109. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +674 -150
  110. package/src/components/Skeleton/__tests__/__snapshots__/index.spec.tsx.snap +490 -294
  111. package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +117 -33
  112. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +105 -77
  113. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +1308 -636
  114. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +121 -93
  115. package/src/components/Success/StyledSuccess.tsx +2 -1
  116. package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +388 -258
  117. package/src/components/Success/__tests__/index.spec.tsx +9 -6
  118. package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +210 -75
  119. package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +58 -30
  120. package/src/components/Swipeable/index.tsx +3 -3
  121. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +226 -114
  122. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +146 -109
  123. package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +202 -62
  124. package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +132 -68
  125. package/src/components/Tabs/__tests__/SceneView.spec.tsx +7 -7
  126. package/src/components/Tabs/__tests__/__snapshots__/SceneView.spec.tsx.snap +206 -94
  127. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +2217 -1962
  128. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +523 -455
  129. package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +121 -65
  130. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +1641 -1398
  131. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +554 -274
  132. package/src/components/TextInput/StyledTextInput.tsx +8 -31
  133. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +0 -44
  134. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +990 -711
  135. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3200 -2431
  136. package/src/components/TextInput/__tests__/index.spec.tsx +2 -2
  137. package/src/components/TextInput/index.tsx +113 -57
  138. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +414 -304
  139. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +686 -534
  140. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +871 -573
  141. package/src/components/Toast/__tests__/__snapshots__/ToastContainer.spec.tsx.snap +180 -68
  142. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +582 -426
  143. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +683 -363
  144. package/src/components/Typography/Body/__tests__/__snapshots__/StyledBody.tsx.snap +704 -256
  145. package/src/components/Typography/Body/__tests__/__snapshots__/index.spec.tsx.snap +855 -323
  146. package/src/components/Typography/Caption/__tests__/__snapshots__/StyledCaption.spec.tsx.snap +430 -150
  147. package/src/components/Typography/Caption/__tests__/__snapshots__/index.spec.tsx.snap +572 -208
  148. package/src/components/Typography/Label/__tests__/__snapshots__/StyledLabel.tsx.snap +328 -104
  149. package/src/components/Typography/Label/__tests__/__snapshots__/index.spec.tsx.snap +462 -154
  150. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +900 -340
  151. package/src/components/Typography/Title/__tests__/__snapshots__/StyledTitle.tsx.snap +880 -320
  152. package/src/components/Typography/Title/__tests__/__snapshots__/index.spec.tsx.snap +1035 -391
  153. package/src/index.ts +2 -2
  154. package/src/testHelpers/renderWithTheme.tsx +2 -2
  155. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +40 -3
  156. package/src/theme/components/button.ts +0 -1
  157. package/src/theme/components/chip.ts +47 -0
  158. package/src/theme/components/textInput.ts +2 -2
  159. package/src/theme/getTheme.ts +3 -0
  160. package/testUtils/setup.tsx +0 -18
  161. package/tsconfig.json +4 -1
  162. package/types/components/Accordion/AccordionItem.d.ts +2 -1
  163. package/types/components/Accordion/index.d.ts +1 -1
  164. package/types/components/Attachment/index.d.ts +2 -1
  165. package/types/components/Avatar/Avatar.d.ts +2 -1
  166. package/types/components/Avatar/AvatarStack/index.d.ts +2 -2
  167. package/types/components/Avatar/index.d.ts +3 -2
  168. package/types/components/Badge/StyledBadge.d.ts +0 -4
  169. package/types/components/BottomSheet/Footer.d.ts +2 -1
  170. package/types/components/BottomSheet/Header.d.ts +2 -1
  171. package/types/components/BottomSheet/ScrollView.d.ts +1 -0
  172. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -4
  173. package/types/components/Box/index.d.ts +2 -1
  174. package/types/components/Button/IconButton.d.ts +2 -1
  175. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +3 -3
  176. package/types/components/Button/LoadingIndicator/index.d.ts +2 -1
  177. package/types/components/Button/UtilityButton/index.d.ts +2 -1
  178. package/types/components/Calendar/CalendarRowItem.d.ts +2 -1
  179. package/types/components/Calendar/StyledCalendar.d.ts +1 -1
  180. package/types/components/Calendar/index.d.ts +2 -1
  181. package/types/components/Carousel/CardCarousel.d.ts +1 -1
  182. package/types/components/Carousel/CarouselItem.d.ts +2 -1
  183. package/types/components/Carousel/index.d.ts +2 -2
  184. package/types/components/Checkbox/index.d.ts +2 -1
  185. package/types/components/Chip/StyledChip.d.ts +31 -0
  186. package/types/components/Chip/index.d.ts +27 -0
  187. package/types/components/Collapse/StyledCollapse.d.ts +0 -2
  188. package/types/components/Collapse/index.d.ts +2 -1
  189. package/types/components/ContentNavigator/index.d.ts +2 -1
  190. package/types/components/DatePicker/DatePickerAndroid.d.ts +2 -1
  191. package/types/components/DatePicker/DatePickerCalendar.d.ts +2 -1
  192. package/types/components/DatePicker/DatePickerIOS.d.ts +2 -1
  193. package/types/components/DatePicker/index.d.ts +2 -1
  194. package/types/components/Divider/index.d.ts +2 -1
  195. package/types/components/Drawer/StyledDrawer.d.ts +0 -6
  196. package/types/components/Error/StyledError.d.ts +3 -9
  197. package/types/components/FAB/ActionGroup/ActionItem.d.ts +2 -1
  198. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -4
  199. package/types/components/FAB/AnimatedFABIcon.d.ts +2 -1
  200. package/types/components/HeroDesignProvider/index.d.ts +2 -1
  201. package/types/components/Icon/AnimatedIcon.d.ts +2 -1
  202. package/types/components/Icon/IconList.d.ts +1 -1
  203. package/types/components/Icon/index.d.ts +3 -2
  204. package/types/components/Icon/utils.d.ts +1 -1
  205. package/types/components/Image/index.d.ts +1 -0
  206. package/types/components/Modal/index.d.ts +12 -8
  207. package/types/components/PageControl/StyledPageControl.d.ts +0 -2
  208. package/types/components/PageControl/index.d.ts +2 -1
  209. package/types/components/PinInput/PinCell.d.ts +2 -1
  210. package/types/components/Portal/PortalHost.d.ts +1 -1
  211. package/types/components/Portal/PortalProvider.d.ts +1 -1
  212. package/types/components/Portal/index.d.ts +2 -2
  213. package/types/components/Progress/ProgressBar.d.ts +1 -0
  214. package/types/components/Progress/StyledProgressBar.d.ts +0 -2
  215. package/types/components/Progress/index.d.ts +1 -0
  216. package/types/components/Rate/StyledRate.d.ts +0 -2
  217. package/types/components/Rate/index.d.ts +2 -1
  218. package/types/components/RefreshControl/index.d.ts +2 -1
  219. package/types/components/RichTextEditor/EditorToolbar.d.ts +2 -1
  220. package/types/components/RichTextEditor/MentionList.d.ts +2 -1
  221. package/types/components/RichTextEditor/index.d.ts +2 -2
  222. package/types/components/Select/BaseOptionList.d.ts +1 -1
  223. package/types/components/Select/Footer.d.ts +2 -1
  224. package/types/components/Select/MultiSelect/Option.d.ts +2 -1
  225. package/types/components/Select/MultiSelect/OptionList.d.ts +2 -1
  226. package/types/components/Select/MultiSelect/index.d.ts +1 -1
  227. package/types/components/Select/SingleSelect/Option.d.ts +2 -1
  228. package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
  229. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +2 -1
  230. package/types/components/Select/SingleSelect/index.d.ts +1 -1
  231. package/types/components/Select/helpers.d.ts +1 -2
  232. package/types/components/Select/index.d.ts +2 -1
  233. package/types/components/Skeleton/index.d.ts +2 -1
  234. package/types/components/Slider/index.d.ts +2 -1
  235. package/types/components/Spinner/AnimatedSpinner.d.ts +2 -1
  236. package/types/components/Success/StyledSuccess.d.ts +3 -7
  237. package/types/components/Swipeable/SwipeableAction.d.ts +2 -2
  238. package/types/components/Swipeable/index.d.ts +3 -3
  239. package/types/components/Switch/SelectorSwitch/Option.d.ts +2 -1
  240. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -6
  241. package/types/components/Switch/StyledSwitch.d.ts +0 -2
  242. package/types/components/Tabs/ActiveTabIndicator.d.ts +2 -1
  243. package/types/components/Tabs/SceneView.d.ts +1 -1
  244. package/types/components/Tabs/ScrollableTabs.d.ts +2 -1
  245. package/types/components/Tabs/ScrollableTabsHeader.d.ts +2 -1
  246. package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -4
  247. package/types/components/Tabs/StyledTabs.d.ts +0 -4
  248. package/types/components/Tabs/TabWithBadge.d.ts +2 -2
  249. package/types/components/Tabs/index.d.ts +2 -1
  250. package/types/components/TextInput/StyledTextInput.d.ts +5 -25
  251. package/types/components/TextInput/index.d.ts +2 -1
  252. package/types/components/TimePicker/TimePickerAndroid.d.ts +2 -1
  253. package/types/components/TimePicker/TimePickerIOS.d.ts +2 -1
  254. package/types/components/TimePicker/index.d.ts +2 -1
  255. package/types/components/Toast/StyledToast.d.ts +0 -2
  256. package/types/components/Toast/Toast.d.ts +1 -0
  257. package/types/components/Toast/ToastProvider.d.ts +2 -1
  258. package/types/components/Toast/index.d.ts +1 -1
  259. package/types/components/Toolbar/ToolbarGroup.d.ts +2 -1
  260. package/types/components/Toolbar/ToolbarItem.d.ts +2 -1
  261. package/types/components/Toolbar/index.d.ts +3 -2
  262. package/types/components/Typography/Body/index.d.ts +2 -1
  263. package/types/components/Typography/Caption/index.d.ts +2 -1
  264. package/types/components/Typography/Label/index.d.ts +2 -1
  265. package/types/components/Typography/Text/index.d.ts +2 -1
  266. package/types/components/Typography/Title/index.d.ts +2 -1
  267. package/types/index.d.ts +2 -2
  268. package/types/testHelpers/renderWithTheme.d.ts +1 -0
  269. package/types/theme/ThemeSwitcher.d.ts +2 -2
  270. package/types/theme/components/button.d.ts +0 -1
  271. package/types/theme/components/chip.d.ts +40 -0
  272. package/types/theme/getTheme.d.ts +2 -0
  273. package/.turbo/turbo-publish:npm.log +0 -0
  274. package/src/components/Modal/ModalContentWrapper.tsx +0 -112
  275. package/src/components/Modal/ModalPresenter/ModalPresenter.tsx +0 -135
  276. package/src/components/Modal/ModalPresenter/index.tsx +0 -9
  277. package/src/components/Modal/ModalProvider.tsx +0 -8
  278. package/types/components/Modal/ModalContentWrapper.d.ts +0 -16
  279. package/types/components/Modal/ModalPresenter/ModalPresenter.d.ts +0 -34
  280. package/types/components/Modal/ModalPresenter/index.d.ts +0 -3
  281. package/types/components/Modal/ModalProvider.d.ts +0 -5
File without changes
@@ -1,112 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import {
3
- Animated,
4
- Dimensions,
5
- Easing,
6
- Platform,
7
- StyleProp,
8
- ViewStyle,
9
- } from 'react-native';
10
-
11
- type ModalContentWrapperProps = {
12
- children: React.ReactElement;
13
- visible?: boolean;
14
- onShow?: () => void;
15
- testID?: string;
16
- animationType?: 'none' | 'slide' | 'fade';
17
- style?: StyleProp<ViewStyle>;
18
- animated?: boolean;
19
- };
20
-
21
- export type ModalContentWrapperHandler = {
22
- hide: (callback?: () => void) => void;
23
- };
24
-
25
- const windowHeight = Dimensions.get('window').height;
26
- const defaultAnimationConfig = {
27
- easing: Easing.inOut(Easing.cubic),
28
- duration: 400,
29
- useNativeDriver: Platform.OS !== 'web',
30
- };
31
-
32
- const ModalContentWrapper = forwardRef<
33
- ModalContentWrapperHandler,
34
- ModalContentWrapperProps
35
- >(
36
- (
37
- {
38
- animationType,
39
- children,
40
- testID,
41
- onShow,
42
- style,
43
- visible,
44
- animated = true,
45
- },
46
- ref
47
- ) => {
48
- const animatedValue = React.useRef(new Animated.Value(0)).current;
49
-
50
- const modalAnimation = animatedValue.interpolate(
51
- animationType === 'fade'
52
- ? {
53
- inputRange: [0, 1],
54
- outputRange: [0, 1],
55
- }
56
- : {
57
- inputRange: [0, 1],
58
- outputRange: [windowHeight, 0],
59
- }
60
- );
61
-
62
- React.useImperativeHandle(
63
- ref,
64
- () => ({
65
- hide: (callback) => {
66
- Animated.timing(animatedValue, {
67
- toValue: 0,
68
- ...defaultAnimationConfig,
69
- }).start(callback);
70
- },
71
- }),
72
- [animatedValue]
73
- );
74
-
75
- React.useEffect(() => {
76
- // Hiding animation will be called from the modal component
77
- if (visible) {
78
- Animated.timing(animatedValue, {
79
- toValue: 1,
80
- ...defaultAnimationConfig,
81
- // Prevent animation when updating the modal content
82
- duration: animated ? defaultAnimationConfig.duration : 0,
83
- }).start(() => {
84
- onShow?.();
85
- });
86
- }
87
- }, [visible, animatedValue, onShow, animated]);
88
-
89
- return (
90
- <Animated.View
91
- testID={testID}
92
- style={[
93
- style,
94
- {
95
- ...(animationType === 'fade' ? { opacity: modalAnimation } : {}),
96
- ...(animationType === 'slide'
97
- ? {
98
- transform: [{ translateY: modalAnimation }],
99
- }
100
- : {}),
101
- },
102
- ]}
103
- >
104
- {children}
105
- </Animated.View>
106
- );
107
- }
108
- );
109
-
110
- ModalContentWrapper.displayName = 'ModalContentWrapper';
111
-
112
- export default ModalContentWrapper;
@@ -1,135 +0,0 @@
1
- import React, { forwardRef, useRef } from 'react';
2
- import { Animated, StyleSheet, ViewProps } from 'react-native';
3
- import RootSiblings from 'react-native-root-siblings';
4
- import { useTheme } from '../../../theme';
5
- import Box from '../../Box';
6
-
7
- export type ModalPresenterHandles = {
8
- animatedOut: (completion?: () => void) => void;
9
- };
10
- export type ModalDismissFunc = (onDismiss?: () => void) => void;
11
- export type ModalUpdateFunc = (content: React.ReactNode) => void;
12
-
13
- /**
14
- * Modal handler is returned by `showModal` function.
15
- */
16
- export type ModalHandler = {
17
- /**
18
- * Same `dismiss` function as in `ModalContentProps`.
19
- */
20
- dismiss: ModalDismissFunc;
21
- /**
22
- * Same `update` function as in `ModalContentProps`.
23
- */
24
- update: ModalUpdateFunc;
25
- };
26
-
27
- const ModalPresenter = forwardRef<ModalPresenterHandles, ViewProps>(
28
- ({ style, children, ...props }, ref) => {
29
- const animatedOpacity = useRef(new Animated.Value(0));
30
- const theme = useTheme();
31
-
32
- React.useEffect(() => {
33
- Animated.spring(animatedOpacity.current, {
34
- toValue: 1,
35
- useNativeDriver: true,
36
- }).start();
37
- }, []);
38
-
39
- React.useImperativeHandle(ref, () => ({
40
- animatedOut: (completion?: () => void) => {
41
- Animated.spring(animatedOpacity.current, {
42
- toValue: 0,
43
- useNativeDriver: true,
44
- }).start(() => {
45
- completion?.();
46
- });
47
- },
48
- }));
49
-
50
- return (
51
- <Box style={StyleSheet.absoluteFill}>
52
- <Animated.View
53
- style={[
54
- {
55
- width: '100%',
56
- height: '100%',
57
- backgroundColor: `${theme.colors.overlayGlobalSurface}66`, // 66 = 40% opacity as suggested by the mobile color guidelines
58
- justifyContent: 'center',
59
- alignItems: 'center',
60
- opacity: animatedOpacity.current,
61
- },
62
- style,
63
- ]}
64
- {...props}
65
- >
66
- {children}
67
- </Animated.View>
68
- </Box>
69
- );
70
- }
71
- );
72
-
73
- /**
74
- * Present a modal on screen immediately.
75
- *
76
- * The new presented modal will be on top of existing modals if there are any.
77
- *
78
- * @param Content A component to be presented as a modal on screen.
79
- * This component will be centered horizontally and vertically on screen with
80
- * a semitransparent black overlay underneath.
81
- * @param contentProps Props for this modal component.
82
- * @returns A `ModalHandler` you can use to dismiss the modal.
83
- */
84
-
85
- export const showModal = (content: React.ReactNode): ModalHandler => {
86
- let ref: ModalPresenterHandles | null = null;
87
- let rootSiblings: RootSiblings | null = null;
88
-
89
- const dismiss: ModalDismissFunc = (onDismiss) => {
90
- if (rootSiblings) {
91
- const cleanup = () => {
92
- rootSiblings?.destroy();
93
- rootSiblings = null;
94
- ref = null;
95
- onDismiss?.();
96
- };
97
-
98
- if (ref) {
99
- ref.animatedOut(cleanup);
100
- } else {
101
- cleanup();
102
- }
103
- }
104
- };
105
-
106
- const update: ModalUpdateFunc = (newContent) => {
107
- rootSiblings?.update(
108
- <ModalPresenter
109
- ref={(_ref) => {
110
- ref = _ref;
111
- }}
112
- >
113
- {newContent}
114
- </ModalPresenter>
115
- );
116
- };
117
-
118
- rootSiblings = new RootSiblings(
119
- (
120
- <ModalPresenter
121
- ref={(_ref) => {
122
- ref = _ref;
123
- }}
124
- >
125
- {content}
126
- </ModalPresenter>
127
- )
128
- );
129
-
130
- return { dismiss, update };
131
- };
132
-
133
- ModalPresenter.displayName = 'ModalPresenter';
134
-
135
- export default ModalPresenter;
@@ -1,9 +0,0 @@
1
- import {
2
- ModalDismissFunc,
3
- ModalHandler,
4
- showModal,
5
- ModalPresenterHandles,
6
- } from './ModalPresenter';
7
-
8
- export type { ModalDismissFunc, ModalHandler, ModalPresenterHandles };
9
- export { showModal };
@@ -1,8 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { RootSiblingParent } from 'react-native-root-siblings';
3
-
4
- const ModalProvider = ({ children }: { children: ReactNode }) => {
5
- return <RootSiblingParent>{children}</RootSiblingParent>;
6
- };
7
-
8
- export default ModalProvider;
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- type ModalContentWrapperProps = {
4
- children: React.ReactElement;
5
- visible?: boolean;
6
- onShow?: () => void;
7
- testID?: string;
8
- animationType?: 'none' | 'slide' | 'fade';
9
- style?: StyleProp<ViewStyle>;
10
- animated?: boolean;
11
- };
12
- export type ModalContentWrapperHandler = {
13
- hide: (callback?: () => void) => void;
14
- };
15
- declare const ModalContentWrapper: React.ForwardRefExoticComponent<ModalContentWrapperProps & React.RefAttributes<ModalContentWrapperHandler>>;
16
- export default ModalContentWrapper;
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { ViewProps } from 'react-native';
3
- export type ModalPresenterHandles = {
4
- animatedOut: (completion?: () => void) => void;
5
- };
6
- export type ModalDismissFunc = (onDismiss?: () => void) => void;
7
- export type ModalUpdateFunc = (content: React.ReactNode) => void;
8
- /**
9
- * Modal handler is returned by `showModal` function.
10
- */
11
- export type ModalHandler = {
12
- /**
13
- * Same `dismiss` function as in `ModalContentProps`.
14
- */
15
- dismiss: ModalDismissFunc;
16
- /**
17
- * Same `update` function as in `ModalContentProps`.
18
- */
19
- update: ModalUpdateFunc;
20
- };
21
- declare const ModalPresenter: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<ModalPresenterHandles>>;
22
- /**
23
- * Present a modal on screen immediately.
24
- *
25
- * The new presented modal will be on top of existing modals if there are any.
26
- *
27
- * @param Content A component to be presented as a modal on screen.
28
- * This component will be centered horizontally and vertically on screen with
29
- * a semitransparent black overlay underneath.
30
- * @param contentProps Props for this modal component.
31
- * @returns A `ModalHandler` you can use to dismiss the modal.
32
- */
33
- export declare const showModal: (content: React.ReactNode) => ModalHandler;
34
- export default ModalPresenter;
@@ -1,3 +0,0 @@
1
- import { ModalDismissFunc, ModalHandler, showModal, ModalPresenterHandles } from './ModalPresenter';
2
- export type { ModalDismissFunc, ModalHandler, ModalPresenterHandles };
3
- export { showModal };
@@ -1,5 +0,0 @@
1
- import { ReactNode } from 'react';
2
- declare const ModalProvider: ({ children }: {
3
- children: ReactNode;
4
- }) => JSX.Element;
5
- export default ModalProvider;