@hero-design/rn 8.34.2 → 8.35.0-alpha.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 (292) hide show
  1. package/.tool-versions +1 -0
  2. package/.turbo/turbo-build.log +2 -2
  3. package/.turbo/turbo-build:types.log +9 -0
  4. package/.turbo/turbo-lint.log +163 -0
  5. package/.turbo/turbo-publish:npm.log +9 -0
  6. package/.turbo/turbo-test.log +725 -0
  7. package/.turbo/turbo-type-check.log +1 -0
  8. package/es/index.js +199 -64
  9. package/lib/index.js +199 -64
  10. package/package.json +9 -8
  11. package/src/components/FAB/ActionGroup/FABModal.tsx +63 -0
  12. package/src/components/FAB/ActionGroup/FABModalContentWrapper.tsx +31 -0
  13. package/src/components/FAB/ActionGroup/ModalPresenter/ModalPresenter.tsx +133 -0
  14. package/src/components/FAB/ActionGroup/ModalPresenter/index.tsx +13 -0
  15. package/src/components/FAB/ActionGroup/index.tsx +48 -46
  16. package/src/components/Progress/StyledProgressBar.tsx +0 -1
  17. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +44 -46
  18. package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +7 -4
  19. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
  20. package/src/components/Switch/SelectorSwitch/index.tsx +15 -7
  21. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +12 -12
  22. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +4 -4
  23. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +7 -7
  24. package/src/theme/components/progress.ts +2 -2
  25. package/src/theme/components/switch.ts +4 -4
  26. package/src/theme/components/tabs.ts +1 -1
  27. package/types/components/Accordion/AccordionItem.d.ts +0 -0
  28. package/types/components/Accordion/StyledAccordion.d.ts +0 -0
  29. package/types/components/Accordion/index.d.ts +0 -0
  30. package/types/components/Alert/StyledAlert.d.ts +0 -0
  31. package/types/components/Alert/index.d.ts +0 -0
  32. package/types/components/Attachment/StyledAttachment.d.ts +0 -0
  33. package/types/components/Attachment/index.d.ts +0 -0
  34. package/types/components/Avatar/Avatar.d.ts +0 -0
  35. package/types/components/Avatar/AvatarStack/StyledAvatarStack.d.ts +0 -0
  36. package/types/components/Avatar/AvatarStack/index.d.ts +0 -0
  37. package/types/components/Avatar/AvatarStack/utils.d.ts +0 -0
  38. package/types/components/Avatar/StyledAvatar.d.ts +0 -0
  39. package/types/components/Avatar/index.d.ts +0 -0
  40. package/types/components/Badge/Status.d.ts +0 -0
  41. package/types/components/Badge/StyledBadge.d.ts +0 -0
  42. package/types/components/Badge/index.d.ts +0 -0
  43. package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
  44. package/types/components/BottomNavigation/index.d.ts +0 -0
  45. package/types/components/BottomSheet/BottomSheetContext.d.ts +0 -0
  46. package/types/components/BottomSheet/Footer.d.ts +0 -0
  47. package/types/components/BottomSheet/Header.d.ts +0 -0
  48. package/types/components/BottomSheet/ScrollView.d.ts +0 -0
  49. package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
  50. package/types/components/BottomSheet/index.d.ts +0 -0
  51. package/types/components/Box/StyledBox.d.ts +0 -0
  52. package/types/components/Box/config.d.ts +0 -0
  53. package/types/components/Box/index.d.ts +0 -0
  54. package/types/components/Box/types.d.ts +0 -0
  55. package/types/components/Button/Button.d.ts +0 -0
  56. package/types/components/Button/IconButton.d.ts +0 -0
  57. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
  58. package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
  59. package/types/components/Button/StyledButton.d.ts +0 -0
  60. package/types/components/Button/UtilityButton/StyledUtilityButton.d.ts +0 -0
  61. package/types/components/Button/UtilityButton/index.d.ts +0 -0
  62. package/types/components/Button/index.d.ts +0 -0
  63. package/types/components/Calendar/CalendarRowItem.d.ts +0 -0
  64. package/types/components/Calendar/StyledCalendar.d.ts +0 -0
  65. package/types/components/Calendar/helpers.d.ts +0 -0
  66. package/types/components/Calendar/index.d.ts +0 -0
  67. package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
  68. package/types/components/Card/DataCard/index.d.ts +0 -0
  69. package/types/components/Card/StyledCard.d.ts +0 -0
  70. package/types/components/Card/index.d.ts +0 -0
  71. package/types/components/Carousel/CardCarousel.d.ts +0 -0
  72. package/types/components/Carousel/CarouselItem.d.ts +0 -0
  73. package/types/components/Carousel/StyledCardCarousel.d.ts +0 -0
  74. package/types/components/Carousel/StyledCarousel.d.ts +0 -0
  75. package/types/components/Carousel/contants.d.ts +0 -0
  76. package/types/components/Carousel/index.d.ts +0 -0
  77. package/types/components/Carousel/types.d.ts +0 -0
  78. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
  79. package/types/components/Checkbox/index.d.ts +0 -0
  80. package/types/components/Collapse/StyledCollapse.d.ts +0 -0
  81. package/types/components/Collapse/index.d.ts +0 -0
  82. package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
  83. package/types/components/ContentNavigator/index.d.ts +0 -0
  84. package/types/components/DatePicker/DatePickerAndroid.d.ts +0 -0
  85. package/types/components/DatePicker/DatePickerCalendar.d.ts +0 -0
  86. package/types/components/DatePicker/DatePickerIOS.d.ts +0 -0
  87. package/types/components/DatePicker/StyledDatePicker.d.ts +0 -0
  88. package/types/components/DatePicker/index.d.ts +0 -0
  89. package/types/components/DatePicker/types.d.ts +0 -0
  90. package/types/components/Divider/StyledDivider.d.ts +0 -0
  91. package/types/components/Divider/index.d.ts +0 -0
  92. package/types/components/Drawer/DragableDrawer/helpers.d.ts +0 -0
  93. package/types/components/Drawer/DragableDrawer/index.d.ts +0 -0
  94. package/types/components/Drawer/StyledDrawer.d.ts +0 -0
  95. package/types/components/Drawer/index.d.ts +0 -0
  96. package/types/components/Empty/StyledEmpty.d.ts +0 -0
  97. package/types/components/Empty/index.d.ts +0 -0
  98. package/types/components/Error/StyledError.d.ts +0 -0
  99. package/types/components/Error/index.d.ts +0 -0
  100. package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
  101. package/types/components/FAB/ActionGroup/FABModal.d.ts +21 -0
  102. package/types/components/FAB/ActionGroup/FABModalContentWrapper.d.ts +18 -0
  103. package/types/components/FAB/ActionGroup/FABProvider.d.ts +5 -0
  104. package/types/components/FAB/ActionGroup/ModalPresenter/ModalPresenter.d.ts +34 -0
  105. package/types/components/FAB/ActionGroup/ModalPresenter/index.d.ts +3 -0
  106. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
  107. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
  108. package/types/components/FAB/ActionGroup/index.d.ts +0 -0
  109. package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
  110. package/types/components/FAB/FAB.d.ts +0 -0
  111. package/types/components/FAB/StyledFAB.d.ts +0 -0
  112. package/types/components/FAB/index.d.ts +0 -0
  113. package/types/components/Icon/AnimatedIcon.d.ts +0 -0
  114. package/types/components/Icon/HeroIcon/index.d.ts +0 -0
  115. package/types/components/Icon/IconList.d.ts +0 -0
  116. package/types/components/Icon/index.d.ts +0 -0
  117. package/types/components/Icon/utils.d.ts +0 -0
  118. package/types/components/Image/index.d.ts +0 -0
  119. package/types/components/List/BasicListItem.d.ts +0 -0
  120. package/types/components/List/ListItem.d.ts +0 -0
  121. package/types/components/List/StyledBasicListItem.d.ts +0 -0
  122. package/types/components/List/StyledListItem.d.ts +0 -0
  123. package/types/components/List/index.d.ts +0 -0
  124. package/types/components/PageControl/StyledPageControl.d.ts +0 -0
  125. package/types/components/PageControl/index.d.ts +0 -0
  126. package/types/components/PinInput/PinCell.d.ts +0 -0
  127. package/types/components/PinInput/StyledPinInput.d.ts +0 -0
  128. package/types/components/PinInput/index.d.ts +0 -0
  129. package/types/components/Progress/ProgressBar.d.ts +0 -0
  130. package/types/components/Progress/ProgressCircle.d.ts +0 -0
  131. package/types/components/Progress/StyledProgressBar.d.ts +0 -0
  132. package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
  133. package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
  134. package/types/components/Progress/constants.d.ts +0 -0
  135. package/types/components/Progress/index.d.ts +0 -0
  136. package/types/components/Progress/types.d.ts +0 -0
  137. package/types/components/Radio/Radio.d.ts +0 -0
  138. package/types/components/Radio/RadioGroup.d.ts +0 -0
  139. package/types/components/Radio/StyledRadio.d.ts +0 -0
  140. package/types/components/Radio/index.d.ts +0 -0
  141. package/types/components/Radio/types.d.ts +0 -0
  142. package/types/components/RefreshControl/index.d.ts +0 -0
  143. package/types/components/RichTextEditor/EditorEvent.d.ts +0 -0
  144. package/types/components/RichTextEditor/EditorToolbar.d.ts +0 -0
  145. package/types/components/RichTextEditor/MentionList.d.ts +0 -0
  146. package/types/components/RichTextEditor/RichTextEditor.d.ts +0 -0
  147. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -0
  148. package/types/components/RichTextEditor/StyledToolbar.d.ts +0 -0
  149. package/types/components/RichTextEditor/__mocks__/heroEditorApp.d.ts +0 -0
  150. package/types/components/RichTextEditor/constants.d.ts +0 -0
  151. package/types/components/RichTextEditor/heroEditorApp.d.ts +0 -0
  152. package/types/components/RichTextEditor/index.d.ts +0 -0
  153. package/types/components/RichTextEditor/types.d.ts +0 -0
  154. package/types/components/RichTextEditor/utils/events.d.ts +0 -0
  155. package/types/components/RichTextEditor/utils/rnWebView.d.ts +0 -0
  156. package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
  157. package/types/components/SectionHeading/index.d.ts +0 -0
  158. package/types/components/Select/BaseOptionList.d.ts +0 -0
  159. package/types/components/Select/Footer.d.ts +0 -0
  160. package/types/components/Select/MultiSelect/Option.d.ts +0 -0
  161. package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
  162. package/types/components/Select/MultiSelect/index.d.ts +0 -0
  163. package/types/components/Select/SingleSelect/Option.d.ts +0 -0
  164. package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
  165. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +0 -0
  166. package/types/components/Select/SingleSelect/index.d.ts +0 -0
  167. package/types/components/Select/StyledSelect.d.ts +0 -0
  168. package/types/components/Select/helpers.d.ts +0 -0
  169. package/types/components/Select/index.d.ts +0 -0
  170. package/types/components/Select/types.d.ts +0 -0
  171. package/types/components/Skeleton/StyledSkeleton.d.ts +0 -0
  172. package/types/components/Skeleton/index.d.ts +0 -0
  173. package/types/components/Slider/index.d.ts +0 -0
  174. package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
  175. package/types/components/Spinner/StyledSpinner.d.ts +0 -0
  176. package/types/components/Spinner/index.d.ts +0 -0
  177. package/types/components/Success/StyledSuccess.d.ts +0 -0
  178. package/types/components/Success/index.d.ts +0 -0
  179. package/types/components/Swipeable/StyledSwipeable.d.ts +0 -0
  180. package/types/components/Swipeable/SwipeableAction.d.ts +0 -0
  181. package/types/components/Swipeable/index.d.ts +0 -0
  182. package/types/components/Switch/SelectorSwitch/Option.d.ts +0 -0
  183. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +0 -0
  184. package/types/components/Switch/SelectorSwitch/index.d.ts +0 -0
  185. package/types/components/Switch/StyledSwitch.d.ts +0 -0
  186. package/types/components/Switch/index.d.ts +0 -0
  187. package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
  188. package/types/components/Tabs/SceneView.d.ts +0 -0
  189. package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
  190. package/types/components/Tabs/ScrollableTabsHeader.d.ts +0 -0
  191. package/types/components/Tabs/ScrollableTabsV2/SceneView.d.ts +10 -0
  192. package/types/components/Tabs/ScrollableTabsV2/ScrollableTabsV2.d.ts +9 -0
  193. package/types/components/Tabs/ScrollableTabsV2/index.d.ts +4 -0
  194. package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
  195. package/types/components/Tabs/StyledTabs.d.ts +0 -0
  196. package/types/components/Tabs/TabWithBadge.d.ts +0 -0
  197. package/types/components/Tabs/index.d.ts +0 -0
  198. package/types/components/Tabs/useIsFocused.d.ts +0 -0
  199. package/types/components/Tabs/utils.d.ts +0 -0
  200. package/types/components/Tag/StyledTag.d.ts +0 -0
  201. package/types/components/Tag/index.d.ts +0 -0
  202. package/types/components/TextInput/StyledTextInput.d.ts +0 -0
  203. package/types/components/TextInput/index.d.ts +0 -0
  204. package/types/components/TimePicker/StyledTimePicker.d.ts +0 -0
  205. package/types/components/TimePicker/TimePickerAndroid.d.ts +0 -0
  206. package/types/components/TimePicker/TimePickerIOS.d.ts +0 -0
  207. package/types/components/TimePicker/index.d.ts +0 -0
  208. package/types/components/TimePicker/types.d.ts +0 -0
  209. package/types/components/Toast/StyledToast.d.ts +0 -0
  210. package/types/components/Toast/Toast.d.ts +0 -0
  211. package/types/components/Toast/ToastContainer.d.ts +0 -0
  212. package/types/components/Toast/ToastContext.d.ts +0 -0
  213. package/types/components/Toast/ToastProvider.d.ts +0 -0
  214. package/types/components/Toast/index.d.ts +0 -0
  215. package/types/components/Toast/types.d.ts +0 -0
  216. package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
  217. package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
  218. package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
  219. package/types/components/Toolbar/index.d.ts +0 -0
  220. package/types/components/Typography/Text/StyledText.d.ts +0 -0
  221. package/types/components/Typography/Text/index.d.ts +0 -0
  222. package/types/components/Typography/index.d.ts +0 -0
  223. package/types/index.d.ts +0 -0
  224. package/types/testHelpers/renderWithTheme.d.ts +0 -0
  225. package/types/theme/ThemeProvider.d.ts +0 -0
  226. package/types/theme/ThemeSwitcher.d.ts +0 -0
  227. package/types/theme/components/accordion.d.ts +0 -0
  228. package/types/theme/components/alert.d.ts +0 -0
  229. package/types/theme/components/attachment.d.ts +0 -0
  230. package/types/theme/components/avatar.d.ts +0 -0
  231. package/types/theme/components/badge.d.ts +0 -0
  232. package/types/theme/components/bottomNavigation.d.ts +0 -0
  233. package/types/theme/components/bottomSheet.d.ts +0 -0
  234. package/types/theme/components/button.d.ts +0 -0
  235. package/types/theme/components/calendar.d.ts +0 -0
  236. package/types/theme/components/card.d.ts +0 -0
  237. package/types/theme/components/cardCarousel.d.ts +0 -0
  238. package/types/theme/components/carousel.d.ts +0 -0
  239. package/types/theme/components/checkbox.d.ts +0 -0
  240. package/types/theme/components/contentNavigator.d.ts +0 -0
  241. package/types/theme/components/datePicker.d.ts +0 -0
  242. package/types/theme/components/divider.d.ts +0 -0
  243. package/types/theme/components/drawer.d.ts +0 -0
  244. package/types/theme/components/empty.d.ts +0 -0
  245. package/types/theme/components/error.d.ts +0 -0
  246. package/types/theme/components/fab.d.ts +0 -0
  247. package/types/theme/components/icon.d.ts +0 -0
  248. package/types/theme/components/image.d.ts +0 -0
  249. package/types/theme/components/list.d.ts +0 -0
  250. package/types/theme/components/pageControl.d.ts +0 -0
  251. package/types/theme/components/pinInput.d.ts +0 -0
  252. package/types/theme/components/progress.d.ts +0 -0
  253. package/types/theme/components/radio.d.ts +0 -0
  254. package/types/theme/components/refreshControl.d.ts +0 -0
  255. package/types/theme/components/richTextEditor.d.ts +0 -0
  256. package/types/theme/components/sectionHeading.d.ts +0 -0
  257. package/types/theme/components/select.d.ts +0 -0
  258. package/types/theme/components/skeleton.d.ts +0 -0
  259. package/types/theme/components/slider.d.ts +0 -0
  260. package/types/theme/components/spinner.d.ts +0 -0
  261. package/types/theme/components/success.d.ts +0 -0
  262. package/types/theme/components/swipeable.d.ts +0 -0
  263. package/types/theme/components/switch.d.ts +1 -1
  264. package/types/theme/components/tabs.d.ts +0 -0
  265. package/types/theme/components/tag.d.ts +0 -0
  266. package/types/theme/components/textInput.d.ts +0 -0
  267. package/types/theme/components/timePicker.d.ts +0 -0
  268. package/types/theme/components/toast.d.ts +0 -0
  269. package/types/theme/components/toolbar.d.ts +0 -0
  270. package/types/theme/components/typography.d.ts +0 -0
  271. package/types/theme/getTheme.d.ts +0 -0
  272. package/types/theme/global/borders.d.ts +0 -0
  273. package/types/theme/global/colors/eBens.d.ts +0 -0
  274. package/types/theme/global/colors/global.d.ts +0 -0
  275. package/types/theme/global/colors/globalDark.d.ts +0 -0
  276. package/types/theme/global/colors/jobs.d.ts +0 -0
  277. package/types/theme/global/colors/swag.d.ts +0 -0
  278. package/types/theme/global/colors/swagDark.d.ts +0 -0
  279. package/types/theme/global/colors/types.d.ts +0 -0
  280. package/types/theme/global/colors/wallet.d.ts +0 -0
  281. package/types/theme/global/colors/work.d.ts +0 -0
  282. package/types/theme/global/index.d.ts +0 -0
  283. package/types/theme/global/scale.d.ts +0 -0
  284. package/types/theme/global/sizes.d.ts +0 -0
  285. package/types/theme/global/space.d.ts +0 -0
  286. package/types/theme/global/typography.d.ts +0 -0
  287. package/types/theme/index.d.ts +0 -0
  288. package/types/types.d.ts +0 -0
  289. package/types/utils/functions.d.ts +0 -0
  290. package/types/utils/helpers.d.ts +0 -0
  291. package/types/utils/hooks.d.ts +0 -0
  292. package/types/utils/scale.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.34.2",
3
+ "version": "8.35.0-alpha.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,13 +21,13 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.34.2",
24
+ "@hero-design/colors": "8.34.1",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
28
28
  },
29
29
  "peerDependencies": {
30
- "@hero-design/react-native-month-year-picker": "^8.34.2",
30
+ "@hero-design/react-native-month-year-picker": "^8.34.1",
31
31
  "@react-native-community/datetimepicker": "^3.5.2",
32
32
  "@react-native-community/slider": "4.1.12",
33
33
  "react": "18.0.0",
@@ -47,8 +47,8 @@
47
47
  "@babel/preset-typescript": "^7.17.12",
48
48
  "@babel/runtime": "^7.18.9",
49
49
  "@emotion/jest": "^11.9.3",
50
- "@hero-design/eslint-plugin": "8.34.2",
51
- "@hero-design/react-native-month-year-picker": "^8.34.2",
50
+ "@hero-design/eslint-plugin": "8.34.1",
51
+ "@hero-design/react-native-month-year-picker": "^8.34.1",
52
52
  "@react-native-community/datetimepicker": "^3.5.2",
53
53
  "@react-native-community/slider": "4.1.12",
54
54
  "@rollup/plugin-babel": "^5.3.1",
@@ -64,10 +64,10 @@
64
64
  "@types/react-native": "^0.67.7",
65
65
  "@types/react-native-vector-icons": "^6.4.10",
66
66
  "babel-plugin-inline-import": "^3.0.0",
67
- "eslint-config-hd": "8.34.2",
67
+ "eslint-config-hd": "8.34.1",
68
68
  "eslint-plugin-import": "^2.27.5",
69
69
  "jest": "^27.3.1",
70
- "prettier-config-hd": "8.34.2",
70
+ "prettier-config-hd": "8.34.1",
71
71
  "react": "18.0.0",
72
72
  "react-native": "0.69.7",
73
73
  "react-native-gesture-handler": "~2.5.0",
@@ -82,5 +82,6 @@
82
82
  "rollup-plugin-flow": "^1.1.1",
83
83
  "ts-jest": "^27.0.7"
84
84
  },
85
- "prettier": "prettier-config-hd"
85
+ "prettier": "prettier-config-hd",
86
+ "react-native": "src/index.ts"
86
87
  }
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { Dimensions, View, ViewStyle } from 'react-native';
3
+ import { ModalHandler, showFABModal } from './ModalPresenter';
4
+
5
+ const wrapperStyle: ViewStyle = {
6
+ width: Dimensions.get('window').width,
7
+ height: Dimensions.get('window').height,
8
+ };
9
+
10
+ export interface ModalProps {
11
+ /**
12
+ * Content of the modal.
13
+ */
14
+ children: React.ReactElement;
15
+ /**
16
+ * Visibility of the modal
17
+ */
18
+ visible?: boolean;
19
+ /**
20
+ * Callback when the modal is shown.
21
+ */
22
+ onShow?: () => void;
23
+ /**
24
+ * TestID of the modal.
25
+ */
26
+ testID?: string;
27
+ }
28
+
29
+ const fABModal = ({ children, onShow, testID, visible = true }: ModalProps) => {
30
+ const [modalHandler, setModalHandler] = React.useState<ModalHandler>();
31
+
32
+ const getModalContent = React.useCallback(
33
+ () => (
34
+ <View pointerEvents="box-none" style={wrapperStyle} testID={testID}>
35
+ {children}
36
+ </View>
37
+ ),
38
+ [visible, children, onShow, testID]
39
+ );
40
+
41
+ React.useEffect(() => {
42
+ if (visible) {
43
+ // Modal does not exist, create a new one
44
+ if (!modalHandler) {
45
+ const newModalHandler = showFABModal(getModalContent());
46
+ setModalHandler(newModalHandler);
47
+
48
+ onShow?.();
49
+ }
50
+ // Modal already exists, update it
51
+ else {
52
+ modalHandler.update(getModalContent());
53
+ }
54
+ } else {
55
+ modalHandler?.dismiss();
56
+ setModalHandler(undefined);
57
+ }
58
+ }, [getModalContent]);
59
+
60
+ return null;
61
+ };
62
+
63
+ export default fABModal;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { StyleProp, View, ViewStyle } from 'react-native';
3
+
4
+ type ModalContentWrapperProps = {
5
+ children: React.ReactElement;
6
+ visible?: boolean;
7
+ testID?: string;
8
+ style?: StyleProp<ViewStyle>;
9
+ animated?: boolean;
10
+ pointerEvents: 'box-none' | 'none' | 'box-only' | 'auto';
11
+ };
12
+
13
+ export type ModalContentWrapperHandler = {
14
+ hide: (callback?: () => void) => void;
15
+ };
16
+
17
+ const FABModalContentWrapper = ({
18
+ children,
19
+ testID,
20
+ pointerEvents,
21
+ }: ModalContentWrapperProps) => {
22
+ return (
23
+ <View testID={testID} pointerEvents={pointerEvents}>
24
+ {children}
25
+ </View>
26
+ );
27
+ };
28
+
29
+ FABModalContentWrapper.displayName = 'FABModalContentWrapper';
30
+
31
+ export default FABModalContentWrapper;
@@ -0,0 +1,133 @@
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 Box from '../../../Box';
5
+
6
+ export type ModalPresenterHandles = {
7
+ animatedOut: (completion?: () => void) => void;
8
+ };
9
+ export type FABModalDismissFunc = (onDismiss?: () => void) => void;
10
+ export type FABModalUpdateFunc = (content: React.ReactNode) => void;
11
+
12
+ /**
13
+ * Modal handler is returned by `showModal` function.
14
+ */
15
+ export type FABModalHandler = {
16
+ /**
17
+ * Same `dismiss` function as in `ModalContentProps`.
18
+ */
19
+ dismiss: FABModalDismissFunc;
20
+ /**
21
+ * Same `update` function as in `ModalContentProps`.
22
+ */
23
+ update: FABModalUpdateFunc;
24
+ };
25
+
26
+ const FABModalPresenter = forwardRef<ModalPresenterHandles, ViewProps>(
27
+ ({ style, children, ...props }, ref) => {
28
+ const animatedOpacity = useRef(new Animated.Value(0));
29
+
30
+ React.useEffect(() => {
31
+ Animated.spring(animatedOpacity.current, {
32
+ toValue: 1,
33
+ useNativeDriver: true,
34
+ }).start();
35
+ }, []);
36
+
37
+ React.useImperativeHandle(ref, () => ({
38
+ animatedOut: (completion?: () => void) => {
39
+ Animated.spring(animatedOpacity.current, {
40
+ toValue: 0,
41
+ useNativeDriver: true,
42
+ }).start(() => {
43
+ completion?.();
44
+ });
45
+ },
46
+ }));
47
+
48
+ return (
49
+ <Box style={StyleSheet.absoluteFill} pointerEvents="box-none">
50
+ <Animated.View
51
+ style={[
52
+ {
53
+ width: '100%',
54
+ height: '100%',
55
+ justifyContent: 'center',
56
+ alignItems: 'center',
57
+ opacity: animatedOpacity.current,
58
+ },
59
+ style,
60
+ ]}
61
+ {...props}
62
+ pointerEvents="box-none"
63
+ >
64
+ {children}
65
+ </Animated.View>
66
+ </Box>
67
+ );
68
+ }
69
+ );
70
+
71
+ /**
72
+ * Present a modal on screen immediately.
73
+ *
74
+ * The new presented modal will be on top of existing modals if there are any.
75
+ *
76
+ * @param Content A component to be presented as a modal on screen.
77
+ * This component will be centered horizontally and vertically on screen with
78
+ * a semitransparent black overlay underneath.
79
+ * @param contentProps Props for this modal component.
80
+ * @returns A `ModalHandler` you can use to dismiss the modal.
81
+ */
82
+
83
+ export const showFABModal = (content: React.ReactNode): FABModalHandler => {
84
+ let ref: ModalPresenterHandles | null = null;
85
+ let rootSiblings: RootSiblings | null = null;
86
+
87
+ const dismiss: FABModalDismissFunc = (onDismiss) => {
88
+ if (rootSiblings) {
89
+ const cleanup = () => {
90
+ rootSiblings?.destroy();
91
+ rootSiblings = null;
92
+ ref = null;
93
+ onDismiss?.();
94
+ };
95
+
96
+ if (ref) {
97
+ ref.animatedOut(cleanup);
98
+ } else {
99
+ cleanup();
100
+ }
101
+ }
102
+ };
103
+
104
+ const update: FABModalUpdateFunc = (newContent) => {
105
+ rootSiblings?.update(
106
+ <FABModalPresenter
107
+ ref={(_ref) => {
108
+ ref = _ref;
109
+ }}
110
+ >
111
+ {newContent}
112
+ </FABModalPresenter>
113
+ );
114
+ };
115
+
116
+ rootSiblings = new RootSiblings(
117
+ (
118
+ <FABModalPresenter
119
+ ref={(_ref) => {
120
+ ref = _ref;
121
+ }}
122
+ >
123
+ {content}
124
+ </FABModalPresenter>
125
+ )
126
+ );
127
+
128
+ return { dismiss, update };
129
+ };
130
+
131
+ FABModalPresenter.displayName = 'FABModalPresenter';
132
+
133
+ export default FABModalPresenter;
@@ -0,0 +1,13 @@
1
+ import {
2
+ FABModalDismissFunc,
3
+ FABModalHandler,
4
+ showFABModal,
5
+ ModalPresenterHandles,
6
+ } from './ModalPresenter';
7
+
8
+ export type {
9
+ FABModalDismissFunc as ModalDismissFunc,
10
+ FABModalHandler as ModalHandler,
11
+ ModalPresenterHandles,
12
+ };
13
+ export { showFABModal };
@@ -14,6 +14,7 @@ import {
14
14
 
15
15
  import Box from '../../Box';
16
16
  import { FABHandles } from '../FAB';
17
+ import FABModal from './FABModal';
17
18
 
18
19
  export type ActionGroupHandles = {
19
20
  showFAB: () => void;
@@ -31,7 +32,6 @@ export interface ActionGroupProps {
31
32
  * This function is called on pressing the FAB button.
32
33
  * */
33
34
  onPress?: () => void;
34
-
35
35
  /**
36
36
  * Specify if the FAB button is in active state and the action group is shown.
37
37
  * */
@@ -124,51 +124,53 @@ const ActionGroup = forwardRef<ActionGroupHandles, ActionGroupProps>(
124
124
  });
125
125
 
126
126
  return (
127
- <StyledContainer testID={testID} pointerEvents="box-none" style={style}>
128
- <StyledBackdrop
129
- pointerEvents={active ? 'auto' : 'box-none'}
130
- testID="back-drop"
131
- style={{ opacity: interpolatedBackdropOpacityAnimation }}
132
- />
133
- <StyledActionGroupContainer
134
- pointerEvents={active ? 'auto' : 'none'}
135
- testID="action-group"
136
- style={{
137
- opacity: interpolatedActionGroupOpacityAnimation,
138
- }}
139
- >
140
- {!!headerTitle && (
141
- <Animated.View
142
- style={{ transform: [{ translateY: titleTranslateY }] }}
143
- >
144
- <StyledHeaderText testID="header-text" level="h4">
145
- {headerTitle}
146
- </StyledHeaderText>
147
- </Animated.View>
148
- )}
149
-
150
- <Box style={[style, { paddingBottom: 0 }]}>
151
- {items?.map((itemProp, index) => (
152
- <ActionItem
153
- key={itemProp.key || `${itemProp.icon}_${itemProp.title}`}
154
- {...itemProp}
155
- index={active ? index : items.length - index}
156
- active={active}
157
- />
158
- ))}
159
- </Box>
160
- </StyledActionGroupContainer>
161
-
162
- <StyledFAB
163
- testID="fab"
164
- icon={fabIcon}
165
- onPress={onPress}
166
- animated
167
- active={active}
168
- title={fabTitle}
169
- ref={fabRef}
170
- />
171
- </StyledContainer>
127
+ <FABModal>
128
+ <StyledContainer testID={testID} pointerEvents="box-none" style={style}>
129
+ <StyledBackdrop
130
+ pointerEvents={active ? 'auto' : 'box-none'}
131
+ testID="back-drop"
132
+ style={{ opacity: interpolatedBackdropOpacityAnimation }}
133
+ />
134
+ <StyledActionGroupContainer
135
+ pointerEvents={active ? 'auto' : 'none'}
136
+ testID="action-group"
137
+ style={{
138
+ opacity: interpolatedActionGroupOpacityAnimation,
139
+ }}
140
+ >
141
+ {!!headerTitle && (
142
+ <Animated.View
143
+ style={{ transform: [{ translateY: titleTranslateY }] }}
144
+ >
145
+ <StyledHeaderText testID="header-text" level="h4">
146
+ {headerTitle}
147
+ </StyledHeaderText>
148
+ </Animated.View>
149
+ )}
150
+
151
+ <Box style={[style, { paddingBottom: 0 }]}>
152
+ {items?.map((itemProp, index) => (
153
+ <ActionItem
154
+ key={itemProp.key || `${itemProp.icon}_${itemProp.title}`}
155
+ {...itemProp}
156
+ index={active ? index : items.length - index}
157
+ active={active}
158
+ />
159
+ ))}
160
+ </Box>
161
+ </StyledActionGroupContainer>
162
+
163
+ <StyledFAB
164
+ testID="fab"
165
+ icon={fabIcon}
166
+ onPress={onPress}
167
+ animated
168
+ active={active}
169
+ title={fabTitle}
170
+ ref={fabRef}
171
+ />
172
+ </StyledContainer>
173
+ </FABModal>
172
174
  );
173
175
  }
174
176
  );
@@ -13,7 +13,6 @@ const StyledWrapper = styled(View)<ViewProps & { themeIntent: ThemeIntent }>(
13
13
  THEME_INTENT_MAP[themeIntent]
14
14
  ],
15
15
  overflow: 'hidden',
16
- borderRadius: theme.__hd__.progress.radii.default,
17
16
  })
18
17
  );
19
18
 
@@ -7,8 +7,7 @@ exports[`Progress.Bar renders correctly 1`] = `
7
7
  Object {
8
8
  "alignSelf": "stretch",
9
9
  "backgroundColor": "#e8e9ea",
10
- "borderRadius": 999,
11
- "height": 8,
10
+ "height": 4,
12
11
  "overflow": "hidden",
13
12
  },
14
13
  undefined,
@@ -46,8 +45,7 @@ exports[`Progress.Bar renders correctly with intent 1`] = `
46
45
  Object {
47
46
  "alignSelf": "stretch",
48
47
  "backgroundColor": "#e8e9ea",
49
- "borderRadius": 999,
50
- "height": 8,
48
+ "height": 4,
51
49
  "overflow": "hidden",
52
50
  },
53
51
  undefined,
@@ -112,7 +110,7 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
112
110
  Object {
113
111
  "borderColor": "#5ace7d",
114
112
  "borderRadius": 999,
115
- "borderWidth": 8,
113
+ "borderWidth": 4,
116
114
  "height": 72,
117
115
  "width": 72,
118
116
  },
@@ -163,7 +161,7 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
163
161
  Object {
164
162
  "borderColor": "#e8e9ea",
165
163
  "borderRadius": 999,
166
- "borderWidth": 8,
164
+ "borderWidth": 4,
167
165
  "height": 72,
168
166
  "width": 72,
169
167
  },
@@ -206,7 +204,7 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
206
204
  Object {
207
205
  "borderColor": "#5ace7d",
208
206
  "borderRadius": 999,
209
- "borderWidth": 8,
207
+ "borderWidth": 4,
210
208
  "height": 72,
211
209
  "width": 72,
212
210
  },
@@ -258,7 +256,7 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
258
256
  Object {
259
257
  "borderColor": "#e8e9ea",
260
258
  "borderRadius": 999,
261
- "borderWidth": 8,
259
+ "borderWidth": 4,
262
260
  "height": 72,
263
261
  "width": 72,
264
262
  },
@@ -276,11 +274,11 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
276
274
  Object {
277
275
  "backgroundColor": "#5ace7d",
278
276
  "borderRadius": 999,
279
- "height": 8,
280
- "left": 32,
277
+ "height": 4,
278
+ "left": 34,
281
279
  "position": "absolute",
282
280
  "top": 0,
283
- "width": 8,
281
+ "width": 4,
284
282
  "zIndex": 2,
285
283
  },
286
284
  undefined,
@@ -312,11 +310,11 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
312
310
  Object {
313
311
  "backgroundColor": "#5ace7d",
314
312
  "borderRadius": 999,
315
- "height": 8,
316
- "left": 32,
313
+ "height": 4,
314
+ "left": 34,
317
315
  "position": "absolute",
318
316
  "top": 0,
319
- "width": 8,
317
+ "width": 4,
320
318
  "zIndex": 2,
321
319
  },
322
320
  undefined,
@@ -331,12 +329,12 @@ exports[`Progress.Circle allows to custom value renderer 1`] = `
331
329
  Object {
332
330
  "alignItems": "center",
333
331
  "borderRadius": 999,
334
- "height": 56,
332
+ "height": 64,
335
333
  "justifyContent": "center",
336
- "left": 8,
334
+ "left": 4,
337
335
  "position": "absolute",
338
- "top": 8,
339
- "width": 56,
336
+ "top": 4,
337
+ "width": 64,
340
338
  "zIndex": 3,
341
339
  },
342
340
  undefined,
@@ -402,7 +400,7 @@ exports[`Progress.Circle renders correctly 1`] = `
402
400
  Object {
403
401
  "borderColor": "#401960",
404
402
  "borderRadius": 999,
405
- "borderWidth": 8,
403
+ "borderWidth": 4,
406
404
  "height": 72,
407
405
  "width": 72,
408
406
  },
@@ -453,7 +451,7 @@ exports[`Progress.Circle renders correctly 1`] = `
453
451
  Object {
454
452
  "borderColor": "#e8e9ea",
455
453
  "borderRadius": 999,
456
- "borderWidth": 8,
454
+ "borderWidth": 4,
457
455
  "height": 72,
458
456
  "width": 72,
459
457
  },
@@ -496,7 +494,7 @@ exports[`Progress.Circle renders correctly 1`] = `
496
494
  Object {
497
495
  "borderColor": "#401960",
498
496
  "borderRadius": 999,
499
- "borderWidth": 8,
497
+ "borderWidth": 4,
500
498
  "height": 72,
501
499
  "width": 72,
502
500
  },
@@ -548,7 +546,7 @@ exports[`Progress.Circle renders correctly 1`] = `
548
546
  Object {
549
547
  "borderColor": "#e8e9ea",
550
548
  "borderRadius": 999,
551
- "borderWidth": 8,
549
+ "borderWidth": 4,
552
550
  "height": 72,
553
551
  "width": 72,
554
552
  },
@@ -566,11 +564,11 @@ exports[`Progress.Circle renders correctly 1`] = `
566
564
  Object {
567
565
  "backgroundColor": "#401960",
568
566
  "borderRadius": 999,
569
- "height": 8,
570
- "left": 32,
567
+ "height": 4,
568
+ "left": 34,
571
569
  "position": "absolute",
572
570
  "top": 0,
573
- "width": 8,
571
+ "width": 4,
574
572
  "zIndex": 2,
575
573
  },
576
574
  undefined,
@@ -602,11 +600,11 @@ exports[`Progress.Circle renders correctly 1`] = `
602
600
  Object {
603
601
  "backgroundColor": "#401960",
604
602
  "borderRadius": 999,
605
- "height": 8,
606
- "left": 32,
603
+ "height": 4,
604
+ "left": 34,
607
605
  "position": "absolute",
608
606
  "top": 0,
609
- "width": 8,
607
+ "width": 4,
610
608
  "zIndex": 2,
611
609
  },
612
610
  undefined,
@@ -621,12 +619,12 @@ exports[`Progress.Circle renders correctly 1`] = `
621
619
  Object {
622
620
  "alignItems": "center",
623
621
  "borderRadius": 999,
624
- "height": 56,
622
+ "height": 64,
625
623
  "justifyContent": "center",
626
- "left": 8,
624
+ "left": 4,
627
625
  "position": "absolute",
628
- "top": 8,
629
- "width": 56,
626
+ "top": 4,
627
+ "width": 64,
630
628
  "zIndex": 3,
631
629
  },
632
630
  undefined,
@@ -692,7 +690,7 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
692
690
  Object {
693
691
  "borderColor": "#5ace7d",
694
692
  "borderRadius": 999,
695
- "borderWidth": 8,
693
+ "borderWidth": 4,
696
694
  "height": 72,
697
695
  "width": 72,
698
696
  },
@@ -743,7 +741,7 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
743
741
  Object {
744
742
  "borderColor": "#e8e9ea",
745
743
  "borderRadius": 999,
746
- "borderWidth": 8,
744
+ "borderWidth": 4,
747
745
  "height": 72,
748
746
  "width": 72,
749
747
  },
@@ -786,7 +784,7 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
786
784
  Object {
787
785
  "borderColor": "#5ace7d",
788
786
  "borderRadius": 999,
789
- "borderWidth": 8,
787
+ "borderWidth": 4,
790
788
  "height": 72,
791
789
  "width": 72,
792
790
  },
@@ -838,7 +836,7 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
838
836
  Object {
839
837
  "borderColor": "#e8e9ea",
840
838
  "borderRadius": 999,
841
- "borderWidth": 8,
839
+ "borderWidth": 4,
842
840
  "height": 72,
843
841
  "width": 72,
844
842
  },
@@ -856,11 +854,11 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
856
854
  Object {
857
855
  "backgroundColor": "#5ace7d",
858
856
  "borderRadius": 999,
859
- "height": 8,
860
- "left": 32,
857
+ "height": 4,
858
+ "left": 34,
861
859
  "position": "absolute",
862
860
  "top": 0,
863
- "width": 8,
861
+ "width": 4,
864
862
  "zIndex": 2,
865
863
  },
866
864
  undefined,
@@ -892,11 +890,11 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
892
890
  Object {
893
891
  "backgroundColor": "#5ace7d",
894
892
  "borderRadius": 999,
895
- "height": 8,
896
- "left": 32,
893
+ "height": 4,
894
+ "left": 34,
897
895
  "position": "absolute",
898
896
  "top": 0,
899
- "width": 8,
897
+ "width": 4,
900
898
  "zIndex": 2,
901
899
  },
902
900
  undefined,
@@ -911,12 +909,12 @@ exports[`Progress.Circle renders correctly with intent 1`] = `
911
909
  Object {
912
910
  "alignItems": "center",
913
911
  "borderRadius": 999,
914
- "height": 56,
912
+ "height": 64,
915
913
  "justifyContent": "center",
916
- "left": 8,
914
+ "left": 4,
917
915
  "position": "absolute",
918
- "top": 8,
919
- "width": 56,
916
+ "top": 4,
917
+ "width": 64,
920
918
  "zIndex": 3,
921
919
  },
922
920
  undefined,